sentences:
How do audio based games such as Audiosurf and Beat Hazard work? Note: I am not asking how to make a clone of one of these. I am asking about how they work.

I'm sure everyone's seen the games where you use your own music files (or provided ones) and the games produce levels based on them, such as Audiosurf and Beat Hazard.

Here is a video of Audiosurf in action, to show what I mean.

If you provide a heavy metal song, you would get a completely different set of obstacles, enemies, and game experience from something like Vivaldi.

What does interest me is how these games work. I do not know much about audio (well, data-side), but how do they process the song to understand when it is settling down or when it's speeding up? I guess they could just feed the pitch values (assuming those sorts of things exist in audio files) to form a level, but it wouldn't fully explain it.

I'm either looking for an explanation, some links to articles about this sort of thing (I'm sure there's a term or terms for it), or even an open-source implementation of this kind of thing ;-)

EDIT: After some searching and a little help, I found out about FFT (Fast Fourier Transform). This maybe a step in the right direction, but it is something that does not make any sense to me..or fits with my physics knowledge of waves.

sentences: Game Design Schools in Canada I am a High School student in Ontario and i am trying looking for college/university programs the are specifically about game design. There are quite a few at most colleges near me, but they are all BA's and I am looking for a BSc. The only one i have been able to find is at digipen but that is across the continent and more importantly outrageously expensive. Does anyone know of and programs in Canada or the US that offer a BSc in Game design?

sentences:
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:
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:
Blender FBX exports to Unity3D have incomplete animation sequences Using Blender, I have rigged and animated this model with this attack action.

I exported this model to an FBX format and imported the said FBX file into my Unity3D project. However, when I imported it, I noticed that the animation sequence is incomplete:

As you can see, the sword does not animate correctly and remains unmoved in its original position.

In Blender, the sword and scabbard are animated in Pose mode with IK and other constraints. However, as I understand it, FBX bakes these constraints into the animation, so I'm not sure if that causes the issue.

Why is the sword not animating correctly? How do I fix this so that the Unity animation is 100% faithful to the Blender animation?

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:
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:
What is the most efficient way to render water? Would I create the water surface mesh in C++, and control the movement/animation in the CPU, and afterward apply any shaders (reflect/refraction/caustics/etc..).
Or should I only create the mesh in C++ and afterward control movement in the vertex shader?

It seems with the second approach, it would be more difficult to simulate more complex water models.

What is the most common approach in modern video games?

sentences:
C++ class hierarchy issue I am taking the step of moving on from Java over to c++, I have been working on my own custom game engine in java for a while so have a good understanding of polymophism, inheritance etc.

Now to the issue:

Currently I am working on a basic level format trying to get entities to render to the screen, this all goes well if i change the code to what i don't want it to be below is the code:

#include <SFML/Graphics.hpp>
#include "../Entities/Player.h"

#include "Layer.h"

class TileMap: public sf::Drawable, public sf::Transformable {
private:
    std::vector<Player> entities;
public:

    Player* addEntity(Player player) {
        entities.push_back(player);
        return &entities[entities.size() - 1];
    }

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

    virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const {
        for (unsigned int i = 0; i < entities.size(); i++) {
            target.draw(entities[i]);
        }
    }

};

The player that is returned in the function is then stored in a DrawableEntiity* player; variable. & this works fine everything updates

As I want a generalized list of entities and not a list for each entity i add to the game i want to be able to change this from

std::vector<Player> entities;

and change it too (obviously including the include for it too)

std::vector<DrawableEntity> entities;

The issue is everytime i store it this way the draw and update functions of the lower level Entity class isn't called and instead the default function inside of the DrawableEntity is called.

This is probably a easy mistake on something I've overlooked but i can't find anything online anywhere that fixes the issue. a full code listing of the Entity classes can be found at http://pastebin.com/3rRuzZHs

Thanks for taking your time to read this
Jordan

P.S: If you need any more information let me know.

sentences:
Strategy game tile and unit storage I've recently started working on a turn based strategy game much like games from the Fire Emblem or Final Fantasy Tactics series. However, I'm running into a few problems concerning the storage of the tile data and unit data. For example, just like in Fire Emblem I want to show all possible movement when you click on one of the units. Here is an image showing what I mean.

In this image the possible fields to move to have been indicated with a blue color. Fields that are in range for an attack have been indicated with the red color. Normally the tile the enemy unit is on would be in range to move to, however since there is someone standing on the tile the game has recognized that you can't move there.

I understand the need for an algorithm like Breadth-First Traversal to find out all possible fields to move to, but I'm unsure how to exclude fields occupied by an enemy. In order to avoid circular dependencies between fields and units I only store a reference to field in the unit class and not the other way around. So when I work my way through the fields to check all possible moves, how do I best find out if that field is actually valid?

I could of course just loop through the list of all enemies for each field that I process to see if it's occupied. Another way to potentially solve it would be to loop through the list of possible fields and removing fields occupied by enemies from that list, but I think that wouldn't work properly because occupied fields can also have the effect that empty fields around them are no longer reachable (due to the enemy blocking access to them). The easiest way to solve it would be to also store a reference to the unit within the field class. This would of course introduce a circular dependency.

I feel like there should be a much better solution than the ones I can think of, but I just can't figure it out.

Thanks in advance!

sentences:
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:
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:
Are mathematical models a good way to test strategy games? I am currently working on a simple strategy game. The game is a space exploration game where the player has to try to keep the game going for as long as possible to score as many points as possible. To go from planet to planet the player needs to use resource points; each explored planet also gives the player points (decreases gradually with time), yet a small expense in resource points is also added for each explored planet. Therefore, the player has to keep exploring to avoid running out of points.

The knowledge points allow the player to try to discover more planets, before exploring them.

I am looking for a methodical way to test the game. At the moment I keep adjusting the formulas used for the points given by each planet, or the expenses, or the travel/exploration costs, yet this trial and error method is pretty tedious and not really efficient. At the moment my "strategy" game seems more like a "click as much as you can" kind of game.

Since each type of planet has its own advantages and inconveniences, I'd really like that to show in the game play.

I was thinking of using mathematical models in Excel, by inputting all my formulas and adjusting the parameters there, but the more I think about it the more I think I will have to use some "randomness" to reflect the player choices, which defeats the purpose of testing the game for its "strategic" aspect.

Here's a screenshot of the game:

sentences:
Check every body's position and delete or not (box2d performance specific) I have a simple game with a platform (a ground that's not infinitely long). During the game I have about 10-30 balls on average that'll fall off the platform. There's gravity so I think they'll keep falling until the end of the game. My question is should I put a function that check if position within boundary in the render() function,  render() function is called in every frame. Or should I leave those balls falling. And let box2d keep on calculating their speed and velocity etc?

So basically I'm wondering which cost less, checking every body's position or calculating dropping object's velocity and position. I think they happen with same frequency, once per frame.

Or is this trivial for 10-30 balls and I can ignore it?

sentences:
How do I resolve asynchronous client actions against an authoritative server state? I have a multiplayer card game which I am in the process of developing.

The game is relatively simple; players have a certain number of cards which they can activate, sell, or use in various other ways.

The game isn't turn based.  Instead, it is asynchronous so that players (A, B, C, and D) all make their choices at the same time. Certain actions will affect the game state.  For example, removing a card from the game or adding a card to the game. Players should always be in sync with each other so that, for instance, Player A cannot use a card that Player B has just removed, as it is no longer present.

Obviously there are situations in which Player A may remove a card at nearly the same time that Player B tries to interact with the same card. How would the server handle this sort of situation?

My original thought is that each client could hash their game state and send it with their command to the server, for example:

Player A - #MYHASH# - Command = Pick Up Card Z

Player B - #MYHASH# - Command = Remove Card Z

The server would then action the first command and regenerate the hash. Upon trying to execute the second command it would notice the hash sent by Player B differs from the current hash, so the server would reject the request.

In the above example Player A would notice nothing and the game would continue normally, but Player B would have to be informed that their action failed.

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:
Why does my model render differently than its preview? I've been importing .fbx files that I made with 3DS Max 2012 into Unity, and it's quite neat to see my models running around in game. However, I can't help but notice that the models, as they're rendered in game, vary substantially from what they look like in the preview (and also what they looked like in 3DS Max).

Observe:

           In-Game                   Unity Preview            3DS Max

My gut tells me that I'm not setting up Unity's lighting system properly. What, then, do I need to do, to either my scene or my model, in order to get the left-most picture to look like the middle one?

sentences:
Spatial data visualization level of detail I have a 3D point cloud data set with different attributes that I visualize as points so far, and I want to have LOD based on distance from the set. I want to be able to have a generalized view from far away with fewer and larger points, and as I zoom in I want a more points correctly spaced out appearing automatically.

Kind of like this video below, behavior wise:
http://vimeo.com/61148577

I thought one solution would be to use an adaptive octree, but I'm not sure if that is a good solution. I've been looking into hierarchical clustering with seamless transitions, but I'm not sure which solution I should go with that fits my goal.

Any ideas, tips on where to start? Or some specific method?

Thanks

sentences: 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:
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:
Annoying snag when moving with dx and dy JAVA I am currently using a keyAdapter with detectors and when I move I change the value of dx and dy respectively. However if I move left then right or up then down quickly, the sprite won't move in the direction I last input. Does anyone know a fix?

Detector method:

@Override
public void keyPressed(KeyEvent e) {

    int key = e.getKeyCode();

    if (key == KeyEvent.VK_LEFT) {
        dx = -1;
    }

    if (key == KeyEvent.VK_RIGHT) {
        dx = 1;
    }

    if (key == KeyEvent.VK_UP) {
        dy = -1;
    }

    if (key == KeyEvent.VK_DOWN) {
        dy = 1;
    }
}

@Override
public void keyReleased(KeyEvent e) {

    int key = e.getKeyCode();

    if (key == KeyEvent.VK_LEFT) {
        dx = 0;
    }

    if (key == KeyEvent.VK_RIGHT) {
        dx = 0;
    }

    if (key == KeyEvent.VK_UP) {
        dy = 0;
    }

    if (key == KeyEvent.VK_DOWN) {
        dy = 0;
    }
}

Move method:

public void move(){
    worldX+=dx;
    worldY+=dy;
}

sentences:
How to create a 2D fog shader? I am trying to write a fragment shader in GLSL for a fog effect in a 2D game.

Here are some links showing what I'm after.

Here the fog is in the foreground and near the ground:

https://twitter.com/i/status/992811158318075904

Here the fog is on a background layer and fills the screen:

https://twitter.com/i/status/963889084337983488

Here the fog is more subtle and denser near the ground:

https://twitter.com/i/status/1001926421856563205

I am interested in learning how to create these effects. Unfortunately, I am pretty new to shaders and only know how to do elementary stuff like color swaps, outlines, and simple vignettes. It doesn't help that it's hard to find resources on shaders with a bent toward 2D.

In the environment in which I'm working, I can attach a shader script to any of my sprites, parallax background layers, etc.

Does anyone have advice on creating these kinds of effects?

sentences:
Unity 2019 build for Oculus Go not appearing on device My project was building fine in 2018 and showing up on my Go under "unknown sources".

My project builds fine in 2019 and it says it gets installed but it no longer shows up under "unknown sources" or anywhere else that I can see.

I can uninstall using adb - so it's there apparently, but where, and how can I launch it?

thanks

sentences: Can I integrate Unity 5 with the 0.6.0 runtime for Oculus DK2? I am a new user and I am trying to get the Oculus running on an old PC. I had a few issues with the latest SDK so I am currently using the 0.6.0.1-beta version. I would like to integrate Oculus with Unity. My question is whether I can use Unity 5 with the SDK 0.6.0.1-beta and which kind of integration should I use - or if I should download a previous release of Unity. Thank you!

sentences:
Rendering Unity across multiple monitors At the moment I am trying to get unity to run across 2 monitors. I've done some research and know that this is, strictly, possible. There is a workaround where you basically have to fluff your window size in order to get unity to render across both monitors.

What I've done is create a new custom screen resolution that takes in the width of both of my monitors, as seen in the following image, its the 3840 x 1080:

How ever, when I go to run my unity game exe that size isn't available. All I get is the following:

My custom size should be at the very bottom, but isn't. Is there something I haven't done, or missed, that will get unity to take in my custom screen size when it comes to running my game through its exe?

Oddly enough, inside the unity editor, my custom screen size is picked up and I can have it set to that in my game window:

Is there something that I have forgotten to do when I build and run the game from the file menu? Has someone ever beaten this issue before?

sentences: How to parent object to empty when looked at I am making a fps in unity. I have an empty parented to the camera for the gun, and I want to be able to pick up and drop guns found in the scene. Does anyone have a simple c # script that would allow the player to look at the gun on the ground, press a key and have it be parented to the empty? I would also like for the player's old gun to drop on the floor where the one being picked up was and un-parent from the empty when the new gun is picked up. If you want an example I guess you could say it is like halo where you can go around and pick up new guns. I am not looking to make an inventory, just a simple script where you can swap your weapon.

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:
Change value in arrays in array The title might be confusing and I don't think this short explanation is 100% accurate, but I will try my best to show the problem.
So I have this hierarchy:

And I want to change "measureOfTime" value in all subWave in wave[i], because I had no clue how to do this in a short way (at least I bet there is a shorter way) and I made this:
    using UnityEngine;

public class EnemySpawner : MonoBehaviour
{
    [Header("Set this value here to set time to 1 wave")]
    public float timeUntilWave;
    [Header("Measure Time basically = 0")]
    public Wave[] waves;
    public float waveTime;
    public bool roundStarted;
    public int wave;

    private void Start()
    {
        wave = -1;
        roundStarted = false;
    }
    private void Update()
    {
        if (timeUntilWave >= 0)
        {
            timeUntilWave = timeUntilWave - 1 * Time.deltaTime;
        }else if (timeUntilWave < 0)
        {
            roundStarted = true;
            wave++;
        }
        if (roundStarted == true)
        {
            waveTime = waveTime + 1 * Time.deltaTime;
            int subwaveLenght = waves[wave].subWave.Length;
            int count = 0;
            while (count <= subwaveLenght)
            {
                waves[wave].subWave[count].measureOfTime = waves[wave].subWave[count].measureOfTime + 1 * Time.deltaTime;
                count++;
            }
        }
    }
}

And in lines 33 and 37 I see an error: "IndexOutOfRangeException: Index was outside the bounds of the array."
And here are 2 questions:
Why those errors appear here?
Is there an easier way to raise the value in arrays in an array?
I hope it's not too confusing, and thanks for your help!

sentences:
Unity: Best Practise to apply Uniform Acceleration (regardless of direction) I have read a lot of other topics both on here, on the Unity forums and from Google searches that answer thing that are similar but not quite the same as my question.

My question:

I have a Unity project with a sphere, the sphere starts at a certain initial speed and I want the sphere to accelerate uniformly over time to reach its maximum speed, regardless of bounces and interactions.

Obviously an interaction will cause the Velocity to change, but I don't want the Speed to change.

I started off looking for a speed LERP, but come up with the below code.

I have negated and turned off all drag and friction settings on the gameobject.

My current code is thus (C#):

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour {
    public float accelerationSpeed = 10f;
    public float maximumSpeed = 25f;
    public float initialSpeed = 10f;
    private Rigidbody rb;
    private bool ballInPlay = false;

    // Use this for initialization
    void Awake () {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    //...other functions that don't relate to this question...

    void FixedUpdate ()
    {
        /***
         * Gradually increase ball speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude < maximumSpeed)
        {
             rb.AddForce(rb.velocity.normalized * accelerationSpeed, ForceMode.Acceleration);
        }

    }
}

This code takes ~3-4 seconds to accelerate the ball up to the maximum speed, and it seems to adequately bounce the ball off rigidbodies, as I want.

However, I will in time be having more things interacting with the ball including explosions and other actual Force values (such as Wind), so taking this into account; is this code the best way of applying a constant acceleration to a game object, regardless of its other behaviours and influences?

While the above may work I'm also looking for best practise as far as possible (and memory/processor efficiency if that's applicable).

While obviously there are going to be unknowns (as it's excessive to show you my whole project, just for this qustion), some guidance on best methods of approach to solving this as well as improving efficiency would be appreciated.

Many Thanks.

EDIT:
To clarify my exact question:
Is the code above best practise when applying uniform acceleration to the gameobject while dealing with the influence of additional Rigidbody.AddForce functions on the gameobject.

sentences:
Check if vertex is visible in shader Im trying to figure out when a vertex is visible from the main camera. I have this function:

bool in_frustum(float4x4 M, float4 p) {
            float4 Pclip = mul(M, float4(p.x, p.y, p.z, 1.0));
            return abs(Pclip.x) < Pclip.w &&
                abs(Pclip.y) < Pclip.w &&
                0 < Pclip.z &&
                Pclip.z < Pclip.w;
        }

I call it in the vertex shader, and it works fine. The problem is when I have multiple cameras, and I only want to know if it is within the frustum on one of the cameras. If the vertex is not visible from my target camera, I want all other cameras to render it (if it is visible) a particular way (for example red).

I am a little rusty on matrix transformations and the graphics pipeline, but maybe instead of passing UNITY_MVP_MATRIX into the in_frustum function, I need to pass in the MVP matrix of the target camera? Or maybe just the View of the target camera needs to be replaced in.

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:
What does the TextureRegion.flip() method do? I'm learning libgdx and don't understand the purpose of parameters passed to flip(boolean x, boolean y). For example, I have code like this:

texture = new Texture(Gdx.files.internal("data/texture.png"));
textureRegion = new TextureRegion(texture, 0, 0, 20, 20);
textureRegion.flip(false, false);

My TextureRegion is flipped when both parameters are true and not flipped when they are false. But why does it need two parameters when it could have only one? The documentation says nothing about that.

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:
Unity 'Collider.bounds.Intersects'. Does it handle rotation? You will probably laugh at my code here (and I would love to hear some completely different approaches to this problem if possible), but I've written this myself using the only logic I could come up with alone.
Basically I want to make a slope randomly covered with trees. The slope is a quad with a mesh collider (I've also tried Box), and the tree is a prefab with just a model and a collider.  I iterate through every possible tree location and give it a 0.25 chance of spawning a tree. This all works ok, but since the quad is not lying flat to any axis, I couldn't think how best to assign the Y-position value to my trees.
My idea was to simply drop the trees all from above and have them land in the quads collider. If I lay the quad flat my code will work fine, but as soon as I tilt the slope the collision is still detected. It seems as if its reading the top of the quads highest point and making a box around it all the way to the bottom.
This is the code:
        for (int i = 0; i < trees.Count; i++)
        {
            if (!trees[i].GetComponent<Collider>().bounds.Intersects(ski_slope.GetComponent<Collider>().bounds))
            {
                Debug.Log("moving tree");
                trees[i].transform.Translate(0, -0.2f, 0);

            }
        }

So really I think my use of the 'Intersects' function must be wrong.
I hope my description of the problem makes sense. Otherwise I can take some screenshots to try show it.
Thank you for any help.

sentences:
Pathing for 2D, sprite-based game I'm making a 2D, oblique-styled sprite based RPG. My game does not live in a 2D matrix (like Tetris), rather it's sprites animating over a tilemap. I am trying to set pathing rules for NPCs. I've considered a few methods to do this but am not sure on the path I should take (no pun intended).

The NPC's trajectory is set by calculating the angle between origin coordinates and next coordinates and moves at that angle. I'm sure this will lead to blocky movements as they move along an array of coordinates along their path.

So, to set pathing rules, I was considering the following approaches and would like some direction given my style of game:

Manually define coordinates: For each NPC, define a set of coordinates for a given destination (a destination location set in my game). This issue with this is it will get tedious to set all the coordinates along the path.
Pathing algorithm: I'd rather simply set the destination coordinates once, and perhaps use a pathing algorithm, such as Dijkstra's Algorithm, that the NPC can use to navigate the map. I am not sure if this will have any ability/effect on smoothing out the movement.

It was also suggested using the Rapidly Exploring Random Tree algorithm, but again... not sure if this is overkill for my game... and what the performance hit would be.

Here is a snapshot of my map. The red arrow is a sample path. The blue lines are collision rules defined around map objects.

I would love some guidance on this. I am not sure if something like a pathing algorithm is a) overkill my game, b) doesn't fit with my game style

sentences:
Multiplatform game, save game state and resume it on other platform This is for a personal and knowledge acquiring project.

I want to create a little TIC-TAC-TOE multiplatform game, app & web. The choosen technology for the app will be Android or Flutter and for the web Angular.

My doubt is, during a game if the user wants to change from the mobile version to the web version, how to resume or change the game to the web application? What would be the best way to save the game state and load it into the other platform? Having in consideration that the user will play only in one platform at a time, which is the best way to implement this restriction too?

Is this as simple and hard at the same time as implementing all controls in both platforms and storing all the data required in the database?

sentences:
Retain Position and Scale Values of Render Texture Canvas Elements to another Canvas Now the title might not be able to express the entirety of the question but here's my problem. In my main scene I have a camera and a canvas in overlay mode, let's call this "View A". In this view is a crosshair which position and size I want to manipulate depending on elements inside the canvas of "View B". "View B" is located in the main scene as a render texture it contains a camera and a canvas in camera space with another crosshair. Now what I want to do is the following: I'm trying to set the position and size of the crosshair in "View A" to practically overlap with the values of the crosshair in "View B", i.e. if the crosshair in "View B" is in the lower left corner of its screen I'd like the crosshair in "View A" to be in the same position with the same size but in the canvas of "View A".

What I'm currently capable of is setting the crosshair in "View A" to the same location as the crosshair in "View B" but only if the crosshair in "View B" is in its origin, as all I have to do in that case is to get the origin of the render texture quad in the screen space of "View A" canvas. I do this in the following way:
RectTransformUtility.ScreenPointToLocalPointInRectangle(CanvasTransform, CameraComponent.WorldToScreenPoint(RenderTextureQuadTransform.position), null, out Vector2 localPoint);
CursorTransform.localPosition = localPoint;

But now I'm stuck in figuring out how to get a scale factor that makes the crosshair in "View A" and "View B" look the same size and how to adjust the position of the crosshair in "View A" depending on the position of the crosshair in "View B".

sentences:
How can I scale by time a canvas scaler > scaler factor float value from 0.01 to 1? The minimum is 0.01f the maximum I want it to be is 1
I want that when I start a Coroutine to be able to decide the time it will take to change the value to 1 and also the direction if from 0.01 to 1 or from 1 to 0.01
I tried this :
if (buttonType == "LoadGame")
        {
            StartCoroutine(DisplaySavedGamesWindow(5f, true));
        }

And
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float scaler = GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor;

        float currentTime = 0;
        while (currentTime < time)
        {
            scaler = currentTime / time;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

I used a break point on the line :
scaler = currentTime / time;

I see that scaler is changing up to 1 or to 0.9 ot sure why it's not getting to 1
And also it's not changing the value to 0.9 or to 1 in the editor in the scale factor it's still 0.01
Also how to use the bool flag ? true should be from 0.01 to 1 and false from 1 to 0.01
Ok I managed to make it working to be changed up from 0.01 to 1 :
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float currentTime = 0;
        while (currentTime < time)
        {
            var scaler = currentTime / time;
            GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor = scaler;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

The problem now is that when it's changing the value from the script the result is gray.
This is how it looks like when I'm changing it to 1 in the editor :
You can see the blue scroll view on the left :

but when it's changing the value from the script the result is gray scroll view and not blue like before :

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 to use Tiled Editor to recreate a 2D map? Alright, to familiarize ourselves with the Tiled Editor, the teacher asked us to replicate a tile-based map of a 2D platformer.

He gave us pretty much these two things:

1.) A selection of maps to copy from (Choose one map to copy)

2.) A folder with subfolders that contains 16x16 images on each subfolder (tiles)

Naturally, I started by importing the images from the folders by clicking on each folder, and importing each collection, which takes a long amount of time..(also considering the tiles for the other maps are mixed in here as well)

I used the png image as a transparent backdrop to help me place the tiles, then started placing tiles, which again, took a lot of time...

More than halfway there, I realized the width I set the map when I created it wasn't enough and tried to change the option under properties but it was grayed out. I also tried creating a new map and copying and pasting from my original one but that one doesn't seem to work either.

Is there a way to speed up the process a little bit? or salvage the tmx file?
Considering that he might ask us to create more maps later on, I'd like to be a bit informed...

I've also looked up the possibility of importing the image itself, slicing it to the desired tile size and removing duplicate tiles. This way I can simply import the map png and have the software only create tiles that are used in the level.

Can this be done?

sentences:
Game development for multiple Microsoft platforms I intend to develop games for Microsoft's Windows Store, however, I'm confused between their platforms, so please clarify those questions:

Is there any technology (XNA, DirectX), so a game can be distributed to Xbox360, Windows Store, Windows Phone?
What are the differences between Xbox360 and Windows?
What is a good approach for 2D games?
Does a Windows Store game work for Windows Phone just by recompiling it?
Are the Windows Store and Windows Phone store separated?

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:
Infinite terrain generation performance: one big heightmap or several smaller heightmap? I'm generating a procedural terrain using (a home-made fBm based on) Perlin noise as heightmap. To make the terrain infinite, I redraw part of it while the camera moves.

There are two alternatives:

either have several (say 9) heightmap-textures and rotate them while the camera moves;
or have only one heightmap (say 9 times bigger) and redraw only part of it as necessary.

Note:

The two approaches redraw exactly the same amount of pixels each time.

But:

in the first case, I must bind 3 small textures and entirely redraw them to redraw a line of my grid;
in the second case, I bind the whole bigger texture and redraw only a line inside it.

Question: Should I expect one to be faster than the other? Does glBindTexture has higher cost for larger texture?

sentences:
Too much animation work for 2d characters. Creating 2d character animations by prerendering an animated 3d model? I've read a bit about creating assets for games and the consensus seems to be that 2D is cheaper than 3D in all aspects with the exception of character animation. That's caused by the need of redrawing every frame of an animation versus simply animating the skeleton of a model.

The cheapest solution seems to be making all the assets with lots of animations as 3d models and prerendering them to create sprite sheets, and leave the background and everything else that has few animations traditionally drawn.

How do I do it, what tools would be appropriate, whats the process and workflow? How does the pipeline for this work? Where could I learn more about doing something like this?

On the other hand, I'm afraid that such an approach greatly limits the available customisation of my characters - wouldnt such a thing mean that each combination of gear needs to have its own spritesheet? Doesnt that pump up my game size and memory footprint and slow it down due to slow disk access?

How viable is putting a 3d model in a isometric view 2d environment? Would that be a solution to the "lots of sprites" problem, if it exists? How would I go about that in Unity? Where could I learn about that approach?

I've looked at this question but it did'nt really help me, the answers are just vaugue suggestions, I want solutions and resources to learn how to implement those solutions.

EDIT:
I'll elaborate on why that question isnt the same as mine, because some of the commenters didnt get it. That post refers to a game called hero academy that has little to do with the isometric game I'm talking about - that one has a grid, does not use the 8 directions, does not adress the customisation of a character via gear etc. All in all it's totally another beast. As for my question, think Diablo II.

Out of the answers I found there it seemed like the answer referring to project zomboid might be on the right track for me, but I had doubts about the customisation and tons of sprites. So what am I asking here? Does the "project zomboid method" fit my needs (trying it out only to find out it doesnt work would be a waste of time) and if it does, how do I do that in Unity. Why didnt i phrase the question that way in the first place? To avoid the XY problem. Hope this clarifies well enough.

sentences:
Why is my sprite displayed offset from its Box2D body? I found out about this using a debug renderer. When the game starts, everything is in order. But when a collision happens, the sprite's rotation is way larger than its body. The sprite and body match when the body is completely horizontal.

The sprite's rotation origin seems far distant from where it should be. Here's my code:

Sprite sprite = data.sprite;
position = body.getPosition();
sprite.setPosition(
    position.x - sprite.getWidth()  / 2,
    position.y - sprite.getHeight() / 2
);
sprite.setOrigin(position.x, position.y);
sprite.setRotation(MathUtils.radiansToDegrees * body.getAngle());

As you can see, I am even trying to set center of its rotation with setOrigin without success. How can I fix this?

sentences:
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: How to discourage micromanagement in strategy games? When designing a strategy game (or one in a similar genre), how do you avoid having your players focus almost entirely on micromanagement? What should be done and what avoided in gameplay mechanics?

sentences:
How to create an even gamescore? Currently I'm doing an android game. My problem is the score. The game speeds up in every round and currently I'm counting the score like this:

private static final const int MAX_SCORE = 150;
private int countdown = 0;

public void scoreUpdate(){

   if(countdown <= 0){
      score = 0;
   }

   score += countdown;

   countdown = MAX_SCORE;
}

countdown gets constantly decreased in my game loop so the less time you take to react the more score you get. Every Tap you do correctly will start the next round and call scoreUpdate().

Problem now is, that the game is speeding up, so you only get good scores the further you play the game. Does anyone has a better method to count the score more evenly?

sentences:
How to import Blender mesh+rig separately from animations for generic rigs in Unity? Currently I'm creating mesh, rig and animations in Blender and export them together as an fbx file.
I know that importing animations separately works for humanoid meshes, but how to do this for  a generic rig?
 Why?
After importing a character, I have to add components to some bone game objects of the characters rig. Adding or changing animations of an already existing character currently requires me to reimport mesh+rig aswell as the animations and then add the components to those game objects again.
Also sometimes the reference of existing prefabs to the reimported mesh is lost and I have to add the mesh to those prefabs again, this might have been me doing somethin wrong though.

 Better solution?
I also thought about naming bones in blender in a certain way and have a script in Unity add these components, I would still prefer to import animations separately though.
Thank you in advance!

sentences:
Unity: Animation With Motion Now running in place I am new to unity.  I am trying to assemble a character that walks forward, stops, and walks forward again when I maneuver the joystick (ps4 controller) accordingly.

I have the whole thing pretty much set up...

However, my animations broke at some point.  Initially, when I added the animations to my character, the character moved with the animation according to the motion encoded in the animations (all of which were auto-rigged at Mixamo...so I am almost certain the bug is downstream in something I did or enabled somehow).

Now, every animation has the character running, turning, jumping etc. in place. Meanwhile, the animation subscreen (when I inspect the clip) shows the character running forward.   I tried implementing some fixes I found online;  I changed the root motion node to Root Transform, for instance...and that is when the most confusing thing happened: a few of the animations started working...but all of the animations showed the character running in place in the subscreen...so now I have no idea what is happening.

Additionally, the animation clips which do not move the character actually transform the character back to the starting position (actually, that isn't correct--I moved the character into the air to test this; the clips without motion transform the character back to the starting position on the ground).

I have disabled all scripts...so have I somehow broken the animations...??? Re-Importing the animations does not fix them either.

Here are the images of my character settings, then the controller, and then an animation clip which shows the character moving forward in the sub-clip and where motion information is clearly present...

sentences:
Calculations for a camera system I am building an interactive application in Starling for which a camera system is required. Since there is no existing camera system in flash and the addons for starling do not meet our requirements, I am writing my own. Basically, it moves and scales all assets depending on the position of the camera.

However, I am having trouble with zooming towards a specific point on the screen. Every object has a pivotpoint in the topleft corner - so it scales relative to the topleft corner. For all kinds of reasons, I cannot change the pivotpoint of the objects.

To compensate for this, the camera needs to move towards the point we want to zoom towards on the x/y-plane, but I cannot figure out how much it should move. Are there any known formulas for this? How do I calculate how the camera should move?

EDIT: I can actually move the pivotpoint to the center of the assets if that makes it much easier.

EDIT: This method is used on each sprite to update its position:

var zPos:Number = Number(this.z - Game.cameraZ);
var scale:Number = Game.focalLength / (Game.focalLength + zPos);
var correctedScale:Number = scale * (1 / (Game.focalLength / (Game.focalLength + this.z)));
this.scaleX = this.scaleY = correctedScale;
this.x = Game.cameraX * scale + this.defaultX * scale;
this.y = Game.cameraY * scale + this.defaultY * scale;

sentences:
Changing some color of a texture using C# in Unity It's almost 2 days that I'm looking for a way to do this in Unity using C#, but still no luck.

Imagine you have a texture with different colours (this texture can be a rug), and you just want to change the colour of the parts that you click on it. e.g. I click on blue and the blue part turn into yellow. take into consideration that the parts we click on it are irregular.

The images are png, but created in Photoshop using different layers. for example, in the following texture, we have 2 colours of pink and purple. if I click on purple I want it to become yellow, and if I click on pink I want it to become green

How can I do it in Unity C#?

Thanks for all your helps.

sentences:
Which Graphics/Geometry abstraction to choose? I've been thinking about the design for a browser app on the HTML5 canvas that simulates a 2D robot zooming around, sensing the world around it. I decided to do this from scratch just for fun. I need shapes, like polygons, circles, and lines in order to model the robot and the world it lives in. These shapes need to be drawn with different appearance attributes, like border/fill style/width/color. I also need to have geometry functions to detect intersections and containment for the robot's sensors and so that the robot doesn't go inside stuff.

One idea for functions is to have two totally separate libraries, one to implement graphics (like drawShape(context, shape)) and one for geometry operations (like shapeIntersectsShape(shape1, shape2)). Or, in a more object-oriented approach, the shape objects themselves could implement methods to do their own graphics (shape.draw(context)) and geometry operations (shape1.intersects(shape2)).

Then there is the data itself: whether the data to draw a shape and the data to do geometric operations on that shape should be encapsulated within the same object, or be separate structures (where one would contain the other, or both be contained inside another structure).

How do existing applications that do graphics/geometry stuff deal with this? Is there one model that is best, or is each good for certain applications? Should the fact that I'm using Javascript instead of a more classical language change how I approach the design?

sentences:
Best way to implement Finite State Machine for player character in Unity? I'd like to implement the player in my game as an FSM as described in this guide to programming patterns in games.

What is the best way to accomplish this? Should I implement each state as a monobehaviour with a state interface that can be enabled/disabled when the state transitions? Or would it better to the states as plain classes (with their own Update method) where the main player monobehaviour calls StateName.Update() from its own Update method (.e.g. void Update() { currentState.Update() })

sentences:
How Do I Play An AnimationClip I want to play an animation but it seems that in The new version of unity it is harder.  I have an AnimationClip but I don't know how to play it.  I have been looking at this for 2 hrs now and i cant get it to work.

using UnityEngine;
using System.Collections;

public class FPSCamera : MonoBehaviour {

public float lookSensitivity = 5;
private float xRotation;
private float yRotation;
private float currentRotationX;
private Animation walking;

void Start() {
    // DONT KNOW HOW TO FIND AND START WALKING ANIMATION
}
void Update() {
    yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
    xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
    xRotation = Mathf.Clamp(xRotation, -90, 90);
    transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
}
}

sentences:
Splitting a sprite sheet into sprites Each animation has its own sprite sheet. First I tried to give each sprite their own rectangle and do some calculations to make sure that the bottom left corner of each sprite would be at the same position as the default sprite's bottom left corner. But I discovered this doesn't work properly for some animations.

So I tried to give all sprites in a sprite sheet the rectangle of the sprite with the biggest dimensions. This works for each individual animation, but when changing from one animation to another the rectangle size changes, so it gives the same problem as the first method. Additionally, when flipping the character it's flipped around the center of the rectangle, not necessarily the character.

Now I'm thinking of using the second method, but for each animation defining a pivot point that the character will be flipped around and a sprite offset will be calculated in relation to the x and y distance between the pivot point of the default animation and the current one, so that the character center will always be at the same position. This is manual and thusly means more work and is prone to human error. Is this really the best method? It's certainly better than defining this offset manually for each sprite.

sentences:
Converting ARGB surface to NV12 surface I'm trying to use NVENC to encode some frames that I'm capturing from a game. I've hooked EndScene() and I can get the data from the backbuffer, which is in ARGB format.

Unfortunately, NVENC only supports NV12 buffers ("resources") as input. I checked the SDK demo source and I've found that they create their NV12 surfaces using the fourcc code like so:

IDirectXVideoProcessorService * directx_services;
DXVA2CreateVideoService(d3ddev, IID_PPV_ARGS(&directx_services));
directx_services->CreateSurface(desc.Width, desc.Height, 0, (D3DFORMAT)MAKEFOURCC('N', 'V', '1', '2'), D3DPOOL_DEFAULT, 0, DXVA2_VideoProcessorRenderTarget, &NV12_surface[0], NULL);

This works. The problem now is that i need to convert my ARGB buffer into NV12. StretchRect() does not work, and CheckDeviceFormatConversion() returns D3DERR_NOTAVAILABLE, so it doesn't seem like this is possible using high-level API's.

One idea I had was to copy the backbuffer to a texture surface, and then use that texture as an input to a pixel shader when doing some dummy draw operation, and then inside the shader i can do some math to do the conversion from ARGB to NV12. But then i would have NV12 formatted data inside an ARGB render target again. Would i be able to "cast" that to a NV12 buffer, or just use it as an input to my encoder even though the format technically doesn't match, but the data does?

Any ideas?

sentences:
Java 2D - Cannot get code to work for generating points for a line with a start point and Angle I am developing a Java 2D video game.  I am trying to write code to generate points for a line (actually a projectile path), at a specified angle, from a given start point.  There seems to be something wrong with my Math.  The points are to be used for moving a projectile from the top of the screen, towards the target (a submarine) which sits at the bottom.

I am suspicuous issue has to do with fact the origin of Java 2D coordinate system is 0,0 at top of the screen, not at bottom left for cartesian coordinate system.  Note: I am not a Math person.  So please excuse me if I am getting the terms wrong.

Here is what I am doing:

xloc, yloc - the initial location of the projectile I want to move towards the sub location

// Get slope of the line
float m= ((float)((int) yloc - subYcoord))/((int) xloc - subXcoord);

double radians= Math.atan(m);

double ycoord= yloc;
double xcoord= xloc;

int speed= 1;

// This is how I am attempting to generate the points for the path for the projectile to take

while (true) {

    xcoord += speed * Math.cos (radians);
    ycoord -= speed * Math.sin (radians);

    if (((int) ycoord)>= gunBaseYcoord) {

        break;
    }

    // WayPoints is my list of points to move the Projectile towards the sub at    bottom of the screen

    Point aPoint= new Point((int) xcoord, (int) ycoord);
    wayPoints.add(aPoint);
}

This does not seem to work for angles of 245 degrees.

As an example, if x,y are: 660, 35 (this would be my start point for the projectile), and subXcoord, subYcoord are: 169, 500

I get a slope of: -.947 (should be like: 245 degrees)

The radian is: -.758

I get degrees of: -43 (now this doesn't look right)

Appreciate any help with this!
Thanks!

sentences:
Managing large amounts of data and processes for an economy management game I'm making a management game in the vein of Anno or Stellaris, but I'm unsure how to manage all my data efficiently.

Short example: the player controls multiple islands. Each island has factories on it. A factory has inputs, a process that does something with the inputs, and outputs. The process depends on the inputs and the outputs and other parameters. The outputs could be another factories input. A factory needs human workers. Human workers have stamina ... ... ...

So the question is: how do you manage so much data and processes programmatically? And it's not only about running many processes simultaneously, they also depend on each other and the data, use each other, inform each other - on each tick. You also need the ability to get information out of those sub processes and put data into it at any time.

I'm struggling to come up with a system/codebase that could handle those things. I've choose C#/dotnet core since I assume it has something to do with threading, but I still haven't got anything that works.

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:
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:
Rigidbody freeze rotation around global Y My player is a cube that moves in all directions, but cannot jump. I want to achieve that the cube cannot rotate around global Y axis, but can rotate around global X and Z. This cannot be simply done by freezing the local Y rotation, since the cube can fall from higher ground and rotate mid-air - after that the local and global y axes are not parallel anymore and some other axis should be frozen.
Currently, I am using this line:
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(transform.rotation.eulerAngles.x, Mathf.Round(transform.rotation.eulerAngles.y / 90) * 90, transform.rotation.eulerAngles.z), 1f);

which is located in the FixedUpdate(). The resulting movement is shown in this video. Clearly, this always snaps the axis that is parallel to the global Y to the closest 90° angle. This solution, however, has a few unwanted side effects. One of them is clipping with the terrain or other player cubes, the second one is that the cube randomly rotates if walking over the edges or corners, and the third one is that if one cube is on top of another and both have this script attached, they start lagging, jittering and sometimes spinning.
I also tried by freezing the rotation based on what side of the cube is "on the bottom", but this does not work OK, since it often happens that the cube does not rotate for exact 90° when it drops from higher ground and ends up frozen standing on only one edge, just slightly off from being on the ground with the whole bottom side.
What is the "to go" solution for this type of movement?

sentences:
How to make healing in an exploration game interesting I'm creating a game with a heavy focus on exploration, though I'm at a bit of a loss for healing.

The problem is that I don't like the idea of enemies randomly dropping health, as this usually results in grinding when at low health and not near any healing stations(Metroid, Axiom Verge), and I don't want to copy the Soul/Focus system from Hollow Knight(Combat system has already been stolen by me :3), but Hollow Knight is the only game I've played with a focus on exploration that made healing interesting.

I've also thought of auto-regeneration, however that can easily lead to the player cowarding during a boss fight while they heal, and that would break the flow of the gameplay.

I've also considered something like striking a foe heals 1/8th of a health point, however this leads to the player feeling less tense after they take a gain 1/8th which will keep them from dying if they get hit again, and it makes the game feel like its all offense and little defense.

I've also though about an items approach where the player has to eat something or drink something to heal, however this doesn't really encourage healing as once you run out of items, you can no longer heal until you get some more(Legend of Zelda).

I've also though about no healing at all, however I noticed that when exploring and then you take a dumb hit before a hard boss, or a dumb hit before the boss gets hard(cough Cuphead cough), the player will just either commit suicide or run back to a healing station.

What can I do to make healing interesting, and not break the flow of gameplay?

This is a 2D platformer, and jumping is really important in the combat.

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:
How to make the character move along the axis using touch? I have the following code it works, but I don't know how it works.
This is the code I found:
void Update()
{
#if UNITY_ANDROID

    if(Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Moved )
    {
        Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
        float offset = touchDeltaPosition.x * 40f / 18 * Mathf.Deg2Rad;
        transform.position += new Vector3(0f, 0f, offset);
        transform.position = new Vector3(0f, 0f, Mathf.Clamp(transform.position.z, -7.1f, 7.1f));
    }
#endif
}

I need to move the player along the axis by touch, for example, like in the game Cube Surfer!
What I want to get (I used android emulator):

The code I wrote works well at 720x1280, but if you set the resolution to 1440x2960, the controls become too sharp. I know why this is happening because touch.delta is getting too big.
My code:
if (Input.touchCount > 0)
{
    var t = Input.GetTouch(0);

    var delta = t.deltaPosition;

    if (delta != Vector2.zero)
    {
        var offset = transform.position;

        offset.x += delta.x * Sensitivity * Time.deltaTime;

        offset.x = Mathf.Clamp(offset.x, -4f, 4f);

        transform.position = offset;
    }
}

How to fix it?
ScreenToWorldPoint this does not fit because the player moves along a spline.
Thank for help

sentences:
How do I publish a game for the web, using Cocos Creator? I am new to Cocos Creator and web game programming. I have build a simple game for the web, but I don't know how can I publish it. In the documentation files, it says:

  You only need to .zip scripts and resources in the game project and resource library, and then drop them into the designated release path

But I don't understand it. How do I publish a game for the web, using Cocos Creator?

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:
How do I calculate the bounce vector of a ball hitting the starting point of a segment? I have a ball (with parameters x, y, radius) that travels on the screen (with vectors directionX directionY) and can collide with a segment with random slope (with parameters startX, startY, stopX, stopY).

After i detect the collision i split code for calculate bounce vector in two different situations: first situation is ball in the middle of the segment (which is now working properly) and second is ball colliding the segment corners (starting or ending point) of a segment. Now,my algorythm is more or less working but sometimes there is some wrong behaviour and bounce is wrong or even no bounce (ball pass through the line without bounce)

This is the code i'm currently using:

       if (Math.pow(line.startX - x, 2) + Math.pow(line.startY - y, 2) <= Math.pow(radius, 2) || Math.pow(line.stopX - x, 2) + Math.pow(line.stopY - y, 2) <= Math.pow(radius, 2)) {
          // ball has hit the corner of the segment
           if (Math.pow(line.startX - x, 2) + Math.pow(line.startY - y, 2) <= Math.pow(radius, 2)){
               //calculate bounce vector with starting point of segment
                float x1 = x - line.startX;
                float y1 = y - line.startY;
                float c1 = (float) (-2 * (directionX * x1 + directionY * y1) / (x1 * x1 + y1 * y1));
                directionX += c1 * x1;
                directionY += c1 * y1;

           }
           else{
               //calculate bounce vector with ending point of segment
                float x1 = x - line.stopX;
                float y1 = y - line.stopY;
                float c1 = (float) (-2 * (directionX * x1 + directionY * y1) / (x1 * x1 + y1 * y1));
                directionX +=  c1 * x1;
                directionY +=  c1 * y1;
           }
        }

      else
            {
 //other code for calculating bounce vector after collision inside segment.

}

sentences:
How to calculate if a point is contained in rectangular camera viewport with rotation? I am working with my camera, and am trying to improve it so that I can calculate if a world point is on screen, taking rotation into account. Currently, my camera rectangle is calculated as so:

    public Rectangle Rectangle
    {
        get
        {
            int width = (int)((ViewportWidth / _zoom));
            int height = (int)((ViewportHeight / _zoom));
            return new Rectangle((int)(_pos.X - width / 2), (int)(_pos.Y - height / 2), width, height);
        }
    }

Then, to check if a point is on screen, I call one of the following functions:

    public bool IsOnScreen(Point location)
    {
        return this.Rectangle.Contains(location);
    }

    public bool IsOnScreen(Rectangle bounds)
    {
        return this.Rectangle.Intersects(bounds);
    }

However, none of these calculations take the rotation factor into account; only position and the zoom factor. I know that I can calculate the corners of the camera, in world space, using the following transformations:

var topLeftCorner      = Vector2.Transform(new Vector2(0, 0), Matrix.Invert(ViewMatrix));
var topRightCorner     = Vector2.Transform(new Vector2(ViewportWidth, 0), Matrix.Invert(ViewMatrix));
var bottomLeftCorner   = Vector2.Transform(new Vector2(0, ViewportHeight), Matrix.Invert(ViewMatrix));
var bottomRightCorner  = Vector2.Transform(new Vector2(ViewportWidth, ViewportHeight), Matrix.Invert(ViewMatrix));

However, the rectangle object that I am using is not able to take this into account, since it cannot store rotation. What is the calculation that I can use to check if a point is inside the virtual rectangle with these points, or if a rectangle intersects with the virtual rectangle?

Here's some graphics to better illustrate some of my code:

sentences:
How to get window size from within another class? I have found this post explaining about how to get the size of the Window, but for whatever reason I'm having issues getting it to work inside of a Singleton class that I'm made to manage a set of Objects.  Anyone have any examples of getting these values from inside of a singleton?

EDIT:  Just in case the question gets asked.  I'm using the values for when the Manager instantiate the objects it's managing...  So that they don't all start at the same spot and to ensure they start on the screen.

sentences:
Libgdx getting screen size I'm working on libgdx project. I basically recreate my game which I coded in xna to make it available for android. Here's the problem android has many screen resolutions, and I want to know how to get them.

i tried Gdx.graphics.getWidth() or getHeight() but it gives me null pointer exceptions.

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:
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:
What gamepad functionality can be assumed? When I offer gamepad support, the simplest solution seems to be to assume XBox controllers and use a library that maps the most frequent gamepads to a similar layout.

Now if I want to minimize customer complaints, can I just use all the buttons (in a sensible way), or are there some I should avoid because they are missing on some common controllers?

The question is primarily about PCs (Linux/Windows/Mac), but does the answer change if we consider gamepads for mobile devices?

The one thing I know about is that we cannot use any input scheme that requires the user to press LT and RT at the same time, but that limitation affects XBox controllers as well.

sentences:
change texture at runtime How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used

using UnityEngine;
using System.Collections;

public class switchtime : MonoBehaviour {

    // Use this for initialization
    private bool showLabel = false;
    private bool showLabe2 = false;
    private bool showLabe3 = false;
    private bool showLabe4 = false;

    public void Start() {
        Invoke("ToggleLabel", 1);
        Invoke("ToggleLabel2", 3);
        Invoke("ToggleLabel3",6 );
        Invoke("ToggleLabel4", 9);
    }

    public void ToggleLabel() {
        showLabel = !showLabel;

    }
    public void ToggleLabel2() {

        showLabe2 = !showLabe2;
    }
    public void ToggleLabel3() {

        showLabe3 = !showLabe3;
    }
    public void ToggleLabel4() {

        showLabe4 = !showLabe4;
    }

    public void OnGUI() {
        if (showLabel) {
            GUI.Label(new Rect(300, 200, 100, 20), "Copying window file..");

        }
        if (showLabe2) {

            GUI.Label(new Rect(40, 40, 100, 20), "Epanding windows file..");
        }
        if (showLabe3) {

            GUI.Label(new Rect(80, 80, 100, 20), "Installing Feature..");
        }
        if (showLabe4) {

            GUI.Label(new Rect(100, 100, 100, 20), "Installing Updates");
        }
    }
}

Now I need to change the GUITexture at runtime. How can do this? Can anybody help me in coding?

Here is some changes I made. I worked on changing the gameObject when mouse is placed on it. This is the code I applied and its working for me

using UnityEngine;
using System.Collections;

public class change : MonoBehaviour {

    // Use this for initialization
    public GameObject newSprite;

    private Vector3 currentSpritePosition;
    void update()
    {
    }

    void Start()
    {
        newSprite.renderer.enabled = false;
        currentSpritePosition = transform.position;

        //then make it invisible
        renderer.enabled = false;

        //give the new sprite the position of the latter
        newSprite.transform.position = currentSpritePosition;

        //then make it visible
        newSprite.renderer.enabled = true;
    }

    void OnMouseExit(){
        //just the reverse process
        renderer.enabled = true;
        newSprite.renderer.enabled = false;
    }
}

Now the problem is that, in same code I need to set a time so that the text get loaded without the mouse click. I mean a particular time to load each text one after the another.

Here  is my screen shot

Here I have placed the image one below the another,when the mouse is hovered on it it will change the text from bold to normal text.Changes process stated in (image 2,3).That code I posted is working for me.

sentences:
The tile cursor is not on the same tile I selected Here is the image, when I select the tile I want to paint, it paints in the correct box where I want it to be but the white cursor should also be in the same box but it is 2 units to the left? This really  makes it difficult to paint the tiles. I'm a beginner in unity and can't seem to fix this problem :(
Thank you for your help!

sentences:
How to transfer the player into a new scene, loaded in the background? I'm porting an old BuidBox 2 game to the Godot game engine. I already added all assets and scenes to the Godot project. The game is a 2.5D (isometric) endless runner. What I want now is to add a mechanism to load the next scene offscreen, remove the player's character from the current scene, and add it to the next scene seamlessly, without breaking the game physics or causing the player character to go behind or in front of other game objects that it's not supposed to.
For instance if I have this scenes:
Scene1
|-bg
|-player
└-fg

Scene2
|-bg
|-player
└-fg

I would like to load Scene2, remove player from Scene1 and replace player from Scene2 with the player node I removed from Scene1, without the player node changing its velocity or position abruptly in the physics world or appearing behind the bg node in Scene2 or in front of the fg node in Scene1.

sentences:
Farseer for platformer - (Almost) constant velocity I am building the prototype for a platformer and would like to use farseer physics engine. I got the feedback that it might not be a good idea to use physics engine, but I would like to have elements like bumpers and so on.

At the moment I am looking for a good way for moving right and left (jumping is very easy). The goal is to get an almost constant velocity, so I was playing around with hight gravity and high linear damping and it is working fine, but also affects gravity. Is there a way to get a linear damping on the x-axis only or do I just have to increase gravity (which sounds a little bit strange to me).

sentences:
Radiometric quantities and time in rendering Often in papers people use various radiometric quantities, mostly radiant flux, radiant intensity, radiance and irradiance.

It seems to me that all of these quantities are dependent on time. For example, radiant flux is defined as the amount of radiant energy per span of time (emitted by a light source). The other quantities contain radiant flux in some measure so they seem to depend on time as well.

Yet when reading papers, people don't go into time at all. For example, some papers say "the radiant flux diffusely reflected by this area of the surface is x" and then they go on to explain that x is just light_colored_intensity * surface_color or something (depending on the illumination model used, of course), not factoring in any kind of time at all.

Is this because the time frames observed are assumed to be 1 second? Is the time factored out somewhere (perhaps when defining the light intensity, which may be defined as radiant flux)? What am I misunderstanding here?

sentences:
Detecting a Collision Between Two Bodies Undergoing Multiple Transformations I have been searching for an answer to this for a really long time and I have not found any definitive answers as of yet.  What I am trying to do is determine if and when two bodies collided between the times t0 and t1.  Calculating this is much more straight forward if each body is only either translating or rotating (about center or any point), but when adding multiple transformations on top of each other, things become a bit more messy.  I made this animation to illustrate the problem.

As you can see, at times t0 and t1 there are no collisions, but between there are multiple collisions occurring.

One way I thought of for tackling this problem was to reduce the size of the time intervals.  So, between t0 and t1 there would be a total of n updates to check for collisions.  This works, but the only way I found that I could guarantee no false negatives, i.e. not finding a collision that happened, was to integrate over extremely small time-steps.  As you can imagine, this is very costly because it resulted in the tens to hundreds of time-steps per body per update cycle.  I am not saying this idea has no merit (it makes calculating the collision response much easier since I know the exact points of contact), but I would need to find a way to calculate the minimum number of time-steps rather than uniformly moving each body forward one unit of distance/rotation until they reach the desired position and orientation.

So, my question is two parts:

Is there a better way of determining if and when a collision occurs?
If not, is it possible to calculate the minimum number of time-steps?

P.S.

I think the maximum translation per time-step can be the shortest distance between any two points in the body.  This would not allow it to hop over anything.  When it comes to rotation about the center or orbiting a point I do not know how to determine the minimum angle.  It probably has to do with the arc length, but what should that maximum distance be?

EDIT: this is not right. For a triangle, the base would be the shortest distance between two of its points, but the top could pass through something that is less wide than the triangle base.

sentences:
How do I access a Unity class from an Android Activity? I have made my own C# classes in Unity. How can I access them from the Android Activity that starts the UnityPlayer?

Example: I have a C# class called testClass in Unity:

class testClass {
    public static string myString = "test string";
}

From the Android activity in Java, I want to access a member of that class:

string str = testClass.myString;

Is this possible? If so, how? Is there another way to do this? In the end, I basically want to communicate between my Android activity and the UnityPlayer object.

Edit: I found a solution.

I looked at building Android plugins for Unity but this wasn't satisfactory to me.

I ended up building a socket client-server interface in Unity with C# and another one in Java for the Android app: Unity listens on port X and broadcasts on port Y. The Android activity listens on port Y and broadcasts on port X. This is necessary as both interfaces are running on the same host.

So that's how I solved my problem, but I'm open for any suggestions if anyone knows a better way of communicating between the Unityplayer and your app.

sentences:
How can I pass a texture to a custom deferred lighting model in Unity? I've replaced the Internal-DeferredShading.shader with my own shader, and it's working fine, but I want to add a uniform texture for it to sample from.

I've tried adding a texture as a property and assigning it a default value in the inspector but at run-time the shader still uses the default value given in the shader (e.g. white).

Is it possible to do this?

sentences:
How to move a 2d sprite to a target location while avoiding obstacles? How can I get a 2d sprite to move to a position clicked on the screen, without bumping into other objects? I'm programming in java using the android API library

I have created a surface view and loaded my sprites as a bitmap object.

sentences:
Why does GameMaker Studio not open from a removable drive? I downloaded GameMaker Studio 1.4 onto a jump drive so I could use it between two different computers. I downloaded it in a Windows 7 computer, but when I try to use it on a Windows 8 computer, it flashes the updating box, then nothing happens.

I have tried running it in Windows 7 compatibility mode, and I have tried running it as an administrator. Neither works.

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:
Using CAShaperLayer within COCOS2d My class X is interited from CCLayer.

@interface X : CCLayer

Then in X, I added an instance variable of type CAShapeLayer.

CAShapeLayer *_Circle

I drew the Circle using UIBezierPath. Now if I try to add _circle to self, it gives me error:

[self addChild:_Circle];

[CAShapeLayer tag]: unrecognized selector sent to instance 0x916f7f0 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAShapeLayer tag]: unrecognized.

I also tried typecasting _Circle to (CCNode*) or (CCSprite*) but nothing helped.

Any suggestions?

sentences:
Draw a line/curve for the path an object has taken Hello I am making a game in libgdx. I want to draw a line/curve of the path a object have taken.

First a thought I could save all positions of the objects each iteration and draw line between them using the Shaperenderer. This is however inefficient because the number of saved positions for a object becomes really large, and I have alot of objects.

My second thought was to draw a line between only the previous position and the current position on to a pixmap, and then draw the pixmap to the screen. This way I only need to save the old position because I don't clear the pixmap. The problem is that the world is infinitely big, and the pixmap cant cover the entire world (and it is bad to make a really big pixmap?). Also when I zoom out of the world the lines becomes really small and I cant see them. When I use the shaperenderer, the lines are always one pixel wide independent of the zoom.

So is there a smart way where I can draw the path my objects have taken without saving all previous positions, and where the line stays constant width?

sentences:
How can I simulate multiple depth channels? Here's what I'd like to achieve:

Rendering a first pass of objects in my scene, using standard depth comparison
Rendering another pass of objects in the same scene, but with the following rules:

A Pixel of the 2nd pass always override the first pass (no depth compare between them)
Use Depth comparison between pixels written from the second pass.

In English I want depth comparison made inside each pass but I always want the second pass pixels to override the first pass ones.

Some things I've thought:

I tried to think about using stencil to solve this, but I couldn't find a way.
I know I could render into a separate target the second pass then composite the result into the first, but I'd like to avoid that.
I could use two separate Depth Buffer, one dedicated to each pass. (I never tried, but I figure it's possible to switch the depth buffer in a Render Target "on the fly")

Any idea of the best solution?

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:
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:
Idle+Walk animation problem and double-button input axes I have 2 problems with unity3d.

First, I created an animator and attached it to player. In animator I put 2 condition, Speed and Running (first is float, second is boolean). Default Animation is Idle. Then player press W, I want animation to fade from idle to walk and when he stop press the button, I want the animation to fade from walk to idle. Here is my problem.

When I press W, he make walk animation, but after it he play half of idle animation and after it he enter again in walk animation. How can I loop the walk animation until he release W? And if he release, even if the animation isn't totally played, I need the animator to make transition to idle.
How can I make this "transition"? Then I release W, he just go from walk to idle animation without any transition (and it is a kind of wear).

Second, How can I put 2 input buttons on axes? I mean: If he press W, there should go vertical axes. When he press W+Left Shift, there should go running axes. How can I attach 2 buttons to 1 axes?

I am new in unity and I want to figure out how to work with this things.

sentences:
Separating Axis Theorem fails at certain angles I'm currently attempting to add an overlap tester for an axis aligned and orientated bounding box but the solution only seems to work accurately when the OBB's angle is between -10 and +10. As the angle approaches +90 degrees the collision area seems to at first move to the right half of the OBB and then become non existent. Between 90 and 270 I couldn't get an overlap and then when it comes round a full 360 the area registers accurately again.

Any light on this subject would be great. I'm using positive X for 0 degrees increasing CCW.

EDIT: Did a little more research and realized that projecting a vector onto another requires more than just a dot product. Could any one give me a correct version of one of the check axis methods below?

EDIT 2: Actually just a dot product should do I think since the vectors being  projected onto are unit length.

public static bool overlapAABB_OBB(AABB a, OBB o)
    {
        float rads = MathHelper.ToRadians(-o.angle);
        T = Vector2.Subtract(o.position, a.position);
        Ax.X = 1;
        Ax.Y = 0;
        Ay.X = 0;
        Ay.Y = 1;
        Ox.X = (float)Math.Cos(rads);
        Ox.Y = (float)Math.Sin(rads);
        Oy.X = -Ox.Y;
        Oy.Y = Ox.X;
        if (checkAX(a, o) &&
           checkAY(a, o) &&
           checkOX(a, o) &&
           checkOY(a, o))
            return true;
        else
            return false;
    }

    private static bool checkAX(AABB a, OBB o)
    {
        float TAx = Vector2.Dot(T, Ax);
        float WoOxAx = Vector2.Dot(Vector2.Multiply(Ox, o.halfWidth), Ax);
        float HoOyAx = Vector2.Dot(Vector2.Multiply(Oy, o.halfHeight), Ax);
        if (TAx > a.halfWidth + WoOxAx + HoOyAx)
            return false;
        else
            return true;
    }

    private static bool checkAY(AABB a, OBB o)
    {
        float TAy = Vector2.Dot(T, Ay);
        float WoOxAy = Vector2.Dot(Vector2.Multiply(Ox, o.halfWidth), Ay);
        float HoOyAy = Vector2.Dot(Vector2.Multiply(Oy, o.halfHeight), Ay);
        if (TAy > a.halfHeight + WoOxAy + HoOyAy)
            return false;
        else
            return true;
    }

    private static bool checkOX(AABB a, OBB o)
    {
        float TOx = Vector2.Dot(T, Ox);
        float WaAxOx = Vector2.Dot(Vector2.Multiply(Ax, a.halfWidth), Ox);
        float HaAyOx = Vector2.Dot(Vector2.Multiply(Ay, a.halfHeight), Ox);
        if (TOx > o.halfWidth + WaAxOx + HaAyOx)
            return false;
        else
            return true;
    }

    private static bool checkOY(AABB a, OBB o)
    {
        float TOy = Vector2.Dot(T, Oy);
        float WaAxOy = Vector2.Dot(Vector2.Multiply(Ax, a.halfWidth), Oy);
        float HaAyOy = Vector2.Dot(Vector2.Multiply(Ay, a.halfHeight), Oy);
        if (TOy > o.halfHeight + WaAxOy + HaAyOy)
            return false;
        else
            return true;
    }

sentences:
Graphic optimization for iPhone Basically, I am creating a large iPhone game (with an overwhelming amount of 2d graphics).

I am concerned about the game file size.

Since the iPhone game will accept Retina and Normal display, we need 2 versions of each image (one HD and on normal). Therefore, it is necessary to resize our image files (it is not a good idea to resize the images in-game, an iPhone 3GS would have memory usage problems).

So my team is thinking about using Adobe Fireworks for the image creation, since it has that nice vector-resizing behavior without losing image quality (not-blurry on resize).

And it works alright.

But then I created an image that is pretty much the same in Adobe Photoshop, and it happened to be about 3x smaller in memory.

So naturally, there's something wrong with our Fireworks' files. How can I save my .png Firework file with the smallest memory size possible?

Note: the images require transparency.

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:
When I exit the pause menu of my game the gun fires When The player exits the pause menu in my game the gun will fire. I figured out that it happens when the player clicks when the game is paused.

Basically i the player goes to the pause menu and exits without clicking the gun will not fire, but if they go to the pause menu and click then exit the gun will fire. Here are my scripts:

public class Shooting : MonoBehaviour
{
    Animator anim;
    public float FireRate = 15f;
    private float NextTimeToFire = 0f;
    // Start is called before the first frame update
    void Start()
    {
        anim = GetComponent<Animator>();
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButton("Fire1") && GetComponentInParent<PlayerController>().moving == false && Time.time >= NextTimeToFire)
        {
            NextTimeToFire = Time.time + 1f / FireRate;
            Shoot();
        }
    }
}

/

public class PauseMenu : MonoBehaviour
{
    public static bool GameIsPaused = false;
    public GameObject HUDPanel;
    public GameObject PauseMenuPanel;
    public GameObject OptionsPanel;

    private void Start()
    {
        Time.timeScale = 1f;
        GameIsPaused = false;
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (GameIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }
    }

    void Resume()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        PauseMenuPanel.SetActive(false);
        OptionsPanel.SetActive(false);
        HUDPanel.SetActive(true);
        Time.timeScale = 1f;
        GameIsPaused = false;
    }

    void Pause()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
        PauseMenuPanel.SetActive(true);
        HUDPanel.SetActive(false);
        Time.timeScale = 0f;
        GameIsPaused = true;
    }
}

sentences:
SAT, How Do I Find The Penetration Vector? I've just successfully implemented Separating Axis Theorem (SAT) in my game but I was wondering how do I find the penetration vector? I heard it can be useful for collision response. e.g. The harder they collide the harder the response.

I want the penetration vector so I apply it to the position of an object when it is current penetrating an other so I can move it back outside of the other object's bounds.

Here is my code so far.

Any help would be much appreciated,

Thanks in advance.

sentences:
Can I save a score as highscore, if it's a float? So I have this infinite runner type of game, subway surfers style. I chose a method where the player doesn't move, and instead the obstacles move towards him.
My score is a float and it increases as time passes.
However, I'm unable to figure out how can you save this as a highscore.
I tried a few methods but most of them were for int so it didn't work out.
Here is what I have for the score counting. It's currently missing the save score part completely.
    public class GameManagerC : MonoBehaviour
{
    float score = 0;
    public float scoreMulti = 5;

    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }

EDIT: Many of you asked how I tried to implement the code I've found so here it is:
public float score;
public float highScore;

void Start()
    {
        score = PlayerPrefs.GetFloat("score");
        highScore = PlayerPrefs.GetFloat("highScore");
        if (score > highScore)
            highScore = score;
        StartGame();
    }

    // Update is called once per frame
    void Update()
    {
        if (isPlayerAlive == true)
        {
            score += Time.deltaTime * scoreMulti;
            scoreText.text = score.ToString("Score: 0");
        }
    }

sentences:
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:
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:
How can I efficiently resize sprites every frame? I want to animate UI elements, like HP bars, by moving and resizing them. How can I efficiently resize sprites every frame?

I am using the LibGDX framework.

sentences:
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:
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:
Why does the size/extents of a bounding box of a BoxCollider in Unity show the Z element being double what it is? As you can see from the picture below, I fetch the BoxCollider inside CollisionHandler and Debug.Log() it to the screen.
In this case, I'm logging the size, but the same thing happens with extents. There are 4 logs because I have 4 instances of the object in the scene.
The Z value of the Vector3 is double what it should be, whereas the other values are, for the most part†, normal. Also, it seems that each object prints a slightly different value for extents.z. Most stay around 1.3, but one gave me 1.07~.
Additionally, it inverts the order for 2 of the objects. I don't know why.
None of the objects are scaled and all use the exact same values for their collider.

I tried drawing a cube with the same size as the BoxCollider's bounding box, and here's what I got:

I'm not entirely sure if the misalignment with the Collider in the scene is a sign of a problem or just how Gizmos.DrawCube() works. Here's the code that does this:
private void OnDrawGizmosSelected() {
    Vector3 origin = coll.bounds.center + transform.TransformDirection(new
    Vector3(0f, 0f, 0.675323f + skinWidth));
    // The hardcoded number above is Z extent of the box.
    Vector3 direction = transform.TransformDirection(Vector3.forward) * 2;

    Gizmos.color = Color.red;
    Gizmos.DrawRay(origin, direction);
    Gizmos.DrawCube(origin + direction, coll.bounds.size);
    // Where coll is a reference to the BoxCollider, cached in Awake().
}

Unity version 2019.3.15f1.
† For the X value of 2.286476, it rounded to 2.1 in the 3rd log for some reason. And in the first log, it rounded the doubled value of Z to 2.4 rather than 2.6...

sentences:
What does Steam require from a Greenlight submission? I'm an indie developer getting ready to submit my game to Steam Greenlight, but have hit a road block. I don't know what to submit.

I've been searching and I haven't found anything detailing whether I should submit the game's files and let Steam do the rest or an installer to install the resource files and the executable in a certain spot?

Do I need to make any Steam-specific optimizations/additions to my game before it can be submitted?

sentences:
Alpha is not working in diffuse light shader I am following this tutorials series on rastertek.com and I got a bit stuck on the Diffuse Lighting Tutorial. Particulary, the part that does not work for me is alpha channel of the light color. Here are the [I think they are] relevant code parts:

Light Shader:

cbuffer MatrixBuffer
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

Texture2D shaderTexture;
SamplerState SampleType;

cbuffer LightBuffer
{
    float4 ambientColor;
    float4 diffuseColor;
    float3 lightDirection;
    float padding;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
};

float4 LightPixelShader(PixelInputType input) : SV_TARGET
{
    float4 textureColor;
    float3 lightDir;
    float lightIntensity;
    float4 color;

    textureColor = shaderTexture.Sample(SampleType, input.tex);

    lightDir = -lightDirection;

    lightIntensity = saturate(dot(input.normal, lightDir));

    color = saturate(diffuseColor * lightIntensity);

    color = color * textureColor;

    return color;
}

PixelInputType LightVertexShader(VertexInputType input)
{
    PixelInputType output;

    input.position.w = 1.0f;

    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);

    output.tex = input.tex;

    output.normal = mul(input.normal, (float3x3)worldMatrix);

    output.normal = normalize(output.normal);

    return output;
}

The problem here is the shader completely ignores the alpha channel of the light. If I set the diffuse color to red, then the texture will be reddish no matter what alpha is supplied.

The only way I could make the alpha work is changing the line

color = color * textureColor;

to

color = color * color.w * textureColor;

in the pixel shader. This however gives overall wrong result.

Might it be the DirectX setup issue, here are some parts of the device initialization:

// Set regular 32-bit surface for the back buffer.
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;

[...]

// Set up the description of the depth buffer.
depthBufferDesc.Width = screenWidth;
depthBufferDesc.Height = screenHeight;
depthBufferDesc.MipLevels = 1;
depthBufferDesc.ArraySize = 1;
depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthBufferDesc.SampleDesc.Count = 1;
depthBufferDesc.SampleDesc.Quality = swapChainDesc.SampleDesc.Quality;
depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
depthBufferDesc.CPUAccessFlags = 0;
depthBufferDesc.MiscFlags = 0;

[...]

// Setup the raster description which will determine how and what polygons will be drawn.
rasterDesc.AntialiasedLineEnable = false;
rasterDesc.CullMode = D3D11_CULL_BACK;
rasterDesc.DepthBias = 0;
rasterDesc.DepthBiasClamp = 0.0f;
rasterDesc.DepthClipEnable = true;
rasterDesc.FillMode = D3D11_FILL_SOLID;
rasterDesc.FrontCounterClockwise = false;
rasterDesc.MultisampleEnable = false;
rasterDesc.ScissorEnable = false;
rasterDesc.SlopeScaledDepthBias = 0.0f;

What's wrong with this shader?

I'm not sure what other code might be relevant, I will gladly add any at your request.

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:
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:
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:
score displaying system without using bitmap how to make a score displaying system without using bitmap in libgdx.
I making a fluppy bird remake
somone can explaim me in details?

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:
Torque applies to one wheel, but inconsistently to the other wheel I have a GameScript class which is derived by another class WheelScript; it is meant to apply torque to a rigidbody in different directions depending upon the key pressed.

However the result to this is that one of the rigidbodies rotates fine but the other one doesn't (say the right wheel rotates but the left doesn't turn or even if it does, it doesn't move with the same angular velocity as the first one)

Base class:

public class GameScript : MonoBehaviour
{
    public static GameScript instance;
    protected float Force;

    protected virtual void  Print(GameObject gameObject) {
        print(gameObject.name);
    }

    protected virtual void MoveForward(Rigidbody rigidBody, int identifier) {
        if(identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveLeft(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveRight(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveBack(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }
}

Child class:

public class WheelScript : GameScript
{
    [SerializeField] private int identifier;
    Rigidbody body;
    [SerializeField] float force;

    private void Start()
    {
         body = GetComponent<Rigidbody>();
         Force = force;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.W))
        {
            MoveForward(body, identifier);
        }
        else if (Input.GetKey(KeyCode.A))
        {
            MoveLeft(body, identifier);
        }
        else if (Input.GetKey(KeyCode.D))
        {
            MoveRight(body, identifier);
        }
        else if (Input.GetKey(KeyCode.S))
        {
            MoveBack(body, identifier);
        }
    }
}

and similarly for the other wheel with only difference being that of axis as its axis is (0,0,-1)

Hinge Joint for left wheel is visible in this picture

Hinge Joint for right wheel is visible here in this picture

This is how each wheel is aligned

Hinges are attached to the pivot in the opposite direction as marked in the circle

Also I think I forgot to mention but the WheelScript is attached to both the wheels (it is the script component for both wheels)

sentences:
Alpha blending sometimes gives the wrong color? I've got a method for alpha blending:

public static int alphaBlend(int c1, int c2) {
        int a1 = (c1 & 0xff000000) >>> 24;

        int r1 = (c1 & 0x00ff0000) >> 16;
        int r2 = (c2 & 0x00ff0000) >> 16;

        int g1 = (c1 & 0x0000ff00) >> 8;
        int g2 = (c2 & 0x0000ff00) >> 8;

        int b1 = (c1 & 0x000000ff);
        int b2 = (c2 & 0x000000ff);

        float src_alpha = ((float)a1) / 255.0f;

        int red   = (int) ((r1 * src_alpha) + (r2 * (1.0f - src_alpha)));
        int green = (int) ((g1 * src_alpha) + (g2 * (1.0f - src_alpha)));
        int blue  = (int) ((b1 * src_alpha) + (b2 * (1.0f - src_alpha)));

        return (a1 << 24) | (red << 16) | (green << 8) | blue;
    }

But sometimes this gives the wrong color (I guess because I don't use the second color's alpha). Could anyone explain how to fix this?

sentences:
How do you structure an Item class? I've been thinking about the structure of an Item class.
There are many items which may or may not have effects in the game.

For example,
an item "Herb" has an effect to "Heal HP by 5". but
an item "Stone" has no effect.

As per a title, when you design a game, how do you structure the Item class?

The following is the structure I've come up with.

class Item{
    String id;
    // Status where s = HP, MP, ATK .. etc
    // Integer -> value which affects on the Status
    Map<Status, Integer> effect;
    SignType st; // +, -, *, /
}

class Player{
    Map<Status, Integer> status; // Status where s = HP, MP, ATK .. etc
}

sentences:
Will my "Block Buster" game infringe on the Blockbuster (movie rental) trademark? I'm developing a small puzzle game called "Block Buster" and I was wondering if there will be any collision with already existing "Blockbuster" (movie rental company) registered trademark.

Does the space or case difference in the trademark mean something? Or is there any difference in that Blockbuster is a movie renting company and I will just be selling a game?

Do I really have to change the game's name?

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:
OpenGL camera moves faster than player I have a side scroller game made in OpenGL, and I'm trying to center the player in the viewport when he moves. I know how to do it:

cameraX = Width / 2 / TileSize - playerPosX
cameraY = Height / 2 / TileSize - playerPosY

However, I have a problem. The player and "camera" move, but the player moves faster than the "camera" scrolls. So, the player can actually move out of the screen.

Some code, this is how I translate the camera:

public Camera(){
}

public void update(Player p){
    glTranslatef(-p.getPos().x - Main.WIDTH / 64 / 2, -p.getPos().y - Main.HEIGHT / 64 / 2, 1);
}

Here's how I move the player:

public void update(){
    if(Keyboard.isKeyDown(Keyboard.KEY_D)){
        this.move(MOVESPEED, 0);
    }

    if(Keyboard.isKeyDown(Keyboard.KEY_A)){
        this.move(-MOVESPEED, 0);
    }
}

The move method:

public void move(float x, float y){
    this.getPos().set(this.getPos().x + x, this.getPos().y + y);
}

And then after I move the player, I update the player's geometry, which shouldn't matter.

What am I doing wrong here, this seems like such a simple problem, yet it doesn't work!

sentences:
Libgdx: api fadein() and fadeout() methods are switched? I've been trying to create a white-screen fade effect for my libgdx game.

When I run the following code with fadeOut = false, nothing happens (white-screen does not appear because alpha is 0). When fadeOut = true, it works (fades out) until the actors alpha is down to 0.5f, then it rebounds and starts fading in. No clue why.

    if(fadeOut){
        map.setColor(new Color(1, 1, 1, 1));
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 0));
        addAction(Actions.fadeIn(duration));
    }

When I run the exact same code but switch the starting alpha's like this:

if(fadeOut){
        map.setColor(new Color(1, 1, 1, 0)); //notice this is 0 now
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 1)); // notice this is 1 now
        addAction(Actions.fadeIn(duration));
    }

When I run this code with fadeOut = false, nothing happens (screen is all white though, because starting alpha is 1). When fadeOut = true, it actually fades in. sigh...

Here's the draw method i'm running, but I doubt there's an issue there.

@Override
public void draw(Batch batch, float parentAlpha){
    batch.draw(texture, 0, 0);

    //Get the current color of the actor
    batch.setColor(getColor());

    act(Gdx.graphics.getDeltaTime());

}

I really don't know why this is happening, any insight would be valuable.

Thanks!

Edit:
Here's the full code I'm using to call the fades:

I have a "StartScreen" object that gets initialized (and contains the stage), and this piece of code is in it's constructor:

fade = new Fade((int)GdxGame.getWidth(), (int)GdxGame.getWidth(), Color.WHITE, fadeOut, duration);
stage.addActor(fade);

In the same StartScreen class, I have the following code to draw the stage:

@Override
public void render() {
    super.render();
    stage.draw();
}//end render

The following code then calls the "Fade" objects constructor which has the code mentioned above:

public Fade(int width, int height, Color color, boolean fadeOut, float duration){

    this.fadeIn = fadeOut;
    this.duration = duration;

    Pixmap map = new Pixmap(width, height, Pixmap.Format.RGBA8888);

    if(fadeOut){
        map.setColor(new Color(1, 1, 1, 1));
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 0));
        addAction(Actions.fadeIn(duration));
    }

    map.fillRectangle(0, 0, width, height);

    texture = new Texture(map);

    map.dispose();
}

Update: Changing the alpha with this line:

map.setColor(new Color(1, 1, 1, alpha)); to 0.2f or 0.7f works fine. Though that's because it's changing the alpha of the pixmap (and later becomes the texture)- which leads me into investigation of whether fadeOut or fadeIn change the texture's alpha or something else...

sentences:
How to calculate angle for shooting bullet in 3D? What I want to know is if I can calculate an angle similar to how I'm doing in 2D and update the x,y,z position of a bullet based on that angle in a similar manner I'm doing the update function below.

I wrote this function in Ruby to find the target angle between two 2D (x,y) vectors, but now I want to find out how to do this in 3D in a similar way:

  def target_angle(point1, point2)
    x1 = point1[0]
    y1 = point1[1]
    x2 = point2[0]
    y2 = point2[1]
    delta_x = x2 - x1
    delta_y = y2 - y1
    return Math.atan2(delta_y, delta_x)
  end

Given an object (like a bullet in this case), I can shoot the object given a target_angle between the player (x,y) and the mouse (x,y), as such in the bullet update function:

  def update
    wall_collision
    # the angle here is the target angle where point 1 is the player and
    # point 2 is the mouse
    @x += Math.cos(angle)*speed
    @y += Math.sin(angle)*speed
  end

Is there a similar method to calculate a target angle in 3D and use that angle in a similar manner as my update function (to shoot a bullet in 3D)? How can I make this work for two 3D vectors (x, y, z), where you have the player position (x,y,z) and some other arbitrary 3d point away from the player.

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:
Problem setting up OpenGL dev environment in Ubuntu 14.04 Currently I'm using this tutorial to get started with opengl.So when I try to compile the example program :

#include <GLFW/glfw3.h>
#include <thread>

int main()
{
    glfwInit();
    std::this_thread::sleep_for(std::chrono::seconds(1));
    glfwTerminate();
}

using

  g++ test.cpp -o test  -lglfw3

to ensure that all is good with glfw I get this

  In file included from /usr/include/c++/4.8/thread:35:0,
                   from test.cpp:2: /usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This
  file requires compiler and library support for the ISO C++ 2011
  standard. This support is currently experimental, and must be enabled
  with the -std=c++11 or -std=gnu++11 compiler options.  #error This
  file requires compiler and library support for the \   ^ test.cpp: In
  function ‘int main()’: test.cpp:7:10: error: ‘std::this_thread’ has
  not been declared
       std::this_thread::sleep_for(std::chrono::seconds(1));
            ^ test.cpp:7:38: error: ‘std::chrono’ has not been declared
       std::this_thread::sleep_for(std::chrono::seconds(1));

So then I guessed I could use the flag that g++ suggested and compile it using

  g++ -std=c++11 test.cpp -o test  -lglfw3

But then things get weirder and g++ comes with this error(I will post only a part of it since it's a huge output overall but you will probably get the idea) :

  x11_window.c:(.text+0x2d9): undefined reference to XSaveContext'
  x11_window.c:(.text+0x324): undefined reference to
  XChangeWindowAttributes' x11_window.c:(.text+0x3be): undefined
  reference to XSetWMProtocols' x11_window.c:(.text+0x417): undefined
  reference toXChangeProperty' x11_window.c:(.text+0x41c): undefined
  reference to XAllocWMHints' x11_window.c:(.text+0x48e): undefined
  reference toXSetWMHints' x11_window.c:(.text+0x49d): undefined
  reference to XFree' x11_window.c:(.text+0x4a2): undefined reference
  toXAllocSizeHints' x11_window.c:(.text+0x5ed): undefined reference
  to XSetWMNormalHints' x11_window.c:(.text+0x5fc): undefined reference
  toXFree' x11_window.c:(.text+0x613): undefined reference to
  XAllocClassHint' x11_window.c:(.text+0x66c): undefined reference to
  XSetClassHint' x11_window.c:(.text+0x67b): undefined reference to
  XFree' x11_window.c:(.text+0x6dc): undefined reference to
  XISelectEvents' x11_window.c:(.text+0x71e): undefined reference to
  XRRSelectInput' //usr/local/lib/libglfw3.a(x11_window.c.o): In
  functionhideCursor': x11_window.c:(.text+0x7bd): undefined reference
  to XUngrabPointer' x11_window.c:(.text+0x7fb): undefined reference to
  XDefineCursor' //usr/local/lib/libglfw3.a(x11_window.c.o): In
  function captureCursor': x11_window.c:(.text+0x880): undefined
  reference toXGrabPointer'
  //usr/local/lib/libglfw3.a(x11_window.c.o): In function `showCursor':

How could I fix this type of problem cause it really hurts my motivation to get into opengl. And please if you have in mind any better-hassle free guide for setting a proper opengl environment for deving with glfw and glew in linux/ubuntu , care to mention it.

UPDATE 1: http://pastebin.com/CPEwmbUZ <--- The whole output is here if anyone cares.

sentences:
How to make a point light cast shadows in realtime? I have a solar system...

The central star has a point light attached to it.

However, objects don't cast shadows on each other...

Planets are < 20 units from the star, so it's not a light falloff issue.
The point light is the only light source in the scene.
There are occasions when it works - moon 3 of planet 5 correctly casts a shadow on its parent and siblings, whereas none of the others do.
Here's a video showing the issue more clearly: https://youtu.be/rmlWlXjygk0
Note that there are issues both casting and receiving shadows for all but the outermost moon.

Everything is set to both cast and receive shadows, objects are in the correct layers and not marked static...

I've tried changing from forward to deferred but that only prevented me seeing any shadows at all.
What am I missing? How can I get Unity to cast shadows correctly?

sentences:
Sphere intersection Stuck I have two spheres that are bounded by spheres for collision detection. I do not want them to intersect. My intersection works. But it gets stuck. Once the function returns true, I cannot get it out. I tried

collideBool = ObjectOne.Intersect(ObjectTwo);

if(collide == true)
{
    leftright = leftright;
    updown = updown;
}
else
{
if(GetAsyncKeyState(VK_RIGHT))
leftright -= dt;
if(GetAsyncKeyState(VK_LEFT))
leftright += dt;
if(GetAsyncKeyState(VK_DOWN))
updown += dt;
if(GetAsyncKeyState(VK_UP))
updown -= dt;
}

collide = false;

My sphere gets stuck. What is a way around this?

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:
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:
Webgl: pixel perfect tilemap rendering? The problem described below is a follow-up of Seamless tilemap rendering (borderless adjacent images).

I'm not sure to fully understand the rendering issue I have, so I'll try to describe as much as I can.

I had "seams" when rendering a tile map of tiles of 16px by 16px, more precisely I was seeing the following:

I followed the recommendations describes in this answer. It solved entirely the previous problem. However I now have the following rendering issue:

As you can see, everything is blurry.

I have also tried to do what is recommended in this answer, but it didn't change anything. I got the exact same output.

Last note, this is not always visible. When changing the position and scale of the camera, the rendering can end-up being correct. This is quite random though.

If you are interested in seeing some code, please have a look on the following links:

This gives you a rough idea of the pipeline executed
This is where the texture coordinates are generated
This is where the buffers are instantiated
This is the fragment shader
This is the vertex shader

If you think you need more details, please feel free to ask me.

sentences:
how to calculate resulting velocity and angular velocity rocket has on center of mass The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass.

*Edit
This is in 2D

e.g.
Let's call the body 'ship'

the 'ship' is 1000 (relative unit) and the center of mass is normalized at [0,0] (origin)

the 'ship' has two rockets (lets say for thrust vectoring), one at [-2,-4] (left) and one at [2,-4] (right) relative to the center of mass, and that both had nozzles pointed down (90 degree angle counterclockwise from x)

if the left rocket were to fire at say 500 (relative unit), what formula could i use to find the resulting force and angular force on the center of mass?

if it helps, the language is a superset of javascript (custom preparser similar to typescript), and i'm using a custom physics engine that only accepts force on center of mass as an array e.g. [force x, force y, force angular]. I tried to recycle my collision detection algorithm but it was like jamming a square into a circle shaped hole.

I've searched since last night and can't seem to find a formula to do this (atleast not one I can understand, I can't understand complex math notations).

Any and all help is greatly appreciated.

TL;DR
I need a formula that gives the resulting force and angular force from a offset rocket on center of mass where the result looks like:

[force x , force y , force angular]

the center of mass is normalized to origin,

and takes the variables:
rocket offset ([x,y]),
rocket angle (in degrees to center of mass),
force of rocket (in relative units)

sentences:
Save a mouse coorinates after a specific number of seconds I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java?
Please add a simple usage example.

 public void mouseMoved(MouseEvent e) {
        currentX = e.getX();
        currentY = e.getY();

        if(enemy.onWall() == true){
            timer.schedule(new TimerTask(){
                public void run() {
                    saveX = e.getX();
                    saveY = e.getY();
                    enemy.setCont(true);
                    move();
                }
            },100);
            enemy.setOnWall(false);
        }
    }

But this code saves mouse coorinates immediately and then waits for 1000ms and I have old coordinates.

sentences:
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: Game free publishing website? I am making game that will be completely free and I want to publish it. The publishing platform have to be free and it can be done without any contract or specific license. I simply upload my files make my game page and that’s all. Thanks for help, Maratonec.

sentences:
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:
Javascript - create a new bullet instance every time a user event is triggered Basically I have a function that I need to create an object of every time the user presses space(event listeners not shown here).

function arrow(){
    this.x = playerXPos + 40;
    this.y = playerYPos + 40;

    this.init = function(){
        var arrowImg = new Image();
        arrowImg.src = "arrow.png";
        c.drawImage(arrowImg,this.x,this.y);

        this.x+=10;

        if(this.x > 500){
            keySpace = false;
        }
    }
}

if(keySpace){
    arrowObj.init();
}

This works great, but I can only have 1 arrow on the screen at once, which is rather limiting. Is there some way to create a new object every time the if statement is true, and store it in an array or something?

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 do I code a 2D tile map? I'm new to game development and I want to know how to create a tile map. The map should be divided into squares, such that each square represents a location like x : 10, y : 10.

The width and height of the squares, as well as the number of squares, should be configurable.

How can I do this? (I'm using MVC .NET.

sentences:
Accurately measure time between calls to onDrawFrame (Android OpelGL ES 2.0) I'm trying to sort out some timing issues within my gameloop and I've seen something that I don't understand.

The Nexus 10 is supposed to have (as far as I'm aware) a VSync on 60Hz.  So that would be mean would it not that onDrawFrame is called by the system every 16.66ms?

When I try to measure it I get different readings on every iteration like so:

public void onDrawFrame(GL10 gl) {

        Log.v("NewTag","Millis between this call and last: "+((System.nanoTime()-newTime)/1000000));

        newTime = System.nanoTime();
}

See my results:

As you can see, it varies between 11.53ms and 21.85ms

Why is it not a constant 16.66 or is it just that nanoTime isn't acurate enough to give a more exact reading?

sentences:
Issues with background coordinate configuration in objective c with runAction? In my game I want to have two backgrounds going one after the other creating a continuous loop moving to the left. However, right now one goes, and the other does not follow it.

Here's what I currently have, which isn't working.

if((self = [super init]))
{

    self.isTouchEnabled = YES;

    background=[CCSprite spriteWithFile:@"testbackground88.png"];
    [self addChild:background z:1];
    background.position=ccp(500,240);
    id repeat1 =[CCRepeatForever actionWithAction:[CCSequence actions:
                                                         [CCMoveTo actionWithDuration:7 position:ccp(-300,240)],
                                                         [CCPlace actionWithPosition:ccp(800,240)],nil]];
   [background runAction:repeat1];

    background2=[CCSprite spriteWithFile:@"testbackground92.png"];
    [self addChild:background2 z:1];
    background2.position=ccp(500,240);
    id repeat2 =[CCRepeatForever actionWithAction:[CCSequence actions:
                                                         [CCMoveTo actionWithDuration:7 position:ccp(-300,240)],
                                                         [CCPlace actionWithPosition:ccp(800,240)],nil]];
   [background2 runAction:repeat2];
}

sentences:
Debug data visualization best practices I found debugging games especially hard for some obvious reasons. It's hard to monitor some internal values in dynamic, conditional breakpoints helps somehow, but only to detect some specific conditions. You don't get information that lead you there. Sometimes you just want to monitor some value, sometimes value are hard to interpret in their internal form (say a current path calculated by AI).

So I'm thinking about implementing kind of debug layer which will draw this information above gameplay in real time. The question is how to do it in most convenient and reusable way.

I'm currently thinking to make interface say IDebugInfo, implement it in all entities which I want to monitor, and add then to debug layer (it's a DrawableGameComponent) via GameServices. The debug layer will draw them. It can be turned on or off in realtime by removing/adding debug layer.

Does this sound good? I'm almost sure this was done many times already, is there some proved patterns?

Update. So, I implemented it this way:

// iface
public interface IDebugDrawable
{
    void DrawDebug(GameTime gameTime, SpriteBatch spriteBatch);
}

// service
public class StateManager
{
    public StateManager()
    {
        this.DebugDrawables = new List<IDebugDrawable>();
    }

    public List<IDebugDrawable> DebugDrawables { get; private set; }
}

// debug screen draw
public override void Draw(GameTime gameTime)
{
    SpriteBatch sb = this.ScreenManager.SharedSpriteBatch;
    StateManager sm = this.ScreenManager.Game.GetService<StateManager>();

    sb.Begin();

    foreach (IDebugDrawable debugDrawable in sm.DebugDrawables)
    {
        debugDrawable.DrawDebug(gameTime, sb);
    }

    sb.End();
}

// implementation in game entity
public void DrawDebug(GameTime gameTime, SpriteBatch spriteBatch)
{
    spriteBatch.DrawString(
        DebugScreen.DebugFont,
        this.Cell.ToString(),
        this.Position,
        Color.White);
}

this looks like:

sentences: Error to open Cryengine editor I am having problems with Cryengine 5, every time I open the editor through the launcher, it appears an image speaking Traceback (most recent call last): File "cry run", line 722, in module File "cryrunapy", line 375, in omd open File ubprocessapy line g59, in init File "subprocesspy", line 1112, in execute child osError: IwinError 216) This version of% 1 is not compatible with the version of Windows being run. Check your system's information if you need an o86 B2-bit or x64 (64-bit) version of the program and cont bug, I do not understand anything about it, I need explanations and resolutions

sentences:
Web workers for HTML5 game physics simulation? A bit related to this question.

The idea is to guarantee the same physics behavior as much as possible. Would it be possible to run fixed time step physics on a web worker? The UI would update itself with different/variable refresh rate.

Has anyone tried such yet?

sentences:
Creating weapons/armor procedurally In my current project I am creating a 2d game (rpg) which should be able to dynamically create new weapons and armor based on different components. So, i.e. a sample weapon would consist of barrel1, grip3, etc. It's much like Borderlands, but in 2d.

I thought about using a library like CImg in order to assemble the different parts (which are images) and then using the created sprite in my game.

Am I on the right way? Is there a better way to accomplish this task?

sentences:
How can I change a shader alpha color in script? How can I get access to the Main Color and change the alpha color ?
How do I know what is the variable of the main color in the shader code ?

If it's Main Color in the Inspector then this is the parameter I should get in the script "Main Color" ?

sentences:
How to keep the value of angle between 0 and PI in box2d In box2d, if i rotate an object multiple times in clockwise or anti clockwise direction, the value of angle ( body.getAngle() ) keeps on increasing. Like at start it is at 0 radians, then 1.57(90 deg), after complete roatation 6.28, then after second rotation 2*6.28 .
If a player keeps on rotating for too much time, angle value becomes really big.And for multiplayer games, sending big values uses more bytes.

How can i keep the value between 0 to +-3.14.Is there any solution in box2d Or
Is it a good way of sending Sin(angle) to keep the value between -1 and 1 and doing reverse of sin at client side.

sentences:
Does the ClientSizeChanged event disable exceptions? If I illegally index into a list in the subscribed ClientSizeChanged() method, no ArgumentOutOfRangeException is thrown. Is this normal behavior ? And if so, when should I expect this behaviour ?

@ Roy T. : You're right in that it is an event which I'm subscribing to as follows :

game.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);

and here's my event handler addendum (sorry, I don't know how to properly talk about these things) :

    // Event manager that responds to the window size being changed
    private static void Window_ClientSizeChanged(object sender, EventArgs e)
    {
        presentationRegion = GDM.GraphicsDevice.PresentationParameters.Bounds;
        if (currentScreen <= 0 || currentScreen > screens.Count)
            throw new Exception("currentScreen index is out of bounds of the screen list");

        List<int> myIntList = new List<int>();
        myIntList[-2] = 7; // Exception is not thrown here

        screens[currentScreen - 1].UpdateLayout();
        //Game.Window.Title += " WinCSC | ";
    }

I've put in the integer List just to demonstrate the effect. Although I originally noticed it with the screens[currentScreen-1].UpdateLayout() call.

@ Blecki : You are onto it I think. So when I trace the execution, as soon as i index into myIntList with an index of -2 execution breaks out of Window_ClientSizeChanged() and the exception is not caught. And even if I throw my own exception inside Window_ClientSizeChanged() the application continues without the debugger catching it.

sentences: Elo-like ratings for games with variable number of players I read this article about using Elo for more than 2 players in a game: http://sradack.blogspot.ru/2008/06/elo-rating-system-multiple-players.html. But in my case I have a variable number of players in each match (2-10 usually) and if I just apply this logic winner of a 2-players match will have a larger rating increase than a winner of 3-players match (if we start with the same rating we will have expected {0.5, 0.5} actual {1, 0} for 2 and expected {0.33, 0.33, 0.33} actual {0.66, 0.33, 0} for 3). Are there any variations of Elo or some other systems that could handle it?

sentences:
How can I implement procedural humanoid generation like MakeHuman? Some applications allow you to generate a human mesh by simply adjusting parameters. The results are broad and convincing: you can get from a thin asian girl to a muscular african man by just adjusting those. MakeHuman, for example, exposes the following UI:

What is the technique and what are the formulas used to implement that kind of procedural humanoid generation? Is there any published study/resource with the required information?

sentences:
MMO architecture - Highly Scalable with Reporting capabilities A friend of mine is asking me to help out on a project of his, I have done a small amount of game development before, but mainly do application and enterprise development these days.

He is asking me to look into some of the networking part of his game. I know that a huge part of this is going to involve reporting/analytics as well as scalability, so it isnt as simple as spamming a server and instantly getting responses.

In the enterprise app/web world we tend to use CQRS pattern or some other similar approach when we need to scale quite well and also take into account reporting on interactions etc.

So I imagine that most typical MMO style games (lets assume mmorpg games akin to WoW), they must employ a heavily distributed and scaleable system. So do they end up using a node system with a messaging fabric behind the scenes?

Sorry for being a bit vague but are there any sort of articles on people discussing the overall architecture for these style games?

sentences:
Unity Blurry on new Windows 4k Computer I just got a Razer 14 Inch 4k with a GTX 1060 and am having some blurry rendering in unity. Also the cursor is tiny... Here is a screen shot:

As you can see, the rendering is really blurry. I came from a mac and did not expect unity to look worse after switching to a computer with a great screen res and graphics card...

Please help!

EDIT:

I am still getting jagged shadows but now I seem to be able to fix it with changing shadow distance in Quality Project Settings:

But then the shadow disappears really quick if i have low shadow distance...

sentences:
How can i properly display 2D Pixel sprite's pixels without distortion while it's moving ? (in unity) Introduction to what i'm trying to do

Hi, I'm trying to make a 2D Pixel Platformer Game in Unity. Before that i used godot and for some reasons (not about the engine) i switched to unity. And in Unity there are things need to handle by myself, and they were handled by the engine in godot (i guess), because godot is more suitable and compatible with 2D Pixel games (i guess).
So; i am not sure why the problem happens

The Problem

In the scene, my pixel sprite is playing his Idle animation (he's only breathing so you can think of that as head and the body moving 1px up and down repeatedly) While playing that simple animation, if my sprite is big enough on the screen, there is no problem and it looks pixel perfect animation is playing without distortion (or disruption idk what was the right word). But if the character looks smaller on the screen, i mean if i scale the character down or keep the scale same and make camera's angle of view bigger, so character looks smaller (not too small a regular platformer character size), What happens is character's eyes visibly goes thinner and thicker as the character plays his animation (head and the body moving 1px up and down repeatedly). Character's eye is 2 black pixels side by side thats it. While the animation playing it kinda distorts. Height changes.

Yes I fixed it somehow but..

I fixed it, but idk how and seems like a temporary fix AND i don't think that is how it's supposed to be fixed because we wrote code, I'm okay with writing code for fixing it but first i want to know what was the problem and how to fix it in editor. aaand it just seems weird to write code for simply having a properly functioning pixel sprite animation.

How did i fixed it ? just watched this video and added the same script to the camera i have no idea how it worked and why my animation problem was occuring at the first place.

What I'm asking for

Pleaaaase somebody explain all that to me, why is that happening what are the possible and proper fixes. i'm researching for days and i thought unity had a "big community a lot of tutorials too easy to learn"

TL;DR : when playing animation pixel sprite character's some pixels distorts

version: Unity 2019.3.3f1

I imported sprite the right way (Filter mode: Point(no filter) Compression: none, Pixels per unit: 16 (that option seems suspicious maybe the problem is about that pixels and units thingies))
I can provide more information about project or directly send you the whole project if you can't reproduce the error. I'm just too curious and want to learn how to have a proper 2D display setup and finally start the fun part coding mechanics etc.
since a code about camera solved the issue the problem might be unity's camera settings because unity has no 2D special camera component while godot has Camera2D and Camera3D seperatly. These are just my guesses please teach me what you know.

sentences:
Getting unit to complete rotation before moving? I've been trying to get a unit in my project to move in a fashion similiar to that of modern MOBA games.

However, I am faced with the issue of the unit moving before the rotation is completed and the unit moving along the Y-axis.

I have tried using a cooroutine to allow the rotation to completed first, but to no avail.
Any help would be greatly appreciated.

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {

    public float smooth;
    public float speed;

    private float z;
    private float x;
    private Vector3 targetPosition;

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {

            speed = 1;
            smooth = 20;

            RaycastHit hit;

            //var playerPlane = new Plane(Vector3.up, transform.position);
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            //double hitdist = 0.0;

            if (Physics.Raycast(ray, out hit))
            {
                targetPosition = hit.point;

                x = hit.point.x;
                z = hit.point.z;
                //var targetRotation = Quaternion.LookRotation(targetPoint    - transform.position);
                //transform.rotation = targetRotation;
            }
        }

        StartCoroutine(Turn(x,z));

        //transform.position = Vector3.RotateTowards(transform.position, targetPosition, speed*Time.deltaTime, 0.0f);
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * smooth);
    }

    IEnumerator Turn(float _x, float _z)
    {
        Vector3 turn = new Vector3 (_x, 0, _z);
        transform.Rotate(turn, speed);
        yield return null;
    }
}

sentences:
LibGDX: Miscalculated polygon collision These 2 polygons are not colliding, though this method returns true:

Intersector.overlapConvexPolygons(
            new float[]{
                        100.0f, 750.0f,
                        200.0f, 750.0f,
                        100.0f, 150.0f,
                        200.0f, 150.0f
                        },
            new float[]{
                        77.0f, 695.0f,
                        91.0f, 695.0f,
                        84.0f, 681.0f
                        },
            null);

Am I using it correctly?

sentences:
How to put trees on procedural generated world created using Perlin noise I have been new to game programming but I knew little bit about Perlin noise.
So I have created a infinite world using Perlin noise but I don't be able to understand how I put trees in my world like it is put in game Factorio.
My game is a 2d top down.

sentences:
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:
Unity Input System: Rebinding composite parts I have controls for movement defined as composite Binding through Vector 2D.

I have shown in settings any single binding which is not composite. I understood that I must get a composite index for binding, which is correct, I got the right binding like up, down, ...
But whenever I click on button for change something on Move, whole game freezes. And I can't do anything... Is there something I'm missing, when rebending part of composite?
Here is my code and screen, how the control settings looks.
public void Start()
{
    Button.onClick.AddListener(() =>
    {
        Key.Text = "Listening";

        _operation = Action.PerformInteractiveRebinding()
            .WithTargetBinding(BindingIndex)
            .Start();

        _operation.OnApplyBinding((op, path) =>
        {
            Action.ApplyBindingOverride(BindingIndex, path);
            Key.Text = Action.bindings[BindingIndex].ToDisplayString();
            _operation.Dispose();
        });
    });
}

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:
Integrating game center into cocos2d I have a Cocos 2d game in which I want to have achievements and a leader-board. What are the steps I would need to take?

Thanks

P.S All of the tutorials I have found are outdated. So please write instructions

sentences: What name (if any) applies to this particular 3D rendering technique? Is there a name for this technique where when instead of rendering certain polygons, you just calculate a few key points and do the drawings in 2d? For instance, instead of rendering a sphere, you just calculate its central vector and draw a 2d circle? And what are the situations one can benefit from it?

sentences:
When animating sprites, why subtract frametime when switching between sprites instead of resetting elapsed time to zero? I am currently on chapter 3 of the book "Learning XNA 4.0". At the end of this chapter is a section on changing the animation speed of sprites.

timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds;
   if (timeSinceLastFrame > millisecondsperFrame)
   {
       timeSinceLastFrame -= millisecondsperFrame;
       //code for cycling through sprite sheet here.

This code is in the Update method. It iterates timeSinceLastFrame until it's greater than millisecondsperFrame (which I have specified as 20), and then it resets by subtracting millisecondsperFrame from timeSinceLastFrame.

If I instead reset it by writing timeSinceLastFrame = 0, the animation is noticeably slower. From what I can tell, this is due to the fact that XNA updates at 60 frames per second, so timeSinceLastFrame iterates by several milliseconds each time, and likely won't have the same value as millisecondsperFrame once the if statement compares the two.

Despite this, is there anything particularly bad about writing timeSinceLastFrame = 0? Or is timeSinceLastFrame -= millisecondsperFrame safer?

sentences:
Make an object rotate from 0 to 360 degrees by using the trigger button on the htc vive controller Hello I would like to be able to make a sphere that is attached to a cube rotate  from 0 to 360 degrees by pressing the trigger on the vive controller. As the sphere rotates I want it to be able to stop at any of the degrees in rotation. For example I press the trigger and the sphere starts rotating but I can stop the rotating at 190 degrees or 10 degrees or 359 degrees etc... I would appreciate any suggestions.
Best Regards,
Rafman27

sentences: How to handle many sprites and update? I am making a game, and I just started to think about how I am going to update and render all the sprites on the screen. Should I store all sprites in some type of list (vector or something?) and then call the draw and render method on all those? I'm using SFML and C++ if that helps.

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:
Separating .js elements/ .js element communication So I have 2 questions regarding the code below:

function goldClick(number){
    gold = gold + number;
    document.getElementById("gold").innerHTML = gold;
};

function buyMiner(){
    var minerCostG = Math.floor(100 * Math.pow(2.1,miner));
 var minerCostW = Math.floor(10 * Math.pow(3.1,miner));
    if(gold >= minerCostG){
  if(wood >= minerCostW){
   miner = miner + 1;
   gold = gold - minerCostG;
   wood = wood - minerCostW;
   document.getElementById('miner').innerHTML = miner;
   document.getElementById('gold').innerHTML = gold;
   document.getElementById('wood').innerHTML = wood;
    }};
    var nextCostMG = Math.floor(100 * Math.pow(2.1,miner));
    document.getElementById('minerCostG').innerHTML = nextCostMG;

 var nextCostMW = Math.floor(10 * Math.pow(3.1,miner));
    document.getElementById('minerCostW').innerHTML = nextCostMW;
};

window.setInterval(function(){

 goldClick(miner);

}, 1000);

Question 1: Is it possible to separate these functions (goldclick, buyminer, window interval,) into their own documents so that if I have say, 50 different XXXXclick functions, and 50 buyXXXX functions and 50 interval functions, I have just 3 .js documents instead of 50.

Question 2: If it is possible to separate them, how would I ensure that they are communicating with each other and variable values are not being confused or sent to the wrong <span> in the displaying html.

sentences:
How can rotate a 2D textured quad in legacy OpenGL immediate mode? I have a texture of a tank, and I want to it appearance on the screen depends on its current direction, so I decided to use rotating texture functions of OpenGL. I followed some advices through Google and received unsuccessful results. Anyone can help me with this problem?

This is my render() function:

#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3

void GameObject::render()
{
    glBindTexture(GL_TEXTURE_2D, textureID);
    glLoadIdentity();
    glTranslatef((GLfloat)coord.getX(), (GLfloat)coord.getY(), 0.0f);
    glDrawArrays(GL_QUADS, 0, 4);
}

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

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

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

sentences:
What is wrong with my collision detection code? I want to check collision detection between two bitmaps but I am not getting how to do it. I read several queries and tutorials but didnt get properly. I want to check by their width and height. I have implemented some logic also but not getting where I am doing wrong

public boolean collision(){
        for(int i=0; i<9; i++){
            for(int j=0; j<14; j++){
                if(frog.getX() < x + getX() || frog.getY() < y + getY() || frog.getX() > x || frog.getY() > y){
                //if(other.getWidth() > x && other.getWidth() < x + width && >other.getHeight() > y && other.getHeight() < y + height);
                    frog.frogShiftDown();
                }
            }
        }
        return true;
    }

public void draw(Canvas canvas){
        canvas.drawBitmap(bmp, x, y,null);
        carmove();
        collision();
    }

sentences:
Design patterns in Game Physics In the frames of a number crunching compatible programming language (say.. C++), what would be an elegant solution for adding self collision, external collision and integration step (Euler, etc.) updates to an object? (say the already abused mass spring system).

Say the object class is this one:

class DeformableObject
{
    public:
    DeformableObject();
    virtual ~DeformableObject();
    protected:
    vector <vec3<Real> > pos;
    vec3<real> fEval(int idx); // - the internal force due to ellasticity at the idx-th node
    friend class Integrator;
}

For example, in case of the integration method, I was thinking of having an abstract Integrator class and derive from it to add specific methods (Euler, Verlet, Midpoint, you name it).:

class Integrator
{
    public:
    Integrator();
    virtual ~Integrator();
    vec3<Real> Step(Real DTime, DeformableObject * dObject, int idx);
}

Now, since I'd like to switch or perhaps let different instances of the same deformable object use  integration method A and the other use integration method B (for "benchmarking" purposes), is it safe to "think inside the box" and refer to either the Bridge or Strategy pattern? Which is more suitable and less ambiguous, especially performance-wise?

What about a self collision controller approach? Should I just add a self collision method to the DeformableObject class or "befriend" it with a Collider class? And what about external collisions, with different objects - how should that aspect be approached, at least at the conceptual level: considering the naive, brute pair-to-pair collision queries, if two objects collide, their points must be updated in the sense that velocities and forces are added to the points' own dynamic quantities (e.g. restitution forces, penalty forces, friction forces, reflected velocities, impulse conservation velocity changes, etc.).
I know this is a broad topic, but I don't know which book does tackle these natural problems for a novice programmer. Thanks for your patience in reading this question!

sentences:
Unity 4.6: Position jumps when switching Canvas render mode from Overlay to camera in code In the project I am currently working on I have two sets of main UI: one set that is on the screen at all times for the players use, and the second set which the player can open and look at to gauge their progress and see things about the game world(think pokedex) . The second set also has 3d models in front of the UI in places. To achieve this, I have a script that changes the canvas render mode to Screen Space - Camera when the 2nd UI opens, and I instantiate a 3d model in front of it. My problem is when I switch the canvas back to Screen Space - Overlay, it jumps down in the corner.

My to switch the canvas mode to Camera is as follows:

 /*--Adjust canvas--*/
     canvas.renderMode = RenderMode.OverlayCamera;
     canvas.planeDistance = canvasPlaneDistance;  //1 in this case

My code to switch the canvas back to overlay looks like this:

 /*--Adjust canvas render mode and position--*/
     canvas.renderMode = RenderMode.Overlay;

I discovered that it seems the problem is because the z pos of the Canvas's Rect Transform changes value when I initially change the render mode and this displaces it when I switch it back. I can adjust it back into position in the code by doing this:

canvas.GetComponent<RectTransform>().localPosition =
         new Vector3(canvas.GetComponent<RectTransform>().localPosition.x,
                     canvas.GetComponent<RectTransform>().localPosition.y,
                     0);

But this causes a disorienting flicker which I would rather avoid. Is there any workaround or fix for this?

sentences:
Create shape from points / lines in editor and mathematically calculate nearest points within shape If I want an editor that accepts "points" of a minimum of three (a triangle) and I just add some points first, like this:

how can I mathematically connect these corners (points) into an object of multiple triangles? so amount of triangles looks like something like this, by connecting nearest point:

and then later render this and also being able to define what it is and check for collisions on this ground, so I can create more than Rectangle based "bricks" on a Platformer for example. Also being able to texturize the whole object without it looking ugly.

Any ideas? Or what is this called in game programming?

sentences:
How can I snap a game object's position to a grid? I'm making a game that involves "falling block" gameplay elements. The problem is, I'm not quite sure how to make it so that the blocks will snap to some kind of grid, in other words, I'm not sure how it will pick the closest cell to its position.

The blocks are not continuously snapping to a grid (i.e. they are subject to gravity). Any tips?

sentences: Using Quaternion in libGDX Can someone give me an explanation about how to use the Quaternion class in libGDX to move my camera around a sphere or just set it up, manipulate it, and apply it general? I am trying to acheive orbiting my camera around a sphere without gimbal lock, and I'm not having any luck getting the camera to do anything by using quaternions...

sentences:
Finding the normals of an oriented bounding box? Here is my problem.

I'm working on the physics for my 2D game.

All objects are oriented bounding boxes (OBB) based on the separate axis theorem.

In order to do collision resolution, I need to be able to get an object out out of the object it is penetrating.

To do this I need to find the normal of the face(s) that the other OBB is touching.

Example:

The small red OBB is a car lets say, and the big OBB is a static building. I need to determine the unit vector that is the normal of the building edge(s) the car is penetrating to get the car out of there.

Here are my questions:

How do I determine which edges the car is penetrating.
I know how to determine the normal of an edge, but how do I know if I need  (-dy, dx) or (dy, -dx)?
In the case I'm demonstrating the car is penetrating 2 edges, which edge(s) do I use to get it out?

Answers or help with any or all of these is greatly appreciated.

Thank you

sentences: Is there any opensource game frameworks in browser? I have been looking for and found any.

sentences:
Drawing Colored Geometry in OpenGL using SDL First off, I will confess I have asked the same question on stackoverflow, but I think this forum might be a better fit.

I am trying to combine 2 things using SDL:

Draw a webcam feed via an SDL_Surface (from OpenCV).
Draw some plain colored geometry on top, using OpenGL.

The problem I have is that—I think—the geometry is textured by the screen texture that I draw the webcam feed in, even if I call glDisable(GL_TEXTURE_2D) right before drawing the quad. See the screenshot below, the square in the top-left is supposed to be white, but it seems to have the color of the bottom-right texel.

The code in my Display function is as follows:

// screen_surface_ contains a frame from the camera
SDL_UpdateTexture(screen_texture_, NULL, screen_surface_->pixels, screen_surface_->pitch);
SDL_RenderClear(renderer_);
SDL_RenderCopy(renderer_, screen_texture_, NULL, NULL);

glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glColor3f(1.0, 1.0, 1.0);
glBegin( GL_QUADS );
  glVertex3f( 10.0f, 50.0f, 0.0f ); /* Top Left */
  glVertex3f( 50.0f, 50.0f, 0.0f ); /* Top Right */
  glVertex3f( 50.0f, 10.0f, 0.0f ); /* Bottom Right */
  glVertex3f( 10.0f, 10.0f, 0.0f ); /* Bottom Left */
glEnd( );

glColor3f(1.0, 1.0, 1.0);
SDL_RenderPresent(renderer_);

You can view all the code of relevant functions here.

I got a blanket answer saying "Don't mix SDL and OpenGL draw code"; as addressed in this bug report. But that would mean I'm simply stuck waiting for that bug to be fixed, so I'm still looking for a way to disable texturing after SDL_RenderCopy has been called.

Edit: I've confirmed that it's indeed still using the screen_texture_. Setting the texCoord to values between 0-100 shows a part of the webcam feed. (I tried 0-1 first but then I read that texCoords are different for rectangular images).

sentences:
Dialog Title Does Not Fit I successfully added my own font to the default .json file and it displays, however I get some weird sizing issues. Specifically when I try to create a Dialog. This is what it looks like: Ignore the fact that that says "and"As you can see, the title does not fit and the button seems a bit big... This is how I create the dialog:

Dialog d = new Dialog("Error", RBResources.gameSkin);
        d.add(new Label("You cannot continue and empty game.", RBResources.gameSkin));
        TextButton b = new TextButton("Ok", RBResources.gameSkin);
        d.button(b);
        d.show(this);

This is how the skin is initialized:

gameSkin = new Skin(Gdx.files.internal("skins/uiskin.json"));

All I did to add the font was create the font with Hiero, add it to directory with the .json, and change the BitmapFont file reference from "default.fnt" to "text.fnt" (text is what I called the font).

EDIT
I tried changing the font size to 32 (before it was 48) and this is what it gives me:

The title still exceeds the boundaries of the title box. Does that mean, in the .png file containing the different button states and other Drawables, that I have to manually adjust the window Drawable to fit the title or is this a bug?

sentences:
A* Algorithm for Tactical RPGs? I'm messing around with writing a really poor tactical RPG in C++. So far I have a 2D tile map and just got the A* algorithm working based on the pseudocode in the wikipedia.

But real tactical RPGs don't just find the best path on a flat plane and move there. They typically have limited move ranges and must climb up or down. If you've ever played Final Fantasy Tactics these would be affected by the Move and Jump stats. This is where I get lost. How do I alter the A* algorithm so that it finds the best path toward a target, but the path is only so many tiles long? How should I take height differences and jump stats into account? How do I implement jumping over a gap?

If it helps, right now my map is represented by a Vector of Tile objects. Each tile has pointers to the North, South, East, and West tile, which are set to a nullptr if no tile exists there, such as along the edge of the map or if a tile is set to non-passable.

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:
Background color gradient with SDL I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window will be, using an image is no option).

Please note: I need to achieve this using only the C standard library and the SDL, no other library and no C++.

sentences:
How can i use draw gizmos to draw dots between each waypoints? private void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.blue;

        for (int i = 0; i < waypoints.Length; i++)
        {
            Gizmos.DrawLine(transform.position, target.position);
        }
    }

Before that i'm not sure how to draw at all between all the waypoints.

Instead line maybe to draw spheres or something else and scale it to dots/points ? And i also want to be able to set and change the number of dots/points between each two waypoints.

For example from waypoints[0] to waypoint[1] to draw 30 dots and from waypoints[1] to waypoints[2] 10 dots or just the same maount of dots between all waypoints.

For not not curves lines only straight lines like showing the path between the waypoints in game view.

sentences:
creating a simple cartoon like light effect I could like to create a really simple light engine that does not eat to much CPU and will produce this effect:

I am using libgdx for my game with box 2D light (which is too heavy for my needs). I have no idea of what is the best solution to create this effect (shapeRenderer? pure shader?). For the moment I don't need any shadow casting, but I would like to be able to maintain multiple light sources and to add color to the light.

sentences:
Avoid shaking artifacts in 3D continuous collision detection I am programming a 3D game physics engine that uses continuous collision detection to avoid my objects from being able to "tunnel" through the geometry.

Here is basically how it works:

Execute a swept-object/world collision check
Move the object up to the exact point where it collides
If no time is remaining, everything is done, just stop
Else, update the velocity so that the object "slides" in a direction orthogonal to the collision normal before returning to step 1. This is the formula I use for this sliding (I just remove the component of the motion in the normal direction): velocity = velocity - (velocity dot normal) * normal

My problem occurs in this kind of situation:

(Do not take into account faces other than A and B, their only purpose is the emphasize the 3D aspect of the shape)

In the first frame, the object first follows the black arrow, then collides face A. It slides correctly on face A (first red arrow) and then climbs on face B (second red arrow). The problem with this algorithm is precisely the fact that it can climb on the opposite face: after several consecutive frames (here the other frames are the cyan and green ones), the general motion will follow the good path (the intersection line of planes A and B), but with a local left-right shaking artifact that I would appreciate getting rid of.

Any idea to solve this would be greatly appreciated.

sentences:
How can I make OpenGL textures scale without becoming blurry? I'm using OpenGL through LWJGL.

I have a 16x16 textured quad rendering at 16x16. When I change it's scale amount, the quad grows, then becomes blurrier as it gets larger.

How can I make it scale without becoming blurry, like in Minecraft.

Here is the code inside my RenderableEntity object:

public void render(){
    Color.white.bind();
    this.spriteSheet.bind();
    GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0,0);
        GL11.glVertex2f(this.x, this.y);
        GL11.glTexCoord2f(1,0);
        GL11.glVertex2f(getDrawingWidth(), this.y);
        GL11.glTexCoord2f(1,1);
        GL11.glVertex2f(getDrawingWidth(), getDrawingHeight());
        GL11.glTexCoord2f(0,1);
        GL11.glVertex2f(this.x, getDrawingHeight());
     GL11.glEnd();

}

And here is code from my initGL method in my game class

GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glClearColor(0.46f,0.46f,0.90f,1.0f);
GL11.glViewport(0,0,width,height);
GL11.glOrtho(0,width,height,0,1,-1);

And here is the code that does the actual drawing

public void start(){
    initGL(800,600);
    init();

    while(true){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

        for(int i=0;i<entities.size();i++){
            ((RenderableEntity)entities.get(i)).render();
        }

        Display.update();
        Display.sync(100);

        if(Display.isCloseRequested()){
            Display.destroy();
            System.exit(0);
        }
    }
}

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:
How to get the center of a rotated rectangle regardless of point of rotation I need help working out the centre coordinate of a rotated rectangle regardless of the point of rotation (i.e. the rectangle doesn't rotate around its center). I do not know the coordinates of the corners, so it's not a simple case of dividing those.

It's easier to show than tell, so here's example 1:

http://gametest.mobi/rotate/index.php?f=point1.js&d=tests

Click to start/stop the rotation.

In this example I've got my sprite with the rotation point set to the bottom-right corner of it. If you click you'll see it rotate around that. I need to find a way to work out the coordinates of the center of the rectangle (represented by the middle red cross-hairs.)

Here is another example, this one is set to rotate at 0.3 x 0.8 into the rectangle:

http://gametest.mobi/rotate/index.php?f=point3.js&d=tests

You can see I added the circle into each demo, this is positioned on the sprites x/y coordinate and the radius was calculated from the distance of the center of the rectangle to the rotation origin.

I can visually see the correlation between the point of rotation and the circle, and I can see it tracks the centre of the rectangle beautifully on the circles perimeter! But I'm falling at the last hurdle in trying to calculate the actual value, so desperately need a fresh set of eyes on it please.

sentences:
Get type of the object where attribute was declared - Hide In Derived Inspector Attribute I want to implement a custom Unity inspector attribute, like usual ones [HideInInspector] or [Range(0, 100f)].

This attribute should hide a field from the inspector if it's inherited from a base type, rather being defined directly in the type of the object we're inspecting.

So, for example, if I have these classes...

public class Enemy : MonoBehaviour {
    [SuperField]
    public int EnemyHealth;
}

public class GiantMonster : Enemy {
    [SuperField]
    public int Armor;
}

then the inspector for a base Enemy should show a control for the EnemyHealth variable, but when inspecting a GiantMonster we should not see a control for this variable.

So far I have my attribute:

public class SuperFieldAttribute : PropertyAttribute {}

which has its own PropertyDrawer:

[CustomPropertyDrawer(typeof(SuperFieldAttribute))]
public class SuperFieldDrawer : PropertyDrawer {

    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
        // ...
    }
}

Inside OnGUI I need to access/find the type where the field we're drawing was declared with the [SuperFieldAttribute].

So if SuperFieldDrawer.OnGUI() is called for the SerializedProperty corresponding to GiantMonster.EnemyHealth, I should be able to determine that the type where EnemyHealth was declared is Enemy and not GiantMonster. (I'll use this to hide the field so it's not drawn)

And if SuperFieldDrawer.OnGUI() is called for the SerializedProperty corresponding to GiantMonster.Armor, I should be able to determine that the type where Armor was declared is GiantMonster itself. (Meaning I should proceed and draw the field)

So far I've found ways to access the type of the component we're inspecting, but not the type where the field was first declared, so that's the missing piece I need to fill in.

It's OK if I use reflection and so on; any method is good, performance isn't a concern.

sentences:
Libgdx Box2D and Screen Viewport Scaling I am currently having problems getting an easy to manage system of scaling my units for use with box2D. Normally I would create virtual units to go along with me viewport and camera but since I am using a screen viewport this is not as easy as it seems. I have tried scaling my viewport by setting the units per pixel to 1/100 which will then scales my world by 100 times. Then I set set my sprite batch projection to be 1/100 as well as my tiles map renderer scale to be 1/100 this led to my box2D elements of size .64 to be 64 pixels large which leads to a good looking simulation as well as a good size. The only problem is then any sprite I use must also be scaled with a scale of 1/100. Also my scene 2d HUD must also be scaled. This works but it is confusing to manage and very time consuming to write out all the scaling etc. I am looking to see if there is a way to use world units where 1 world unit is 100 pixels to make my box2D elements and use screen coordinates for the rest of my drawing etc. Also if there is an easier way to do this that I am not thinking of please let me know. I will try to post code later tonight when I am back at my computer.

EDIT:
I created a test project to work on just the scaling factor of my game and here is my test code.

@Override
public void create () {
    camera = new OrthographicCamera();
    camera.translate(new Vector3(camera.viewportWidth / 2, camera.viewportHeight / 2, 0));
    vp = new ScreenViewport(camera);
    vp.setUnitsPerPixel(1/100f);

    batch = new SpriteBatch();
    img = new Texture("badlogic.jpg");
    sprite = new Sprite(img);
    sprite.setScale(1/100f);

    world = new World(new Vector2(0, (float) -9.8), true);
    BodyDef bdef = new BodyDef();
    bdef.type = BodyType.DynamicBody;
    bdef.position.set(1, 1);
    body = world.createBody(bdef);
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();
    shape.setAsBox(1, 1);
    fdef.shape = shape;
    body.createFixture(fdef);

    dr = new Box2DDebugRenderer();

    map = new TmxMapLoader().load("Levels/bricksTest.tmx");
    mapRenderer = new OrthogonalTiledMapRenderer(map, 1 / 100f);
}

@Override
public void render () {
    camera.update();
    sprite.setX(body.getPosition().x - sprite.getWidth() / 2);
    sprite.setY(body.getPosition().y - sprite.getHeight() / 2);
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    mapRenderer.setView(camera);
    mapRenderer.render();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    sprite.draw(batch);
    batch.end();
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    dr.render(world, camera.combined);
}

@Override
public void resize(int width, int height) {
    vp.update(width, height, true);
}

This code runs and produces the expected results, but I feel there has to be some easier way. Also ignore any of the size numbers/horrible sloppiness of this code because this is only a test project and is not from my actual game.

This is a picture of the final result. Note: The box2D box is not the same size as the image because I wanted the box to be about the size of a character from my game for this test. I also moved the position of the box to x = 5 and y = 5 so it is easier to see.

sentences:
I want to render some surfaces in GLSL with normal maps, and some without I have normal mapping working in my game, but I want to only use normal mapping for some surfaces, and not others.

Right now, as far as I can tell, my shader is applying an incorrect normal of (0, 0, 0) in tangent space to my non normal mapped surfaces, since no textures are bound to the sampler.

Is there a suitable way of detecting that nothing is bound to a sampler in GLSL and then using a flat normal instead? I've also found old posts around the web recommending the following:

Using a dummy 1x1 texture with the color (128, 128, 255) - this will lose Phong interpolation.
Switching shader programs for normal mapped and non-normal mapped surfaces - I get the feeling that I'd end up duplicating a lot of code this way, especially when I start implementing specular maps, parallax displacement maps, etc.

Are either of these still recommended or is there a new feature to query the sampler that I could make use of? Should I be doing it one way over another for performance reasons?

Here is my fragment shader:

#version 330 core

in vec2 UV;
in vec3 tangentSpaceLightDir;
out vec4 outColor;
uniform sampler2D diffuseMap, normalMap;

void main (void)
{
    vec4 texel = texture(diffuseMap, UV);
    vec4 ntexel = texture(normalMap, UV);

    // I want to use vertex normal here, if nothing is bound.
    vec3 N = normalize(ntexel.xyz * 2.0 - 1.0);

    vec3 L = normalize(tangentSpaceLightDir);

    float lambertTerm = dot(N, -L);

    vec4 finalColor = vec4(0.0);
    if (lambertTerm > 0.0)
    {
         finalColor += vec4(lambertTerm, 1.0);
    }

    outColor = finalColor * texel;
}

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:
How to make a customizable 3D character with maya for a flash game i'm working in a 3d flash role-playing game with alternativa 3d engine.

My game requires the main character to be customizable, for example, the player must be able to add a mustache, a hat, a tie, change colors of sking, clothing, etc, to the character.

How am i able to do that?.

(I'm using maya for modeling.)

Thanks in advance.

sentences:
2D Distance Field as collision handler method Pixeljunk Shooter has really cool fluid simulation.

I found the dev's video explaining what they did. Here

I understand that it is particle based simulation Smoothed Particle Hydrodynamic

I can find adequate resources and even books covering this topic, but I can't find resources for the "collision"

All I can find about using distance field for collision are very tough article and some vague description

The second resource states

  Using a signed distance field then makes it very easy to check if a particle is colliding with our environment - simply sample the distance field at the particle position and if the magnitude of the distance is negative we have a collision (ignoring the potential for tunneling for the time being). Once a collision is detected we can then backtrack along the particle trajectory until we find where the particle collided with the surface. To calculate the collision response we then need to determine the surface normal - this is again easy as we simply need to calculate the gradient of the distance field and normalize the result.

Does it mean that I just backtrack my particle till it is no longer "inside the object"?
Then take average distance from surrounding, then take normalized average as "normal vector of the sourface"?

Is that "all" I need to do?

If such is the case, don't I need to render only "inside" of distance field? I don't need how close edges are when I am outside an object? Or do I need to know that as well?

I really need clear step by step teaching material in which I can really look at it and read it through to understand. Are there any resource that teaches this technique?

sentences:
Algorithms for Automated Game Levels Creation ( 2D )? I am trying to algorithmically create a game like the one in the picture below

I am trying to Create random levels from an algorithm.

Ideally, the algorithm will take into account the desired difficulty size and the board size ( N x N ) and produce a random map based on those 2 things.

I personally don't know how to determine difficulty in this game nor how to mathematically model it.

sentences:
How would you handle different level-types in an entity-component-system? Im currently developing a game with the entity-component system of Ashley in Libgdx (Java).

In the game you would be able to walk on planets (2D not 3D), fly in the star system and traverse between systems. These are all different types of levels that all need to be handled and rendered differently.

So my question is, how would you differentiate between these types (for example in the renderer), should I add a case for every type in the renderer or split it up somehow?

sentences: How to place same canvas on multiple cameras in Unity? I know how to do It on one, but I don't know how to do it using multiple cameras, 3 of them are important, i want to show the whole UI except for the minimap. I need to change the camera angle on some spots, while keeping the same canvas for displaying the number of coins XP and the current level.

sentences:
How can I stop the endless output in Unity console? I want to print the sum of two numbers, but only when I press the enter key. Pressing any other key should give me the message "Invalid Key".
Now the output I am getting is an endless loop of "Invalid key", until I press another button.

How do I only produce the output when I press a key?

using UnityEngine;
using System.Collections;

public class LearningScript : MonoBehaviour {

    public int number1 = 5;
    public int number2 = 10;
    public bool condition;
    public int answers;

    void Update()
    {
        if (Input.GetKey (KeyCode.Return))
            condition = true;
        else
            condition = false;

        if (condition)
            Debug.Log (answers);
        else
            Debug.Log ("INVALID KEY");
    }

    void Start()
    {
        answers = addTwonumbers (number1, number2);
    }

    int addTwonumbers(int num1,int num2)
    {
        int result = num1 + num2;
        return result;
    }
}

sentences:
Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#? I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that must be able to move to certain points, so the A* algorithm sounds very appealing to me.

However, as I went through the Half-Life 2: Episode 1 Developer Commentary, I found another solution that the workers at Valve have been using: a line system. I couldn't find a screenshot and alas, I couldn't find the developer node to show the system. :(

Basically, there's a whole system drawn on the level map for AI to move along. If there happens to be an enemy that shows up in a certain section that might not be on the AI's line of sight, then the AI can break out of the line and attack said enemy.

I'm building the game in C# (XNA) and I wanted to know if it would be better to use the algorithm, the line system or even both to achieve pathfinding?

sentences:
Estimate the time it takes for an object to travel from point A to point B I have an object with vec2 position, velocity, and destination with 2 variables maxspeed and acceleration. In each step, its position is calculated as follows:

vec2 desiredVel = destination - position;

var dist = desiredVel.length;
if (2 * dist * acceleration < currentSpeed*currentSpeed)
    desiredVel.zero();

vec2 steering = desiredVel - velocity;
steering.setLength(acceleration);

velocity += steering * dt;
velocity.truncate(maxspeed);
currentSpeed = velocity.length();

position += velocity * dt;

Basically the object will accelerate to its maxspeed towards destination, then maintains  speed until the a certain distance to destination. At that distance, the object will decelerate at the -max acceleration rate so that it stops approximately to the destination point.

My question is that if I have an object with an initial velocity and I set a destination point, how can I estimate the time it will take to reach the destination point? Assuming its maxspeed and max acceleration doesn't change and no other force/acceleration applies to the object in the path.

sentences:
OpenGL ES respecting alpha for background but not for objects I have a problem with the alpha of my game, maybe it is solved in another post but as I am new in OpenGl and Game developemnt I dont understand most of the vocabulary and cant find a solution.

The problem is I have enemies with alpha and coins with alpha that works great, but when an enemy pass through the coin it take seem the background instead of the coin(same with shoots)

there is a image explaining it

There is the code to draw enemys and coins

public void drawEnemy(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    switch (type)
    {
        case 0:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.textureIDs[0]);
            break;
        case 1:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs[0]);
            break;
        case 2:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs2[0]);
            break;
    }

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

public void drawCoin(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.CointextureIDs[0]);
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

sentences:
Creating rectangles from the inner part of a texture2D This may be hard to understand, but I'll do my best.

You will see that the first image is a normal Mario, and the other is the result I am looking for. I'm trying to find a way to extract rectangles (biggest possible to smallest) from a texture2D, without overlapping rectangles. If the pixel is completely transparent, leave it out of the loop. I know it would be really easy to implement a rectangle for every pixel, but millions of rectangles isn't going to help performance wise. The goal is to get rectangles somewhat like this, decreasing the total rectangles greatly.

Any ideas or links? Anything would be great.

sentences: Is it possible to make an obj with single triangle I am not good in using blender so i wanted to ask if it is possible to make an object with just one triangle and how would it look like, will the no of triangle increase if you scale it up.

sentences:
How do you draw a straight line between two points in a bitmap? I'm playing around with height maps (bitmaps), trying to create some of my own in my game, and for that I need to implement some basic drawing methods. I've quickly realized that drawing straight lines isn't as basic as I thought.

It simple's if your points share an X or Y coordinate, or if they are aligned so you can draw a perfectly diagonal line. But in all other cases its trickier.

What algorithm do you use to determine what pixels need to be coloured for it to become a "straight" line ?

sentences:
Checking collision in an array - is there a better way? MSDN suggested this, but I'm worried about it slowing down the game when there are a lot of objects to check:

for (int i = 0; i < enemy.Length; i++)
{
   if (enemy[i].isActive)
   {
      BoundingSphere enemySphere =
         new BoundingSphere(enemy[i].position,
         enemy[i].Model.Meshes[0].BoundingSphere.Radius *
         enemy[i].modelBoundingConstant);
      for (int j = 0; j < bulletList.Length; j++)
      {
          if (bulletList[j].isActive)
          {
             BoundingSphere bulletSphere = new BoundingSphere(
                bulletList[j].position,
                bulletModel.Meshes[0].BoundingSphere.Radius);
             if (enemySphere.Intersects(bulletSphere))
             {
                enemy[i].health -= 10;
                bulletList[j].isActive = false;

                break; //no need to check other bullets
             }
          }
       }
   }
}

Nested looping like this just doesn't seem like the most efficient way to check if a bullet connects with an enemy. Is there a better way?

sentences:
Sorting for 2D Drawing I am drawing a game in 2D (isometric)
My objects have their own arrays. (i.e. Tiles[], Objects[], Particles[], etc)
I want to have a draw[] array to hold anything that will be drawn.
Because it is 2D, I assume I must prioritise depth over any other sorting or things will look weird.
My game is turn based so Tiles and Objects won't be changing position every frame. However, Particles probably will.

So I am thinking I can populate the draw[] array (probably a vector?) with what is on-screen and have it add/remove object, tile & particle references when I pan the screen or when a tile or object is specifically moved. No idea how often I'm going to have to update for particles right now. I want to do this because my game may have many thousands of objects and I want to iterate through as few as possible when drawing.

I plan to give each element a depth value to sort by.

So, my questions:

Does the above method sound like a good way to deal with the actual drawing?
What is the most efficient way to sort a vector? Most of the time it wont require efficiency. But for panning the screen it will. And I imagine if I have many particles on screen moving across multiple tiles, it may happen quite often.

For reference, my screen will be drawing about 2,800 objects at any one time. When panning, it will be adding/removing about ~200 elements every second, and each new element will need adding in the correct location based on depth.

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:
OpenGL application, not working on AMD. Recently,

I moved an app I am building from a computer with Intel & Nvidia to a computer with AMD CPU & GPU.

The problem is, that glDrawElements gives me bad access location and I can't figure out why.

The render function is the following:

template<class PositionData> void drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color, GLuint text)
{
  // draw mesh
  const unsigned int *faces = mesh.getFaces().data();
  const unsigned int nFaces = mesh.numFaces();
  const Vector3r *vertexNormals = mesh.getVertexNormals().data();
  const Vector2r *uvs = mesh.getUVs().data();

  // Update our buffer data passed to GPU
  glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 3 * pd.size(), &pd.getPosition(0)[0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  glBindBuffer(GL_ARRAY_BUFFER, vbo[1]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 2 * mesh.getUVs().size(), &uvs[0][0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  glBindBuffer(GL_ARRAY_BUFFER, vbo[2]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 3 * mesh.getVertexNormals().size(), &vertexNormals[0][0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  // Binding element array and drawing. numFaces * 3 triangles per face.
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
  glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(unsigned int) * mesh.getFaces().size(), mesh.getFaces().data());

  glDrawElements(GL_TRIANGLES, 3 * nFaces, GL_UNSIGNED_INT, BUFFER_OFFSET(0));

  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

Math, vectors and matrices are from Eigen.
Any ideas or any other code part you would like to see?
Bare in mind that this exact code works fine with nVidia.

Thanks.

sentences:
Hue, saturation, brightness, contrast effect in hlsl I am new to pixel shader, and I am trying to write a simple brightness, contrast, hue, saturation effect. I have written a shader for it but I doubt that my shader is not providing me correct result, Brightness, contrast, saturation is working fine, problem is with hue. if I apply hue between -1 to 1, it seems to be working fine, but to make things more sharp, I need to apply hue value between -180 and 180, like we can apply hue in Paint.NET.

Here is my code.

// Amount to shift the Hue, range 0 to 6
float Hue;
float Brightness;
float Contrast;
float Saturation;
float Alpha;

sampler Samp : register(S0);

// Converts the rgb value to hsv, where H's range is -1 to 5
float3 rgb_to_hsv(float3 RGB)
{
    float r = RGB.x;
    float g = RGB.y;
    float b = RGB.z;

    float minChannel = min(r, min(g, b));
    float maxChannel = max(r, max(g, b));

    float h = 0;
    float s = 0;
    float v = maxChannel;

    float delta = maxChannel - minChannel;

    if (delta != 0)
    {
        s = delta / v;

        if (r == v) h = (g - b) / delta;
        else if (g == v) h = 2 + (b - r) / delta;
        else if (b == v) h = 4 + (r - g) / delta;
    }

    return float3(h, s, v);
}

float3 hsv_to_rgb(float3 HSV)
{
    float3 RGB = HSV.z;

    float h = HSV.x;
    float s = HSV.y;
    float v = HSV.z;

    float i = floor(h);
    float f = h - i;

    float p = (1.0 - s);
    float q = (1.0 - s * f);
    float t = (1.0 - s * (1 - f));

    if (i == 0) { RGB = float3(1, t, p); }
    else if (i == 1) { RGB = float3(q, 1, p); }
    else if (i == 2) { RGB = float3(p, 1, t); }
    else if (i == 3) { RGB = float3(p, q, 1); }
    else if (i == 4) { RGB = float3(t, p, 1); }
    else /* i == -1 */ { RGB = float3(1, p, q); }

    RGB *= v;

    return RGB;
}

float4 mainPS(float2 uv : TEXCOORD) : COLOR
{
    float4 col = tex2D(Samp, uv);

    float3 hsv = rgb_to_hsv(col.xyz);

    hsv.x += Hue;
    // Put the hue back to the -1 to 5 range
    //if (hsv.x > 5) { hsv.x -= 6.0; }
    hsv = hsv_to_rgb(hsv);
    float4 newColor = float4(hsv,col.w);

    float4 colorWithBrightnessAndContrast = newColor;

    colorWithBrightnessAndContrast.rgb /= colorWithBrightnessAndContrast.a;
    colorWithBrightnessAndContrast.rgb = colorWithBrightnessAndContrast.rgb + Brightness;
    colorWithBrightnessAndContrast.rgb = ((colorWithBrightnessAndContrast.rgb - 0.5f) * max(Contrast + 1.0, 0)) + 0.5f;
    colorWithBrightnessAndContrast.rgb *= colorWithBrightnessAndContrast.a;

    float greyscale = dot(colorWithBrightnessAndContrast.rgb, float3(0.3, 0.59, 0.11));
    colorWithBrightnessAndContrast.rgb = lerp(greyscale, colorWithBrightnessAndContrast.rgb, col.a * (Saturation + 1.0));
    return colorWithBrightnessAndContrast;
}

technique TransformTexture {
    pass p0 {
        PixelShader = compile ps_2_0 mainPS();
    }
}

Please If anyone can help me learning what am I doing wrong or any suggestions?
Any help will be of great value.

EDIT:
Images of the effect at hue 180:

On the left hand side, the effect I got with @teodron answer. On the right hand side, The effect Paint.NET gives and I'm trying to reproduce.

sentences:
A logic error. canvas: balls physics, bounce Hi I was making a program that simulate a bunch of balls bouncing, but the problem is some balls got stuck to the floor. Since it's a logic error, it is kind of difficult to find. Can someone help, I let the snipper code below thanks.

var output = document.getElementById('output');
var canvas = {};
var ball = [];

canvas.obj = document.getElementById('canvas');
canvas.ctx = canvas.obj.getContext('2d');
canvas.width = canvas.obj.width;
canvas.height = canvas.obj.height;
canvas.clear = function() {
  canvas.ctx.clearRect(0, 0, canvas.width, canvas.height);
};
canvas.preferences = function() {
  canvas.ctx.strokeStyle = 'rgb(210,210,210)';
  canvas.ctx.lineWidth = 1;
};

const FRICTION = .9;
const MIN_ACCELERATION = 1;
const FRICTION_INCREASE = .015;
const DIST = 20;
const N_BALLS = 50; // BALLS NUMBER
const GROUND = canvas.height;

var Object = function() {
  this.yVel = 0;
  this.gForce = 0.2;
  this.friction = FRICTION;
  this.full = false;
  this.run = true;

  this.draw = function() {
    canvas.ctx.beginPath();
    canvas.ctx.arc(this.x, this.y, this.radio, 0, Math.PI * 2);
    canvas.ctx.stroke();
  };

  this.physics = function() {

    this.y += this.yVel;

    if (this.y + this.radio < GROUND) {
      this.yVel += this.gForce;
    } else if (this.y + this.radio > GROUND && this.yVel > MIN_ACCELERATION) {
      this.yVel *= -this.friction;
      this.y = GROUND - this.radio;
      this.friction -= FRICTION_INCREASE;
    } else {
      this.yVel = 0;
      this.y = GROUND - this.radio;
      this.run = false;
    }
  };
};

var generateBalls = function(p) {

  var i, random;

  for (i = 0; i < N_BALLS; i++) {
    p[i] = new Object();

    random = Math.floor(Math.random() * 18) + 5;
    p[i].radio = random;

    random = Math.floor(Math.random() * 22) + 1;
    p[i].x = DIST * random;

    random = Math.floor(Math.random() * 15) + 1;
    p[i].y = DIST * random;

  }
};

var drawBalls = function() {
  var i;

  for (i = 0; i < N_BALLS; i++) {
    ball[i].draw();
  }
};

var applyPhysics = function() {
  var i;

  for (i = 0; i < N_BALLS; i++) {
    ball[i].physics();
  }
};

generateBalls(ball);
canvas.preferences();
var program = setInterval(function() {

  canvas.clear();
  drawBalls();
  applyPhysics();

}, 1000 / 60);
canvas {
  border: 1px solid rgb(210, 210, 210);
}

body {
  background: black;
  color: rgb(210, 210, 210);
}
<canvas id="canvas" width="450" height="400"></canvas>

sentences:
How to force a translation to go through an exact point? I have a camera object with a script that will whether translate it with a set speed, or stop it. I also have 7 "checkpoints", where there are 7 different quads, who will stop the camera whenever the camera reaches them.

The problem here is that in my code :

void Update() {

if (scoreholder.CheckScore()<scoretimer) {
//if the current score is less than set X score

        if (killcam.transform.position.y == quadholder.y) {
//and if the camera's position equals the position of the generic quad *PROBLEM HERE*

            killcam.GetComponent<cameraUp> ().SetCam (true); //stop the cam

            while (scoreholder.CheckScore () < scoretimer) { // do stuff

                offset = mr.material.mainTextureOffset;
                offset.y += offsetSpeed * 0.1f;
                mr.material.mainTextureOffset = offset;

                break;
            }
        }

    }

else { //once the score is not less than the desired X score, move the cam
        killcam.GetComponent<cameraUp> ().SetCam (false);
    }

}

So my problem here is that this line of code if (killcam.transform.position.y == quadholder.y) never happens, the translation skips some values, and the camera doesn't hit the exact quad spot. I tried to use > instead of ==, but I ran into another problem, is that after the 3rd quad, since my camera speed increases in time, the code apparently doesn't get processed fast enough, and my camera goes beyond the 4th,5th,6th, and 7th quad without stopping.

I have already tried Vector3.Lerp, and it gives me almost the same result, if I lerp between the beginning and the end of the track, I have to do it with an extremely small fraction, and I can't have my camera move at that speed.

sentences:
Vector problem: which one is the left / centre / right one? In aviation, runways are named according to their magnetic orientation seen from the pilot's perspective. For example: a strip of asphalt oriented along the east-west axis will be named 9 for the pilot coming from west (east is at 90° from North) and 27 for a pilot coming from east (west is 270° from North).

When several runways have the same orientation, the naming convention uses letters L/C/R for distinguishing between the Left/Centre/Right ones (look at the 22 runways in the capture above).

In the game I'm coding, I chose to describe runways by the following three attributes:

Orientation (between 0° and 180°).
Position of their geometrical centre relative to the aeroport one.
Length

With this data I'm able to generate all the touchdown points and give them the correct number, but I can't find a straightforward method to assign the correct letter, as I could not think to a straightforward way to mathematically determine which one is "left/centre/right" from a "landing pilot's perspective".

So the question is:

  Is there a simple, straightforward vector formula that - given two
  parallel vectors pointing in the same direction - will return the
  leftmost (or rightmost) one?

Please note that this question is really about the straightforwardness of the formula, as I already found a non-straightforward way to get the result, but I would like to find a more elegant way to solve the problem.

Many thanks in advance for your expertise and contributions!

sentences:
How to work with two layers or more in cocos2d? I want to make a game in cocos2d. I don't know too much about it.

My question is related to communication between two layers or more. For instance, let's say I want a layer with a scrolling road and another on top with scrolling clouds.

Is there anything built-in cocos2d for doing that, or any reference link?

sentences: Why do my NPC's fall through the world when I select them as triggers? I'm making a game in Unity where when the player comes into contact with an NPC it will switch scenes. I have the code for it and made sure all NPC's have rigidbody as well as using gravity and convex. They do not fall through the world but as soon as I click the trigger box on the mesh collider they start falling straight through the world. The switching scenes code works fine - I tested it and it does switch the scene.

sentences:
Where i must put .xnb files in mono game project using VS2010? Hello there my problem was describe below In the "The Content Pipeline" paragraph

http://blogs.msdn.com/b/bobfamiliar/archive/2012/08/07/windows-8-xna-and-monogame-part-3-code-migration-and-windows-8-feature-support.aspx#comments

Author describe how fix it using VS2012 put xnb files to \AppX\Content folder but i use VS2010 and mono game templates for it and there is no folders like this so where i must put this asstes to run game correctly

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:
Area Lights in DirectX So after reading https://www.guerrilla-games.com/read/killzone-shadow-fall-creating-art-tools-for-a-new-generation (a guerilla games presentation on PBR) I noticed the Area lights as opposed to the standard Directional, Point & Spot lights in DirectX can produce very realistic shadows.

Now a lot of the resources online talk about it and what it is but there's not much regarding implementation. Some websites online say that it is just an array of lights but I don't think that's what it is.

Can somebody explain how I can implement this (and maybe with some code). If you could include any links to some good resources regarding implementation that would be great aswell.

sentences:
Loading sprite resources from nested folders This is how I try to load my sprite images:

 sprite Sprites[];

 void Start() {
    ...
    Sprites = Resources.LoadAll<Sprite>("Card/AnimalImages");
    Debug.Log("Sprite name: " + Sprites[8].name);
    ...
 }

But it gives me the error that you can see in the picture below. Note that in the same figure there is a hierarchy of folders on the right side. I put two ellipsis in the code because it is actually much longer than what I posted, but I assure you that the script is correctly attached to the object and it generally works.

The problem is that it doesn't load the sprites as I expect: the debugger hangs at the point where the Debug.Log(...); is executed (precisely when it tries to access the Sprites vector which is probably empty).

It's the first time in Unity3D where I need to load the sprites in that way. I tried to look in some previous posts, probably I will have missed someone, but in those found until now no one has helped me.

Can someone help me to understand how to load the sprites and especially where is my mistake?

  Update

I tried to check if could be a problem of static/dynamic arrays, but it seems not to be a problem of this type, in fact following code:

    Sprites = new ArrayList(Resources.LoadAll<Sprite>("Card/AnimalImages"));
    Debug.Log("Size of dynamic array: " + Sprites.Count);

prints:

Size of dynamic array: 0

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:
Can't attach animation to script I'm working on a little game (which is also my first one) and I want to insert a splash screen at the beginning (after the Unity one).
I've finally achieved to add a fade-in and a fade-out transistion when the splash screen starts and ends, but the fade out is activated by a button and I wont to play it simply after a certain time.
I've made a script for that:

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

public class FadeInOut_2 : MonoBehaviour
{
    public Animation anim;

    IEnumerator Start()
    {
        yield return new WaitForSeconds(2f);

        anim.GetComponent<Animation>().Play();

        Application.LoadLevel(Application.loadedLevel + 1);
    }

}

The problem is: when I try to attach the animation the Inspector refuses to do it.

Any ideas?
Thanks

sentences:
Will my Admob Unity Plugin be Obsolete? When I got back to Google Admob Console I received this announcement:

"Beginning on 23 Jan 2018, Google Mobile Ads SDK versions older than 7.0.0 for Android and 7.0.0 for iOS will no longer be supported. Publishers with these older versions will not be able to serve ads in their apps(s). Please ensure that you have upgraded to the latest version of the Google Mobile Ads SDK."

I am concerned about whether the Unity game I released eight months ago will continue to serve Admob ads.

I think this pertains to many Unity developers. It seems that the Google Mobile Ads for Unity uses a different versioning system. Its current version is version v3.10.0.

So what is the latest version of Admob Unity Plugin that will be affected by this? Will we be affected at all?

sentences:
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:
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:
How do I set a scene up for two players? I´m finishing a game in Unity, but I have a new requirement: make it multiplayer. I will do this by splitting the screen and running two instances.

Is there a way to instance a scene twice at the same time, and render them two a different part of the screen? Alternativley, what is the best approach to achieve this?

sentences:
android game change background image at every level? I want to be able to have a different background image at each level of my game. Presently I have only one. There is no layout folder shown in Android Studio and all info I have searched shows how to do it with the layout xml.

I have found this code in GameLayer.java of my game. Actually I am reskinning the game so everything is already there, I just need to know how to have different bg images now. Code:

// background
CCSprite bg = new CCSprite("game/game_bg.png");
bg.setPosition(G.displayCenter());
addChild(bg);

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:
Card Game Suggestion I'm developing a gameboard for a 4 players cardgame well know in my region ( like a Bridge with 8 cards).

I create a cardcontrol class, all the deck methods and all the logics for value card and score count.

But I need some link or suggestion for the implementation of  "computer player" based on a few rules to follow.

thank you all for any help.

sentences:
Stop vibration (bouncing efect) I have a game with some ball and I want to make it bounce. I already have movement, gravity, collisions implemented, I only need to make it bounce. Thing is, using this code:

player.getVelocity().y *= Player.ENERGY_LOSS;
player.getVelocity().y = -player.getVelocity().y;

indeed it makes the ball bounce but obviously the .y will get to very small values causing the ball to 'vibrate' and never stop.

How can I 'clamp' this value? Let's say I just want the ball to bounce just 2 - 3 times?

sentences:
Unity update sizeDelta in OnValidate based on Layout Group computed values I'm trying to update the sizeDelta of a RectTransform in OnValidate.  I'm trying to grab the computed values from a Layout Group.
Here's what I've got:
#if UNITY_EDITOR
        void OnValidate()
        {
            UnityEditor.EditorApplication.delayCall += Resize;
        }

        private void Resize()
        {
            if (this == null) return;
            RectTransform parentRect = (RectTransform)gameObject.transform;
            RectTransform textRect = (RectTransform)tabText.transform;
            textRect.sizeDelta = new Vector2(parentRect.rect.height, parentRect.rect.width);
            layoutElement.preferredHeight = parentRect.rect.height;
        }
#endif

At first this seemed to be working, but it only works the first time OnValidate runs.  Subsequence invocations of Resize() sets the sizeDelta to Vector2(0, 0).
I'm wondering what causes this and if there's a way to avoid it.  If I remove the delayCall, the values are correct, but I get warnings:

SendMessage cannot be called during Awake, CheckConsistency, or
OnValidate

I'd like to do this at edit time since there's no need to compute this stuff at runtime.

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:
XNA advanced rotation 3D I'm able to rotate any model with any angle I want, where I can not rotate my model around a given point.

e.g: My model rotates from the origin assigned in its .fpx file. I want it to rotate related to a point of its bottom plane, so that it is animated as falling

sentences:
Which array does dstArrayElement refer to in the VkWriteDescriptorSet structure? Here is the link of VkWriteDescriptorSet structure from vulkan specification:
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkWriteDescriptorSet.html
Text pertaining dstArrayElement

dstArrayElement is the starting element in that ARRAY. If the descriptor binding identified by dstSet and dstBinding has a descriptor type of VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT then dstArrayElement specifies the starting byte offset within the binding.

I want know which array this statement is refering to?

sentences:
Toon/cel shading with variable line width? I see a few broad approaches out there to doing cel shading:

Duplication & enlargement of model with flipped normals (not an option for me)
Sobel filter / fragment shader approaches to edge detection
Stencil buffer approaches to edge detection
Geometry (or vertex) shader approaches that calculate face and edge normals

Am I correct in assuming the geometry-centric approach gives the greatest amount of control over lighting and line thickness, as well eg. for terrain where you might see the silhouette line of a hill merging gradually into a plain?

What if I didn't need pixel lighting on my terrain surfaces? (And I probably won't as I plan to use cell-based vertex- or texturemap-based lighting/shadowing.) Would I then be better off sticking with the geometry-type approach, or go for a screen space / fragment approach instead to keep things simpler? If so, how would I get the "inking" of hills  within the mesh silhouette, rather than only the outline of the entire mesh (with no "ink" details inside that outline? (AKA suggestive contours, creases).

Lastly, is it possible to cheaply emulate the flipped-normals approach, using a geometry shader? My concern with this is that I could certainly duplicate every single vertex and scale these accordingly, but how would I approach flipping normals, and distinct colouring in the fragment shader?

What I want - varying line thickness with intrusive lines inside the silhouette...

What I don't want...

EDIT: Further research has turned up the following...

Since I have a massive vertex count on terrain, even considering distance-based LoD, neither flipped-normals nor a geometry shader based approach (even with frustum culling) would be a sensible option due to sheer computational complexity involved in duplication & scaling of all uploaded vertices.

Considering that I don't need per-pixel lighting in the form of solid-tone shading on the terrain surfaces, it also becomes less prudent to consider any face-normal based approaches -- otherwise a requirement for correct surface lighting -- as these are naturally quite expensive to calculate. It is however true that they give the finest degree of control; for example, the ability to shade edges using "artistic" strokes: Beautiful, but again, not really viable for a massively complex game environment.

Stencil buffers are something I'd rather avoid as I'd prefer to do all work in shaders. (The above example with the red outline was done with a stencil buffer -- old school.)

This leaves fragment shader image-space approaches. Computational complexity is reduced to the number of fragments rather than the number of vertices (in my case, this is 10-100x fewer operations than I would have to do in the geometry shader). This requires more than one render pass in order to generate a g-buffer (consisting of a normal buffer and optionally a depth buffer as well) to which we can apply discontinuity filters (eg. Sobel operator). Depth discontinuity is what enables suggestive contours and creases. My only quibble with this approach is the inability to provide finer control over inked edge widths, though with the right algorithm in the fragment shader, I'm sure this would be possible.

So the question now becomes more specific: How exactly would I go about getting variable edge widths, particularly on the outer silhouette, in a fragment shader?

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:
Displaying text letter by letter I am planing to Write a Text adventure and I don't know how to make the text draw letter by letter in any other way than changing the variable from
h to he to hel to hell to hello
That would be a terrible amount of work since there are tons of dialogue.

Here is the source code so far

protected override void Update(GameTime gameTime)
{
    //input code removed for clarity

    if (Dialogue == 1)
    {
        Row1 = "Input Text 1 Here.";
        Row2 = "Input Text 2 Here.";
        Row3 = "Input Text 3 Here.";
        Row4 = "Input Text 4 Here.";
    }
    if (Dialogue == 2)
    {
        Row1 = "Text 1";
        Row2 = "Text 2";
        Row3 = "Text 3";
        Row4 = "Text 4";
    }

    base.Update(gameTime);
}

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

    spriteBatch.Begin();
    spriteBatch.Draw(sampleBG, new Rectangle(0, 0, 800, 600), Color.White);
    spriteBatch.Draw(TextBG, new Rectangle(0, 400, 800, 200), Color.White);
    spriteBatch.DrawString(defaultfont, Row1, new Vector2(10, (textheight + (rowspace * 0))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row2, new Vector2(10, (textheight + (rowspace * 1))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row3, new Vector2(10, (textheight + (rowspace * 2))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row4, new Vector2(10, (textheight + (rowspace * 3))), Color.Black);
    spriteBatch.End();
    base.Draw(gameTime);
}

sentences:
New game shows up as an update instead of a release I'm not sure if this is the right place to ask this sort of question but since there is a google-play tag...

I've just released a new game (my first one actually) two days ago. And I've just noticed that it showed up as an update instead of a freshly released game: Under ADDITIONAL INFORMATION section on the listing page it shows Updated instead of Released. I don't know how that happened and I'm worried it may affect the relevance of the game on the store. Is there any way to fix this issue? Am I right about worrying about the relevance of the game?

Link to the listing page of the game: Google Play link.

EDIT:

To clear any confusion, I'm not talking about people seeing the install/update button when they are about to install/update the game. I'm talking about the game release dateitself. The game shows up as an update from the Google Play Console as if it was released before. Me publishing the game for the first time was interpretted as updating an already released game, why?

sentences:
Is there a free source for flat/32-bit character avatars to build off of? I'd like to use some pixel characters as a base for tweaking into characters for my browser-based-game http://ninjawars.net .  (In other words, I take a base template and I modify it with colors and pixels slightly to make character variations)

Now, my bbg is mostly ninja oriented, so a ninja avatar to work off of would be great, but more varied character types would be good as well.  And I can probably fudge a "ninja" from some other template.

But, err, free-to-use-for-commercial-purposes (e.g. public domain) would be necessary.  I'm already makin' a little money off the site from Ads, and would certainly like to make more, so I can't use stuff for "non-commercial use only", unfortunately.

So any source for free-for-commercial-use pixel-y 32-bit-y characters to use as a starting design base?

sentences:
PhysicsConstraints Module not found in Blender 2.71 I am trying to export bullet from blender using python console however it raises an error while reaching to import PhysicsConstraints;
The error says Module not found, Since bullet exporter and PhysicsConstraints expected to be present in Blender 2.71,
Can anybody tell me what is this error about? I tried to run the script while I was in Game Engine (Someone suggested to do so in previous answers of a closed thread)
But it didn't work too.

Thanks

Iman

sentences:
Why use asset manifest files? Sometimes you'll see people recommend that rather than using graphics/sound files/etc. like this...

// Game code
Image myImage = new Image("path/to/image.png");

... you should use a manifest file as a level of indirection instead:

// Manifest file
MY_IMAGE: path/to/image.png

// Game code
Manifest myManifest = new Manifest("path/to/manifest");
Image myImage = myManifest.getImage("MY_IMAGE");

What reasons would I have of taking this sort of approach? If I'm not using a compiled language, would there still be reasons to do this?

sentences: Unity3d: Position a gameobject such that its forms a right angled triangle with other two gameobjects How do I position C gameObject such that it forms a right angled triangle with A and B. I tried to use (B.transform.position.x,A.transform.position.z) but it still gives me something which is close to A (it takes it globally). I want the C to be along the local red axis of A and local green axis of B as seen in the picture. What do I do?

sentences:
AS3: Using singletons for sound managers Is it necessarily a bad thing to use a singleton for a sound manager?

I am having a really tough time determining whether or not I should go ahead and use a singleton (which is easy/it works) or if I am shooting myself in the foot by deviating away from good OOP principles (since a singleton is basically a glorified single-instance global variable of sorts).

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 can I get the texture file name for my polygon? I have a problem with the FBX SDK. I read in the data for the vertex position and the UV coordinates. It works fine, but now I want to read for each polygon to which texture it belongs, so that I can have models with multiple textures. Can anyone tell me how I can get the texture file name for my polygon? My code to read in vertex position and uv coordinates is the following:

int i, j, lPolygonCount = pMesh->GetPolygonCount();
FbxVector4* lControlPoints = pMesh->GetControlPoints();

int vertexId = 0;
for (i = 0; i < lPolygonCount; i++)
{

    int lPolygonSize = pMesh->GetPolygonSize(i);

    for (j = 0; j < lPolygonSize; j++)
    {
        int lControlPointIndex = pMesh->GetPolygonVertex(i, j);
        FbxVector4 pos = lControlPoints[lControlPointIndex];
        current_model[vertex_index].x = pos.mData[0] - pivot_offset[0];
        current_model[vertex_index].y = pos.mData[1] - pivot_offset[1];
        current_model[vertex_index].z = pos.mData[2]- pivot_offset[2];

        FbxVector4 vertex_normal;
        pMesh->GetPolygonVertexNormal(i,j, vertex_normal);

        current_model[vertex_index].nx = vertex_normal.mData[0];
        current_model[vertex_index].ny = vertex_normal.mData[1];
        current_model[vertex_index].nz = vertex_normal.mData[2];

        //read in UV data
        FbxStringList lUVSetNameList;
        pMesh->GetUVSetNames(lUVSetNameList);

        //get lUVSetIndex-th uv set
        const char* lUVSetName = lUVSetNameList.GetStringAt(0);
        const FbxGeometryElementUV* lUVElement = pMesh->GetElementUV(lUVSetName);

        if(!lUVElement)
            continue;

            // only support mapping mode eByPolygonVertex and eByControlPoint
        if( lUVElement->GetMappingMode() != FbxGeometryElement::eByPolygonVertex &&
            lUVElement->GetMappingMode() != FbxGeometryElement::eByControlPoint )
            return;

        //index array, where holds the index referenced to the uv data
        const bool lUseIndex
            = lUVElement->GetReferenceMode() != FbxGeometryElement::eDirect;
        const int lIndexCount= (lUseIndex) ? lUVElement->GetIndexArray().GetCount() : 0;

        FbxVector2 lUVValue;

        //get the index of the current vertex in control points array
        int lPolyVertIndex = pMesh->GetPolygonVertex(i,j);

        //the UV index depends on the reference mode
        int lUVIndex = pMesh->GetTextureUVIndex(i, j);
        lUVValue = lUVElement->GetDirectArray().GetAt(lUVIndex);
        current_model[vertex_index].tu = (float)lUVValue.mData[0];
        current_model[vertex_index].tv = (float)lUVValue.mData[1];

        vertex_index ++;
        }

    }

    float v1[3], v2[3], v3[3];
    v1[0] = current_model[vertex_index - 3].x;
    v1[1] = current_model[vertex_index - 3].y;
    v1[2] = current_model[vertex_index - 3].z;

    v2[0] = current_model[vertex_index - 2].x;
    v2[1] = current_model[vertex_index - 2].y;
    v2[2] = current_model[vertex_index - 2].z;

    v3[0] = current_model[vertex_index - 1].x;
    v3[1] = current_model[vertex_index - 1].y;
    v3[2] = current_model[vertex_index - 1].z;

    collision_model->addTriangle(v1,v2,v3);

sentences:
Draw Cards and Eliminate Cards Problem I am having a problem in this question. I want a system inside a game wherein the player draws 2 cards randomly, and the enemy draws 2 cards randomly. Then, what the program does is to print out to the console the cards the player draw and the enemy's. The cards should not conflict and must not be the same. Then lastly, the program prints out the card that was not drawn by both the player and the enemy. Here's how I did it but it was lengthy and full of errors:

import java.util.Random;
public class Draw {

    public static Random random = new Random();
    public static String cards[] = {"Hall", "Kitchen", "Billiard", "Study", "Pool"};
    public static int playercounter;
    public static int enemycounter;
    public static String playercardA = null;
    public static String playercardB = null;
    public static String enemycardA = null;
    public static String enemycardB = null;
    public String lastcard = null;

    public static void playercardAdraw() {
        playercounter = random.nextInt(5);
        playercardA = cards[playercounter];
    }

    public static void playercardBdraw() {
        playercounter=random.nextInt(5);
        playercardB= cards[playercounter];
            if (playercardB==playercardA || playercardB == enemycardA || playercardB == enemycardB) {
                return;
            }
    }

    public static void enemycardAdraw () {
        enemycounter = random.nextInt(5);
        enemycardA=cards[enemycounter];
            if (enemycardA == playercardA || enemycardA == playercardB) {
                return;
            }

    }

    public static void enemycardBdraw () {
        enemycounter = random.nextInt(5);
        enemycardB=cards[enemycounter];
            if (enemycardB == playercardA || enemycardB == playercardB || enemycardB == enemycardA) {
                return;
            }
    }

    public static void main (String args []) {

        System.out.println("Starting to draw...");
        System.out.println("Player's Turn: ");
            playercardAdraw();
        System.out.println("Player's first card: " + playercardA);
            playercardBdraw();
        System.out.println("Player's second card: " + playercardB);
        System.out.println("Enemy's Turn: ");
            enemycardAdraw();
        System.out.println("Enemy's first card: " + enemycardA);
        enemycardBdraw();
        System.out.println("Enemy's Second card: " + enemycardB);
    }

}

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:
How to build an AIManager class I'm trying to figure out how to write a good AIManager class in Java in order to manage the AI of all the objects in my game.

From another post of mine, an user has suggested to do the following:

Your calculations should go into the update method. it's fine to have an AIManager class, that has an update() method itself which gets called in the main update loop.
this AIManager could hold a list of all the Objects that need to be updated. Since you're using java, you could use an interface to declare something to have an AI, and use this interface to iterate over your objects (which could then be completely different Classes) and have interactions managed by this AI manager.

It is not so clear to me.

If my Player class implements SeekArriveMovement (for instance), then it should implement the methods of this interface. And AIManager have to implement an update method. But... i don't know. I mean.. how the AIManager should be built and how it should interact with the objects?

Something like this.. ?

public class AIManager {

private List<Object> objects;

public AIManager() {
    objects = new ArrayList<Object>();
}

public void addObject(Object o) {
    objects.add(o);
}

public void removeObject(Object o) {
    objects.remove(o);
}

public void update() {
    for(Object o : objects) {
        if(objects instanceof SeekArriveMovement) { // ?
            RedEnemy re = (RedEnemy)o;
            move(re);
        }
    }
}

private void move(RedEnemy re) {
    // ?
}

sentences: Is it possible to emulate a MovieTexture with dynamically loaded images? Say I have a short video and want to play the video in a game scene, but I can't use the MovieTexture for whatever reason. Is it technically possible and feasible to dynamically load images (in a flip book fashion) in order to emulate a video being played in a scene?

sentences:
Game economy for a tower defense game I am currently working on a tower defense game, and I am having trouble figuring out how to implement the cost of turrets, upgrades, and the gain from completing a level, killing an enemy. Below is a summary of the requirements:

  There are multiple types of turrets, each turret has different properties, such as reload speed, range. Each upgrade has multiple levels.
  Each turret can have multiple types of ammo, each ammo type can have different upgrades, such as blast range, damage, addons. Each upgrade has multiple levels
  The sources of income are

  killing enemies, each enemy has a different value
  completing a level

My problem is with balancing everything so the game is at least playable, or in the right direction to get balanced by testing it. I know there is no magic formula for this but I believe people with experience will know where to start, and what process to follow. So my questions are:

1- is there a method to calculate the cost of turrets, upgrades? what factors should I take into consideration?
2- Should I use two different currencies for upgrades and turret purchases?
3- How to calculate the upgrade cost as the upgrade level increases? i.e. when the user purchases more of the same upgrade.

sentences:
How Extract Frustum Planes from Clip Coordinates? I'm having some problems with my Frustum Culling and I want to debug it, so I'm trying to render it's planes, to see exatly the Frustum. But I'm using the Clip Coordinates to do the culling (like OpenGL pipeline do), but I dont know how to render a frustum, in another words, I dont know how to convert a frustum in Clip Coordinates to a "Frustum Mesh".

Actually to calculate the frustum I use this function:

glm::vec3 point = MVP * glm::vec4(-radius, -radius, -radius, 1.0f)) //leftTopPoint
return (point.x > -point.w) && //Inside left clipping pane
       (point.x < point.w) && //Inside right clipping pane
       (point.y > -point.w) && //Inside bottom clipping pane
       (point.y < point.w) && //Inside top clipping pane
       (point.z > -point.w) && //Inside near clipping pane
       (point.z < point.w); //Inside far clipping pane

Where MVP is a glm::mat4 of Projection * View * Model matrices.

This function is activated only when I press the left click of mouse, so I want to render the Frustum and see how it is.

Also I dont use a "lookAt" function to rotate the camera, I'm using Quaternions (dont know if that matters).

Sorry if it is a bit confusing, it's hard to explain. So I just need a tip or a orientation/example of how achive this.

Thanks for your attention.

sentences:
How can I work on a game that I don't like? I started making a game with a friend, and I want to see it through. But the deeper we get into the project, the more I dislike the game.

How can I stay motivated and keep getting things done, if I don't really feel invested in the end product?

sentences:
One big Instance or One instance for every moving entity? I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. These NPCs will be controlled by the central server in PHP. Should I create one big world simulation PHP file that simulates all the NPCs in turn or a smaller controller that will be ran for each active NPC (on its own thread)? Each NPC has its own row on an SQL table and will be retrieved by the client to determine its position, state, etc.

Note: This is my first time creating a networked game, so if there is anything that I can do better, or a unique way of doing things that could work for this, feel free to comment

sentences:
How can I communicate user information from a website to a hosted Unity game? I have a Ruby on Rails website running which provides a log-in system and dashboard for users. I am building a small game in Unity which is much like an inventory management system. But, the inventory is specific to a user and the user can make changes to it. The user sees the game as a part of his dashboard.

What I'd like is for the moment the user lands on his dashboard, the Unity game should load with the inventory of the signed-in user. How can I get this user information from the Ruby dashboard over to Unity?

sentences:
What is the term for how much a game's code is coupled to its engine? Essentially, what is a word or phrase I might use/search for to describe how much the choice of an engine dictates the structure of your code, such as the language it is written in or the way objects much be structured, as well as aspects of what design patterns can be used or how assets are formatted?

For instance, Unity has a high amount of this coupling because, while it allows the use of C# (which runs on many platforms), it requires many object interconnections to be exposed as concrete classes and public member variables. GameMaker Studio is almost completely coupled in this way because it has its own proprietary scripting language and asset format.

sentences: How do Aimbots get detected? I was wondering on the programming methods which are used to detect when a player is using an Aimbot/AutoAim cheat.

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:
Android - Google play - enable download app for devices that supports opengl extension I am using OpenGL ES 2 in my game. However, for simplicity i have used some extensions like VAO. Is there a way, how to disable dowloading of my app for devices, that do not support this (and other) extensions?

I can check it in code, but that is a little late, when user already bought my game and it wont work.

sentences:
Is it possible to have FixedUpdate execute once every n frames? I'm currently building a small game, and I've created this simple character controller using FixedUpdate, which executes every frame.

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    /// <summary>
    /// Check for a key press, and if that key is pressed,
    /// move in a specified direction if there are no obstacles.
    /// </summary>
    private void MovePlayerOnKey(KeyCode keyCode, Vector3 direction)
    {
        Collider[] hitColliders = Physics.OverlapSphere(this.transform.position + direction, 0.1f);
        if(Input.GetKey(keyCode) && hitColliders.Length <= 0)
        {
            this.transform.position += direction;
        }
    }

    /// <summary>
    /// FixedUpdate is used to ensure that the player is
    /// moving in sync with the step of the Physics engine,
    /// and not executing a variable amount each frame.
    /// </summary>
    public void FixedUpdate()
    {
        this.MovePlayerOnKey(KeyCode.W, new Vector3(0, 1f, 0));
        this.MovePlayerOnKey(KeyCode.A, new Vector3(-1f, 0, 0));
        this.MovePlayerOnKey(KeyCode.S, new Vector3(0, -1f, 0));
        this.MovePlayerOnKey(KeyCode.D, new Vector3(1f, 0, 0));
    }
}

While the code itself works, the player moves much too fast for my liking, and I can't change the step of the player either, it has to stay at 1 in order for other game mechanics to function properly.

The only solution I can think of is changing how FixedUpdate runs by running it less often. Is it possible to make FixedUpdate run once every n frames?

sentences:
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:
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:
Soft body plasticity using Bullet Physics I made this post on the Bullet forum(link), but the forum is slow so I'm just copying the text from there.

Hello,

I'm currently working on a game and I want to make certain surfaces of the game world deformable by the user. I've already implemented soft bodies and mouse picking but I cant get the surfaces to stop returning to their original shape.

I should note that I use joints to keep the soft bodies stationary.

Does anyone know which settings I need to play with to get the desired effect? I'm very new to soft bodies so I don't understand a lot of the terms in the source code.

If bullet does not have the capabilities I need, does anyone know where I can read up on the topic and soft bodies in general?

sentences:
Score Based on Game play Time and a Int I'm trying to do a score that is based on the time taken and number of manipulators used. The faster you do it, with the fewest manipulators, the higher the score. I've managed to get it working with you get the lowest score but not the highest and i can't think how to do it. Any help would be appreciated.

I have a play time (GameTime.TotalGameTime.TotalSeconds - startTime.TotalSeconds) and a count of the manipulators used (grid.NumberOfManipulatorsInGrid(TextureList.GameplayTextures)) to work with

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 to use the actions of the actors in libgdx? I'd like to know if someone has already used Actions in the actors, and how to use them. I don't know how. I want to rotate an Actor.

sentences:
When is the right time to save game data in a standalone game? For standalone game, what's the best time to save game data, such as player's coins, level, skill data and so on?

Should the data be saved before quitting? Or whenever it changes? Or something else?

sentences:
Top Down RPG Movement w/ Correction? I would hope that we have all played Zelda: A Link to the Past, please correct me if I'm wrong, but I want to emulate that kind of 2D, top-down character movement with a touch of correction. It has been done in other games, but I feel this reference would be the easiest to relate to.  More specifically the kind of movement and correction I'm talking about is:

Floating movement not restricted to tile based movement like Pokemon and other games where one tap of the movement pad moves you one square in that cardinal direction. This floating movement should be able to achieve diagonal motion.
If you're walking West and you come to a wall that is diagonal in a North East/South West fashion, you are corrected into a South West movement even if you continue holding left (West) on the controller. This should work for both diagonals correcting in both directions.
If you're a few pixels off from walking squarely into a door or hallway, you are corrected into walking through the hall or down the hallway, i.e. bumping into the corner causes you to be pushed into the hall/door.

I've hunted for efficient ways to achieve this and have had no luck. To be clear I'm talking about the human character's movement, not an NPC's movement. Are their resources available on this kind of movement? Equations or algorithms explained on a wiki or something?

I'm using the XNA Framework, is there anything in it to help with this?

sentences:
Making smooth walk/jump/fly etc animations i am soon gonna start with developing my own game for the iOS, i have the plan and idea of the game ready. BUT i have 1 question. How do people make such a smooth animation? Lets take for example: Angry Birds, if you pull on the rope to shoot the bird everything looks so smootthh or take Tiny Wings for example.., how did they make this? Did they made an image for every frame of the animation in photoshop and putted it in a plist? or how?

Ty in advance!

sentences:
HLSL - Creating Shadows in 2D The way that I create shadows is by the following technique:
http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/

But I have questions to HLSL. The way that I currently do it is, I have a black and white image, where Black means 'object', and white means 'nothing'. I then distort the image like in the tutorial. I do this with a pixel shader, but instead of rendering to the screen, I render to a texture, back to my application. I then take this, and create the shadows, and then send it back to the graphics card to undo the distortion, after the shadow has been added - this comes back and I have a stencil of shadow. I can put this ontop of the original image and send them back to the graphics card, which then puts them on the screen.

To me this is alot of back and forth. Is there a way i can avoid this?

The problem that I am having is that I need to basically go through all positions in the texture 3 times, and use the new new texture every time instead of the orginal one. I tried to read up on Passes, but i don't think that i am heading in the right direction there.

Help?

sentences:
Query for users machine hardware When writing a game, you can do many things in many ways. But not all the machines the code will be ran on support all the ways of doing it.

How can you query for the capabilities of the machine hardware programmatically?

For example, there are ways in openGL to detect if certain openGL methods are supported by the GPU, you can also see if certain extensions are supported, query the openGL version, ect, but that still doesn't give you all the data (I'm pretty sure you cannot query the amount of VRAM the machine has).

Can you do a hardware query system-wide?
To ask for the number of cores, CPU frequencies, L2  cache size, amount of ram/vram, sound card capabilities and any other system specifics so you could instruct your code how to behave (for example, to not try to play sound on 64 channels if sound card supports only 32, if vram is limited use smaller textures, etc)?

It would be nice to query for such data on startup to see if machine supports minimum requirements and then have the data globally available to the code so certain feature can be turned on or off or substituted by maybe less efficient but supported code for that machine.

I remember GTA IV had a gfx menu where it showed the amount of VRAM available and the amount required for the selected setup.

Anyway, is there a way to do what I ask?

sentences:
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 can I move a 3d object to a known Cartesian point on the surface of a sphere? I'm trying to figure out how to move an object from one Cartesian point to another located on the surface of a 3D sphere. So that the object will follow the spherical coordinate system (Theta and Phi)

I've a function that converts a Cartesian to Spherical but how can I make it work on the surface of a sphere just like we are using the equation of a line y=mx+b when moving from one point to another on a flat surface?

I'm going to use it to move an object from its point to a selected point somewhere else on the sphere so that the object will move in a straight line but following the curvature.

sentences:
How can I design good continuous (seamless) tiles? I have trouble designing tiles so that when assembled, they don't look like tiles, but look like a homogeneous thing. For example, see the image below:

Even though the main part of the grass is only one tile, you don't "see" the grid; you know where it is if you look a bit carefully, but it is not obvious. Whereas when I design tiles, you can only see "oh, jeez, 64 times the same tile," like in this image:

(I took this from another GDSE question, sorry; not be critical of the game, but it proves my point. And actually has better tile design that what I manage, anyway.)

I think the main problem is that I design them so they are independent, there is no junction between two tiles if put closed to each other. I think having the tiles more "continuous" would have a smoother effect, but can't manage to do it, it seems overly complex to me.

I think it is probably simpler than I think once you know how to do it, but couldn't find a tutorial on that specific point. Is there a known method to design continuous / homogeneous tiles? (My terminology might be totally wrong, don't hesitate to correct me.)

sentences:
What to use instead of UNet? If you look at this Link you'll see UNet is deprecated and will be removed in the future.

I'm developing a mobile multiplayer game, i've red official advise about it but they say "You can publish it with 2018.4 (LTS)" and I can't use 2018.4 version because in my project i use LWRP which is not in the 2018.X versions.

I've found the alpha version of the new system right here

My questions are:

1- Should i use the alpha version of the new system? And can i publish my game with it?

2- Should i wait for the new system came out? (I can't wait for months)

3- Should i try to use other third party systems like Photon?

Or is there any way to publish my game with nice multiplayer system?

Note: I can't pay for multiplayer matchmaking system. Because of that i want to make Hosting multiplayer game.

sentences:
Triangle-triangle continuous collision detection I am making a 3D game engine and I use continuous collision detection. I am using Sphere-Trees to cull primitive collision checks to a minimum. However, I'd like to perform continuous triangle-to-triangle collision checking.

How does continuous triangle-triangle collision detection work, assuming triangles with linear velocities?

sentences:
Bitmap font rendering, UV generation and vertex placement I am generating a bitmap, however, I am not sure on how to render the UV's and placement. I had a thread like this once before, but it was too loosely worded as to what I was looking to do.

What I am doing right now is creating a large 1024x1024 image with characters evenly placed every 64 pixels. Here is an example of what I mean. I then save the bitmap X/Y information to a file (which is all multiples of 64).

However, I am not sure how to properly use this information and bitmap to render. This falls into two different categories, UV generation and kerning. Now I believe I know how to do both of these, however, when I attempt to couple them together I will get horrendous results.

Now for the algorithm. I am doing my letter placement with both GetABCWidth and GetKerningPairs. I am using GetABCWidth for the width of the characters, then I am getting the kerning information for adjust the characters.

Does anyone have any suggestions on how I can implement my own bitmap font renderer? I am trying to do this without using external libraries such as angel bitmap tool or freetype. I also want to stick to the way the bitmap font sheet is generated so I can do extra effects in the future.

Rendering Algorithm

for(U32 c = 0, vertexID = 0, i = 0; c < numberOfCharacters; ++c, vertexID += 4, i += 6)
{

    ObtainCharInformation(fontName, m_Text[c]);

    letterWidth = (charInfo.A + charInfo.B + charInfo.C) * scale;

    if(c != 0)
    {

        DWORD BytesReq = GetGlyphOutlineW(dc, m_Text[c], GGO_GRAY8_BITMAP, &gm, 0, 0, &mat);
        U8 * glyphImg= new U8[BytesReq];
        DWORD r = GetGlyphOutlineW(dc, m_Text[c], GGO_GRAY8_BITMAP, &gm, BytesReq, glyphImg, &mat);

        for (int k=0; k<nKerningPairs; k++)
        {
            if ((kerningpairs[k].wFirst == previousCharIndex) && (kerningpairs[k].wSecond == m_Text[c])) {
                letterBottomLeftX += (kerningpairs[k].iKernAmount * scale);
                break;
            }
        }

        letterBottomLeftX -= (gm.gmCellIncX * scale);
    }

    SetVertex(letterBottomLeftX, 0.0f, zFight, vertexID);
    SetVertex(letterBottomLeftX, letterHeight, zFight, vertexID + 1);
    SetVertex(letterBottomLeftX + letterWidth, letterHeight, zFight, vertexID + 2);
    SetVertex(letterBottomLeftX + letterWidth, 0.0f, zFight, vertexID + 3);
    zFight -= 0.001f;

    float BottomLeftX = (F32)(charInfo.bitmapXOrigin) / (float)m_BitmapWidth;
    float BottomLeftY = (F32)(charInfo.bitmapYOrigin + charInfo.charBitmapHeight) / (float)m_BitmapWidth;

    float TopLeftX = BottomLeftX;
    float TopLeftY = (F32)(charInfo.bitmapYOrigin) / (float)m_BitmapWidth;

    float TopRightX = (F32)(charInfo.bitmapXOrigin + charInfo.B - charInfo.C) / (float)m_BitmapWidth;
    float TopRightY = TopLeftY;

    float BottomRightX = TopRightX;
    float BottomRightY = BottomLeftY;

    SetTextureCoordinate(TopLeftX, TopLeftY, vertexID + 1);
    SetTextureCoordinate(BottomLeftX, BottomLeftY, vertexID + 0);
    SetTextureCoordinate(BottomRightX, BottomRightY, vertexID + 3);
    SetTextureCoordinate(TopRightX, TopRightY, vertexID + 2);

    /// index setting

    letterBottomLeftX += letterWidth;

    previousCharIndex = m_Text[c];

}

sentences:
Blending and shadowmapping? I am trying to implement shadow mapping, and currently I have 2 point lights and 1 global ambient light source and my rendering loop looks roughly like this (the details are not relevant):

void OpenGLRenderer::DrawRenderables(const uint32_t windowWidth, const uint32_t windowHeight, const RenderQueue& renderQueue, const RenderableLighting& lighting)
{
    GLCALL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

    for (uint32_t lightIndex = 0; lightIndex < lighting.mUsedLights; lightIndex++)
    {
        if (lighting.mLights[lightIndex].mLightType == LightType::LIGHT_TYPE_POINT)
        {
            GLCALL(glUseProgram(mShadowMapProgram.mProgramHandle));
            GLCALL(glBindFramebuffer(GL_FRAMEBUFFER, mFrameBuffer));
            GLCALL(glViewport(0, 0, mShadowTextureWidth, mShadowTextureHeight));
            for (uint32_t faceNum = 0; faceNum < CUBEMAP_NUM_FACES; faceNum++)
            {
                GLCALL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceNum, mShadowMapTexture, 0));
                GLCALL(glClear(GL_DEPTH_BUFFER_BIT));

                ShadowPass();
            }
            GLCALL(glBindFramebuffer(GL_FRAMEBUFFER, 0));

        }

        // final pass
        GLCALL(glUseProgram(mDefaultProgram.mProgramHandle));
        GLCALL(glViewport(0, 0, (GLsizei)windowWidth, (GLsizei)windowHeight));

        // enable blending, how?

        ShadingPass();
    }

    GLCALL(glUseProgram(0));
}

The problem is the screen will only be shown with last light in the light list, for example the ambient light and therefore ignoring the effects of the point lights. I assume I somehow needs to do blending but I was wondering how and where is this done?

Thanks

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:
unity 5 how to get a shadowmap I'm writing a custom shader in unity 5 that requires a shadowmap (not just for drawing shadows but also for different computations involving scattering particles through fog). Does anybody know how to actually get the shadow map in unity rather than just using the fallback option? That is including the actual Z buffer not just the resulting 1's and 0's.

I could also use the depth buffer from the camera but that only appears to apply to camera used by the player rather than the second one I can add to replace the light (inside the light).

sentences:
How to compute the 2D equations of 3D circular arcs? I'd like to obtain these equations for the ellipses produced by the perspective projections of (3-dimensionally transformed) circles.

This is useful for rendering in 2D contexts which provide curve primitives. I'm using HTML5's canvas, so I get Beziers, arcs, and quadratic curves.

See here:

The projection of a sphere outside of the plane of projection is an ellipse because the view is a cone (silhouette of a sphere is a circle).

However if I want to draw my sphere using circular wireframes, that projection-cone is no longer a circular cone. So it's not your traditional conic section anymore.

How to deal with this?

sentences: Game industry layoffs? I want to be a game programmer and it's come to my attention that people who work in this industry are laid off/fired every few years. Can someone please tell me how to deal with this? Thanks

sentences:
How can I improve my rendering performance in Java? How can I improve the performance of my rendering? Currently, I'm rendering with java.awt.Graphics, but it seems to be starting to slow down since I'm adding new stuff to render.

My rendering setup:

Loading a spritesheet:
Spritesheet sheet = new Spritesheet(ImageLoader.loadImage("/textures/spritesheet.png"));

Loading sprites:
BufferedImage player = sheet.crop(5, 0, Spritesheet.DEF_WIDTH, Spritesheet.DEF_HEIGHT);

And then rendering it with java.awt.Graphics in my gameloop:
g.drawImage(player, x, y, Entity.DEF_WIDTH, Entity.DEF_HEIGHT);

Spritesheet.DEF_WIDTH and Spritesheet.DEF_HEIGHT refer to 32px for quick access since most of my sprites are 32x32px. Entity.DEF_WIDTH and Entity.DEF_HEIGHT refer to 64px to render the entity on the screen.

One way I know that could solve my problem is that I could use smaller sprites but scale them up while rendering, but let's see if it's possible without that first.

sentences:
Where can I find sources on how many people play on silent etc.] This is probably more a problem with me being unable to find statistics which i am absolutely certain must exist in some form: How many people play with the sound off/on when playing browser games or very casual mobile games. Because in my experience: nobody, but that is too subjective.

The question i want to answer for myself: Is it worth adding sounds to my game. But I dont want to base that decision off of my personal experience (sound is always off), but rather some cold hard fact.

They must exist somewhere, someone must have compiled that data, but I cant find it anywhere...

sentences:
2D tilemap editor UI--how do I disable editing while save/load dialog is open? I'm working on a basic 2D tilemap editor in C#/XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking mouse position (i.e., Is it within the picture box? If so, what tile is it on?).

The problem I'm having is that this results in the map being edited through other windows. For example, when trying to save a map, any clicks in the savefiledialog window will edit the map square beneath it, including the click on "Ok" or "cancel."

I believe this is the offending snippet of code from the Game1 class:

protected override void Update(GameTime gameTime)
    {

        Camera.Position = new Vector2(hscroll.Value, vscroll.Value);

        MouseState ms = Mouse.GetState();

        if ((ms.X > 0) && (ms.Y > 0) &&
            (ms.X < Camera.ViewPortWidth) &&
            (ms.Y < Camera.ViewPortHeight))
        {
            Vector2 mouseLoc = Camera.ScreenToWorld(
                new Vector2(ms.X, ms.Y));

            if (Camera.WorldRectangle.Contains(
                (int)mouseLoc.X, (int)mouseLoc.Y)) //<--right there
            {
                if (ms.LeftButton == ButtonState.Pressed)
                  //....

Two questions.

Is this even a viable way to display the map in the map editor? I'd like to be able to pan, zoom, etc. in the future, as well as select multiple tiles at once and edit their properties.
How do I stop the picturebox from registering clicks while other windows are in focus? I've tried adding && PictureBox.Focused to the if statement up there, but that stops it from accepting input at all, regardless of whether there's another window over it (apparently, "focus" doesn't mean what I thought it meant in this context).

Confession: this is my first attempt at Winform programming. Please excuse my lack of experience.

UPDATE: && pictureBox.Focused didn't work, but && pictureBox.Capture did. Still feels a little sloppy, but it works now. I have no confidence that this solution is correct, so I'm not closing the question just yet--something tells me there's a more correct way, and I'd like to know about it.

UPDATE2: Using Capture has introduced a new bug--right clicks don't register reliably (i.e., only around one in ten clicks) until minimizing and restoring the window, after which they register correctly. Rage.

sentences: Free AAA RTS engine SDK? I'm currently trying out the various free SDKs out there (Cryengine3, UDK, Source) however all of them are mainly designed for FPS games. I was wondering if there are other AAA 3D engine SDKs that are aimed towards RTS games?

sentences:
Render specific part of a texture in OpenGL (2D Sprite Sheet) I've looked at this answer to find out how to render just a part of a texture:
C++ Opengl render part of an image

I tried that, but the problem is, this is how I render my texture:

glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(x, y);
glTexCoord2f(1, 0); glVertex2f(x + w, y);
glTexCoord2f(1, 1); glVertex2f(x + w, y + h);
glTexCoord2f(0, 1); glVertex2f(x, y + h);
glEnd();

I tried doing this to render the top left quarter:

glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(x, y);
glTexCoord2f(0.5, 0); glVertex2f(x + w, y);
glTexCoord2f(0.5, 0.5); glVertex2f(x + w, y + h);
glTexCoord2f(0, 0.5); glVertex2f(x, y + h);
glEnd();

But it just totally messes up and makes my texture bigger and cut off. What I want is to just draw a part, like you would on a sprite sheet. I've been messing around with those lines for awhile and I just can't seem to find out how to do what I want.

I've been messing around with this:

// yeah i know this math is crappy and weird but im trying EVERYTHING at this point,
// it draws until the dcw (width) just fine but i cant seem to integrate cx/cy...

double dcw = double(cw) / double(w);
double dch = double(ch) / double(h);

double dcx = double(cx) / double(dcw);
double dcy = double(cy) / double(dch);

std::cout << "dcw:" << dcx << "\n" << "dch:" << dcy << "\n";

glBegin(GL_QUADS);

//bottom right
glTexCoord2f(0, 0); glVertex2f(cx, cy);
//top right
glTexCoord2f(dcw, 0); glVertex2f(cx + cw, cy);
//top left
glTexCoord2f(dcw, dch); glVertex2f(cx + cw, cy + ch);
//bottom left
glTexCoord2f(0, dch); glVertex2f(cx, cy + ch);

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:
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:
Changing orientation by applying torques Suppose you've got an object floating freely in space. You have a vector you want this object to point towards, and a vector representing the direction it's currently facing. From these two, you can get the rotation (matrix, quaternion, whatever) that represents the change in orientation to bring the two vectors into alignment.

If you only have the ability to apply torque (derivative of angular velocity) to your object, what's a good algorithm for applying torque over time that won't over/undershoot the destination?

(In this case, it's a space ship that wants to automatically orient itself in the direction of travel using thrusters. Roll is irrelevant.)

sentences: Visual Studio not updating files made in Unity In the past Visual Studio simply updated solution based on files added in Unity but now all of them have to be added manually and they are as miscellaneous when they are added. How can I fix it?

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:
100 points between 0-1000 on an increasing scale Basically, it's for roleplay, I need to generate 100 points along a scale. Level 1 is the starting amount, and is at point 0 on the scale. Level 100 is the highest amount planned at this point, and it needs to be at 1,000 on the scale.

My problem is generating points 2-99 between those two. I could do it cheaply and just go with one level at every 10 points. But that's not how I want it to function.

Ideally, I'd like a sloping curve, so that in the early stages, levels might be only a number or two apart. Such as:

Level 1 - 0
Level 2 - 2
Level 3 - 4

But then as the level increases, the number also goes up.

Level 98 - 960
Level 99 - 980
Level 100 - 1000

Can someone help me figure this out?

sentences:
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:
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:
objects disappear before time I created a little pool in order to better manage my enemies, to which, an enemySpawner object calls to retrieve a clone and show it on screen

public class ObjectPool : MonoBehaviour
{
    public static ObjectPool current;
    public GameObject objectForPool;
    public int poolAmmount = 20;
    public bool growth = true;

    List<GameObject> objectsForPool;

    void Awake()
    {
        current = this;
    }

    // Use this for initialization
    void Start ()
    {
        objectsForPool = new List<GameObject>();

        for (int i = 0; i < poolAmmount; i++)
        {
            GameObject obj = Instantiate(objectForPool);
            obj.SetActive(false);
            objectsForPool.Add(obj);
        }
    }

    public GameObject GetPooledObject()
    {
        for (int i = 0; i < objectsForPool.Count; i++)
        {
            if (!objectsForPool[i].activeInHierarchy)
            {
                return objectsForPool[i];
            }
        }
        if (growth)
        {
            GameObject obj = Instantiate(objectForPool);
            objectsForPool.Add(obj);
            return obj;
        }
        return null;
    }

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

    }
}

The call(EnemySpawner update)

void Update ()
{
    transform.position = new Vector3(transform.position.x + (speed * Time.deltaTime), 0, transform.position.z);
    if (transform.position.x <= boundary.xMin || transform.position.x >= boundary.xMax)
        speed *= -1;

    if (Time.time > nextSpawn)
    {
        nextSpawn = Time.time + spawnRate;

        GameObject clone = GetComponent<ObjectPool>().GetPooledObject();
        if (clone == null || clone.activeInHierarchy) return;
        clone.GetComponent<EnemyMovement>().SetPlayerShip(playerShip);
        clone.transform.position = transform.position;
        clone.transform.rotation = transform.rotation;
        clone.GetComponent<Health>().RestoreHealth();
        clone.SetActive(true);
    }
}

The problem here is, that my enemies are being deactivated on mid trajectory

https://youtu.be/ZGHC6wwGX1E

I know my issue is in my pooling, but I can't figure out what I'm doing wrong

sentences:
What can I do with the 4th component of gl_Position? When I set gl_Position I usually assign it such as gl_Position = vec4(in_position, 1.0) where in_position as a vector of three components representing a vertex of my model.

But looking up tutorials and such I cannot find anything explaining what the 4th component of the gl_Position vec4 is doing aside from making the vector big enough so matrix transformations can be applied to it.

Q: What can I do with the 4th component of gl_Position / what does it influence in the rendering process?

sentences:
First Person Shooter game agent development I would like to apply (program) the Artificial intelligence methods to create game bots for first person shooter games. Do you have any knowledge from where can I start to develop as a Linux user? Do you have a suggestion for an easy-to-start game for which I can develop bots easily, caring more about the result of my algorithms rather than spending a lot of time dealing with the game code? I've read some publications about the applied methods to Quake 3 (c) and Open Arena. But I couldn't find the source codes and manuals describing how to start coding( for compiling, developing ai and etc.).

I appreciate your help.

sentences:
How to figure out what's moving my GameObject? I have a GameObject as part of a complex scene with a handful of interconnected parts, that's moving when it shouldn't be.  I've tried running under the debugger and setting breakpoints on all of the script points that are supposed to move its Transform, and ensured that none of them are firing.  There seems to be some "spooky action at a distance" going on, some rogue script doing something I don't want it to be doing, but I can't for the life of me figure out where it is.

What I'd really like is some way to set a "breakpoint" on the object's Transform that will break me into the debugger when it gets moved by any script, but that doesn't appear to be supported.  Is there any way to figure out exactly what it is that's moving my object around when it shouldn't be?

(And before anyone says "trial and error, disable components and see when it stops moving," I already know exactly which component to disable to make it stop moving.  Unfortunately, that isn't helping track down the problem because the movement isn't coming directly from that component's MonoBehaviour script.)

sentences:
Centre of mass not recalculated after scaling I am spawning a prefab object at runtime (actually, in the Start() method of another object), and I need to apply a scaling to the object. I made a little component to handle this:

public class Spawner : MonoBehaviour {

  public Transform SpawnPrefab;
  public Vector3 Scale;

    void Start () {
      var spawn = Instantiate(SpawnPrefab, Vector3.zero, Quaternion.identity);
      spawn.localScale = Vector3.Scale(spawn.localScale, Scale);
      // spawn.GetComponent<Rigidbody>().ResetCenterOfMass();  // Has no effect
    }
}

The pivot point of the prefab I am spawning does not coincide with the centre of mass of the object. Therefore, the rescaling means that the centre of mass location relative to the pivot will change. However, it's not being updated automatically, so my spawned object has unexpected physics.

I tried adding a call to GetComponent<Rigidbody>().ResetCenterOfMass() immediately after the call to Scale()  (the commented-out line above), but this has no effect.

However, if I put the call to ResetCenterOfMass() in the Start() method of a separate little component added to the spawned object, e.g.

public class COMReset : MonoBehaviour {
  void Start() {
    GetComponent<Rigidbody>().ResetCenterOfMass();
  }
}

this does cause the centre of mass to be recalculated correctly. However, the spawned object appears to have already been through at least one physics update with the wrong COM by this time, and so has already acquired some unexpected momentum.

Why isn't the COM being automatically recalculated, without me having to call ResetCenterOfMass() explicitly? And if I must trigger it manually, can I do that immediately after the calls to Instantiate() and Scale(), rather than deferring like this?

sentences:
3D Camera control in DCC I'm trying to build a simple world editor and I would like to implement a camera similar to what's used in 3ds Max, Maya or even Unity.

From what I can figure out from Unity, the panning behavior seems to be relatively simple : the camera is moving on the plane defined by the camera position and direction. However, rotation is more complex. Most of the time, the camera is looking at a fixed point on the xz plane and rotating around it. I'm not entirely sure how this point is determined and this is what I'm trying to find out. Also, I've noticed that, after a certain height, the camera fall back to a rotation-only control.

Does anybody implemented something similar to this?

sentences:
GLM: Euler Angles to Quaternion I hope you know GL Mathematics (GLM) because I've got a problem, I can not break:

I have a set of Euler Angles and I need to perform smooth interpolation between them. The best way is converting them to Quaternions and applying SLERP alrogirthm.

The issue I have is how to initialize glm::quaternion with Euler Angles, please?

I read GLM Documentation over and over, but I can not find appropriate Quaternion constructor signature, that would take three Euler Angles. The closest one I found is
angleAxis() function, taking angle value and an axis for that angle. Note, please, what I am looking for si a way, how to parse RotX, RotY, RotZ.

For your information, this is the above metnioned angleAxis() function signature:

detail::tquat< valType > angleAxis (valType const &angle, valType const &x, valType const &y, valType const &z)

sentences:
Client side prediction on FPS game I've recently attempted to develop a simple client prediction for an FPS based on Gaffer on Games famous blog (http://gafferongames.com/game-physics/networked-physics/).

Now I've gotten to the point that everything works (more or less), my main problem is crossing the message sent from the server and finding the appropriate snapshot on the client. I can use the last/average ping time to find a very near state, but it will never be exactly timed/placed as on the server.

So my question is - how exactly can I sync and find the time stamp sent from the server to the client and find which snapshot is the correct one on the client?

sentences:
Rectangle Collision Not Correct As you can see on the top corner it says COL: False/True. This is if the player bounds and the tiles which are solids. The rectangles for the tiles and players are checked if they intercept each-other. Looks like its working right? Well nope. Look more closely.

The BOTTOM RIGHT corner needs to be inside the tiles for it to count.

Now let's get to the code I used now that hopefully you understand the problem.

Player Bounds (Rectangle)

playerBounds.Width = 32;
playerBounds.Height = 64;
playerBounds.X = (int)this.position.X;
playerBounds.Y = (int)this.position.Y;

Tile Bounds (Rectangle)

newTile.bounds = new Rectangle(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE);

Now onto how it detects it:

for (int x = 0; x < Tilemap.MAP_WIDTH; x++)
        {
            for (int y = 0; y < Tilemap.MAP_HEIGHT; y++)
            {

                if (tm.tile[x, y].bounds.Intersects(playerBounds))
                {
                    if (tm.tile[x, y].getSolid())
                    {
                        Colliding = true;
                    } else
                    {
                        Colliding = false;
                    }
                }
            }

        }

Move

    public void Move(Vector2 pos)
    {
        for (int i = 0; i < speed; i++)
        {

            position += pos;
        }

    }

I have used breakpoints at the collision detection loop. And the rectangle fully covers the character and the tiles.

sentences:
How to manually render with a given camera in Unreal Engine 4? I would like to render with any camera at any given time for a Portal clone project.
There's a USceneCaptureComponent2D but it renders the whole scene to a texture.
I don't need to render the entire scene. I would like to setup stencils to avoid unnecessary rendering. I don't think this component supports this.
Additionally, I would like to render directly to the main framebuffer - without render textures, which this component uses.
Is it possible to do something like this in Unreal Engine 4?

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:
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:
2D object move & evade obstacle Description:

Actor{
    int x,y,width,height;
    float speed, angle;
}

actor is an object that move around the map
every frame, actor change position(x,y) according to it’s speed & angle

Problem:

If: Next frame actor A will collide with actor B
Then: A should turn to what angle to evade B?

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:
Creating a GUI Countdown Timer Unity5 This was originally posted as a follow-up comment to https://stackoverflow.com/questions/30714357/guitext-in-unity-5-need-an-alternative , but I'm asking it here as a dedicated question as per the community's recommendation.

What I'm trying to do: display GUI Text on screen as a countdown timer that counts down in real time

What I've done so far:

watched YouTube tutorial:  "Unity Scripting Tutorial 7 - A Countdown Timer" by VR Enthusiast.1
GameObject --> UI --> Text --> renamed: TimerText
Wrote the Timer script in C#

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

 public class Timer : MonoBehaviour

public float seconds = 59;
public float minutes = 0;

void Update() {

    if (seconds <= 0) {

        seconds = 59;
        if (minutes > 1) {

            minutes--;

        } else {

            minutes = 0;
            seconds = 0;
            GameObject.GetComponent<GUIText>().text = minutes.ToString("f0") + ":0" + seconds.ToString("f0");

        }

    } else {

        seconds -= Time.deltaTime;

    }

    if(Mathf.Round(seconds) <= 9) {

        GameObject.GetComponent<GUIText>().text = minutes.ToString("f0") + ":0" + seconds.ToString("f0");

    } else {

        GameObject.GetComponent<GUIText>().text = minutes.ToString("f0") + ":" + seconds.ToString("f0");

    }

}

}
placed the TimerText object in the GUI Text object reference

Then I got this error:

"MissingComponentException: There is no 'GUIText' attached to the "TimerText" game object, but a script is trying to access it. You probably need to add a GUIText to the game object "TimerText". Or your script needs to check if the component is attached before using it. Timer.Update () (at Assets/Timer.cs:40)"

I essentially placed The object GUI Text object itself (TimerText) as its own scripting reference in Unity's Inspector. Not sure where to go from here. Any advice on what I can do next? Any help would be appreciated.

sentences:
What is the best way to funnel input to the correct entities? I have an input pipeline that stores InputObjects into a queue, which I then iterate through once every frame.

while(!inputQueue.isEmpty())
{
    InputObject inp = inputQueue.pop();

    boolean handled = false;
    for(Entity entity : inputRecievingEntities)
    {
          //entity.manage() returns true if it wants to consume the event, false otherwise
          handled = entity.manage(input);
          if(handled)
               break;
    }
}

This works fine to make sure the input is handled by only one entity. However, consider this situation:

There is a button overlaying the screen. The user can either click the button to jump or press anywhere (else) on the screen to shoot in that direction (which is handled by the player entity). If the player entity happens to be before the button entity in the inputReceivingEntities list, the player will shoot and not jump. If the button is before the player, the player will jump, and not shoot (which would be correct). Obviously I could assign some sort of priorities to the objects and sort the list but is there a better way to do this?

sentences:
Fixing game loop to 60fps makes animation very jittery ns is 1000000000 / amountOfTicks;

    long now = System.nanoTime();
    delta += (now - lastTime) / ns;
    lastTime = now;

    if (delta >= 1) {
        tick(glad);
        updates++;
        delta--;
        fps_counter = 0;
    }

    if (delta >= fps_counter / FramesPerTick) { // render
        fps_counter++;
        frames++;
        render(glad);
    }

    if (System.currentTimeMillis() - timer > 1000) {
        timer += 1000;
        frame.setTitle("Ticks: " + updates + " Fps: " + frames);
        updates = 0;
        frames = 0;
    }

So if i have 20 ticks and 3 FramesPerTick i get 60fps
it checks whenever delta is bigger than 1/3, 2/3 and 3/3, so every tick has 3 frames

Everything is jittery, movement, mouse look.
Animation gets more and more jittery the lower the FPS, i dont understand why.

Also when i take the render(glad) method out of the if, it goes up to 400 fps and runs very smoothly.

EDIT:
If i put Thread.sleep(13) instead of if (delta>=fpscounter/FramesPerTick){} i get around 60 fps and smooth animations.

sentences:
how to make cross platform 3d games using modern opengl? How to create games that run on windows, Linux, mac os x, android, ios, wp8 etc....
using c/c++, opengl 3 or 4 and opengl es 2.0.
any tutorials or videos on how to create cross-platform 3d games.

sentences:
How to change size of collider attached to UI Image in unity I have a circle image which has a Cicle collider 2D and Rigidbody 2D attached to it and its size (width and height) is constantly increasing in script like this:

rt = circle.GetComponent<RectTransform>();
float width = rt.rect.width + increment;
float height = rt.rect.height + increment;
rt.sizeDelta = new Vector2 (width, height);

The collider doesn't change size with UI Image as it expands...what should i do in order to make the collider change size as UI Image changes size.

sentences:
GJK algorithm in case of circle and polygon? I wonder if it's possible to modify GJK so I can use it to detect collision between circle and n points polygon.
I implemented for polygon and polygon before, and I tried modifying the support function (to get furthest point of a circle), but apparently, this results in infinite loop.
Is this possible to do? do I need to change other thing than the support function? (because I don't see any)

sentences:
FXAA Shader turns image upside-down I'm trying to use an existing FXAA shader for anti-aliasing, which works, but when I try to run it, the filtered image is upside-down (vertically flipped)

[Vertex_Shader]
varying vec4 posPos;
uniform float FXAA_SUBPIX_SHIFT = 1.0/4.0;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in

void main(void)
{
  gl_Position = ftransform();
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  posPos.xy = gl_MultiTexCoord0.xy;
  posPos.zw = gl_MultiTexCoord0.xy -
                  (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));
}

[Pixel_Shader]
#version 120
uniform sampler2D tex0; // 0
uniform float vx_offset;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in
uniform float FXAA_SPAN_MAX = 8.0;
uniform float FXAA_REDUCE_MUL = 1.0/8.0;
varying vec4 posPos;

#define FxaaInt2 ivec2
#define FxaaFloat2 vec2
#define FxaaTexLod0(t, p) texture2DLod(t, p, 0.0)
#define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)

vec3 FxaaPixelShader(
  vec4 posPos, // Output of FxaaVertexShader interpolated across screen.
  sampler2D tex, // Input texture.
  vec2 rcpFrame) // Constant {1.0/frameWidth, 1.0/frameHeight}.
{
/*---------------------------------------------------------*/
    #define FXAA_REDUCE_MIN   (1.0/128.0)
    //#define FXAA_REDUCE_MUL   (1.0/8.0)
    //#define FXAA_SPAN_MAX     8.0
/*---------------------------------------------------------*/
    vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
    vec3 rgbNE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,0), rcpFrame.xy).xyz;
    vec3 rgbSW = FxaaTexOff(tex, posPos.zw, FxaaInt2(0,1), rcpFrame.xy).xyz;
    vec3 rgbSE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,1), rcpFrame.xy).xyz;
    vec3 rgbM  = FxaaTexLod0(tex, posPos.xy).xyz;
/*---------------------------------------------------------*/
    vec3 luma = vec3(0.299, 0.587, 0.114);
    float lumaNW = dot(rgbNW, luma);
    float lumaNE = dot(rgbNE, luma);
    float lumaSW = dot(rgbSW, luma);
    float lumaSE = dot(rgbSE, luma);
    float lumaM  = dot(rgbM,  luma);
/*---------------------------------------------------------*/
    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
/*---------------------------------------------------------*/
    vec2 dir;
    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));
/*---------------------------------------------------------*/
    float dirReduce = max(
        (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
        FXAA_REDUCE_MIN);
    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
    dir = min(FxaaFloat2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),
          max(FxaaFloat2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
          dir * rcpDirMin)) * rcpFrame.xy;
/*--------------------------------------------------------*/
    vec3 rgbA = (1.0/2.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (1.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (2.0/3.0 - 0.5)).xyz);
    vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (0.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (3.0/3.0 - 0.5)).xyz);
    float lumaB = dot(rgbB, luma);
    if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
    return rgbB; }

vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
  vec4 c = vec4(0.0);
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  c.rgb = FxaaPixelShader(posPos, tex, rcpFrame);
  //c.rgb = 1.0 - texture2D(tex, posPos.xy).rgb;
  c.a = 1.0;
  return c;
}

void main()
{
  vec2 uv = gl_TexCoord[0].st;
  gl_FragColor = PostFX(tex0, uv, 0.0);
}

I'm still new to shaders - how can I modify this shader so the filtered image is displayed the correct way up?

sentences:
How can people recognize what engine a game uses, based off its graphics? With many games, you can say "oh, that's the Unreal Engine, for sure", or "this was made with an upgraded Rockstar Advanced Engine". We can often recognize the engine used for a game just by looking at its graphics, disregarding user interface.

Why is this? All game engines use the same 3D rendering technology that we all use, and the different games usually have a distinct art style. What's left to recognize?

sentences:
How to compute highscores, so that 10 matches will "correctly" compete 100 matches When computing highscores, it is possible to:

count sum of points (in every match),
count average of points (across all matches).

Sum is vulnerable to: multiple low-quality matches.

Average is vulnerable to: creating new account and playing few high-quality matches.

How to face this problem? Multiply sum x average? How is this done in practice, e.g. in World of tanks?

sentences:
Railgun Ruby - is there a documentation? I finally found Railgun Ruby on the web and installed it.

But I cannot find any documentations.

Does anyone have played around with it? Does anyone still have a good documentation about it?

I'd like to have a look at what it can do.

Thanks.

Yours, Joern.

sentences:
How to get crash reports from game Unity3d I am working on a project and I am in need of to gather CrashReports, email crash log, along with allowing the user to describe how the crash happened. I cannot find anything on how to do this, anyone has any ideas? Thanks!

-Learning Unity User

sentences: Physics engine for Billiard game I need to write a simple 3D billiard game using OpenGL. Which physics engine is simple and best to use in this case? Or it's better to write physics by myself?

sentences:
Capturing a programs performance I'm trying to capture the performance of the GPU, CPU, FPS and memory usage on a program I'm currently working with and want to avoid having to write my own performance capture stuff. Does anyone know of a good program/programs that can do 1 or more of the above?

Ideally something that is simple to use. I've googled a few, but getting them to work has been a right pain. The couple that I've tried out have given me my entire systems performance, as opposed to just my running program.

Any help would be appreciated. I'm currently using DirectX 9 and C++ for my program.

sentences:
Are there 3D projections other than orthographic and perspective? The question is pretty much in the title. Are there notable 3D projections other than orthographic and perspective that could be used in a 3D system such as OpenGL?

In particular, are there any that have a particular use in game design?

sentences:
Should a server run all maps in one loop, or a thread/game loop per map? I'm working on a real time multiplayer browser-based game.
The game is top down on variable size tile based maps. There is no central map where all players come together, the entire game plays out in multiple maps. (Player chooses one on login, but has the ability to switch whenever they want).
Let's take the following loop that runs on the server side of things:
let tick_time = Duration::from_millis(500); // e.g. Tick 2 times per second.
let mut next_tick = Instant::now();

loop {
    let now = Instant::now();

    if now >= next_tick {
        // Parse user input
        // Update state
        // Update to state to users in map

        next_tick += tick_time;
    } else {
        let wait_time = next_tick - now;
        sleep(wait_time - Duration::from_millis(1)).await;
    }
}

In my 'map based' gameplay scenario, would it make sense to spawn a thread for every map where one of these loops runs? Or would it be recommended to have only a singular thread with a singular game loop that updates every map? Or is there perhaps a better, already existing, pattern for this?

sentences:
How to calculate alpha for n channels, so the sum equals 1 (100% coverage)? Having "n" number of overlaying channels (bitmaps in the same place, layers etc.) how to calculate required alpha for each of them, so they "hide" background completely?

Each layer can have equal value, sum should be exactly 1 ("full alpha"). "n" is 2 or more (likely up to dozens).

[Game example of this would be a Smoke Grenade in FPS game - multiple ("n") bitmaps, making area behind it completely invisible for player - if standing before smoked area (standing inside results in partly-covered vision).]

sentences:
Odd Behaviour XNA Game Component Inside of my main class file I am initializing a number of game components which are used to represent game scenes i.e. main menu and game. I am initilizing each component inside of XNAs LoadContent method without issue and set the default scene as the main menu. I then switch to the game scene.

My issue then occurs when I switch back to the main menu scene and then try to start a new game by switch from the menu to the game scene. When I switch from the game to the menu I dispose of the game scene using the GameComponent.Dispose() method provided by the XNA framework.

private void UnloadScene(GameScene scene)
{
     scene.Dispose();
}

As I have disposed of the game scene I attempt to re-initialize the game scene component with the following method.

private void LoadScene(GameScene scene)
{
     scene = new GameScene(this, graphics.GraphicsDevice);
     Components.Add(scene);
}

I then switch from the menu scene to the game scene using the following method. This method is called in my Update method after the user has selected new game on the main menu.

public void SwitchScene(SceneManager manager)
{
     sceneManager.HideScene();
     sceneManager = manager;
     manager.ShowScene();
}

This time when the game scene loads I am met with a cornflower blue background and no assets on screen. I have placed a breakpoint within the above method and seen that the game scene is given all of the required data yet nothing is being drawn.

However if I explicitly place the following code above the SwitchScene() method after the player has selected new game then the scene is drawn without issue.

scene = new GameScene(this, graphics.GraphicsDevice);
Components.Add(scene);

Below is what the code looks like with the second approach mentioned.

if (InputHandler.IsHoldingButton(0, Buttons.A, out throwAway))
{
     switch (menuScene.Index)
     {
          case 0:
              gameScene = new GameScene(this, graphics.GraphicsDevice);
              Components.Add(gameScene);

              SwitchScene(gameScene);
              break;

          case 1:
              this.Exit();
              break;
     }
}

Is this behaviour intentional, if so how would I attempt to produce the first approach correctly?

Below is a screenshot of the graphics device after the second attempt to load the game scene. Note the data in this image is identical to the graphics device when loading the game scene for the first time.

Below is the code for the SceneManager class.

public class SceneManager : DrawableGameComponent
{
    private readonly List<GameComponent> components;

    public List<GameComponent> Components
    {
        get { return components; }
    }

    public SceneManager(Game game)
        : base(game)
    {
        components = new List<GameComponent>();

        // Indicates whether draw should be called
        Visible = false;

        // Indicates whether GameComponent.Update should be called
        // when Game.Update is called
        Enabled = false;
    }

    public virtual void ShowScene()
    {
        Visible = true;
        Enabled = true;
    }

    public virtual void HideScene()
    {
        Visible = false;
        Enabled = false;
    }

    public override void Update(GameTime gameTime)
    {
        for (int i = 0; i < components.Count; i++)
        {
            if (components[i].Enabled)
                components[i].Update(gameTime);
        }

        base.Update(gameTime);
    }

    public override void Draw(GameTime gameTime)
    {
        for (int i = 0; i < components.Count; i++)
        {
            GameComponent component = Components[i];

            if ((component is DrawableGameComponent) &&
                ((DrawableGameComponent)component).Visible)
            {
                ((DrawableGameComponent)component).Draw(gameTime);
            }
        }

        base.Draw(gameTime);
    }
}

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:
How come the 3d graphics and animations of MMORPGs are usually worse than non-online 3d games? I have noticed that in general it seems like the 3d graphics and animations for MMOs and MMORPGs seem not as seductive and polished as the graphics for normal, non-online 3d games.

How come this is the case?

or
Is my judgement inaccurate?

If my judgement is inaccurate please provide examples of MMORPGs that render 3d graphics and animations that are superior to normal, non-online 3d games.

sentences:
Cast shadow without rendering object I'm new to UDK, and am using it to develop a survival-horror game based heavily on shadows.

My question is short:  is there a way to create an actor that, when rendered, ONLY renders its shadow (not itself)?

If UDK can't do this, is there any other engine (Unity, CryEngine, Source) that can?

sentences:
Detect Car Wheel Position? I have an image:

I want to detect wheel empty position dynamically, is it possible?

If not possible please let me know, my work involves PHP/XML/Actionscript where actionscript get image url from xml generated by PHP,

User uploads car image through php admin panel, then passes url to actionscript through XML and actionscript should load image and let him choose the wheel and test on the car.

If you have another solution let me know?

sentences:
Player Ranking System Already posted this on another forum but I'll repost it here because I'm curious if this is a good forum for game-design questions.

I'm looking to design a player ranking system for my game. The game is similar to a racing game where you get a score for individual tracks you play (based only on your own performance). Beside the score for tracks played I want a player rank. The purpose of this player rank is to:

Make you feel like you are progressing and getting better
Encourage you to play more
Encourage you to play better and improve your skill
Be enjoyable

Another way to state it is that I want to encourage playing more levels (increasing amount of play) as well as improving skill (getting higher score). It's not necessary for the rank to actually reflect your skill. Although, I suspect some amount of accuracy is needed for the score to feel meaningful.

The only ranking system I'm familiar with is the ELO-type ranking system which I feel is lacking in some ways. Although it accurately reflect the skill of the player it has the problem of not being enjoyable in my experience - it punishes bad plays, gives no rewards for trying/experimenting with new plays. It also puts a lot of pressure on you to perform well in every game which discourages casual play.

Any ideas?

Thanks

sentences:
Jittery collisions in Unity 2D I tried to implement a simple movement to my object. My object moves perfectly fine but I'm having issues with its collision. When I keep on moving object towards the obstacle/ground, collision are jittery.
Here the code for what I've written.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TempScript : MonoBehaviour
{
    [SerializeField] float walk_speed = 5f;
    [SerializeField] float jump_speed = 10f;
    [SerializeField] float max_up = 7f;
    [SerializeField] float max_low = -1.5f;

    void Update()
    {

        PlayerMovement();

    }
    void PlayerMovement()
    {

        if (Input.GetKey(KeyCode.W) && transform.position.y <= max_up)
            transform.position = transform.position + Vector3.up * jump_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.S) && transform.position.y >= max_low)
            transform.position = transform.position + Vector3.down * jump_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.D))
            transform.position = transform.position + Vector3.right * walk_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.A))
            transform.position = transform.position + Vector3.left * walk_speed * Time.deltaTime;
    }

}

The cube goes below the ground and bounces right back up. making it look like its jittering.
what i want is movement should stop when its colliding with object. just like it happens with addForce method.
for now you can ignore max_up and max_down variable, it was just to make sure its in the camera.

sentences:
How is the default value of ContactFilter2D.isFiltering true? I have a static ContactFilter2D like so:

protected static ContactFilter2D contact_filter;
protected float self_destruct_timer;
protected Vector3 direction;
private float xward;

protected virtual void Start ()
{    phys.velocity = transform.right * speed * xward;
     self_destruct_timer = Time.time + life_time;

     if (!contact_filter.isFiltering) contact_filter.layerMask = Public_Const.Solid;
     contact_filter.useLayerMask = true;
     ...
}

Every isFiltering_____ variable (i.e. isFilteringLayerMask) is set to false by default, therefore there should be no way that isFiltering should return a true value.
The whole point of checking to see if isFiltering is true is to check to see if the contact filter has already been initialized, so why won't it work?

sentences:
Opengl in 500 lines point in triangle question https://github.com/ssloy/tinyrenderer/wiki/Lesson-2-Triangle-rasterization-and-back-face-culling
I am on lesson 2 of the "Opengl in 500 lines" tutorial. I follow the part of the lesson in "The method I adopt for my code", but I don't understand this leap from
P = A + uAB-vector + vAC-vector

to
0-vector = uAB-vector + vAC-vector + PA-vector.

sentences:
Why does the code in Unity affect objects differently? There are 2 objects made in a blender and imported into Unity.

Eye of the Cyclops.blend

Flask.blend:

The problem is that after using the code, which should create an object in the hand-body area (I'm still working on it), one object is created far from the character.

Example:

Everything is OK.

It's not ok.

Code:
PlayerInteraction:

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

public class PlayerInteraction : MonoBehaviour
{

    public GameObject target = null;

    public KeyCode interactKey;

    public GameObject itemHolder;

    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent<FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent<TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

        }
    }

    public void SetItem(GameObject c)
    {
        if (c != null)
        {
            Debug.Log("Взяли предмет!");
            itemHolder = Instantiate(c, transform.position + new Vector3(0f, 2.15f, -0.65f), Quaternion.Euler(-90f, 0f, 180f), transform);
        }
        else
        {
            Destroy(itemHolder);
        }
    }

    private void OnTriggerEnter(Collider col)
    {
        if (target != col.gameObject && target != null)
        {
            return;
        }
        else {
            target = col.gameObject;
            Debug.Log("Мы дошли сюда до " + target.name);
        }

    }

    private void OnTriggerExit(Collider col)
    {
        if (col.gameObject == target)
        {
            target = null;
        }
    }
}

TableBox:

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

public class TableBox : MonoBehaviour
{

    public GameObject itemHolder;

    private void Start()
    {
        if (itemHolder != null)
        {
            itemHolder = Instantiate(itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 45f, 0f),transform);
            Debug.Log("Мы создались!!");
        }
    }

    public void Interact(GameObject i, PlayerInteraction player)
    {
        if ((i == null || itemHolder == null))
        {
            player.SetItem(this.itemHolder);
            Destroy(this.itemHolder);
            //Debug.Log(itemHolder);
            this.itemHolder = i;

            if (this.itemHolder != null)
            {
                this.itemHolder = Instantiate(this.itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 0f, -135f),transform);
                Debug.Log("Мы ингридиенты из ТейблБокса!");
            }
        }
        else
        {
            return;
        }
    }
}

FoodBox:

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

public class FoodBox : MonoBehaviour
{

    public GameObject ingredient;
    private Animator anim;

    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator>();
        anim.SetBool("openFoodBox",false);
    }
    public void Interact(PlayerInteraction player)
    {
        anim.SetBool("openFoodBox", true);

        if (anim.GetBool("openFoodBox")) {
            anim.Play("Opening");
            player.SetItem(ingredient);
            Debug.Log("Мы ингридиенты из ФудБокса!");
        }

        anim.SetBool("openFoodBox",false);
    }
}

There is also an assumption that this is due to the initial position of the models. Because for me, some models are stored normally vertically, and some lie horizontally.

I also add the prefab inspector:

Eye of the Cyclops:

Flask:

sentences:
Splitting a tetris game apart - where to put time-management? I am creating a tetris game in C++ & SDL, and I'm trying to do it "good" by making it object-oriented and keeping scopes small. So far I have the following structure:

A main with some lowlevel SDL set up and handling input
A game class that keeps track of score and provides the interface for main (move block down, etc)
A map class that keeps track of the current game field, which blocks are where. Used by the game class.
A block class that consists of the current falling block, used by game.
A renderer class abstracting low level SDL to a format where you render "tetris blocks". Used by map and block.

Now I have a though time where to place the time-management of this game. For example, where should be decided when a block bumps the bottom of the screen how long it takes the current block locks in place and a new block spawns?

I also have an other unrelated question, is there some place where you can find some standard data on tetris like standard score tables, rulesets, timings, etc?

sentences:
How are loot box labels positioned? Take this screenshot for example:

How exactly are they positioned perfectly adjacent to each other? Do they already create the label positions based upon the world map first, and then when the player drops an item it fills the space? Or do they use a simple padded array function server-side and some custom algorithm to position them right next to each other. I have a feeling I'm totally overthinking this.

I am using nodejs w/ the Phaser framework for my web based game and am stuck at how they accomplish this server-side. (Since all players in-game see the same exact position)

sentences:
Creating a path including loops and spirals I have a paper airplane that I would like to take a "random" path towards its destination based on the game layouts size. I want it to include spirals and loops and gliding a little back and forth.

How would I go on about creating those random movements?

sentences:
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:
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:
Client not executing commands in Unet Edit

Okay, so I partially solved the problem by adding a rigid body component to the capsule. I read somewhere that apparently you have to have one in order to move on the server.

Problem 2

The next problem I have is that I can now move a capsule that is spawned by the client fine and the host can move it as well as many times as they like. The problem I am getting now is that when the host spawns a capsule the client cannot move it at all and I get a sort of glitch effect on the client side and the capsule still doesn't move on the host side. Is there a reason why it would only work one way and not the other way around? I thought at first it might have to do with Spawn vs SpawnWithClientAuthority but that doesn't seem to make a difference.

Project Summary

I have a pretty simple multiplayer project, all I want to do is have one player host and the other join as a client. Once they are joined together the two players can spawn a capsule and then when the user clicks on a capsule. They should be able to pick it up and move it around the scene and the other player should be able to see this action. I can get both players to connect to the server and spawn their own capsule and both players can see this. The movement script is done as well. However, it is only transmitted on the host side. When the client picks up the object it does not update on the server.

Problem

I have done a bit of debugging and have found that when I call the command on the client it is not being executed at all through line breaks and simple debug statements.

Code

public void OnInputClicked(InputClickedEventData eventData)
    {
        Debug.Log("clicked");
        if (isLocalPlayer)
        {
            if (Physics.Raycast(transform.position, direction: transform.forward, hitInfo: out hit, maxDistance: range))
            {
                Debug.Log("Hit capsule");

                objectID = GameObject.Find(hit.transform.name);
                objNetId = objectID.GetComponent<NetworkIdentity>();
                playerIDThatClicked = player.GetComponent<NetworkIdentity>();

                CmdAssignAuthority(objNetId, playerIDThatClicked);
                Debug.Log("grabbed");

            }
            else
            {
                //if we are releasing the object we want to unassign our authority
                if (objNetId != null)
                {
                    CmdAssignAuthority(objNetId, playerIDThatClicked);

                    objNetId = null;
                    Debug.Log("released");
                }
            }
        }

    }

[Command]
    void CmdAssignAuthority(NetworkIdentity target, NetworkIdentity player)
    {
        Debug.Log("inside cmd");
        current = target.clientAuthorityOwner;
        playerconn = player.connectionToClient;

        if (current != null && current != playerconn)
        {
            Debug.Log("Had authority now removing and replacing");
            target.RemoveClientAuthority(current);

            target.AssignClientAuthority(playerconn);

        }
        else if (current != null)
        {
            Debug.Log("removing authority");
            target.RemoveClientAuthority(current);

        }
        else if (current == null)

        {
            Debug.Log("No authority, adding one now");
            target.AssignClientAuthority(playerconn);

        }
        else {
            Debug.Log("CmdAuthority error");
            target.RemoveClientAuthority(playerconn);

        }
    }

Question

Am I calling this command correctly? The script is attached to a player prefab and the capsule prefab contains a network id and a network transform. I am pretty new to Unet and this feels like a noob mistake.

sentences:
Finding relative x and y value on a sprite [Gamemaker] I'm having a little conundrum that may just result from a lack of knowledge of Gamemaker's functionality. I've attached two images to aid explanation.

I have a sprite of a turret (with a gun barrel), attached to a turret object, and at certain points in gameplay this object will spawn another object on top of it (let's call it the 'bullet object').

I would like the bullet object to spawn at the x and y coordinates at the end of the gun barrel. This would be easy to find as a pair of coordinates if the sprite was always stationary, in this configuration. Alas, it is not. It rotates like billy-oh. This means that the x and y coordinates at the end of the gun barrel are constantly different.

How do I find this constantly changing x and y coordinate? I imagine (though am most likely wrong) that there the initial x and y coordinates of the sprite are saved and can be found even if rotated; is there a function that does this? Or do I need to write a script and then call it every time I want to spawn the bullet object?

Thanks for your help.

sentences:
I keep getting this error when I run my game so far I have a tags script:

public class Tags {
    //Tags
    public static string PLAYER_TAG = "Player";
    public static string PLATFORM_TAG = "Platform";

    //Player Animation Tags
    public static string ANIMATION_IDLE = "idle";
    public static string WALK = "walk";
    public static string ANIMATION_RUN = "run";
    public static string ANIMATION_JUMP = "jump";
    public static string ANIMATION_JUMP_FALL = "jumpFall";
    public static string ANIMATION_LEDGE_FALL = "ledgeFall";
    public static string ANIMATION_JUMP_LAND = "jumpLand";

}
 Then I have my player animation script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAnimation : MonoBehaviour {

    [SerializeField]
    private Animation anim;

    void Awake () {
        anim = GetComponent<Animation>();
    }

    public void DidJump () {
        anim.Play(Tags.ANIMATION_JUMP);
        anim.PlayQueued(Tags.ANIMATION_JUMP_FALL);
    }

    public void DidLand()
    {
        anim.Stop(Tags.ANIMATION_JUMP_FALL);
        anim.Stop(Tags.ANIMATION_JUMP_LAND);
        anim.Blend(Tags.ANIMATION_JUMP_LAND, 0);
        anim.CrossFade(Tags.ANIMATION_RUN);
    }

    public void PlayerRun()
    {
        anim.Play(Tags.ANIMATION_RUN);
    }
}

When I run the game, the player doesn't run like he's supposed to and I get this error:

NullReferenceException: Object reference not set to an instance of an object
PlayerMovement+<StartGame>c__Iterator0.MoveNext () (at Assets/Scripts/Player Scripts/PlayerMovement.cs:83)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

What am I doing wrong here?

sentences:
What is a good approach for making a relationship between the HUD and Environment? What is an elegant / common way to build a relationship between the game scene / environment / world and the HUD that usually sits on top of it? I have thought about this for a while, and though there are ways to accomplish this that are easy to implement, they always seem to expose too much unrelated information between the two, or end up being too coupled. An example of this that I have used in the past would be to simply pass reference from the HUD to the Environment and vice-versa (which is obviously not a good apporach for many reasons, especially when aiming for low coupling).

What I want to end up with is a clean, uncoupled way to do things like:

From the HUD; reference and manipulate objects within the environment, change the state of the Environment itself.
From the environment; update the HUD to reflect the current state of the environment.

Maybe passing reference between the two is the way to go about this, but I feel like there's some pattern that I am missing for this type of task. Any insights into past experience and implementations concerning this type of problem would be very helpful.

sentences: What NPC gets attacked first when attacking an NPC party in an RPG? Let's say I am in a battle with four trolls, and I have the highest initiative, so I attack first. Should I randomly choose a troll to attack? Proximity to each troll does not matter (it is not a factor in the algorithm). I remember playing an older RPG (I think one of the Final Fantasy games on N64), and the attacks appeared random. You might have one troll that never gets hit, or you might have one that always gets hit. Is there an acceptable standard?

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:
Java - Tile engine changing number in array not changing texture I draw my map from a txt file. Would I have to write to the text file to notice the changes I made? Right now it changes the number in the array but the tile texture doesn't change. Do I have to do more than just change the number in the array?

public class Tiles {

public Image[] tiles = new Image[5];

public int[][] map = new int[64][64];

private Image grass, dirt, fence, mound;

private SpriteSheet tileSheet;

public int tileWidth = 32;
public int tileHeight = 32;

Player player = new Player();

public void init() throws IOException, SlickException {
    tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight);

    grass = tileSheet.getSprite(0, 0);
    dirt = tileSheet.getSprite(7, 7);
    fence = tileSheet.getSprite(2, 0);
    mound = tileSheet.getSprite(2, 6);
    tiles[0] = grass;
    tiles[1] = dirt;
    tiles[2] = fence;
    tiles[3] = mound;

    int x=0, y=0;
BufferedReader in = new BufferedReader(new FileReader("assets/map.dat"));
String line;
while ((line = in.readLine()) != null) {
        String[] values = line.split(",");
    for (String str : values) {
            int str_int = Integer.parseInt(str);
            map[x][y]=str_int;
            //System.out.print(map[x][y] + " ");
            y=y+1;
        }
//System.out.println("");
x=x+1;
    y = 0;
}
    in.close();
}

public void update(GameContainer gc) {

}

public void render(GameContainer gc) {
    for(int x = 0; x < map.length; x++) {
        for(int y = 0; y < map.length; y ++) {
            int textureIndex = map[y][x];
            Image texture = tiles[textureIndex];
            texture.draw(x*tileWidth,y*tileHeight);
        }
    }
}

Mouse picking

public void checkDistance(GameContainer gc) {
    Input input = gc.getInput();

    float mouseX = input.getMouseX();
    float mouseY = input.getMouseY();

    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) {
        System.out.println("Clicked");
        if(tiles.map[(int)mousetileX][(int)mousetileY] == 1) {
            tiles.map[(int)mousetileX][(int)mousetileY] = 0;
        }
    }

    System.out.println(tiles.map[(int)mousetileX][(int)mousetileY]);
}

sentences:
How to balance this Pokémon simulator metagame by feedback? This is a Pokémon simulator where you build a team of 6 pokémon and battle with someone. Unfortunately, some Pokémon are stronger than others and only a few of the hundredth species are practical. I'm trying to create a metagame where all of them are competitive. For this, I am tagging a Pokémon with a parameter (level) that changes it's strength and scales up/down depending on the it's performance. That is, if the system detects Mewtwo is overperforming, it should decrease it's level tag until Mewtwo is balanced.

The question is: how can I identify if a Pokémon is causing an unbalance? The data I have is the historic of the battles (player 1, player 2, pokémon list, winner). The most basic solution I can think of is victory/loss counting.

sentences:
How to share matrix in HLSL? I am trying to share this across multiple effect files:

matrix worldMatrix : register(vs_4_0, b0);

If I set this from one effect file, will it effect every effect file which has the same type of variable assigned to that specific register?
What is the difference between this and the cbuffer struct?

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:
How can I play an audio source while a key is being held down? if (Input.GetKey(KeyCode.A))
        {
            audioSource.Play();
        }

Except this only functions once as the key is held down. Same goes with GetKeyDown. Is there any way I can get this to loop as long as they key is being held down? (Is in Update)

sentences:
How can I make this style of 2D "glowing" graphics? I'm comfortable with the basics of building a 2d sprite based game in XNA, where all my objects are simply .png images that I move around.

What things do I need to learn next to be able to develop a 2d game that utilizes an art style similar to Super Laser Racer for example.

Other examples of this style would include Frozen Synapse, Geometry Wars, etc.

I would describe this style "2D abstract glowing geometry" or something like that.

I can see that a lot of the effects in these types of games are achieved via particle systems and also that maybe some things are still just sprites that were maybe drawn in a graphics editor to look all "glowing" etc.

But then the rest is possibly done by making draw calls to DirectX and implementing custom shaders, etc?

Is that right? I'm not really sure of what to learn next to be able to go in this direction or what questions to ask.

sentences:
Turning model from 3ds max file into sprite I'm planning to buy animated 3D assets to render and use as 2D sprites in my game, but i don't know anything about 3ds max or own any software. How do i render the animations (i need top-down ones) to turn them into a bunch of pngs?

From there i already know how to create a spritesheet.

I assume there is a more streamlined way of doing this than opening each file in the 3D software, looking at each animation frame, and capturing the screen?

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:
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 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: Euler Angles of Any Great Circle from hit.point of a sphere How do you get the Euler Angles of Euler Angles of Any Great Circle that surrounds the raycast hit.point of a sphere?

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

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

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

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

Update 4:

Solved!

Try it live here.

sentences:
Setting bounds to a label in libgdx textStyle = new LabelStyle();
textStyle.font = font;
textStyle.fontColor=Color.GREEN;

EnterTextCasheir= new Label("",textStyle);
EnterTextCasheir.setBounds(AssetsHelper.convertWidth(158),
        AssetsHelper.convertHeight(162),
        AssetsHelper.convertWidth(180),
        AssetsHelper.convertHeight(55));
EnterTextCasheir.setWrap(true);
EnterTextCasheir.setFontScale(1f, 1.5f);
EnterTextCasheir.setSize(CashierCounterEnterBoxZoomImage.getWidth(),
        CashierCounterEnterBoxZoomImage.getHeight());

table4.addActor(EnterTextCasheir);

EnterTextCasheir.addListener(new InputListener() {
    private boolean EnterTextCasheirBol;

    public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
        if(!EnterTextCasheirBol)
        {
            EnterTextCasheirBol = true;
            Gdx.input.getTextInput(new TextInputListener() {
                private String CasheirBoxStg;

                @Override
                public void input (String text) {
                    EnterTextCasheirBol = false;
                    EnterTextCasheir.setText(text);

                    CasheirBoxStg = (String) text;
                }
            }
        ...
        }
    }
}

Its my brief code;I am not able to display the text into single line ;its coming in 2 lines can anyone help me to resolve.Thank you

sentences:
Are the Minecraft animations hardcoded into the game? I would like to know how the animation system works in minecraft. I get a feeling that all the mobs are hardcoded into the game. Did notch really sit there and create the matrices for all the animation bones by hand?

I like recreating games for fun, so I would like to know how he did this. Also, if he truly does hardcode them... is there a better way?

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:
Having trouble with grouping in 3D Studio Max I'm using 3D Studio Max 2012. I've got a simple mesh and several other polygons and I want to group everything all together. But the option is greyed out, I can't actually select 'Group' under the menus.

I've tried exploding and collapsing the mesh but nothing seems to work.

How can I group them together, what things can I do to try to diagnose the problem?

EDIT:
My object hierarchy looks weird:

scene root:
 . object 1
model:
 - object 2 ... 99

sentences:
Unity - How to set IK position of Left Hand with an offset? I have a character holding a stick with left hand. I am using IK to make the stick hit a target position. When I position left hand at target position, it works fine. But, I need to offset the hand such that the end of the stick hits the target position. For this, I have put an empty game object as a child at the end of the stick, and offset it like in the code below, but the hand just keeps jittering like crazy. I know it is quite possible to do, but somehow I seem to be missing something. Please help me!
[SerializeField] private GameObject target;
 private Vector3 leftHandPosition;
 private Vector3 hitChildPosition;

 private void OnAnimatorIK(int layerIndex)
 {
         Vector3 t = target.transform.position - (hitChildPosition - leftHandPosition);
         animator.SetIKPosition(AvatarIKGoal.LeftHand, t);
         animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
 }

 private void LateUpdate()
 {
         hitChildPosition = BatHit.transform.position;
         leftHandPosition = animator.GetBoneTransform(HumanBodyBones.LeftHand).position;
 }

Here's an image to visualise what I'm trying to solve -

sentences:
Movement constrained to the faces of a cube The basic setup I'm working with is a cube rendered in-Engine (Panda3d, although I only am looking for a generalized solution) as well as a 2d square on one face of the cube. The eventual outcome I'm looking for is for the player to control the 2d square with WASD as it moves on the faces of the cube (never anywhere else)

My current solution is to have the player object contain two unit vectors: forward and right. The forward vector controls with direction the player moves when W/S are pressed, and right controls the direction for A/D. So for example, the player starts out on the near Y face (y = -1), so the vectors are:

forward = {0, 0, 1}
right = {1, 0, 0}

When the player's position exceeds the a boundary of the cube (e.g. on a unit-cube, the Z coordinate is greater than 1), forward and right are recalculated for the new face the square should be on, and the square is appropriately rotated.

I've started to get this working, however, in this early implementation, there is a fixed camera. Eventually, the camera is planned to move to be orthogonal to the face the cursor is currently on, so I realized that what signifies "forward" is going to vary based on the path a player takes to get to a face. My struggle is to now find an appropriate movement method to the cube-face constrained motion, with a moving camera.

sentences:
Should I use "conventional" colors to represent item rarity? I'm making a new RPG that has loot. In fact, a majority of the game is based around loot. It's going to have colored borders to denote the rarity of the loot as it's drawn.

WoW uses Grey, White, Green, Blue, Purple, Orange and some others. GW2 uses Gray, Black, Blue, Green, Yellow, Orange, Pink, Purple. The colors don't match but you can see some distinct overlap.

I'm wondering if those colors are important or intuitive to users understanding of the rarity or if they can be messed with? If they can be changed how do you determine what colors to put in what order?

For instance, if I went with White, Blue, Green, Yellow, and Red, would that be fine as long as I made it clear in other ways or would those colors be confusing?

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:
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:
How to apply linear drag to a velocity vector? I have built my own movement code for my character as I want to make smooth movement. (This project is just a character and a floor/wall for testing).

The code seems to work fine, but I of course need to apply my own drag somehow. I've tried many ideas for this, and tried to read around a lot. But I can't work out if this code I made is frame dependant or not.

I am getting 120fps in Unreal editor for example (and my monitor is 144hz if that affects it), but what if someone played my game and was on 60fps, or another number.

After many hours I came up with the code below, and I did even go on the calculator and try to test with various numbers, but sadly I'm no expert mathematician, I wasn't sure if the figures I got meant it was good or bad.

Anyway, here is the move method, pretty self-documenting. With the drag part at bottom. Does this drag formula apply consistent drag for the character over any frame rate?

void APostie::Move()
{
float DeltaTime = GetWorld()->GetDeltaSeconds();
FHitResult Hit;

CurrentVelocity.X = FMath::Clamp<float>(CurrentVelocity.X + (InputAxisVector.X * WalkForce), -MaxWalkSpeed, MaxWalkSpeed);
CurrentVelocity.Y = FMath::Clamp<float>(CurrentVelocity.Y + (InputAxisVector.Y * WalkForce), -MaxWalkSpeed, MaxWalkSpeed);
FVector ForwardMovement = GetActorForwardVector() * CurrentVelocity.X;
FVector SidewaysMovement = GetActorRightVector() * CurrentVelocity.Y;
FVector Velocity_Localised = ForwardMovement + SidewaysMovement;

float r = 1;
FVector DeltaMovement = Velocity_Localised * (FMath::Pow(r, DeltaTime) - 1.0f) / FMath::Log2(r);

AddControllerYawInput(LookAxisVector.X * LookSpeed);
GetMovementComponent()->MoveUpdatedComponent(Velocity_Localised, GetActorRotation(), true, &Hit);

// Apply drag
CurrentVelocity *= (1 - WalkDrag) * (1 - DeltaTime);
if (CurrentVelocity.IsNearlyZero())
{
    CurrentVelocity = FVector::ZeroVector;
}
}

NOTE: WalkDrag is a uproperty set to 0.01f.

Also, I do of course realise I need to clamp the velocity and to handle hits so velocity is set to zero if I hit walls etc. I'm doing that now, but meanwhile still unsure about this drag formula.

UPDATE: I've tried to take on board DMGregory's help. Here is what I came up with:

void APostie::Move()
{
float DeltaTime = GetWorld()->GetDeltaSeconds();
FHitResult Hit;

CurrentVelocity.X = FMath::Clamp<float>(CurrentVelocity.X + (InputAxisVector.X * WalkForce), -MaxWalkSpeed, MaxWalkSpeed);
CurrentVelocity.Y = FMath::Clamp<float>(CurrentVelocity.Y + (InputAxisVector.Y * WalkForce), -MaxWalkSpeed, MaxWalkSpeed);
FVector ForwardMovement = GetActorForwardVector() * CurrentVelocity.X;
FVector SidewaysMovement = GetActorRightVector() * CurrentVelocity.Y;
FVector Velocity_Localised = ForwardMovement + SidewaysMovement;

float r = WalkDrag;
FVector DeltaMovement = Velocity_Localised * (FMath::Pow(r, DeltaTime) - 1.0f) / FMath::Log2(r);

AddControllerYawInput(LookAxisVector.X * LookSpeed);
GetMovementComponent()->MoveUpdatedComponent(DeltaMovement, GetActorRotation(), true, &Hit);

// Apply drag
CurrentVelocity *= FMath::Pow(r, DeltaTime);

}

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:
What are the limitations of retro consoles? I'm interested in creating a retro look for a game, and I'm currently in the process of deciding just how retro (which generation/console). What would make it easier would be if there was some sort of wiki/document on the limitations of each console, such as maximum number of colours total, maximum per sprite, number of layers, max tiles, max tile size, sprite size, etc., etc.. Take the Game Boy for example. 4 colours, yes, and I can find the screen resolution too. But what about all the other limitations?

So if anyone knows any good resources, it would be a huge help. I find that the freedom that today's generation of computers and consoles provides is a little too much, in that I can just keep adding more and more to it, and I'll never finish. I'd love to set a limit, and do the best I can within that limit.

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:
Will polishing my current project be a better learning experience than starting a new one? I started programming many years ago. Now I'm trying to make games. I have read many recommendations to start cloning some well known games like galaga, tetris, arkanoid, etc. I have also read that I should go for the whole game (including menus, sound, score, etc.).

Yesterday I finished the first complete version of my arkanoid clone. But it is far from over. I can still work on it for months (I program as a hobby in my free time) implementing a screen resolution switcher, remap of the control keys, power-ups falling from broken bricks, and a huge etc.

But I do not want to be forever learning how to clone ONE game. I have the urge to get to the next clone in order to apply some design ideas I have come upon while developing this arkanoid clone (at the same time I am reading the GoF book and much source code from Ludum Dare 21 game contest).

So the question is: Should I keep improving the arkanoid clone until it has all the features the original game had? or should I move to the next clone (there are almost infinite games to clone) and start mending the things I did wrong with the previous clone?

This can be a very subjective question, so please restrain the answers to the most effective way to learn how to make my own games (not cloning someone ideas). Thank you!

CLARIFICATION

In order to clarify what I have implemented I make this list:

Features implemented:

Bouncing capabilities (the ball bounces on walls, on bricks, and on the bar).
Sounds when bouncing on bricks and the bar, and when the player wins or loses.
Basic title menu (new game and exit only). Also in-game menu and win/lose menus.
Only three levels, but the map system is so easy I do not think it will teach me much (am I wrong?).

Features not-implemented:

Power-ups when breaking the bricks.
Complex bricks (with more than one "hit point" and invincible).
Better graphics (I am not really good at it).
Programming polishing (use more intensively the design patterns).

Here's a link to its (minimal) webpage: http://blog.acamara.es/piperine/
I kind of feel ashamed to show it, so please do not hit me too hard :-)

My question was related to the not-implemented features. I wondered what was the fastest (optimal) path to learn. 1) implement the not-implemented features in this project which is getting big, or 2) make a new game which probably will teach me those lessons and new ones.

ANSWER

I choose @ashes999 answer because, in my case, I think I should polish more and try to "ship" the game. I think all the other answers are also important to bear in mind, so if you came here having the same question, before taking a rush decision read all the discussion.

Thank you all!

sentences:
Roguelike movement system I'm trying to implement a roguelike movement system for my game. I'm using the ECS architecture.
The requirements are:

entities will have a mass, on which should slow down the entity
movement accordingly. fatty ones move slower
there will have different terrains, that should apply different
friction types, eg: ice will decelerate the entity slower; a
quicksand will almost stop the entity immediately and so on.

[optionally]

there will have different weathers that should also impact on the
entity movement, eg: sandstorm would push the entity to it's
direction; rains will diminish the friction coefficient a little bit
etc...

If the two first requirements are solved, the third will probably be as well, I think.
How would you do this?

sentences:
Godot - Collision for character teleportation I'm currently working on a little game to discover Godot game engine.
It's a Top-Down game and I want my character to be able to teleport through walls.
I thought to dupplicate my character's collision box and to set its position to the teleportation's position but I didn't find a way to check if there is a collision to this new position.
Any advise?

sentences:
How do we generate overhangs with simplex noise 3d? Now I use a simplex noise 2d function with x( voxel's x location ) and y(voxel's y location) to generate heightmap. How do we use simplex noise 3d to generate overhangs? What should the x y z inputs be?
Pseudo code would help a lot.

sentences:
Does the gender of a game's protagonist affect sales? Most protagonists of games are male. I imagine the conventional wisdom is that this is because

We live in a patriarchal society, especially when it comes to game development, and
The target demographic is predominantly male.

I once heard that for fiction, females are more able to empathise with a male character, than males are with a female character. So the great imbalance in gender in fiction is not necessarily due to patriarchy, but that it just makes sense from a financial point of view. I'm not sure if I subscribe to that, but it is interesting.

And there was a time when gaming was for super hardcore nerdy males, but now almost everybody has a games machine, and it is not a stigma to like games as it once was, I don't know if it is such a male domain any more.

So leaving aside any question of whether we should try to reduce gender stereotypes,
my question is, does having a female protagonist actually affect sales, in particular, for small indie games? Are there any experiments, statistics or research relating to this question? What is the actual demographic breakdown of gamers these days?

I realise this is an inflammatory subject, so I will stress here that I am not looking for opinions:

I am looking for hard facts and data.

sentences:
Is it possible to reuse the same window in multiple games? In particular, I'm thinking about C# and XNA, and obviously on Windows. Let's say I have the main game which is a normal XNA game, but at some point I would like to momentarily switch to a mini-game that was also implemented in XNA but is completely independent of my game.

Is there any way I can switch to and back between the two games, while reusing the same windows handle? And preferably keeping the old state in memory, although I could also implement this persistence writing to a file.

And when going back to the initial game, is there any way I could access the value returned by the mini-game's main method? For instance, 1 or 0 depending on whether the player cleared the mini-game or not.

Andrew Russell wrote:

  You should build your mini game and your main game into separate classes within the same program. Each of those classes should have Update, Draw, Initialize, etc methods. You should then have some kind of master controller to call those methods to have only one game active at a time (this could also simply be in your main game class).

Thanks for the answer. Your suggestion is what I'd do in a normal game situation - one where I'd be the one creating all of the mini games and their content.

But this is not a game, but rather a game maker tool for creating graphic adventures, and it is the end user that might feel the need to plug in external mini-games in response to certain game events.

The older internal engine that I'm trying to replace was done in Flash, and solved this problem simply by loading an SWF inside of the main SWF. It worked okay for most cases. I'm trying to do something similar but with XNA now.

But following your train or thought, perhaps I could create a separate assembly containing a base class or common interface for all mini games, and compile it as a dll. Then the user would reference that library, implement the interface and compile into his own library which could be loaded by the engine at runtime and executed as a separate state inside the main game. Am I missing some hidden implications?

sentences: Google Sketchup pro exporter/importer for MD5 model format? Where can I find google sketchup pro MD5 (The doom3 model format) exporter/importer? If there isn't one what modeling program can I use to export/import MD5 models?

sentences:
Should I slow down my animation with co-routines or update the animation state? I want to

gradually stop the car animation as it collides with another car
gradually speed up the car animation as it exits the collider

I have two ways to achieve this.

Update
Co-routine

For co-routine I used this piece of code:

IEnumerator IncreaseSpeedGradually1(AnimationControlSpeed lastGOHitScript)
{
    //stop if decrease speed in progress
    StopCoroutine("DecreaseSpeedGradually");
    float decrementValue = ((lastHitVehicleSpeed / 2) * 2);
    while (lastGOHitScript.Speed <= lastHitVehicleSpeed)
    {
        lastGOHitScript.Speed += decrementValue * Time.deltaTime;
        yield return 0;
    }
    //setting speed to the last speed
    lastGOHitScript.Speed = lastGOHitScript.iniSpeeed;
}

and for the update-based approach I just added this criteria to the method:

if (carAnimState == carAnimationState.starting)
{
    carAnimState = carAnimationState.running;
}

if (carAnimState == carAnimationState.stoping)
{

    carAnimState = carAnimationState.running;
}

These are the two ways I thought about using. I wanted to ask which is right way to do this job? To slow down animation speed and hence get my objective? I guess co-routines can be problematic later in my game.
Are there performance concerns for using one of the approaches?

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:
Match-3 should pieces store their location in the matrix? I'm making a match-3 game. I have a TileManager script which stores all the tiles in a matrix, it's a singleton and it handles tile swapping and basicly everything regarding the management of tiles.
I have a variable called selectedTile. I have a method called SwapSelected which swaps the currently selected tile with the one you just clicked on. As pieces don't know their location in the matrix I can only loop through the whole thing to find them but it feels extremly stupid I just feel like there's gotta be a better way. If pieces stored their location and I kept that updated all the time that'd feel stupid too.
What could I do to make this method work nicer and more optimalized? Is there a way or there is no problem with how I do it?
    public void SwapSelected(Tile tileToSwap)
    {
        Vector3 tempPos = selectedTile.transform.position;
        selectedTile.transform.position = tileToSwap.transform.position;
        tileToSwap.transform.position = tempPos;

        Vector2Int tileToSwapPosition = new Vector2Int(-1, -1);
        Vector2Int selectedTilePosition = new Vector2Int(-1, -1);

        //OPTIMALIZE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        for (int x = 0; x < _tileMap.GetLength(0); x++)
            for (int y = 0; y < _tileMap.GetLength(1); y++)
            {
                if (_tileMap[x, y] == tileToSwap)
                {
                    tileToSwapPosition = new Vector2Int(x, y);
                }
                if (_tileMap[x, y] == selectedTile)
                {
                    selectedTilePosition = new Vector2Int(x, y);
                }
            }

        _tileMap[selectedTilePosition.x, selectedTilePosition.y] = tileToSwap;
        _tileMap[tileToSwapPosition.x, tileToSwapPosition.y] = selectedTile;

        UpdateTileName(tileToSwap);
        UpdateTileName(selectedTile);
    }

sentences:
How can I detect collision between a circle and a rectangle? I'm trying to make a clone of brick breaker, one problem that I am running in to is to do with collision. I know how to detect if a collision has happened but I do not know how to check what side of the brick is hit.

Some general background from the program.
all the bricks are just 2 points (x,y) a top right point and a bottom left point. The ball is just 1 point with a radius. for my current collision detection I'm checking if the ball's coordinates are at or in between the two box coordinates.

sentences:
3D model rendered in halftone I am writing a 3D renderer that would render 3D models as if they had been drawn in halftone.
Feature-wise I need nothing fancy - no colors, just pure 3D geometry and basic lighting like here:
Image credit: https://blenderartists.org/forum/showthread.php?438820-Suzanne-Sketch

Notes:

I have written a basic 3D renderer in the past, however, I am really inexperienced when it comes to shaders (again, I do know basics) and I have absolutely no idea where to start with this.
The example image has been created in Blender, but I am writing my custom renderer.
This is not a duplicate of "How can I make a shader effect that looks like a lightly shaded pencil drawing?", as my input is a 3D model, whereas the OP in the linked question used an image.

sentences:
Box collider pushes me out of it's area slowly, I can pass through it if moving quickly I am new to Unity. I Setup a character in unity2D with a rigidbody. I had the scale off my sprites set to 100 pixels per unit. At this scale, my rigidbody character stood on top of platforms and could not pass through walls containing box colliders. I decided, that to make things easier, I would change all sprites to 1 pixel per unit. After doing so, I scaled everything (variables, sizes, etc.) by 100. I confirmed that the box colliders on both the caharcters, floor, and walls, are all in the same places, relatively. The box colliders on the floors still work, but the wall box colliders behave differently. When I walk into a wall, the wall slowly pushes me in a direction (depending on whether or not my character has walked through half the wall or not). The wall should be stopping my motion completely.

The code is very simple, but this is what I use to move:

if (Input.GetKey (KeyCode.D)) {
        transform.Translate (Vector2.right*moveOffset*Time.deltaTime);
        transform.localScale = new Vector3(1,1,1);
        anim.SetBool("moving",true);
    }

Do note that the moveOffset variable, was scaled by 100 after the change. Thanks in advanced!

sentences:
How do I sort isometric sprites into the correct order? In a normal top-down 2D game one could use the screen y axis to sort the images. In this example the trees are properly sorted but the isometric walls are not:

Wall 2 is one pixel below wall 1 therefore it is drawn after wall 1, and ends up on top.

If I sort by the isometric y axis the walls appear in the correct order but the trees do not:

How do I do this correctly?

sentences:
Mini Game Platform for PC - similar to Warcraft III Custom Games I think it would be fun to make a game for pc that has an online community like Warcraft III (the RTS, not the MMORPG), aka there's lobbies and chat rooms and users can host games to play with eachother. And there's no seriousness, just fun mini games that last on average 30-60 minutes, more or less depending on the game.

I searched google but it's really hard to find anything. Is there anything similar to this idea that's already out there? Or is this a first?

Also, in making this, any recommendations, flaming, or random comments? (yes I know it is hard to make an online game and such, especially since I have no experience with networking. I do have 2-3 years of programming experience, however).

Some more info on what I want to create.

I want it to be easy for users to create games and play with friends. All of us game creators have ideas, and we probably draw them out on paper (graph paper for me). Wouldn't it be amazing if it was a matter of a couple hours to transfer that idea to a fully working game, even if it is in 3d?

sentences:
Where to store polygons and polygon animation? I thought about making something with ApeOut graphics long before it came out and its release motivated me to try - I'm having tons of fun but I stumbled upon a pickle.
I can imagine storing polygons is a very common task in game development. I'm prototyping with pygame and currently store each polygon as a list of Vector2 coordinates/vertices on a 10x10 field and keep these lists in a Python dict. This can't be a good practice.

Is there an established format to store list of vertices (preferably supported by some free editor)? I was thinking about SVG but it works with curves and I only need straight edges. Or is SVG still the better option?
What's a sensible way to store frames of an animation for such polygon (e.g. "deer" lowering its head when eating or moving its shoulders while walking, etc.; legs will be driven by invert kinematics)? Right now I'm thinking about each animation being a list of frames where each frame is list of vertices but it'll become unmanageable if I don't separate animations to different files.

What I have so far:
shapes = {
    # I edit this in my head, was fun, slowly becomes a nightmare
    'deer': [(5,0), (4,1), (2,0), (3,1), (2,1), (1,0), (1,1), (4,2), (3,3), (4,5), (3,7), (3,8), (5,10), (7,8), (7,7), (6,5), (7,3), (6,2), (9,1), (9,0), (8,1), (7,1), (8,0), (6,1)],
}

def loadShape(name, size):
    resolution = 10 # 10x10
    verts = shapes.get(name)
    scaled = [tuple((point[0]/resolution*size, point[1]/resolution*size)) for point in verts]
    surface = pygame.Surface((size, size), pygame.SRCALPHA)
    pygame.draw.polygon(surface, colors.get(name), scaled)
    return surface

sentences:
Eliminate isolated cave in procedural cave generation I've got an algorithm that generates a cave procedurally, the map is modeled in the data as a 2d array of 0s (empty space) and 1s (wall). The algorithm works just fine, but I've got quite some isolated small caves on the scene, which I would like to avoid.

That's how the map looks that gets generated. Is there some efficient algorithm to remove the black holes in the white wall sections? I was thinking of something like:

For every closed cave, check if there is a bigger cave and if so, close it.

But that seems insanely inefficient since I'd have to loop over the map a lot in order to do this for all small caves.

sentences:
How to store generic data in game database? To clarify things a bit:
I want to create a kind of database for my game, that simply is a class that stores all game-state information like object positions, player scores, etc.

The main problem I am facing, that the whole game is to be scripted, to the level of the (lua)script controlling what members should the database have.

The reason for this is that I want to create a game that gives modders complete access to the game via lua scripting.(its one of the core features)
For this to be viable I need to be able to add custom elements to the
database.

I want to avoid using a 'real' database and roll my own solution.

For example I want to be able to do the following in the script file:

-- In function init...
Engine:AddStateEntry( "Score", TYPE_INT )

-- In function update...
Engine:SetStateEntry( "Score", 12 )

My engine would then synchronize data between players and render things accordingly.

How could I:

Efficiently store arbitrary types of data?(including arrays)
Set up custom interpolation functions

Efficiency and ease of use are my main priorities.(I dont care if the implementation is complex)

TL;DR: How to efficiently store arbitrary data that is defined by lua scripts and stored on the c++ side?

sentences:
Unity WebGL Responsive content I was trying to develop a simple drag and drop items for Web. What I was trying to do is to make the UI elements from web view to mobile view when the aspect ratio is changes.

I need this web view change to mobile view as below when the screen changes.

Changing Canvas settings does not seems to be work. Could someone please help with this issue?

sentences:
Referencing engine resources Let's assume for the sake of argument, that we have a resource engine in place, and that we use OpenGL. My question is how the engine/game classes should reference the resources.

Lightweight example : among others, we probably have a texture resource. If we now have a class that uses this resource, do we store:

a resource id?
a resource pointer?
the resultant resource (e.g. the GLID of the Texture)

1 gives us the most flexibility, and neat features like being able to reload all textures on the fly (after context destruction), but costs us a lookup each time it is used, and might require a mutex lock.

Another example - a font resource, same questions -- do we hold an id, pointer or a direct font class?

Third example, a model resource has a reference to a texture it uses. Does it store id, pointer or direct link?

If the answers differ between uses, is there a sensible set of rules one can follow to decide what should be used in what case?

EDIT: we're talking about a general use, heavy duty (3d, streaming, resource groups, memory managing) resource manager here in a threaded environment.

sentences:
How can I reduce render time on scenes with lots of UI component? I'm looking for a way to reduce rendering time for my Game Over scene. A quick look of the scene components is like this:

All yellow objects are UIButton, texts are all UIText, white areas are all UIImage (including the background). The friend list is a Facebook friends list contained inside a Scroll View. All object are inside a Canvas that resizes to the camera.

I noticed the problem firsthand when playing the game on Android. This game over scene is running at 15fps (while the main game play scenes are all running at nearly 60fps). The phone is a HTC One. On my cheap LG phone the game simply crashes at this scene.

Profiler shows Camera.Render() taking 70~90% of each game loop.

The iPhone5 & 6 on the hand is quite interesting, fps show no real difference between gameplay scenes and the gameover scene, both running smoothly at ~120fps. Still Camera.Render() was taking 40~50% of each loop in GameOver scene vs ~20% on GamePlay scenes.

Quite strange considering the fact that HTC One specs and iPhone 5's are quite similar.

I think the problem is because of the large number of UI Components on the GameOver Scene, since sprites on gameplay scenes are all batched (it's a 2d game). So I suppose I must find a way to reduce draw call on all those UI components. I thought this should be a common problem, but strange enough I've been searching for weeks without a sounding solution that actually work.

I've tried to check all UI objects static: doesn't show any notice-able change. On the other hand, Scroll View's contents are what's taking the bulk of the rendering (a long friend list), and I can't mark them as static because they do move.
Canvas pixel perfect off: already done that from the beginning.
Move the Scroll View to a separate Canvas: only improve performance when I'm actually scrolling scroll view, otherwise no change. And - could be I did something wrong - the scroll view doesn't work on Android anymore.

TL;DR; Question: Please guide me to reduce rendering time on scenes with lots of UI elements.

sentences:
Can the different computation power in a multi-player game affect each player's performance? In case an RTS game allows the clients to perform some calculations such as path-finding after the player clicks the map for a destination, and taking into account the game should be synchronised for all clients, there is clearly a chance that one of the machines is so slow that such computation (if it is done on a different process) might take much longer than in another client.

Therefore, the first player would experience a processing delay of his commands (and his units would be stopped for some time), giving the second player a clear advantage.

Now, how is this usually managed in the commercial RTSs?

Are all computations handled by the server and sent back to the clients?
In case processing in the client would be preferred, how would you implement a system to avoid such a player advantage?

Note: In SC2 I have seen how the server notifies the players that someone is slowing down the match. But I guess that is just the client has not enough speed to compute the visualisation.

sentences: 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:
Can UNet do Rigidbody2D prediction? (i.e. using gravity) Having a NetworkTransform with transformSyncMode set to SyncRigidbody2D (as opposite to a plain SyncTransform) I assumed it would try to sync all physics, hence handling gracefully forces, especially gravity.

What I got instead, is a very simple linear interpolation, which smooths out the gravity, so that jumping up and down looks incredibly unnatural: I would have expected this wish a SyncTransform of course, but, given the name I would have expected SyncRigidbody2D to solve this sort of problem…

So, am I missing something and might I have some value set wrong, or what?

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:
Player object's model starts to shake after some time I created a default scene in a new project and imported a model from Unity's asset store and then get this strange behavior of the model starting to shake for no reason after some time after starting the game.

I also have a script to read keyboard input and then apply forces to the model when the player presses some keys but the shaking of the model starts to happen even when the player does absolutely nothing.

I'm really confused and have no idea where to look for a problem and google doesn't seem to have a solution to this either.

sentences:
How to keep track of players nearby other players in an MMO I'm confused how to handle the players in my MMO server (using Socket.IO but I think this should apply to any MMO).

Suppose there are 2 players in my server that are far away from eachother. I will call them A and B in this example.

The server launches. No clients are connected.

A joins and is added to the server's active playerlist.

Every second A gets a list from the server with the active players nearby to update their positions. Since there are none online currently, the list is empty.

B joins, far away from A. The server adds B to the active playerlist.
Since A cannot see B yet, the list that A receives from the server is still empty.

B is moving towards A and comes within visual range.

What to do now for A? Send an event to A that B has come within range? How can the server know that A was informed of B being nearby? Does this mean I have to maintain a list on the server which player can see another?

Here's what I was doing before with my previous project: I never told the clients that a player was in range, instead the server just sent a list every second of players that are nearby and let the client do the rest. This way, the client keeps track which unit is added and which is not. Is this the best approach, or am I missing something?

sentences:
Reconciling external events with the game loop Is there any way I can program (in Java or Python, but open to other solutions) some game logic based on events, timed and sent by player input, without dealing with it inside the game loop, by having a game state that has a number of scripts listening for events, and those scripts can themselves fire events that change the game states and by consequence the scripts listening for events? An example bellow

class BombScript {

    private GameObject bombReference;

    void bombDefused() {
        // change the script listening for events
        bombReference.destroy();
    }

    void bombExplode() {
        // launch some events, change the script listening for events
        stopListeningForEvent("bombDefused");
        bombReference.destroy();
        sendEvent("bombExplode", bombReference);
    }

    void bombPlanted() {
        // if somehow the server receives a defuse command
        onEvent("bombDefused").execute(bombDefused);

        // else, if 6 seconds pass without an "bombDefused" event
        onTimeout(6).execute(bombExplode);
    }
}

I'm having trouble imagining a concrete implementation for that, specifically the timed based "if/else"

sentences: Slide to reveal in AndEngine I was designing the game in that i want to cover the scene with black layer and i want user to see it when he slide the image. Is there any functionality in AndEngine for something like slide to unlock.

sentences:
How to find the largest bounding boxes in 3D array to cover all cells? I'm trying to generate colliders automatically from a 3D array where each cell represents a constant-sized piece in a world (like a voxel). I'm trying to optimize the number of colliders, so I want to traverse the 3D array and create as few colliders as possible to cover all cells.

I know that for a single axis (1D array), I could do something like this:

// Let's say 0 = empty and 1 = wall
int[] array = {0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1};
boolean creating = false; // Was start index found?
int startIndex = 0; // Where the box started?
int endIndex = 0; // Where the box ended?

for (int i = 0; i < array.length; ++i) {
    if (!creating) {
        if (array[i] == 1) {
            creating = true;
            startIndex = i;
            endIndex = i;
        }
    }else{
        if (array[i] == 1) {
            // The line of blocks continues, increment the end index
            endIndex = i;
        }else{
            // Empty cell found, create a collider
            createBox(startIndex, endIndex);
            creating = false;
        }
    }
}

// Result would be four colliders sized 2, 1, 3 and 1

However, I can't figure out how to expand this to two and three dimensions. For instance, take this 2D array:

{{ 1, 1, 1, 0, 0, 0, 0 },
 { 1, 1, 1, 0, 1, 0, 0 },
 { 1, 1, 1, 0, 1, 0, 0 },
 { 0, 0, 0, 0, 1, 0, 0 },
 { 1, 1, 1, 1, 0, 0, 0 }}

This should result in three colliders: the first from (0, 0) to (2, 2), the second from (3, 1) to (3, 5) and the third from (0, 4) to (3, 4). However, simply looping the two dimensions wouldn't work.

Any ideas how to tackle this?

sentences:
How to render text on an 3d Object? I want to render text on an 3d object. I'm trying to simulate a digital signage LED panel.

My lcd Panel has a material and a texture.

How can I do ?

Using 3d Text ?

Thanks

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:
Inconsistent accessibility error in xna Hey all, you may remember me asking a question regarding a snake game I was creating about two weeks ago.

Well I'm quite far now into making the game (thanks to a brilliant tutorial I found). But I've come across the error described named above.

So heres my problem;

I have a SnakeFood class that has a method called "Reposition". In the game1 class I have a method called "UpdateInGame" which calls the reposition method to load an orange that spawns in a random place every second.

My latest piece of code changed the reposition method to allow the snake I have on the screen to not be overlapped by the orange that randomly spawns.

Now I get the error (in full):

Error   1   Inconsistent accessibility: parameter type 'TheMathsSnakeGame.Snake' is less accessible than method 'TheMathsSnakeGame.SnakeFood.Reposition(TheMathsSnakeGame.Snake)'   C:\Users\Tom\Documents\Visual Studio 2008\Projects\TheMathsSnakeGame\TheMathsSnakeGame\SnakeFood.cs 33  21  TheMathsSnakeGame

I understand what the errors trying to tell me but having changed the accessiblity of the methods, I still can't get it to work.

Sorry about the longwinded question.

Thanks in advance :)

Edit: Code I'm using

 (Game1 Class)
private void UpdateInGame(GameTime gameTime)
    {
        //Calls the oranges "reposition" method every second
        if (gameTime.TotalGameTime.Milliseconds % 1000 == 0)
            orange.Reposition(sidney);
        sidney.Update(gameTime);
    }

(SnakeFood Class)
 public void Reposition(Snake snake)
    {
        do
        {
            position = new Point(rand.Next(Grid.maxHeight),     rand.Next(Grid.maxWidth));
        } while (snake.IsBodyOnPoint(position));
    }

sentences:
Are SDL games trivially portable from Linux to Windows? I have a small game made with SDL2 and I want to port it to Windows. Would I hav eto write a lot of #ifdefs to port it or will the very same code work on Windows and Linux? Or is it more complicated?

Sorry if these are silly questions. I couldn't find existing resources on porting SDL games between desktop systems and I've never done this before!

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: 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: How does displacement mapping generalize bump mapping? This PDF discusses bump mapping, a special case of displacement mapping. A surface is represented as a function \$\overrightarrow{O}\left(u,\,v\right):\:\Bbb R^2\mapsto\Bbb R^3\$. In bump mapping, we shift this surface by \$\delta\overrightarrow{O}=B(u,\,v)\overrightarrow{N}\$, with \$\overrightarrow{N}=\overrightarrow{O}_u\times\overrightarrow{O}_v\$ the surface normal. What happens in more general displacement mapping? Do we, for example, replace \$B\$ with a matrix, or include multiples of \$\overrightarrow{O}_u,\,\overrightarrow{O}_v\$ in \$\delta\overrightarrow{O}\$? If there's too broad a variety of displacement maps to describe in one answer, I'll settle for one or more mathematically detailed references.

sentences:
Separation of axis theorem implementation I have been following the this guide to implement this. My current implementation is the following:

class SAT {

  SAT();

  bool collides(Rectangle rect1, Rectangle rect2){
    var axises = [
                  rect1.topRight-rect1.topLeft,
                  rect1.topRight-rect1.bottomRight,
                  rect2.topLeft-rect2.bottomLeft,
                  rect2.topLeft-rect2.topRight
                  ];

    for(var axis in axises){
      Projection p1 = project(axis,rect1);
      Projection p2 = project(axis,rect2);
      if(!overlap(p1,p2)){
        return false;
      }
    }
    return true;
  }

  Projection project(Position axis, Rectangle rect){
    Position projection = getProjectionPosition(axis,rect);
    Collection<Position> corners = [rect.topLeft,rect.topRight,rect.bottomRight,rect.bottomLeft];
    num min = dot(projection,corners[0]);
    num max = min;
    for(var i = 1; i < corners.length; i++){
      num p = dot(projection,corners[i]);
      if(p < min){
        min = p;
      }else if(p > max){
        max = p;
      }
    }
    return new Projection(min,max);
  }

  bool overlap(Projection p1, Projection p2){
    return p1.max >= p2.min && p1.min <= p2.max;
  }

  num dot(Position projection, Position point){
    return projection.x*point.x + projection.y*point.y;
  }

  Position getProjectionPosition(Position axis, Rectangle rect){
    num p = (rect.topRight.x*axis.x+rect.topRight.y*axis.y)/(Math.pow(axis.x, 2)+Math.pow(axis.y, 2));
    Position projected = new Position(p*axis.x,p*axis.y);
    return projected;
  }
}

However this doesn't seem to work. I think I might be a bit confused about the getProjectionPosition algorithm, as you can see I always use rect.topRight. But maybe I am supposed to loop trough all the corners of the rectangle? or should it just be the corner belonging to this axis? The guide wasn't very clear on this.

Any ideas on whats wrong? Or is there a reference implementation I could look at to see how my implementation differs?

sentences:
How to modularly call a script based on parameters within the script? I am coding an interaction system in Unity that does things based on whether the player taps interaction, or holds interaction. Each object holds their own scripts of how a player can interact with them and what happens (e.g., they can physically lift an object, add an object to their inventory, open/close a door, etc)

What I want is for the interactable_object to call component scripts that have been added to it and categorized as tapInteraction or holdInteraction, but I also want the component scripts to be separated from how they're called (e.g., they might be called via tap or hold, it shouldn't matter).

If I use interfaces, the tapInteraction could check for GetComponent<ITap>() and the holdInteraction could check for GetComponent<IHold>(), but then wouldn't each action need separate scripts defined as Lift : ITap and Lift : IHold? I feel like there would be a lot of repetition.

I'm wondering if there is some better way to go about this.

EDIT:

Thank you very much for the input DMGregory and Alex F!

I ended up going with an interface approach similar to what Alex F answered, but with two key differences:

It was very important to me to have the actions as components on the gameobject since a specific action (e.g. Lift or AddToInventory) would have a large amount of customization from object to object.
I also wanted the interaction to return a status as to whether it succeeded or not.

As such I created a base class Interaction that implements the interface IInteraction with a bool TryInteraction method, and registers/deregisters itself to an interactable_object via OnEnable and OnDisable as the tapAction or holdAction depending on if that Interaction is set as a tapAction or holdAction.

InteractionLift and InteractionInventoryPickUp inherit that base Interaction class, they implement the TryInteraction interface, and depending on their parameters will register themselves to a interactable_object script as either the hold or tap action. Then the interactable_object fires the hold or tap TryInteraction accordingly.

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:
What do I need to program games for the PS3? Possible Duplicate:
  What do I need to develop for the Playstation 3?

How can an amateur programmer have access to learn programming on PS3, and test the developments on own PS3? Not only use of CPU but also of GPU.

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:
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: How to calculate vector that is perpendicular to the direction of moving in Flash? In flash i have a class that extends movieclip and i am moving it forward, up and down, and rotating it. How can i calculate the vector that is perpendicular to this movieclip?

sentences:
Sprite with shadows in both sides I have a gameobject with a SpriteRenderer, and I want it to cast (and receive) shadows like a 3D model. The sprite will turn around depending of his direction, so all faces must cast shadows.

I already activated Cast Shadows and Receive Shadows in the Sprite Renderer component, and also included a Transparent Cutout shader with the Cull Off instruction (so all faces are drawn), but only one side of the sprite is being affected by light, while the other is even darker. To ilustrate:

How can I achieve an sprite casting shadows with both faces?

sentences:
Assigning IDs to entities and obects for use in scripts and by other objects I'm currently planning a small, simple scripting system for my game engine that will allow me to easily define scenes (similar to the "cutscenes" found in 2D RPGs). It consists mainly of simple commands such as "Change scene", "Move to" and so on.

Some of these scripting commands require operands. For example, the "Move to" command should expect an entity ID and a target node ID (where the node is just another placeable object). The aim is that whenever you create an entity, map or other object in the editor, it is assigned an ID that other objects and scripts can use to refer to it easily. These IDs will be stored when the game loads its data and used during runtime to make sure I'm targeting the correct object when an interaction occurs.

The problem I'm having is in how best to assign IDs to these objects of interest. I thought about just automatically assigning an incremented integer ID to new objects, but was unsure of how I should deal with the possibility of stale references. As I work in the editor, I may add and then later remove an item that was assigned an ID when it was created. If I delete an item that previously had an ID, should that ID be released for use by something new, or should I just leave a gap? Also, how should I keep track of assigned IDs between uses of the editor so that I can easily avoid collisions and also check easily for stale references?

For example, if I was to (either accidentally or intentionally) delete door A that is linked to door B, what would be the simplest way to check for any stale references, so that door B can be known to refer to something that no longer exists? Is it literally just a case of iterating through every object and seeing if any IDs it refers to are there or not?

I have the same problem when trying to decide how best to refer to the game's central list of items, spells, etc. These are the things that can be considered a core part of the game, but may be modified or removed over time. How can the game deal with a situation like the deleting of an item that has already been put in numerous places (i.e containers) in the game world?

Thanks in advance for any enlightenment you can offer with the above.

sentences:
Blurry background sprite, other sprites fine Why is the background blurry, but all the other sprites fine?

The background sprite has the same settings as the others. It's on the same Z position (0). It happened after I made some changes to the original image, just deleting some colours on it, not changing it's dimensions. It's coming from a sprite sheet of 11 images. All the images are blurred in the same way

Details

The camera is set orthographic.
The camera size is set to 95.
The camera is at [0,0,-10].
The background sprite is at [0,0,0].
The sprites are all at Z=0;
The sprite is W: 256, H: 174.
Anti-aliasing is disabled in the project.

sentences:
Unity - Instantiate GameObject from client on Network I am building a game where a weapon shoots prefab bullets. I am trying to make this a multiplayer game, so the bullets need to be spawned into the Network.

What happens right now is that if I shoot a bullet from a host, the bullet is shot, but doesn't appear on the client screen. If I shoot the bullet from the client, the bullet doesn't appear on either screen. In fact, the function CmdShoot() isn't even called, as the Debug.Log("Hello") is not called. Here is the current code:

public class Gun : MonoBehaviour
{

    private GameObject bulletPrefab;

    void Update()
    {
        if (Input.GetMouseButtonDown(0)) {
            owner.GetComponent<PlayerSetup>().CmdShoot(bulletPrefab, transform.position, owner.name, GetComponentInParent<Weapon>().angle);
        }
    }
}

public class PlayerSetup : NetworkBehaviour
{

    void Start ()
    {
        // Disable components if not local player
    }

    [Command]
    public void CmdShoot(GameObject bulletPrefab, Vector3 position, string playerName, float angle)
    {
        Debug.Log("Hello");
        GameObject bullet = Instantiate(bulletPrefab, position, Quaternion.identity);
        bullet.name = "bullet: " + playerName;
        bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right * bulletPrefab.GetComponent<Bullet>().force);
        Destroy(bullet, 10f);
        NetworkServer.Spawn(bullet);
    }
}

Edit:

This piece of code doesn't work either, gives the same result. No error, but the function is also not called. The Input is detected though:

    void Update() {
        if (Input.GetMouseButtonDown(0)) {
            CmdShoot();
        }
    }

    [Command]
    void CmdShoot()
    {
        Debug.Log("Shoot");
        GameObject bullet = Instantiate(gunComponent.bulletPrefab, gun.position, Quaternion.identity);
        bullet.name = "bullet: " + transform.name;
        bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(GetComponentInChildren<Weapon>().angle, Vector3.forward) * Vector3.right * gunComponent.bulletPrefab.GetComponent<Bullet>().force);
        Destroy(bullet, 10f);
        NetworkServer.Spawn(bullet);
    }

```

sentences:
Exporting 3DS Max animated biped character into Assimp I've been having some trouble with MD5 meshes exported from 3DS Max into my C++ program, using Assimp to import the model and its skeletal animation.  If the models were rigged manually with bones, the export and animations work perfectly, but if they were rigged as a biped character, the animation hits a "deadly import error" and all the bones appear to get smooshed together into a big pile.  This seems like it might just be a limitation of the MD5 exporter (we're currently using the one found here.

Our plan is to try out a different MD5 exporter (this one), and if that still has problems, then try switching from MD5 to COLLADA.

Our modeler won't be able to make time to try out these other exporters for a few days, so in the meantime I wanted to see if there were any better methods out there for getting biped rigged models from 3DS Max into our app via Assimp.  Out of Assimp's supported formats, I need to figure out which will support the following:

Skeletal animations
Exportable from 3DS Max biped rigged models

Failing that, an alternative would be a way to convert a biped character to its corresponding bones before exporting.  We did find one script to do that, but it only seems meant as a starting point for modeling -- it doesn't carry over any hierarchy, skinning, or animation -- so it can't be used solely during export.

sentences:
Advertising before seeking a publisher I'm nearing competition of my first title and I'd like to seek out publishers but I'm also eager to show it off on social media.

Should I hold off until I've spoken to publishers or is it mostly harmless?

sentences:
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:
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:
Issue with fps limiting in XNA The game I am making runs at 60 fps, but occasionally it will drop lower than that. I want to limit the frame-rate to 30 fps so that those drops will be less noticeable.

I don't understand everything about this, so bear with me.
Here is what I have in the Initialize method:

IsFixedTimeStep = true;
TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0f);

All this is doing is making the game run in slow-motion.
What am I doing wrong?

Edit: I would like Update to be called the same number of times per second, but for Draw to be called only 30 times per second, instead of 60. How could this be accomplished?

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:
Is my Lua form/scene loading setup efficient? At the moment, I'm working on a small game project using LUA and the love2d framework. Using this framework, I've made my own assets (i.e. button images, form images, etc), and using these assets I've been able to make a functional application, but not yet a game. In my project, I plan on having several scenes, and I'm not quite sure whether my method for scene management/switching is efficient/safe to use (safe, as in minimal bugs). So the process I'm using is as follows:

if scene_selector.active_scene == "splash" then
    if sceneSplash.loaded == false then
        sceneSplash.link.load()
        sceneSplash.link.update(dt)
        sceneSplash.link.draw()
        sceneSplash.loaded = true
    else
        sceneSplash.link.update(dt)
    end
elseif scene_selector.active_scene == "menu" then
    if sceneMainmenu.loaded == false then
        sceneMainmenu.link.load()
        sceneMainmenu.link.update(dt)
        sceneMainmenu.link.draw()
        sceneMainmenu.loaded = true
    else
        sceneMainmenu.link.update(dt)
    end
end

where scene_selector is a link to the follow file:

    -- Misc Vars
    active_scene = "splash"
    version = nil

    -- Resources
    cre = nil
    xp = nil

    -- End Vars

    -- Global Script Indicator
    calls = {}
    calls.active_scene = active_scene
    calls.version = version
    return calls

and sceneSplash/sceneMainMenu are links to lua files which act as the scenes. Each file manages its own updates, which are passed through by the main.lua - found by the love.update and love.draw functions which are passed through to the forms relevant load/update/draw functions. I'm aiming at using about 10 forms, 3 variable files and 2 misc function files (file management/encryption/IO operations/logging/etc).

So the TL;DR version is - is it efficient/safe (safe in terms of minimal bugs) to pass through draw and update functions from main.lua to other lua script files?

So far, the process works without any bugs, even when I go back to a previously accessed 'scene', so I assume the process will work 'safely' when I'm using more scenes.

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:
Can I combine 2 UnrealEngine forks? I am using Daz Gen 8 characters and clothes in my project.
After I read this I decided to use a fork of UE4 which uses Dual Quaternion Skinning.
Basically if you use Daz characters under UE4, they going to distort better if you use DQS, which UE4 doesn't support by default.
You can get the DQS modded engine from here.
I compiled it and I managed to get all my stuff from my original project to a DQS one.
No problem.
But I also need a soft body and a clothing solution in the project.
4.25 has a clothing solution and it does work fine, but there is no soft body, that I know about...
So there are a few options:

Vico Dynamics from the Marketplace
using a Flex branch of UE4
if you know any more please please let me know

Tested Vico, and it works fine for simple meshes, up to 20k poligons. Over that the editor becomes unresponsive... But this works with my modded DQS engine.
The latest version of an UE4 branch with Flex is 4.22. I could get this compiled and running.
I would like to know if I can merge the 2 repositiories (4.22 DQS and Flex) into one, and source build it...
What software or workflow do you recommend to do merge these big branches of UE4?
I guess there will be quite a few conflicts, because Flex distorts the mesh in it's own way, so does the DQS version of Unreal...

sentences:
Build Placement and Connectors I'm having trouble with the logic for this problem. I've got a grid of modules. Each module may take 1 or more cells on the grid, and each cell of a module may have 1 or more connectors. The connectors are represented by an enum (or int). Adjacent modules may only be placed if they have matching connectors.

So, for example:

-Module A in position (0, 1) has a down (3) connector.
-Module B in position (0, 2) has an up (1) connector.

This is a valid configuration.

-Module A in position (0, 1) has a down (3) connector.
-Module B in position (0, 2) has an right (2) connector.

This configuration is invalid.

I've attached an image below for clarity:

sentences:
How do I use data-orientated programming without object-orientated programming? I have been reading many resources about data oriented programming, and one thing I understand about it is that it's about keeping chunks of memory together to improve performance. Other than that, I find it hard to understand.
 can someone tell me if this counts as DOP or if I am doing it all wrong?

I can't tell if my pseudocode counts as data-orientated programming:

// attempted non-OOP format since I am bored of standard OOP and trying C instead of C++,
// where object_ids is array of objects holding their type id's

update() {
    for (int i=0;i<nObjects-1;i++) { // where i is the object id
        // get the update function for the type of object
        object_update_functions[object_ids[i]](i);
    }
}

// example
void * object_update_functions[0](int id) {
    // // object #0's update function
    object_x[id] += 2;
}

I'm still unsure of how to use data-orientated programming, without object-orientated programming. Unfortunately, all of the examples I've seen of data-orientated programming still use class-based object-orientated programming.

As far as I know, back in the day of the NES, they didn't have object-orientated programming like they did, today. They had to store object variables in different arrays, consequently leading to better-performing, data-orientated code.

I want to avoid making the mistake of writing pseudo data-orientated programming, and not really getting the benefits of caching and modularity. How do I use data-orientated programming without object-orientated programming?

sentences:
How to flick gameObject using Touch? I've been searching for a solution for my problem for a while on the web, but i didn't find anything that work properly

What i want to do

I have a bouncing ball and I want to let the user flick it with his finger (using a swipe gesture or whatever).
The ball shouldn't start moving unless the player flick touch the ball. I don't want the ball to move if the player flicks anywhere on the screen, only if the flick touch the ball

What i've done so far :

I've tried to write a script which would detect the touch starting position and the touch end position, and check if the end position is the same as the ball position to make sure that the flick touch the ball. Then the script calculate the direction vector by substrating the start position from the end position.
After that i use the AddForce methode and give it the direction vector as a parameter.

Here's my code, (it's better than 1000 words ) :

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour
{
    public Vector2 start;
    public Vector2 end;
    public Vector2 direction;
    public Vector2 ballPos;
    public float Flicktime;
    void Start(){
        }
    void Update(){
        ballPos = new Vector2(transform.position.x,transform.position.y);
        if (Input.touchCount > 0)
        {
            Touch t = Input.touches[0];
            if (t.phase == TouchPhase.Began)
            {
                start = Camera.main.ScreenToWorldPoint(new Vector3(t.position.x,t.position.y,0));
            }

            if (t.phase == TouchPhase.Ended || t.phase == TouchPhase.Canceled)
            {
                end = Camera.main.ScreenToWorldPoint(new Vector3(t.position.x,t.position.y,0));
                direction = end-start ;
                if(t.position == ballPos){

                    rigidbody2D.velocity = direction * 2 ;
                }
            }
        }
    }

}

What's the problem ?

The problem is that the code doesn't work.

When i launch the game in the Unity Remote 4 app in my android device and try to flick the ball it doesn't move, the inspector shows that the the scripte is calculating the start & end positions and the direction vector, but the ball doesn't move, it stays in the same position even when the flick touch the ball.

So what's the problem ? is there a better way to do it ?

Since the ball have a circle collider how to make it detect collision with the player swipe ?

Thank's and have a nice weekend !

sentences:
C4d or 3DS-like matrix rotations I have a rotation 4x4 matrix to generate a model matrix, but I would like to be able to control it like cinema4D or 3ds Max with three separate angles that are always perpendicular to each other, and so far I've had no luck...

Currently, every time I change one of the angles, I call a function containing the following code:

self->rot_matrix = mat4();
self->rot_matrix = mat4_rotate(self->rot_matrix, 1, 0, 0,
    rot.x);
self->rot_matrix = mat4_rotate(self->rot_matrix, 0, 0, 1,
    rot.z);
self->rot_matrix = mat4_rotate(self->rot_matrix, 0, 1, 0,
    rot.y);

This doesn't work though, because when I rotate around z or x, the y axis should change, but not the y angle... I'm terrible at this sort of mathematics, and would appreciate a simple explanation of what to do.

One idea I've had would be to have two vectors define the rotation system, and then use rodrigues rotation to update them, this I can do with ease, but I have no idea how to transform those two vectors back to a rotation matrix.

Thanks in advance!

sentences:
Interpolation of render with fixed physics update In Fix Your Timestep, they briefly address the remainder time in relation to rendering.  Saying that remainder can be used to generate an interpolated rendering.

  We can use this remainder value to get a blending factor between the
  previous and current physics state simply by dividing by dt. This
  gives an alpha value in the range [0,1] which is used to perform a
  linear interpolation between the two physics states to get the current
  state to render.

http://web.archive.org/web/20190506030345/https://gafferongames.com/post/fix_your_timestep/

So let's say your last two physics updates we'll call A and B are from 00:10.033 and 00:10.066, and it is now 00:10.070 when we want to perform a render.  We have a remainder of .004.

I take "interpolation between the two physics states" to mean we compare all the objects in update A and B and slide them back from B towards A by 88% (.033-.004)/.033).  This would mean I'm actually rendering the physical state at 00:10.037, correct?  So my physics updates A and B are really more like previous and next and my interpolation is between the previous and the next, correct?

sentences:
Translate object in world space usings it's local rotation I'm using Three.JS to render some objects. I'm struggling with some very simple object rendering and translation.

The scenario is that I spawn an object at 0,0,0 in world space with 0,0,0 rotation.

var scene, camera, cube;

...

function change() {
  var degrees = 90
  var zTranslation = 5;

  cube.rotation.y = degrees * Math.PI / 180;
  cube.rotation.z = zTranslation;

  var newCubeMatrix = cube.matrix;
  newCubeMatrix.identity();
  newCubeMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(cube.rotation.y));
  newCubeMatrix.multiplySelf(THREE.Matrix4.translationMatrix(cube.position.x, cube.position.y, cube.position.z));

  cube.updateMatrix();
}

function loop() {
  renderer.render( scene, camera );
}

...

What now happens is that the cube is rotation 90 degrees and translated 5 points on the Z axis in world space, not 5 points on the Z axis in the cube's local space.

How do I make the cube translate 5 points in it's local space?

sentences:
Unity - Collision detection issue with CharacterController I am making an isometric game (3d scene, using 2d sprites). Currently I am trying to add collision to the enviroment to prevent the player from walking through everything. However no matter what I do the player seems to simply ignore the and walks through the object. Below are some combination I have tried and the results I got. For this instance I am looking at the windmill object

NOTE: Player has a character controller , no rigidbody.

Scenario 1:

Windmill has Rigibody
IsKinematic false
No rotation & Position constraints
Boxcollider isTrigger == false

result: On touching object it start flying around. So collision is there.

Scenario 2:

Windmill has Rigibody
IsKinematic false
has rotation & Position constraints (all axis)
Boxcollider isTrigger == false

result: I can walk through the object and somehow the collision is gone. the reason for constraints is so that the object wont move. (its a windmill)

Scenario 3:

Windmill has Rigibody

IsKinematic false
both with and without rotation & Position constraints (all axis)
Boxcollider isTrigger == true

result: Debug.Log shows that there is collision

Now what I would like to achieve is that the windmill can't be moved yet also can't be moved through.I am willing to programm collision if needed, but i rather do it with the unity provided tools. Any idea what I am overlooking?

EDIT 1:

Since it was asked how I moved the player, I use the Fingers asset. We make use of the joystick to move the player around. Below is our JoystickExecuted method depicting what exactly I do.

 private void JoystickExecuted(FingersJoystickScript script, Vector2 amount)
{
    if (amount.x > 0 && !_facingRight)
    {
        FlipXAxis();
    }
    else if (amount.x < 0 && _facingRight)
    {
        if (amount.x > 0 && !_facingRight)
        {
            FlipXAxis();
        }
        else if (amount.x < 0 && _facingRight)
        {
            FlipXAxis();
        }
    }
    var pos = transform.position;
    pos.x += amount.x * 8 * Time.deltaTime;
    pos.z += amount.y * 8 * Time.deltaTime;
    transform.position = pos;
    _anim.SetBool("isWalking", true);

    if (amount == Vector2.zero)
    {
        _anim.SetBool("isWalking", false);
    }
}

sentences:
Convert coroutine into void I want to get rid of a co-routine and do this with a void.

How could I convert his IEnumerator into a void?

private IEnumerator pChangeFoV()
{
    float zValue =70f;

    for (float t = 0f; t < FoVDuration; t += Time.deltaTime)
    {
        float fNew = Mathf.Lerp(_camera.fieldOfView, zValue, t / FoVDuration);
        _camera.fieldOfView = fNew;
        yield return 0;
    }
    _camera.fieldOfView = zValue;
}

Thank you for the help!

sentences:
Are there any reasons to use Legacy (2.X) OpenGL? The benefits are well documented of the Modern OpenGL 3.X & 4.X API's, but I'm wondering if there are ANY benefits to keeping with the old OpenGL, Or if learning OpenGL 2.X is a complete waste of time now no matter what?

Particularly I've wondered if using the OpenGL 2.X API is appropriate if the target platform had graphics hardware capable of only up to OpenGL 2.X. Would a driver update on said target platform allow programs compiled using the Modern OpenGL API's to be released on this old platform? If they both work, which would be faster?

Thanks

sentences:
How do I resolve the error "Trying to send command for object without authority."? I don't know what I did wrong I tried couple different ways from not using commands to using SpawnWithClientAuthority. But It either gives build and compile errors or just the Error in the title

Here the Start function of my player object

 void Start () {
    player = isLocalPlayer;
    race = Data.races[(int)selectRace].getInstance();
    clss = Data.classes[(int)selectClass].getInstance();
    health = race.Health * clss.HealthMultiplyer;
    speed = race.Speed * clss.SpeedMultiplyer;
    armor = race.Armor * clss.ArmorhMultiplayer;
    energy = race.Energy * clss.EnergyMultiplayer;
    skills.AddRange(race.RaceSkills);
    skills.AddRange(clss.ClassSkills);

        Data.entities.Add(this);

    Debug.Log(isLocalPlayer);

    if (!isLocalPlayer)
        return;
    int enID = Data.entities.IndexOf(this);
    foreach (Skill s in skills)
        s.CmdSpawn(enID);

}

And here is the spawn functions from skills I try to spawn

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    Debug.Log("Spawned");
    dir = getEntity().lookingAt;
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;
    transform.up = dir;
    NetworkServer.Spawn(gameObject);
}

and

[Command]
public override void CmdSpawn(int enID)
{
    setEntity(Data.entities[enID]);
    dir = getEntity().lookingAt;
    transform.up = dir;
    dir = new Vector3(dir.z, dir.y, -dir.x);
    gameObject.transform.position = getEntity().transform.position + dir * 0.65f;

    NetworkServer.Spawn(gameObject);

}

If you can help, thank you ^.^

sentences:
Efficient UI for RTS units I was wondering how I should approach the runtime changes on the game UI when selecting different types of units in a RTS.

For example, in Starcraft, each unit type has its own portrait, attributes, buffs and command cards displayed in the UI. Selecting another unit will update all of these.

I can see two possible solutions:

Each unit type has its own UI panel created (in memory), and selecting another unit disables the current UI panel and enables the new one.
There is only one UI panel, and selecting a unit fills the portrait, attributes, command cards, etc. dynamically.

Both solutions seem inefficient. The first may consume too much memory, and the second makes no caching at all. Maybe the way to go would be something in-between, or completely different.

I'm working with Unity, but I think the discussion should stay pretty high level.

sentences:
Using a DirectX Vertex Shader to Modify the Vertex Data in VRAM? I'm working on a GPU-side particle system in DirectX 11 where the vertex shader  uses a vector field encoded into the color channels of a texture to modify the positions of the vertices before drawing them to the screen.

I'm trying to keep the computations on the GPU rather than calculating the updated particle positions on the CPU and send the new vertex data to the GPU every frame, so I've been investigating the possibility of having the vertex shader overwrite the vertex buffer in VRAM with the updated vertex positions each frame. So far, I haven't managed to find anything on the topic.

Would this be possible, and if so, how would I accomplish it?

sentences:
Car driving through walls with transform.Translate() I need help with a script for a very simple car that uses transform.Translate:

public class car1 : MonoBehaviour {

    public PauseMenu pause;
    [Space]
    public Car_Script car_s;
    public float speed;
    public GameObject car;

    void FixedUpdate()
    {

        if (car_s.InCar == true)
        {
            if(pause.isPaused == false)
            {
                if (Input.GetKey(KeyCode.W))
                {
                    car.transform.Translate(Vector3.forward * Time.deltaTime * speed);

                    if (Input.GetKey(KeyCode.A))
                    {
                        if (speed <= 0)
                        {
                        }
                        else
                        {
                            if (speed > 0F && speed <= 50F)
                            {
                                car.transform.Rotate(Vector3.down, 2F);
                            }
                            else if (speed > 50F && speed < 90F)
                            {
                                car.transform.Rotate(Vector3.down, 1.3F);
                            }
                            else if (speed > 90F)
                            {
                                car.transform.Rotate(Vector3.down, 0.9F);
                            }

                        }
                    }
                    if (Input.GetKey(KeyCode.D))
                    {
                        if (speed <= 0)
                        {
                        }
                        else
                        {
                            if (speed > 0F && speed <= 50F)
                            {
                                car.transform.Rotate(Vector3.up, 2F);
                            }
                            else if (speed > 50F && speed < 90F)
                            {
                                car.transform.Rotate(Vector3.up, 1.3F);
                            }
                            else if (speed > 90F)
                            {
                                car.transform.Rotate(Vector3.up, 0.9F);
                            }

                        }
                    }
                }
            }
        }
    }
}

Whenever I drive the car it immediately goes through walls.

I have colliders on everything. The car has mesh colliders set to convex.

I've searched around quite a bit for answers and it seems that a common one is using rigid bodies. But whenever I even put a rigid body on the car, it flies out into the sky.

sentences:
How can I move my player on exact x and y coordinates, like on a grid? I'd like to implement movement exactly like it is done in this game. (You can see it in action on YouTube.)

I need my Player to always stay in the center of X and Y similar to grid movement, but with free movement/line like. Only move on x and y lines. And I need smooth changes at intersections.

 var x = Input.getAxis("Horizontal");
 var y = -Input.getAxis("Vertical");
 var deltaPos = Vector2.zero;

 if (Mathf.Abs(inputY) > Mathf.Abs(inputX)) {
     deltaPos.Y = speed * inputY * Time.deltaTime;
 }
 else {
     deltaPos.X = speed * inputX * Time.deltaTime;
 }

 transform.position += deltaPos;

sentences:
Is there an equivalent of Unity's OnCollisionEnter() in UE4? I've been looking for how to figure out when two objects are colliding all day.

If anyone knows how to do it I would be grateful. What I really want is a similar function to Unity's OnCollisionEnter() and a way to get a pointer to the object that I'm colliding with.

sentences:
Collision detection between two arrays with nested loops: why do I get a crash? I'm creating a game where waves of enemies are coming to me and I have to kill them.

So far, I'm doing great: it took me hours to come up with this nested loop to check for collision detection and when I ran it the game was running great... but for a few kills only. Sometimes I manage to play it even for a few minutes until it crashes, sometimes I shoot twice and it crashes, and I always get this error:

"Uncaught TypeError: Cannot read property 'x' of undefined
    at collision (collision.js:6)"

I just cannot figure out whats going on. If someone can help me I will be so grateful, I saw similar topic but I couldn't find the answer there.

function collision(){
    for(var l = bullets.length - 1; l >= 0; l--){
        for( var k = enemies.length - 1; k >= 0; k--){
            var e = enemies[k];
            var b = bullets[l];
            if(b.x > e.x && b.x < e.x + e.imgWidth/4 && b.y > e.y && b.y < e.y +
            e.imgHeight/4 ){
                e.enemiesHealth -= 50;
                b.deletion(); // basically assigns true to b.toDelete
                e.deletion(); // basically assigns true to e.toDelete
            }
            else if (b.toDelete){
                bullets.splice(l, 1);
            }
            else if(e.toDelete && e.enemiesHealth == 0){
                enemies.splice(k, 1);
                kills += 1;
            }
        }
    }
}

sentences:
How can I set up a 2D circular boundary in Unity? I wanted to create a virtual analogue stick on Unity.

I figured a very simple, 2 part method setting up a tether to the middle of a doughnut-container and a boundary would work. While the tether was quickly solved just by using Vector2.MoveTowards, the boundaries would be much harder to solve.
I initially tried to create a 2D circle collider around the doughnut-container but I didn't know how to reverse its collisions to keep the cursor inside. Later, I tried to set up a square shaped boundary by setting up the limits of the x and y coordinates the cursor cannot exceed (these limits were also made according to the doughnut-container). Thus was done with multiple if statements:
 if (currentPoint.y >= 2.7f){currentPoint.y = 2.7f;}
 if (currentPoint.x >= 2.5f){currentPoint.x = 2.5f;}
 if (currentPoint.y <= -2.7f){currentPoint.y = -2.7f;}
 if (currentPoint.x <= -2.5f){currentPoint.x = -2.5f;}

However, when testing the code out, the cursor still exceeded the boundaries given:

Minimum reproducible code for the cursor:
public class menuScript : MonoBehaviour
{
    public float speed;
    public Vector2 originPoint;
    private Vector2 currentPoint;
    // Start is called before the first frame update
    void Start()
    {
        Vector2 originPoint = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        currentPoint = transform.position;
        float step = 50 * Time.deltaTime;
        float vertical = Input.GetAxis("Vertical") * Time.deltaTime * speed;
        float horizontal = Input.GetAxis("Horizontal") * Time.deltaTime * speed;

        if (horizontal != 0 || vertical != 0)
        {
            transform.Translate(horizontal, vertical, 0);
            if (currentPoint.y >= 2.7f){currentPoint.y = 2.7f;}
            if (currentPoint.x >= 2.5f){currentPoint.x = 2.5f;}
            if (currentPoint.y <= -2.7f){currentPoint.y = -2.7f;}
            if (currentPoint.x <= -2.5f){currentPoint.x = -2.5f;}
        }
        else
        {
            transform.position = Vector2.MoveTowards(transform.position, originPoint, step);
        }
    }
}

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: Where can I find free motion capture footage? Are there any repositories of free motion capture footage? Or maybe just libraries of animations.

sentences: interfacing WiiMote with Unity 5 I am looking for a guide on connecting WiiMote with Unity 5 as an Input device. I found this library here but I do not understand how to install it and what the prerequisites are for it to work.

sentences:
Directx displaying selectable text I am new to direct x and following this tutorial : brayzarsoft (part 14) I was able to display text. However, using this method the text is rendered to a texture.

When you look at games that have chat/consoles, you can select/copy/paste the text. How do they achieve this effect? Is it by using the winapi or do they code the whole system to be able to do this with texture?

sentences:
Unity : How to detect if a UI button is pressed down? I want a UI up arrow button to be able to detect if it is pressing down. It is a child of a canvas in a 3D scene. My target platform is webGL for both desktops and mobiles.
I coded not only the control of the up arrow UI button but also the control of keyboard arrow button for desktops.

The keyboard control worked fine in PC but the UI arrow button didn't work as expected both in desktop and mobile.

I tried the OnPointerDown() function attaching to the UI up arrow button and the logged it. The log didn't even show up when the UI button is pressed down both in desktop and mobile.

It seems the OnPointerDown() needs the image of the button to receive raycast so its image component Raycast target option is on.

Isn't the onPointerDown() supposed to be used in detecting press down of UI component by both mouse in desktop and touch in mobile?

How to get the UI button to be notified when it is pressed down?
Any approach other than onPointerDown() which can do the same thing?

My scripts are here:

the one attached to the car object to be controlled

using UnityEngine;

public class CarPlayerControl : MonoBehaviour {

public float speed = 40;
private bool touchCtrl = false;
private float xInput = 0f;
private float zInput = 0f;

void Awake(){
    //if (Input.touchSupported && Application.platform
         //     != RuntimePlatform.WebGLPlayer){
        //touchCtrl = true;
        //}
        }

void FixedUpdate(){

    xInput = 0f;
    zInput = 0f;

    if (touchCtrl)
    {

    }
    else //keyboard control in desktop
    {
        xInput = Input.GetAxis("Horizontal");
        zInput = Input.GetAxis("Vertical");
    }

    Move(xInput, zInput);
}

public void Move(float xInput, float zInput)
{
    float xMove = xInput * speed * Time.deltaTime;
    float zMove = zInput * speed * Time.deltaTime;

    float x = KeepXWithinRange(xMove);
    float y = transform.position.y;
    float z = KeepZWithinRange(zMove);

    transform.position = new Vector3(x, y, z);
}

private float KeepXWithinRange(float xMove){
    float x = transform.position.x + xMove;
    return Mathf.Clamp(x, 0, 900);
}

private float KeepZWithinRange(float zMove)
{
    float z = transform.position.z + zMove;
    return Mathf.Clamp(z, -470, 500);
}
}

and the one attached to the UI Up arrow button

using UnityEngine;

public class ButtonUpControl : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public GameObject car;
private CarPlayerControl carPlayerControl;
private bool mouseDown;
private float xInput;

void Awake()
{
    carPlayerControl = car.GetComponent<CarPlayerControl>();
    mouseDown = false;
}
void Start()
{

}

void FixedUpdate()
{
    if (mouseDown) {
        xInput = 1.0f;
    }
    else {
        xInput = 0f;
    }

    carPlayerControl.Move(xInput, 0f);
}

public void OnPointerDown(PointerEventData eventData)
{
    mouseDown = true;
    Debug.Log("on ptr down btn up ");
}

public void OnPointerUp(PointerEventData eventData)
{
    mouseDown = false;
    Debug.Log("on ptr up btn up ");
}
}

sentences:
fast 3d point -> cuboid volume intersection test Im trying to test whether a point lies within a 3d volume defined by 8 points. I know I can use the plane equation to check that the signed distance is always -1 for all 6 sides, but does anyone know of a faster way or could point me to some code?

I should add that ideally the test would produce 3 linear interpolation parameters which would lie in the range 0..1 to indicate that the point is within the volume for each axis (since I will have to calculate these later if the point is found to be in the volume)

sentences:
Collision Detection works 2 sides This might be really simple but it is giving me a lot grief and I wondered if you guys would be able to shed some light on it. Basically I have a tile map which draws tiles at 64 * 64 and that works very well and they are drawn in a 2D array like this in the game1 class.

TileMap tileMap = new TileMap(new int[,]
    {
        { 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,4,4,4,4 },
        { 0,0,0,0,0,0,1,1,4,4 },
        { 1,1,1,1,1,1,1,1,1,1,},
        { 1,1,1,1,1,1,1,1,1,1,}
    });

Now comes the problem. Basically I want to determine which side the player has hit the tile from. However, with the algorithm below the collision only works correctly for the bottom and left side. if the player hits the tile from the top it will state it was hit from the bottom. if the player hits from the right it will specify the left side was hit. if the player hits from the left or bottom it will show that collision has happened but state it happened on the right or top of it. it will output that the top of the has been hit but only when the player is completely in the tile like this

.

Pretty much the same thing happens when it displays the right side is hit (player moves more to the left)

TileMap

int left = (int)Math.Floor((float)player.playerBounds.Left / TILE_WIDTH);
        int top = (int)Math.Floor((float)player.playerBounds.Top / TILE_HEIGHT);
        int right = (int)Math.Ceiling((float)player.playerBounds.Right / TILE_WIDTH) - 1;
        int bottom = (int)Math.Ceiling((float)player.playerBounds.Bottom / TILE_HEIGHT) - 1;

        Rectangle tileBounds = new Rectangle((int)tilePosX, (int)tilePosY, TILE_WIDTH, TILE_HEIGHT);
        Rectangle playerBounds = player.playerBounds;

        float WidthOfRects = 0.5f * playerBounds.Width + tileBounds.Width;
        float heightOfRects = 0.5f * playerBounds.Height + tileBounds.Height;

        int centerX = (playerBounds.Left + playerBounds.Width / 2) - (tileBounds.Left + tileBounds.Width / 2);
        int centerY = (playerBounds.Top + playerBounds.Height / 2) - (tileBounds.Top + tileBounds.Height / 2);

        for (int y = top; y <= bottom; ++y)
        {
            for (int x = left; x <= right; ++x)
            {

                if (mapCell[y, x].TileID == 1)
                {
                    //minkowski sum
                    if (Math.Abs(centerX) <= WidthOfRects && Math.Abs(centerY) <= heightOfRects)
                    {
                        double wy = WidthOfRects * centerY;
                        double hx = heightOfRects * centerX;
                        if (wy > hx)
                        {
                            if (wy > -hx)
                            {
                                Console.WriteLine("bottom");
                                //newPos.Y = tileCollision.Bottom;
                            }
                            else
                            {
                                Console.WriteLine("right");
                                //newPos.X = tileCollision.Right;

                            }
                        }
                        if (wy > -hx)
                        {
                            Console.WriteLine("left ");
                            //newPos.X = tileCollision.Left - playerBounds.Width;
                        }
                        else
                        {
                            Console.WriteLine("top");
                            //newPos.Y = tileCollision.Top - playerBounds.Height;
                        }
                    }
                    // player.Position = newPos;
                }
            }
        }

Map Cell

public class MapCell
{

    public int TileID { get; set; }

    public MapCell(int tileID)
    {
        TileID = tileID;
    }

Any help would be greatly appreciated.

Thank you.

sentences:
Do delays after losing and before restarting serve as a defense against burnout, or are they addiction machines? In games like Super Hexagon or even Everwing, there's a very brief but noticeable delay from losing to starting over: waiting for the restart button to appear, pressing it, etc...

Is this a defense against player burnout? If there's no pause that separates one game try from next, the game might feel never-ending and burn out the player quickly.

Or is it a way to keep the player addicted? I often suspected this in Everwing, because that game's hardly shy about its avaricious nature. Perhaps there's a psychological effect in making the player wait before they can play again — like building the craving part of a habit?

Or perhaps a lack of this delay is to keep the flow going, so to speak? Ori and the Blind Forest does something similar in its Ginso Tree level. It has very fast restarts, no button or anything, and deaths do not restart the music that's playing in the BG. The result is that deaths do not break the flow of the game, and despite them the whole level feels seamless.

So, are there any studies on this? Barring those, anecdotes? I couldn't find anything, anywhere.

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:
How to build a static version of cocos2d-x and link it to my project Firstly, I'm using Cocos2d-x v3.6 for Win32 desktop + Visual studio 2013 and C++.

When building Cocos2d-x, always it has been built as a dynamic version not a static version as I want.

How to build it as static version ?
Then, How to bind it with the project ?

sentences:
Make one object rotate to face another object in 2D In my 2D project, I have an object that is sometimes above or below another object.

Once the primary object comes in close proximity with the secondary object, I want the object to rotate on the z axis so that the front of the primary object is facing the secondary object.

(Here, following Unity's default setup, the z axis is the axis pointing into the screen)

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:
Determining if player-created structure matches a template in a 3D block-based game Disclaimer: this is one of those dreaded Minecraft-style questions, but I feel it's more a data structures and algorithms question

I'm really new to 3D data structures and am wondering what the best way to store and match a 3D block structure.

Right now, the player is able to place blocks in any arbitrary space and when these blocks match a pre-defined structure an event happens. The way I'm doing it currently is when a player places a block the game recursively checks each adjacent block to find the block with the lowest x, y, z coordinate and makes that block the root block. Then it checks the rest of the blocks, based off of the root block, to make sure they match a certain template. The problem is that as the template gets more complicated, so does my (terribly inefficient) code.

I'm thinking the best way to do this is to store some type of matrix that defines the structure and then match against the matrix whenever a player places a block. Are there already data structures/algorithms that would match this type of problem?

sentences:
Move-Cycle generates unintended numbers I have an image I want to move like it's hovering up and own in a cycle.
For that image I have the Y

float _sMY = 10;

My cycle is this:

if (!_hoveredDown)
{
   _sMY -= 0.1f;
}
else
{
   _sMY += 0.1f;
}

if (_sMY < -10)
   _hoveredDown = true;
else if (_sMY > 10)
   _hoveredDown = false;

But during this cycle, the image stutters in certain positions and debugging told me that _smY goes way to -5.677342E-06.

Why do you think this is happening?

Fix, which won't work:

float hoverSpeed = 0.1f;
hoverSpeed += (float)(GameTime.ElapsedGameTime.TotalSeconds);

if (_hoveredDown)
{
   _sMY += hoverSpeed;
}
else if (!_hoveredDown)
{
   _sMY -= hoverSpeed;
}

if (_sMY < -10)
    _hoveredDown = true;
else if (_sMY > 10)
    _hoveredDown = false;

sentences:
For Blender+Unity users— Would Blender's “UV Project Modifier” work in Unity? So, say in Blender you have a Cube that you put a "UV Project Modifier" on, with an Empty (controlled by a Bone) as the Projector. In Blender when you move the Bone, the UV moves on the cube. Great!

But now let's say you wanted to bring that to Unity. Would that still actually work (being able to move the UV around with bone movement) or would it be busted?

I'm trying to test it myself and it seems a dud but I already struggle with Blender's export process so wanted to check here.

sentences:
How do I manage multiplayer login? How is the typical login, loading the level and spawning handled?
For example:

Client sends "iwanttologinwithcharacterx"
Server does some validity checks and instantiates characterx
Server sends back "loadlevelx"
Client sends "iaminloadingscreen", when finished sends "finishedloading"
Server sends "spawnyourcharacterx"

OR just after the "iwanttologinwithcharacterx" the server tells the client to handle steps 3, 4, and 5 without interaction?

I'm confused about what would be the ideal approach with the least room for errors.

Some info: The level in which players begin is always the same. Players can have multiple characters and during the game they often switch levels (this would be linked to my first question, how would I handle that cleanly? Don't destroy the playerobject between level load and just change their positions accordingly?)

sentences:
Drawing a texture line between two vectors in XNA WP7 I want to create a simple graph maker in WP7.

The goal is to draw a texture line between two vectors what the user defines with touch. I already made the rotation, and it is working, but not correctly, because it doesn't calculate the line's texture height, and because of that, there are too many overlapping textures. So it does draw the line, but too many of them.

How could I calculate it correctly?

Here is the code:

public void DrawLine(Vector2 st,Vector2 dest,NodeUnit EdgeParent,NodeUnit EdgeChild)
    {
        float d = Vector2.Distance(st, dest);
        float rotate = (float)(Math.Atan2(st.Y - dest.Y, st.X - dest.X));
        direction = new Vector2(((dest.X - st.X) / (float)d), (dest.Y - st.Y) / (float)d);
        Vector2 _pos = st;
        World.TheHive.Add(new LineHiveMind(linetexture, _pos, rotate, EdgeParent, EdgeChild,new List<LineUnit>()));
        for (int i = 0; i < d; i++)
        {
            World.TheHive.Last()._lines.Add(new LineUnit(linetexture, _pos, rotate, EdgeParent, EdgeChild));
            _pos += direction;

        }
    }

d is for the Distance of the st (Starting node) and dest (Destination node)
rotate is for rotation
direction calculates the direction between the starting and the destination node
_pos is for starting position changing

Thanks for any suggestions/help!

sentences:
Travel over step angle http://www.gamasutra.com/blogs/AdamWinkels/20140220/211306/DevLog_7_Learning_How_to_Walk.php

Following the link above I have been able to get my character to move and rotate very smoothly over angled surfaces up-to 80 degrees.  Anything over that and it begins to clip and wobble when traveling down the surface. The spiders rotation only reaches half of the desired angle.  So at 85 degrees it only rotates to 42.5.  Going up is a mess, but I have not implemented the fix for that from the link above, so I am less worried about that.  Any suggestions?

private float RayDuration = 0;
private float RayAngle = 5f;
private float RayLength;
Vector2 MovementDirection;
float OffSetY  = 5;
float OffSetX = .5f;
int GroundMask = 1 << 8;

 void Start()
{
    SpiderRect = GetComponent<RectTransform>();
    RayLength = SpiderRect.rect.height;
}

private void TouchHeld(CustomEvent customEvent)
{

    if (Input.mousePosition.x > 400)
    {
        MovementDirection = transform.right;
    }
    else
    {
        MovementDirection = -transform.right;
    }

    Vector2 transformUp = transform.up;
    Vector2 position = transform.position;

    Vector2 rightRayPosition = new Vector2(transform.position.x + OffSetX, transform.position.y + OffSetY);
    Quaternion rightOffSetAngle = Quaternion.AngleAxis(-RayAngle, new Vector3(0, 0, 1));
    Vector2 rightRayAngle = rightOffSetAngle * Vector2.down ;

    Vector2 leftRayPosition = new Vector2(transform.position.x - OffSetX, transform.position.y + OffSetY);
    Quaternion leftOffSetAngle = Quaternion.AngleAxis(RayAngle, new Vector3(0, 0, 1));
    Vector2 leftRayAngle = leftOffSetAngle * Vector2.down;

    RaycastHit2D rightHit = Physics2D.Raycast(rightRayPosition, rightRayAngle, RayLength, GroundMask);
    RaycastHit2D leftHit = Physics2D.Raycast(leftRayPosition, leftRayAngle, RayLength, GroundMask);

    #region move
    if (rightHit && leftHit)
    {

        Debug.DrawRay(rightRayPosition, rightRayAngle, Color.red, RayDuration);
        Debug.DrawRay(rightRayPosition, rightHit.normal, Color.green, RayDuration);

        Debug.DrawRay(leftRayPosition, leftRayAngle, Color.yellow, RayDuration);
        Debug.DrawRay(leftRayPosition, leftHit.normal, Color.magenta, RayDuration);

        Vector2 averagePoint = (leftHit.point + rightHit.point) / 2;
        Debug.DrawRay(averagePoint, -transform.up, Color.cyan, RayDuration);

        Vector2 averageNormal = (leftHit.normal + rightHit.normal) / 2;
        Debug.DrawRay(averagePoint, averageNormal, Color.cyan, RayDuration);

        Quaternion targetRotation = Quaternion.FromToRotation(Vector3.up, averageNormal);
        Quaternion finalRotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 10);
        transform.rotation = Quaternion.Euler(0, 0, finalRotation.eulerAngles.z);

        transform.position = Vector2.MoveTowards(transform.position, averagePoint + MovementDirection, .15f);
    }
    else
    {
        Debug.Log("What");
    }

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:
How can I get projected coordinates of vertex on screen I want to check picking for faces and for that I need projected X Y coordinates of my vertexes in -1 to 1 range:
For that I multiply my vertex array with matrices and then get projected triangle coordinates from it and check if mouse is inside of that triangle ,but something goes wrong:
Here is my code

    for (int i = 0; i < m_vertexCount; ++i)
{
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &worldmatrix);
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &viewmatrix);
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &projectionmatrix);
}
z = 0;
for (int i = 0; i < m_faceCount; ++i)
{
    x1 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y1 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z1 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;
    x2 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y2 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z2 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;
    x3 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y3 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z3 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;

    //code .. //
}

Where  m_Pverts is array of vertexes  m_Pverts1 is empty array for transformed vertexes and  m_verts[].x is array of vertex indexes:
x1,y1,z1,x2,y2,z3,x3,y3,z3 must be X Y  projected coordinates of triangle and Z depth:
Other code is checked and works right:

What I am doing wrong ??

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:
Scene - human speed correlation I am writing a really simple game with a scene (horizontal plane) and a human moving to the right of the plane (watching the simulation from the +z axis).

The scene contains some trees, which I am moving towards -x axis in order to create the animation effect (by adding a float to their current position).

The human just walks or runs with increasing/ decreasing the angular velocity of one of his legs.

The question comes down to, how can I combine this two entities in order to correlate the change of the speed of the human with the change of the variable that is responsible for making the animation of the scene?

Should I convert the angular velocity to velocity?

sentences:
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:
Remove nested if statements I have been learning a new method of programming. I have been programming many years and am recently finding out there is a better method in general via abstract classes.

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

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

public class AddTotalWater : Water
{
    public double TotalWater;

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

and use it with:

TotalWater.text = AddTotalWater.GetString(amountToAdd);

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

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

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

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

sentences:
Dropping through a platform in Clickteam Fusion 2.5 I am using Clickteam Multimedia Fusion 2.5. Currently, I have a rudimentary platformer game, with the following setup:

player object is set as a physics platform, with the physics engine added to make it all work
the floor is a quick backdrop, with the obstacle type of obstacle
the only platform in the game is also a quick backdrop, with the obstacle type of platform

The way the game is setup, the player object can jump through the platform.

WHAT I WOULD LIKE TO DO

Is there a default, built-in way for the player object to be able to drop down through the platform? To be more specific, is there a default key press or a default combination of keys which would allow the player object to drop down through the platform?

I guess I could add it all in via the Event Editor, but I was wondering if there's a built-in way which handles it all.

sentences:
Frustum Culling bug in program I did Frustum Culling in my engine, but it does not work correctly. All shown in the video:

Video

If the approximation is too close, the model disappears. On the right in the console you can see that one model is rendered less. With what it can be connected?

Frustum creation code:

bool FrustumCulling::update(ID3D11Device* device, const Camera & view, float angle, float ratio, float _near, float rear)
{
    Vector3 pos = (Vector3)view.getViewPosition();
    Vector3 d = pos - (Vector3)view.getViewDirection();
    d.normalize();
    Vector3 right = (Vector3)view.getViewHeight();
    right = right.cross(d);
    right.normalize();
    Vector3 up = Vector3::cross(d, right);
    // get h and w near and rear planes
    float val = angle * 0.5;
    float tang = (float)tan(val);
    float nh = _near * tang; // near height
    float nw = nh * ratio; // near width
    float rh = rear * tang; // rear height
    float rw = rh * ratio; // near width
    // generate 8 vertex frustum
    Vector3 fc = pos - d * rear;
    Vector3 ftl = fc + up * rh - right * rw; // ftl - Far(rear) Top Left
    Vector3 ftr = fc + up * rh + right * rw;
    Vector3 fbl = fc - up * rh - right * rw;
    Vector3 fbr = fc - up * rh + right * rw;
    Vector3 nc = pos - d * _near;
    Vector3 ntl = nc + up * nh - right * nw;
    Vector3 ntr = nc + up * nh + right * nw;
    Vector3 nbl = nc - up * nh - right * nw;
    Vector3 nbr = nc - up * nh + right * nw;
    // generate 6 planes frustum
    Plane3 p(ntr, ntl, ftl);
    data.planes[TOP] = PlanesFrustum(p.getPlane());

    p = Plane3(nbl, nbr, fbr);
    data.planes[BOTTOM] = PlanesFrustum(p.getPlane());

    p = Plane3(ntl, nbl, fbl);
    data.planes[LEFT] = PlanesFrustum(p.getPlane());

    p = Plane3(nbr, ntr, fbr);
    data.planes[RIGHT] = PlanesFrustum(p.getPlane());

    p = Plane3(ftr, ftl, fbl);
    data.planes[FARP] = PlanesFrustum(p.getPlane());

    p = Plane3(ntl, ntr, nbr);
    data.planes[NEARP] = PlanesFrustum(p.getPlane());
}

Model verification code (cube bbox) to hit frustum:

bool modelCheckFrustum(Vector3 * v)
{
    for(int k = 0;k<8;k++)
    {
        Vector3 p0 = v[k];
        int isFrustum(0);
        for(int l = 0; l<PLANES_SIZE;l++)
        {
            Vector4 n = planes[l].pl; //
            float value = shortDistanseFromPointToPlane(n, p0);
            if(value > 0.f) // point in current plane
                ++isFrustum;
        }
        if (isFrustum == PLANES_SIZE)// point in frusrtum
            return true; // model in frustum
    }
    return false; // model not in frustum
}

PLANES_SIZE - count planes, == 6

planes - array planes frustum

planes - Vector4, when x,y,z - a,b,c, and w - d

Method shortDistanseFromPointToPlane:

float shortDistanseFromPointToPlane(Vector4 p, Vector3 p0)
{
    return p.x*p0.x + p.y*p0.y + p.z*p0.z + p.w;
}

Distance to the front and rear planes:

float SCREEN_DEPTH = 1000.f;
float SCREEN_NEAR = 0.01f;

Creating a matrix of perspectives:

matrixProjection = Matrix::CreatePerspectiveFovLHMatrix(GeneralMath::PI / 4, w / (float)h, SCREEN_NEAR, SCREEN_DEPTH);

w, i - width and height window

How to fix this nasty bug? Thank.

P.S.: I did frustum culing in this lesson.

UPD1:

I created a model frustum, and it shows that not a single BBox vertex got inside the frustum. Now I know the reason, it remains to come up with a solution to this problem :)

Image:

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:
LibGDX: Smooth movement on a grid based game I'm making a game with LibGDX where the player is on a grid (like a Chess board).
For now, I'm moving the player by teleporting him 16px in a direction.
I'd like to use the delta time to make smooth movements, I want the character to move to 16px in a direction smoothly and when he's arrived, he stops moving.

Here's the code of my Player's Class:

public Player(Sprite sprite){
    super(sprite);
    setX(16*5);
    setY(16*5);
}

@Override
public void draw(Batch batch){
    update(Gdx.graphics.getDeltaTime());
    super.draw(batch);
}

public void update(float deltaTime) {
}

public void move(int direction){

    switch(direction){
    case UP:
        setPosition(getX(), getY()+16);
        break;
    case DOWN:
        setPosition(getX(), getY()-16);
        break;
    case LEFT:
        setPosition(getX()-16, getY());
        break;
    case RIGHT:
        setPosition(getX()+16, getY());
        break;
    }
}

public boolean canMove(int direction){
    if(direction == UP){
        if(getY() == 160-getHeight())
            return false;
    }
    else if(direction == DOWN){
        if(getY() == 0)
            return false;
    }
    else if(direction == RIGHT){
        if(getX() == 160-getWidth())
            return false;
    }
    else if(direction == LEFT){
        if(getX() == 0)
            return false;
    }
    return true;
}

sentences:
Part of model in Unity is inside out but not in Blender? I've downloaded this asset and it looks perfectly fine in preview, and even in blender.

But when I import it in Unity, one of its shoulder is inside out, even after making all faces double sided.

I also tried switching the normal mode in the import settings to Calculate.

What causes this issue and how could I fix this?

sentences:
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 generate a (relatively) linear dungeon path? We developing a concept for an action side-scroller. What we need is a way to generate a (relatively) straight map. By this I mean something like...

It's clear to see that this map follows one simple route, even if it deviates a bit. With that, we're also going to implement straying pathways -- shortcuts, or secret passages. So that, perhaps, to get from the third circled area to the fourth, you'd have the main path, and a secret passageway that's filled with stronger enemies, but is faster and has higher rewards.

Here we've reached an impasse. We're exploring a few options but haven't really made any progress. What approach could we use to generate this kind of path We're not bound by programming languages, as so far we've experimented with Java, C# and C++. Similarly, we don't have any current dependencies on specific game engines.

sentences:
Setting up sequential animation clips in Unity I'm trying to play two animation clips sequentially using Unity 2D. I've been using Mecanim for this so I've imported the two clips in a newly created controller and connected the first one to the next one. I also want the last clip to be looping so I set that toggle in the settings of the clip.
Now for some reason the first clip is played just fine but the second one doesn't animate at runtime. It loops fine in the Animator window and the clip itself works in the preview window but not at runtime.

I've also tried setting it up using the Animation Component and use the PlayQueued method but this doesn't give any animation.

I'm kind of lost on what to try next

EDIT: This is to be used on a Canvas UI Image

sentences:
Should I design UI in raster or in vector editing software? I am working on a IOS city builder game (more like planet builder)
but that's not the case, I was making the buttons in photoshop when something hit me:
"if I make raster icons in photoshop, they will look pixelated on ipads!"

And so I proceded to illustrator to create the same things, but illustrator has nowhere near the amount of cool tools, that made my buttons look so cool in photoshop.

The question:
Should I stick with vector graphics and make them work? so then I have resizable buttons.
or
Should I just create several sets of buttons, which are different sizes?  a set for ipads,a set for iPhone 5's a set for iPhone 6's..

sentences:
how to set multiple materials using array in the submesh of an object I'm trying to insert multiple materials into the object's submesh using the array, but I'm not getting

public GameObject[] obj;

//material mat;

public void Color(Material mat) {

    for (int x = 0; x < obj.Count; x++)
        obj[x].GetComponent<MeshRenderer>().sharedMaterials[1] = mat;

    Material[] mats = GetComponent<Renderer>().materials;
    mats[1] = mat;
    GetComponent<Renderer>().materials = mats;

    {
        print("New Material");
    }
}

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:
How can I resize pixel art in Pyglet without making it blurry? I have a tileset of 8x8 pixel images, and I want to resize them in my game so they'd be double that (16x16 pixels, e.g. turning each pixel into a 2x2 block.) What I'm trying to achieve is a Minecraft-like effect, where you have small pixel images scale to larger blockier pixels.

In Pyglet, the sprite's scale property blurs the pixels. Is there some other way?

Working Code:

Here's the solution that works (thanks to DMan's persistence and Jimmy's insight):

image = resource.image('tileset.png')
texture = image.get_texture()
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
texture.width = 16 # resize from 8x8 to 16x16
texture.height = 16
texture.blit(100, 30) # draw

sentences:
Tile Maps and vertexZ order for sprites Here is the setup.  I have a orthogonal tile map made with Tiled.  There are 5 layers.  The bottom 4 comprise the background, while the top layer is the foreground that I will refer to as the “tree” layer.  I have a hero sprite that I have added as a child of the tile map at the same node zorder as the tree layer.

The issue that invariably comes up with this scenario is that I want my hero to be in front of trees that he is “below”, but behind those trees that he is “above”.  Below and above are determined by the Y coordinate of the hero versus the Y coordinate of any given tree.

The Cocos2d programming guide contains a section for tile maps, and in that section it specifically discusses how to achieve the affect I have described.  This information can be found here.

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps

The solution is pretty simple.  Enable the depth buffer in my code.  Add a cc_vertexz property with a value of -1000 to each layer that the hero will be above.  Then add a cc_vertexz property to the tree layer with a value of “automatic” as well as a cc_alpha_func property with a value of .5.  Then as your hero moves re-adjust its sprite’s vertexz value based on its position within the map.

I did all this and it worked great.  However, a problem appeared as soon as I added other “enemy” sprites to this map.  As with the hero sprite these sprites were added to the map with the same node zorder as the tree layer, and they too have their vertexz values changed based on their Y coordinate within the map.  It should be noted that the hero sprite is added after the enemy sprites.  In addition, both the hero and enemy sprites are animated and their textures are not part of the tile map textures.  Based on the Cocos2d documentation this should not matter.

The problem is this.  If my hero is below an enemy sprite on the map then everything looks and works fine.  However, if my hero is above an enemy sprite on the map then as the enemy passes over the hero sprite the background comes through rather than the hero sprite.  The best way to describe it is to say that as soon as the enemy sprite begins to pass over the hero sprite, the transparent areas of the enemy sprite begin to fill with the background and the hero sprite is partially obscured until then enemy sprite moves off the hero.  It is like the hero sprite is not there.

I know this is related to the order that the sprites are added to the map, because if I change this and have the hero sprite added to the map before the enemy sprites, then the effect reverses in that the background comes through the transparent areas of the hero sprite rather than the enemy sprites.   It is almost like the vertexz property is not absolutely determining the order that things are drawn.

Looking into this it appears to be a blending issue and I found what seems to be the solution, which is to subclass the CCSprite class and override the draw method with the following:

-(void) draw {

   glEnable(GL_ALPHA_TEST);

   glAlphaFunc( GL_GREATER, 0 );

   [super draw];

   glDisable(GL_ALPHA_TEST);

}

The problem however is that this code is not applicable to the version of Cocos2d that I use, which is Cocos2d 2.1.  In addition this appears to be handled by the CCTMXLayer drawing function if automatic vertexz is enabled.  As such I do not know if subclassing CCSprite would just be redundant.  See below for how CCTMXLayer handles this:

// CCTMXLayer drawing function
-(void) draw

{

    if( useAutomaticVertexZ_ ) {
        glEnable(GL_ALPHA_TEST);
        glAlphaFunc(GL_GREATER, alphaFuncValue_);
    }

    [super draw];

    if( useAutomaticVertexZ_ )
        glDisable(GL_ALPHA_TEST);
}

I am not new to Cocos2d, but I am very new to anything related to OpenGL.  So in short, is the solution just to subclass CCSprite and find the Cocos2d 2.1 equivalent to the above code snippet, or am I simply doing something wrong?  I suspect the latter.

Any help would be very much appreciated.  Thanks!

sentences:
In snapshot-based networked game does client store N snapshots as well? I understand that in a snapshot-based network replication system the server holds onto N full snapshots and uses incoming ACK'd data from the clients to construct delta snapshots. This makes sense.  What I have not seen a lot of information about is how the client uses that delta compressed snapshot to apply the changes.

Does the client store N snapshots so that it can reconstitute the delta compression against the reference it claims to have, or does it simply have one snapshot state of accumulated deltas? I imagine the former being correct, but the latter being less memory.

I've read How would a game-state snapshot system be implemented for networked real-time games? and and other answers, looked at Fabien's post, and read a couple of articles by Valve, but I am still unclear.

Any thoughts on this?

sentences: How to make animation in unity Dots hybrid? I'm working on isometric game in 2D but didn't find any good tutorial in how to handle animation...any help?

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:
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:
MotionBuilder- Actor attached to Mocap moves fluently, but Character using Actor as source jitters and has joints occasionally pop out I'm trying to get a MotionBuilder animation to work in Unity on my custom character.
I've downloaded Motionbuilder FBX mocap files with Actors already attached from http://dancedb.eu/main/performances
The thing is that when I put the Actor as the Input source for my own (Characterized) character model and hit play on MotionBuilder, my model follows the animation 80% correctly but for the other 20% my character jitters and shakes and occasionally even "breaks a limb" when a joint randomly pops out of its place for a second.
Does anyone have suggestions on how to get the animation smoother for my Character?

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:
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:
Unity3d multiplayer canvas so I am making multiplayer game and I stuck on one thing, I have blood overlay canvas in my scene(you know, in fps games if somebody shoots you your screen becomes red and this stuff), and when I shoot enemy, his screen becomes red, but mine also.

thats what i ahve now: if raycast hits enemy, player script calls: ColorController.MakeItred(); color controller is attached to this canvas image, here is its code:

`

 void Start () {
       if (current == 100 || current == 0)
        {
        opacity = 0;
        }
    }

// Update is called once per frame
void Update () {
          image = GetComponent<Image>();
    image.color = new Color32(reds, greens, blues, opacity);

    if (current == 0)
    {
        opacity = 0;
    }
    if (!playing)
    {
        if (opacity > 0)
        {
            StartCoroutine(toLower());
        }
        }
    if (opacity == 255)
    {
        playaudio();

    }

}

public static void MakeItred()
{
    opacity = 255;

}
public static void MakeItOff()
{
    opacity = 0;

}
 void playaudio()
{
    AudioSource audio = GetComponent<AudioSource>();
    audio.Play();
}
private IEnumerator toLower()
{
    playing = true;
    opacity -= 1;

    yield return new WaitForSeconds(interval);
    playing = false;
}`

btw thats function in player code that calls colorcontroller.makeitred,

[ClientRpc]
    public void Rpcdoit()
    {
        ColorController.MakeItred();
    }

-Nick
thanks.

sentences:
Controlling Unity 3D cube with remote gyroscope This probably will go into conceptual things as well, but what I would like to do is take a Raspberry Pi (with a Sense Hat), transmit the gyro values to Unity, and effectively have a 1-1 realistic representation of orientation changes.

I have no problem transmitting values from the Pi to Unity (though learning about hidden firewall rules was fun), however I am lacking some understanding of how to transform raw gyro values to something representative in Unity.

I have not calibrated the Sense hat recently, but know that is something that should be done.

For example, I am transmitting the pitch/roll/yaw values from the Pi (resting normally, these are about: 100.30272132022793, 351.3885231076573 354.9306950697191).

I have a cube gameobject that I've flattened out and set to the origin.

My question is basically, what is the best way to translate raw values from some anonymous object to the Unity coordinate system, and have it rotate appropriately?  I don't necessarily want its position to change, just rotation.

Screenshot for reference.  Raspberry Pi sending gyro data is on the left, Unity is on the right.  Tabletop (flattened cube) is what I'd like to rotate to simulate a ball balancer.

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:
how can I move an actor in opposit direction of mouse's position in GameSalad? I have a moving actor named ball and I want to move it in the opposite direction of my mouse's position.

In my code in Move To behaviour for X-axis location I write

  -game.mouse.position.X

and for Y-axis location I write

  -game.mouse.position.Y

But it's not working properly.

sentences: What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix? So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a look-at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?

sentences:
Find the nearest control points either side of a Catmull Rom spline segment There is a formula for evaluating a Catmull Rom spline segment at time 't' found here.

The problem with this is that it requires finding the two control points either side of the segment to evaluate.

Is there a formula for finding those two control points?

As a alternative I considered utilising some kind of algrorithm for finding the nearest values either side of a given value:

float lowerNearest = float.MaxValue;
float upperNearest = float.MinValue;

int numElements = array.Length;

for (int i = 0; i < numElements; ++i)
{
    float dif = index - array[i].Index

    if (dif > 0)
    {
                     lowerNearest = Math.Min(lowerNearest, dif)
    }
    else
    {
         upperNearest = Math.Max(upperNearest, dif);
    }
}

However I'm not sure what values I should be comparing as the control points are only vectors and felt that it was probably the incorrect way to approach this problem.

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 do I get an XNA 4.0 game to run on other machines? Whenever I try and run a game made in XNA 4.0 on a machine other than one used for development, it just won't run. I've followed the instructions here to ensure that all the dependencies are present.

To be clear I've done the following:

Downloaded and installed the Microsoft .NET Framework 4 Client Profile.
Downloaded and installed the Microsoft XNA Framework Redistributable 4.0.
Made sure I am not using anything contained within GamerServices and XNA.Net.*, my references are as follows:

  Microsoft.Xna.Framework
  Microsoft.Xna.Framework.Avatar
  Microsoft.Xna.Framework.Game
  Microsoft.Xna.Framework.Graphics
  Microsoft.Xna.Framework.Storage
  Microsoft.Xna.Framework.Video
  Microsoft.Xna.Framework.Xact
  mscorlib
  System System.Core
  System.Windows.Forms
  System.Xml
  System.Xml.Linq

I also followed the advice here to ensure the problem was not within the code itself.

I've tried the follow methods to get it to run (on both Vista and 7):

Use the built in publishing functionality. This results in an error saying that Microsoft.Xna.Input.Touch needs to be present in the GAC. I've tried adding Microsoft.Xna.Input.Touch to the references, and this does not fix the issue.
Copy the XNA dll files locally. This results in an error message stating that Microsoft.Xna.Game.dll or one of its dependencies could not be located.
Copy over everything contained in Release. This results in an Application X stopped working... or APPCRASH error message the second it starts. My code is never reached.

Is there any way to get this to work? I've been trying to get this to work with the deadline looming, and it's been a source of unneeded stress.

sentences:
MonoGame "couldn't find a default importer" for .txt file? I'm trying a solution in MonoGame to create levels from a .txt file, but the pipeline tool fails when trying to build the Content.mgcb correctly:

❌ Skipping HighResolutionContent\Backgrounds\Layer1_0.png
C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Backgrounds/Layer1_0.png
Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/2.txt'!
Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/0.txt'!
Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/1.txt'!

Visual Studio shows me this:

❌ The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"C:\Users\foo\documents\visual studio 2017\Projects\Platformer\Platformer\Content\Content.mgcb" /platform:Windows /outputdir:"C:\Users\foo\documents\visual studio 2017\Projects\Platformer\Platformer\Content\bin\Windows" /intermediateDir:"C:\Users\foo\documents\visual studio 2017\Projects\Platformer\Platformer\Content\obj\Windows" /quiet" exited with code 3.
❌ Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/0.txt'!
❌ Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/1.txt'!
❌ Couldn't find a default importer for 'C:/Users/foo/Documents/Visual Studio 2017/Projects/Platformer/Content/HighResolutionContent/Levels/2.txt'!

sentences:
Why are faces being drawn like this with my custom shader? I've been writing a custom surface shader which allows for vertex colors (with alphas) to be set programmatically. From test runs of the shader itself, it works perfectly fine, and I am able to set the color of vertices programmatically. Unfortunately, I ran into some other issues. Currently, the shader is rendering mesh faces quite strangely, and I cannot figure out why:

The shader code itself currently looks like this:

Shader "Custom/VertexColorSurface" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" { }
    }

    SubShader {
        Tags { "RenderType"="Cutout" }

        CGPROGRAM
        #pragma surface surf Lambert alpha
        #pragma target 3.0

        struct Input {
            float2 uv_MainTex;
            float4 color : COLOR;
        };

        sampler2D _MainTex;
        fixed4 _Color;

        void surf(Input IN, inout SurfaceOutput OUT) {
            OUT.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * _Color.rgb * IN.color.rgb;
            OUT.Alpha = tex2D(_MainTex, IN.uv_MainTex).a * _Color.a * IN.color.a;
            OUT.Specular = 0.2;
            OUT.Gloss = 1.0;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Currently the two solutions I've tried have been using ZWrite On and ColorMask 0 in a Pass block, and while both of these methods fix the face rendering issues, they totally screw up alpha blending, which is something I need.

What might be causing this issue, and how do I fix it?

sentences:
LAN multiplayer game for desktop and Android in Unity 3D How can I add an option "Multiplayer on LAN" to my desktop and Android game? I am using Unity 3D, and I am currently building a chess game.

Just give me the source or a specific path that I have to follow. Any shared material or criticism will be appreciated.

sentences:
Finding the Dimension of OBJ objects I am having a Three OBJ file , Cone , Sphere and Cube. How can i find the dimension of these objects , so that i can use it in my collision detection class.

i.e How can i find Radius , Length of Cube and Radius and Height of cone.
Or is there any better way for collision detection , I have Hundreds of random particle in my game which may or maynot collide with these objects.

sentences:
How to define a weak-perspective camera in openGL? I know how to define the perspective camera as well as weak-perspective camera in the Math.
But how to define a weak-perspective camera () in openGL?

sentences:
Why the renderers Renderer[] array are all null? using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LightsEffect : MonoBehaviour
{
    public List<UnityEngine.GameObject> waypoints;
    public int howmanylight = 5;
    public Generatenumbers gn;
    public bool changeLightsDirection = false;
    public float delay = 0.1f;

    private List<UnityEngine.GameObject> objects;
    private Renderer[] renderers;
    private int greenIndex = 0;
    private float lastChangeTime;

    private void Start()
    {
        //waypoints = new List<UnityEngine.GameObject>();
        objects = new List<UnityEngine.GameObject>();

        if (howmanylight > 0)
        {
            UnityEngine.GameObject go1 = UnityEngine.GameObject.CreatePrimitive(PrimitiveType.Sphere);
            duplicateObject(go1, howmanylight);
            LightsEffects();
        }
    }

    private void Update()
    {
        LightsEffectCore();
    }

    public void duplicateObject(UnityEngine.GameObject original, int howmany)
    {
        howmany++;
        for (int i = 0; i < waypoints.Count - 1; i++)
        {
            for (int j = 1; j < howmany; j++)
            {
                Vector3 position = waypoints[i].transform.position + j * (waypoints[i + 1].transform.position - waypoints[i].transform.position) / howmany;
                UnityEngine.GameObject go = Instantiate(original, new Vector3(position.x, 0, position.z), Quaternion.identity);
                go.transform.localScale = new Vector3(0.3f, 0.1f, 0.3f);
                objects.Add(go);
            }
        }
    }

    private void LightsEffects()
    {
        renderers = new Renderer[objects.Count];
        for (int i = 0; i < renderers.Length; i++)
        {
            renderers[i] = objects[i].GetComponent<Renderer>();
            renderers[i].material.color = Color.red;
        }

        // Set green color to the first one
        greenIndex = 0;
        renderers[greenIndex].material.color = Color.green;
    }

    private void LightsEffectCore()
    {
        // Change color each `delay` seconds
        if (Time.time > lastChangeTime + delay)
        {
            lastChangeTime = Time.time;

            // Set color of the last renderer to red
            // and the color of the current one to green
            renderers[greenIndex].material.color = Color.red;
            if (changeLightsDirection == true)
            {
                Array.Reverse(renderers);
                changeLightsDirection = false;
            }
            greenIndex = (greenIndex + 1) % renderers.Length;
            renderers[greenIndex].material.color = Color.green;
        }
    }
}

In this line if for example objects count is 5 then there will be 5 renderers but they will be all null.

renderers = new Renderer[objects.Count];

sentences:
How to change the sprite of an object from another's script? I have an object A and an object B, I want that when object B is in a certain position, the sprite of object A changes to that corresponding to that position, how do I change the sprite of object A from the script of object b?

The image may give them an idea of what I want to do, object B is the glove, And the object A is the viewer.

Tansk form any help.

sentences:
What can I do with an old XNA game? I have this little amusing game that I made in my second year of high school, and I'm rather impressed with it. It isn't anything that I could present in any style of major game conference or anything, it is simply a castle-defense I enjoyed creating greatly that got me through my programming course with highest grades. It is simply too small to do anything big with, I made the majority of it in a single week Easter holiday, but I still want to share it. It was made in C#, Visual Studio 2008, XNA 3.1. It can be played by either Xbox controller connected to the computer, or by keyboard. It relies heavily on XNA codes, I only thought of making things work so I saw it and not for everyone else. Now, my question.

If I want to share it, is this possible, where do I do it, and what should I expect for incidents? I am entirely new to the concept of sharing my game online, so I don't even know where to start. Is the game simply too old? Is there someplace similar to, like, Newgrounds except for XNA games? What could I possibly release the game for?

This kind of question must arise all the time, so I don't mind if I'm linked to some other question I've been unable to locate. All questions I've been able to find are asked before the people have even started the project, which is possibly smart. Me, I'm already done with this game and I'm wondering what I can do with it.

Anyone who can sate my curiosity?

sentences:
Efficient Per-Tile Lighting Technique Quite a few of the 2D games that I have seen use per-tile lighting, where each tile has a set brightness (continuous scale of 0 to 1, for example).

One way of calculating the brightness of any one tile is to loop with all light sources and add a brightness value to the tile based on distance from the light source. However, with 100^2 tiles and 100 lights, that's a million iterations.

What's a CPU efficient method of calculating the light on each tile with multiple light sources?

Light sources that have objects in the way of tiles should also have a lesser impact but it doesn't matter if this doesn't resemble shadows.

The light sources change every few seconds.

sentences:
How to load a terrain of connected caves into bullet-phisics engine? I have a terrain that can not be represented as height map. Say a mountain with caves. I  have it in one large .obj file. How do I load such a terrain into bullet-phisics engine?

Or I shall generate height map, load it as a terrain and then load my caves as a seprate obj file somehow cutting it out from generated terrain?

sentences:
After a postprocess effect, can I output a list of all non-zero pixel locations without having to save the entire image? I am trying to simulate what's known as an 'event camera' in Unreal. Unlike conventional cameras that output full frames, event cameras return the locations of pixels where activity is detected - see example below.

I have a post-process material in UE, whose job is to essentially subtracts the current image from the previous one at every tick and 'light up' all the pixels that have changed. Thus, the job of this material to identify all "moving" pixels, and after doing this subtraction, I can identify all the pixel locations that had a change in intensity.

Under the assumption that the number of changed pixels is much lesser than the total number of pixels, I want to avoid the really expensive 'ReadPixels' sort of operations in order to simulate the output of an event camera. Is it possible to access the UV positions of non-zero pixels directly? What is a good, efficient way to access such data and read it out from a material?

sentences:
Logic that can traverse all possible layouts, but not checking every combination of identical pieces? Suppose we have a grid of arbitrary size, which is filled by blocks of various widths and heights. There are many 2x2 blocks (meaning they take a total of 4 cells in the grid) and many 3x3 blocks, as well as some 5x4, 4x5, 2x3, etc.

I was hoping I could set up a program that would look at all possible layouts, and rank them, and find the best one. Simply it would look at all possible positions of these blocks, and see what setup is the best rank. (the rank based on how many of these can be connected by a roadway system of 1x1 road blocks, and how many squares can be left empty after this is done. - wanting to fit the most blocks as possible with the least roads.)

My question, is how should I traverse all the possibilities? I could take all the blocks and try them one at a time, but since all 2x2 blocks are equal, and there are a couple dozen of them, there is no point in trying every combination there, as in the following

AA BBB
AA BBB
 CCBBB
 CCEEE
DD EEE
DD EEE

is exactly the same as

CC EEE
CC EEE
 AAEEE
 AABBB
DD BBB
DD BBB

You notice that there are 2 3x3 blocks and 3 2x2 blocks in my two examples. Based on the model I have now, the computer would try both of these combinations, as well as many others. The problem is that it is going to try every single possible variation of my couple dozen 2x2 blocks. And that is sorely inefficient.

Is there a reasonable way to take out this duplicated work, somehow getting the computer program to treat all 2x2 blocks as equal/identical, instead of one requiring rearranging/swapping of these identical blocks?

Can this be done?

My current pseudo code

blocks = array of all blocks [2x2, 2x2, 2x2, 3x3, 3x3]
iterate(0)
function iterate(i) {
    currentblock = blocks[i]
    for each possible position of currentblocks
        see if there are any more blocks to place, and if there are
            iterate(i+1)
        else
            all blocks are placed, so get the rank
            if the rank is better than thebestrank
                thebestrank = rank
                thebestposition = position
}
at this point, we proceed with thebestposition.

sentences:
2D Hidden Object Silhouette Shader Right now I am not using any depth information in my engine, but I just found out that it would be neat to be able to render the silhouette of important game objects that are "behind" something with a shader, though I am quite at a loss how to do this in a 2D scene with little to no depth information. I will propably have to use depth information for something like that, but I am not quite sure how.

I guess the abstract concept would be:

zn = depth of pixel that should be rendered
zc = depth of pixel at current position in some sort of buffer
if(zn < zc)
    render pixel with a "silhouette" color
else
    render pixel with it's intended color

Is this a proof of concept I can follow in my next few workhours?
How can I use and access stuff like the Z buffer of the current framebuffer in the shader?

As an example, I most recently saw this in Titan Souls:

Also remember that I am thinking 2D only, so application of the painter's algorithm might or might not be desirable.

EDIT: So right now, from comments and such, I got the following proof of concept:

activate stencil mechanism to set stencil
render obscuing objects
deactivate stencil
render scene, using painter's algorithm or depth checks to obscure
activate stencil mechanism to check weather or not something got rendered within the stencil area
render important objects again, using a different fragment shader to render pixels within the stencil as a dark shadow

amirite?

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 render portals in OpenGL? I am making RPG in OpenGl and I need to make some portals.
How should I render it if I want to see through the portal on the other side?

sentences:
Visual Studio 2012 and Game Development Alright, I think it's a simple question, but I got difficulties to find some answers around.

I already read that XNA wouldn't be in Visual Studio 2012.  I recently learned to use XNA, but since I would like to work on games, I'd like to know if there's a way to develop games using C# on Visual Studio 2012, or if I should learn everything again using C++ and Direct3D?

C# is a language I like a lot, so if there's no way to do it in C# but something quite easy to use Java for game development, I'd also be interested.

Thanks a lot!

sentences:
Why can't I swap fixtures on collision in Box2D? I'm trying to swap the fixtures associated with a body after colliding with a specific obstacle.

I can listen to the collision event by extending b2ContactListener. I tested it with a trace and it's working. My listener function in the main game class calls a Player method that makes the swap. But it's just not working.

The body is stored in public var _body:b2Body; in the Player class.

The method I'm calling goes like this:

public function changeFixture():void {
    var newShape:b2CircleShape = new b2CircleShape(1);
    var myFixtureDef:b2FixtureDef = new b2FixtureDef();
    // Here I set density, friction, restitution, etc... Not important now...
    myFixtureDef.shape = newShape;

    _body.DestroyFixture(_oldFixture);
    _body.CreateFixture(myFixtureDef);

    // I know the method is called because this works
    trace('Yay! I'm working!');
}

What might be wrong?

sentences:
Handling different renderers Y axis direction in a single engine I have an engine that uses either three.js (3D WebGL rendering library) or pixi.js (2D rendering library) depending on the game.

The problem is that pixi.js has y-axis pointing downwards (same as in most 2D applications), while three.js has it up, like most 3D rendering systems.

I am wondering if there is a way to gracefully handle the difference in the engine, so that the user doesn't have to remember to invert everything depending on if they use 2D or 3D.

Are there any known solutions or engines doing something similar? My first guess would be trying to invert all coordinates, but this seems like an ugly hack that won't necessarily handle all situations.

sentences:
Efficient fog-of-war visibility searching Every game I look into that uses fog of war tends to have the AI ignore fog of war completely. I'm starting to see why.

I have a RTS game I'm working on, with lots of units moving around. All units are on a grid, and I use a predefined search pattern to scan the grid points around the unit to find the nearest target. So far so good.

However, I have another unit type who's job it is to run around the map and collect scrap from destroyed units. As with combat units, I want it to look around and select the closest scrap it can find. However, unlike combat units, this search isn't limited to it's own vision radius. It should be able to take advantage of the player's entire fog of war. If another unit or building has revealed some scrap, it should be available for the unit to go pick up.

While scanning the vision radius of a unit is simple, I'm having trouble thinking of an efficient way to determine which grid points to scan in this much larger case. Any grid points within view of a building will be fairly static, but things other units see will change every frame, as they are constantly moving.

The two options I see are to record per-player visibility flags within the grid points themselves, and then (somehow) update those flags each frame, or to just loop through all units and buildings and perform individual searches to build a list of visible scrap. The first would be difficult to keep updated without re-scanning the entire map, and the second would be very redundant if there were many units or buildings in a small area.

Is there another method I could use to build a list of visible scrap within a player's entire fog of war view, given that that view is constantly changing?

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:
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:
3D rotation matrices deform object while rotating I'm writing a small 3D renderer (using an orthographic projection right now).

I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain angles.

Here's a live demo (only tested in Google Chrome):
http://dl.dropbox.com/u/109400107/3D/index.html

The box is viewed from the top along the Y axis and is rotating around the X and Z axis.

These are my 3 rotation matrices (Only rX and rZ are being used):

var rX = new Matrix([
        [1, 0, 0],
        [0, Math.cos(radiants), -Math.sin(radiants)],
        [0, Math.sin(radiants), Math.cos(radiants)]
    ]);

    var rY = new Matrix([
        [Math.cos(radiants), 0, Math.sin(radiants)],
        [0, 1, 0],
        [-Math.sin(radiants), 0, Math.cos(radiants)]
    ]);

    var rZ = new Matrix([
        [Math.cos(radiants), -Math.sin(radiants), 0],
        [Math.sin(radiants), Math.cos(radiants), 0],
        [0, 0, 1]
    ]);

Before projecting the verticies I multiply them by rZ and rX like so:

vert1.multiply(rZ);
vert1.multiply(rX);

vert2.multiply(rZ);
vert2.multiply(rX);

vert3.multiply(rZ);
vert3.multiply(rX);

The projection itself looks like this:

bX = (pos.x + (vert1.x*scale));
bY = (pos.y + (vert1.z*scale));

Where "pos.x" and "pos.y" is an offset for centering the box on the screen.

I just can't seem to find a solution to this and I'm still relativly new to working with Matricies.

You can view the source-code of the demo page if you want to see the whole thing.

sentences:
Raymarching on a Hi-Z buffer in GLSL So I'm trying to implement Screen Space Reflections using a Hierarchical z-Buffer in GLSL. I'm following the approach from GPU Gems 5 and the Frostbite presentation linked here ("Stochastic Screen-Space Reflections", Slide 36+).

I believe I have a fundamental misunderstanding how the algorithm works, however there are not many information about this algorithm, besides of the resources I linked.

My current GLSL code looks like this:

vec3 trace_ray(vec3 ray_start, vec3 ray_dir)
{

    ray_dir = normalize(ray_dir);
    ivec2 work_size = SCREEN_SIZE_INT;
    const int loop_max = 250;
    int mipmap = 0;
    int max_iter = loop_max;
    vec3 pos = ray_start;

    // Move pos by a small bias to avoid self-intersection
    pos += ray_dir * 0.004;
    float hit_bias = 0.002;

    while (mipmap > -1 && max_iter --> 0)
    {

        // Check if we are out of screen bounds, if so, return
        if (pos.x < 0.0 || pos.y < 0.0 || pos.x > 1.0 || pos.y > 1.0 || pos.z < 0.0 || pos.z > 1.0)
        {
            return vec3(0,0,0);
        }

        // Compute the fractional part of the coordinate (scaled by the working size)
        // so the values will be between 0.0 and 1.0
        vec2 fract_coord = mod(pos.xy * work_size, 1.0);

        // Modify fract coord based on which direction we are stepping in.
        // Fract coord now contains the percentage how far we moved already in
        // the current cell in each direction.
        fract_coord.x = ray_dir.x > 0.0 ? fract_coord.x : 1.0 - fract_coord.x;
        fract_coord.y = ray_dir.y > 0.0 ? fract_coord.y : 1.0 - fract_coord.y;

        // Compute maximum k for which the ray would still be inside of the cell.
        float max_k_x = (1.0 / ray_dir.x) / work_size.x;
        float max_k_y = (1.0 / ray_dir.y) / work_size.y;

        // Scale the maximum k by the percentage we already processed in the current cell,
        // since e.g. if we already moved 50%, we can only move another 50%.
        max_k_x *= 1.0 - fract_coord.x;
        max_k_y *= 1.0 - fract_coord.y;

        // The maximum k is the minimum of the both sub-k's since if once maximum
        // is reached, the ray is out of the cell
        float max_k = min(abs(max_k_x), abs(max_k_y) );

        // Fetch the current minimum cell plane height
        float cell_z = textureLod(DownscaledDepth, pos.xy, mipmap).x;

        // Check if the ray intersects with the cell plane. We have the following
        // equation:
        // pos.z + k * ray_dir.z = cell.z
        // So k is:
        float k = (cell_z - pos.z) / ray_dir.z;

        // Check if we intersected the cell
        if (k > 0.0 && k < max_k + hit_bias )
        {
            // Move to point of intersection
            pos += k * ray_dir;

            // In case we are at mipmap level 0, we found a match
            if (mipmap == 0) {
                return pos;
            }

            // If we hit anything at a higher mipmap, step up to a higher detailed
            // mipmap:
            mipmap -= 2;
            work_size *= 4;
        }

        // If we hit nothing, move to the next cell, with a small bias
        pos += max_k * ray_dir * 1.02;

        mipmap += 1;
        work_size /= 2;

    }
    return vec3(0);
}

And the result is:

So I'm doing something wrong, its probably not much since the result is not completely off, however, I cannot figure out what I'm doing wrong.

TL;DR: Am I either misunderstanding how the Algorithm works, or if not, what am I missing or doing wrong in my code?

sentences:
libGDX - How to rotate with a specific duration I want to rotate my player to 90° for a specific duration. I know scene2d provides this, but I don't want to use it for my players.

With how much to rotate every frame, so after x seconds the rotation is finished? The game can run on different FPS also.

sentences:
How might I eliminate asymmetrical gameplay caused by turn order? I'm designing a turn based game in which players profit from buying, transporting, and selling resources. Each turn, the map has to produce a certain number of resources and different locations, and resource prices have to be updated. Because of this, each round, after every player has taken their turn, the game state has to be updated; resources are consumed/produced, prices in each cell of the map need to be updated, etc. Originally, I was going to have a simple turn order, where each player took their turn, then the map is updated, then the cycle repeats in the same order. However, after a little bit of testing, it became clear that this gave a significant advantage to players who have their turn right after the map is updated. They're able to collect the newly produced resources before any one else has a chance to.

The easiest way I could think of to balance out the gameplay for all players is to randomize the turn order after each round. While this would give everyone a fair chance, I'm worried that this might be too big of a shift away from strategy and towards luck.

How might I eliminate asymmetrical gameplay caused by turn order?

sentences: Creating a Timer in C# Unity In my game I have watch video earn coins system, now I want to program a delay so the user cant watch the video every 5 seconds, for example I want to let him watch every 6 hours, but I'm not sure how can I do that, how can I program a timer that will count down even if the app is closed or how does this kind of timer work, I mean everyone saw this in many games where they count down days or hours until some gift or something. Any help is appreciated.

sentences:
Storing large amounts of voxels in file I'm making a game similar to Dwarf Fortress and I've run into a large problem from the start. How can you store such a large amount of land on disk. With every voxel holding an integer with the 28 MSB representing its type and the 8 LSB having flags like transparency or if it can be walked through a world similar to dwarf fortress would take up almost 18 000 GB. chunks(16 X 16 X 256 voxels) regions(64 X 64 chunks) and world(128 X 128 regions).

I know about Run Length Encoding which could save a lot of memory but its unpredictable because I don't know how many different block types there will be. However it will definitely use less memory so I will use it. I also thought that if I use Perlin Noise for everything I could regenerate everything from scratch if the player came close and only store the areas the player changed (and maybe towns because regenerating them could be time consuming) so I could definitely save a lot of memory there.

I read that Dwarf Fortress doesn't use Perlin Noise or anything like that, and it seems that it generates the whole map at once and saves it with data like erosion from rivers. Can anyone suggest another method that I could use to store a map as much expansive as the one in dwarf fortress?

Ok so it thought of a way to store rivers erosion, as a heightmap of subtractions to the terrain height and only store the heightmap of chunks that have rivers and also use run length encoding, then generate everything else that the player didn't change each time.

sentences:
Intersection points of plane set forming convex hull Mostly looking for a nudge in the right direction here. Given a set of planes (defined as a normal and distance from origin) that form a convex hull, I would like to find the intersection points that form the corners of that hull. More directly, I'm looking for a way to generate a point cloud appropriate to provide to Bullet.

Bonus points if someone knows of a way I could give bullet the plane list directly, since I somewhat suspect that's what it's building on the backend anyway.

sentences: Is 1 pixel of a height map representative of 1 vertex on the mesh? I'm trying to get my head around heightmap terrain generation. If I have a plane say 64 x 64 verts will I need to create a 64px by 64px greyscale heightmap in order to displace the geometry of the plane correctly?

sentences:
Reading a text file and changing each digit into a value inside an array c# I'm having a bit of an ordeal with the StreamReader.

I'm working on a game where you build the map with a 2D array by imputing different numbers so the array like this:

    int[,] map = new int[,]
    {
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,1,1,1,1,1,2,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,1,1,1,1,1,1,1,1,1,1,1,1,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    };

will give you the outcome where the 0's are one type of block and the 1's another and so on.

I currently have that working, however the array is hardcoded in.

What I am now trying to solve is how to read it from a text file. I attempted doing it in a Console Application with this code but I keep on receiving errors.

    static void Main(string[] args)
    {
        int[,] map = new int[300, 300];

        StreamReader SR = new StreamReader(@"F:\test.txt");

        for (int y = 0; y < 300; y++)
        {
            for (int x = 0; x < 300; x++)
            {
                map[y, x] = int.Parse(SR.ReadLine());
            }
        }
        SR.Close();

        for (int y = 0; y < 300; y++)
        {
            for (int x = 0; x < 300; x++)
            {
                Console.Write(map[y, x]);
            }
        }
        Console.ReadLine();
    }

Any idea how I can make it work for a 2D array so that whenever the compiler reads a digit, it allocates a number into a specific area in the array, so for example when a file like this is read:

11111
10001
10001
10001
10001
11111

It will turn into an array like this:

1,1,1,1,1
1,0,0,0,1
1,0,0,0,1
1,0,0,0,1
1,0,0,0,1
1,1,1,1,1

Thanks for any help provided. :)

sentences:
Why do games have consumables? Thinking along the lines of this question, and the too awesome to use trope in general.  Why do game designers want to include consumable items in their games?

Mortal Kombat 11 got me thinking...  Why include consumables that give you an edge in battle at all?

I’m looking for concrete answers for what it is that consumables add to gameplay, whether it be about those that one can buy with real money, or those that you just get by playing the game, or whether they are available in limited or unlimited quantities.

sentences:
Libgdx, Gradle, android package naming problem I'm upgrading my libgdx project to make use of all the new Gradle stuff.

However I changed the package namespace from the default generated by gdx-setup but that hasn't worked: when I debug to my phone Gradle is still trying to launch the default activity using the old namespace, hence it fails. But I can't figure out where Gradle is getting this from - I've searched the entire folder tree for the offending old namespace string and can't find it anywhere.

Details:

So gdx-setup generated the android project with namespace "com.wibble.mygame.android"

To match the namespace of my already-published game, I edited that to "com.wibble.mygame_a". I did this in the Android.manifest and the source code. Also noticed that the android build.gradle file has a line that generates the am start command so corrected that as well.

But when I debug with my connected Android device, it tries to launch the app with a command like:

am start -n "com.wibble.mygame.android/com.wibble.mygame_a.AndroidLauncher"
   -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

the old namespace is still there but I can't figure out where its getting it from because I can't find any mention of 'mygame.android' anywhere in the whole project tree. Is there some cache of stuff hidden somewhere that I need to delete?

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:
Does interfacing not work as well when it comes to games development? I'm currently at the start of a project, and I'm following the wisdoms of my day-to-day career as a C# developer for large web applications.

Currently I have set up a bunch of interfaces. Notable of these are IActor, IHuman, ISelectable, IUIAction & IHealth.

I also have a Person class. Person implements IHuman (which implements IActor), ISelectable and IHealth and also inherits from MonoBehaviour.

ISelectable has a property of IEnumerable<IUIAction> Actions. Actions have a property of Action click. Im sure you can see where I am going with this...

The intended goal is that if a class inheriting from MonoBehaviour (person in this case) implements ISelectable and is attached to a GameObject that is clicked, a list of buttons representing ISelectable.Actions is displayed on the screen. If a class implements IHealth, a healthbar will be displayed on the screen etc etc...

Now, the problem I see is I'm going to end up with huge classes. The classes are going to need properties for their health, theyre going to need properties for their actions, theyre going to need properties for what the UI panels title should be when selected, and anything else that comes up as development progresses... My other thought is to remove the interfaces like IHealth from the class itself and have them be their own class, such that IHealth will only mean a class has a property that is of the class Health and Health has all the properties relating to an objects health levels... but this removes authority from the class as to what control it has over its health.

Whats the industry standard for this sort of thing, and how can I implement it effectively in my game?

sentences:
Generating mesh along path I'm currently trying to generate a path along an array of points (Vector3)
This is the result I'm currently getting:

The dark gray points are the given path
The red points are the generated vertices
And the triangles are obviously the mesh I failed to generate correctly

And from the bottom it looks like this, which is odd, because I'd expect all the missing triangles to be at the bottom. But some of them just don't exist:

here's the code i wrote that generates the path mesh

//Removed code since there's no need in showing something that doesn't work

And here's a quick example of what it looks like when I drag a path:

SOLUTION FOUND

As the accepted answer states, I was skipping triangles in my triangle for loop.
Here is my new working code:

public static Mesh extrudeAlongPath(Vector3[] points, float width){
    if (points.Length < 2)
        return null;
    Mesh m = new Mesh();
    List<Vector3> verts = new List<Vector3>();
    List<Vector3> norms = new List<Vector3>();

    for (int i = 0; i < points.Length; i++) {
        if(i != points.Length-1){
            Vector3 perpendicularDirection = new Vector3(-( points[i+1].z-points[i].z ), points[i].y, points[i+1].x -points[i].x).normalized;
            verts.Add (points[i]+perpendicularDirection*width);
            norms.Add (Vector3.up);
            verts.Add (points[i]+perpendicularDirection*-width);
            norms.Add (Vector3.up);
        }else{
            Vector3 perpendicularDirection = new Vector3(-( points[i].z-points[i-1].z ), points[i].y, points[i].x -points[i-1].x).normalized;
            verts.Add (points[i]+perpendicularDirection*-width);
            norms.Add (Vector3.up);
            verts.Add (points[i]+perpendicularDirection*width);
            norms.Add (Vector3.up);
        }
    }
    m.vertices = verts.ToArray ();
    m.normals = norms.ToArray ();

    List<int> tris = new List<int> ();
    //Changed i+=3 to i++
    for(int i = 0; i < m.vertices.Length-3; i++){
        if(i%2 == 0){
        tris.Add(i+2);
        tris.Add(i+1);
        tris.Add(i);
        }else{
            tris.Add(i);
            tris.Add(i+1);
            tris.Add(i+2);
        }
    }
    m.triangles = tris.ToArray ();

    m.name = "pathMesh";
    m.RecalculateNormals ();
    m.RecalculateBounds ();
    m.Optimize ();
    return m;
}

sentences:
Java: Basic Movement AI not working I am working on a basic AI system to get an entity to follow a player. I created both the player and the ghost entity, but it seems as if the ghost only wants to increment both x and y, it never wants to do the opposite, or choose only x or y to use. Here is where I implemented the ghost and player in my constructor:

public MansionAzazel() {
    ...
    TileCoordinate ghostSpawn = new TileCoordinate(52, 50);
    TileCoordinate playerSpawn = new TileCoordinate(54, 52);
    player = new Player(playerSpawn.x(), playerSpawn.y(), key);
    player.init(level);
    ghost = new Ghost(ghostSpawn.x(), ghostSpawn.y(), player);
    ghost.init(level);
    ...
}

Here is the update() function for the ghost:

public void update() {
    int xa = 0, ya = 0;
    if (anim < 1000000)
        anim++;
    else
        anim = 0;

    if (player.getX() > xa)
        xa++;
    if (player.getX() < xa)
        xa--;
    if (player.getY() > ya)
        ya++;
    if (player.getY() < ya)
        ya--;

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

In which to sum it all up, the ghost entity will only and always move in one direction because the coordinates are 0 and I don't know why.

sentences:
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:
How to display a hierarchical skill tree in php If I have skill data set up in a tree format (where earlier skills are prerequisites for later ones), how would I display it as a tree, using php?  The parent would be on top and have 3 children. Each of these children can then have one more child so its parent would be directly above it.

I'm having trouble figuring out how to add the root element in the middle of the top div, and the child of the children below each child of the root.  I'm not looking for code, but an explanation of how to do it. My data in array form is this:

Data:

Array
(
    [1] => Array
        (
            [id] => 1
            [title] => Jutsu
            [description] => Skill that makes you awesomer at using ninjutsu
            [tiers] => 1
            [prereq] =>
            [image] => images/skills/jutsu.png
            [children] => Array
                (
                    [2] => Array
                        (
                            [id] => 2
                            [title] => fireball
                            [description] => Increase your damage with fire jutsu and weapons
                            [tiers] => 5
                            [prereq] => 1
                            [image] => images/skills/fireball.png
                            [children] => Array
                                (
                                    [5] => Array
                                        (
                                            [id] => 5
                                            [title] => pin point
                                            [description] => Increases jutsu accuracy
                                            [tiers] => 5
                                            [prereq] => 2
                                            [image] => images/skills/pinpoint.png
                                        )

                                )

                        )

                    [3] => Array
                        (
                            [id] => 3
                            [title] => synergy
                            [description] => Reduce the amount of chakra needed to use ninjutsu
                            [tiers] => 1
                            [prereq] => 1
                            [image] => images/skills/synergy.png
                        )

                    [4] => Array
                        (
                            [id] => 4
                            [title] => ebb & flow
                            [description] => Increase the damage of water jutsu, water weapons, and reduce the damage of jutsu and weapons that use water element
                            [tiers] => 5
                            [prereq] => 1
                            [image] => images/skills/ebbandflow.png
                            [children] => Array
                                (
                                    [6] => Array
                                        (
                                            [id] => 6
                                            [title] => IQ
                                            [description] => Decrease the time it takes to learn a jutsu
                                            [tiers] => 5
                                            [prereq] => 4
                                            [image] => images/skills/iq.png
                                        )

                                )

                        )

                )

        )

)

An example would be this demo image minus the hover stuff.

sentences:
How do I rotate an object back and forth? I want my object to rotate between two angles in relation to speed and it doesn't need to be a smooth rotation, how can I achieve that?

Thank you in advance.

sentences:
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:
Get Text dimmensions on CCTextFieldTTF Hi I want to know the width of the text inside the CCTextFieldTTF but I can't find a way to do it, I want this width so I can move a CCLabelTTF in that position so it can be like a cursor for the CCTextFieldTTF

Thanks

sentences:
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:
Picking game entities What is the preferred methods for doing so, performance-wise?

For example I want to pick certain objects in an area around a given point.

What I have thought off so far is using invisible objects as extended hit detectors. Like creating a circle or square then have collision responses to them.

Or maybe just pass the entire object list and iterate on it, then using a distance/angle based condition.

sentences:
Raycast in Unity for ground detection returns false while touching ground I'm using a raycast to detect the player's distance to the ground for a hovercraft game.

The raycast works correctly (returns true and also returns the distance to the first impact) until the moment the craft actually touches the ground.  When the player hits the ground, the raycast should theoretically return true and return the distance as near 0f.  Instead, it returns false, meaning the raycast isn't colliding with anything over the length of the ray.  As a result, it can't find the distance.

I'm having a hard time troubleshooting this, and I wonder if anyone can lend a fresh pair of eyes.

Ray ray = new Ray (transform.position, Vector3.down);
RaycastHit ray_result;
bool hit_ground = Physics.Raycast (ray, out ray_result, optimal_vertical_distance * 2);
if (ray_result.distance < optimal_vertical_distance && vertical_force < max_vertical_force)
  {
  vertical_force += vertical_acceleration;
  }
if ((!hit_ground || ray_result.distance > optimal_vertical_distance) && vertical_force > min_vertical_force)
    {
    vertical_force -= vertical_acceleration;
    }
  }
body.AddForce (Vector3.up * vertical_force, ForceMode.Acceleration);

The only time hit_ground worked correctly was when I increased the thickness of the floor from 2 units to 4 units and set the ray to start from 2 units above the craft instead of from the craft itself.  I don't understand why it works, though.  However, in that example, ray_result.distance seems to be locked at -1.10999, regardless of how far away the craft is.

sentences:
Finding equivalent axial coordinates for a wrapping hexagonal map of radius n I'm creating a wrap around hexagonal map that will potentially render infinatly.

With the method I'm using, I have an x-y coordinate I use to find it's equivalent axial coordinate with the equations:
Q = (sqrt(3)/3 * x - 1./3 * y) / hexSize;
R = (2./3 * y) / hexSize;
the problem is, my map is of radius n and it's possible for the Q R coordinate to be far outside that radius. How can I find the equivalent Q-R coordinate within the radius n? I know methods for a single radius outside, but I'm talking the potential of having a radius of 15 but a Q-R something like (9999999,99999999). What would that coordinate be in relation to the center of the 15 radius hex region it'd be in?

sentences:
Isometric smooth fog I'm working on a simple 2d game with direct3d 9. It's a isometric game with diamond tiles and a staggered map. This is what I have:

As you see I have some kind of fog which is acomplished by having a fog matrix which is true  (clear terrain) or false (obscure terran). But the result is very chunky. The fog moves as the player moves by tiles but not by pixels. Basically I check for every tile if there is fog, if so I just change the color of that tile:

D3DCOLOR tile_color = 0xffffffff;
if(scene->fog[i+mapx][j+mapy] == FOG_NONE) { tile_color = 0x666666FF; }
g_pSprite->Draw(texTilesNew,&rect,NULL, &D3DXVECTOR3(pantx,panty,0.0f), tile_color);

Where parameter tile_color is:

  A Color structure. The color and alpha channels are modulated by this
  value. The Transparent value maintains the original source color and
  alpha data.

I also would like the fog to be smoother, for that I followed this "tutorial" but I haven't managed to work it it out becuase I think the tutorial implements a diferent kind of fog than I am.

http://www.appsizematters.com/2010/07/how-to-implement-a-fog-of-war-part-2-smooth/

sentences: How do I instantiate a prefab to a specific coordinate? I have a prefab called ‘road’.  How can I instantiate it (using C#) such that it appears initially at coordinates (5, 5, 5)?

sentences:
Handling non-automatable, repetitive, game tasks A problem I'm currently having with a project of mine is deciding how to handle repetitive, but important, in-game tasks.

As an example (Though there will be many other instances of this), earlier in the game, the player must smelt and shape iron without modern tools.
After iron ore has been smelted, it must be shaped into tools, this requires manual labor.

So how are some ways I could handle the shaping process (A repetitive, time consuming, task)?

Having the player sit in a GUI until the shaping process is complete is obviously not a great idea.

I don't want to make the process instant and simply rely on the speed of the smelting process to cull production, as the player could just utilize a huge number of furnaces to bypass that.

For other reasons, it would be incredibly difficult and time consuming to create a short mini-game for each of these situations.

Is there an easy way to solve this?

sentences:
What are the fundamentals of a Quad Billboarding effect? I'm taking my first venture in to writing a shader and what I really need to do is create a billboarding effect. A thorough Google search turns up a number of threads on the topic and they always end with

A) Figured it out. Thread closed.

B) Anyone?

C) "long language/system-specific answer without explanation"

Most commonly, people are directed to Riemers which is fine, except his code isn't compatible with XNA 4.0 (what I'm using) and he doesn't explain the shader itself.

Can anyone explain/direct-me-to a language/system agnostic answer of how quad billboarding works?

EDIT: For others so they don't need to dig through the comments: NtscCobalt pointed out that I was attempting to use an orthographic camera when applying the shader. This essentially voided some of the effects of the shader. After changing to a perspective-based cam, the shader worked as it should have.

sentences:
How can I design an effective game object interaction scheme with a component-based architecture? This is a design question... I'm sure this could be generalized more, but I'm having a hard time with it. I am wondering about design for game object interactions - here is my example (2D puzzle-platformer).

Say the player is trying to progress through a level. There are many lights that can be pointed in different directions. Here is an example of how these light objects might interact...

One light projects a platform that allows the player to cross a gap
One light decreases the friction coefficients of anything it touches, another increases it
One light nulls the effects of all lights, which would make the platform disappear while that light is on and null the friction modifiers
Etc...

What is the best way to approach this problem when using a component architecture? Components for each major object seem obvious, as well as a clean way to define their effects on the environment. A class to "resolve" interaction (seems like that could become a mess quickly)? Some usage of the decorator pattern to create combined objects for those that are interacting at a given time? A data structure that lends itself to this?

Also, connecting audio to these interactions? It seems like connecting audio to the system would be just like connecting any other property, like visibility or player movement/collision.

Obviously as more components are added it would be nice if there was a robust system that could handle new ones with little modification, but I am not familiar with how to go about designing this.

Other Information:
The engine I am using is an XNA engine called IceCream.

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:
Find position in arc depending on the direction of the agent So what I am trying to do is to find a random point on the (green") arc around the enemy:

Sorry for  the bad drawing but

Red (no go)
Green ( Points the allied can go to)

I know that unity has the following function:
Radius = 5;
_randomDirection = (Random.insideUnitCircle * _target.position).normalized;
Vector3 finalPosition = _target + _randomDirection + Radius;

However, this is for a full circle. How can I achieve the closest half circle?

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:
Primitives does not show on screen I'm trying to render terrain, everything compiles fine, but I can't see anything on screen. ( I'm moving camera around in case it was on the other side)

Can't figure out whats wrong.

public class Terrain
    {
        public VertexBuffer vertexBuffer;
        public IndexBuffer indexBuffer;
        public VertexPositionNormalTexture[] vertices;
        public int[] indices;
        //int gridSize;

        Camera camera;
        ContentManager Content;
        GraphicsDevice device;

        Texture2D heightmap;
        public Texture2D grass;

        Effect effect;

        public Terrain(ContentManager Content, GraphicsDevice device, Camera camera)
        {
            this.Content = Content;
            this.device = device;
            this.camera = camera;

            heightmap = Content.Load<Texture2D>("Gfx//heightmap");
            grass = Content.Load<Texture2D>("Gfx//grass");

            effect = Content.Load<Effect>("Effects//terrain");

            CreateVertices();
            CreateIndices();
        }

        public void Draw()
        {
            effect.CurrentTechnique = effect.Techniques["Texture1"];
            effect.Parameters["xWorldViewProjection"].SetValue(camera.worldMatrix * camera.viewMatrix * camera.projMatrix);
            effect.Parameters["xTexture"].SetValue(grass);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                device.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, indices.Length / 3);
            }
        }

        private void CreateVertices()
        {
            vertices = new VertexPositionNormalTexture[heightmap.Width * heightmap.Height];
            for (int x = 0; x < heightmap.Width; x++)
            {
                for (int y = 0; y < heightmap.Height; y++)
                {
                    vertices[y * heightmap.Width + x].Position = new Vector3(x, 0, y);
                    vertices[y * heightmap.Width + x].Normal = new Vector3(0, 1, 0);
                    vertices[y * heightmap.Width + x].TextureCoordinate = new Vector2(y, x);
                }
            }
            //device.SetVertexBuffer(vertexBuffer);
        }

        private void CreateIndices()
        {
            indices = new int[(heightmap.Width - 1) * (heightmap.Height - 1) * 6];
            int counter = 0;
            for (int x = 0; x < heightmap.Width - 1; x++)
            {
                for (int y = 0; y < heightmap.Height - 1; y++)
                {
                    int lowerLeft = x + y * heightmap.Width;
                    int lowerRight = (x + 1) + y * heightmap.Width;
                    int topLeft = x + (y + 1) * heightmap.Width;
                    int topRight = (x + 1) + (y + 1) * heightmap.Width;

                    indices[counter++] = topLeft;
                    indices[counter++] = lowerRight;
                    indices[counter++] = lowerLeft;

                    indices[counter++] = topLeft;
                    indices[counter++] = topRight;
                    indices[counter++] = lowerRight;
                }
            }
        }
    }

sentences:
How to map trapezoid image to rectangle cubemap face? I am writing a 360 video application on oculus mobile SDK. My video frame has a trapezoid region and I need to map it into a rectangle region.

In the above figure, trapezoid ABDC is part of my video frame. I need to map it into a rectangle A'B'D'C'. The rectangle is part of a face of a cube.

At the video frame generation side, the trapezoid region is generated from a rectangle region. The bigger side of the trapezoid (AC in the abovefigure) is same as the height of rectangle (side A'C') and smaller side of trapezoid (side BD) is smaller than the height of the rectangle. I know I am loosing some details in this process and I am fine with it.

At rendering side for mapping, I need to provide the region as combination of triangles. So I gave two triangles, ABC and CBD. But sice the triangle sizes are not equal, mapping was not proper. The triangle region CBD expands more compare to triangle region ABC.

I also tried drawing diagonals to trapezoid ABDC and mapped using four triangles. Even with that logic I observed same issue.

Update 1
Please refer to image3(https://i.stack.imgur.com/yRy9W.jpg) and image1(https://i.stack.imgur.com/dwOuI.jpg) of this question (https://stackoverflow.com/questions/15141039/transform-rectangle-to-trapezoid-for-perspective). Please note, in my application decoded image will be like image3 and I need to render it such that it appears like image1.

Can anyone suggest me the right way to map trapezoid to rectangle?

sentences:
Pathfollowing with acceleration - centripetal force I'm implementing A* waypoint pathfinding with some twists.
One of the problems I'm encountering is because I do not change velocities of the agents directly but rather I do so through forces.

Which gives me the following problem:
let's suppose the path consists of three nodes,

P0 = the starting position
P1 = node 1
P2 = node 2

When the agent starts moving, it's first target position is P1. The agents moves in that direction because I let a force F act on it's velocity: F=normalized(targetPos-agentPos)*agentAccel*agentMass;

The agent reaches P1.

Now the agent's target position is P2, and upon it will act a force in the direction of (targetPos-agentPos).

However, this is a centripetal force, meaning that the agent will most likely orbit around P2 instead of popping the next node off the path (unless the angle between [P0,P1] and [P1,P2] is small) Stopping the agent at each node is not an option (would look unnatural) What should really happen is the velocity of the agent gradually shifting towards 100% the direction of [targetPos-agentPos], and the velocity should be completely 'shifted' before a certain distance(dX) is laid off, starting from the previous node position

In order to solve this problem, only one parameter is adjustable:

F_dir: the direction of the force acting upon the agent, that's
supposed to lead the agent to the next node.

The values of the following parameters are known:

agentAcceleration (=the magnitude of the force vector)
agentVelocity
agentPosition
node positions
targetPosition (= the next node on the path)

I've been trying some different strategies with trial and error to prevent this, but it seemed rather messy, so my question is, what is a decent approach to this problem?

sentences:
Get perpendicular vector from another vector I should clarify that I understand there is an infinite amount of 'perpendicular' vectors in 3D space. I am creating an electricity effect, and to do this the ability to have any number of perpendicular vectors is a good thing. The hard part is how to select any random one of these vectors - how would I do that, given a base vector "direction" which has been normalised?

Keep in mind that I want the resultant vector to be random, not just always up and down on the y-axis or anything.

sentences:
Why does the debug say my assigned field "is never assigned to, and will always have its default value 'null'"? I have an itemData class that stores the data for a couple of items. It looks something like this:

public class ItemData : MonoBehaviour
{
    public List<Item> items;

    [SerializeField] private Sprite itemOneSprite, itemTwoSprite, itemThreeSprite;

    void Awake()
    {
        items = new List<Item>();

        Item itemOne = new Item(0, "Item 1", itemOneSprite);
        items.Add(itemOne);

        Item itemTwo = new Item(1, "Item 2", itemTwoSprite);
        items.Add(itemTwo);

        Item itemThree = new Item(2, "Item 3", itemThreeSprite);
        items.Add(itemThree);
    }
}

I get an error message for itemTwoSprite and itemThreeSprite, stating that they are null and will always be null:

  Field name of field is never assigned to, and will always have its default value 'null'

Oddly, when I check the inspector, those fields are not null. I have manually attached sprites to them. When I debug, I see that they are not null. I get something like "itemTwoSprite(UnityEngine.Sprite)". I can run the game, and things seem to work normally.

The order of the declared Sprite variables seems to be important, as well. For instance, if my line of code looked like Sprite itemTwoSprite, itemOneSprite, itemThreeSprite, then itemOneSprite and itemThreeSprite would bring up error messages. The first one declared seems to be unproblematic.

What could be causing the issue, and how do I fix it? I have isolated the problem into an empty project, and it still persists. The only other script is the item class. To reiterate, the error message does not prevent the game from running, but it pops up in the console from time to time, with the yellow exclamation mark.

sentences:
Permanently Sync a wiimote with a computer i have tried to look up many ways to sync up my wiimotes to my computer so that i can program games with it, but every time it only syncs them up temporarily, or if it says it can permanently sync it, it doesn't actually do it. it gets tiresome when i have to keep on reconnecting it every time i want to save battery life. how would i be able to sync up my wiimote to my computer so that if i turn off my wiimote, i can just hit any button and it will automatically sync it up?

Edit: I have looked here: http://wiibrew.org/wiki/Wiimote under Bluetooth pairing for some advice, but I have no idea how to export the char array to the window (i am using the standard pairing with a Bluetooth device, but instead of pairing without a code, i use the "enter device's pairing code" section. this should work, but I'm stuck at how to enter the weird characters that aren't on the keyboard).

sentences:
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:
How can I get my game to show up in the Games Explorer on Windows? I want to create an installer for a game which allows for an icon to be put in the Games Explorer for Vista and Windows 7.

I have created the GDF, then built the script for project and obtained the .h, .gdf and .rc files. But I can't compile (using Visual Studio 2010) the .rc file into an executable to be used after that in order to create the installer. I get the following error after I set the executable path:

  "Could not load file or assembly'Microsoft.VisualStudio.HpcDebugger.Impl, Version 10.0.0.0, Culture=neutral, PublickKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

Any ideas what I'm doing wrong?

sentences: Blending effect on textures Hi i am trying to build screen animation like flickering, interlace, color separation similar to old style malfunctioning Amiga screens. The intended effects are shown in this  video. I am using libgdx and I already discovered the universal tween engine, which helps a lot to build transitional animations, but how should I approach those blending effects, any suggestions? I will specify my question once I learned more about libgdx, but maybe you could give me some hints already. Thanks!

sentences:
Unity 2D UI Scrollview Stretch settings not staying So I'm trying to make a Scrollviewer and inside that will be aload of boxes stacked on top of each other (the boxes have information in them - like the boxes in this screenshot here but they will always be the same size).

My problem is that whenever (in Unity's UI) I set where the Text UIs (in-game) should be, they will revert to some random place whenever I start the game.

For example: I set the X: 0 Y: 50, start the game changes are made and it looks right. But when I exit game mode the X: Some random number between 0-1000 Y: Also the same, some random number between 0-100.

Anyone know why this is happening?

sentences:
How are methods like Awake, Start, and Update called in Unity? I'm developing with Unity 5 and I know that there are some methods you can use like in the code below:

public class MyGameElement : MonoBehaviour
{
    private void Awake() { }
    private void Start() { }
    private void Update() { }
    private void FixedUpdate() { }
    // and more
}

I know what they do but I find it strange that the methods can be private. However they are not called into my code I've written. Here you've an image with code lens (I use VS 2015 Professional for coding) where you can really see that it has zero references.

The second 'strange' thing for me is that the methods aren't overwritten.

So my question is now is there anything that Unity has implemented into the MonoBehaviour class that the methods can call?

sentences:
How to get which gameobject the mouse is over in Unity? So I'm working on a simple drag-n-drop based trading card game for my own amusement.

There is a card inspector included.

What I want to achieve is to change values in the inspector (which has its own Inspector.cs, so I would change the variables in it) based on which card I hover over with my mouse.

Each card has its own Card.cs attached from which I want to read the values of the current card.

If I try to do this from within the Inspector.cs by something like this: Name.text = gameobject.GetComponent<Card>().Name;, then obviously it won't work, because using gameobject in the current context is not valid.

So solution No1 would be to properly reference the gameobject over which the mouse is, which I don't know how to do.

When I try to do the same from within Card.cs, I cannot use an event trigger OnPointerEnter and run the code through that, because I have to have a reference to the gameobject that contains that function. ( And I cannot do that in a prefab, only in gameobject already existing in the level.)

So could anyone tell me how I could achieve what I want, please?

sentences: Converting Cube Maps I have cube maps in lat/long format, and i need to convert them to Horizontal/Vertical Cross, and individual cross images, is there an utility to do that?

sentences:
Failing to move exponential depth term to depth shader in exponential shadow mapping I'm playing around in my little toy project to see if I can understand how exponential shadow mapping works. To begin, I have the following two fragment shaders:

Light depth texture shader

layout(location = 0) out float fragmentdepth;

void main(){
  fragmentdepth = gl_FragCoord.z;
}

Main shader

...
vec3 shadowDiv = shadowCoords.xyz / shadowCoords.w;
float lightDepth = texture(depthMap, shadowDiv.xy);
float visibility = clamp(exp(-70 * shadowDiv.z) * exp(70 * lightDepth), 0, 1);
...

This works fine - I have shadows where I expect them, and I'm using the approximation to the boolean function by taking the product of exponentials, as shown in the ESM paper.

However, my understanding is that the whole point of this, is that I can move exp(70 * lightDepth) out of this shader, and into the shader when I generate the depth texture at the light. That is:

New light depth texture shader

layout(location = 0) out float fragmentdepth;

void main(){
  fragmentdepth = exp(70 * gl_FragCoord.z);
}

Main shader

...
vec3 shadowDiv = shadowCoords.xyz / shadowCoords.w;
float lightDepth = texture(depthMap, shadowDiv.xy);
float visibility = clamp(exp(-70 * shadowDiv.z) * lightDepth, 0, 1);
...

When I make this change, the entire scene becomes shadowed. I'm sure I'm misunderstanding something somewhere, but I'm not sure where. I have tried varying the constant term (70) between 1 and 70, though this doesn't appear to make a difference. I have no errors reported by KHR_debug

I am creating my light depth texture as:

genLightDepthMap :: IO GLTextureObject
genLightDepthMap =
  do lightDepthMap <- overPtr (glGenTextures 1)
     glBindTexture GL_TEXTURE_2D lightDepthMap
     glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR
     glTexParameteri GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR
     glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP_TO_EDGE
     glTexParameteri GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP_TO_EDGE
     glTexImage2D GL_TEXTURE_2D
                  0
                  GL_DEPTH_COMPONENT24
                  shadowMapResolution
                  shadowMapResolution
                  0
                  GL_DEPTH_COMPONENT
                  GL_FLOAT
                  nullPtr

sentences:
How to handle re-rendering a scene in my custom game engine? I have a very simple game engine. A GameObjectManager stores a collection of all the GameObjects. When I want to render, I just call GameObjectManager.render() from the rendering context.

This works well for rendering most objects, but now I am looking to add a water shader to the scene where it takes in reflection and refraction textures. The reflection and refraction textures will be computed each frame by re-rendering the scene from a new perspective. Unfortunately, my design choice of having a single GameObjectManager to store all GameObjects just won't work for this - it wouldn't make sense to store a GameObject for the water in the GameObjectManager.

What is a good game engine design pattern to handle re-rendering the scene for an effect such as a reflection?

sentences:
Understanding marching cubes and voxel data relationships in case it matters i'm doing all this in unity with C# ...

I think I missed something or maybe don't understand the logic correctly.
I have an existing voxel engine that looks very "minecrafty" at the moment, and I want to step it up a bit so it actually looks reasonably good!

So lets say I have a "chunk", and common sense says that a chunk can either be on or off in a voxel world so its basically a "point cloud" (you either render it or you dont).
This means my game engine has something like this ...

public class Chunk
{
    public Block[,,] Blocks;
    ... other stuff
}

public class Block
{
    public bool Active;
    ... other stuff
}

So bring in the marching cubes and part 1 of Paul Bourke's guide (http://paulbourke.net/geometry/polygonise/) says ....

  The first part of the algorithm uses a table (edgeTable) which maps
  the vertices under the isosurface to the intersecting edges. An 8 bit
  index is formed where each bit corresponds to a vertex.

   cubeindex = 0;
   if (grid.val[0] < isolevel) cubeindex |= 1;
   if (grid.val[1] < isolevel) cubeindex |= 2;
   if (grid.val[2] < isolevel) cubeindex |= 4;
   if (grid.val[3] < isolevel) cubeindex |= 8;
   if (grid.val[4] < isolevel) cubeindex |= 16;
   if (grid.val[5] < isolevel) cubeindex |= 32;
   if (grid.val[6] < isolevel) cubeindex |= 64;
   if (grid.val[7] < isolevel) cubeindex |= 128;

Now here's what throws me ...
I'm comparing my "grid data" (so basically my block data) to some "isolevel" value.
Every implementation i've seen (the easiest being here: http://nucleardevs.wordpress.com/2011/11/17/marching-cubes-sourcecode/) does exactly that but it creates a load of float values using something like simplex or perlin noise and runs through this logic.

floats? not bools?

So ...

Given a Block[,,] if i check each blocks state (Active property) and return a simple true or false ... why do i need a float / double value or should I say ... what is the purpose of the float value that requires it to be a float and not a simple boolean?

I gather they are referred to as "densities" which implies that I missed something because i've been thinking of them as the point cloud data to be evaluated and a voxel (to my knowledge) isn't a "density" value its more like a switch (on off).

sentences:
Is there an existing algorithm to find suitable locations to place a town on a heightmap? I've been experimenting with random generation of a "map" with the intention of building a basic sort of procedural map generator. Generating a reasonable heightmap using libnoise hasn't been that much of an issue.

I am considering using A* or similar to plot two main "roads" across the terrain from top to bottom and left to right, intersecting in the middle of a town in some relatively flat section of the terrain.

I am unsure of the best way to go about locating the optimal point to place the town though. I created a "steepness" map as another map which looks at the points surrounding each point on the heightmap to determine the steepness and then sets 1 if steep and 0 if not to create a "mask" of steep and flat areas.

How then could I determine the largest rectangle area that will fit within those flat areas?

Or perhaps I need to re-look at this a different way and place the "town" first then build the terrain around it rather than trying to place it into an existing terrain.

sentences:
Map coordinates to camera coordinates I have a tiled map which is 3 times higher than camera. When I press on a tile, I want an actor on that tile to show up. This works if camera is not moved. If I move camera a little bit up, so the tile coordinates are greater then camera coordinates, actor is placed offscreen. Is there a way to get tile coordinates so they wil fit the camera coordinates

Im using libgdx if it helps.

sentences:
Are there well-known algorithms for fitting a polygon to an arbitrary shape? I'm using the Chipmunk physics engine to make the levels for a 2D C game.  I'd like to be able to fit a polygon to an arbitrary shape to serve as the collision mask.  Given a black and white collision mask for an arbitrary level object like this:

Are there any well-known algorithms for getting this:

I could then use the red polygon to create a physics object to go with the image.

sentences:
Why does my vertex shader produce no output until I add some arbitrary value to the position attribute? I want to draw a textured quad but there is nothing drawn and the setup should be right.
This is my vertex shader:

#version 330

in vec2 position;
in vec2 texel;

out vec2 texCoord;

void main() {
    texCoord = texel;
    gl_Position = vec4(position, 0.0, 1.0);
}

This code is producing no output on screen. Now comes the crazy stuff. If I add the following,

#version 330

in vec2 position;
in vec2 texel;
in vec2 foo;

out vec2 texCoord;

void main() {
    texCoord = texel;
    gl_Position = vec4(position + foo, 0.0, 1.0);
}

everything is as it should be.

I am pretty sure that my setup is correct. I have checked the values of the vertex attributes by passing them as texCoord instead of the uv coordinates, and assigning them to my fragment color output in the fragment shader. In both cases this produces the expected color gradient. The extra uninitialized attribute foo must be zero, because its rendered as the vertex color.

So the thing is, nothing is drawn unless I add an vertex attribute to position. It doesn't matter if I add texel or the mysterious, uninitialized vertex attribute. The output is the same.

update:

glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), sizeof(glm::vec2);

This is my vertex struct:

struct Vertex {
    glm::vec3 pos;
    glm::vec2 tex;
    glm::vec3 normal;
    Vertex(const glm::vec3& _pos,const glm::vec2& _tex,const glm::vec3& _normal):
    pos(_pos),tex(_tex),normal(_normal){}
    Vertex(const Vertex&)=default;
    Vertex& operator=(const Vertex&)=default;
};

The buffer is correct. I have mapped the vertex buffer and put it on the standard output.
All numbers are correct.

sentences:
How can I solve the problem of attacking being disadvantageous in TBS due to entering the range of enemy attacks? I noticed this thing in Age of Wonders I some time ago, but I can imagine this problem popping up in any other game system where units with equal attack range spend their move points on either moving in range or attacking.

In this game, both sides start far away from each other, not being able to hit each other. They have to spend a couple of turns advancing. At some moment it happens that one player moves their units closer to the enemy units to be able to attack them, but also ends up in the opponent's attacks' range, getting damaged before being able to attack themself. Not very good!

Sometimes it is acceptable and intended, like if I attack an army of cavalry with an army of archers, my opponent is essentially allowed a free attack because cavalry can usually move further than archer's shooting range. But if both armies have equal ranges, the game can turn into a stalemate, because nobody wants to move forward and be hit first. Getting the first strike is so important that it overshadows a strong unit stats advantage.

Even the AI knows to abuse it, waiting for an infinite amount of time before the player attacks. While it is easy to counter this as a player against AI by flanking the enemy ranks in such a way that only one of their units gets in range of many my units and the enemy is forced to advance, a real player could just back off with this unit and wait for me to fully advance, getting hit severely and likely even losing my upper hand if I had one.

Thus, it feels like an example of very bad design. How do I design TBS combat in a similar system so that it is not completely disadvantageous to move in and attack unless you have a range advantage?

The only possible solution that I see is making the ranges more different, so it is less probable to see units with similar attack ranges, but even in that case such a situation r still not impossible. I am sure that some more elegant solutions exist. So, what are they?

sentences:
Direct3D 12 can't create a swap chain I'm learning DirectX12 and I'm trying to create a simple application that clears the screen with a solid color, but I'm stuck in Direct3D initialization. I can't create the swap chain and the DXGI factory returns a nullptr. This is my initialization code:

bool Game::InitializeD3D()
{
ID3D12Debug *debug;
D3D12GetDebugInterface(IID_PPV_ARGS(&debug));
debug->EnableDebugLayer();

// hardware result returned by functions
HRESULT hr;

// create device
hr = D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&mDevice));
if (FAILED(hr))
    MessageBox(0, L"device creation failed", L"error", MB_OK);

// create fence
mDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&mFence));

// query descriptor size
mRTVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
mDSVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
mCBVSRVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);

// check for 4X MSAA quality level support
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS MSAAQuality;
MSAAQuality.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
MSAAQuality.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE;
MSAAQuality.NumQualityLevels = 0;
MSAAQuality.SampleCount = 4;
mDevice->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &MSAAQuality, sizeof MSAAQuality);
mMSAAQualityLevels = MSAAQuality.NumQualityLevels;

// create command queue
D3D12_COMMAND_QUEUE_DESC commandQueueDesc = {};
commandQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
commandQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
hr = mDevice->CreateCommandQueue(&commandQueueDesc, IID_PPV_ARGS(&mCommandQueue));
if (FAILED(hr))
    MessageBox(0, L"command queue creation failed", L"Error", MB_OK);

// create command allocator
mDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&mCommandAllocator));

// create main command list
mDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, mCommandAllocator, nullptr, IID_PPV_ARGS(&mCommandList));
static_cast<ID3D12GraphicsCommandList*>(mCommandList)->Close();

// create the swap chain
DXGI_MODE_DESC mode = {};
mode.Width = mWindowWidth;
mode.Height = mWindowHeight;
mode.Format = mBackBufferFormat;
mode.RefreshRate.Numerator = 60;  // 60 Hz refresh rate
mode.RefreshRate.Denominator = 1;
mode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
mode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
swapChainDesc.BufferCount = bufferCount; // double buffering
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferDesc = mode;
swapChainDesc.OutputWindow = mWindow;
swapChainDesc.SampleDesc.Count = 4; // 4X MSAA
swapChainDesc.SampleDesc.Quality = mMSAAQualityLevels - 1;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.Windowed = true;
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

hr = CreateDXGIFactory1(IID_PPV_ARGS(&mFactory));
if (FAILED(hr))
    MessageBox(0, L"factory creation failed", L"Error", MB_OK);

hr = mFactory->CreateSwapChain(mCommandQueue, &swapChainDesc, &mSwapChain);
if (FAILED(hr))
    MessageBox(0, L"swap chain creation failed", L"Error", MB_OK);

// more init code
......

My main window is created and the message box appears saying that the swap chain creation failed and Visual Studio raises an access violation exception.
What am I doing wrong?

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:
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:
How to decide whether a Buff should be a component or a Buff object in an ECS? I'm developing a top-down 2D game in Javascript using an Entity-Component-System architecture and I'm struggling with the question of exactly how to implement temporary buffs / permanent passives.
For example, let's say we want to give some entities Regeneration, such that they regenerate 5 health per second.
One option is to have a BuffsComponent that holds a list of all active buffs. You could create a RegenerationBuff object that inherits from some base Buff class, and then stick that in a list inside the BuffsComponent. Then a BuffsSystem would query all entities with a BuffsComponent every frame, and execute the active effect on each buff. Simple.
However, could you not argue that these effects could just be regular old components? That is, why not create a Regeneration component and then have a system that queries for all entities with a Regeneration component, and then update their health in that system?
Each approach seems to have its own pros and cons, and I'm not sure if I should have a mix of the two, or fully commit to one. I feel like fully committing to one approach would simplify the architecture and design of the program, so I'm leaning towards that, but I'm not sure which approach to pick. Even if I did have a mix, I'm not sure how to decide on what should be a component versus what should be a buff.
The first approach seems more computationally efficient I suppose? Because one potential implementation of such could involve you just iterating through the list of active buffs and calling execute on each one. However, I feel that while it may be more efficient, it may also be less powerful, because with the second solution I can directly query entities with certain buffs, so I could potentially have more complex interactions between entities based on who is holding which buffs. For example, with a Flight buff I would likely desire the ability to directly query entities with such a buff, so the latter solution would be preferable.
However, besides the latter solution being potentially slower, it also seems like it could get a bit out of hand. What if I ended up having over 100 different buffs? Adding and removing components to entities is O(1) with my ECS library, but still, it sounds like it could be a bit ridiculous to have hundreds of components for an entity, most of which are just random buffs / passives.
What should I do?

sentences:
How should I structure the implementation of turn-based board game rules? I'm trying to create a turn-based strategy game on a tilemap.

I'm using design by component so far, but I can't find a nice way to fit components into the part I want to ask.

I'm struggling with the "game rules" logic. That is, the code that displays the menu, allows the player to select units, and command them, then tells the unit game objects what to do given the player input. The best way I could thing of handling this was using a big state machine, so everything that could be done in a "turn" is handled by this state machine, and the update code of this state machine does different things depending on the state.

However, this approach leads to a large amount of code (anything not model-related) going into a big class. Of course I can subdivide this big class into more classes, but it doesn't feel modular and upgradable enough. I'd like to know of better systems to handle this in order to be able to upgrade the game with new rules without having a monstruous if/else chain (or switch / case, for that matter).

Any ideas? What specific design pattern other than MVC should I be using?

sentences: How to calculate a 3x3 rotation matrix from 2 direction vectors? I've got 2 direction vectors, for the X axis and the Y axis of the object. How do I calculate the rotation matrix of the object using these?

sentences:
How to layer two textures in a cylinder without Z-fighting? In the documentation of ShaderLab culling and depth testing you have the following:

Offset

Offset Factor, Units

Allows you specify a depth offset with two parameters. factor and units. Factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scale the minimum resolvable depth buffer value. This allows you to force one polygon to be drawn on top of another although they are actually in the same position. For example Offset 0, -1 pulls the polygon closer to the camera
ignoring the polygon’s slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle.

I have the following scenery, it's two cylinders of the same size, one being the sky, one being the horizon on the floor, it is shown exactly how it is expected to render:

This is how it actually looks without playing with the offset factor and units, lots of Z-fighting:

I had to put a fairly high value to Factor so Z-fighting stops, around 15.
And setting the value of Units has absolutely no effect.
So I'm a bit at a loss as on how to correctly use both of these parameters.
Question:
Can you explain how shall one understand the meaning and correctly use Factor and Units?

sentences:
Custom build failure callback I've been working on some custom build scripts, which will manipulate the references of certain MonoBehaviours.

I'm using IPreprocessBuildWithReport to do the manipulation, and I want to reset the references when the build completes. Even if the build fails, I want to do the operation, but I want to do some additional stuff if it fails. I'm also using IPostprocessBuildWithReport and IProcessSceneWithReport as well.

I've tried putting a Debug.Log in OnProcessScene and OnPostProcessBuild. I'm building without JAVA path defined, for Android, or without the Keystore password, which fails the build. The IPreprocessBuildWithReport correctly prints the Debug, but the others don't.

Is there any class or interface which has a callback for Build Failure which I can use? I've tried to get the summary from the BuildReport in OnPreprocessBuild, but the result is always returning Unknown.

Edit: I would also like to make the same changes if the Build was cancelled, rather than just if it was failing.

Platforms: Windows, Android

Unity 2019.3.7f1

sentences:
Jittery Movement, Uncontrollably Rotating + Front of Sprite? So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math.

Now I'd like it to rotate and face the mouse as it moves. From what I've found this calculation seems to be what keeps reappearing:

Sprite Rotation = Atan2(Direction Vectors Y Position, Direction Vectors X Position)

I express it like so:

sp.Rotation = (float)Math.Atan2(directionV.Y, directionV.X);

If I just go with the above, the sprite seems to jitter left and right ever so slightly but never rotate out of that position. Seeing as Atan2 returns the rotation in radians I found another piece of calculation to add to the above which turns it into degrees:

sp.Rotation = (float)Math.Atan2(directionV.Y, directionV.X) * 180 / PI;

Now the sprite rotates. Problem is that it spins uncontrollably the closer it comes to the mouse. One of the problems with the above calculation is that it assumes that +y goes up rather than down on the screen. As I recorded in these two videos, the first part is the slightly jittery movement (A lot more visible when not recording) and then with the added rotation:

Jittery Movement

So my questions are:

How do I fix that weird Jittery movement when the sprite stands
still? Some have suggested to make some kind of "snap" where I set
the position of the sprite directly to the mouse position when it's
really close. But no matter what I do the snapping is noticeable.
How do I make the sprite stop spinning uncontrollably?
Is it possible to simply define the front of the sprite and use that to make it "face" the right way?

sentences:
How do I align the cube in which shadows are computed with the view frustrum? ("View Space aligned frustum") Short and concise:

Given 8 world space positions that form a cube of arbitrary size, position and orientation and given an arbitrary light direction.

How do I compute the View and Projection matrix for a directional light, such that the shadows are computed in exactly and only this cube?

Edit: Clarification: I want to create Shadow Maps, in the way, that Crytek calls "View Space aligned" (http://www.crytek.com/download/Playing%20with%20Real-Time%20Shadows.pdf page 54-55), so I want that the cube in which shadows are computed is aligned with the view frustrum. How do I achieve that, when I have already have the 8 world space positions of a cube, around the view frustrum?

sentences:
why doesnt this function work? glsl opengl c++ Im trying to move a transformation matrix onto the gpu, and I managed to find this code to help me on the way:

vertex.shader:

#version 410 core
layout ( location = 0 ) in vec3 vertex_position ;

mat4 rotationMatrix(vec3 axis, float angle)
{
    axis = normalize(axis);
    float s = sin(angle);
    float c = cos(angle);
    float oc = 1.0 - c;

return mat4(oc * axis.x * axis.x + c,           oc * axis.x * axis.y - axis.z * s,  oc * axis.z * axis.x + axis.y * s,  0.0,
            oc * axis.x * axis.y + axis.z * s,  oc * axis.y * axis.y + c,           oc * axis.y * axis.z - axis.x * s,  0.0,
            oc * axis.z * axis.x - axis.y * s,  oc * axis.y * axis.z + axis.x * s,  oc * axis.z * axis.z + c,           0.0,
            0.0,                                0.0,                                0.0,                                1.0);
}

void main()
{

gl_Position=rotationMatrix(vertex_position,45.0);

}

However, this gives errorc1035: assignment of incompatible types. Shouldnt this work? What am I missing

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:
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:
Cross-platform, free (for commercial use) C/C++ 2d game library or rendering engine? I need a C/C++ engine that should be really cross platform (or at least windows, android, and iphone).

The 2d engine should be written in C or (better) C++, should permit the rendering of animated sprites, permit transparency, collisions (but I can integrate box2d for that), rotations (eventually with opengl support to accelerate things), handle tile-based games. If it could be a game engine (with support for events/actions, scripting and generally have the features needed when developing a 2D game) it would be fantastic.

There are a lot of open source free 2d engine out there, but soon or later you find that:

the documentation is not so good and/or the tutorials are not so good (or there are no tutorial at all), the examples are missing (or are too few or are missing)
the community is too small and not so supportive
the engine doesn't abstract system things enough. That is bad, because you
soon find out that there is support for X and Y but not Z. With abstraction, you can use even Z adding system specific code
the engine is a game engine but does not have an associated editor. scripting is good, but an editor would save a lot of time I think
the engine writers have spent too much time to develop a complex (that will probably fails) compilation tools.

It would be useful to have something that:

#define WIN_PLATFORM
#define IOS_PLATFORM
#define ANDROID_PLATFORM
#define UNKNOWN_PLATFORM

In that way, using an empty implementation of the relevant interfaces, you
can simply code what you need

6 . You come to the conclusion that usually there is not a sufficient conceptual separation from what really needs to be abstracted and what can be supposed to be found on almost all systems (e.g. opengl).

Ok. The question is, regarding a free, open source 2D rendering engine or a 2D rendering engine+2D game engine for at least iOS and Android: in your experience, what would be a good/wise choice?

sentences:
Box2D Weird collision behavior I'll let the gif speak first.

As you can see, the small cube just kinda floats there like it has a forcefield. This weird glitch only happens with small cubes, smaller than 60 pixels for some reason. It's 32x32. And I have no clue why this happens, at all. I've debugged and debugged, but I am at my end.

Box class

//Header
class Box
{
public:
    Box(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer, b2World* _world);

    void draw(SDL_Renderer* _render) const;
    void update();
private:
    SDL_Texture* m_image;
    SDL_Rect m_bounds{};

    b2PolygonShape m_polygon;
    b2FixtureDef m_fixture;
    b2BodyDef m_bodyDef;
    b2Body* m_body;
};

//CPP
Box::Box(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer, b2World* _world) : m_image(IMG_LoadTexture(_renderer, _textureName.c_str()))
{
    SDL_QueryTexture(m_image, nullptr, nullptr, nullptr, nullptr);

    m_bounds.x = _x;
    m_bounds.y = _y;
    m_bounds.w = _width;
    m_bounds.h = _height;

    m_bodyDef.type = b2_dynamicBody;
    m_bodyDef.position.Set(_x / World::PPM, _y / World::PPM);
    m_body = _world->CreateBody(&m_bodyDef);

    m_polygon.SetAsBox((_width / World::PPM) / 2.0f, (_height / World::PPM) / 2.0f);

    m_fixture.shape = &m_polygon;
    m_fixture.density = 1.0f;
    m_fixture.friction = 0.3f;

    m_body->CreateFixture(&m_fixture);
}

void Box::draw(SDL_Renderer* _render) const
{
    SDL_Point center;
    center.x = m_bounds.w - (m_bounds.w / 2);
    center.y = m_bounds.h - (m_bounds.h / 2);

    const auto angle = (180 * m_body->GetAngle()) / M_PI;

    SDL_RenderCopyEx(_render, m_image, nullptr, &m_bounds, angle, &center, SDL_FLIP_NONE);
}

void Box::update()
{
    m_bounds.x = m_body->GetPosition().x * World::PPM;
    m_bounds.y = m_body->GetPosition().y * World::PPM;
}

World class

//Header
class World
{
public:
    static constexpr float PPM = 32.0f;
    static constexpr int VELOCITY_ITERATIONS = 5;
    static constexpr int POSITION_ITERATIONS = 8;

    World();

    void update();
    void render(SDL_Renderer* m_renderer);

    void createBox(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer);
private:
    float m_timeStep;

    b2World m_world;
    b2BodyDef m_groundBodyDef;
    b2Body* m_groundBody;

    std::vector<Box*> m_boxes{};
};

//CPP
World::World() : m_world(b2Vec2(0.0f, 9.8)), m_timeStep(1.0f / 60.0f)
{
    m_groundBodyDef.position.Set(400.0f / PPM, 590.0f / PPM);
    m_groundBody = m_world.CreateBody(&m_groundBodyDef);

    b2PolygonShape groundBox;
    groundBox.SetAsBox(400.0f / PPM, 20.0f / PPM);
    m_groundBody->CreateFixture(&groundBox, 2.0f);
}

void World::update()
{
    m_world.Step(m_timeStep, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
    for (auto box : m_boxes)
    {
        box->update();
    }
}

void World::render(SDL_Renderer* m_renderer)
{
    for(auto box : m_boxes)
    {
        box->draw(m_renderer);
    }
}

void World::createBox(const std::string& _textureName, int _x, int _y, int _width, int _height, SDL_Renderer* _renderer)
{
    m_boxes.push_back(new Box(_textureName, _x, _y, _width, _height, _renderer, &m_world));
}

If anybody has any idea why this might happen, please let me know. Thank you.

sentences:
Lag Compensation in a Real-Time Game I have been trying to implement some lag compensation techniques for a real-time game, I've found some good resources online, but I don't think I fully understand the server-side part of the problem.

The game is a simple 2D game, where the player moves an entity around the map. There will be other entities with their own behavior that are controlled by the server, but I made it so that their movement can be easily interpolated. The player input is quite simple: an analog stick and some commands (pick target, loot objective, etc.). The game runs at a fixed 10 TPS (it's on mobile and it's not that action packed, 10 TPS will suffice). The client will send the input state every tick (even if no input is present, like the analog stick is in the default position).

It is worth mentioning that only one player is connected at the same time, so in a way this is not multiplayer, but I need to run this on the server as well to prevent cheating.

I understand client-side prediction and that's quite straightforward to implement. I am struggling with the server-side part. As far as I can see I have 3 options:

The server waits for the input from the client then computes the new game state and sends it to the client. This is a viable option only because there is only one player.
The server runs the game loop waiting up to 100ms (10 TPS -> 100ms / tick) for an input. If it gets one, it will be taken into consideration when computing the next state, otherwise it will be discarded. If an input arrives after the tick was done, it will be discarded. If an input arrives during this timespan, but the tick numbers don't match (client send input for tick 5, but server is at tick 7) it will be also discarded.
The server runs the game loop waiting up to 100ms (10 TPS -> 100ms / tick) for an input. If it gets one, it will be taken into consideration when computing the next state, otherwise it will be discarded. In this case it will not care if the input is not for the current tick, it will apply it anyways.

Option 1 is the easiest to implement and will be more consistent. The biggest issue with this is that I believe it's easy to cheat. Since the server is waiting for input, the player might be able to "pause" the game, analyze the situation then dispatch the action, basically allowing a cheating player to play in slow-motion. The client-side reconciliation in this case seems easy, when the player moves, it will move instantly on the screen and when it received the updated state from the server it will do it's reconciliation.

Option 2 is a tad harder to implemented (not by much though), but it will be unplayable (literally, the player won't be able to move) if their ping is higher than 100ms.

Option 3 has the same complexity as Option 2. It will work with pings higher than 100ms but it will most probably lead to some frustration on the player's side since their inputs will not arrive in time.

Is there a better way to do this? What are your thoughts?

sentences:
Can I change vertex buffer's size? Maybe it's a stupid question but I actually don't know - is it possible to change vertex buffer's size after it's been already created (with CreateBuffer())? If so, how do I update its data (with both Map() and UpdateSubresource()) when the new data contains more/less vertices?

I'm interested in vertex buffers and dx11 but the question probably applies also to index buffers and opengl.

sentences:
Entity Component System based engine Note: I'm programming this in Javascript, but it should be language agnostic in the most part.

I am thinking about converting my engine to an ECS based one.

I get the basic idea (note: this is wrong, see my answer):

Entities are game objects.
Components are bits of functionality (reactToInput()) or state (position) which can get "glued" to entities.
Systems have a list of entities they manage and update.

But, I'm not quite sure that I get the implementation and some details...

Question: can a system operate on different kinds of entities? I usually give the example of a class called Scene in my engine, and it will serve this purpose now, as well. A scene is a container of all objects that can be rendered, updated, affect the rendering (lights), and maybe, in future, even 2DSoundEmitter objects. It has a high-level interface so the user doesn't need to worry about the type of the object he's scene.add()ing, and all that kind of stuff.

I realize that the Scene could be a system. It takes in entities, stores them, and then it can call their update methods, and maybe even do some state changes. But, there is a problem: as I described above, the Scene can be fed different types of objects! What should I do in, say, a situation where a scene has both renderable objects ("drawables") and lights in it? Should I make it type-check entities before interacting? Or, should I solve it at an even lower level: make a LightSource component which can be added to any object, and the light would just be an entity with LightSource and Position components. Is that acceptable?

Also, is it a good practice to still use conventional inheritance and traditional classes? For example, I just can't figure out what would my Renderer be! It's not a system, as its only function is to take in a camera and a scene, render everything and apply effects (such as shadows). It also manages the context, the width and the height of the game, makes translations... But it's still not a system!

Edit: could you maybe link any resources you found on the ECS? I'm having trouble finding good ones.

sentences: Blur shader without render textures? Is it possible to append a blur shader to a standard (diffuse) shader ? I am looking for a way to do this as Unity indie doesn't allow render textures.

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 can I properly access the components in my C++ Entity-Component-Systems? (What I'm describing is based on this design: What is an entity system framework?, scroll down and you'll find it)

I'm having some problems creating an entity-component system in C++.  I have my Component class:

class Component { /* ... */ };

Which is actually an interface, for other components to be created.  So, to create a custom component, I just implement the interface and add the data that will be used in-game:

class SampleComponent : public Component { int foo, float bar ... };

These components are stored inside an Entity class, which gives each instance of Entity a unique ID:

class Entity {
     int ID;
     std::unordered_map<string, Component*> components;
     string getName();
     /* ... */
};

Components are added to the entity by hashing the component's name (this probably isn't such a great idea).  When I add a custom component, it is stored as a Component type (base class).

Now, on the other hand, I have a System interface, which uses a Node interface inside.  The Node class is used to store some of a single entity's components (as the System isn't interested in using all of the entity's components).  When the System has to update(), it only need to iterate through the Nodes it stored created from different entities.  So:

/* System and Node implementations: (not the interfaces!) */

class SampleSystem : public System {
        std::list<SampleNode> nodes; //uses SampleNode, not Node
        void update();
        /* ... */
};

class SampleNode : public Node {
        /* Here I define which components SampleNode (and SampleSystem) "needs" */
        SampleComponent* sc;
        PhysicsComponent* pc;
        /* ... more components could go here */
};

Now the problem: let's say I build the SampleNodes by passing an entity to the SampleSystem.  The SampleNode then "checks" if the entity has the required components to be used by the SampleSystem.  The problem appears when I need access the desired component inside the Entity: the component is stored in a Component (base class) collection, so I can't access the component and copy it over to the new node.  I've temporarily solved the problem by casting the Component down to a derived type, but I wanted to know if there is a better way of doing this.  I understand if this would mean re-designing what I already have.  Thanks.

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: Graphics for non-Graphics Designers Are there resources for programmers with little to no graphics design talent, but still want to make good-enough graphics for their own programs? I'm interested in both 2d and 3d computer generated graphics techniques, as well as free graphics repositories.

sentences:
Collision Detection for a 2D RPG First of all, I have done some research on this topic before asking, and I'm asking this question as a mean to get some opinions on this topic, so I don't make a decision only on my own, but taking into account other people's experience as well.

I'm starting a 2D online RPG project. I am using SFML for graphics and input and I'm creating a basic game structure and all for the game, creating modules for each part of the game.

Well, let me get to the point I just wanted to give you guys some context.

I want to decide on how I'm going to work with collision detection. Well I'm kinda going to work on maps with a tile map divided in layers (as usual) and add an extra 2 layers - not exactly in the map - for objects. So I'll have collisions between objects and agents (players - npcs - monsters - spells etc) and agents and tiles. The seconds one can be easily solved the first one need a little bit of work.

I considered both creating a basic collision test engine using polygons and a quadtree to diminish tests since I'm going to be working with big maps with lots of objects - creating both a physical and graphical world representation. And I also considered using a physics engine like Box2D for collision tests.

I think the first approach would take more work on my part but the second one would have the overhead of using a whole physics engine for just collision detection and no physics.

What do you guys think ?

sentences:
How to update different constant buffers for different vertices in vertex buffer? Lets say I have vertices and indices for Box and Sphere and I put them into one vertex buffer.
But if I want to use different constant buffers for each of the figures, how would I do that?

As I understand I need to somehow say in VertexShader "Do those calculations for those vertices, and these calculations for these". But to my understanding, shaders don't work that way? Also I can't have two input layouts for each figure (it doesn't even make sense).
I've heard you are not suppose to do it that way these days, better to have different buffers for each figure, but still I want to try it.

sentences:
Prevent players from wallhacking in an online FPS? Why do we still complain about wallhackers in multiplayer first-person shooters?

Isn't it possible to perform occlusion culling for all players server-side? For example, send player xyz information to client only when the player is visible in client's frustum and not occluded by any object ? Even if the collision-geometry is very, very simplified, most of the time cheater won't receive tactical information.

Why not do this?

sentences:
Getting Image From Android to Unity3D I am trying to get an image from the user gallery and import it in unity. I have written a native plugin in Android Studio and exported JAR as it’s needed for the native stuff to get working. I am successful in opening gallery but I don’t have an idea how do I get that image retrieved from OnActivityResult in Java File and use it in C# for Unity.
Any help and ideas will be highly appreciated.

sentences: Changing Yaw, Pitch And Roll OpenGL I'm using LWJGL and OpenGL 1.1 at this time and I was wondering what command is used to change the yaw, pitch and roll?

sentences: How to morph a player character into another entity in MC JAVA 1.16-1.17? I want to add morphs into my game. Is there any command/code/resource I can use to make someone morph into an entity?

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:
Google Play Services Message Handling with Libgdx I'm looking for some idea of how to handle Reliable Messages in Google Play Services with libGDX. So far I've been using it like this: I was waiting for message with OnRealTimeMessageReceivedListener, setting an outside byte[] array to the message received, changing a flag that suggests that new message arrived to true, getting that message in my libGDX class using methods from interface, setting newMessage flag again to false, handling message, and so again waiting for new one

private OnRealTimeMessageReceivedListener mMessageRecievedHandler = new OnRealTimeMessageReceivedListener() {
        @Override
        public void onRealTimeMessageReceived(@NonNull RealTimeMessage realTimeMessage) {

            //Handle received message here

            byte[] message = realTimeMessage.getMessageData();

            /*byte tbye[] = message;
            ByteBuffer bb = ByteBuffer.wrap(tbye);
            if(bb.getFloat() == 1884) {
                Log.d("MESSAGETEST", "Message received in anL : " + debugIntL);
                debugIntL++;
            } */

            byteArray = message;

            newMessageFlag = true;
        }
    };

@Override
    public boolean getNewMessageFlag() {
        return newMessageFlag;
    }

@Override
    public byte[] getMessage() {
        newMessageFlag = false;
        return byteArray;
    }

Libgdx class:

@Override
    public void render (float delta) {
    ...
    checkForNewMessage();
    ...
   }

private void checkForNewMessage() {

    if(game.customHandler.getNewMessageFlag()) {
        handleMessage(); // handling message here
    }

}

private void handleMessage() {

        byte[] message = game.customHandler.getMessage();

        ByteBuffer bb = ByteBuffer.wrap(message);

        float typeOfMessage = bb.getFloat();

        if(typeOfMessage == NEW_UNIT_MESSAGE) {

            Gdx.app.log("MESSAGETEST", "Message received in gdx : " + debugInt);
            debugInt++;
            ...
           }
       }

But the result is, when uncommenting the code in OnRealTimeMessageReceivedListener and adding similar log to my handleMessage(); that some messages are skipped between receiving it in listener and checking for new in my libGDX class, I don't know why, maybe because some render calls take longer to do everything inside and it skips through one check call when there's significant number of those in small amount of time

On the image you can see that first log is from OnRealTimeMessageReceivedListener, which receives every message, but the second one is from handleMessage, and at 251 there it wasn't called, so handleMessage just skipped this message and went to the next one.

So here's my question, what's good way to handle those messages so that I won't skip any?

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: Unity - get screenshots from various resolutions To upload my app to Google Play I need to provide various screenshots. Thing is, I have only one tablet, no phone and I don't feel like virtualizing a bunch of devices. Is there a way to create screenshots of different sizes? Like what would a 7" 1280X720 tablet see?

sentences:
Rotation of a ball moving on a surface I have a ball that moves along a platform. The ball is characterized as a sphere that has a radius and a position. The platform basically is a rectangle consisting of two vertex triangles. Its class also stores the normal of the platform.

While moving the ball and applying the physics of gravity doesn't pose a problem, I just can't get the sphere to rotate correctly. To represent the rotation(s) I'm using Qt's QQuaternion class.

Here's my current rotation code:

QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

float radian = QVector3D::dotProduct((ball - position), forward) / radius;
angularRate = ((radian / interval) * 180.0f / M_PI) * right;

QQuaternion rotation(angularRate.length() * interval, angularRate);
orientation = rotation * orientation;

The orientation quaternion is initialized like this:

orientation = QQuaternion(0.0f, QVector3D(0.0f, 0.0f, 1.0f));

When drawing the ball I update the model matrix (QMatrix4x4) like this:

    modelMatrix.setToIdentity();
    modelMatrix.translate(position.x(), position.y(), position.z());
    modelMatrix.rotate(orientation);
    modelMatrix.scale(radius);

What I noticed when debugging is that the final model matrix gets NAN values in the first three columns. Is there any physical flaw in my calculation or could it have to do with the model matrix itself?

If that's important, here's the full code for updating the ball's properties:

void Ball::update(float interval) {
    collision = false;

    // Calculate new velocity
    velocity += (MOVE_FORCE / mass * interval) * pushDirection;
    velocity.setY(velocity.y() - (GRAVITY * interval));

    /* Collision detection */
    QVector3D normal(0.0f, 0.0f, 0.0f);
    QVector3D step = interval * velocity;
    QVector3D ball = position + step;

    // Check all tiles for collision with ball
    for (unsigned int i = 0; i < tiles->length(); i++) {
        Tile *tile = tiles->at(i);
        QVector<QVector3D> mainVertices = tile->getVertices();

        QVector3D a1 = VectorMath::closestPointOnTriangle(ball, mainVertices[0], mainVertices[1], mainVertices[2]);
        QVector3D a2 = VectorMath::closestPointOnTriangle(ball, mainVertices[2], mainVertices[3], mainVertices[0]);

        float d1 = (ball - a1).length();
        float d2 = (ball - a2).length();

        QVector3D a = (d1 <= d2) ? a1 : a2;
        QVector3D aN = a - tile->getAdjustedSurfaceNormal();

        float aBallLength = (a - ball).length();
        float aNormalBallLength = (aN - ball).length();

        if (aBallLength <= radius || aNormalBallLength <= radius) {
            QVector3D distance = (aBallLength <= aNormalBallLength) ? a - ball : aN - ball;
            float l = distance.length();

            QVector3D move = -((radius - l) / l) * distance;

            // Rotation
            QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
            QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

            float radian = QVector3D::dotProduct((ball - position), forward) / radius;
            angularRate = ((radian / interval) * 180.0f / M_PI) * right;

            ball += move;
            normal += move;

            collision = true;
        }
    }

    // Set new ball position
    position = ball;

    normal.normalize();

    // Applying rebound
    if (collision) {
        float velocityNormal = QVector3D::dotProduct(velocity, normal);
        QVector3D rebound = (-(1 + ELASTICITY) * velocityNormal) * normal;

        velocity += rebound;
    }

    // Damping
    velocity *= DAMPING;

    QQuaternion rotation(angularRate.length() * interval, angularRate);
    orientation = orientation * rotation;

    if (position.y() < -10.0f) {
        reset();
    }
}

sentences:
Unity: Shader Graph and GPU-Instancing? Unity Version: 2019.4.1f1
Render Pipeline: URP
I created a shader using Unity's ShaderGraph, and i want to apply GPU Instancing on this shader, but there is no way to declare per-instance properties inside the shader graph.
Is there a way to make GPU Instancing work on shader graphs' materials?

sentences:
Bullet Manager Class I'm making a game in AS3, and it's a rather simple shooting game because I'm original. Anyway, probably the most subjective question here yet: what is the best way to implement bullets in my game?

Would it be smarter to make a universal bullet manager class on the game that handles all the bullet related data or have every entity that has bullets (players, enemies) have this sort of 'bullet manager'?

Make a level-wide bullet manager --or-- bullet manager for each entity?

Oh, and a side question: I actually have an enemy manager class. How would I check for collisions from the aforementioned bullet manager class.

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

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

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

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

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

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

sentences:
How do I interpret the dot product of non-normalized vectors? I know that if you take the dot-product of two normalized vectors, you get the cosine of the angle between them.

But if I take the dot-product of two non-normalized vectors (or one normalized, one not), how can I interpret the resulting scalar?

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:
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:
What is a proper way to handle player inputs based on different states? So, I have two ideas how to do that:

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

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

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

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

sentences:
For voxel rendering, what is more efficient: pre-made VBO or a geometry shader? Given a fairly static voxel array, what is more efficient: using the CPU to pre-generate a VBO to render the voxel faces (ignoring more advanced forms of rendering like marching cubes for now) or using a geometry shader on the GPU to generate the faces on the fly?

I'm not that worried about updating changing voxels but of course that is a benefit of the GPU-version since you don't have to rebuild the VBOs. Also, the GS approach feels a bit more modern :)

On the other hand, I haven't looked at the details on how a GS actually works with the rasterization pipeline in modern GPUs. Does it output the vertices into a sort of stream-cache or is the vertices written to the normal GPU memory in between? If it's the latter, then on-the-fly generating could reduce the available bandwidth and processing power from the rest of the GPU tasks I guess and then it would be more beneficial to do it on the CPU..

sentences:
Objective-C SpriteKit – How to make a circle of buttons I have some code in a project already, but I'd like to change it up a bit. Currently, my code creates an empty node called _buttonLayer and then create some buttons to add to it. My buttons start from the top-left corner of the _buttonLayer and then get added all the way to the bottom-right corner.

// Set up button layer.
_buttonLayer = [SKNode node];
_buttonLayer.position = CGPointMake(_centerOfScreen.x - (_buttonSize.width * 1.5) - 5.0,
                                    self.size.height - ((self.size.height * 0.375) + (_buttonSize.height) - 50.0) + 5.0);
[self addChild:_buttonLayer];

// Set up button array.
_buttonArray = [NSMutableArray array];

// Add some buttons.
for (char row = 0; row < 4; row++) {
    for (char col = 0; col < 4; col++) {

        // Buttons.
        SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"LightGreyButton"];
        button.name = @"LightGreyButton"; // Initially set it to grey, because they all start off that way.
        button.size = _buttonSize;
        button.position = CGPointMake(2.0 + ((button.size.width + 3.0) * col),
                                      -(2.0 + ((button.size.height + 3.0) * row)));
        [_buttonLayer addChild:button];
        [_buttonArray addObject:button];

    }
}

So what I need to do now is create the buttons in a circle – instead of in a square. I'd like to somehow add the buttons into an outline of a circle, and then take the whole _buttonLayer and rotate it. Of course, the way I have it right now, it rotates on the top-left corner of the square. I want the middle of the circle to rotate.

How would I go about doing 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:
How can I reduce a bezier curve using a slider till all points converge to it's original midpoint I am using the code from the question here to create bezier curves (I didn't think it was necessary to repost the code here since I haven't made any significant changes to it yet).

I have a symmetric bezier curve (please see image) that I want to reduce till all points converge at the midpoint of the original curve. I would like to preserve it's symmetry while it moves.
I would like achieve this using a  float slider (with values from 0 to 1) in editor mode.

sentences:
What is the alternative to Time.time for scrolling texture? In my game, I'm using the standard SetTextureOffset method to smoothly scroll texture on background quad.

However, on game over, instead of reloading the scene, I'm just reseting all values initial position to give illusion that scene was reloaded. With this approash, i'm unable to use Time.time or Time.timeSinceLevelLoad because, the level was not reloaded and this value stays high. So scrolling is too fast right in the beginning.

Are there any time independent methods to smoothly scroll texture? Thanks.

sentences:
How to visualize objects in darkness Below I've an image of my current scene, and two images of what I want to achieve. Now the question is, how can I visualize objects in low light, as you can see the current scene isn't that attractive however the pic from kentucky route zero is soul capturing, so what should I do? Any type of guidance will be appreciated c:

Current Scene:

Required Output:

sentences:
Restrict A* pathfinding to overlapping "safe zones" within map I've been bashing my head against this idea for a few days without luck, I'm hoping someone sees something I don't.
So I have a 2D map containing walls and obstacles, and I have a unit that navigates through it (A* and funnel algorithm). So far so good. Now, for gameplay purposes, I need to limit the movement of this unit to circular safe zones that I can place on the map. Think of them like cell towers, the unit has to stay within range of at least one tower, with the max range dictated by the tower (possibly different for each tower). Effectively, imagine drawing a set of interlocking circles over the map, and the unit must remain within that.
Now for the complicated part. The map is a constrained Delaunay triangulation, not a grid, so the triangles that A* is using can vary in size and shape. With a grid, I could imagine limiting individual grid cells by circle distances, but in my case these triangles could be larger than any one circle. There could even be cases where the start and end points of a path are within the same triangle, but because of the network of circles, an indirect path would have to be chosen to stay within the circles.
The only option I can think of involves adding these circles into the triangulation as additional edges, altering the map. This would mean rebuilding the map triangulation each time a player adds or removes these circles, and would require that I maintain a separate copy of that triangulation per player. And since these circles don't care about map walls, I'd have to alter my triangulation method to allow edge splitting and removal, to prevent overlapping lines from rendering the triangulation invalid.
I feel like there has to be another way to do this. I've considered:

Running A* purely on the circles first, then placing that intermediate path on the map and re-pathing it to avoid obstacles.
Finding all of the circle intersections between the start and end points, and treat those lines as portals that I must pass through, somehow altering the A* pathing to prioritize passing through them.
Performing a regular path search on the triangulation, but forcing a dead-end whenever entering a triangle that is too far from a circle. Then refining that path to conform to the circles themselves.

Each of these have issues, or scenarios where they fall apart.
Has this been done before? Any input on how this might possibly be achieved would be appreciated.
Edit: Adding an image to show what I'm trying to accomplish. The red lines show the path that A* would generate using just the map triangulation. The green lines show the desired path, taking the circle bounds into account.

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:
Graphic Engine/Programming/Etc resources? Posting this question here rather than SO because of it's relevance with game development.

My dilemma is this: It is currently my summer vacation after my first semester of CompSci and I have learned enough C++ to actually get started in a little more advanced stuff.

I don't want to start games programming yet until I teach myself linear algebra, trigonometry, etc. However, I do want to know the fundamentals, the theory and the methods used in game programming!

I thought I had some decent books in the college library, but they were horribly outdated with books on game programming or game engines or game/graphic (topic here) from the early 90s to 2002.

Knowing the volatile state of computer technology, I figured grabbing knowledge on cutting-edge technology from a decade-old book isn't a good idea. Amazon itself leaves me clueless as to what book I want.

What I don't want:  A platform-dependent book. I'm not out to learn OpenGL, Direct3D or any specific API. I just want to know things like tessellation, how the GPU handles stuff, what goes on under the hood and what kind of raytracing and radiosity methods there are. The basics, the core concepts- those kinds of things.

I hope that's clear! Books, resources are all welcome. Though I much prefer a book over a website!

sentences:
How do I distribute MonoGame games in Windows? I'm using VS2013 and MonoGame to create a simple game. The things is I can't make it run on others PCs.

I've tried to copy Content to the Release folder using the "always copy" option in VS2013;
I've tried to add the OpenAL and wrap_oal DLLs to the Release folder too but it is not working;
I've tried to Publish the game using this functionality of VS2013 but no success neither.

Am I forgetting something?

Edit: I'm using the OpenGL template (I've tried the DirectX but had the same problem).

sentences:
Blur offset artifacts I have simple blur shader which I calculate offsets in:

Piece of vertex shader:

output.texCoord1 = input.tex + float2( texelSize * -4.0f, 0.0f );
output.texCoord12 = input.tex + float2( texelSize * -3.0f, 0.0f );
output.texCoord13 = input.tex + float2( texelSize * -2.0f, 0.0f );
output.texCoord14 = input.tex + float2( -texelSize, 0.0f );
output.texCoord15 = input.tex + float2( 0.0f, 0.0f );
output.texCoord16 = input.tex + float2( texelSize, 0.0f );
output.texCoord17 = input.tex + float2( texelSize *  2.0f, 0.0f );
output.texCoord18 = input.tex + float2( texelSize *  3.0f, 0.0f );
output.texCoord19 = input.tex + float2( texelSize *  4.0f, 0.0f );

However with this manner I have artifacts on the sides of the screen:

I know that it occurs because when the offset goes out from the right it takes pixels from the left appropriately.

So my question is: how is the "standard" way to deal with this? I was trying to saturate() all of the values assigned to output.texCoordX, it removes the artifacts in 95%, but it makes my blur much weaker and with strange sharper edges ("roll my log and I will roll yours"?).

sentences:
Timestep schemes for physics simulations The operations used for stepping a physics simulation are most commonly:

Integrate velocity and position
Collision detection and resolution
Contact resolution (in advanced cases)

A while ago I came across this paper from Stanford that proposed an alternative scheme, which is as follows:

Collision detection and resolution
Integrate velocity
Contact resolution
Integrate position

It's intriguing because it allows for robust solutions to the stacking problem.  So it got me wondering...

What, if any, alternative schemes are available, either simple or complex?  What are their benefits, drawbacks, and performance considerations?

sentences:
How do I create tileable 3D Perlin/Simplex noise? I have a library which provides functions for 1/2/3/4-D simplex noise. With that I successfuly created a tileable 2D cloud texture (see How do you generate tileable Perlin noise?).
Now I want to create a tileable 3D cloud volume. It only has to be tileable in 2 dimension of course.

How can I achieve this? Do I need higher dimension than 4D noise?

sentences:
Why do people use quaternions? I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question.

So far the only benefit I've come across personally is the ability to SLERP between two angles - to achieve the same effect with a vector you need quite an ugly work around (intrinsically linking 0 and 2PI together).

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: How do I dynamically load a smaller texture in Unity based on the screen size? I have a Unity application on windows phone which is having problems running on small devices because the HD textures are so huge. What is the best way to test and dynamically use a smaller version on a smaller or less powerful device?

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:
Best data structure to store large amount of data I am making a minecraft kind of game. In which I have 100s of objects and their crafting recipe.

Now I want to store them inside the program, ie I cannot load external files. Everything must be inside class for now. In future I might be able to use databases, once the game gets more traction.

All these objects will have addition properties like shootable,purchase cost,etc etc.

Some also have array property like

{ research1: unlocks{ object1:50%, object2:100% }},

{ research2: unlocks{ object1:50% }}.

But all these objects will be constant with an exception of "locked" boolean.

If I do a huge database I'll also have to search data using filters on they keys like we do on sql.
Example: "Give me all Researches that are unlocked and that unlocks object1"

What will be the best datastructure to store them?
Thanks.

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:
Using Lerp to zoom in on an object inside an if statement I'm trying to zoom in on an object once the raycast hits it in the Update method, I am using the Lerp method to make the camera movement smoother but it's not working properly. The object only lerps for a single frame.

I also tried using a coroutine but the result is still the same. I can't simply just place it outside the if statement because I only need to change the field of view once the raycast hits an object.

Here's a sample of my code :

if (Input.GetMouseButtonDown(0))
        {
            ray = mainCam.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {

                if (hit.collider.tag.Equals("Building"))
                {

                    SetTarget(hit);
                    mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, newFOV, Time.deltaTime * smooth);
                }
            }
         }

sentences:
Can inserting/removing one point in a quadtree or octree cause multiple splits/collapses? I was reading Robert Nystrom's Game Programming Patterns website and, in the section about spatial partitioning, particularly in the section on quadtrees, he mentions:

Objects can be added incrementally. Adding a new object means finding the right square and adding it. If that bumps that square above the maximum count, it gets subdivided. The other objects in that square get pushed down into the new smaller squares. This requires a little work, but it’s a fixed amount of effort: the number of objects you have to move will always be less than the maximum object count. Adding a single object can never trigger more than one subdivision.
Removing objects is equally simple. You remove the object from its square and if the parent square’s total count is now below the threshold, you can collapse those subdivisions.

I can't help but wonder if this is really right. Experimenting with certain simulators this one, when adding a point that is close to another one (and since it only allows one point per grid space) multiple subdivisions happen until they're fit. The same happens when you remove a point, with the subdivisions collapsing.
An example using the website:

With just another point, 5 subdivisions happen:

Was this perhaps a mistake on Nystrom's part? Or is it just a definition that can change from quadtree implementation to implementation? I'm also wondering if the same can happen with octrees.

sentences:
Why do my Box2D bodies not fall, even though world.step is called? I have SFML set up with a Box2D world that has gravity, but my bodies won't
move.  I std::cout'ed the position of the body in the game loop, but it's always at (0, 14)!

No errors or warnings, just no movement when there's supposed to be.

I'm quite new to Box2D, so I'm unsure if I'm doing this correctly. What mistake am I making?

main.cpp:

#include <SFML\Graphics.hpp>
#include <Box2D\Box2D.h>
#include <iostream>
#include <vector>

#include "Box.h"

sf::RenderWindow window;

int main(int argc, char* argv[])
{
    // Initialize stuff here since the things here will only run on startup
    b2Vec2 gravity(0, 9.8f);
    b2World world = b2World(gravity, true);

    // Initialize entities
    b2BodyDef groundBodyDef;
    groundBodyDef.position.Set(0.0f, -10.0f);
    b2Body* groundBody = world.CreateBody(&groundBodyDef);

    b2PolygonShape groundBox;
    groundBox.SetAsBox(50.0f, 10.0f);
    groundBody->CreateFixture(&groundBox, 0.0f);

    Box box;
    box.init(&world, sf::Vector2f(0.0f, 14.0f), sf::Vector2f(15.0f, 15.0f), sf::Color::White);

    sf::RenderWindow window(sf::VideoMode(1200, 840), "Title");

    while (window.isOpen())
    {

        sf::Event e;
        while (window.pollEvent(e))
        {

            if (e.type == sf::Event::Closed)
                window.close();

        }

        // Drawing

        world.Step(1 / 60, 8, 3);

        window.clear();

        box.getSfShape().setPosition(sf::Vector2f(box.getBody()->GetPosition().x / 30.0f, box.getBody()->GetPosition().y / 30.0f));
        box.getSfShape().setRotation(box.getBody()->GetAngle());

        window.draw(box.getSfShape());

        //std::cout << "X : " << box.getSfShape().getPosition().x << " Y : " << box.getSfShape().getPosition().y << std::endl;
        std::cout << "X : " << box.getBody()->GetPosition().x << " Y : " << box.getBody()->GetPosition().y << std::endl;

        window.display();

    }

}

Box.h:

#pragma once

#include <Box2D\Box2D.h>
#include <SFML\Graphics.hpp>

class Box
{

public:
    Box();
    ~Box();

    void init(b2World* world, sf::Vector2f position, sf::Vector2f dimensions, sf::Color color);

    b2Body* getBody() { return body; }
    b2Fixture* getFixture() { return fixture; }

    sf::RectangleShape getSfShape() { return sfmlShape; }

private:
    b2Body* body = nullptr;
    b2Fixture* fixture = nullptr;

    sf::RectangleShape sfmlShape;

};

Box.cpp:

#include "Box.h"

Box::Box()
{

}

Box::~Box()
{

}

void Box::init(b2World * world, sf::Vector2f position, sf::Vector2f dimensions, sf::Color color)
{
    // Creates a body definition
    b2BodyDef bodyDef;
    bodyDef.type = b2_dynamicBody;
    bodyDef.position.Set(position.x, position.y);

    // Create the body into the world
    body = world->CreateBody(&bodyDef);

    // Create the box for the body
    b2PolygonShape boxShape;
    boxShape.SetAsBox(dimensions.x / 2.0f, dimensions.y / 2.0f);

    // Create a fixture for the body
    b2FixtureDef fixtureDef;
    fixtureDef.shape = &boxShape;
    fixtureDef.density = 1.0f;
    fixtureDef.friction = 0.3f;
    fixture = body->CreateFixture(&fixtureDef);

    sfmlShape.setFillColor(color);
    sfmlShape.setPosition(body->GetPosition().x / 30.0f, body->GetPosition().y / 30.0f);
    sfmlShape.setRotation(body->GetAngle());
}

sentences:
How can I disable an NGUI button when I pause my game? There is an NGUI button in my game, which when pressed increases the player's power.

When I press the escape key, my game pauses completely. But the button still functions normally. Here's how I check for pausing:

void Update ()
{
    if(Input.GetKeyDown("escape"))
    {
        if(isPaused && Time.timeScale == 1.0f){
            Time.timeScale = 0.0f;
            AudioListener.volume = 1;
        }
        else
        {
            Time.timeScale = 1.0f;
            AudioListener.volume = 0;
        }
    }
}

I'd like the button to be deactivated when the game is paused. It should be visible, but not be clickable or anything. How can I achieve that?

sentences:
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:
Going from using XMLSerializer to using the XNA Content Pipeline A well known limitation of using the XNA Content Pipeline is that it is not included in the XNA redistributable. So, if you want to create an editor for your game, the designer must download the whole deal: your editor, your engine, XNA Game Studio and Visual Studio Express. Even then, I'm not sure you can compile your XML data into xnb outside of Visual Studio.

So I decided to simply use XMLSerializer, which works fine. However, I'm thinking that, once all the content of my game is done, prior to release, it would be great if I could convert the whole system into using the XNA Content Pipeline. In my mind, I think that the compiled xnb files would load faster than deserializing XML into objects.

Is the conversion possible? More importantly, is it worth it?

Note: my intention is to release the game as an XBOX Live Indie Game.

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:
Generate a large data structure using a compute shader I know that
RWTexture2D Result;

void CSMain (uint3 id : SV_DispatchThreadID)
    {
        Result[id.xy] = float3(1,2,3);
    }

will result in an texture containing the numbers 1,2,3 however I'm now looking for a way to control a compute shader in such a way as to generate either a 3D texture with control over which order my operation occur or a way to fit a data structure in the return value of the compute shader.

For a simplified example let's say that I want to generate either a 2D array of linked lists with each value in the linked list being equal to 1+the next value so

9-8-7-6 , 11-10-9-8
8-7-6-5 , 6-5-4-3-2

from the input texture

6,8
5,2

or store the same in a 3D texture (the real version will be more complex so we will not be able compute that 5+2=7 but instead have to relly on the fact that 5+1=6 6+1=7)

Any idea how to do this?

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:
Text mesh scaling camera distance relative I am searching a fromula that can maintain my text mesh size according to the distance from camera. I want that no matter my camera is near or far from text mesh my text show always with same width an height. I have tried this but the problem is still persist somehow

float  size = (activeCam.transform.position - transform.position).magnitude;
            newLocalScale = new Vector3(size / 108, size / 108, size / 108);
            transform.localScale = newLocalScale;

sentences:
simplest way of making a sphere roll in a realistic way rather than just moving a sphere across a plane, I want to make it roll like a ball. What is the simplest way of doing this? I assume it will have something to do with the circumference of the ball and rotating + moving it at a calculated rate.

What is the relevant maths here?

sentences:
Unity job system - long running task I have a long running task (250ms+)that I want to pick up a resultant array from. This job is a path finding service that should run periodically in the background. It's all prototyped in another language using a background Thread.

According to the Unity docs, I should call Complete() when I'm ready for the results of this job. However, I don't know when this task will complete - I don't want my main thread to wait on this job completing. I want this job to run async and to collect the result from a Nativearray:

the resultant search array
null (if it's a first run and still in process.

with concurrent array access protected by a lock. If the job is writing to the array, it should be locked.

What's confusing is that most of the Unity job examples seem to use short jobs that last a few frames, then pick up a result in a LateUpdate() or next Update().  My job is much longer running. Since my job uses no Unity API directly, am I correct that standard c# Threads seem more applicable for my kind of problem?

sentences:
Unity Application.LoadLevel freezes the game on Android device I'm developing a game using Unity. The game has a single level and after the player wins/loses, I simply want to reload the same scene. Here's the code I'm using:

private void OnLevelFailed()
{
    IsGameStarted = false;
    Debug.Log("LEVEL FAILED");
    Invoke("RestartLevel",5);
}

void RestartLevel()
{
    Application.LoadLevel(Application.loadedLevelName);
}

When running this code on the editor, everything seems fine and the scene reloads as intended. However, when I build the game for Android and run it on a device (an LG G3), the game simply freezes. I used adb logcat to see the logs of any exceptions or errors if there were any but to no luck. I also suspected if the Invoke call was causing the problem and replaced it with simply the method call, but that didn't solve the problem either.

Anyone have any idea why this might happen?

sentences:
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:
Getting mousemovement despite mouselock - unity I have lockcursor so the cursor doesn't leave the screen, but now i have to rotate an object based on mouse movement (think garrys mod item rotation) but the mouse cursor is obviusly locked to the center, is there anyway of getting the input from the mouse?

 public void GetRotated()
{
    Debug.Log(Input.GetAxis("Mouse X").ToString() + ", " + Input.GetAxis("Mouse Y").ToString());
    gameObject.transform.localRotation = new Quaternion(Input.GetAxis("Mouse X") * RotationSpeed * Time.deltaTime, Input.GetAxis("Mouse Y") * RotationSpeed * Time.deltaTime, 0, 0);
}

sentences:
What timeframe is used to compute ARPDAU for monetization purposes? I search this for a while now but could't find the answer. ARPDAU - the 'average revenue per daily active user' is a metric for the financial performance of a game/app. But what timeframe is the value measured in?

For example, some statistics that can be found online mention an ARPDAU of $0.05 to $0.1 for casual games and up to $0.8 for hard-core (targeted at hard-core gamers) games. But what's the timeframe over which this is computed? One day? One month? The lifetime of the game?

The acronym itself would suggest it's lifetime revenue divided by DAU (otherwise it should be named ARPDAUPD or ARPDAUPM shouldn't it?), but then these numbers seem incredibly low.
Let's say I have a casual game that performs averagely and has (on average, or let's say constantly) 10,000 daily active users. Does that mean I could expect from such a game to generate $500-$1000 over it's entire lifetime? Seems like nothing. Or is that rather $500-$1000 per day?

sentences:
How can I implement a file format that allows for random access to varying-sized sub-files? I need to store and update collections of serialized data (of varying sizes) into a single file that is compact and allows for efficient random access to the stored data.

Some real world examples:

Storing a series of JSON objects (of varying sizes) that can be
pulled out individually for parsing given an index or hash key.
Other serialized structures that may contain persisted state or
configuration settings given an index or hash key.

How can I implement such a file format?

I think at the very least there would need to be an index that points to blocks of the serialized data. Minecraft uses the Region file format which allocates space in the file by a fixed block size and then store data in the header of the file to determine the location and size of the data.

If the data I was storing was static, something like this format would probably be a fit, however, the data could change in length. Because the length may change, I think some mechanism would need to be in place to defragment the file.

sentences:
How to determine size of art assets for Unity UI? Previously when I made games, I used ui assets from the asset store. Working with those assets was easy as the backgrounds were plain. However, I'm now working on a game where custom graphics are used for UI. So, I need to specify size of backgrounds,icons etc to the art team. I understand how aspect ratio works with regards to unity camera, but having trouble understanding the relation between camera size and Canvas. For example, for a camera size of 4.6, an image size of 517X920 will cover the whole screen in 9:16 aspect. However, the same image is considerably larger when used as UI image under the Canvas.
Can someone please help me understand how Canvas deals with image sizes?

sentences:
How to move a sprite automatically using a physicsHandler in Andengine? I use a DigitalOnScreenControl (knob with a four-directional arrow control) to move the entity and the entity which is bound to a physicsHandler.

physicsHandler.setEntity(sprite);
sprite.registerUpdateHandler(physicsHandler);

From the DigitalOnScreenControl, I know which direction I want my sprite to move. Inside its overridden onControlChange function, I call a function animateSprite that checks which direction I chose. Based on the direction, I animate my sprite differently.

Problem: I want to automatically move the sprite to a specific location on the scene, say at coordinates (207, 305). My sprite is at (100, 305, which means it has to move down by 107 pixels.

How do I tell the physicsHandler to move the sprite down by 107 pixels? My animateSprite method will take care of animating the sprite's downward motion.

sentences: Problems managing collision filtering I have my character fixture and body(is a tank), so when I press the screen it throws a rocket(which also has a body and a fixture) that the player can controlll touching the screen. My game also has coins, which are dropped from boxes, when I destroy them, I don't want the rocket to collide with the tank, because the player can guide it anywhere(even to the tank), and it only get destroyed when touching an enemy. The problem here is that the rocket can touch a coin and move it, but it wouldn not happen. I've read that this can be solved using collision filtering, but I didn't understand very much this concept. I want the tank to collide with the coins, but not with the rocket, which should not collide with the coins.

sentences:
Should Animations in Turn-Based Games Happen Before or After State Transitions? I'm planning a roguelike game and I'm unsure how to design for animations. Since a roguelike is turn-based, the game model is discrete and would have no intermediate states during an animation(?). I've come up with two possible approaches:

Perform state transitions immediately upon input and compute the animations that occurred. In the case of a moving character, draw the animation as a member of the destination tile (instead of the static sprite) and coming from the origin tile.
Compute animations before transitioning and transition the state asynchronously after the animation completes. Draw moving objects as members of their origin tile so that they arrive immediately before the state transition.

Do developers of this type of game tend to prefer approach 1 or 2 (or some third option) and why?

sentences:
Sprite sizing for my game I have recently started a new project with my SO (Significant other)and she is doing the art for my game (Pixel art) now i have always gone with 32x32, 64x64 and so on (Using 16x scale) but she thinks we should only have world objects tiled at that scale i.e the floors and walls etc, but the character and crafted items, weapons etc as whatever other scale, as it wont affect it. Am i correct in thinking this could lead to collision issues, scaling issues etc if we used, say a 50x16 character scale?
I know this may be opinion based (Although im not sure) i just want to know if it will affect things like collision and other mechanic's if the sprites don't all follow the same size scale.

sentences:
How to Move a Player in a Tile-Based RPG I've been following a JavaHub tutorial that basically uses a pixel engine similar to MiniCraft. I've attempted to make a Player Class as such, and I'm basically making a mock Pokemon game for learning's sake:

    package pokemon.entity;

    import java.awt.Rectangle;

    import pokemon.gfx.Screen;
    import pokemon.levelgen.Tile;
    import pokemon.entity.SpritesManage;;

    public class Player
    {
      int x, y;
      int vx, vy;
      public Rectangle AshRec;
      public Sprite AshSprite;
      Screen screen;
      Sprite[][] AshSheet;

      public Player()
      {
        AshSprite = SpritesManage.AshSheet[1][0];

        AshRec = new Rectangle(0, 0, 16, 16);

        x = 0;
        y = 0;

        vx = 1;
        vy = 1;

        screen.renderSprite(0, 0, AshSprite);
      }

      public void update()
      {
        move();
        checkCollision();
      }

      private void checkCollision()
      {

      }

      private void move()
      {
        AshRec.x += vx;
        AshRec.y += vy;
      }

      public void render(Screen screen, int x, int y)
      {
        screen.renderSprite(x, y, AshSprite);
      }

    }

I guess what I really want to do is have the Player centered in the screen and have the sprite drawn based on an Input Handler.

I have a render method in the main Game Class that I'm using to render the tiles for the map.  I'd imagine I'd just need to add some parameters or methods in the Player Class?  Do I create and render the sprite for the Player in the Main Class or Player Class?

Main render method:

    private void render()
    {
      BufferStrategy bs = getBufferStrategy();
      if(bs == null)
      {
        //Technically 3 dimensions;
        requestFocus();
        createBufferStrategy(3);
        return;
      }

      level.renderBkgrd(xScroll, yScroll, screen);
      level.renderSprite(0, 0, Ash.AshSprite);

      for(int i = 0; i < screen.pixels.length; i++)
      {
        pixels[i] = screen.pixels[i];
      }

      //Here are the graphics that you meticulously use to put in a separate paint method.
      Graphics g = bs.getDrawGraphics();
      g.drawImage(image, 0, 0, getWidth(), getHeight(), null);

      //If they are already drawn, don't show them again.
      g.dispose();
      bs.show();
    }

...And level.renderSprite() is what I thought would work...But without it the code gives me a NullPointerException.

Update:

Normally, a Game/Board/World class can aggregate all of the object updates and renderings.  Knowing what I do now, in a World update() method, I typically throw the player.update() method in there and the drawing method in the World draw() method.  The answer concerning through objects into an object manager is also a good suggestion, especially considering you could have multiple different enemies that will probably be deleted or updated synchronously in the near future as the game runs.

It appears I had a specific problem with an NPE (as general as it can be).  It looks like I was over-complicating things way too much: I could just abstract the render/draw method out and have a player sprite (determined by the Player Class, if need be) rendered at the player's coordinates (again, determined by the Player Class).  As you can see in the Player Class above I have a render method which calls the screen render method while I'm fiddling around with the Level instances rendering something in the main render() method and it's just a hot mess.

Moral of the story: A good game dev tutorial will offer you the reason for their methodology based on design patterns like separation of concerns that make the code much more maintainable.

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 can I define items in my RPG like Java game? I am casually working on an RPG type game in Java but I am having trouble figuring out how I can have items that can do many different things without creating a different class for every item.

As an example, how would I create an Axe that could chop trees and attack monsters?

If I extend either the chopping or the weapon class then I can't extend the other class.

If I have chopping and weapon be an interface then I will have a lot of duplicated code when a dagger can also attack monsters and a different axe can cut trees.

I am hoping there is a way to have a single Item class and load the items and their respective abilities from a file. If that is possible how can it be done? If it isn't then what is the best way to have items in a game?

sentences:
Looking for very simple implicit integration example I am trying to design a robust cloth system. I have no problem at all simulating things like that using forward integration such as euler, midpoint, runge-kutta, verlet, etc. However, I just can't wrap my head around implicit methods.

I don't understand how you formulate the equations in linear algebra terms.
I'd really like to see a VERY simple tutorial, and an actual example of how to construct the equations, and then solve for a very simple system (for example, 3 particles connected by 3 springs).

I looked into David Baraff's Large Steps in Cloth Simulation, and I can kind of follow it, but going from equations to code is a weak spot of mine.

I can use a package like eigen to solve, but I'd also really like to see some code for something like conjugate gradient descent. I don't care about efficiency at the moment, I just want to be able to clearly understand what's going on.

Thanks

sentences:
Adding air drag to a golf ball trajectory equation I'm developing a 2D golf game in VB.NET 2005, but I am stuck on how to implement air or wind drag that should affect the ball.

Already I have these equations for projectile:

\$v_0\$ for the initial velocity of a golfball when hit or fired
Vertical and horizontal components the velocity of the golfball:
$$
\begin{align}
v_x &= v_0 cos(\theta) \\
v_y &= v_0 sin(\theta) - gt*
\end{align}
$$
Vertical and horizontal distance of golfball:
$$
\begin{align}
x &= v_0cos(\theta)t \\
y &= v_0sin(\theta) t - (0.5)gt^2
\end{align}
$$

How do I add air drag to this equation to properly affect the velocity of the golf ball? I don't have any idea how to do it, has anyone worked with similar equations?

sentences:
Locate the shortest path through obstacles when all normal paths are blocked I'm making a Tower Defense and I have basic pathfinding working, but I got a problem.

I want to make the path blockable, and when a block occurs the runners will attack the blocking towers.

So what I need is a way to find the shortest path that, more importantly, has the lowest number of towers in the way.

How do I do that?

sentences: How do I distribute an executable for a c++/opengl game that uses dynamic libraries? I have a makefile that compiles everything fine but I'm wondering how I can package the dynamic libraries with the executable for distribution.

sentences:
Switching songs - MediaPlayer lags the game When the player encounters a boss in the game I'm working on, I want to have the music change. It seems simple enough with the MediaPlayer class to fade out the current song, switch to another, and then fade the new song in. However, at the point where the second song starts, the game freezes for a split second. The songs in question aren't particularly large either - the first song is 1.7mb and the second song is 3.1mb, both mp3 format. This is the code I'm using to do it:

protected void switchSong(GameTime gameTime)
{
   if (!bossSongPlaying)
   {
      MediaPlayer.Volume -= ((float)gameTime.ElapsedGameTime.TotalSeconds/10);
      if (MediaPlayer.Volume < 0.05f)
      {
         MediaPlayer.Play(bossSong);
         MediaPlayer.Volume = 1.0f;
         bossSongPlaying = true;
      }
   }
}

What can I do to eliminate that momentary hang?

sentences:
Is it worth planning to be cross-platform in mobile game development? Disclaimer: my goal is not to use cross-platform frameworks like Unity.

I am currently planning a mobile game which I intend to first launch on iOS.  However, I am wondering if it is better to write everything in Objective-C, thus locking the code into the platform, and to do a complete rewrite for other platforms (ie: Android).  The other option would be to write the game logic in C or C++ and to only write the code that interfaces with each OS in the preferred language (Objective-C(++) or Java).

I understand that this must depend on the size of the code base, so what program size should mark the separation?
Finally, if I write cross-platform code, should I stick to C (since Objective-C is a superset of C, making it easy to use C and to use the code samples and because the NDK and the JNI interfaces are more C oriented)? The only advantage I see with C++ in that case is the fact that it is object-oriented and thus it is easier to represent game entities).

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:
Any problems with Event usages within XNA on Xbox/Phone This is a slightly vague one but I am currently looking at a couple of areas of my current framework, such as spatial partitioning and UI based menus, and with UI menus it makes sense to have an event based system so you can tell if the user has clicked on it etc... its like your own small version of winforms.

However for some other areas it got me thinking that I could expose a lot of evens for other things, such as when an object moves so it could be re-allocated in a spatial tree of some kind if needed, or if it needed to calculate a collision it could return an event.

Anyway I quite like using events everywhere as it decouples you from having to know about who needs to know what, however I was wondering if there were any hidden gotchas with using events on the Xbox/Phone. I read a few older posts that mentioned that there are performance penalties with events on non PC platform (i.e http://blogs.msdn.com/b/shawnhar/archive/2007/07/09/delegates-events-and-garbage.aspx)

So is this still an issue or has XNA and the .net implementation on these machines improved in this area, as it would be nice to add events of all kinds to high level entities, like Player.HealthChanged, Creature.AnimationStateChanged etc, but I dont want to go exposing these for usage if there is a major performance overhead with doing so...

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:
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:
Learning To Use C# In Both VisualStudio And Unity's Monodevelop Frameworks I apologize if this has been asked and answered, but I can't find it.  I know the framework is different in MonoDevelop and Visual Studio 2010 Express.  For instance, if I want to use Write.Line, I need to change the code to Debug.Log.  Is there a source for crossover syntax?  I found this but it doesn't seem to answer the question.

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            string name;

            Console.WriteLine("Hello, what is your name?");
            name = Console.ReadLine();
            Console.WriteLine("Your name is  " + name);
            Console.ReadLine();
        }
    }
}

For instance, where would I find a resource to translate this code to MonoDevelop?  I know Unity doesn't use static void, namespace, Console.ReadLine();, etc.  Thanks for the help!

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:
2D camera perspective projection from 3D coordinates -- HOW? I am developing a camera for a 2D game with a top-down view that has depth.
It's almost a 3D camera. Basically, every object has a Z even though it is in 2D, and similarly to parallax layers their position, scale and rotation speed vary based on their Z.

I guess this would be a perspective projection.

But I am having trouble converting the objects' 3D coordinates into the 2D space of the screen so that everything has correct perspective and scale. I never learned matrices though I did dig the topic a bit today. I tried without using matrices thanks to the Wikipedia article on perspective projection but every attempt gave awkward results.

I'm using ActionScript 3 and Flash 11+ (Starling), where the screen coordinates work like this:
Left-handed coordinates system illustration

I can explain further what I did if you want to help me sort out what's wrong, or you can directly tell me how you would do it properly. In case you prefer the former, read on.

These are images from the Wikipedia article linked above, showing the formulas I used:

The long formula is greatly simplified because I believe a normal top-down 2D camera has no X/Y/Z rotation values (correct?). Then it becomes d = a - c. Still, I can't get it to work.

Maybe you could explain what numbers I should put in a(xyz), c(xyz), theta(xyz), and particularly, e(xyz)? I don't quite get how e is different than c in my case.
c.z is also an issue to me. If the Z of the camera's target object is 0, should the camera's Z be something like -600? ( = focal length of 600)
Whatever I do, it's wrong.

I only got it to work when I used arbitrary calculations that "looked" right, like most cameras with parallax layers seem to do, but that's fake! If I want objects to travel between Z layers I might as well do it right.

sentences:
More loosely coupled way to design this attack and target concept? In my 2d game in unity and c sharp, my friendly units are squares. Each square has a grid on it. Each cell of the grid can have one enemy attached to it at a time.
This means that my enemy's targets are not just the friendly game object, but the cell as well. Because of this, I've created a Target class for this (just contains a gameobject and cell). Enemies carry their Target reference so they know where to move to and who to attack.
However, my friendlies do not need the cell to target an enemy. Enemies are small and don't have grids on them. I cannot figure out a nice way to make this polymorphic(?) Target concept work without doing checks for "if cell is not null" in all of my targeting code.
For example, code in my behavior tree for checks like "HasTarget" are tightly coupled to check for existence of a gameobject and cell. It just feels wrong. Am I stuck using custom checks and code for an enemy vs friendly target?
I tried interfaces but they require the same return types. That differs depending on if they are an enemy or friendly. Something like unit.Itargettable.GetTarget() won't work.
Help!

sentences:
How to handle 3D collisions using raycasting (with a reflection vector?) I'm making a game using THREE.JS, and I want my character to walk on the terrain, and collide with static 3D objects (=AABB boxes) that are on that terrain.

The problem is: THREE.JS has only a raycasting class which can be used for collisions.

I figured it would be possible if I casted 8 rays from my character to the points of an imaginary cube around the character (simulating an AABB box). I realize a sphere would be much better, but I wouldn't know how to do that using rays.

var rayDirections = [];
rayDirections.push(new THREE.Vector3(1, 1, 1));
rayDirections.push(new THREE.Vector3(-1, 1, 1));
rayDirections.push(new THREE.Vector3(1, 1, -1));
rayDirections.push(new THREE.Vector3(-1, 1, -1));
rayDirections.push(new THREE.Vector3(1, -1, 1));
rayDirections.push(new THREE.Vector3(-1, -1, 1));
rayDirections.push(new THREE.Vector3(1, -1, -1));
rayDirections.push(new THREE.Vector3(-1, -1, -1));

Then, I simply test the rays against the terrain and possible 3D meshes on the terrain, and check if the ray distance from one of the raycasts is smaller than the AABB box size. This would mean a collision occured.

Rays around the character http://www.ironbane.com/images/colbox.png.

So far so good! I cast a ray from the character's position with every rayDirection and check if one collides with the meshes array (which contains the terrain and other 3D objects on the terrain)

Once I have a collision, what to do now? Should I calculate a reflection vector? If for instance I simply walk on a flat terrain, the four rays at the bottom should trigger a collision. How do I use this reflection vector in my situation?

for(var r in rayDirections) {
    // this.position refers to the character's current position
    var ray = new THREE.Ray( this.position, rayDirections[r] );

    for (var m in meshes) {
        var intersects = ray.intersectObject( meshes[m] );

        if ( intersects.length > 0 ) {
            // Normal vector of the meshes' face we hit
            var nV = intersects[0].face.normal;

            // Velocity vector (of the character)
            var vV = this.velocity.clone();

            // And calculate the reflection vector
            var rV = n.multiplyScalar(-2 * vV.dot(nV)).addSelf(vV);;

            // ... Now what?
        }
    }
}

sentences:
Bullet Physics Integration - direct movement of rigid bodies I'm adding bullet physics to my engine. The physics simulation bits are all working nicely, but one bit I'm struggling with is being able to move objects using their co-ordinates, and then have them affect other bullet objects. I currently have this code just before I step the simulation, and this moves all of the objects to the co-ordinates that the game engine thinks the object should be, due to outside movement.

btTransform trans;
trans.setFromOpenGLMatrix(glm::value_ptr(host->getTransMat() * host->getRotMat()));

motionState->setWorldTransform(trans);
body->setWorldTransform(trans);

Then I step the simulation, and move every object to where bullet thinks it should be. I am aware there are nicer ways to do this part (custom written motionstate classes I think) but I want to get the logic down first. This works, but moving a cube directly into another causes the second cube to just shake a bit.

I've read in  few places I should be applying forces to objects, but:

I don't really want to expose the btRigidBody and physics stuff to the core gameobject, and
I have a lot of code that does it's own movements using co-ordinates, and I don't really want to rewrite it, although I will if it's the only way.

Could I replace the code below with something that compares the position of the gameobject to the rigidbody's position, and applies the correct force to make that happen? How would I implement this code? It can't be as simple as F = MA can it, given that this would happen any frame?

Edit 1:

I have implemented the formula provided by DMGregory and I've not had any success. I've tried swapping this out for applyCentralImpulse too. The objects just stay stationary and anything falling just goes into hyper speed. This runs for every  physics object just before step sim, and then the simulations positions are applied to back to their hosts.

    if (host == nullptr)return;

btVector3 newPos = convert(host->getPos());

btVector3 oldPos = body->getWorldTransform().getOrigin();

btVector3 dist = newPos -oldPos;

btVector3 acc = 2 * ((newPos - oldPos -( body->getLinearVelocity() * timeStep)) / (pow(timeStep, 2)));

if (dist.length() > btScalar(0.1f))
{
    std::cout << acc.length() << "large acc \n";
}

body->applyCentralForce(mass * acc);

sentences:
XNA Load/Unload logic (contentmanager?) I am trying to make a point-and-click adventure game with XNA, starting off simple. My experience with XNA is about a month old now, know how the classes and inheritance works (basic stuff).

I have a problem where I cannot understand how I should load and unload the textures and game objects in the game, when the player transitions to another level. I've googled this >10 times, but all I find is hard coding while I don't even understand the basics of unloading yet.

All I want, is transitioning to another level (replacing all the sprites with new ones).

Thanks in advance

sentences:
How can I achieve a constant drop rate with a variable frame rate? In my game, I have particles that should spawn at random intervals but with an average rate of x per second.

However, the frame-rate varies from around 60 fps all the way to around 3000 fps. I would like to maintain a variable frame-rate to ensure the game looks as smooth as possible, but this means I cannot simply create particles with probability x each frame:

if (random.Next(100) > x)
{
    // Create particle...
}

How can I maintain a constant "real time" drop-rate when the frame rate fluctuates?

Note that I have a variable dt which is the number of seconds since the last frame.

sentences:
How do I implement corner correction in a platformer? I'm writing a platformer in Unity and I'm trying to make it so that when the player jumps up to a ledge but barely misses (imagine they hit their toe on the ledge, or maybe even their foot, I'll play with the values) they are nudged up onto the ledge instead of not making the jump (as it is now in my game). There's a thread showing that Celeste does this in a few ways here.

My player character uses a dynamic Rigidbody2D and I move the character by setting the velocity directly.

sentences:
Calculating vertex_normals (vn) causes ugly lines C++/openGL Im trying to procedurally generate planets for a project I'm working on. By adding noise to each vertex, I'm able to generate elevation, but without having updated vertice normals for my shader. It originally looked something like the picture below.

When I tried to recalculate the vertex normals, I got some ugly sharp lines, most likely as a result from the way I was parsing the model.

this is the code Im using to recalculate the normals:

for (auto &x : normals)x = vec3(0);  //zero normals
vec3 facenormal; //buffer

//indices is the faces/triangles indexed, in pairs of 3.
for (size_t i = 0; i<indices.size();)
{
    facenormal = cross(
        (shape[indices[i + 1]] - shape[indices[i]]),
        (shape[indices[i + 2]] - shape[indices[i]])
        );

    normals[indices[i++]] += facenormal;
    normals[indices[i++]] += facenormal;
    normals[indices[i++]] += facenormal;
}

for (auto &x : normals)x = normalize(x); //normalize adjacent faces

Basically I add up the adjacent faces to the vertices they belong to, then normalize the value they have.

Then, based on suggestions, I took a look at the parsing and made sure it doesnt share vertices in the indexing. This seems to remove the lines, but im still stuck flat shading?

But according to this, it should be accurate. So I'm still not fixing the problem. What is the correct formula to do the vertex calculation, if its not what I'm already doing.

Like user Kolenda suggests, I was not modifying values at the base-mesh level. but rather, doing them after loading the indexed copies. So, what I end up with is a combination of flat shading faces "shading" ghost vertice normals. Iterating over the faces on a mesh level, with the same formula, solves the problem.

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:
Finding next AI move using MinMax algorithm for Checkers I am currently working on a Checkers game using Unity ( human vs computer ) I am done with the base architecture of the game ie defining the rules, moves, jumps etc.

I am currently stuck in implementation of MinMax for computer AI. I know how it works but I am confused on two things. Firstly, the heuristics ( I am using simple red checker count - black checker count ) but I am not sure if its correct. Secondly, outputting the final path of nodes for my AI to make its next turn.

Below is my MinMax implementation so far.

int MiniMax(TreeNode node)
    {
        int depth = 2;
        List<TreeNode> pathNodes = new List<TreeNode>();
        int final = MaxMove(node, depth, pathNodes);
        return final;
    }

int MaxMove(TreeNode currNode, int depth, List<TreeNode> pathNodes)
{
    if (depth == 0)
    {
        return currNode.getPriority();
    }
    else
    {
        depth--;
        int v = -10000;
        List<TreeNode> allPossRedMoveNodes = gameBoardScript.createNewRedBoardsFromCurrent(currNode.getCurrentBoard());
        foreach (TreeNode RedNode in allPossRedMoveNodes)
        {
            int v1 = MinMove(RedNode, depth,pathNodes);
            if(v1 > v)
            {
                v = v1;
            }
        }
        return v;
    }
}

int MinMove(TreeNode currNode, int depth, List<TreeNode> pathNodes)
{
    if (depth == 0)
    {
        return currNode.getPriority();
    }
    else
    {
        depth--;
        int v = 10000;
        List<TreeNode> allPossBlackMoveNodes = gameBoardScript.createNewBlackBoardsFromCurrent(currNode.getCurrentBoard());

        foreach (TreeNode BlackNode in allPossBlackMoveNodes)
        {
            int v1 = MaxMove(BlackNode, depth,pathNodes);
            if (v1 < v)
            {
                v = v1;
            }
        }
        return v;
    }
}

Max in this case would be Black Checkers ( Computer AI ) and Min is Red Checker, the human player

Let me briefly explain what I am trying to do with my code above. I have a TreeNode structure that stores the GameBoard, next possible move and also the Heuristic value

In My Max Move, I get all the possible Red Move Nodes from the current board. Logic for finding all possible moves is working absolutely fine. And for my Min Move which would be the human player, I get all its possible black nodes.

I am currently testing the code with depths 2 to 3 for my game tree. Please correct me if my current implementation is wrong. And finally how or where do I trace the final path of all my final Tree Nodes based on Min and Max values generated and get the next move for the Black Checker?

sentences:
Displaying Trajectory Path How can I display trajectory path exactly as in this image?

I have used void OnDrawGizmos, but that only displays trajectory in the editor and without any arrows like shown below.

Trajectory with void OnDrawGizmos

Script:

public Transform someObject; //object that moves along parabola.
float objectT = 0; //timer for that object

public Transform Ta, Tb; //transforms that mark the start and end
public float h; //desired parabola height

Vector3 a, b; //Vector positions for start and end

void Update () {
    if ( Ta &&  Tb ) {
        a = Ta.position; //Get vectors from the transforms
        b = Tb.position;

        if ( someObject ) {
            //Shows how to animate something following a parabola
            objectT = Time.time % 1; //completes the parabola trip in one second
            someObject.position = SampleParabola( a, b, h, objectT );
        }
    }
}

void OnDrawGizmos () {

    //Draw the parabola by sample a few times
    Gizmos.color = Color.red;
    Gizmos.DrawLine( a, b );
    float count = 20;
    Vector3 lastP = a;
    for ( float i = 0; i < count + 1; i++ ) {
        Vector3 p = SampleParabola( a, b, h, i / count );
        Gizmos.color = i % 2 == 0 ? Color.blue : Color.green;
        Gizmos.DrawLine( lastP, p );
        lastP = p;
    }
}

#region Parabola sampling function
/// <summary>
/// Get position from a parabola defined by start and end, height, and time
/// </summary>
/// <param name='start'>
/// The start point of the parabola
/// </param>
/// <param name='end'>
/// The end point of the parabola
/// </param>
/// <param name='height'>
/// The height of the parabola at its maximum
/// </param>
/// <param name='t'>
/// Normalized time (0->1)
/// </param>S
Vector3 SampleParabola ( Vector3 start, Vector3 end, float height, float t ) {
    float parabolicT = t * 2 - 1;
    if ( Mathf.Abs( start.y - end.y ) < 0.1f ) {
        //start and end are roughly level, pretend they are - simpler solution with less steps
        Vector3 travelDirection = end - start;
        Vector3 result = start + t * travelDirection;
        result.y += ( -parabolicT * parabolicT + 1 ) * height;
        return result;
    } else {
        //start and end are not level, gets more complicated
        Vector3 travelDirection = end - start;
        Vector3 levelDirecteion = end - new Vector3( start.x, end.y, start.z );
        Vector3 right = Vector3.Cross( travelDirection, levelDirecteion );
        Vector3 up = Vector3.Cross( right, travelDirection );
        if ( end.y > start.y ) up = -up;
        Vector3 result = start + t * travelDirection;
        result += ( ( -parabolicT * parabolicT + 1 ) * height ) * up.normalized;
        return result;
    }
}

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:
Should I use OGRE3D or start from scratch with OpenGL for a large, procedural, open world game? This question has probably been asked quite a few times, or something similar to it, but I'd like to get some better information on OGRE, since I felt that any descriptions I found weren't very comprehensive as to what it truly does.

I've been dabbling in OpenGL for a while now, and am currently doing my best to tackle shaders, with varying levels of success. Now the reason I'm learning OpenGL is ultimately to be able to develop a game, of course, but I was wondering if I could get started faster if I began using OGRE instead of programming the graphics engine from scratch.

So I looked into it, but nothing really seemed to inform me what kind of development the engine is actually good for. The game I have in mind will have a large open world, partially using procedural terrain generation, so I'm wondering how feasible is something like that in OGRE? Can it be used effectively to generate vertices in real time? Or am I better off skipping OGRE and building from scratch...

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:
Game over pop-up like Flappy Bird How can I make a game over pop-up like Flappy Bird in cocos2d-iphone 3?

I tried to add a new Scene, but it adds a new screen on the game, I just want a rectangle with some buttons inside it. I also search how to add multiple scene, but didn't find an example doing it.

sentences:
Applying Animation to specific parts of a humanoid model I have imported a humanoid character from AutoDesk Character Generator into Unity. Once you specify that you want the character for Unity, a humanoid skeleton in integrated, in order to use MecAnim.

I also have a plug-in that applies the user's motion data to this character and animates it. Because the plug-in is free and open-source, I am trying to apply the motion data to different MecAnim bones, to see if I can do so.

By the way, by "motion data" I am referring to 2 arrays: one that contains positions and one that contains orientations of a number of joints and bones. So, I can access these Vector3 and Quaternion data...

Is it enough to just apply, for example, the left foot's orientations to the right foot, or do I need to also do it with positions, in order to inter-change the animations/motions/movements of these 2 limbs?

This is the method I have written so far:

public void swapLimbsPosRot(Vector3[] positionsArray, Quaternion[] rotationsArray)
{
            Vector3 tempPos = positionsArray[16];
            positionsArray[16] = positionsArray[20];
            positionsArray[20] = tempPos;

            Quaternion tempRot = rotationsArray[16];
            rotationsArray[16] = rotationsArray[20];
            rotationsArray[20] = tempRot;
}

But it doesn't work, because when I apply it to my array of transforms before updating, severe jitters show there is a fighting going on between MecAnim and my motion capture device' incoming motion data, but for now I am just wondering:

If you wanted to swap the animations/movements/motions of 2 similar MecAnim parts, what would you do? What would you swap? How would you go about it?

p.s. Of course, first I tried swapping the mecanim bones (right & left feet) but that turned out silly, as the "actual" feet of my MecAnim character had been swapped!

Some code, showing how the swapping and updating are done now, hoping someone could please help me find the cause of the jitters.

    void Update()
    {
        Vector3[] latestPositions;
        Quaternion[] latestOrientations;

        if (mvnActors.getLatestPose(out latestPositions, out latestOrientations))
        {
                // If this variable is set to true, then do the swapping.
                if (swapLimbs)
                {
                    swapLimbsPosRot(latestOrientations);
                }

                // Update both the pose and the model, using the delayed data.
                updateMvnActor(currentPose, latestPositions, latestOrientations);
                updateModel(currentPose, targetModel);
        }
    }

    /// Swap the rotations of different mimicking limbs; e.g. LeftHand = 16 & RightHand = 20
    public void swapLimbsPosRot(Quaternion[] rotationsArray)
    {
        float tempRotY = rotationsArray[16].y;
        rotationsArray[16].y = rotationsArray[20].y;
        rotationsArray[20].y = tempRotY;

        float tempRotZ = rotationsArray[16].z;
        rotationsArray[16].z = rotationsArray[20].z;
        rotationsArray[20].z = tempRotZ;
    }

The motion data that comes in is always the latest positions and orientations from the device, so Update modify them and then apply them to the character to animate it. So, for example, in my Update, I get the latest pose (i.e. the latest positions and orientations) and then I swap the orientations of left and right hands, but the jitters are severe...

sentences:
Moving texture according to position in shader Divinity Original Sin have beautiful particle effect , When I move around game I see galaxy through particle that move according to my position.how can I make like it?

you can see this effect here:
https://youtu.be/4fIpQZ2sIAY

sentences:
A good approach on working on player controller for movable platforms? I have got my player controlling working out decent enough, except with mediocre animation controller for the player, but oh well.  All I have done so far is basic input: move, run, jump, multi-jump.  How would I approach making my player conform to the movement of the moving platform.  I know to move the platform relative to my player on top of adding more force if player has moved.  I have looked up some resources on line, but I am confused why they use certain methods.

def Platform ():
        //BROKEN
        if (activePlatform != null):
            newGlobalPlatformPoint = activePlatform.TransformPoint(activeLocalPlatformPoint)
            moveDistance = (newGlobalPlatformPoint - activeGlobalPlatformPoint)

            if (moveDistance != Vector3.zero):
                controller.Move(moveDistance)

            lastPlatformVelocity = (newGlobalPlatformPoint - activeGlobalPlatformPoint) / Time.deltaTime

        else:
            lastPlatformVelocity = Vector3.zero

        activePlatform = null

        if activePlatform != null:
            activeGlobalPlatformPoint = transform.position
            activeLocalPlatformPoint = activePlatform.InverseTransformPoint (transform.position)

I don't understand why it is important to get local and world positions.  Also, I don't understand moveDistance calculation.

My first intuition was doing something like moveDistance.y or moveDistance.x and changing them depending on the hit object positive or negative velocity.  Just getting some ideas.

I also use:

def OnControllerColliderHit (hit as ControllerColliderHit):
        if (hit.moveDirection.y < -0.9) & (hit.normal.y > 0.5):
            activePlatform = hit.collider.transform

to check which platform I have collided with and strictly focusing on the one below the player.

sentences:
What programming language was Super Mario Bros. written in? Super Mario Bros. is definitely the most famous videogame created yet, selling a scorching 40.23 million copies. http://en.wikipedia.org/wiki/List_of_best-selling_video_games

What programming language was it written in? Does anyone have some original code reference?

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:
Why don't Sin and Cos give expected results when rotating off axis around a non uniform shape? When I rotate a rectangle and draw straight lines along it's edge using Sin and Cos the lines don't follow the edge as the angle approaches 45 degrees, why? The exact same code works just fine when I use it on a square. See Gif:

Left object has the same width and height, No distortion of angles. Right side has larger X axis and lots of distortion.

Why does this happen and how do I prevent it?

Unity code:

[RequireComponent(typeof(Image))]
class rotation : MonoBehaviour
{
    [SerializeField]
    private float left = 180f, up = 90f;

    private void OnDrawGizmosSelected()
    {
        RectTransform rect = GetComponent<RectTransform>();

        Vector3[] corners = new Vector3[4];
        rect.GetWorldCorners(corners);
        float rot = transform.eulerAngles.z;

        Gizmos.color = Color.red;
        Gizmos.DrawLine(corners[3], corners[3] + new Vector3(
                Mathf.Cos((left + rot) * Mathf.Deg2Rad) * rect.rect.width,
                Mathf.Sin((left + rot) * Mathf.Deg2Rad) * rect.rect.height));

        Gizmos.color = Color.blue;
        Gizmos.DrawLine(corners[3], corners[3] + new Vector3(
            Mathf.Cos((up + rot) * Mathf.Deg2Rad) * rect.rect.width,
            Mathf.Sin((up + rot) * Mathf.Deg2Rad) * rect.rect.height));
    }
}

sentences:
Switch from left click to right click to make character walk in the Top Down Example, in UE4? When creating a new project in the Unreal Engine 4, you can choose to create a project already with some added features and things (Top Down Example):

This project has a character (which I changed its appearance) and it moves around the map when I click the left mouse button:

I looked at the blueprints of the project, but I did not identify where the command is that makes the character walk, so I'd like it to walk when I right-click.

Alls blueprints of project:

M_Cursor_Decal:

TopDownCharacter:

TopDownController:

TopDownGameMode:

The circled blocks of reds are the ones I suspected could be where I should make the modification, but no information on them gave me the certainty that that was where I was supposed to change.

I still do not create projects in C ++ programming mode, because I do not have Visual Studio 2017.

Some links from websites where I spent before coming here and that can help you to help me:

https://docs.unrealengine.com/en-us/Engine/Blueprints

https://www.youtube.com/watch?v=EFXMW_UEDco

The video is 2015, so although it's good, I did not take it so well, because I know that with all this time that has already happened, a lot is different.

Sorry for any translation errors, I'm not English speaker.

sentences: 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:
Switch statement efficiency in game code Recently, I was digging into VVVVVVV's source code that was released on GitHub by Terry Cavanagh. I went into the Game.cpp file, and found that it contains an absolutely gigantic, 3000+ case long switch statement in what is seemingly a function that is called consistently, not just once.
This made me ponder about how efficient switch statements are, and I realized I don't know much about their difference to normal if-else chains. Are switch statements normally used in this manner to implement state handling, and why doesn't something like this lag the game like crazy? (I'm assuming a massive amount of comparisons are being made every time)

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:
Why the lockState of the doors is all the time false even if in the editor I set one of them to true? In the DoorsLockManager in the class DoorClass I changed in the editor one of the lockState to true but when running the game they are all change to false including the one I tried to set to true. Not sure why if I set it to true it's changing back to false.

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

[ExecuteInEditMode]
public class DoorsLockManager : MonoBehaviour
{
    [System.Serializable]
    public class DoorClass
    {
        public bool lockState;
    }

    public DoorClass[] doorclass;

    private List<HoriDoorManager> Doors = new List<HoriDoorManager>();

    private void Start()
    {
        var doors = GameObject.FindGameObjectsWithTag("Door");
        doorclass = new DoorClass[doors.Length];

        for (int i = 0; i < doors.Length; i++)
        {
            Doors.Add(doors[i].GetComponent<HoriDoorManager>());
            doorclass[i] = new DoorClass();
            Doors[i].doorLockState = doorclass[i].lockState;        }
    }
}

And the HoriDoorManager script:

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

public class HoriDoorManager : MonoBehaviour
{
    public List<DoorHori> doors = new List<DoorHori>();
    public bool doorLockState;

    private void Awake()
    {
        if (transform.parent != null)
        {
            Transform parent = transform.parent;
            var children = parent.GetComponentsInChildren<Transform>();

            if (children != null)
            {
                foreach (Transform door in children)
                {
                    if (door.name == "Door_Left" || door.name == "Door_Right")
                        doors.Add(door.GetComponent<DoorHori>());
                }
            }
            ColorDoors(Color.red, Color.green, doorLockState);
        }
    }

    void OnTriggerEnter()
    {
        if (doorLockState == false)
        {
            if (doors != null)
            {
               for(int i =0; i < doors.Count; i++)
                {
                    doors[i].OpenDoor();
                }
            }
        }
    }

    private void ColorDoors(Color red, Color green, bool state)
    {
        List<Transform> children = new List<Transform>();

        for (int i = 0; i < doors.Count; i++)
        {
            foreach (Transform child in doors[i].GetComponentsInChildren<Transform>())
            {
                if (child == doors[i].transform)
                    continue;

                var renderer = child.GetComponent<Renderer>();
                renderer.material.shader = Shader.Find("Unlit/ShieldFX");

                if(state == true)
                {
                    renderer.material.SetColor("_MainColor", red);
                }
                else
                {
                    renderer.material.SetColor("_MainColor", green);
                }
            }
        }
    }

    public bool GetLockState
    {
        get { return doorLockState; }
        set { doorLockState = value; }
    }
}

sentences:
Creating Seamless Perlin Noise Across Faces of Cube I am writing a planet renderer and have stumbled into a problem that I cannot solve. I am generating heightmaps in a glsl pixel shader. These heightmaps are generated for every quad in the quadtree that the planetary sphere is built on. The sphere is a cube transformed by the equations found here. The way I am generating a point to be inputted into the noise function in the shader is shown here:

vec2 coords = vec2((gl_FragCoord.x - 0.5) * m_Scale , (gl_FragCoord.y - 0.5) * m_Scale)+m_Offset;
vec2 position = vec2(coords.x,coords.y);
vec3 noiseInput;

 if(m_t == 1){

 noiseInput = vec3(spherize(vec3(position.x, 0.0, position.y) + m_faceOffset))/m_worldSize;
}else if(m_t == 2){

noiseInput = vec3(spherize(vec3(position.x, position.y, 0.0) +  m_faceOffset))/m_worldSize;

}else if(m_t == 3){

noiseInput = vec3(spherize(vec3(0.0, position.x, position.y) +   m_faceOffset))/m_worldSize;

}

Here "m_Scale" is the length of the quad's edges divided by the lengths of one of the root node's sides. m_Offset is a variable which offsets the quad from the origin. m_worldSize represents the planet's radius. m_faceOffset is the variable which translates the quad to it's correct face of the cube (faceIndex = faceOffset):

if(c.face.equals(faces.TOP)){
                    c.faceIndex = new Vector3f(nhsize, hsize, nhsize);
                }else if(c.face.equals(faces.BOTTOM)){
                    c.faceIndex = new Vector3f(nhsize, nhsize, nhsize);
                }else if(c.face.equals(faces.FRONT)){
                    c.faceIndex = new Vector3f(nhsize, nhsize, hsize);
                }else if(c.face.equals(faces.BACK)){
                    c.faceIndex = new Vector3f(nhsize, nhsize, nhsize);
                }else if(c.face.equals(faces.RIGHT)){
                    c.faceIndex = new Vector3f(hsize, nhsize, nhsize);
                }else{
                    c.faceIndex = new Vector3f(nhsize, nhsize, nhsize);
                }

where hsize is the radius of the planet and nhsize is the radius negated.
Finally, m_t describes which face of the cube the quad is supposed to be on:

if(q.face.equals(QuadMesh.faces.TOP.toString()) || q.face.equals(QuadMesh.faces.BOTTOM.toString())){
                    t = 1;
                    }
                if(q.face.equals(QuadMesh.faces.FRONT.toString()) || q.face.equals(QuadMesh.faces.BACK.toString())){
                    t = 2;
                    }
                if(q.face.equals(QuadMesh.faces.RIGHT.toString()) || q.face.equals(QuadMesh.faces.LEFT.toString())){
                    t = 3;
                    }

"spherize" is the function which transforms a point on the cube to a point on the sphere:

     denom1 = hWorldSize * hWorldSize * 2f;
 denom2 = hWorldSize * hWorldSize * hWorldSize *hWorldSize * 3f;

     vec3 spherize(vec3 v){
float x = (v.x * (sqrt(1.0-((v.y*v.y)/m_denom1)-((v.z*v.z)/m_denom1)+(((v.y*v.y)*(v.z*v.z))/m_denom2))));
float y = (v.y * (sqrt(1.0-((v.x*v.x)/m_denom1)-((v.z*v.z)/m_denom1)+(((v.x*v.x)*(v.z*v.z))/m_denom2))));
float z = (v.z * (sqrt(1.0-((v.y*v.y)/m_denom1)-((v.x*v.x)/m_denom1)+(((v.y*v.y)*(v.x*v.x))/m_denom2))));
return vec3(x,y,z);
 }

This all leads to the following problem:

As one can see the faces of the "cube" do not match up.
I am at a loss here; I use the exact same methods described above to transform the vertices of the cube to those of a sphere.

Any and all help is highly appreciated. If one needs more code to form an accurate opinion please let me know.

sentences:
Hobbyist game dev, want to create async multiplayer game. Are server costs manageable? I want to make the game I want to play, and that game happens to be an asynchronous multiplayer game. Think Hero Academy or Hearthstone, where there are 2 players and each submits moves to a central server. Alternatively (and not ideally), clients connect to each other and play is limited to a fixed window of connection, but still there needs to be a central server to acquire new opponents.

That said, this is very much going to be a hobby type endeavor - I'm just one guy after all. This is not going to commercially support itself. If I have 100 players ever, that would be fantastic.

Given that I'm going to have to eat server costs myself, what are my options for getting a server? I don't need much bandwidth or CPU, due to the nature of async games - only the sending of the gamestate/current move, and perhaps some checking of legal moves. Going to Amazon or getting dedicated hosting seems drastically overkill for what I want.

If it makes a difference, I'm intending to learn and use Unity for this.

sentences:
On key press, spawn a collider where my player is facing? I'm trying to create an attack mechanic to my player hero in my 2D Tower Defense game. When I press the Q button I want my hero to do an animation and spawn a temporary collider shaped as a cone at where the hero is looking at. If this collider collides with a GameObject called "Stone" it will decrease its hpValue with a script I made. If there is multiple Stones in the cone I want it to only effect one Stone, chosen either by random or/and closest to the hero.

How would I go about doing this and how can I detect the direction of where my hero is facing? This is my movement script:

public float speed;   //Movementspeed

Rigidbody2D rbody;

void Start () {

    rbody = GetComponentInChildren<Rigidbody2D> ();
    rbody.freezeRotation = true;
}

void FixedUpdate () {

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    rbody.MovePosition (rbody.position + movement_vector * speed * Time.deltaTime);

}

A picture visualising what I mean:

sentences:
timeScale=0 doesnt stop all prefabs in unity As expected timeScale=0 can be used for stopping the game or pausing but when i make timeScale equal to 0 some prefabs still move and they can shoot bullets but addforce doesnt effect to bullets and they stop there. I know i can fix the problem on handling code of my prefabs but they are a lot. is there a good way to do the trick in my game?
thank you for helping

sentences:
How can I verify if there is no object between 2 others? I have 2 characters in my 2D game, I would like that if both of them are on the same Y axis, and there is no collider/object between them, for an animation to happen. I can't figure out how to check for the last one though... Thanks for the help!

EDIT :

Hello, I have used MrCranky's code and it seemingly looks like it should work, but I am having a problem with the syntax I think. Physics.Raycast((x,y) of the 1st player, new Vector3 (1,0,0), distance between them -2) So this code, if there is nothing between the player and the other character, it should give me a false. And it worked, but the problem is, even after I added an object between them, it stayed on false through every update, could you assist me with what am I doing wrong please?

sentences:
Discarding triangles in Unity I have about 2+ years of experience in computer gaming development and I just started writing my own shaders to help me utilize performance. I have this problem that I'm trying to work around but after several tries nothing seems to work.

Basically, I have a plane that's made of 16641 vertices - thats 32768 triangles and I know that is pretty much. The plain has a texture on it with some colors. Now, what I am trying to do is placing units on that plane. Where they stand, the vertex under them will have a certain color but all other vertexes on the plain will have the color white. The idea is to discard and don't draw vertexes that aren't white.

Now in the shader, I tried two things.

1 - In the vertex input I check if the vertex, called o, had the o.color.b value != 0. If so it was given the alpha value of 0 and would not be seen when rendering.

2 - In the vertex output, I checked the same thing ( if(i.color.b !=0)
    discard;) and discarded the fragment so it would not be rendered.
    That way I thought Unity should not count these triangles and thus
    wouldn't waste performance.

Now when I run my game and open the stats, with the plane active I have
85.8k triangles and only 28 draw calls. With the plane un-active I have 20.2k triangles and 26 draw calls (Note : there are some units, interface, skies etc around that counts up to 26 draw calls, thus the plane is just 2 draw calls).

I thought this solution would be clever to save draw calls (developing for mobile games) by treating this plane and the colors under the units as one instead of making them all a separate gameobject. Turns out, I'm way over budget on the triangles. Does anyone know if this is possible and if so, give a good answer or explenation?

Here is the following shader.

Shader "Custom/Ottar_VertexBasic" {
Properties {
    _MainTex ("Particle Texture", 2D) = "white" {}
    _Transparency("Transparency", Range(0,1)) = 1
}

SubShader {
    Tags { "Queue" = "Transparent" }
    Blend SrcAlpha OneMinusSrcAlpha
    AlphaTest Greater .01
    ColorMask RGB
    Lighting Off
    ZWrite Off
    //Fog { Color (0,0,0,0) }
    Pass {
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile_builtin
            #pragma fragmentoption ARB_precision_hint_fastest
            #include "UnityCG.cginc"

            uniform float4  _MainTex_ST;
            float _Transparency;
            //VertexInput
            struct vI {
                float4 vertex : POSITION;
                float4 texcoord : TEXCOORD0;
                float4 color : COLOR;
            };

            uniform sampler2D _MainTex;
            //VertexOutput
            struct vO {
                float4 pos : SV_POSITION;
                float2  uv;
                float4 color;
            };

            vO vert (vI v) {
                vO o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                float4 viewPos = mul(UNITY_MATRIX_MV, v.vertex);
                o.color = float4(v.color.rgb, v.color.a*1);
                //if(o.color.b != 0) o.color.a = 0;
                //else o.color.a = 1;
                return o;
            }

            float4 frag (vO i) : COLOR {

                if(i.color.b !=0) discard;
                else
                {
                half4 texcol = tex2D( _MainTex, i.uv );
                return texcol*i.color*_Transparency;
                }
            }
        ENDCG
    }
}
Fallback "Particles/Alpha Blended"
}

sentences:
Need help with physics 2D Unity I'm making a 2D game in Unity. Basically there's just a rocket that goes where ever the user touches. With the code that i have right now, the rocket instantly rotates towards the point and moves there straight.

Vector3 dir = targetPos - transform.position;
float rotZ = Mathf.Atan2(dir.x, dir.y) * Mathf.Rad2Deg;
rb.MoveRotation(-rotZ);
thrust = 10.0f;
rigidbody2d.AddForceAtPosition(transform.up * Thrust, transform.up);

This code is placed in the Update function.

I want the rocket to start moving in which ever direction It's currently facing and slowly rotate towards the point as it goes there.

sentences:
Working together on a game as a project over the internet I'm looking for someone who would be willing to work on a project that would potentially become something similar to the game evony/tribal wars, but the project won't be primarily for actually making the game, rather than learning from starting to make the game work.

What website would I go about finding someone willing to help me with this and work together on a little project, no money involved unless things started really progressing, in that case if we actually do complete something worth money, then there will definitely be an even split of the income. I'm not what you would call great at programming, I have learned everything from teaching myself and have never taken a college level (or highschool) programming class, but I'm not bad at it or anything. And if anyone reading this is interesting, leave a comment.

sentences:
GET and POST requests in gdscript How do I perform get and post requests from Gdscript in Godot?
I am trying to get a map API and use it in the game.

sentences:
Move enemy left in sin wave motion over time I'm trying to create a top down shooting game where the enemy moves in sinusoidal motion over time. For the first 10 seconds the enemy needs to move only left and after that it needs to move left in sin wave motion. This is the code I'm using. `

public float enemySpeed;
float frequency = 5.0f;
float magnitude = 1.8f;

void FixedUpdate()
{
    if(Time.time < 10.0f)
    {
        transform.Translate((enemySpeed* Vector2.left) * Time.deltaTime);
    }
    if(Time.time >= 10.0f)
    {
        transform.Translate(enemySpeed* -1.0f * Time.deltaTime, 1.0f * Mathf.Sin(Time.time * frequency) * magnitude * Time.deltaTime, 0);
    }`

What's happening is that for the first 10 seconds the enemy just moves left but after that all the enemies in the screen start moving in sin wave motion. What I want to achieve is that if the enemy has already spawned before the 10th second, it should move left without sin motion. Right now if the enemy is in the middle of the screen and the time is over 10 seconds, even this enemy starts moving in sin motion.

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:
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:
OpenGL Texture Zig-Zag Artifacts Over Time I'm working on a deferred shading renderer in OpenGL, where I write all geometry output to Colour, Normal and Depth textures and then apply lighting effects later.

Everything seems fine except once every few weeks, constant zigzag-like patterns appear past a certain depth (below the player's knees in the screenshot below). These zigzag patterns are at the same screen coordinates regardless of my pitch and yaw in the game:

I'm not sure what information to provide to resolve this issue, as it seems to me like a GPU error. Each zigzag square is 16x16 pixels, which could be the warp size on my NVIDIA GTX 960. Restarting the program resolves the problem and it doesn't happen again for a few weeks.

My guess is that sections of the fragment shader are failing to write to multiple render targets as I see the same pattern on the Colour, Normal and Depth textures.

The blue colour you can see on the left side of the zigzag pattern is the water at the bottom of the map, which is rendered after the post-processing stage and does not have these artifacts.

Any help with this would be greatly appreciated.

sentences: Different OnMouseDown functions based on where an object is clicked So my problem is I'd like to have one GameObject with multiple "OnMouseDown" functions. I have a target (classic looking bullseye) and I'd like to award a player say 10 points if they click on it, but 100 points if they click the center. Because the "OnMouse" functions don't pass in a collider I'm not sure how to go about doing this. I had an idea (which I think is a bad one) which would be to attach a small "empty" gameobject to my target prefab and give it a smaller hitbox with code that spits out 100 points instead of 10 and place that object "in front of" the other one while being attached. Again, seems wrong. Anybody else have to do this before or have a more elegant solution?? Thanks!

sentences:
Use an image as mask only where pixels are opaque We are into a game where to build our tile map, we carve on an image with a mask (At first the whole map is an image, and we create holes on it with tiles to create the map and le the background show. It is like substracting instead of adding new tiles in any common tiled based game).

We have done this with just a tile that acts as a mask using stencil buffer. The problem comes when we want to mask with tiles where all their pixels are not opaque, for example a slope. The problem is that it applies the mask as if all the pixels in tile where opaque and we want to apply the mask in two differnet ways:

1) Keep the pixels of the big image where the mask pixels are opaque

2) Mask the pixels of the big image where the mask pixels are transparent (alpha==0)

I have read a lot of info about using stencil and alpha blending but can't make it work. Checking the pipeline order it seems that stencil is applied after the fragment color has been calculated. Is it possible to access the alpha value at stencil stage and write to the stencil as needed to just mask part of the image (tile in my case).

Update to add a visual example:

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 this approach correct to make my game framerate indipendent in javascript? this is what i did

my game loop is run every REFRESH milliseconds

loop = setInterval(tick,REFRESH);

in the loop i calculate how much time is passed since last tick and subdivide that for how much time i expected to be passed

var now = performance.now();
var elapsedTime = now - lastTick;
var delta = time / REFRESH;
lastTick = now;

and every time based action that should happen every tick is "scaled" with the delta factor,
for example my movement code

var distance=ball.dest.x-ball.x;
var movement=distance/speed;
ball.x+=movement;

will have movement multiplied with delta

sentences:
How do I move an object towards a moving object? I am trying to make an AI that tries to move towards the player but I don't know how. I tried using Vector2.MoveTowards() but it just mimics my movements instead of moving towards the player. I tried everything i could think of (which was not a lot :D) but i couldn't make it move towards and touch the player! Help please :D.

Also my original code:

#pragma strict
var speed : float = 100;
var targetX : Transform;
var targetY : Transform;
var mex : Transform;
var meY : Transdorm;
function Update ()
{
var targetX = transform.position.x;
var targetY = transform.position.y;
var meX = transform.position.x;
var meY = transform.position.y;
Vector2.MoveTowards(Vector2(meX, meY), Vector2(targetX, targetY), speed);
}

sentences:
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:
Why is clip-space 3 dimensional? A vertex shader is basically a transformation function that converts a vertex in your world space to a space that can be rendered on screen.

Since the screen is a 2 dimensional surface whats the purpose of the intermediate clip space? Why not have the vertex shader directly transform a 3d vertex to a 2d point on the raster surface?

sentences:
Clientside anticheating in multiplayer game 1vs1 I'm developing a simple card game, where there will be a matchmaking system that will put you against another human player. This will be the only game mode available, a 1vs1 against another human, no AI.

I want to prevent cheating as much as possible. I have already read a lot of similar questions here and I already know that I cannot trust the client and I have to make all verifications server side. I intend to have a server (need one for the matchmaking anyway) and I intend to make some verifications server side but if I want to check everything server side this makes my server to be able to keep track of the state of all current games and check every action, and I don't have the money/infrastructure to support that server.

My idea is to make clients check and verify some of the actions made by their opponent* and if they find some illegal action notify the possible cheating to the server and make the server verify it. This will still require my server to keep track of all current games, but it will save resources only checking some things that cannot be checked at client side(like card order in the deck) and only checking other things when they are actually wrong.

*(only those they can check with out allowing themselves cheating! for example:they can't check if the played card was in hand cos that will need them to know all cards in hand)

Summing up, my questions are: is this a viable approach? will I actually save resources doing this or the extra complexity in the server and client for exchanging this messages is not worth it? do you know any game that has successfully or unsuccessfully tried a similar approach?

Thanks all for reading and answering

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:
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:
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:
Batching and Z-order with Alpha blending in a 3D world I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++)

Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls.

Here is what I've got for the moment:

Order all elements of my scene back to front.
Send order list of elements to the Renderer.
Renderer look in his batch manager if a batch exist for the given element with his Material.

Batch didn't exist: create a new one.
Batch exist for element with this Material: Add sprite to the batch.

Compute big mesh with all sprite for each batch (1 material type = 1 batch).
When all batches are ok, the batch manager compute draw commands for the renderer.
Renderer process draw commands (bind shader, bind textures, bind buffers, draw element)

Image with my problem here:

But I've got some problems because objects can be behind another objects inside another batch.

How can I do something like that?

sentences:
How 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:
How to test for adjacency? I need to come up with a better way to test for adjacency in a grid environment.  Imagine that the blue is water, the green is land, and the red dot is a character.  What I need to do is efficiently return a list of Vector positions of all grid tiles for the "island" that the character is on.

I have attempted to do this with raycasts using the following procedure.

-raycast at all of the immediately adjacent nodes surrounding the player.

-if (hit == land) then add hit to adjacent list.

-raycast at all immediately adjacent grid cells around each of the previous hits on land. (if they have not already been tested)

-if (hit == land) add to the adjacent list.

-loop until no more hits on land.

this seems to work okay, but is not very fast. If possible I need to maintain the raycasting because the levels are randomly generated at run time.

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:
Stuck at tile seams using 2D collision I'm making a little top down 2D dungeon crawler, and have pretty much fallen over at collision detection with my dungeon walls. I have figured out how to stop my player sprite at the walls, but I'm having trouble with the seams of the vertical walls. Horizontal walls, for some reason, are giving me absolutely no issue.

I store a bunch of rectangles representing the dungeon walls, and for each entity that is of the type RigidBody.Type.Moving, I collision check using a projection of where the entity will be based on its current X & Y velocity (against all rectangles, at the moment).

Here is my collision detection code:

var dt = (float) gameTime.ElapsedGameTime.TotalSeconds;
var rb = entity.GetComponent<RigidBody>();
var body = rb.Body;

// We only want to do collision checks for bodies that are moving.
if (rb.Type != RigidBody.Type.Moving) return;

// Don't collision check against itself!
var rectangles = CollisionWorld.Instance.Bodies.Where(b => b != body);
foreach (var rectangle in rectangles)
{
    // Work out where the entity is going to be next with its current velocity
    // and store it as a rectangle to collision check on.
    var projectedBody = new Rectangle(
        (int)(rb.Position.X + rb.Velocity.X * dt),
        (int)(rb.Position.Y + rb.Velocity.Y * dt),
        body.Width, body.Height);

    // If we have a collision, continue. Otherwise move on.
    if (!Collision.DoesCollide(projectedBody, rectangle)) continue;
    var side = Collision.CalulateCollisionSide(projectedBody, rectangle);

    if (side == Collision.Side.Top || side == Collision.Side.Bottom)
    {
        rb.Velocity.Y = 0;
    }
    if (side == Collision.Side.Left || side == Collision.Side.Right)
    {
        rb.Velocity.X = 0;
    }
}

I have tried finding the collision intersection, and using it to offset the player's position. by that and that kinda works, but then the sprite is all jittery whenever it collides. I've been bashing my head against this for a couple of days, now.

Why would the seams between each vertical tile be causing my sprite to get stuck?

sentences: How can I mark levels as "complete" in a way that prevents cheating? My first thoughts about marking levels complete is to just write the information to a file upon level completion and load that in once the app is opened up again. But how could I keep this safe from tampering and prevent cheating?

sentences:
3d bounding Box border xna So, I'm trying to develop a 3d table tennis game, and I'm having problems when it comes to colliding the ball with the table. I have a bounding sphere for the ball and bounding box for the table, but the intersection isn't that accurate, and I'm guessing that the bounding box is incorrect since colliding the ball with the racket is good.

I'm trying to display the bounding box so that it would be easier to see where the error is, but I cant seem to implement the tutorials I've found with my code, or just don't know how. And, I'm I right in creating an AABB since my table isn't moving? If anyone could help, it would be greatly appreciated, or if anyone could suggest a better way to collide a ball with a box (if there is) thanks. I've pasted my bounding box detection, and the collision between the sphere and box. If more code is needed I'll post it. Thanks

http://pastebin.com/NDYmhXCh

http://pastebin.com/47vwJWSc

sentences:
Behavior after collision using masks overlap I'm using masks to make collision detection in a game using pygame. The detection works well, but I have had problems with the behaviour after collision.

In most games, the obstacles are vertical or horizontal, making easy manipulate the velocity of objects moving. So, if the object collide, there is just two options: cancel x component or cancel y component. In this way, the object stop the move only in the normal direction.

But, my obstacles have any shape (not any, just rectangles and triangles) and direction, making things hard.

Basically, I want to cancel the velocity component in the normal direction to obstacle in the collision point.

Some help?

Thanks

sentences:
At what point of the game should I request users leave a review? I'm planning on displaying a dialog requesting users review my Android game, but I'm wondering at what point I should display the dialog. I wont show the dialog until the user has completed several levels, but I can't decide where in the game flow to place it.

I have several options.

On game launch - my concern with this is that they're looking to play a game at this moment in time, not review the game.
On game exit - this seems a fairly classic time to do it, but many users wont quit by pressing back, often they'll just use the home button, or just turn the phone off. Also, if a user is stopping playing then they'll often be doing so because they've got something else to do.
On level completion - I will only request the review on successful level completion as I assume a player will be feeling good about the game at that point in time. My concern with this is that it interrupts game flow.

I'd be interested in hearing the thoughts of others on this.

sentences:
Generating spherical world from heightmapped terrain I am using a standard heightmapped procedural terrain in my project.  However, I want the terrain to appear spherical when the user zooms out.  This is an attempt to simulate the appearance of a spherical planet.  Here is my current algorithm:

        //get the direction from the "planet" center to this vert
        Vector3 sphereCentertoVertPosition = vert.Position - SphereCenter;
        sphereCentertoVertPosition.Normalize();

        //our rotation axis is the cross between the direction from this vert to the planet center and the root (center of the terrain) to the planet center
        RotationAxis = Vector3.Cross(sphereCentertoVertPosition, sphereCenterToRootPosition);

        //the amount we rotate is based on the distance of this vert from the center of the terrain
        Vector3 fromCenter = vert.Position - Root.Position;
        float amount = (fromCenter.Length() / ((myTextureWidth / Scale) / 2)) * (float)Math.PI;

        Quaternion rot = Quaternion.CreateFromAxisAngle(RotationAxis, amount);

        Vector3.Transform(ref vert.Position, ref rot, out vert.Position);

My main concern is that the rotation axis is not correct.  Theoretically, should it be the cross between the vert-to-planet-center and the terrain-center-to-planet-center?

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:
Access Entities components via the Entity that holds them, or via a separate System? Now, I'm implementing a component based game engine and I came to a thought: Which way should I access my components?

Have a list of Entities, which have a list of Components, and access them by going trough each entity, and updating/drawing/whatever on each component.

or

Have separate systems for each component type and acces them by going trough that systems components.

Or does it really matter? I think that the second way would seem faster...

sentences:
Data structure for a body I'm writing a game in Java and am struggling to think how to appropriately manage character's bodies.  My current structure is, in relevant part:

public class Character{
    private Body body;
    private Race race;
}

public class Body{
   private Leg rightLeg;
   private Leg leftLeg;
   //etc

   //the constructor takes a single Race argument and constructs a default
   //body for a member of that race

   public Leg getRightLeg(){
       return rightLeg;
   }

   ///etc
}

public class BodyPart(){
  //assorted instance variables and appropriate getters and setters
}

public class Leg extends BodyPart(){
  //leg specific stuff
}

public class AdvancedLeg extends Leg{
    //various different ways of improving body parts - magical enhancement
    //for example.  There are a number of these classes
    public AdvancedLeg(Leg l){
        //make leg better
    }
}

But this isn't working  because each character must have the same basic body structure - 2 arms, 2 legs, one torso, one head, etc.  Sure, I could have public class QuadrapodBody or similar (and make Body into an interface) but I certainly don't want to be getting in to public class OneHeadTwoRightArmsOneLeftArmOneRightLegOneLeftLegBody implements Body.

In essence I want to be able to flexibly assign body plans to each character and be able to manage getting body parts without having to write a potentially infinite number of classes each with a subtly different set of instance variables and getters/setters.

Hopefully my question is clear enough.

sentences:
SDL2 - Isometric map: Draw visible tiles or draw pre-rendered slice of the whole map? I started a small project which is basically an isometric map with tiles. Right now I render only the visible tiles - at each rendering cycle.

Because I don't have experience with actual SDL2 projects I'm asking myself if I can store a large map (e.g. 10000 x 10000 tiles with 32px each) completely into an SDL_Texture. In my rendering routine I could slice out everything that's visible and draw a few things on top of it, e.g. units.

sentences:
Steam web API won't work with new domain Following code works perfect on localhost (even using LightOpenID('localhost')). "mysite.com" is replaced with current site in real script. But for some reason this doesn't work on an external domain, but on localhost. Anyone knows why?

Seems like $openid->validate() returns false once on a server with a domain name, but on localhost it works fine.

<?php
require "lightopenid/openid.php";

$_STEAMAPI = "XXX";

try{
    $openid = new LightOpenID('mysite.com');
    if(!$openid->mode){
        if(isset($_GET["login"])){
            $openid->identity = "http://steamcommunity.com/openid/?l=english";
            header("Location: " . $openid->authUrl());
        }else{
            $notloggedin = 1;
        }
    }elseif($openid->mode == "cancel"){
        die("cancel");
    }else{
        if($openid->validate()){
            $id = $openid->identity;
            $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
            preg_match($ptn, $id, $matches);

            $url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $_STEAMAPI . "&steamids=" . $matches[1];
            $json_object = file_get_contents($url);
            $json_decoded = json_decode($json_object);

            foreach($json_decoded->response->players as $player){
                // now login, etc.
            }
        }
    }
}catch(ErrorException $e){
    echo $e->getMessage();
}
?>

sentences:
How do you build a rotation matrix from a normalized vector? I'm trying to find the correct way to build a rotation matrix from a unit vector. I have two arbitrary points in space (p1 and p2), and I'm trying to create the vertices for a rectangle to span between them.

From the points, I can get a unit vector easily enough. From there I've been trying to create a rotation matrix that I can apply to a set of hard-coded vertices to get them oriented correctly. The rectangle extends along the X axis, so I'm trying to rotate it's X axis to match the unit vector.

So far I've tried GLM::orientation:

glm::vec3 direction = glm::normalize( glm::vec3( p2 - p1 ) );
glm::mat4 rotation4 = glm::transpose( glm::orientation( direction, glm::vec3( 0, 1, 0 ) ) );
glm::mat3 rotation = glm::mat3( rotate4 );

As well as the manual matrix creation method mentioned in this similar question:

glm::vec3 direction = glm::normalize( glm::vec3( p2 - p1 ) );
glm::vec3 rotationX = direction;
glm::vec3 rotationZ = glm::normalize( glm::cross( direction, glm::vec3(0,1,0) ) );
glm::vec3 rotationY = glm::normalize( glm::cross( rotationZ, direction ) );
glm::mat3 rotation( rotationX, rotationY, rotationZ );

However, in both cases I end up with rectangle rotations that seem fine for axis-aligned rotations, but which veer off in weird directions in all other cases. In both cases, I'm attempting to specify the positive Y axis as up, to keep the rectangle level, but the rotated rectangle always ends up twisted around despite that.

I'm obviously doing this wrong, but I may just not be understanding the problem well enough. If someone could point me in the right direction, I'd appreciate it.

sentences: TCP Socket communication with unity I am working on communicating unity application with an PC app. Since I doesn't know how socket programming can be implemented in unity.Can anybody please help me in creating a simple small application using TCP socket with unity

sentences:
XNA UV Mapping flipping the Texture every second time I am making a tile based game. Recently I moved to drawing tiles as primitives to speed up things and also allow for easier lighting (Vertex Shader).

I then took it a step further and made some calculations to "merge" together tiles into the same primitive to gain even more performance, and to get around UV texture problems I simply did this...

if (!top)
{
    //Adds the top vertices
    thisquad.Vertices[0] = new VertexPositionTexture(new Vector3(new Vector2(p.X, p.Y), 0), new Vector2(0, 0));
    thisquad.Vertices[1] = new VertexPositionTexture(new Vector3(new Vector2(Tile.Size + p.X, p.Y), 0), new Vector2(1, 0));
    top = true;
}
//Extends the bottom vertices
thisquad.Vertices[2] = new VertexPositionTexture(new Vector3(new Vector2(p.X, Tile.Size + p.Y), 0), new Vector2(0, currentquadtilecount));
thisquad.Vertices[3] = new VertexPositionTexture(new Vector3(new Vector2(Tile.Size + p.X, Tile.Size + p.Y), 0), new Vector2(1, currentquadtilecount));
currentquadtilecount++;

With currentquadtilecount starting at 1, if a tile is floating on its own it will display the texture properly, but for every second tile that merges, the texture is flipped. As shown below...

What am I doing wrong? Is this even the right way to do this??

Twitchy

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:
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:
Loading TextureRegion with filter diff from that of texture it came from I am using libgdx .
While packing my texture atlas I have set the filter for mag and min to Nearest . But for just one region I wish to draw it with linear filter . Is it possible to have different filters for texture region than that of texture atlas it came from.

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:
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:
Blender: How to merge two faces? Initial Situation
Using Blender 2.6, I often come to the same problematic setting: There are two faces on one straight line.

My Aim
I want to keep just one of the two selected faces, which you can see above. And all of the vertices adjoining the one face should be merged [Alt + M in Vertex Select Mode] with the apt vertex adjoining the other face.

Summary
I just simply need a tool working like Vertex Merging [Alt + M in Vertex Select Mode] for faces.
How can I do that easily?

sentences:
How should I structure VBOs for my 2d world data? My game is played on a fixed-size hex based arena, where each hex can be of a different type, and possibly contain some creatures/items/anything on it.

When I started out, I got the advice to have a VBO per entity, which I took quite literally and ended up creating a VBO per-hex per-frame, which got real slow. This lead me to restructure the data in a way that I pre-calculate all of the VBO data for the "background" hex grid just once, and just repeatedly draw it.

The problem is that now I can't simply rely on changing the model and having everything be updated, as the whole "map" is pre-calculated. Following this I created a separate VBO which is filled just with "dynamic" objects that change on each frame, and first render the static background, and then the dynamic part that changes.

But this leads me to a question. What if I need to change the background at runtime? For example, what if a "wall" gets torn down every once in a while, and I need to update the world data? Currently I can think of only a few options:

Change the VBO in place during the frame. This would only work if the change is small enough to not lag the frame.
Keep a separate VBO that just has the "changes" and is drawn over the original one. I don't really like this approach, as it doesn't really feel flexible.
Build a new VBO in a separate thread and atomically swap them once done. While this would allow me to do a larger update without sacrificing framerate, it could also introduce a weird kind of latency, when the user would still see the old thing for a few frames until the new VBO is calculated.

Ideally I'd just change my "model" and re-build the whole VBO from it, but that's about as slow as it gets, so I'm not really sure if I should even keep thinking this way?

How do larger and more complicated games handle updating geometry on the fly? Is everything just pre-calculated animations that simply get swapped around?

sentences:
IDE cannot find CoreMinimal.h, Unreal Engine 4 course I'm following this tutorial on Udemy about learning the basics of Unreal Engine as I start up my CS degree, and I've reached a problem where CoreMinimal.h cannot be found.

This solution was proposed in the Q&A community, however I still could not quite understand it! I'm still learning and would love some help ;)

Here is my code!

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "ShipController.generated.h"

UCLASS()
class SPACESHOOTER_API AShipController : public APawn
{
    GENERATED_BODY()

public:
    // Sets default values for this pawn's properties
    AShipController();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};

sentences:
How do you call game mode where the time is running out and player can increase time by collecting coins I am working on an arcade game and I want to make a game mode, where the player has some time to collect coins. When a coin is collected player gets extra time, so the game can continue infinitely. But when the time is run out the game ends.
I don't know how to name this game mode. Do you have any suggestions? Something like: Time attack?

sentences:
Vector games (Wireframe, Elite-like) theory and implementations? I'm interesting in knowing more about how vector games like Elite and Star Wars Atari were built from grounds up. The question is not how to implement vector graphics with modern 3D APIs like OpenGL and DirectX, since doing it is quite easy and does not require to build a vector/matrix system from scratch like those games did.

Some things I presume about these games:

They work on an extremely low level and are written in ASM
They're actual 3D games and not faking it like After Burner. Not like Wolfenstein 3D, either. Afterburner used rotozoom/raster effects and Wolfenstein 3D used raycasting and 2D scaling and it's not really 3D, since you can't move up. Even if you could like the Build Engine that Duke Nukem 3D used, everything except the walls is just a sprite. Star Fox is closer to it, since uses actual 3D models, but the implementation uses SNES' Super-FX chip and probably employs scanline trickery. I know Elite probably uses said scanline trickery as well (at least on some implementations like Elite NES) but I'm not sure about SWA, since it used a custom-built arcade machine; either way, I'd like to know more about it.
Their 3D models are actual 3D models. They are defined as vectors and transformed according to the position of the camera.

I know the best thing to do would be to disassemble the source of Elite and see how things were done by myself but before doing that I want to know more about how they were made and if there are modern open-source projects that show similar techniques. I don't mean Elite remakes like Oolite (which uses OpenGL and Obj-C) but projects that use similar techniques and avoid using APIs like OpenGL directly - not necessarily low-level projects, though, using 2D library like SDL (without OGL) should be enough, at least for now.

I know that the source code to MESA3D probably contains many of the routines that games like Elite and SWA implemented - I just want to see them in the context of a game. I know that what Elite and SWA basically did was implement Rasterisation, create their format for models and a loader (I'm pretty sure that at least SWA had models built from modelers using tools, although it's not impossible to hard-code TIE-fighters it's hard to do so accurately) and many other things I may be unaware of. But it's really time-consuming to get into and I don't care about much of the stuff that is in it. Keep in mind that games like Elite were very lightweight due to the low ROM and RAM that computers and consoles had at the time.

I'm new to 3D graphics and all my assumptions are based on my limited knowledge of 3D Geometry and school level maths, sorry if I said any bullshit. But I'd really like to know more about how those games work in every detail, and possibly not just "buy X book" since I'm quite broke. Although I'd buy a book about the development of Elite or a similar game, if it existed. Some general suggestions would be enough.

sentences:
Key Handling mechanics I am new to game development and am working on my first game using OpenGL and C++.
I have a game class which handles everything necessary in an update() function.
Now i want to handle keyboard inputs. I use GLFW which supports key callbacks. However i wonder how to deal with inputs. Should i record the keys pressed and poll on it the next time my game updates or should the callback immediately perform the necessary actions? And why?

Thanks :)

sentences:
How can I split up a large model into an octree codewise? For collision detection, I am attempting to split up a large model into an octree.

If we take this black thing thing to be the ship (104,000 vertices):

Then I would like to split up the faces

I could easily split them up, but the problem is one of location. For example, if we take the bottom left chunk, how can I know that the projectile (in this case, a cannonball) is at that specific chunk?

And also how can I define the areas of the chunks in the first place? And for that matter, I need them to rotate with the ship as well!

I'm hopelessly lost as of how to do this, and so I'm hoping someone can help me out.

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:
Finding the monitors orientation in XNA for Windows Just to be clear this is not for Windows Phone 7. =)

I've got some interesting requirements for a project and I'm having trouble trying to find the information I need.

I have two monitors. The default monitor is landscape. The second monitor is portrait.

Right now I save the width and height and then change Graphics.PreferredBackBufferWidth and Graphics.PreferredBackBufferHeight to the values returned from GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width (1920) and GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height (1080) right before toggling to full screen. This works fine on the monitor in landscape mode. The monitor in portrait however scales 1920x1080 to fit onto the 1080x1920 screen.

I'm looking for either a way to determine that the monitor is in portrait mode or have the CurrentDisplayMode.Width and CurrentDisplayMode.Height return the portrait appropriate values.

I've been rifling through the XNA Framework documentation and googling like mad and not finding anything helpful.

sentences:
How can I generate random lakes and rivers in my game? I have a 2D block building game and am trying to make randomly generated lakes and rivers. I have looked into the Perlin noise algorithm, but, I couldn't get it to generate random and nice results.

I have been trying to use the python noise library, but, it didn't create maps very randomly.

Is there some seed function I am missing on that library to make it more random? What variable do I change if I want it to go more random? If possible, give me a less technical answer, with less math and more python terms.

The map is a 2D tiled map. Here is some examples of the non-randomness of the other algorithm. The following code was outputted 3 times in a row. I was randomizing the octaves and frequency with something like this: freq = 16.0 * random.randint(1, 500000) * 0.000001 + 0.5

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1
1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

This is the code that produced the output above:

"""Writes a 256x256 grayscale simplex noise texture file in pgm format
(see http://netpbm.sourceforge.net/doc/pgm.html)
"""
# $Id: 2dtexture.py 21 2008-05-21 07:52:29Z casey.duncan $

import sys
from noise import pnoise2
import random
octaves = random.randint(1, 500000) * 0.000001 + 0.5
freq = 16.0 * octaves
for y in range(30):
    for x in range(40):
        n = int(pnoise2(x/freq, y / freq, 1)*10+3)
        if n>=1:
            n=1
        else:
            n=0
        print n,
    print

sentences:
Only 1 TextMeshProUGUI being affected by coroutine I have a prefab m_wordContainer which is empty other than having a TextMeshProUGUI as a child (I did this so that I could position this container freely not being bugged by an animation played by the TMPUGUI object). At the start of the program I start a coroutine (SpawnWordPopups) which splits the words in a sentence, making a copy of m_wordContainer and assigning that word to the text property of its TMPUGUI, spawning such m_wordContainer in a random location within the screen, and then starting a coroutine (FadeText) that fades in the text of every TMPUGUI.
The problem is that only one of the TMPUGUI has its text faded, even though the FadeText coroutine is called seemingly correctly.
All words are shown as expected, only thing missing is the fading effect on all but the first word that fades.
If I called FadeText like this: if (i > 0) { yield return FadeText(true, tmpText, 2); } then only the second word will be faded.
 [SerializeField] private GameObject m_wordContainer;

    void Start()
    {
        yield return StartCoroutine(SpawnWordPopups("test foo bar"));
    }

private IEnumerator SpawnWordPopups(string l_line)
    {
        string[] words = l_line.Split(' ');
        List<Vector3> wordPositions = new List<Vector3>();
        for (int i = 0; i < words.Length; ++i)
        {
            Vector3 spawnLocation = new Vector3(Random.Range(m_wordScreenDistanceOffset, Screen.width - m_wordScreenDistanceOffset), Random.Range(m_wordScreenDistanceOffset, Screen.height - m_wordScreenDistanceOffset), 0);
            if (IsWordOverlapping(wordPositions, spawnLocation))
            {
                --i;
                continue;
            }
            wordPositions.Add(spawnLocation);
            GameObject wordContainer = Instantiate(m_wordContainer, transform.parent);
            wordContainer.transform.position = spawnLocation;
            TextMeshProUGUI tmpText = wordContainer.GetComponentInChildren<TextMeshProUGUI>();
            tmpText.text = words[i];

            yield return FadeText(true, tmpText, 2);
        }
    }

    private IEnumerator FadeText(bool l_fadeIn, TextMeshProUGUI l_textBox, float l_time)
    {
        float time = Time.time;
        float until = Time.time + l_time;
        int alphaFrom = l_fadeIn ? 0 : 1;
        int alphaGoal = l_fadeIn ? 1 : 0;
        Color textColor = l_textBox.color;
        textColor.a = l_fadeIn ? 0 : 1;
        l_textBox.color = textColor;

        while (time < until)
        {
            textColor = l_textBox.color;
            textColor.a = Mathf.Lerp(alphaFrom, alphaGoal, Time.time / l_time);
            l_textBox.color = textColor;
            time += Time.deltaTime;
            yield return null;
        }
        textColor.a = l_fadeIn ? 1 : 0;
        l_textBox.color = textColor;
    }

Could anyone shed some light into this issue I'm having? Why are not all the words being faded?

sentences:
How to run the built .exe file? I'm fresh new to unity and I only followed several tutorials. Up to now, I always used/tested the games inside of unity and now I would like to use them even on different systems. Hence, I built the game and I will get a folder with several files, e.g.:

"Tutorial.exe"
"UnityCrashHandler64.exe"
"UnityPlayer.dll"
"WinPixEventRuntime.dll"

and the folders "MonoBleedingEdge" and "Tutorial_Data".

I wonder why is the .exe called Tutorial.exe? Because I'm using files from a tutorial? Probably, however, this is not really my question, instead I would like to know how I start the game..  when I run "Tutorial.exe", the terminal opens and I get the following lines there:

Mono path[0] = 'C:/Users/info/Desktop/game_tutorial/Tutorial_Data/Managed'
Mono config path = 'C:/Users/info/Desktop/game_tutorial/MonoBleedingEdge/etc'
PlayerConnection initialized from C:/Users/info/Desktop/game_tutorial/Tutorial_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55319
Multi-casting "[IP] 192.xxx.y.zz [Port] 55319 [Flags] 2 [Guid] 2366299205 [EditorId] 3420877675 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-58KOK07) [Debug] 0 [PackageName] WindowsPlayer" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55319]
PlayerConnection already initialized - listening to [0.0.0.0:55319]
Initialize engine version: 2018.4.13f1 (497f083a43af)
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
FMOD initialized on nosound output
Begin MonoManager ReloadAssembly
- Completed reload, in  0.132 seconds
UnloadTime: 0.683600 ms
Setting up 2 worker threads for Enlighten.
  Thread -> id: 2bc8 -> priority: 1
  Thread -> id: 2280 -> priority: 1

I would expect being set into the game? The game has no menu or anything else, one should just be spawning in a landscape and walk around. Instead I end up in the console all the time.

What am I doing wrong?

More information: I'm following this tutorial here: https://www.udemy.com/course/virtual-reality-game-development/learn/lecture/7118680#overview
So it is about a virtual reality scenario but afaik the building and so on shouldn't really be different. These are the options I use to build:

I would like to use the htc vive. I use two different systems: The one where I build the game has steam and steamvr installed but no connected hmd. The other one is in another chamber where I play vr and so on.

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:
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:
Building a Flash Platformer I am basically making a game where the whole game is run in the onEnterFrame method. This is causing a delay in my code that makes debugging and testing difficult. Should programming an entire platformer in this method be efficient enough for me to run hundreds of lines of code?

Also, do variables in flash get updated immediately? Are there just lots of threads listening at the same time?

Here is the code...

stage.addEventListener(Event.ENTER_FRAME, onEnter);

function onEnter(e:Event):void
{
//Jumping

if (Yoshi.y > groundBaseLevel)
{
    dy = 0;
    canJump = true;
    onGround = true; //This line is not updated in time
}

if (Key.isDown(Key.UP) && canJump)
{
    dy = -10;
    canJump = false;
    onGround = false; //This line is not updated in time
}
if(!onGround)
{
    dy +=  gravity;
    Yoshi.y +=  dy;
}

//limit screen boundaries

//character movement
if (! Yoshi.hitTestObject(Platform)) //no collision detected
{
    if (Key.isDown(Key.RIGHT))
    {
        speed +=  4;
        speed *=  friction;
        Yoshi.x = Yoshi.x + movementIncrement + speed;
        Yoshi.scaleX = 1;
        Yoshi.gotoAndStop('Walking');

    }
    else if (Key.isDown(Key.LEFT))
    {
        speed -=  4;
        speed *=  friction;
        Yoshi.x = Yoshi.x - movementIncrement + speed;
        Yoshi.scaleX = -1;
        Yoshi.gotoAndStop('Walking');

    }
    else
    {
        speed *=  friction;
        Yoshi.x = Yoshi.x + speed;
        Yoshi.gotoAndStop('Still');
    }

}
else //bounce back collision detected
{
    if(Yoshi.hitTestPoint(Platform.x - Platform.width/2, Platform.y - Platform.height/2, false))
    {
        trace('collision left');
        Yoshi.x -=20;

    }
    if(Yoshi.hitTestPoint(Platform.x, Platform.y - Platform.height/2, false))
    {
        trace('collision top');
        onGround=true;  //This update is not happening in time
        speed = 0;

    }

}
}

sentences:
XNA Sprites Not Drawing Correctly I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other.

For example, at the start I have sprite font being drawn over a background image and half the text is not shown when I add the image.

        _sb.Draw(_background, new Rectangle(0, 0, 800, 480), Color.White);
        if (isPaused)
            _sb.DrawString(_bigFont, "Resume", new Vector2(295, 200), Color.Black);
        else
        _sb.DrawString(_bigFont, "Start", new Vector2(315, 200), Color.Black);

The text then seems to appear if I change the value of other text on the screen.

Is there something I am missing here?

Thanks.

sentences:
How to correctly Dispose a SourceVoice once its finished i am starting to play a sound with XAudio2 and SourceVoice and once its finished, it should be correctly disposed to not have any leaks.

i was expecting it to be something like this:

        sourceVoice.Start();
        sourceVoice.StreamEnd += delegate
            {
                if (!sourceVoice.IsDisposed)
                {
                    sourceVoice.DestroyVoice();
                    sourceVoice.Dispose();
                }
            };

but that crashes with a read access violation in native code deep in XAudio2.dll which i cant debug.

sentences:
How to reduce weird polygon artifacts? I wrote an application that takes an obj file, parses all the vertices, UV coordinates and normals, loads them into an OpenGL VBO and presents the model on screen. It works, but I'm getting annoying aliasing artifacts.

Notice black edges popping in and out of existence:

This happens with every model I load. I have tried enabling antialiasing, but although edges appear less jagged, the black artifacts still appear, only smoother. I need them completely removed.

What's the best way to fix this?

sentences:
need to create formulas for stat, level progression etc. What tools will help the not-mathematically-literate? I want to create some of the fundamental guideline formulas for a game I am working on. I am following on from sirlin's advice in that I am starting with some assumptions and working back from there.

So let's say that I want to have the player do an average of 1000hp damage at level 100 and 10 at level one. Is there a tool that I could use to draw this (a low exponential curve) and it would spit out a formula based on the curve?

There are some similar questions on here but none that I can find with any advice on the specifics of making the formulas for these progress curves.

thanks

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:
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:
load textures using assimp I've got .obj model with .mtl materials.I load like this: When I get aiTextureType_DIFFUSE I create new texture object and then call glGenTextures, glBindTexture and etc.

for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
    const aiMaterial* pMaterial = pScene->mMaterials[i];

    m_Textures[i] = NULL;
    if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
        aiString Path;

        if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
            m_Textures[i] = new Texture();
            if (!LoadTGA(m_Textures[i], const_cast<char*>(FullPath.c_str())))
            {
               ....
            }
            else {
        glGenTextures(1, &m_Textures[i]->texID);
        glBindTexture(GL_TEXTURE_2D, m_Textures[i]->texID);
        ....

How to load texture with diffuse, specular, ambient, shininess properties when they are all together in material file?

sentences:
Algorithm for drawing asteroids from, er... Asteroids game? What would the algorithm be for generating/drawing the asteroid shapes from the original Asteroids game? Is it even an algorithm? Or would they be hard coded shapes?

Here is a screenshot to jog your memory.

Screenshot from Asteroids game http://www.heinzwerner.de/emu_asteroids.jpg

EDIT - Also found this:

alt text http://www.next-gen.biz/files/images/feature_article/2009/05/asteroids4.jpg

from the article Edge - The Making of Asteroids. Interesting read, but does not mention any specifics.

sentences:
Unity - job system compatibility for end user? I'm thinking about using Job system. But it requires .Net 4.x (also look like .Net 4.x will be default for Unity in 2019). It is a little hassle for me cause I'm using Visual Studio 2015, I have to download & install .Net target pack 4.7

My question is: If my game is developed with .Net 4.7.2 (so that I can use Job system), does it require the end user installing .Net 4.7.2 to play the game?

My target user is low-end PC (they may using windows 7, I see that .NET Framework 3.5.1 is included in Windows 7)

sentences:
Using one Vive controller: default to left hand? We're making a sailing game in VR for Vive Pro, where you hold the rudder with your left hand using a Vive controller. We use just one controller because there's nothing to do with your other hand, and the rudder is on the left side of the player (it's a seated setup). The second controller will be charging, or it will be off while the game is being played.

We use the Player prefab that comes with the Steam VR Unity Plugin, that has GameObjects for both the left and right hand, with the option to show controllers and/or hand skeletons that move according to what controls you're using on the controllers.

The problem is that when only one controller is on and detected by Steam VR, it decides to show the right hand, instead of the left hand that we're holding it with.
When both controllers are switched on and connected, it works as expected. The left hand controller is at the player's left side as long as the unused controller is located at the player's right side.

I tried putting a left handed skeleton on the right hand controller gameObject in the Player prefab, but that resulted in an unresponsive skeleton (not visualising the interaction of the player with the controller).

How can we make it so that when using only one controller, it shows as the left hand?

So what we want is like in this picture, hold the controller with one hand (normally the left hand) except always showing a left virtual hand in the application, and still mimicking whatever controls the user is pressing on the real controller.

sentences:
Is continuous loop best idea for Android OpenGL game? I've done some small OpenGL games for computer. I've used continuous loop (with VSync) for game life cycle, input - update - render. Now i'm going to write simple game for Android, but i'm wondering if it is the right way to go.

What matters? Battery usage, i've played some simple games that used so much battery compared to their complexity and graphics and i don't wanna to create that battery hungry game.

sentences:
How can I disable the red X button in unity? I just want to know how to disable the red X button in the game window using unity, to prevent the player for example from closing the game.

So if anyone knows how to do it, any help would be greatly appreciated.

sentences: To use Apple's game servers, do I need to enroll in the Apple Developer program? I am developing a multiplayer iPhone game. To use the Apple game servers, do I need to register for the Apple Developer program?

sentences:
Unity not opening in Ubuntu I installed the latest version version of Unity for Linux from the official website, but when I try to launch Unity, it displays a blank dialog box. I waited for a long time, but nothing happens.

These are my system specifications. I was running Unity on the same computer, several months ago, using Windows.

Model: Thinkpad R500
Processor: Intel® Core™2 Duo CPU P8600 @ 2.40GHz × 2
RAM: 2Gb DDR3 RAM
Storage: 155Gb HDD
Graphics Card: ATI Mobility Radeon HD 3400 Series 128mb dedicated GFX

Why is it doing this? Is there a problem with the latest build? What should I do to fix it?

sentences:
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:
How do I ensure consistent behaviour when using Unity's Collider2Ds for triggers and collisions? I am experiencing inconsistent behavior using Unity's 2D Physics engine and their Collider2Ds to detect collisions and triggers on my projectiles. I will classify it into two problems. The first is that occasionally the projectile will pass through walls/objects it should collide with. The second is that occasionally the projectile will pass through enemies that it should hit without triggering. I will try to elaborate in detail below.

A projectile is organized into a container Projectile GO and two children GO: a PhysicsColliders GO and a HitBoxColliders GO.

The PhysicsCollidersGO job is to hold the colliders that define the solid regions of the projectile using Collider2D components. It's GO is on a Projectile layer which is set to collide with other solid layers such as the ones my walls are on. Walls are static colliders.

The HitBoxCollidersGO job is to define the a HitBox area. It's GO is on a HitBox layer and also uses Collider2D components that are set to be triggers. A HitScript on the GO listens for OnEnterTrigger.

Projectiles are set in motion by setting the velocity of the RigidBody once upon firing.

Here is a visual of the structure:

 ProjectileGO
  - PhysicsCollidersGO
  - HitBoxCollidersGO

Here are descriptions of the GameObjects and their components:

 ProjectileGO
   - RigidBody2D Component (collisionDetectionMode is set to Continious)

 PhysicsCollidersGO (Layer is set to Projectile)
   - BoxCollider2D Component

 HitBoxCollidersGO (Layer is set to HitBox)
   - BoxCollider2D Component (IsTrigger is set)
   - HitScript Component

Problem 1. Projectiles will sometimes not collide with walls/solid objects/etc...

Problem 2. Projectiles will sometimes not trigger a hit.

What could be causing these inconsistencies?  How can ensure that collisions and triggers will consistently behave correctly?

sentences: How realistic are procedural textures in sandbox? I'm working with Unreal and want to make a Minecraft-Style Block-Sandbox with HD-textures. Since at that resolution the repetitive pattern becomes too noticable, I'd like the game to generate the textures on the fly, based on coordinates, so the blocks have a seamless appearance, and distance to player, so further away blocks have a lower resolution. I'd love something between Rust and Grounded, Quality-wise, so it will include PBR, SSS, and height maps. I've got a fairly powerful PC, but since the CPU will have to constantly generate textures, which all would have to be stored inside the RAM, I was wondering how realistic something like that would be in the first place. And how I could save resources, things like reducing the quality in the shadows or so on. Thanks in advance.

sentences:
Destroy object copies? I want to know how to destroy object copies.

    public GameObject sparks;

void Update() {

}

void OnTriggerEnter(Collider bulletv) {

    if (bulletv.gameObject.CompareTag("enemy"))
    {
        Destroy(this.gameObject);
        Instantiate(sparks,transform.position,transform.rotation);
        // destroy sparks copies after 2 seconds !!!
    }
}

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:
Can I use a BlendState object to emulate a draw call's blending color? I'm working on a lighting system for a tile-based game.

What I want to do is draw my tiles to the screen, then draw a single Texture2D object (my light map) over top of them. However, doing it in two steps results in the tiles looking "painted" and washed out.

To get this effect working, I called Texture2D.GetData() and then used that Color as the blending color when calling SpriteBatch.Draw() on each tile, which results in them being "tinted" correctly. This works, but it's a fair bit slower, and won't scale up for huge maps/view areas.

So, is it possible to use a BlendState object to do what I am doing above?

Tile map
Light map
Tile map with light map applied (per tile)

sentences:
Unity procedural skybox shader texture stretching I am using the procedural skybox shader that Unity provides, but have tweaked it so that I can have a cloud texture.

The problem I have, is that the texture is not tiling correctly, even though it is a repeatable pattern.

In the GIF below you will see the stretching, but it tiles everywhere else.

Here is the test cloud texture I am using.

Am not doing anything unusual in the shader I don't think.

// In the vertex (copied this from another shader, could this be the problem?)
OUT.uv = TRANSFORM_TEX(v.uv, _Sky_Clouds);

// in the fragment before returning the color

c = c + tex2D(_Sky_Clouds, IN.uv);

How can I use the cloud texture so it tiles around the whole skybox without stretching?

The look I am trying to achieve is like this...

That image is from this video tutorial by BlenderGuru.

https://www.youtube.com/watch?v=9Q8PwcDzb8Y&t=1046s

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:
Tournament ranking for card game bot fights - how to try new bot against existing ranking? Let's say we run a tournament for 10 bots playing 1-1 fights in card game with significant randomness influence. To measure bot skills level we run round-robin with 10k matches per each pair. Ranking shows that bots #3, #4 and #5 have very similar result.

Some time later 11th bot is developed. What is the best strategy to rank it honestly?

Re-run whole tournament? Bots with similar results can come out on different positions.
Run all ranked bots against new one? Again, those results could re-rank previous positions, if taken into account.
something different?

CPU time is not limited and tournaments are run offline.

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:
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:
Tiled map seen from an angle I have working code to display a tiled map. It's composed of a OrthogonalTiledMapRenderer and an OrthoGraphicCamera :

camera.setToOrtho(false, WORLD_WINDOW_SIZE.x,
            WORLD_WINDOW_SIZE.y);

renderer = new OrthogonalTiledMapRenderer(tiledmap, 1 / TILE_WIDTH);

renderer.setView(camera);

So far so good. The map is rendered as seen from above:

My question is, how do I render it with the camera not facing right down to the floor?

Like this:

[Thanks to all GIMP developers :) ]

Is it possible? I tried Camera.rotate(45) but it rotates in the wrong axis. I can't set Camera.direction because of this  - taken from OrthogonalTiledMapRenderer.setView(camera) documentation :

  Sets the projection matrix and viewbounds from the given camera. If
  the camera changes, you have to call this method again. The viewbounds
     are taken from the camera's position and viewport size as well as
  the    scale. This method will only work if the camera's direction
  vector     is (0,0,-1) and its up vector is (0, 1, 0), which are the
  defaults.

If I change the camera direction, the renders are weird or non-existant.

Is it possible to do so with the standard LibGDX api? If not, how can I do this? If not are there any workarounds to get the same effect?

sentences:
Displaying a particular sprite from spritesheet using Phaser I am trying to make a card game using Phaser, the HTML5 JS framework.  Because I'm a terrible artist and can't design my own, I'm using a free spritesheet of playing card images I found online.  The problem is, I can't seem to figure out how to display individual cards using Phaser.

In the previous framework I used, I was able to create individual smaller sprites from the larger sprite sheet that I used.  But I can't figure out how to do that in Phaser, if it's possible at all.

So I looked into loading the image as a spritesheet, but it seems that spritesheets are used for animation only and you can't really display a particular 'frame' of the spritesheet (please correct me if I'm wrong).

I think what I need to do is load the image as a tilemap, however, the particular image that I'm using did not come with a json file specifying the layout (nor could I find one that did).  Being new to javascript I'm having trouble reading the Phaser source code to see how the json file should be formatted.

So in summary, what's the best way to display an individual card of a spritesheet of playing cards in Phaser given that I don't have a json file specifying the map data?

sentences:
Transition the scale of a sprite I'm new to LibGDX but I am making a menu with some basic animation, I would like to start with a sprite scaled up and then it would transition to the normal size.

Is it possible with LibGDX or do I have to use a third party library?

sentences:
2D Box Collision Trouble Hello I am trying to handle some simple box collision (axis-aligned) in my top-down 2d game, but running into a problem.

My game is running at a fixed time step, and checks for player-wall collision on each iteration. It retrieves some collision data (if it collided & what side of the bounding box) and adds some offset (dir) to the players position depending on the overlap amount.

// Check player with walls
        CollisionData col = testBoxCollision(m_player->getCollider(), wall.getCollider());
        if (col.isCollided){
            Vec2f dir(0.0f, 0.0f);
            if (col.left)
                dir.x -= (m_player->getCollider().getPosition().x + m_player->getCollider().getHalfSize().x) - (wall.getPosition().x - wall.getHalfSize().x);
            else if (col.right)
                dir.x += (wall.getPosition().x + wall.getHalfSize().x) - (m_player->getCollider().getPosition().x - m_player->getCollider().getHalfSize().x);
            if (col.top)
                dir.y -= (m_player->getCollider().getPosition().y + m_player->getCollider().getHalfSize().y) - (wall.getPosition().y - wall.getHalfSize().y);
            else if (col.bottom)
                dir.y += (wall.getPosition().y + wall.getHalfSize().y) - (m_player->getCollider().getPosition().y - m_player->getCollider().getHalfSize().y);

            m_player->GameObject::setPosition(m_player->GameObject::getPosition() + dir);
        }

The testBoxCollision function:

CollisionData testBoxCollision(const Collider& a, const Collider& b)

{
    CollisionData c{ false, false, false, false, false };

float w  = a.getHalfSize().x + b.getHalfSize().x;
float h  = a.getHalfSize().y + b.getHalfSize().y;
float dx = a.getPosition().x - b.getPosition().x;
float dy = a.getPosition().y - b.getPosition().y;

if (abs(dx) <= w && abs(dy) <= h)
{
    c.isCollided = true;

    float wy = w * dy;
    float hx = h * dx;

    if (wy > hx)
    {
        if (wy > -hx)
            c.bottom = true;
        else
            c.left = true;
    }
    else
    {
        if (wy > -hx)
            c.right = true;
        else
            c.top = true;
    }
}
return c;

}

The Problem

When two walls produce a corner, and I push my player up to the corner, the player goes through the wall. Not Ideal!

Clearly I've overlooked something and another set of eyes would be very helpful. Thanks.

Below is a snapshot of what's happening.

EDIT: I'm led to believe this is a math error, because it only happens on some corners at a consistent frame rate.

sentences:
Pushing Rigidbody forward doesn't go straight I have a object that pushing rigidbody forward when it's instantiated:

GameObject grenade = Instantiate(projectilePrefab, shootPoint.position, shootPoint.rotation);
grenade.GetComponent<Rigidbody>().velocity = transform.forward.normalized * 50;

It seems fine, but when I ran the game, projectile always not going straight and it's little bit moving left or right.

So I thought that shoot point wasn't pointing the right direction or my crosshair didn't centered properly, but unfortunately there were nothing wrong with them.

I think there's no extra forces that affects physics in my scene except gravity, and gravity has default settings which only affects downside. But why projectile doesn't go straight and move little bit left?

What am I missing?

sentences:
Why does my first person camera attached to a rigid body vibrates? I'm trying to make a first-person character with a rigid body. I need a rigid body because I want to add areas where the gravity comes from different directions so I also need to rotate the character accordingly. And as far as I know you cant rotate a character controller.

So I wrote a script for movement and camera rotation.

The problem I now face is that the camera vibrates. I recorded this video to show it.

Why do I get this and how do I fix this?

Movement code:

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

public class PlayerMovementRigidBody : MonoBehaviour
{
    public float speed = 10.0f;
    public Rigidbody rb;
    public LayerMask groundLayers;

    public float jumpForce = 7;
    public CapsuleCollider col;

    float transelation;
    float straffe;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rb = this.GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        transelation = Input.GetAxis("Vertical") * speed;
        straffe = Input.GetAxis("Horizontal") * speed;
        bool jumping = Input.GetKeyDown(KeyCode.Space);

        transelation *= Time.smoothDeltaTime;
        straffe *= Time.smoothDeltaTime;

        /*if (IsGrounded())
        {
            rb.useGravity = false;
        }
        else
        {
            rb.useGravity = true;
        }*/

        if (IsGrounded() && Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }

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

    }

    void FixedUpdate()
    {
        transform.Translate(straffe, 0, transelation);
    }

    private bool IsGrounded()
    {
        return Physics.CheckCapsule(col.bounds.center, new Vector3(col.bounds.center.x, col.bounds.min.y, col.bounds.center.z), col.radius * .9f, groundLayers);
    }
}

Mouse look code:

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

public class MouseLookRigidBody : MonoBehaviour
{
    public float mouseSensitivity = 100f;

    public Transform playerBody;

    Rigidbody rig;

    float xRotation = 0f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rig = this.transform.parent.gameObject.GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    public void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);

    }
}

sentences:
RenderState in XNA 4 I was going through this tutorial for having transparency which can be used to solve my problem here. The code is written in XNA 3 but I'm using XNA 4.

What is the alternative for the following code in XNA 4?

device.RenderState.AlphaTestEnable = true;
device.RenderState.AlphaFunction = CompareFunction.GreaterEqual;
device.RenderState.ReferenceAlpha = 200;
device.RenderState.DepthBufferWriteEnable = false;

I searched a lot but didn't find anything useful.

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:
Image speeds up while moving and or rotating instead of constant speed I'm having a problem with rotating/moving an image. I've set one of my images to rotate on it's z-axis buy updating the angle, but when I run my game, the image starts slowly starts to rotate from a stationary position as if to build up momentum. Once it reaches a certain speed, it begins to slow down to almost a stop, then repeats the process over. Furthermore, when it starts to rotate, it's rotating clockwise. But halfway before it stops, it's now rotating counter-clockwise.

If I were to only update it's x or y position or both, the image will move slow, then speed up to the desired speed, instead of moving at the desired speed at start.

Lastly, if I were to rotate AND move the image, the image shakes erratically while rotating. My suspicion is that I'm calculating something wrong.

Within Shader

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;
....
gl_Position = projection * view * model * vec4(position, 1.0);

init()

        projection = glm::ortho(LEFT, RIGHT, BOTTOM, TOP, ORTHO_NEAR, ORTHO_FAR);

        mSprite.init("res/texture/foo.png", 1.0f);
        mSprite.setPosition(mPosition);
        mSprite.setRotation(rot, glm::vec3(0, 0, 1));

        glm::vec3 pos(1.5, 0.5, 0.0);
        mSprite2.init("res/texture/bar.png", 1.0f);
        mSprite2.setPosition(pos);
        mSprite2.setRotation(0.0f, glm::vec3(0, 1, 0));

update()

        mPosition.x += 0.000005f;
        mPosition.y += 0.000005f;
        mSprite.setPosition(mPosition);

        rot += 0.0005f;
        mSprite.setRotation(rot, glm::vec3(0, 0, 1));

render()

        mShader->start();
        mShader->LoadProjectionMatrix(projection);
        mSprite.draw(mShader, view);
        mSprite2.draw(mShader, view);
        mShader->stop();

draw(Shader* shader, glm::mat4& view) (mSprite)

        shader->LoadViewMatrix(view);
        shader->LoadTransformMatrix(mModel);
        shader->connectTexture(mTexture.id);
        // Draw image...

    void setPosition(glm::vec3 position)
    {
        mModel = glm::translate(mModel, position);
    }

    void setRotation(GLfloat angle, glm::vec3 axis)
    {
        mModel = glm::rotate(mModel, angle, axis);
    }

sentences: OpenGL +SFML + GLFW3 I'am maybe asking a stupid question, but can we mix OpenGl + SMFL and add to it some GLFW in the same SFML window ?

sentences:
How to make my model's top section rotate without rotating the entire model? I'm trying to learn a bit of Maya modeling so that I can be self sufficient when it comes to creating super basic assets for my game development. I'm trying to understand skeletal rigging and how it modifies the model geometry itself.

I've got the most basic model - a cube with proportions that make it into a 3D rectangle. I've rigged it with a very simplistic skeleton. My goal is to learn how all of this works, and create a character that has motion similar to maybe the magic carpet from Aladdin - it's a rectangle but the edges somewhat move like it has arms and legs.

When I rotate some joints, it distorts the entire model. I added a bit more geometry thinking that it'd allow the top section of my model to rotate a bit more without having to deform the entire model, but it still just seems to do the same thing.

How can I make the top section of my model be capable of moving forward and backward in such a way that it does not cause the entire model to move forward?

Here are some screenshots to help explain and show my situation ...

This is my model and skeleton (I told you it was super basic, lol) ...

And here is what happens when I rotate around the neck joint ...

And here is sort of what I was hoping to achieve ...

sentences:
How to determine if the player between two points? I'm making a skating game and I'm having trouble figuring out how to snap the player onto grinds and rails in between multiple points. My plan was to snap the player onto a point in between the two points using lerp, check which direction the player is facing using the dot product to compare direction of the rail from its first point to second and its second point to first and move them in direction that they are closer to.

But I'm having trouble with the first step. If the rail is more than two points how do I determine which two points do I use for lerping?

sentences:
Vulkan Error: cmd buffer submit cant use image because of layout I've been coding a Vulkan rendering engine for the past few weeks.
My code still continues to execute and I get the desired output, but I am getting an error.

I'm fairly certain that my error is a mistake in my code somewhere. My code is 1000+ lines, so I'm not going to ask anyone to debug it. I guess my question is what typically causes the error I'm getting, and how can I fix it?

I've been pretty closely following this (if this helps anyone): https://software.intel.com/en-us/articles/api-without-secrets-introduction-to-vulkan-part-3#_Toc445674490

My code draws the desired triangle from the tutorial, but I get an error for the first 3 frames:

VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x6) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x7) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x8) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.

I suppose I could just ignore this, because I get a desired output and the error doesn't seem to break anything, but I would guess that it's bad practice to leave this unfixed.

Thank you for anyone helping!

sentences:
Handle Multiple Scene For my game, now I adopt the strategy to create multiple scene.
For this I have to ask two question please provide your view for my and other members for improvement.

I have created single TextureManager class in which I load all the graphics of the game which is at least 50 MB.

-> My first question is that this much loading of texture will create any problem in game performance,So all the scene in the game have reference to this TextureManager class and they access corresponding texture region using dot operator. if other better strategy for this texture loading then please suggest me.

-> My second question is that my actual game scene uses bound camera and I perform scrolling on that camera but my other scene uses the normal camera. So in this situation what to do? how to use multiple camera for single engine? or how to reset available current camera?

My current working platform is andengine.

Thank for you support.

sentences:
Unity: Creating a Plane from 3 Vectors https://docs.unity3d.com/ScriptReference/Plane-ctor.html

  public Plane(Vector3 a, Vector3 b, Vector3 c); Description: Creates a
  plane.

  The resulting plane goes through the given three points. The points go
  around clockwise as you look down on the top surface of the plane.

Since there is no Debug.DrawPlane I don't know whether my plane works as expected. Are all 3 Vectors world coordinates? Or are they connected to each other? Can somebody elaborate how this works? Neither can I make any sense of "The points go around clockwise as you look down on the top surface of the plane"

sentences:
Find your value between four values in a grid based on distance, Unity Please note: Originally posted in stack overflow, redirected due to nature of problem.

I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by getting nearby temperature values and interpolating.

The way this works is, let's say we are at world space 95, 0, 65 (x,y,z). What I do is:

1) generate, using perlin noise, temperature values for every 20 squares (smartly generated to only do so to the 4 squares most relevant to us at any given time). We will get the points: 80, 0, 60 100, 0, 60 80, 0, 80 100, 0, 80

Each of these points is fed into a perlin noise generator and spits out a number. That number is the temperature.

So, in order to make the climate smoothly transition, I need to figure out how to get the distance each point weighted against its temperature so I can calculate the temperature of the space I am standing in.

If there is a name for this (there must be, I'm essentially sampling a gradient made by four points) and a way to do it, please just link that instead.

I tried taking the distance from my point to each point and multiplying that number against the temperature at that point, but I'm not sure if that's a correct first step, or what to do from there (just average the four resulting numbers?!).

sentences:
How to rotate a triangle towards the point in Qt? I have an issue with items rotating.

I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to be, and the left side represents how it works. Red dashed arrows represent motion, the triangle moves along its arrow. Green dashed arrow represent rotation, the triangle should rotates along its arrow.

How do I do calculations:

calculating desired velocity aka direction

velocity(direction) = Vec2DNormalize(targetPoint - locationPoint) * maxVelocity;

calculating angles for target point and location point

float angleLoc = atan2(rect->location.y, rect->location.x);

float angleTarg = atan2(rect->target.y, rect->target.x);

rotating after subtracting angleLoc - angleTarg

rotate((angleLoc - angleTarg) * 100);

Here it is the source code.

ster.cpp

#include "steer.h"
#include <QPointF>
#include <QBrush>
#include <QPen>
#include <vector2d.h>
#include <QGraphicsPolygonItem>
#include <QPolygonF>
#include <QPointF>
#include <QGraphicsItem>
#include <QDebug>
#include <cmath>
#include <vector>
#include <QtWidgets>

void Steer::seek()
{
    //calculating desired velocity aka direction
    rect->desired = Vec2DNormalize(rect->target - rect->location) * rect->maxspeed;

    //calculating steering force
    rect->steer = rect->desired - rect->velocity;

    //if the steer force is bgger than maxforce
    rect->steer.Truncate(rect->maxforce);

    //adding to acceleration steering force
    rect->acceleration += rect->steer;

    //add to velocity acceleration which has steering force only
    rect->velocity += rect->acceleration;

    //if the velocity is bgger than maxspeed
    rect->velocity.Truncate(rect->maxspeed);

    //changing our position
    rect->location += rect->velocity;

    //reset the acceleration
    rect->acceleration *= 0;

    viewport()->repaint();
}

Steer::Steer(QGraphicsView *parent)
    : QGraphicsView(parent)
{
    scene = new QGraphicsScene;
    rect = new Vehicle;

    scene->setSceneRect(0, 0, 500, 500);

    polygon <<  QPointF(5.0, 0.0) << QPointF(-5.0, 0.0) <<  QPointF(0.0, 20.0);
    rect->triangle = scene->addPolygon(polygon);

    this->setScene(scene);

    timer = new QTimer(this);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(seek()));
    timer->start();

    this->show();
}

void Steer::paintEvent(QPaintEvent *)
{
    QPainter painter(viewport());

    painter.setBrush(QBrush(Qt::green));
    painter.setPen(QPen(Qt::black));

    painter.save();

    //moving to position
    painter.translate(rect->location.x, rect->location.y);

    //calculating angles for target point and location point
    float angleLoc = atan2(rect->location.y, rect->location.x);
    float angleTarg = atan2(rect->target.y, rect->target.x);

    //rotating after substracting angleLoc - angleTarg
    painter.rotate((angleLoc - angleTarg) * 100);

    painter.drawPolygon(polygon);

    painter.restore();

    for(int i = 0; i < vec.size(); i++)
        painter.drawEllipse(vec[i].x() - 1, vec[i].y() - 1, 1 * 2.0, 1 * 2.0);
}

void Steer::mousePressEvent(QMouseEvent * click)
{
    point = mapToScene(click->pos());

    vec.push_back(point);

    rect->target.x = point.x();
    rect->target.y = point.y();
}

Here the whole project.

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:
Uniform lighting when there are multiple light sources I'm writing a 2d game where there are walls and the NPCs can only see what is within their line of site. To do this I'm using Box2dLights so the walls create shadows.

The problem I'm having is that each NPC has a light. This means that the lighting increases where multiple lights crossover. Instead I would just like the same amount of light to hit the areas that are visible to the NPCs.

To summarise I would like there to be a peak amount of light to be reached. If any more lights are added then the light doesn't increase past this threshold.

Here is an example of multiple lights crossing over.

How might I go about doing this?

sentences: How to improve textmesh quality? In my game I using textmesh, but textmesh has a pixel problem even adjusting scale, character size and font size.  How to solve it?

sentences:
Color change effect, with a sharp line separating the old & new colors I want to achieve some sort of "transformation" effect in Unity while changing colors in a mesh.

For instance, when changing its color from red to blue, I have a line going around the mesh, where the part of the mesh on one side of the line is red and the other is blue. Over time, the line moves so the object is entirely blue.

From what I understand, I would need some sort of custom shader to do that? Or would I need some sort of animation? I really have no clue how to achieve this kind of effect so any tips are welcome.

sentences:
How to give individual tiles their own collider in Unity's tilemaps? My floor tile is a 2D drawing of a 3D platform, for lack of a better description. I want my player character to stand not on the top of the tile but a little inside it, as the red circle does in the picture.

How do I give this tile its own collider that would fit this shape, while letting others have a normal, square one?

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:
Should the game host be the authority, or another dumb client? When designing a networked multiplayer-game where one player hosts and others connect, there are two strategies I'm aware of:

Have the host-player's game be the authority, with all other players as dumb-clients trying to catch up with the current game-state.  In the code, there will have to be lots of special cases, depending on if the current player is the host or not.
Make the host a dumb-client like everyone else by running a hidden dedicated server on another thread.  The dedicated-server will be the authority, and the host will connect to it like everyone else (through localhost).

What are the advantages/disadvantages of each of these?  Which is used most often (or does it vary by game type/size)?

sentences:
Why are assets (images) in Unity build reported as 28 times larger I'm trying to reduce a Unity WebGL build size which, for the data asset, is currently at 30 Mb.  I installed the Build report inspector.  On clicking the "Source assets" tab and choosing "Size" it showed the top entries were images.  Fine.  But all the sizes reported were between 4 and almost 30 times the size of the file on disk.  Is this just a bug / artifact of the build reporter or a genuine problem which I need to address to reduce the build sizes?

** Edit **

Two of the files are text files.  Their size in unity build report is the same as that on disk.  Why?

** Edit 2 - after Ed Marty's answer **

Using low quality with crunch compression at 70 results in slightly lower image quality but it went from 10 Mb to 300 kb, i.e. 30 times smaller size (and about 10x smaller than actual file size on disk).

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:
Print on the GUI in Unity I'm trying to show the players name on the GUI with a label.

GUI.Label(new Rect(10,10, 100, 30), playerName);

Instead of use the default style I want to use a different font with larger character.

Any suggestion to achieve this?

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:
What is the best approach to minimise the lag caused by ping when spawning predictable entities? When the client clicks it spawns a unit on the client-side which moves in a predetermined path, it also emits an event to the server which indicates that the client has spawned a unit. Once received the server then spawns a unit and updates it.
Both the client and server's update loop occurs 60 times a second, every 5 iterations the server emits the new state to the client which is then applied.
This works fine for very low ping however when the ping increases the unit that is spawned moves for a while and then snaps back to the position it was spawned (because the server has only just received the event and emitted the new state).
What are the ways I can deal with this?

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:
State Machine class vs function pointers What do you guys recommend to use?
A State Machine with function pointers or classes?

Or, in which case one would be better than the other one?

At work we use the state machine with function pointers only and I've never tried to use one with classes before.

sentences:
Incomplete mesh using DrawIndexedPrimitives after rotating mesh Through help on this site I was able to draw the triangles of an unrotated, nonscaled nontransformed mesh created in Blender and exported to OBJ, accurately imported through Assimp and rendered in XNA Graphics.
However after applying rotation on a single axis in Blender(Z) and adding materials(I wanted to test loading of materials through Assimp) the same mesh appears incomplete. Is something wrong with my view matrix or is it something else?

This is what the unrotated mesh looks like:

Here is the rotated mesh:

Camera, View and Projection are defined as follows:

cameraPos = new Vector3(0, 5, 9);
viewMatrix = Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0));
projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f);

Rendering is done through this code:

device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
effect = new BasicEffect(GraphicsDevice);
effect.VertexColorEnabled = true;

effect.View = viewMatrix;
effect.Projection = projectionMatrix;
effect.World = Matrix.Identity;

foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
    pass.Apply();
    device.SetVertexBuffer(vertexBuffer);
    device.Indices = indexBuffer;
    device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes[0].VertexCount, 0, mMesh.FaceCount);
}
base.Draw(gameTime);

sentences:
Check if OpenVR / SteamVR / OculusVR headset is mounted on your head The Oculus and the Vive have this light proximity sensor that detects whether you have your VR headset placed on your head currently or not.

Is there any way to tap into that for our own game checks? E.g. We could pause or restart the game depending on whether the headset's being worn or not.

I'm using Unity/C#, but any (driver / API level) help is much appreciated.

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:
How to remove jitter from motion input? I am writing a Minecraft mod that supports input from the Razer Hydra. It is a pair of motion controllers (one for each hand) that provide incredibly accurate position and rotation information.

For the purpose of this question, rotating the right controller on the Y-axis cause the player's character to look left or right (yaw), and rotating on the X-axis makes the player look up and down (pitch).

The input from the controller is mapped directly to the character's heading. If the controller is rotated 30 degrees left, the character turns 30 degrees to the left.

The problem is that the input "jitters". If I try to hold the controller perfectly still, the character's heading moves erratically within a very small cone (maybe 1 degree).

This is probably due to my shaky hands, as the controller's data is seemingly exact.

I tried filtering input by averaging data from the last X frames, but this makes input seem buttery.

My question is: How can I filter the rotational data to remove jitter without loosing precision?

sentences:
Need ideas on how to give my levels structure I am making an iOS game for a project at school. It is going to be a tiny bit like Fruit Ninja, as in it will have different things on the screen, and when you hit them, they die, and you get points. The trouble is that unlike Fruit Ninja, my game will have different types of sprites, all doing different things (moving different places, doing different things, etc).
The one thing that is bad about having all of these sprites that do different things is that it is hard for them to look neat on the screen all together. I was planning on having a couple of different gamemodes:

Time Trial
You have 120 seconds to kill as many sprites as possible.

Survival
You have three lives, every time you try to hit a sprite and miss, you lose a life.

????
Whatever I think of.

I am a rookie to game design in general, and I don't know the best way to make my game look good, and play well. I could have all of these sprites on the screen at the same time, or I could have them come in waves, for example 10 of sprite_a come on, and once they are killed, 10 of sprite_b come on, etc...

Please give me your opinion about which one I should code. If you have any other suggestions for either a third gamemode, or a completely different way to make the levels, feel free to tell me.

sentences:
How should I manage Roguelike levels/maps in JavaScript? I am developing a Roguelike in JavaScript using ROT.js. I'd like to keep with traditional gameplay (permadeath, randomly generated dungeons/mobs/items), but I want to have a statically defined overworld with randomly generated dungeons beneath.

Currently, I use the TILED map editor to create my overworld map and export it to JSON/JS format and import/parse the map into my game. For randomly generated dungeons, I use ROT.js's built in dungeon generator tool to create dungeons that are in the same JSON/JS format that the TILED maps are in.

The issue I am facing is finding an efficient way to store these maps and levels once they are generated, alongside the overworld. Right now, I just throw the generated maps into a JavaScript object indexed by the name of the map. Here's an example of how I do this currently:

levels = {};
// map class parses TILED map json and creates actors based on ascii
let map = new Map(TiledMaps["overworld"]);
levels["overworld"] = map;
let dungeon = new Map(randomMap(...)); // random map generates tiled map
levels["dungeon1"] = dungeon;
// to switch levels, just set the current game map
Game.map = levels["dungeon1"];

Is this a good approach? I would like to consider the possibility of having different types of dungeons. So, in the overworld, you might visit different sections of the world and those have different dungeons. Something like Link to the Past perhaps? Any advice?

sentences:
GL ES: Fragment shader optimization Summary:
I get FPS slowdown as soon as I try to tint the sprites (i.e: multiply texture with color in the fragment shader)

Details:

Hardware: iPod touch 4

I am drawing 700 sprites on the screen using glDrawArrays. And yes I am batching all of these in a single draw call. Following shows Vertex data structure:

struct Vertex {
    float Position[2];
    float Color[4];
    float Texture[2];
};

Yes I am sending colour with each vertex because I selectively need to tint some sprites but not others. Following is the fragment shader I am using:

varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord );
}

Till now it is working GREAT, giving me full 60 FPS !!!

BUT

As soon as I change the fragment shader to the following (to allowing tinting):

varying lowp vec4 DestinationColor;
varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord ) * DestinationColor;
}

Using following 64x64 png texture containing alpha channel, rendering with glEnable(GL_BLEND):

The performance drops to 47 FPS only due to this single change {just by multiplication with ONE vector} (FPS measured using xcode instruments and OpenGL detective). Any ideas what is going on ?

Thanks.

Edit:

I've also tried stripping off per vertex color attribute:

struct Vertex {
    float Position[2];
    float Texture[2];
};

And modifying the fragment shader as follows:

precision lowp float;
varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord ) * vec4(1.0,0.0,0.0,1.0);
}

It is running at 52 FPS for 700 sprites (a gain of only 5 FPS). So this is not interpolation, seems like the multiplication is extremely expensive. Just this ONE multiplication?

sentences:
Zoom Layer centered on a Sprite I am in process of developing a small game where a space-ship travels through a layer (doh!), in some situations the spaceship comes close to an enemy space ship, and the whole layer is zoomed in on the two with the zoom level being dependent on the distance between the ship and the enemy. All of this works fine.

The main question, however, is how do I keep the zoom being centered on the center point between the two space-ships and make sure that the two are not off-screen?

Currently I control the zooming in the GameLayer object through the update method, here is the code (there is no layer repositioning here yet):

-(void) prepareLayerZoomBetweenSpaceship{
    CGPoint mainSpaceShipPosition  = [mainSpaceShip position];
    CGPoint enemySpaceShipPosition = [enemySpaceShip position];

    float distance = powf(mainSpaceShipPosition.x - enemySpaceShipPosition.x, 2) + powf(mainSpaceShipPosition.y - enemySpaceShipPosition.y,2);
    distance = sqrtf(distance);

    /*
        Distance > 250 --> no zoom
        Distance < 100 --> maximum zoom
     */
    float myZoomLevel = 0.5f;
    if(distance < 100){ //maximum zoom in
        myZoomLevel = 1.0f;
    }else if(distance > 250){
        myZoomLevel = 0.5f;
    }else{
        myZoomLevel = 1.0f - (distance-100)*0.0033f;
    }

    [self zoomTo:myZoomLevel];
}

-(void) zoomTo:(float)zoom {
    if(zoom > 1){
        zoom = 1;
    }

    // Set the scale.
    if(self.scale != zoom){
        self.scale = zoom;
    }
}

Basically my question is: How do I zoom the layer and center it exactly between the two ships? I guess this is like a pinch zoom with two fingers!

sentences:
Generating lakes and rivers on 2D grid I recently posted a question about how to technically represent a generated terrain similar to the game kingdoms and castles.

I got some great advice and decided to create a 1x1 cube at each coordinate since I will have very small maps, for now 50x50.

I wrote some code to generate terrain,  this is super basic atm and simply instantiates either grass or water tiles depending on the noise value at the coordinate:

public static class Noise
{

    public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, float scale)
    {
        float[,] noiseMap = new float[mapWidth, mapHeight];

        if (scale <= 0)
            scale = .0001f;

        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float sampleX = x / scale;
                float sampleY = y / scale;

                float perlinValue = Mathf.PerlinNoise(sampleX, sampleY);
                noiseMap[x, y] = perlinValue;
            }
        }

        return noiseMap;
    }
}

public class MapGenerator : MonoBehaviour
{
    public int mapWidth;
    public int mapHeight;
    public float noiseScale;

    [Space]
    public GameObject grassTile, waterTile;

    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, noiseScale);

        for (int x = 0; x < mapWidth; x++)
        {
            for (int y = 0; y < mapHeight; y++)
            {
                if (noiseMap[x,y] >= .3)
                    Instantiate(grassTile, new Vector3(x, 0, y), Quaternion.identity);
                else
                    Instantiate(waterTile, new Vector3(x, -1, y), Quaternion.identity);
            }
        }
    }
}

It generate something like this:

Now this obviously does not look like a realistic landscape. My question is, how do I decide which values should represent water, and which should represent grass, in order to get a landscape that makes sense?

What I would like my landmass to look like something that has lakes and maybe rivers, instead of these random puddles you see in the image above, more something like this:

EDIT:

Setting a higher scale value lead to this:

sentences:
How do I ensure my Android build is not darker than in Editor? My scene on the Android Build looks much darker. Based on my research about the  topic, and from the texture of the light on the spheres, I assume it is because the light uses per vertex render mode on Andriod.

I am trying to force per pixel render on Android, these are the things I have tried:

set the Rendering to Important of the Light on the scene (There is only 1 directional)
check the values of my RenderPipeline asset (the one came with the LWRP Template project), the Main light is Per Pixel, Additional Light (which doesn't seem to matter) is also Per Pixel
set the Preset Light's Render type to Important in the Preset Manager

I will have infinite levels, the map changes dynamically, so Baking the light is not an option.

Can I achieve this somehow? Or at least force my editor to use per pixel so I can light up my scene more intuitively.

sentences:
Shadows go through meshes, and also being applied to itself I am using Ogre3D and I am using stencil shadows for my character. They work pretty well, but I have 2 problems: first, the shadow is applied to the entity it is casting the shadow, and secondly, the shadow goes through all the entities on the screen, and I would like to apply the shadow to only the first entity.

Also, the shadow gets rendered on the back of the model.

Images showing the problems:

sentences:
Recursive backtracking sometimes missing a tile? I have a basic recursive backtracking algorithm for a maze. It pretty much works but occasionally leaves some tiles in the corners untouched. This is the recursive function:

void GenerateMaze(Coordinate tilePos)
    {
        Debug.Log("MazeGen");
        tileMap[tilePos.x, tilePos.y].visited = true;
        Shuffle<Coordinate>(directions);
        foreach(Coordinate d in directions)
        {
            if (tilePos.x + d.x >= 0 &&
            tilePos.x + d.x < mapWidth &&
            tilePos.y + d.y >= 0 &&
            tilePos.y + d.y < mapHeight)
            {
                if (!tileMap[tilePos.x + d.x, tilePos.y + d.y].visited)
                {
                    Carve(tilePos, d);
                    GenerateMaze(new Coordinate(tilePos.x + d.x, tilePos.y + d.y));
                }
            }
        }
    }

This is how the Carve method looks like:

private void Carve(Coordinate position, Coordinate direction)
    {
        if (direction.Equals(new Coordinate(-1, 0)))
        {
            tileMap[position.x, position.y].west = true;
            tileMap[position.x + direction.x, position.y + direction.y].east = true;
        }
        else if (direction.Equals(new Coordinate(1, 0)))
        {
            tileMap[position.x, position.y].east = true;
            tileMap[position.x + direction.x, position.y + direction.y].west = true;
        }
        else if (direction.Equals(new Coordinate(0, -1)))
        {
            tileMap[position.x, position.y].south = true;
            tileMap[position.x + direction.x, position.y + direction.y].north = true;
        }
        else if (direction.Equals(new Coordinate(0, 1)))
        {
            tileMap[position.x, position.y].north = true;
            tileMap[position.x + direction.x, position.y + direction.y].south = true;
        }
    }

I'm betting on a typo or stupid mistake somewhere but I cannot find it. In my last result tileMap[4,4] stayed untouched without any walls. But the algorithm does backtrack as I often end up with dead ends. It does not happen often and up till now only on the sides.

Below is an example where two tiles on the bottom right have not been carved in too.

Here is another one without walls, this time 3 unconnected tiles in another corner of the maze.

Anyone can find whats wrong?

sentences:
Coloring a Voronoi Graph Intro:

I want to convert a Voronoi Graph made with this awesome library by jceipek on GitHub into something I can work on.

So far so good, this user provides with a demo to start with and shows how to generate the VG.

Question:

How do I convert the VG (made by edges and that dot in the middle) into something that I can work with?

Such as, after you generate some noise and apply to it (height), you colour the polygons based on it.

Thoughts:

Something comes to my mind about instantiating meshes and tiles based on the edges and the position of the dot as a start, but it won't work if I can't "detect" the polygon.

Expected result:

Image from this blog about Voronoi Mapping link

What I have:

It is drawn with Gizmos (for visual debugging in Unity)

I want to know how to color my polygons as in the expected image above. So I thought about doing a mesh or individual tile (and color it based on height afterwards but that is sauce for another question if needed)

Edit of my progress:

To further explain this question I provide the next image.

The image shows that I could use that position data somehow and turn that random polygon shape into a "tile" that will have a colour (mesh?) and possible data in it (script).

I hope this helps otherwise let me know in the comments.

sentences:
Drawing visibility polygons in Unity (for vision cones with occlusion) I'm currently trying to create an effect like the one displayed below in Unity:

However, it seems that I can't do this with any of Unity's built-in light objects, and I simply cannot find anything online that talks about this. Is there a way to achieve this in Unity? 2D or 3D solutions are fine, as I'm sure that they're both very similar to each other,

sentences:
What would be the best way to find a Game Object that is closest to another Game Object in unity? I made a 2d space shooter game awhile ago and I want to go back into it and overhaul some things. I'll provide a link to the game so anyone can play and get a better understanding of what I'm trying to do.
https://your-pal-drewdle.itch.io/starspeed
With how the game is currently set up, all the enemies are constantly setting their rotation to be facing the position of the player. I want to go back in and add a co-op mode where there are 2 players, however, if I just added a second player without changing any code, the enemies would always be facing Player 1, never directly facing Player 2.
I was thinking that I could get around this by giving each enemy an invisible circle with the center at the enemies position that would constantly expand until it hit one of the two players, I could then set the enemies rotation to face the point where the circle collides with one of the players.
In theory, this would make it so that each enemy is facing towards whichever player is closest to it.
So my question is: How could I go about implementing this in unity? Or, is there a better or more efficient way to do this that would yield the same result? I've spent a decent amount of time researching this and I haven't had much luck.
All help is appreciated, if you need more explanation just let me know and I will do my best to explain in more detail.

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:
Unity 2D softbody with custom spring I'm trying to make custom 2D softbody physics that can interact with other Unity colliders.
My starting point was to implement a custom spring joint capable of connecting two entities ("particle") together.
With these joints and with 4 particles I made a simple rectangle. The 4 particles are created inside a GameObject used as a container, to which I applied the RigidBody2D and PolygonCollider2D components.
So the displacement of the particles is relative to the container.
If I apply forces directly to the particles the figure deforms correctly and works quite well, but the problem is that I don't know how to get the forces directly from the collider or the rigid body.
What I would need is to deduce from the collisions the forces to be applied to the particles, and at the same time keep the standard behavior of the collision.
Do you have any suggestions on this?

sentences:
What does 'AlwaysResetOnEntry' do, and where would it be used? In Unreal Animation Blueprints, each state has an option for AlwaysResetOnEntry.

The tooltip text for this is:

Whether or not this state will ALWAYS reset its state on reentry, regardless of remaining weight

Question

What does this do, exactly?

Additionally, what is a good example of where this would be used?

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:
How do I generate surface normals? I have quite a few debug drawing methods in my engine that can generate geometry useful for debugging, like spheres and cubes.

At the moment I do not generate any normals for these shapes. Is there a general purpose method of generating face normals and per vertex normals for an arbitrary mesh? (I'd imagine you would need face normals to generate per vertex normals?)

sentences:
How to shoot on direction of touch I'm new to the Corona SDK(and I also suck in trigonometry) and I'm trying to achieve this:

Shoot a bullet from the player, towards the direction of the point the user touched, but always with ethe same speed, regardless of how far the touch was from the player.

I have tried several solutions. After some research I saw that I should calculate the angle from the two deltas in degrees, and then use the cos and sin of the angle as the x and y values respectively. But when I try to do so, I get pretty random results.

The closer I was able to get from what I want to achieve was to use the delta variables as the X and Y (multiplied by the speed factor). It worked, but then the speed varied based on how far from the player I touched and I want the speed to be fixed.

Here's my latest code(using sin and cos)

local math, physics = require("math"), require('physics')

physics.start()
physics.setGravity( 0, 0 )

display.setStatusBar( display.HiddenStatusBar )

local screenW, screenH = display.contentWidth, display.contentHeight
local playerX, playerY = (screenW / 2), (screenH / 2)

local player = display.newRect( 0, 0, 30, 30 )
player.x = playerX
player.y = playerY

-- local sinT = display.newText("", 100, 10)
-- local cosT = display.newText("", 100, 30)
local angleT = display.newText("", 100, 70)

local function onScreenTouch( event )
  if (event.phase == "began") then
    speed = 3
    deltaX = event.x - playerX
    deltaY = event.y - playerY

    angle = math.atan2( deltaY, deltaX ) * 180 / math.pi

    -- sin, cos = math.sin( angle ), math.cos( angle )

    -- sinT.text = sin
    -- cosT.text = cos
    angleT.text = angle

    bullet = display.newRect( 0, 0, 6, 6 )
    bullet.x = playerX
    bullet.y = playerY

    physics.addBody( bullet )

    bullet:setLinearVelocity( math.cos( angle ) * speed, math.sin( angle ) * speed )
  end
end

Runtime:addEventListener( "touch", onScreenTouch )

sentences:
Tetris - Smooth piece drop (c++) So I have coded simple tetris games on the past but I have never done one where the pieces drop smoothly, like for instance Super Tetris 3 on the SNES.I am planning to learn SDL and for such I want to code a Tetris on it.

My questions are two, as follow :

Can you give me some hints as to how to code this?
How hard is to code this compared to make the pieces fall in the easy way?

sentences:
Is it possible to create an "impossible" rooms in games? Forgive me my lack of knowlegde, but for quite a long time I asked myself whether it was possible to create a continous game space that some player could walk inside and so on, that would be absolutely impossible in reality, e.g. you have a very small house that allows you to go around it to see all sides and the full dimensions, and then, when you enter, it is like a giant hall, without any loading screen or (internal) "model change" and so on.

I'm no game designer and I never needed to learn 3D-modelling, so I don't know what is possible and what isn't. And is this the same as Is the "impossible object" possible in computer graphics? this? Or is it just the same category, but not exactly the same question?

Thanks.

sentences:
How to animate objects with bobbing up and down motion in Unity? I have created a 2D platform game with Unity and C# where I have collectable items that can be picked up by the player. What I want is to give the items more focus by having them bobbing up and down.

I came up with the following version:

Vector2 floatY;

public float FloatStrength; // Set strength in Unity

void Update () {
    floatY = transform.position;
    floatY.y = (Mathf.Sin(Time.time) * FloatStrength);
    transform.position = floatY;
}

But, this makes the object float in the middle of the level instead of where the object is positioned. How can I fix that?

Here is a screenshot of the prototype of the game:

The player can collect the wood stumps which should be bobbing up and down in space just above the ground.

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:
Pixel Perfect Camera I'm trying to get the camera pixel perfect in my game. I have tried the solution described in this video: https://www.youtube.com/watch?v=eN1zV0hlkso&t=7s

I use the resolution 128 by 72.

Set the main camera to orthographic and the size to half of the screen height, 36
Duplicate the camera and make it a child of the main camera, set the value near to 0 and rename the camera to Virtual Camera.
Create a new layer called Virtual Screen and set the culling mask of the virtual camera to virtual screen.
Create a quad and make it a child object of Virtual Camera. Remove the Mesh Collider and turn ligt and reflection probes off. Rename the quad to virtual screen and set the layer to virtual screen. Set the size of the quad to the desired resolution, 128 by 72
Create a render texture, set the size to the desired resolution and the filter mode to point.
Create a material, set it to unlit/texture and the texture to the render texture created in step 5.
Set the target texture of the main camera to the render texture and the material of the virtual screen to the material created in step 6.

With these steps 1 pixel is 1 unit. Is it possible to get a pixel perfect camera with for example 16 pixels per unit?

sentences:
Fullscreen + Vsync = Stuttering In my research for a stuttering problem in my game engine, I think, I have found the problem, but don't have any idea why this is happening, that's why I ask you if you have an idea !

The situation :
DirectX10 under win7 simple engine. If running fullscreen (and only in fullscreen), with Vsync On and the rendering loop going much more faster than the vsync ==> Stutter (Frame dropped by the driver).

My base solution at this moment : Make the call to device.present() not faster than the Vsync !

My questions :
- What is happening here ? It seems that the called to .present() "is caching" frames, and if the cache is full, it can go to throw away a frame ==> It makes the stutter !
- Why is it not happening in windowed mode under the exact same situation (back buffer resolution, scene, ...) ???

Edit :
Here is a Pix debugging screen (big picture), showing the stuttering :
http://www.s33m3.be/PIX/PIX3.png
You can see that frame 912, that did exactly the same amount of work as other frames, wasn't processed by the GPU. (No GPU start/Duration). And after debugging, it just that for this frame the call to .Present() was really low (more then 10 times faster than the average .Present() of the other frames !

So how can I disable in DirectX10  this "feature" to throw aways frames ? I would prefer the Present method to hold instead of dropping a frame !

sentences:
How to draw the contour of a hexagon area, like in Civ 5 I am trying to achieve the hexagon contour look you find in Civilization V:

I want to outline the area a unit can move to on a hexagon grid, so far I can get a list of all the tiles a unit can move to and from that select the tiles that are on the boundary, which looks like this:

Assume the list of boundary tiles are in random order. I can also get a list of all the corners on each hex. As you can see above the island in the middle would create a hole in the contour shape, Civ 5 also seems to handle these holes nicely:

sentences:
C#/XNA get hardware mouse position I'm using C# and trying to get hardware mouse position. First thing I tryed was simple XNA functionality that is simple to use

Vector2 position = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);

After that i do the drawing of mouse as well, and comparing to windows hardware mouse, this new mouse with xna provided coordinates is "slacking off". By that i mean, that it is behind by few frames. For example if game is runing at 600 fps, of curse it will be responsive, but at 60 fps software mouse delay is no longer acceptable. Therefore I tried using what I thought was a hardware mouse,

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCursorPos(out POINT lpPoint);

but the result was exactly the same. I also tried geting Windows form cursor, and that was a dead end as well - worked, but with the same delay. Messing around with xna functionality:

GraphicsDeviceManager.SynchronizeWithVerticalRetrace = true/false
Game.IsFixedTimeStep = true/fale

did change the delay time for somewhat obvious reasons, but the bottom line is that regardless it still was behind default Windows mouse. I'v seen in some games, that they provide option for hardware acelerated mouse, and in others(I think) it is already by default. Can anyone give some lead on how to achieve that.

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:
Is the Manhattan distance monotonic when used as heuristic function? I have a square-based map. Only horizontal and vertical movement is allowed (no diagonals). Movement cost is always 1.

I'm implementing an A* algorithm on that map, using the Manhattan distance as a distance heuristic. Is this heuristic consistent? Can I can avoid checking g(node) against nodes that are in the CLOSED set?

Edit: By consistent I mean monotonic.

sentences:
Gameobject-Component model with many background tiles - long iteration time So I'm making a game engine for a game I'm making - the game is a 2D tile-based game

I've implemented a gameobject-component style for the engine, for decoupling reasons

However, every frame, the engine iterates through every gameobject, and calls the update method of every component on that gameobject - as it's a tile-based game, every tile is a gameobject, which means that that update loop could go through several thousand gameobjects every frame. Add into that the fact that each gameobject could have multiple components (transform component containing location/rotation info, renderer component, collider component etc), and a hell of a lot of time is spent in that loop. This is only magnified by the fact that the game is a mobile game, and as such the processing power isn't as great as on a desktop

Any ideas on algorithms/programming styles/design styles that would help to minimise this performance sinkhole please?

sentences: Is glEnable obsolete/unneeded in OpenGL ES 2? In an iOS app I am writing I am now culling all the GL 1 crap from my GL 2 code. Can I safely remove glEnable?

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:
How do rendering pipelines improve the performance of updating all the vertices every frame? Let's say I am implementing a simple game engine, particularly the rendering part. From the high-level view we have some vertices which are copied to the graphics card alongside shader information etc.

I do not really understand how this is done in a performant manner: Consider a basic OpenGL program (and all the tutorials or whatever I could find out there) which copies all the vertices to the graphics card at each draw call. This seems to be a lot of work.

And as far as I understand if I am doing some kind of third person game, for example, I have to copy every vertex of the character at each draw call (and possibly more). Even though the world is static and the character is representing only a small amount, this still seems to be a lot.

Do game engines apply some kind of "caching" here, to make sure they only copy what has actually changed, or is this a rather mindless copy of everything, and the performance is not such a big deal?

Essentially I want to learn about some kind of architectural choices concerning this vertex copy operation, however I cannot seem to find the right resources. Thank you for any input you could provide.

sentences:
Markup format or script for data files? Possible Duplicate:
  How to choose how to store data?

The game I'm designing will be mainly written in a high level scripting language (leaning towards either Lua or Squirrel) with a C++ core.  In addition to scripts I'm also going to need different data files.  Many data files will be for static information such as graphical assets and monster types.  I'd also want to create and update data files at runtime for user information like option settings and game saves.

Can I get away with using plain script files (i.e. .lua or .nut files) for my data files, or is it better to use dedicated markup formats like XML or YAML?

If I use script files, loaded separately from my true scripts, then I wouldn't need an extra library to read those files.  Scripting languages like Lua also have table syntax that lend themselves towards data definition.  On the other hand I'd have to write my own schema check code.  These languages also don't seem to support serialization "out of the box" like the markup format libraries do.

sentences:
How do I make Windows store recognize multiple resolutions? I'm currently developing a XNA Game for Windows phone 8, it works with every emulator resolution (WXGA, WVGA, 720p). However, when I upload the XAP to the Windows phone store it tells me that only WVGA resolution was detected.

Do I have to add some code to make the app downloadable for WXGA phone owners ?

sentences:
Serializing object members within unordered_map and storing into binary file (C++) I'm making a multiplayer game, the Server stores it's game world state as various std::unordered_map in a class
called ServerWorldState.

The server is composed by a single class called Game, which contains ServerWorldState.

Currently I'm trying to make Save() and Load() functions, which for now will be in the Game class. These functions
are supposed to save certain data from the maps within ServerWorldState into a binary archive, for this purpose, I'm
using Cereal library for serialization and the standard file IO streams.

Cereal requires a serialize method to be present in a class, in order for members to be specified for serialization:

ServerWorldState.h

class ServerWorldState : public World
{
private:
    std::unordered_map<int, ServerProp> props;
public:
    template<class Archive>
    void serialize(Archive& archive);

};

ServerWorldState.cpp

template<class Archive>
void ServerWorldState::serialize(Archive& archive)
{
    archive(props); //Serialize things by passing them to the archive
}

The ServerProp class actually has another serialize method within itself. I'm unsure if this is correct for specifying with further depth what object members should get serialized.

Save function from Game (load works very similar and has same problem, but since I haven't finished it's design I'm only showing save):

Game.h

class Game
{
private:
    std::shared_ptr<ServerWorldState> currentWorld;
public:
    bool Save();
};

Game.cpp

bool Game::Save()
{
    std::ofstream outfile("level.dat", std::ios::binary | std::ios::out);
    if (!outfile) {
        std::cout << "SERVER_WORLD_STATE::SAVE: Could not open world.dat file for saving!" << std::endl;
        return false;
    }

    {
        cereal::PortableBinaryOutputArchive oarchive(outfile); //Create an output archive

        oarchive(currentWorld); //Write data to the archive

    } //Archive goes out of scope, ensuring all contents are flushed

    outfile.close();

    return true;
}

In essence I want to serialize/deserialize and binary save/load the std::unordered_map in ServerWorldState, but I get this link error:

  Error LNK2019 unresolved external symbol "public: void __cdecl ServerWorldState::serialize(class cereal::PortableBinaryOutputArchive &)" (??$serialize@VPortableBinaryOutputArchive@cereal@@@ServerWorldState@@QEAAXAEAVPortableBinaryOutputArchive@cereal@@@Z) referenced in function "public: static void __cdecl cereal::access::member_serialize(class cereal::PortableBinaryOutputArchive &,class ServerWorldState &)" (??$member_serialize@VPortableBinaryOutputArchive@cereal@@VServerWorldState@@@access@cereal@@SAXAEAVPortableBinaryOutputArchive@1@AEAVServerWorldState@@@Z) - Game.obj line 1

I would asume this would show if the serialize method wasn't defined, but it is.
I also thought I might be missing some inclusion, but I seem to have all in order.

sentences:
Looking for a peer reviewed article that details the benefits of a physics simulation within interactive media I'm hoping this is the correct place to ask this question as it is video game related and can be seen as a key ingredient in modern game development.

Does anyone know of a peer reviewed article that details the benefits of incorporating a physics simulation into interactive media (such as video games)?

I can find books with a few remarks in their introduction (no more than a couple of sentences) but nothing substantial.

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:
SDL_RenderDrawLines isn't drawing complete geometry So I am trying to draw hexagons with [SDL_RenderDrawLines][]. It looks to be working fairly well, however, it fails to draw some of the lines.

So each of the hexagons in the screenshot is a hex object. They each have a center x/y , and an array of SDL_Points for the six corners of the hex.

Here is the hex object draw call:

SDL_RenderDrawLines(
    TheGame::Instance()->getRenderer(),
    corners,
    HEX_NUMBER_OF_CORNERS);

There is some reoccurring condition that causes a vertical line to not be rendered, and I can't seem to figure out why.

The two obvious things that stand out don't explain why there is no line:

The draw order of the objects shouldn't matter since all of the borders for each hex are being drawn.
The horizontal distance between adjacent hexes' centers can be +-1 because of rounding would lead to a double thick border and not a missing border.

If anyone has any insight, I welcome the input.

EDIT:

I have been over suggestions you have mentioned prior to this question, increasing the array of points to 7 is correct, I tested it on a triangle before I tried with hexagons. When you don't close of the shape, you typically get drawn lines that shoot off the edge of the screen.

The part on three lines is also something else I discovered while messing around. I included some of my code to show the two ways that I preformed the very thing you mentioned:

// render the hexagon to on screen
void Hex::draw()
{/*
 draw order of points
 rotate ccw 90 degrees for actual postion
  [2] ____ [3]
     /    \
[1] /      \
    \      / [4]
     \____/
  [0]    [5]
 */

    // draw the hex with a fill color
    // 0XAABBGGRR is the bit order for the color param
    filledPolygonColor(
        TheGame::Instance()->getRenderer(),
        vx, vy,
        HEX_NUMBER_OF_CORNERS, r_order(CLEAR));

    // set outline color to black
    SDL_SetRenderDrawColor(
        TheGame::Instance()->getRenderer(),
        0, 0, 0, 255);

    // draw the hex outline

    //SDL_RenderDrawLines(
    //  TheGame::Instance()->getRenderer(),
    //  corners + 2,
    //  HEX_NUMBER_OF_CORNERS - 2);

    // or
    SDL_RenderDrawLine(
        TheGame::Instance()->getRenderer(),
        corners[2].x, corners[2].y,
        corners[3].x, corners[3].y);
    SDL_RenderDrawLine(
        TheGame::Instance()->getRenderer(),
        corners[3].x, corners[3].y,
        corners[4].x, corners[4].y);
    SDL_RenderDrawLine(
        TheGame::Instance()->getRenderer(),
        corners[4].x, corners[4].y,
        corners[5].x, corners[5].y);
}

Just for clarity, it still occurs in spots where there should be a drawn line. This is a shot with the above code:

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:
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:
How can I exit an Unreal game with a specific exit code? How could I quit out of a Unreal game with a specific exit code? In Unity you can just Application.Quit(exitCode); but I could not find anything regarding Unreal.

I know you can use the QuitGame-node or FGenericPlatformMisc::RequestExit(false); in C++ but without the custom exit code that I am looking for.

Any ideas?

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: setTint() on half image I'm developing a game where I need to paint half of a image when the user is either wrong or right. To paint the image, I'm using setTint() to paint the image the color I need, but it paints the whole image, is there any way I can paint only half, using setTint or another method?

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:
glGetUniformLocation returns 23724032 as the title says, I have a problem using glGetUniformLocation call that returns, for the following code, the value 23724032. I'm writing a little engine and the draw function of my models is:

void Model::draw()
{
    // enable the shader program
    m_material->enable();
    // set the current value of the ModelViewProjection matrix
    m_material->getShaderProgram()->uniform("u_mvp", getPose());
    // draw the mesh using VAO
    m_mesh->draw();
    // disable the shader program
    m_material->disable();
}

where

void ShaderProgram::uniform(std::string i_varName, glm::mat4& i_value)
{
    // get the location of the uniform variable in the shader program
    GLint loc = glGetUniformLocation(m_programId, i_varName.c_str());
    if(loc != -1)
        glUniformMatrix4fv(loc, 1, GL_FALSE, glm::value_ptr(i_value));
}

My shaders are very simple:

// vertex shader
#version 330

uniform mat4 u_mvp;

attribute vec4 i_position;
//attribute vec4 i_normal;
//attribute vec2 i_texcoords;

void main(void)
{
    gl_Position = u_mvp * i_position;
}

and

// fragment shader
#version 330

precision highp float;

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

So, I have a question: why I get this weird value from the glGetUniformLocation call?
I found this topic (link) from the OpenGL discussion board, but I still don't understand why my code doesn't draw anything. If the Intel integrated video card uses its own ids for attributes and uniforms, why is this a problem? What I have to do to fix it?

Note that if I run my application on high performance (with the dedicated video card), the function returns 0 as expected.

My notebook is a HP Pavilion dv7 6c90el with a ATI Radeon HD 7690M XT and a Intel 3000.

Thanks.

sentences:
Can't find out why aren't those collisions framerate independent I'm making a 2D Platform game and I'm having trouble with my collision detection. It doesn't seems to be framerate independent even though I used deltatime there.

The problem is that at 60fps, a collision is sometimes detected too early whereas at 500fps there's no problem (so it really seems like this isn't framerate-independent but I don't know why).

Here's a video of the game running at 60fps
https://www.youtube.com/watch?v=P0hRJbw_gcw

And here's the code which is moving my character (I inspired myself about 2D Collision detection from the youtuber dermetfan):

/// Makes the entity jump
void Entity::jump()
{
    m_onGround = false;
    setVelocity(sf::Vector2f(getVelocity().x, -500));
}

/// What to do at each frame
void Entity::update(sf::Time dt)
{
    if (getVelocity().y > 800)
    {
        setVelocity(sf::Vector2f(getVelocity().x, 800));
    }
    else
    {
        setVelocity(sf::Vector2f(getVelocity().x, getVelocity().y - m_map->getGravity()*dt.asSeconds()));
    }

    checkCollisions(dt);
}

/// Collision functions
void Entity::checkCollisions(sf::Time dt)
{
    float oldX = getPosition().x;
    float oldY = getPosition().y;

    bool collX = false;
    bool collY = false;

    setPosition(getPosition().x + getVelocity().x*dt.asSeconds(), getPosition().y); // Setting the position on x

    m_collisionIncrement = (getSize().x < getMap().TILE_SIZE) ? getSize().x / 2 : getMap().TILE_SIZE / 2;

    if (getVelocity().x < 0)
        collX = collidesLeft(); // Using collision tests
    else if (getVelocity().x > 0)
        collX = collidesRight();

    if (collX){ // Testing if there was a collision
        setPosition(oldX, getPosition().y); // Correct position
        setVelocity(0, getVelocity().y*dt.asSeconds());
    }

    setPosition(getPosition().x, getPosition().y + getVelocity().y* dt.asSeconds()); // Setting the position on y

    m_collisionIncrement = (getSize().y < getMap().TILE_SIZE) ? getSize().y / 2 : getMap().TILE_SIZE / 2;

    if (getVelocity().y > 0)
    {
        collY = collidesBottom();
        m_onGround = collY;
    }
    else if (getVelocity().y < 0)
    {
        collY = collidesTop();
    }

    if (collY){ // Testing if there was a collision
        setPosition(getPosition().x, oldY);
        setVelocity(getVelocity().x*dt.asSeconds(), 0);
    }
}

bool Entity::collidesRight()
{
    for (float step = 0; step <= getSize().y; step += m_collisionIncrement)
    {
        if (getMap().isCollideable(getPosition().x + getSize().x, getPosition().y + step))
            return true;
    }
    return false;
}
bool Entity::collidesLeft()
{
    for (float step = 0; step <= getSize().y; step += m_collisionIncrement)
    {
        if (getMap().isCollideable(getPosition().x, getPosition().y + step))
            return true;
    }
    return false;
}
bool Entity::collidesTop()
{
    for (float step = 0; step < getSize().x; step += m_collisionIncrement)
    {
        if (getMap().isCollideable(getPosition().x + step, getPosition().y))
            return true;
    }

    return false;
}
bool Entity::collidesBottom()
{
    for (float step = 0; step < getSize().x; step += m_collisionIncrement)
    {
        if (getMap().isCollideable(getPosition().x + step, getPosition().y + getSize().y))
            return true;
    }
    return false;
}

sentences:
Timers: check in game loop, or run independently? Specifically talking in the context of JavaScript game development.
For example, I can use the language specific timeout mechanism:
// Timeout is not tied to game loop at all, tied to language specific timer loop
setTimeout(() => player.age += 1, 1000);

Or I can create some custom game timer
game.createFixedDelayTimer(() => player.age += 1, 1000);

// In update loop
let lastTimerCheckTime = Date.now();
function update(game) {
  checkTimers(game, lastTimerCheckTime); // Fire timer if specified delay has passed.
  lastTimerCheckTime = Date.now();
}

The disadvantage to approach 2 is that the checks are less granular... but maybe it's still desirable so that game behavior is deterministic?

sentences:
What are some different types of device motion gestures? Complex touch events are well-defined and can even be categorised as seen in this Wikipedia article

We have great names for various touch gestures like:

Double-tap
Pinch / Zoom
Long Press
etc.

When it comes to whole-device motion gestures, I can only think of a few:

Shake
Figure-8
Horizontal Slice (ie: quickly move back an forth without rotation)

Is there a similar list for whole-device motion gestures?

sentences: What could I use to search tiles in a game I'm creating a tile based game similar to Minesweeper. When a user clicks on a tile and its not a mine or a number space I need to search and expose the adjacent tiles that are empty and stop when it hits a number or the edge of the board. I have it working right now so that it will clear the row of the tile clicked and stop at a numbered tile or the edge of the board. What I have is going to get ugly quickly and I am sure there is a easier way of doing this. Is there a searching algorithm I can use that will find all adjacent tiles to the one the player click only stopping once it hits the edge of the board or hit a numbered tile?

sentences:
Method to make character roam map isn't working I'm an absolute beginner in Unreal Engine, so sorry for any strange mistakes, formatting, etc. I'm trying to make a game for a project where an enemy chases the player through a maze when it spots the player, but when there's no player it roams around the maze. I have the following blueprint:

Every time I run it, it has varying outcomes. Sometimes the enemy will move around a few times, then randomly stop. It won't return a fail message or move. Other times, it will send a single fail message as soon as the program is run, then not return anything else. And other times, it won't send anything at all or move and just stand there. It'll also sometimes simply turn ~95 degrees to the left then stop.
There's also the issue that the enemy takes the same path every trial, even though it's supposed to choose a random point and move to it.
The enemy easily chases the player through the maze and won't get stuck anywhere, but for some reason the enemy stops moving when it's executing the roam method.
I tried adjusting the radius in the GetRandomPointInNavigableRadius part, but that didn't affect anything. I also tried making the character smaller in case it was getting stuck on certain turns, but that also didn't affect it. Removing the delay made it work a few times, but then it went back to not working after a few trials.
Here's the rest of the code for reference:

and a picture of the maze:

and the enemy's width relative to the maze path:

Thank you for any help!

sentences:
How to give each player in card game the same shuffled deck? I'm writing a card game in Swift.  The idea is to make it work on the Apple Game Center framework. I've noticed an issue which I am not sure how to address.

I need the current game data to be the same for all players.
There are 6 players in the game.
There is a deck of 30 cards, they are shuffled.
Each player must have the same deck of cards (post-shuffle).
6 cards are presented to the "table" one at a time (animation).

There are also other activities that a player does that are outside the bounds of this question.

My question is this;

How do I give each player the same shuffled deck of cards?

There are a couple of options I can think of, but perhaps none of these are the best way; hence my question

The start player is the host. The host creates the shuffled deck, and this deck is sent to other players (ie: JSON); in short all activities are facilitated through him.

The problem with this is that the start player could lose internet, abandon the game or all sorts?

So I don't think this is a viable solution

There is a middleman, the server.

There is a "lobby" (waiting area)
There is multiple games.
The game has players.
An AI-bot could be used to fill in abandoned players

But wait, does this then mean the server shuffles the cards and sends the same data to all players and makes the players "thin clients"?

Can Apple's Game Center handle this for me?

I'm not sure about the best solution for this?

sentences:
Are there games already including detailed psychological/social modeling? I have this project that have been running in my head for some time, and was surprised to realized I have never seen it in an existing video game. So I thought I might be wrong.

Most of current video games use basic social modeling, for example:

Actor1 goes from A to B, then back to 1. Repeat
Actors walk around limited area. When 2 Actors meet, they interact for 10s, then go back to walking
Actors have complex patterns, e.g. Oblivion (eat lunch under this place at 1am, except if raining, goes to this city on Sundays, etc)

My point is, it is currently mainly based on scripts. To use a graphical equivalent, it is as when physical interactions were limited/scripted, compared to current games having a detailed physics engine allowing realistic and unscripted interactions (think "Link to the Past" arrows compared to "Skyrim" arrows)

The main difference would be that there are detailed and verified models of physical behavior, gravity, etc, where as psychology/social tend to be more "fuzzy". However, there are psychological models out there, some of them widely accepted and verified, and not that difficult to implement (for example, distance between people during a social interaction, group theory, and all that). I believe that it would make a game more realistic, which is often a good point.

An example would be the "pretty rich girl / beggar" situation. In most games, either they interact as soon as they are less than 5ft from each other, and in the same way as two "equal" characters would interact (both are doing gestures while talking, they are talking about the weather, looking each other in the eyes, etc), or they are scripted not to talk to it to each other. In both cases, it would be different than what you would expect in real life.

So, (finally) the question: Are there games out there that have implemented and modeled real psychological/social models? Or even tried, and realized it was not working?

sentences:
UNet send message by Client.Send error I'm try to implement client-server communication base on UNET.
The problem i got now is send custom message to server, but the Client.Send always show error without my understanding.
So what i'm wrong? I jus try to implement from scratch, not inherit from NetworkManager.
Here is the code:

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;

public class ZMessageTransfer : NetworkBehaviour
{
    private static ZMessageTransfer instance;
    public static ZMessageTransfer Instance { get { return instance; } }
    NetworkClient m_Client;
    public class MessageType
    {
        public static short Login = 1001;
    };
    public class LoginMessage : MessageBase
    {
        public string username;
        public string password;
    };
    void Awake ()
    {
        instance = this;
    }
    public void SendLoginMessage(string username, string password)
    {
        LoginMessage loginMsg = new LoginMessage();
        loginMsg.username = username;
        loginMsg.password = password;
        m_Client.Send(MessageType.Login,loginMsg);
    }
}

Server:

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

public class ZMatchServer : NetworkBehaviour
{
    public int listenPort;
    public int maxConnection;
    public bool enableNAT;

    public Text currentPlayer;
    public Text currentLog;

    private int onlinePlayer;

    void Start ()
    {
        Network.InitializeSecurity();
        Network.InitializeServer(maxConnection,listenPort,enableNAT);
        NetworkServer.RegisterHandler(ZMessageTransfer.MessageType.Login,OnPlayerLogin);
    }

    void OnPlayerLogin(NetworkMessage netMsg)
    {
        var loginMsg = netMsg.ReadMessage<ZMessageTransfer.LoginMessage>();
        string username = loginMsg.username;
        string password = loginMsg.password;
        currentLog.text = "Player send login " + username + " " + password;
    }

    void OnServerInitialized()
    {
        Debug.Log("Server Initialize completed! ");
        currentLog.text = "Server Initialize completed! ";
    }

    void OnPlayerConnected(NetworkPlayer player)
    {
        onlinePlayer += 1;
        currentPlayer.text = "Current player online : " + onlinePlayer.ToString();
        currentLog.text = "Player connected";
        Debug.Log("Player connected " );
    }

    void OnPlayerDisconnected(NetworkPlayer player)
    {
        onlinePlayer -= 1;
        currentPlayer.text = "Current player online : " + onlinePlayer.ToString();
        currentLog.text = "Player disconnected";
    }
}

Client:

using UnityEngine;
using System.Net;
using System.Collections;
using UnityEngine.Networking;
using UnityEngine.Networking.Types;

public class ZNetworkConnection : NetworkBehaviour
{
    [SerializeField]private string serverURL;
    [SerializeField]private string serverIP;
    [SerializeField]private int serverPort;

    NetworkClient m_Client;

    private static ZNetworkConnection instance;

    public static ZNetworkConnection Instance { get { return instance; } }

    void Awake()
    {
        instance = this;
    }

    void Start ()
    {
        ConnectToServer();
    }
    protected void ConnectToServer()
    {
        Network.Connect(serverIP,serverPort);
    }

    public void LoginToServer(string username,string password)
    {
        ZMessageTransfer.Instance.SendLoginMessage(username,password);
    }

    protected void OnConnectedToServer()
    {
        Debug.Log("Connected to server complete ");
    }
}

sentences:
Does a pong clone called "Ping" infringe on any copyrights or trademarks? Long story short, I made a retro Pong clone and submitted it to the App Store as my first app. It survived for a bit, but I eventually received a message from Atari tell me to remove it. There was nothing more than that, I just took it down, and they made no other demands. Since then, it has remained removed.

I have become a much better programmer now and would now like to re-create my original app and upload it again. However, I'm afraid that something of the sort would happen again. Is remaking the game itself against any laws? If not, would using the name "Super Ping" instead of "Super Pong" be legal?

sentences:
how to use preferences in libgdx I am trying to save a username for game in preferences (first time user enters the game, registration screen shows up, and after that whenever user enters the game, username is automatically synchronized).

i tried the following

// in create() method of game class
   userPreferences = Gdx.app.getPreferences("userPrefs");

then, in my registration stage

        enter.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                super.clicked(event, x, y);
                user.username = usernameField.getText();
                PanBallGame.getGameInstance().userPreferences.putString("username", user.username);
                user.requestPath = "/addUser";
                new RequestObserver(user);
            }
        });

but this doesn't save the username in preferences.
Can anyone explain how to get this work ? Thank you .

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:
How to benefit from cpu cache in a entity component system game engine? I often read in the ECS game engine documentations that is a good architecture for using cpu cache wisely.

But I can't figure how we can benefit from cpu cache.

If components are saved in an array (or a pool), in contiguous memory, it's a good way to use cpu cache BUT only if we read the components sequentially.

When we use systems, they need entities list which are list of entities that have components with specific types.

But these lists give the components in a random way, not sequentially.

So how to design a ECS to maximize the cache hit ?

EDIT :

By example, a Physic system needs an entities list for entity that has the RigidBody and Transform components (There is a pool for RigidBody and a pool for Transform components).

So its loop for updating entities will be like this :

for (Entity eid in entitiesList) {
    // Get rigid body component
    RigidBody *rigidBody = entityManager.getComponentFromEntity<RigidBody>(eid);

    // Get transform component
    Transform *transform = entityManager.getComponentFromEntity<Transform>(eid);

    // Do something with rigid body and transform component
}

The problem is that the RigidBody component of entity1 can be at the index 2 of its pool and the Tranform component of entity1 at the index 0 of its pool (because some entities can have some components and not the other and because of adding / deleting entities / components randomly).

So even if components are contiguous in memory, they are read randomly and so it will have more cache miss, no ?

Unless there is a way to prefetch the next components in the loop ?

sentences:
How does this work? Data catching without displaying client Alright so this is about a game, but more generally this can probably be done for all games, I just want to figure out how the application accomplishes it.

So it's for a game called League of Legends, huge game, has an executable file and a massive LoLClient where you can view all data specific to your account, you can queue for games etc.

Now what this app does (that I've came across) is it logs into the league client, grabs all info related to the character and logs out) but it does this without even displaying the client on the users screen, how is this possible? bare in mind it isnt using a server.

A broad question perhaps, but im sure there's a straight forward question (app developed in C#)

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:
about register reserved word or sementic in HLSL I'm studying HLSL cookbook. In that sample code, author used a lot of register sementic.

like this

cbuffer cbPointLightDomain : register( b0 )
{
    float4x4 LightProjection : packoffset( c0 );
}

cbuffer cbPointLightPixel : register( b1 )
{
    float3 PointLightPos : packoffset( c0 );
    float PointLightRangeRcp : packoffset( c0.w );
    float3 PointColor : packoffset( c1 );
    float2 LightPerspectiveValues : packoffset( c2 );
}

what is benefit of this?

actually I erased every register keywords and ran program.

the result is completely fine.

sentences:
What is the most appropriate path-finding solution for a very large proceduraly generated environment? I have been reading quite a bit in order to make the following choice: which path-finding solution should one implement in a game where the world proceduraly generated, of really large dimensions?

Here is how I see the main solutions and their pros/cons:

1) grid-based path-finding - this is the only option that would not require any pre-processing, which fits well. However, as the world expands, memory used grows exponentially up to insane levels. This can be handled in terms of processing paths, trough solutions such as the Block A* or Subgoal A* algorithms. However, the memory usage is the problem difficult to circumvent;

2) navmesh - this would be lovely to have, due to its precision, fast path calculation and low memory usage. However, it can take an obscene pre-processing time.

3) visibility graph - this option also needs high pre-processing time, although it can be lessened by the use of fast pre-processing algorithms. Then, path calculation is generally fast too. But memory usage can get even more insane than grid-based depending on the configuration of the procedural world.

So, what would be best approach (others not present in this list are also welcome) for such a situation? Are there techniques or tricks that can be used to handle procedural infinite-like worlds?

Suggestions, ideas and references are all welcome.

EDIT:

Just to give more details, one should see the application I am talking about as a very very large office level, where rooms are generated prodecuraly. The algorithm works like the following. First, rooms are placed. Next, walls. Then the doors and later the furniture/obstacles that go in each room. So, the environment can get really huge and with lots of objects, since new rooms are generated once the players approaches the boundary of the already generated area. It means that there will be not large open areas without obstacles.

sentences:
Restarting a level but with more time? So I'm trying to add a "Rewarded video ad" with the reward being more time to play in the next game.
my RewardedAd.cs:

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

public class RewardedAd : MonoBehaviour
{
    public static RewardedAd singleton;

    private void Awake()
    {
        if (singleton == null)
        {
            singleton = this;
        }
        else if (singleton != this)
        {
            Destroy(gameObject);
        }
    }

    public void ShowRewardedAd()
    {
        if (Advertisement.IsReady("rewardedVideo"))
        {
            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show("rewardedVideo", options);

        }
    }

    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Finished:
                Debug.Log("The ad was successfully shown.");
                StartCoroutine(NewGameWithTime());
                break;
            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                SceneManager.LoadScene(0);
                break;
            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                SceneManager.LoadScene(0);
                break;
        }
    }

    IEnumerator NewGameWithTime()
    {
        Debug.Log("NewGame Started");
        GameOverManager.singleton.GameOverAfterRewardAd();
        SceneManager.LoadScene(1);
        Timer.singleton.AddBonusTime(20);
        Debug.Log("NewGame Ended");
        yield return new WaitForSeconds(1);
    }
}

and my Timer.cs:

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

public class Timer : MonoBehaviour
{
    public static Timer singleton;
    public Text timeTF;
    private float seconds = 10f;

    private void Awake()
    {

        if (singleton == null)
        {
            singleton = this;
        }
        else if (singleton != this)
        {
            Destroy(gameObject);
        }
    }
    private void Update()
    {
        if (seconds > 0f)
        {
            seconds -= Time.deltaTime;
            TimeSpan timeSpan = TimeSpan.FromSeconds(seconds);
            string timeLeft = string.Format("{0:D2}",timeSpan.Seconds);
            timeTF.text = timeLeft;
            TimeLeftCheck(seconds);
        }
    }

    public void AddBonusTime(float bonusTime)
    {
        seconds += bonusTime;
        Debug.Log("New Timer script:");
        Debug.Log(seconds);
    }

    private void TimeLeftCheck(float _time)
    {
        if (_time < 5)
        {
            //Debug.Log("RunningOutTime sound");
            //SoundManager.singleton.Sound_RunningOutofTime();
        }
        if (_time < 2)
        {
            //Debug.Log("Out of Time sound");
            //SoundManager.singleton.Sound_OutofTime();
        }
        if (_time < 1)
        {
            Debug.Log("Game Over");
            GameOverManager.singleton.GameOver();
        }
    }

The video ad is playing fine and it's resetting my ad counter in my game over manager but I can't seem to figure out how to start the next game with more time (20 seconds to so) but ONLY if they've watched the ad.

Also, I'm still learning so any suggestions or things I can improve, more than happy to take that criticism too!

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:
Simultaneous line of sight for hundreds of individual agents on a grid? I have a large grid with hundreds of individual agents, each of which is moving around based on its own visual inputs and a fast control algorithm.

My question is: How can I efficiently provide each agent with a set of other agents (or walls) that they can see?

Ray casting from each individual works, but is slow.  It seems like I should be able to preprocess the world at each step to speed up this process since I'll be doing it MANY times, but I haven't been able to come up with an appropriate algorithm.  Is there some known trick that I've missed?

sentences: How to convert from OpenGL to OpenGL ES? I need to convert code from OpenGL to OpenGL ES 1.1, I found that the GLUT library is missing in that. Can anyone tell me what do I do to replace glRasterPos3f in OpenGL?

sentences:
Specular reflections shine at the wrong angle when using a normal map I'm using Unity with URP and I'm trying to include a normal map in my shader graph.
Here is a basic graph that just display a normal map, with properties to control tiling and smoothness.

When I render the scene, the sun reflection highlights the wrong parts of the surface.
In this example, we can see the shadow direction of the cube, and the light itself. The sun reflection is clearly at the wrong place.

I tried with several normal maps from the web, all maps behave exactly like this one, so I think I'm missing something.
Ah, and strangely, when I rotate the object, the light reflection origin seems to change!
Of course, without the normal map, the light reflects gracefully.

What am I missing?

sentences:
How should I handling clipping vertices that are closer to the eye than the near clip plane? I'm rolling my own 3D engine, in JavaScript, and using only canvas drawing, no WebGL. This is another Minecraft clone; I love boxes, don't judge me.

So far, everything works wonderfully, except for one thing: in 3D, when some vertices go behind the near clipping plane, their projection on the screen comes out weird (assuming other vertices used to trace a plane are in front).

I tried clipping these points but then I can see trough the surfaces that use these vertices. In WebGL/OpenGL the graphics card takes care of these points and the plane is rendered correctly, but I don't have access to hardware so I must code this myself.

I'm not quite sure what to make of it, currently the last thing that came to mind is to reverse the projection of points behind the player's near clipping plane, which seems logical since I must project a point to a screen which is in front of the vertex.

Here are my thoughts:

Here are some images to illustrate what happens:

From distance the blue box renders perfectly well.

When some of the vertices go behind the player's near clipping plane I do reverse projection, but it doesn't look right:

focalLength *= -1;
2d.x = x*focalLength/z;
2d.y = y*focalLength/z;

Note that the gray box behind is completely removed since all the vertices used to draw its faces are behind the player.

This is what happens when look up or down.

I don't know what to make of the math behind this, I'm hoping somebody has encountered the same problem already and can help me.

sentences:
How to throw a ball vive controller object in unity3d I have this simple line of code that through the ball. Under arm throw is right while if i try through any else ways its through movement is weird like a curve from down to up. what i am doing wrong. how do i through the ball using controller (touchingObject) object direction correctly/realistically.
Additionally i am also encounter a problem that if i through one ball all the previous throw balls move in that direction also. what the heck is that?

gameObject.GetComponent<Rigidbody> ().AddForce(touchingObject.transform.forward * 1000);

sentences:
2D Drag Racing Algorithm What algorithm can I devise for a 2D drag racing game to simulate a race?

The gameplay is 2D and the camera's perspective is from the right side of the cars i.e. cars are seen from their right side in the game. This means that the cars travel in a horizontal line, from left to right till they reach the finish line.

There can be many participants in the race however the algorithm must not be affected by the number of participants in a race. It must work for any and every car given the stats of that car and other race-time driving info e.g. the time of a gear shift, good shift, perfect shift, over rev, etc.

To rephrase my question I am just asking for an algorithm which simulates the car motion/velocity along a straight line according to the stats the car has and according to the way the driver shifts up/down and revs a car.

A car can have many stats. Some I thought of including in the game are:

General stats

Top speed (mph)
Acceleration (can be represented by just a number)
Power (bhp)
Weight (lbs)
Grip (can be represented by just a number)

Tuning stats

Nitrous duration vs. nitrous power (can be represented by just a number)
Final drive (can be represented by just a number)
Gear ratio for each gear (can be represented by just a number)
Tire pressure (can be represented by just a number)

Upgrading a part will usually vary these stats.

Each participant is able to shift up or down but once the race starts acceleration is automatic. Players will be able to choose from automatic and manual acceleration in a later release; for this release the acceleration is automatic. Players must only worry about gear shifting in a race. And outside a race players must worry about changing, upgrading and/or tuning their cars.

Also, the game is multiplayer on a single system and not on a network. That is, the kind of multiplayer we have on consoles with two controllers. No LAN/WiFi networking is involved so we don't have to worry about network lags. Actually, I'm developing the game for Sifteo Cubes.

If a single player plays the game we then have AI opponents. We can have any mix of human and AI players in a race as long as their number is within the capacity supported by that race.

Right now I am trying to build a prototype so this must be all there is to the game. However, the game will keep evolving after the prototype. It will even keep on evolving after its release; in the form of updates and sequels.

Any ideas from the gamedev community to make this game better or add/remove features are gladly welcome.

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:
Concurrent touches not being detected I have pretty much the same controls on the race example of the engine. A AnalogOnScreenControl and a button defined by a Sprite.

The problem is, when I'm using the analog directional, touching the button does not trigger onAreaTouched on the button sprite.

I even tried adding the button to the child scene (controller scene) but it doesn't register the secondary touch on the button.

Am I doing something wrong or is this a bug?

UPDATE

I am doing some debugging and apparently if I touch the control base, it triggers it's onAreaTouched, and if I keep touching the controls and then touch the button (on the other side of the screen) the same onAreaTouched from the control base is triggered. He's the only one receiving the touch event.

I really can't understand why this is happening.

sentences:
How to Convert a Z Up Matrix to a Y Up Matrix? My 3D program exports my vertex data and instancing matrixes in Z+ up format.  I want to store them in my own data format as Y+ up.  If given a Matrix4 describing a position with Z+ being up. How can I convert that to a Y+ up Matrix4?

I know you can just rotate the object but I don't want to rotate the object.

sentences:
Struggling with simple orthographic projection for a 2D setup I'm trying to build a simple setup for 2D using SharpDX. Basically I want to supply my vertices in classic Cartesian coordinates: X-right, Y-up, starting with (0,0) in bottom-left corner. I've had similar experience with PSM (Sony OpenGL ES based framework for PS Vita and mobile), so I've used similar approach. The main work here is basically to construct a MVP transformation. Basic verification math on paper (800x600 screen):

so everything seems right here. So our target mvp matrix should match refT. The supplied point (50, 200) maps to (-0.875, -0.333) in clip space.

I used SharpDX-Samples\Desktop\Direct3D11\MiniCube as a starting point. I've modified it to leave a single cube plane, added texturing, everithing working fine so far. Then I replaced original coordinates with pixel-based one, and changed MVP calculation to this:

var model = Matrix.Identity;
var view = Matrix.LookAtLH(new Vector3(0, 0, -1), Vector3.Zero, Vector3.UnitY);
var proj = Matrix.OrthoOffCenterLH(0, form.ClientSize.Width, 0, form.ClientSize.Height, 0, 1);
var worldViewProj = model * (view * proj);
context.UpdateSubresource(ref worldViewProj, constantBuffer);

The worldViewProj is exactly as expected with math above. However there is nothing on the screen. I feel like I very close to solution but missing something. Any suggestions appreciated.

Complete main file gist. The part with ORTHO undefined is original sample code and it's working properly. With ORTHO defined is my new "pixel coordinates" approach which is not working as expected.

Update 1: as David suggested I've tried following modification:

var rDesc = RasterizerStateDescription.Default();
rDesc.CullMode = CullMode.None; // also tried CullMode.Front and CullMode.Back
var rState = new RasterizerState(device, rDesc);
context.Rasterizer.State = rState;

but it didn't seem to help in any way. I've also rearranged vertex order to be exactly in same order as in sample, but also with no success.

sentences:
Get a point inside an ellipse So I have a sprite of an ellipse ( it is a 2D game). I would like to get a point inside this ellipse so I can instantiate something. How would I do that? Sprite won’t be changing the scale, so uniform scale.

The point shouldn’t be on the edge and a bit further away from the edge

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:
What are the pros and cons of these voxel data file formats? .VXL
.VOX
.KVX
.KV6
.V3A
.V3B

I am trying to decide whether it's worth going with any of the above, or some other, or if I should roll my own. The deciding factors in order of importance are:

Animation support (I am aware this is a difficult aspect when it comes to voxels), using voxel deltas or numerical transform descriptions.
Simplicity (or at least a concise format)
Compression

From what I can tell, the Tiberian Sun VXL format is the only one which is designed for animation, but Ken Silverman of Voxelstein3D fame claimed that VXL does not support animation (in a single file, were his words). So I wonder if maybe there are not two different .VXL formats, since it seems an obvious choice of file extension for voxel data... could be from a medical imaging context.

I do need someone with solid experience of voxel formats to come and comment on the practical pros and cons, in their experience. Consider this question in the same way you might compare JPG to PNG to GIF.

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:
How do I call  glVertexPointer in Java? I'm trying to convert the following code to Java:

glVertexPointer( 3, GL_FLOAT, 0, &(mesh.m_PositionBuffer[0]) );

Where mesh::mPositionBuffer is std::vector<glm::vec3>;

How would I make a similar call to glVertexPointer with a first index to the position buffer?

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:
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:
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:
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:
Assets Management, database or versioning system? While developing the assets for the game, (meshes, textures, sounds, videos) ho do you manage them?

Keeping them together with the source code
inside the versioning system? (perforce, git, etc…)
Or having a central back-upped, database
dedicated to the assets and having
the editors always work liked to it?
(PostgreSQL, MySQL, etc…)
Other?

What are the pro and cons of each, and why one should choose it over the other/s?

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:
OpenGL 4 several glUseProgram overhead I'm developing a little 2D game using OpenGL 4.x and I've also coded a very simple light system which does not take care of shadows.
The main concept behind this light system is the frambuffer multiplicative blending. I basically have two framebuffers, one for the normal scene render and the other one for ambient light and the scene light sources. Then, I blend those two framebuffers and I get my final result (which is pretty good, to be honest).

In this model I have 3 different shader programs:

One for rendering the normal scene (with texturing and other normal features)
One for rendering lights, which compute light halos and other light effects
One for blending the two framebuffers together

Now, in my main application loop I have to switch between those three shader programs in order to complete a full rendering cycle. I'm also planning to add more shaders to render different light effects and particles.
At the moment I'm in the design phase of my game, so I'm not able to test out the performance of this approach and I have no previous experience with it.
And for the same reason I'd like to start with the best approach possibile for this situation.

So my question is: considering your experience, is switching between several shader programs at each frame something good or is it a bad behaviour in a 2D enviroment ? Is using fewer shader programs but with more if statement and more unused uniform variables a better solution?

sentences:
in XNA 4.0, How to get the matrix or Vector3 of a model? I'm trying, for many days, to get the Matrix or the Vector3 of my 3D model, I don't want to use the World matrix because I need first to idenfy the axes of my object for animation (= rotation of a second object around my first object).

If you have an idea or a tutorial for this ?

Many thanks,

Jeangil

sentences:
How to use Bidirectional path tracing on sky dome for rendering indoor Is it possible to use bidirectional path tracing to render an indoor scene where
the light source is skylight(no sun) coming through a window? I think I roughly
know how this is done if the light source was the window rectangle itself acting
as a diffuse source but cannot get my head around on how it would work if the source is skylight and the camera is in a room: Is it the window shape that needs to be sampled or the sky dome? Would the light sample point be picked from the whole sky dome, or just a visible bit from the window?

Thanks.

sentences:
Normal vector of a face loaded from an FBX model during collision? I'm loading a simple 6 sided cube from a UV-mapped FBX model and I'm using a BoundingBox to test for collisions. Once I determine there's a collision, I want to use the normal vector of the collided surface to correct the movement of whatever collided with the cube. I suppose this is a two-part question:

1) How can I determine which face of the cube was collided with during a collision?

2) How can I get the normal vector of that surface?

sentences:
Will points on path with width intersect I want to be able to check if a list of points will hit a screwed rectangle (rhombus i think).

I start out with 2 point P and T, i want to create a rectangle between the 2 points. I have used https://stackoverflow.com/questions/7854043/drawing-rectangle-between-two-points-with-arbitrary-width to do this. This gives me 4 points A, B, C and D of the new rectangle.

I then want to check if the point M is withing this rectangle.

The two black dots are my points P and T, the black box is the rectangle i want to generate between the two dots, being X wide.
I then want to test if the red dots are withing the black box.

sentences:
Adding hotbar to inventory? I have a inventory and I need to add a hotbar to access certain items.

What this hotbar needs to do is when in the inventory "Menu" you add items to it and when you close the menu the hotbar moves to the bottom of the screen and you select and item, weapon, food ect, and can use it (like in Minecraft).

My problem is I don't know whether I should:

Keep track of which items are in hotbar "spaces" of the inventory and use them accordingly, or
Make a separate list for hotbar items and move them between the inventory and hotbar lists when needed

or a third way I did not even think of.

My inventory works by having items in a list. The item class has values such as dmg, uses, name, etc. I have an item data class I put on GameObjects that has a public item variable. I have an inventory UI class that takes the inventory list and displays them.

sentences:
How to resolve "Accessed None trying to read property" error? Whenever I finish running the project, this error message appears:

  Blueprint Runtime Error: "Accessed None trying to read property
  jogador". Blueprint:  Jogador_BP_Anim Function:  Execute Ubergraph
  Jogador BP Anim Graph:  Transition Node:  Result

By clicking to know where the error is coming from, the program tells me this code:

This is the code I made to get the player reference (jogador/player Animation Blueprint):

This is basically for the transition code between animations, to receive information whether or not the player is jumping (jogador/player Blueprint):

Animations perform normally, so the error doesn't seem to compromise project execution, but why does it occur?

I looked at some links, but I don't know how to remove it.

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/86607-accessed-none-trying-to-read-property

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:
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:
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:
Advice on playtester recruiting strategy for closed beta? I am the lead programmer for a small game company working on our first release. A top down turn based historical WWII strategy game. Because our game appeals to WWII buffs and players who enjoy ‘simulation’ levels of detail we started by posting discussions of the game and invitations to the beta on WWII related sites like (WW2 Talk, The Wargamer, Axis History Forum etc.) However, we have had comparatively little response or willingness to participate in a beta from these communities.

What are some successful strategies that others in our position (small houses working on first projects) have used, or would suggest to attract and recruit beta testers?

sentences:
How to avoid the collision of objects that move along a path? There are 2 cars (same object) that go through a circuit:

Consider that the white part is an intention that they avoid (it would be as if it were a wall). The black part (circuit) would be just illustrative, it is not an object.
In the program the room looks like this:

Green -> background
Red square -> car
Other light colored squares -> points that are followed by the cars (to go through the circuit)
Black square -> wall

The walls are avoided as follows:
mp_grid_add_instances(grid,obj_Wall,false);

In addition to the walls, I would like cars to avoid each other. I did it as follows:
repeat(instance_number(obj_Car)){
    i++;

    if(instance_find(obj_Car,i-1).id!=id){
        carOtherID=instance_find(obj_Car,i-1).id;
        mp_grid_add_instances(grid,carOtherID,false);
    }
}

It happens more or less like this:

Cars avoid the starting position of other cars, but I would like you to avoid the current position of other cars. For that, I put this part of the code in the step event:
mp_grid_add_instances(grid,carOtherID,false);

I tried some changes, with some conditions, but none worked. Simply buggy, cars even go through walls (something that shouldn't happen, because I don't even change anything in them).
Documentation:
https://manual-en.yoyogames.com/#t=GameMaker_Language%2FGML_Reference%2FMovement_And_Collisions%2FMotion_Planning%2Fmp_grid_path.htm&rhsearch=mp_grid_path&rhhlterm=mp_grid_path

sentences:
Calculate heading required to turn ship so that its weapon can fire at target I have a ship, the ship travels towards a heading (vector3, blue arrow) with an arbitrary speed.

The ship has a weapon on the side, the weapon can point in any direction, except straight forward/backwards from the ship heading. (In example image the weapon is a perpendicular 90* right).

The weapon has a firing arc, in n degrees (so, n/2 degrees in either side from the weapon "point direction").

Given a target at any position on the same side of the ship as the weapon (red circle), how do I rotate the ships heading so that when oriented towards the new heading (in this example, the yellow arrow), the target is inside the bounds of the firing arc? (The ship cannot rotate on the spot, it turns by driving forward towards a heading, like a simplified aircraft)

While my game is set in full 3D, I think a 2D solution will be more than enough.
I use Unity, and C#, but I'm thankful for any solutions.

Edit: To clarify, I am looking for the "math-based" solution, collision-checks etc isn't really feasible.

sentences:
How can I make a self-updating game launcher? I have been creating a game with java, and before I release it I wanted to make a launcher that is connected to the game's website.

Basically I need to make a launcher that updates itself when I have changed the content.

Unfortunately I have no idea on how to do this. There would be a description in the main launcher which only I can change, and a large play button that will close the launcher and run the game. If I have changed the description, then it will change on the website download, and on the copy that anyone else owns (anywhere).

So, because of my lack of knowledge on this topic, does anyone know how I'm supposed to do this, and how it would work?

sentences:
Real-time multiplayer game server development I'm an Android developer, and I want to start developing a real-time multiplayer game, like Pocket Legends.

Would this type of server be good for a real-time multiplayer action game - http://systembash.com/content/a-simple-java-udp-server-and-udp-client/?

I'm absolutly new to server development, so it would be great if you explaind even more about this stuff ...

sentences:
Data structure for objects in a galaxy of star systems I'm having some difficulty coming up with the appropriate data structure to use for a game.
I'm aiming for a galaxy view with tens of thousands of visitable star systems.

Structure
Hierarchically, each star system can contain one or more of the following:

Planets [and their moons]
Asteroid Belts
Megastructures [and their moons/sub-structures]

All of the above can have "points of interest" [POI] eg a station in low orbit, a surface resource node, a docking bay.
Usage
I don't particularly care about physical location within a system beyond knowing its order in the hierarchy (I'll be showing a list of locations, rather than trying to render them in 3D space). So I can treat all objects within a system as located at the star for the pursposes of calculation.
I do, however, need a way to specify routes from any Planet/AsteroidBelt/Moon/Megastructure/POI to any other. I also need to be able to search for other locations meeting certain criteria [both to offer as destinations in the UI and to handle rendering].
Each type of location will have some unique properties (Asteroid belts have resource distributions, for example whereas planets ave atmospheres) but they also have lots of common properties (inventory, owner, comms network node id, etc).
Ideas so far
Obviously, with the numbers I'm considering I need to take a sparse/lazy generated approach. Currently the galaxy is built entirely in the GPU and stars are only presented to the CPU when the user first clicks on them.
That lends itself nicely to a hierarchical data structure with a load-on-first-access approach. Click on a star and it's added to the list, so the name is saved. Scan/visit it and I'll generate the system contents.
Unfortunately, I also need to be able to search across all generated locations efficiently (given an ID, find the star system coordinates, find planets with an atmosphere like X, find any location with X in its inventory) in a potentially huge search space.
That doesn't align with recursively walking up/down trees.
I considered using a heirarchy and manually maintaining a number of separate indices to speed up searching. It's doable but a pain and error-prone. It also feels like one of those solutions where I'm going to keep finding one more type of query I need to support and before long I'm trying to implement a minimal database.
Speaking of which I also need to persist this data at some point. Currently I'm serializing to a densely packed binary blob.
So... I took a step back and wondered whether I should actually use a database. I can see the benefits of using something like SQLite which I could bundle with the game and would handle persistence, indices, and the rest.
Db?
After spending a couple of days implementing the basics, I can see this is going to be quite a long and involved process.
None of the friendly tooling works well in Unity, so I can't take advantage of entity framework w/ code first, nor nice Linq-To-Sqlite predicate handling. Even worse, most of the libraries to work with EF are tightly coupled to windows. EF Core seems like an option but I haven't been able to get it working in Unity (I need to do some assembly version mapping but as Unity overwrites the project file regularly and doesn't seem to support this itself, I think it's a losing battle).
So I've headed down the route of implementing a data layer that generates SQL as needed.
I can do that, but it opens up a huge can of worms in terms of manually maintaining the DB schema. I'm going to have to start tracking a DB version and bundling migration scripts with any update/patch. It's a whole new maintenance burden.
Question
So... What am I missing? What's the elegant way to store a sparse hierarchy of data whilst still supporting flexible search across disparate object types that just happen to have a lot of common properties?

sentences:
Reducing Memory Use on OpenGL ES I'm using an opengl es based framework to create my game.I have an out of memory problem on some devices.I have 15 textures with a size 1024x1024(totally 10 mb).On memory they covers a lot of space.Some devices are exiting from game on loading time

I want to reduce memory use and how can i do that?Maybe a solution when i loading bitmaps into memory will be great.That's my texture class:Texture.java

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:
Better data structure for a game like Bubble Witch I'm implementing a bubble-witch-like game (http://www.king.com/games/puzzle-games/bubble-witch/), and I was thinking on what's the better way to store the "bubbles" and to work with. I thought of using graphs, but that might be too complex for a trivial thing. Thought of a matrix, just like a tile map, but that might get too 'workaroundy'. I don't know.

I'll be doing in Flash/AS3, though.

Thanks. :)

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:
Third person camera xna I'm trying to create a third person camera in my XNA game. I'm able to move the model I have and the camera at the same time, although the camera is not "following" the model. The model moves faster than the camera. Ultimately, I want the camera to rotate with the model with the left and right keys, and move the model with forward and back.

This is in my update method

    if (keyState.IsKeyDown(Keys.D))
        {
            camera.Rotation = MathHelper.WrapAngle(camera.Rotation - (rotateScale * elapsed));
        }

        if (keyState.IsKeyDown(Keys.A))
        {
            camera.Rotation = MathHelper.WrapAngle(camera.Rotation + (rotateScale * elapsed));
        }

        if (keyState.IsKeyDown(Keys.W))
        {
            camera.MoveForward(moveScale * elapsed);
            player.Position += new Vector3(0.1f, 0f, 0f);
        }

        if (keyState.IsKeyDown(Keys.S))
        {
            camera.MoveForward(-moveScale * elapsed);
            player.Position += new Vector3(-0.1f, 0f, 0f);
        }

player is the model I'm using. Currently the A and D keys don't do anything with the model.

    public class Camera
{
    private Vector3 position = Vector3.Zero;
    private Vector3 lookAt;
    private Vector3 baseCameraReference = new Vector3(0, 0, 1);

    private bool needViewResync = true;

    private float rotation;

    public Matrix Projection { get; protected set; }
    private Matrix cachedViewMatrix;

    public Vector3 Position
    {
        get
        {
            return position;
        }

        set
        {
            position = value;
            UpdateLookAt();
        }
    }

    public float Rotation
    {
        get
        {
            return rotation;
        }

        set
        {
            rotation = value;
            UpdateLookAt();
        }
    }

    public Matrix View
    {
        get
        {
            if (needViewResync)
                cachedViewMatrix = Matrix.CreateLookAt(Position, lookAt, Vector3.Up);

            return cachedViewMatrix;
        }
    }

    public Camera(Vector3 position, float rotation, float aspectRatio, float nearClip, float farClip)
    {
        Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, nearClip, farClip);
        MoveTo(position, rotation);

    }

    private void UpdateLookAt()
    {
        Matrix rotationMatrix = Matrix.CreateRotationY(rotation);

        Vector3 lookAtOffset = Vector3.Transform(baseCameraReference, rotationMatrix);
        lookAt = position + lookAtOffset;
        needViewResync = true;
    }

    private void MoveTo(Vector3 position, float rotation)
    {
        this.position = position;
        this.rotation = rotation;
        UpdateLookAt();
    }

    public Vector3 PreviewMove(float scale)
    {
        Matrix rotate = Matrix.CreateRotationY(rotation);
        Vector3 forward = new Vector3(0, 0, scale);
        forward = Vector3.Transform(forward, rotate);
        return (position + forward);
    }

    public void MoveForward(float scale)
    {
        MoveTo(PreviewMove(scale), rotation);
    }
}

I also want to offset the camera for obvious reason, but changing the values in the variable baseCameraReference doesn't change what I want it to

sentences:
In Unity, how can I check if an input was made x seconds/frames ago? I'm using the Rewired input plugin, and it comes with an input buffer. I enabled the buffer for my directional keys and airdash button so that the player doesn't have to hit both keys on the same frame in order to dash.

However, this means that if you press both keys and hold them down for more than a frame, the airdash code gets run again. I tried to stop this by comparing Time.time at the beginning of Update() to Time.time at the beginning of the coroutine, but this seems inconsistent and it doesn't feel like the right way to do it.

How would you check for the player's input time and compare it to the time since some previous input?

Here's a sample of the dash code within FixedUpdate()

        //Dash

        if (grounded)
        {
            dashCount = 0;
            dashTime = 0;
        }

        if (dashCount < 2)
        {
            //print(currentTime - dashTime);
            if (currentTime - dashTime < 0.1 || dashCount == 0)
            {
                //Double Tap Dash
                if (player.GetButtonDoublePressDown("Left"))
                {
                    StartCoroutine(Dash("left"));
                }

                //Button Dash
                if (player.GetButtonDown("Dash") && player.GetButtonDown("Left"))
                {
                    StartCoroutine(Dash("left"));
                }
            }

        }

        print(dashCount);

and here's a sample of the coroutine:

    //Dash
    IEnumerator Dash(string axis) {

        dashCount++;

        dashTime = Time.time;

        if (axis == "left")
        {
            if (inDash == true)
            {
                anim.SetBool("dashUp", false);
                anim.SetBool("dashDown", false);
                anim.SetBool("Hover", false);
            }
            canControl = false;
            inDash = true;
            anim.SetBool("dashHorizontal", true);
            anim.SetBool("inDash", true);
            rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, 0);
            rigidbody2D.AddForce(-dashForceHorizontal, ForceMode2D.Impulse);
            rigidbody2D.velocity = Vector2.ClampMagnitude(rigidbody2D.velocity, maxVelocity);
            rigidbody2D.gravityScale = 0;

            yield return new WaitForSeconds(0.2f);

            rigidbody2D.gravityScale = 2;
            rigidbody2D.drag = 25f;
            yield return new WaitForSeconds(0.2f);

            if (grounded == true)
            {
                yield return new WaitForSeconds(0.1f);
            }

            rigidbody2D.drag = 0f;
            canControl = true;
            anim.SetBool("dashHorizontal", false);
            anim.SetBool("inDash", false);

            inDash = false;

            yield break;
        }
  }

sentences:
How to access sprite sheet via row and column I'm currently designing a 2D game engine in C#, just had a quick question.

I have a SpriteSheet class that splits up a sprite into several different sprites (like a tileset for a example) and stores them in a list. Which is great, because now I can access sprites via it's corresponding index in the sheet.

However, I would really like to add a feature that will let me access a sprite by specifying the row and column it resides in (in the original sprite). I just don't know the equation to find where the sprite is in the list.

Here is what I have so far:

    public Sprite this[int index]
    {
        get { return this.sprites[index]; }
    }

    public Sprite this[int row, int column]
    {
        get
        {
            // Get the width and height of each individual sprite in the sheet.
            int cellWidth = this[0].Width;
            int cellHeight = this[0].Height;

            // Figure out and how many rows and columns are in the entire sprite sheet
            int rows = this.sprite.Width / cellWidth;
            int columns = this.sprite.Height / cellHeight;

            // Here is where I want to return the sprite located at the row and column specified.
            return this.sprites[ /* what do i put in here? */ ];
        }
    }

Also, I don't know if it will help but here is the method I use to fill the list with sprites:

    private void CreateSheet(Sprite sprite, int xOffset, int yOffset)
    {
        for (int y = 0; y < sprite.Height; y += yOffset)
        {
            for (int x = 0; x < sprite.Width; x += xOffset)
            {
                this.sprites.Add(sprite.Clone(new Rectangle(x, y, xOffset, yOffset)));
            }
        }
    }

sentences:
SFML Segmentation Fault when using VBOs? I'm trying to follow along with the gltut tutorials and for some reason when I call GLDrawArrays my program segmentation faults. I've been looking at the state of my application with the Mac OpenGL Profiler and Googling and I can't seem to figure out why it isn't working. I may have missed setting some OpenGL state somewhere.

My code is here, it segfaults on line 32. If I don't call glEnableClientState(GL_VERTEX_ARRAY); and the respective glDisableClientState(GL_VERTEX_ARRAY); it compiles and runs, but I get no rendering, which is what I would expect given my limited OpenGL knowledge.

sentences:
UE4: Subclass problem: cannot access private member declared in parent class? I get the following error:

  [...]\ClassB.cpp:7: erreur : C2248: 'UClassA::UClassA' : cannot access private member declared in class 'UClassA'
  [...]\ClassA.h:12: see declaration of 'AClassA::AClassA'
  [...]\ClassA.h:9: see declaration of 'AClassA'

when I create a subsubclass.

The problem occurs with the following code:

ClassA.h

#pragma once

#include "GameFramework/Actor.h"
#include "ClassA.generated.h"

UCLASS()
class PROBUILDER_API AClassA : public AActor
{
    GENERATED_BODY()
    AClassA( const FObjectInitializer& ObjectInitializer );

};

ClassA.cpp

#include "ProBuilder.h"
#include "ClassA.h"

AClassA::AClassA(const FObjectInitializer &ObjectInitializer):Super(ObjectInitializer)
{

}

ClassB.h

#pragma once

#include "ClassA.h"
#include "ClassB.generated.h"

UCLASS()
class PROBUILDER_API AClassB : public AClassA
{
    GENERATED_BODY()
    AClassB( const FObjectInitializer& ObjectInitializer );

};

ClassB.cpp

#include "ProBuilder.h"
#include "ClassB.h"

AClassB::AClassB(const FObjectInitializer &ObjectInitializer):Super(ObjectInitializer)
{

}

(I tried with a subclass of AActor and UMeshComponent and got the same errors)

sentences:
2D Tower Targeting (Tower Defense) so just to be more specific this question isn't in regards to how to target enemies or anything like that rather its purposed towards a specific targeting issue i have with me enemies in its current state.

So the issue im having is that if i fire a bullet towards an enemy and then before that bullet hits the desired enemy it was initially set too, if my tower changes its target then suddenly my bullet does a u-turn and then targets this new enemy. Which isn't what i want.

I'm using C++. I know this is a pointer issue, that my pointer's memory address changes to point at the new enemy which the tower would be facing, the problem is i just don't know how to solve this, personally for me i don't use pointers that much and unfortunately im just not very good at using them it seems :/.
Any help on this issue is greatly appreciated, its been annoying me now for the better part of a few hours, and if anyone could explain what I'm doing wrong here as-well that would be great!
So here's my targeting code

for (int numOfEnemies = 0; numOfEnemies < lib.numberOfEnemies; numOfEnemies++)
{
    float y =  pow(enemies[numOfEnemies].position.y - position.y, 2);
    float x = pow(enemies[numOfEnemies].position.x - position.x, 2);

    if (sqrt(y + x) < range && enemies[numOfEnemies].alive)
    {
        cEnemy =  &enemies[numOfEnemies];
        acquiredTarget = true;
        break;
    }
}

Simple enough, then this is how i'm passing it in my Projectile class;

bullets.push_back(Projectile(bulletPosX, bulletPosY, 8, 8, damage, 1, speed, *cEnemy, currentUpgradeLevel));

Which specifically then uses this constructor;

Projectile::Projectile(float x, float y, int w, int h, int dmg, int type, float mxSpeed, Enemies& bulletTarget, int towerLevel)
{
     position.x = x;
     position.y = y;
     width = w;
     height = h;
     bulletAngle = 0;
     renderingAngle = 0;
     damage = dmg;
     active = true;
     ySpeed = 0;
     xSpeed = 0;
     maxSpeed = mxSpeed;
     typeOfProjectile = type;
     target = &bulletTarget;
}

There you see target is then a pointer to an enemy address, the cEnemy (currentEnemy). What my desired effect would be to have my Projectile store the enemy that I pass into it which then until it hits that enemy, the targeted enemy will forever stay focused on the enemy passed in when the projectile was first created.

Again any help greatly appreciated!

For reference

Enemies = Class Name.
enemies = vector array of active Enemies.

cEnemy = (Pointer to Enemies Object)/Enemies* cEnemy.

sentences:
Implementing attack animation in four direction movement The way the program is supposed to run is basically, a character can be running/idle and if spacebar is pressed, all movement stops and movement controls are locked through the bool "canMove". The integer shockwave is a 1-4, directly correlating to the direction 1-4 (1 = north, 2 = east, 3 = south, 4 = west). Then, the animation plays and when it is over the controls are unlocked and you can move freely.

The problem I have encountered is, I can find no way to specifically tell when the animation is ending inside of a blend tree. I cannot find a way to allow the animation to play, and then continue to unlock the controls.

Since this site won't let me post more than three links, I will have to describe the animator window. Basically I have four idle states (N, E, S, W). Each motion is a blend tree, and each state is connected with a transition purely based off of int direction.

This is where I tried adding another motion to the blend tree called shockwave, based on threshold speed (-1). This worked up until the point that I realized I would not be able to add anymore attacks or states, and that I could not tell when the animation had finished in order to unlock the controls.

void Update (){

    if (Input.GetKey (KeyCode.Space)){

        canMove = false;
        direction = animator.GetInteger ("Direction");
        animator.SetFloat ("Speed", 0.0f);

        if (direction == 1){
            animator.SetInteger("Shockwave", 1);
            animator.SetFloat ("Speed", -1.0f);

            //find a way to detect that the attack animation is done.
            //continue and allow movement
            canMove = true;

                }
            }

        else if (direction == 2){
            animator.SetInteger ("Shockwave", 2);
            //if(!anim.IsPlaying ("character_shockwave_2")){
                //canMove = true;
            //}
        }
        else if (direction == 3){
            animator.SetInteger ("Shockwave", 3);
            //if(!anim.IsPlaying("character_shockwave_3")){
            //  canMove = true;
            //}
        }
        else if (direction == 4){
            animator.SetInteger ("Shockwave", 4);
            //if(!anim.IsPlaying("character_shockwave_4")){
                //canMove = true;
            //}
        }

Attempted solutions:

I have tried to use waitforseconds(x), and just wait for the attack animation to finish, and then after that amount of seconds I would set the canMove bool to true. For whatever reason, I cannot get this to work.

I have also tried to directly find if the animation is done playing through a few different ways, but I learned that the blend tree does not allow this.

The only solution I have thought might work is actually manually playing all animations through code alone. (Would require re writing the entire program).

If any further code is needed, I can supply it.

sentences: making a game in 2D(C++). SDL or openGL? Or, why not both? I'm trying to make a platform game in 2D and I want to know what tool should I use to make it happen. I understand that I can use SDL with openGL. However, if I want to make a solid 2D platform game, should I use SDL? Or, openGL?

sentences:
How do I remove control points from imported curve in Maya? When I create a path from an Illustrator file, it adds extra control points for bezier handles for each point in the AI file, even though I don't drag out the handles in Illustrator.  All my points in the AI file are hard edges.

I can clean this up by using the merge vertex tool, but that takes a long time on each model.  Is there a way I can:

Select all the control points at once and delete the extra curve handle points
OR
Import without the extra handle points and have only a flat polygon.

I'm importing the path as curves, because when I import as bevel it adds lots of extra geometry.  I'm new to Maya, but have taken several lessons, so please be gentle.

sentences:
How do I connect Unity to a server backend developed in .net core? I'm currently running to a wall in my game development and I need now some discussion to clear my mind... In my mind I have a plan for some little online game (focused around clicking and idling), which I imagined could be served both on website and winapp, and in future even in mobile platforms.
I have chosen C# for it, build some server backend (join server, game server), but 'cause I want this server components be runned on linux, I have chosen .net core. Which is now my problem, because I'm building the game client in Unity, which only works in .net standard.
My main problem now is that I have build some "base network library" for communication, written in .netcore with plenty of NuGet packages, which I now have implement to Unity to get it work, but there are now conflicts (the main one is that unity is using another version of System.Threading).
Now I am wondering what steps should I choose nexts... There are some work behind now (but not so much, there are only some basic proceses for login and creating game worlds), so probably make that base network package compatible with .netstandard and .netcore.
Or I am thinking if it isn't more suitable to choose some another technology like c++ and some 2D engine in it (which to choose?).
What are you opinions? And what would you do in this situation?

sentences:
Using gluUnProject to transform mouse position to world coordinates (LWJGL)? I am programming on a LWJGL project and have been trying to figure out how to successfully use the GLU.gluUnProject function in order to transform a given point on the screen (mouse position) to world coordinates. I found several examples on Google and really tried hard to get it to work. I do manage to get a result vector but the values it gives me make no sense.
I initialize my scene using GL11.glFrustum(...) as follows:
public void initialize()
{
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 6.5);
// left, right, bottom, top, zNear, zFar

GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();

GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
}

The window has a size of 800 x 600. Here is a screenshot:

Now to find a corresponding point in the game world for a given mouse position on the screen I use the following method:
public void calcWorldCoordinates(float mouseX, float mouseY)
// mouseX is in the range of [0..800] and mouseY in [0..600]
{
FloatBuffer model = BufferUtils.createFloatBuffer(16);
FloatBuffer projection = BufferUtils.createFloatBuffer(16);
IntBuffer viewport = BufferUtils.createIntBuffer(16);

GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, model);
GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection);
GL11.glGetInteger(GL11.GL_VIEWPORT, viewport);

float viewportHeight = viewport.get(3); // = 600.0f
float y = viewportHeight - mouseY;

FloatBuffer posNear = BufferUtils.createFloatBuffer(16);
FloatBuffer posFar = BufferUtils.createFloatBuffer(16);

GLU.gluUnProject(mouseX, y, -1.5f, model, projection, viewport, posNear);
GLU.gluUnProject(mouseX, y, -6.5f, model, projection, viewport, posFar);

// ...
}

For mouseX = 300, mouseY = 400 I receive:

posNear = [x=-0.0580, y=0.0774, z=-0.6964]
posFar = [x=-0.0208, y=0.0278, z=-0.6964]

None of the three resulting coordinates makes sense to me. As far as I can tell x should be somewhere around 240 (each tile in the scene is of size 120 x 80 pixels). It should definitely be positive though and not -0.0580 or -0.0208.
I also looked at the model and projection matrix as well as the viewport size. Those are:

model:
1.0,  0.0,    0.0,    0.0
0.0,  1.0,    0.0,    0.0
0.0,  0.0,    1.0,    0.0
0.0,  0.0,    0.0,    1.0

projection:
3.0,  0.0,     0.0,    0.0
0.0,  3.0,     0.0,    0.0
0.0,  0.0,    -1.6,   -1.0
0.0,  0.0,    -3.9,    0.0

viewport: 0, 0, 800, 600

I rewrote the code several times using different implementations of other people but could not get it to work. Maybe somebody could give me a hint. What I am doing wrong?

sentences:
Unity gameobject design approach for item drops In a game like Minecraft, the player could have any of several hundred types of items in their inventory. Players can drop those items into the world, but obviously how they're rendered in the world differs from how they're rendered in the inventory.

I'm trying to understand how to design for this scenario using Unity's GameObject concept.

Individually, it seems like the expectation is that:

I would have one GameObject (with at least a SpriteRenderer) for every unique item that can appear in-world.
I would have one GameObject (with at least an Image component) for every unique item that can appear in inventories.

With so many, I also need to come up with some sort of directory so that I can associate bulk prefab objects for use in-game.

Is this accurate? I feel like that's a lot of overhead.

Would I be able to create one GameObject with both a SpriteRenderer and an Image and maybe toggle between then based on whether its in world or an inventory?

I had also considered using one generic GameObject and replacing the sprite/image based on the item needed, but that feels like it's misusing what GameObjects are meant for. It also likely subverts the benefit of pooling them, etc.

Is there another approach I'm missing?

sentences:
Game (X-Plane) boot/startup time / performance I use X-Plane for my question but it also concerns probably every other flight-simulator or simulation game in general. When developing a plugin what bothers me most is the startup-time of the application to test my plugin functionality so I was wondering how I can improve the startup speed of the simulator.

First I removed all additional scenery and reduced the loaded files to a minimum which gave me a startup time of 34 seconds which is quite fast already.
To improve the time even further I thought it would make sense to run the whole application from memory and I installed ubuntu 64-bit and created a 2GB tempfs filesystem in memory (ram-disk).

When starting x-plane from this memory file system it still takes 30 seconds. Can anyone explain what the application does during startup which needs so much processing time?

I assume that the graphic bitmaps for the object and the environment are compressed on disk and therefore they have to be decompressed in memory first before they can be used in opengl. This would explain the time spent on startup.

If it is true that the bitmaps need to be decompressed first would it be possible to improve the time by using multiple cores? If the application is multithreaded and there are four cores would the time be divided by four or does this processing happen on the GPU?

Any explanation which helps me to better understand the startup-process of a computer game is really appreciated because I'm interested in improving the overall performance of the system and therefore I need a better understanding of the bottlenecks (RAM, CPU, GPU, Disks (SSD/Raid), OS, libraries, ...).

sentences:
Find out what word you are hovering mouse over I want to be able to pop up something when the user hovers over particular words that are on a label in pygame.

Can anyone give me a good (or even bad) idea on how to implement this (doesn't have to be pygame specific)? Do I have to put each word in a different label and place them one after the other?

(what I'm calling a label is the result of font.render)

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:
Rotating an object at the user specified speed in corona I am developing a globe animation, in which the speed of the rotation changes with the length of the user's drag event.The globe when touched and moved attains positive acceleration,reaches maximum value,rotates there for sometime and starts retarding and comes back to its original position.Can anybody tell me how to do this in corona.A sample code will be really helpful.

Thanks.

sentences:
Wall collision and sweep and prune algorithm I am documenting myself on collision detection algorithms.

If I understand well, "sweep and prune" algorithm using frame coherence is powerful to detect object vs object collisions (almost as 0(n)).

I am wondering if this algo is good for object vs wall collision ?

Suppose you have a big plane wall that is tilted regarding the axes of the "sweep and prune" algorithm (in a 3D game), because it is tilted the bounding box is quite big, and the wall bounding box will be detected as colliding a lot of objects. Similarly if a room is tilted regarding the axes of the algo (and the room is not a cube, but a complex geometry), then all walls collides almost all objects in the room, and the "sweep and prune" algo is useless for this problem.

A turnaround could be to split the wall in many little faces before the algo ?
Or are there other fast specific algos to detect object vs (big)wall collisions ?

sentences:
Why do games have credits more often than other software? Lately I have seen several videos that discuss how important it is to have your name in the credits of the game you've worked on. And it kinda makes sense - it's a way to prove to your future employers what experience you have.

However what puzzles me is that games seem to be the only software that does it. Unless it's a small one-man project, most software - especially closed-source commercial stuff - doesn't list any credits at all. Nor does anyone expect them to. It seems that neither employees nor their (future) employers have any problem with that.

How come there is this huge difference?

sentences:
Some meshes are visible in game view while others are not I have a FPS character in unity. The FPS character is divided into a few different pieces (upper arm, lower arm, hand, fingers, etc). I exported it from blender, so I'm using the camera that got converted from the blender camera.
For some reason, the mesh is not showing up in the game view/camera vision.
I did a little bit of testing and found out that:

If I move the camera away, the mesh shows up, so the mesh isn't invisible or anything
I put a version of the character that I imported from blender earlier as a test(different rest pose and less animations attached to it) in the same location as the FPS character, and attached the same animator to it. When I did that, you can see the earlier version but not the newest one
The same thing happens even if I change the camera

The camera has a field of view of about 67, and a focal length of 18. Near is set to the lowest value possible. Both characters are visible in scene view, just not in game view.

sentences:
Unity, Pixel Perfect and Scaling I am totally stuck on with pixel perfectness of the game. I have tried a few pixel perfect camera -assets, but they have lots of issues considering scalability. is it normal that these cameras zoom in and out, instead of scaling the camera screen when using different resolutions for the game. Because this is a huge problem for me, cause i need to make a game for aspect ratio of 16:10, and every resolution that has the same aspect ratio is needed to scale it correctly keeping the pixel perfectness. The ortographic camera size is dependent of screen width (width / PPU / 2) So it always zooms in or out with different resolutions.
Question is: Is there a way to make it scale the game sprites instead of zooming the view?

sentences:
Why do some games have different builds in different platforms/regions? I'll try to keep things brief and provide some context. I was playing MineCraft one day and this question popped into my head. I was thinking about some of the things that the Bedrock edition of the game had for example, yet the Java edition lacked. One example would be that Java doesn't allow for the use of dyes with cauldrons, but in Bedrock? No problem. Conversely, the "Illusioner" mob from the illagers can be found in Java, yet is exempt from Bedrock.
To provide another example, I recently stumbled across a mobile game called Seven Knights, created and developed in South Korea, later ported and localized for global release. It is my understanding that the Korean version of the game is quite a' ways ahead of the global release. From the number of heroes, to the length of the narrative, and the number of items, the Korean version is planned fairly far ahead. I find this to be a rather odd thing to do.
So I'll ask, why is this done? Why do developers have different builds of the same game in different platforms/regions? Would it not make more sense to simply port everything as is and then localize it if need be? Why split up the builds or only port/localize part of the content?

sentences: using an int to control events Let me explain -- I'm just looking for a way that I can link a number to a set of methods. I want to randomly generate a "difficulty" int, and pick out an event based on the number I get. IE, if I get an int of 3 I want that to point to a specific event. What's the best way to accomplish this? I was thinking of story the events in lists, but methods can't be in lists. I thought about making the methods into delegates and putting those in lists but that seems unnecessarily complicated. Also, in the future I think I'd want to put multiple events at each level which would sort of make putting them into array or lists difficult.

sentences:
Physics2D.IgnoreCollision not work when rb not moving I want to use Physics2D.IgnoreCollision for ignoring collision between enemy and player, when player have shield.
But I have enemy who some time is static and some time jump only on y axis. When enemy not moving Physics2D.IgnoreCollision not work and physics collision between player and enemy occur even Physics2D.IgnoreCollision is called. When i add some velocity to enemy in update method
Code (CSharp):
rb.velocity = new Vector2(0.1f, rb.velocity.y);

IgnoreCollision work like it should.
Can some one tell me why this happens?
Thanks

sentences: Making a crosshatching effect in Unity Shader Graphs I'm learning Shader Graph and am trying to experiment with toon shading effects. One thing I'd love to do is make a traditional art styled crosshatching effect either inside shadows or at the edge of shadows. However, I'm lost as to how to do that. I have a sample crosshatch texture I can use as a texture2D but I'm unsure how to use this as an input in shadows and to which nodes to hook it up to. I'm very new to dabbling in shaders so I'd appreciate any tips.

sentences:
Why can't we put GameObject's into a NativeArray and pass them to a Job? I just started using the Unity Job System.

It has a lot of limitations. You have to use NativeArray with it and NativeArray doesn't allow many types, notably GameObject's. It says there is a bug that you have to use non-nullable types. Why can't the job system operate directly on game objects?

sentences:
Help with Collision of spawned object(postion fixed) with objects that there are translating on screen Hey guys I am creating a game using Corona SDK and so coding it in Lua.
So there are 2 separate functions,

To translate the hit objects and change their color when they are tapped
The link below is the code I am using to for the first function
http://developer.anscamobile.com/sample-code/fishies
Spawn objects that will hit the translating objects on collision. Alos on collision the spawned object disappears and the translating object bears a color(indicating the collision). In addition the size of this spawned object is dependent on i/p volume level. The function I have written is as follows:

--VOICE INPUT CODE
local r = media.newRecording()
r:startRecording()
r:startTuner()

--local function newBar()
--    local bar = display.newLine( 0, 0, 1, 0 )
--    bar:setColor( 0, 55, 100, 20 )
--    bar.width = 5
--    bar.y=400
--    bar.x=20
--    return bar
--end

local c1 = display.newImage("str-minion-small.png")
c1.isVisible=false
local c2 = display.newImage("str-minion-mid.png")
c2.isVisible=false
local c3 = display.newImage("str-minion-big.png")
c3.isVisible=false

--SPAWNING
local function spawnDisk( event )
    local phase = event.phase

    local volumeBar = display.newLine( 0, 0, 1, 0 )
    volumeBar.y =  400
    volumeBar.x = 20
    --volumeBar.isVisible=false

    local v = 20*math.log(r:getTunerVolume())
    local MINTHRESH = 30
    local LEFTMARGIN = 20
    local v2 = MINTHRESH + math.max (v, -MINTHRESH)
    v2 = (display.contentWidth - 1 * LEFTMARGIN ) * v2 / MINTHRESH
    volumeBar.xScale =  math.max ( 20, v2 )

    local l = volumeBar.xScale
    local cnt1 = 0
    local cnt2 = 0
    local cnt3 = 0
    local ONE =1
    local val = event.numTaps
    --local px=event.x
    --local py=event.y

    if "ended" == phase then
        --audio.play( popSound )
        --myLabel.isVisible = false

        if l > 50 and l <=150 then
            --c1:setFillColor(10,105,0)
            --c1.isVisible=false
            c1.x=math.random( 10, 450 )
            c1.y=math.random( 10, 300 )
            physics.addBody( c1, { density=1, radius=10.0 } )
            c1.isVisible=true
            cnt1= cnt1+ ONE
            return c1

        elseif l > 100 and l <=250 then
            --c2:setFillColor(200,10,0)
            c2.x=math.random( 10, 450 )
            c2.y=math.random( 10, 300 )
            physics.addBody( c2, { density=2, radius=9000.0 } )
            c2.isVisible=true
            cnt2= cnt2+ ONE
            return c2

        elseif l >=250 then
            c3.x=math.random( 40, 450 )
            c3.y=math.random( 40, 300 )
            physics.addBody( c3, { density=2, radius=7000.0 , bounce=0.0 } )
            c3.isVisible=true
            cnt3= cnt3+ ONE
            return c3
        end
    end
end

buzzR:addEventListener( "touch", spawnDisk ) -- touch the screen to create disks

Now both functions work fine independently but there is no collision happening. Its almost as if the translating object and the spawn object are on different layers. The translating object passes through the spawn object freely.

Can anyone please tell me how to resolve this problem. And how can I get them to collide.

Its my first attempt at game development, that too for a mobile platform so would appreciate all help. Also if I have not been specific do let me know. I'll try to frame the query better :).

Thanks in advance.

sentences:
Which K-factor should be used in case players have different K-factor values I am implementing a ranking system based on the Elo rating and cannot get a point about the K-factor. If two players with different skills and, therefore, different K-factors are playing, which exactly K-factor should be used when changing their ratings?

For example, player A has rating 2500 and K-factor 16 (probability ~75%) while player B has rating 2300 and K-factor 24 (probability ~25%). If player A wins, do I need to use 16 as K-factor for both players or 16 for player A and 24 for player B?

sentences:
How to program friction in an air hockey game in Cocos2d-x 3.11? I'm developing a simple air hockey game, and I have a question about friction of puck and puddles with the game scene. How can I do that? I'm using cocos2d-x default physics engine, and the friction setting of physic bodies only applies when they collide.

I've found an old air hockey example project, but it seems that it's ported to cocos2d-x 3.x so it doesn't use built in physics engine.

sentences:
Why are most windowed games not resizeable? I find it incredibly rare to find a game where the window can be resized, even if permitting it is a single click away in their game engine. For what reason is this done?

Thoughts that come to mind are...

Performance, is it possible that certain resolutions still perform better in windowed mode?
Easy switching to fullscreen, as fullscreen usually requires supported resolutions. However, I find even borderless fullscreen games still prevent resizing.
Management of aspect ratios? I don't think this would be a big issue to overcome however.

There's so many games that I want to be able to resize so I can fit them where I want on my screen, but alas, it's rare.

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:
Why do I get this error when setting up Android support for Game Maker? Game Maker asks me to install the Android SDK API 13 for it to work. I opened the SDK Manager and clicked at API 13 but I wasn't able to click the "install packages" button.

I clicked at the obsolete and then I was able to install. But when I pressed "Accept Licence" I wasn't able to click install as an error came out:

Package Google Tv Addon, Android API 13, revision 1 (Obsolete) depends on Missing SDK Platform Android, API 13".

Any help would be much appreciated.

sentences: How do I publish to Google Play if I'm under 18? I've finished my first Unity and want to release it on the Google Play store but can't because I am under 18.  The main issue is that Google Wallet requires you to be over 18.  How could I work around this?

sentences:
Drawing models and their bounding boxes using two different shaders? I have a bunch of 3d models I want to draw and also for some of them I want to draw bounding boxes.
Calculating the boundnig boxes is no problem, but I'm not sure as to what is the best approach to rendering them.

I have a vertex and fragment shader for my 3d models and they contain a ton of information not needed to draw simple bounding boxes (textures, normals, etc) linked up in a program. Now I also want draw bounding boxes for each of the models meshes and I can think of two ways using two shader programs (one for 3d models and one for bounding boxes):

after drawing each mesh change program to boundingbox and draw its boundingbox
after drawing all meshes, change program to boundingbox and draw all boundingboxes for all meshes

I am inclined to believe the 2nd option is better, but is the overhead of glUseProgram significant enough to notice?

sentences:
LWJGL - Mixing 2D and 3D I'm trying to mix 2D and 3D using LWJGL.

I have wrote 2D little method that allow me to easily switch between 2D and 3D.

protected static void make2D() {
    glEnable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    glOrtho(0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

protected static void make3D() {
    glDisable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity(); // Reset The Projection Matrix
    GLU.gluPerspective(45.0f, ((float) SCREEN_WIDTH / (float) SCREEN_HEIGHT), 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    glLoadIdentity();
}

The in my rendering code i would do something like:

make2D();
//draw 2D stuffs here

make3D();
//draw 3D stuffs here

What i'm trying to do is to draw a 3D shape (in my case a quad) and i 2D image. I found this example and i took the code from TextureLoader, Texture and Sprite to load and render a 2D image.

Here is how i load the image.

TextureLoader loader = new TextureLoader();
Sprite s = new Sprite(loader, "player.png")

And how i render it:

make2D();
s.draw(0, 0);

It works great.

Here is how i render my quad:

glTranslatef(0.0f, 0.0f, 30.0f);
glScalef(12.0f, 9.0f, 1.0f);
DrawUtils.drawQuad();

Once again, no problem, the quad is properly rendered.

DrawUtils is a simple class i wrote containing utility method to draw primitives shapes.

Now my problem is when i want to mix both of the above, loading/rendering the 2D image, rendering the quad. When i try to load my 2D image with the following:

s = new Sprite(loader, "player.png);

My quad is not rendered anymore (i'm not even trying to render the 2D image at this point). Only the fact of creating the texture create the issue. After looking a bit at the code of Sprite and TextureLoader i found that the problem appears after the call of the glTexImage2d. In the TextureLoader class:

glTexImage2D(target,
        0,
        dstPixelFormat,
        get2Fold(bufferedImage.getWidth()),
        get2Fold(bufferedImage.getHeight()),
        0,
        srcPixelFormat,
        GL_UNSIGNED_BYTE,
        textureBuffer);

Commenting this like make the problem disappear. My question is then why? Is there anything special to do after calling this function to do 3D? Does this function alter the render part, the projection matrix?

sentences:
Does it require any license to use a real city landscape in a car racing game? I'm now planning a casual car racing game that want to model some real cities sight into it. I doubt if there is copyright of the landscape or city planning of those real cities in the world. Can I model such as existing city or I can't?

Thanks a lot.

sentences:
How to handle Multiple-accounts creation and cheating? I am developing a game that is running as a web application. The fact is that the game lose sense if one player creates several accounts. Imagine that is a turn-based strategy game, and if you play against yourself (with another account) you can earn tons of points easily.

At first, I thought about logging every single user action, and then comparing the users IP to detect if there is any clue of cheating. But then I noticed that different users could be running under the same IP, for example if they are in the school and all them share the same IP using a proxy. Using this way innocent people could result banned.

Is there any better approach that I'm missing?

sentences:
Managing left and right direction buttons being pressed at the same time I am currently programming a Tetris clone. In Tetris, there is a system being used called DAS, or Delayed Auto Shift. It works similarly to the keyboard auto-repeat used in Windows. For example, if you press left, the block immediately jumps one Column to the left. Then a certain amount of time goes by till it jumps a second time, and the following jumps move at a constant rate. I have this implemented as moveHorizontal(boolean moveRight), and can call it with a boolean that determines the direction the movement is going in.

However my main problem is handling the left and right direction buttons at the same time. More specifically, the state where you hold down one button, while pressing another button. The more recently pressed button should overwrite the old one, and the DAS should be reset once it switches directions. I feel like I can't really get a grasp on how to implement this kind of logic.

How do I logically change the state so as to correctly respond to the user input as I have described?

I hope I explained the problem in enough detail. If I didn't, please let me know, so I can provide more information.

sentences: How to do frame by frame animation in android using open gl es I have application in some part i am using AndroidDrawable for animation but it giving  jerking effect that why i planed to  change the code to Open Gl ES for better performance .so far i have googled a lot but did not got any good example .anybody has any idea????

sentences:
Separating scene generation and scene starting in Unity? I'm working on a game, where the map is generated, and:

The map is generated in an Awake(), so when an object's Start() is called, the map should be fully initialized.
But the scene's physics world won't be updated till the next FixedUpdate.
So when Start() is called, there is a high chance, that physics operations are done in an incorrect world (like raycasting)

I tried using Physics.SyncTransforms, but it didn't solve the issue for some reason. (Why?)

My next approach was to start the objects with a delay. Precisely: after a FixedUpdate.

So I started a Coroutine in the Start() method, which waits for a FixedUpdate, then starts the object.
But this caused that for example: ObjectA's Update() is called before ObjectB's Start coroutine finishes.

How could I achieve that scenes won't be started until the scene is fully initialized?

Is there a way to tell Unity to call every Start() i.e. 1 frame later? Or how else could I fix this? What is the best solution?

sentences:
Making an organized rendering class I'm using LWJGL (opeengl wrapper for Java) and Don't know how to make a renderer class for OpenGL. So In Immediate mode rendering I'd do a method like this to draw quadralaterals.

public static void drawQuad(int x, int y, int width, int height) {
    glBegin(GL_QUADS);
    glVertex2f(x, y);
    glVertex2f(x + width, y);
    glVertex2f(x + width, y + height);
    glVertex2f(x, y + height);
    glEnd();
}

Now that I want to use OpenGL 3+ , how can I organize code like this into a static rendering class I can call methods like Renderer.drawRect(x,y, width, height);? Or if I can make something like a spriteBatch class.

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 to control JavaFX's animations execution order when animations "queue" is being altered in run-time? What is the proper way of handling synchronization between GUI animations' execution order and the user's dynamic input?

More specifically, I would like to know how to enforce some logical conditioning on the execution's order, while remembering, that the user's input cannot be foreseen.

For instance, a greatly simplified example:

9 rectangles are shown on a screen.
A click on a rectangle fades it out.
The user clicks whichever rectangle he wants in whatever order he likes and as fast as he feels is right.
The condition here breaks into two simple ones:

The rectangles must not fade out simultaneously.
The rectangles' fade out effect occurs in the same order as their clicks.

I would assume a simple FIFO methodology here where threads would register themselves in some ordered queue and be allowed to enter the critical code only on their turn would be sufficient.

A slightly more complicated scenario:

8 rectangles are shown on a screen - the 9th is an invisible rectangle.
A click on a rectangle that is a neighbor of the invisible one, activates a translate animation that swipes between the two.
The user clicks whichever rectangle he wants in whatever order he likes and as fast as he feels is right.
A "shuffle" button is shown on the screen - shuffles the rectangles in a legal manner, i.e., by randomly moving the rectangles many times.
The conditions:

The rectangles must not get swiped simultaneously when clicked directly, their animations must be played in the order they were clicked.
The rectangles must get swiped simultaneously when the "shuffle" button is clicked. Meaning, the user must only see each rectangle move to its final position.

Some constraints:

Each rectangle has a Coordinate field that itself contains xCoordinate & yCoordinate.
Checking if the clicked rectangle is a neighbor of the invisible one will be done by comparing the rectangles' Coordinates and not their positioning on the screen, i.e., translateX, translateY.
If they are neighbors: the rectangles swipe places.
Else: the rectangle shows a nudge animation (as in invalid move).
Only after the animation is finished, rectangles' Coordinates can be swiped.
Each process (containing the needed steps after a click) apart from the animation itself, should be handled in a different thread.

A question: If the Coordinates can be swiped only after the animation is done, meaning each click activates a thread that holds all other threads(clicks that came after) until it is done so it can swipe the coordinates so the next thread's neighbor check is based on correct data, how would it be possible to allow the "shuffle option" without creating an entirely different execution path, i.e., by reusing most of the already written code and leveraging the Java & JavaFX's strengths?

What if we add a constraint that only every second click should be executed?

My point being, these problems can appear in various ways. There must be someone who thought of providing some kind of framework or an abstract solution to this kind of problems. Or is it each case for itself?

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:
Level Editor + Game -> Duplicating rendering/game specific code? I've been reading about how to design code for a game. One thing I haven't been able to figure out is - how do you manage writing an outside-game level editor (not an 'in-game level editor') without 'copying' code from the game? For example, you might have to copy all code about the different types of entities you can have. You'll have to add the game rendering code.

My guess is this can be done by making a DLL out of the 'engine' part of the game. Then, share it between the actual game and the level editor.

Or is there a better/easier way to do this?

sentences:
Flare (particle system) showing weird semi-transparent rectangles instead of smoke when there's fog in the scene I'm making an FPS game with some fog in the scene.

I've added a flare particle system (from the standard assets' prefabs) but it looks like it has some weird collision with the fog.

Whenever the fog is enabled I get these weird rectangles on top of the flare like in this screenshot:

I've noticed that when I turn off the fog they disappear, also I've noticed that when I turn off the Emission part of the particle system the rectangles disappear, but of course, also most of the wanted effect is gone.

sentences:
Weird warping with per-vertex normals I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection passes.

In spherical geometry, it noticeably distorts at the beginning and end, resulting in an imperfect transition in a cubemap reflection:

In rectangular geometry, normals are quite warped and skewed on an angle:

Same perspective (top down), but switched over to the normal map:

My approach for calculating per-vertex normals is to cycle through all the vertices in a mesh, while also looping through each triangle in the mesh (inner loop). I check if the desired vertex exists in the triangle, and if so I sum that triangle's normal into the normal for that vertex. After all the normal's have been summed together for a given vertex, I normalize it.

My implementation of the above is as follows:

QVector<GLushort> *i = getIndices();
QVector<QVector3D> *n = getNormals();
int total = i->size();
n->resize(total);

if ( total > 0 )
{
    // Loop through each vertex in mesh
    for (int x = 0; x < total; x++)
    {
        QVector3D normal = QVector3D(0,0,0);

        // Loop through each triangle in mesh
        for (int y = 0; y < total; y+=3)
            if (doesTriangleContainVertex( i->at(y), i->at(y+1), i->at(y+2), i->at(x)) )
                normal += calculateTriangleNormal( i->at(y), i->at(y+1), i->at(y+2) );

        n->replace(x,normal.normalized());
    }
}

My calculation for a normal for a given triangle is just the cross product of (vertex2-vertex1 and vertex3-vertex1).

Does anyone have any ideas as to why this is happening? The underlying shading methods work fine,  at least with per face normals,  but that obviously gives a faceted look, which I'm trying to avoid.

sentences:
Copy velocity of one object to other object I have a script to pick up items with a VR controller. I connect the object to the VR controller through a FixedJoint on a rigidbody attachPoint. When I drop an item through destroying the Joint however it plummets straight down to the ground, no force from the controller is transferred to the released object. Thus I can't throw the object.

I tried it using the AddForce() method. attachPoint's velocity is the controller's as it is a child of the controller. Relevant code below.

Can someone help me with transferring the velocity of the controller at the time of release to the object just released?

Thanks!

public class PickupCarryRelease : MonoBehaviour {

    public Rigidbody attachPoint;

    FixedJoint joint;
    GameObject obj;
    Collider grabbedObjColl;

    void Update()
    {
        Release();
    }

    void Release()
    {
        var device = SteamVR_Controller.Input((int)trackedObj.index);
        if (canGrab && joint != null && device.GetTouch(SteamVR_Controller.ButtonMask.Trigger))
        {
            var obj = joint.gameObject;
            var rb = obj.GetComponent<Rigidbody>();

            grabbedObjColl.isTrigger = false;
            rb.detectCollisions = true;

            //Transfer velocity

            Destroy(joint);
            rb.AddForce(attachPoint.velocity, ForceMode.Impulse);
            StartCoroutine(GrabDelay());
        }

    }
}

sentences:
How to make a projectile align correctly with the entity that shot it I'm developing a 2D game. In the game, all entities can rotate 360 degrees. Each entity holds an angle value, and every frame it is drawn rotated around it's center by it's current angle value. For example:

An entity can 'shoot' another entity, a projectile. The Projectile is instantiated with a position and an angle. The position is calculated like so:

radius = entity.width / 2
angle = entity.angle
projectileX = entity.centerX + cos(angle) * radius
projectileY = entity.centerY + sin(angle) * radius

Example positions this calculation gives:

The angle the Projectile is instantiated with is the angle of the entity creating it. So if the entity's current angle value was 45, the angle of the new Projectile is going to be 45.

All of this creates a problem. I will demonstrate the steps leading to this problem:

1- An entity decides to shoot a Projectile. It's position is calculated like shown above.

2- A new Projectile is added to the game. It is instantiated with the position calculated in the previous step and with the angle of the entity instantiating it, for this example 45.

3- Every frame, each entity is drawn rotated around it's center by it's current angle value.

The angle of the new Projectile is 45, so it is drawn rotated around it's center by 45 degrees.

As you can see: after the rotation, the Projectile is no longer aligned correctly with the entity that created it. They are both rotated by the same angle, but the Projectile isn't 'pointing from the center' of the entity. It seems like it 'moved' a little to the side.

To clarify:

My question: how can I make the Projectile align correctly with the entity that created it? How can I make it still 'point from the middle' of the entity that created it, and not mess this up when rotating it around it's center?

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:
How can I do fast Triangle/Square vs Triangle collision detection? I have a game world where the objects are in a grid based environment with the following restrictions.

All of the triangles are 45-90-45 triangles that are unit length. They can only rotate 90°. The squares are of unit length and can not rotate (not that it matters)

I have the Square vs Square detection down and it is very very solid and very fast (max vs min on x and y values)

Wondering if there are any tricks I can employ since I have these restrictions on the triangles?

sentences:
How can I use startcoroutine to change a variable value using while? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Outline : MonoBehaviour
{
    public float width;

    private Renderer rend;
    private float currentWidth;

    private void Start()
    {
        rend = GetComponent<Renderer>();
        currentWidth = rend.material.GetFloat("_Outline");

        StartCoroutine(ChangeOutline());
    }

    private void Update()
    {
        //SetOutLineWidth(width);
    }

    public void SetOutLineWidth(float width)
    {
        rend.material.SetFloat("_Outline", width);
    }

    IEnumerator ChangeOutline()
    {
        float timeToWait = 3f;

        while (currentWidth < width)
        {
            width += 0.01f;
            SetOutLineWidth(width);
            yield return new WaitForSeconds(timeToWait);
        }
    }
}

What I want to do is for example if I will set width variable value to 5 then change the value until the currentWidth is 5:

SetOutLineWidth(width);

If the currentWidth is 7 and I set width to 5 change the value from 7 to 5 slowly. If currentWidth is 7 and I set width to 10 again change it slowly to 10.
What I did now is making the width value keep raising and setting the Outline non stop.

What I want to do in general is to make two modes:

Change the width value and set the Outline slowly according to the time once on one direction.
Like 1 but make it ping pong mode once the outline value reached to width change it back slowly to the first value outline was and then back to width nonstop.

sentences:
Why are my objects becoming permanently stuck to walls using Box2D? I setup a simple simulation environment something like billiards. There are four circle balls (dynamic) and four box walls (static).

Simulation works... except one thing. Sometimes when a ball rest against a wall, it sticks to the wall eternally. The other balls hits the stuck ball so many times, but the ball never wants to separated with the wall. The only situation where the ball will become unstuck from the wall is another if another ball is rests against the same wall such that it hits the already-stuck ball.

Why does this situation occur? How can I avoid it?

sentences:
Line-Rectangle Collision Detection and Response I've looked through Google and none of the solutions seem to pinpoint my idea. Ultimately, I want to create a level editor where I can draw lines and have them exported to a file for my engine to read. I'm having trouble getting path-rectangle to work. I'm using this in the context of a platformer, so I'm also interested in knowing which direction and distance the collision came from so I can resolve it. Which is the best algorithm for doing this? I'm only concerned about axis aligned rectangles.

EDIT: My character is represented as a rectangle and the level is represented by lines. The tools really do not matter as I'm looking for the mathematics behind it, not necessarily an implementation.

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:
What is a game mechanic? I am trying to understand exactly what defines a game mechanic, and whether it is the same as a gameplay mechanic. There are many different sources online that try to define this but they appear to be quite inconsistent. Two that go into quite a bit of depth are below:
https://en.wikipedia.org/wiki/Game_mechanics (game context)

https://badgeville.com/wiki/Game_Mechanics (gamification context)

I understand the concepts of objectives, challenges and rules in a game, but exactly how do game mechanics tie into these? For example, are game mechanics simply abstract ways of motivating users (eg. points, achievements, discovery etc)? Or are they more practical aspects of a game such as a cover system, or how a character moves, jumps etc?

sentences:
How can I attach a model to the bone of another model? I am trying to attach one animated model to one of the bones of another animated model in an XNA game.

I've found a few questions/forum posts/articles online which explain how to attach a weapon model to the bone of another model (which is analogous to what I'm trying to achieve), but they don't seem to work for me.

So as an example: I want to attach Model A to a specific bone in Model B.

Question 1.
As I understand it, I need to calculate the transforms which are applied to the bone on Model B and apply these same transforms to every bone in Model A. Is this right?

Question 2.
This is my code for calculating the Transforms on a specific bone.

private Matrix GetTransformPaths(ModelBone bone)
{
    Matrix result = Matrix.Identity;
    while (bone != null)
    {
        result = result * bone.Transform;
        bone = bone.Parent;
    }
    return result;
}

The maths of Matrices is almost entirely lost on me, but my understanding is that the above will work its way up the bone structure to the root bone and my end result will be the transform of the original bone relative to the model.

Is this right?

Question 3.
Assuming that this is correct I then expect that I should either apply this to each bone in Model A, or in my Draw() method:

private void DrawModel(SceneModel model, GameTime gametime)
{
    foreach (var component in model.Components)
    {
        Matrix[] transforms = new Matrix[component.Model.Bones.Count];
        component.Model.CopyAbsoluteBoneTransformsTo(transforms);

        Matrix parenttransform = Matrix.Identity;
        if (!string.IsNullOrEmpty(component.ParentBone))
            parenttransform = GetTransformPaths(model.GetBone(component.ParentBone));

        component.Player.Update(gametime.ElapsedGameTime, true, Matrix.Identity);

        Matrix[] bones = component.Player.GetSkinTransforms();

        foreach (SkinnedEffect effect in mesh.Effects)
        {
            effect.SetBoneTransforms(bones);

            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index]
                * Matrix.CreateRotationY(MathHelper.ToRadians(model.Angle))
                * Matrix.CreateTranslation(model.Position)
                * parenttransform;
            effect.View = getView();
            effect.Projection = getProjection();
            effect.Alpha = model.Opacity;
        }
    }
    mesh.Draw();
}

I feel as though I have tried every conceivable way of incorporating the parenttransform value into the draw method. The above is my most recent attempt.
Is what I'm trying to do correct? And if so, is there a reason it doesn't work?

The above Draw method seems to transpose the models x/z position - but even at these wrong positions, they do not account for the animation of Model B at all.

Note: As will be evident from the code my "model" is comprised of a list of "components". It is these "components" that correspond to a single "Microsoft.Xna.Framework.Graphics.Model"

sentences:
Xbox Controller Not Connecting in Monogame Project I have recently been playing around with the support of the wired XBox 360 controller in Windows development.  I am developing in C# in Visual Studio 2012.

I have created 2 projects.  The first (Project A) is an XNA project compiled in .Net 4.0.  The second (Project B) is a MonoGame 3.0 Windows Open GL project also compiled in .Net 4.0.

My issue is that my wired Xbox 360 controller can only be picked up in Project A - the XNA project.  I would really like to continue working with the Monogame type, but have hit a brick wall here.

I have verified that all the requisite libraries (OpenTK, Tao.SDL, SDL) are the exact same files being referenced by both projects.  Still, the Monogame project does not pick up the controller.

The exact state of the GamePadState variable is Connected = false.

Any ideas?

Again, same computer, same code for accessing the controller, only difference is XNA vs Monogame.

sentences:
Point Light shows black box & rect (PointLight not working) - libgdx 3D I am creating a 3d scene currently a box and rect, and trying to enable lighting.

  When i create a PointLight and add it to Environment everything turns to  black color?

all i want to do is create a 3d scene and enable point light, like a sun or rays coming from a point and shading the objects.

Code:

environment = new Environment();
environment.add(new PointLight().set(1f, 1f, 1f, 0, 0, 20f, 100f));

modelBatch=new ModelBatch();

..

square=new ModelBuilder().createBox(300,300,300,new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
squareinst=new ModelInstance(square);
squareinst.transform.setTranslation(-500,0,0);

--

sprites.get(0).setRotationY(sprites.get(0).getRotationY() + 1f);
sprites.get(1).setRotationY(sprites.get(1).getRotationY() - 1f);
squareinst.transform.rotate(1,0,0,1);

modelBatch.begin(camera);
for(Sprite3D sp:sprites)// has 3d rect models
     sp.draw(modelBatch,environment);
modelBatch.render(squareinst,environment);
modelBatch.end();

PointLight turning everything black

Without using environment or lights

as per my investigation, here if pointlight is not working then everything should be black as currently, because the environment needs light, it works fine with Directional light (only the backface of rect is black even after rotations, i don't know why)

libgdx version 1.6.1 - android studio
i checked it on both android device and desktop

please i really need to get this PointLight working, i don't know if it will take a custom shader, if so please guide me to some links because i am not experienced in shaders. I also read about PointLight not working on some device or not working in opengl 2.0 enabled, but i am not sure.

sentences:
Entitiy spawn on Button press I'm trying to create a little 2D-Zombie-Shoot game. I'm pretty much at the beginning of programming. At least, I can create a player that is moving with arrow keys and stuff. My question is: How do I spawn a Zombie on a button-press? I've already tried it, but with no good results. Here's the code:

//A variable, for the amount of zombies spawned
public int zombie = 0;

 public void tick() {
 //The rest of the code is irrelevant
 ...........

    if (mouse1.isPressed()) {
        zombie++;
    }

}

public void render() {
    //The rest of the code is irrelevant
    ...........

    //Player
    g.drawImage(playerImage, x, y, null);

    //Check how many zombies should be created
    if (zombie > 0) {
        g.drawImage(zombieImage, zX, zY, null);
    }
    ...........

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:
Marshalling C# Structs into DX11 cbuffers I'm having some issues with the packing of my structure in C# and passing them through to cbuffers I have registered in HLSL. When I pack my struct in one manner the information seems to be able to pass to the shader:

[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct TestStruct
{
    [FieldOffset(0)]
    public Vector3 mEyePosition;

    [FieldOffset(12)]
    public int type;
}

This works perfectly when used against this HLSL fragment:

cbuffer PerFrame : register(b0)
{
    Vector3 eyePos;
    int type;
}

float3 GetColour()
{
    float3 returnColour = float(0.0f, 0.0f, 0.0f);

    switch(type)
    {
        case 0:
            returnColour = float3(1.0f, 0.0f, 0.0f);
            break;
        case 1:
            returnColour = float3(0.0f, 1.0f, 0.0f);
            break;
        case 2:
            returnColour = float3(0.0f, 0.0f, 1.0f);
            break;
    }

    return returnColour;
}

However, when I use the following structure definitions...

// Note this is 16 because HLSL packs in 4 float 'chunks'.
// It is also simplified, but still demonstrates the problem.
[StructLayout(Layout.Explicit, Size = 16)]
internal struct InternalTestStruct
{
    [FieldOffset(0)]
    public int type;
}

[StructLayout(LayoutKind.Explicit, Size = 32)]
internal struct TestStruct
{
    [FieldOffset(0)]
    public Vector3 mEyePosition;

    //Missing 4 bytes here for correct packing.

    [FieldOffset(16)]
    public InternalTestStruct mInternal;
}

... the following HLSL fragment no longer works.

struct InternalType
{
    int type;
}

cbuffer PerFrame : register(b0)
{
    Vector3 eyePos;
    InternalType internalStruct;
}

float3 GetColour()
{
    float3 returnColour = float(0.0f, 0.0f, 0.0f);

    switch(internaltype.type)
    {
        case 0:
            returnColour = float3(1.0f, 0.0f, 0.0f);
            break;
        case 1:
            returnColour = float3(0.0f, 1.0f, 0.0f);
            break;
        case 2:
            returnColour = float3(0.0f, 0.0f, 1.0f);
            break;
    }

    return returnColour;
}

Is there a problem with the way I am packing the struct, or is it another issue?

To re-iterate: I can pass a struct in a cbuffer so long as it does not contain a nested struct.

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:
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:
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:
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:
Rewriting a text object I'm trying to set up a UI system. Say I have a text object 'text' which is visible onscreen. I want to change it with a button press using a script such that the text box's previous string is replaced with a new string held in a string variable 'chat'.

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

public class textchange : MonoBehaviour
{

public Text text; //the text box gameobject is dragged into this

public string chat; //the chat string is filled elsewhere

void Awake()
{

}

void Update()
{
(if button press logic here)
{
text.text = chat;
}
}

}

What I expect is for the text to dynamically change, but what happens is absolutely nothing, the gameobject does not have its text component rewritten. What gives?

sentences:
How can I clean up excessive player-created rubble? In my latest game I'm making, you can slice a 2D object arbitrarily, demonstrated in this gif:

You can continuously cut it into hundreds or thousands of pieces. This doesn't create a lot of lag, because they're always in a sleeping physics state, but there's a problem when you cause them to move.

I'm not really sure how to deal with making it so there's not so much rubble from cutting something apart. I don't really want to delete them after a certain amount of time; I don't like how, if you go back to something you cut up after a while, it randomly disappeared.

How can I clean up excessive player-created rubble?

sentences:
Space-efficient data structures for broad-phase collision detection As far as I know, these are three types of data structures that can be used for collision detection broadphase:

Unsorted arrays: Check every object againist every object - O(n^2) time; O(log n) space. It's so slow, it's useless if n isn't really small.

for (i=1;i<objects;i++){
  for(j=0;j<i;j++) narrowPhase(i,j);
};

Sorted arrays: Sort the objects, so that you get O(n^(2-1/k)) for k dimensions O(n^1.5) for 2d and O(n^1.67) for 3d and O(n) space.

Assuming the space is 2D and sortedArray is sorted so that if the object begins in sortedArray[i] and another object ends at sortedArray[i-1]; they don't collide
Heaps of stacks: Divide the objects between a heap of stacks, so that you only have to check the bucket, its children and its parents - O(n log n) time, but O(n^2) space.

This is probably the most frequently used approach.

Is there a way of having O(n log n) time with less space? When is it more efficient to use sorted arrays over heaps and vice versa?

sentences:
How granular should entity states be? I'm writing a component-based entity system and one of the components is the entity's state, which dictates how it reacts to game events. In case anyone has experience with implementing states, how granular should they be?

To give you an idea about how granular they are in my case, I have a WalkingLeft state and a WalkingRight state (as opposed to simply a Walking state) and I fear that they might be too granular. What do you think?

sentences:
Is it better to import photoshop files or illustrator files into flash? I was wondering what would be better to import into flash for when I animate.
My intention is to animate my characters and objects and then export as a png sequence and make a sprite sheet then take into cocos2d.

Illustrator like flash is vector based but I will have to turn it into pixels anyway to play on a screen.

So I was just wondering what would be better or easier or does it not matter either way?

Additional information:
I have all the adobe software above at CS5.
I am slightly more comfortable working in Illustrator.
My intention was to make the graphics in illustrator so that I could easily resize my graphics for multiple devices, sometimes I may have to rasterize my illustrator file and add final touches in photoshop.

As I'm sure you can tell i'm pretty new to flash and iphone development so any help or advice would be greatly appreciated, sorry for all the questions.

sentences:
Water silhouette shader using GLSL I have this problem to solve using Cocos2d-x 3.x:
In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc.

I would like to achieve silhouette effect when he goes into the water - so if pixel of character texture is not transparent and pixel of water texture is not transparent, color should be changed lets say to gray. I would like it to work as fragment shader added to character sprite.

The problem is that I have no idea how to go from character UV coords to water texture coords (positions, rotations and dimensions of textures are different). I am also not sure the approach proposed by me is the correct one, maybe there is better way to do it?

Could you please give me some thought how it should be done? Any code is welcome too!

Edit: here is a visualization, red triangle is character, it changes color as it submerges

sentences:
Math major as a viable degree While I realize there are many topics about CS vs software engineering vs game school programs, I haven't found anything relating to whether pure math degrees (with CS minor and electives) would also be a viable program. By this I mean: Would having a math major, CS minor put one at competitive disadvantage as compared to a pure CS program?

This relates specifically to game engine programming, more on the graphics side.

Background (for those who care): Currently a math major, CS minor at school and looking to land a career doing graphics engine programming. Admittedly, I love math and if at all possible would like to stay my current program as long as it doesn't put me at a competitive disadvantage trying to land a job post-graduation. That being said, I'm strong in the traditional C/C++ languages, strong concurrent programming skills, and currently produce self-made games for iOS. As an employer, how badly is the math major hurting me? Just want to get some advice from people already in the field!

sentences:
3d vertex translated onto 2d viewport I have a spherical world defined by simple trigonometric functions to create triangles that are relatively similar in size and shape throughout.

What I want to be able to do is use mouse input to target a range of vertices in the area around the mouse click in order to manipulate these vertices in real time.

I read a post on this forum regarding translating 3d world coordinates into the 2d viewport.. it recommended that you should multiply the world vector coordinates by the viewport and then the projection, but they didn't include any code examples, and suffice to say i couldn't get any good results.

Further information.. I am using a lookat method for the viewport.  Does this cause a problem, and if so is there a solution?  If this isn't the problem, does anyone have a simple code example illustrating translating one vertex in a 3d world into a 2d viewspace?

I am using XNA.

sentences:
Logic / Render phases with a single thread The question I have may generate different opinions from different developers, but I'd still like to have an answer on this.

Its all about the updating and rendering steps of the game loop, and their use under multi and single threaded environments.

Currently, there is one thread running, which takes care of sequentially executing events , logic and rendering. Sometimes, the logic part may wish to change the game state to something else, and in between do some loading of files.

The result is that the game hangs completely while loading, and then proceeds to normal rendering of the new state. To go around this, i could make another thread, do the loading there while the main thread renders a smooth loading animation, and then proceed normally.

The real question is about if i don't create another thread. I could refresh the screen from the logic thread, and provide some basic loading screen, which could be not so smoothly updated while the files load.

In fact, this approach is not loved by a lot of developers, as it scrambles render code in the logic step, which may cause problems of different sorts..

Hope its clear!

sentences:
Get sprites from XML and spritesheet in Java I have a SpriteSheet that have a lot of images in one in .png format, and the XML file with the all names of every sprite (x,y,width,height) like this:

<TextureAtlas imagePath="sheet.png">

<SubTexture name="box.png" x="0" y="864" width="70" height="70"/>

</TextureAtlas>

Im using Slick2D to make a BasicGame, SpriteSheet and XStream lib to manage the sprites, but i cant do, that load the image correctly. How I can do?

sentences:
Tools for developing C64 Games Just wondering what people nowadays use for developing Commodore 64 Games?

I've got the Programmer's Reference Guide which goes into all the details, but in the modern Age I assume I won't have to do development on an actual C64 itself?

Are there tools that run on Windows or Mac OS X that are a bit like an IDE that offers some help and some debugging facilities (e.g., by hooking into an Emulator) or easy packaging into .d64 disk images?

Is 6502 Assembler the one chosen language, or is C development feasible? (Ignoring BASIC here)

sentences:
Game state management? I'm running in circles here trying to figure out how to implement game states!

Many of the articles I have read use an abstract class that game states inherit, and another "manager" class that handles pushing/popping game states.

This is fine I guess, but for the game I'm planning on making, I can only imagine I'll have MANY classes, alot of which are nearly identical. For example, I have one game state which is basically a view of my scene with a few GUI buttons. Another game state gets entered when the user clicks the "Terraforming" button, which allows the user to modify the terrain. Both of those have many similarities - they are both rendering the same scene, the controls are the same, much of the GUI is the same except for a new window that contains terraforming controls, and mouse clicking is handled differently. It sounds silly to completely reconstruct a new game state when 90% of it will be identical.

Am I thinking about this the wrong way? Or is there a better solution for managing game states?

sentences:
Best system for creating a 2d racing track I am working a 2D racing game and I'm trying to figure out what is the best way to define the track.

At the very least, I need to be able to create a closed circuit with any amount of turns at any angle, and I need vehicles to collide with the edges of the track. I also want the following things to be true if possible (but they are optional):

The code is simple and free of funky workarounds and extras
I can define all of the parts of the track (such as turns) relative to the previous parts
I can predict the exact position of the road at a certain point (that way I can easily and cleanly make closed circuits)

Here are my options:

Use a set of points. This is my current system. I have a set of turns and width changes that the track is supposed to make over time. I have a point which I transform according to these instructions, and I place a point every 5 steps or so, depending on how precise I want the track to be. These points make up the track. The main problem with this is the discrepancy between the collisions and the way the track is drawn. I won't get into too much detail, but the picture below shows what is happening (although it is exaggerated a bit). The blue lines are what is drawn, the red lines are what the vehicle collides with. I could work around this, but I'd rather avoid funky workaround code.
Beizer curves. These seem cool, but my first impression of them is that they'll be a little daunting to learn and are probably too complicated for my needs.
Some other kind of curve? I have heard of some other kinds of curves; maybe those are more applicable.
Use Box2D or another physics engine. Instead of defining the center of the track, I could use a physics engine to define shapes that make up the road. The downside to this, however, is that I have to put in a little more work to place the checkpoints.
Something completely different.

Basically, what is the simplest system for generating a race track that would allow me to create closed circuits cleanly, handle collisions, and not have a ton of weird code?

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:
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:
Blocking Physics Raycasts with Unity's 4.6 UI? I use raycasts to determine hit objects and object selection in our game. I want these to be blocked by UI elements. Before I had a crude form of that where I just excluded rects of the screen, though with a non-rectangle shaped UI that's pretty difficult.

I want to have physics raycasts NOT go through UI objects, can this be done? My initial thought it adding colliders to the UI objects, though I'm not sure if the colliders will scale with elements based on screen size.

Note: Canvas Group does not apply to physics.raycast

sentences:
unity JsonUtility.ToJson returns empty string I am trying to use Unity's built in json serialization.  It produces empty string.   I do not understand why.  (I was trying to use NewtonSoft Json.Net but that wasn't working either even though I was following instructions).

Here's the serialization code:

public class Player : MonoBehaviour
{
    void Start ()
    {

        Mission a = new Mission()
        {
            Id = 1,
            Name = "Speak to the Farmer",
            State = MissionState.OnGoing,
            Parent = -1,
            Type = MissionType.Main
        };

        string json = JsonUtility.ToJson(a);
        System.IO.File.WriteAllText("missions2.json", json);
    }
}

Here's the Mission class:

[Serializable]
public enum MissionState
{
    NotStarted,
    OnGoing,
    Finished
}

[Serializable]
public enum MissionType
{
    Main,
    Sideline
}

[Serializable]
public class Mission
{
    public Mission()
    {
        Parent = -1;
    }

    public int Parent { get; set; }
    public int Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public MissionState State { get; set; }
    public MissionType Type { get; set; }
}

here's the output:
{}

There are no exceptions thrown.  The file missions2.json is created.  But the data is as shown above.  What is wrong that the serialization produces nothing?

Thnx
Matt

sentences:
How to remove fragment from VAO? I have the OpenGL VAO object (~40K) to draw the 3D scene

glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 4, GL_UNSIGNED_BYTE, nullptr);
glBindVertexArray(0);

To add some data I can use glMapBuffer:

GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, (2 * steps) * sizeof(float),
     NULL, GL_STATIC_DRAW);
float *data = (float *) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
myFuncAddingData(data,{2.4f, 40.0f, 19.0f});
glUnmapBuffer(GL_ARRAY_BUFFER);

Can I to remove (hide/mask) some verteces (3 from 40K) directly from the located in the grafical memory VAO without full complete replacement all of the 40K?

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:
Unity getting Input from UI So I'm trying to get a script of mine to pass information to another static class being used for saving files as I've been told I wouldn't want that script to be instantiated. So I used a separate script to get input field text. However, I seem to be encountering a problem whenever I want to save the file.

I keep getting the error "Object reference not set to an instance of the object", I have made done this though. (See code below)

The class to get the name of the file

public class SaveInputField : MonoBehaviour
{
    public static string saveName;
    public GameObject inputField;

    public void getFileName(string saveName)
    {

        saveName = inputField.GetComponent<Text>().text;
        Debug.Log("Save file name: " + saveName);
        SaveFile.saveName = saveName;
    }
}

^called whenever its been edited

The static class

public static class SaveFile
{

    public static string saveName;

    public static void SaveData(Deck deck)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string path = Application.persistentDataPath + "/" + saveName + ".dd";

        FileStream stream = new FileStream(path, FileMode.Create);
        Debug.Log("Stream Opened");
        DeckData data = new DeckData(deck);

        formatter.Serialize(stream, data);
        stream.Close();
        Debug.Log("Stream Closed");

    }
```

sentences:
How do I prevent dynamic GUI elements from overlapping in Unity? I'm working on a birds-eye-view for our Unity3D game world, where each point of interest has a label hovering above it. The problem is that sometimes they overlap, although there is more than enough space on the screen for them to co-exist.

Can anybody think of a better way to separate them than checking every texture with every other texture and moving them away from each other?

sentences:
Is there a way to get native resolution of device window/display on android? When change the framebuffer resolution by calling

Screen.setResolution(1920,1080)

Screen.currentResolution, Screen.width, Screen.height reports back the new resolution 1920x1080.

Screen.resolutions gave me empty array (tested on real android device).

I am unable to get back the original resolution which was a native resolution of the device. Do I have to remember the native resolution or is there a way to get that through unity API ?

sentences:
Minecraft Bedrock behaviors: drop items for player/owner? I'm making a simple behavior pack for Minecraft's Bedrock Edition for my own experimenting - the aim is to get tamed wolves to play fetch. The behavior pack is valid and loading, as it sort of works, but the part that isn't working is what I've been banging my head against for hours.

As per the tutorial on the official wiki, I've copied entities/wolf.json and entities/player.json from the vanilla behavior pack to my pack and added to them, borrowing cues from the villager's behavior file and referring to the reference for BE's entity components. I've also modified the priorities of the tamed wolf's behaviors so picking up items (i.e. sticks) and sharing them are a higher priority than following the owner or breeding.

wolf.json:

{
    "minecraft:entity": {
        "format_version": "1.2.0",
        "component_groups": {
            ...
            "minecraft:wolf_tame": {
                ...
                "minecraft:behavior.pickup_items": {
                    "priority": 7,
                    "max_dist": 16,
                    "speed_multiplier": 1.5,
                    "track_target": true
                },
                "minecraft:inventory": {
                    "inventory_size": 1,
                    "private": true
                },
                "minecraft:shareables": {
                    "items": [
                        {
                            "item": "minecraft:stick",
                            "want_amount": 1,
                            "surplus_amount": 1
                        }
                    ]
                },
                "minecraft:behavior.share_items": {
                    "priority": 6,
                    "max_dist": 16,
                    "speed_multiplier": 2,
                    "goal_radius": 2.0,
                    "entity_types": [
                        {
                            "filters": {
                                "test": "is_owner",
                                "subject": "other"
                            },
                            "must_see": true
                        }
                    ]
                }
                ...
            }
       }
   }
}

player.json:

{
    "minecraft:entity": {
        "format_version": "1.2.0",
        "components": {
            ...
            "minecraft:shareables": {
                "items": [
                    {
                        "item": "minecraft:stick",
                        "want_amount": 2304,
                        "surplus_amount": 2304
                    }
                ]
            }
        }
    }
}

Currently, a tamed wolf will run over to pick up a dropped stick within 16 blocks of it, but after that it simply resumes following me (its owner) and never drops/shares its sticks. I've messed with the want_amount and surplus_amount of the sticks for both the player and wolf, but with absolutely no results.

sentences:
How do I stop gyroscope-controlled camera from jittering when holding phone still? I have here a simplified version of my gyro-controlled camera with a sensitivity modification (a side effect of increasing sensitivity is that the jitteriness is exacerbated).
public class GyroControl : MonoBehaviour{

private Transform _rawGyroRotation;
Vector3 gyroAdjust;
[SerializeField] private float _smoothing = 0.1f;

void Start()
{
    Input.gyro.enabled = true;
    Application.targetFrameRate = 60;

    _rawGyroRotation = new GameObject("GyroRaw").transform;
    _rawGyroRotation.position = transform.position;
    _rawGyroRotation.rotation = transform.rotation;

}

private void Update()
{
    _rawGyroRotation.rotation = Input.gyro.attitude;

    gyroAdjust = _rawGyroRotation.rotation.eulerAngles * 2; //increase rotation sensitivity
    transform.rotation = Quaternion.Euler(gyroAdjust);

    transform.rotation = Quaternion.Slerp(transform.rotation, _rawGyroRotation.rotation, _smoothing);

}}

When in motion, the jittering isn't noticeable. But when you hold the phone still, there's what I assume to be just analogue noise that causes jittering. I would really appreciate any help or advice on how to add a filter or something to reduce the jittering for this kind of controller.
Thanks.

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:
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:
Pygame End Screen Problem How To Fix? Video as you can see there I am trying to make my end screen restart my game but whats happening is that its not restarting my game its just loading the same thing when I die >> how could I make it so it restarts my game when I click start game on my end screen?

my end screen def

---------------------------------------------------

def button(msg,x,y,w,h,ic,ac,action=None):
    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()

    if x+w > mouse[0] > x and y+h > mouse[1] > y:
        pygame.draw.rect(window, ac,(x,y,w,h))
        if click[0] == 1 and action != None:
            action()
    else:
        pygame.draw.rect(window, ic,(x,y,w,h))
    smallText = pygame.font.SysFont("comicsansms",20)
    textSurf, textRect = text_objects(msg, smallText)
    textRect.center = ( (x+(w/2)), (y+(h/2)) )
    window.blit(textSurf, textRect)

#------------------------------------------------------

def text_objects(text, font):
    textSurface = font.render(text, True, black)
    return textSurface, textSurface.get_rect()

def endScreen():
    red = (200,0,0)
    green = (0,200,0)
    bright_red = (255,0,0)
    bright_green = (0,255,0)

    intro = True
    while intro:
        for event in pygame.event.get():
            #print(event)
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()

        window.fill((255,255,255))
        largeText = pygame.font.Font('BLOODY.ttf',100)
        TextSurf, TextRect = text_objects("You Have Died Fool", largeText)
        TextRect.center = ((800/2), (800/2))
        window.blit(TextSurf, TextRect)
        button("Start Game",150,450,100,50,green,bright_green,game_loop)

# make the square brighter if collideded with the buttons
        mouse = pygame.mouse.get_pos()
        if 150+120 > mouse[0] > 150 and 450+50 > mouse[1] > 450:
            pygame.draw.rect(window, bright_green,(150,450,120,50))
        else:
            pygame.draw.rect(window, green,(150,450,120,50))
        if 550+110 > mouse[0] > 550 and 450+50 > mouse[1] > 450:
            pygame.draw.rect(window, bright_red,(550,450,110,50))
        else:
            pygame.draw.rect(window, red,(550,450,110,50))
# ---------------------------------------------------------------------

        smallText = pygame.font.Font("freesansbold.ttf",20)
        textSurf, textRect = text_objects("Start Game", smallText)
        textRect.center = ( (150+(120/2)), (450+(50/2)) )
        window.blit(textSurf, textRect)

        smallText = pygame.font.Font("freesansbold.ttf",20)
        textSurf, textRect = text_objects("Quit Game", smallText)
        textRect.center = ( (150+(910/2)), (450+(50/2)) )
        window.blit(textSurf, textRect)

        pygame.display.update()
        clock.tick(15)

#----------------------------------------------------------

and on my main loop I said if my playerman health is > -1 it should load the end screen

            if playerman.health < -5:
                endScreen()

```

sentences:
Keep platformer jump height consistent with different frame rates I want to achieve a platformer jump similar to that of Super Mario Bros. (keep pressed the jump button to jump higher) and I want it to be frame rate independent.
At 30 FPS it works as I want. However, I noticed that, if frame rate is lower (e.g. 10 FPS) the jump height is much lower.

The following is the pseudo-code I am using on my character. What am I doing wrong? Note: I'm considering the Y-axis to grow downwards, so a negative vertical speed means the character is moving upwards.

jump_force = 4000;
jump_max_speed = 800;
gravity = 2000;

yspeed = 0; // vertical speed (negative is upwards)
is_jumping = false;

update() { // called every frame
    dy = 0; // delta y-position for this frame

    if (yspeed != 0 && is_grounded()) {
        yspeed = 0;
    }

    if (jump_button_pressed() && is_grounded())
        is_jumping = true;
    else if (is_jumping && !jump_button_pressed())
        is_jumping = false;

    if (is_jumping) {
        yspeed -= jump_force * dt(); // dt() is delta time, i.e. time elapsed since last frame
        // cap vertical speed to limit jump height
        if (yspeed < -jump_max_speed) {
            is_jumping = false;
            yspeed = -jump_max_speed;
        }
    }
    else if (!is_grounded()) {
        // apply gravity only when the character is not jumping
        yspeed += gravity * dt();
    }

    dy = yspeed * dt();

    // if character would fall inside terrain, place it just above it
    if (dy > 0 && check_for_ground(x, y + dy)) {
        y = ground.y;
        yspeed = 0;
    }
    else
        y += dy;
}

sentences:
AI algorithms for Strategy Game I am working on building a Strategy Game (Animal Colonies fighting each other).

It is going to be simple game targeting Kids, the beta version will only support single player playing against AI opponent.

I am going to hire Algorithm programmers to build the AI algorithms of the opponent, BUT :

I am not sure what information I need to give for the programmers in order to build these algorithms.
I want to have different AI levels difficulties (easy, medium, hard), BUT if the AI opponent is too easy to defeat, the game is boring, while if it is too difficult to defeat, the game is too frustrating, and the player will quit, so I need this issue to be addressed when building AI for different levels.
I am not sure if the AI opponent should behave like a human player? I mean should the specification allow AI opponent to have access to all game resources ? or AI should behave like human player to use scouts to collect information about resources and enemy?

I need to identify these points. I want to write detailed specification so algorithm programmers can do the work as expected. All what I have at the mean time is Colonies design (characters/elements), maps with objects (grass, rocks, hills, tree .. etc).

So, what exactly do I need to give them in order to build opponent AI?

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: how to change floor sprite in unreal engine I have started a 2D side scrolling game in Unreal Engine from the menu when you start a new game. The basic environment loads up and it works but I don't know how to change the floor sprites and player sprites. Please Help.

sentences:
Unity - Read pixels of camera into memory I am trying to develop a bot in a Unity game that takes actions based on the image produced by the camera.

I have attached a camera to the "face" of the bot, which is the camera I need to get the image of. For instance in the following picture I have run the bot and taken a screenshot. For every frame update I need to read the pixels that would be shown on the screen into memory.

How do I do that?

Ultimately I would like the bot to run in batch mode without graphics if possible, as this would speed up the process of evolving the bot.

Is it possible to read the pixels that a given camera would have shown on the screen even without graphics enabled? If so how?

sentences:
Room generation with external walls and doors I am looking to implement a means to generate rooms with outer walls with windows and doors from prefab game objects in Unity.

The idea is that a group of tiles is defined as a room which I then iterate through to find the outer tiles and then use their external edges to generate the walls of the entire room. Gathering the outer tiles is easy enough and working out the external edges is already implemented.

What I need to understand is the best approach for using prefab game objects as the set pieces for walls and floors.

Currently for a single wall piece, I have created a quad and made that into a prefab which I then clone, position and rotate into place along the outer edges. The below screenshot shows a room with walls made using the prefab wall GameObject. In this screenshot, the room consists of 12 wall GameObjects. I want to avoid having lots of GameObjects for single wall segments and instead perhaps merge them all into a single mesh on a single GameObject.

What I would like to achieve is to be able to create a consistent set of pieces for each outer wall, with windows and doors (most likely cloned from other prefabs) to build a realistic looking room. For example, any single length of a wall would be made up from

Wall -> Wall -> Window -> Wall -> Wall

Perhaps there is a much easier way to achieve this that I have overlooked but searching for room generation always leads back to examples for dungeon crawlers and roguelikes. I am not creating a dungeon crawler, nor am I generating the environment proceedurally, instead the player will be able to create rooms in a similar fashion to Evil Genius and The Sims.

In the current approach, creating a room which is 5x5 would mean that there are a total of 20 wall GameObjects and 25 floor GameObjects. I am not keen on having this many objects in the scene for a single room. I would prefer to be able to create a mesh for the entire room, adding in the vertices and triangles from the prefab mesh to cut down on the number of GameObjects in the scene.

Does anyone have any experience with building rooms in this fashion, or are there any clear examples of how to achieve this? I am not sure how to translate and rotate a prefab and then merge the translated meshes into a single mesh. Perhaps I am barking up the wrong tree and there is a better approach but for now, this is the only way I can see which is possible to achieve what I want.

sentences:
How to synchronize a parent and child position? When watching this video of Unity development, I was following along trying to learn Unity and for the most part understood everything conceptually.

Where I got lost was when I tried using some of the same code and setup in Unity. I got the code working fine, but I got in trouble when I tried to implement the parent-child behavior seen in the video at around 7 minutes regarding the Enemy objects.

The solution described is set up as follows (someone correct me if I didn't understand it properly from the video).

Parent Object

Contains the script which drives behavior and movement
Is located at the origin of the scene (reset the transform in other words)

Child Object

Contains the graphics renderer which draws the actual sprite or 3D object
Is located at the enemy spawn point

For me to get this setup working, I had to run the Translate function explicitly against the child object:

transform.GetChild(0).Translate(dir.normalized * distThisTurn)

However, in the video, it appears to work just fine with only:

transform.Translate(dir.normalized * distThisTurn)

Once he fixes the rotation issue, at about 7 minutes in, this works beautifully, and the enemy travels the path exactly as expected. When I tried this exact same approach, my enemy sprite jumps all over the place. It took me several hours to figure out that I needed to add the .GetChild(0) part. The behavior I saw with the setup from the video is that the invisible parent object moved correctly along the path, and the child went crazy and followed some alternate version of the same path, as if the origin was different or offset, or the path was reflected across some axis.

My question is: what did I do wrong? Can anyone spot how my setup is different than the one used in the video? Did I miss some detail of how he set up his parent-child objects, particularly for the enemies? Or could this be some different behavior due to the version of Unity he is using (I believe mine is newer as I installed it just this week). I think it could also be some small gizmo or feature he neglects to mention that allows you to synchronize the movement of a parent object with its children.

The reason for this setup (at least as given in the video) is it allows you to easily swap out the graphics. The scripting is tied to the parent, so all you have to do is exchange the child for one with different graphics and you're done. That part makes sense, I just don't understand why the exact same code he uses did not work for me. I'm talking only about the Enemy object here - the creeps that move along the path (it's a tower defense game).

I just want to know because I may have to use this extra GetChild call quite a bit, and I feel like it shouldn't be necessary, especially after seeing it work so well in the video. Doing this would also make my scene design a little easier.

I have already read the comments on that video for additional info, as well as looked through Unity forum posts, other posts here on Game Dev.SE, and Google results. It would seem as if this is either old behavior, or there is some small detail neglected to explain in the video of how to synchronize movement of parent and child objects.

sentences:
Turn-Based RPG Battle Instance Layout For Larger Groups What a title, eh?

I'm currently designing a videogame; a turn-based RPG like Final Fantasy (because everybody knows Final Fantasy). It's a 2D sprite game.

These are my ideas for combat:

The player has a group of 15 members (main character included)
During battle, five of the group are designated as active, and appear in the battle.
These five may be switched out at leisure, or when one of the five die.
At any time, the Waiting members can cast buffs, be healed by the active members, or perform special attacks.
Battles should contain 10+ monsters at least. I'm aiming for 20, but I'm not sure if that's possible yet.
Battles should feel larger than normal due to the interaction of Waiting members, active members and the increased amount of monsters per battle.
The player has two rows in which to put the Active members:  front and back.
Depending on the implementation, I might allow comboing of player attacks and skills.

These are just design ideas, so beware! I have not been able to test this out yet- I have no idea yet if any of these ideas bunched together will make for a compelling game. What sounds good on paper doesn't necessarily have to be good in practice!

What I'm asking now is how to create the layout for this. My starting point are the battles in Final Fantasy VI, with up to 5-6 monsters on the left and the characters on the right- monsters on both sides if it's a pincer attack.

However, this view would not work feasible with my goal of 20 monsters and 5 characters. All the monsters on the left would appear cluttered unless I scale them far far back. If I create a pincer-like map, then there would be no real pincer-attack possible. If I space the monsters out, I force the player to scroll the screen- a game mechanic I've come across and not enjoyed.

Does anybody have any layouts or guides for designing battle maps in turn-based RPGs, especially with a larger number of enemies taken into consideration? How should it look?

I am not asking for specific combat mechanics, just the layout for the moment.

sentences:
Any way to set drag events on a phaser 3 group? I'm trying to set a drag event on a phaser 3 group, but I wasn't able to achieve what I want. I was reading some phaser 2 blogs, and they said that it isn't possible to set a group a drag event.
Can somebody help me with this? It's really impossible to set a drag event to a group?

sentences:
Repeating a background texture forever in libgdx My "game" works with a pretty large playing field, so I need a repeating background. I've implemented this the following way:

Loading:

assetManager.get("texture_bg.png", Texture.class).setWrap(Repeat, Repeat);
bgRegion = new TextureRegion(assetManager.get("texture_bg.png", Texture.class));
bgRegion.setRegion(0, 0, 16384, 16384);

Drawing:

batch.draw(bgRegion, 0, 0);

This does as expected: Creates a background of 16384 by 16384 pixels from a 512x512px texture. But now that I'm getting further in the testing, I foresee running out of space quickly almost no matter what I set the region to.

Is there a way I can have it simply repeat forever and not specifying a finite number?

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:
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:
Libgdx switching between screens without losing Information I've been having issues with Screens, as I want to switch between the main game screen, the battle screen and the ingame menu screen (JRPG). The problem is that I have initialised all the information (Position of Player and NPC's, Map data, Sava data, etc) in the Show() function of the screen. That means that when I switch between 2, it will rebuild and reload everything all over again. There is also no Create() function in Screen so I'm at a dead end right now. Is there a way I can reserve data or draw the other screen on top of the main game screen, pausing that one?

I really need help with this.

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:
One SKSpriteNode with multiple PhysicsBodies? I am making a game similar to Lunar Lander, when you land with your ship on different objects, etc... The issue I am having is that I have a Player SKSpriteNode (my Ship) with a slightly complex collision system (bottom of the ship has different CategoryBitMask from other sides, etc.) and when I apply PhysicsBody(bodies: [physicsBodiesArray]) I cannot control CategoryBitMask for each element of the [physicsBodiesArray]... Because main PhysicsBody is applied to the Player it overrides all other Categories and such.

Here is my "createPlayer" function:

//Creating the player

    player = SKSpriteNode(imageNamed: "Bottle_02")
    player.size = CGSize(width: 130, height: 200)
    player.position = CGPoint(x: 0, y: 0 + player.frame.height / 2)

//Creating 2 collision objects and placing them

    var playerColTop = SKSpriteNode()
    var playerColBottom = SKSpriteNode()

    playerColTop = SKSpriteNode(imageNamed: "test_top")
    playerColBottom = SKSpriteNode(imageNamed: "test_bottom")

    playerColTop.position = CGPoint(x: 0.5, y: 0)
    playerColBottom.position = CGPoint(x: 0.5, y: 0 - playerColTop.frame.height / 2 - playerColBottom.frame.height / 2)

//Creating PhysicsBodies for the Array and assigning CategoryBitMasks

    let playerColTopPhys = SKPhysicsBody(texture: playerColTop.texture!, size: playerColTop.size)
    let playerColBottomPhys = SKPhysicsBody(texture: playerColBottom.texture!, size: playerColBottom.size)

    playerColTopPhys.categoryBitMask = PhysicsParams.Player
    playerColTopPhys.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    playerColTopPhys.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls

    playerColBottomPhys.categoryBitMask = PhysicsParams.PlayerScore
    playerColBottomPhys.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    playerColBottomPhys.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls

//Adding my PhysicsBodies and setting up the Player

    player.physicsBody = SKPhysicsBody.init(bodies: [playerColTopPhys, playerColBottomPhys])
    player.physicsBody?.categoryBitMask = PhysicsParams.Player
    player.physicsBody?.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    player.physicsBody?.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    player.physicsBody?.restitution = 0
    player.physicsBody?.friction = 1
    player.physicsBody?.mass = 5
    player.physicsBody?.affectedByGravity = false
    player.physicsBody?.isDynamic = false

    self.addChild(player)

Thanks in advance!

sentences:
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:
Coordinates issue vertical scroll Libgdx I'm going crazy with this problem. I'll explain:

I have a camera that falls down (flowing along the y-axis) which displays a TiledMap and declare the whole in this way:

In the create method:

map=new TmxMapLoader().load("Map.tmx");
this.renderer=new OrthogonalTiledMapRenderer(map);
this.camera=new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
this.camera.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
this.camera.update();

In the render method:

this.renderer.setView(camera);
this.renderer.render();
camera.position.y+=1;
camera.update();

Then I have also a sprite drawing by SpriteBatch in the render method:

batchM.begin();
sprite.draw(batchM);
batchM.end();

In the tiledmap there are MapObject and I have to check if this objects hit to sprite and I do this so in the render method:

MapObjects collisionObjects =  map.getLayers().get("objects").getObjects();
        for(MapObject object : collisionObjects) {

               if (object instanceof RectangleMapObject) {
                   RectangleMapObject rect = ((RectangleMapObject) object);
                   Vector3 coo=camera.project(new Vector3(rect.getRectangle().x,rect.getRectangle().y,0));
                    com.badlogic.gdx.math.Rectangle Sprite= sprite.getBoundingRectangle();
                    com.badlogic.gdx.math.Rectangle Map=new com.badlogic.gdx.math.Rectangle(coo.x,coo.y,32,32);
                    //TEST
                   System.out.println("PLAYER X: "+Sprite.x+" Y: "+Sprite.y);
                   System.out.println("Object X: "+Map.x+" Y: "+Map.y);
                   if(Intersector.intersectRectangles(Sprite, Map, Sprite)) System.out.println("HIT");
          } }

My problem is that when I do not change the window size(remain the size the starting), collisions are detected fine, but when I change the window size (for example, I enlarge) collisions are not detected and I can not explain why.

Could you help me to fix this bug.
Thank you for your time

sentences:
How to properly transform vertices for a model loaded using Assimp? When I try to load a DAE model then vertices are not placed correctly. Here's the code snippet I use to load 3D models using Assimp  :

aiNode* CGameObject::findNode(aiNode* rootNode, const char *name) {
    if (!strcmp(name, rootNode->mName.data)) {
        return rootNode;
    }
    for (int i = 0; i < rootNode->mNumChildren; i++) {
        aiNode *found = findNode(rootNode->mChildren[i], name);
        if (found) {
            return found;
        }

    }
    return NULL;

}

void CGameObject::transformNode(aiMatrix4x4 *result, aiNode* rootNode) {
    if (rootNode->mParent) {
        transformNode(result, rootNode->mParent);
        aiMultiplyMatrix4(result, &rootNode->mTransformation);
    } else {
        *result = rootNode->mTransformation;
    }
}

Assimp::Importer importer;
    const aiScene* scene = importer.ReadFileFromMemory(buffer,
        size,
        aiProcess_CalcTangentSpace      |
        aiProcess_Triangulate           |
        aiProcess_JoinIdenticalVertices |
        aiProcess_GenUVCoords   |
        aiProcess_TransformUVCoords |
        aiProcess_FlipUVs |
        aiProcess_SortByPType);

    if (!scene) {
        return false;
    }

    const int iVertexTotalSize = sizeof(aiVector3D) * 2 + sizeof(aiVector2D);
    int iTotalVertices = 0;

    for(int i = 0; i < scene->mNumMeshes; i++) {
        _Mesh* m = new _Mesh;

        aiMesh* mesh = scene->mMeshes[i];

        aiNode* node = findNode(scene->mRootNode, mesh->mName.data);
        transformNode(&node->mTransformation, node);
        aiTransposeMatrix4(&node->mTransformation);

        int iMeshFaces = mesh->mNumFaces;
        for (int f = 0; f < iMeshFaces; f++) {

            const aiFace* face = &mesh->mFaces[f];

            for (int k = 0; k < 3; k++) {
                int vertexIndex = face->mIndices[k];
                iTotalVertices++;
                aiVector3D pos = mesh->mVertices[vertexIndex];

                aiTransformVecByMatrix4(&pos, &node->mTransformation);

                m->vertices.push_back(pos.x);
                m->vertices.push_back(pos.y);
                m->vertices.push_back(pos.z);
    ...

What am I doing wrong ? I will create a VBO for all the vertex positions later and render them.
When I load an OBJ model everything loads fine and there is no need for applying per-node transformations.

Also, I noticed that Assimp renames node names from "Cube.001" to "Cube_001", is this behavior normal/expected.
I'm using Assimp 3.1.1.

sentences:
How can I combine my scrolling effect with the vertex lit shader? I want my shader to work in both Forward and VertexLit rendering modes. I'd written a texture scrolling shader, but I also want to consider lighting which is produced by Vertex lit shader. I can't add my effect directly in the vertex lit shader, so I'd created 2 passes: the lighting one and the effect one. Here's my code now:

SubShader
{
    Tags
    {
        "RenderType" = "Opaque"
        "LightingMode" = "Vertex"
    }
    Pass
    {
        Name "Hardware lighting pass"
        Tags { "LightingMode" = "Vertex" }

        Zwrite On
        Cull Back

        Material
        {
            Diffuse [_Color]
        }

        Lighting On
    }

    // At the second pass we'we turned the multiplicative blending on to combine our texture
    // effect with the ightin that has been couputed at the previous pass.
    Pass
    {
        Name "Effect-applying pass"
        Tags { "LightingMode" = "Vertex" }

        // If you're change this, you must then change the light calculation algorithm
        Blend One DstColor
        Lighting Off
        Cull Back

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        // texture samplers
        uniform sampler2D _MainTex;
        uniform sampler2D _AlphaMask;
        uniform sampler2D _ManaTexture;
        uniform sampler2D _Noise;

        // float values
        uniform float _ManaFloatSpeed;
        uniform float _ShinessSpeed;

        struct VertexInput
        {
            float4 pos : POSITION0;
            float4 col : COLOR0;
            float4 uv : TEXCOORD0;
        };

        struct FragmentInput
        {
            float4 pos : POSITION0;
            float4 col : COLOR0;
            half2 uv : TEXCOORD0;
        };

        // In the vertex shader we're just applied MVP-transform to our object
        FragmentInput vert (VertexInput i)
        {
            FragmentInput o;
            o.pos = mul(UNITY_MATRIX_MVP, i.pos);
            o.uv = i.uv.xy;
            o.col = i.col;
            return o;
        }

        // 1) Sample our fancy texture to get the pixel color
        // 2) Get the color value of scrolled pixel of the noise texture
        // 3) Set the alpha channel of an output color value to prevent glow at the textured areas
        half4 frag(FragmentInput i) : COLOR0
        {
            float4 col = i.col * tex2D(_MainTex, i.uv);

            // Now reading from the separate mask, later it will be col.a by default (this instruction will desappear)
            col.a = tex2D(_AlphaMask, i.uv).r;

            // Epsilon to prevent dx9-11, and GLES tolerance pass (not 0.0f)
            if(col.a > .0001f)
            {
                // Sample two textures and get the value from the alpla layer
                float4 tl1 = tex2D(_ManaTexture, float2(i.uv.x, i.uv.y + (_Time.y * _ManaFloatSpeed)));
                float4 tl2 = tex2D(_ManaTexture, float2(i.uv.x, i.uv.y + (_Time.y * (_ManaFloatSpeed * 2))));
                float alphaValue = tex2D(_Noise, float2((i.uv.x + _Time.y * _ShinessSpeed), (i.uv.y + _Time.x))).r;

                return half4((tl1 * tl2).rgb, alphaValue);
            }
            else
            {
                return col;
            }
        }
        ENDCG
    }
}

The problem is... Yep, 2 passes, which is extremely undesirable. How can I calculate vertex-lit lighting and apply my effect in the single pass?

sentences:
What is an ArchVisCharacter? What is it used for? As the question states.

I can't really find any useful documentation surrounding this.

What is an ArchVisCharacter and what do you use them for?

sentences: Fitting Android game to different screen sizes I am making an Android game that is only in portrait screen orientation.  It works great when I run it on my phone, but when I run it on a tablet, even though the screen size is bigger, all of the bitmaps are the same size. Is there any way to make the bitmaps stay the same proportion even on different size screens?

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: Storing Entity Meta-Data The question is about how to handle data about entities, but not particularly useful to the entity itself. An example of such data may be the external script that controls the entity's behavior or the path to the animation file — such data is gathered when loading the entity and is no longer useful until you save the game; it certainly doesn't belong in the entity object. Any tips on how to handle metadata?

sentences:
Null Reference Exception while getting Components I'm trying to access my enemy and spawning values from two different classes into a class that is trying to change them both. Although when I do this I keep getting a Null Reference Exception error. The error is where spawnManager first gets called.

This is the code that is trying to get the two values. (And just to note I am trying to access these two values from my Welcome scene and these two values are in my Game scene but I do not know if this is affecting anything):

private EnemyAI enemy;
private SpawnManager spawnManager;

void Start() {
    spawnManager = GetComponent<SpawnManager>();
    enemy = GetComponent<EnemyAI>();
}

public void onEasy() {
    spawnManager.enemyShipWait = Random.Range(1f, 3f); <-- This line has the error
    spawnManager.randomPowerupWait = Random.Range(7f, 12f);
    enemy.speed = 2.75f;
}

These are the two pictures of my scenes:
Game Scene:

Welcome Scene:

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:
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:
How can I distribute a native executable for a Python program? Lately all of my work has been in Python (and Ruby), and I'm in love with those two languages. There are many libraries for game development on Python but the problem I see is that many of those frameworks don't cover the "distribution" aspect of game creation. I'd like to code my game on Python (and any other pure Python extra libraries I need) and be able to distribute an executable for the main PC platforms (Windows, Mac and Linux).

Any options out there or what are the best combinations for this? (maybe pyglet + cx_freeze)

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: Integration of LibRocket and Android I am using OpenGL ES 2.0 to create a 2D game for Android 2.2 and was planning on using LibRocket for the GUI.  Does anyone have any links or knowledge they would share on how to integrate LibRocket with the android platform?  I know that it is a c++ library that would need to go through the NDK, however I rather not change my OpenGL rendering code to the NDK unless I have to.

sentences:
C# XNA4 2D Collision Detection I am working on a 2D engine in Xna and am running in a bit of trouble with Collision implementation.
What I want to do is have an interface ICollidable that I can add to GameObjects that are collidable.
I am trying to get it to work by using this awnser: https://gamedev.stackexchange.com/a/40432/33751

My question is how do I add the objects that use ICollidable to the List in the CollisionManager dynamically?

By case would be that the manager 'sees' what objects use the ICollidable interface and automatically add it to the list.

Second question is, how can I get the properties and stuff from the objects that contain the interface to actually preform the collision detection in CollisionManager? would a simple cast suffice?

ICollidable:

interface ICollidable
{
    void onCollision(ICollidable other);
}

CollisionManager:

class CollisionManager : GameObject
{

    private List<ICollidable> collidables = new List<ICollidable>();

    public CollisionManager(Game game)
        : base(game)
    {
        game.Components.Add(this);
    }

    void addCollidable(ICollidable obj){
        // This function needs to be called when ICollidable is inherited dynamically
        collidables.Add(obj);
    }

    public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
    {
        base.Update(gameTime);

        for (int i = 0; i < collidables.Count; i++)
        {
            for (int a = i + 1; a < collidables.Count; i++)
            {
                if(collision(collidables[i], collidables[a])){
                    collidables[i].onCollision(collidables[a]);
                }
            }
        }

    }

    private bool collision(ICollidable obj)
    {
        // How can i get obj's properties etc for checking collision.

        return false;
    }
}

PS. Never worked with interfaces in c# before, if I am doing it completely wrong, please let me know

Thanks in advance.
Yme-Jan

sentences:
Change collision action I have a collision detection and its working fine, the problem is, that whenever my "bird" is hitting a "cloud", the cloud dissapers and i get some points. The same happens for the "sol" which it should, but not with the clouds.

How can this be changed ? ive tryed a lot, but can seem to figger it out.

Collision Code

- (void)update:(ccTime)dt {
    bird.position = ccpAdd(bird.position, skyVelocity);

    NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
    for (CCSprite *bird in _projectiles) {
        bird.anchorPoint = ccp(0, 0);
        CGRect absoluteBox = CGRectMake(bird.position.x, bird.position.y, [bird boundingBox].size.width, [bird boundingBox].size.height);

        NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
        for (CCSprite *cloudSprite in _targets) {
            cloudSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(cloudSprite.position.x, cloudSprite.position.y, [cloudSprite boundingBox].size.width, [cloudSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [cloudSprite boundingBox])) {
                [targetsToDelete addObject:cloudSprite];

            }
        }

        for (CCSprite *solSprite in _targets) {
            solSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(solSprite.position.x, solSprite.position.y, [solSprite boundingBox].size.width, [solSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [solSprite boundingBox])) {
                [targetsToDelete addObject:solSprite];
                score += 50/2;
                [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
            }
        }

        // NÅR SKYEN BLIVER RAMT AF FUGLEN
        for (CCSprite *cloudSprite in targetsToDelete) {
            //[_targets removeObject:cloudSprite];
            //[self removeChild:cloudSprite cleanup:YES];
        }

        // NÅR SOLEN BLIVER RAMT AF FUGLEN
        for (CCSprite *solSprite in targetsToDelete) {
            [_targets removeObject:solSprite];
            [self removeChild:solSprite cleanup:YES];

        }

        if (targetsToDelete.count > 0) {
            [projectilesToDelete addObject:bird];
        }
        [targetsToDelete release];
    }

    // NÅR FUGLEN BLIVER RAMT AF ALT ANDET
    for (CCSprite *bird in projectilesToDelete) {
        //[_projectiles removeObject:bird];
        //[self removeChild:bird cleanup:YES];
    }
    [projectilesToDelete release];

}

sentences:
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:
How to apply force towards direction using mouse drag and/or touch input direction and input speed? I've to object. I can move object 1 (my Player) using mouse (or Touch for smartphone version).

I want apply a force to object 2 when object 1 hit it. Force direction must be mouse vector direction or touch vector direction.

For Mouse input i'm using event OnMouseDown and OnMouseDrag to determine mouse original position.

But I think this is not the best approach. Behaviour is not what i am expecting

void OnMouseDown()
    {

        mouseDragStartPosition = Input.mousePosition;

        //translate the cubes position from the world to Screen Point
        screenSpace = Camera.main.WorldToScreenPoint(transform.position);

        //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
        offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));

    }

    void OnMouseDrag()
    {

        //keep track of the mouse position
        var curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z);

        //convert the screen mouse position to world point and adjust with offset
        var curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;

        transform.position = new Vector3(curPosition.x, ClampY, curPosition.z);
    }

    void OnCollisionEnter(Collision collision)
    {
        Debug.Log("OnCollisionEnter");
        if (collision.collider.tag == "Disc")
        {
            ApplyForce();
        }

    }

 void ApplyForce()
    {
        Vector3 direction = mouseDragStartPosition - Input.mousePosition;
        direction = new Vector3(direction.x, ClampY, direction.z); //ClampY used to not allow +-Y
        DiscRb.AddForce(direction * 1, ForceMode.Impulse);
    }

sentences: Publishing a game on Google Play with a fake name I'm almost publishing my game to Google Play, but I wonder if I can use an fake name, I mean, not using a fake name with a real names, just some words like Lazer Dude or anything else, because I don't want to show who am I, I wanna keep my anonymously. There's no problem to use an fake name?

sentences:
Render just the pixel under mouse cursor in DirectX I'm having difficulties rendering just a single pixel which is on the defined coords of viewport. I'm using D3DXMatrixPerspectiveOffCenter function, but the result is not what I expected.

Here is how I calculate the parameters for the function:

// pCamera is the actual camera used to render full screen picture

// what is the width and height of camera near plane in Camera Space
double dHeight = 2 * pCamera->m_dNear * (tan(pCamera->m_dFOVy/2.0));
double dWidth  = dHeight * pCamera->m_dRatioXY;

// what is the pixel size in Camera space
double dHeightReduced = (dHeight / pCamera->m_dViewportHeight) * CAMERA_1x1px_SIZE;
double dWidthReduced = (dWidth / pCamera->m_dViewportWidth) * CAMERA_1x1px_SIZE;

// mouse pixel position in Camera space
double dCamSpaceX = -0.5*dWidth  + double(uiMousePosX) / pCamera->m_dViewportWidth    * dWidth;
double dCamSpaceY = -0.5*dHeight + double(uiMousePosY) / pCamera->m_dViewportHeight   * dHeight;

// create matrix
D3DXMatrixPerspectiveOffCenterRH( &m_mProjection,
         (float)(dCamSpaceX),
         (float)(dCamSpaceX+dWidthReduced),
         (float)(dCamSpaceY),
         (float)(dCamSpaceY+dHeightReduced),
         (float)m_dNear,
         (float)m_dFar );

(I set CAMERA_1x1px_SIZE = 100 to see a part of the scene, but I see the scene distorted and it's definitely NOT just the cut-off of the original)

How do I need to calc the params to make it work?

Thanks.

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:
Can you recommend a game server for a facebook board game? I am seeking a game server that will scale well. All commercial and/or free software alternatives are welcome. Game will be a boardgame that is similar to poker. Some technical details are listed below.

There will be a table which consists of 4 people, to send them message I need a channel manager. A table will be ready to play for at least 5 minutes. There should be a reliable channel manager.
People will wait for some time(i.e.) and if they are not playing they will be kicked by server, so there will be a reliable timed task queue to execute some tasks.
It should be quick enough to response and show the changes to all 4 people on that table simultaneously.To achive this server should have a powerfull I/O library.
I think to use inmemory to have quick response times, but it comes with scalability problems.
And some variables should be thread safe so a variable should be thread safe between multiple nodes.
Flash(AS3) and Unity (.Net 2.0 C# mono) client API's should be available for socket connection.

PS: I am using Reddwarf server, it lacks of documentation and multiple node.

sentences:
most efficient Bounding Sphere vs Ray collision algorithms Is there a known 'most efficient' algorithm for Sphere vs Ray collision detection?

I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly noteworthy algorithm for this.

One must have condition for this algorithms is that I need to have the option of querying the result for the distance from the ray's origin to the point of collision. Although if there is another, faster algorithm which does not return distance, then in addition to posting one that does, also posting that algorithm would be very helpful indeed.

Please also state what the function's return argument is, and how you use it to return distance or a 'no-collision' case. For example, does it have an out parameter for the distance as well as a bool return value? or does it simply return a float with the distance, vs a value of -1 for no collision?

sentences:
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:
Wait for vSync without swapping buffers with SDL I am trying to optimize my SDL rendering loop for an immediate mode GUI application that doesn't need to be redrawn every frame. I have vSync turned on and would like to skip buffer clearing / drawing altogether if the GUI hasn't changed.

The problem is, swapping buffers without redrawing causes flickering because of double / triple buffering. On the other hand, also skipping the buffer swap causes the program to run full throttle because the waiting is effectively done in SDL_GL_SwapWindow.

Ideally I would need some kind of function that waits for vSync without swapping buffers, but I haven't seen one in the SDL documentation. I've tried the following solutions but none are satisfying:

Drawing VBOs every frame even if they haven't been updated. That will reduce load on the CPU but not on the GPU, so not ideal.
Keeping track of which backbuffers are up to date, and only redraw them if they are dirty. This worked in my testing but requires to make some assumptions (the number of backbuffers, and hoping the driver didn't replace them with fresh ones). So not reliable enough.
Manually waiting with a small delay. Probably the most reliable, but still not ideal.

sentences:
Where to find market research info on adventure games? Looks like adventure games are on the rise again. There were several great releases in 2012, including brilliant and highly acclaimed Walking Dead from TellTale.

Is there a market research that proves the new rise of adventure games? Bonus points for revenue estimates and such. I'm particularly interested in mobile games segment, but everything else is of interest as well.

sentences:
Game 30% done on HTML5. Maybe it was a bad idea. Should I change to Unity3d? I'm creating a 3d game on HTML5. It's 30% complete and the hard part is already coded. The server is on node.js.Now I'm realizing that maybe it was not a wise choice. This is because I realized:

Three.js still has many bugs. I don't see the same thing on every machine. Each browser, OS, can give different results. I'm afraid my clients will have a great stress installing my game properly.
I have tons of sprites and models on my game. I wonder if my clients will have to load all them again everytime they want to play?
I wonder if a Node.js server will be fast enough to handle it, and I'm afraid it won't be scalable.

What would you advise me? Should I continue and finish the game on HTML5 or is it better to remake it on something else, like Unity3d for the client and (what?) for the server?

sentences:
I need to improve my ring shop. help with array, loop & query PHP I have an array setup which consists of 25 rings, names, stats, prices. Right now in its current form, I have a form setup with 25 radio buttons with a value of 1-25 on them, and I'm using If statements in my function to buy a ring. It works but I feel it's very inefficient because I have this code running 25 times based on $_POST['ring'] which sends the value 1-25.
    if ($rings[1][7] > $_SESSION['cash']) {
        echo "You do not have enough cash for this ring!

        GO Back!

";
        return;
    }
    if ($_POST['ring'] == 1) {
        $ringcost = $_SESSION['cash'] - $rings[1][7];
        $stmt = $pdo->prepare('UPDATE cu_cash SET cash=:cash WHERE id=:id');
        $stmt->bindParam(":cash", $ringcost);
        $stmt->bindParam(":id", $_SESSION['id']);
        $stmt->execute();

        $stmt = $pdo->prepare('UPDATE cu_users SET ring_id=:ring_id WHERE id=:id');
        $stmt->bindParam(":ring_id", $_POST['ring']);
        $stmt->bindParam(":id", $_SESSION['id']);
        $stmt->execute();
        echo "You have Successfully Purchased " . $rings[1][0] . "

        GO Back!

";
    }

Now I am wondering if there's a loop I could use to take the value from $_POST['ring'] and pull the price assign it to a variable so I can do my cash - price then update the DB with ring id & update my cash? been thinking about this for a while & I am having a hard time wrapping my head around it. Loops have always confused me, but I know they are useful!

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:
Wrapping 3D noise functions like simplex and perlin in c# I'm experimenting with loop-able worlds that have a height-map for terrain data.
While I can easily create loop-able .BMP textures for this in Photoshop and just load the terrain from them, but that limits the size and variance of the worlds to whatever I pre-generate for the player.

I would like to proceduralize the process. I have got a simplex terrain and a perlin terrain generator and I'd like to wrap them so that the world loops back around to the same place if you travel in a straight line in any direction North East South West

What would be the best techniques to use to wrap the noise to a tillable terrain.

This question Different as it is for both perlin AND simplex.
It is also different as I forgot to mention I am using 3D noise for some of my work.

sentences:
understanding image rotation XNA C# I do not understand how the rotation of the image i have works. Is it something to do with the ThumbSticks on the Xbox Pad? or properties of a float? if someone could explain to me what is actually happening here i would be very greatful.

The image is of a Gun. I would like to add in shooting guided by the thumbsticks for enemies above the player, so understanding this is crucial.

The image and coding has its own class. So in Game1.cs only initialised, WMpos set to the character and update and draw methods referenced, so does not affect rotation.

This is all the relevant code for it here:

public Texture2D WMtxr;
public Vector2 WMorigin;
public float WMrotation;

public void UpdateMe(GameTime gameTime)
    {
        WMorigin = new Vector2(WMtxr.Width - 100, WMtxr.Height - 36);
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y < -0.1)
        {
            WMrotation += 0.03f;
        }
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y > 0.1)
        {
            WMrotation -= 0.03f;
        }
    }

public void DrawMe(SpriteBatch sb)
    {
        sb.Draw(WMtxr, WMpos, null, Color.White, WMrotation, WMorigin, 1f, SpriteEffects.None, 0);
    }

sentences:
Town generation algorithms In this RPG.SE post a long-lost page with several online generators is mentioned.
I'm particularly curious about the way towns were generated. Take this image for example:

Although a lot of things could be improved graphics-wise, it was very good considering the tools available at the time (mid to late 90s):

The road layout seems fairly organic (even considering all roads are placed in an orthogonal manner).
Not all roads are necessarily connected, but it feels right.
Buildings are placed in believable spots.
Even trees seem to be placed in logical spots.

I think it would be fun to give it a shot and try it myself. Especially since my previous attempts have been too "blocky":

You'll notice that I'm describing many of the qualities with not-quite-measurable adjectives (seems, feels, believable, etc) so I'm having a hard time translating them to instructions and ultimately to an algorithm.
Are there any tried-and-true algorithms for town generation?
I understand this seems to be too broad, so consider this: If I asked for an algorithm for generating maps of continental land masses, I'd get references to Perlin and other noise algorithms right away; closely followed by Voronoi.
I've seen questions like this one but they seem to have a more concrete idea already in mind (ie: 2x2 houses, fixed number of houses, canal and road placement restrictions).
What I'd like to have is something less constrained. Except maybe for the grid layout, which should be a lot easier for a first attempt than, say, L-system.

sentences:
Phaser: Shader Chain I want to implement lighting via shadowmaps. I see process as:
1) render something to RenderTexture1(size as game)
2) create RenderTexture2 (custom size)
3) add it to Image2 (custom size)
4) apply "generate lightmap" shader to that image, with RenderTexture1 as additional channel
5) create RenderTexture3(size as game)
6) add it to Image3(size as game)
7) Apply "generate light from lightmap" shader, with rendered lightmap as additional channel

I have a problem on last step, seems texture passing as additional channel is not rendered with shader. however it's ok in image.

code:

create() {
    ...
    this.sourceRT = this.game.make.renderTexture(this.game.width, this.game.height);

    this.shadowMapRT = this.game.make.renderTexture(this.SHADER_SIZE, this.SHADER_SIZE);
    this.shadowMapImage = this.game.add.image(0, 0, this.shadowMapRT);
    this.shadowMapImage.filters = [this.shadowTexureShader];

    this.lightingRT = this.game.make.renderTexture(this.game.width, this.game.height);
    this.lightingImage = this.game.add.sprite(200, 0, this.lightingRT);
    this.lightingImage.filters = [this.shadowCastShader];

    this.shadowTexureShader.uniforms.iChannel0.value = this.sourceRT;
    this.shadowCastShader.uniforms.iChannel0.value = this.shadowMapRT;
}

update() {
    this.light.x = this.game.input.activePointer.x;
    this.light.y = this.game.input.activePointer.y;

    this.sourceRT.renderRawXY(this.renderGroup, 0, 0, true); // this.renderGroup is a group with shadow-casters

    this.shadowTexureShader.uniforms.uLightPosition.value = [this.light.x, this.light.y];
    this.shadowCastShader.uniforms.uLightPosition.value = [this.light.x, this.light.y];
}

Additional re-explanation with picture:

I take texture0, apply shader to it (texture1 as an additional channel), to get shadowmap. Then i want to take texture1, apply shader2 to it, with texture2 (given by shader as additional channel) to get shadows from objects.

Problem at the question mark -- instead of getting texture2 (processed by shader1) i get texture0 (still unprocessed). I want to get rendered texture2 in my shader2.

sentences:
How do I make a Box2D object that makes objects passing through it slower? I wish to have a sort of "slow motion" or "slow down" effect on a players character when they walk in a mud area, usually the character velocity is 3f constant in any one direction. The problem is I tried to declare a rectangle to cover the object mud area but I  am only able to get a solid rectangle area and therefore the character cannot walk through or over this area, the desired action would be having the character movement slow down while walking in the mud area. The code below is what I have tried to make this sort of region, but this code only makes a solid object which the character cannot pass through.

 final Rectangle rect = new Rectangle( object.getX(), object.getY(), object.getWidth(), object.getHeight(), vbom );

 final FixtureDef fixDef = PhysicsFactory.createFixtureDef( 0.0f, 0.0f, 1.0f );
 Body body = PhysicsFactory.createBoxBody( physicsWorld, rect, BodyDef.BodyType.KinematicBody, fixDef );
 body.setUserData( typeOfObject );
 physicsWorld.registerPhysicsConnector( new PhysicsConnector( rect, body ) );

sentences: What are typical job interview questions related to game development? I've already looked at some examples from StackOverflow, but I'd like to know if any of you could show concrete examples of job interview questions... Are they different with a job related to game development?

sentences:
How to calculate normal from normal map in world space? (OpenGL) I'm trying to do normal mapping in a deferred renderer and I'm stuck on how to implement normal maps. I have a bool that passes whether or not to use a normal mapped value and thus, whether to calculate the TBN matrix. My vertex code for the geometry pass looks as follows:

#version 410 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTangent; // Optional Texture coordinates
layout (location = 4) in vec3 aBitangent; // Optional Texture coordinates

out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool hasNormalMap;

void main()
{
    vec4 worldPos = model * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    TexCoords = aTexCoords;
    Normal = transpose(inverse(mat3(model))) * aNormal;

    if(hasNormalMap)
    {
        vec3 T = normalize(vec3(model * vec4(aTangent, 0.0)));
        vec3 N = normalize(vec3(model * vec4(aNormal, 0.0)));
        // re-orthogonalize T with respect to N
        T = normalize(T - dot(T, N) * N);
        // then retrieve perpendicular vector B with the cross product of T and N
        vec3 B = cross(N, T);
        mat3 TBN = mat3(T, B, N);
    }

    gl_Position = projection * view * worldPos;
}

Here is where I am confused:

In my calculation, I multiplied T and N by the model matrix which should have moved it into world space. Now transposing (T,B,N) should move me back into model space (I think, I'm not sure). In the fragment shader how do I use the TBN to calculate the normal in world space?

If there are better approaches, they are welcome. Thank you.

Update:
I removed the transposing of the TBN as there's no reason to transform into tangent space if we want to pass it in world space. Now that we have the TBN matrix in the fragment shader, how do we apply it so that the normal is the correct value for lighting? Currently I've done:

#version 410 core

layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;

in vec2 TexCoords;
in vec3 FragPos;
in vec3 Normal;
in mat3 TBN;

struct Material {
    sampler2D diffuseMap;
    sampler2D specularMap;
    sampler2D normalMap;
    float shininess;
};

uniform Material material;
uniform bool hasNormalMap;

void main()
{
    // store the fragment position vector in the first gbuffer texture
    gPosition = FragPos;

    // also store the per-fragment normals into the gbuffer
    gNormal = normalize(Normal);

    if(hasNormalMap)
    {
        gNormal = texture(material.normalMap, TexCoords).rgb * TBN;
        gNormal = normalize(gNormal);
    }

    // and the diffuse per-fragment color
    gAlbedoSpec.rgb = texture(material.diffuseMap, TexCoords).rgb;

    // store specular intensity in gAlbedoSpec's alpha component
    gAlbedoSpec.a = texture(material.specularMap, TexCoords).r;
}

but that doesn't feel right. I imagine that I would transform the sampled value from the normal map by the TBN matrix to get it in world space. Am I missing something?

sentences:
Determine "bounding box size" (not scale) of model in MonoGame I'm working on integrating some the 3D models I import into my physics system by trying to take their "size" and use that as the side for objects within my physics system. When I say size, I'm referring essentially to a bounding box size around my model. Here's an example of a test level layout I'm designing:

All of the cubes below are 1x1 units in Blender (measuring from the center), so I've been able to just code in those assumptions. However, it starts to get more interesting when you consider the slope and smaller platform I have.

For the slopes, I've found an easy hack for the time being (as long as their size remains 1x1). However, the platforms are throwing me off. A few things to call out with the platform model:

The model itself is centered at (0,0,0) and no scaling was done on the model itself in Object Mode
I scaled down the Z of the model in Edit Mode, while the model itself remains at (1,1,1) scaling

I'm now trying to figure out how to get some form of size for the model. For what I'm looking for, if we assume the cubes I have are bounds box size of (1,1,1), then this platform would be a bounding box size of (1, 1, .25). I would assume that I would need to look at the model's meshes to determine this, but I'm not entirely sure

Any help on this would be appreciated. Thanks!

sentences:
How do I manually submit a new UI InputField in code? I need some conditions for submitting the text inside of an Inputfield, however I cannot find a way to do this via code. I was expecting something simple like with WPF or WinForms, but I cannot find any method I can use to actually submit an Inputfield via code.

How can I submit an Inputfield through code so that I can add some sort of conditions to when it can be submitted by the user other than just the enter button.

Thanks!

Edit, some clarification:

Submitting an input field is submitting it's text, firing an event which can be listened to by the OnSubmit method which then fires an onEndEdit event (I think event) which you can add listeners to so that specific methods of your own get called when it fires.

Right now I am unable to identify a reasonable way to change the keys or combination of keys that control when the form is submitted (Default ie "Enter" or "Return" in the Input Manager) (Can't use Shift-Enter for a new line since enter submits the form). Instead I want to manually submit the form through code when the appropriate keys are pressed.

public class ChatInputField : MonoBehaviour
{
    public InputField textInput;

    public void Start()
    {
        textInput.onValueChange.AddListener(delegate { CheckForSubmit(); });
    }

    //Checks for an enter to submit
    public void CheckForSubmit()
    {
        //No idea how to get the actual value changed from this event so I have to check for keys being held down. Terribly awkward
        if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
        {
            if(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
               //Add a new line
            }
            else
            {
                if(textInput.text != "")
                {
                    //Submit form if not empty
                }
            }
        }
    }

Edit2: I just realized that I can manually edit the attributes I want. I can send it's text to the appropriate class, clear the input field, and de-select it if I wanted. No need to fire the event other than for ease-of-use within the inspector. Sorry for wasting you guy's time :)

I'll leave this question open in case someone does figure out how to fire these events manually though.

sentences:
Which 3D Engine for iPad development? I have built a couple of games on the iPad using core animation, but for my next project I would like to built a 3D game. I am not really comfortable with programming OpenGL directly and would also like the toolset that usually comes with a mature 3D engine project. I have used Ogre3D on the PC before and was very happy with that, but I wasn't sure if it had been ported to the iPad specifically and if there were better alternatives available.

What engines have used and can recommend? Specifically I am interested in:

Cost
Tool support
Data import functionality

sentences:
libgdx building 3D terrain I've been spending a lot of my time working with libgdx scene 2d & have become very familiar with it. I've decided I want to move over to 3D & take a couple of weeks to learn & better understand the 3D side.

I've gotten a clear understanding of loading 3D objects, camera, & more. Where I'm stuck is deciding which method for loading a terrain is best &/or a decently clear tutorial/snippet on loading a 3D terrain tiled terrain without the use of a height-map & I can learn on my own from there.

A specific terrain in mind is a grid terrain. Similar to the first image w/ multi-texturing (smooth textures - paint effect) similar to the second image.

Places/repositories I have taken into account & have thoroughly taken a look into.

Fabula-Engine (Decent but hastle to understand & get working), gdx-proto (decent but the terrain is created using a meshbuilder & required a full texture (similar to first image), xoppa (didn't cover 3D terrain)

Things I would like to take into account are low polygon count & no usage of a height-map.

Question's Summary:
Is there any tutorials/snippets to help better understand generating tiled/grid maps?
Is the method provided suitable for multi-texture painting similar to the second image?

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:
How can I avoid coupling between units and their environment? Currently in the process of making a game like Dwarf Fortress, so without graphics. I'm mostly thinking about how I want to implement everything. While writing code I keep stumbling on general game implementation problems that are really annoying me. Assume this:
We have a Map class which stores Chunk classes which stores Tile classes which stores Players and Enemys currently on this tile.
class Map {
    public:
        std::vector<std::vector<Chunk>> chunks;
};

class Chunk {
    public:
        std::vector<std::vector<Tile>> tiles;
        std::vector<Player*> player_need_update;
        std::vector<Enemy*> needs_update;
};

class Tile {
    public:
        std::vector<Player*> players;
        std::vector<Enemy*> enemies;
};

Now let's say I want to move() a player to a different Tile. For this I created a needs_update vector storing entities that need to be updated on the game Map. Every game tick we loop all chunks and loop all entities needing an update.
I think (thought) this is a logical way of doing this because we can have a tile that is independent of a chunk that is independent of a map. Same for entities. So let's say we want to move an Entity:
void Entity::move(uint16_t move_x, uint16_t move_y) {
    x += move_x;
    y += move_y;

    changed() // Notify chunk that something changed about us
}

This is already where it is going wrong. To be able to notify the chunk we have moved, we need to know ourselves in which chunk we are Chunk *in_chunk; in class Entity. And this breaks the structure I wanted to achieve (independence across classes).
Another example, suppose we want to attack an Entity on a different Tile. We would need to know there is an entity in the first place, but we would also need to know things about the enemy to then decide whether to attack it or not.
Player::attack(Enemy &enemy /* ?? */) {
    // Attack
}

I think it is wrong to move a player by calling a function in Map:
void Map::movePlayer(Player &player) {
    // Do stuff to move player
}

So, how do you implement basic game structures like this, keeping things logically structured but while still being able to ie. move a player across the map?

sentences:
Opengl texture rendered as solid color,why? her is my vertex array and texture coordinate..

float POS[]=
{
    -0.5,-0.5,-1.0,
    0.5,-0.5,-1.0,
    0.5,0.5,-1.0,
    -0.5,0.5,-1.0
};

float texCoords[] = {
0.0,0.0,
1.0,0.0,
1.0,1.0,
0.0,1.0
};

here is my texture creation

stbi_set_flip_vertically_on_load(1);
    openglTexBuff=stbi_load("lena.jpg",&w,&h,&c,0);

    glGenTextures(1,&TexID);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,TexID);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,w,h,GL_FALSE,GL_RGB,GL_UNSIGNED_BYTE,openglTexBuff);
    glGenerateMipmap(GL_TEXTURE_2D);
    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);

    glBindTexture(GL_TEXTURE_2D,0);
    stbi_image_free(openglTexBuff);'

and these are my shaders

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
layout(location = 1) in vec2 texCoords;
uniform mat4 translation_matrix; //inactive shader variables..
uniform mat4 rotation_matrix;

mat4 model_matrix; //
mat4 projection_matrix;
out vec4 pos;
out vec2 frag_TexCoord;

void main()
{

rotation_matrix;

gl_Position=rotation_matrix*translation_matrix*positions; //translation matrix operated with POS vector..
pos=positions;
frag_TexCoord=texCoords;
translation_matrix;

}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;
in vec4 pos;
in vec2 frag_TexCoord;rag_TexCoord;
uniform float col;
uniform sampler2D  a_texture;
void main()
{
col;
a_texture;

color=texture(a_texture,frag_TexCoord);

}

when i use (solid)color instead of texture in shader..everything works fine but when i use shader it gives solid color instead of texture..It seems like my whole tex is super-zoomed to output single color

here is draw call

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    box.shader.setUniformat4x4("translation_matrix",translation);
    //box.shader.setUniformat4x4("rotation_matrix",rotation_arr);
    box.shader.setUniform1f("col",1.0);
    glBindTexture(GL_TEXTURE_2D,TexID);
    box.shader.setUniform1i("a_texture",0);
    box.render();

box.render

void render()
    {
        vertices.bind();
        indices.bind();
        shader.bind();
        glDrawElements(render_As,vertices.getSize(),GL_UNSIGNED_INT,NULL);
        vertices.unbind();
        indices.unbind();

    }

sentences:
Why am I getting white lines in my tiled map when my character moves? I followed the tutorial here -

http://mainroach.blogspot.com/2013/02/fast-html5-canvas-rendering-tiled-maps.html

I can't really figure out why it's happening. At certain times the map looks fine and then when I move my character the map starts to look like this -

sentences:
Thread per connection or thread-pool in a MMO server? So I'm writing this MMO server, and I'm really struggling in this topic. I'm writing a fast paced MMO, and the server max players would be 800.

I have read that one thread per connection is not a good idea, and also that thread-pooling is not ideal in some cases.

I think 800 threads listing for client message is bit to much. In my case, which approach is better?

sentences:
How to flip card by a corner? After searching "flip card" in google and our stackexchange site, there is no result and I have no ideas about how to flip a card by a corner.
I am developing a ios card game with cocos2d, in this game, i just want to touch the right-bottom corner of back face, and hold on moving towards left-up direction. With moving a little distance, the card can flip to front face.
Any ideas?

sentences:
SDL.NET no longer detecting modifier keys I'm using SDL.NET with C#.
Recently, a bug has appeared where the library does not detect if the shift key is held down; although it used to do so.

private static void KeyboardEventHandler(object sender, KeyboardEventArgs args)
    {
            case (Key.Comma):

                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveU; Console.WriteLine("Going up..."); }
                else { actionBuffer = GameAction.Pickup; }
                break;

            case (Key.Period):
                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveD; Console.WriteLine("Going down..."); }
                else { actionBuffer = GameAction.Wait; }
                break;

            default:
                actionBuffer = GameAction.Null;
                break;
        }
    }

However, recently, the checks to see if a shift key is held have returned incorrectly false, despite previously previously evaluating to true.

This means the function never returns the "MoveU" or "MoveD" values, just the "Pickup" and "Wait" values.
Why is this?
Thanks in advance.

sentences:
Flash Professional vs FlashBuilder 4.6 for mobile app development From the marketing materials I see online, it seems to me that FlashBuilder 4.6 is a subset of the functionality available in Flash Professional.  If I understand correctly, mobile app development target iOS and Android started as a plugin for Flash Pro and has since been made a separate product.

But can Flash Pro still do all the multi-platform targeting that FlashBuilder 4.6 can do?  What other considerations are there between the two applications that are critical to understand for mobile app development?

Thanks!

sentences:
Rotation deforming mesh (Opengl ES 2.0) I'm trying to render a rotating cube on Opengl ES 2.0, using some math classes I wrote (based on a lot of online and offline info) for quaternions, matrixes and the like. As far as I know all the math classes are right, but I'm still having some issues rotating objects.

The scene is a simple cube, with no translation or scale, I've tried both without projection setup and with projection, and in any case it acts strangely. Without the projection, it looks like the mesh deforms until at some point it breaks, but it's hard to tell what's really going on. With perspective projection, this is a video of what it does rotating about the y-axis.

The rotation is simply an angle being incremented by 0.05f each frame (never decremented), but the effect isn't what I think it should be at all.

Does someone know where should I start looking for mistakes? Thanks.

Note: I haven't posted any code because I don't know where the problem might be (and posting the whole thing is way too much), if anyone has any clues, I will post any code that might be useful.

sentences:
In Java swing, while handling a 2D top down game, how should I handle scaling for quality transformations (mainly screen rotation) For my top down game, I plan to have screen rotation where entities don't rotate, but everything else does. I am using a raster array to store my image so I don't have to render things stacked on each other. I have my game scaled by three, however so pixels are 3 times as large and take up 9 times more space meaning that when I do a matrix rotation for everything except the player and entities, the pixels are very badly rotated as it is rotating then scaling afterwards.

Essentially, I copy whatever pixels I need to to the main image (both arrays of pixels), then after that it is scaled by three and drawn to the actual screen (with the Java Graphics). Mainly, I would like to do quality rotations and scaling means that I cannot do that.

Also off a little bit from the question, how would you recommend I handle the rotation so that the entities stay upright and everything except the map moves while keeping collision and logic working fine. Similar to how the game Realm of the Mad God works.

I am willing to change my rendering logic a bit, however I want to keep it as efficient as possible. I can also change my game into 3D in order to have higher quality walls and such.

Overall, I am asking:
How should I handle scaling so that I can use high quality transformations and how would I efficiently and effectively implement screen rotation.

All help is appreciated, thanks.

sentences: Should I rotate the Camera using the View or World? I have an issue with roll/rotation. I have a Camera defined to move along X and Y axis at a given Z for zoom. The camera is always pointed straight down the Z axis so there is not any yaw or pitch. I do however need to roll or rotate. The problem I have is that when I roll/rotate left or right I am modifying up in the view. So, when the mouse or keyboard are moved up toward the top, the target actually moves toward the new up. If I rotate 90 right degrees when I move mouse up or arrow up it moves right. I fully understand why it is behaving this way. I need to find a way to make it not behave that way. I need to roll/rotate independent of x, y. My first thought is to use the view when moving camera along x and y. Then rotate the target (1-9 quads) in the world space. Any thoughts on this? Any Examples would help and would be greatly appreciated.

sentences:
UniRX, how much of it should I use? for good optimization I come from the Front End dev world and I'm taking my baby steps in Unity.

I'm already very familiar with RXJS and glad to see it being re-coded into almost every other big language (there's starting to be quite a few) :

Java: RxJava
JavaScript: RxJS
C#: Rx.NET
C#(Unity): UniRx
Scala: RxScala
Clojure: RxClojure
C++: RxCpp
Lua: RxLua
Ruby: Rx.rb
Python: RxPY
Go: RxGo
Groovy: RxGroovy
JRuby: RxJRuby
Kotlin: RxKotlin
Swift: RxSwift
PHP: RxPHP
Elixir: reaxive
Dart: RxDart

And as I discovered and as you can see, it is available in Unity-flavor.

here's a quick intro :
https://youtu.be/kFoBvjwzbNA

But not every framework or environment or every variable and event is necessarily improved by RX, or is it?

Since I don't quite understand how Unity operates internally (nor do I plan to do that fully, I have a game to make), I'd like to know is it a performance gain or a performance loss, to use UniRX to (for example) store every input my game might need into observables,

and then susbcribe to those observable versions of user Inputs wherever applicable in my C# scripts?,

or does the repeated use of the Update() method to listen to inputs in multiple scripts get interpreted somehow by Unity at compile to automatically optimize the built code and adding my extra RX step would just be a net loss?

What about game state, and, say I'm coding an RTS, unit states?

What about RayCast Hits, should I make those observable?

What UniRX usages are poor practice, and which result in performance gain/optimized code? (especially with my given examples in mind)

The obvious use-case is game UI, obviously, but disregarding that, what could I extend UniRx usages to?

[PS: Since UniRX is a relatively new topic here could someone with 3000+ points create the unirx tag and add it to my question please?]

sentences: Do I have to ask for permission to use real company logos for advertising props in the world in my sports game? I'm making a simple turn-based Android ball flicking soccer game and I was thinking of creating a theme in a sports game, like soccer for example, usually had advertisement banner on walls and a bit realistic but cartoony. It is usually encountered in most sports-based game in any gaming platform. I have a question regarding this topic. Is it required to ask a permission to used some recognized ad banner designed walls (e.g. Adidas, Samsung, McDonalds, etc.) to be used as props for the game field like this one for example?

sentences:
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:
What is the difference between a game framework and a game engine? What is the difference between a game framework (for example, XNA with C#, SDL for c++) and a game engine?

Do game frameworks use engines? Does a game engine encapsulate sub-engines like physics engines, particle engines etc? Should they be used together, or are they mutually exclusively?

I take it there are separate engines for both 2D and 3D?

sentences:
UV texture mapping with perspective correct interpolation I am working on a software rasterizer for educational purposes and I am having issues with the texturing.

The problem is, only one face of the cube gets correctly textured. The rest are stretched edges:

You can see the running program online here.

I have used cartesian coordinates, and all I do is interpolate the uv values along the scanlines.
The general formula I use for interpolating the uv coordinates is pretty much the one I use for the z-buffering interpolation and looks like this (in this case for horizontal scanlines):

    u_Slope = (right.u - left.u) / (triangleRight_x - triangleLeft_x);
    v_Slope = (right.v - left.v) / (triangleRight_x - triangleLeft_x);
    //[...]
    new_u = left.u + ((currentX_onScanLine - triangleLeft_x) * u_Slope);
    new_v = left.v + ((currentX_onScanLine - triangleLeft_x) * v_Slope);

Then, when I add each point to the pixel buffer, I restore z and uv:

                z =  (1/z);
                uv.u = Math.round(uv.u * z *100);//*100 because my texture is 100x100px
                uv.v = Math.round(uv.v * z *100);

Then I turn the u v indexes into one index in order to fetch the correct pixel from the image data (which is a 1 dimensional px array):

        var index = texture.width * uv.u + uv.v;
        //and the rest is unimportant imagedata[index].RGBA bla bla

The interpolation formula is correct considering the consistency of the texture (including the straight stripes).

I must get some sleep now, but before I get into further dissecting of every single value to see what goes wrong, Can someone more experienced guess why might this be happening, just by looking at the cube?

"I have no idea what I'm doing" (it's my first time implementing a rasterizer). Did I miss an important stage?

Thanks for any insight.

PS: My UV values are as follows:

    { u:0,   v:0 },
    { u:0,   v:0.5 },
    { u:0.5, v:0.5 },
    { u:0.5, v:0 },
    { u:0,   v:0 },
    { u:0,   v:0.5 },
    { u:0.5, v:0.5 },
    { u:0.5, v:0 }

[EDIT]

The uv values were to blame, and pixel 50 being in the second zone, as Victor pointed out.

My new uv values:

                    {u:0, v:0},
                    {u:0, v:1},
                    {u:1, v:1},
                    {u:1, v:0},
                    {u:1, v:0},
                    {u:1, v:1},
                    {u:0, v:1},
                    {u:0, v:0}

To some extent this was "a bug in my code", but also I had overlooked an important part of the process: the uv values should not just be assigned to the 8 corners of the cube.

sentences:
Which code is faster to convert -1 to 0 and 1 to 1? I'm writing a shader for rendering the sides of triangles with different colors. I have a value mediump float back = dot(V, N) which is positive if the normal faces away from the camera and negative if towards the camera.

To correctly select which diffuse color to shade a particular fragment, I need something like this:

lowp vec4 color = max(0.0, sign(-back)) * frontdiffuse + max(0.0, sign(back)) * back diffuse;

It's more or less an "unrolled conditional"...

Which code produces faster instructions?

x * 0.5 + 0.5, or
max(0.0, x) ?

The former may be better mathematically behaved than the latter, but maybe min/max/clamping is super efficient in hardware

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:
Unity-How can I enlarge the sprite to avoid the movement of the character when the pivot change? Changing the pivot to custom on all of the sprites is not a viable option for me
Video showing the problem:
https://youtu.be/YpAdamkbhFA

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: Pixel perfect collision detection between sprite and animated sprite I am trying to make a collision between a sprite and an animated sprite. The animated sprite is the main character of the game. The problem I am facing is that when another sprite collides with the main character, it collides with the transparent bounding area around the character. How should I perform collision detection between the actual pixels of the character and any other obstacle sprite?

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:
Error loading "SpriteFont1". File not found I have an issue while trying to load a font file with the extension ".xnb" and I am receiving following error:

Error loading "SpriteFont1". File not found.

For following code:

public static Dictionary<string, T> LoadListContent<T>(this ContentManager contentManager, string contentFolder)
        {
            DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory + "/" + contentFolder);
            if (!dir.Exists)
                throw new DirectoryNotFoundException();
            Dictionary<String, T> result = new Dictionary<String, T>();

            FileInfo[] files = dir.GetFiles("*.*");
            foreach (FileInfo file in files)
            {
                string key = Path.GetFileNameWithoutExtension(file.Name);

                result[key] = contentManager.Load<T>(key);
            }
            return result;
        }

The file is actually there and I am getting here FileInfo[] files = dir.GetFiles("*.*"); one file which is present in the folder.

I am using the function like this:

fontList = ContentLoader.LoadListContent<SpriteFont>(Content, "Fonts");

Is there something which I have overlooked?

sentences:
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:
GLFW3 multiple windows I'm trying to use GLFW3 to develop VJing application. So basic idea is use two windows:

1st window for fullscreen projection on secondary monitor (basically projector)

2nd window for (hopefully) fullscreen GUI.

It does not have to share context, as GUI window will be just using libRocket for controlling content, recieving MIDI & OSC commands, etc.

Problem is that so far, when I switch projection window on second monitor to fullscreen, it runs, but as soon as I move mouse to primary monitor and click somewhere, projection window gets minimized. Also, GUI window gets a poor framerate.

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <GLFW/glfw3.h>

using namespace std;

void errorCallback(int error, const char *description){
fputs(description, stderr);
}

static void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods){
if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE)
{
    glfwSetWindowShouldClose(window, GL_TRUE);
}
}

int main(){

glfwSetErrorCallback(errorCallback);
if (!glfwInit())
{
    exit(EXIT_FAILURE);
}

int MonitorCount;
GLFWmonitor ** monitors = glfwGetMonitors(&MonitorCount);

//GLFWvidmode* modes = glfwGetVideoModes(monitors, &MonitorCount);

GLFWwindow *window;
window = glfwCreateWindow(1024, 768,"Projection", monitors[0], NULL);
GLFWwindow *controls;
controls = glfwCreateWindow(1024, 768, "Controls", glfwGetPrimaryMonitor(), NULL);

glfwSetKeyCallback(window, keyCallback);
while(!glfwWindowShouldClose(window)){

     //// PROJECTION WINDOW
    glfwMakeContextCurrent(window);

    float ratio;
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    ratio = width / (float) height;
    glViewport(0,0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);

      glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
    glBegin(GL_TRIANGLES);
    glColor3f(1.f, 0.f, 0.f);
    glVertex3f(-0.6f, -0.4f, 0.f);
    glColor3f(0.f, 1.f, 0.f);
    glVertex3f(0.6f, -0.4f, 0.f);
    glColor3f(0.f, 0.f, 1.f);
    glVertex3f(0.f, 0.6f, 0.f);
    glEnd();

    //// ---- CONTROL WINDOW ----
    glfwMakeContextCurrent(controls);
    glfwGetFramebufferSize(controls, &width, &height);
    ratio = width / (float) height;
    glViewport(0,0, width, height);
    glClear(GL_COLOR_BUFFER_BIT);

          glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef((float) glfwGetTime() * 100.f, 0.f, 0.f, 1.f);
    glBegin(GL_TRIANGLES);
    glColor3f(0.f, 0.f, 0.f);
    glVertex3f(-0.6f, -0.4f, 0.f);
    glColor3f(0.f, 1.f, 0.f);
    glVertex3f(0.6f, -0.4f, 0.f);
    glColor3f(0.f, 0.f, 1.f);
    glVertex3f(0.f, 0.6f, 0.f);
    glEnd();

    glfwSwapBuffers(controls);
    glfwSwapBuffers(window);

    glfwPollEvents();
}

glfwDestroyWindow(controls);
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);

}

I'm on Win7 / VS2012 using nVidia 680m

sentences:
Better quality texture when zooming Is there any way to have better quality textures ?

I thought that creating huge textures will improve their quality in game, that's why I draw textures with 0.25f or 0.5f scale.

I understand that computer can't display 4 pixels in 1 screen pixel, but how people do to have beautiful sprites while zooming ? even on smartphones...

Hope you can help me.

sentences:
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:
Jittery Rotational Movement with Arcball implementation I have an assignment where I need to implement arcball using Opengl (~2.0). I have it more or less implemented but I have a some problems/issues/bugs and I'm not sure whats either causing them or how to solve.

Arcball rotation: Specically minor variance in mouse movement away from the axis I'm rotating on seems to "confuse" my program, causing artifacts (such as rotating briefly a completely different direction before resuming its current path).

Code:

void mouse_motion(int mx, int my)
{

    float angleRadians;
    //handles mouse motion events
    if ( arcball_on && (mx != last_mx || my != last_my) ) {
        // if left button is pressed
        lArcAngle = arcAngle;
        cout << " Last Angle: " << lArcAngle << endl;
        cur_mx = mx;
        cur_my = my;

        glm::vec3 va = get_arcball_vector(last_mx, last_my);
        glm::vec3 vb = get_arcball_vector(cur_mx, cur_my);
        angleRadians = acos(min(1.0f, glm::dot(va, vb)));
        arcAngle = ( ( angleRadians * 180 ) / 3.14159265 );
        cout << " Angle in degrees: " << arcAngle << endl;
        //cout << " ArcAngle after Mult: " << arcAngle << endl;
        arcAngle += lArcAngle;
        cout << " ArcAngle after accumulation: " << arcAngle << endl;
        axis_in_world_coord = glm::cross(va, vb);

        last_mx = cur_mx;
        last_my = cur_my;
        //glutPostRedisplay();

    }
// other code for other functionality...
}

void display()
{
    //Background color
    glClearColor(1, 1, 1, 0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    //glClear(GL_COLOR_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);

    // Matrix setup
    glMatrixMode(GL_PROJECTION);
    glViewport(0, 0, width, height);
    glLoadIdentity();
    gluPerspective(40, (float)width / (float)height, 0.1, 1000);

    // Matrix setup
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0, 0, -3);

    int myFlagCtr = getFlagCtr();
    //cout << "CRX: " << crx << " CRY: " << cry << " CRZ: " << crz << endl;

    glPushMatrix();
        //glRotatef(arcAngle, axis_in_world_coord.x, axis_in_world_coord.y, axis_in_world_coord.z);
        glTranslatef(vec_blx, vec_bly, zScaling);
        glRotatef(arcAngle, axis_in_world_coord.x, axis_in_world_coord.y, axis_in_world_coord.z);

    if (myFlagCtr == 1) {
        // Set Wireframe
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        // color red
        glColor3f(1.0f, 0.0f, 0.0f);
    }
    else if (myFlagCtr == 2) {
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        // color red
        glColor3f(1.0f, 0.0f, 0.0f);
        glEnable(GL_POLYGON_OFFSET_LINE);
        glPolygonOffset(-1.0, -1.0);
        //draw object
        blDrawMouseMesh();
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
        // color red
        glColor3f(0.0f, 1.0f, 0.0f);
    }
    else if (myFlagCtr == 0 || myFlagCtr == -1) {
        // Bring back to Default
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
        glColor3f(0.53f, 0.12f, 0.47f);
    }
        blDrawMouseMesh();
    glPopMatrix();
    glutSwapBuffers();
}

As you can see between the two mouse vectors I get the angle between them, and the orthonogol vector which is the axis I am rotating around. But this only seems to work in a rather "dirty" and not particularly smooth way.

Edit: I now think the problem is the accumulation of degrees, when I switch axis's it remembers the angle from before, so it will "rotate" by the same amount previously plus the new angle, I'm not sure how to solve given the loading of the identity matrix causing non-accumulated values to reset.

sentences:
How to raycast from a UI element How do I raycast from a UI object?
I have tried

Ray ray;
Camera cam;
Transform obj; //UI object

ray = cam.ViewportPointToRay(obj.position);

AND

ray = new Ray(obj.position, obj.forward);

Neither of these seem to work.

sentences:
Tilemap layer scaling and Camera issue in Phaser I'm working with the Phaser framework and I'm struggling with a camera/rendering issue when scaling a tilemap layer to simulate a zoom feature in my project.

The camera size is set to 1024x768px.(Same as the stage size)
I then create a tilemap and a tilemap layer that is 3072x2304px.

    // Create the tilemap and the tilelayer
    this.map = this.add.tilemap();
    this.map.addTilesetImage('tiles');

    this.layer1 = this.map.create('layer', 96, 72, 32, 32);
    this.layer1.resizeWorld();

Code to zoom

        this.layerScaleGroup = this.add.group();
        this.layerScaleGroup.add(this.layer1);
        this.layerScaleGroup.add(this.marker);

        this.layerScale = 1;
        this.inputScale = 1;

In the update function

        if(this.input.keyboard.isDown(Phaser.Keyboard.Q)){

            this.layerScale -= .2;
            this.inputScale += .2;

        }
        if(this.input.keyboard.isDown(Phaser.Keyboard.A)){

            this.layerScale += .2;
            this.inputScale -= .2;

        }

        this.layerScale = Phaser.Math.clamp(this.layerScale, .33, 1);
        this.inputScale = Phaser.Math.clamp(this.inputScale, 1, 3);

        this.layerScaleGroup.scale.set(this.layerScale);
        this.input.scale.set(this.inputScale);

When completely zoomed out I need the tilemap layer to be shown in the camera, but instead it seems like the camera or a camera follows the scale of the tilemap layer, even though the original camera is still 1024x768.

Here is a video showing the issue.
https://youtu.be/e2mRfigq98I

When you are zoomed out you can still draw a tile onto the tilemap, but it is not rendered.

sentences:
Error when initializing Stage I made a new class that implements Screen, what I've seen from other people's code is that they create a constructor that takes a parameter of Game game. I did not created a constructor, I think that's the reason why I get the error

  public class MainMenu implements Screen{
     public MainMenu(Game game){ //I dont know what are these for
            this.game = game;    //<--
        }

 public void show() {
        btnAtlas=new TextureAtlas(Gdx.files.internal("bitters.atlas"));
        skin=new Skin();
        skin.addRegions(btnAtlas);
        stage=new Stage(Gdx.graphics.getWidth(),Gdx.graphics.getHeight(),true);// I get the error here when initializing the Stage
    }
 }

the error is "Cannon resolve constructor 'Stage(int,int,boolean)'"

sentences:
Why is the Enemy not changing direction when entering the collider? I'm really new to Unity, and I'm trying to make a 2.5D platform game. I want to make my enemies walk on a platform and turn when they reach the end of the platform so I placed two triggers at the beginning and at the end of it to change the direction of the enemy.

public class BanditScript : EnemyScript{
    // Start is called before the first frame update
    private Rigidbody rb;
    private Vector3 moveDir;
    private bool left;
    void Start(){
        left = true;
        speed = 1;
        player = GameObject.FindWithTag("Player");
        animator = GetComponent<Animator>();
        minDistance = 1;
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update(){
        IsNear();
        if (near) {
            //attack
            animator.SetBool("isAttacking", true);
            animator.SetBool("isMoving", false);
        }
        else {
            MoveOnPlat();
            animator.SetBool("isAttacking", false);
            animator.SetBool("isMoving", true);
        }
    }
    void MoveOnPlat() {
        animator.SetBool("isMoving", true);
        if (left)
            moveDir = transform.forward;
        else {
            moveDir = -transform.forward;
        }
        rb.velocity = moveDir * speed;
    }
    private void OnTriggerEnter(Collider other) {
        if (other.tag == "platEndL") {
            left = false;
            transform.rotation = Quaternion.Euler(0, 90, 0);
        }
        if (other.tag == "platEndR") {
            left = true;
            transform.rotation = Quaternion.Euler(0, -90, 0);
        }
    }
}

This is my class, the issue is that the enemy keeps moving in the same direction despite everything. Can you help me?

sentences:
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:
OpenGL first person camera orientation issues I have a "camera" in my opengl program that I recently finished. However, I've noticed that whenever I rotate and then move again, the x, y, and z angles change. For example, when I press the "w" key, I move forward along the "z" axis. If I then rotate the camera 90 degrees, when I push the "W" key, I will actually be moving right, seemingly along the "x" axis. It makes sense why this happens, I'm just wondering why its happening. Here's the rotation function:

private void camera() {
    glRotatef(xrot, 1.0f, 0.0f, 0.0f);
    glRotatef(yrot, 0.0f, 1.0f, 0.0f);
}

The keyboard function:

if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        xpos -= 0.035 * delta;
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
        xpos += 0.035 * delta;
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
        zpos += 0.03f * delta;
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
        zpos -= 0.035 * delta;
    }
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
        xrot += 0.035;
        if (xrot > 360) {
            xrot -= 360;
        }
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
        xrot -= 0.035;
        if (xrot > 360) {
            xrot += 360;
        }
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
        yrot += 0.035;
        if (xrot > 360) {
            xrot -= 360;
        }
    }

    if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
        yrot -= 0.035;
        if (xrot > 360) {
            xrot += 360;
        }

    }

And my translate function:

        glTranslated(xpos, ypos, zpos - 30);

any ideas on how to solve this? I would be very grateful

sentences:
Help in 2d platform script Now I finished my 2d game but when I set up it in my mobile it becomes like this so I change some scripts in Maincamera but it's still the same

How can I change the screen to become horizontal in my mobile like this?

what I need that how can I make it fit my mobile screen.

sentences:
Matrix transformation I have to find components of a matrix for 3D transformation. I have a first system in which transformations are made by multiplying:
M1 = Scale x Rotation x Translation.
I want to have the same transformations in an engine who compute like this:
M2 = Scale x Translation x Rotation
So when I enter the same values there's a problem du to the inversion of translation and rotation.

How can I compute the values in the last matrix M2 for having the same transformation?

Thanks

sentences:
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:
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:
LibGDX play sound when hovering button I'm trying to make a button that plays a sound when hovering above it with the cursor

So far I created a class which extends the scene2d TextButton and I'm adding a FocusListener. The problem is that the sound is played a lot of times when hovering because this event fires not only once but as long as the button is focused.

//When button is hovered
this.addListener(new FocusListener() {

        public boolean handle(Event e) {

            SoundManager.play(hoverSound);

            return true;
        }
});

I also tried to make a variable soundPlayed which toggles if the sound is played once but this leads to the sound playing only one time because I don't know how to detect if the button is not focused anymore so i can reset the variable.

Thanks for the help.

sentences:
CCD IK Pole Target Contraint I am writing my own CCD IK solver. The version I have currently works perfectly fine, however, I need a way to make it use a pole target constraint.

What I want is for the elbow of my characters arm to point towards a pole target, similar to how Blender allows you to add a pole target.

I would love if someone could point me in the right direction of how this can be implemented.

sentences: Storing attributes in static geometry I have a Minecraft like world where I statically create one instance of each tile type, and then place it around the world. However, I don't know how to actually change individual attributes for each tile. For instance, I need to change the lighting per tile, but if I do, it'll change the color of ever single tile. I was thinking about storing two arrays per chunk, one for the tiles and one for the light, and when I want to change the lighting, I can just change the value in the lighting array that coincides with the position in the tile array. However, this will mean I'll have to have store twice as much data per chunk, but is it something I have to accept?

sentences:
How good do I have to be at Math to create a 3D game using three.js? A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. However, jumping into 3d does seem a little scary and I'm worried my "bad at maths brain" will take it. I love creating games, I really don't want this to hold me back.

Is it possible to learn as I go along or do I need to have some natural math talent to be able to create 3d games? Also... if anyone can find a good place to start for a guy like me I'd really appreciate that too.

Thanks

sentences:
using glew glviewport cannot get the correct proportion of a window the generated window resolution is (1334, 750)
when i call glViewport(0, 0, 1334, 750); the whole window is filled,
but when i call glViewport(0, 0, 1334 / 2, 750); the result is as bottom:

the proportion is obviously wrong, anyone know what happened?

sentences:
Rotate around a 3d Object (Software Renderer) I have a simple 3d software renderer (SDL / C++) which can load a 3ds Model and render it (shaded) and rotate it around X Y Z - Axis.
Now I would like to rotate / move around the object, meaning, the object itself stands still, and everything in the scene is displayed from the angle of the view. Is that what a camera in 3d engines does, and how would I implement something like this ?

(No OpenGL / DirectX is used, just plain software)

sentences:
Problems with Rotation Matrices on Certain Axes Here is what my rotation matrix looks like:

public Matrix4f initRotation(float x, float y, float z)
{
    Matrix4f rx = new Matrix4f();
    Matrix4f ry = new Matrix4f();
    Matrix4f rz = new Matrix4f();

    x = (float)Math.toRadians(x);
    y = (float)Math.toRadians(y);
    z = (float)Math.toRadians(z);

    rz.m[0][0] = (float)Math.cos(z);rz.m[0][1] = -(float)Math.sin(z);rz.m[0][2] = 0;                rz.m[0][3] = 0;
    rz.m[1][0] = (float)Math.sin(z);rz.m[1][1] = (float)Math.cos(z);rz.m[1][2] = 0;                 rz.m[1][3] = 0;
    rz.m[2][0] = 0;                 rz.m[2][1] = 0;                 rz.m[2][2] = 1;                 rz.m[2][3] = 0;
    rz.m[3][0] = 0;                 rz.m[3][1] = 0;                 rz.m[3][2] = 0;                 rz.m[3][3] = 1;

    rx.m[0][0] = 1;                 rx.m[0][1] = 0;                 rx.m[0][2] = 0;                 rx.m[0][3] = 0;
    rx.m[1][0] = 0;                 rx.m[1][1] = (float)Math.cos(x);rx.m[1][2] = -(float)Math.sin(x);rx.m[1][3] = 0;
    rx.m[2][0] = 0;                 rx.m[2][1] = (float)Math.sin(x);rx.m[2][2] = (float)Math.cos(x);rx.m[2][3] = 0;
    rx.m[3][0] = 0;                 rx.m[3][1] = 0;                 rx.m[3][2] = 0;                 rx.m[3][3] = 1;

    ry.m[0][0] = (float)Math.cos(y);ry.m[0][1] = 0;                 ry.m[0][2] = -(float)Math.sin(y);ry.m[0][3] = 0;
    ry.m[1][0] = 0;                 ry.m[1][1] = 1;                 ry.m[1][2] = 0;                 ry.m[1][3] = 0;
    ry.m[2][0] = (float)Math.sin(y);ry.m[2][1] = 0;                 ry.m[2][2] = (float)Math.cos(y);ry.m[2][3] = 0;
    ry.m[3][0] = 0;                 ry.m[3][1] = 0;                 ry.m[3][2] = 0;                 ry.m[3][3] = 1;

    m = rz.mult(ry.mult(rx)).getM();

    return this;
}

And here is how I've been implementing it for tests (using default orthographic perspective):

public class Renderer {

private WorldMesh mesh;
private Mesh _mesh;

private Matrix4f transform;

private Shader shader;

public Renderer(){

//Setup Meshes

    mesh = new WorldMesh();

    _mesh = ResLoader.loadMesh("pyramid.obj");

    mesh.addToBuffers(_mesh);

//setup Shader

    shader = new Shader();

    shader.addVertexShader(ResLoader.loadShader("basicVertex.vs"));
    shader.addFragmentShader(ResLoader.loadShader("basicFragment.fs"));
    shader.compileShader();

    shader.addUniform("transformation");

//temporary transformation matrix

    Matrix4f tran = new Matrix4f().initTranslation(0, 0, 0);
    Matrix4f rot = new Matrix4f().initRotation(0, 0, 0);     //problem is definitely with the rotation matrix;
    Matrix4f scale = new Matrix4f().initScale(1, 1, 1);

    transform = tran.mult(rot.mult(scale));

}

public void update(){}

public void render(){

    RenderUtils.clearScreen();

    shader.setUniform("transformation", transform);

    shader.bind();

    mesh.draw(true);
}

}

and finally here is my vertex shader:

#version 330

layout (location = 0) in vec3 position;

uniform mat4 transformation;

void main(){

    gl_Position = transformation * vec4(position, 1.0);
}

The problem is that setting a rotation on any other axis other than Z (for some reason z axis rotation is working fine) does not function properly. An X axis rotation seems to be doing both an x and y rotation at the same time, causing a weird stretching affect. A Y axis rotation causes the mesh to completely disappear.

The funny thing is that I've used this code over and over again and some projects don't give me a problem.

The order of multiplication seems in order, and I made sure that OpenGL knows to transpose the matrix I give it when setting the uniform.

Any ideas as to what could be causing the x and y axis rotations to completely fail?

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:
Proper way to calculate x and y components of two 2D vectors I'm having some issues on resolving this with the current set of Vector2 methods. Could you help me to define a universal solution? The idea is to move a spaceship to another point using only relative to (A) lateral and forward movements.

Given two points A(1,-1) and B(2,-3):
- A has a known angle with the y axis: alpha
- How to calculate the x-dist and y-dist relative distances in order to move A to B?

sentences:
View to normal calculation in GLSL Sorry for the terrible title, but I really cant think of anything better.. Suggestions welcome.

I am trying to do something like showcased in this video:

http://www.youtube.com/watch?v=CaTI2d0tQME

So basically smoothly change the opacity when looked face-on.

This is my vertex shader so far, the fragment shader is simple as it just multiplies the lightColor with the texture:

#version 430 core

uniform mat4 MV;
uniform mat4 MVP;

layout(location = 0) attribute vec3 vertexPosition;
layout(location = 1) attribute vec2 vertexUV;
layout(location = 2) attribute vec3 vertexNormal;

layout(location = 3) attribute mat4 bufferMatrix; // For per-instance translation

varying  vec2 UV;
varying  vec4 lightColor;
flat varying int InstanceID;

void main(){
    vec4 mcPosition = MV * bufferMatrix * vec4(vertexPosition, 1.0);
    mcPosition = mcPosition / length(mcPosition);

    vec3 mcNormal = vertexNormal;

    vec3 ecNormal = vec3(MV * bufferMatrix * vec4(mcNormal, 0.0));
    ecNormal = ecNormal / length(ecNormal);

    float dotProduct = dot(vec4(mcNormal, 1.0), mcPosition);

    lightColor = vec4(dotProduct);

    gl_Position = MVP * bufferMatrix * vec4(vertexPosition, 1.0);
    UV = vertexUV;
    InstanceID = gl_InstanceID;
}

The base is copied code from a 'phong' shader - that works!.. I have tried everything I could think of, as well as searched google for quite some time.

I think I realize what I need to do mathematically, which is getting the dot-product of the vertex-normal on to the view-to-vertex vector. That is mathematically speaking, another is to do it in GLSL with matrices etc.

I am bad at debugging GLSL code, but right now the lightColor is always 0, no matter where I look at the model from.

Quick Bonus Question: What is the technique in the video actually called - if anything?

sentences:
IOS OpenGl transparency performance issue I have built a game in Unity that uses OpenGL ES 1.1 for IOS. I have a nice constant frame rate of 30 until i place a semi transparent texture over the top on my entire scene. I expect the drop in frames is due to the blending overhead with sorting the frame buffer. On 4s and 3gs the frames stay at 30 but on the iPhone 4 the frame rate drops to 15-20. Probably due to the extra pixels in the retina compared to the 3gs and smaller cpu/gpu compared to the 4s.

I would like to know if there is anything i can do to try and increase the frame rate when a transparent texture is rendered on top of the entire scene.

Please not the the transparent texture overlay is a core part of the game and i can't disable anything else in the scene to speed things up. If its guaranteed to make a difference I guess I can switch to OpenGl ES 2.0 and write the shaders but i would prefer not to as i need to target older devices. I should add that the depth buffer is disabled and I'm blending using SrcAlpha One.

Any advice would be highly appreciated.

Cheers

sentences:
Efficient Dynamic Memory Management My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles.

At the moment, I create two VBOs for each chunk (vertices and colours), when the chunk is loaded. Once a mesh is created, it is only edited every few seconds. These buffers are deleted when the chunk is no longer visible.

Am I leaking memory here by constantly creating and destroying buffers?

I've heard somewhere that OpenGL (or WebGL in this case) doesn't do garbage collection until the program quits, due to it being slow. Is this right?

Could I improve this system somehow?

sentences:
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:
failbit is being set and I can't figure out why I'm writing a MIDI file loader. Everything is going fine until at some track I get a failbit exception while trying to read from file. I can't figure out why, I've checked the file size and it's ok too.

Upon checking "errno" and it returns "0".

Any ideas?
Thanks.

The snippet follows:

file.read(reinterpret_cast<char*>(&mHeader.id), sizeof(MidiHeader));

mTracks = new MidiTrack[mHeader.nTracks];
for (uint i = 0; i < mHeader.nTracks; ++i)
{
    // this read fails on 6th i. I've checked hexadecimal file and it's
    // ok so far.
    file.read(reinterpret_cast<char*>(&mTracks[i].id), sizeof(uint));
    if (file.fail())
    {
        std::cerr << errno << std::endl;
        massert(false);
    }
    massert(mTracks[i].id == 0x6B72544D);

    file.read(reinterpret_cast<char*>(&mTracks[i].size), sizeof(uint));
    mTracks[i].size = swapBytes(mTracks[i].size);

    mTracks[i].data = new char[mTracks[i].size];
    file.read(mTracks[i].data, mTracks[i].size * sizeof(char));

    totalBytesRead += 8 + mTracks[i].size;
    massert(totalBytesRead <= fileSize);
}

sentences:
Can't consistently add to TimeSpan for Unity Game I'm making a game that has a timer showing how long the player has survived from being crushed by pessimism. (Long story) I'm trying to use TimeSpan in Unity to accomplish this but it seems that I'm having trouble finding a way to add time consistently. My output is always 00:00:01. Here is the code I've been working on. Any help would be appreciated.

using UnityEngine;
using System.Collections;
using System;

public class TestScript : MonoBehaviour {

static float timer;
TimeSpan t = TimeSpan.FromSeconds(timer);
TimeSpan add = TimeSpan.FromSeconds(1);

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

    TimeSpan span3 = t.Add(add);

    Debug.Log(span3);
}
}

UPDATE

Thanks for your help Jason, here's the code I made in case anybody else wants to know how to do this. The only beef I have is that the milliseconds show 3 characters instead of two, but I'm personally very satisfied with it. Plus, I'm sure that it is something that could be easily fixed.

using System.Collections;
using System;

public class TestScript : MonoBehaviour {

static float timer;

// Update is called once per frame
void Update () {
    timer += Time.deltaTime;
    TimeSpan timeSpan = TimeSpan.FromSeconds(timer);
    string output = String.Format("{0}:{1}:{2}",timeSpan.Minutes,timeSpan.Seconds, timeSpan.Milliseconds);
    Debug.Log(output);
}
}

sentences:
How to Replace two object by rotating in center I created Find Rock game but I have problem In replacing two object by rotating in center and when rotating finish stop rotating how can I do this?

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
    public GameObject[] obj;
    public int[] Randomize = new int[2];

    void Start(){
        StartCoroutine (Delay ());

    }

    IEnumerator Delay(){
        Randomize [0] = Random.Range (0, obj.Length);
        Randomize [1] = Random.Range (0, obj.Length);
        while (Randomize [0] == Randomize [1]) {
        Randomize [0] = Random.Range (0, obj.Length);
        }
        yield return new WaitForSeconds (2);
        obj [Randomize [0]].transform.rotation = Quaternion.Euler (new Vector3 (0, 0, 0));
        obj [Randomize [1]].transform.rotation = Quaternion.Euler (new Vector3 (0, 0, 0));

        StartCoroutine (Delay ());
        }
    void Update(){
        if (obj [Randomize [0]].transform.rotation.eulerAngles.y < 90 || obj [Randomize [1]].transform.rotation.eulerAngles.y < 90) {
            obj [Randomize [0]].transform.RotateAround (obj [Randomize [1]].transform.position, Vector3.up, Time.deltaTime * 100);
            obj [Randomize [1]].transform.RotateAround (obj [Randomize [0]].transform.position, Vector3.up, Time.deltaTime * 100);
        }
    }
}

I can make this game but when rotating finish they aren't Directed.
this video link describe my problem and this is unity package of my game.
how can I use mathf clamp RotateAround for stopping rotation?!

sentences:
Object Composition in the Unity Editor I'm trying to learn how to use Unity for my class composition, and I was wondering if you could help me.

I'm trying to create a simple game where the player is trying to pop a bunch of balloons. However, any given balloon can only be popped if all of its conditions are met. Example conditions are:

The player color must match the balloon color
The balloon must be popped in sequence (balloon A must be popped before balloon C)
The balloon is only pop-able during a certain time window

And I'm sure you could think of more.

Balloons can have 0 to many conditions associated with them, but they follow the 80/20 principle where 80% will fall into a specific category (e.g. color-match-only, or color-and-sequence-only).

My Initial Solution

I created a "Balloon" class that contains a list of "ICondition" interfaces. When a collision occurs, the balloon loops through each condition to determine whether the balloon is pop-able or not. I populate this list within a "BalloonFactory" class. For 80% scenarios I can just pass in the name of the balloon type I want. For 20% scenarios I can pass a list of conditions.
This solution works, except for each new combination I need to change the factory code to include the new condition.

What I'd Like to Do

Instead of storing the balloon definitions in code, I'd prefer to create prefabs in Unity and use the editor to assign condition implementations to each balloon. My problem so far is that the Unity editor doesn't seem to like displaying a list of interfaces or abstract classes.

Is there some way to do what I'm trying to do here? Or is there a third option which you would recommend?

sentences:
unity : How to delete unused assets? Hi i have some questions :

How to properly delete unused asset ?

I have an unused game object and i want to delete it together with its material/texture. I can select it and RMB select dependencies , but i can't delete them all because some of these selected textures is being used by other object. So i have to manually check them one by one. Is there any other faster method ?

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:
Create quad from texture and screen metrics If I have a texture with known metrics (pixel size, byte type) and a GL surface to render to of a know density and measures, and I want to draw a quad composed of two triangles that correspond to the size of the texture in proportion to the size of the surface. For that I need to recalculate the needed quad's vertexes. Can someone explain me the math involved in this process?

Example: I have a screen/surface of 800x600 and a texture of 100x20 that I want to position in (20, 20). How do I calculate the vertex of the quad needed for it.

My shaders are simple

v

attribute vec2 a_texcoord;
attribute vec2 a_position;
varying vec2 v_texcoord;
void main() {
   gl_Position = vec4(a_position, 0.0, 1.0);
   v_texcoord = a_texcoord;
};

f

precision mediump float;
uniform sampler2D u_texture;
varying vec2 v_texcoord;
void main() {
    gl_FragColor = texture2D(u_texture, v_texcoord);
};

And the VAs even simpler

float squareCoords[] = {
     -1.0f,  1.0f, 0.0f,
     -1.0f, -1.0f, 0.0f,
      1.0f, -1.0f, 0.0f,
      1.0f,  1.0f, 0.0f
};

char drawOrder[] = {
      0, 1, 2, 0, 2, 3
};

float textureCoords[] = {
      0.0f, 1.0f,
      0.0f, 0.0f,
      1.0f, 0.0f,
      1.0f, 1.0f
};

sentences:
Keeping over-shoulder camera view consistent at different screen resolutions I have a player GameObject.
There is a character attached to it and a camera (both are children of the player GameObject).

The over-shoulder camera is positioned nicely.
The player should appear on the left edge of the screen.

Now when I change the viewport / screen size and make it larger, the camera doesn't keep it's view. I can see in the Inspector that the camera's view changes.

I don't understand in which way it does that.

What would I need to do to keep the player always on the left edge, no matter what the screen resolution is?

Thank you.

The upper image shows how I have planned / developed the camera view. This is what the camera view should look like.
The lower image shows how the camera changes at larger viewport.

sentences:
How do I compute the angle between a pixel on an irregular curve and a circle colliding with it? I'm building a custom physics engine to accompany a level-editor. This image shows how the level-editor outputs levels:

Now, some explanation is in order. The curve is defined by the red points. After they are connected in threes by circles (yellow lines show these circles), a system connects them in a 'streamlined' way - as shown by the blue lines. This makes the curves flow seamlessly.

Now, these curves are 'irregular,' so to say. For the accompanying physics engine - how do I detect the angle made between a pixel on the curve and a colliding circle (per-pixel collision check)?

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:
How to ease toward a rotation limit, instead of stopping abruptly? I rotate my camera using a framerate-independent exponential ease-out blend like so:

    _x += Input.GetAxis("Mouse X") * xSpeed;
    float target = 0f; //I want to blend towards 0
    float sharpness = 0.05f; //the smaller this value, the longer it takes to settle down to the target value
    float referenceFramerate = 90f;//the approximate framerate on my developer machine
    float blend = 1f - Mathf.Pow(1f - sharpness, Time.deltaTime * referenceFramerate);
    _x = Mathf.Lerp(_x, target, blend);

This works fine.

Now my camera should be clipped at a certain rotation yaw.

The new camera rotation yaw is calculated like this:

    _CurrentYaw += _x * Mathf.Abs(_CameraDefaultPos.z);
    if (_CurrentYaw > 160f)
    {
       _CurrentYaw = 160f;
    }
    else if (_CurrentYaw < -120f)
    {
       _CurrentYaw = -120f;
    }

This clipping part of my code makes the camera stop abruptly at the maximum.

How could the above Mathf.Lerp function be adopted to make it so that the _x value would be damped more quickly when going towards the rotation limit?

sentences:
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:
Normal Mapping issue The first image shows a spotlight shining correctly on the floor.
The second image shows the same spotlight but rotated 180 degrees.

The first is correct, the second is not.

The third image shows the light "half if and half out"

Can anyone understand what is happening here?

Normal mapping code:

Shader.fs

vec3 CalcBumpedNormal()
{
vec3 Normal = normalize(normal0);
vec3 Tangent = normalize(tangent0);
Tangent = normalize(Tangent - dot(Tangent, Normal) * Normal);
vec3 Bitangent = cross(Tangent, Normal);
mat3 TBN = mat3(Tangent, Bitangent, Normal);

return normalize(TBN * (255.0/128.0 * texture2D(normalMap, texCoord0.xy).xyz - 1 ));
}

The model is Sponza by crytek.
Loaded using Assimp Model Loader.

sentences:
Gamma adjustment slider implementation Various online sources talk in sufficient detail about gamma correction. By following them, I achieved a rendering pipeline that looks somewhat like this:

// Both are set to 2.2
uniform float gammaIn;
uniform float gammaOut;

void main()
{
    vec3 color = pow(texture(material.albedo, texCoord).rgb, vec3(gammaIn));
    // Do lighting and then HDR tone mapping here.
    //   color = ...
    FragColor = pow(color, vec3(1.0 / gammaOut));
}

That is the easy part.

Now, many games implement the gamma correction adjustment slider that is meant to accommodate for display differences in various monitors that players may have. This presents some questions that I couldn't find any definitive answer to:

Which value should the adjustment slider affect? I reckon it will be gammaOut because gammaIn deals with decoding of the sRGB picture and assuming that all textures are sRGB, this should always be the const 2.2. With this approach a lower gammaOut means darker picture.
What's the reasonable value range for the slider? Should it start at 1.0 or somewhere higher? Where should it end?
If I were to display the "barely visible / invisible" comparison combo picture to help the user with doing the adjustment correctly, what should be the color values for the "should be barely visible" dark picture and its background and ditto for the "should be invisible" bright picture and its background?

sentences:
Using Sampler States in Effect file I have been reading a lot of different shaders and some have the preference of:

sampler depthSampler : register(s1);

Whilst others take the longer route:

texture depthMap;
sampler depthSampler = sampler_state
{
    // etc.
};

Is there any real difference between the two?  Does one perform faster than the other?

sentences:
Breaking up a map so countries can be colored separately in Spritekit I'm currently trying to build a little strategy game where players take control of countries on an world. Each player's countries are represented by having a different color background but as each country is a different irregular shape I'm wondering how best to build this. To be clear I know how to change the color of a sprite or texture, but I'm wondering if there's a better approach to building the map then I outline below

My initial thought is that I export each individual country sprite and then use a shader etc. to change the background color when required. To do this I would obviously need to piece together each scene manually and make sure my countries line up correctly against each other to form the whole world.

This means I can't really create any 'dynamic' worlds. i.e. each map has to be hand curated.

Is there a better way to approach this without having uniform shaped countries? Bearing in mind this is a 2D game and there isn't really physics, could I use a physics body or something similar to get the actual shape of a country, and perhaps make sure each sprite has a white/transparent background then just change that particular color? Leaving the border black or whatever color I choose.

My fallback option is just having a building on each country that has a flag representing the faction color as this would be a lot easier to do.

sentences:
Advice on a PHP RPG System I am looking to make a php/mysql/javascript based rpg on a site. I am trying to figure out the best method when it comes to items, quests, etc. For instance should I make classes for each item type and then store just the item level etc in the database, thus making a object of the item when the player starts playing. Or to store the full item data in the database and update that as the player plays.

I figured the object one would cause less calls to the database but I then wonder how would I go about this method. That is I know how to make the classes etc, but what would the method be when the player logged in and you needed to get their inventory etc.

Any advice on how to go about this would be nice, any tutorials you know of etc too. Thanks.

sentences:
Instancing with Directx11 I'm a total beginner with Directx/3D programming. I need help with implementing hardware instancing on Directx 11. I'm trying to render multiple cubes on the screen, to create some sort of Minecraft-esque voxel engine. The problem is, I don't know where to start to achieve this. This is how my "render frame" function looks:

void RenderFrame(void)
{
    D3DXMATRIX matView, matProjection;
    D3DXMATRIX matFinal;

    // create a view matrix
    D3DXMatrixLookAtLH(&matView,
    &D3DXVECTOR3(0.0f, 9.0f, 24.0f),   // the camera position
    &D3DXVECTOR3(0.0f, 0.0f, 0.0f),    // the look-at position
    &D3DXVECTOR3(0.0f, 1.0f, 0.0f));   // the up direction

    // create a projection matrix
    D3DXMatrixPerspectiveFovLH(&matProjection,
    (FLOAT)D3DXToRadian(45),                    // field of view
    (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio
    1.0f,                                       // near view-plane
    100.0f);                                    // far view-plane

    // create the final transform
    matFinal = matView * matProjection;

    devcon->ClearRenderTargetView(backbuffer, D3DXCOLOR(0.0f, 0.2f, 0.4f, 1.0f));

    devcon->ClearDepthStencilView(zbuffer, D3D11_CLEAR_DEPTH, 1.0f, 0);

    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    devcon->IASetVertexBuffers(0, 1, &pVBuffer, &stride, &offset);
    devcon->IASetIndexBuffer(pIBuffer, DXGI_FORMAT_R32_UINT, 0);
    devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    devcon->UpdateSubresource(pCBuffer, 0, 0, &matFinal, 0, 0);
    devcon->DrawIndexed(24, 0, 0);

    swapchain->Present(0, 0);
}

Notice that there's a single vertex buffer containing the verteces of a cube, and index buffer containing its indeces. I want to render many (5000+) cubes on the screen at once on a single draw call, without performance issues, so I know instancing is the way to go, but I don't know how to implement it in my code. What changes do I need to do to my code in order to display multiple instances of the cube?

Thanks in advance!

sentences:
Tweaking AStar to find closest location to unreachable destination I've implemented AStar in Java and it works ok for an area with obstacles where the chosen destination is reachable.

However, when the destination is unreachable, the calculated "path" is in no way to the closest location (to the unreachable location) but is instead some random path.

Is there a feasible way to tweak AStar into finding the path to the closest location to an unreachable destination?

sentences:
How to keep my auto-aim in sync with the rendered frame? In my FPS game there is an automated lock system. If you stare at an enemy, your weapon locks onto the enemy as long as your aim is hovering approximately around the target.

If my player sets frame rate high (say they changed frame rate from 60 to 140+) they have smooth frame rate in which allows them to change their view more smoothly. My players can now hover their aim onto an enemy more rapidly.

Problem is, if my game were to run at 60 ticks per second while the player set the render system to render 140+ frames per second, my game's tracking system will be a few frames behind what the player looks at.

So I am wondering, should my game's logic run at the same rate that the rendering system is rendering the game? Or can I solve this synchronization issue in another way?

sentences:
How can I specify which enemies to spawn for each round in a tower defense? I am making a TD game in Unity, and I would like to know the most common approach to spawning enemies each round. I have more than 200 rounds per map, just like Fieldrunners.

Is it some kind of hardcoding, say for 25 rounds and then repeat the same waves with harder enemies, or maybe logic/algorithm based on rounds, where it'll give number of enemies and type of enemies which will spawn in that round.

I have 8 type of enemies. I want to implement a function/equation which inputs round number and outputs "number of enemies" and "enemy type" keeping the difficulty level which is round numbers.

for e.g if input: 50th round, output: enemy type1, large no. of enemies,
if the input: 2nd round, output: enemy type 1, less number of enemies

sentences:
Add translation at each animation cycle loop in Unity I have a running animation. It already contains root animation. At every loop, it jumps to starting position.

What is the best way to add a translation every time the animation loops?

sentences:
Should I share the same tile structure for display and pathfinding? I know how to display a 2D map with tiles.

I know how to make a pathfinding algorithm using A*.

Those two things demand a structure or a class. My question is : do you use the same structure for displaying and path-computing ? Node structure for pathfinding demand to add some data : x position, y position, F, G, H plus the Parent Node. Tile structure for displaying can be optimized to almost only one information : the value of the tile.

Do you use a big class for your tiles, that handle both displaying and pathfinding, or do you use a different method ? Thank you for your advices !

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:
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:
Making object move in an angle I have a game with a beat-em-up perspective (think Final Fight, Streets of Rage) where movement is in X and Z. My movement logic consists of checking controller input of X-axis for X movement and Y-axis for Z movement. I use this logic to move enemy as well, using this method:

internal bool MoveTowardsPosition(Vector3 targetPosition)
{
    bool reachedPosition = false;
    bool reachedX = false;
    bool reachedZ = false;

    // Determine x direction
    if (Mathf.Round(Mathf.Abs(targetPosition.x - _enemy.transform.position.x)) > 0)
    {
        if (targetPosition.x < _enemy.transform.position.x)
            Input.HorizontalMove = -1;
        else
            Input.HorizontalMove = 1;
    }
    else
        reachedX = true;

    // Determine z direction
    if (Mathf.Round(Mathf.Abs(targetPosition.z - _enemy.transform.position.z)) > 0)
    {
        if (targetPosition.z < _enemy.transform.position.z)
            Input.DepthMove = -1;
        else
            Input.DepthMove = 1;
    }
    else
        reachedZ = true;

    if (reachedX && reachedZ)
        reachedPosition = true;

    return reachedPosition;
}

So what happens here is that given a target position, I add to the HorizontalMove (X) and DepthMove (Z) until the enemy reaches the destination (these X and Z additions will be read on Update to do a transform.translate()). The enemy does move to the destination but in a unnatural path. So when Z is larger, it will reach the destination X first then traverse Z. So for example, X=2 and Z=5, it'll traverse with a path like this:

What I'm trying to do is for it to traverse a path like this:

I figured instead of adding fixed 1/-1, I need to determine X and Z based on that angle but I'm lost on how to compute/do it. Can you guys lend me a hand, please?

sentences:
openGL ES - change the render mode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY on touch i want to change the rendermode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY when i touch the screen.

WHAT i Need :
Initially the object should be stationary. after touching the screen, it should move automatically. The motion of my object is a projectile motion ans it is working fine.

what i get : Force close and a NULL pointer exception.

My code :

public class BallThrowGLSurfaceView extends GLSurfaceView{

MyRender _renderObj;
Context context;
GLSurfaceView glView;

public BallThrowGLSurfaceView(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    _renderObj = new MyRender(context);
    this.setRenderer(_renderObj);
    this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    this.requestFocus();
    this.setFocusableInTouchMode(true);
    glView = new GLSurfaceView(context.getApplicationContext());
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    if (event != null)
    {
        if (event.getAction() == MotionEvent.ACTION_DOWN)
        {
            if (_renderObj != null)
            {   Log.i("renderObj", _renderObj + "lll");
                // Ensure we call switchMode() on the OpenGL thread.
                // queueEvent() is a method of GLSurfaceView that will do this for us.
                queueEvent(new Runnable()
                {
                    public void run()
                    {
                        glView.setRenderMode(RENDERMODE_CONTINUOUSLY);
                    }
                });
                return true;
            }
        }
    }
    return super.onTouchEvent(event);
}

}

PS : i know that i am making some silly mistakes in this, but cannot figure out what it really is.

sentences:
How to fix overly blurred texture / image in unity? so, I'm not sure what caused this, let image below do the explanation :

How to fix the overly blurred texture in unity? It's so frustrating, since I can't get it right, because when I tried it in LibGDX, the image looks good (Well, it's not exactly a same image, but similar).

They both screenshot from android device (Samsung Galaxy Note 3 Neo)

Thanks

P.S. It's a pixel art

Edit, here's the screenshot of my relevant inspector window

And here's the alpha ingame screenshot

sentences:
Ray picking gives inversed results I'm trying to do a simple ray picking implementation to allow a user to select a cell in a grid rendered in 3D. I'm almost there, but I've ran into an issue which I can't seem to solve.

Consider the following image:

The line represents the ray. The circled part is where the mouse is, and the line's green tip is where it intersects with the grid (XZ plane). When I move the mouse around, the green tip moves almost opposite of the mouse.

What is causing this?

I am converting screen coordinates to OpenGL coordinates using gluUnproject.

After obtaining the direction and position of the mouse, I use the properties of similar triangles to obtain the XZ interception. The ratio between the direction y and position y is the same for both x and z axis. Hence multiplying the direction x, z by the ratio and using y=0 should give the location of the XZ plane intersection. Essentially:

Ray ray = ...
float ratio = ray.point.y / ray.dir.y;
Vector3 intercept = new Vector3(ray.dir.x * ratio, 0, ray.dir.z * ratio);

And yet, as the image shows, its not. Is there something wrong with my reasoning, or something I've overlooked?

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:
Does pausing the canvas draw restores the FPS to higher value in a HTML5 game? I set Frame Per Second of 60 for my game. But after 1 minute it gets to a significantly lower value - around 8 FPS.

Does pausing the canvas drawing restores the FPS to higher value? If it does, how much time is enough to pause the game in order to get 60 FPS again?

sentences:
how to improve sprite animations to reduce FPS My game has different, and detailed animations throughout the game. For example, the main character has an idle stance, so its not just painted still, giving him some life. Death animation, hurt animation, etc... even the background scenario has animations(which I don't think I went with the best approach here, but, it's working for now, this will be in another thread if not answered here)
Anyways, the thing is, while the main character had these animations only that character was in the game at that time, so everything ran smoothly. After adding another character, the enemy, the burden of animations seems to overcharge the FPS and just slows the game down. The most obvious of this problems was that the spritesheet I was using was 1 per character, I figured how to use spritebatchnode efficiently and now 1 spritebatchnode covers the 2 characters animation set.
The FPS tried to get back to normal, but its still laggy at times. This worries me because my game design has more enemies to the game, meaning that it will have this issue in a bigger scale.
So I believe that its because of my animation approach, its poor, and inefficient making my game run slow.

I have been trying to find the answer online with no luck, and I don't my approach is the best. I tried working some solutions by my own, but they end up in the same thing. THE ONLY, the only way I find how to reduce this problem is to make my sprites smaller, its not a big deal, but I wouldn't like this solution.

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:
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:
Why does my sprite player move faster when I move the mouse? I'm trying to develop a simple game made with Pygame (Python library).

I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, but when I move the mouse, the sprite moves faster (like x2 or x3). The player object is inside the charsGroup var.

I've run the game in W7 and in Ubuntu. Same thing happens in both OS.

I have more entities which move like NPCs and bullets but they don't get affected, just the player. Given this, I think that the problem maybe has a direct connection with the player moving system (arrow keys).

Here is the update() method of the player object:

def update(self):

    for event in pygame.event.get():
        key = pygame.key.get_pressed()
        mouseX, mouseY = pygame.mouse.get_pos()
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.bulletsGroup.add(Bullet(pygame.image.load("bullet.png"),
                                          self.rect.x + (self.image.get_width()/2),
                                           self.rect.y + (self.image.get_height()/2),
                                            mouseX, mouseY, 50, 50))

        if key[pygame.K_RIGHT]:
            if not self.checkCollision():
                self.rect.x += 10
            else:
                self.rect.x -= 10
        if key[pygame.K_LEFT]:
            if not self.checkCollision():
                self.rect.x -= 10
            else:
                self.rect.x += 10
        if key[pygame.K_UP]:
            if not self.checkCollision():
                self.rect.y -= 10
            else:
                self.rect.y += 10
        if key[pygame.K_DOWN]:
            if not self.checkCollision():
                self.rect.y += 10
            else:
                self.rect.y -= 10

And here is the while loop:

while True:

    if PLAYER.healthBase <= 0:
        GAMEOVER = True

    if not GAMEOVER:
        mapTilesGroup.draw(SCREEN)
        charsGroup.update()
        charsGroup.draw(SCREEN)
        npcsGroup.update()
        npcsGroup.draw(SCREEN)
        drawBullets()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    freq.tick(0)

    pygame.display.flip()

I don't know what more you can  need to help me, but anything you need (more info or code) just ask for it!

sentences:
Creating A Board Game AI I want to code a board game that name is Okey and mostly popular in Turkey. http://en.wikipedia.org/wiki/Okey

But i have got some problems about AI.

Firslty let me explain the game..

The game is played by 4 players.

In this game there are 106 tiles, 2 of them are fake joker. Other 104 tiles are divided 4 colours generally green, black, blue and red. All colours have two sets of tiles. A set ise contains 13 tiles that numbered sequentially 1 to 13.

Each player start 14 tiles (one is start 15 and starts first) and throws one of the most unwanted tile the next player. Next player can get this tile or can get another tile from stack in the middle of table. The game played in anti-clockwise..

The aim of this game is find the valid sequence of 14 tiles as soon as possible. Player can align tiles by sequential numbers in the same colour until 13. For examle Green 1, Green 2, Green 3. There is an exception here, 1 can be follow to 13. For example Red 12, Red 13 and Red 1 is a valid set. But Red 13, Red 1 and Red 2 is not valid.

Or player can align tiles by colors in the same number. For examle Green 1, Black 1, Red 1, Blue 1.

Each set need to be 3 or more tiles to be valid and each of this set named as "Per". Less then 3 tiles is not valid for the finish. A valid finish set can be like this. G: Green, B:Blue, R:Red, BL: Black G1|G2|G3 B2|R2|BL2 R9|R10|R11|R12 BL13|R13|G13

Last thing, when starting game a tile selected to determine joker (okey). For example if you select Blue 3; Blue 4 will be joker (okey) and player can use this tile instead of any tile that player needs to win or complete a set (per).

Of course these rules are general rules and summarized to explain question. If you can read English you can check this link for more information http://tr.wikipedia.org/wiki/Okey or translated page by Google Translate http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=tr&tl=en&u=http://tr.wikipedia.org/wiki/Okey

So which AI algorithm that i can used? I searched for minimax theory and alpha beta pruning. But these theories are generally about 2 players game like chess or tic-tac-toe.

Original Question is at stackoverflow: https://stackoverflow.com/questions/4419628/creating-a-board-game-ai

sentences:
2D Collision detection and reaction: Rect to Line I'm working on a little 2D side scrolling platformer with a couple of friends. The issue I'm having is the level is completely defined by points. They are just a bunch of points which when I read in I turn into line segments, thus creating the floor in a sense. I've been having a lot of issues with this because I'm trying to make appropriate collision detection and reactions but I've never really approached Rect (which my characters sprite is defined as) to a Line (which would represent the section of the floor) collisions. Now I've already tried a few things and what I put together was I treated the character's Rect as if it were 4 Lines and did 4 Line to Line collisions then finding the points where the line's collided I then used some vector math to push out the line from the box. Now as far as that goes it works pretty well IF I'm colliding with one line at a time running into it straight and not on the end points. I'm really wondering if this was a good way to approach it at all really.
What I did for the reaction was make a vector from the center of the character's Rect to the two points then I added them together to make a combined vector then divided it by 2 (so it wasn't to long) and then pushed out by that, which works, some of the time. I can't get it to work without 2 points of intersection.

My questions are: Should I instead go for some other sort of collision detection and reactions?
or
Given your character's Rect and points of intersection on those lines how would you handle the reaction for this?

sentences: What is the color value of daylight? This is a very short question. I want to implement ambient light in the color of daylight from the sun. What is the color value of sun light?

sentences:
Zero vector test in projection intersection test in SAT I stumbled across this implementation for a projection intersection test to use in a SAT test:

// aCorn and bCorn are arrays containing all corners (vertices) of the two OBBs
private static bool IntersectsWhenProjected( Vector3[] aCorn, Vector3[] bCorn, Vector3 axis ) {

    // Handles the cross product = {0,0,0} case
    if( axis == Vector3.zero )
        return true;

    float aMin = float.MaxValue;
    float aMax = float.MinValue;
    float bMin = float.MaxValue;
    float bMax = float.MinValue;

    // Define two intervals, a and b. Calculate their min and max values
    for( int i = 0; i < 8; i++ ) {
        float aDist = Vector3.Dot( aCorn[i], axis );
        aMin = ( aDist < aMin ) ? aDist : aMin;
        aMax = ( aDist > aMax ) ? aDist : aMax;
        float bDist = Vector3.Dot( bCorn[i], axis );
        bMin = ( bDist < bMin ) ? bDist : bMin;
        bMax = ( bDist > bMax ) ? bDist : bMax;
    }

    // One-dimensional intersection test between a and b
    float longSpan = Mathf.Max( aMax, bMax ) - Mathf.Min( aMin, bMin );
    float sumSpan = aMax - aMin + bMax - bMin;
    return longSpan < sumSpan; // Change this to <= if you want the case were they are touching but not overlapping, to count as an intersection
}

I now don't really get why there is a check for the zero vector, i.e. these lines right here:

if( axis == Vector3.zero )
    return true;

Why can we immediately say that the projections intersect, when there is a zero vector as projection axis?

The code is from Acegikmo answer on this question right here: How many and which axes to use for 3D OBB collision with SAT

He just states, that:

  The cross product will give you a zero vector {0,0,0} when any two
  axes between the objects point in the same direction.

Can anyone clarify this?

sentences:
Reading XML working in my computer but not in my Android phone Following code works perfect in my computer but when I try to run it in my Android Phone, it does not work.

string path = @"Assets\Layout\XML\file" + select.ToString() + @".xml";
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Name>));
StreamReader sr = new StreamReader(path);
List<Name> listnames = (List<Name>)xmlSerializer.Deserialize(sr);

How can I make the code work in my Android Phone?

PS: It is C# , Unity.

sentences:
How to properly set up XNA shader? I'm trying to get a basic shader to work in XNA. I pass in a bool value called "TextureEnabled" to indicate whether or not it should expect some UV texture coordinates. But regardless of what I pass, it is always expecting the UV value, and it throws and InvalidOperationException -"TextureCoordinate0 is missing":

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;

float4 worldPosition = mul(input.Position, World);
float4x4 viewProjection = mul(View, Projection);
output.Position = mul(worldPosition, viewProjection);

if (TextureEnabled == true)
{
    output.UV = input.UV; //**// always executes**
}
else
{
    output.UV = float2(1, 0);
}

return output;

}

Here's the declaration at the top of the effect file:

float4x4 World;
float4x4 View;
float4x4 Projection;
texture BasicTexture;
bool TextureEnabled = false;

I'm even setting the effect parameter in my XNA Draw() method:

paramName = "TextureEnabled";
effect.Parameters[paramName].SetValue(false);

If I just hard-code output.UV = float2(1, 0) instead of output.UV = input.UV, it does not throw an exception, so I know that has to be the problem. Its almost like the TextureEnabled variable isn't getting set up (or not evaluated), even though I can see SetValue(false) being called in the debugger. What am I doing wrong?

Here's the relevant source files, if needed: http://www.mediafire.com/?g85tc5d9582vs8g

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:
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:
How to handle interactions between a sprite (player) and another sprite? What's the proper way, a proper way, or any proper way at all, to handle interactions between a sprite (usually a player) and another sprite (can be any other object)? (in a tile based world)

i.e. getting into a vehicle, talking with other character, reading signs, etc.

My first instinct is to have some kind of "feeler" or interaction rectangle that's always in front of the player in the direction the player is facing. Then if that rectangle overlaps some kind of intractable object (driver door on vehicle, other character, sign, etc) I would be able to initiate an interaction.

Is this a naive implementation?

EDIT

This is for a 2D engine, written in C# for Xbox Live Arcade and Windows.

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:
Is there a good existing starting point for realistic 2d racing car physics? I'm trying to get a realistic behaving racing car into my 2d top-down game.

Making a very simple car that drives around is straight forward but I want a reasonably sophisticated model that models Newtons laws and the forces on the car well and results in something great.

I searched the web for a good tutorial on how to do this but there doesn't seem to be much example code out there.

I followed this tutorial http://www.gamedev.net/topic/470497-2d-car-physics-tutorial/ which was very good and seems like a good starting point but if you have a play with the included demo you can see it still has a fair way to go before its a convincing racing car.

I hear that some 3d game engines like Unity come with a good starting vehicle model out of the box. Is there something like that out there for 2D?

Just want to make sure I am not missing some great existing 2d starting point I don't know about before I spend a LOT of time reading and figuring out all the correct forces etc needed to build my own from scratch.

This article seems to describe all the things you need: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but the source code links are broken unfortunately.

sentences: Unity using 40% GPU for just a UI interface on ultra but 90 on low? So I made some software using unity for my FRC team. All this application is, is just a User Interface with labels, input fields, buttons, etc... When I choose the quality to be on Ultra, I will get about 50% GPU usage but when on very low, I got 90%, close to 100%. How can I optimize my software to use much less of the GPU(Preferably less than 15%)? I am measuring with the Task Manager Performance Menu

sentences:
What is this JavaScript gibberish? I am studying how to make a 2D game with JavaScript by reading open source JavaScript games and I came across this gibberish...

aSpriteData = [
    "}\"¹-º\"À+º\"À+º\"À+º\"¿¤À ~C_ +º\"À+º\"À+º\"À*P7²OK%¾+½u_\"À<¡a¡a¡bM@±@ª",    //  0 ground
    "a ' ![± 7°³b£[mt<Nµ7z]~¨OR»[f_7l},tl},+}%XN²Sb[bl£[±%Y_¹ !@ $",        //  1 qbox
    "!A % @,[] ±}°@;µn¦&X£ <$ §¤ 8}}@Prc'U#Z'H'@· ¶\"is ¤&08@£(",           //  2 mario
    "  ´!A.@H#q8¸»e-½n®@±oW:&X¢a<&bbX~# }LWP41}k¬#3¨q#1f RQ@@:4@$",         //  3 mario jump
    "   40 q$!hWa-½n¦#_Y}a©,0#aaPw@=cmY<mq©GBagaq&@q#0§0t0¤ $",         //  4 mario run
    "+hP_@",                                    //  5 pipe left
    "¢,6< R¤",                                  //  6 pipe right
    "@ &  ,'+hP?>³®'©}[!»¹.¢_^¥y/pX¸#µ°=a¾½hP?>³®'©}[!»¹.¢_^  Ba a",        //  7 pipe top left
    "@ , !] \"º £] , 8O #7a&+¢ §²!cº 9] P &O ,4    e",              //  8 pipe top right
    " £ #! ,! P!!vawd/XO¤8¼'¤P½»¹²'9¨  \"P²Pa²(!¢5!N*(4´b!Gk(a",            //  9 goomba
    "   Xu X5 =ou!¯¬a[Z¼q.°u#|xv ¸··@=~^H'WOJ!¯¬a=Nu ²J <J   a",          // 10 coin  // yui
    "@ & !MX ~L \"y %P *¢ 5a K  w !L \"y %P *a%¬¢ 4  a",               // 11 ebox // yui
    "¢ ,\"²+aN!@ &7 }\"²+aN!XH # }\"²+aN!X%  8}\"²+aN!X%£@ (",          // 12 bricks
    "} %¿¢!N° I¨²*<P%.8\"h,!Cg r¥ H³a4X¢*<P%.H#I¬ :a!u !q",         // 13 block
    makeSpace(20) + "4a }@ }0 N( w$ }\" N! +aa",                    // 14 bush left
    " r \"²y!L%aN zPN NyN#²L}[/cy¾ N" + makeSpace(18) + "@",            // 15 bush mid
    makeSpace(18) + "++ !R·a!x6 &+6 87L ¢6 P+ 8+ (",                // 16 bush right
    " %©¦ +pq 7> \"³  s" + makeSpace(25) + "@",                 // 17 cloud bottom left
    "a/a_#².Q¥'¥b}8.£¨7!X\"K+5cqs%(" + makeSpace(18) + "0",             // 18 cloud bottom mid
    "bP ¢L P+ 8%a,*a%§@ J" + makeSpace(22) + "(",                   // 19 cloud bottom right
    "",         // 20 mushroom
    "", // koopa 16x24
    "",             // 22 star
    "",                         // 23 flagpole
    "",         // 24 flag
    "",                 // 25 flagpole top
    "  6  ~  }a }@ }0 }( }$ }\" }! } a} @} 0} (} $} \"² $",             // 26 hill slope
    "a } \"m %8 *P!MF 5la\"y %P" + makeSpace(18) + "(",             // 27 hill mid
    makeSpace(30) + "%\" t!DK \"q",                         // 28 hill top
    "",         // 29 castle bricks
    "",                         // 30 castle doorway bottom
    "",                 // 31 castle doorway top
    "",         // 32 castle top
    "",         // 33 castle top 2
    "",             // 34 castle window right
    "",             // 35 castle window left
    "",         // 36 castle flag
    makeSpace(19) + "8@# (9F*RSf.8  A¢$!¢040HD",                    // 37 goomba flat
    "     *(!¬#q³¡[_´Yp~¡=<¥g=&'PaS²¿ Sbq*<I#*£Ld%Ryd%¼½e8H8bf#0a",         // 38 mario dead
    "   =  ³ #b 'N¶ Z½Z Z½Z Z½Z Z½Z Z½Z Z½Z =[q ²@ ³  ¶   0",           // 39 coin step 1
    "   ?@ /q /e '¤ #³ !ºa }@ N0 ?( /e '¤ #³  ¿  _a  \"",               // 40 coin step 2
    "   /  >  ]  º !² #¢ %a +  >  ]  º !² #¢ 'a  \"",               // 41 coin step 3
    "   7¢ +² *] %> \"p !Ga t¢ I² 4º *] %> \"p  ¡  Oa  \""              // 42 coin step 4
],

What does it do? If you want to look at the source file, here it is. Beware, there is more gibberish inside. I can't seem to make sense of any of it.

sentences: Can glsl main() have params or return a value? I haven't ever seen anyone declare main as anything but void main() or void main(void) but I'm curious, is it possible to have a parameter or return value?

sentences:
let me know how to save an integer for game stage level? I am trying to make a game which there are many stages.
For example, If users are done stage 3 of the game, and then turn off the game,
they can play the game at stage 3 anytimes.

simply, I tried to make this logic, so when you press space bar, the level goes up.
However, after turning off and on, lev will start at 0.
I guess when program are ruining every single times, the lev is initialized 0.

I tried to use preference.

please let me know solutions..

AppPreferences.java

public class AppPreferences {

   private static final String PREFS_NAME = "Adventure";
   private static final String PREF_LEVEL = "Level";
   private Preferences preferences;

   protected Preferences getPrefs(){
    if (preferences == null)
        preferences = Gdx.app.getPreferences(PREFS_NAME);
       return preferences;
}

public void setPrefLevel(int level){
    getPrefs().putInteger(PREF_LEVEL,level);
    getPrefs().flush();
}

public int getPrefLevel(){
    return getPrefs().getInteger(PREF_LEVEL);
}

}

PlayScreen.java

public class PlayScreen implements Screen {
 int lev=0;

 public void render(float delta) {

     if(Gdx.input.isKeyJustPressed(Input.Keys.SPACE)){

        advanture.getPreferences().setPrefLevel(i);
        System.out.println(advanture.getPreferences().getPrefLevel()+"!!!!!!!!!");
        i++;
   }

 }

sentences:
Why is my variable seems to be non-existent in GameMaker? I find myself stuck again with a peculiar issue that I don't really understand.

I'm currently trying to implement a "weapon" into a shooter game (using it as a learning project), as I was (and still am) a total noob in programming since two month ago.

Here is the code pointed by the error message. I'll explain what I'm trying to do right after.

  if instance_exists(Player)
  {
    nbtarget=instance_number(ENEMY);
    var i;
    for (i=0;i<nbtarget;i++)
    {
      Target= instance_find(ENEMMY,i)

      if Target != noone
      {
        if Target.size <3 {hit=Target}
      }
      if hit != noone
      {
       if point_distance(x,y,hit.x,hit.y)<startradius
        {
          repeat(2)
          {draw_lightning(x, y, hit.x, hit.y,and other parameters)}

          if damageTik = true
          {
            DMG = instance_create(hit.x,hit.y,Obj_dmg)
            DMG.dmg = Current_dmg
          }
        }
      }
    }
  }
  damageTik= false;
}
else
{
  instance_destroy()
}

So, the behavior I was looking for is a lightning that targets every enemy within a radius around the player, only if the enemy size is smaller than 3. Also, the targeted enemy takes a certain damage per second.
Everything is working fine.

But, since I implemented that, when I test it, it works fine for a certain amount of time, and then I get this error:

FATAL ERROR in
action number 2
of Draw Event
for object lightning_weapon:
Unable to find any instance for object index '103752' name '<undefined>' at gml_Object_lightning_weapon_DrawEvent_2 (line 15) -if point_distance(x,y,hit.x,hit.y)<startradius

From what I understand, it looks like the instance referred to in the variable hit has been destroyed before running the code at line 15. But I'm checking if such instance exists just before (hit != noone), so how can this be? Any pointer will be appreciated.

I try to move the "instance_destroy()" part of the enemy code out from the Step Event (of the enemy parent object), I tried to move it in the End Step Event, then in the Begin Step Event, I even tried to make a variable to tell the enemy he is dead and destroy it in the next step... Nothing fixed my issue.

Maybe the problem is not with that part of the code, but after half a day looking at this I can't find any new thing to try.

I also try to do the same with a ds_list, but failed to make it work (only one enemy is hit by the lightning):

var target = ds_list_create();
with(ENEMY)
{
  if (point_distance(PLAYER.x,PLAYER.y,ENEMY.x,ENEMY.y) < other.radius)
  ds_list_add(target,ENEMY.id);
}

nbtarget = ds_list_size(target)
var i;
for (i=0;i<nbtarget;i++)
{
  hit = ds_list_find_value(target,i)
  if hit != noone
  {
    {draw_lightning(x, y, hit.x, hit.y,other parameters...)}
    if fire = true
    {
      DMG = instance_create(hit.x,hit.y,ODamage)
      DMG.dmg = dmg
    }
  }
}
fire = false;

If I manage to make one or the other to work, it's perfect.

sentences: Rotate point by a direction vector Given a vector, A, which represents a point, and a unit vector, B, which represents the looking direction, how would I rotate A so that B is the axis that's looked down on? Let's say the looking-axis is originally (0,0,1) and I want it to become B by rotating A accordingly. So it needs to rotate by (0,0,1) - B.

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:
Single or multiple inheritance for game world objects So I am currently laying out on paper the system I want to code for a game in C++.

Now currently I am debating whether to have e.g. a class object_door that inherits from another class object_interactive, which inturn inherits from the base class object

OR

have a class object_door that inherits from both the class object and another base class interactive.

Is there any advantage to either way of doing inheritance? Or is there maybe a commonplace convention for this?

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:
What is the correct way to reset and load new data into GL_ARRAY_BUFFER? I am using an array buffer for colors data. If I want to load different colors for the current mesh in real time what is the correct way to do it. At the moment I am doing:

glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, colorBuffer);
glBufferData(GL_ARRAY_BUFFER, SIZE, colorsData, GL_STATIC_DRAW);
glEnableVertexAttribArray(shader->attrib("color"));
glVertexAttribPointer(shader->attrib("color"), 3, GL_FLOAT, GL_TRUE, 0, NULL);
glBindBuffer(GL_ARRAY_BUFFER, 0);

It works, but I am not sure if this is good and efficient way to do it. What happens to the previous data ? Does it write on top of it ?

Do I need to call :

glDeleteBuffers(1, colorBuffer);
glGenBuffers(1, colorBuffer);

before transfering the new data into the buffer ?

sentences:
Quaternion.slerps resets camera rotation to (0,0,0) when i go to play mode help! i am building a camera rotation script like in fps. Everything is setup and working except that camera rotation resets to zero at the start of game which i dont want.
This is the camera rotation i have set:

This is rotation of character my script is attached to:

And after hitting play it resets camera rotation to (0,0,0). i want it to remain how i have set it in inspector. i am using quaternion.slerp to rotate camera around to rotations on the basis of touch inputs. After reset to (0,0,0) everything works fine.please help, i have always had a hard time understanding quaternions.

this is the script:

    public class ScreenCharacterController : MonoBehaviour {

     private Camera mainCamera;
     private CharacterController character;
     private int leftFingerID = -1;
     private int rightFingerID = -1;
     private Vector2 leftFingerInput;
     private Vector2 rightFingerInput;
     private float xAxisRotation;
     private float yAxisRotation;
     [SerializeField] private float minXRotation;
     [SerializeField] private float maxXRotation;
     [SerializeField] private float minYRotation = -25f;
     [SerializeField] private float maxYRotation = 25f;
     [SerializeField] private float cameraRotationSpeed = 20f;

     void Start()
     {
         mainCamera = Camera.main;
     }

     void Update()
     {
        //for touch
         TouchInput();

        //for calculating rotation vaues
         CalculateAndClampRotation();

         RotateCamera();
     }

     void TouchInput()
     {
         foreach (Touch touch in Input.touches)
         {
             if (touch.phase == TouchPhase.Began)
             {
                 //Left Touch
                 if (touch.position.x < Screen.width / 2)
                 {
                     leftFingerID = touch.fingerId;

                 }
                 //Right touch
                 else
                 {
                     rightFingerID = touch.fingerId;

                 }
             }
             else if (touch.phase == TouchPhase.Moved)
             {
                 //Left Touch
                 if (touch.position.x < Screen.width / 2)
                 {
                     if (leftFingerID == touch.fingerId)
                     {

                     }

                 }
                 //Right touch
                 else
                 {
                     if (rightFingerID == touch.fingerId)
                     {
                         rightFingerInput = touch.deltaPosition * Time.smoothDeltaTime;

                     }

                 }
             }
             else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
             {
                 if (touch.fingerId == leftFingerID)
                 {
                     leftFingerID = -1;

                 }
                 else if (touch.fingerId == rightFingerID)
                 {
                     rightFingerID = -1;
                     rightFingerInput = new Vector2(0, 0);
                 }

             }
         }
     }

 void RotateCamera()
     {
         Quaternion currentRotation = mainCamera.transform.localRotation;
         Quaternion targetRotation = Quaternion.identity;

         targetRotation = Quaternion.Euler((mainCamera.transform.localRotation.x - yAxisRotation),
         -(mainCamera.transform.localRotation.y - xAxisRotation), 0f);

         mainCamera.transform.localRotation = Quaternion.Slerp(currentRotation, targetRotation, 0.5f);

     }

     void CalculateAndClampRotation()
     {
         xAxisRotation += rightFingerInput.x * cameraRotationSpeed;
         yAxisRotation += rightFingerInput.y * cameraRotationSpeed;
         xAxisRotation = Mathf.Clamp(xAxisRotation, minXRotation, maxXRotation);
         yAxisRotation = Mathf.Clamp(yAxisRotation, minYRotation, maxYRotation);
     }

 }

sentences: Am I allowed to use a real life celebrity in a game? In previous questions many users asked whether or not an athlete can be used in a game. Yet the answer was no due to multiple copyright their images and names had. However anyone can use a politician's name and physical appearance due to the fact that they are "public figures" (example: Obama). In this case, I want to use famous game developers such as Kojima and Gabe Newell in a game. Am I allowed to use them? or should I make references to them using distinct names (I.E. Lord Gaben). How can I find out whether or not a person is a "public figure" and if their appearance/name is protected?.

sentences:
FormatMessage not working for HRESULTs returned by Direct3D 11 I am using Windows 7 x64 and Visual Studio 17 (v15.9.7).

Say I try to create a swap chain using IDXGIFactory2::CreateSwapChainForHwnd and pass in DXGI_SCALING_NONE. I will get the following message in debug output (if I have enabled Direct3D debugging):

DXGI ERROR: IDXGIFactory::CreateSwapChain: DXGI_SCALING_NONE is only supported on Win8 and beyond. DXGI_SWAP_CHAIN_DESC{ SwapChainType = ..._HWND, BufferDesc = DXGI_MODE_DESC1{Width = 816, Height = 488, RefreshRate = DXGI_RATIONAL{ Numerator = 0, Denominator = 1 }, Format = B8G8R8A8_UNORM, ScanlineOrdering = ..._UNSPECIFIED, Scaling = ..._UNSPECIFIED, Stereo = FALSE }, SampleDesc = DXGI_SAMPLE_DESC{ Count = 1, Quality = 0 }, BufferUsage = 0x20, BufferCount = 2, OutputWindow = 0x0000000000290738, Scaling = ..._NONE, Windowed = TRUE, SwapEffect = ..._FLIP_SEQUENTIAL, AlphaMode = ..._UNSPECIFIED, Flags = 0x0 } [ MISCELLANEOUS ERROR #175: ]

The function returns 0x887a0001 in form of a HRESULT. If I put @err,hr in the watch window, I get a nice error message there:

ERROR_MOD_NOT_FOUND : The specified module could not be found.

However, if I pass this HRESULT to FormatMessage, it just puts NULL in the output and returns 0. @err,hr helpfully informs me that the new error is ERROR_MR_MID_NOT_FOUND : The system cannot find message text for message number 0x%1 in the message file for %2.

My questions are:

Why is FormatMessage not giving me right error string (the one starting with ERROR_MOD_NOT_FOUND...)?
Where is Visual Studio getting these pretty error strings from?
Can I get them too? Who do I pay?

PS. I am using the Windows 10 SDK version of DX11, not the older DirectX SDK version. Thus, I can't really link to dxerr.lib either.

This is the code that is used to print the error message:

LPTSTR error_text = NULL;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
              FORMAT_MESSAGE_ALLOCATE_BUFFER |
              FORMAT_MESSAGE_IGNORE_INSERTS,
              NULL,
              hr,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
              (LPTSTR)&error_text, 0,
              NULL);

sentences:
Move a 2D sprite into an irregular terrain With a tile based engine, in my knowledge, is not possible to move a sprite into an irregular terrain. So which are the techniques to use for implementing that?
Maybe an hexagonal tile based engine?

sentences:
Panda3D documentation, manual, and tutorials for offline viewing? Is there a way to get the Panda3D's manual and tutorials available for offline viewing? I'm going on a business trip and I will spend a good deal of time at the airports and on long flights. I'd love to get started on Panda3D while in flight. Is there a way to get all that information available for offline, or use some program to download the tutorials and manual webpages?

Thanks

sentences:
How can I load all of my scenes at startup? I want all of my scenes to load when the loading screen is shown (but only one
should be shown at a time) so I can switch between them quickly I have tried
this:

if (Application.GetStreamProgressForLevel (2) == 1) {
    Application.LoadLevel (2); Application.LoadLevelAdditive (1);

and:

(Application.GetStreamProgressForLevel (2) == 1) {
Application.LoadLevelAdditive (2);
Application.LoadLevelAdditive (1);
Application.LoadLevel (1)

sentences:
How to move a Line Renderer as its game object moves I created an empty game object and added a Line Renderer component to it through a script. I thought that once I adjust the position of the game object, it would do likewise for the line rendeder, but that is not the case.

I tried useWorldSpace = false but it totally changed the positions making the following points a straight line, though I was able to move the game object to to the line.

public Vector3 beginPos = new Vector3 (-1.0f, -1.0f, 0);
public Vector3 endPos = new Vector3 (1.0f, 1.0f, 0);

Is there a way I can convert points to input what I am more familiar with (so that points like the above points don't create a straight line) or should I be approaching the problem in a different way? I am open to a different approach.

UPDATE

I think I left an import detail. I'll be using lines made with line renderer to create shapes. So I need to be able to be able to move the lines around to move the shapes so I don't have to always recalculate the start and end points for the lines.

sentences:
Dividing Data and Logic in Unity I am currently working on a small side project (as usual), and trying to build up from previous experiences.

I have the following elements in the game:
1) Region: which contain a "food" target that has to be met
2) Location: Each region has a few location, where crops can be sown
3) Crop: A variety of crops with different effects

I currently have a system where I have a Region monobehaviour script that only considers the production of food from the crops.
The location monobehaviour, stores the current state of the location, namely what crop is currently on it and how much food is currently available.
I also have all the food production logic on that script.
The crop scripts are scriptable objects with different food production rates and water consumption values.

I run into a problem when I started to want to add other types of elements to the location, or rather, have crops that don't necessarily produce food but have another effect on the game.

I decided to build another system, where instead of having the logic that triggers the various methods on the location script (for example the ProduceFood(), SendFood(), ReceiveFood()) within the location script itself or via hard links from UI elements.

This new systems is centred on Action scriptableObjects that can be added to the Crop scriptableobjects. The action script contains an Act(Location loc) method as well as a SetUp(Location loc) and Disable(Location loc). I can now customise how and when the ProduceFood(), SendFood(), ReceiveFood(), etc methods on the location script get called. For example the ProduceAction will add the Act method to a delegate event on the location script that triggers when a global OnProduction event gets triggered. Similarly, my hard UI links now point to a method on the location script called UITriggerAction(int index) which triggers the Act method registered to a delegate array on the location script.

Now each time a change the crop at a location I call the Disable method on all the Actions of the current crop, then I replace the crop and call the SetUp method on it, which will either register the associated Act method to the array accessible from UI, or to some other custom event.

The Act methods would be simple and look like:

Act(Location loc)
{
    loc.Produce();
}

or

Act(Location loc)
{
    if(loc.HasProduced())
    {
        loc.SendFood();
    }
}

By doing it this way I keep the variables specific to the location on the location script as well as the logic on it. In addition I avoid any dependency between the current crop at a location and the rest of the game. For example I could have a method from the Region script, that would check all the currentFood values on the locations, and it would still work even if the crop at that location doesn't impact the currentFood value at that location.

int AvailableFood()
{
    int availableFood = 0;
    for (i = 0; i < loactions.Length; i++)
    {
        availableFood += loactions[i].currentFood;
    }
    return availableFood;
}

I just control the way in which I call those methods using a more versatile system.

My question is: Is this likely to lead to a very messy code on the location script where I will have all the variables and all the methods to do everything?

Do you have any suggestions on how I can improve that system?

Supporting code:

class Location : MonoBehaviour
{

    Region parentRegion;
    Crop currentCrop;
    public int currentFood;
    int maxFood;

    public delegate CropAction(Location loc);
    public CropAction[] actions = new CropAction[6] // 6 possible actions accessible from UI

    public void UITriggerAction(int index) { actions[index](this);  }

    public void Produce() { // Do stuff   }
    public void SendFood() { // Do stuff   }
    public void RecieveFood() { // Do stuff   }
    public void UseWater() { // Do stuff   }
    public bool HasProduced() { return currentFood > 0;  }

    public AddCrop(Crop crop)
    {
        loc.Produce();
    }
}

sentences: Java LWJGL - How can I add water to my 3d world? The title says it all, how can I implement a simplistic water system into my game? I am using Java LWJGL and OpenGL glsl shaders. I am still fairly new to game programming, and a complete noob in the use of shaders so some guidance and a thorough explanation would be great!

sentences:
How can I have margins or padding around a texture in libgdx? I am building a game using libgdx a 2048 like game and I draw the tiles of the board using textures (each texture represents a tile with the number 2 or 4 etc.)

I would like tohave a small space around the square textures. How can I do this ?

Thanks.

sentences:
Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie)
I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided.

(In Short: I know that polygons eat performance. I want to know why they eat performance)

So my question would be:
What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?.
If possible i would like to have some links to sites containig this information.

sentences:
How do I make a curved surface out of rectangular blocks? For a Peggle-like game, I want to make blocks that follow a curve, like this:

The blocks would then disappear as the ball hits them.

I managed to draw some horizontally, but I'm having trouble making them follow a path:

How do I do this? Do I need to create Box2D objects with custom vertices?

sentences:
Why it's not adding gaps between the prefabs? gap value is 7 but all the prefabs Instantiated at 0,0,0
private void GenerateLines()
    {
        for (int i = 0; i < numberOfLines; i++)
        {
            var prefab = Instantiate(linesPointsPrefab, Vector3.zero, Quaternion.identity);

            prefab.transform.position = new Vector3(prefab.transform.position.x * gap, prefab.transform.position.y * gap, prefab.transform.position.z * gap);
            prefab.transform.parent = linesParent.transform;
        }
    }

After added gaps between the prefabs it's creating lines using linerenderer between the prefabs. then when I drag the prefabs around it's making curved lines and then the NAVI object can move on the curved lines :

It was working before too but I wanted to generate the curved lines automatic.
So with the gaps I can drag the prefabs around and make curved lines and next I will add automatic random positions option too so it will make the curved lines already.

sentences:
How to Create Snakelike Objects I am working on a 2D action platformer in Python, though my question is a general one about creating snakelike objects which move in a variety of patterns.

I have noticed this kind of object in many 2D games. For example, this boss in Contra has snakelike arms.

And this enemy from Super Metroid clearly seems to be composed of multiple segments.

I want to create snakelike objects in my game, though I don't know where to begin or what I may need to add to my physics engine to support them.

So far, all my enemies and hazards consist of single sprites and are programmed using simple attributes like velocity, acceleration, parametric curves, etc.

Maybe I need to create a class for the segments, designate one segment instance as the leader, and update the positions of the  other segments based on the position of the segment in front of it. But how do I program different patterns of movement? Do I need to learn about so-called joints and implement them between the segments? I currently don't have them in my engine.

I know I could easily create a segmented object where each non-leader segment is moved to the previous position of the segment in front of it (like in classic Snake, described here), but I want more complex patterns than this. Sometimes I may want the object to be flailing from an anchored point, and other times I may want it to be following some pattern across the screen.

I really don't know where to begin in trying to create this kind of object and would greatly appreciate any advice.

How do you implement snakelike objects with a variety of movement patterns?

(Given the ubiquity of this kind of object in games, I was surprised that I couldn't easily find much about it online. I think a detailed write-up on it would be cool.)

sentences:
How can I register Mouse Events in the Scene window of the Editor? I want to create a custom level editor for the level designers that should allow them to place predefined objects in Unity3d similar to the Terrain wizard.

How can I register Mouse Events in the Scene window of the Editor?

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:
Does Google Play allow an account to log in to the same game on 2 devices? I'm developing an online Android game with Unity. I want all Google Play accounts to have only one session logged in at a time.

Do I need to write my own code to disconnect an existing session on new login attempts, or does Google Play already handle this?

Edit:

An idea popped to my mind. I can save the logged in device's state to a a file on Google's Saved Games cloud, and write an instance-specific identifier to that file that indicates who has logged on last. And checking file constantly on all instances will allow me to disconnect instances whose identifier doesn't match the one on the file on the cloud.

Do you think this is a good idea? I mean, fetching file from cloud every second or so?

sentences:
UE4 Navmesh precision I'm trying to make my very tiny man pathfind his way through a map of a school but the navmash won't recognize some of the hallways cause they are very narrow like this.

So as you can see the man can fit but the navmesh says no so can anyone help and keep in mind that i am very new to unreal engine so please make your explanation easy to understand.

sentences: How could a NPC find items that appear randomly? My main question is basically: What is the algorithm that CPU players use in smash bros to find items like the smash ball? I am trying to make a small ai character that will "look around" and once an item appears it will find it and walk to it. In all smash bros the cpu players are able to find items on the stage when they appear. How do they do this?

sentences:
How to fix lag in 64 bit Android devices My game's FPS drops to 30 - 8 FPS on any 64 bit Android device but is at 59 - 60 FPS on an even lesser 32 bit Android device.
I've tried unchecking Development Build on Build settings and I've tried disabling debug calls on my game by using:
void Update ()
{
#if UNITY_EDITOR
if(!Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = true;
#else
if(Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = false;
#endif
}

But there wasn't any change. And I tried setting all Stack Trace Log type to None(Edit > Project Settings > Player). Also no change.
PS: I used that update call because there are other imported assets that call the Debug class and I wouldn't want to mess around with their classes.
EDIT: As you can see in the screenshots below, the device that runs the game at less than 30 FPS(every 64 bit device) has Gfx.WaitForPresentOnGfxThread take 71.6% of the frames and RenderPipelineManager.DoRenderLoop_Internal() takes up 51.1%. While the device that ran the game at 60FPS(every 32 bit device) has RenderPipelineManager.DoRenderLoop_Internal() take up the most frames with 35.7% of the frame.
How should I fix the frame rate drop on the 64 bit device?

EDIT:
The 32 bit Android device is an Infinix Hot 4, 2GB RAM, 1.3GHz quad-core MediaTek MT6580 CPU, OpenGLES2, Android 7.0, 1280x720. - This reaches a maximum of 62FPS(Average 59FPS).
The 64 bit Android devices are:

Cubot X19 - 4GB RAM, [8 core CPU: 4x 2.3 GHz ARM Cortex-A53, 4x 1.65 GHz ARM Cortex-A53], OpenGLES3, Vulkan supported, Android 9.0, 2160x1080. - This reaches a maximum of 30 FPS(Average 25FPS).
Qubo P19 - 3GB RAM, 1.5GHz Quad-Core MT6739WA CPU, OpenGLES2, OpenGLES3 supported, Android 9.0, 1280x640. - This reaches a maximum of 25FPS(Average 19FPS).

I'm using Unity 2019.3.1f for my project.

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:
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:
Sound activated particlesystem I am trying to make a particle system that is activated by sound. Like emitting on the beat resizing on the beat and such things.  I found some nice tutorials on how to make things like Windowsmediaplayer visualsynths but they dont really help me to convert it to a particle system.

Anysuggestions how i could do this ?

sentences:
Convert a string to a gameobject name I want to use a string to reference a gameobject that I already have in my code, but the console says that you can't convert a string to unityengine.object. I have a string that says aaaa and a gameobject that has the name aaaa.
using System.Collections.Generic;
using UnityEngine;

public class WorldRenderer : MonoBehaviour
{

    public Transform Tile;

    string seed = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaabaaaaaaaa";

    public int worldHeight;
    public int worldWidth;

    private int seedSub = 0;

    public GameObject aaaa;
    public GameObject aaab;
    public GameObject aaac;

    void Start()
    {

        transform.position = new Vector3(worldWidth / 2 * -0.64f + 0.32f, worldHeight / 2 * 0.64f + 0.32f);

        for (int height = 0; height < worldHeight; height++)
        {

            transform.position = new Vector3(worldWidth / 2 * -0.64f - 0.32f, transform.position.y);
            transform.position = transform.position - new Vector3(0, 0.64f);

            for (int width = 0; width < worldWidth; width++)
            {

                seedSub = seedSub + 1;

                transform.position = transform.position + new Vector3(0.64f, 0);
                //Here's the problem VVV
                GameObject tilepos = Instantiate(seed.Substring(seedSub * 4 - 3, 4)) as GameObject;
                //Here's the problem ^^^
                tilepos.transform.position = new Vector2(transform.position.x, transform.position.y);

            }

        }

    }

}```

sentences:
Clipping speed when turning without using aggressive drag I have a Unity project in which I want to control a player in a similar way to Source games, and so far I am clipping each input to the speed in the player's coordinates, by using
transform.InverseTransformDirection( GetComponent<Rigidbody>().velocity )

after which I pass each of the player's input vector direction through this function:
private float FLSMF ( float aInputVelocity, float aMaximumVelocityOnAxis, float aSpeedOnAxis ) {
    if ( Mod( aSpeedOnAxis ) >= aMaximumVelocityOnAxis ) {
        if( Sign( aSpeedOnAxis ) != Sign ( aInputVelocity ) ) {
            if ( Mod( aSpeedOnAxis + aInputVelocity ) > aMaximumVelocityOnAxis ) {
                return Sign ( aInputVelocity ) * ( aMaximumVelocityOnAxis + Mod( aSpeedOnAxis ) );
            }
            return aInputVelocity;
        }
        return 0;
    }
    if( Mod( aSpeedOnAxis + aInputVelocity ) > aMaximumVelocityOnAxis ) {
        return Sign( aInputVelocity ) * ( aMaximumVelocityOnAxis - Mod( aSpeedOnAxis ) );
    }
    return aInputVelocity;
}

There is only one problem: whenever I turn and strafe and walk forwards or backwards, the speed increases dramatically. I tried solving it by comparing each processed velocity axis to the velocity rotated by the difference in the rotations between the last 2 FixedUpdate's. So far nothing worked, aside from driving the drag factor through the roof.
My best guess is that when turning, the unclipped X axis of the vector bleeds into the Z axis when turning, which can't add anything, but cant stop the X axis from interfering because the forward key is pressed.
There is no issue when only one of the input axis are used, the speed remaining consistent when turning.
I tried to implement this function especially so I don't have to use any drag, to allow the player to be flung by other things, like grapples and explosions (this issue is present irrespective of said external factors).
If you want to, I will share the entire code, but it's messy and I don't think it would help.
Any ideas how to solve it?
Edit: yes, I have normalized the input vector. The speed increases to more than triple of the maximum, in as few as 2 turns.

sentences:
Unity HDRP transparent material back-face rendering/front face culling I try to render an object with 2 different transparent materials. One should only render the back faces (higher opacity/more color) and one only the front faces (lower opacity/less color). The purpose is to show another object inside the mesh better, while keeping the more saturated color on the back faces.
I tried to only render the back faces using a  shader graph, but it seems to be impossible to only render back faces with TRANSPARENT material. With opaque materials, it was not a problem to isolate the back faces.
Is there a way to only render back faces of a transparent material, and overlap them with another material that only renders front faces?
(btw. this is the model, I need it for. The bones should pretty much preserve their details/color, while the jello is a rich green (screenshot from blender))

Any help is very appreciated!
Thank you!

sentences:
Game Maker: How do I make a score display move with the view? I have drawn everything needed to the screen including a HUD for the score, but I have my room set to follow my player: When the camera follows the player, the score HUD stays doesn't scroll with him!

How do I make the score display follow along with the player also?

sentences: How do I exchange information between JavaScript front end and C++ back end? I am trying to make a chess like 2-player game that has game logic written in C++ and front end in JavaScript. How do I exchange information between the two? I am not familiar with network programming, so resources regarding that would be helpful as well.

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:
Where should I save game object's attributes (hp, score) in Swift? Scenario: I have a game with several game objects on screen. Each can have different score and hitpoints. When I use collision detection for cannonball vs. ship (example) I need to know which ship is hit and how much hitpoints it has.

Problem: I had several approaches from extending SKSpriteNode or SKPhysicsBody but all failed. SKSpriteNode doesn't work, because Swifts collision detection only returns physicsBody and since you can't extend physicsBody, it didn't work to save there ships attributes as well.

Question: What would be a good approach to save such data to my game objects? I do not need code - because I think I can write it myself - but I would be happy to read a good suggestion. But if you have already some code written and a good solution for this problem, I would not be angry to read it ;)

sentences:
Frame Rate Independence for Non-Linear Increases So while working on my game, I decided that I would have a speed variable increase in the fashion

speed += 1/speed;

with the goal being that in the beginning it increases fast and then it increases slow as it gets higher. However this is being called each frame and I need to make it framerate independent, however just scaling it based on time doesn't give the same results throughout. How would I go about creating a framerate independent increase that dampens like this?

sentences:
LibGDX: Can i get some useful tips for loading textures? So basically in my game(completely new to gave dev) I have a level select screen. I have 8 Buttons to select the levels and i use an asset manager to load the textures for the buttons. For example their is a locked button for when you have unlocked the level, an active for when your mouse is over the button and inactive when your mouse is not over it. My problem is that having all these textures keep interchanging is causing memory usage to go off the charts, from as low as 30mb all the way over 1000mb as soon as i go to the level select screen and it keeps rising. Whats a good way to load lots of textures without having to use so much memory? Or should i just figure out a better way to load them without causing so much usage of memory. Im new to this so go easy on me :)

or... Would this amount of memory being sprung be a memory leak somewhere?

Edit: Heres the code snippet where the memory leak i traced to i believe.

I'm calling this method in my handleInput which i then call in the render method.

public void levelManager(float rowX, float rowY, Screen setScreen, Texture drawActive, Texture drawInactive,
        float multiplier) {
    if (Gdx.input.getX() / GravitySpikesRevamped.PPM < (rowX + BUTTON_WIDTH) / GravitySpikesRevamped.PPM
            && Gdx.input.getX() / GravitySpikesRevamped.PPM > rowX / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY())
                    / GravitySpikesRevamped.PPM < (rowY + BUTTON_HEIGHT) / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY()) / GravitySpikesRevamped.PPM > rowY
                    / GravitySpikesRevamped.PPM) {

        if (multiplier == 1) {
            game.batch.draw(drawActive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }

        if (Gdx.input.isTouched()) {
            game.setScreen(setScreen);
        }
    } else {

        if (multiplier == 1) {
            game.batch.draw(drawInactive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }
    }

Okay i solved it, basically in my method above every time i called it was creating a new screen. So i basically was creating infinite amount screens in memory. I fixed it :]

sentences:
can't get File Open screen to appear in Blender? (screenshot attached) Just starting out with blender. Did something and now I can't work out how to get the basic File Open screen to appear. Have been trying for a while.

Anyone able to tell me what to do to get back to the basic File Open screen, i.e. the one at http://wiki.blender.org/index.php/Doc:2.6/Manual/Data_System/Files/Open

Here's what I'm seeing:

sentences:
Problem rendering a Wavefront mesh, nothing displays(VBO) I'm having a problem with displaying my wavefront obj file using VBO's My fps counter slows down like there is something being drawn but I cannot see anything. Is it a problem with my loader? Or maybe just a simple bug in my VBO rendering code?

I have checked that I am actually loading the data but maybe it's in the wrong order. I used OpenGL profiler and found nothing specious the texture and the VBO and IBO are in the GPU. I did try two different obj files, one of mine and a random one I found on NASA's site both rendered at the same speed(about 60 fps) with nothing on the screen. If you want any output from OpenGL profiler ask me.

BlockRender.cpp
http://pastebin.com/3KuuWX9H

Renderer.cpp
http://pastebin.com/gDCvi3t7

Relevant snippets of code
http://pastebin.com/rTqRzYXL

Sample wavefront obj file
http://pastebin.com/qVJ55gwn

sentences:
Hierarchical state machines I have a rather simple state machine to control my Unity character and as the actions the character can perform increase, so does the complexity of state management, I have been reading about hierarchical state machines, they seem like the answer to my problems but I cannot 'connect' the theory to actual implementation, take for example the below Movement State
public class Player_Movement : BaseState
{
    public Player_Movement(PlayerController playerController, EntityStateMachine_Comp entityStateMachineComponent) : base(playerController, entityStateMachineComponent)
    {

    }

    public override void OnEnter()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", true);
        _playerController.GetComponent<Cast_Component>().OnCastReady.AddListener(() =>
        {
            _stateMachineController.ChangeToState(new Player_Movement_Casting(_playerController, _stateMachineController));
        });
    }

    public override void OnExit()
    {
        _playerController.GetComponent<Animator>().SetBool("IsMoving", false);
    }

    public override void OnFixedUpdate(StateMachineContext _context)
    {
        //If movement input is zero
        if (_playerController.PlayerInput.inputData.Movement.Input == Vector3.zero)
        {
            _stateMachineController.ChangeToState(new Player_Idle_State(_playerController, _stateMachineController));
        }
        else
        {
            _playerController.motor.MoveAndRotateTowards(_playerController.PlayerInput.inputData.Movement.Input_CameraRelative);
        }
    }

    public override void OnUpdate(StateMachineContext _context)
    {
        if (Input.GetKey(KeyCode.LeftShift))
        {
            _playerController.motor.IsSprinting = true;
            _playerController.motor.Speed = _playerController.motor.walkSpeed * _playerController.motor.sprintSpreedModifier;
        }
        else
        {
            _playerController.motor.IsSprinting = false;
            _playerController.motor.Speed = _playerController.motor.walkSpeed;
        }

        if (!_playerController.motor.IsGrounded && _playerController.Rigidbody.velocity.y < 0)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Falling_State(_playerController, _stateMachineController));
        }

        if (Input.GetKeyDown(KeyCode.Space) && _playerController.motor.IsGrounded)
        {
            _stateMachineController.ChangeToState(new Player_Locomotion_Jump_State(_playerController, _stateMachineController));
        }
    }
}

My current goal is to have this become my super state for my movement state machine, I would like to add a sub state to this (Cast Movement) that simply calls _playerController.motor.Move instead of _playerController.motor.MoveAndRotateTowards as I would like to have a different style of movement while aiming a spell, but how would I write this substate so that it only handles how the character moves and falls back on the super state for everything else?
I have the feeling I have to re-write how my state machine works but I have no idea where to start except I probably need to seperate transitions out of the states themselves? perhaps? haha

sentences:
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:
Subtract a circle on a rectangle - OpenGL I am writing a game using GLFW, GLEW, GLM and Bullet3 in C++. Its a Maze with holes. I am doing the floor with rectangles (wich is 2 GL_TRIANGLES).

I want to make some woles (circles), to the ball fall out of the board. What the best way to do that? How can I subtract a circle to the floor? And add the shape to the Bullet3?

Thanks

sentences:
Is there a way to view all colliders in a unity project at runtime (after the game have been deployed)? I'm have created a small Unity project but physics has weird behavior (bug). Unfortunately it only happens on some specific hardware (after build), not on development machine.

I don't know what is the reason it's probably due to different framerate. Viewing all object and their colliders would probably help me a lot.

Is there a possibility in Unity to view all colliders in the game at run time (some kind of debug mode). Something similar as Game tab view in Unity with Gizmos option enabled, but for all objects ?

sentences: 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 can I use GPL software like Stockfish Chess Engine in my Unity game? I am working on a 3D Chess game and I want to implement an A.I bot to play with the player. I found a chess engine called Stockfish which serves this purpose, and I would like to implement that engine in my project.

Is it as simple as including the Stockfish code in my project or importing a binary as a plugin, or do I have to do something more complex because of the GPL licence?

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:
What is the technology behind screen sharing? Came across an app called Draw N Guess(iTunes link) and the app uses screen sharing, i.e what a player draws is visible to others. I'm wondering how they are doing it in real time. I believe it is a cross-platform app. I got curios to know what is the technology behind it! It must be very interesting to learn :)

P.S. If this is not the site to ask plain question (i.e unrelated to programming), can you let me know where I can ask such questions? TIY!

sentences:
How to convert screen space into 3D world space? I am trying to make a 3D model to look at the mouse position. Currently I have this code:

MouseState mouseState = Mouse.GetState();

Matrix world = Matrix.CreateTranslation(0, 0, 0);

Vector3 source = new Vector3((float) mouseState.X, 1f, (float) mouseState.Y);
Vector3 mousePoint = GraphicsDevice.Viewport.Unproject(source, this.game.Camera.Projection, this.game.Camera.View, world);

System.Console.Out.WriteLine("x: " + mousePoint.X + ", Y: " + mousePoint.Y + ", Z: " + mousePoint.Z);

I get output such as this in the console:

x: 0.1787011, Y: 999.7204, Z: 299.7723
x: 0.08917224, Y: 999.8602, Z: 299.8862
x: 0.05908892, Y: 999.9069, Z: 299.9241
x: 0.04422692, Y: 999.9302, Z: 299.9431
x: 0.03303542, Y: 999.9477, Z: 299.9573
x: 0.03109217, Y: 999.9508, Z: 299.9598
x: 0.02930491, Y: 999.9535, Z: 299.9621
x: 0.02770578, Y: 999.9559, Z: 299.9641
x: 0.0263205, Y: 999.9581, Z: 299.9659

The player is positioned at Vector3.Zero. The camera is positioned at new Vector3(0.0f, 1000.0f, 300.0f).

I would like to get output such as X: -300, Y: 0, Z: -300 when moving the mouse to screen top left and when moving the mouse to screen center where the model is located I want to have X: 0, Y: 0, Z: 0. So I want the world coordinates of the mouse so that I can make the player rotate towards the mouse.

Basically I want to map mouse X into world X, mouse Y to world Z and the world Y coordinate can be 0 at all times.

sentences:
Moving AI in a multiplayer game I've been programming a multiplayer game and its coming together very nicely. It uses both TCP and UDP (UDP for movement and TCP for just about everything else). What I was wondering was how I would go about sending multiple moving AI without much lag. At first I used TCP for everything and it was very slow when people moved. I'm currently using a butchered version of this http://corvstudios.com/tutorials/udpMultiplayer.php for my movement system and I'm wondering what the best method of sending AI movements is.
By movements I mean the AI chooses left/right/up/down and the player can see this happening.

Thanks.

sentences:
Swift get the true date I have a game and want to reward the user for going on every day. I want to be able to get the true date somehow. I do not want the device date, because the user could just change it and get free rewards. Is there a way for me to access the true date from apple time or something like that?

Thanks

sentences:
creating a simulation game,  what type of knowledge is needed? I am a beginner in game development. As a part of learning and fun, want to create a game in java-script and html5. I am planning a game that we were used to play in childhood, that is "new business"- a monopoly game, in that we used to buy ,rent,sell places and bank we get some money to play and etc. are features. Its just simple ludo like game.

So can anyone suggest me from where to start? what will be the designing?

Is it possible to create it only in a html5 and java-script.

sentences: Need advice concerning the creation of open world game in Unity 3D I just wanted to ask for advice those being an expert in Unity 3d and overall in game industry about how it is possible to create an open-world game by means of Unity 3D, that is, I already tried to combine several tiles of terrains, 4 to be exact, and their respective size is 500x500. However, once I started to add the fifth terrain to those terrains, Unity stopped working. Moreover, another problem that I faced was with light mapping in Unity, that is, the more terrain I add to the scene the more it is difficult to bake the light mapping. The question is if I am doing correctly by adding terrains to each other and how open-world games are actually created. Yes, I heard of chunk loading but is it possible to code it on my own without using ready plugins. Lastly, Is it possible to combine tiles of terrains just manually without using any tools like Terrain Slicing kit or Gaia please I really need your help Thank you for your attention))).

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:
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:
Moving gameobject with animation according to my script Unity3D I am developing a game with Unity3D with an horizontal list of elements which you can move with arrows. Here you can see an example:

I have created animations in order to modify the alpha value of the elements and to move them according to my script:

void Update () {
    if (managePositionInUpdate) {
        transform.position = Camera.main.ScreenToWorldPoint (new Vector3 (Screen.width * positionX, Screen.height * positionY, 10));
    }
}

In my animation, the alpha value of the centered element is initially 1 and after the animation the alpha value is 0.5, this works correctly; however, in this animation I have also put positionX of my script initially with a value A, and after the animation with a value B, and this doesn't work correctly.

I have tested the code and it works correctly without animation, but I can't get it works according to my animation. What can I do? I have read about apply root motion but It also doesn't work for me.

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

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

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

sentences:
Move a sprite in a sine wave along different angles I understand this piece of code

Enemy.position.Y = StartPosition.Y + (-(float)Math.Cos(position.X / 100) * 100);

However it only works along the X axis. What I want to be able to do is move it along an arbitrary axis; Set an angle as the x axis.
How would I go about this?

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:
Loading models with opengl I'm developing a video game using OpenGL as graphic API and C++ programming language, and I'm creating all models with blender.

One question I have is how you deal with models (vertices), I mean, once you have created a model and want to load them with OpenGL you use hard-coded or a software module to load them on runtime?.

sentences:
How do I upscale my scene to a larger viewport? I want to:

Render my scene to a small viewport (some divisor of the full screen size).
Stretch the rendered image to cover the full screen size.

For example I want to render a complex, very slow scene at 960x520 and then stretch the resulting image over a full 1920x1040 screen.

Texture2D.LoadTextureFromTexture() can achieve that result, but is incredibly slow (far, far too slow for gaming). Similarly, Device.CopySubresourceRegion() or Device.CopyResource() copies the pixels exactly based on the size of the image, so they don't stretch at all and a 960x520 image will simply take up a corner of the full screen.

I could render the texture onto a quad, but I wanted to know if there was a way to do this programmatically before writing a shader just to stretch an image.

sentences: fade/transparence for object by shader graph? I'm trying to make a simple fade/transparence for my object using shader graph. I got a result with dither but I don't like it. I want something smooth without dots. How to get it?

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:
Struggling to get AI to repeat infinitely I am following this as a guideline to help me figure out a simple AI for an enemy as I am new to java.

https://www.javacodegeeks.com/2014/08/game-ai-an-introduction-to-behaviour-trees.html

https://github.com/obviam/behavior-trees/tree/master/src/net/obviam/bt

I am calling this function:

AI goombaBrain = Routines.selector(Routines.repeatInfinite(Routines.wander(Board.board, InitObject.goomba)));

InitObject.goomba.setRoutine(goombaBrain);

But once it finishes wandering to a random location once it doesn't automatically reset. Any ideas? if you need any more information let me know. (InitObject.goomba is the enemy)

sentences:
XInputDotNet not working when building for UWP in Unity I am working on a game where a controller has to vibrate. I have found the XInputDotNet plugin which worked very well in the editor and a normal windows build, but if I build for UWP (both Xaml and D3D) the controller doesn't vibrate.

When building in unity for UWP it also gave me an error saying this:

Plugin 'XInputInterface.dll' is used from several locations:
Assets/Plugins/x86/XInputInterface.dll would be copied to
<PluginPath>/XInputInterface.dll
Assets/Plugins/XInputInterface.dll would be copied to
<PluginPath>/XInputInterface.dll
Plugin 'XInputDotNetPure.dll' is used from several locations:
 Assets/Plugins/x86/XInputDotNetPure.dll would be copied to
<PluginPath>/XInputDotNetPure.dll
 Assets/Plugins/x86_64/XInputDotNetPure.dll would be copied to
<PluginPath>/XInputDotNetPure.dll
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at
C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.HostView:OnGUI()

The only way I found to remedy this is by deleting one of the plugin folders.

I tried manually copying the ddl's to the build folder, but this didn't help. I tried using the 32 bit dll's and the 64 bit dll's, I tried building for x86 and x64 and I tried all three modes in visual studio(Debug,Master,Release).

I found some links to the Windows.Gaming.Input namespace, but I dont't know if it is possible to add this namespace to unity and if so how.

Does anybody have an idea how to fix my problem?

sentences:
Detect Open Space in Farseer Possible Duplicate:
  How do I detect ledges?

I'm working on a 2D platformer using XNA and Farseer. I would like the player's character to be able to grab and climb up ledges. Detecting a collision between the player and the side of a wall is simple enough with the OnCollision delegate, but I have to admit I'm a bit stumped on how to detect that there's enough clearance for the PC to mount the ledge.

Essentially, I want to ensure there's an appropriately sized rectangle above and to the left or right of the PC (depending on their direction) and I'm not sure how I would check for such a space.

Any suggestions on how to determine there is nothing in the simulated world within some bounding rectangle?

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:
How can I render cloud patterns like in these examples? I have a quick question.

I see in many games, usually in the menu, some moving "clouds" in the background, apparently additive blended into each other, which does a really nice job immersing the player, in my opinion.

A couple of examples that jump to mind right now are the Far Cry 3 main menu background: https://www.youtube.com/watch?v=B5XcMx3GjPA

and the Plague Inc main menu background: https://www.youtube.com/watch?v=RQv60ywrLxU (the first seconds show it)

These cloudy patterns seem like some kind of noise to me, like Perlin or other. So, how would you proceed to achieve that kind of blurred cloud effect with vivid colors?

More specifically, would you pre-generate sets of clouds and include them in the game package? Or generate them on-the-fly? On the CPU as a regular texture or on-draw in the GPU shader program?

I am interested in mastering this kind of visual effect, and as such any help would be appreciated pointing me in the right way. Thanks.

sentences:
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:
Game Design Patterns ( think GOF ) literature? Possible Duplicate:
  What are some programming design patterns that are useful in game development?

Is there any literature on game design patterns? I'm taking a software design class and would like to learn how some of these design patterns would apply to game development.

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: What is a good clock implementation for a multiplayer game? In cases where players need to send out their times for game state sync, can everyone send out their default timestamp implementation or should something like NTP be used? http://en.wikipedia.org/wiki/Network_Time_Protocol

sentences: Game Development Degree vs Computer Science Degree I'm at the point in my life where I'm starting to look at schools, and was hearing a lot of mixed things about schools such as Digipen or Fullsail that target game development specifically. As someone who is planning on becoming a programmer and getting into the games industry, would getting a game development degree be better than a traditional computer science degree?

sentences:
Distance between two points with staggered isometric coordinate system I don't think this exact question has been asked already (I've done a lot of searching but come up empty).. I am trying to work out what would be described as the 'L0 Tile' distance between two points in my game in tiles.

My coordinate system is as below:

And this is the effect I'm looking for when calculating distance from a central point:

The problem is I keep running into boundary conditions when trying to come up with a better solution than just 'walking' between the two positions and counting the steps.

The code I have at the moment only works if the direction between the two points is perfectly vertical, horizontal or diagonal:

if( fIsVertical )
{
    // Vertical distance calculation

    nDistance = nYDifferenceTiles / 2;

}
else if( fIsHorizontal )
{
    // Horizontal distance calculation

    nDistance = nXDifferenceTiles;
}
else
{
    // Diagonal distance calculation (slightly more headache-prone)

    bool fIsPerfectDiagonal = false;

    if( nYDifferenceTiles % 2 == 0 )
    {
        // Irrespective of W or E path these values are always the same

        if( nXDifferenceTiles * 2 == nYDifferenceTiles )
        {
            fIsPerfectDiagonal = true;
        }
    }
    else
    {
        // Values for X when Y is odd are slightly different..

        if( fNorthWestOrSouthWest )
        {
            // Handle the West paths
            if( nXDifferenceTiles == ( nYDifferenceTiles - std::floor( nYDifferenceTiles / 2.0 ) ) )
            {
                fIsPerfectDiagonal = true;
            }
        }
        else
        {
            // Handle the East paths
            if( nXDifferenceTiles == ( nYDifferenceTiles - std::ceil( nYDifferenceTiles / 2.0 ) ) )
            {
                fIsPerfectDiagonal = true;
            }
        }
    }

    // Now we've calculated whether we are on a perfect diagonal
    // line from the origin we can decide how to calculate the distance

    if( fIsPerfectDiagonal )
    {
        // If exact diagonal this works well
        nDistance = std::max< int >( nYDifferenceTiles, nXDifferenceTiles );
    }
    else
    {
       // ? - problem
    }
}

So in the diagram below, the green tiles are correctly calculated but for the red ones I have to fall back to my quick and nasty code to walk the distance.

Despite trying a good few things I'm still no closer to having a simple and quick way of calculating the distance. I'm sure this problem has to have been addressed before and that I'm missing something probably obvious. Please help! :)

sentences: SDL2 window as child of Win32 GUI I'm building an editor. Is it possible to create a child window of SDL2 within a Win32 gui? (The most obvious page from SDLTutorials works for earlier versions of SDL)

sentences:
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:
Dual Currency vs. One Currency in social games economics and monetization Not a programming question but game development related.

I am creating an iPhone online game which I wish to be free-to-play where in-app purchase is used for monetization. The important point is to make sure that this does not break the game-play, my priority is gameplay first, monetization second.

One popular way of monetizing the player base is to sell your in-game currency, however there are 2 ways to go about this:

One Currency: This currency can buy anything within the game, it can be earned through normal play at a limited rate. Players can, however, choose to buy this currency directly to speed up the acquisition of the currency.
Dual Currency: One currency can be earned through normal play and it can be used to buy a limited set of items that is required for normal enjoyment of the game. The second currency is 'premium' and must be purchased using real world money. This second currency can be used to purchase 'premium items' that gives extra abilities such as increase EXP gain, etc. The 2 currencies can be traded between players to give non-paying players to exchange their time for the 'premium' currency.

Both methods do not break gameplay and allows players who does not wish to pay enjoy the entire contents of the game if they put in enough time and effort.

My question is, is there any reason why you would pick one over another? What are the pros and cons that I should pay attention to when implementing each alternative?

Thank you.

sentences:
How do I create a Fixture in Andengine and assign it user data? I´m following this tutorial: How do I use a JBox2D ContactListener to check if my character is standing on the ground? in order to get input from player's bottom part including a fixture in player's main body.
My problem is that I´m initializing FixtureDef like this:

    body = PhysicsFactory.createBoxBody(physicsWorld, this,BodyType.DynamicBody,PhysicsFactory.createFixtureDef(0,0, 0));

    body.setUserData("player");
    body.setFixedRotation(true);

    // create the bottom sensor
    final FixtureDef footSensor = PhysicsFactory.createFixtureDef(0, 0, 0);
    footSensor.isSensor = true;
    body.createFixture(footSensor);

Now I can't do: footSensor.setUserdata("sensor") because only Fixture class has this method. How can I initialize Fixture class to be able to include a user data? Thank you.

sentences:
How does this data oriented design retain level data, while still offering cache-wise benefits? I'm almost sold on the concept of a data oriented engine; however, one thing still eludes me. If we pack the data from a large level into huge arrays, and go over them, any visibility system that we have would basically render most of it as unprocessable.

Consider this exert:

void do_stuff_with_data(data* vdata, const const_data* cdata, int count)
{
    for ( int i = 0; i < count; ++i )
    {
        if ( vdata->active )
        {
            ... process data
        }
    }
}

Considering that most of the data is not visible, and due to stuff moving around, there is no sensible prediction for how to order it, and branch prediction is screwed. Doesn't that void the cache-wise benefits?

I have read up on article dealing with this specific problem, but most of the sources just show the "big picture", completely disregarding this important issue.

sentences:
Weird effect when generating gradients for height map I am experimenting with generating height maps using radial gradients and perlin noise, using a technique I found here: http://www.reddit.com/r/gamedev/comments/1g4eae/need_help_generating_an_island_using_perlin_noise/cagmlsi.

This is my code:

 public override void generate(int seed) {
        Random rand = new Random(seed);

        float[,] pixelMap = new float[gridSizeX, gridSizeY];

        // generate random starting points for the islands
        centers = new int[ISLAND_COUNT,2];
        for (int i = 0; i < ISLAND_COUNT; i++) {
            centers[i, 0] = rand.Next(0, gridSizeX - 1);
            centers[i, 1] = rand.Next(0, gridSizeY - 1);
        }

        float maxDistance = 0;
        for (int x = 0; x < gridSizeX; x++) {
            for (int y = 0; y < gridSizeY; y++) {
                // calculate the distance for each center node to the current coords.
                // pick the distance that is closest for the color value
                float distanceToCenter = 9999999; //artificially high number
                for (int i = 0; i < ISLAND_COUNT; i++) {
                    int centerX = centers[i, 0];
                    int centerY = centers[i, 1];
                    float localDistance;

                    //Simple squaring, you can use whatever math libraries are available to you to make this more readable
                    //The cool thing about squaring is that it will always give you a positive distance! (-10 * -10 = 100)
                    float testX = x;
                    float testY = y;

                    float distanceX = (centerX - testX) * (centerX - testX);
                    float distanceY = (centerY - testY) * (centerY - testY);

                    localDistance = (float)Math.Sqrt(distanceX + distanceY);

                    // let's see if the wrapped distance is shorter; if so use that.
                    // this allows our gradient to wrap along the X axis
                    if (x > centerX) {
                        testX = (gridSizeX - x) + centerX * 2;
                    } else {
                        testX = (gridSizeX + x);
                    }

                    distanceX = (centerX - testX) * (centerX - testX);
                    if (localDistance > (float)Math.Sqrt(distanceX + distanceY)) {
                        localDistance = (float)Math.Sqrt(distanceX + distanceY);
                    }

                    //is this closer than the last recorded distance? If so use it
                    if (localDistance < distanceToCenter) {
                        distanceToCenter = localDistance;
                    }

                    // record the maximum distance calculated
                    if (localDistance > maxDistance) {
                        maxDistance = localDistance;
                    }
                }

                // add the color to the pixel map, adjusted for an rgb between 0 and 255.
                pixelMap[x, y] = (distanceToCenter / gridSizeX) * 255 * 2;
            }
        }

        drawImage(pixelMap);

        // save image of final generation
        passOutput.Save(@"test.png", ImageFormat.Png);
    }

This code generates an image like this though:

the red dots (if you can see them) are diagnostics code I added to mark the center of the gradients.

I am completely stumped as to why these white borders are happening at the midway points between gradients. I feel like there is a simple solutions to this, but I have been at this for days and have been unable to fix it no mater what I try.

What I am expecting is something like this mockup made in Photoshop:

Notice how there are no sharp edges; all gradients int he image blend into each-other seamlessly.

Any ideas?

sentences:
Is it a good idea to develop non-trivial 2d game in python? I am planning to develop 2D space RPG and i am facing the choice: what is the best language to write it in? My candidates are C++, Java and Python. Obviously, I want to write game in Python because of its expressiveness, speed of development and simplicity of adding scripting support. But I am worried:

Won't Python be too slow? The game will be not trivial (like Tetris for example), it may be needed to calculate tasks for thousands of ships in universe (though their AI can be heavily simplified if those ships are not seen to the player). Of course I can write some critical parts in C, but it will instantly complicate building and deploying.
Let's suppose that game became popular, and I became a superstar. Windows users rarely have Python at all (fortunately we have py2exe). Python on Mac OS X can be outdated and game may crash with obscure exception. Wouldn't it be hard to deploy game in Python?
Because of lack of libraries for Python 3 I'll have to write game in Python 2. Wouldn't transition to Python 3 in couple of years be too painful and time consuming?

sentences:
Calculating theoretical FPS I'm unsure if this question would be more appropriate in stackoverflow, so apologies before hand if it should be moved.

Given that I know the user's hardware (Video Card, RAM, CPU, screen resolution, etc.) is it possible to make a rough estimate of the expected FPS when comparing with the game's minimum and recommended system requirements?

I see some gaming websites with those estimates and I was wondering how do they do it.

sentences:
Isometric tilemap circle around object I am developing an isometric game like Anno 1602.
I have an isometric tilemap. The default tilesize is 64x31.
My goal is to show the area a building has influence to. For that I want to show a circle in isometric style around that building. Look at the picture below:

I need to find an algorithm which turns information about a building (width, height, radius in tiles) into a polygon containing screen coordinates of the outer parts of the dark area (see picture, I want the red points). For example, the data for the picture above would be:
w = 2;
h = 2;
r = 3
I tried creating circles with midpoint algorithm for each tile of the building. Merging all points together and running concave hull algorithm to get the outer most points. But this did not yield nice results.
What could be an approach to get points to create a polygon which resembles an isometric area around an object.

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:
Game speed on different devices isn't same I have an app, in which I have constant int speed = 5; On each update, the game object (player) is moving 5px ahead. Problem is, that I can't handle that on different devices - older devices is having fx. 20fps (so 20 updates per second), and other one have 60fps. Then, my object is moving faster or slower, than it should.

I tried some screen width divisions, but didn't managed to work it.

I also tried to stick to some FPS (25) and skip frames if necessary. But on my tablet and phone, it just run on its own; it works like there isn't any frame skip code at all.

sentences:
Effort of impementing interpolation in networked Asteroids Questions:
When we draw with interpolation, where should the collision detection code be?
Is it worth implementing interpolation in the following situation?

This is for Scrolling Asteroids. I have my game working at the moment without interpolation. It does physics updates using fixed step time deltas. The frame display rate is decoupled from this. So, it might be doing 40 Physics updates per second and 75 frame draws per second. Up until now, it is in the physics update routine that I do the collision detection and response. Your ship can collide with a rock. Your photons (bullets) can collide with a rock.

Now I am considering improving it to use interpolation as per all the good articles recommend:

http://www.koonsolo.com/news/dewitters-gameloop/

and

http://gafferongames.com/game-physics/fix-your-timestep/

So when this is implemented, I might be making the following calls:

update(dt)
draw(0.24)
draw(0.64)
update(dt)
draw(0.24)
draw(0.76)

The floating point numbers shown are examples of actual calculated interpolation value i.e. the proportion of the physics update that is complete at the time the frame is being drawn. I am going to have to change the draw code to draw the objects at a fraction of the distance between their previous and current value positions and rotations. That is yet to be done.

Question: Will I also have to do move my collision detection code out of the update routine and into the draw routine, seeing as I will be drawing these interpolated frames ?

Bear in mind, my highest priority goal is to make this networked: multiple player ships on as large a Universe as possible. So a physics update solution that is compatible with the networked game that is required. Is the interpolation worth the effort? Right now. I rarely if ever see a problem with smoothness. If I reduce my physics updates to 25 per second which I have only done as an experiment then it is a bit jerky. But the game easily runs at higher rates than that so there may never be a problem.

So the two questions:

Collision detection where?
Is introducing interpolation worth the
effort or should I proceed to networked version straight away?

Thanks in adance:

sentences:
Effect only on one object (two cameras) I have a problem. I want a Grayscale effect to be applied ONLY to the chair on the stage. The chair has a layer CurrentItem. And I have two cameras:

Camera_All renders everything except layer CurrentItem (I set this exception in CullingMask)
Camera_CurrentItem

Finally:

I need to apply not just one effect, but a few.

sentences:
Should I use animated objects or use the physics engine on iOS scenes with lots of rigidbodies? I have a scene with lots of houses and other objects. These objects will be bombarded from the sky. How to handle these kind of settings having in mind that you want the physics to be as realistic as possible.

In Unity3D, if I set all the objects with isKinematic=true and on collision I set it to false, then the physics isn't as realistic as I want it to be... Can you have these kind of scenes on iPhone? Should I have animated objects? I really don't know what is the best practice in this kind of scenes....

sentences:
SDL2 C++ Program Behaves Badly if FullScreen Mode I'm making an app with SDL2.
I've gotten everything to work so far, including SDL_TTF. When I run my program in a normal window, everything works great!

However, now I'm trying to add fullscreen functionality... and I've run into the problem. On fullscreen mode ONLY, the program APPEARS to look fine at first, however, one of my functions (A text rendering function) causes problems. On fullscreen, this function momentarily removes or "flickers" the image behind it, revealing the previous image underneath. Why would this function cause an error on fullscreen vs. regular window sizing? I assume it's some kind of strange sizing issue...

void drawDialog(const char* content) {
//Draws a dialog box with set text
TTF_Font* font = TTF_OpenFont("assets/times.ttf", 30);
SDL_Color textColor = { 255, 255, 255 };
SDL_Surface* message = TTF_RenderText_Solid(font, content, textColor);
SDL_Texture* dialogTex;
SDL_Rect destRect;

destRect.x = 50;
destRect.y = 730;

destRect.w = 300;
destRect.h = 30;

dialogTex = SDL_CreateTextureFromSurface(renderer, message);
SDL_FreeSurface(message);
SDL_RenderCopy(renderer, dialogTex, NULL, &destRect);
SDL_RenderPresent(renderer);

}

Any help would be super! Thanks!

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:
Creating three-dimensional biomes I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between them where there are 'mixed' biomes or even no biomes whatsoever, indicating no 'side' has control over that region.

There are a plethora of articles on the web these days about how to create two dimensional biome maps, but I have seen none about making three-dimensional maps. Has anyone done any coding like this before? My Google-fu is strong but I haven't found any significant pages on it.

I will continue to work on it solo, but as a beginning, solo programmer I expect I will be quite slow on it. I was just wondering if anyone had done this already.

sentences: 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:
Slick2D shader crashes, but only after a while I'm using Slick2D's ShaderProgram for shader-based drawing in my game. Some players report that after 3-10 minutes, the game inevitably crashes hard during what appears to be a setUniform4f operation that's happened thousands of times before:

[error occurred during error reporting (printing native stack), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  org.lwjgl.opengl.ARBShaderObjects.nglUniform4fARB(IFFFFJ)V
J  com.zarkonnen.airships.Appearance.draw(Lcom/zarkonnen/catengine/Draw;DDDDILcom/zarkonnen/catengine/util/Clr;Z)V

Full Log

Why might this happen? Is it a transient problem, or maybe a driver issue? I'm confused that this happens not when the shader is bound, or when textures are set, but at the point of this utterly mundane operation of setting a 4f value. I'm in fact pretty lost here, as I can't even repro this on any of my own machines.

This is the culprit function in its entirety:

public void draw(Draw d, double x, double y, double w, double h, int ms, Clr tint, boolean flipped) {
    if (shaderLoadFailed) {
        drawFallback(d, x, y, w, h, ms, tint, flipped);
        return;
    }

    if (tex == null) {
        tex = loadTex(SPRITESHEET);
        if (tex == null) {
            shaderLoadFailed = true;
        }
    }
    if (sp == null) {
        try {
            sp = ShaderProgram.loadProgram(
                    AGame.getGameDirectoryPath("data/passthrough.vert"),
                    AGame.getGameDirectoryPath("data/frag.frag"));
        } catch (Exception e) {
            e.printStackTrace();
            shaderLoadFailed = true;
        }
    }

    if (shaderLoadFailed) { return; }

    sp.bind();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
    sp.setUniform1i("tex", 0);
    if (tint == null) {
        sp.setUniform4f("tint", 1.0f, 1.0f, 1.0f, 1.0f);
    } else {
        sp.setUniform4f("tint", tint.r / 255.0f, tint.g / 255.0f, tint.b / 255.0f, 1.0f);
    }

    Img img = frames.get((ms / interval) % frames.size());

    glBegin(GL_QUADS);
    if (flipped ^ isFlipped) {
        glTexCoord2d(img.srcX, img.srcY);
        glVertex2d(x + w, y);
        glTexCoord2d(img.srcX, img.srcY + img.srcHeight);
        glVertex2d(x + w, y + h);
        glTexCoord2d(img.srcX + img.srcWidth, img.srcY + img.srcHeight);
        glVertex2d(x, y + h);
        glTexCoord2d(img.srcX + img.srcWidth, img.srcY);
        glVertex2d(x, y);
    } else {
        glTexCoord2d(img.srcX, img.srcY);
        glVertex2d(x, y);
        glTexCoord2d(img.srcX, img.srcY + img.srcHeight);
        glVertex2d(x, y + h);
        glTexCoord2d(img.srcX + img.srcWidth, img.srcY + img.srcHeight);
        glVertex2d(x + w, y + h);
        glTexCoord2d(img.srcX + img.srcWidth, img.srcY);
        glVertex2d(x + w, y);
    }
    glEnd();
    sp.unbind();
    TextureImpl.bindNone();
}

And the shaders FWIW:

passthrough.vert

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

frag.frag

uniform sampler2D tex;
uniform vec4 tint;

void main(void) {
    gl_FragColor = texture2D(tex, floor(gl_TexCoord[0].st) / 1024.0) * tint;
}

As you can see, there's very little to them.

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:
RTS game unit structure I want a way to make a lot of different units without having to program stuff like moveTo and Attack actions more than once

The way I see it, there are 2 ways I can do this.

A single generic Unit class with flags that specifies what it can/can't do (then create instances in a static array and grab them when needed)
Abstract unit class with abstract methods for Unit-specific actions like (Attack, Harvest, Patrol), which then all need to be implemented in the subclasses, even if the unit can't actually harvest anything.

the first way of doing this seems the simplest, but i would end up having a lot of code being unused for the majority of the units.

the second way could also work. But if i decide to have two different units that can harvest resources, i'm gonna have the exact same code in two different classes, which doesn't seem like the right way to do it.

Is this even the right approach to this problem?
In a game like AoE, every unit has, what i presume is, some kind of List of Actions/Orders, I would really like to know how to achieve something similar to that, where i can just code each Action/Order once, and then give it to all the units that need said Action.

If i'm unclear (highly plausible) or you need more information on what exactly i'm looking for, just ask me in a comment.

sentences:
Spritesheet vs single tiles I am currently programming a 2d platformer and this is the first time I am coding a video game. Now I've downloaded the 'platformer art deluxe' package. In the tiles folder there are single tiles and a spritesheet with every tile on it.
Should I use the spritesheet or the single tile sprites?

sentences:
Android development in Unreal with an existing project I am currently using an Unreal 3 project that has been targeted for multiple devices.  Originally, it was targeted for iOS and now I want to try and build it for Android. The project is capable of doing it and I am in the process of testing it.

I think I have everything I need in order to build it and launch it for an android device that I have set up and connected to my PC and is recognized by the Android SDK ABD. I am currently trying to build and launch the game through the Unreal Frontend but when I try, I am getting stuck at getting the Unreal Frontend to find my Android device as a platform to debug, like it would with a PC, Xbox360, or PS3.

Right now, I am just trying to launch the game to see if I can get it to simply run on an Android device, I'm going to worry about the packaging later.

So I have two questions:

Am I on the right track in looking at the Unreal Frontend to cook and launch the project on Android or should I look somewhere else?

How do I get Unreal to recognize my Android device as a platform to launch on?  I would even settle for recognizing an emulator, but that seems even harder.

sentences:
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:
Faster way to scale images than gluScaleImage? I'm porting a C++ game to Android using the NDK and there's one bottleneck that's really slowing down the code: gluScaleImage().

Does anyone know of a faster way to scale image textures?

sentences:
MeshBuilder, assembly missing I'm trying to build a terrain starting from a heightmap. I've already some ideas about the procedure, but I can't even get started. I feel like I have to use a MeshBuider. The problem is that Visual Studio (I'm using the 2008 version) wants an assembly. Effectively on the MSDN there's a line specifying the assembly needed by the MeshBuilder, but I don't know how to import/load it.
Any suggestions?

Thanks in advance :)

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: Do SpriteBuilder's Smart Sprite Sheet need to be loaded to memory? When I create an Smart Sprite Sheet Folder using SpriteBuilder and publish it, must I load that SpriteSheet into memory "FrameCache" with code or does SpriteBuilder do this automatically (so I just have to access any image inside of SpriteSheet?)

sentences:
Is it possible to add touch screen functionality to a Windows Standalone build for a Surface Pro? I have an application which is currently PC/ Windows Standalone, however I need it to be able to work with the touchscreen on a Surface Pro tablet when the same build is run on here. The interaction the user has is that of clicking buttons to open and close windows etc (all buttons use the OnClick() functionality), so any input required would just be simple button taps.

I simply need this to work on a Surface Pro touchscreen display when it is run on there, so mouse clicks to be replaced with taps of the buttons.

I've read many posts on the subject, but many are from Unity 4.6 and nothing conclusive for Unity 5. Many posts I found stated that this feature was introduced for Unity 5, but others suggest it is not supported and third party plugins are needed.

I don't currently have access to a Windows touch screen device, so am unable to do a quick check. I therefore want to make sure it is possible before I purchase a device and commit to the update.

From what I gather, the 'Standalone Input Module' has now replaced the 'Touch Input Module' which apparently had a checkbox to tick if you wanted to have it work in Standalone. As such a checkbox does not exist in the former, I am unsure whether this feature is still supported.

So I would like to know -

Is it supported in Unity 5?

If so -

Does it 'just work' automatically or does extra work need to be done to tell it to use touch screen if it is running on a Windows touch screen device?

Many thanks in advance

sentences:
Does research exist on the impact of vibration in mobile games? I've implemented vibration for various player collisions in my mobile game, but I feel like this is not a common thing on mobile even though it is on consoles.

Is there any research on the positive or negative benefits of using vibration feedback in mobile games that would suggest guidelines for when it is and isn't appropriate to use?

sentences:
Update and merge Unity coordinate systems multiplayer - Hololens Project Summary

Creating a multiplayer HoloLens app that allows players to spawn and move objects around the local space they share.

Problem

I am able to connect to the other HoloLens and see the other player in the correct location but, for some reason the objects that I spawn I offset. I determined that the offset was based off of where the application started off. When developing in HoloLens the device always starts at (0,0,0). However, once the client has connected to the host and imported their world anchor the client's coordinate system is never updated event though the anchor is in the same physical location. This creates a problem because if the client is offset by 180 degrees everything that the host does is offset by the same amount when moving an object if that makes sense.

Moving toward a solution

After doing a lot of research I found this pertaining to sharing and HoloLens:

  "After a GameObject is locked via the LockObject call, it will have a WorldAnchor which will keep it in the same physical position in the world, but it may be at a different location in the Unity coordinate space than other users."

I found this on Microsoft's website here

https://developer.microsoft.com/en-us/windows/mixed-reality/shared_experiences_in_unity

Question

So obviously my question is basically, is there a way to update the x,y,z coordinates of (0,0,0) during runtime?

sentences:
Checking collision of bullets and Asteroids I'm trying to detect collision between two list of bullets and asteroids. The code works fine, but when the bullet intersects with an asteroid, and that bullet passes through another asteroid, the code gives an assertion, and it says about it can't increment the iterator.
I'm sure there is a small bug in that code, but I can't find it.

for (list<Bullet>::iterator itr_bullet = ship.m_Bullets.begin();
     itr_bullet!=ship.m_Bullets.end();)
{
    for (list<Asteroid>::iterator itr_astroid = asteroids.begin();
         itr_astroid!=asteroids.end();
         itr_astroid++)
    {
        if(checkCollision(itr_bullet->getCenter(),itr_astroid->getCenter(),
           itr_bullet->getRadius(), itr_astroid->getRadius()))
        {
            itr_astroid = asteroids.erase(itr_astroid);
        }
    }
    itr_bullet++;
}

sentences:
How to put labels at a specific point on any resolution I am working on a project in Unity 4.6.1 and I put the label at the top:

But when I put the Scene in full view this happened:

I made a Development Build and when I select my resolution (1366x768) the label goes behind the buttons. Is there any way to put the label at a specific point no matter what resolution?

sentences: 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:
Do I need a backend engineer for my studio right now? I am working on a mobile game that requires a well thought-out backend, because it spans across the healthcare/data science space and we need to be compliant in terms of security/regulations in how we approach this. Think something like Fitbit.

My team is nearly finished with the client-side game aspect; but I am wondering whether I need to take on a short-term contract/part-time backend engineer to create our entire backend infrastructure OR someone who would work on this full-time with our team.

Here is what we would need to do:

Setup our entire backend infrastructure and plug this into Unity
This would require knowing how to handle (transmit/receive) data securely, and also perform computation with that data in the cloud
Set-up an API where other developers can query our data
Set-up our dev ops infrastructure (Docker, Jenkins) for the future

The kicker here is that we are not yet live and are just in a testing phase. I don't want this to be 2-3 weeks of work, with no users for 3 more months while we're working on other aspects of the project, with the dude having nothing to do.

Does this sound like a lot of work? Or could it easily take up a devs time for a month or two? Would a short contract be advisable here, or would it be better to hire someone FT and have them grow with us.

sentences:
How should I organise classes for a space simulator? I have pretty much taught myself everything I know about programming, so while I know how to teach myself (books, internet and reading API's), I'm finding that there hasn't been a whole lot in the way of good programming.

I am finishing up learning the basics of XNA and I want to create a space simulator to test my knowledge. This isn't a full scale simulator, but just something that covers everything I learned. It's also going to be modular so I can build on it, after I get the basics down. One of the early features I want to implement is AI. And I want to take this into account as I'm designing my classes so I can minimize rewriting code.

So my question:
How should I design ship classes so that both the player and AI can use them?

The only idea I have so far is:

Create a ship class that contains stats, models, textures, collision data etc. The player and AI would then have the data for position, rotation, health, etc and would base their status off of the ship stats.

sentences:
How do animation works with mesh? I'm currently developing a game using OpenGL and my dev has run into a small problem. I'm having some problems understanding how "array of vectices works with animated object". For example, if we have a 3D object is there a different array for each frame of the animation or is there an instruction which does the animation ?

So, does a 3D objet file look like this :

Idle
Frame 1 mouvement animation
Frame 2 mouvement animation
Frame 3 mouvement animation

All of the above being big array containing vertices and texture coords ?

Thank you for the answer and explaning this thing to me !

sentences: Getting closest distance between a square's edge and a point 2D How would I get the closest distance between a square's edge and a point in 2D, if I only have the points coordinates, and the coordinates of the square and it's size?

sentences:
How to cut a desired shape out of a mesh? I want the player to be able to cut a hole through a wall, similar to what's shown in this video

I know for the fact that it's really difficult to achieve, so I was wondering how I can cut a shape out of a simple mesh at run time (or even cut a shape out of a 2D sprite).

sentences:
Unity RectTransformUtility.ScreenPointToLocalPointInRectangle What does the unity's RectTransformUtility.ScreenPointToLocalPointInRectangle do
I've read unity documentation but I didn't get the clear meaning.

sentences:
Polygonal Triangulation - algorithm with O(n log n) complexity I wish to triangulate a polygon I only have the outline of (p0, p1, p2 ... pn) like described in this question: How do you triangulate an arbitrary polygon? and this webpage: http://cgm.cs.mcgill.ca/~godfried/teaching/cg-projects/97/Ian/algorithm2.html

I do not wish to learn the subject and have a deep understanding of it at the moment. I only want to see an effective algorithm that can be used out of the box. The one described in the site seems to be of somewhat high complexity O(n) for finding one ear. I heard this could be done in O(n log n) time. Is there any well known easy to use algorithm that I can translate port to use in my engine that runs with somewhat reasonable complexity?

The reason I need to triangulate is that I wish to feel out a 2d-outline and render it 3d. Much like we fill out a 2d-outline in paint. I could use sprites. This would not serve cause I am planning to play with the resulting model on the z-axis, giving it different heights in the different areas.

I would love to try the books that were mentioned, although I suspect that is not the answer most readers are hoping for when they read this Q & A format. Mostly I like to see a code snippet I can cut and paste with some modifications and start running.

sentences:
Audio Thread as daemon thread I'm looking to set up two threads in my puzzle game, one for logic/graphics, and one for audio.
Am I correct in thinking that the thread that handles the audio should be set as a daemon thread, because the game can end without that thread finishing?

sentences:
Is there any potential downside to procedurally programmingh in DirectX 11, without classes? I'm learning DirectX 11, and I hope to start a simple 3D engine, some day. I'm following a tutorial series, and I realised that I have no need to create any class to maintain my code. The tutorials also use this procedural approach, but I don't copy and paste the tutorial code; I try to understand the tutorial, and then try to code the new stuff in my way.

I can have the code understable, and working well, with just functions and global variables. When I have enough knowledge of the API, and I want to start creating my own library, could this procedural approach have some downside? Should I start writing some classes?

sentences:
Is glDrawArraysInstanced in OpenGL parallel when drawing those instances? Is glDrawArraysInstanced in OpenGL parallel when drawing those instances?

I cannot figure out by referring to its reference and numerous online tutorials.

[Update] To be more clear, I mean, for example, we have 100 instances.
Are the drawing of those 100 instances parallel?
For example, we have the 100 commands "glDrawArrays(mode, first, count);"?
Is execution of those 100 commands sequential or parallel?

I think it should be sequential. GPU begins to draw the second instance, only AFTER the first instance drawing finished.

Or glDrawArraysInstanced just save the time for "giving your GPU the commands"?

[Update 2] The reason I wanted to know the answer, is that:
If it is sequential, personally I think drawing thousands of tree leaves in this way is time consuming. I may draw them in one shader program with some algorithm tweak.

sentences:
Performance problems with quadtree for dynamic objects I´ve implemented a quadtree spatial partitioning to my game engine as I wanted to try it and see how it affects the performance checks. The results were great (instead of hundreds collision checks only for cursor I was suddenly having just about 10%), however I faced performance problems (not caused by the number of collision checks but by the spatial structure itself [or my implementation]) :

1. At first I was inserting items every frame and at the end of the frame the quadtree was cleared and so on. I realised this slowed down the performance more than 2-3 times.

2. Of cource the next step was to try to make the quadtree dynamic by not clearing it but by checking the moving objects from the quadtree. However this process is also not trivial as I can have a multiple nodes containing the same object (if it doesnt fit to any of the children I "broadcast" and check neighbour nodes so it can be visible in more than 1 node) and I ended up by digging through the entire quadtree again.

How did you solve these problems with the quadtrees? I´ve read that some of the engines use multiple spatial structures to divide work for static/dynamic objects, I would use quadtree for static structure but what would be suitable for dynamic? Also I think I "hurt" myself when I want to make as generic solution as possible so I dont have to change the spatial structures of my game engine no matter what type of game I´m creating with it at the time.

sentences:
Manual GLU.gluUnproject Before I used GLU.gluUnproject to calculate my picking ray in my OpenGL game. Recently I switched to my own calculated matrices, and now I can forget the gluUnproject.

How can I calculate the picking ray with my own matrices?

My picking ray code (for the fixed pipeline):

public Ray getPickingRay() {
    FloatBuffer modelBuffer = BufferUtils.createFloatBuffer(16);
    FloatBuffer projBuffer = BufferUtils.createFloatBuffer(16);

    glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
    glGetFloat(GL_PROJECTION_MATRIX, projBuffer);

    IntBuffer viewPort = BufferUtils.createIntBuffer(16);
    glGetInteger(GL_VIEWPORT, viewPort);

    FloatBuffer obj_pos = BufferUtils.createFloatBuffer(3);
    float middleX = (Display.getWidth() / 2)-0.01f;
    float middleY = (Display.getHeight() / 2)-0.01f;
    GLU.gluUnProject(middleX, middleY, 1.0f, modelBuffer, projBuffer, viewPort, obj_pos);

    Vector3f objPos = new Vector3f(obj_pos.get(0), obj_pos.get(1), obj_pos.get(2));

    Vector3f.sub(objPos, game.player.position, objPos);

    return new Ray(game.player.position, objPos);
}

At first I thought I just could use my own model- and projection matrix, but I have not found a way to manually calculate the GL_VIEWPORT intBuffer.

Thanks folks.

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 display a loading state until a song loaded with www.GetAudioClip() is ready to play? I use www.GetAudioClip() to get a song and play it when my Android mobile game starts.

My issue is that it takes a 3-second delay to play the song.

My idea is to add some loading screen before starting the game, and the game starts after www.GetAudioClip() finishes getting the song and I begin to play it. But I don't know how to control the loading screen so it disappears after the right delay.

sentences:
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: Repeating UVs wont convert to texture in maya I have designed a material in Maya which i want to convert to a texture jpg, however i have repeating the UV's on the material. When i convert the material to a jpg the repeating UV's wont convert across. Is there anyway i can get them too?

sentences:
Slick2d font rendering makes all other drawings vanish I'm converting a java game to lwjgl and slick-utils. I've followed the slick2d examples for font loading/rendering but I found that the font shows as a solid box of color unless I add the following glBlendFunc code:

GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
head_font.drawString( (float)(x + 20), (float)(y + 80), "Title Here", org.newdawn.slick.Color.green);
GL11.glDisable(GL11.GL_BLEND);

I've tried leaving this code as-is, I've tried leaving the blend function on, but any other drawing methods I have vanish when that blendFunc line is left in.

For example, here's a basic rectangle drawing method. The rect drawn here, only shows when I leave out the blend func. Is there a different blend func I need to constantly switch to?

GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f( r_f, g_f, b_f, a_f );
GL11.glRecti(x1, y1, x2, y2);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);

Update: Setting the blendFunc back to default values for the drawRect method I have works, but I'm not sure yet if it's the right solution.

GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);

sentences:
Particle system: BlendMode of particle's draw call I noticed by reading some tutorial around the web, that when dealing with particle systems, you can both use these approces:

Black background on the single particle and additive mode as blending mode for drawing
Transparent background on the single particle and alpha blend mode for drawing.

What are the differences between the two approces?

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:
Anyone have a source for pictures/screenshots/demos of Mud OLC systems? I really want to get access to some images of MUD (multi user domain/multi user dungeon) OLC (mud OnLine Creation), to use the structure of npcs/mobs/characters/areas/rooms that muds use on my own webgame project (http://www.ninjawars.net), which features a near predominant use of text itself.

I've played a mud for years, and experienced the OLC system of that mud first hand, but the mud went under, so I'm looking for

I tried compiling the type of Mud it was from source (ROM 2.4) but haven't been able to accomplish that.

I'm expecting that there are some images of the OLC of items/mobs/etc out there already, but I haven't been able to find any to base my implementation of the same concepts in my game off of.  If there's some live way to get access to a demo of OLC, that would be even better.

sentences:
What does Mecanim's "loop pose" parameter do? What exactly does the loop pose parameter do?

What's the difference between enabling or disabling it on animation clips?

sentences:
How to launch a prefab at the mouse position I want to use Instantiate(item, new Vector3(...), Quaternion.identity) to land an item at the position that was clicked. My game is using a third-person view (example).

This is the code that I think I should be using:

if(Input.GetKeyDown(KeyCode.Mouse0) && cur_items > 0){
    Instantiate(item, object_pos, Quaternion.identity);
    cur_items--;
}

mouse_pos = Input.mousePosition;
object_pos = Camera.main.WorldToScreenPoint(mouse_pos);

What am I doing wrong?

sentences:
Filling a room with random furniture This is a rather complex question and I'm more hoping for general algorithms anyone might have heard of.

I wish to generate randomly sized rooms. Each of these rooms has a type and a corresponding list of furniture to be placed inside it (ie: kitchens can have fridges, both kitchens and living rooms can have TVs, etc). Each piece of furniture has it's own collider (cylinder, cube, mesh...). Are there any good algorithms to randomly lay them out?

The best idea I've managed so far is to subdivide the room into a grid the size of the smallest piece available. Then I would randomly place the furniture until every grid square is at least partially filled. However, this is hardly ideal and the rooms would more or less look like warehouses.

[Optional]How do I randomly place the furniture in such a way as to make it at least look slightly realistic?

sentences:
Geometry Shader input vertices order MSDN specifies (link) that when using triangleadj type of input to the GS, it should provide me with 6 vertices in specific order: 1st vertex of the triangle processed, vertex of an adjacent triangle, 2nd vertex of the triangle processed, another vertex of an adjacent triangle and so on... So if I wanted to create a pass-through shader (i.e. output the same triangle I got on input and nothing else) I should return vertices 0, 2 and 4. Is that correct?

Well, apparently it isn't because I did just that and when I ran my app the vertices were flickering (like changing positions/disappearing/showing again or sth like that). But when I instead output vertices 0, 1 and 2 the app rendered the mesh correctly.

I could provide some code but it seems like the problem is in the input vertices order, not the code itself.

So what order do input vertices to the GS come in?

sentences:
How to calculate vertex normals for a mesh in Java in OpenGL ES? Can some one point me to Java code ( in Java not C or C++) that calculates all the normals for all the vertices of a mesh for OpenGL ES application. I need this for lighting. Lets say I have a cube with following vertices and indices:

float vertices[] = { -width, -height, -depth, // 0
                      width, -height, -depth, // 1
                      width,  height, -depth, // 2
                     -width,  height, -depth, // 3
                     -width, -height,  depth, // 4
                      width, -height,  depth, // 5
                      width,  height,  depth, // 6
                     -width,  height,  depth  // 7
        };
short indices[] = { 0, 2, 1,
                    0, 3, 2,
                    1,2,6,
                    6,5,1,
                    4,5,6,
                    6,7,4,
                    2,3,6,
                    6,3,7,
                    0,7,3,
                    0,4,7,
                    0,1,5,
                    0,5,4
                  };

In above specific example how many normals we need?

sentences:
Multi-disciplined: Strength or Weakness? My last two credited titles I was Lead Programmer then moved to Lead Design role. At my current company I kinda switch between design and programming hats quite often.

The bulk of my education is in programming and my experience is pretty broad. I honestly can't pick which I prefer, and if I focused then I think I would do the other in my spare time. My colleagues consider me capable in both roles.

I'm currently looking for opportunities, some at larger companies, and often people seem to be thrown by my dual role. I feel like it may be damaging my chances in some cases, because they can't easily fit me into the company.

Should I just pick one and focus or is it viable to continue wearing my two hats?

sentences:
Polygon filling algorithm Share your methods or algorithms for painting areal objects, I will be very grateful.  I have points List <Vector2> or List <Vector3>, there are textures with different settings:

And I need to fill the area.
For example, I have 4 coordinates, I painted a square by clicking the button:

sentences:
Orientation is off when nearing 90 degrees rotation Context: I am using Vive Trackers to track the head of a user. It is not a Vive headset and I am restricted to the TrackingUniverseRawAndUncalibrated, which only guarantees that the Y axis will be UP. The pose (matrix) of the tracker is therefore not aligned with my axis (except for the Y) and does not take into account the orientation of the tracker on the head of the user.

First I convert the measure pose (Pm) to my axis system, which differs from the Vive one by R, to get the corrected pose (Pc):

Pc = R * Pm

(those are all rotation matrix)

Then I obtain the head pose (Ph) using the corrected pose and the calibrated pose (Pca), which is the corrected pose when facing exactly forward. This is to take into account the tracker's position on the head.

Ph = Pc * inverse(Pca)

Finally I extract the Euler angles for my needs. And it looks fine when looking straight ahead or near it: changes in yaw, pitch and roll do what we expect them to do.

But things start to be off when getting to a heading near -90 or 90 degrees. The image starts to move as if there were changes in the pitch and roll and any small head movements then has big effects on the pitch/roll of the image. In other words, the farther you look from straight forward, the more the orientation is wrong.

What am I doing wrong here?

sentences:
How to implement the interaction between engine parts? I want to ask a question about how the information exchange between game engine parts should be implemented.

The engine is separated in four parts: logic, data, UI, graphics.
In the beginning I made this exchange through the flags. For example if the new object is added in the data, the flag isNew in a object's class will be set as true. And after that the graphics part of the engine will check this flag, and will add the object into the game world.

Though, with this approach I was to write much code to process every flag of each kind of object.

I thought of using some event system, but I don't have enough experience to know whether this would be the right solution.

Is the event system the only appropriate approach, or should I use something else?

I’m using Ogre as the graphics engine, if that matters.

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:
Third Person - Highlight "Usable" Objects I'm trying to figure out a good solution in a third-person RPG to determine if the character is facing and close enough to an object for it to highlight and be shown as a usable item - a door, or a chest, or any other usable object in the scene.

I imagine the best approach is ray-casting, but I've yet to figure out how this would actually work.  I plan to have a usable script on all usable objects that defines what happens during use (a door or chest opens, a coin goes into your inventory, etc), but I need to know whether the player can use the item, highlight it, and also determine which object is the "best choice" based on facing direction and distance if multiple items are in range.

sentences:
When to Use Collision Detection Methods I've done some research into different collision detection methods but I don't know when I should be using one over the others. Some I've seen are:

Continuous Collision Detection (CCD) or Raycasting
Quadtrees
Discrete stepping

So for example if I want to shoot a bullet which method would I use? Well I've herd CCD is the way to go for that. But what if I have an unrealistic machine gun that has a huge rate of fire making 100 bullets shot at any given time. I don't know if I should be using a quadtree or be consistent and use CCD or even use something else.

Could I get some clarification on what each method is best suited for? That way I'm confident I'm using the right method for the situation. Also if you know of any other good collision detection methods let me know. Oh and if the dimensions matter I'm talking 2D here.

Thanks.

sentences:
Correct level of abstraction for a 3d rendering component? I've seen lots of questions around this area but not this exact question so apologies if this is a duplicate.

I'm making a small 3d game. Well to be honest, it's just a little hobby project and likely won't turn out to be an actual game, I'll be happy to make a nice graphics demo and learn about 3d rendering and c++ design.

My intent is to use direct3d9 for rendering as I have some little experience of it, and it seems to meet my requirements. However if I've learned one thing as a programmer it's to ask "is there any conceivable reason that this component might be replaced by a different implmentation" and if the answer is yes then I need to design a proper abstraction and interface to that component. So even though I intend to implment d3d9 I need to design a 3d interface that could be implemented for d3d11, opengl...

My question then is what level is it best to do this at?
I'm thinking that an interface capable of creating and later drawing

Vertex buffers and index buffers
Textures
Vertex and Pixel "shaders"
Some representation of drawing state (blending modes etc...)

In other words a fairly low level interface where my code to draw for example an animated model would use the interface to obtain abstract vertex buffers etc. I worry though that it's too low level to abstract out all the functionallity I need efficiently.

The alternative is to do this at a higher level where the interface can draw objects, animations, landscapes etc, and implement them for each system. This seems like more work, but it more flexible I guess.

So that's my question really, when abstracting out the drawing system, what level of interface works best?

sentences:
How to make a 3D mesh invisible in Godot? Just like the title says i'm trying to make the mesh disappear after a set value reaches zero. Current code is trying to simply turn the entity invisible so that later i can implement a resurrect function.

if Sname == get_node("Entity").get_name():
    print("punched number 1")
    selected.health = selected.health - 10
    if selected.health <= 0:
        selected.health = 0
        get_node("Control/Button").disabled = true
        $Entity.visable = false

Is it even possible to toggle that value or is there an easier way to do this?
I dont want to use free_queue() as that would interfere with other entitys.

Thanks for the help in advance, im new to Godot so sorry if this ends up being a no brainer.

sentences:
Which free HTML5-based game engine meets these requirements? I am experienced with traditional JS and HTML but new to HTML5. I want to develop games in HTML5 so that it can work on all devices and browsers, including IE. Additionally, I require the following features:

Physics Engine
Animation
Some AI
Vector drawing and manipulation
Better user/player controls, et cetera

I know there are many options, but just want some one that can give most flexibility... so I want some thing that can also be compiled to achieve maximum functionality.

One that is in my mind is GameKit; but please tell what you guys would suggest that meets my requirements.

sentences:
2D stop on collision So, this is the code I have right now:

if (keysPressed.Count() > 0)
        {
            switch (keysPressed[0])
            {
                case Keys.W:
                    {
                        characterStats.Velocity.Y += velocityCahge*(-1);
                        break;
                    }
            }
        }

        for (int i = 0; i < 2; i++)
        {
            if (Rectangle.Intersects(anotherRectangle))
            {
                characterStats.Velocity.X *= -1;
                characterStats.Velocity.Y *= -1;
            }
        }

       characterStats.position.X += Velocity.X;
       characterStats.position.Y += Velocity.Y;

The problem with this, is that sometimes, after collision, when pressing button to go in opposite direction from the collided sprite, the character starts going inside the sprite, in the opposite direction to where the button should move him. I know, that it happens cause of that *= -1, but how do i prevent that?

sentences:
need help in implementing KeyListener for 2D game in Java i stated coding my first game in java, i need some help in imlementing KeyListener to fit my game.
after some search in tutorials i've imlemented it like this :

frame.addKeyListener(new KeyAdapter(){

private boolean[] keys = new boolean[120];
public boolean up , down , left , right;

public void tick() {
    up =  keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
    down =  keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
    left =  keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
    right =  keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
}

public void keyPressed(KeyEvent e) {
    if(e.getKeyCode() != KeyEvent.VK_F5) keys[e.getKeyCode()] = true;
    tick();
    if (up){
        yMap+=4;
        direction='n';
        xInd=0;
    }
    else if(down){
        yMap-=4;
        direction='s';
        xInd=2;
    }
    else if(right){
        xMap-=4;
        direction='e';
        xInd=1;
    }
    else if(left){
        xMap+=4;
        direction='w';
        xInd=3;
    }
    wait++;
    if(wait==5){
        yInd++;
        wait=0;
    }
    if(yInd==3)
        yInd=0;
    cha=sprites[xInd][yInd];
    panel.repaint();
}

public void keyReleased(KeyEvent e) {
    keys[e.getKeyCode()] = false;
    tick();
    yInd=0;
    cha=sprites[xInd][yInd];
    panel.repaint();
}

public void keyTyped(KeyEvent e) {
}
});

however every thing is fine in this code, the character is moving correctly the sprites are perfect but it is missing only one thing, the only thing i need is when i move the character in a direction, lets say for exemple UP, with a simple click on the up button (which normaly should make it move with only 4 pixels to up),  the character should complete walking to the next square automaticaly (each square is 32*32 pixels).
i hope i explained well my question and sorry for bad english !

sentences:
Detecting collisions between entities in a text mode game What I'm trying to do is create a terminal soccer game. Without using any modules/packages like pygame or anything required to have something not outside of the terminal. So, I did research on a simple code that was supposedly going to work. It required python as expected. Here's the code found on a website.
# Draw all sprites
for entity in all_sprites:
    screen.blit(entity.surf, entity.rect)

# Check if any enemies have collided with the player
if pygame.sprite.spritecollideany(player, enemies):
    # If so, then remove the player and stop the loop
    player.kill()
    running = False

How could I turn this into something that works in the terminal?

sentences:
Improve bloom quality I'm trying to understang how can I improve bloom effect quality using all known to me optimizations.

Currently I'm making it as follows:

Create new texture using some threshold to extracts areas which should glow
Downsample that texture 4 times (using bilinear filtering - GL_LINEAR)
Blur each texture horizontally using 5x5 gaussian blur.
Blur each texture vertically using 5x5 gaussian blur.
Composite each blurred texture with final image.

I've implemented gaussian blur using Incremental Gaussian Algorithm and set radius to 5. However because of size of last texture after composition bloom has very low quality especially when moving camera:

It doesn't look clear here but you can see it near bunny tail.

Simple workaround to that issue was increasing the radius for smaller textures but then image was more blurred.

Similar effect is when I use solution presented by Philip Rideout.

I get better results when I use blur shader presented here. However I still see some kind of vertical stripes.

I also tried to improve the algorithm by blurring the image and then downsampling it. Then I repeated whole process for the rest of images. But I haven't spotted any difference.

I'm also wonder how it is done in Unreal Engine. I mean how effective blur radius is computed. Documentation claims that each Bloom Size value is "the size in percent of the screen width" and each texture is smaller from previous one 2 times.

sentences: What options are there for developing on the Nintendo platforms? I know of Wario Ware DIY but is this the only option?

sentences: AndEngine - Dragging a sprite that has a path modifier registered to it I'm looking to be able to drag a sprite that is currently on a path from a path modifier.  Currently, I have sprites on a path, and I have stationary sprites that are draggable.  However, simply overriding the sprite's onAreaTouched doesn't work until the sprite completes its path.  How would I do this?

sentences:
How can I pass an enum value to the OnClick method of a button? I am making a UI system for my game where I want to use an enum to define different UI modes. But OnClick function on button doesn't show method which receive enums.

I heard I can pass an integer value to OnClick method and then somehow transform it into an enum. What can I do about it?

sentences:
Adding gesture recognizer (or dragging) to CCSprite I'm trying to allow a CCSprite to be dragged across the screen. I've succeeded so far by doing it on a Layer level (from this tutorial). However, this only allows ONE sprite to be dragged at a time as the method implementation can only identify a single sprite to move at a time.

I'd like to be able to perhaps add a gesture recognizer or somehow implement ccTouchesBegan/Moved in my own little CCSprite subclass.

However, from what I understand, you can't just add gesture recognizers to CCSprites. ccTouchMoved are also not available on CCSprites?? Really confused as to how to implement touches on Cocos2D.

What is the easiest way to add some position translation code to a CCSprite so it can be dragged around? Thanks!

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:
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:
Raycast not hitting a collider I have the following simple raycast from a capsule on a cube:

bool hit = Physics.Raycast
(transform.position, Vector3.down,
jumpSettings.groundJumpDistanceCheck,
jumpSettings.layerMask);

print(hit);

When my layerMask is 8 (terrain), I have set my layer on my cube and my groundJumpDistanceCheck is 2. Then my hit is false.

When my groundJumpDistanceCheck is set to Infinity. Then my hit is still false.

However when I remove the distance parameter:

bool hit = Physics.Raycast
(transform.position, Vector3.down,
/* jumpSettings.groundJumpDistanceCheck, */
jumpSettings.layerMask);

print(hit);

Then hit returns true. This is odd for me, as far as I know when you exclude the distance parameter it's supposed to be Infinity by default. But when I explicitly give Infinity as the distance, it returns false.

I have also used the following code in an attempt to debug my issue, using the desired distance 2f

Debug.DrawRay(transform.position,
Vector3.down * jumpSettings.groundJumpDistanceCheck, Color.red, 60f);

As you can see, the ray does intercept the cube.

I need the reycast to return true with a distance of 2f.

sentences:
Low dexterity game development I am tasked with developing a game for kids with low dexterity (as a college project).
I am stuck trying to find examples of similar games to generate ideas about game play and overall function. The general idea is that these kids wont be using a fully featured controller, it will be more basic, for example just a joystick.

Can anyone point me in the direction where I might find some resources (specifically game play ideas) to aid the in the development of low dexterity games?

sentences:
Alternative path not working I am using Android studio (libGDX), and I can't figure out why alternative paths doesn't work. I've tried it as it said in the book, but it doesn't do anything, it shows a black window and than the program exterminates.
If the .png file would be in the .../android/assets/ folder, it wouldn't work either.

Book: Java Game Development with LibGDX 2nd edition

This is what the book wants me to do it:

public Spaceship(float x, float y, Stage s){

    super(x,y,s);
    loadTexture( "assets/spaceship.png" );
    setBoundaryPolygon(8);

    setAcceleration(200);
    setMaxSpeed(100);
    setDeceleration(10);
}

This is the shortest form that works for me:

public Spaceship(float x, float y, Stage stage) {

    super(x, y, stage);

    loadTexture("core/src/com/dusi/game/ch04/assets/spaceship.png");
    setBoundaryPolygon(8);

    setAcceleration(400);
    setMaxSpeed(200);
    setDeceleration(20);
}

This is what my path looks like:

sentences:
How can you easily determine the textureRect for tiled maps in SFML 2.0? I'm working on creating a 2d map prototype, and I've come across the rendering bit of it. I have a tilesheet with tiles, each tile is 30x30 pixels, and there's a 1px border to delimitate them.

In SFML the usual method of drawing a part of a tilesheet is declaring an IntRect with the rectangle coordinates then calling the setTextureRectangle() method to a sprite.

In a small game it would work, but I have well over 45 tiles and adding more every day, I can't declare 45 intRects for every material, the map is not optimized yet, it would get even worse if I would have to call the setTextureRect() method, aside from declaring 45 rectangleInts.

How could I simplify this task? All I need is a very simple and flexible solution for extracting a region of the tilesheet.

Basically I have a Tile class. I create multiple instances of tiles (vectors) and each tile has a position and a material. I parse a map file and as I parse it I set the materials of the map according to the parsed map file, and all I need to do is render.

Basically I need to do something like this:

switch(tile.getMaterial())
{
   case GRASS:
       material_sprite.setTextureRect(something);
       window.draw(material_sprite);
       break;

   case WATER:
       material_sprite.setTextureRect(something);
       window.draw(material_sprite);
       break;

  // handle more cases
}

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:
Unity method/framework for handling different input modes I'm a very new Unity developer who's looking for a best practice or framework for handling different input modes.  I'm working in C#.  Here's a contrived example:
Sample Map Application
Control Scheme 1:

W/A/S/D keys move map up/right/down/left.
Escape key closes application

Spacebar opens menu and switches to Control Scheme 2
Control Scheme 2:

W/A/S/D moves menu selection up/down/into submenu/back to parent menu.
Escape key closes menu and switches to Control Scheme 1

I realize this is a silly contrived example, but it demonstrates the point.  When we are in a menu we don't want the W/A/S/D keys to also move the map while we are trying to navigate the menu.  This could be done with a bunch of if statements such as
if(moveMode)
   // read keypresses and move map
else if(menuMode)
   // read keypresses and menu navigation

But you can see how this would get messy very quickly if we had lots of modes.  We could also end up with a lot of nested if statements if we have sub-modes for controls.
Surely there's a cleaner way to do this?  Any best practices for this?  Any frameworks?

sentences: High quality graphics but low apk size - How? So I have been playing this app that has so many high quality graphics with some 3d models and tons of levels and it is only 70mb in size.My app that has only 2 pictures is about 20 mb in size lol..Why?

sentences:
How to make changes to array of prefabs in editor to be visible in game window I attached the following script to an empty game object (EnemiesGO) in the editor.

public class EnemiesScript {

[System.Serializable]
public struct EnemyWithType {
    public EnemyScript enemy;
    public EnemyScript.Type enemyType;
}

public EnemyWithType[] enemyPrefabs;
public EnemyScript[] enemies;

void Start ()
{
    enemies = new EnemyScript[enemyPrefabs.Length];

    for (int i = 0; i < enemyPrefabs.Length; i++)
    {
        enemies[i] = Instantiate<EnemyScript>(enemyPrefabs[i].enemy);
        enemies[i].enemyCategory = enemyPrefabs[i].enemyType;
    }
}

}

When I was populating enemyPrefabs (through the editor) I didn't see the prefabs in the popup selection window so I dragged them directly from the Assets window Assets/Resources/Prefabs/EnemyPrefabs. My question is two fold.

If it is possible, how can I get the populated enemyPrefabs array to be displayed in the game window/ scene window before I run the game? In general, I would like to see changes effected from the editor in the game window before I run the game.
How can I access the EnemyPrefabs folder from the popup selection window?

sentences:
Why is Vector3.MoveTowards only working on a single frame? I have three laptops in my scene and I am trying to bring them to front when I click on them. I am able to recognize which laptop is clicked by using the code below, but it doesn't move to the focus position in a single click: it moves only one frame so I have to keep clicking it.

void Update () {
        if (Input.GetMouseButtonDown (0)) {
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);

            if (Physics.Raycast (ray, out hit)) {
                if (hit.transform.name == "Laptop 1") {

                    Debug.Log("Laptop 1 is clicked");
                    Laptop1Trans.position = Vector3.MoveTowards (Laptop1Trans.position, FocusPointTrans.position, moveSpeed);

                } else if (hit.transform.name == "Laptop 2") {
                    Debug.Log("Laptop 2 is clicked");
                } else if (hit.transform.name == "Laptop 3") {
                    Debug.Log("Laptop 3 is clicked");
                } else {
                }
            }
        }
    }

I tried moving the move part to a method but still same behaviour.

Are there any workaround?

sentences:
Behavior Trees :: Actions That Take Longer Than One Tick From what I understand on Behavior Trees, each Behavior should be a short goal oriented Action that could be done in a few iterations.

So for example, below is an image of a Behavior Tree:

Now let us assume that the Drive To Enemy behavior takes more than a few iterations in the tree.  So on each pass Drive To Enemy is called because it is now in the running state.

The problem is I want to call Evade Enemy if an Enemy is nearby.  And considering that Drive To Enemy is always called I never get a chance to call Evade Enemy (Should probably be called Avoid Enemy).

Should I traverse the Tree EACH pass no matter what Action is currently running?
Am I going about this the right way?
What is the proper way of handling such a behavior?

Originally asked on Stackoverflow. Thought here would be a more appropriate place to ask this question.

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

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

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

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

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

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

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

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

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

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

}

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

        Position = TruePosition;
        Rotation = rotation;

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

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

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

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

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

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

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

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

sentences:
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:
Texture2D GetPixels - Finding pixels that are not transparent. Problem as finding more than expected I am trying to make a level design system where I use a low resolution png file with certain pixels filled. My code will turn this location of the pixel in the image into placement of platforms in my game.

But I test the following code with a png i made with only 1 pixel in it (the rest are transparent). But the result is it finds 4 every time. Is it possible there is a discrepancy between the Gimp png and the texture that Unity sees. (In GIMP I used pencil 100% hardness 1px width. There are also settings for 'resolution' of the image, which i left at defaults):

public class LevelBuilder : MonoBehaviour
{
public Texture2D sourceTex;
Color32[] pixels;
int pixelsFound = 0;

private void Start()
{
    pixels = sourceTex.GetPixels32();
    for (int i = 0; i < pixels.Length; i++)
    {
        if (pixels[i].a != 0)
        {
            Debug.Log("found colored pixel. total: " + ++pixelsFound);
        }
    }
}
}

sentences:
Libgdx OrthogonalTiledMapRenderer not rendering map properly I'm using a little hack to change the coordinate system to the one i'm accustomed to (left and up is negative and right and down is positive) but this causes the tiled map renderer to render the map incorrectly, as shown below

Whereas it looks like this in the Tiled map editor

This is the "hack" I'm using to change the coordinate system:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

Camera = new OrthographicCamera(w, h);
Camera.setToOrtho(true, w, h);

My render code

renderer.setView(Camera);
renderer.render();

So is there a workaround to this? Or perhaps a better way to change the coordinate system that doesn't screw up everything?

Edit: The rendered tiles are correct now but the map and everything rendering is still flipped along the y-axis. If I was drawing sprite and stuff, I could always draw them flipped but I don't know how to do it with the tiled map renderer.

sentences:
How can I architecture the cards and boards of this board game? I want to create a board game (at least it's structure and engine, not the graphics), and since It's the first time I do this I don't know where to start.

It's a turn based strategy card game where cards that act differently, some are placed and moved on the board, some are placed but don't move, and some are played from the hand but not placed on the board.

Well, I don't know how to translate this to code. I thought that I should have a interface for the Cards, but since there are various types of cards that act very differently it doesn't make sense . Then I thought that there should be a class for each Player which stores which of his cards are played, which are left etc.. Something like this:

public Class Player
{
 private List<Card> PlayableCards;
 private List<Card> OutOfGameCards;
}

But there's a fixed amount of cards of each type, so its useless to have a List<T> (besides as I said I don't think I'll have a Card class).
Then How should I approach this? Having the cards as individual variables? It doesn't sound right.

The next thing is the Board, it's formed by 8x8 squares where the cards are placed. How do I identify each placed card with a card in the code?

Maybe something like this:

public Class GameBoard
{
 private Square[][] SquareGrid;
}

If I do it this way its easy to separate each square and access it by it's position (SquareGrid[3][4]=3x4). But do I store which card is in each Square? Or do I store in which square is each card? After that there's a "special zone" outside this board and everything gets more messy.

sentences:
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:
Cutout fragment shader pixels arent square It has been solved, link to the final shader:
Shader

The problem (as portrayed by the image below) is that the pixels seem to be, for lack of a better word, cut off. I wish to either display a pixel, or not.

My fragment function, it uses the red value of the vertex colors (displayed by the image blow) on the edge of the mesh which are assigned during mesh generation to determine the pixel cutout "weight" by multiplying it with the texture.

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

    if (i.color.r * tex.r > 0.4f) discard;

    return fixed4(tex.rgb * clamp(i.color.r, 0.3f, 1.0f), 1.0f);
}

sentences:
How do I organize my class structure for networking? In my gameclient I have the following classes(compontents):
Game, GameScreen, GameWorld, Player.

They are structured like this:
Game has two GameScreens: MenuScreen and MainScreen.
MenuScreen has an instance of GameWorld.
GameWorld has an instance of Player.

Now I wanted to add a multiplayer mode to my game. For this I have a class "NetworkConnection".
For the problem keep in mind that this class needs to access individual objects in the game world, as well as vice-versa. Meaning that individual objects (as a simple example the player) need to send messages to the class.
It could look like this for example:

networkConnection.SendPlayerPositionUpdate(x, y, playerID);

The problem

Where do I put my NetworkConnection?

I thought about adding it to "Game" because it is a part of the game (duh).
But when I want the player to tell its position to the server I have to do this:

(Inside the player class)
world.screen.game.networkConnection.SendPositionUpdate(...);

The otherway around (when messages are being received from the server)

(Inside the network class)
game.currentScreen.world.player.SetHealthPoints(receivedHealth);

Where should I place NetworkConnection?
Should I make NetworkConnection a global singelton ?

sentences: How do you rotate the camera using right mouse clicks with Cinemachine? How can I rotate the camera around the player using right-click?

sentences: 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:
Where can I find an accurate map of Earth for a real-time third-person game? I want to create a game that will allow the player to move to any place on Earth. The game will not be first-person, but it will be possible to zoom in quite close nonetheless. What I am lacking is an accurate height-map of the planet. Textures such as albedo, specular or normal would also be very helpful.

I don't know if such textures exist, but an "accurate" height-map should have a resolution of at most a few meters.

The textures do not have to be 100% real. Some parts can be procedurally generated, as long as they look "realistic".

sentences:
Rendering curved text in AndEngine I'm trying to implement a small game using AndEngine and I have a question about the Text. More specifically, I'm wondering if it is possible to deform the text so that you can have a "curved" text or something like this.

I have searched on the Internet but I couldn't find an answer about this. I have seen that there exists a class Transformation in AndEngine but I don't know if its purpose is what I want to do.

sentences:
Player wont rotate properly So Small problem. I'm able to rotate my camera around my player AND rotate the player when the camera moves around it, but the controls don't seem to move with it. Example: W moves forward. If I look right then W should move forward in that direction. It doesn't, instead it will go left (the forward as it was before).

[SerializeField] GameObject GameCamera;

private void PlayerRotateWithCamera()
    {
        Quaternion CharacterRotation = GameCamera.transform.rotation;

        transform.rotation = CharacterRotation;
    }

private void FixedUpdate()
{
    PlayerRotateWithCamera();
    MovePlayer();
}

I only think the player is rotating cause it looks like it is, but if you look at the move tool the axis dont seem to move with the Player

Just in case my movement isn't getting along with the rotation:

private void MovePlayer()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");

        // more realistic ball movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I also have Tool handle rotation set to global because it's a ball, and well, those axis obvious go crazy while rolling around.

Any help at all would really be appreciated!

sentences:
Why does my health bar disappear whenever my character takes damage? I'm making a health bar for my game that looks like this:

public void healthBar(Canvas canvas)
{
    float healthScale = happy.getHP() / happy.getMaxHP();
    Rect rect = new Rect(20, 20,(120 * (int)healthScale), 40);
    Paint paint = new Paint();
    paint.setColor(Color.RED);
    canvas.drawRect(20, 20, 220 * healthScale, 40, paint);
}

This is called every time my game renders. When the game starts it's where I want it, but as soon as my character ("happy") takes any damage, it dissapears. And I know that his hp only gets subtracted by 5 every time he gets hit. So this should not happen?

Example:

@Startup: happy.getHP() == 100, happy.getMaxHP == 100.
when damaged HP -=5, -> happy.getHP() == 95 -> healthscale == 0,95 -> 220 * 0,95 == new width for Rect(?)

sentences:
Why are Visual Studio and VSCode not giving me a dropdown list of methods and options etc? I am using VSCode but I have also tried Visual Studio 2019 to write code for Unity, but when I'm writing the lines I don't get dropdown menus with for example the methods this class holds. Or objects. Or it's properties. etc.: basically, IntelliSense is not working.

Is there a setting that I need to enable in order to get those? Since I've seen everyone who use VSCode and visual studio get these dropdown menus.

sentences:
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:
PyGame custom isometric engine : caching or not? In the game I'm making, I need an isometric view with some altitude, which means players can go behind a hill, and be partly or totally hidden. To avoid re-drawing the whole view tile after tile every time a player moves, I decided to put each horizontal line of tiles in cache and draw each line, one after another from top to bottom. This works pretty well, I think FPS are correct and everything, but memory usage could soon be a problem: a 50*50 map means 99 lines resulting in 98Mo, a 100*100 map means 199 lines and 388 Mo.

Here is a line:

The memory consumption will grow even bigger if I allow higher altitude (each line will be stored in a higher Surface object).

I'm wondering if this cache system was really a good idea... I could code a bit better so that lines are stored in the smallest possible Surface, but there will still be a big memory consumption.

Do you have any advice, any feedback on my system? Is it worth optimizing, or should I forget this cache-idea ?

sentences:
How can I randomly spawn circles on a screen but make sure they don't overlap? I just need a general idea for how to do this.

I have a list of Circle objects.

Circle {

private int yCoord;
private int xCoord;

Circle(int a, int b) {

xCoord = a;

yCoord = b;

}
}

I randomly spawn circles on a screen:

private void spawnCircles() {

   //Spawns new circle in a rectangular region that starts at top corner
   //of screen and has 100 pixels length and width.
   Circles.add(new Circle(rand.next(100),rand.next(100));
}

The radius of the circles is 20 pixels.

How can I spawn these circles randomly so they don't overlap?

All I need is pseudo code or a rough outline.

sentences:
How can I manage the deceleration of units so that they arrive on-target? When I first started trying to set up my air units' movement in my RTS game, I thought it was going to be easy with simple Euler method linear acceleration. This was far from the case as the ship would have to slow to a halt on exactly the target destination, as well as properly compensate after a sharp turn.

How would I decelerate my unit exactly onto the target destination and properly compensate for changed destinations while still factoring in the current velocity in a 2D simulation (Positions and velocity stored in 2D vectors)?

StarCraft 2 does this well, and I'd like to arrive at a similar effect. I want something like shown here. Acceleration can be seen at 0:20. Turning and maintaining momentum can be seen at 1:25. Deceleration can be seen at 1:55. (Find these times in recent comments of the video).

Note: I'm using a lockstep model and frame rate can be either 5 or 10 per second depending on players' computer abilities.

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:
Collision detection for 2D RTS game in C++ I'm currently working on a real time strategy game in C++, and I need to implement a collision detection algorithm. I need to have a very efficient algorithm because this game will be running on mobile devices, and has potential to have many objects on the screen at one time.

I was thinking that a QuadTree might work for this, but then I realized it could be slow since QuadTree's are designed for static objects, and having many objects moving around the Q-Tree might not be optimal.

So I'm wondering what a good algorithm is for detecting collisions? The objects in my game will just have simple axis aligned bounding boxes to check for collisions, so I need a nice spacial indexing system so an object only checks for collisions with objects around it.

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:
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:
Is it possible to detect contact with every frame change when using an animation in SpriteKit? Is it possible to detect contact with every frame change when using an animation in SpriteKit? For example, if I have two nodes of a person walking, I want to detect contact with the ground each time the frame changes (the character is walking on a surface). Just can't seem to get it.

I've tried using a for loop to add a physics body and the contact and collision properties to each node, but that doesn't seem to work. It detects contact once, but that's it. Anyone have any ideas?

Thanks in advance!

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:
Lightwight cross browser library for server side push? I am looking for a lightweight javascript library that allows the server to push update information to the client reliably and regularly. We use a fixed turn time of 300ms and often there are only about 20 bytes of changes. So doing polling using XMLHttpRequest would imply a huge overhead (3-way tcp handshake, http request headers, http response header).

There area number of alternatives, but they have limited browser support:

streaming <script>-tags in another frame (does this work on IE?)
MIME multipart/x-mixed-replace responses (Firefox, Safari, Opera only?)
WebSockets (removed from recent beta version of Firefox and announced to be removed from Opera 11 because of security issues)
Server-sent events (only Opera?)
Java / Flash relays (requires the users to have those plugins installed)
Polling using XMLHttpRequest (huge overhead)

Is there a website which has recent information on which technology works in which browser?  Are there javascript libraries which provide a common cross browser interface that hides the messy details? (Yes, i know that it still requires me to write multiple server sides, but that is rather easy. And more important it is easy to write automatic tests for the server sides).

sentences:
Make objects stack in unity? I have two kinematic rigidbody cubes from the standard 3D objects, I have also enabled contact pairs mode to "all contact pairs", how do I make it so that no matter what angle they collide in they perserve the same angle but just get out of each others space making it look like they're in contact e.g. collided?
Here is my attempt at doing that:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

 public class Physics : MonoBehaviour
{
  private Collider collider1;
  private bool grounded = false; //used to determine if the collider hit something so it doesnt keep going down

// Start is called before the first frame update
void Start()
{
    collider1 = GetComponent <Collider>();
}

// Update is called once per frame
void Update()
{
    if (!grounded) //if the collider hit something, stop going down
    {
        collider1.transform.Translate(0f,-.1f,0f,Space.World);

    }
}

private void OnCollisionEnter(Collision collision)
{
    grounded = true; //the collider hit something
    if(collider1.transform.position.y != collider1.bounds.extents.y) //if this is true, it means it is at the floor so dont move it
    {
        transform.position = new Vector3(collider1.transform.position.x, collision.collider.bounds.size.y + collider1.bounds.extents.y, collider1.transform.position.z); //attempts to put the collider on top of whatever it get

    }

 }

}

This works if the cubes are right on top of each other with no angle:

It also works if one of the cubes collides at a angle to the other cube, when they collide the bottom cube perverse its angle of collision and and the top cube just gets out of the space of the other collider making it look like they have collided:

What doesn't seem to work is if both cubes collide with each other at a angle, although they preserve their angle of collision, and also get out of each others space, they do not remain in contact with each other which if they did would make it look like they have collided.

Instead there is a gap between them, how do I get rid of the gap e.g. make it so that no matter what angle the objects are at they get out of each others space, preserve the angle, and remain in contact with each other to give the illusion that they have collided?

sentences:
How do you create multiple blocks with minecraft addons? I've seen a question like this and I followed the directions they gave (Adding a blocks folder into behavior pack etc.), but I can't seem to get a result, it could be because I want to make 2 blocks (slime_cyan and  slime_purple), OR it could also be because they weren't doing the right version because they said to add the component: "Register To Creative Menu" and on bridge it doesn't even suggest that component (I know I said bridge but I'm not looking for a bridge tutorial).
I just want to create 2 new blocks for Minecraft bedrock with only add-ons, no special modding app, could anyone help me with this?

I'm on Windows 10 edition.
I'm using Minecraft Bedrock 1.16

sentences:
How can I simulate limited AI vocabulary for a word game? I've got a small handful of competitive word games in progress, and while the preference is for (mostly asynchronous) play against other human opponents, I'd like to provide players the option of playing against an AI.  I have my dictionary and I can easily give the AI full dictionary knowledge while it's playing, but my concern is that having the AI regularly playing words they're not familiar with will be a frustrating experience for players: 'I would have won that game if it'd just used words I know!' — even if the AI's overall skill level is turned down.

I'd rather create a weaker AI through a combination of (un)tuned play parameters and a weaker vocabulary — but I'm not sure how to limit that vocabulary to 'common' words.  I've looked at several word frequency lists (for instance, the list of all words that appear in the Project Gutenberg books, sorted by number of occurences) but they all have a number of false negatives: words that everyone knows that simply don't show up with any real frequency (for instance, CHEETAH shows up less frequently in the PG texts than VOCATIVE or SUTTEE).  I've tried using search results to get estimates of a word's popularity, but they also tend to be prone to spurious mis-estimates, and of course it's hard to get search results for an entire dictionary without running afoul of the terms of service on the search engines.

Does anyone have suggestions on other good means of determining a rough frequency of word usage, or other ways of limiting word game AI that will feel natural to players?

sentences:
Text on touch in Algodoo I have just started off in Algodoo and have only a basic knowledge of how it works.

I want to be able to create something that when it is touched by a ball with an English flag on, it shows England and when it is touched by a ball with an American flag, it says America.

How would I do this?

sentences:
Is there a universal method to send key or mouse input to any application from C#? I need method or group of them to send signals to any application (browsers, games, et cetera) about mouse movement or key input.

I can easly retrieve an IntPtr to any process, but I don't know what library or function I must use next.

I know only about SendMessage/PostMessage functions from user32.dll, but these functions can send messages only to applications with standard message loops and it doesn't work with DirectX applications. And I've noticed that something like this:

PostMessage(pFoundWindow, WM_KEYDOWN, (IntPtr)VK_RIGHT, (IntPtr)0);
Thread.Sleep(150);
PostMessage(pFoundWindow, WM_KEYUP, (IntPtr)VK_RIGHT, (IntPtr)0);

sends messages slower than DirectInput in and does not allow player to send, for example, left arrow and space, even in threads.

sentences:
Dynamic force behind logical jumping on 3 axis' I've been working on physical jumping in a 3D environment, I've got it working with a static force. The problem with this is that the force on each axis should be different due to the rotation from the player.

A few things to keep in mind:

A total rotation of 360 degrees can be made;
Forces should never be greater than 0.2 or lower than -0.2;
There is no framework/engine behind the game, it's all hardcore codings.

I've been trying something like;

velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) );
velocity.y = y - ( y + ( 20 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) );

where x,y is the spawned location and rz is the rotation from the player. This way, I'll get the location from the player 20 units in front of him. By subtracting the actual starting position from it, I should've gotten a velocity. However, this turned out to be wrong. It's not going towards the direction the user is facing, it's just doing it's own simple thing.

The jumping/throwing into 1 direction is working perfectly fine. The calculations I made so far are totally messed up and not working as expected.

The results which I am expecting to get is something like;

force.x = 0.1;
force.y = 0.2;

this can be negative or positive, this should be dynamic though.

sentences:
How to seperate gui input from world input? I have a GUI interface and a player that hase code to detect when the mouse is pressed.
When i mess with my GUI buttons the code for the player also fires off; an undesired behavior.  The code in the player is meant for mining or using his current item not meant for buttons.
Some people have suggested using _unhandled_input and mouse filters, but i havent gotten either of those to work.  Im just wondering what the common thing to do in the situation?

sentences:
Getting access violation because of ID3D11Buffer I try to create a simple class store my model variables vertex array and vertexbuffer. So I create an array of myclass to create and manage object dynamically. But when

 hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &pieces[counter].g_pVertexBuffer);

this line run I get the error "Access violation reading location". I try to many things but I never success. If I don't use class and array I don't get this error. Porgram runs without error.

MyClass:

class Piece
{
public:
  double positionX, positionZ,
    red, green,blue;
  bool renderable;
  int type, color, vertexCount;
  XMMATRIX g_WorldPieces;
  ID3D11Buffer* g_pVertexBuffer;
  SimpleVertex* vertices;
  Piece();
  void create(int, int, double, double);
};
Piece::Piece()
{
   g_pVertexBuffer = NULL;
}
 void Piece::create(int t, int c, double pX, double pZ)
{
   g_pVertexBuffer = NULL;
   renderable = true;
   type = t;
   color = c;
   red=green=blue=0.0f;
   if(color == 1)
     red=green=blue=1.0f;
   positionX = pX;
   positionZ = pZ;
   vertexCount = 0;
}

  Piece *pieces;//Global variable which define after defining "ID3D11Device*                       g_pd3dDevice = NULL"

and using objects of myclass:

for(int x=0;x<4;x++)
{
if(x==2)
{
    c=0;
    positionZ = 12.5;
}

for(int y=0;y<8;y++)
{
    pieces[counter].create(typeArray[x][y],c,positionX,positionZ);
    positionX += 5;
    switch(pieces[counter].type)
    {
         //Switching object txt. All cases and breaks are fine.
    }
    fin >> pieces[counter].vertexCount;
    pieces[counter].vertices = new SimpleVertex[vertexCount];
    for(int i=0; i<vertexCountpiyon; i++)
    {
        fin >> pieces[counter].vertices[i].Pos.x >> pieces[counter].vertices[i].Pos.y >> pieces[counter].vertices[i].Pos.z;
        fin >> pieces[counter].vertices[i].Tex.x >> pieces[counter].vertices[i].Tex.y;
        fin >> pieces[counter].vertices[i].Normal.x >> pieces[counter].vertices[i].Normal.y >> pieces[counter].vertices[i].Normal.z;
    }
    fin.close();
    bd.ByteWidth = sizeof( SimpleVertex ) *pieces[counter].vertexCount;
    ZeroMemory( &InitData, sizeof(InitData) );
    InitData.pSysMem = pieces[counter].vertices;
    hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &pieces[counter].g_pVertexBuffer);//THIS LINE IS MY PROBLEM!
    if( FAILED( hr ) )     return hr;
    counter++;
}
positionX = -17.5;
positionZ += 5;
}

When I get access violation counter is 0.

Source code of my project: http://1drv.ms/1nKdoUf

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 exactly do slopes and edges work in this scenario? So this sort of behaviour probably exists in other games, but the old Kirby games - Kirby's Adventure and Kirby's Dreamland 2 - is where I noticed it.

So, when dealing with regular block platforms, Kirby's hitbox acts like a simple rectangle, as you'd expect, as evidenced by the fact that you can stand like so:

On the other hand, when dealing with slopes of any kind, standing on them looks like this:

As you can see, if we were still using the rectangular hitbox, it would be halfway in the ground. This sort of behaviour is easily explained, however, buy a hitbox shaped like a 'diamond' or a 'plus'. (This is probably so that it doesn't look like Kirby is hovering in midair when walking on slopes)

Platforms such as these show perfect consistency with the 'diamond' hitbox model:

However, of course, the first screenshot shows that it's not possible for a diamond-shaped hitbox to be used all the time, or you would be able to 'slide' off any corner as if there was a slope there.

In fact, formations such as this show that it can't even be based on particular tiles, at least not 'full' tiles. (16x16, Kirby's size) (Otherwise you couldn't walk all the way up that slope)

Another model I've come up with is that the hitbox is always rectangular, but all slopes in the game are actually 'sunk' deeper than the tiles would have you believe. However, the stake-shaped platforms in the third & fourth screenshots invalidate this model, since then you wouldn't be able to stand at the top middle like you see there.

By the way, slopes on the ceiling work symmetrically, as can be seen in water stages.

While it seems intuitive to the player, how could we program a similar collision system ?

N.B. I am not asking for speculation on the internal workings of Kirby (unless someone here actually developed the collision system for those games - unlikely). Just a general approach.

sentences: Why four buttons rather than two? I'm curious that most console controllers released these days - and all handheld consoles - contain four main buttons rather than two. Obviously increases in processing power, graphics engines etc, have allowed for more complex games, but is there an argument to be made that two buttons are really enough to create some great games? In other words, would someone releasing a new handheld console on the market today be foolish not to include four?

sentences:
Body inside other body after collision I'm using bullet to create a 2D topdown game. In my physics proof of concept, I can walk around and push a box. However, if I walk too fast the character goes through the box, instead of colliding with it. See gif:

This seems like a common thing to me. However, I cannot find other people having the same problem, so that's why I'm asking a question directly. I'm using a DiscreteDynamicsWorld with two rigid bodies which I step through at 60Hz.

Why does this happen?
Is there a way to tune bullet to support higher speeds and prevent this issue?

Help is very much appreciated.

Edit

Regarding the question about how I setup collision shapes:

btConvexHullShape shape;
shape.addPoint({-size, size, 0.0f});
shape.addPoint({size, size, 0.0f});
shape.addPoint({size, -size, 0.0f});
shape.addPoint({-size, -size, 0.0f});

sentences: How can I run native code (in a DLL) from UnrealScript in UT/UE1? I'm seeking an example showing how to create a DLL that can be called from UnrealScript in Unreal Engine 1 or Unreal Tournament.

sentences:
how to keep display tick rate steady when using continuous collision detection? (I've just found about this forum). I hope it is ok to repost my question again here. I posted this question at stackoverflow, but it looks like I might get better help here.

Here is the question:

I've implemented basic particles motion simulation with continuous collision detection.

But there is small issue in display.

Assume simple case of circles moving inside square. All elastic collisions. no firction. All motion is constant speed. No forces are involved, no gravity. So when a particle is moving, it is always moving at constant speed (in between collisions)

What I do now is this:

Let the simulation time step be 1 second (for example). This is the time step simulation is advanced before displaying the new state (unless there is a collision sooner than this).

At start of each time step, time for the next collision between any particles or a particle with a wall is determined. Call this the TOC time; let’s say TOC was .5 seconds in this case.

Since TOC is smaller than the standard time step, then the system is moved by TOC and the new system is displayed so that the new display shows any collisions as just taking place (say 2 circles just touched each other’s, or a circle just touched a wall)

Next, the collision(s) are resolved (i.e. speeds updated, changed directions etc..).

A new step is started. The same thing happens. Now assume there is no collision detected within the next 1 second (those 2 circles above will not be in collision any more, even though they are still touching, due to their speeds showing they are moving apart now), Hence, simulation time is advanced now by the full one second, the standard time step, and particles are moved on the screen using 1 second simulation time and new display is shown.

You see what has just happened: One frame ran for .5 seconds, but the next frame runs for 1 second, may be the 3rd frame is displayed after 2 seconds, may be the 4th frame is displayed after 2.8 seconds (because TOC was .8 seconds then) and so on.

What happens is that the motion of a particle on the screen appears to speed up or slow down, even though it is moving at constant speed and was not even involved in a collision.

i.e. Looking at one particle on its own, I see it suddenly speeding up or slowing down, becuase another particle had hit a wall.

This is because the display tick is not uniform. i.e. the frame rate update is changing, giving the false illusion that a particle is moving at non-constant speed while in fact it is moving at constant speed. The motion on the screen is not smooth, since the screen is not updating at constant rate.

I am not able to figure how to fix this. If I want to show 2 particles at the moment of the collision, I must draw the screen at different times. Drawing the screen always at the same tick interval, results in seeing 2 particles before the collision, and then after the collision, and not just when they colliding, which looked bad when I tried it.

So, how do real games handle this issue? How to display things in order to show collisions when it happen, yet keep the display tick constant? These 2 requirements seem to contradict each other’s.

sentences:
Correct order of entity updates and collision detection I'm trying to simulate a number of units walking in a single file. My update loop looks like this:

for each unit:
    n = compute next position
    if n is empty then move to n

If I start the loop from the foremost unit, it moves first and leaves its current position to the unit behind it. When the loop finishes every unit will be moved one step. However if I start the loop from some other unit, it can't move since its next position is occupied by the unit in front of him. So, in the worst case it would take n-1 ticks for a unit to move one step (where n is the number of units in front of it).

I tried changing my update like this:

for each unit:
    save current position to p
    n = compute next position
    move to n

detect colliding units and move them back to their p positions

In this case the units move fine, as long as we have a single group. But another problem arises when the group collides head-first into another group. In this case, the foremost units will collide and they need to be moved back, but their previous positions will be occupied (by the units behind them) and they also need be moved back. This method also needs too many iterations.

How do RTS games tackle this problem? Is there a standard approach?

sentences:
physics engine without time steps I'm looking for physics engines that doesn't use time steps. I don't think time steps are reliable, and I don't like how without tweaking the engine a bullet going too fast can pass through a wall without colliding it. Moreover I suspect they do a lot of unnecessary computations.

I thought of a physics engine concept where all the movements are represented by forces and movement beginning time. In such an environment as long as no event occur the engine would not do any computation.

I imagine the following:

I shoot a bullet in space, an object is created representing its physics properties.
The engine compare the bullet trajectory with other's to find if it's gonna collide with an other object.
It finds a collision, in 3 seconds.
An callback is programmed to trigger in 3s to process the collision.
In the meantime if no other event occur (like shooting an other bullet, changing an object trajectory, etc...) no other computation is done.

Does such an engine exists?
Is there a name to this technique?
Have you ever tried using this approach?

sentences:
8 Directional Character Spritesheet Generator I've searched for the past hour and didn't find anything worth looking.

I'm creating a game, and I'm just starting. I found this site to help me create my characters, but I want something to create characters with 8 directions, instead of just 4. Are there any of these online?

I don't need the animation part for now, just the 8 direction sprites

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:
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:
GJK point-in-tetrahedron - capping the number of searches? The very informative mollyrocket video has given me quite a lot to work with, but one thing that the video seems to suggest is that the algorithm should ideally run until it definitely determines whether or not there's a hit.

I was of the idea that if there's no collision, it would be obvious by testing the dot product of the latest point against the search direction; if it is not positive, then we did not pass the origin, so a tetrahedron which encloses the origin simply cannot be built.

In cases where there is a hit OR a clear miss, the routine typically picks up less than 11 loops through. However, as I tend towards 'questionable territory' and the definitive hit/miss is visually less distinct, there are times when the method apparently continues to pass the origin yet construct unsuccessful simplexes.

Is it common to cap this kind of function at a max number of tries? Right now I am somewhat arbitrarily using the number of points in one shape times the number of points in the other shape; in other words:

max_tries = len(shape1.pts) * len(shape2.pts)

It feels a bit hacky and I have to assume that the routine is geared towards simply running ad nauseum until it smacks into a clear hit/miss situation.

Has anyone experienced this before? Is this a problem or an anticipated safety measure in such an algorithm? If it needs to be done I'll gladly share some code, but I think it stands as self-evident that it is kind of a longer read than most code snippets so I've abstained for now.

sentences:
Bluring behind something then drawing text? I want to basically make a blur shader in glsl and use it like Windows 7 does for Windows. I want to for example draw something and then blur a rectangle, then draw text over it.

If someone could point me in the right direction on how to do this I'd be very grateful.

Thanks

sentences:
Learning math from the basic to become a game programmer Hi i want to become a game developer. Im currently doing some web programming. I want to learn
game programming. Im not good in math thats why i decided to learn from basic math to be sure i will not missed
some important concepts. Do you have some advice if my way of learning is ok. thanks.

sentences:
Unity animation tool doesn't save changes I'm trying to create an animation inside Unity using the animator tool, however the record tool isn't recording my changes and I'm struggling to get this to create animations.

I have created an example here:
https://i.gyazo.com/91f88b3531b4fb3ffd4100d40f06bdcf.mp4

I have tried recreating the animation file, but no matter what I do it refuses to record the element?

Any information would be appreciated, as it appears unity may be bugged.

When applying an update between tweened keypoints the fields for X Y Z are red and do not apply changes

sentences:
Non-Perfect maze generation with objectives I need an algorithm that can generate mazes with these requirements:

Allows for random structures to be made (Ex: a center spawn area, objective points and 'Caverns (corridors with 2 or more entrances and a width > 1)' )

Generates paths from structures to required connections

Can be implemented in Python with relatively little difficulty

No extra modules (unless supports Python 3.5.5)

As an example, the objectives would look like this in game (I use integers to store the walls in the ray caster):

2 2 2 2
2 0 0 2
2 0 0 2
2 2 2 2

I also tried looking on wikipedia
and I found this semi-helpful link
but none have helped me achieve this so far.

sentences:
Deterministically shuffling of array I couldn't find an answer to this so I'm asking here, I've made a voxel engine and it's working reasonably well, except for a small detail: I have yet to figure out how to seed my simplex noise engine, the internet gave me two suggestions:

Generate simplex of one dimension higher with the fourth axis being the seed, this worked but was painfully slow in comparison.

Shuffle the permutation table, I like this idea. It should (if my understanding of math is correct) yield 512! permutations, however I don't know how to shuffle an array reliably in a deterministic manner, I want the shuffle to be the same every time I use the same seed.
so something like shuffle(perm, 12) would return the same every time the seed is 12 but something different when the seed is 22321.

So what I really wish to know is either how to shuffle the permutation table in a fast, reliable and deterministic manner using a seed or a better method for seeding simplex noise.

sentences:
Game engine for turn based wargame I would like to ask for game engine recommendations for turn based wargame development. I would like my engine to support;

hex maps
agents on hex
rule based ai for the agents
terrain on hex
cultural features on hex
los analysis
abstract agent templetes

sentences: Tile draws pixels from adjacent tiles Whenever I try to draw from the tile palette, this is the result. why does this happen? I have tried messing around with the palette, how the sprite editor has sliced the tiles and played around with the anchors and cell sizes, but to no avail. I found a few threads about offset tiles in the tile map, but it doesn't help at all. Any leads as to why this happens?

sentences:
Is Goal-Oriented Action Planning (GOAP) a valid replacement for state machines outside the realm of AI? I just learned about Goal-Oriented Action Planning (GOAP, sources below) as used in AI programming. I'm making a state machine for a player-controlled character and was wondering if it can be replaced by a GOAP model? Does this make sense? Or is GOAP only for AI?
Sources:

Goal-Oriented Action Planning (GOAP)
10 Reasons the Age of Finite State Machines is Over
Common Ways to Implement Finite State Machines in Games

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:
Starting my own development company I completed my postgraduate education, and I am interested in starting my own game development company.

I have a team of six members consisting of animators and artists.

I'd like you to suggest all the requirements for starting a new company and suggest whether it would be good for me to start it or not. I have a few game concepts, and I am really passionate about it.

sentences:
Unity3d or WebGL: Where should I go? I am interested in making a simple 3D game this summer, and I'd prefer if it were playable in a browser. My choices I am considering are Unity and WebGL. Currently I have no experience in either. But I have taken an introduction course to OpenGL. As well I will later be taking a course that will use Unity. I have some C# experience, but no web background.

The factors I'm considering are ease to learn and the penetration each has. I know Unity games can be uploaded to Kongregate, which seems like a pretty big deal if I made a game that would be somewhat successful. But of course that may not be the case at all.

Which way should I lean? Personally I think learning WebGL would be the easiest transition, but I am not sure

sentences:
What caused "falling out of the world" and what fixed it? A lot of early 3D games had the problem where you'd be trundling merrily along and suddenly everything was black, with an island of what looked like the hollow facade shell of the scene you'd been walking through rising into the distance above.  Because you'd fallen out of the world.  I remember this being a particular and long-standing problem for Bethesda Softworks, though they certainly weren't alone.  It's been a while since I've seen it in the wild, so it seems we've gotten past it.  My question is two-part:

1) What was the cause, or causes, of this?  (My guess is that it's to do with floating-point-precision related seams between polygons, interacting with point-modeled character position, i.e. floor chunk A ends at position 1.0, floor chunk B starts at position 0.9998 and for a microsecond your position is 0.99992, and boom, you fall through the world.  But that's just a guess.)

2) How did it get fixed?

sentences:
Resuming a previous scene from a current scene using the Unity3D I am building a first person shooter game using unity and I am facing the problem of resuming a scene from its current state. It would be easy to pause the scene by using the Time.timeScale = 0.0; within the scene itself. But I am loading a pause scene to ask whether the user wants to restart, resume or quit. But when I click on resume, it loads the scene I want, but it is totally fresh (i.e when the Ammo is supposed to be half full, it is full. Or the enemy has lost a part of his life, but then it starts with life completely full)

How do I resume the previous scene from where it left off using  SceneManager? This could have been somewhat easy by using the Application.loadLevel() and making sure that application does not destroy the previously loaded state.

Here is the script I made for the pause scene.

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

public class pauseScript : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }

    public void exitPressed()
    {
        Application.Quit();
    }

    public void restartPress()
    {
        SceneManager.LoadScene("prototype1");
    }

    public void resumePress()
    {
        SceneManager.LoadScene("prototype1");
    }
}

Here is the code snippet for calling the pause menu scene. and this is in another script.

SceneManager.LoadScene ("PauseMenu");

Is there anyway to save the current scene before calling the PauseMenu scene as shown in the above statement?
This may be a simple enough query to you but I am completely new to game development as a whole and I am using unity for the first time, so please go easy on me.

Thanks

sentences:
Problem with coroutines unity 3d I cannot understand why the coroutines are not waiting the designated number of seconds before executing the code below it. At the moment, the animation bleeds into the next state. I could get around this by using .time and if statements but I thought the whole point of coroutines is that you can avoid that sort of mess.

         public IEnumerator LoadBow()
     {
         this.gameObject.GetComponent<Animation>().CrossFade("Load_Bow");
         yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Load_Bow"].length);
         aimStates = AimStates.Draw;
     }

     public IEnumerator DrawBow()
     {
         this.gameObject.GetComponent<Animation>().CrossFade("Draw_Bow");
         yield return new WaitForSeconds(this.gameObject.GetComponent<Animation>()["Draw_Bow"].length);
         aimStates = AimStates.Aim;
     }

     public void Aiming()
     {
         moveTarget.SetActive(false);
         switch(aimStates)
         {
             case AimStates.Load:
                 StartCoroutine(LoadBow());
             break;

             case AimStates.Draw:
                 StartCoroutine(DrawBow());
             break;

sentences: How does Unity store references to GameObjects in a scene A Monobehaviour can have references to GameObjects in the same scene, but Prefabs, ScriptableObjects can't reference GameObjects in a scene. While  Assets, Objects and serialization  covers references to assets, i.e. actual files, it doesn't explain how references to scene objects work. But it has to be some kind of serialization, for example, do they also consist of a GUID part and a local id part when serialized?

sentences:
Why the Render texture is not working when trying to preview a camera on a object? In the editor in Assets right click Create > Render Texture
Then changed the Render Texture name to: SecurityCameraTexture

Dimension 2D size 480 x 256

Then created a new material Assets right click Create > Material
Then changed the material name to: SecurityFootage

Then changed the material shader from Standard to Mobile/Diffuse

Then dragged the render texture(SecurityCameraTexture) to the top right image place of the SecurityFootage(material)

Next I have a tv object in the scene.
In the tv screen I dragged the new material:

The SecurityCamera. On the SecurityCamera I attached the script that rotate the camera from side to side:

And the script:

using UnityEngine;
using System.Collections;

public class scr_camera : MonoBehaviour {

    public float rotate_amount;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        transform.rotation = Quaternion.Euler(transform.eulerAngles.x, (Mathf.Sin(Time.realtimeSinceStartup) * rotate_amount) + transform.eulerAngles.y, transform.eulerAngles.z);
    }
}

Last step I did was to drag the render texture(SecurityCameraTexture) to the camera Target Texture.

When running the game and watching the tv I don't see the camera preview in the tv. It should the show the camera preview the camera moving from side to side and what the camera is showing.

The camera preview was working fine before I started working with the render texture. But it's not showing the preview in the tv.

sentences:
Advice on mapping tiles to a height map/3D world I've been attempting to think of a way to map tiles to a height map. Where a grid can be either layered or integrated into the world data. However, since I am not using voxels I could use some advice on where to start or look into on doing something like this.

For example a 16x16 grid layout on 3D world data.

sentences:
Using Smartphone as a steering wheel on Linux I am making a car simulation game, however, I find it being inefficient and difficult to test the simulation realism and accuracy via keyboard or even joystick control. I need a steering wheel controller to do this. However, getting good steering wheel controllers is so difficult - they cost a lot. However, I noticed(when playing Real Racing 3) that the phone actually can handle such task kinda well.

What sort of code could I write to use a smart phone as a steering wheel?

Looking forward to see some useful answers ;)

sentences:
How do you script movement of two or more characters at the same time? Its not quite clear how to move 2 characters at the same time from and to fixed positions.  Within the tutorials for RPG Maker MV users are shown how to script the movement of single characters at a time to fixed positions.  In the tutorials, users are also shown how to have multiple characters moving at the same time in random directions or possibly in repeating loops.  However, its not quite clear how to move 2 or more characters at the same time in a one-time scripted manner.

For example, at the start of a conversation, its normal to move the characters to specific screen positions so that they can begin uttering dialogue much like actors on a stage.  However, the only way I know how to do this is moving one character at a time, which you often see in many classic jrpgs.   In the modern age, however we have a lot more tools and resources at our disposal, so it doesn't seem necessary to move them one at a time. Why not just have them move at the same time so the player doesn't have to watch a second or two of rapid sequential movement?

Is there a way to script the movement of 2 characters at the same time to fixed positions so that they can begin speaking cutscene dialog?

How does one script simultaneous movement of characters that is not random or looped?

I don't have enough rep yet to create an rpg maker mv tag.

sentences:
Debugging/Logging Techniques for End Users I searched a bit, but didn't find anything particularly pertinent to my problem - so please do excuse me if I missed something!

A few months back I inherited the source to a fairly-popular indie game project and have been working, along with another developer, on the code-base.  We recently made our first release since taking over the development but we're a little stuck.

A few users are experiencing slowdowns/lagging in the current version, as compared to the previous version, and we are not able to reproduce these issues in any of our various development environments (debug, release, different OSes, different machines, etc.).  What I'd like to know is how can we go about implementing some form of logging/debugging mechanism into the game, that users can enable and send the reports to us for  examination?  We're not able to distribute debug binaries using the MSVS 2010 runtimes, due to the licensing - and wouldn't want to, for a variety of reasons.

We'd really like to get to the bottom of this issue, even if just to find out it's nothing to do with our code base but everything to do with their system configuration.  At the moment, we just have no leads - and the community isn't a very technically-savvy one, so we're unable to rely on 'expert' bug reports or investigations.

I've seen the debug logging mechanism used in other applications and games for everything from logging simple errors to crash dumps.  We're really at a loss at this stage as to how to address these issues, having been over every commit to the repository from the previous to the current version and not finding any real issues.

sentences:
AS3 Starling in Fullscreen Mode cuts off most of the screen I have a mixed mode (classic Flash Renderer + Starling) AIR AS3 project that I'm switching to fullscreen with

 stage.align=StageAlign.TOP_LEFT;
 stage.scaleMode=StageScaleMode.SHOW_ALL;
 // Swtich to Fullscreen with
 stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

When I do this, I have a callback on the Event.RESIZE event to resize my Starling instance to fullscreen:

private function resizeStarling(e:Event):void
{
            var size:Point = new Point();
            if(this.stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE)
            {
                size.x = Capabilities.screenResolutionX;
                size.y = Capabilities.screenResolutionY;

            }
            else
            {
                size.x = WIDTH;
                size.y = HEIGHT;
            }

            RectangleUtil.fit(
                new Rectangle(0, 0, stage.stageWidth, stage.stageHeight),
                new Rectangle(0, 0, size.x, size.y),
                ScaleMode.SHOW_ALL, false,
                Starling.current.viewPort);
}

The set to FULL_SCREEN_INTERACTIVE turns all my normal flash Stage object based UI and visuals to full-screen mode.  However, while the Starling graphics are correctly upscaled, they only occupy the upper left corner of the screen, and the remaining three quadrants are cut off.  I haven't validated yet, but I suspect that the segment being displayed is the same dimensions as the original windowed stage size.  Any ideas on what I'm forgetting to do to achieve fullscreen Starling displays that are actually fullscreen?  This is on OSX.

sentences:
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:
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:
SSAO in my unity games has flickering lines at the top and right side of the screen I've tried both the built-in unity ambient occlusion that comes with the post-processing stack, as well as another one ported from the Microsoft MiniEngine by someone: https://github.com/keijiro/MiniEngineAO.
Both of them have the same issue pictured below with these dark lines and the occlusion on the faces around the lines seem to flicker as the camera moves.

I've been trying to solve this issue by using the Microsoft MiniEngine AO and changing the compute shader. In one of my attempts, I changed the output of the shader from the calculated occlusion:
Occlusion[OutPixel] = lerp(1, ao, gIntensity);
to the depth texture UV to be sampled: Occlusion[OutPixel] = QuadCenterUV.x;
(QuadCenterUV probably being the center of the UV to sample for the 4 depth texture samples:)

// Fetch four depths and store them in LDS
#ifdef INTERLEAVE_RESULT
    float4 depths = DepthTex.Gather(samplerDepthTex, float3(QuadCenterUV,
DTid.z));
#else
    float4 depths = DepthTex.Gather(samplerDepthTex, QuadCenterUV);

and this was the output:

With a similar effect on the Y axis. I think that may be the cause, as the distortion of the UVs matches the distortion of the effect. I don't know how to fix this, because I don't have enough knowledge about RWBuffers or compute shaders. My terrain is generated by a noise function as a 2D array, constructed into a mesh, the mesh runs Mesh.RecalculateNormals(), and then is sent to the Mesh Filter. What is the issue here, and how can I fix it, or can anyone fix it for me?

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:
I keep coming across an error "Cannot read property 'innerHTML' of undefined" I'm new to game designing and have to create a game for my project but I keep coming across an error to do with:

index.html:93 Uncaught TypeError: Cannot read property 'innerHTML' of undefined
at drawMissiles (index.html:93)
at gameLoop (index.html:140)

Any idea how to fix this problem?
    drawMissiles()
}

function drawMissiles() {
  document.getElementsByTagName('missile')[0].innerHTML   <--- (index.html:93)
    for(var i = 0 ; i < missiles.length ; i++ ) {
        document.getElementById('missile').innerHTML +=
             `

`;

sentences:
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:
Why is Raycast hitting masked layer? Many questions have been posted on this topic but I'm facing a weird behavior which I could not find an explaination for.

I perform a raycast giving it a LayerMask parameter which is defined as public variable and set in the inspector with thick on layer "Wall" and "Enemy".

At first glance it appeared to work fine because raycast rightly stops  on GameObjects with that layer.

But then I saw that it stopped also on GameObjects with default layer, like if the LayerMask was ignored. Is there something I'm missing?

According to this answer I set up everything correctly and I expected it to work fine.

Looking at the inspector at Runtime I can clearly see that my mask is set only to "Wall" and "Enemy", and that the GameObject the collider is attached to has default layer set. I'm then stating that the mask the way I'm using it does not exclude other layers. The only way I found to have this working is by setting that GameObject layer to Ignore Raycast but in this case the LayerMask is not necessary.

I'm calling the function this way:

RaycastHit2D inSight = Physics2D.Raycast(start, end, lm);

Maybe is there something different using Physics2D?
I would really enjoy touse LayerMasks instead of giving specifically Ignore Raycast to whatever I want to ignore. Any clue?

sentences:
XNA: My bullets lag the game the first time they're fired, but not after I'm working on a SpaceWar-esque project to get comfortable with XNA. I have a Ship DrawableGameComponent and a Bullet DrawableGameComponent. The player's Ship is created at the start of the game, and the Bullets are created for each Ship as part of its constructor.

In my Ship constructor, I have the following code:

for (int i = 0; i < 5; i++)
{
    activeBullets[i] = new Bullet(game);
}

The relevant part of my Ship's shoot() function is as follows:

activeBullets[bullet].Visible = true;
activeBullets[bullet].Enabled = true;
activeBullets[bullet].position = this.position;

The first five times I shoot() (that is, once for each bullet object that the ship is allotted), there is lag that I think is due to the bullet sprite being loaded. I've tried setting Visible and Enabled to true in the ship constructor loop where the Bullets are instantiated, but the first-five-shots lag persists. Any shots beyond the first five are completely lag-free.

How do I load the Bullets properly ahead of time so that there is no lag on the first shots?

sentences:
SceneNode transform and Eye and Center position I am learning some inner workings of game engine development and have come across this confusion. To explain what I am trying to do, I want to start with an example:

Let's say that I have an object (e.g a cube) that moves forward. I want to add a camera that follows the object (e.g 3rd person camera). For this, my SceneGraph looks like this (XML type markup to show hierarchy):

<GameObjectNode mesh="cube.mesh" position="(0.0, 0.0, z)">
    <CameraNode position="(0.0, 10.0, 15.0)" />
</GameObjectNode>

This allows my camera to "follow" the cube because the camera's world transformation is:

camera.worldTransform = parent->worldTransform * camera.transform;

This all makes sense in terms of transformations in the world. However, when it comes to view transforms, this is where I am confused about. All the hardware APIs use have something like setViewTransform(float *matView, float *matProjection) and the view matrix is typically calculated using something like lookAt(vec3 eye, vec3 center, vec3 up).

My camera transform is calculated using the formula above. However, the lookAt matrix function requires position as vector (eye). Is there a way to create lookAt matrix function that does not use vectors to get position? Or is there a way to extract position from transform matrix?

EDIT: I was able to use the worldTransform matrix last "vector" to get the position vector as that's where the translation parameters were. However, I still have a problem with center one because the the center vector must also be calculated using matrix transform. How can I get the coordinates of center in relationship to Eye.

sentences:
How do I calculate the bounding box for an ortho matrix for Cascaded shadow mapping? I've been trying to get a cascaded shadow mapping system implemented on my engine, though it appears to be that the bounding boxes for the cascades aren't correct.
The part I'm interested in can be found here, under the function name "CalcOrthoProjs".
I've been trying to understand the matrix multiplications with this answer, and the ogldev variable and function names are kind of confusing me.
This is how I modified ogldev's function to work with my variables:
void Scene::calcOrthoProjections(Camera &camera, glm::mat4 LightView, std::vector<glm::mat4> &orthoContainer, std::vector<GLfloat> &cascadeEnd) {
GLfloat FOV, nearPlane, farPlane, ratio;
camera.getPerspectiveInfo(FOV, nearPlane, farPlane);
ratio = static_cast<GLfloat>(RE::config.height) / static_cast<GLfloat>(RE::config.width);

GLfloat tanHalfHFov = glm::tan(glm::radians(FOV / 2.0f));
GLfloat tanHalfVFov = glm::tan(glm::radians((FOV*ratio) / 2.0));

for (GLuint i = 0; i < NR_CASCADES; i++) {
    GLfloat xn = cascadeEnd[i]     * tanHalfHFov;
    GLfloat xf = cascadeEnd[i + 1] * tanHalfHFov;
    GLfloat yn = cascadeEnd[i]     * tanHalfVFov;
    GLfloat yf = cascadeEnd[i + 1] * tanHalfVFov;

    //The frustum Corners on View(Camera) space
    glm::vec4 frustumCorners[8]{
        //Near Face
        glm::vec4( xn,  yn, cascadeEnd[i], 1.0),
        glm::vec4(-xn,  yn, cascadeEnd[i], 1.0),
        glm::vec4( xn, -yn, cascadeEnd[i], 1.0),
        glm::vec4(-xn, -yn, cascadeEnd[i], 1.0),
        //Far face
        glm::vec4( xf,  yf, cascadeEnd[i + 1], 1.0),
        glm::vec4(-xf,  yf, cascadeEnd[i + 1], 1.0),
        glm::vec4( xf, -yf, cascadeEnd[i + 1], 1.0),
        glm::vec4(-xf, -yf, cascadeEnd[i + 1], 1.0),

    };

    //The frustum Corners in LightSpace
    glm::vec4 frustumCornersL[8];

    GLfloat minX, maxX, minY, maxY, minZ, maxZ;
    minX = minY = minZ = std::numeric_limits<GLfloat>::max();
    maxX = maxY = maxZ = std::numeric_limits<GLfloat>::min();

    glm::mat4 cam = (camera.getProjection() * camera.getView());
    glm::mat4 camInverse = glm::inverse(cam);

    for (GLuint j = 0; j < 8; j++) {
        //View(Camera) space to world space
        glm::vec4 vW = camInverse * frustumCorners[j];
        //world space to light space
        frustumCornersL[j] = LightView * vW;

        minX = min(minX, frustumCornersL[j].x);
        maxX = max(maxX, frustumCornersL[j].x);
        minY = min(minY, frustumCornersL[j].y);
        maxY = max(maxY, frustumCornersL[j].y);
        minZ = min(minZ, frustumCornersL[j].z);
        maxZ = max(maxZ, frustumCornersL[j].z);
    }
    orthoContainer[i] = glm::ortho(minX, maxX, minY, maxY, minZ, maxZ) * LightView;
 }
}

LightView represents a matrix created with:
glm::LookAt(-glm::normalize(light.direction), glm::vec3(0.0), glm::vec3(0.0, 1.0, 0.0))

camera.getProjection() returns the perspective matrix of the main camera
camera.getView() returns a LookAt at the objective the camera is looking at
The orthoContainer values are then fed into the depth rendering unaltered afterwards (by anything other than the model matrix of each model)
I wrote some comments on how I think the math is done, trying to understand what's wrong.
The result is a frustum too wide, resulting on low res shadows(even for the closest shadow map):

and this is the depth map of the closest shadow map:

any insight as to why this isn't working, or any other best practice advice, is welcome.

sentences:
How can I efficiently render lots of 2D quads? I have lots of 2D quads. I write their local vertex position info to a buffer (accompanied with a world transform matrix) which gets sent to the render thread.

I then pass the world transform matrix as a uniform into the vertex shader which applies itself to each vertex and works fine. I however have to make a call to glDrawElements() for each quad I want to render because each one has a different world transform.

What is the most efficient way for me to render all of these quads? Should I do what I'm already doing, or should I calculate the world position for each vertex on the CPU before I write them to the buffer, so I can attempt to batch more quads into a single glDrawElements() call? Or is there another approach?

sentences:
XNA Deferred Shading, Replace BasicEffect I have implemented deferred shading in my XNA 4.0 project, meaning that I need all objects to start out with the same shader "RenderGBuffer.fx". How can I use a custom Content Processor to:

Not load any textures by default (I want to manually do this)
Use "RenderGBuffer.fx" as the default shader instead of BasicEffect

Below is the progress so far

   public class DeferredModelProcessor : ModelProcessor
    {
       EffectMaterialContent deferredShader;

       public DeferredModelProcessor()
       {

       }

       protected override MaterialContent ConvertMaterial(MaterialContent material, ContentProcessorContext context)
       {
           deferredShader = new EffectMaterialContent();
           deferredShader.Effect = new ExternalReference<EffectContent>("DeferredShading/RenderGBuffer.fx");

           return context.Convert<MaterialContent, MaterialContent>(deferredShader, typeof(MaterialProcessor).Name);
       }
    }

sentences:
Backface culling without light leaking through I want to be able to see through walls, so to do this I used planes for the walls, and enabled backface culling. However with shadow mapping I have a lot of light leaking through:

I read that using a thick wall solves this, so I did just that. This solved the leaking light:

but now I cannot see through the walls (camera is within the room in the above screen), all the backfaces are inward.

How could I prevent light leaking, as well as enable seeing through the walls?

sentences:
Can Unity censor my content or invalidate my license for offensive content? If I make an offensive game can they pull my license and prevent me from selling my game? Like we're talking think of the most offensive thing you can think of: you're in charge of the most efficient genocide against some specific racial/religious/political group, your choice... now imagine the game is mocking victims and generally being extremely rude, violent, and insensitive.

Now I have no intention of making such a horrible game but I am using an extreme example to ask my question. It's not unheard of for less extreme things to get blocked by brands who didn't want to associate with them, for example I saw that Apple removed the Confederate flags from Civil War games in the App Store.

Would Unity be able to prevent me from using their game engine or selling my game after I had already purchased appropriate Unity licenses and completed the game?

Do they have that kind of power with their licensing model? Or would even the most extreme cases still be legally allowed to sell the content?

I want to make something that may have some mildly provocative/divisive content (not as offensive as say, South Park, which I know was made in Unity, but more serious than South Park) and I'm just making sure I don't get a bunch of work done and then get disappointed later, wishing I had gone with some kind of more free/open engine.

sentences:
How attach a model with another model on a specific bone? I meet a difficulty attached to a model to another model on a "bone" accurate.
I searched several forums but no result. I saw that many people have asked the same question but no real result see no response.
Thread found :

How to attach two XNA models together?

How can I attach a model to the bone of another model?

https://stackoverflow.com/questions/11391852/attach-model-xna

But I think it is possible.

Here is my code example attached a "object" of the hand of my player

private void draw_itemActionAttached(Model modelInUse)
    {
        Matrix[] Model1TransfoMatrix = new Matrix[this.player.Model.Bones.Count];
        this.player.Model.CopyAbsoluteBoneTransformsTo(Model1TransfoMatrix);
        foreach (ModelMesh mesh in modelInUse.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                Matrix model2Transform = Matrix.CreateScale(1f) * Matrix.CreateFromYawPitchRoll(0, 0, 0);

                effect.World = model2Transform * Model1TransfoMatrix[0]; //root bone index
                effect.View = arcadia.camera.View;
                effect.Projection = arcadia.camera.Projection;
            }
            mesh.Draw();
        }
    }

sentences:
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:
Rendering methods comparison I'm learning the basics of writing the game engine. Now I'm on the rendering the scene aspect using  the page flipping method. I roughly understand the theory but as of the implementation i can't find simple examples showing this technique.
Can someone please be so nice and provide me some c++ code showing the simplest direct vs page flipping rendering allowing me to see the difference as of problems like the image flickering or image tearing?

sentences:
1% idea, 99% execution? I keep reading in the game development community that the idea of a game is 1% and the execution of the game is 99%.

Do you believe that to be true? Not necessary in those percentages..

I always thought that a great idea is invaluable and it makes a game successful even though the execution is simplistic.

sentences:
Disadvantages of using a singular scene in Unity In my previous experience with Unity, I have had an organized level structure where each level instance was easily separated into a different scene.

For my current project, it would be much more natural to avoid such transitions, and instead disable or remove GameObject instances far from the player's position, and of course loading them in when necessary.

It strikes me that this must be how titles like Gone Home & Firewatch must have been made, and while my game won't be huge in scope, it will be bigger than those ("distance" wise).

Basically, I don't want to get halfway down this road and realize I've made a terrible mistake, so any input is appreciated. Are there disadvantages to using a singular scene in Unity?

sentences: Unity Ads or Google Ads wich one is better? I don't know if i can ask this here, but i have a doubt about wich ad advertiser is better, a friend said unity and other said google... I want to know in general wich one is better? If there's one wich is better than both let me know. If i can't ask this here let me know and i delete this question :D thanks

sentences:
What's the best way to generate an NPC's face using web technologies? I'm in the process of creating a web app. I have many randomly-generated non-player characters in a database. I can pull a lot of information about them - their height, weight, down to eye color, hair color, and hair style.

For this, I am solely interested in generating a graphical representation of the face. Currently the information is displayed with text in the nicest way possible, but I believe it's worth generating these faces for a more... human experience.

Problem is, I don't know where to start. Were it 2007, I'd naturally think to myself that using Flash would be the best choice. I'd love to see "breathing" simulated. However, since Flash is on its way out, I'm not sure of a solid solution.

With a previous game, I simply used layered .PNGs to represent various aspects of the player's body: their armor, the face, the skin color. However, these solutions weren't very dynamic and felt very amateur. I can't go deep into this project feeling like that's an inferior way to present these faces, and I'm certain there's a better way.

Can anyone give some suggestion on how to pull this off well?

sentences:
How to get image/icon/texture of asset from project window I want to get image of any asset from code. Unity can display assets as with images of those assets. Is there a way to get that image from code? I need it to be able to display it in the inspector.

public class AssetIconDisplayAttribute : MultiSupportPropertyAttribute
{
#if UNITY_EDITOR
    public override void DrawInInspector(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUILayout.ObjectField(new GUIContent(property.displayName), property.objectReferenceValue, property.GetContainingObjectFieldType(), true);

        EditorGUI.DrawPreviewTexture(position, @that asset image here@);
    }
#endif
}

Is there a better way to achieve this? The ideal result I want is object field that is displayed like a Texture2D field in inspector but is not a type of Texture2D but stays its own type.

An example of Texture2D:

EDITS:

With AssetPreview.GetMiniThumbnail:

With AssetPreview.GetAssetPreview:

Gives null if the object reference is a component, you have to pass GameObject in order to get the value.

Fix:

AssetPreview.GetAssetPreview((serializedProperty.objectReferenceValue as Component).gameObject)

With AssetDatabase.GetCachedIcon:

@EDIT - note: the code won't work out of the box as some elements which are not important/related for/to this task are custom made.
This is what I currently have and what has been working for me before in the old project. Because of some non-related errors after upgrading to new unity version I can't get an example of how it looked but anyway I wanted to share it.

public class AssetIconDisplayAttribute : MultiSupportPropertyAttribute
{
#if UNITY_EDITOR
    public override float GetPropertyExtensionHeight()
    {
        if (this.serializedProperty != null && this.serializedProperty.objectReferenceValue != null)
        {
            return EditorGUIUtility.singleLineHeight + 80f;
        }

        return EditorGUIUtility.singleLineHeight;
    }

    public override void DrawInInspector(Rect rect, SerializedProperty serializedProperty, GUIContent label)
    {
        EditorGUI.PropertyField(new Rect(rect.position, new Vector2(rect.size.x, EditorGUIUtility.singleLineHeight)), serializedProperty);

        if (serializedProperty.objectReferenceValue != null)
        {
            if (AssetPreview.IsLoadingAssetPreview(serializedProperty.objectReferenceValue.GetInstanceID()))
            {
                EditorGUI.DrawPreviewTexture(new Rect(new Vector2(rect.max.x - 82f, rect.position.y + EditorGUIUtility.singleLineHeight * 1.5f), new Vector2(64f, 64f)), AssetPreview.GetMiniThumbnail(serializedProperty.objectReferenceValue), null, ScaleMode.ScaleToFit);
            }
            else
            {
                EditorGUI.DrawPreviewTexture(new Rect(new Vector2(rect.max.x - 82f, rect.position.y + EditorGUIUtility.singleLineHeight * 1.5f), new Vector2(64f, 64f)), AssetPreview.GetAssetPreview((serializedProperty.objectReferenceValue as Component).gameObject), null, ScaleMode.ScaleToFit);
            }
        }
    }
#endif
}

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:
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 am I missing? (Converting 2D mouse coords to 3D space) I'm making a networked game which has a birds-eye view and I'm trying to convert the 2D mouse coordinates into 3D space. Right now I have a perfectly flat grid and it intends to remain perfectly flat, all I really want is the mouse coordinates to translate onto this grid.

I had a solution figured out that worked fine if the camera was perfectly straight looking down which I thought was going to be enough for what I wanted, but now I've found that it would be nicer if the camera had a slight tilt to it which completely messes with what I have. Could someone help me out in what I'm missing?

nearsourceV = GD.Viewport.Unproject(new Vector3(mouse.X, mouse.Y, 0f), camera.Projection, camera.View, camera.World);
farsourceV = GD.Viewport.Unproject(new Vector3(mouse.X, mouse.Y, 1f), camera.Projection, camera.View, camera.World);

mouseCoordinatesIn3D = Vector3.Normalize(farsourceV - nearsourceV);

zoomMultiplier = -mouseCoordinatesIn3D.Y;
zoomMultiplier = camera.CameraOffset.Y / zoomMultiplier;

mouseCoordinatesIn3D = mouseCoordinatesIn3D * zoomMultiplier;

mouseCoordinatesIn3D.X = mouseCoordinatesIn3D.X + camera.CameraOffset.X;
mouseCoordinatesIn3D.Z = mouseCoordinatesIn3D.Z + camera.CameraOffset.Z;

//Sends data and moves character

I figured I needed to include the camera rotation into it somehow, but I'm not really sure how or where.

Thanks!

sentences:
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:
AndEngine Sprite position I had noticed the AndEngine a few days ago, and I tried to create basic game with a few Sprites.Sure, the engine makes the development process much more easier.However I found the sprite lacking a major functionally:

Whenever there is a need to refer to the position of an Sprite the engine manipulates the position based on the top-left corner of sprite,this is not the best thing because there is a need to subtract/add the width/height to its position in order to refer to its center.However when we refer to he scale of the Sprite it scaled according to its center point (which is great)

I find it very confusing to refer to its position each time differently.I solved that by extending the Sprite class and implementing my methods of setCenter and getCenter, I guess that not the best way to do so.

Do you have any suggestion?

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:
Networking player input, UI, and ability use I am currently working on a project to learn more about networking, specifically authoritative network architecture.

In most authoritative systems you capture a player's input queue them up then send them to the server after a certain count or time has passed. The input is "copied" to the local(client) loop and run as prediction while it waits for the server to return the authoritative state back to the local(client) for correction. The states are also sent to all connected players to recreate the observed behavior of remote players.

This system works well for things like player movement and shooting(raycasts). This gets more complicated as we start to integrate UI and player skill/ability bars. In most MOBA or MMO games there is UI that can also create "input". In these cases there isn't a truely 100% right way to accomplish the goal of networking these pieces. You wouldn't need or want the UI to be run on the server in most cases.

I have come up with a few concepts of sending the input for these to the server and would like to know if I am close to conventions that are used in professional system or if I am even thinking about it in the right way.

Case 1: Mapped config agreement
In this model the player can assign abilities to a skill bar that is both clickable and correspond to the number keys on the keyboard. This "mapping" of abilities to bar slots is stored in a player config and is sent to the server.
When the player presses a number key or clicks on an icon an input is generated and added to the input sent to the server that looks something like this:
[BarId:1,BarIndex:1,KeyId:1]
When this is received by the server the server looks up the player UI config that was sent to the server and see what abilityId was stored on that place in the bar, check if it is a valid move then update the server state.

Case 2: Server Command
In this case the player class has a UseAbility(abilityId,target) method that can be called from the client player instance but is executed on the server instance, this bypasses the normal input gathering loop by executing the command on the server immediately so incorporating this into the client/server step systems isn't clean.

Borrowing the use-case from Case 1:
The player presses the button on the keyboard or clicks the UI button. This is "mapped" locally to a specific skill. The button/keypress calls UseAbility(0x00012,self) and is run on the client and server immediately it is checked for validity and then a state is sent to all connected players.

Those are the two cases I have right now. One works well with how input is gathered and sent to the server for processing. The other makes more sense in that the code can be more explicit but it appears to break the server authoritative structure. Would you guys please tell me what you think and maybe we can have a conversation about best practices.

Thanks for reading my post.

sentences:
Large-Scale Case Handling for 2D Procedural Environment I am creating a procedurally generated side scroller and I have a question regarding proper code structure/Architecture when it comes to connecting different platforms and large scale cases. There are various platform types I need to connect (e.g. a hill which leads into a tunnel which then leads into a cave, etc). I can successfully generate and connect the meshes using a bezier curve. My problem is that the way I am handling each platform connection case seems very clunky/inelegant the more I expand.

Currently I am using switch statements to handle each scenario like the above mentioned. Below is a small snippet of how I am handling each case.

public void SetTransition(int PrevPlatform, int CurrPlatform , Vector3 LastPosition)
{
    switch (PrevPlatform) {
    case 0:
        GroundTransition (CurrPlatform,LastPosition);
        break;
    case 1:
        CaveTransition (CurrPlatform,LastPosition);
        break;
    case 2:
        WaterTransition (CurrPlatform,LastPosition);
        break;
    case 3:
        TunnelTransition (CurrPlatform,LastPosition);
        break;
    case 4:
        WallJumpTransition (CurrPlatform,LastPosition);
        break;
    }
}

From here I have separate functions that handle the cases using more switch statements. The problem now is that I am starting to have a large number of branching functions that are relying each case. My code structure is becoming this large tree of switch statements. For the most part it works but I wanted to reach out to other developers before I continued this route. Is there a more effective, organized methodology to handling large scale cases?

sentences: LibGDX ImageButton resizeing How can I resize ImageButton ? It show very big on screen . How I know it is an Actor and it is not resizing automatically . I can`t find the method for resizing it. Any ideas?

sentences:
how to fill alpha with color? model changes color completely:

G3dModelLoader modelLoader = new G3dModelLoader(new JsonReader());
Model model = modelLoader.loadModel(Gdx.files.getFileHandle("g3dj/model.g3dj", Files.FileType.Internal));
ModelInstance modelInstance = new ModelInstance(model);
modelInstance.materials.get(0).set(ColorAttribute.createDiffuse(0, 0, 1, 1));

I want to replace only the alpha channel with blue color

(one model, many colors)

sentences:
Simulate wind in a powder game I would like to create a game similar to powder game.

I've got a 2d array that stores different types of powder such as sand, water, gas, and fire. I've managed to get these to all move around successfully.

I would now like the powders to react to wind. For example if there is fire it should push air upwards. If the air is moving upwards it will move other bits of powder around.

The way I've been trying is to have two more 2d byte arrays. One for the wind x direction and another for the wind y direction. The fire will then add an amount to the cells and each update will add the wind x and y to the piece of powder that is on that cell. This almost works but pushes the powder much to fast.

The difficulty in doing this is that the powder is on a grid while the wind could be going a variety of directions.

What is the most efficient way of doing this?

sentences:
Wikipedia A* pathfinding algorithm takes a lot of time I've successfully implemented A* pathfinding in C# but it is very slow, and I don't understand why. I even tried not sorting the openNodes list but it's still the same.

The map is 80x80, and there are 10-11 nodes.

I took the pseudocode from here Wikipedia

And this is my implementation:

 public static List<PGNode> Pathfind(PGMap mMap, PGNode mStart, PGNode mEnd)
    {
        mMap.ClearNodes();

        mMap.GetTile(mStart.X, mStart.Y).Value = 0;
        mMap.GetTile(mEnd.X, mEnd.Y).Value = 0;

        List<PGNode> openNodes = new List<PGNode>();
        List<PGNode> closedNodes = new List<PGNode>();
        List<PGNode> solutionNodes = new List<PGNode>();

        mStart.G = 0;
        mStart.H = GetManhattanHeuristic(mStart, mEnd);

        solutionNodes.Add(mStart);
        solutionNodes.Add(mEnd);

        openNodes.Add(mStart); // 1) Add the starting square (or node) to the open list.

        while (openNodes.Count > 0) // 2) Repeat the following:
        {
            openNodes.Sort((p1, p2) => p1.F.CompareTo(p2.F));

            PGNode current = openNodes[0]; // a) We refer to this as the current square.)

            if (current == mEnd)
            {
                while (current != null)
                {
                    solutionNodes.Add(current);
                    current = current.Parent;
                }

                return solutionNodes;
            }

            openNodes.Remove(current);
            closedNodes.Add(current); // b) Switch it to the closed list.

            List<PGNode> neighborNodes = current.GetNeighborNodes();
            double cost = 0;
            bool isCostBetter = false;

            for (int i = 0; i < neighborNodes.Count; i++)
            {
                PGNode neighbor = neighborNodes[i];
                cost = current.G + 10;
                isCostBetter = false;

                if (neighbor.Passable == false || closedNodes.Contains(neighbor))
                    continue; // If it is not walkable or if it is on the closed list, ignore it.

                if (openNodes.Contains(neighbor) == false)
                {
                    openNodes.Add(neighbor); // If it isn’t on the open list, add it to the open list.
                    isCostBetter = true;
                }
                else if (cost < neighbor.G)
                {
                    isCostBetter = true;
                }

                if (isCostBetter)
                {
                    neighbor.Parent = current; //  Make the current square the parent of this square.
                    neighbor.G = cost;
                    neighbor.H = GetManhattanHeuristic(current, neighbor);
                }
            }
        }

        return null;
    }

Here's the heuristic I'm using:

    private static double GetManhattanHeuristic(PGNode mStart, PGNode mEnd)
    {
        return Math.Abs(mStart.X - mEnd.X) + Math.Abs(mStart.Y - mEnd.Y);
    }

What am I doing wrong? It's an entire day I keep looking at the same code.

sentences:
2D player controller moves to the left, but not to the right I wrote a C# script to control a 2D player, but the script is not fully working. When I press the right arrow/d key to move the player is not moving in the right direction, but I have done the same exact thing for left key which works fine.The script shows no errors too.Kindly help me to solve the issue.The code is:

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private Rigidbody2D _rb2d;
    [SerializeField] private float _speed;
    [SerializeField] private float _jump;
    private static float _tempspeed;
    private static float _tempjump;
    private bool _isRight;
    private bool _isLeft;
    private bool _isSpace;

    private void Start()
    {
        _isLeft = false;
        _isRight = false;
        _isSpace = false;
        _speed = 5f;
        _jump = 7f;
        _tempjump = _jump;
        _tempspeed = _speed;
    }

    private void Update()
    {
        ReadInput();
    }

    private void FixedUpdate()
    {
        Move();
    }

    private void ReadInput()
    {
        if (UnityEngine.Input.GetKey("d") || UnityEngine.Input.GetKey("right"))
        {
            _isRight = true;
        }else {
            _isRight = false;
        }
        if (UnityEngine.Input.GetKey("a") || UnityEngine.Input.GetKey("left"))
        {
            _isLeft = true;
        }else {
            _isLeft = false;
        }
        if (UnityEngine.Input.GetKey("w") || UnityEngine.Input.GetKey("up"))
        {
            _isSpace = true;
        }else {
            _isSpace = false;
        }
    }

    private void Move()
    {
        Vector2 speedVectorRight=new Vector2(_tempspeed,_rb2d.velocity.y);
        Vector2 speedVectorLeft=new Vector2(-_tempspeed,_rb2d.velocity.y);
        Vector2 jumpVector=new Vector2(_rb2d.velocity.x,_tempjump);

        if (_isRight)
        {
            _rb2d.velocity = speedVectorRight;
        }else {
            speedVectorRight.x=0f;
            _rb2d.velocity = speedVectorRight;
        }
        if (_isLeft)
        {
            _rb2d.velocity = speedVectorLeft;
        }else {
            speedVectorLeft.x=0f;
            _rb2d.velocity = speedVectorLeft;
        }
        if (_isSpace)
        {
            _rb2d.velocity=jumpVector;
        }
    }

When I tried to print debug statements in different parts of if statements, they work fine. The problem in my observation is in :

if (_isRight)
        {
            _rb2d.velocity = speedVectorRight;
        }else {
            speedVectorRight.x=0f;
            _rb2d.velocity = speedVectorRight;
        }

The _rb2.velocity is not accepting speedVectorRight I guess.Thanks in advance!

sentences:
Equation for bouncing graph? I basically want my camera in 3D move automatically. Currently, I have linear movement which is rather dumb, so I'd like to do a bouncing movement.

However, what is a good equation for bouncing? I mean, for a circle you can do y = sqrt(1 - x^2), but if I were to have a bouncing graph, what would the corresponding formula be? I guess it's something with abs as it has to 'bounce'. Something like (I made this up with Paint):

What is a good equation that results in such a graph? The transformations I can do myself I guess, but I'm just looking for the kind of equation.

sentences:
How to enable antialiasing for SVG Images? My game has vector icons and sprites, like this one:

Its quality disappoints me. I guess that antialiasing is disabled here for some reason, but have no idea how to turn it on.

The problem is only with UI component SVG Image. Sprite Renderer seems to not have this issue:

Regular Image does not support vector icons. I tried this approach.

MSAA is enabled on Camera and in Quality settings. When it's disabled, second sprite becomes exactly the same as first.

Unity version: 2018.2.7.f1 for Linux
Vector graphics package version: 1.0.0-preview.23

I will accept a solution or an optimal workaround of any complexity. But please don't suggest using raster images.

Why?

I have to compress them because the game is for WebGL and I already had problems with memory because of textures. Vector sprites take less memory.
Without mipmaps icons are pixelated. With mipmaps, they look blurry. They are all power of two, but at different scales. They are even blurred different, some more, some less. I can't use fixed-sized sprites because there's an animation that changes zoom, and canvas will rescale in fullscreen.

Vector guns are to the left, raster ones with mipmaps - to the right. Thin black border lines are gone.

sentences:
How to justify text that appears character-by-character I'm currently using the latest version of phaser framework and I have a problem to which I haven't been able to figure out how to approach.
I need to have a block of text appear letter by letter and also be justified as a block.
(I'm working on a text-based game project).
Text typed letter by letter is functional, but my issue is with justification: it has issues like some words first appearing on a line and then being removed and placed in the next line.
This is my code so far:
    addTextParagraph(text) {
    //  We check the current GAME STATE.
    //  During exploration (SCOUTING_STATE), text is in typewriter mode.
    if (gameState === SCOUTING_STATE) {
      this.typewriteText(text);
    }
  }

  typewriteText(text) {
    let delayedCallback;
    let length = text.length;
    let i = 0;

    this.time.addEvent({
      callback: () => {
        this.textParagraph.text += text[i]
          ++i
        // Callback after typewriter text is complete.
        // Delay before the choices appear in the screen (in ms)
        if (i >= length) {
          i = 0;
          delayedCallback = this.time.delayedCall(200, this.addChoiceArray, [], this);
        }
      },
      repeat: length - 1,
      delay: 40,
    })
  }

Thanks.

sentences: Unity tilemap collider not colliding with rigidbody In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on layer order 0.

sentences:
When is a good point to revise a project? I am currently working on a project. Some time ago I realized that I do achive my goals but the more code and prototypes I add the more I feel like there is no going back. For example some of the data-structures, methods and parts of architecture I implemented could be made more productive and reusable. But this would need a refactoring nearly from scratch.

So I wonder, is it a good decision to reedit a project as soon as I realized it's flaws or should I finish all the prototypes and then create a final and clean version?

I think it does matter that I am a solo developer.

Thanks in advance.

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:
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:
Mismatch cordinate system of unity and android I am new to unity3d, Right now i am adding a cube as game object with coordinate 0,0,0 But when i run it on android device Iam facing 2 problem a) Coordinate system of unity3d are different from coordinate system of device, For device top left is 0,0 but for unity center of the screen is 0,0. How to fix that mismatch or i need to multiply with some factor to make it work.

b) Iam moving the object on x-axis this is what iam doing for moving object on x-axis

if(xback){
     xaxis+=(2*Time.deltaTime);
     if(xaxis >Screen.width/2){
      xback = false;
      }
     }
else if(!xback){
     xaxis-=(2*Time.deltaTime);
     if(xaxis<=-(Screen.width/2)){
      xback = true;
  }
 }

Vector2 temp = transform.position;
temp.x = xaxis;
temp.y = yaxis;
transform.position = temp;

But the problem iam facing is as soon as my xaxis equals 9 it touches the right of screen and then it get out of screen, so iam little bit confuse is unity3d pixel system is different from the one on device, because iam moving the cube by one pixel every time but movement is not equal to 1 pixel of device. so i want to know is pixel system of unity is different from pixel system of android or iam doing something wrong.

sentences:
How to determine whether a line intersects any other? I have a collection of lines:

List<Line> _lines;

Each has the properties: X1, X2, Y1, Y2

How can I determine whether any given line in the list (Line[n]) intercepts, at any point, any other line in the list?

sentences:
Libgdx: How to setZIndex for pause dialog? Pause dialog has to appear on top of the play screen, it has to appear on top of other objects.

I have tried to use

dialog.setZIndex(10); // or whatever number and I tried adding it in many places

It just doesn't work, how to make the dialog be on top of other objects? for a ccomplete version here

I'm using only one batch and the stage is used only to add background and dialog

  stage = new Stage();
  Gdx.input.setInputProcessor(stage);
  stage.addActor(bg); // somewhere else in the code
  stage.addActor(btnPause);
  camera.update();
  game.batch.setProjectionMatrix(camera.combined);
  stage.act(delta);
  stage.draw(); // and thats about it for stage
  game.batch.begin();
  font.setColor(Color.YELLOW);
  font.draw(game.batch, myScore + score, Gdx.graphics.getWidth(), camY);
  // and here I draw the game   game.batch.draw(game) and I'm using only one batch

I hope I didn't miss anything

If I put the game batch in state.RUN in an effort to hide objects when the pause dialogue appears, then when I resume, it will go to batch.end and exit the game

Pause

public void pause() {
 this.state = State.PAUSE;
 final Dialog dialogP = new Dialog("", skin, "pauseDialog") {};

 dialogP.setScale(4, 6);
 dialogP.setPosition(Align.center, Gdx.graphics.getHeight());

 dialogP.addAction(sequence(alpha(0),
  parallel(fadeIn(.5 f)),
  moveBy(0, -1000 f, .30 f, Interpolation.smooth),
  moveBy(0, 30 f, .40 f, Interpolation.smooth)));

 //PlayOn
 ImageButton btnPlayOn = UIFactory.createButton(txtrPlayOn);
 btnPlayOn.setSize(40, 40);
 btnPlayOn.setPosition(75, 75, Align.center);
 dialogP.addActor(btnPlayOn);

 //EndGame
 ImageButton btnEndGame = UIFactory.createButton(txtrEndGame);
 btnEndGame.setSize(40, 40);
 btnEndGame.setPosition(75, 55, Align.center);
 dialogP.addActor(btnEndGame);

 stage.addActor(dialogP);

 //playOnAction
 btnPlayOn.addListener(new ClickListener() {
  @Override
  public void clicked(InputEvent event, float x, float y) {
   dialogP.hide();
   resume();
  }
 });

 //EndGameAction
 //PlayButtonAcion
 btnEndGame.addListener(
  new InputListener() {
   @Override
   public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
    super.enter(event, x, y, pointer, fromActor);

    Actions.scaleTo(0.7 f, 0.7 f, 0.5 f, Interpolation.bounceOut);
    stage.addAction(Actions.sequence(Actions.moveBy(-stage.getWidth(), 0, .5 f), Actions.run(new Runnable() {
     @Override
     public void run() {
      game.setScreen(new MainMenuScreen(game));
     }
    })));

   }

  });

}

The basic principle is implemented from the accepted answer to this question

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:
uNet - Client cant see server spawned objects I'm facing a problem where when I connect with the host, all the towers spawn. After I connect with a client only to find out there are no towers visible and I can walk through them when looking at the host screen.

My tower spawn script ( GameManager.cs ) :

public int numberOfDestroyedTopTowers = 0;
public int numberOfDestroyedMidTowers = 0;
public int numberOfDestroyedBotTowers = 0;

public GameObject[] topTowerSpawns;
public GameObject[] midTowerSpawns;
public GameObject[] botTowerSpawns;

public GameObject towerPrefab;

void Start() {
    CmdSpawnTowers();
}

[Command]
void CmdSpawnTowers() {

    for (int i = 0; i < midTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = midTowerSpawns[i].transform.position;
        currTower.name = "Tower [MID] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < topTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = topTowerSpawns[i].transform.position;
        currTower.name = "Tower [TOP] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < botTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = botTowerSpawns[i].transform.position;
        currTower.name = "Tower [BOT] " + i;
        NetworkServer.Spawn(currTower);
    }

}

The script is derived from NetworkBehaviour and it does have a Network Identity on it (Server Only checked). Also on my towerPrefab I also have a network identity with server only checked.
I have added my tower prefab under the network manager "Registered Spawnable Prefabs".

sentences:
Unity: Controlling animation by switching between a GameObjects children I bought an asset the other day containing an Atlas of character parts (head, hairs, clothes, body-parts). It's great and allows me to tint each piece any color I want. However, The artist decided to devide up the character like this:

Each child is a fully setup character, facing a certain direction, with an Animator attached to it, inside each Animator Controller you find this:

Some sample animations, pretty self-explanatory.
However, I have never worked with sprites like this where its several parts, the entire character is maybe 30-40 parts (allowing for some fun animations).
I'm used to making Blend Trees (on a single GameObject) and have one animation for each direction.
The best solution for controlling these animations I could think of was something like this:

private void AnimControl() //call in update
    {
        if(direction != directionLastFrame) //do not run method if we are moving same direction
        {
            //standing still
            if (direction.x == 0 && direction.y == 0)
            {
                directionLastFrame = direction;
            }
            ////left
            else if (direction.x < 0.5f && direction.y == 0)
            {
                currentCharacterDirection.SetActive(false); //set current gameObject (which is a character facing a certain direction) inactive
                currentCharacterDirection = character.leftDirection; //change to correct direction
                currentCharacterDirection.SetActive(true); //set gameobject active again
                anim = currentCharacterDirection.GetComponent<Animator>(); //set the animation controller to the new gameObject
                directionLastFrame = direction; //set the new direction to check for
            }
            ////right
            else if (direction.x >= 0.5f && direction.y == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.rightDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
            ////down
            else if (direction.y < 0.5f && direction.x == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.downDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
            ////up
            else if (direction.y >= 0.5f && direction.x == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.upDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
        }

        anim.SetBool("Moving", playerMoving);
    }

I mean it works, but feels wrong? Anyone that can think of a better Idea here, worried this might be too slow. setting an object to active/inactive too often.

sentences: What distinguishes a free to play game from one worth paying for? There's a heck of a lot of free games available out there, some of which are as good as games that you have to pay for. My question is, what makes the difference between a game that people will be willing to pay for, and one which is best left as a free to download/play online game subsidised with advertising?

sentences:
Combining cylindrical Billboarding and aligning with velocity (unity) I'm trying to make a custom GPU particle solution on Unity to fullfill some needs on my project, using compute shaders and custom shader + Graphics.DrawProceduralNow() to draw them.

While I managed to make the system, I'm struggling making the particles cylindrical billboards and align them to their velocity axis as I'm not really used to work with matrices.

I achieved to make both effect working individually (using usefull ressources on the forum) but I can't manage to combine the two rotations without obtaining wrong results

v2f vert(uint id : SV_VertexID, uint inst : SV_InstanceID)
{
    v2f o;

    //Vertex position
    float3 q = quad[id];

    float3 newPos = q * particles[inst].size * _SizeMul;

    //PARTICLE DIRECTION

    float3 particleDirection = normalize(particles[inst].velocity);

    float3x3 rotMatrix;

    float3 xaxis = cross(float3(0,0,1), particleDirection);
    xaxis = normalize(xaxis);

    float3 zaxis = cross(xaxis, particleDirection);
    zaxis = normalize(zaxis);

    //Matrix for particle direction
    rotMatrix[0].xyz = float3(xaxis.x, particleDirection.x, zaxis.x);
    rotMatrix[1].xyz = float3(xaxis.y, particleDirection.y, zaxis.y);
    rotMatrix[2].xyz = float3(xaxis.z, particleDirection.z, zaxis.z);

    newPos = mul(rotMatrix, newPos);

    //CYLINDRICAL BILLBOARDING

    // Distance between the camera and the center
    float3 dist = _WorldSpaceCameraPos - particles[inst].position;

    // With atan the tree inverts when the camera has the same z position
    float angle = atan2(dist.x, dist.z);

    float cosinus = cos(angle);
    float sinus = sin(angle);

    // Matrix for billboarding
    rotMatrix[0].xyz = float3(cosinus, 0, sinus);
    rotMatrix[1].xyz = float3(0, 1, 0);
    rotMatrix[2].xyz = float3(- sinus, 0, cosinus);

    newPos = mul(rotMatrix, newPos);

    newPos += particles[inst].position;

    o.pos = mul(UNITY_MATRIX_VP, float4(newPos.xyz,1));

    o.uv = q + 0.5f;

    o.col = particles[inst].alive * particles[inst].color;

    return o;

}

Another way to say it is i would like Y to point toward the velocity direction and then rotate the quad around it's new Y axis to make the billboard point at best toward camera.

Any help would be much appreciated and any other approach for cylindrical billboarding that would work once quad is aligned to velocity vector would be welcomed too. Have a good day!

sentences:
How do i set gravity towards a point in the centre in AndEngine with Box2D? I have a scene and i can set gravity in the PhysicsWorld like

this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, -SensorManager.GRAVITY_EARTH),false);

but i would like all bodies to gravitate to a point.

I tried

physicsWorld.setGravity(new Vector2(centerX, centerY));

but that has not worked- i assume because i need to calculate the vector to the centre. But I'm not sure how to do that and where to calculate it so it changes.

I would like the input (of force) to be from the touch handler of the sprite. The sprite at the moment can be moved via

@Override
    public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
            float pTouchAreaLocalX, float pTouchAreaLocalY) {

        //this.setPosition(pSceneTouchEvent.getX() - this.getWidth() / 2, pSceneTouchEvent.getY() - this.getHeight() / 2);

        if (pSceneTouchEvent.isActionMove() || pSceneTouchEvent.isActionDown() || pSceneTouchEvent.isActionOutside())
        {
            this.setX(pSceneTouchEvent.getX() - this.getWidth() / 4);
            this.setY(pSceneTouchEvent.getY() - this.getHeight() / 4);
        }

        return true;
    }

I would like to do the calculation in there so as the sprite is dragged, the vector changes, then when it's released it should 'fall' to the centre

EDIT:

Mass can be set as 1 unit since it's not relevant

Thanks for the help.

sentences:
Black screen when trying to render multiple textures I generate an array for two textures:

int[] textureID = new int[2];
glGenTextures(1, textureID, 0);
glGenTextures(1, textureID, 1);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID[0]);
glBindTexture(GL_TEXTURE_2D, textureID[1]);

Render:

int Position = glGetAttribLocation(Shader.program_Image, mPosition);
glEnableVertexAttribArray(Position);
glVertexAttribPointer(Position, 3, GL_FLOAT, false, 0, vertexBuffer);
int TexCoordLoc = glGetAttribLocation(Shader.program_Image, atexCoord );
glEnableVertexAttribArray (TexCoordLoc);
glVertexAttribPointer (TexCoordLoc, 2, GL_FLOAT, false, 0, uvBuffer);
int mtrxBackground = glGetUniformLocation(Shader.program_Image, mbackground);
int mtxObj = glGetUniformLocation(Shader.program_Image, mobj);
glUniformMatrix4fv(mtrxBackground, 1, false, m, 0);
glUniformMatrix4fv(mtxObj, 1, false, m, 0);
int mSamplerLoc = glGetUniformLocation (Shader.program_Image, bTexture);
int mSamplerLoc1 = glGetUniformLocation (Shader.program_Image, sTexture);
glUniform1i (mSamplerLoc, 0);
glUniform1i(mSamplerLoc1, 1);
glDrawElements(GL_TRIANGLES, background.getIndices().length, GL_UNSIGNED_SHORT, drawListBuffer);

My fragment shader is like this.

precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D b_texture;
uniform sampler2D s_texture;
void main() {
    gl_FragColor = texture2D(b_texture, v_texCoord );
    gl_FragColor = texture2D(s_texture, v_texCoord );
}

I have no error message, but when I run the application, I only see a black screen.

The app runs correctly with just one texture, but doesn't with more than one. What's wrong in my code?

Do I have to add another set of coordinates and update the vertex shader? Because I have only one “rectangle” constructed from two triangles.

sentences:
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:
How would one generate a texture for cracks in different materials? I would want to have the ability to simulate different variables like brittleness, or other variables to get varied end results.

I would mainly need to generate impact cracks, so it would need to react to different impact angles and speeds.

I am using ActionScript3, but general theory answers will be helpful as well.

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:
Serializing and writing a Dictionary of Vector2 keys and custom class values in Unity I have tried to create code to serialize a Dictionary of <Vector2, Block>, where Block is a custom serializable class, loosely based off of this guide. I need to do this so that I can write this data to disk.

public static void SavePiece (string ObjectName, int index, Dictionary<Vector2, Block> VoxelSlice) {
    string saveFile = FileName (ObjectName, index);

    Stream stream = new FileStream(saveFile, FileMode.Create, FileAccess.Write, FileShare.None);
    formatter.Serialize(stream, VoxelSlice);
    stream.Close();
}

However, I am experiencing this error:

SerializationException: Type UnityEngine.Vector2 is not marked as Serializable.

I'm an absolute beginner to all things serialization and file writing, so I don't have much knowledge to go on, and I'm pretty stuck. I have a few questions:

Is there any way to save lots of data without serializing?
Can I somehow make Vector2 serializable?
While I would rather not spend time re-working my code, would serialization work if I replaced Vector2 with a custom class?
Can Dictionary be serialized at all anyway? A quick search for "unity serialize dictionary" seems to indicate that Dictionary can't be serialized.
If Dictionary can't be serialized, what could I use instead to my store key/value pairs?

sentences:
Effects for Programmers Does anyone have any good resources for creating special effects, aimed at programmers.
I'm not specifically interested in particle effects, but broader things like:

Fullscreen effects, blur, depth of field, damage
Explosions, shockwaves
Weapons, lasers, projectile
Environment - light "glows" and beams, water, bubbles, dust etc

I'm interested in these things from a technical perspective rather than an artistic one.

EDIT:
To clarify, I'm not interested in the low level details like "a method for doing depth peeling on SPUs" or "fast particle rendering with vertex textures", I'm interested in how people have combined various techniques into a recipe to show a special effect for the game.

For example - when rendering a "space" explosion:

Draw opaque bright sphere at center.
Draw alpha'd shockwave around a random axis.
Expand sphere and decrease alpha.
Expand shockwave and rotate UVs.
Spawn particles showering randomly from center.
Wobble camera when shockwave reaches viewer position.

sentences:
HLSL - Voxel texturing I'm currently trying to develop a Voxel Engine using Direct3D 9 and C++.
To keep the memory usage low, i'm only passing the position, the orientation and the offset of the current voxels texture in the texture atlas of each vertex to the vertex shader.

The vertex shader then calculates the normal and passes it to the pixel shader. I found this article which covers, how to texture voxels with just their position and normal in glsl.

This is the part that calculates the texture coordinates in my pixel shader (SM3):

float2 tileUV = float2(dot(input.normal.zxy, input.pos3D),
    dot(input.normal.yzx, input.pos3D));
float2 texcoord = input.texOffset + tileSize * frac(tileUV);

This code works fine for faces that point in negative z-direction (normal [0,0,-1]), however, the back is flipped by 180° and the sides and top/bottom squares are flipped by 90°/270°.

I am not sure, if this is correctly translated from glsl, because this behaviour should be the expected one in hlsl, if I calculate it by hand. Is there anything that I have overseen or should I aim for a different approach?

Edit:

I have now managed to successfully texture the faces by replacing the previous calculation with the following:

if(input.normal.y != 0.0f) // handle top/bottom surfaces as front/back faces
{
    input.pos3D.y = input.pos3D.z;
    input.normal.z = -input.normal.y;
    input.normal.y = 0.0f;
}
texcoord.x = input.texOffset.x + tileSize * frac(float3(1.0f, 1.0f, 1.0f) +   cross(frac(input.pos3D), input.normal)).y;
texcoord.y = input.texOffset.y + tileSize * (1.0f - frac(input.pos3D.y));

Is there any way that I can simplify/optimize the equation? I may also mention that the voxels are all axis aligned and clamped to integer coordinates.

Edit2:

This is the modified formula of zogi's answer which works as expected.

float3 n = abs(normal.xyz);
float2 texcoord = float2(input.texOffset.x + tileSize * dot(n, frac(input.pos3D.zxx)),
    input.texOffset.y + tileSize + tileSize * dot(-n, frac(input.pos3D.yzy)));

sentences:
What are the consequences of adding a progress stat to a live Steam achievement? Say I have an achievement in my game, "Collect your first thingamajig", and I publish this to the live version of the game without a progress stat. Later on I decide I want to add some new achievements in an update, including one based on the previous achievement: "Collect 10 thingamajigs".

I create a progress stat for this one which is updated in code, but I also edit the original achievement so that it's unlocked through the progress stat rather than an AwardFirstThingamajigAchievement() function in code.

What are the consequences of this? Will a player that already had this unlocked find the achievement has been relocked because the achievement has been edited, technically making it a new one? Will it remain unlocked, but still cause a little popup for the first achievement on the next Thingamajig collected? Or will Steam simply not touch already unlocked achievements?

sentences:
Why are changes in one object applied to all objects in a list? I've got two List:

BasicModels: As Content has to be loaded at the start of the game I instanciate and load all models into this list.
ModelsOnScreen: Every time when a Model is added to the screen I take the corresponding object out of BasicModels and put it into ModelsOnScreen. At the same time I write the ID of the Model at it's location in ModelsOnScreen.

So the problem is though I change the Id at a specific place in the list, changes are applied to all models in ModelsOnScreen.

 for (int i = 0; i < _game.Models.Length; i++)
        {
            if (assetName == _game.Models[i].name.ToString())
            {
                _game.modelsOnScreen.Add(_game.Models[i]);
                _game.modelsOnScreen[_game.modelsOnScreen.Count - 1].ID = nameCounter;
            }
        }

What could be the problem? My theory is that the Models I put into ModelsOnScreen are only references, no separate instances. If that is so, how could I solve this problem?

Any advice is welcome,

greets BC++

sentences:
What is the math behind the light effect in krakatoa? I'd like to know the math behind the light effect in krakatoa (click here for an example).

Light source is traveling with particles, but how is shading done? Is it something simple, like Phong shading? Is it possible to implement such effect in real time on GPU?

sentences:
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:
How to make a cube fall from the edge when part of it is outside in Unity Let's assume I have a 1x2x1 cube and it is balanced over an edge, since the weight of the cube is distributed perfectly, it doesn't fall, how to make it fall when part of the cube is over the edge?

I have tried adding invisible objects to both ends of the cube and then adding another invisible object on the edge so when they collide I change the center of mass of the cube, this seems to work but I think it is overly complex since I have to add that invisible object around all edges of my scene.

sentences: How can I map regions on a world map image? I am trying to use a map of the real world, but I need to have a way to break it down by countries and regions.  Ideally down to a province level.  I figure that I'd need to be able to define polygonal regions on the image and export the points that represent the bounding polygon, so that I could check for clicks inside, and do other things with it.  I'm having a hard time finding a tool that will let me do this, that is, load in an arbitrary image and start defining polygons on it to be exported.  Or am I going about this the hard way?  Using XNA/Monogame currently if that matters in your answer.  Thanks

sentences:
Reloading Resources on Resume I'm having a problem with my game. If I press the "Home button" the game is paused... everythings fine, but if I then go back to the game all the resources are reloaded before I can continue the game. And it takes quite a bit. Is this normal, or is there a way to avoid the reloading?

I have write following code in onResume and onPause method. It loads same texture again and again on resume of game.

    @Override
    protected void onPause() {

            super.onPause();
            if (Utility.flagSound && mScene != null) {

                    if (mScene.getUserData().equals(Constants.GAME_SCENE))
                            Utility.isPlayLevelMusic = false;
                    else
                            Utility.isPlayLevelMusic = true;

                    audioManager.gameBgMusic.pause();
                    audioManager.levelBgMusic.pause();
            }

            if (this.mEngine != null && this.mEngine.isRunning()) {
                    this.mEngine.stop();
            }

    }

    @Override
    protected void onResume() {

            super.onResume();
            if (audioManager != null && Utility.flagSound && dataManager != null) {
                    if (Utility.flagSound) {
                            if (Utility.isPlayLevelMusic)
                                    audioManager.levelBgMusic.play();
                            else
                                    audioManager.gameBgMusic.play();
                    }
            }

            if (this.mEngine != null && !this.mEngine.isRunning()) {
                    this.mEngine.start();
            }

    }

I would be glad if anybody could help...

sentences:
2D Side-scrolling Strategy Game Pathfinding Help Hey Guys,I am trying to implement dungeons into my 2d RTS ish game.The dungeons is made out of rooms, you start at the top, and you can unlock rooms with scouts.The picture is the unlocked version of the dungeons, except for the middle part where it says "locked".For example the long rooms in the picture are actually consists of 3-4 rooms.
The dungeon is handbuilt by me, there are no obstacles except for unlocked areas and walls.No need for collision avoidance.The boxes with up and down indicates "ladders", when a unit wants to go up/down it just fades out and fades in the new layer, no moving up/down animation.You control the units by mouse.No jump mechanic etc, they just move flat on the green areas.

So I think I need to calculate and store which ladders(or nodes) the unit needs to take to reach the target, I need to check if ladders are connected to each other I think.But I don't know, not a great programmer.I have looked into Astar and dijkstra's algorithms but they seem complicated to implement, there is a built in Astar in gamemaker but it uses grid system and doesn't seem to fit to my problem.
Do I really need to learn one of those algorithms or can I get away with a simpler approach?Any pseudo code you guide me with?I would really appreciate the help.I know a bit of c# and unity.Thanks a lot!

sentences:
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:
2D animation is not rendered as it supposed to I'm working with Melonjs, i have configured everything to update the character movement and still get this "delayed" rendering of the character.

below is the constructor

  // call the constructor
  settings.image='kit.walk';
  settings.spritewidth=56;
  settings.spriteheight=80;

  this.parent(x, y, settings);
  this.alwaysUpdate=true;
  // set the default horizontal & vertical speed (accel vector)
  this.setVelocity(3, 15);
  this.setFriction(0.4,0);
  // set the display to follow our position on both axis
  me.game.viewport.follow(this, me.game.viewport.AXIS.HORIZONTAL);
  this.renderable.addAnimation('walk',[0,1,2])
  this.renderable.setCurrentAnimation('walk');
  this.anchorPoint.set(0.5,1.0);

i'm not very familiar with the engine, but it doesn't seem to be a problem with the engine, i think is a configuration problem somewhere.. i tried to look into examples but nothing helped so far.

could it be a problem with the sprite?

sentences:
Combining varying vertex variable and vertex variable in OpenGL. How to? Let's say I have 2 triangles sharing an edge defined by 4 vertices. Though the normals for these 2 triangles are unique for each triangle and are defined per vertex. So say I have 4 vertices, 6 normals (as shown in the figure below).

I would like to know how this can be dealt with in OpenGL? I have been using glDrawElement so far, but I understand that this would only work if I had 4 normals (1 normal per vertex) and this it wouldn't allow me to define 3 normals per triangle.

What's the best/common/most efficient of dealing with this case? Do I need to also duplicate the vertices (3 unique vertices per triangle or is there a more clever solution to this?) so that I have as many vertices than I have normals?

sentences:
Handling Origin/Anchor Points in a Scene Graph I'm trying to implement a simple scene graph on iOS using GLKit but handling origin/anchor points is giving me fits. The requirements are pretty straightforward:

There is a graph of nodes each with translation, rotation, scale and origin point.
Each node combines the properties above into a single matrix (which is multiplied by it's parent's matrix if it has a parent).
Nodes need to honor their parent's coordinate system - including the origin point (i.e. a child's origin should line up with the parent's origin)

So the question is:

What operations (e.g. scaleMatrix * rotationMatrix * translationMatrix, etc.) need to be performs and in what order so as to achieve the proper handling of origin/anchor points?

P.S. - If you are kind enough to post an answer please mention whether your answer is based on column or row major matrices - that's a perennial source of confusion for me.

sentences:
Designing a game that allows for selectable perks/customization Call of Duty games all have the core functionality of any FPS (walking around, killing, dying and repeat). Layered on top are various stuff. Of interest to me is during pre-game when you pick your perks. These perks can have very different effects and targets. Some affect walking speed and persist throughout the game, others are only activated at certain events and last for a certain duration. I am wondering what sort of design architecture/pattern would allow such a system that supports a wide variety of perks that have little in common.

For instance, imagine I want to add a perk that speeds up the rate of fire:

Do I make all my gun classes take as a constructor argument 'rateOfFire'? but then I will need to expand the code for each perk that affects the gun and the constructor gets bloated.

Maybe have it as a setter property on each gun? but then I can also bloat properties and make code insecure since I don't want anyone except the appropriate perks to change that property. I will also have to go back exposing more properties for each new perk. In addition, other classes that depend on this value might have already been initialized after the gun was created and acted upon the original 'rateOfFire' value before I get to change it.

and so on... and to further complexity, now imagine I want to add a new perk 'walk faster for 5 seconds after you die 5 consecutive times without killing anyone(death streak)'. This perk has nothing in common with the 'rateOfFire' perk.

And also there is the issue of how to deliver those chosen perks to their targets? I was thinking of the visitor pattern, but it seems inefficient since a perk that affects only certain guns will be passed to all game components that are customizable(level manager/presenter/physics and so on). And I will also need to expose their properties so that the perk can change them once visited.

I thought of other solutions that might work, but they all seem either too complex/over engineered. I am wondering how the Call of Duty developers might have implemented what seems to be a flexible and extensible perk system (many sequels).

Any suggestions are welcome.

Note am not remaking COD, instead I am making a simple mobile puzzle game but the perk problem is similar.

sentences:
How do I get my character to jump? I've got animations and simple movements down as well as attacking, although I'm having my difficulties with jumping and I'm not sure how to make it work.

using UnityEngine;

public class Player : MonoBehaviour
{
    private Rigidbody rb;
    public float speed = 100f;
    public float jumpforce = 50f;
    public float movement = 0f;
    public Vector3 jump;
    public LayerMask ground;
    public bool onground;
    public float groundcheckradius;
    public Transform groundcheck;

    void OncollisionStay() { onground = true; }

    void Start()
    {
        rb = GetComponent<Rigidbody>();
        jump = new Vector3(0f, 50f, 0f);
    }

    void FixedUpdate()
    {
        onground = Physics.OverlapSphere(groundcheck.position, groundcheckradius, ground);

        if(Input.GetKeyDown(KeyCode.Space)&& onground) {
            rb.AddForce(jumpforce * jump, ForceMode.Impulse);
            onground = false;
        }

        if (Input.GetKey(KeyCode.W))
        {
            rb.velocity = new Vector3(0, 0, speed * Time.deltaTime);
        }
        {
            if (Input.GetKey(KeyCode.S))
            {
                rb.velocity = new Vector3(0, 0, -speed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.D))
            {
                rb.velocity = new Vector3(speed * Time.deltaTime, 0, 0);
            }
            if (Input.GetKey(KeyCode.A))
            {
                rb.velocity = new Vector3(-speed * Time.deltaTime, 0, 0);
            }
        }
    }
}

sentences:
Should I load scenes from files, or hard code them? In a game engine I'm working on, I'm using scenes similar to what you would find in Unity. The entities, in my game, are composed of reusable components and custom data which is linked to those components. Entities have children, and one parent. This is shown, below:

class Entity {
    ...custom data here...
    let parent : Component
    var children : [Component] = []
    var components : [Component] = []

    ...methods...
}

If the entities did not have custom data, then creating a scene would be described by the following steps:

Loading a file into memory.
Creating a tree of entities.
Adding components to them, with parameters listed in the file.

However, this does not leave room for custom data. My other alternative is to create a scene by creating a scene object, then hard-coding the entities in. It would look something a bit like this:

var opening_scene = Scene()

opening_scene.addEntity(Player())
opening_scene.addEntity(Car())
opening_scene.addEntity(Terrain())
...

The downside to this is that everything is hard coded. What can I do to create scenes in a game more efficiently?

sentences: How can you check your users' unlocked achievements (Google Play Game Services)? Is it possible to see how many of your users have unlocked certain achievements on the Google Play Developer console? This information would be very useful. I guess that one could achieve this through integration with Google Analytics but I was wondering if there was a simpler way to get this data.

sentences:
How to keep clicks from menu from interfering with game state? I ran into a problem coding my game in which when I click the play button on the newly implemented menu, it also creates a bullet from my player. The player and the menu both rely on the mouse input. How would I make it so that this doesn't occur? Perhaps how would I delay input from the mouse for a second until after the game starts?

Thank you.

public static boolean pressed = false;

public void mousePressed(MouseEvent e)
{
    int mx = (int) e.getX();
    int my = (int) e.getY();

    if(Game.state == STATE.MENU) {
        if(Menu.playButton.contains(mx, my))
        {
            // Pressed Play Button
            pressed = true;
            Game.setState(Game.STATE.GAME);
        }

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

            if(tempObject.getId() == ID.Player && pressed == true)
            {
                handler.addObject(new Bullet(tempObject.getX()+16,
                        tempObject.getY()+24, ID.Bullet, handler, mx, my, game));
                bullets_shot += 1;

            }
        }
    }
}

sentences:
Framerate-independent game loops and discrete tasks When writing good framerate-independent game code, you take some sort of deltaTime parameter in your main render() function and then scale your calculations based on that -- this is essential for things like physics engines.

However, in my game there are often discrete tasks -- the AI system might add components representing a "task" to the agents that should be removed (finished) after x seconds have passed. To make a contrived example, if a task/component takes 60ms to process, and the game is running at 60fps (16.6ms/frame), then the first three frames will run, bringing the "work done" on that task to 50ms, and then one last frame will do 10ms of work, but then the remaining 6.6ms will be "lost", because the AI system won't run and schedule new work until the next frame.

Ideally, I'd like to not lose the "loose change" of ms that occurs at the end of tasks.

How do people normally deal with this? I can think of a few options:

Ignore it -- the shortest tasks will probably never be less than 100ms anyway, generally more in the 1-5 second range. It's not multiplayer, and provided the game can maintain 60 fps (which it probably can), the experience should be the same for all players.
"Carry" the remainder over to the next frame. In the example above, give the agents 23.2ms of time to "spend" in the next frame.
Amp up the framerate. At 60fps, the most time you can possibly waste is 16.6ms, but at 200fps you can lose at most 5ms. (Currently my logic loop and render loop are coupled and capped at 60fps, but I can easily change that.)

sentences:
JBullet - Detecting when 2 objects collide? How can I detect when 2 collision objects collide with JBullet? Currently, all body types are going to be of type RigidBody.
I have quite literally been trying to find the answer of this for over 2 months, and would highly appreciate it if someone could help me.

There is some random stuff about collision callback, but that never seems to work - Either there is missing classes, or the code just does not do what I want it to do (Or is something stupid like "check every singke collision object" to do this), and just other things that mean I have never got an answer to my question.

I need to know this to allow ships and a cannonballs to be able to collide and explode. The game is fully playable and has got collision detection manually implemented, however it takes up over 50% of my I7's CPU - Far too much.

Thank you if you can answer my question.

P.S. JBullet is being used on my server, not my client.

sentences:
Android OpenGL ES RENDERMODE_WHEN_DIRTY implementation I am trying to understand RENDERMODE_WHEN_DIRTY so that I could save battery life wherever possible.. I made this sample application so that GlSurfaceView is updated with random color only when the random number temp is greater than 50... If the value of temp is less than 50, I want it to retain the last random color.. But in this code sample, it is not retaining it but making the screen go black forever!

Basically I want to know if my implementation of RENDERMODE_WHEN_DIRTY correct...

package com.blob.blob;

import java.util.Random;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Bundle;
import android.util.Log;

public class OpenGLActivity extends Activity implements Renderer
{
    GLSurfaceView glView;
    Random rand ;
    @Override
    public void onCreate(Bundle s)
    {
        super.onCreate(s);
        glView = new GLSurfaceView(this);
        glView.setRenderer(this);
        glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
        rand = new Random();
        setContentView(glView);

    }

    public void onDrawFrame(GL10 gl)
    {
        int temp = rand.nextInt(100);

        if(temp > 50)
        {
        glView.requestRender();

        gl.glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        }

    }

    public void onSurfaceChanged(GL10 gl, int width, int height) {

        Log.d("OpenglTest", "Surface Changed");
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {

        Log.d("OpenglTest", "Surface Created");
    }

    public void onPause()
    {

        super.onPause();
        glView.onPause();

    }

    public void onResume()
    {
        super.onResume();
        glView.onResume();
    }
}

sentences:
Working with lots of cubes. Improving performance? Edit: To sum the question up, I have a voxel based world (Minecraft style (Thanks Communist Duck)) which is suffering from poor performance. I am not positive on the source but would like any possible advice on how to get rid of it.

I am working on a project where a world consists of a large quantity of cubes (I would give you a number, but it is user defined worlds). My test one is around (48 x 32 x 48) blocks.

Basically these blocks don't do anything in themselves. They just sit there.

They start being used when it comes to player interaction.

I need to check what cubes the users mouse interacts with (mouse over, clicking, etc.), and for collision detecting as the player moves.

Now I had a massive amount of lag at first, looping through every block.

I have managed to decrease that lag, by looping through all the blocks, and finding which blocks are within a particular range of the character, and then only looping through those blocks for the collision detection, etc.

However, I am still going at a depressing 2fps.

Does anyone have any other ideas on how I could decrease this lag?

Btw, I am using XNA (C#) and yes, it is 3d.

sentences:
How to keep track of elements inside a std::vector? Let's say I have a std::vector with sf::sprites and my maps are auto-generated.

Then you won't know which element is which sprite.

Example :

I want THAT tree sprite to be removed, but I have no idea which element that tree sprite is inside of my vector... :(

sentences:
Replicating no. of sprites without letting the app to slow down and crash Is it possible that if I'm making a a simple drag-n-drop game, does making a new sprite via constructor with texture as a parameter makes the game slower and depletes more memory until it crashes or does making a new texture via constructor cause the memory to go slow? I'm on a revision for the new drag-n-drop puzzle game where the only goal is to stack the most no. of objects as you can before it falls off the platform. Is it a good idea to create another sprite with texture as a parameter every time a player drag-n-drop another object?

Here's the start of the dry run looked like and I set it to debug mode so that the platform is completely block the pit to test the replication test.

Afterwards, when it reaches from hundreds to thousands, this will be like this and the game gets slower.

When the game crashes, here's the result via Logcat:

12-11 16:38:53.953: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:38:53.953: E/SoundPool(25701): Error creating AudioTrack
12-11 16:38:53.993: D/dalvikvm(25701): GC_EXPLICIT freed 947K, 14% free 14414K/16672K, paused 2ms+4ms, total 96ms
12-11 16:39:16.363: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:39:16.363: E/SoundPool(25701): Error creating AudioTrack
12-11 16:39:16.433: D/dalvikvm(25701): GC_FOR_ALLOC freed 2120K, 15% free 14418K/16848K, paused 47ms, total 47ms

By the way, I'm using BodyEditor library for Box2D program and rendering, a physics engine.

sentences:
How can I make the cursor the right size on a 4k monitor? Since I have a 4k screen,

cursor.loadFromSystem(sf::Cursor::Hand));

gives me a cursor that is way too small.

Is there a simple way to make the cursor automatically be the right size? (I want my program to work for people with any screen size).

sentences:
Libgdx, actor touchlistener not working public class Main extends ApplicationAdapter {

SpriteBatch batch;

OrthographicCamera camera;

Stage stage;

Image greyback;
Image circle;

private float width;
private float height;

@Override
public void create () {

    batch = new SpriteBatch();

    camera = new OrthographicCamera();

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    greyback = new Image(new Texture("greyback.png"));
    circle = new Image(new Texture("circle.png"));

    width = Gdx.graphics.getWidth();
    height = Gdx.graphics.getHeight();

    greyback.setWidth(width);
    greyback.setHeight(height);

    circle.setPosition(200,200);

    circle.setBounds(200, 200, circle.getWidth(), circle.getHeight());
    circle.setTouchable(Touchable.enabled);
    circle.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {

            System.out.println("CLICKED");

            return true;

        }

        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {

            System.out.println("REMOVED");

        }

    });

    stage.addActor(greyback);
    stage.addActor(circle);

}

@Override
public void render () {

    stage.draw();

}

}
But, when I click on the circle the touchlistener doesnt fire, why?

sentences:
Unity3d getting terrain height I am making an RTS game in unity like Total War games. As for rendering I am using Graphics draw mesh instanced method and after culling a I can easily render massive amount of soldiers on battlefield also they are animating with shader. I am not using unity gameobjects or unity physic engine(Also they are costly) as only data I am providing is Matrix4*4 to DrawInstancedIndirect method and rendering.Problem is I want to get height of terrain at specific position(to place unit on terrain) So I can pass Y value to Matrix4*4 for rendering. After seraching documentation I found that there are few ways to get height.

Terrain.SampleHeight :
It is easy to get height with this method just need to pass vector position but
costly As When there comes 10,000s of units on battlefield 10k calls for sample height kills performance.

TerrainData GetHeights : Can get heightvalue from it in 2d array but height I get is only for int value i.e [10,500] so there is not any option to get value sayif specific unit is at position[10.52,234.8]

TerrainData.GetInterpolatedHeight : I can get height for float values but I am getting inconsistant result with it.

One option for me is to make flat terrain but it kills immersion. I ran out of ideas here Is there any way I can get of terrain by either terrain texture or by shader ?
Sample Image

EDIT: GetinterpolatedCode

         for (int i = 0; i < position.Length; i++)
        {//position is array contains info of all vectors
         //t is terrainData
            q = t.GetInterpolatedHeight(position[i].x, position[i].z);
            position[i] = new Vector3(position[i].x,q, position[i].z);
            print(position[i]+"//"+ t.GetInterpolatedHeight(position[i].x, position[i].z));
        }

sentences:
Improving Processes in One-Man GameDev Shops As a hobby programmer, how can I incorporate a continuous-improvement-like process like Agile's retrospectives in my processes?

I've tried bullet items of three good/bad things at the end of each project, but I feel it's not enough. And I feel that a sprint retrospective is overkill. Where's the balance? How can and should I open the door for continuous process improvement?

Or maybe this question should go on the beta Project Management Stack Exchange site?

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:
2d shapes in XNA 4.0? Having some experience of XNA but none of 3D programming. I have an idea i want to realize but i have not decided to do it in 3d or 2d. Im not sure which one will be best in XNA.

I want to have a shape like a blob that can reshape depending on input. The morphing does not need to be very advanced. It could be a circle (2d) or globe (3d) that just has one point that moves slightly in a random direction.

In ASP.NET i have made this through the 2d Draw classes where i can make lines, circles, squares etc and then modify the points that makes them up. But it seems to me that XNA does not have classes for making 2d shapes (can i get this confirmed?). If it had, then this would be the quickest solution for me.

sentences:
Leaderboard not working in Unity I'm trying to create a leaderboard for my game. I have the game created and added the leaderbaord using cloudonce. I have also created the app on google play console and linked the app to the game services. I have followed the following tutorial to create the leaderboard: Leaderboard tutorial
I have followed the exact same instruction as given in the tutorial. Once the game is over, the leaderboard button is activated. I have attached LeaderboardsButton script(this script comes with the CloudOnce package) to the leaderboard button.
Here is the code in the game over panel for getting the score:
void OnEnable()
{
    DisplayGameOverScore();
}
void DisplayGameOverScore()
{
    gameOverScore.text = ((int)gameManager.playerScore).ToString();
    gameOverHighScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
    CloudOnceServices.instance.SubmitScoretoLeaderboard(PlayerPrefs.GetInt("HighScore", 0));
}

This is the CloudOnceServices script as per the tutorial:
public static CloudOnceServices instance;

private void Awake()
{
    TestSingleton();
}

private void TestSingleton()
{
    if (instance != null)
    {
        Destroy(gameObject);
        return;
    }
    instance = this;
    DontDestroyOnLoad(gameObject);
}

public void SubmitScoretoLeaderboard(int score)
{

    Leaderboards.HighScore.SubmitScore(score);
}

I have attahced this script to an empty game object along with the InitializeCloudOnce script(this is provided with the CloudOnce package).
I have also created an alpha test on googleplay. Once I open the link and start the game, the google play services console open and when I hit the leaderboard button, google play services console loads but after that nothing happens. It just goes back to the game. I read that other people ran into similar issues and the advise given was to check if the SHA1 certificate fingerprint is the same in app signing under release management and the credentials in GoogleApis. They both match. I'm not sure what the issue is?

sentences:
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:
How to draw a 3D capsule? I want to draw a 3D capsule defined by a segment (two points start->end) and a radius:

Image source: Orionist on Wikimedia Commons

I already have a sphere leaning on this answer: https://stackoverflow.com/a/31326534/1902536.
I understand that I can expand the Parametric Equation to an ellipse one but I'm not sure how to do it with the segment (that may have rotation).

what is the best way to draw/model a capsule?

sentences:
c++ How to use angular velocity that derived from inertia and force(torque) in 3d I am relatively new to game development. May my terminology and description are not appropriate. Please excuse my poor phrasing and help me by giving advice on how to question better if this question seems less fitting. I really appreciate your efforts.

Hi. I am having hard time interpreting the set of values I have.
I have inertia and force(torque) in terms of x y z.
FYI I used x and y coordinates as my ground, flat coordinates and z as my up/down.

I am assuming that since f = ma, that angular acceleration must be a = f / m.
So I divide my torque by inertia.
Then I add those x y z values to my angular velocity variable's x y z.

However these x y z values confuse me. Don't I need angle/sec or radian/sec sort of values in order to apply rotation?
The x y z values I have seemed to not say anything about radians or angular movement.

Question : If I have ( 1, 2, 3 ) or any ( x, y, z ) as my angular velocity, how do I actually apply it as angular movement?

FYI Here I am pasting my code :

float mass = 100;
float devidedMass = 1.0/12 * mass;
Vec3 innertia(
    devidedMass* (_box._size.z*_box._size.z + _box._size.x*_box._size.x),
    devidedMass* (_box._size.y*_box._size.y + _box._size.x*_box._size.x),
    devidedMass* (_box._size.y*_box._size.y + _box._size.z*_box._size.z ));
box._angAccel += forceAng/innertia;
box._angVelo += box._angAccel;
box._angAccel.allZero();

source of my inertia calculation
http://www.health.uottawa.ca/biomech/courses/apa4311/solids.pdf

sentences:
The View-Matrix and Alternative Calculations I'm working on a radiosity processor in DirectX 9. The process requires that the camera be placed at the center of a mesh face and a 'screenshot' be taken facing 5 different directions...forward...up...down...left...right...

...The problem is that when the mesh face is facing up( look vector: 0, 1, 0 )...a view matrix cannot be determined using standard trigonometry functions:

Matrix4 LookAt( Vector3 eye, Vector3 target, Vector3 up )
    {
        // The "look-at" vector.
        Vector3 zaxis = normal(target - eye);
        // The "right" vector.
        Vector3 xaxis = normal(cross(up, zaxis));
        // The "up" vector.
        Vector3 yaxis = cross(zaxis, xaxis);
        // Create a 4x4 orientation matrix from the right, up, and at vectors
        Matrix4 orientation =
        {
            xaxis.x, yaxis.x, zaxis.x, 0,
            xaxis.y, yaxis.y, zaxis.y, 0,
            xaxis.z, yaxis.z, zaxis.z, 0,
            0,       0,       0,     1
        };

        // Create a 4x4 translation matrix by negating the eye position.

        Matrix4 translation =
        {
            1,      0,      0,     0,
            0,      1,      0,     0,
            0,      0,      1,     0,
            -eye.x, -eye.y, -eye.z,  1
        };
        // Combine the orientation and translation to compute the view matrix
        return ( translation * orientation );
    }

The above function comes from http://3dgep.com/?p=1700...

...Is there a mathematical approach to this problem?

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:
Setting the colour of a dynamically created tile does not work I have a function that takes in the position of a tile on a Tilemap and sets the colour. If I do not replace the tile with a dynamically created one, it works just fine.
However, if I create a tile at runtime, set it's colour and add it to the tilemap, the tile does not change. In the preview window it appears black.
The function can be found below:
private void CreateTile(Vector3Int tilePosition)
{
    var tempTile = ScriptableObject.CreateInstance<Tile>();

    tempTile.flags = TileFlags.None;
    tempTile.color = Color.green;

    tilemap.SetTile(tilePosition, tempTile);
}

Any help would be appreciated, I have spent a few hours on this problem.
Thanks.

sentences: How do I stop rotation after colliding with a specific object? How do I stop rotation after colliding with a specific object? I want player to stop rotating when they collide with walls. I am using Unity, with C#.

sentences:
Why isn't OnCollisionEnter2D working? I've made a hole. I have animals tagged as animals. When an animal walks into the hole, they disappear. I tried OnTriggerEnter2D() as well, and set the collider to isTrigger, but it still didn't work. I can get it to work without the tag part, but anything that bumps into each other sets each other to inactive.

public class BlackHole : MonoBehaviour
{
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "animal")
        {
            other.gameObject.SetActive(false);
        }
    }
}

sentences:
Compute min/max position of tile in compute shader I'm trying to implement tiled deferred lighting with OpenGL compute shaders.
For that, I need to compute the minimum and maximum position of each tile.

My first approach was to use atomicCounters for the computation, like that:

shared int minX;
shared int minY;
shared int minZ;
shared int maxX;
shared int maxY;
shared int maxZ;
...
atomicMin(minX, positionWorld.x);
atomicMax(minY, positionWorld.y);
barrier();

// now the shared variables contain the min/max
// position per tile

But that runs painfully slow (I guess because the atomic operations aren't very well for  parallel processing).

So what would be the best / fastest way to do this?

sentences:
Smooth rotation for a bone? I'm trying to make my character bone "chest" rotate smoothly when face enemy and get back to his stand. Can anyone help me with this ?

public Transform Target;
public Vector3 Offset;

Animator anim;
Transform chest;

public float rotation_speed;
public bool aim_at_traget = false;

void Start()
{
    anim = GetComponent<Animator>();
    chest = anim.GetBoneTransform(HumanBodyBones.Chest);
}

void LateUpdate()
{
    if (aim_at_traget == true) {
    // smooth rotation to face target
    chest.LookAt(Target.transform.position);
    chest.rotation = chest.rotation * Quaternion.Euler(Offset);
    }
    else {
        // get back to you stand smoothly
    }
}

sentences:
LibGDX - Executing 2 different touchDown events in the same method On the bottom left of my screen is a circle with an Arrow and on the bottom right is a circle with a gun. If the player is in jetpack mode and the Arrow "button" is clicked he flies like flappy bird (touch down = push him upwards, touch up = he falls down) - if the player is in jump mode he simply jumps.

My problem is I can't seem to fly the jetpack upwards AND shoot a bullet at the same time (i.e. the case where I'm tapping both the Arrow and the Gun). Is there some sort of trick I can use here?

My touchDown() method is in a class Controller looks like this:

@Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        int tapY = Gdx.graphics.getHeight() - screenY;
        //true if the arrow (bottom left) is tapped
        arrowClicked = inRange(upArrowSprite, screenX, tapY);
        //true if the gun (bottom right) is tapped
        gunClicked = inRange(gunSprite, screenX, tapY);

        // if arrow is pressed and player isn't in jetpack mode, make him jump
        if (arrowClicked) {
            if (!(player.getState() == ObjectState.JETPACK_MODE)) {
                player.setState(ObjectState.JUMPING);
                player.jump();
            // if the player is in jetpack mode, accelerate him upwards every time arrow is tapped
            } else {
            player.setTouchedDownFlying(true); // set boolean to be true
            player.setState(ObjectState.JETPACK_MODE);
        }
        }
        //if the gun is tapped (bot right), shoot a bullet
        if (gunClicked) {
            player.shoot();
            }
        return true;
    }

these are the relevant methods in Player:

public void update() {
    moveBy(xSpeed, -gravity);
    ...
    if(touchedDownFlying) {
        jetPackFly();
    }
    ...
}

public void setTouchedDownFlying(boolean bool) {
    touchedDownFlying = bool;
}

public void jetpackFly() {
        setySpeed(getySpeed() + flyAcceleration);
}

public void shoot() {
        Bullet i = new Bullet(this);
        bullets.add(i);
}

Any help is highly appreciated, thank you :)

sentences: How to access triangulates in a 3d model that was imported in Unity? I have a 3d model of a city. It is in collada format and ina dae file. I imported 3d model to unity but I don't know how can I access the objects of this 3d model with c# script.Because I am new with coding stuff. I am trying to learn bot unity and c# at the same time and I think this is a painful process.I want to access and manipulate the triangles in this 3d model. You can see the model in the attaching picture

sentences:
In Unity, how can I register a custom file type that is always opened with my game? I want my players to be able to create their own scenes as custom levels, save them as files (say custom1.gamelevel), and open them directly in my game program by double-clicking the level file, rather than having to go through the steps of opening the game, browsing to the file in my menus, and then loading that scene/level.

I already have loading custom levels covered. I just need a way to associate this custom file type with my game which can open it.

I am mainly interested in a Windows-based solution.

How can I do this?

sentences:
High-performance update of a bitmap grid I need to visualize a fast paced process in .NET in 2D. I am planning to use writeable bitmap 800x40px.
The idea is like this - there are objects which are represented by very basic colours and sizes anything from 1x1 to 4x4. each takes 4x4 "cell" - they all are fixed like a chess board.
The objects move between cells and change size. Most importantly they move independently, so I cant (I can but I would like to not) have a sort of refresh rate.. I need to animate each object state change - like say pixels pouring from cell to cell. the transition time should be around 500ms.
In this period of time the states can change multiple times so I should be able to abort outdated animation, move object "instantly" to new cell and start more recent object animation which could have taken over the "old" cell..
The accuracy should be in 1-2ms intervals.
The host application is WPF .NET Framework

sentences:
Game loop alternatives for efficiency Understand where I'm coming from - I've been taught that a game is implemented something like this (pseudocode):

while (!win_condition)
{
   waitforinput();
   updategraphics();
   //etc..
}
exit();

Is there another way to implement the "game loop" without limiting the game to finite "turns"?

This

while (true)

business seems to eat a lot of CPU, especially for how simple a game I'm making!

sentences:
Developing Kinect game for Xbox360? Possible Duplicate:
  Can you access Kinect motion sensing from XNA?

bunch of questions:

Is it possible for me to create a Kinect application using XNA and deploy it to Xbox360 platform?
What should I use, will Kinect SDK for Windows be okay for this task?
What about licenses, is it free to use or should I pay for licenses?

Thanks for any answer or url...

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: Implementing audio for a game made using JMonkey? Is it possible to implement music/SFX in game made using JMonkey?  If yes, how did you do it?  What did you use?

sentences: 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:
Assigning function to button in foreach loop causes all buttons to have the same argument value I have a script that generates buttons based on a list of assets. Each button is intended to to add the asset's resource path to a variable called SpawnGlobals.CurrentSelection. When printing the asset resource name of all button within the loop, the different resoruce paths are shown. When printing the value in the select function, the value is always the last item in the asset_register list.

I do not understand why this is happening. Am I using the foreach loop or lambda incorrectly?

void Start () {

    //Add Foundry Assets Here:
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Test Sphere", "sphere_obj"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 01", "BuildingBlock10x10x10_01"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 02", "BuildingBlock10x10x10_02"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 03", "BuildingBlock10x10x10_03"));
    foreach (FoundryAsset asset in SpawnGlobals.asset_register) {
        SpawnGlobals.buttons.Add(Instantiate(button_prefab));
        GameObject current_button = SpawnGlobals.buttons.Last ();
        current_button.transform.SetParent(master.transform, false);

        current_button.GetComponentInChildren<Text>().text = asset.AssetName;

        print (asset.AssetName);
        current_button.GetComponentInChildren<Button>().onClick.AddListener (delegate {
            select(asset.ResourcePath);
        });

    }

}
public void select(string selected)
{
    print (selected);
    SpawnGlobals.CurrentSelection = selected;
}

sentences: Region selection in OpenGL If I have a mesh of triangles and going to make a selection on it using a region (and not rectangle using   Glu.gluPickMatrix(...);), how can I implement it?

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:
A* path finding for road network - data structure to represent directivity I have been reading A* path finding to apply on a road like network structure. Most of the code I saw is about A* on tile based maps. There is a short description at Amit's page here about what I am looking for. My question is about what data-structure should I use to define a road network map.

I have infromation like, node, cost,etc. But not sure how to represent both one directional and bidirectional roads. In a graph structure, can I mix directed and undirected edges or use two edges to represent that a segment of road can be traversed in both direction. Any good example available?

Thank you so much.

sentences:
Blending Lightmaps and Dynamic Texture Shadows in HLSL/GLSL I'm using Gile[s] as my lightmapper and my engine can execute GLSL/HLSL scripts.

I would like to accomplish something like this for performance reasons. I was told that this technique can only be done by shaders.

Someone has provided me with a quick code example and starting code but it is still far from being implemented.

lightmapColor*=shadowmapValue;
colorIntensity = (lightmapColor.r+lightmapColor.g+lightmapColor.b)/3.0;
lightCol = (1-colorIntensity)*ambient+(colorIntensity)*lightmapColor;

Not sure if it is applicable in my engine so I am looking for some guidance and perhaps some basic hlsl code to accomplish this. My lightmap texture uses the UV2 Channel if it helps. Thanks.

sentences:
Why does reverse depth buffering provide more precision? (with DXGI_FORMAT_D24_UNORM_S8_UINT Datatype layout) I lately came around methods optimizing the use of the depth buffer, as the easiest solution reverse depth buffering is mentioned but I cannot wrap my head around why I would be gaining a better depth distribution with it.

First I thought it to be that way because floats use well floating point format so if I can map 90% of the scene to near zero i can benefit from floats great precision near zero but then I saw that those 8 bit for the exponent are being reserved by stencil so now I don't think they store exponent data?

Edit: Now that i was told unnorm are just fixed precision and have actually tested that it does improve depth resolution indeed I dont understand how it can improve Z-buffering without having exponent data has someone a theory regarding why? If the UNORMs have fixed precision it should´nt matter whether I map the 99% that don't lay 3 meters in front of the camera to one or to zero.

sentences:
Why code reflection became a must in game engines? I'm currently doing some research on programming languages(compile time reflection area, if you ask) and I found that on the game engine area the reflection feature becomes a must, an engine either uses a language which has reflection feature itself(for example uses C#), or implements it for non-reflection languages(for example both UE and CryEngine implement reflection mechanisms for C++).

I'm not a game developer, so I have no experiences on game developing and not familiar with engines, so can anyone tell me in what case the reflection becomes a must? And what's more, does reflection used only in development phase or also used in released production?

sentences:
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:
What is a good "easily" moddable and scriptable 3D game? I've made a fair number of 2D games (and actually completed/released a few of them). I'm hesitant to move into the 3D realm, because of the order of magnitude (everything takes ~10x more work).

To get started, I was thinking about picking something and modding it. What's a good, "easily" moddable game? By easily, I really mean:

Most or all of the content can be changed via tools (not code)
Tools are included, and mature (don't crash much, etc.)
The game is free or cheap
The game is scriptable (scripting language or SDK)

I'm not really particular about a target language, although I lean towards something more like C# than JavaScript.

If this is not a "good" question, we can make it a list and community wiki it. I really want to know options to get started in the 3D modding realm.

sentences:
Optimize algorithm: finding all possible moves for a turn based game I am working on the ai for a turn based game. To illustrate my problem this are the simplified rules of the game:

The game takes place on a tiled map with obstacles (black quads) like this:

The player has several tokens (like the two colored dots in the example picture)
The player can move all his tokens in his turn
the tokens move in a straight line until they hit an obstacle, the border of the map or another token
each token could move two times in each turn.
the player can move his tokens in any order he likes

The AI needs a list of all possible turns it could make of one game state. My first attempt was to recursively go through all tokens and move them in any possible direction and order. that works of course but the problem is that with just four tokens there are several millions of possible turns (if each token could move two times). Most of the outcomes of these turns are the same (the tokens end in the same place). In the example above the tokens could move like this:

No matter in which order the four move actions (A,B,C,D) are made, the end positions of the tokens are the same. I am only interested in the possible end turn situations. So I implemented a transposition table in the turn generation algorithm to negate all of the equal turns. That works and in the end I have only several hundred of possible turns with four tokens rather than several millions.
The problem is that the algorithm takes too much time because it has to calculate every possible turn. Does anybody has a hint how to prune the turn generation  tree? Or any other idea how to calculate only the different possible turn outcomes?

Note: In the real game the map is slightly bigger (30-40 free cells) and there are up to 6 tokens.

sentences:
Unity animation editor having trouble to animate twice the same component I'm not getting warm with the Unity animation editor.

This is what I want to do:

The 2 lasers should be like this, rotating 360 degrees over and over. .The classname laser2 doesn't mean anything, I implemented 2 concepts therefore this is the laser2 class.
However, the animation editor seems to have a problem with having the same component more than once. I'm only able to animate the first laser.

As soon as I open the Laser2 section, it opens both lasers and changes in it are only stored in the first laser. Is there way to make them seperate? Having the exact same class twice (with different name) will help but that's an unbelievable dirty solution.
I did not do much with the animation editor so far so maybe there is some easy fix that.
Edit: Startangle is the value which must be animated on both.

sentences:
Bitmap drawn with Graphics.DrawImage flickers I am working on a space invaders clone using bugs as aliens. Everything works ok but the bug bitmap flickers on the screen.

    public void Form1_Load(object sender, EventArgs e)
    {

    }
    int x = 0, y = 0;
    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;
            }
        }
    }
    private void timer1_Tick(object sender, EventArgs e)
    {
        y -= 5;
        Invalidate();
    }
    protected override void OnPaintBackground(PaintEventArgs e)
    {

    }
    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        Bitmap bug_one = new Bitmap("bug_one.bmp", true);
        Bitmap ship = new Bitmap("ship.bmp", true);
        Bitmap bullet = new Bitmap("bullet.bmp", true);
        e.Graphics.Clear(this.BackColor);
        e.Graphics.DrawImage(ship, 350 + x, 530);
        e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
        e.Graphics.DrawImage(bug_one, 350, 0);
        e.Graphics.Dispose();
    }

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:
Can you use well known buildings in your game? Is it legal to reference a real city in your game and use the same architecture of well known shops and buildings?

For example, I'm sure you can't create an exact 3D model of McDonalds, put it in your game, and sell it. However, is it possible to use the same architecture, but different name? and even use the same colors, just as long as the name and logos are not used?
Or would there be the possibility of getting in trouble for creating something in the "likeness".

sentences:
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:
How does one save a procedural world? I have recently read about how to create procedural worlds... but how do I save one?

In games like Terraria or Minecraft users can freely modify the landscape, but that world can't be recreated from the start seed. What techniques are used to save procedural but modifiable worlds?

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:
How to get Pixel Coordinates of certain colors in a Texture? I have a relatively big Texture, and I try to find a certain color pixels pattern:
eg. White, Black, White, Green .
They are lying next to each other,

If I use Texture2d.Getpixels() on every pixel every frame its possible, but way too slow.

Is there a "real good" way to do this? For example a shader way?

The "big idea" is to make a game which is "remote-playable".
For example through Twitch or of a streamed youtube video.
The user should not be connected to the server in any way, Instead he is sending messages or not.

For this I have to find a health bar. This health bar has the left-upper corner in black-> white -> black -> green pixels lying next to each other.

In the shader I CAN find these colors, but I dont really know the coordinates.
Also I think there "should" be a solution with a  ... compute shader?
I dont really want to render new stuff. Just check pixel colors.
I just want to know where these pixel colors are.

I imagined something like this:

If PixelColorIsWhite(x,y)
{
If PixelColorIsBlack(x+1,y)
{
If PixelColorIsWhite(x+2,y)
{
If PixelColorIsGreen(x+3,y)
{
return x+20,y+100 //because the player is 20 pixels right and 100 pixels below
}}}}

In a shader i guess i can access the current coordinate, but I cant access the other pixels. Its paralell processing... right?
So its impossible to access the "entire thing" in one go , right?

I think it must work somehow with... getting the big "chunk" of texture data, a very long array of pixels, giving it to a compute shader, and letting the CS find it.

I hope I could clarify the problem now :)

_-----------------------------------

Update:

I found out it (at least) should work with a compute shader.

I feel like im so close to the solution, yet im getting errors. :-(

So...

This is my C# Code:

public ComputeShader shader;
public Material thisMat;

public RenderTexture ScreenTex;

public int x;
public int y;

public const string INPUTTEX = "InputTexture";

private void Update()
{
    RunShader();
}

public void RunShader()
{
    RenderTexture tex = new RenderTexture(1024, 786, 24);
    tex.enableRandomWrite = true;
    tex.Create();

    shader.SetTexture(0, INPUTTEX, ScreenTex);
    shader.SetFloat("_ScreenWidth", Camera.main.pixelWidth);
    shader.SetFloat("_ScreenHeight", Camera.main.pixelHeight);

    int[] data = new int[2];
    ComputeBuffer buffer = new ComputeBuffer(data.Length, sizeof(int)*2);
    buffer.SetData(data);
    shader.SetBuffer(0, "readWriteIntBuffer", buffer);

    thisMat.mainTexture = tex;
    int kernelHandle = shader.FindKernel("CSMain");

    shader.SetTexture(kernelHandle, "Result", tex);
    shader.Dispatch(kernelHandle, 1024 / 8, 786 / 8, 1);

    buffer.GetData(data);

    x = data[0];
    y = data[1];
    buffer.Release();}

And this is my ComputeShader Code:

    -------------------
    #pragma kernel CSMain

RWTexture2D<float4> Result;

RWStructuredBuffer<int> readWriteIntBuffer;
Texture2D<float4> InputTexture;
float _ScreenWidth;
float _ScreenHeight;

[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    if (id.x >= (uint)(_ScreenWidth*_ScreenHeight))
    {
        return;
    }

    int y = id.x / int(_ScreenWidth);
    int x = id.x % int(_ScreenWidth);
    readWriteIntBuffer[0] = 999; //some debug-testnumbers that show me that there were no colors found
    readWriteIntBuffer[1] = 998;

    if (InputTexture[float2(x,y)].r == 1.0f && InputTexture[float2(x, y)].g == 0.0f && InputTexture[float2(x, y)].b == 0.0f)
{
    float2 coordinates = float2((float)id.x / (float)_ScreenWidth, (float)id.y / (float)_ScreenHeight);

    readWriteIntBuffer[0] = coordinates.x;
    readWriteIntBuffer[1] = coordinates.y;

}
}

This Computeshader checks if a single pixel in a texture is red and writs it in a buffer. The buffer gets read by C# with getdata.
-- it seems we're almost getting there!
But "something" seems to be wrong, since I dont seem to get the colors i want.
But the compute shader seems to work, since i also get the triange-pattern in my material.

sentences: 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:
Java enum pairs / "subenum" or what exactly? I have an RPG-style Item class and I stored the type of the item in enum (itemType.sword). I want to store subtype too (itemSubtype.long), but I want to express the relation between two data type (sword can be long, short etc. but shield can't be long or short, only round, tower etc). I know this is wrong source code but similar what I want:

enum type
{
    sword;
}

//not valid code!
enum swordSubtype extends type.sword
{
    short,
    long
}

Question: How can I define this connection between two data type (or more exactly: two value of the data types), what is the most simple and standard way?

Array-like data with all valid (itemType,itemSubtype) enum pairs or (itemType,itemSubtype[]) so more subtype for one type, it would be the best. OK but how can I construct this simplest way?
Special enum with "subenum" set or second level enum or anything else if it does exists
2 dimensional "canBePairs" array, itemType and itemSubtype dimensions with all type and subtype and boolean elements, "true" means itemType (first dimension) and itemSubtype (second dimension) are okay, "false" means not okay
Other better idea

Thank you very much!

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

sentences:
Good approach in designing game classes I took a semester-long course in java but I'm still a beginner in Object-Oriented programming paradigm. Suppose that I want to create a simple game where the player can go to different locations. Each location has its own unique treasure (that has other attributes) and has its own set of different animals. The question: How can I design classes that are not too naive based on the game? (can be too broad) Is my approach below correct or can it be improved? (narrowed)

I was thinking that I should create a Location, treasure, and Animal classes; Each classes declared in its own file.

public class Location {
    // attributes such as treasure and animals
    private ArrayList<Animal> animals;
    private Treasure treasure;
    public Location(String name) {
        // initialization of attributes
        if(name.equals("Jungle")) {
            treasure = new Treasure("Rare Vine");
            animals.add(new Animal("Monkey", 90, 50);
            animals.add(new Animal("Snake", 100, 60);
        }
        else if(name.equals("Valley")){
            // and so on
        }
        // and so forth
    }
}
public class Treasure {
    // attributes such as name and value
    public Treasure(String name, int value) {
        // initialization of attributes
        this.name = name;
        this.value = value;
    }
}
public class Animal {
    // attributes such as name
    public Animal(String name, int encounterRate, int captureRate) {
        // initialization of attributes
        this.name = name;
        this.encounterRate = encounterRate;
        this.captureRate = captureRate;
    }
}

But I doubt that the use of conditional statements in Location class to initialize its attributes makes the method have so many lines and may confuse the developer after some time. what if there are so many attributes per location and there are many locations?

Another approach that I can think of is to create subclasses of Location and put the corresponding values for the location's attributes. For me, I can understand the structure of the game and efficient if the number of location subclasses is small.

I'm new in creating java games so I don't have a solid view in designing game classes. this problem may be broad so I narrowed it down to my code above.

sentences:
Need physics algorithm for modeling ceiling collapse in voxel-based game I'm looking for algorithms on how to model the physics of cave-ins/collapses for a game idea I am working on. The game allows the player to extensively mine 3D voxel-based asteroids, and I want areas that are insufficiently supported to collapse under their own weight. Making the problem even more challenging, gravity will be non-uniform (the direction it pulls will depend on where a given voxel is in relation to the asteroid's center of mass), and the number of voxels in the asteroid will be too large to model them all individually (I am using a sparse voxel octree to model the asteroid).

Hopefully, someone will be able to provide links to articles discussing suitable algorithms, or can provide ideas on how to solve the problem. If you need more details, please ask.

Edit 1: It does not need to be very accurate, I'm looking for something that would be a reasonable approximation for a Minecraft or Dwarf Fortress style game. I am mostly interested in how to determine where sections should break off when blocks are added or removed, moving the bodies after they break isn't part of this issue.

Edit 2: My initial idea was to calculate the force on each block then iteratively distribute the forces amongst neighbors. However, this would require an entry for each block, while only blocks on the surface have entries in the data structure. Modeling all blocks on the scale I want would likely be prohibitive - I would like to have bodies of at least 10,000,000 voxels, of which 200,000 will be on the surface and need to be stored.

sentences: 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 to implement server side auto attack? I'm writing a basic MMORPG and im trying to implement auto attack.

At client side I send an AutoAttackMessage to the server.

Should I send this message every X ms to the server, or juste one time and then server handle this himself ?

How to handle delay between 2 auto attack at server side ? (timer, special thread)...

sentences:
Optimising skeletal animation I am implementing a skeleton system for my latest game. I am using my own linear algebra classes which already have some optimisations, such as separate transformPoint and transformVector functions which avoid some multiplications by 0 or 1. It is working well so my question is not HOW to implement skeletal animation.

My question is how to optimise the matrix multiplications. At the moment there are several full 4x4 multiplications and 1 inverse per bone. I need the inverse because this is not just for skinning but also physics and stuff. But there are many 0s and 1s in the homogeneous matrices which can be optimised out. Also, I want to be able to specify the degrees of freedom for each joint, and in which order they are calculated, so for example, a shoulder joint could rotate yaw then pitch, or pitch then yaw. The result would be different. Should I have a separate matrix constructor for each permutation, which I believe is 15?

I assume this is a common issue with skeletal systems, so is there a standard method for this? How do engines normally optimise forward kinematic calculations?

I calculate all the matrices for the bones, starting at the root and working outwards. Note: my bones are in an array that is sorted by heirarchy depth so a bone's parent's matrices will already have been computed.

Please note: this is not a questions about skinning, I have no problem with that.

sentences: Can you have an embedded browser in Gamemaker:Studio I am trying to make a sort of browser in gamemaker and I wanted to know how to embed a browser within a game. Are there any extensions I need to download?

sentences:
How can I reduce Unity's package size? I've been experimenting with Unity3D 4.3's 2D features.  I've created a simple prototype game to learn how Unity works, how to create sprite animations, collisions and all the basic things.  My project compiled for PC was approximately 23MB.

The game includes one larger bitmap for a background (originally 1MB JPEG). The player spritesheet was black and white with almost no details. So all the assets had (in their original, compressed form) no more than 2-3 MB.  I ended up with one large executable file (about 10MB) and a folder with .dll files and assets (5-6MB).

Can that be reduced?

My experience with C# WinForms code makes me believe that executables and DLLs grow that big only when binary data was involved (images, sound, etc).  Is that the case with Unity?  I am interested in developing 2D applications for Android and iOS, where low total app size is a priority.

sentences: How does "Cut the Rope" do such realistic animation? "Cut the Rope" is so smooth and real life like, while some apps are very "bitmap" like.  How does "Cut the Rope" do such realistic animation?

sentences:
GLSL Shader Editors for Linux Are there any good IDE's for linux that lets us edit GLSL shaders and visualize their effect?

Note : Shader Designer By Typhoon Labs is a good option but I am looking for alternatives as this software has some issues with Ubuntu 11.10

sentences:
Control animation using animator control class I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given the screen short of the animation

Then I have attached the following code to it

Animator animator;

int eatHash=Animator.StringToHash("ideal");

int stateHash=Animator.StringToHash("Base Layer.pickbothfork");

void Start () {
    animator = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
    //animator.SetBool ("isEat", true);
    float move = Input.GetAxis ("Vertical");
    animator.SetFloat ("Speed",move);

    AnimatorStateInfo stateinfo = animator.GetCurrentAnimatorStateInfo (0);
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Debug.Log ("clicked spacebar");
        animator.SetTrigger(eatHash);
    }
}

The problem here is the above code is working,when I run the project the animation is getting played one after the another according to the state diagram.But when I click on the space bar the trigger function(jump animation ) is not working

if (Input.GetKeyDown(KeyCode.Space))
{
    Debug.Log ("clicked spacebar");
    animator.SetTrigger(eatHash);
}

Can anybody please help me finding solution for it

sentences:
Simple Line Formation I'm working on the first formation for my game's troops. These should simply stand on land, facing the same direction.

To achieve this, I tried to create offsets towards a pivot-unit, that is approximately the unit in the center of the formation.
The units are (temporary) elements of a squad list withing the Squad class.
I divide the List by 2 and get the closest integer, that should be the pivot point of the formation. Now I generate offsets for all units on the left side (Unit 1 to pivot-1) and right (pivot+1 to last unit) based on the distance/gaps.

This is the code for the line formation. Sadly, the units are only forming a very stange line with no visually detectable system:

int count = (int)(squadMembers.Count / 2);
pivot = squadMembers[count];
center = pivot.transform.position;
switch (type) {
    case FormationType.Line:
        int space = 5;
        for (int i = 0; i < squadMembers.Count; i++) {
            Unit tmp = squadMembers[i];
            int dist = 0;
            if (i > count) {
                dist = (count + 1) * space;
                center.x -= dist;
            }
            if (i < count) {
                dist = (count - 1) * space;
                center.x += dist;
            }
            tmp.StartMove(center);
        }
        break;
}

It also appears that this only works along the x axis, any idea how i can realize this with the walking/facing direction ov the pivot?

Is there any (obvious) error? How can I improve this script?

PS: Any idea, how I can transform this into a double line (2 Lines behind with half spacing)

sentences:
Physics for curved edges? I'm learning how to program simple two-dimensional games in C++ using SFML, I've done a relatively simple pong game already I would like to ask how I could go about creating the physics for a curved edge such as one on an air hockey table Such as this:

Do I have to code a type of reflection of xVelocity/yVelocity for every single point or what? How do I even add a curved edge such as that in the first place?

sentences:
Ranking - which position to show? My company is making Android apps, mostly little games...
Most of them have a view with the users profile and a view with a ranking list.

In the users profile you can see what rank the user is and of course you can see it in the ranking list. The ranking list shows ranks 1 - 100 and if the user is rank 35476 we are showing ranks 35466 to 35486 too, so whatever your rank, you are always in the ranking list.

Now my boss wants me to scroll the ranking list to the users position and I don't understand why you'd want this. You can see the rank in the profile and in my mind, when I go to the ranking list, I want to see the top guys and see how much points or whatever they have and I am not interested in seeing rank 35475 or 35477...this just doesn't make sense to me.

Is there some consensus on where to scroll the ranking list?

sentences:
Building a unified interface for a swap chain in both DirectX 12 and Vulkan Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

VkInstance = IDXGIFactory
VkPhysicalDevice = IDXGIAdapter
VkDevice = ID3D12Device
VkQueue = ID3D12CommandQueue
VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it's not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.
Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

sentences:
"_SRGB" suffix for BC texture format doesn't result in sRGB-to-linear correction at sampling I am working on a 3D engine as a hobby (Direct3D 11). Currently I am trying to implement sRGB -> linear -> sRGB color space conversions via texture formats with "_SRGB" suffix. So, my textures are supposed to be sRGB images (for example, DDS-files compressed in BC1_UNORM_SRGB format), output is also gamma-corrected (thanks to R8G8B8A8_UNORM_SRGB frame buffer) and all shader calculations are made in linear color space.
The problem is, whether I use sRGB or non-sRGB format for the DDS-file, after sampling the texture I get exactly the same color values inside the shader that are stored in original image. But if I get it correctly, sampler should apply implicit gamma correction (pow(color, 2.2f)) for the input values. So, for example, if I want to output the same color as is in the map (lets say, 0.5f for R channel), I sample it from the texture (0.5f becomes 0.218f after transferring to linear color space by sampler), then I do nothing with it inside the shader and send to output. As the frame buffer has sRGB format, merger (or some other part of pipeline, that does it) will apply gamma re-correction to our value (pow(color, 1.0f / 2.2f)), and 0.218f will become 0.5f again. I will get the same image as I had on the input.
The output colors are definitely gamma corrected, as I see clear difference when I change frame buffer format from sRGB to non-sRGB. But as no input correction is applied, the final image looks brightened comparing to the input one. As I said, I checked the value in pixel shader after texture.Sample() call, and it is exactly the same as colorpicker shows for the source texture. When I swap the texture format to non-sRGB, nothing changes (I use Visual Studio 2013 Update 4 for format changing).
To load DDS files I use DDSTextureLoader. I also called Direct3D methods directly to create resource and view from the file, but nothing changed. Both resource and shader resource view have "_SRGB" format, as I can see in Graphics Debugger, so they are definitely sRGB ones.
I've read at MSDN that in Direct3D 11 setting texture format is enough for sampler to recognize sRGB image. Is there something I am doing wrong or missing, or understand incorrectly? Maybe someone had similar issues? Any advice would be highly appreciated!

sentences:
Add Existing Animation I have several animations that I am using on a GameObject.  I switched the folder they were stored in, and they got detached from the gameObject.  How can I add the existing animations to my gameObject without having to recreate them?

I am not looking to do this programmatically.  I just want to undo the damage I have done without having to start over.  Ideally, I want a "Load Animation" option from the Animator window in the editor, but that does not appear to exist :-/.

sentences:
Play animation when click on each player with in maincamera unity3d I have 3 gameobjects (player1, player2, player3). I attached a script "playerscript" to these game objects.  In the main camera, I have added another script called "testscript". Clicking on a player should play the animation.  For that, I need to call the update() of "testscript.cs" in maincamera to the onMouseDown() of "playerscript.cs".

testscript.cs:

public class testscript : MonoBehaviour {
public bool selected;
public GameObject player1;
public GameObject player2;
public GameObject player3;

void Update () {
    //animation PickRightAndLeft
    player1.animation.Play("PickRightAndLeft");
}

playersscript.cs:

public class Playersscript : MonoBehaviour {
     void OnMouseDown () {
         Debug.Log (gameObject.name);
      }
}

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:
why won't my character move I am using game maker because I am new to game development and I think it's the easiest to understand because I took a course on it but I put in all the events so that my playerobj moves when you press the A and D keys but when I load up the game it doesn't work here is the GML code below that I am using:

//Speed of player: 5 Pixels per frame
 playerSpeed = 5;

 //Shortcuts for keypresses
 MOVELEFT = keyboard_check(ord('A'));
 MOVERIGHT = keyboard_check(ord('D'));
 MOVEUP = keyboard_check(ord('W'));
 MOVEDOWN = keyboard_check(ord('S'));

 //Move Player
 if (MOVELEFT && x > sprite_width/2)
 {
x -= playerSpeed;
 }

 if (MOVERIGHT && x < room_width - sprite_width/2)
 {
x += playerSpeed;
 }

 if (MOVEUP && y > room_height/2)
 {
y -= playerSpeed;
 }

 if (MOVEDOWN && y < room_height - sprite_width/2)
 {
y += playerSpeed;
 }

sentences:
How can I make billiard without using Rigidbody? Unity's physics engine isn't deterministic (ie. the results aren't always the same on all computers) so I haven't Idea that how billiard games Implemented.Is there a way to Implementing fake and deterministic
physic in unity?
I mean I want to make billiard without using Rigidbody

http://www.bezzmedia.com/swfspot/tutorials/flash8/8_Ball_Pool

I found this open source project that didn't use physic! this is what I need but unfortunately it's full c++ and I haven't enough time to convert it to c#

http://downloads.sourceforge.net/foobillard/foobillard-3.0-win32-2-bin.zip

sentences:
Reshapable polygonsprite I have an sprite I want to use as a texture.
I want to create an area, defined by a polygon collider, where the sprite is drawn.
For example:

Having the following sprite

And the following polygon collider 2d:

I want to have the resulting sprite/mesh:

This way I would have an image that covers exactly the polygon collider area.
Having an sprite and modifying it's vertexes doesn't seem to do the trick, as they are only editable while loading the sprite into unity.
Is there a way to make it editable in the editor, so while I change my collider, the image is updated to fit inside of it?

sentences:
What is the difference between phy_position_x and x in GameMaker: Studio? This is not covered anywhere in the documentation that I can find.

I am using the physics engine, and the reported phy_position_x and x values are different, such that (phy_position_x, phy_position_y) is (0, 0) and (x, y) is (origin x, origin y).

Why are they different and is one preferred over the other in code?

sentences:
Unity: OnGUI streamlining So like most games, I have inventory screens, equip screens, shop screens, and all that. I've previously been making each "screen" controlled by its own script (which is normal I think), and I draw the screens using GUI. However, I'm worried about having multiple OnGUI functions in my game (one OnGUI for each "thing" I draw [eg Inventory or Shop]) since OnGUI really isn't that best for performance. How should I solve this problem?

I thought about making each screen its own scene in the game but I wasn't sure if that would help things much.

sentences:
Revenue model for an open-source multiplayer game I've had an idea for a multiplayer game, and ideally, I'd absolutely love for it to be open source.

However, I also want to make a profit from it so I can make more games and maybe even have a dev team.

Is it possible to keep it open-source and generate revenue?

One idea I've had is to charge for online multiplayer services, but then users could easily circumvent that by patching in their own servers.

Is there a revenue model that can work for this kind of game project?

sentences:
Smooth moving on tile-based map, how to fix simple collisions? I've already had some experiences about the work of 2 dimensional square-based playfields and moving a player on them. Though, when a square has multiple pixel sizes, and player moves e.g. 1 pixel per frame, I have some problems. Currently, my program counts the coordinates of tile Player stands on like this:

Tile X coordinate = floor of Player X coordinate divided by the X size of a tile
a.k.a TileX = floor(PlayerX/TileXsize)

and same for Y. However, when I increase the moving speed to bigger px/frame speed, sometimes the player sinks into the tile that should stop it. How can I prevent this problem?

EDIT: codes. Language is Lua, framework is LOVE2D, gamefield is stored in tables. Player has an X, an Y, and Tilex&TileY, count this way on every frames:

Player.TileX = math.floor((Player.X)/TileSize)
Player.TileY = math.floor((Player.Y)/TileSize)

Moving belongs to key actions, they are simply like Player.X = Player.X + 1

There's a Gravity function as well, called on every frames:

function Gravity()
    if not Solidchecker(Field[Player.TileX][Player.TileY+1]) then
        Player.Y = Player.Y +GForce
    end
end

In case of anyGforce (which is a constant) where value is different from the size of the tile (24) the player sinks into the ground. Obviously in that case, everythings the same as if the system would be counted with only tiles, without separated Player.TileX calculations. Otherwise, it can't handle the occuring alignment.

Possibly I forgot showing some code parts, but I can't see now that any other functions would influence these variables.

sentences:
Animator.SetBool: am I supposed to call it only when its value changes? I've searched around the web for a while, but didn't manage to find anything about it.

Despite using Animator in several projects so far, I've never been in this exact situation, so I'm unsure what to do.

Does calling Animator.SetBool have any performance issue, so that I'd better call it only when its value has changed, or when its value doesn't change it's so quick that I can call it every frame?

Keep in mind that, due to the nature of this question, I don't care if it's slow when I change its value, I only care if it's slow when it's false and I call it to set it to false again (same thing for true ofc).

sentences:
How to export a terrain from Unity to Blender? I'm trying to make an environment for my scene that consists animations and other objects such as trees.

Making a terrain in Unity seem to be a lot easier than in Blender, so I want to export that environment which I've made in Unity to Blender. How can I do this?

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:
Can I extract Flash SWF sprite frames to bitmaps? I want to create the 2D graphics of my game in Flash Studio, but then get all the frames from my SWF movies into C# for further work in Unity3D.

I find it easier to create nice smooth animations in Flash Studio. But then I also want the performance Unity gives and the multi-platform support as well.

How can I do this?

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:
Problem with repeating objects in array when already in the array When the player move forward then paint is instantiate and stored in the array, even if the paint is already in the array it will again be stored in the array.

But I don't want to repeat any paint in the array.

public GameObject[] array;
public GameObject paint;
int temp = 0;
private RaycastHit hit;

public float speed = 10f;
public Text levelText;
public GameObject paint;
float maxdistance = 0.51f;
Vector3 newtargetposition;
bool pos;
private void FixedUpdate()
{
      if(Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward,out hit, maxdistance))
      {
        if (hit.collider.gameObject.tag == "Obstacle")
        {
            move = false;
        }
     }
    if (move)
    {
        PlayerMove();
    }

public void PlayerMove()
{
    if (move)
    {
      vector3 positions = transform.position + new Vector3(0f, -0.5f,0f); //when player move then paint instantiate y position

        array[temp] = Instantiate<GameObject>(paint, position, Quaternion.identity);
        temp++;

        newtargetposition=position;
        Debug.Log("newtargetposiiton:" + newtargetposition);

        if (temp == 150)
        {
            if (newtargetposition == position)
            {
                //what can i do here
                //i dont want to paint here because position store in newtargetposition,it is repeat
                //array[temp]--;
                Debug.Log("newtargetpositions:" + newtargetposition);
                //temp--;
            }
            gameOver.SetActive(true);
            SceneManager.LoadScene(1);
        }
    }
}

when player move forward store position in array

when player move back already fillup position again store in array

sentences:
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: Mobile game textures sizes I am developing a Windows Phone 7 game using XNA 4.0 which I plan to later port to iOS and android using Monotouch and Monodroid. My question is how to determine what texture size should I include? This is because the in-game objects that utilize the textures dont care about the actual texture size and just re-size them. Windows phone by its own exists in multiple resolution variants. Should I pick the highest resolution emulator and then measure the sizes of my in-game objects, and then re-size their respective textures to be the same?

sentences:
What C++ GUI library can you suggest? I'm building my own game engine in C++ and I'm currently deciding on what user interface I should use.

Should I use a library? Should I make my own?

sentences:
(RPGs) Drop table design I guess this question pertains more to games like MMO and Diablo-like games.

What are the usual designs for implementing a drop table, where a monster could drop different type of items depending on a percentage? I guess the simplest way there is to have a dictionary of 'percentage weightage' to item types, but this is hard to extend if we wish to introduce new item types (for example, when D2 expansion includes runes and new class items)

sentences:
How to get PS3/Xbox 360 experience without having access to Dev kits? I am a budding game programmer trying to get into the industry programming for PS3, Xbox 360.  The main problem I see is the need to demonstrate my skills to a potential employer, but without access to Dev kits for the PS3 or Xbox 360, doing this directly is impossible.

My question is, what is the best alternative way to show console developers my skills?

C++ programming in DirectX for Windows seems close to showing Xbox 360 programming skills, and C++ programming in OpenGL seems relatively close to showing PS3 programming skills.  Unfortunately, it seems from web research as if both Xbox 360 and PS3 actually have their own propietary libraries, therefore seeming to make this not a 100% fruitful endeavor.  This approach seems closest, but also most time consuming.  Plus you're not actually making anything run on the console.

On the other hand, programming in XNA has the benefit that your games are actually on the console, though I get the impression that this is looked upon as not "the real deal" since it is just a wrapper around DirectX and uses C# instead of C++.

Does anyone have knowledge or experience from inside the industry so as to know what kind of game demos would be most useful to show to a potential employer?  C++ in DirectX, OpenGL, XNA, Unreal Engine, Unity3d, Flash, etc etc etc?  There are only so many hours in the day, and I'd love to know how to direct my efforts.

My gut feeling is that DirectX would be the best choice, as it seems closer to what is used on the Xbox 360, but if having a good demo in another language/engine is just as good, it would obviously be less time consuming to go another route.

Thanks in advance for your help and advice!

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:
How can I access bitmaps created in another activity? I am currently loading my game bitmaps when the user presses 'start' in my animated splash screen activity (the first / launch activity) and the app progresses from my this activity to the main game activity,

This is causing choppy animation in the splashscreen while it loads/creates the bitmaps for the new activity.

I've been told that I should load all my bitmaps in one go at the very beginning.

However, I can't work out how to do this - could anyone please point me in the right direction?

I have 2 activities, a splash screen and the main game.  Each consist of a class that extends activity and a class that extends SurfaceView (with an inner class for the rendering / logic updating).

So, for example at the moment I am creating my bitmaps in the constructor of my SurfaceView class like so:

public class OptionsScreen extends SurfaceView implements
  SurfaceHolder.Callback {

      //Create variables here

 public OptionsScreen(Context context) {

Create bitmaps here
}

public void intialise(){                         //This method is called from onCreate() of corresponding application context

// Create scaled bitmaps here (from bitmaps previously created)

}

sentences:
How to document processes and concepts for a game? For the sake of generating a documentation and having a reference for my self, I want to formalize some concepts, behaviors and processes in a proper way.
For example: My game has a game server. This server has to do a reset in some situations. These situations or events could be when all players left the game, the game was lost or one player sends a clear reset intent command.

Now I’m wondering how to formalize that. My first thought was to use a UML-process-diagram. But I have no idea how this should look in a case like the described one (since there are more than just one entry point and also async events).

Maybe I’m wrong and there are better way to formally describe the behavior of some concepts?

Can you give me an example please?

sentences:
How 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:
Player experience using a server in single player adventure to prevent cheating I'm making a game where the user can sell items he finds during the the "single player" adventure on an online, I was looking at ways to prevent any malicious user to create rare and expensive items from scratch to sell them on the net.

I tried obfuscation but soon or later someone will successfully break into my code and I can't afford that, for obvious reasons.

Items are stored in files, so I thought about making client add a digital signature to generated files but I have to keep the key on the client machine, so same problem: if someone finds his key he can apply digital signature algorithm to generate the valid key for any file he creates.

So I ended up think the only secure option was to make the single player adventure interact with the server (everyone around here tends to say this is the way to go, like this subject, in my opinion the accepted answer explains it well).

But what about the user-friendly aspect?

My game is divided in two parts. Firstly the "real" single player adventure, where you can cheat all you want because everything is stored on your pc and server won't ever use it (~24h), then you beat the final boss and you're notified you're able to go online to battle against other players with the stuff you acquired on the single player map. At this point of the adventure, my idea was to record everything the player is doing in singleplayer mode onto the server, so whenever he plays a tournament, his stuff is verified.

I can't verify stuff just before a tournament begins because overpowered items can be obtained but are very rare, I want to systematically know if it was hardly-obtained or cheated.

Do you think it would be acceptable for a player to play "single player mode using internet" if he was told this will allow him later to rank up online and be

The single player map will be kind of mixed with the multi player area, but maybe I can think about a feature to play totally offline but then you won't be able to use your "online items" during this time.

EDIT: My app might outputs txt file (representing an item) with its corresponding digital signature, so I just need a way to be sure that it's my app (and not a modified copy) that has created a given file. That's why I'm reading about Trusted computing and Memory curtaining right now, but maybe I should head to security.stackexchange?

sentences:
Letting the player create a combination of any 4 items that the game will then give the player on a set timer Okay, so I've researched scriptable objects and I've realized that it's something that might be very useful for the kind of game I'm making. I've managed to create my own scriptable object for weapons that is able to hold weapon upgrades, range, damage, and other special stuff. I was told scriptable objects are much better for larger scales than enums so that I can hold data for each weapon. I do know how to implement them into
 [CreateAssetMenu(fileName = "New Weapon", menuName = "Weapon")]
 public class Weapon : ScriptableObject
 {
     public new string name;
     public string _discription;

     public Sprite _artwork;

     public int _range;
     public int _damage;
     public int _upgrades;
     public int _element;

     public void Print()
     {
         Debug.Log(name + ": " + _discription + " The weapon does:  " + _damage + "damage.");
     }
 }

I've researched how to show these on the UI, but is there any hint you could give me on getting scriptable objects working with an inventory system, and point me in a direction on how I can give the player control of the order of weapon in the inventory that the game will use to give said weapons in the same order the player set for themselves.
For Example, I want the player to be able to take any of the four weapons: Katana, Spear, Axe, Chakram, and be able to set them in any order. Even using multiple of itself. Eg. (Chakram, Spear, Spear, Axe) and then the game will then give the player the items list they created on a set timer. (Weapons are one-time use, and the player can only hold one weapon at a time, and the timer won't start until the player has used up their current weapon)
 public class Weapon
 {
     public WeaponType type { get; set; }
 }

 public enum WeaponType
 {
     Katana,
     Axe,
     Spear,
     Chakram
 }
 public class WeaponCycle: MonoBehaviour
 {
     [SerializeField] private Weapon[] _weapon;

     public Weapon[] weapons = new Weapon[4];

     List<Weapon> InventoryWeapons = new List<Weapon>();

     // Start is called before the first frame update
     void Start()
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             weapons[i].type = (WeaponType)Random.Range(0, 3);
         }

         StartCoroutine(GiveWeapons(1));
     }

     IEnumerator GiveWeapons(float delay)
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             yield return new WaitForSeconds(delay);
             InventoryWeapons.Add(weapons[i]);
         }
     }
 }

Sorry if it feels like I'm asking for too much, but I'm a beginner when it comes to C# and I'm trying to learn as efficiently as I can.

sentences:
UNET Performance of (many) Kinematic Rigidbodies I am building a game in Unity in C# using the UNET networking elements.

I am trying to figure out what is the performance cost of kinematic rigidbodies?

My understanding is that, when kinematic, rigidbodies are outside the physics system and therefore are not as resource-heavy as non-kinematic rigidbodies.

For my game, I will need to use a lot of kinematic rigidbodies in the scene, because they are used to detect collisions between player-placed objects (with box colliders) and the rigidbodies. All the objects instantiated in the scene will therefore need a kinematic rigidbody to allow this collision checking to take place.

Thanks very much for your help.

sentences:
Multiple passes in direct3d10 I begin to learning direct3d10 and stuck with multiple passes. As input I have a triangle(that stored in vb/ib) and effect file:

//some vertex shader and globals goes there. skip them to preserve simplicity

float4 ColorPixelShader(PixelInputType input) : SV_Target
{
    return float4(1,0,0,0);
}

float4 ColorPixelShader1(PixelInputType input) : SV_Target
{
    return float4(0,1,0,0);
}

technique10 ColorTechnique
{
    pass pass0
    {
        SetVertexShader(CompileShader(vs_4_0, ColorVertexShader()));
        SetPixelShader(CompileShader(ps_4_0, ColorPixelShader()));
        SetGeometryShader(NULL);
    }
    pass pass1
    {
        SetVertexShader(CompileShader(vs_4_0, ColorVertexShader()));
        SetPixelShader(CompileShader(ps_4_0, ColorPixelShader1()));
        SetGeometryShader(NULL);
    }
}

And some render code:

pass1->Apply(0);
device->DrawIndexed(indexCount, 0, 0);

pass2->Apply(0);
device->DrawIndexed(indexCount, 0, 0);

What I'd expect to see is the green triangle, but it always shows me red triangle. What am I doing wrong?

Also, I've got another question - should I set vertex shader in every pass?

I've added ColorVertexShader1 that translates vertex position by some delta, and 've got following picture: http://imgur.com/Oe7Qj

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:
Cocos2dx Windows Phone 8.1: Seperate Characters in RTL Label I use below code to show a text :

auto label = Label::createWithSystemFont("سلام و خداحافظ", "BTitrBold", 24);

( RTL text like Persian, Arabic and Hebrew)
This code works fine in both **Android** and **iOS**. But when I run project on **WindowsPhone8.1-universal** device, the label shows the characters not only separated but also LTR , as below screenshot:

I was faced same problem in Android long time ago. But It solved Link.

In order to solving problem I compiled fribidi library for windowsPhone. this library solve separated character problems (somehow) but still Wrapping is a big problem.

Please solve Right-To-Left problem in WindowPhone8.1. We really miss this platform's store.

PS: cocos2dx 3.10

sentences:
Predicting the route a rigid body will take when force is applied I'm learning 3D game development with some kind of mini golf game.

It is working well so far: I have a sphere, and I am using AddForce on its RigidBody to launch it in the desired direction.

One feature I'd like to add is to show a preview line that predicts the trajectory of the ball. Like telling the player that if he uses this direction and this force, the ball is going to follow this route, collide here, bounce, and end up there etc.

I know how to use a line renderer alright, but I don't know how to calculate the array of points from which to draw the line.

It has to be updated in realtime, and the player can quickly change the potential direction and force at any time - it has to consider that there are various objects with different bounciness/friction etc.

That seems like a lot of work. The only thing that occurs to me is to use dummy invisible balls that will be constantly firing using the potential direction/force and then recording their route, but I'd need to figure out some way to make them 'move faster' so I can get the array of points instantly.

What would be my best approach for this?

sentences:
How can I display an image larger than the screen and allow the user to scroll to see more? I am new to development and trying to understand my options.  I have found no info or threads on this idea so I was hoping some of you folks could weigh in.

When developing for Android, I know that different images optimized for different screen densities and sizes are typically used.  I am wondering if anyone just flicks in the resizing and develops so that the smallest device (i.e. phone) shows enough of say a game world to make it relevant for the user and larger screens (i.e. tablet) just show more of that world but at the same scale.

I guess you would have to have a couple versions for different densities or graphics could appear too small, but it could really cut down on the number of asset files the user would have to download.  Though the whole background/world image would be one big file.  I assume when downloading an app graphics files for all screen sizes and resolutions are downloaded and then the app detects the screen size and chooses from among them for display.

sentences:
What is the best PBR real time Fresnel function? I'm working on a physically-based renderer, and I've come to a sort of crossroads regarding the Fresnel factor. I'm having trouble finding the best way to represent it. I know that Schlick's Fresnel approximation is based off IOR, but IORs can go up to 38.6 for a meta-material, and 4.05 for a natural element, which will make representing these in a 0-1 image difficult and confusing. I also noticed that no one really uses IOR maps.

I also read a paper on Unreal's PBR integration, and I discovered that they initially wanted to use a F0 of 0.4, for non-metals. What would be the F0 for metals, in this case, and isn't the static value of 0.4 worth the limitations for that tiny bit of memory? I believe the F0 tends to the base color, as it becomes more metallic, but I'd like confirmation.

Finally, there's reflectivity or specular, as is used in modern PBR equations. Is there a standard for this, in regard to getting an F0? It seems arbitrary; is it a float value up to that directly maps to F0?

I am not sure if there are any real reasons to not combine specular color and base color, as Unreal has done this, before. I can't think of a single real reason, even for more stylized implementations.

What is the best PBR real time Fresnel function?

sentences:
How to make the paddle stop at the screen edge in my Pong clone? Well, I'm obviously very new to game dev and Android. I've got a ball bouncing around (successfully detecting screen edge collisions so that the bitmap stays within screen) and a paddle that the user can move left and right with their finger.

At the moment there's a few things wrong with my method, but I will post it as is:

(current method from my paddle class that I use to manage touchevents:)

public void onTouchEvents(MotionEvent e, int viewW, int viewH){
        //DETECT PRESS
        if (e.getAction() == MotionEvent.ACTION_DOWN){
            // delegating event handling to the paddle
            handleActionDown((int)e.getX(), (int)e.getY());
        }
        //MOVE GESTURES
        if (e.getAction() == MotionEvent.ACTION_MOVE){
            if (isTouched()){
                //paddle is being dragged
                //Log.i(TAG, "paddle is being dragged");

                //SETTING NEW POSITION
                boolean collision = false; // to check wall collisions

                if (speed.getxDirection() == Speed.LEFT
                        && getX() - (bitmap.getWidth() /2) <= 0)
                {//Left wall collision
                    collision = true;
                    Log.i(TAG, "left wall col");

                }
                if (speed.getxDirection() == Speed.RIGHT
                        && getX() + (bitmap.getWidth() /2) >= viewW)
                {//right wall collision
                    collision = true;
                    Log.i(TAG, "right wall col");

                }

                if(collision == false){ //No wall collisions, no problem
                    setX( (int)e.getX() );
                }

            }
        }
        //PRESS RELEASED
        if (e.getAction() == MotionEvent.ACTION_UP){
            if (isTouched()){
                //no longer being dragged
                setTouched(false);
            }
        }
    }

At the moment when my paddle hits the right side of the screen it stops where it should (without the bitmap going off screen) but the user is unable to drag it back, presumably because collision is now stuck set at "false"  so setX is never called again.

Oddly, when the paddle hits the left side of the screen the bitmap can just be continued to be dragged off screen and the collision is never detected.

Obviously I can recognize that there are two different issues here and I've had several ideas of how to solve the first, still can't figure out whats wrong with the second.

To solve the first I've tried getting rid of the collision variable all together. I've tried putting setting the x position back at various points

//eg. (after right wall collision detected)
setX( (int)e.getX() - 1);

or using my toggle x direction method, the same I got working with my ball object

//eg ( xDirection = xDirection * -1; )
speed.toggleXDirection();

I've tried all kinds of re-positioning of the code that I could think of that would possibly get it working as intended but I haven't been able to figure it out, any help would be appreciated.

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:
Why are my click events being fired many times for every click? I am working on a game in unity where a user will click a button to gain coins and clicks over a lifetime of clicking the button but the code is making the clicks go up by a lot instead of just 1 each time it is clicked like here are the values returned the first 3 clicks
247 731 2111
anybody have an idea why it produces this behavior and how i can fix it?

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

public class GameManager : MonoBehaviour {
    public Button clicker;

    public Text coinsSec;
    public Text ltClicks;

    private float baseClick = 2;
    private float coins = 0;
    private float lifeTimeClicks = 0;
    private float coinsPerSec;

    private void Start(){
        UpdateTxt ();
    }

    private void Update(){
        UpdateTxt ();
        Clicker ();
    }

    private void Clicker(){
        clicker.onClick.AddListener (delegate {
            coins += baseClick;
            lifeTimeClicks++;
        });
    }

    private void UpdateTxt(){
        coinsSec.text = "Coins/s: ";
        ltClicks.text = "Lifetime Clicks: " + lifeTimeClicks.ToString ();
    }
}

sentences:
which is the best approach or algorithm to calculate real-time ranking I want to know the fastest and most efficient way to compute points and ranking in real time.

I'm doing a betting football game (a game where users try to predict the outcome of a game before it). In my country is called "Quiniela".

Players put "predictions" just before the match starts. My question is: from the moment the game starts, which is the most efficient way (not just code level but to the database and server) to calculate the ranking for the players "real time" as their predictions regarding the actual outcome of the game.

For example:

If a Team1 vs Team2 plays, the user U1 predicted that the game would end 0-0, U2 predicted the game would end 1-0, U3 predicted the game would would end 1-1.

When starting the game, the U1 would be to first in the ranking because, if the match ends like this, his prediction would be correct, or at least the most accurate.

Then the score switches to 1-0, and the user U1 would be the last of the ranking (because his prediction is not possible anymore), U2 would be the first and U3 second.

If the score changes to 1-1, U2 would go first, U3 would be second (because he guessed part of the result) and U3 last.

I thought about creating a tree of possibilities with one level (0-0 first node, with 1-0 and 0-1 as child nodes) as you change the score, changes the Ranking "temporarily" and I would keep it in cache.

Once the game is over, I keep the latest Ranking in the database.

There is a more optimal way to solve this problem? It has been proposed before and already solved? I'm using MySQL for database, PHP (Cake Php) for the server and a bunch of mobiles who ask for the ranking once in a while.

sentences:
Javascript canvas check if all recs on the screen overlap a new one So I know the AABB collision detection formula, however, this code does not work. Whenever I press space, a new square pops up. But this new square can spawn inside another, something that I do not want to happen. Here is a snippet of the code I think is going wrong:

var xTopsBotsYTopsBotsSquares = [];

//Makes a randint() function.
function randint(min, max) {

    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function checkForOccupiedAlready(left, top, right, bottom) {

    if (xTopsBotsYTopsBotsSquares.length == 0) {
        return true;
    }
    for (var i = 0; i < xTopsBotsYTopsBotsSquares.length; i++) {
        var data = xTopsBotsYTopsBotsSquares[i];

        if (data[0] <= right || data[1] <= bottom ||
            data[2] >= left  || data[3] >= top) {/*Do nothing*/}
        else {

            return false;
        }
    }

    return true;
}

//Makes a new square
function makeNewsquare() {
    var checkingIfRepeatCords = true;
    //DO loop that checks if there is a repeat.
    do {
        //Makes the square x/y positions
        var squareRandomXPos = randint(50, canvas.width - 50);
        var squareRandomYPos = randint(50, canvas.height - 50);

        //Tests if that area is already occupied
        if (checkForOccupiedAlready(squareRandomXPos,
                                    squareRandomYPos,
                                    squareRandomXPos+50,
                                    squareRandomYPos+50) == true) {

            xTopsBotsYTopsBotsSquares.push([squareRandomXPos,
                                            squareRandomYPos,
                                            squareRandomXPos+50,
                                            squareRandomYPos+50]);
            console.log(squareRandomXPos, squareRandomYPos, squareRandomXPos+50, squareRandomYPos+50);
            checkingIfRepeatCords = false;
        }
    }
    while (checkingIfRepeatCords == true);

}

sentences:
Why are the inputs not changing the animation on keypress? I have been following this tutorial. You can watch 16:00 - 18:20 to see what I am trying to do.

What should be happening is: I press a key, my animation plays and the parameters or Inputs get updated depending on which key I press. There are no errors in my script, but the parameters or Inputs are not updating. I have checked that I am using floats and that all my names match up. I've watched this part of the video and checked that my code was exactly like his multiple times. When using the model that he used in the video, the inputs the inputs are working fine. So would this mean there is something wrong with my animation, or is this an issue in my script?

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour
{
    public Animator anim;

    private float inputH;
    private float inputV;

    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("1"))
        {
            anim.Play("Armature|Walking", -1, 0f);
        }
        if (Input.GetKeyDown("2"))
        {
            anim.Play("Armature|TurnRight", -1, 0f);
        }
        if (Input.GetKeyDown("3"))
        {
            anim.Play("Armature|TurnLeft", -1, 0f);
        }
        if (Input.GetMouseButtonDown(0))
        {
            int n = Random.Range(0, 2);

            if (n == 0)
            {
                anim.Play("Armature|Walking", -1, 0f);
            }
            else
            {
                anim.Play("Armature|TurnRight", -1, 0f);
            }
        }
        inputH = Input.GetAxis("Horizontal");
        inputV = Input.GetAxis("Vertical");

        anim.SetFloat("inputH", inputH);
        anim.SetFloat("inputV", inputV);
    }
}

Anyone got any ideas?

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:
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:
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:
Data Locality and Polymorphism I've been reading over the various chapters available at http://gameprogrammingpatterns.com, and in particular his chapter over Data Locality(http://gameprogrammingpatterns.com/data-locality.html) has raised a few questions. I've sent him out an email, but while waiting for it I figured I'd gather the opinions of others.

In the chapter, it is suggested that you would take your GameEntity class and strip everything away, sticking all of the components into an array and using a dirty bit to tell whether or not the component is active. This allows for faster iteration and avoids thrashing the cache.

However, it is also stated to avoid polymorphism in order to keep all components of some type the same size, and avoid virtual methods. Rather, for every type you would have an array.
To me, this sounds wasteful. Say I have 20 different enemies, and I allow for 100 enemies to exist at a time. That'd be 21(20 different MOBs + 1 array that would hold the entity) arrays of 100 entries, so 2100 objects just for the different enemies. And then each enemy needs a physics component, a rendering component, and maybe even more depending on the game.
If every enemy needs it's own physics and rendering component, that'd be 21 Entities + 20 Physics Components + 20 Rendering Components, all multiplied by 100(or however many entities you are allowing to exist at once). That's a lot of data for stuff that isn't going to even be used most of the time.

Wouldn't it be simpler(and smarter) to just have arrays of the base class, then stick in the needed subclass at some index? The base class would hold all the data that would need to be accessed by any of the subclasses, the subclasses would only have an overloaded Update() function. Yeah, it'd be a bit slower because then the program would have to look at the vTable over and over again to figure out which Update() function to use and not all the data in the base class will be used by every subclass, but it sounds simpler and faster than having 100+ arrays, each with 100+ members, when a large portion of them aren't even being used at any given moment. Are there any downsides to my take on it? Am I missing an important concept of data locality? What is your take / what would you do?

sentences:
How to client/server game using Google App Engine (Looking for tutorial.) (NOTE: This is a duplicate of a question I asked on SO, having temporarily forgotten about GameDev <hang head in shame>.  When one is answered, I will link it back to the other.)

I'm trying to do my first client/server game using Google Apps Engine as my back end (specification requirement.) I've done the tutorials (Java), but that all seems highly browser-centric.

Basically, I'd like my (mobile, not that it matters) app to:

Allow the user to create a game-account (NOT their Google account!)
Log-in with that account.
Press the "MARCO" button to send an account-identified request to the server.
Get a "POLO" response from the server.

As data (like a JSON object, XML-DOM or similar), not as a web-page.

Can anyone point me to a good tutorial/sample project/detailed reading to help me achieve that? I'm pretty sure that, once I get that working, I can do all the rest of it -- but I'm having the "stuck at the starting gate" problem, not being able to work up basic account-login, and non-HTML data exchange.

Thanks!

sentences: Detect collision with static collider only Is this possible to detect collision with static colliders only I check it is not working. I dont want to use rigidbody or character controller with my box collider.

sentences:
Online MMO collision detection for players & walls Let's assume the following:

I have a server which stores the player's position (float x, float y, float z)
Client sends the server it's updated position ever 250ms or so.
Server has bounding boxes for all buildings & players ( Let's say each wall has it's own AABB or OBB)
For broad-phase collision detection, I use spatial hashing based on the bounding boxes.
Client does full-on triangle level collisions locally.

My question:
- How can I quick calculate if a player has passed through a wall on the server only using AABBs or OBBs. Or, is there no way to do that without going to triangle-level collision detection. Maybe some other data structure? Any help would be appreciated.

sentences:
Make 2d sprite move in unity At the moment I have a movement script which moves my player in Bothe directions but it only faces 1 way -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
    public float moveSpeed = 5f;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Jump();
        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
        transform.position += movement * Time.deltaTime * moveSpeed;
    }

    void Jump()
    {
        if (Input.GetButtonDown("Jump"))
        {
            gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
        }
    }

}

How can I make the sprite face the other way when I move west not east?

sentences:
Nestling into contact with a group of physics objects without exerting forces on them I'm making a pool game, and would like the circle (imaginary) to be in contact with the table and balls, and to fit perfectly as a ball would.

Now I thought I would use Rigidbody and lerp the position of the circle to the raycast hit, and its collider it would force it into a fitting position.

The problem I encountered is that since it has a collider, it also pushes the balls, which I do not want.

So my question is, how do I make an object act like it's touching & blocked by other GameObjects with Colliders and Rigidbodies, without pushing them?

sentences:
RTS game diplomacy heuristics I'm reimplementing an old 4X space-rts game which has diplomacy options. The original was based on a relation scoring system (0..100) and a set of negotiation options (improve relations, alliance, declare war, etc.) The AI player usually had 3 options: yes, maybe and no; each adding or removing some amount to the relation score.

How should the AI chose between the options?
How does the diplomacy work in other games and how are they imlemented?
Any good books/articles on the subject?

(Googling the term diplomacy yields the game Diplomacy, which is unhelpful.)

sentences:
Finding a moving target in a maze I'm making a game that is a bit of a mix of snake and pacman.

Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail.  If one player touches the other's tail, he steals that piece for himself and the game is over when one player has all the pieces.

Right now they both move randomly unless there's a piece of candy one space away that is not their tail.

I'm trying to find a method/algorithm (preferably a different method for each player) for both players to target/avoid the other player.
Any advice?

sentences:
AddComponent using a variable I want to add a Component to a GameObject using an existing instance of the Component class.

Let's say I have the class Foo:

public class Foo : MonoBehaviour {
    int id {get; set;}
    string name {get; set;}
    //and other many variables
}

In another class I already have an instance of Foo with all variables setup.

What I want to do is attach the existing instance of Foo to a GameObject, instead to attach it and then setup all the variables.

Something like that, it is just an example, of course it give errors:

GameObject go;      //Existing GameObject
Foo foo;            //Existing instance of Foo with variables setup.

go.AddComponent(foo);

Instead of doing:

GameObject go;      //Existing GameObject
Foo foo;            //Existing instance of Foo with variables setup.

go.AddComponent("Foo");

Foo myComponent = go.GetComponent<Foo>();
myComponent.id = foo.id;
myComponent.name = foo.name;
//and so on

Is there a way to do that?

sentences: Make HD trailer for Unity game I am making a HD trailer for my Unity game. How do I record awesome HD shots of my game inside the Unity editor?

sentences: What is the best way to draw outline of object using OpenGL I want to select the best way to draw outline of 3d human like object and what would be the best way to draw outline for this kind of objects. I found about stencil buffer based methods, geometric shader based methods and toon shader based methods is one if this is good if so which method. or is there any other best way to draw a outline.

sentences: What exactly is a physics engine? A program should take input, process it and give output. So what exactly does a physics engine take as input and provide as output?

sentences:
Creating a border on a tile? I'm using Godot and I want to set an outline on the tile which is currently being hovered over, but I'm not sure whether to do it as a seperate tilemap which is hidden until it is hovered over or just display a highlighted tile sprite when the tile is hovered.

This is an example of how I sorta want it.

Any advice?

sentences:
Sprites are sometimes blurry in Flash I am playing around with drawing an SVG sprite (imported in through [Embed]). Depending on the coordinates of the image, sometimes it appears more crisp than others.

The following image shows how at different locations is it rendered differently:

(Image link - You may have to download and zoom in with an image editor to see it)

You'll notice that the middle sprite is more blurry than the ones on the sides. Does anyone know why this is? Any help would be appreciated.

sentences: 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:
How can the lategame in a 4X game be made more exciting? I played a lot of different 4X games lately (eXplore, eXpand, eXploit, eXterminate, like the Civilization series, for example), and noticed that most of them suffer from the same problem: As soon as one player got significantly more powerful than the others, that player gets almost unbeatable. The dominant player has access to vastly more resources than the others. Also, that player has a significant advantage in research, which means that the other factions will soon fall back in technology, giving the powerful player even more tools which the weaker factions can not counter, so it makes the game even easier for them.

During this phase it is pretty clear that this player will inevitably win. However, the game usually does not stop here. It continues for hours while the dominant player steamrolls all the weaker players one after another. This poses no challenge to them, because they are so vastly more powerful. So this phase of the game becomes a dull and boring chore for everyone. The dominant player moves their units from one enemy base/city/planet to another knowing that nothing they could encounter there could stop them as long as they avoid some easily avoidable mistakes, while the other players watch helplessly in frustration without any way to prevent their demise.

How could a 4X game be designed to avoid this boring and tedious endgame?

sentences:
NullReferenceException: Object reference not set to an instance of an object on boolean variable from separate class I'm trying to develop game scenario that able to trigger the alarm with alarm light and siren audio to play. For the testing purpose I set it that to boolean value as "alarmOn" in AlarmLight class.

**AlarmLight.cs**
public class AlarmLight : MonoBehaviour {

public float fadeSpeed = 2f;
public float highIntensity = 2f;
public float lowIntensity = 0.5f;
public float changeMargin = 0.2f;
public bool alarmOn = false;

private float targetIntensity;
public Light light;

//add alarm lights
// tag as siren
void Awake()
{
    light.intensity = 0f;
    targetIntensity = highIntensity;
}

void Update()
{
    if (alarmOn==true)
    {
        light.intensity = Mathf.Lerp(light.intensity, targetIntensity,fadeSpeed * Time.deltaTime);
        ChecktargetIntensity();
    }
    else
    {
        light.intensity = Mathf.Lerp(light.intensity, 0f, fadeSpeed * Time.deltaTime);

    }

}

void ChecktargetIntensity()
{
    if (Mathf.Abs(targetIntensity - light.intensity) < changeMargin)
    {
        if (targetIntensity==highIntensity)
        {
            targetIntensity = lowIntensity;
        }
        else
        {
            targetIntensity = highIntensity;
        }
    }
}

}

Then I  tried to access that value with LastPlayerSight class and for the testing purpose i was trying to return false as below.

alarm.alarmOn = (playerPosition != resetPlayerPosition);

Then I tried to play my scene, and I got the error which is the problem with above line of code.

This is my LastPlayerSight.cs class

public class LastPlayerSight : MonoBehaviour {

public Vector3 playerPosition = new Vector3(1000f, 1000f, 1000f);
public Vector3 resetPlayerPosition = new Vector3(1000f, 1000f, 1000f);

public float lightHighIntensity = 0.25f;
public float lightLowIntensity = 0f;
public float fadeSpeed =7f;

public float musicFadeSpeed = 1f;

//directional alarmlight ref
private AlarmLight alarm;

//main directional light ref
private Light mainLight;

private AudioSource panicAudio;

//siren audio
private AudioSource[] sirens;

void Awake()
{
    alarm = GameObject.FindGameObjectWithTag(Tags.alarms).GetComponent<AlarmLight>();
    mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent<Light>();

    GameObject[] sirenAttachedGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);
    sirens = new AudioSource[sirenAttachedGameObjects.Length];

    for(int i = 0; i<sirens.Length; i++)
    {
        sirens[i] = sirenAttachedGameObjects[i].GetComponent<AudioSource>();
    }
}

void Update()
{
    SwitchAlarms();
    MusicFading();
}

void SwitchAlarms()
{
    alarm.alarmOn = (playerPosition != resetPlayerPosition);

    float newIntensity;

    if(playerPosition != resetPlayerPosition)
    {
        newIntensity = lightLowIntensity;
    }
    else
    {
        newIntensity = lightHighIntensity;
    }

    mainLight.intensity = Mathf.Lerp(mainLight.intensity, newIntensity,fadeSpeed*Time.deltaTime);

    for (int i = 0; i < sirens.Length; i++)
    {
        if (playerPosition != resetPlayerPosition)
        {
            sirens[i].Play();
        }
        else
        {
            sirens[i].Stop();
        }
    }
}

void MusicFading()
{
   //AudioSource audioTemp = audio.GetComponent<AudioSource>();

    if (playerPosition != resetPlayerPosition)
    {
        //audio.GetComponent<AudioSource>().volume = Mathf.Lerp(audio.volume, 0f, musicFadeSpeed * Time.deltaTime);

        panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0.8f, musicFadeSpeed * Time.deltaTime);

    }
    else
    {
        panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0.0f, musicFadeSpeed * Time.deltaTime);

    }
}

}

I'm beginner of developing such things and can anyone guide me to correct the problem?

sentences:
Circle inside ellipse collision/intersection (preventing circle from leaving the ellipse) I am working on a 2D RPG with a turned based battle system.

Characters move inside the confines of an ellipse movement area and when they leave the boundaries will be pushed back inside. (i.e they should be able to walk around the inner part of the ellipse). Previously we were using circles for the movement area and I wrote the code to do circle inside circle collision (not too difficult because the radius is always the same) but since we will change to using an ellipse, I am trying to update the code.

I have looked at a few solutions for actual ellipse collision/intersection and the math looks..daunting. My questions are:

Are there any clean solutions to doing circle inside ellipse collision/intersection?
Should I be approximating the ellipse collision in another way? Like using an n-sided polygon?

I am a bit lost on how to approach this and could really use some advice.

sentences: Xna: Texture2D from a png file I'm making a tile based game, and I'm working for support of tilesets. I'm trying to make it so that a Texture2D is set as a chosen PNG file. I can do this with no problem f I load the image into the content pipeline, but the level editor will be used by people without access to the content pipeline. How do I go about doing this?

sentences: What are file formats that store skeletal movements, and are there databases of them? I have a set of 3d vectors representing the positions of a character's hand, foot, shoulders and so on. Is there any kind of easy to read file I can use to animate those with walking, standing, jumping etc motions? Is there a database with some of them?

sentences:
2D Collision Box Clipping There is this strange issue with the collision in a game I am making. When the player is slightly lower than a block it is colliding with from the side, the player ends up clipping to the top of the block rather than sliding along the side of it down. Do you have an idea how to fix it?

If that description didn't help you at all you can reproduce it here (goes to the website with the game on it). (Use WASD/Space/Arrow Keys to move) To reproduce, stand on the single block and hold the right move button. You will fall off the edge, hit the side of the block, and get clipped to the top of it. You are meant to fall onto the block below instead.
(The words and colors are debug info)

The code below is what handles the collision detection. If you need the rest of the code, you can view the source of the page linked above.

this.doCollision = function() {
var tx = Math.floor(this.x),
    ty = Math.floor(this.y),
    nx = this.x % 1,
    ny = this.y % 1,
    cell = this.cell = levelStorage.currentLevel.getTileAtPosition(tx, ty),
    cellRight = this.cellRight = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty),
    cellDown = this.cellDown = levelStorage.currentLevel.getTileAtPosition(tx, ty + 1),
    cellDiag = this.cellDiag = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty + 1);

if(this.vy > 0) { // Ground collision
// The !cell checks return if the cell exists or not (null)
  if((cellDown && !cell) || (!cellRight && cellDiag && nx)) {
    this.y = ty;
    this.vy = 0;
    this.falling = false;
    this.jumping = false;
    ny = 0
  }
}else
if(this.vy < 0) { // Ceiling collision
  if((!cellDown && cell) || (cellRight && !cellDiag && nx)) {
    this.y = ty + 1;
    this.vy = 0;
    cell = this.cell = cellDown;
    cellRight = this.cellRight = cellDiag;
    ny = 0;
  }
}
if(this.vx > 0) { // Right collision
  if((cellRight && !cell) || (!cellDown && cellDiag && ny)) {
    this.x = tx;
    this.vx = 0;
    nx = 0;
  }
}else
if(this.vx < 0) { // Left collision
  if((!cellRight && cell) || (cellDown && !cellDiag && ny)) {
    this.x = tx + 1;
    this.vx = 0;
    cell = this.cell = cellRight;
    cellDown = this.cellDown = cellDiag;
    nx = 0;
  }
}
this.falling = !(cellDown || (nx && cellDiag)); // If player isn't on ground
}
}

Thanks for the help!

EDIT: I should note this also happens with the bottom of blocks as well. The same principles apply as clipping to the top, except you clip to the bottom instead.

sentences:
C++ - SFML - OpenGL - GLSL - smooth waving texture I have this shaders:

Fragment:

uniform float time;
uniform sampler2D texture;

void main()
{
    float t = time;
    vec2 aux = gl_TexCoord[0].xy;

    // This would also make waving/deform the texture
    //aux.x = aux.x + (sin(aux.y * time *.5) * 0.05);

    gl_FragColor = texture2D(texture, aux);
}

Vertex:

uniform float time;

void main()
{
    vec4 vertex = gl_Vertex;
    vertex.x = vertex.x + sin(time - vertex.y * 20) / 10;
    vertex = gl_ModelViewMatrix * vertex;

    gl_Position = gl_ProjectionMatrix * vec4(vertex.x, vertex.y, vertex.z, vertex.w);
    gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
    gl_FrontColor = gl_Color;
}

I am used that shader on low resolution textures(I have for example a grass tile texture of 8x8 pixels) to create a 2D waving grass effect.
The problem is, that the shader effect is now very choppy because the texture resolution.
Now I am wonder me, is it not possible to let the shader make more steps and make that "animation" smoother ?

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

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

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

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

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

Many thanks in advance.

sentences:
Game has noticeable frame drops but when through a profiler it always runs smooth I'm trying to optimize my PC game but I can find the bottleneck since every time I run it through a profiler (gDEBugger) it runs smooths. When running outside gDEBugger I get these annoying hiccups. It's not just the graphics, the sound also gets choppy. The drops are inconsistent across runs, i.e, sometimes I run the same scenario and get no drops at all, sometimes I get a few drops, and others the game is consistently slow. The only constant is: when running through gDEBugger I ALWAYS get a smooth run.

I'm suspecting something outside my game is interfering and causing these drops, but what in the hell does gDEBugger do that nullifies these drops? A higher process priority? Any ideas?

Thanks in advance.

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:
Creating a alive object list I'm currently working on a Java game
I know a lot of games created all instances of objects beforehand and then bring then in and out of play when they are needed.

Will it be worth it to have a Vector of all instances that are alive, and loop through that instance of going through all of the instances and checking the alive boolean?

Thanks

sentences:
Why is my bullet disappearing after I release the shoot button? I'm making a game using DirectXTK for my university project. When I press space bullet moves forward like I wanted, but when I let go it stops my bullet from moving. How do I keep the bullet moving when space was pressed?

void update
{
  //shooting
  if (kb.Space)
    Shoot(true);
  else
    Shoot(false);
}
void Render()
{
  if (draw)
  {
    for (int i = 0; i < 10; i++)
    {
      m_projectile[i]->Draw(m_bullet[i], m_view, m_proj, Colors::Red);
    }
  }
}
bool shoot(bool test)
{
  shoot = test;
  draw = true;

  //bool isShot = false;
  if (!shoot)
  {
    for (int i = 0; i < 10; i++)
    {
      m_bullet[i] = Matrix::CreateRotationY(m_ship._42) * m_ship;
    }
  }
  else
  {
    m_bullet[0] = Matrix::CreateTranslation(-Vector3::Forward *float(1))*Matrix::CreateRotationY(0.f) * m_bullet[0];
    //m_bullet *= Matrix::CreateTranslation(-Vector3::Forward);
  }

  return draw;
}

sentences:
Is there a way to blur objects in a 2d game with OpenGL without using shaders? Is there a nice way in OpenGL to blur objects without using shaders?

Currently, I'm accomplishing blur by rendering the object slightly up, down, left, right, and the four diagonals from its original position. It seems like there should be a much better way of doing this. I'm working in a 2d scene.

sentences:
model view projection multiplication order I'm debugging a lighting problem where the camera position is effecting the diffused lighting component on my 3d model. In researching my problem I went back and am reading over all the how to documents. I found that one of my old sources (where I learned open gl 2.0) said this (summarized):

  When creating the modelViewProjection matrix you can't change the order or you'll get unexpected results.  First take the View Matrix and post-multiply it by the projection matrix to create a viewProjection matrix. Then post-multiply the model matrix to get the modelViewProjection matrix.

Looking at my code, all this time I haven't been doing this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mModelView, mModelViewProjection);

As a test I tried changing it to this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mView, mViewProjection);
matrixMultiply(mViewProjection, thisItem->objModel, mModelViewProjection);

...but the result appears the same.

EDIT: To answer a question about what the matrices contain. A snapshot of the matrix values:

EDIT2: As a test I did the math both ways to compare the results and even with moving the camera and model around and rotating the model I'm getting the same results for the final ModelViewProjection.

sentences:
Unity - How to make grass details look good from top-down I have an issue with the terrain details. Since it only draws a single plane per texture, it looks quite crappy with a angled top-down camera, for example for an RTS camera.

Is there some way around this, I know one solution people use is to angle the grass towards the camera a bit, but that isnt possible with the terrain details painter.

The issue is circled in red:

If there is no solution to this, are there some techniques I can use to make some interesting-looking grass for an RTS camera?

sentences:
How can I export Blender game logic for controlling actor actions? How does one export game logic ("Sensors") that Unity references for controlling actions from Blender's "Action Editor" or "Dope Sheet?"

I have a Blender model that has game logic sensors that respond to complex input. These actions are defined in Blender's "Action Editor" or "Dope Sheet". What is the easiest way to export the game logic so that I have access to its input that causes the actions? There are many exporters that focus on the mesh/skeleton, is there a solution for exporting these sensors?

Here is a list with screen shots of Blender's sensors to give a better idea of what I want exported.

For each character made, I want their sensors exported to a file that is easy to read (some kind of XML). This way I don't need to hard-code character behavior or action triggers/sensors. Each modeled Blender actor can have its sensors programmed in Blender with its nice GUI and later exported to my game engine.

This question has been asked before and it seems the asker ended up scripting a very limited exporter (for one variable) but didn't fully explain his approach:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Again, this was asked with no apparent solution:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Looks like someone has already tried using Collada but this was only for exporting actions (not sensors that trigger them):
Blender multiple animations and Collada export

Someone here wrote their own exporter. I don't think they are exporting sensors though:
exporting bind and keyframe bone poses from blender to use in OpenGL

Any ideas?

sentences:
Unity - Determine direction vector3 from a point in space and an angle in eulers I have a ball positioned as Vector3(x, x, x).

I was able to get the direction of the ball to the mouse clicked position with:

Code (csharp):

Vector3 direction = Direction (clickPos2 - startPos);

Where the method is:

Code (csharp):

public Vector3 Direction(Vector3 position) {
        return new Vector3(position.x / Length(position.x, position.y), position.y / Length(position.x, position.y), position.z);
    }

Now I have an angle in eulers and I want that the ball goes to the direction of the angle.

But how I calculate it?

The game is played in 2d so actually only x and y is needed, z stays the same.

Mirza

sentences:
Making a surface transparent from blackness of texture I am making a "halo" shader in unity using GLSL. And I've come to a roadblock.

What I need to do is take a texture, like the following, and make it transparent according to the darkness of it. And I don't want a cutout, because that cuts it off at a hard edge.

This line of code doesn't seem to work.

gl_FragColor = texture2D( vec4( _MainTex.r, _MainTex.g, _MainTex.b, _MainTex.a), vec2(textureCoordinates));

sentences:
How to keep a data structure synchronized over a network? Context

In the game I'm working on (a sort of a point and click graphic adventure), pretty much everything that happens in the game world is controlled by an action manager that is structured a bit like:

So for instance if the result of examining an object should make the character say hello, walk a bit and then sit down, I simply spawn the following code:

var actionGroup = actionManager.CreateGroup();
actionGroup.Add(new TalkAction("Guybrush", "Hello there!");
actionGroup.Add(new WalkAction("Guybrush", new Vector2(300, 300));
actionGroup.Add(new SetAnimationAction("Guybrush", "Sit"));

This creates a new action group (an entire line in the image above) and adds it to the manager. All of the groups are executed in parallel, but actions within each group are chained together so that the second one only starts after the first one finishes. When the last action in a group finishes, the group is destroyed.

Problem

Now I need to replicate this information across a network, so that in a multiplayer session, all players see the same thing. Serializing the individual actions is not the problem. But I'm an absolute beginner when it comes to networking and I have a few questions. I think for the sake of simplicity in this discussion we can abstract the action manager component to being simply:

var actionManager = new List<List<string>>();

How should I proceed to keep the contents of the above data structure syncronized between all players?

Besides the core question, I'm also having a few other concerns related to it (i.e. all possible implications of the same problem above):

If I use a server/client architecture (with one of the players acting as both a server and a client), and one of the clients has spawned a group of actions, should he add them directly to the manager, or only send a request to the server, which in turn will order every client to add that group?
What about packet losses and the like? The game is deterministic, but I'm thinking that any discrepancy in the sequence of actions executed in a client could lead to inconsistent states of the world. How do I safeguard against that sort of problem?
What if I add too many actions at once, won't that cause problems for the connection? Any way to alleviate that?

sentences:
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:
Designing a component based game I'm writing a shooter (like 1942, classic 2D graphics) and I'd like to use a component based approch. So far I thought about the following design:

Each game element (airship, projectile, powerup, enemy) is an Entity
Each Entity is a set of components which can added or removed at run-time. Examples are Position, Sprite, Health, IA, Damage, BoundingBox etc.

The idea is that Airship, Projectile, Enemy, Powerup are NOT game classes. An entity is only defined by the components it owns (and that can change during time).
So the player Airship starts with  Sprite, Position, Health and Input components.
A powerup has the Sprite, Position, BoundingBox.
And so on.

The main loop manages the game "physics", i.e. how the components interact each other:

foreach(entity (let it be entity1) with a Damage component)
    foreach(entity (let it be entity2) with a Health component)
    if(the entity1.BoundingBox collides with entity2.BoundingBox)
    {
        entity2.Health.decrease(entity1.Damage.amount());
    }

foreach(entity with a IA component)
    entity.IA.update();

foreach(entity with a Sprite component)
    draw(entity.Sprite.surface());

...

Components are hardcoded in the main C++ application. Entities can be defined in an XML file (the IA part in a lua or python file).

The main loop doesn't care a lot about entities: it only manages components. The software design should allow to:

Given a component, get the entity it belongs to
Given an entity, get the component of type "type"
For all entities, do something
For all entity's component, do something (e.g: serialize)

I was thinking about the following:

class Entity;
class Component { Entity* entity; ... virtual void serialize(filestream, op) = 0; ...}
class Sprite : public Component {...};
class Position : public Component {...};
class IA : public Component {... virtual void update() = 0; };

// I don't remember exactly the boost::fusion map syntax right now, sorry.
class Entity
{
   int id; // entity id
   boost::fusion::map< pair<Sprite, Sprite*>, pair<Position, Position*> > components;
   template <class C> bool has_component() { return components.at<C>() != 0; }
   template <class C> C* get_component() { return components.at<C>(); }
   template <class C> void add_component(C* c) { components.at<C>() = c; }
   template <class C> void remove_component(C* c) { components.at<C>() = 0; }
   void serialize(filestream, op) { /* Serialize all componets*/ }
...
};

std::list<Entity*> entity_list;

With this design I can get #1, #2, #3 (thanks to boost::fusion::map algorithms) and #4. Also everything is O(1) (ok, not exactly, but it's still very fast).

There is also a more "common" approch:

class Entity;
class Component { Entity* entity; ... virtual void serialize(filestream, op) = 0; ...}
class Sprite : public Component { static const int type_id = 0; };
class Position : public Component { static const int type_id = 1; };

class Entity
{
   int id; // entity id
   std::vector<Component*> components;
   bool has_component() { return components[i] != 0; }
   template <class C> C* get_component() { return dynamic_cast<C> components[C::id](); } // It's actually quite safe
...
};

Another approch is to get rid of the Entity class: each Component type lives in its own list. So there is a Sprite list, a Health list, a Damage list etc. I know they belong to the same logic entity because of the entity id. This is simpler, but slower: the IA components needs access basically to all other entity's components and that would require searching each other component's list at each step.

Which approch do you think is better? is boost::fusion map suited to be used in that way?

sentences:
NodeJS client gameloop running slightly faster than server gameloop So I'm working on a real time multiplayer game in NodeJs (Client and Server). Both loops handle the same "physics" (movement at a constant rate) and both are running at 40hz or 40 times per second. I am using setInterval on both client and server with a delay of 40ms. The issue is that my server average delta between each tick is ~41 and my client average delta between each tick is ~40. This leads to results like this:

See in the last result, there is a difference of 46 ticks meaning the client is rendering about 1.8 seconds ahead of server time. My first guess on solving this is to sync the client every so often but that would lead to it "teleporting" backwards quite often due to how much it is desyncing.

sentences: Can't set up a PS3 controller in Unity So I connected a ps3 controller to my computer via USB cable, when I press play I am able to move by using arrows on the left of the ps3 controller and also I am able to shoot and aim by triangle and circle but when I try setting up the 2nd Horizontal axis in the Input Manager by changing the "X axis" to 5th axis (so I could use sticks to move) and changing type to joystick axis I am not able to move. Also I tried creating a second "Mouse X" and also setting it to joystick axis and changing the "X axis" to "4th axis (joysticks)" nothing happens again, I tried pressing everything but it doesn't work. Anyone knows how I can make it work?

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:
GLM: Quaternion SLERP Interpolation I wish to interpolate two quaternion values. As I still can not get working results, can I kindly ask you to verify my function calls? The code below supports GLM (OpenGL Mathemathics) library, so this questions might be for those, who know it.

Firstly, I perform Quaternion intialization from Euler Angles:

glm::quat myAxisQuat(pvAnimation->at(nFrameNo).vecRotation);
glm::quat myAxisNextQuat(pvAnimation->at(nFrameNo + 1).vecRotation);

Secondly, I interpolate between the two input quaternions. The variable fInterpolation contains value in the range 0.0f - 1.0f.

myInterpolatedRotQuat = glm::mix(myAxisQuat, myAxisNextQuat, fInterpolationTime);

Thirdly, I convert my interpolated quaternion back to Euler Angles:

vecInterpolatedRot = glm::gtx::quaternion::eulerAngles( myInterpolatedRotQuat) ;

At the end, the values in vecInterpolatedRot do not represent the interpolated EulerAngles. It is difficult to understand the Quaternion values after conversion from Euler Angles, so I would like to ask you for your help, please.

What can be wrong, please?

I double and tripple checked input variables, I tried various approaches, and the only issue, at this moment might be with the third Aplha parameter in glm::mix()

Update:

To provide you with more information, the returned values in vecInterpolatedRot are extremely low. At the end of the interpolation, I would expect valid Euler angles.

This is random sequence of interpolated values, as the object moves according to predefined animation path.

rotX:-1.7451 rotY:1.7993 rotZ-0.854642
rotX:-1.06451 rotY:1.18485 rotZ-0.694015
rotX:-0.254822 rotY:0.437004 rotZ-0.942035
rotX:0.578816 rotY:-0.335103 rotZ-0.716057
rotX:1.53934 rotY:-1.07602 rotZ-1.0182
rotX:2.5582 rotY:-1.87737 rotZ-0.759468
rotX:-2.58259 rotY:-2.47432 rotZ-1.06071
rotX:-1.35049 rotY:3.11548 rotZ-0.81839
rotX:0.0106472 rotY:2.78129 rotZ-1.04353
rotX:1.46636 rotY:2.33968 rotZ-0.879188
rotX:0.0289322 rotY:2.31166 rotZ-0.91746
rotX:-1.47901 rotY:2.37235 rotZ-0.938591
rotX:-2.59482 rotY:2.89469 rotZ-1.15554
rotX:2.47283 rotY:-2.76131 rotZ-0.992493
rotX:1.73065 rotY:-1.53285 rotZ-1.27898
rotX:0.85806 rotY:-0.176976 rotZ-1.03487
rotX:0.452009 rotY:-1.14604 rotZ-0.927788
rotX:0.0604701 rotY:-2.12479 rotZ-1.05684
rotX:0.107648 rotY:-2.07785 rotZ-1.05071
rotX:0.154894 rotY:-2.03083 rotZ-1.04569
rotX:0.809623 rotY:2.14456 rotZ-1.31262
rotX:1.15268 rotY:0.332553 rotZ-0.983604
rotX:2.16299 rotY:-0.545458 rotZ-1.11758
rotX:2.95376 rotY:-1.2008 rotZ-0.846527
rotX:-2.94892 rotY:-0.892473 rotZ-1.17334
rotX:-1.89716 rotY:-1.30162 rotZ-1.53247
rotX:0.804938 rotY:1.93659 rotZ-1.37281
rotX:0.653453 rotY:1.73722 rotZ-1.14364
rotX:2.24713 rotY:0.658935 rotZ-1.03684
rotX:2.97528 rotY:0.508203 rotZ-0.559124
rotX:-2.49988 rotY:0.640482 rotZ0.0117903
rotX:-1.57379 rotY:1.16303 rotZ0.288639
rotX:-1.4928 rotY:1.17794 rotZ0.902059
rotX:-0.667796 rotY:1.94995 rotZ1.49074
rotX:2.12971 rotY:-1.85782 rotZ0.904871
rotX:2.36951 rotY:-2.03682 rotZ0.189242
rotX:1.5574 rotY:-2.92156 rotZ-0.450418
rotX:1.6256 rotY:2.29519 rotZ-1.46659
rotX:2.85414 rotY:2.11303 rotZ-0.42888
rotX:-2.48503 rotY:2.96942 rotZ0.189887
rotX:-1.55656 rotY:3.00852 rotZ0.675669

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:
Detect collision with bullet physics, to make a character controller I inherited from btCollisionWorld::ContactResultCallback but I really have no idea how to use this virtual function:

btScalar addSingleResult(btManifoldPoint& cp,
        const btCollisionObjectWrapper* colObj0Wrap, int partId0, int index0,
        const btCollisionObjectWrapper* colObj1Wrap, int partId1, int index1)

I thought about using btCollisionWorld::ConvexResultCallback instead but there is no method in btCollisionWorld to use it.

For now my only goal is to move a btCollisionObject around and detect collision with walls, to adjust the position and movement.

I would just need the collision normal, some collision point, or anything else...

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:
how to check if player stands on platform? I want to test if player stands on platform.

I have 32x32 platform sprites.

My code looks like

   for (block in blocks) {
    if (collides(playerX, playerY - 7, block.blockX, block.blockY)) {
     fall = true;
    }
  }

but it is works wrong.
My player sometimes fall while walking on other platforms.
my collision function works well but maybe 7 is not enough or too much.

sentences:
How to specify font size in nifty GUI when using ttf fonts I'm trying to use a font with a larger size in a ttf file using nifty GUI. All questions and answers I've seen are concerned with making fonts in fnt fonts in a different size, but the size I want to use is actually included in the ttf file. I tried setting fontSize and size attributes with no effect (no errors but the font size does not change either)
Below is the xml excerpt where I'm trying to use the ttf font with a large size:
<control id="score"
name="label"
color="#fff"
text="0"
width="50%"
height="20%"
textHAlign="left"
font="Interface/Fonts/Kenney Future.ttf"/>

sentences:
5.1 sound in Unity3d 3.5 I'm trying to implement 5.1 surround sound in my game. I've set Unity's AudioManager to a default of 5.1 surround and loaded in a 6 channel audio clip that should play a sound in each of the different audio spots.

However, when I go to run my game, all I get is flat sound coming out of my front two speakers. Even then, these don't play the sound they should (front speaker should play "front speaker" right should play "right speaker" and so). Both speakers just end up playing the entire sound file.

I've tried looking to see if there is a parameter that I have missed, but information on how to set up 5.1 sound in Unity is lacking (or my google skills aren't that good) and I can't get it to work as intended. Could someone please either tell me what I'm missing, or point me in the right direction?

My audio source is situated at point (0, 0, 0) with my camera also being in the same point. I've moved about the scene but the same thing happens as I've already described.

sentences:
Finding distances between sprites in an array i'm new to java and was hoping if anyone can help me out. So my game has meteors which spawns off screen and sometimes as they spawn, they overlap each other which I don't want. I want them to spawn from a certain distance from each other.

From pseudo code I know what I want which is to find the centre point of sprite, find other meteors on screen and calculate the distance and then spawn from a certain distance from each other. I know the distance to point formula (distance = Math.sqrt(Math.pow(x2 - x1, 2) + (Math.pow(y2 - y1, 2)));), but how do I do that within an array. Here is my code so far:

Meteor Class

public class Meteors {
    private Texture bigMeteor;
    private Vector2 posBigMeteor;
    private Random yrand;

    //Constructor
    public Meteors(float x){
        bigMeteor = new Texture("meteor.png");
        yrand = new Random();

        //Spawn location of meteor
        posBigMeteor = new Vector2(x, yrand.nextInt(AstroDemo.HEIGHT/2 - bigMeteor.getHeight()));
    }

    public Texture getBigMeteor() {
        return bigMeteor;
    }

    public Vector2 getPosBigMeteor() {
        return posBigMeteor;
    }

    public void reposition(float x){
        posBigMeteor.set(x, yrand.nextInt(AstroDemo.HEIGHT/2 - bigMeteor.getHeight()));
    }
}

Playstate Class

public class PlayState extends State {
    //Total meteor count on screen
    private static final int METEOR_COUNT = 8;

    private Naught naught;
    private Texture bg;
    private Random xrand;
    private Array <Meteors> meteors;

    public PlayState(GameStateManager gsm) {
        super(gsm);
        //Starting co-ordinates of main character (Naught)
        naught = new Naught(50, 100);
        //Setting viewport of the camera
        cam.setToOrtho(false, AstroDemo.WIDTH/2, AstroDemo.HEIGHT/2);
        bg = new Texture("bg.png");
        xrand = new Random();

        meteors = new Array <Meteors>();

        //Spawn meteors randomly off screen
        for (int i = 1; i <= METEOR_COUNT; i++){
            meteors.add(new Meteors(AstroDemo.WIDTH/2 + (xrand.nextInt(300))));
        }
    }

    @Override
    protected void handleInput() {
        //If screen/mouse is held
        if(Gdx.input.isTouched()){
            //Main Character jumps/flys
            naught.jump();
        }
    }

    @Override
    public void update(float dt) {
        handleInput();
        naught.update(dt);
        //If meteors are left side of the screen, re-position to the right side of the screen
        for(Meteors meteor : meteors){
            if (cam.position.x - (cam.viewportWidth/2) > meteor.getPosBigMeteor().x + meteor.getBigMeteor().getWidth()){
                meteor.reposition(meteor.getPosBigMeteor().x + (AstroDemo.WIDTH/2 + 20 + (xrand.nextInt(300))));
            }
       }
        cam.position.x = naught.getPosition().x + 80;

        cam.update();
    }

    @Override
    public void render(SpriteBatch sb) {
        //Adjust the spritebatch for co-ordinate system in relation to camera
        sb.setProjectionMatrix(cam.combined);
        sb.begin();
        //Draw background where the camera is
        sb.draw(bg, cam.position.x - (cam.viewportWidth/2), 0);
        sb.draw(naught.getTexture(), naught.getPosition().x, naught.getPosition().y);
        for (Meteors meteor : meteors) {
            sb.draw(meteor.getBigMeteor(), meteor.getPosBigMeteor().x, meteor.getPosBigMeteor().y);
        }
        sb.end();
    }

    @Override
    public void dispose() {

    }
}

sentences:
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:
Android black screen with Unity app in subview I've exported an Unity app/game I have made to Android Studio. In Android Studio I made a layout and within it I have a framelayout. However, when I run the app the framelayout is completely black, why?

Here is my Java code:

public class UnityPlayerActivity extends Activity {
    protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

    FrameLayout fl_forUnity;

    Button bt_groen, bt_gul, bt_sort;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);

        getWindow().setFormat(PixelFormat.RGBX_8888);

        mUnityPlayer = new UnityPlayer(this);
        if (mUnityPlayer.getSettings().getBoolean("hide_status_bar", true)) {
            setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }

        setContentView(R.layout.main);

        this.fl_forUnity = (FrameLayout) findViewById(R.id.fl_forUnity);

        this.fl_forUnity.addView(mUnityPlayer.getView(),
                FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

        this.bt_groen = (Button) findViewById(R.id.bt_groen);
        this.bt_gul = (Button) findViewById(R.id.bt_gul);
        this.bt_sort = (Button) findViewById(R.id.bt_sort);

        this.bt_groen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "G");
            }
        });

        this.bt_gul.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "Y");
            }
        });

        this.bt_sort.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "B");
            }
        });

        mUnityPlayer.requestFocus();
    }
}

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent" android:layout_height="match_parent"
                android:rowCount="3"
                android:columnCount="10">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="400dip"
        android:id="@+id/fl_forUnity"
        android:background="#00FFFF"
        android:layout_centerHorizontal="true">

    </FrameLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Grøn"
        android:id="@+id/bt_groen"
        android:layout_column="4"
        android:layout_row="2"
        android:layout_alignTop="@+id/bt_sort"
        android:layout_toRightOf="@+id/bt_sort"
        android:layout_toEndOf="@+id/bt_sort"
        android:layout_marginLeft="30dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Gul"
        android:id="@+id/bt_gul"
        android:layout_column="9"
        android:layout_row="2"
        android:layout_alignTop="@+id/bt_sort"
        android:layout_toLeftOf="@+id/bt_sort"
        android:layout_toStartOf="@+id/bt_sort"
        android:layout_marginRight="30dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sort"
        android:id="@+id/bt_sort"
        android:layout_below="@+id/fl_forUnity"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dip" />

</RelativeLayout>

sentences:
How can I pass an array of matrices to a VertexShader I'm trying to learn how to use OpenGL but I'm having problems trying to pass an array of matrices to my VertexShader. I think the problem is in the VertexShader because it seems the values in modelvalue are passed correctly to the components of model, but for some reason at the end only one of the three cubes I've created is drawn. Here's the Main code.

glm::mat4 model[3];
GLint ModelLocation = glGetUniformLocation(MyShader.program, "model");
vector<GLfloat> modelvalue;
const int n = int(sizeof(model[0]) / sizeof(GLfloat));

for (int i = 0; i < 3; i++) {
    model[i] = glm::translate(model[i], cubePositions[i]);

    for (int j = 0; j < n; j++) {
        modelvalue.push_back(glm::value_ptr(model[i])[j]);
    }

}
glUniformMatrix4fv(ModelLocation, 3, GL_FALSE, &modelvalue[0]);

The VertexShader:

   #version 400 core
  layout (location = 0) in vec3 Position;
  layout (location = 1) in vec2 texCoord;
  out vec2 TexCoord;
  out vec4 position0;
  out vec4 position1;
   out vec4 position2;
  uniform mat4 model[3];
  uniform mat4 view;
  uniform mat4 projection;
  void main()
  {
  position0 = projection * view * model[0] * vec4(Position,1.0f);
  position1 = projection * view * model[1] * vec4(Position,1.0f);
  position2 = projection * view * model[2] * vec4(Position,1.0f);
  TexCoord = vec2(texCoord.x,1-texCoord.y);
   }

And the FragmentShader:

  #version 400 core

  layout (location = 0) in vec3 Position;
  layout (location = 1) in vec2 texCoord;

  out vec2 TexCoord;
  out vec4 position0;
  out vec4 position1;
  out vec4 position2;
  uniform mat4 model[3];
  uniform mat4 view;
  uniform mat4 projection;
  void main()
  {
  position0 = projection * view * model[0] * vec4(Position,1.0f);
  position1 = projection * view * model[1] * vec4(Position,1.0f);
  position2 = projection * view * model[2] * vec4(Position,1.0f);
  TexCoord = vec2(texCoord.x,1-texCoord.y);

sentences:
How do I cycle through a BufferedImage array of images and display them? So, I'm coming from Python and Pygame here, porting most of my code because I didn't like the performance. A lot of the syntax is similar, but I've been having some trouble with a few things, namely this animation function.

I'm attempting to cycle through an array of images and have them display an animation. Here's my code so far:

//Animation images.
private BufferedImage[] idling = {Sprite.loadSprite("1"), Sprite.loadSprite("2"), Sprite.loadSprite("3"), Sprite.loadSprite("4"),
         Sprite.loadSprite("5"), Sprite.loadSprite("6")};
private BufferedImage[] walkingLeft = {Sprite.loadSprite("L1"), Sprite.loadSprite("L2"), Sprite.loadSprite("L3"), Sprite.loadSprite("L4"),
         Sprite.loadSprite("L5"), Sprite.loadSprite("L6"), Sprite.loadSprite("L7"), Sprite.loadSprite("L8")};
private BufferedImage[] walkingRight = {Sprite.loadSprite("R1"), Sprite.loadSprite("R2"), Sprite.loadSprite("R3"), Sprite.loadSprite("R4"),
         Sprite.loadSprite("R5"), Sprite.loadSprite("R6"), Sprite.loadSprite("R7"), Sprite.loadSprite("R8")};

Then my actual animate function (which I suspect is where the issue is).

public Image animate() {
    Image animation = idling[0];
    int current_image = 0;
    int current_image_add = 1;
    if (xa == 0 && ya == 0) {
        if (current_image >= 5)
            current_image_add = -1;
        if (current_image <= 0)
            current_image_add = 1;
        if (current_image >= 6)
            current_image = 0;
        current_image += current_image_add;
        animation = idling[current_image];
    }
    if (xa == game.speed) {
        if (current_image >= 7)
            current_image_add = -1;
        if (current_image <= 0)
            current_image_add = 1;
        current_image += current_image_add;
        animation = walkingRight[current_image];
    }
    if (xa == -game.speed) {
        if (current_image >= 7)
            current_image_add = -1;
        if (current_image <= 0)
            current_image_add = 1;
        current_image += current_image_add;
        animation = walkingLeft[current_image];
    }

    return animation;
}

While I was looking over this class, I actually noticed that I had no curly brackets surrounding my if statements, and that might be causing problems. Python doesn't require them, so I forgot that Java did. So, I answered my first question before I even asked it.

The draw function, simple as it is.

public void paint(Graphics2D g) {
    animate();
    g.drawImage(animate(), x, y, null);
}

Now that it will actually swap BufferedImage arrays when I change directions, how do I get it to cycle through the images? Apparently my if statement functions will only swap to the first image and not change to the next ones.

Edit: Alright, I figured that adding some clarification on what this does might help. The arrays contain all of the images for the animations. The animate() function sets the current_image variable to the first index of the array, which is the start of the animation. xa and ya are modified by a move() function elsewhere in the class, which the animate() function checks the value of to determine if the character is moving or not. If xa and ya are zero, the character isn't moving and the idling[] array is chosen. Likewise, if xa is positive or negative game.speed, right or left is chosen, respectively.

The point of this function is to cycle through the indexes by returning Image animation as whatever array and index of that array should be running at the time based on movement. At the end of each if block, it sets animation equal to whatever animation set and the current_image variable to choose the image and index.

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:
Android: 2d scrolling background I am a very beginner in game development. All I want to achieve in the beginning is a free scrollable background like in a strategy game with my custom graphics. In my case it is supposed to be a 2d city map where the user can select buildings.
How can I achieve that as easy as possible in android? With OpenGL? Die you have any examples especially for this scrolling functionality?

sentences:
Translating conditions ("If A has B, then true") into objects that satisfy them ("A has B") I have a system where I'm sifting through a large number and variety of objects in my game, looking for objects that match an arbitrary search criteria that can be simple or complex.
For example, suppose a Foo has three integer properties, A, B, and C. I might search the list of Foo objects three times. First, I want to find a Foo where A>5. Second, I might want to find a Foo where A<B or B=8. Third, I might want to find a Foo where A=2, B=6, C>A, and C<B. The point is that I could arbitrarily pass any of a very wide set of conditions into the search.
Now here's my problem. In all cases, if I can't find an item that matches these criteria, I want to create a new Foo that does match, and add it to the list of Foo objects.
The thing I'm wrestling with is figuring out an underlying system of representing conditions that allows me to then create an item that directly matches those conditions. So far I've got two ideas, neither of which I'm a fan of:

Repeatedly generate random Foo objects across the span of possible properties, until applying the criteria to one of them results in true. Given the possible permutations involved, this feels like an absolute performance nightmare, and would probably require a ton of caching logic to track what possibility spaces have already been tried.
Establish a list of individual conditions with isolated variables (such as a GreaterThan condition with the referenced property that indicates whether the property is A, B, or C; and the target value) and create a corresponding declaration (Make [property] a random value between [targetValue] and [propertyMax]). Not only is this incredibly tedious, but I'm also not really confident I understand how it would work, particularly in C# but more generally also. This feels like self-reading code and that's something I have no experience with.

My question is, basically, what designs and techniques can I use to address this sort of issue - the need to create objects that match criteria, when those criteria could be arbitrary? Surely this has come up in other projects. What kinds of constraints or frameworks are applied to make this doable?

sentences:
Unity 2D Diablo style movement I've made a totally new scene for a 2D mobile game. I placed a sprite on the center of the screen and attached the following script onto it (this is basically a diablo-style click-to-move control script, the sprite follows the pointer when it is clicked):

using UnityEngine;

public class Movement : MonoBehaviour
{
private float _moveSpeed = 5;
private Vector3 _targetPosition;
private float _targetDistance;

void Update()
{
    _targetDistance = Vector3.Distance(_targetPosition, transform.position);

    if (_targetDistance < 1)
    {
        _moveSpeed = 0;
    }
    else if (_targetDistance > 1)
    {
        _moveSpeed = 5;
    }

    if (Input.GetMouseButton(0))
    {
        Plane playerPlane = new Plane(Vector3.up, transform.position);
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        float hitdist = 0.0f;

        if (playerPlane.Raycast(ray, out hitdist))
        {
            _targetPosition = ray.GetPoint(hitdist);
        }
    }

    if (_targetDistance > 1)
    {
        transform.position += (_targetPosition - transform.position).normalized * _moveSpeed * Time.deltaTime;
    }
}
}

Normally this script doesn't work unless I rotate the main camera by 90 degrees (axis: X) and rotate the sprite also by 90 degrees (axis: X).

How should I modify the script to make it work without rotating the camera and all the sprites I place on the scene?

Thank you in advance!

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:
counting coins after a certain time I am beginner in unity .
and now i am trying to write my first game.
the game is includes appear random coins in random place on the screen , after passing a certain amount of time.(one coin will be appear and then after for example 2 seconds it will be destroyed and the other coins will be appear in another place ).
there is a  counter  which calculate the  number of click on coins which appear in scene and counting number  of clicks on screen The coin is a prefab .Now i need to count the number of coins that will be disappear after certain amount of time.
can someone help me how i can write the code.

sentences:
Is 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:
Why occlusion culling isn't working? I've bought a 3d model from a 3d marketplace.

It is a big interior scene.

I've imported the single FBX into Unity, added some collider, changed materials (6-7 materials) etc. There are hundreds of child object/mesh:

Despite what my camera is looking, i noticed Unity is rendering 3-400K tris.

Why Occlusion Culling isn't working ? Maybe importing a single huge Fbx isn't the right practice ?

Thanks

This image is my player looking at a black wall... 360K tris rendered !!!!

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:
phaser.io mouse cursor sprite I am trying to build a game and i want people to be able to select stuff with a pointer but i don't want it to be just an ugly looking default pointer so i wrote this code to try and get a image as it

first i loaded the image

game.load.image('selector', 'assets/img/pointer.png')

then I put it into my game

selector = game.add.sprite(game.world.centerX, game.world.centerY, 'selector')

and then in my render() function i do this

selector.x = game.input.x;
selector.y = game.input.y;

it moves fine with my mouse but with one problem

my game is designed so that i have to use a camera that follows my character because the map is bigger than the view

so since for some reason my sprite always starts at 0,0 it can only move 800x600px since thats all that the canvas sees the mouse in so i need a way to fix this but i'm not sure how to do this because i am new to phaser

sentences:
KeyCode dictionary in Unity I found a strange problem while programming keyboard input in Unity (v5.3.5).

public class AvatarInputMapperUnityContext : MonoBehaviour {

    private AvatarController _avatarController;

    public KeyCode JumpKey = KeyCode.Space;
    public KeyCode LeftKey = KeyCode.A;
    public KeyCode RightKey = KeyCode.D;
    public KeyCode UpKey = KeyCode.W;
    public KeyCode DownKey = KeyCode.S;
    private Dictionary<KeyCode, WeaponTags> ShotKeys;

    void Awake () {
        _avatarController = GetComponent<AvatarController>();
        ShotKeys.Add(KeyCode.I, WeaponTags.Pistol);
        ShotKeys.Add(KeyCode.O, WeaponTags.Shotgun);
    }

    void Update () {

        if (Input.GetKeyDown(JumpKey)){
            _avatarController.JumpSignal();
        }
    }
}

Now, when the ShotKeys.Add... lines are commented out everything works fine. But when I uncomment them, the program never reaches the _avatarController.JumpSignal() line, and none of the other directional keys (w,a,s,d) work. What can be the reason?

sentences: If i make a game in Unity where a player can host their own servers, will it still cost me more money? I know that with Unity's networking system, you will have to pay Unity if you have more than X players on your servers at the same time.  I believe this is because that Unity is hosting the servers, and it costs them internet service?  But if the players are hosting their own servers, this wouldn't cost Unity any internet.  Is it possible to host your own servers using Unity networking, and if so, will it still cost extra money?  thanks. :)

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:
How can I run a Phaser engine game without a window? I'm currently creating a multiplayer game using the HTML5 framework Phaser.

It's a game where zombies spawn on the map and players have to shoot them to kill them. The zombies target players that are closest to them.

Currently, I'm having my an issue with my design strategy. I'm not sure if this type of game is possible with Phaser due to the movement tracking.

At present, the client is handling all of the player movement, so whenever a player moves, it broadcasts it to the server which sends it to all of the other clients.

However, I would like for the zombies and the bullets to be controlled by the server exclusively. The server then updates each client with the velocity of each zombie and their current position. My reasoning is that anything that isn't player input should be calculated by the server. This will prevent issues such as two clients saying that a zombie died at different times and then trying to communicate with one another, having bullets at different locations at the same time, or zombies spawning at separate times between clients.

Here's an example of a zombie class:

function Zombie(game, data){

this.game = game;

this.id = data.id;
Phaser.Sprite.call(this, this.game, data.x, data.y, 'zombie');
this.anchor.setTo(0.5,0.5);

this.animations.add('right', [0,1,2,3], 7, true);
this.animations.add('left', [4,5,6,7], 7, true);
this.game.physics.arcade.enable(this);
this.body.collideWorldBounds = true;

this.health = data.health;
this.maxHealth = data.maxHealth;
this.speed = data.speed;
this.target = this.game.player;
this.waiting = 100;

this.name = "zombie";
this.healthBary = 20;
this.healthBar = this.game.add.sprite(this.x, this.y + this.healthBary, 'player_health');
this.healthBar.anchor.setTo(0.5, 0.5);
CollisionManager.addObjectToGroup(this, 'baddies');
this.game.add.existing(this);

}
Zombie.prototype = Object.create( Phaser.Sprite.prototype );
Zombie.prototype.constructor = Zombie;
Zombie.prototype.update = function(){

this.updateHealthBar();

                this.moveTowards(this.target);

Zombie.prototype.uTarget = function(target) {
    this.target = target;
};
Zombie.prototype.moveTowards = function(target){
var x = target.x - this.x;
var y = target.y - this.y;

var mag = Math.sqrt((x * x) + (y * y));

var nx = x / mag;
var ny = y / mag;

this.body.velocity.x = nx * this.speed;
this.body.velocity.y = ny * this.speed;

if(this.body.velocity.x >= 0){
    this.animations.play('right');
}
else if(this.body.velocity.x < 0){
    this.animations.play('left')
}

}
Zombie.prototype.updateHealthBar = function(){
this.healthBar.x = this.x;
this.healthBar.y = this.y + this.healthBary;

var p = (this.health / this.maxHealth);
p = parseFloat(p.toFixed(1));
this.healthBar.frame = 10 - (p * 10);
}
Zombie.prototype._damage = function(amount){
this.health -= amount;
if(this.health <= 0){
    this.kill;
    this.die(true);
}
}

Zombie.prototype.die = function(points){

if(this.game){
    //this.game.baddie_die_sfx.play();
}

WaveManager.onMap--;
CollisionManager.removeObjectFromGroup(this, "baddies");
if(this.healthBar){
    this.healthBar.destroy();
}
socket.emit("kill zombie", {id: this.id});
this.kill();
this.destroy();
}

The problem is that I can't create a Phaser game object on the server (as it's running on a Linux server) because there's no window that can be used. The bullets and zombies need to be Phaser objects for the sake of collision detection, but I can't do that on the server.

I know that I could create a vector of zombies and bullets server-side that would have the information for each bullet/zombie's position at any given time and then update the client, but then I wouldn't be able to use the CollisionManager in Phaser.

Right now, it seems like my only solution is to create my own collision detection system. Are there any alternative ideas?

sentences:
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:
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:
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 to Programm A Dialog box with a typewriter effect in Java? Im am very new to java and programming so I might be a bit annoying to work with but please bear with me :D So As the title says I'm trying to figure out how to properly program a working dialog box with typing text animation for a game I'm working on. I've seen some posts about swing timers but Im having trouble properly understanding them. If anybody has an idea please share it!

sentences:
How to run code selectively only when a specific trigger collider has been hit I have 2 objects both with trigger colliders. The first object has only 1 trigger collider (imagine this to be a sword).

The second object (a person) has multiple colliders. One is a non-trigger collider (used for collision detection for walls, ground) and then multiple trigger colliders on different parts of the body (the purpose is for hurt box).

Now when the sword hits the person, I want to only process code for those trigger colliders and to be able to detect which of those trigger colliders got hit (arm, leg, etc.).

But the event only exposes a parameter hit for the other collider:

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.layer == LayerMask.NameToLayer(Constants.LAYER_HITBOX_PLAYER))
    {
        // Run code here
    }
}

I want to run code only when certain trigger collider are hit, like for example, when the head is hit, or the body, etc. How do I get this info to be able to run conditional code on this method?

sentences:
Running into issues with Unity Vertical Layout Group I feel sure that I'm missing something obvious, but I've been stuck with this over the past few days.

I want to make a relatively simple UI component for a character creation screen that looks something like this:

The structure is something like:

Canvas
-Panel
--Dropdown 1 Container
---Header
----Collapsible Body (Set as inactive)
-----Buttons for options
-----Buttons for options
-----Buttons for options
--Dropdown 2 Container
---Header
----Collapsible Body (Set as active)
-----Buttons for options
-----Buttons for options
-----Buttons for options
--Dropdown 3 Container
---Header
----Collapsible Body (Set as inactive)
-----Buttons for options
-----Buttons for options
-----Buttons for options
--Dropdown 4 Container
---Header
----Collapsible Body (Set as inactive)
-----Buttons for options
-----Buttons for options
-----Buttons for options
...

Unfortunately, some basic parts of this seem to be beyond my ability.

The panel that contains everything has a Vertical Layout group, but the "Spacing" can only be set to one value at a time, which doesn't work for this because the drop down boxes alternate between two sizes depending on whether they're active or not.
Grid Layouts don't seem to work either, because the cell sizes can't be changed dynamically.

Is there a simple option for this, or would I need to code something myself?

Thanks for any info you can provide.

sentences:
multiple textures into one texture Can i fusion multiple .tga or .jpeg into only one, and texturise my model with it ?

Here is an example to explain my self better :  I have Mr Bowser as 3d model and i want to integrate it in a game. The thing is that all the textures, from the color of his mouth to the cones on his shell are held by different tga files. For the mouth i have mouth.tga as texture, for the cones on the shell i have cone.tga and so on... . But what i want to achieve is to have cone.tga mouth.tga and so on, in the same and only file. Like all the textures to make Mr angry Bowser a colorfull character concentrated in one and only file.
Can i achieve that, is there a way to do it ?

Any help will be much appreciated.
Thank you.

sentences:
C++ Assimp - Transformation Hierarchy I have a question regarding model imports using ASSIMP. I've been working on an Entity and Component (e.g. unity gameobject component) based game engine for fun and to learn in my spare time. I've decided to tackle frustum culling, because it interests me and seems like a relatively simple optimisation to make. I had the algorithm implemented and noticed a problem, while the culling works as expected, the entire sponza scene i have loaded disappears when looking in certain orientations. This happens because it uses the entity the mesh is attached to's position, which in all cases is (0,0,0) or something similar.

This means, despite the fact each mesh of the sponza scene is drawn using it's own model matrix and each entity has the same position (Meaning each mesh should be overlapping surely?) the scene looks entirely normal. Now i know ASSIMP does provide you the transformation for each note (guessing this would be what im looking for) but I can't figure out why the scene just looks normal, does assimp pre-offset the vertices based on the node transform? if so how can i disable this feature?

Any and all literature / tidbits would be welcome, Apologies for not being a super well defined question.

TLDR; How do node transformations work in Assimp

sentences:
xna creating game stage management contrls I am under planning stage of my game where I am creating controls for my game. I have create below control for stages but have no idea how this we can achieve in xna.

Please also help me with your views regarding how to load, play multiple stages and persist score for each stage in game using xna. What we normally used to do is just put everything in infinite loop but here I want more intelligence in game, as one stage over it should go back to menu. Example can be something like angry bird stages.

sentences:
TileBased Game: Blitting Hero or Sprite? So my environment is all set up and now I'm working on the movement physics of my character. I used blitting to copy over my tiles from a tilesheet. But since they are static, they are only copied over once. And with the Hero (main player character), I figured that I might blit him into his continuously changing position. But now, I'm not quite sure it's necessary?

Is there a real big perfomance-save to copy the Hero sprite into a new position constantly using Blitting, OR, is it fine to just copy it into the game once, and simply move the Hero sprite as a movieclip?

sentences:
How to export FBX models to use in SharpDX? I am trying to export a model from 3ds Max 2014 as a fbx file and use it in my SharpDX driven project.
In the SharpDX example solution, there is a project named ModelRendering.Desktop. I just modified it to load my exported testmodel.

This is the result when running the program:

As you see, I modeled a cube in 3ds Max. But the sample application shows me something different. When I try to export some more complex models, their renderings are totally broken.

I use the default export settings ("Autodesc Media & Entertainment"). Do I need to hit a special export option or do I need to use some external converter? What is the common way to use fbx models from 3ds Max in SharpDX?

sentences: How do I include XML files in an Android build? I have a few XML files I want to include in a build of my game, and I want to have access to those XML files in Android. How to I store and load those XML files?

sentences:
Unity game crashes when opened on some computers but not all I'm facing a weird issue where every time I attempt to run a Unity application, it just crashes with no error message or log being generated. I tried running the game, it works on some computers (3) but fails on most (35). Upon attempting to run the application, I get a box that pops up for a second with a red exclamation point, which then crashes. See screenshot below:

I have found people having similar problems, but no real solution.
https://forum.unity.com/threads/solved-crash-when-running-any-unity-application.599953/
https://forum.unity.com/threads/crash-when-opening-any-unity-application.873133/
My game is made in Unity (v2018.1.9f2). Attaching the error logs for your reference. Unfortunately, I do not have the admin privileges to try the citrix solution in lab computers (since they are controlled by the University office).
Error logs:

https://pastebin.com/mcMaD9im
https://pastebin.com/M0e9a9GG
https://pastebin.com/DSRrU8bZ

sentences:
Managing multiple references of the same game entity in different places using IDs I've seen great questions on similar topics, but none that addressed this particular method:

Given that I have multiple collections of game entities in my [XNA Game Studio] game, with many entities belonging to multiple lists, I'm considering ways I could keep track of whenever an entity is destroyed and remove it from the lists it belongs to.

A lot of potential methods seem sloppy/convoluted, but I'm reminded of a way I've seen before in which, instead of having multiple collections of game entities, you have collections of game entity IDs instead.  These IDs map to game entities via a central "database" (perhaps just a hash table).

So, whenever any bit of code wants to access a game entity's members, it first checks to see if it's even in the database still.  If not, it can react accordingly.

Is this a sound approach?  It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

sentences:
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:
How do I stop my skeleton from playing the walking animation? I'm trying to get a Skeleton Model to go from its walking animation to its idle animation using a bool that checks for input. Currently, in-game, the skeleton doesn't leave its walking animation and stays in it even when not walking.
Here is the code I'm using:
public class SkeletonMove : MonoBehaviour
{
    private float velocity = 5f;
    public bool _isWalking = false;
    Vector2 input;

    void Update()
    {
        GetInput();

        if (Mathf.Abs(input.x) < 1 && Mathf.Abs(input.y) < 1)
            return;

        Rotate();
        Move();
    }

    void GetInput()
    {
        input.x = Input.GetAxisRaw("Horizontal");
        input.y = Input.GetAxisRaw("Vertical");
    }

    void Move()
    {
        _controller.Move(transform.forward * velocity * Time.deltaTime);
        _anim.SetBool("Walking", _isWalking);

        if (input.x != 0 || input.y != 0)
            _isWalking = true;

        if (input.x == 0 && input.y == 0)
            _isWalking = false;
    }

sentences:
What's the "appLinkUrl" parameter in the "AppInvite" method for? I'm trying to figure out what should I assign the appLinkUrl parameter of FB.Mobile.AppInvite method. In documentation it says:

  The AppLink URL to identify your app and also used for deep-linking

Should i pass my Play Store link to it?

Thanks in advance.

The documentation page for FB.Mobile.AppInvite: https://developers.facebook.com/docs/unity/reference/current/FB.Mobile.AppInvite

sentences:
Unity saving and loading of images in game So I'm planning out this game for unity but I don't know how feasible it will be with all of the image loading and saving.  I've worked with some other coding, and while I am in the process of learning C# and Unity I don't have a very informed base for my opinion.

Basically the game will be inspired by the base mechanics of the Chaotic tv show where you have to adventure to take scans of creatures and these scans will be used in another aspect of the game as cards.  The creatures will be randomly generated.  The problem is I want the scans to be like actually taking a picture (A picture that includes all the stats of the creature).  This means I want to be able to save a picture of the scene with the creature in it as well as the stats associated with said creature which means I would have to have some sort of data base capable of storing hundreds (Possibly thousands if you include player made and prebuilt cards) of cards and the data associated with them.  The scans take a picture and record the stats of the creature at that point in time so they're only highly usable for the game when the creature is in near perfect condition (Not yet defeated or attacked).  I would have to be able to store scans of creatures, scans of the environment, and possibly scans of items found while adventuring.  I think it would work best if only a small picture of the actual scene is saved with the stats instead of the full card and the stats, with it rebuilding the card each time it's loaded into memory.  The small picture would also cut down on storage space (Possibly so small as to be high res pixel art)

Would it be unrealistic to save all of this data?  Aswell, does Unity/C# even have the capabilities to take screenshots from specifically defined areas of the screen/players view and then reuse them in another area of the game instead of saving them in some predefined screenshot area?

(This game will be entirely offline so no data will need to be transferred to a different system)  (Said game will also be 3d with the card playing area in 2d)

sentences:
Can DDS be used in OpenGL in Linux without license/patent issue? Is there a 'standard' for OpenGL game creation intended for both Windows and Linux? I understand DDS is the DirectX standard (or, at least, it appears to be). Is there one that does not have potential patent/license issue or does it really not matter?

I am asking as I would like to avoid focusing on DDS as the format to use, only to have that kick me in the teeth later when some license/patent/??? issue requires me to remove and replace DDS with [texture format here]. This is not about what is better or an opinion post, but what is (relatively) safe from the constraints mentioned earlier?

sentences:
How do you parameterize turn based AI? I would like to create/find an AI algorithm/process that can be parameterized such that a change in the parameters causes a change in the AI behavior. I am specifically looking to apply this to a turn based game environment where the player is able to perform several moves (or none at all) in a single turn. The player has full knowledge of the board and should be able to take the opponent's current positioning into account when deciding what moves to make in the current turn.

My question is how can I create this type of AI? An example of behavior that I would like it to show in various situations would be:

Turn X: Attack location A with 7 units and attack location C with 12 units
Turn Y: Do nothing
Turn Z: Invest in resource collection

Then a small change in a parameter may cause the AI to only send 6 units to location A instead of 7 in the same situation as Turn X.

My only thought of how to implement something like this would be to have the parameters act as probabilities of doing action T with magnitude R. However, I could imagine how this wouldn't facilitate long term thinking, and I also have no idea how that approach would take the opponent's positioning into account. I also suspect that this approach would cause the AI to overspend within a single turn, as in, it tries to attack 3 locations with a total of 30 units, but it only has 15.

I've spent the last few hours looking through Google Scholar and have found a few papers that say that they have used a parameterized AI approach, but they don't discuss any actual implementation details. If anyone could tell me what this concept is normally called (so I can Google and research it further) or has any reference links to code that uses an implementation like this then I would really appreciate you adding it as an answer.

Also, just so people don't waste their time answering something that isn't needed, I'm only interested in the design/structure of the described process, I am not looking for ways to get good values for the parameters.

Thanks everyone!

sentences:
Why are my screenshots created through a RenderTexture too small? Current render result:

When I am rendering image in Unity and saving as file(.png), quality of those files are reduced. They become tiny and very poor.

How can I enhance that?

Dimension of the image file is 269*168.

Code to save image :

using UnityEngine;
using System.IO;
using System;

//getty code
public class Capture : MonoBehaviour
{
    private static int resWidth = 3840;
    private static int resHeight = 2160;
    private static GameObject camObj = null;

    public static string ScreenShotName()
    {
        return string.Format("{0}/screenshots/{1}.png",
                             Application.dataPath,
                             Util.name_);
    }

    void Start()
    {
        camObj = gameObject;
        Directory.CreateDirectory(Application.dataPath + "/screenshots");
        resHeight=GetComponent<Camera>().pixelHeight;
        resWidth=GetComponent<Camera>().pixelWidth;
        //Util.everyThingHot = true;
    }

    public static void TakeHiResShot()
    {
        try
        {
            RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
            camObj.GetComponent<Camera>().targetTexture = rt;

            Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false);
            camObj.GetComponent<Camera>().Render();
            RenderTexture.active = rt;
            screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
            camObj.GetComponent<Camera>().targetTexture = null;
            RenderTexture.active = null;
            Destroy(rt);
            byte[] bytes = screenShot.EncodeToPNG();
            string filename = ScreenShotName();
            File.WriteAllBytes(filename, bytes);
            Debug.Log(string.Format("Took screenshot to: {0}", filename));
            bytes = null;
        }
        catch(Exception e)
        {
            Debug.Log("Error");
        }

    }

}

Sample:

What I see during saving shot:

It's taking a lot CPU,GPU resources, renders correctly but doesn't give me what I want as a file

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:
How can I obtain a copy of the Kinect commercial SDK? As far as I know, in order to publish a Kinect game on XBOX console, you need a commercial version of the Kinect SDK. The problem is, I couldn't find a reliable source to research about the subject. Do you know:

What are the conditions for getting the Kinect commercial SDK?
Is it possible to buy it without owning a company?

sentences:
Unity Animator - bool transitions keep re-entering state while true My StateMachine is triggered in a loop as long as transition boolean is true.

I have made sure my code only runs once, where I set the animation bool:

animator.SetBool("talk", true);

This does trigger the transition but the problem is that it re-triggers every frame as long as the bool is true. I had the same issue with a normal state earlier, but there I could turn off "Can transition to self" which solved it.
However a StateMachine does not have that option.

I want the animation to play until the bool is set back to false, so using a trigger would not be good here.

EDIT: For some reason it seems the "Transition duration" is the one resetting my animation. So if I change that to 3, it re-enters every 3 seconds, and so on. This seems really weird?

How do I just make sure that the animation plays until its done, then it re-enters (to choose another random talking animation from my StateMachine), as long as talk == true?

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:
If my camera does not change position but rotates, Does adding lerp do anything? If my camera does not change position but rotates, Does lerp do anything?

        cameraposition = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position, Time.deltaTime * cameraLerp);
        Camera.main.transform.position = cameraposition;
        Camera.main.transform.LookAt(gameobject.transform.position);

sentences:
Security concerns related to HTML 5 games I would like to know if people could modify an HTML 5 game's code to harm either the server or other players whom visit the page.

More specifically, whether someone could modify a simple game that doesn't have things like high-scores, global stats, log-in, etc. to harm other users and/or the server the game is hosted on.

Is this only a concern for games that retrieve data to be stored on the server itself?

sentences:
Using Variable to Reference Different C# Script I had a question about using a variable to access different scripts. I have a Rhythm game I'm working on, and I have different scripts named Rudement1, Rudement2, Rudement3, ect... One of my other scripts has something like this,

public GameObject HighHatFlare;
public int RudementNumber = TrainingMenuScript.TrainingMenuInt;

// Use this for initialization
void Start ()
{
    Rudement1.NoteCreated = Rudement1.NoteCreated + 1;
}

What I'm looking to do is use this same script but modify it to to something like this:

public GameObject HighHatFlare;
public int RudementNumber = TrainingMenuScript.TrainingMenuInt;

// Use this for initialization
void Start ()
{
    Rudement(RudementNumber).NoteCreated = Rudement(RudementNumber).NoteCreated + 1;
}

The goal is that I can continually use this script and it will modify itself as I use different "Rudement" scripts. I figured it some type of "RudementNumber" or 'RudementNumber', but I can't figure it out. Can someone help me with this?

A rudement is a basic sticking pattern that you learn at a very beginning level of drumming. Also spelt "Rudiment" I was always told to spell it with an "e" because of its French roots (not relevant).

In this context it could be replaced by the term "level". Each rudiment is a different level and therefore has different amounts of notes. The base script between each level is identical, but the note patterns are different.The script above is attached to each note to give them a numeric order as they are created. It is running under a mono behavior. I think that at it's simplest I'm wondering if you can reference a script name via a changeable string with the intent to pull a variable from it. As the level changes so does this string to pull the amount of NotesCreated from the new level.

sentences:
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:
Strange behavior with transformation matrix I'm fairly new to transformation matrices. I'm using them to translate and rotate nodes and their child nodes. The following code works when applied once, but shows strange behavior when applied many times in a row:

void Node::update() {
    Mat4 parentTrans = (haveParent ? parent->getTransform() : Mat4::Identity());
    Mat4 thisTrans = this->getTransform();

    Mat4 translate = Mat4::Translation(this->getPosition());
    Mat4 rotate(this->getRotation());
    Mat4 result = parentTrans * thisTrans * translate * rotate;

    this->setPosition(result.getTranslation());
    this->setRotation(result.getRotation());
}

This works for a somewhat complex test case: a parent node w/ one child node, the child node is offset from the parent node, the parent node is rotated, and the child node is has its own local rotation. In this case, the drawing looks correct.

I'm running into problems when applying the above multiple times. For example, when I'm animating a rotating node (changing the rotation just a bit on each frame). Here, the position of the node becomes huge and it just zooms back to some very large position.

Any help or advice on how to address this is greatly appreciated.

sentences:
Pygame OpenGL init causes an X Error -> pygame.display.set_mode(display, HWSURFACE|OPENGL|DOUBLEBUF)
(Pdb) s
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  28
  Current serial number in output stream:  29

I've seen one other answer to this question related to video drivers, but I feel like I've already run my game at least once with the same video drivers installed. I'd just like to know if there's another possible cause for this issue before I reinstall my drivers for the umpteenth time on Linux.

sentences: How to fill a rectangle with tilable texture in XNA? So, question in the title. I don't know how to create infinite seamless background.

sentences:
Generate smaller quads from a large quad? I have a big quad (100x100) and I was wondering how can I generate smaller quads from this big quad?
 Such that I will have multiple small quads and I can add a different texture to each quad.

sentences:
How can I get the assignment of an object back? I have been struggling with this NullReferenceExpection error.

When I don't add anything and just use this version of the code. The game adds a tower, upgrades a tower and takes money for it.

It worked all fine until I tried to add a menu that opens up and then you can choose a tower type you can buy.

So after I add all of this I get a NullReferenceExpection at return tower == null && gameManager.Gold >= cost; and at gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;. The game also doesn't take any money from purchases and you can spawn near infinite amounts of towers on one spot.

  //tower = (GameObject)

  theTowerMenu.gameObject.SetActive (false);

  transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z

If i take 'tower = (GameObject)' out of comments I get "error CS0030: Cannot convert type void' toUnityEngine.GameObject'".

The current script:

using UnityEngine;
using System.Collections;

public class PlaceTower : MonoBehaviour {

public GameObject towerPrefab;
private GameObject tower;

public GameObject openSpot;

private GameManagerBehavior gameManager;

public GameObject theTowerMenu;

// Use this for initialization
void Start () {
    gameManager = GameObject.Find ("GameManager").GetComponent<GameManagerBehavior>();
}

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

}

private bool canPlaceTower() {
    int cost = towerPrefab.GetComponent<TowerData> ().levels[0].cost;
    return tower == null && gameManager.Gold >= cost;
}

void OnMouseUp () {
    if (canPlaceTower ()) {
        //tower = (GameObject)
        theTowerMenu.gameObject.SetActive (false);
        transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z);
        Instantiate (towerPrefab, transform.position, Quaternion.identity);

        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);

        gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;
    } else if (canUpgradeTower ()) {
        tower.GetComponent<TowerData> ().increaseLevel ();
        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);
        gameManager.Gold -= tower.GetComponent<TowerData> ().CurrentLevel.cost;
    }

}

private bool canUpgradeTower() {
    if (tower != null) {
        TowerData towerData = tower.GetComponent<TowerData> ();
        TowerLevel nextLevel = towerData.getNextLevel ();
        if (nextLevel != null) {
            return gameManager.Gold >= nextLevel.cost;
        }
    }
    return false;
}
}

Please help. I've been stuck with this for a long time.

sentences:
How can I increase the return from from ads? I made a little Windows Phone game and I want to use AdRotator to show ads in the game. My game has 50 levels. Some levels take 30 seconds, other levels more than 3 minutes to complete them.

Will I make more money with longer levels? Can I get more impressions in longer levels?

My game has a free trial mode, but you have to buy the game if you want the entire content.

How can I increase impressions and get a high eCPM rate?

sentences:
How to export from Eclipse with LWGJL using JarSplice? I am in the process of developing a 2D tile-based RPG with Eclipse, LWJGL, and Slick utilities.

For some reason eclipse seems to be lagging heavily which doesn't make sense as all I have rendering is a 64x64 test map using 16x16 tiles, the character, and text when i press enter.

To see if it is a problem with my code or with eclipse, I am trying to export it into a jar or exe and run it outside of eclipse.

Since I use png spritesheets and xml files to supply coordinates and map data, I need to also include a resource folder.

I've tried exporting from Eclipse as a jar, then adding that jar, the Slick jar, and LWJGL jar into JarSplice, but it says error opening zip file, which I assume is that the resource folder is zipped when Eclipse creates a jar.

I need to know how to get the jar to run, and where I need to place the resource folder, and if I need to change any code to be able to access the resource folder. I think I saw something about the appdata folder being where you place such things, but I do not know how to use it.

P.S My code uses 3 spritesheets (Tiles, Character, Text), 4+ xml files (one for each spritesheet + one for each map), and uses Immediate mode rendering, so if the problem is that immediate mode isn't fast enough, should I go up all the way to VBO's, or would display lists suffice?

EDIT:
I normally wouldn't think it was Eclipse, however Eclipse itself seems very slow lately.

Sometimes when I run my code, it works without lagging at all, and others it seems as if the frame-rate is less than 10.

Also sometimes basic functions in my code decide not to work. For instance, I implemented a way so when the enter key is down three lines of text appear, sometimes when I run, they show up sometimes they don't.

Another instance (I run in fullscreen mode) is that sometimes when I hit run, my view will size up to fullscreen, but it still just shows Eclipse, and I have to take my battery out to exit.

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:
How to make a character sit in Unity? So I've got the animation, it has root motion but activating it in the settings doesn't seem to do much.

What would be a good optimized way to have the character sit on the stool with the animation matching the movement? Would I need to do it through code?And if that's the case, could I specify in which frame do the movement? Or add a second animation that is in charge of Root Motion?

I know either of these two options I give could work but I'm checking to see if there is a better way or if I'm missing something here.

Thanks!

EDIT: Following DMGregory's comment I disabled the collider to see if it improved... it did change, but it isn't much better:

EDIT 2: This is how the animation preview looks like (what I'm expecting)

Then I just hold the last frame while they're sitting and play the animation backwards for when they're getting off - this is just while I get it to work.

sentences: 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:
Algorithm that always returns the same pseudorandom output if given the same input of seed, x and y? I've been trying to find an algorithm that will take in an x value, a y value, and a seed value and then spit out a number between 0 and 255 (or an int that I can cut up into bytes). I want to be able to feed in the tile a player is standing on during some ingame event and get the same value for the same tile any time the player is in that level. I don't want to use a linear PRNG because I just want to check a few tiles at any one time, not go though several of them to get a sequence.

I tried modifying an Xor Shift PRNG, but I just end up making patterns like below:

ubyte Xor( int wx, int wy, ulong seed ){
    int result = wx ^ (wx >> 7) ^ wy ^ (wy >> 9) ^ seed ^ (seed << 6);
    return cast(ubyte)result;
}

My input values are likely to be 0-32000 for x and y, and seed can be any ulong value. I'd like to avoid floating point math as it's not deterministic between machines (so it would screw up some multiplayer stuff). I just need to not get a repeating pattern, and have each seed produce a distinctly different output. Can anyone point me in the right direction?

sentences:
When should I use GL_TRUE or GL_FALSE values? When using GLboolean, should I just use true and false or should I use GL_TRUE and GL_FALSE? When should I prefer using GL_TRUE and GL_FALSE? or maybe I shouldn't care at all (Because both works)?

Here It is said that both are actually a different type.

But in some tutorial websites I've read, they use GL_TRUE or GL_FALSE on functions that requires GLboolean. Example:

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*) 0);

Well, it works too if we substitute GL_FALSE with false in the code above.

sentences:
Circle-Rectangle collision resolution I have a non axis aligned rectangle, like a car, in my game. I have to check and resolve the collision between the rectangle and circle, which is stationary.

I have found lots of ways to determine the collision, but couldn't find anything on resolving it. It is clear that i have to push back the rectangle away if there is a collision, but I can't find a proper way.

Is there a way of handling and resolving the collision between a rectangle and a circle? Like an algorithm?

I am developing in c++.

sentences: What does maximum normalized frictional force mean in this tutorial? I tried following this tutorial: https://nccastaff.bournemouth.ac.uk/jmacey/MastersProjects/MSc12/Srisuchat/Thesis.pdf, but in page 19 I ran onto a problem - I don't understand the step 4. It is also not explained before. Could somebody explain what is it and what values may be used?

sentences:
Jenkins CI with Unity on local machine I have seen some people using Jenkins CI with Unity, would it be wise to install Jenkins locally and use it with Unity? I've never used Jenkins, so I can't imagine why not. Is this ill-advised?

I would have set up Jenkins on my old laptop, but I don't have windows on it. Is there any harm in using it locally?

sentences:
Loading source controlled MonoDevelop project leaves out some folders I have recently started using version control in MonoDevelop and have discovered that if I include a folder containing for example Scenes that they will be included when I push changes to master.

My structure is:

Scripts

--> Armour.cs

--> Inventory.cs

Scenes

--> Scene01.unity

However when I reopen the unity project and look at the code solution only the Script directory and the files within it appear and the Scenes folder is absent.

Strangely enough Scene01.unity is still getting picked up if I make a change and go to commit changes.

This is what I want my project to look like

Does anyone know why this is happens and if there is any way to resolve this?

NOTE: As a basic work around I can manually include the file when it disappears however when I have a large amount of assets this could become a painful task. Also if I load the project using MonoDevelop it loads fine, but opening from Unity itself seems to overwrite the solution files.

sentences:
Drawing each sprite at different location I can draw multiple sprites but they are all on top of each other at (0,0). How would I make each sprite appear after one another in a row?

My Rect class and Draw function:

class Rect(pygame.sprite.Sprite):
    def __init__(self,color,width,height,value=0):
        super().__init__()
        self.image = pygame.Surface([width, height])
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.value = value
        self.x = 0
        self.y = 0
    def change_value(self,color,value):
        self.image.fill(color)
        self.value=value

def DrawRects():
    rect1 = Rect(red, boxW, boxH)
    rect2 = Rect(black, boxW, boxH)
    rects.add(rect1, rect2)

    rects.draw(screen)

sentences: OpenGL ES 1.1: Is it more efficient to use glClear or use glDrawArrays with primitives that render over used frames? For example, if I have several figures rendered over a black background, is it more efficient to call glClear(GL_COLOR_BUFFER_BIT) each frame, or render black triangles over artifacts from the past frame? Answers pertaining to other versions of OpenGL are also greatly appreciated.

sentences:
Canvas enabling is not working I have a canvas with two buttons in it and I want to enable it on the button click, but when I try to enable it, it doesn't work. However, when I try to disable it on button click it does work.
Here is my code:

 public GameObject mycanvas;
  public  void onClick() {
     mycanvas.SetActive(true);
}

Can someone please tell me what I am doing wrong?

sentences:
What is the appropriate way of placing game objects in a 2d game? I'm developing a 2d game for Android.It will be an endless game.I have some items like coins ,plants and other special items.How can i place them effectively?Are there any algorithm or any suggestion for this?

I'm already know that i have to use random numbers for placing them along x and y axis.It's important to not placing two different item at the same x and y position.

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:
Libgdx: How to replace texture with shaperenderer? I have a method that creates rectangles, it takes a texture

 for (Rectangle rect : rect) {
            game.batch.draw(rectImage, rect.x, rect.y);
        }

The texture is simple, I could just draw it instead. I created for example

shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.rect(
        rect.x,
        rect.y,
        rect.width,
        rect.height,
        Color.DARK_GRAY,
);

Now what? game.batch.draw doesn't accept shapeRenderer instead of rectImage and doesn't accept only rect.x, rect.y

I'm just wondering how to call it?

sentences:
XNA 4.0, Combining model draw calls I have the following problem: The levels in my game are made up of a Large Quantity of small Models and because of that I am experiencing frame rate problems. I already did some research and came to the conclusion that the amount of draw calls I am making must be the root of my problems.

I've looked around for a while now and couldn't quite find a satisfying solution. I can't cull any of those models, in a worst case scenario there could be 1000 of them visible at the same time.

I also looked at Hardware geometry Instancing, but I don't think that's quite what I'm looking for, because the level consists of a lot of different parts.

So, what I'd like to do is combining 100 or 200 of these Models into a single large one and draw it as a whole 'chunk'. The whole geometry is static so it wouldn't have to be changed after combining, but different parts of it would have to use different textures (I think I can accomplish that with a texture atlas). But I have no idea how to to that, so does anybody have any suggestions?

sentences:
How do I add a custom mob to Minecraft? Basically decided to make my own mob, I have:

Created my mob's entity class
Created my mobs model class
Drawn the model
Added the function call for addMapping within the EntityList class

I'm stuck on what to do next. I've tried finding the code that deals with passive animal spawning in the world, however I can't seem to find it.

Help greatly appreciated.

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:
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:
Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync? A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering.

The problem with this is that, by interpolating the rendering, you are effectively averaging two states in the game - the current and the previous. If the previous frame is averaged with the current frame, the player will be shown the game slightly delayed.

If the player is stationary in one update, then teleports in the next, the interpolation will show a state where the player is mid-way between a teleport very briefly.

For time-critical games, is my thinking correct that the player may see a different/slightly lagged state on screen (the interpolated state) than what is actually stored in memory?

The only fix I can think of is to interpolate the current state + the next, not yet calculated, state. This gives the correct image on screen instead of a slightly delayed previous image... but then we are stuck in a paradox of calculating the next future update.

Or perhaps the time difference is so minimal that it doesn't matter?

I am referring to the following line, the current state is where we are at this moment in time and not fully displayed:

State state = currentState * alpha + previousState * ( 1.0 - alpha );

sentences:
How to apply impulse to a body to make it fly away? I'm playing around with jbox2d and can't really make a body "fly away" as if from an explosion.

From what I have found on the net, making the body fly away from the world center (0,0), should have been something like that:

b.applyLinearImpulse( new Vec2(0,0) , b.getPosition() );

But really it just doesn't do anything, any idea why? Also how do I change the strength of the impulse, like if it want to make it fly skyhigh or just move a bit?

sentences:
How do client-server cooperation based games like Diablo 3 work? Diablo 3 cooperates with Blizzard servers even during single player games. In fact, Blizzard has had problems with the games "melting their servers."

I would like to ask: How do the client and the server communicate? What details does the client leave to the server, and vice versa? What details are redundant - both the client and the server know - and how often do they disagree?

The previous paragraph contains the important questions, but I have a few more that I must explain my motivation towards. I am interested in the programming of botting. Ethical botting - I don't plan on actually abusing the automation to run 24/7. I just find it to be a great programming challenge to glean information from a game, and then make decisions from that information. I am stuck in the starting gate. The unofficial questions from this post would be: How can I make a bot (language, tools, libraries)? Can I get information through the communication between client and server, rather than the brute force pixel detection easily used in more static games?

There probably is a trust issue, and to that all I can say is that I promise not to abuse the answers. But please feel free to answer any of the questions you feel comfortable with. Thank you!

sentences:
How to implement time traveling into a game? I was wondering how to implement time travel into a game. Nothing super complex, just time-reversal like what's in Braid, where the user can rewind/fast forward time by 30 seconds or whatever.

I searched around the web a lot, but my results usually referred to using time as in like "it's 3:00" or a timer and such.

The only thing I could think of was using 2 arrays, one for the player's x position and the other for the player's y position, and then iterating through those arrays and placing the character at that position as they rewind/fast forward time. Could that work? If it would work, how large would the array have to be and how often should I store the player's x and y? If it doesn't work, what else could I try?

Thanks in advance!

sentences: Can an individual apple developer account have your own name/studio's name? I just purchased the iOS developer program for $99. It said on the website that the sellers name would be your name. I think Ketchapp (the creator of 2048) also uses individual. So are you allowed to use a name you created yourself to be your individual account's name? Thanks in advance!

sentences:
3D format or software that stores a vertex normal At the moment i'm using .obj file format to store 3D models. It's popular, easy to read and parse. The issue is that it stores sufrace normals for each face. This isn't an issue for me yet, but i'm keeping in mind that i have to deal with lights once i'm done with the basics of my engine. This will require vertex normals and not surface normals. I want to avoid vertex multiplication and i want nice, curved surfaces. Blender seems to be unable to store vertex normals, only sufrace normals, is this typical of 3D rendering software and file formats?

Now i'm still kind of bad at profiling and i lack experience of what's "standard", but still i want to write effective code and i can't benchmark my ideas, so please excuse me asking weird questions here.

Is it "normal" to load surface normals from the .obj file and then for each vertex do an average of all the surface normals of surfaces that use this vertex (f.e. a plane "f " in .obj says vertex of index "i" has some normal "n", so i averate this normal "n" with the one already stored for this vertex)? This seems like such an expensive calculation to do when loading a model, is this the right way to think about it? Or is there a better way (or a file format/3D editor) to deal with this issue. Having multiple normals per vertex means that i have to duplicate vertices which is out of the question, not to mention that i'd get flat shading.

I'm mostly asking this because it seems illogical that a 3D model would be stored with surface normals that are very easy to calculate and not vertex normals which aren't easy to calculate and which are required for realistic lighting. Maybe it's a "legacy" thing?

Also, while we're on the subject, how do people deal with surfaces that have to be flat planes like a brick? For light calculations these models need vertices normals to be surface normals. but if i had a model like a knife that would consist of the blade that needs to be flat and the handle that i want round i would have to have the blade with duplicate vertices and the handle with not duplicate vertices which seems like a weird thing to request from my 3D softare (if it's even possible).

How do people deal with it, the only "smart" idea i can think of is to do separate models for flat objects (that would be stored in an innefficient way with vertex copies instead of indices) and separate models for round objets that would use the averating described above. The other idea is to have a program with a geometry shader in case i want to render a flat surface that would calculate a surface normal and set each vertex's normal to the one calculated and pass that to the fragment shader (though the extent of my geometry shader knowledge is a short article, haven't used them yet, is this even possible in OpenGL?).

I feel like i'm trying to brute force the issue, maybe there's a "magic" math trick that could help me or am i just stuck with more models or shader programs to manage.

sentences:
Black or White Border/Shadow around PNGs in SDL/OPENGL having the same issue as this: Why do my sprites have a dark shadow/line/frame surrounding the texture?
however, when I do the fix suggested there (changing GL_SRC_ALPHA to GL_ONE) it just replaces the black border with a white border on the images. was able to find a lot of results on google from people finding black borders and fixing it with the GL_ONE change, but no results for white borders.
any ideas?

heres some of my relevant code.

init:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glAlphaFunc(GL_GREATER, 0.01);
glEnable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

when each texture is loaded:

glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, surface->w, surface->h, GL_BGRA, GL_UNSIGNED_BYTE, surface->pixels);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

thanks!

sentences: Is there an approach in creating an AI Framework? I am creating a board game using Actionscript 3.0. I've finished it to the point of the game playable with (computer players making random decision). I'm now working to create an AI framework/module ( Designing and creating classes that will be used to drive the AI). Is there a commonly/popular approach on creating an AI framework)? I've searhed around abit and could only find algorithms and sample codes. What I'm not looking for game/code specifics but more to thinking process in designing and modeling the AI.

sentences: Make a glass cup look like it's full of water I've been struggling to figure out a way to make a glass cup full of water, and since the cup is made of glass a plane on the top of the glasse won't really do it, so how can i go around making the glass looks like it's full of water?

sentences:
Reading depth buffer result in only two values I am attempting to add an SSAO post processing shader to my deferred rendering engine. I am running into problems with reading from the depth buffer. In the images linked below you can see the depth buffer, and the values I'm reading out of it (the values are scaled - see 'range' value at top of image)

Depth Buffer

What I read from the depth buffer

It looks to me like the format must be wrong somehow but I'm not sure in what way.

The depth buffer is being created as follows:

// Texture
D3D11_TEXTURE2D_DESC textureDesc;
ZeroMemory(&textureDesc, sizeof(textureDesc));
textureDesc.Width = m_Desc.Width;
textureDesc.Height = m_Desc.Height;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
textureDesc.SampleDesc.Count = 1;
textureDesc.SampleDesc.Quality = 0;
textureDesc.Usage = D3D11_USAGE_DEFAULT;
textureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
textureDesc.MiscFlags = 0;
HRESULT hr = m_pDevice->CreateTexture2D(&textureDesc, nullptr, &m_pDepth);

// DS VIEW
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
ZeroMemory(&descDSV, sizeof(descDSV));
descDSV.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
descDSV.Texture2D.MipSlice = 0;
hr = m_pDevice->CreateDepthStencilView(m_pDepth, &descDSV, &m_pDepthStencilView);

// SR View
D3D11_SHADER_RESOURCE_VIEW_DESC depthSrvDesc;
ZeroMemory(&depthSrvDesc, sizeof(depthSrvDesc));
depthSrvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
depthSrvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
depthSrvDesc.Texture2D.MipLevels = 1;
depthSrvDesc.Texture2D.MostDetailedMip = 0;
hr = m_pDevice->CreateShaderResourceView(m_pDepth, &depthSrvDesc, &m_pDepthShaderResourceView);

And the important parts of my SSAO shader:

Texture2D gTextureDepth;

struct VS_INPUT
{
    float3 Position : POSITION;
    float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
    float4 Position : SV_POSITION;
    float2 TexCoord : TEXCOORD0;
};

PS_INPUT VS(VS_INPUT input)
{
    PS_INPUT output = (PS_INPUT)0;

    output.Position = float4(input.Position, 1.0f);
    output.TexCoord = input.TexCoord;

    return output;
}

float4 PS(PS_INPUT input) : SV_Target
{
    int3 loadCoord = int3(input.Position.xy, 0);

    float depth = gTextureDepth.Load(loadCoord).r;

    return float4(depth, depth, depth, 1.0);
}

Any ideas?

sentences:
What elements of D3DPRESENT_PARAMETERS MUST be set? DIRECTX9...
For ages, I've shipped games that only half-fill out the D3DPRESENT_PARAMETERS structure, and now I'm wondering if this is buggy. The items I'm worried about, and never set are:

hDeviceWindow
Windowed
EnableAutoDepthStencil
FullScreen_RefreshRateInHz

I zero out the whole structure initially, so they should all be zero, even if my game is running (happily) in a window. As ever, there are a tiny %tage of users who have issues, and I am looking for possible causes. Could not setting one of these cause problems? The documentation doesn't say either way, and 99% of users certainly are fine with these settings. Does anyone have a definitive answer as to what should be set?

sentences:
How to build multiplayer games for android? I'd like to know how to build android multiplayer games but I'm struggling to find a step-by-step or good resources on this topic. My main questions is which engine and api to use? I'd like to achieve this with the technologies I already know such as Firebase and Libgdx on android studio.

All my researches point to things like Unity, Godot and unreal. Is this the only/better way to go since I want to build simple games such as pool ?

What I want to build is a multiplayer game on where the users should be able to invite friend from their social media to play against, provide rankings and sharing results on social media. ONLY for Android, using Java and free resources (APIs, db's, engines).

A good example would be Trivia Crack how is this game (probably) made? which technologies?

sentences:
Blending animations for more character movements I am making a hack n slash 3rd person game, and I want the character movements to be more dynamic not like fighting games where you have a moves list.

I want to animate tons of different animations and have them "Tween" between each other.

I do not want the to use the mouse for controls, I want it to be all keyboard, that way you have up to 10 inputs (All your fingers) to blend and morph animations to create more fluid movements. In the end this will almost be similar to characters typing a phrase or string of keys rather than move forward mouse look click to melee.

My questions are:

Has anyone done this before?
How would someone go about trying to tween?

lets say one for key on the keyboard excluding Tab, Caps, R+Shift, L+Shift, Enter, R+Ctrl, L+Ctrl, L+Alt, R+Alt, Windows Key, and Menu.

So thats all the numbers, letters and punctuation keys. Thats 46 keys gives me a combination of 46P1 = 5502622159812088949850305428800254892961651752960000000000L (used Python), and with a minimum entry value of 2 keypresses shortening to half. This is not humanly possible to create so many inique animations in one lifetime. But I'm guessing there is a reason this hasn't been done already.

Or if I just used 10 basic keys. Maybe ASDF SPACE (RIGHT HAND) 456+0 (LEFT HAND KEYPAD)
it would give me 3,628,800 posible unique animations.

sentences:
displaying leaderboard Basically what i wish to ask:
*A game is developed for android platform, is on google store and its leader board (scores etc.) are on Google server.

Can we display the top scores from there on a webpage/website which is on a different server? Yes or No!

sentences:
Two graphical entities, smooth blending between them (e.g. asphalt and grass) Supposedly in a scenario there are, among other things, a tarmac strip and a meadow. The tarmac has an asphalt texture and its model is a triangle strip long that might bifurcate at some point into other tinier strips, and suppose that the meadow is covered with grass.

What can be done to make the two graphical entities seem less cut out from a photo and just pasted one on top of the other at the edges? To better understand the problem, picture a strip of asphalt and a plane covered with grass. The grass texture should also "enter" the tarmac strip a little bit at the edges (i.e. feathering effect).

My ideas involve two approaches:

put two textures on the tarmac entity, but that involves a serious
restriction in how the strip is modeled and its texture coordinates
are mapped

or

try and apply a post-processing filter that mimics a bloom effect where "grass" is used instead of light. This could be a terrible failure to achieve correct results.

So, is there a better or at least a more obvious way that's widely used in the game dev industry?

UPDATE:

This is a conceptual question, I do not require a specific shading language or framework.  In real life, I use Cg with Ogre for rendering experiments. If I supply two textures and two different texture coordinate sets for the tarmac entity, I can analyze the second texture coordinate set in the fragment shader and do some blending depending on the .y component of the uv pair, but that requires the artist to hand-craft every asphalt/tarmac runway in the scenario and it looked to me that this is probably the wrong way to tackle the issue.

sentences:
How do I get mouse x / y of the world plane in Unity? I am trying to make a tiled landscape. The terrain itself is not made from tiles but the world has a grid which I define.

I would like to place boxes/rectangles which snap to this grid, at runtime, but in order for me to do that I must get a projection from the user screen to the real-world coordinates.

I have tried various examples using the Ray class but nothing worked. It compiles and outputs a constant value no matter where I put the mouse. I have tried to add some tiles and try to detect them but no luck. I also tried with one plane as big as my world but still no luck.

I am using C# but even a JS version would be helpful.

This technique involves calculating which tile the mouse is under by the x and y positions. Perhaps detecting which tile itself is being pointed to would be a simpler task, at which point I can just retrieve its i/j properties.

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:
Is there a legal option for writing Nintendo 64 games? Recently, I've been looking into developing games for Nintendo 64 emulators, and modding existing ROMs. I wanted to know if there is the possibility for any legitimate tools out there which can be used to write the code for the emulators or if all of that is off limits.

I heard that the Nintendo 64 SDK has always been sealed by an NDA limited to the game studios, years ago; however, I'm curious about where all the current ROMs that are available came from. Mainly because, unlike discs, cartridges are not typically supported by standard hardware.

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:
How to handle mouse input in XNA? I am developing a card game in XNA.

Is there any OnClick event in XNA for objects?

I am trying to make cards move when the player clicks on them. In this project, there is a Sprite class that draws the card, but I am a little stuck because I don't know how to use OnClick events or anything like that.

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:
Using depth buffer on a sprite I am following this guide:

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps

Trying to create a tiled map that also supports multiple layers. The guide says that a way is to use depth buffer, and says to:

1) Create the z-buffer and a 2D projection;
2) For every layer in the tiled map, set the cc_vertexz attribute;
3) Enable alpha test and set the sprite alpha func.

The first question is: if I use a tiled maps with multiple layers, are also the point 1 and 3 needed?

I am fine with the first two points, but as for the third point I don't know how to do that. I should subclass CCSprite and override the draw method, but the problem is that when I create a tiled map there are already sprites on it, so the instances don't belong to the subclass I created. How I go around this?

sentences:
2d Tile Movement and Camera Let's imagine we have a 60x60 grid (where a Tile is 64x64px). Within the viewport there should be 10 tiles. The player object is 32x32px.

To have smooth movement, I have to take delta time in consideration; and do something like:

this.player.x += 5 * dt;

To calculate viewports:

vX = parseInt(this.player.x); - Math.floor(0.5 * 10);
  if (vX < 0) vX = 0;
  if (vX+10 > 40) vX = 60 - 10;

  vY = parseInt(this.player.y); - Math.floor(0.5 * 10);
  if (vY < 0) vY = 0;
  if (vY+10 > 40) vY = 60 - 10;

And to render position of player:

this.context.rect((this.player.x - vX) * 64, (this.player.y - vY) * 64, 32, 32);

However I cannot get the math right.

How can I determine which tiles that should be rendered based on Canvas coordinates, in context to where the Player "actually" is on the tile grid. Basically I want to achieve this: https://stackoverflow.com/questions/11464550/html5-creating-a-viewport-for-canvas

But with smooth movement (and not jumping to one tile at a time).

sentences:
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:
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 implement jumping in a 2D game using bounding box collision? Problem:
I'm trying to implement basic jumping to my 2D game engine, but have failed several times.
Basically what I've done so far is disabling gravity and using a separate function moving the player upwards. The problem with this is that it looks really bad.

I've checked a lot of threads about this, and found one way that should work.
This is by simply adding another force going upwards against gravity. This force should be greater than gravity, but should decrease until the force of gravity is greater again.

The problem is that I am unable to implement it.

My code is written in Javascript and uses html5 canvas for rendering.
Note! This code is only a part of the whole engine.
As for variables:
c_objects - array with all objects the player can collide with
player - object literal with position, width, movement speed, velocity, and the velocity multiplier.

Pseudo-code is good for me, but i'd love an answer in JS.

Code:

// physics module collision
function collision(obj_1, obj_2) {
    var collision = Boolean(
        obj_1.x <= (obj_2.x + obj_2.width)
        && obj_2.x <= (obj_1.x + obj_1.width)
        && obj_1.y <= (obj_2.y + obj_2.height)
        && obj_2.y <= (obj_1.y + obj_1.height)
    );

    // return position booleans
    return {
        collision: collision,
    };
};

function movement(x, y) {
    new_pos.x = player.x + x;
    new_pos.y = player.y + y;
    // check collision for all objects in collision array
    var index;
    var collisions = new Array();
    for (index = 0; index < c_objects.length; ++index) {
        var new_collision = engine.collision(new_pos, c_objects[index]);
        collisions[index] = new_collision.collision;
    }
    var it_collides = collisions.indexOf(true) >= 0;
    if (it_collides == false) {
            player.x += x;
            player.y += y;
    }
}

// velocity & gravity module for adding gravity to an object
function gravity(modifier) {
    if (player.gravity == true) {
        var x = 0;
        var y = 0;
        x = 0;
        y = +(player.velocity * modifier);
        engine.movement(x, y);

        if (player.velocity <= 450) {
            player.velocity = (player.velocity * player.velocity_m);
        }
        else {
            velocity = 450;
        }
    }
};

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

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

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

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

Has anyone tackled this issue. Are we overthinking here?

sentences:
I would like to know how an OpenGL driver will be implemented to learn opengl internals? I'm learning OpenGL and really like to know how the interaction with the Graphics card will be.

I feel understanding how it was implemented in the Graphics driver, will let me know complete internals of the opengl(With this I can know what stages/factors influence my decisions regarding performance in opengl).

Are there any ways for this path to proceed.Does exploring the 'Mesa lib' will help me in this aspect? Am I in the right path?

[I posted this question in SOF but it seems here is the right place for this Question.]

sentences:
Scale DIV with tiles I am trying to create a repeating background. I have a main DIV with a grid of small 16x16 DIVs. I am trying to scale the main DIV in CSS; when the small DIVs simply have a red background color everything works great, but when there is a background image in the small DIVs then borders become visible between the tiles.

This image explains the problem:
http://cl.ly/FpNW/o

Check the HTML in these examples:

With BG-COLOR: http://jsfiddle.net/pTLXw/

With BG-IMG: http://jsfiddle.net/vkpuY/

Does anyone know what is causing this problem and how to fix it? If it is not possible to fix while using DIV, is there another way to do this?

Thanks you so much!

sentences:
Unity2D - Placing text HP and health bar over character sprite I've got a 2D character sprite that I will move through a game board. I want to add over it, in a corner of the sprite, a Text object with the remaining HP of that character and also a health bar. I want those elements to move with the Character. Wherever the character moves, the UI follows.

I've tried adding a Text element in World Space and attaching it to the character sprite, but the Text is so huge that it's not displayed properly on top of it. I need to know how to adapt that text to the size of the sprite and how to make it follow it automatically. I guess that by setting the ch sprite as parent of the Text/canvas it would work, but I don't know how to get it working.

Thanks in advance

sentences:
How can I make my units follow predetermined paths? I'm planning my first game and am planning on using the engine set out in Beginning Android Games, as it deals with a load of stuff that is just noise at the moment to me (because I've no real world experience yet).  There's no real time restraint - this is a learning experience more than a real world project, although I would love to be able to release something at the end of this project.

The way the book tells me how to do movement has been very much acceleration and velocity based with other forces thrown in (wind, gravity etc) but it's not covered how I can set a predetermined path for an enemy to follow.  I was thinking that I could use a lookup table to map points for the enemy to head for, and then I'd just need a way of smoothing out the turning so that the motion is fluid.  Is this the correct approach?

I know this is a bit of a vague question, and I would give you some code, but I'm very much in the planning phase at the moment, so I'm just looking for some pointers or things to think about whilst I'm trying to work out how it's all going to hang together.

sentences: How to sync the actions in a mutiplayer game? I connect the clients with UDP (its a peer to peer connection on a multicast network) and the clients are sending their positions in every frame (in WP7 it means the default 30 FPS) to each other. This game is kinda a pong game, and my problem is the next: whenever the opponent hits the ball the angle will not be the same on both mobiles. I think its because the latency (1 pixel difference can cause a different angle). So my question is: how can I sync the hitting event?

sentences:
Deferred rendering and gaussian blur - artifacts I compute Gaussian blur in two passes (horizontally and vertically). Shaders look like this:

Horizontal blur - fragment shader:

#version 420
layout (location = 0) out vec4 outColor;
in vec2 texCoord;
float PixOffset[5] = float[](0.0,1.0,2.0,3.0,4.0);
float Weight[5] = float[]( 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 );
float scale = 4.0;

uniform sampler2D texture0;
uniform vec2 screenSize;

void main(void)
{
    float dx = 1.0 / screenSize.x;
    vec4 sum = texture(texture0, texCoord) * Weight[0];
    for( int i = 1; i < 5; i++ )
    {
        sum += texture(texture0, texCoord  + vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
        sum += texture(texture0, texCoord - vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
    }
    outColor = sum;
}

I use deferred rendering and the following
screens shows a diffuse material texture after blurring. I simplified a render loop for the sake of clarity(only one render target - a diffuse material).

A render loop - first case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
read a temporary texture, vertical blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, render to the default framebuffer (full screen quad)

The final image has artifacts(flickering pixels). Some of them are placed between two  triangles which create the full screen quad.

A render loop - second case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

Some artifacts may appear between triangles:

A render loop - third case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

The final image doesn't contain artifacts.

How to fix that ? The above code is simplified but normally the first case(render loop order) is most useful, for example: I want to blur a glow texture and use it when shading.

sentences:
Modern opengl for direct3d programmers I don't think this is quite the same questions as this one but if you disagree feel free to close this :)

With SteamOS being announced yesterday I can see that it's entirely possible that opengl will get a big boost in usage in the near future. Now I already know direct3d11 quite well but I think maybe it's time to learn opengl too.

Are there any good resource for learning modern opengl that are aimed at programmers who already know direct3d11 pretty well. So don't need any education on the concepts and math, just on how to use the API and any important differences?

sentences:
How do I get this effect in Unity3D? Here is a mockup of a main menu screen I'm trying to put together in Unity.

I'm clueless as to how I should go about creating the blue glow on the left of my menu options.  Can somebody point me in the right direction?

sentences:
Correct way to export from blender to ogre format? When I export from blender to ogre using the blender2ogre add-on, I'm not getting anything besides a scene most of the time and when I get a mesh I never get a material. Is there something wrong with my export procedure or what else could I be doing wrong?

Update

I can export the basic cube from blender to ogre but when I download a model and try to export it I don't get the meshes.

Update 2

I tried again and selecting the model in Blender does the difference like the answer here says. I can export an alien and get the mesh and material:

I rename the files:

$ ls workspace/DungeonWorld2/assets/objects/creatures/alien/
Cube.001.mesh          Material.002.material  Material.005.material
Cube.001.mesh.xml      Material.003.material
Cube.001.skeleton.xml  Material.004.material
dev@dev-OptiPlex-745:~$ ls workspace/DungeonWorld2/assets/objects/creatures/alien/
alien.mesh          Material.002.material  Material.005.material
alien.mesh.xml      Material.003.material
alien.skeleton.xml  Material.004.material
dev@dev-OptiPlex-745:~$

But how do I actually load the material since the alien now turns up in the game with no material but it does render the mesh:

    Spatial model3 = assetManager
            .loadModel("objects/creatures/alien/alien.mesh.xml");
    model3.scale(0.3f, 0.3f, 0.3f);
    model3.setLocalTranslation(-40.0f, 3.5f, -20.0f);
    rootNode.attachChild(model3);

sentences:
Unity Surface Shader: Conditinally noforwardadd I'd like to have this in my shader:

#if SHADER_API_MOBILE
#pragma surface surf Lambert noforwardadd
#else
#pragma surface surf Lambert
#endif

But this tries to compile both #pragma surface and ignores the second one instead of respecting the #if condition.

Anyone know how to add "noforwardadd" to a shader, but only when it's compiled for mobile platforms?

Thanks!

Allen

sentences:
How Do Day Night Cycles Work? I know that this is a vage question, but how do day night cycles work in video games? How do I get started programming one? I have researched for a while, but the only thing I saw was "unity 3-d day night cycle". I need just a basic concept.

Edit:
I mean how to make it appear visually. I'm sorry for not saying that first.

sentences:
Draw line around mesh with defined width at cut plane I want to display a solid line around mesh with a defined width at a cut plane. Currently I realized that using the same method as gl_ClipDistance works using dot() operation. However, the output is not what I want since the line width changes depending on angle between the current triangle and the plane. There are also some bad aliasing effects. My guess is that the abs(factor) < 0.1 is wrong here but I also dont know any other alternative. I'm fairly new to shaders...

How can I solve that issue?

Current output:

It should look similar to that output:

Fragment-Shader:

#version 330 core

out vec4 fragColor;

in vec3 Normal;
in vec3 FragPos;

uniform vec4 clipPlane0;

void main() {
  float factor = dot(vec4(FragPos, 1.0), clipPlane0);
  if (abs(factor) < 0.1) {
    fragColor.rgb = vec3(1, 0, 0);
  } else {
    fragColor.rgb = vec3(0, 1, 0);
  }
}

sentences:
How to edit a Rigged 3D Model without Ruining the Rig? I have some rigged 3D models that I want to use. They came as .fbx. and sometimes I want to make some minor edits such as merging/moving/removing some vertices or something of that nature.
The Problem: That (using Unity & Blender) I cannot seem to be able to make changes to a 3D model without ruining the model's Rig.
Blender's importing seems to be the problem, if you care to take a look - but it may be unfixable.

(The first picture is what happens because Blender f*#ks up the the
leaf nodes, the 2nd is me trying to reattach the mesh to a Rig)

I have been completely stuck for a full day; however, it would seem that there are several potential fixes/work-arounds for this problem. And I am wondering which of these you would take? These could be:

Figuring out why importing a .fbx into Blender breaks the model. I'm not confident that this is going to happen, so let's discuss other possibilities.
Using Unity / Unity's API, and an unedited copy of the model that is working, apply the changes that I've made to the model, and then (instead of using Blender's broken Rig) somehow apply the Rig of this working model to my edited model, such that the same vertices are attached to the same bones, and new ones are attached to the nearest bone, ect.
Just completely give up on the old Rig and re-rig it in Blender.
Through Unity, somehow applying the vertex changes I've made to the model to the model that does have a working Rig.
Something else that I haven't thought of.

This is frustrating and I want to move on to the next thing already, so if Blender's importing can be fixed I am interested in looking into one of the above work-arounds. What would you advise that I look into?

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:
ECS: removal of group of related components Currently I'm working with LibGDX and using Ashley for ECS. Everything is fine, until i need to remove groups of related components.

Say we have a player that may use different weapons. For now, in my game a weapon is described by one or more components.

For example we have weapons, each is described by its own components:

weapon1: [ c0, c1, c2 ];
weapon2: [ c3, c4 ];
weapon3: [ c5, c6, c7 ];

It's ok when I want to add a weapon. I know which components are required and can put them to entity. The issue comes when I need to replace one weapon with another.

I can deal with if-else when it's only 3-5 weapons. But what if there are 20?

For now, my idea is to have additional component called WeaponComponent.
Which will contain a family (I mean Ashley Family instance) that contains all information i need to remove the unnecessary components.
But for me it looks more like a workaround, not a solution.

So, does anybody know how to deal with this? Are there any other approaches?

UPDATE

OK, For now I have tried  few implementations. And here is the one that seems to be the best for me. I have combined object-oriented and entity-component designes. The WeaponComponent holds a reference to a Weapon implementation. The Weapon implementations know exaclty which components to attach/remove to/from an entity.

interface Weapon {
    void attachTo(Entity entity);
    void removeFrom(Entity entity);
}
class WeaponComponent {
    private Entity owner;
    private Weapon weapon;
    public void setWeapon(Weapon weapon) {
        if(this.weapon != null)
            this.weapon.removeFrom(owner);
        if(weapon != null) {
            this.weapon = weapon;
            this.weapon.attachTo(owner);
        }
    }
}

So, using this design, changing weapons is very easy now. And I don't have to care what weapon is already attached, and how to remove it:
engity.getComponent(WeaponComponent.class).setWeapon(whatEver);.

sentences:
Rendering 10M point that changing position (individualy) at 30Hz i'm able with openTk (vb.net) to draw 10M of points adn rendering it.
The problem is that the bind operation take 114mS on every frame refresh.
I need to refresh the position at 30 Hz , so what can i use for speeder this operation.

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:
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:
Is it normal that "Game.Run" in XNA uses a lot of resources? I have been using the visual studio profiler to optimize my game. I have noticed that the Game.Run method is eating through 93.6% of the overall game resources.

Is this because all of the other functions are called by it in the game? Or is there a problem? I am quite new to the VS profiler and have in the past not used such applications to assist in optimizing.

sentences:
How to set the camera projectionmatrix so that it's 4 rays always exactly hit the corners of a defined plane? I have a camera, and I have a plane.
The plane has 4 corner points.
I need to find out how to change the projection-matrix of the camera so that the projection-rays of the camera always hit the corners of the plane.

The camera and the Plane are supposed to be movable rotateable (if possible)
The Plane is also supposed to be scaleable.

Usage:

I am making a Stereo-3D-Game with Eyetracking where my 2 Eye-Vectors hit the exact same paralax-plane.

That paralax-plane is defined.
So we have the Corner-positions of the Plane.

sentences:
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:
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:
Tracking player on "overview map" I'm working on a city-based isometric game where the player controls a character moving around in the city.
I need to create both an overview map and a minimap similar to both GTA and Mafia 3. Here's a good example:
https://youtu.be/0Jfgjt_1JFg?t=1437 (timestamp)
My question is:
How would you implement such a map? My best guess is to have another camera present a simplified city by switching out material or manipulating with shaders. Another idea was to simple have the map as a drawn image and then "manually" track the player.
Really looking forward to hear you solution!

sentences:
Replacing a sprite for another on runtime (Unity3D) I need to replace the sprite of a face down card for another sprite (of a face up card).

This is the C# script attached to the face down card:

using UnityEngine;
using System.Collections;

public class Entra : MonoBehaviour
{

    public float velocidadDeRotacion = 100.0f;
    public Sprite CartaBase;
    public Sprite CartaDelantera;

    private bool clickActivado = false;
    public void OnMouseDown()
    {
        clickActivado = true;
    }

    // Use this for initialization
    void Start ()
    {

    }

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

        if (clickActivado)
        {
            transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
            if (transform.eulerAngles.y >= 90)
            {
                SpriteRenderer Carta;
                Carta = GetComponent<SpriteRenderer>();
                if (Carta.sprite == CartaBase)
                {
                    Carta.sprite = CartaDelantera;
                    transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
                    if (transform.eulerAngles.y >= 0 && transform.eulerAngles.y <=10)
                    {
                        transform.eulerAngles = new Vector3(0, 0, 0);
                        clickActivado = false;
                        return;
                    }

                }
                clickActivado = false;
                return;
            }

        }

    }
}

As you can see, I rotate the card when I click on it, when the angle reach 90º I stop the rotation and change the sprite, from CartaBase to CartaDelantera.

Right now I have two problems.

When the sprite has an angle of 1º or more, the image breaks. I lose the right half of the image from the center to the right border, and I don't understand why.
Using VS2013 as debugger, I make a step by step walkthrough and when it reach

if (Carta.sprite == CartaBase)

it jumps stright to

clickActivado = false;

So, obviously it's not "seeing" the sprite used by the card. Why???

I'm using this script as reference for the change of sprites.

If you don't understand my problem, you can see live here.

sentences: V8 JavaScript Engine and Mac App Store If I embed the V8 JavaScript Engine in my game is it still possible to distribute it in the Mac App Store?

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: Is there any JavaScript game library good for mobile gaming? I do not know how should I ask this question. I am a very new in this field. I want to learn game development. I want to learn it for Android and iPhone game development. That's why i was looking for JavaScript game engine or libraries. But, I got many. I do not know which one will good for me for 2D or 3D JavaScript game development.

sentences:
Use of solid brushes and CSG in level building Since Quake 1 (I think it was the first), level design tools for FPS games have used solid brushes and CSG operations to define level geometry instead of more conventional poly modeling tools you see in general purpose 3d applications like 3DS MAX.

Why is this? Is it:

More productive for the level designer?
More likely to lead to closed geometry that won't screw up potentially visible set pre-calc?
Results in lower poly count (more cumbersome tools dissuade designers from adding too much detail)?
...

sentences:
How do MMO servers handle a large concentrated number of players? I have a pretty good understanding of how to scale servers but there's one thing I can't quite be sure about is how to manage a lot of players in a concentrated area.

If I have a server which is using multiple threads and processes as long as you limit the amount of players that can join a single game instance then this can scale indefinitely by adding more servers and placing it behind a load balancer.

But MMO games don't work that way because it's broken down into zones that anyone can connect to. So if a massive amount of players all decided to connect to the same zone it would put all of the stress on 1 server.

If you tried to spread the load across multiple servers then you'd run into problems of having to share information between the servers (Such as if player X was connected to sever 1 then all of his movements would also have to be passed on to the players connected to server 2 since server 1 and 2 are managing the load for the same zone).

So I was wondering how do you go about solving this problem? Do you just keep on ramping up the specs for the server on heavily populated zones? Or is there a fast and efficient way for multiple servers to manage the load for the same zone and efficiently share data between the two servers?

sentences:
Using external music mp3 in flash game sorry for my english.
Im relative new to flash game development,
Im creating a game and I need some big size mp3 files.
If I add them into flash, .swf file will be too big.
I guess I need to host mp3 files somewhere and use URL Request?
Where can I upload mp3 files so they are always ready for use?

sentences:
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:
"Breakout" script fails to trigger win after destroying the last brick The behavior I want is that when all the bricks are destroyed, the last brick's OnCollisionEnter2D handler calls SimulateWin(), triggering the next level.

For some reason SimulateWin() is never called.

using UnityEngine;
using System.Collections;

public class Brick : MonoBehaviour {

    public static int brickCount = 0;
    public int maxHits;
    public int timesHit;
    private LevelManager levelmanager;

    void Start ()
    {
        timesHit = 0;
        levelmanager = GameObject.FindObjectOfType<LevelManager>();
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        timesHit++;
        Debug.Log("Collision happened with " + col.gameObject.name);

        if(timesHit >= maxHits)
            Destroy(gameObject);

        if(GameObject.FindObjectOfType<Brick>() == null)//Not entering this if
            SimulateWin();//this is never called
    }

    void SimulateWin()//This is the function that is supposed to be called when all the bricks are destroyed.
    {
        levelmanager.LoadNextLevel();
    }

}

sentences:
How to expose a child node’s texture from the parent in Godot I built a simple scene that I instanciate at will.  Simply a KinematicBody2D as root, containing a Sprite and a CollisionShape2D.  There is a script linked to the root node that basically expose a few properties to describe an orbit and make it move in orbit around its parent.  The point being to make a very basic solar system simulation or anything that requires a node to move around another in a circular fashion.

The movement work fine and I’ve been playing around my scene tree, instancing a bunch and watching them move around as moons of planets, etc.  But the texture is all the same.  If I make children editable, I can go change the texture of the sprite, but I’d like to expose that property from the root node so I can access it directly from the editor.

I tried adding an exposed property with a setter and a getter to assign and retrieve the texture, but it seems to crash Godot completely with this code:

export(Texture) onready var texture setget texture_set, texture_get

func texture_set(newtexture):
    $"Sprite".texture = newtexture

func texture_get():
    return $"Sprite".texture

Is there a solution for that?  Or simply another way?

sentences:
Physics engine and squishing of stacked objects I have a general question that seems to apply to most physics Engines (Box2D, Unity, Matter.js, …). I'm trying to make a tower of rectangular objects that are stacked on the [static/mass=infinity] ground, and the more blocks I have, the more they "squish".

I put together a test case in CodePen, which is reproduced here:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;

//physics vars:
var phys = Matter;
var bod = Matter.Body;
var bodies = Matter.Bodies;
var engine;
var render;
var world;
var optionsForBodies = { // Florian
  restitution: 1,
};

var boxNumber = 0;

// --- TEMP ---
const keyState = {};
window.onkeydown = function (event) {
  keyState[event.code] = true;
};
window.onkeyup = function (event) {
  delete keyState[event.code];
};
// --- /TEMP ---

// Add bodies to matter
function loadMatter(){
  var floor = phys.Bodies.rectangle(100, 225, 200, 50, {isStatic: true});
  var blist = [floor];
  for (var i = 0; i < 13; i++) {
  // for (var i = 0; i < 2; i++) {
    var box = bodies.rectangle(100, 200 - i * 20, 56.8, 20, optionsForBodies);
    blist.push(box);
    boxNumber += 1;
  }
  phys.World.add(world, blist);
}

function drawMatter(name){
  var bodies = phys.Composite.allBodies(world);
  for(var i = 0; i < bodies.length; i++)
  {
    if(!bodies[i].render.visible)
      continue;
    var verts = bodies[i].vertices;
    if(verts.length <= 0)
      continue;
    context.fillStyle = "#aaa";
    context.strokeStyle = "#000";
    context.lineWidth = 2;

    var ofsx = 0, ofsy = 0;
    context.beginPath();
    context.moveTo(verts[0].x + ofsx, verts[0].y + ofsy);
    for(var j = 1; j < verts.length; j ++)
      context.lineTo(verts[j].x + ofsx, verts[j].y + ofsy);
    context.lineTo(verts[0].x + ofsx, verts[0].y + ofsy);
    context.fill();
    context.stroke();
  }
}

function updateMatter(ms){
  phys.Engine.update(engine, ms);
}

function clrCanvas(){
  context.fillStyle = "#fff";
  context.fillRect(0, 0, width, height);
}

var inter;

function init(){
  initMatter();
  clrCanvas();
  requestAnimationFrame(step);
}

function initMatter(){
  engine = Matter.Engine.create();

  world = engine.world;
  world.gravity.y = 3.0;
  render = Matter.Render.create({
    canvas: canvas,
    engine: engine,
    options: {
      width: 400,
      height: 300
    }
  });
  loadMatter();
}

var frameNo = 0;
function step() {
  var SCALER = keyState.KeyA ? 3 : 1;
  var SPEED = 16 * SCALER;
  if (frameNo++ % SCALER === 0) {
    updateMatter(SPEED);
    clrCanvas();
    drawMatter();
  }
  requestAnimationFrame(step);
}

init();
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.11.0/matter.min.js"></script>
<body>
<canvas id="canvas" width="400px" height="400px"></canvas>
</body>

To me what's happening is not obvious and I'd love an explanation in human words, since in real life if you stacked crates they would not squish inside each other, but it's a constant with EVERY physics engine, despite playing with restitution, slop, damping, density and many parameters.

Ideally I'd like those crates to be dense enough to absorb a big part of the shock (=not bounce much) of each other and never penetrate each other.

What concepts am I missing?

In the codepen above, try to select the canvas and then press the 'A' key, which reduces the framerate (increasing the dt from 16ms to 50ms) which increases the forces computed for the objects at each iteration and therefore penetrating even more each other.

Thanks!!

sentences:
How to retrive the original position of an axis to Vector3? float x = Random.Range(-1f , 1f) * magnitude;
        float y = Random.Range(-1f , 1f) * magnitude;

        transform.localPosition = new Vector3(x, y, originalPos.z);

Here I'm trying to retrive the original position of z(without any changes) to the vector3. But in visual studio 2017 is showing an error like this

How to resolve this?

sentences:
Unity Deactivating a gameObject I'm trying to deactivate an GameObject when a certain variable reaches a certain value.
It is an imported FBX and doesnt have a MeshRenderer. I'm trying to stop it now with TheGameObject.gameObject.activate = false; then nothing happens.

Is there any other way to do this or fix this?

sentences:
How to tilt an object(2D) after collision and the rotate continuously I am having trouble rotating and object after collision. The object only transforms to the given angle of rotation once and stops. I would like to achieve in a way that after it has collided with the player object it rotates continuously till its killed after exiting the screen. The OnCollisionEnter2D(Collision2D collision) can't achieve this.

How can I achieve it using the FixedUpdate function?

Here is the code:

namespace Assets.scripts
{
    public class Barmovementscript : MonoBehaviour
    {
        public float Tilt;

        private void FixedUpdate()
        {
        }

        // upon collision the object rotates in a clockwise direction.
        void OnCollisionEnter2D(Collision2D collision)
        {
            if (collision.collider.tag == "Player")
            {
                Tilt += Time.deltaTime * -10;
                gameObject.transform.rotation = Quaternion.Euler(0, 0, Tilt);
            }
        }
    }
}

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:
How do I create a 3rd person camera? I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates.

I have set up my "game" with a separate class for the model/player and a class for the camera. I am fairly new to XNA and most of what I have already got is from a tutorial from my lecturer.

Here is my player/model class:

public class Player
{
    public Model model;
    public Matrix world = Matrix.Identity;
    public Vector3 position;
    public Vector3 direction;
    public Quaternion rotation = Quaternion.Identity;
    public BoundingSphere collision;
    public float speed = 2f;
    public float moveForwards;
    public float moveLeft;
    public float forward;
    Matrix[] transform;

    public Player(Model m, Vector3 iPos)
    {
        model = m;
        position = iPos;
        direction = new Vector3(0, 0, 1);
        transform = new Matrix[m.Bones.Count];
        m.CopyAbsoluteBoneTransformsTo(transform);

        foreach (ModelMesh mesh in m.Meshes)
        {
            collision = BoundingSphere.CreateMerged(collision, mesh.BoundingSphere);
        }
    }

    public Player()
    {

    }

    public BoundingSphere getSphere()
    {
        return collision.Transform(world);
    }

    public void sampleInputMovement(GamePadState player)
    {
        moveForwards = (player.ThumbSticks.Left.Y / 5);
        moveLeft = (player.ThumbSticks.Left.X / 32) * -1;
    }

    public void update()
    {
        rotation *= Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), moveLeft) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), moveForwards);

        Vector3 motion = Vector3.Transform(direction, rotation);
        position += motion * forward;
        world = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix projection, Matrix view)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.Projection = projection;
                effect.View = view;
                effect.World = transforms[mesh.ParentBone.Index] * world;
            }
            mesh.Draw();
        }
    }
}

And here is my camera class:

 public class Camera
{
    Vector3 position;
    Vector3 newposition;
    Quaternion cameraRotation;
    Vector3 targetOffset = new Vector3(0, 1f, -6f);

    public Matrix view = Matrix.Identity;
    public Matrix projection = Matrix.Identity;

    public Camera(Game game, Vector3 xPostion)
    {
        position = xPostion;

        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000000f);
    }

    public void update(Matrix targetWorld)
    {
        Quaternion rotation;
        Vector3 target;
        Vector3 scale;

        targetWorld.Decompose(out scale, out rotation, out target);
        cameraRotation = Quaternion.Lerp(cameraRotation, rotation, 0.15f);
        newposition = Vector3.Transform(targetOffset, targetWorld);
        position = Vector3.SmoothStep(position, newposition, 0.8f);

        Vector3 cameraup = Vector3.Transform(new Vector3(0, 1, 0), Matrix.CreateFromQuaternion(cameraRotation));
        view = Matrix.CreateLookAt(position, target, cameraup);
    }
}

Could someone help me get my camera in the correct position?

sentences:
Scrolling background loop 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 inbetween 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 (which loops, but with a black bar in between the background image)

 GeneralTransform gt = bg1Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);
        Point bg1Offset = gt.Transform(new Point(0, 0));

 GeneralTransform gt2 = bg2Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);
        Point bg2Offset = gt2.Transform(new Point(0, 0));

 bg1.TranslateX -=  playerVel.X; //bg1 and bg2 are the composite transforms for the canvas
 bg2.TranslateX -=  playerVel.X;

 if (bg1Offset.X < -bg_width)
     bg1.TranslateX -= bg1Offset.X - bg_width;
 if (bg2Offset.X < -bg_width)
     bg2.TranslateX -= bg2Offset.X - bg_width;

Any ideas?

Edit - Updated code
Edit 2: New code with three images (all same width). Works for the first few scrolls, then suddenly stops working and no background is displayed.

if (bg1Offset.X < -bg_width )
                bg1.TranslateX = bg3Offset.X+bg_width;

            if (bg2Offset.X < -bg_width )
                bg2.TranslateX = bg1Offset.X + bg_width;

            if (bg3Offset.X < -bg_width)
                bg3.TranslateX = bg2Offset.X + bg_width;

sentences:
Orthographic Camera Movement inside Rotated Boundary Rectangle Weird Behaviour [Unity3d] Basically I have an orthographic camera that is looking at a simple square. The camera is sitting above the square and tilted by x: 45° and y: 45°, so the camera sees the square as a rhombus / diamond shape.
I want the camera to be moveable within a rectangular boundary that appears to be leveled with the camera, so it would need to be rotated by 45° around the y-axis (up-vector in Unity) in World-coordinates. I already figured out the math to constrain the camera to this shape, but there is a weird thing going on when the movement gets clipped: The camera doesn't follow the outline perfectly, but in a rounded shape (see screenshot). Could this be due to a rounding error? Code snipped below.

using System;
using UnityEngine;
using static UnityEngine.Mathf;

public class InputController : MonoBehaviour
{
    private const float CamHeight = 10f;
    [SerializeField] private GameObject gameBoard;
    [SerializeField] private GameObject camBounds;
    [SerializeField] private float camBoundRadius = 5f;
    private Vector3 _camOrigin;
    private MeshCollider _collider;
    private Vector3 _difference; // Change in position of mouse relative to origin
    private Camera _mainCamera;
    private Vector3 _origin; // Place where mouse is first pressed
    private Plane _worldPlane;

    private void Start()
    {
        _mainCamera = Camera.main;
        if (_mainCamera is null) throw new Exception("No main camera could be found!");
        // Set the camera so that the board is always in the center
        _camOrigin = new Vector3(
            -CamHeight / Sqrt(2f),
            CamHeight,
            -CamHeight / Sqrt(2f));
        _mainCamera.transform.position = _camOrigin;
        _collider = gameBoard.GetComponent<MeshCollider>();
        _worldPlane = new Plane(Vector3.up, 0); // For dragging the camera around
    }

    private void LateUpdate()
    {
        if (Input.GetMouseButtonDown(0)) _origin = MouseWorldPosition();
        if (Input.GetMouseButton(0))
        {
            _difference = MouseWorldPosition() - transform.position;
            var newPos = _origin - _difference;
            var absDiff = newPos - _camOrigin;

            var angle = Angle2Pi(Vector3.right, absDiff);
            var constraint = SawTooth(angle);

            if (absDiff.magnitude < constraint)
                transform.position = newPos;
            else
                transform.position = _camOrigin + absDiff.normalized * constraint;
        }
    }

    private Vector3 MouseWorldPosition()
    {
        var clickedPoint = Input.mousePosition;
        var ray = _mainCamera.ScreenPointToRay(clickedPoint);
        var worldPos = Vector3.zero;

        if (_worldPlane.Raycast(ray, out var raycastHit)) worldPos = ray.GetPoint(raycastHit);

        return worldPos;
    }

    private float SawTooth(float theta)
    {
        var x = 4f / PI * camBoundRadius * (1f - 1f / Sqrt(2f));
        x *= Abs(theta % (PI / 2f) - PI / 4f);
        x += camBoundRadius / Sqrt(2f);
        return x;
    }

    private static float Angle2Pi(Vector3 from, Vector3 to, Vector3 normal = default)
    {
        if (normal == default) normal = Vector3.up;

        var angle = Vector3.Angle(from, to) * (PI / 180f);
        var sign = Sign(Vector3.Dot(normal, Vector3.Cross(from, to)));
        angle = 2f * PI - angle * sign;

        return angle;
    }
}

sentences: Multiple game frames in construct 2 for new levels? Hi there I'm new to Construct and have tried out a few platformer tutorials. I'm getting to grips with setting variables and collisions, I'm now at the stage where I want to start adding new levels. What the best way to effectively go to a new level, I know in flash this would be a new frame on the timeline, what would you do in construct 2?

sentences:
How can I load a file in memory on the Apple IIGS? I recently got an Apple IIGS and have it booting GS/OS off of a compact flash with 10 32MB ProDOS volumes. It's a great little setup and I've installed ORCA/M, 816 Paint, Merlin 16+ and Complete Pascal (also known as TML Pascal II) so I can get started programming games for it.

My first goal, for now, is to just display an image on the screen that I've saved from 816 Paint. But I don't even know how to load a file as binary into memory. How can I accomplish that using Pascal and the other tools I've listed above?

sentences:
Store game events data with XML I am new in the game development and now I am at the stage when you need to fill the game content. I want to create the events that occur with the player (like in FTL). Now I make these events with the help of hardcoding, but I understand that this is a very bad style. I know there is another way, use data in XML files. Here is an example:

 <event name="SIMPLE_EVENT">
  <text>Event text</text>
  <battle name="MONSTERS_WEAK"/>
 </event>

This event show a dialog window and start battle with a random weak monster. I understand how to make this XML files, but I not so experienced with C# to write code that will convert data from XML to my C# classes. How to convert this xml to C# methods invocation? Something like: ShowDialogWindow("Event text"); StartBattle("MONSTERS_WEAK"); Another example is:

<event name="ADD_FUEL">
 <text>Adding fuel</text>
 <item_modify>
     <item type="fuel" min="2" max="2"/>
 </item_modify>
</event>

This event show dialog too and add some fuel to the player.

I think its a some deserialization task? Anyway similar as FTL I need one class to represent all events in the game, using different XML data. I ask some advice with this, maybe tutorials, pattens or examples? Or maybe another solution of my task?

sentences:
Why is Spritebatch drawing my Textures out of order? I just started working with XNA Studio after programming  2D games in java. Because of this, I have absolutely no experience with Spritebatch and sprite sorting. In java, I could just layer the images by calling the draw methods in order. For a while, my Spritebatch was working fine in deferred sorting mode, but when I made a change to one of my textures, it suddenly started drawing them out of order. I have searched for a solution to this problem, but nothing seems to work. I have tried adding layer depths to the sprites and changing the sort mode to BackToFront or FrontToBack or even immediate, but nothing seems to work. Here is my drawing code:

    protected override void Draw(GameTime gameTime) {
        GraphicsDevice.Clear(Color.Gray);
        Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);

        for (int x = 0; x < 5; x++) {
            for (int y = 0; y < 5; y++) {
                region[x, y].draw(((float)w / aw)); // Draws the Tile-Based background
            }
        }

        player.draw(spriteBatch, ((float)w / aw));//draws the character (This method is where the problem occurs)
        enemy.draw(spriteBatch, (float)w/aw); // draws a basic enemy
        Game1.spriteBatch.End();
        base.Draw(gameTime);
    }

Player.Draw():

public void draw(SpriteBatch sb, float ratio){
        //draws the player base (The character without hair or equipment)
        sb.Draw(playerbase[0], new Rectangle((int)(pos.X - (24 * ratio)), (int)(pos.Y - (48 * ratio)), (int)(48 * ratio), (int)(48 * ratio)), new Rectangle(orientation * 48, animFrame * 48, 48, 48), Color.White,0,Vector2.Zero,SpriteEffects.None,0);
        //draws the player's hair
        sb.Draw(playerbase[3], new Rectangle((int)(pos.X - (24 * ratio)), (int)(pos.Y - (48 * ratio)), (int)(48 * ratio), (int)(48 * ratio)), new Rectangle(orientation * 48, animFrame * 48, 48, 48), Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
        //draws the player's shirt
        sb.Draw(equipment[0], new Rectangle((int)(pos.X - (24 * ratio)), (int)(pos.Y - (48 * ratio)), (int)(48 * ratio), (int)(48 * ratio)), new Rectangle(orientation * 48, animFrame * 48, 48, 48), Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
        //draws the player's pants
        sb.Draw(equipment[1], new Rectangle((int)(pos.X - (24 * ratio)), (int)(pos.Y - (48 * ratio)), (int)(48 * ratio), (int)(48 * ratio)), new Rectangle(orientation * 48, animFrame * 48, 48, 48), Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
        //draws the player's shoes
        sb.Draw(equipment[2], new Rectangle((int)(pos.X - (24 * ratio)), (int)(pos.Y - (48 * ratio)), (int)(48 * ratio), (int)(48 * ratio)), new Rectangle(orientation * 48, animFrame * 48, 48, 48), Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
    }

the game has a top-down perspective much like the early legend of zelda games. It draws sections of the texture depending on which direction the character is facing and the animation frame. However, instead of drawing the character in the order the draw methods are called, it ends up drawing the character out of order. Please help me with this problem.

sentences: In UE4's Blueprints, how do I activate something when the player looks at it? I want to make an object that activates when the player presses a button, then looks at it. How can I do this using Blueprints Visual Scripting?

sentences:
For creating a distant moon in a 3D game, is it better to use a model or texture? I'm working on my indie game and I want to create a moon (it's a 3D game) however I am unsure if I should create a model and put it far away, or if I should use a texture on a plane and have it constantly move so the face of the plane is facing the player.

The problem I had last time I tried a model is the render view, as the model was really far away (as when I did it very small, you could sort of tell it was a tiny model rather then a far-away moon) and with the texture I'm not sure if it comes across as tacky.

I'd really like to hear the pros and cons of each, since I'm planning to use the 'render objects only when in view' method and basically want advice on which I should go with.

sentences:
How to develop a concept to receive funding? I have a game concept which I wish to develop but don't have the funding to begin it.

What should I do?

sentences:
Making sprites move in oppsite direction of vector I have a sprite that moves from the bottom left of the screen to the top right. What I want to know is how would i make it turn around and go in the opposite direction, and continue this loop.

I tried negating  the direction of the vector but that doesnt work.

This what i have right now:

public void create() {
    // Game Initialization
    v = new Vector2(Gdx.graphics.getWidth() - 0, Gdx.graphics.getHeight() - 0);
    v.nor();
    v.scl(100);

    spriteBatch = new SpriteBatch();
    bug = new Sprite(new Texture("EnemyBug.png"));
    bug.setSize(50, 85);
    bug.setOrigin(0,0);//Gdx.graphics.getHeight() / 5, Gdx.graphics.getHeight() / 5);
    bug.setPosition(1,1);//Gdx.graphics.getWidth() - 50, Gdx.graphics.getHeight() - 50);
    bug.rotate(v.angle());

    rotDeg = 5;
}

@Override
public void render() {
    // Game Loop

    Gdx.gl.glClearColor(0.7f, 0.7f, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    spriteBatch.begin();

    if(bug.getX() >= (int)(Gdx.graphics.getWidth() - 100) && bug.getY() >= (int)(Gdx.graphics.getHeight() - 100)){
        turn = !turn;
    }
    else if(bug.getX() <= 50 && bug.getY() <= 50){
        turn = !turn;
    }

    if(!turn){
        bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime());
    }
    else{
        bug.translate(-(v.x * Gdx.graphics.getDeltaTime()), -(v.y * Gdx.graphics.getDeltaTime()));
    }

    bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime());
    bug.draw(spriteBatch);
    spriteBatch.end();
}

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 to access internal data from separated rendering-layer? I am currently rewriting a project I have been working on last year and I’m utterly stuck trying to "correctly" separate the game-logic from its representation. I know why this is beneficial and I sort of get how to build the representation into its own subsystem but if you actually encapsulate all the game-states into a different object or even library, how can you draw the scene?

Example:

Say we are working on the Super Mario game. There would perhaps be some Mario-object that encapsulates the different states Mario can enter (e.g. Small, Big, Fire-shooting, Mounted, …). These states are not purely visual since Mario’s movement-speed or damage-handling depends on this.

However, the way Mario is drawn also depends on this very state. So how would the rendering-layer know which sprite to bring onto the screen?

Pretty much everything the game-logic does causes some sort of animation, sound, or other output. In a way, having the drawing-logic mixed with the internals seems to be the cleanest since they really do belong together.

If you do separate the game-logic from its representation, there needs to be a way to access the data. What’s the best way to do that? I could think of these:

Data-binding by using some Event-system

Every time some state in the logic-layer changes, it could publish some event to which all other parts of the game can subscribe to. Upon receiving an Event, they can update themselves and load the appropriate animations.

However, this feels like we’re removing the responsibility of drawing the state onto the screen just to add the responsibility of firing an Event, which might actually be messier: There would be Events for each entity and each state, every spell that can be cast, every changed movement-parameter,  plus every started, finished and interrupted attack – the list is huge compared to a function that “just renders the internal state”.

Also, there is a lot of bookkeeping to be done since each Event needs to manage a list of subscribers, which would probably be an Interface resulting in many indirect calls, which might cause a performance-hit as well.
Access the data from the rendering-layer

The representation-layer could just query the state, either by simple Getters or a complex Entity-Component-System where the data would be accessed plainly, anyway.

It still feels wrong to open up the (encapsulated) state like this, but it seems to be cleaner approach. In another post, I saw the use of the visitor-pattern, which sort of does this as well, but then there would be a Draw()-method on the game-object again, which sort of defeats the purpose, doesn't it?

Any input is highly appreciated cause I really want to stop thinking about it and just get into coding again. :D

Thank you so much!

sentences:
Tower Defense: Sorting Algorithm with multiple weights (enemy AI) I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the tower.
Each incoming enemy, will have an associated {distance_from_tower} and {enemy_weight}. The {distance_from_tower} will be a value between 0 and X (X being the max range of the tower). The {enemy_weight} is a valued weight of "how important" it is to target that enemy mob. For example:
Three enemies:
Archer: {distance_from_tower} = 3 , {enemy_weight} = 1
Knight: {distance_from_tower} = 7 , {enemy_weight} = 5
Zombie: {distance_from_tower} = 10 , {enemy_weight} = 3
Currently, I have a simple sorting algorithm that only sorts enemies by their distance from the tower. (So, in the above example, the tower would target: Archer --> Knight --> Zombie)
Which is a "fine" first logical step, but I want my towers targeting to be more robust. I want the sorting to take into account both the {distance_from_tower} AND the {enemy_weight}. (For reference as well, these two values are updated at every Z seconds during the game, so they are constantly being recalculated).
I would like for the tower to be "smarter" and have a more robust sorting mechanism, that takes into account both weights, as said above. That could potentially lead to the tower targeting an enemy mob that is further away because the {enemy_weight} value of that respective enemy mob is of "high priority". (So, in the above example, the inclusion of using both weights could lead to the tower targeting in this order: Knight --> Archer --> Zombie).
I've been digging around for a few possible solutions, such as using a Travelling Salesman approach, Dijkstra's algorithm, or Floyd's algorithm, and I can't figure out the best way to go about sorting using both weights in a manner that makes sense to me. Any intuition or help is greatly appreciated! Thanks!

sentences:
How are the Unreal Development Kit (UDK) and Unreal Engine 4 (UE4) related? I'm thinking of learning Unreal Engine 4, but it costs money, and I want to try and keep costs as low as possible while I'm learning. In contrast, the Unreal Development Kit is free.

How similar are the two? If I learn UDK first, how easily can I transition to UE4?

sentences:
Latency issue on multiplayer game networking I am currently writing a 2D top-down shooting multiplayer game using Java.
I have a game loop at the client-side that does the following in order in each game tick (The client is running in a tick rate of 60 t/s):

client_gameloop{
    1. Send an input sample (an object storing info about what keys are pressed)
       to the server through a DatagramSocket
    2. Receive info on change in game state from the server
    3. Update the client-side game state through the received info
}

For the server-side, I have a game loop that does the following in order in each game tick (The server is running in a tick rate of 60 t/s):

server_gameloop {
    1. Read an input sample through a single DatagramSocket
    2. Using the input sample to apply physics to the game world and update the game state
}

When I try to connect the first client to the server, the game flows fluently with unnoticeable delay. However, when I try to connect the second client, both first and second client start to lag behind the server greatly (delay ranges from 5s to 10s). I am currently stuck on what causes the delay. Am I handling the sending and receiving of info between client and server in a wrong way that causes game state in the server-side not being able to synchronize with those of clients'?

sentences:
Vector field collision avoidance I'm developing a simple "Geometry Wars" like game: 2D world and multiple enemy spaceships. The enemies should be able to pursue the player and avoid collisions between them at the same time. I've implemented a vector field algorithm based on this one. When two ships are too near between them, a force that slightly modifies the direction of the ship is created.

This works like a charm, the enemies pursue the player and no collision exits, but this happens sometimes:

This is because in one frame they "collide" and the path is modified, but, in the next frame they are not colliding and the path is not altered. This two states in loop cause that shaking.

Do you have any idea to solve this?

PS: if I didn't make myself clear, please ask me, english is not my first language

sentences: How to project a vector onto a plane, but not along plane normal? In 3d space, is there any way to project a vector onto a plane,  but alongside the UP vector (0,1,0) instead of the plane normal? If so, then how do I do that and what is it called?

sentences:
How can large terrains be represented in multiplayer games? To give you a bit of context, I often try and imagine how big games are working, especially networked and multiplayer games. This is how I came to this question: how do big 3D multiplayer games load their 3D, predefined maps? (I am not talking of generated ones, such as in Minecraft, but defined maps that represent, for example, a kitchen).

The most viable hypothesis to me are:

Some basic map terrain is loaded in a .obj file (with just variations of height and of ground material), and then more data (like trees) is added according to another file, stored in a format like xml, which also contains paths to other obj files. This techniques therefore allows modifications of terrain, as well as something like serialization to send data to a new client joining (but it's really heavyweight and hard to implement). Finally, you can base player position on which tile they are, and make easier collision & al (for RTSs for example).
A map containing all data in a single .obj file is loaded by all clients, and they are just allowed to move inside it (is this the case in FPSs like Quake?)

But I think both of these techniques aren't optimized enough for commercial or public use. Do you have any idea of how can these games load their map data?

sentences:
Creating Saving and Loading Materials in Runtime I'm trying to create a material during runtime like this:

In my Assets I have a Render Texture and one Material
I created an Script where I attach the Render Texture to Material
I save in my project a PNG Image File for later use

public void CreateAndSaveMaterial(){

RenderTexture.active = _renderTexture;
Texture2D tex = new Texture2D(_renderTexture.width, _renderTexture.height, TextureFormat.ARGB32, false);
tex.ReadPixels(new Rect(0, 0, _renderTexture.width, _renderTexture.height), 0, 0);
tex.Apply();

File.WriteAllBytes(Application.dataPath + url, tex.EncodeToPNG());

tempObject.mainTexture = tex;
RenderTexture.active = null;

}

*The PROBLEM:

1.The Material works in rutime, after quit playing, the Material resets :(
2.The created PNG File not working only if the file is reimported in Unity, I tried with:

AssetDatabase.CreateAsset(obj, fileName);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();

But unsuccessfully, works only in Editor not in build app :(

Any suggestions?
Thanks in advance!

sentences:
XNA - Debugging/Testing Individual Sprites and Pixel Collision I ran through the first training on XNA where you make a shooter game. They did some thing that I would not do and I want to use their starting point to learn more things.

I want to try better collision and adding a menu. I saw something online with the sonic physics where they have a frame by frame of sonic moving 1 pixel. See picture below.

I am new to development, but I have been programming for years now. What would you guys suggest to try these different things out.

How would I simulate a similar frame by frame testing as they do in the above picture?

Thanks!

sentences:
What information would I need to calculate proper placement of my Unity 3D orthographic HUD elements? I have a Unity project and I have managed to create a 3D HUD by creating a separate (orthographic) camera for rendering elements on the UI layer.  I already have some objects appearing in the HUD and rendering correctly.

What I want to do now is calculate the proper position and scale of these elements to make sure they are in the upper left corner and only take up 60% of the vertical space.

I am optimistic the necessary information is available to C# script components, but I have no idea which formulas and which members or methods (probably on the Camera object) can tell me what the X/Y bounds of the orthographic view are (for whatever the current aspect ratio is).

sentences:
Distribute XNA as a standalone zip or exe (no installer needed)? I want to know how would I distribute my XNA such that it won't distribute as an installer/setup files? I just want a zip of files such that when the user can run instantly after extracting into a folder. I am making a small prototype of some functionalities, and I would like my co-workers to visually see it so that we can communicate better. However, this must means I must frequently release my projects (as I update it frequently), so I want to know a way to produce easy-to-launch distribution.

I tried to turn Build option in Visual Studio to Release, and try copy and zip all the files inside Release folder. However, when I zip it and send to my coworkers, they said nothing comes up after they open the exe.

sentences:
How can I maintain saved game backward compatibility? I have a complex sim game I want to add save game functionality to. I'll be updating it with new features continually after release.

How can I make sure my updates don't break existing save games? What sort of architecture should I follow to make this possible?

sentences:
Unity3d Gravity script issues I'm try this script out

http://wiki.unity3d.com/index.php/Gravity

and I'm having some issues with it (it seemed to work when I tried it with an old version of unity)

the first issue is of collision, the objects (in my case spheres) will stick into each other rather than just touch.

and the second is that when the objects collide one of the objects with continue it's trajectory.

I'm thinking of rewriting the script from scratch unless someone can explain what's wrong with the script that i've got.

sentences:
How should I design my classes in a game? I'm stuck for ideas on classes in game programming. This is probably more of an opinion based question. I'm looking for information that is proving hard to find on the internet.

Say I have a class called  Bullet or Mob, the name doesn't really matter it's just an example. With this, there are two options I can think of.

Have the class purely as a way of storing data and nothing else. So I could have, for example, properties such as EntityID, Velocity, HealthPoints, NumberOfAttacks.
I would then have some other part of the game which iterates through every instance of every object and update the properties from there.

Example: During the iteration, it checks what type of object it is, such as Bullet etc. Once it has checked this, it will calculate where the bullet should move to next based upon the Velocity property.
Or, have the same properties within the class, but also have all the code for updating it's own properties in there too. Example: The bullet has some kind of Update() method which get's called periodically by the game engine. This Update method would then take it upon itself to calculate the new Velocity and update it's position etc.
Some combination of the both? Something else I haven't thought of?

Which of these options is the more commonly used approach in game programming? What are the benefits or disadvantages of these different methods?

Have I got it all completely wrong?

sentences:
libgdx scene2d DelayAction and SequenceAction I'm trying to get the delay action in scene2d working correctly. I have multiple image objects which I store in an array and I have managed to get them all displaying, scaling and moving correctly. I can't however seem to get them moving independently using the delay action.

I have tried using the sequence action and that isn’t working either…

I’m trying to create transition effects using little squares that move off the screen.

I have included a sample of the code im using below:

for (i = 0; i < scaleActions.length; i++) {
    ScaleByAction scaleAction = new ScaleByAction();
    scaleAction.setAmount(-0.1f);
    scaleAction.setDuration(0.5f);

    scaleActions[i] = scaleAction;
}

float increase = 0;
for (i = 0; i < delayActions.length; i++) {
    DelayAction delayAction = new DelayAction();
    delayAction.setDuration(0.05f+increase);
    increase += 0.1;
    delayActions[i] = delayAction;

}

for (i = 0; i < boxArray.length; i++) {
    SequenceAction sequence = new SequenceAction(scaleActions[i],moveActions[i],delayActions[i]);
    boxArray[i].setOrigin(boxW / 2, boxH / 2);
    boxArray[i].addAction(sequence);

    //boxArray[i].addAction(sequenceActions[i]);
    //boxArray[i].addAction(scaleActions[i]);
    //boxArray[i].addAction(moveActions[i]);
    //boxArray[i].addAction(delayActions[i]);
}

public void addToStage() {

    for (i = 0; i < boxArray.length; i++) {

        stage.addActor(boxArray[i]);
    }
}

Everything seems to be moving and scaling at the same time, the delay doesn’t look like it is even working.

Hope you guys can help point out what I'm doing wrong.

sentences: How to test a turn-based ios Game Center game with 2 devices? This might well be a very dumb question, but here goes anyway, I'm planning my turn-based ios game center game, obviously I know I'll need 2 iDevices to test it on, but how would I test the online turn-based play between the devices? As I'm to understand it, if the 2 devices are local (i'e close to each other) they automatically revert to a local communication method? is it possible to force them to communicate online so I can test that part of the project?

sentences:
Game states and events I'm writting a game in C++ and I'm struggling with getting events and game states work together.

By game states I mean something like this

class GameState
{
public:
    virtual void onPause();
    virtual void draw();
    virtual void update();
};

class PauseScreen : public GameState
{
     //stuff
};

class Game : public GameState
{
     //stuff
};

And I've created dope event observer based system where I have simple EventObserver class which has register function to what Event I want to subscribe and EventManager where I have map of vectors of all possible EventObservers (everything made with templates) and callback functions. No pointers, no inheritance - everything works like charm.

So there is my problem - how to connect these? In my main loop I'm getting current active game state - and then updating and drawing it. But for example when state is not active its still receiving event. This is pretty bad beacuse if I have MainMenu gamestate and for example if escape key is pressed it would just exit the game even if I'm currently in Game.

I could only came with some bool checking - if current state is not more active it would disable all EventListeners but I would need to manually call EventListener::disable in all game states for every EventListeners I have in onPause() methods and I don't like this solution (and since it's my hobby project I would like things that I like). I could store EventListeners in vector in GameState interface class so I wouldn't need to disable it manually and just iterate thought it and disable it 'automatically' but I would have to deal with A LOT of templates and naaah I don't wanna do it (just keep it simple).

On the other hand I could add method to GameState handleEvent(Event* event) (well since this is now dynamic memory I would probably prefer to use smart pointers so I don't need to worry when I have to delete event) but then I would have giant switch statement for every game state that I have and this also doesn't seems like good solution. Now I'm just binding one method per one event so everything is nice divided and simple.

So any tips how to design this? Can event observers (or subscribers) work with game states?

sentences:
Incorrect placement of diacritics in Arabic fonts I put AdobeNaskh font on my texts and use Arabic text support for unity and use show Tashkeel function then the text appears so

what is the solution of this problem?

sentences: 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:
Turn-based combat AI with multi turn planning My current AI system uses the now very common utility AI. I generate a list of possible actions, I then calculate fitness score for each action and generate a list of possible chains of actions (Move > Attack > Reload or Use Offensive Ability > Leap backwards). The sum of those scores are then sorted and I pick the most (or not, depending on how smart I want the particular AI player to be) appropriate chain to execute.

The issue that I've run into though is that I'm having issues with more complex interactions that require multi-turn planning. To give an actual example: one of my characters got two spells that can deal massive damage when used in the right order.

1) A buff ability that increases target's Mind attribute (cast on self)

2) A powerful spell that deals damage based on your Mind (cast on the enemy)

Both of those actions cost a lot of Action Points and so you can't execute them both in one turn. A very obvious combo is to use the buff and then the damage spell, but if both of those actions are available to the AI, then it always chooses to open with the second action. The buff itself, when considered in isolation, produces a very low fitness score.

A very obvious idea is to then to allow the AI to build chains of actions for two or even three turns ahead. However, this greatly increases the performance cost as I'd have to use similar heuristics for other players to get at least somewhat reasonable gamestate for the AI to go off of. I would also have to think of a fail-safe mechanic for when the player does something unexpected, thus ruining this long-term plan.

Another idea that I had is to let the designer define interesting combos and have the AI see if it can execute one, but it feels messy and a bit hard to implement with the current generic system.

How do the other games do it?

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:
Will using similar/exact name to a current Marvel superhero name for your game be a problem? I have heard that the word 'superhero' is trademarked by marvel and DC and thus we can't use superhero as part of the name of a game we develop. But I wonder do they also have exclusibe rights to all the names of their super hero characters?

For example will people get in trouble if they name their games 'premagneto', 'superwolverine', 'exbeyonder' or 'the cyclop'?

sentences:
How to reverse or create a group sprites pinned to other objects on a specific pattern. Hey guy i am creating a game, where i am facing some problem.

I am creating a sprite, SpriteT on runtime with a rope effect like snake with proper instances. Also am creating Text object pinned on the rope style sprites with instances and need to handle those sprites objects with text instances.

I gave the leadsprite 8 directions where other families are attached to leadsprite.

Now i want is when i rotate the leadsprite to 90 and then to 180 that is top left movement. I need is to compare the instances of equal positions of sprite Whenever i do this the system never compares each value of sprites. i don't know how to compare the elements of one single array that is definately instances to each other's position record and if they match i want to destroy the sprites objects.

this includes i think there must be some pattern now i need to reverse the remaining spriteT to the Leadsprite on the same pattern.. This is where i am lacking whenever i do this

  // On Destroyed
    OnObjectDestroyed() {
     // This contain let 10 number of sprite to attached with the center of one next sprite.
         SpriteTObjectFamily.setPositionTowardsObject(ImagePoint0);
    }

I have just started and a Noob. Please help this is actually doing in Construct2. Any help would be great. Thanks in Advance!

sentences:
OpenGL Array Texture generates black texture I am creating a game using OpenGL that has many textured cubes. I am trying to use an Array Texture to load multiple textures from one file. I tried to setup my texture atlas; however, all that renders is a black texture. I'm not sure what exactly I am doing wrong.

Here is the texture loading code:

    // Load image
    stbi_set_flip_vertically_on_load(true);
    unsigned char *data = stbi_load(path, &width, &height, &nrChannels, 0);
    // Generate texture object
    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1, &textureId);

    glBindTexture(GL_TEXTURE_2D_ARRAY, textureId);

    // Actually load texture
    if (data) {
        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, width, height, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
        //glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
    } else {
        std::cout << "Failed to load " << path << " texture" << std::endl;
    }

    // set texture filtering parameters
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    // Free memory
    stbi_image_free(data);

Here is my fragment shader

#version 330 core
out vec4 FragColor;

in vec2 TexCoord;

uniform sampler2DArray my_sampler;

void main()
{
    FragColor = texture(my_sampler, vec3(0, 0, 1)) * vec4(1.0f);
}

Here is my texture file:

Does anyone know how I can solve my issue?

sentences:
How do I get an object to rotate in world space via RigidBody.AddTorque? I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another way of describing it is that I want to c calculate a torque vector that will rotate the object's yaw and keep it upright regardless of its pitch without rolling it around. This is a problem for me because I want my player to remain upright without ending upside down because they were pitched and decided to turn.

Someone else had posted about the same problem on a different forum but he didn't receive much in the line of help, however he did provide this really helpful image describing the problem:

Notice how the left object is tilted and then rotating with respect to its own local coordinates but the one on the right is rotating with respect to the global coordinates instead of rolling around like the one on the left.

How can I achieve this? Is there something obvious I am overlooking or forgetting? Am I explaining it right?

EDIT:

In the following image the top half illustrates what I want while the bottom half is showing what is actually happening.
What I want is to be able to tilt the player's pitch and have them be able to rotate almost like a turret. I was able to accomplish this for demonstration purposes by first rotating the player and then pitching. Instead what I am getting is if the player tilts their pitch and then turns they start to bank, or in other words they start to roll.

My code looks something like this:

        _rigidBody.AddTorque(Vector3.up * _horizontal *
            RotateImpulse * Time.fixedDeltaTime, ForceMode.Impulse);

        _rigidBody.AddTorque(Vector3.right * _vertical *
            RotateImpulse * Time.fixedDeltaTime, ForceMode.Impulse);

I sincerely  appreciate you all offering to help me with  this.

sentences:
Can a 3g network work for this project and is my understanding correct? I want to make a game for the android phone using unity.  As you can tell by my last post i wanted to use networking to make this happen.  I decided unity would be a good choice and in no time i was able to have two android devices connect to a simple game using unity master server and i was able to see both of my cubes update in real time over both phones.

My end goal is to make a game where you are a sphere and your goal is to knock your friends off the the arena(A sumo game).  The arena will slowly get smaller until only 1 sphere is remaining.  My question revolves around how doable this would be with a 3g network over the phone.  It does not appear that unity3d has bluetooth support for android and i could not find a plugin for it anywhere.  This would be ideal to have bluetooth local networking and if i am incorrect, please tell me.

The way I understand cell phone data transmission is you have your cellphone and it sends the data to the cell tower.  The closer you are to the tower the better.  Does your relative position to one another(Two clients connecting ) matter if you are both in range of the same cell tower?  While my cubes updated just fine I know that 3g can be spotty.  Is 3g viable for this idea?  Is bluetooth usable for android with unity3d if not?

Thank you

sentences:
XNA: Auto-populate content within the content project based on current folder/file structure and content management for large games 1) Is it possible to implement a system where I can simply drop a new image into my content project's folder and VS will automatically see that and bring it into the project for compiling?

2) Similarly, if I wanted a specific texture I could state something like var texture = Game.Assets.Image["backgrounds/sky_02"]; (where Game is the standard XNA Game class and Assets is some kind of content manager statically defined within Game). I know this is fairly simple to implement manually and have done such things in the past (static Dictionary defined within Game) except this only works for relatively small games where you can have all assets loaded at the start without much issue. How would you go about making this work for games where content is loaded and unloaded based on level / area?

I'm not asking for the solution, just how you would go about this and what things you would have to be aware of. Thanks.

sentences:
Unity 3d Animation Flickering We are using 3d bus model for our game in Unity 3d.Animation works perfectly fine on Samsung s3 but some kind of texture flickering occurs on Nexus device.Please help us out how to solve this problem.

Thank you

sentences:
Raycasting - weird lines on walls when ray is facing up or right I am trying to make a raycasting game. Everything is rendered correctly except when the ray is facing up (angle > PI) or facing right(angle > 0.5PI and < 1.5PI) lines are drawn on walls. I am not sure what is causing it to happen but I know that the lines are not affected by the rotation of the player only by the players position. I also tried rounding the rays position but that did not help.
Right and up ray walls.

The walls up close.

Left and down ray walls.

Code:
        let rayX, rayY, rayAngle, rayDeltaX, rayDeltaY

        for (let i = 0; i < this.screen.width; i ++) {
            rayAngle = this.angle - this.fov / 2 + i * (this.fov / this.screen.width)

            if (rayAngle < 0) {
                rayAngle += Math.PI * 2
            }
            else if (rayAngle > Math.PI * 2) {
                rayAngle -= Math.PI * 2
            }

            rayX = this.x
            rayY = this.y

            let stepY

            if (rayAngle > Math.PI) {
                stepY = -this.tileSize
                rayY = Math.floor(rayY / this.tileSize) * this.tileSize - 1
            }
            else {
                stepY = this.tileSize
                rayY = Math.floor(rayY / this.tileSize) * this.tileSize + this.tileSize
            }

            rayX = this.x  + (rayY - this.y) / Math.tan(rayAngle)

            rayDeltaY = stepY
            rayDeltaX = stepY / Math.tan(rayAngle)

            while(true) {
                if (this.Map.map[Math.floor(rayY / this.tileSize) * this.Map.width + Math.floor(rayX / this.tileSize)] == '#') {
                    break
                }

                rayX += rayDeltaX
                rayY += rayDeltaY
            }

            let rayHorizontalX = rayX
            let rayHorizontalY = rayY
            let rayDistanceHorizontal = Math.sqrt((this.x - rayHorizontalX) ** 2 + (this.y - rayHorizontalY) ** 2)

            rayX = this.x
            rayY = this.y

            let stepX

            if (rayAngle > 0.5 * Math.PI && rayAngle < 1.5 * Math.PI) {
                stepX = -this.tileSize
                rayX = Math.floor(rayX / this.tileSize) * this.tileSize - 1
            }
            else {
                stepX = this.tileSize
                rayX = Math.floor(rayX / this.tileSize) * this.tileSize + this.tileSize
            }

            rayY = this.y + (rayX - this.x) * Math.tan(rayAngle)

            rayDeltaY = stepX * Math.tan(rayAngle)
            rayDeltaX = stepX

            while(true) {
                if (this.Map.map[Math.floor(rayY / this.tileSize) * this.Map.width + Math.floor(rayX / this.tileSize)] == '#') {
                    break
                }

                rayX += rayDeltaX
                rayY += rayDeltaY
            }

            let rayVerticalX = rayX
            let rayVerticalY = rayY
            let rayDistanceVertical = Math.sqrt((this.x - rayVerticalX) ** 2 + (this.y - rayVerticalY) ** 2)

            let rayFinalDistance

            if (rayDistanceHorizontal < rayDistanceVertical) {
                rayFinalDistance = rayDistanceHorizontal
                ctx.fillStyle = 'darkblue'
            }
            else {
                rayFinalDistance = rayDistanceVertical
                ctx.fillStyle = 'blue'
            }

            let rayCorrectedDistance = rayFinalDistance * Math.cos(rayAngle - this.angle)

            let lineHeight = this.tileSize * (this.screen.width / 2 / Math.tan(this.fov / 2)) / rayCorrectedDistance
            let lineBottom = this.projectionPlane.centerY + lineHeight * 0.5
            let lineTop = this.projectionPlane.height - lineBottom

            ctx.fillRect(i, lineTop, 1, lineHeight)
        }

Any help would be appreciated.

sentences:
Drawing sprites to a permanent Texture2d using Monogame / XNA I'm working with Monogame to do a 2d sprite engine.  I've gotten it work pretty well where I can move lots of sprites around the screen with the effects and positions that I want.

Last night I tried to add a feature and I can't quite get it to work right.
I'm trying to create permanent trails that the moving sprites can leave behind.  So I have a mostly transparent PNG with some white lines on it called "streak".
The idea is that I set up a new Texture2d surface (called streakoverlay) and I draw the streaks on to it.

I switch back to the back buffer and draw: The background, the streakoverlay, and finally the sprite on top of it.  The streaks should build up over time.
It almost works, but the trouble I have is that streakOverlay seems to clear itself every time.  How I'd like it to behave would be the same behaviour as having the graphics display without this line "GraphicsDevice.Clear(Color.White);" - everything would just pile up in it.

Instead it resets back to the Purple transparent color that is the default for that texture.
Any suggestions?  Here's the core piece of the rendering engine:

GraphicsDeviceManager graphics;
RenderTarget2D streakOverlay;
SpriteBatch spriteBatch;

private Texture2D bkg;
private Texture2D prototype;
private Texture2D streak;

//Initialize
graphics = new GraphicsDeviceManager(this);
GraphicsDevice.Clear(Color.Transparent);
streakOverlay = new RenderTarget2D(GraphicsDevice, 200,200);

//Load Content
bkg = Content.Load<Texture2D>("bkg"); //Background image
prototype = Content.Load<Texture2D>("prototype"); //Prototype sprite that moves around
streak = Content.Load<Texture2D>("blueStreak"); //Trails being left by Prototype sprite

graphics.GraphicsDevice.SetRenderTarget(streakOverlay);
GraphicsDevice.Clear(Color.Transparent); //Attempt to make the streakoverlay is fully transparent.
graphics.GraphicsDevice.SetRenderTarget(null);

//Draw
Random r = new Random();
graphics.GraphicsDevice.SetRenderTarget(streakOverlay); //Switch to drawing to the streakoverlay

spriteBatch.Begin();
//Draw some streaks that should accumulate
spriteBatch.Draw(streak, new Vector2(r.Next(0, 200), r.Next(0, 200)), null, Color.White, 0f, new Vector2(25, 25), 1f, SpriteEffects.None, 1f);
spriteBatch.End();

//Switch back to drawing on the back buffer.
graphics.GraphicsDevice.SetRenderTarget(null);

spriteBatch.Begin();
spriteBatch.Draw(bkg, new Rectangle(0, 0, 2000, 2000), Color.White);    //Draw our background
spriteBatch.Draw(streakOverlay, new Vector2(0, 0), Color.White); //Put the overlay on top of it
spriteBatch.Draw(prototype, new Vector2(_spritePrototype.getX, _spritePrototype.getY), null, Color.White, DegreeToRadian(rotationSprite), new Vector2(25, 25), .5f, SpriteEffects.None, 0f); //Draw the sprite that's moving around.
spriteBatch.End();

base.Draw(gameTime);

sentences:
How can I make sure my game runs on older GPUs than mine? My game must stay at 75fps to be playable (I'm developing for the Oculus Rift) and I'm optimizing with that hardware in mind.

My mid-range Nvidia GTX 650 Ti struggles a little with some Rift demos, but most do OK at medium-low graphics settings. I believe it's a reasonable optimization target if I want to enable more people to play my game.

Now, I've acquired a better-performing GTX 970, but I'd like to still optimize for older hardware. I don't want to be spoiled by my current better performance and develop something that could run only on high-end cards. In a few days, I won't have my old card available to me anymore.

While developing, how can I test if my game still runs at acceptable frame rate on older GPUs?

What I have in mind is to benchmark my GTX 650 now with some software, then underclock my GTX 970 until I get to the older card benchmark score. Is that a good approach? Would it effectively have the same performance?

If yes, what about memory and shader clocks? How can I objectively benchmark them separately?

(If relevant, I'm using Unity and Unreal Engine 4.)

sentences:
Tile set showing grid with lighting Hi so I have this tile set generated procedurally at the start of the scene. When I activate the point light in the middle of the screen I keep getting this grid in the game view, i tried changing the size of the tiles but no luck if I change them before pressing play in the game view.
But if I do it at run time from the inspector the bug goes away , hiding the square of the tile that I have moved...for that tile in particular even just moving it a bit solves it.
This happens in edit and game mode ,and the grid is made of loads of sprites put together.
The import settings of these sprites is dont generate mip maps, no compression. And each of the tiles have the default shader sprite diffuse.
I deactivated gizmos but no luck either

Any idea what can this be ? anything related with baking the light or something? thank you for your help!

sentences:
Using NinePatch in libGDX for Loading Bar I am trying to create images for a loading bar in libGDX. I came across the NinePatch class and I was hoping to use it for this loading bar, since stretching images with a plain Texture or Sprite looks terrible. Does anyone have any examples on how to use this class? I have done some searching around and I've gotten it to work but the image I use just comes through as slightly transparent and gray. It just doesn't look like the same image. The actual loading bar itself seems to work fine as I just set the width of the foreground loading image. Here is the code I am using so far...

// Class vars
private NinePatch loadingBackground;
private NinePatch loadingForeground;

...

// In my constructor
loadingBackground = new NinePatch(new Texture(Gdx.files.internal("loadingback.png")), 8, 8, 8, 8);
loadingForeground = new NinePatch(new Texture(Gdx.files.internal("loadingfore.png")), 8, 8, 8, 8);

...

// Drawing
batch.begin();
loadingBackground.draw(batch, x, y, width, height);
loadingForeground.draw(batch, x, y, loadingWidth, height);
batch.end();

I am open to any other suggestions on how I should implement this as well.

sentences:
Basic Collision Detection Math First a bit of background.  I have yet to read a book on game development, though I do plan on picking one up sometime.

A long time ago I made a simple pong game, followed by a simple Arkanoid-type game.  In both  games I figured the collision detection by comparing the x, y, and z of the ball to the paddle.  I did this calculation for each side of the ball and each side of the paddle.  It was the only way I could think of to do it at the time.

It was something along the lines of:

if (thing.x >= otherthing.x) {
    if (thing.y >= otherthing.y) {
    }
}

And so on.

Is this the normal way of figuring collision detection?  Did I over-complicate it, or is this the basic way that it's done?

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:
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:
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:
How to learn game graphic design for non artist? Possible Duplicate:
  Graphics for non-Graphics Designers

I'm more into the technical aspects of a game like programming, mechanics and algorithms.

I'm no artist but I like to make games independently and I'm finding it hard to make graphics for my games. Is there anything that I could do to recuperate with this?

sentences:
Building a game project in C# for Unity in VS? Say that a project needs to be created from scratch for later use in Unity, for scripts. What is the ideal way to setup this without using a template in Visual Studio?

Can this be created in C# with some simple classes and one or two game loops?

sentences:
C++ Class to Void Pointer, Data Lost? Reaching out yet again for a point in the right direction. Specifically, I am casting a simple struct to a void pointer so it can be sent out on the network, but it is cutting off my second variable for reasons unknown to me. I am likely looking right over it, but a significant lack of caffeine is hiding the answer from me. I have found a few similar threads, notably this one, which has been a great help. I am reasonable certain this is a "newbie mistake" or I am overlooking something exceedingly simply. Like most techs, I've become so lost looking for the "big" answer, that I'm likely overlooking the "small" answer (i.e. 'did you plug it in first?').

Any input is appreciated, so thank you in advance!

/* struct provided */
struct Login_Struct
{
/*000*/ char username[32];
/*032*/ char password[64];
/*096*/
};

void NetWrapper::sendLogin(std::string user, std::string pass)
{
    // ensure size constraints are met
    if( user.length() > sizeof(Login_Struct::username)-1
    ||  pass.length() > sizeof(Login_Struct::password)-1) { return; }

    std::string hashPass = Security::strSHA256(pass); // returns hashed password

    Login_Struct login; // empty struct
    strncpy(login.username, user.c_str(), user.length()); // i.e 'bob'
    strncpy(login.password, hashPass.c_str(), hashPass.length()); // hashed password (64 char)

    char* pData = new char[sizeof(Login_Struct)];
    memcpy(static_cast<void*>(pData), static_cast<void*>(&login), sizeof(Login_Struct)); // serial data for sending
    m_network->send(pData, OP_Login); // Network::send(char* d, short opCode)
    delete pData; pData = nullptr; // cleanup
}

Additionally, debug output looks like this (omitted from code for readability, can supply if needed/requested):

NetWrapper::sendLogin: Login_Struct Dump [bob] (bob), [5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8] (password)
DEBUG: username maxlength [32], user length [3]
DEBUG: password maxlength [64], pass length [64]
DEBUG: pData [x=�i=], [0x7ffc5e4fd0e0], sizeof(Login_Struct) [96], sizeof(login) [96]
NetWrapper::sendSerialized: New pData! pData [x=�i=]
NetWrapper::sendSerialized: Post memcpy! pData [bob]
Network::send : Sending [d0c8504000100bob] ## ignore characters preceding "bob"

sentences:
How should one design an analytics system for an online multiplayer game? For my simple MMO, the MySQL database stores things like user experience, user level, user coins, health points, etc.

We wanna have an analytics system that can show me trends through daily averages, medians, totals of different stats and actions of the game's user base.

Some answers that need to be answered by this analytics system:

Average health points over time
How many users are what level over time
How many quests were started by users over time vs how many were completed
Cohort analysis on certain groups of users

I was looking into BI systems and thought maybe building an OLAP database with a star schema might be appropriate. But I'm not sure what are good dimensions to use for this and how to deal with changes to the transactional database over time. And it seems like a lot of work to build out a ETL and reporting system as well.

Anything else that's simpler and yet still robust? Are key-value datastores a good option?
What are some commonly used systems for doing this type of analytics?

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:
Unity - How to don't ignore a layer when Raycasting? For example: Physics.Raycast(ray, out hit, range, layerMask), let's say layerMask = groundMask. What I want to do is only return true if it didn't hit a ground mask. Like what I mean is like "Ignore raycast except groundMask". Is there anyway to do this?
Some example:
origin ------------ (groundmask) -------- (other mask) --- // return false;
because there is a ground mask in a range
origin ---------------------------------- (other mask) --- // return true;
because there is no ground mask in a range

sentences:
Random enemy placement on a 2d grid I want to place my items and enemies randomly (or as randomly as possible).  At the moment I use XNA's Random class to generate a number between 800 for X and 600 for Y.  It feels like enemies spawn more towards the top of the map than in the middle or bottom.  I do not seed the generator, maybe that is something to consider.

Are there other techniques described that can improve random enemy placement on a 2d grid?

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 does Mikktspace work for calculating the tangent space during normal mapping? Increasingly the 3D industry is adopting the standard of Mikktspace for calculating tangent space for normal mapping and other effects which rely on accurate and consistent calculation of tangent space from one application to another. Blender, xNormal, Unity, Substance Painter and Unreal Engine are just a few I can think of which now use Mikttspace. I'm personally attempting to re-code my own projects to adopt this standard as well.

But there are very few resources on how Mikktspace works as it is a relatively new thing. What little resources there are, are usually scarce on details and very technical, not very user friendly to understand, or assume the coder has a certain level of knowledge which is a bit above the average newbie just starting out who needs things explained more carefully.

I am looking for a clear explanation of how Mikktspace works and how to implement it, with a simple explanation of how the maths and code works in a way which is not limited to just one language.

For the sake of example, lets suppose a programmer has a mesh object, with a index of vertices, each with a position, normal and UV coordinate, and list of triangles which reference that index.

For example:

Vertex: { X Y Z NX NY NZ S T }
VertexIndex: A list of Vertex
Triangle: { V1 V2 V3 } (in correct winding order for normal direction)
TriangleList: A list of Triangle

In simple terms, how would one go about calculating per vertex a tangent vector (TX TY TZ) and bitangent vector (BX BY BZ) for each vertex in a way which conforms to Mikktspace?

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:
how to check a condition for too many objects in a list that you dont know count of them I'm working on a defense game that I need a way of knowing if every enemy in a wave is dead. I wanted to use a counter for it:

foreach (GameObject g in group1)
{
    if(g == dead) {
        deadCount++;
    }
}
if(deadCount == allEnemiesInWave)
{
    goToNextWave();
}

but I think it's not a safe or accurate way. Is there any better way?

Edit:
This question is not like Check if all gameobjects are destroyed. In my question, I wanted to make a condition on many objects, in the other one, OP wanted to check if such objects existed.

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:
How does the rectangle bounds (x,y,width,height) in libgdx work? I cant work out how to use the rectangle bounds in libgdx I am currently using the superJumper example and have 2 or 3 examples with that are:

<!--this is the pause button in the top right corner-->
pause Bounds = new Rectangle(320 - 64, 480 - 64, 64, 64);

<!--this is a rectangle resume button in the middle of the
page in the menu that comes up when the pause button is pressed.-->
resume Bounds = new Rectangle(160 - 96, 240, 192, 36);

Basically my question is aimed at the 360 -64 and 160 -96 because I don't know why this is used. I need to create a rectangle that covers the left side of the screen and the same on the right. I want to create some on screen buttons, I have already created the actions for these buttons and I have managed to get them to work but I can't move the rectangles to where I want.

sentences:
LibGDX scene2d good practices I'm developing a game using LibGDX and in a part it has a pretty complex UI for profile selection and stuff. I have some general problems.

I'd like to know good practices when generate good looking layouts using the Scene2d that comes bundled with it. I've found examples online but they don't usually get to the level of complexity that I require. Is the use of a table recommended always? How can I set positions and widths precisely (I've managed to fake it using paddings but there has to be a better way). I'd need something like absolute positioning in CSS.

I need to use different font files, colors and sizes for instance. How can do that in the skin and the use it in my code?

I also need different designs on buttons (different backgrounds). How can I do that?

Also for some reason my text is very bad looking. How can I make it look sharp?

Thanks in advance.

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:
Using Reflection to access an array from a ScriptableObject in Unity I am trying to get access to a set of stored variables inside a scriptible object in Unity. This class (SectorDeclaration) has a method to pull a variable with a string of the variables name from it:

public Weightings[] GetVariName(string variableName)
{
    Type this_class = Type.GetType("SectorDeclaration");
    System.Reflection.FieldInfo fieldtype = this_class.GetField(variableName);
    Weightings[] fieldFind = (Weightings[])fieldtype.GetValue(null);
    return (Weightings[])fieldFind;
}

Here's the error I'm getting:

TargetException: Non-static field requires a target
System.Reflection.MonoField.GetValue (System.Object obj) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoField.cs:108)
SectorDeclaration.GetVariName (System.String variableName) (at Assets/Code/Gameplay Element/level Elements/SectorDeclaration.cs:54)
BaseGameManager.InitializeNPCSystem () (at Assets/Code/Managers/BaseGameManager.cs:87)
BaseGameManager.Start () (at Assets/Code/Managers/BaseGameManager.cs:73)

It works until the code reaches Weighting[] fieldFind = (Weighting[])Fieldtype.GetValue(null); I've used this code in another area but it is not working here, I've tried with System.object obj but it comes up with namespace doesn't contain this type, as well as with the type I am trying to access. Honestly, not sure what's wrong. If you need more information please let me know.

sentences:
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:
How to write a unity script to observe the position of a game object (during scene creation) I want to write a simple Unity script to be notified when a game object is moved, during the creation of the scene.

More precisly, I want to write a Unity script that can recognize when the user click on the blue, or red, or green axis of the selected game object, and then when the user release the click.

If this is not possible, I want to write a script that can recognize when the selected game object position changes.

Are there existing c# listeners that can be used from within Unity to achieve this?

sentences:
Impact of increasing physics simulation rate I am working one Mini Golf game development using Scenekit (iOS). To fix one of the problem with Scenekit, I have to increase the physics simulation rate by 4 times.

Questions:

What is the impact on the CPU requirements?
What are the common advantages and disadvantages of changing the physics simulation rate?
What are the expected problems/issues with such increase in the physics simulation rate?

I would appreciate any suggestion on this topic. Thank you.

sentences: MonoGame WP custom vertex decleration How do I go about implementing and using a custom vertex deceleration in monogame for windows phone 8. I want to be able to store a position, a colour and a normal?

sentences:
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:
Term for a game that used to cost money but is now a public license What is the term for that?
A game that used to cost money but is so old that it is now available for free (though not always open-sourced).

Also, does anyone know where I can find a list of such games?

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:
Find the current player instance from multiple scripts I have the following code used by multiple classes (e.g. Enemy, Scenary, EnemyProjectile etc.) in my game, which seems intrinsically wrong. What are some ways I could write this code once and use it from multiple places?
        GameObject go = GameObject.Find("Player");
        if (go == null)
        {
            Debug.Log("Failed to find Player go");
        }
        else
        {
            _player = go.GetComponent<Player>();

            if (_player == null)
            {
                Debug.Log("Failed to find player component");
            }
        }

I usually have this code in an Awake function but sometimes I do it in a collision event, e.g. for EnemyProjectile grabbing a player handle would often not be required and thus a wasted lookup. Player is a private variable in the class definition of each class.

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

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

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

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

sentences:
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 can I discourage camping while still supporting a "sniper" style of play? I am trying to add features into a third person shooter that suit a sniper style of play, in addition to the current rush/deathmatch style it was designed for. The current gameplay is similar in style to Gears of War and Battlefield, perhaps similar to Call of Duty in terms of combat ranges but a little slower paced. The levels are similar in size to large COD maps, or medium Battlefield maps.

Two things which I was planning to add includes some long sight lines and also some "sniper nests". I am concerned though because these two features can open the door to a lot of camping. Sniping and camping are not the same things in my opinion, but it can be easy for campers to abuse such features for easy gain, when they were intended to promote tactical sniper use. That said, I don't believe in blaming the flaws of a game on a player's choice of play style.

Sniper: Uses long range rifles, may stay in a specific spot that is tactically advantageous at the time, but knows how to move to other locations good for sniping. Provides spotting and suppression for more offensive/rush style team members.

Camper: May use any weapon, always stays in the one spot and waits for players to pass by, leading to easy low risk kills. Follows the same strategy regardless of what is happening in the game/match. Is more focussed on own performance as opposed to supporting team members.

So, I am trying to think of some ways in which to try to discourage camping while still allowing legitimate sniper play and preserving the original rush gameplay.

sentences: Unity Erase Image from mouse pointer I want to erase the image for mouse pointer in unity. My pointer should be as a eraser. What is I do create the eraser? My sprite is always change because it provide from the server. Please help me.

sentences:
My unity game fails to open in my mobile I'm new to Unity, and want to make a android game. I made a very simple scene:

A sphere
A cube (floor)
A simple script that moves the sphere by touch.

I tried it with unity remote and it works fine. But the problem manifests when I build it to test it. When I run it on my mobile, it opens and suddenly gets closed. I don't know what is the actual problem. what should i do?

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:
How to avoid singleton pattern for Event Scheduler? I want to make an Event scheduler for my Game, I basically want to be able to schedule the triggering of a Game Event. This can be a one time trigger, or a periodic trigger (trigger event "E_BIG_EXPLOSION" on a 5 seconds basis...).

It is tempting to think that this may be a good place to use a Singleton, but singletons can be quite evil and they tend to spread like a disease... so I try to avoid them at all cost.

What design would you propose to avoid the singleton usage in this case?

sentences:
Pygame polygon click detection Here is my problem: I am creating a game and I have a board made out of polygons (hexagons). I want to be able to click on the different tiles but I can't find a simple method. I understood how to detect a click on basic surfaces such as rectangle or pictures, but not with more complex shapes like hexagons. Is it possible to do so?
I first searched for a Pygame function close to this but I didn't find any. Then I searched for the sprites, and I think it is possible, but very long. And the last way I found was to simply detect the color. However I don't want to change the color of the tiles.
How can I detect a click on a polygon? (Hexagons specifically)

sentences:
Phong shading blows out things close to white [OpenGL]; is there a way around this? I'm doing per-pixel lighting using the Phong shading model.

In pseudo code this looks like:

vec4 ambientColor = light.ambientIntensity * material.diffuse;
vec4 diffuseColor = light.diffuseIntensity * material.diffuse;
vec4 specularColor = light.specularIntensity * material.specular;
finalColor = (ambientColor + diffuseColor + specularColor);

And you can add in a shadow map or light attenuation easily. Even color the light via the light.xIntensity values.

My problem is that I have a cloud texture that's all white values with varying levels of alpha. This is textured on a sphere. When rendering, what happens is that at the very appex of the light, i.e. the point closest to the light source the following seems to be happening:

When my light.ambientIntensity is at 0.2,0.2,0.2,0.2 I get an ambientColor on the whitest parts of the texture is say 0.2,0.2,0.2,0.2 and on the darkest parts of the texture could be 0.2,0.2,0.2,0.0.
With a light.diffuseIntensity of 1,1,1,1 I will get diffuseColor ranging from 0,0,0,0 (when we're nowhere near the light, i.e. the other side of the sphere) through to 1,1,1,1 when we're on the tip closest to the light and the diffuse color of the material is also full white.
I can skip specular here. Because the end result is now 1.2,1.2,1.2,1.2. The problem is that I'm now losing some detail because any values that should have been 0.8,0.8,0.8,0.8 are now full opaque white.

I understand that this would be desirable under some situations, like using HDR, but in this particular case it's not the result I want.

I'm using OpenGL 4.4 but I assume this problem and a solution is API agnostic.

sentences:
UNITY Prevent 3D Text Render Trough All Object Without Shader im tired of those answer i found trough search engine that just keep saying " the trick is to modify the shader " without thinking because they want to gain reputation , in my case , i have 2 3D text , one of them using special font and the other  one using default font , and the shader to prevent the text render trough all object from http://wiki.unity3d.com/index.php?title=3DText is not working and giving weird white square plus i don't want to change from default Arial font because i want to make them look different , i also cannot use sprite as background because i need to change their color trough script to give some effect , this is my picture showing my problem -- :

If the picture is not clear , go here https://i.stack.imgur.com/hLqC9.png

The menu dropped is at Z = 100 while the background is at Z = 20 , as you see , the text is rendered while the other not ( such as the border , ect ).

And this is the picture when my special font without using the shader

If the picture is not clear , go here https://i.stack.imgur.com/vbrQ1.png

Now the picture of my special font using the shader

If the picture is not clear , go here https://i.stack.imgur.com/hMAR2.png

Is there any possible way to prevent the text rendered without shader / change the background to sprite  ?

Im sorry if this already asked somewhere , i just cannot find it at search engine ( neither here ) .

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:
Patterns on preserving players progress across all player's devices I'm writing cross platform game that is requested to store player progress across all their devices. I'm not talking about implementation details, but overall picture;

What are the patterns for preserving player progress in the least intrusive/distruptive way?

Logging in requires players to make account or share their facebook/gmail address; It is strong entry-obstacle when someone wants "just to try the thing up"
I can make account for player after they played a bit... This way, the user already tried the game and if he like to have his progress saved, they can make an account now. If not - the progress will be saved only locally
I can experiment with some information taken directly from device (when playing from mobile, for example); I believe I can easily access their gmail on Android, and use it for account merging later on
I can give them codes that unlock their progress. They can type them on different machines
They can manually move save file; I don't need to keep it online
They can move save file via cloud provider (like Dropbox/Skybox/GoogleDrive)
Anything else...?

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 do I blink a sprite a few times before it disappears? I need the 3d poop emoji model in the chest on the right to blink, visible-invisible-visible, several times:

This is a 3d gameObject oriented to face the camera, shaded with an unlit material.

I need the object to "blink/flash" to indicate that the item has been obtained. The object needs to be generated the moment the lid opens (done), stay unchanged until the lid pops all the way up (0.2 seconds), and flash 3 times during the 0.6 seconds the lid is up. The object is destroyed the moment the lid starts to come down again.

My code (blinking/flashing is not working)

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

public class ItemBox : MonoBehaviour
{

    bool disabled = false;
    private Animator anim;
    public GameObject item = null;

    void Start()
    {
        anim = GetComponent<Animator>();
        if (!disabled)
        {
            anim.Play("ItemBoxIdleState");
        }
    }

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

    }

    void OnTriggerEnter (Collider other)
    {
        if (!disabled && other.gameObject.tag == "Player")
        {
            anim.Play("ItemBoxGetItemState");
            GameObject itemClone = Instantiate(item, transform.position + new Vector3(0, 0.5f, 0), Camera.main.transform.rotation * Quaternion.Euler(0,180,0));
            Blink(itemClone);
            Destroy(itemClone);
            disabled = true;
        }
    }

    IEnumerator Blink(GameObject obj)
    {
        Renderer objRenderer = obj.GetComponent<Renderer>();
        objRenderer.enabled = true;
        yield return new WaitForSeconds(0.2f);

        for (int i = 0; i < 3; i++)
        {
            objRenderer.enabled = false;
            yield return new WaitForSeconds(0.1f);
            objRenderer.enabled = true;
            yield return new WaitForSeconds(0.1f);
        }
    }
}

Instead of blinking/flashing, the object is just there, doing nothing.

sentences: 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:
XNA HLSL 2D outline shader I have gotten into quite a bit of trouble getting my rendering correct in my tile based 2D game.

  This kind of shader is surprisingly annoying to write, I've heard (we used it in one of our 3D games and kept running into unsightly edge cases). One thing you might want to consider is encoding the outline directly into the sprite texture with a specific color like (0, 255, 255, 0), and just have the shader transform that color when the sprite is selected. Then the shader is a trivial color change, and you have a high level of artist control over the outline and any details you want. https://gamedev.stackexchange.com/a/3822/25297 by "Joe Wreschnig"

I'm trying to do as Joe Wreschnig suggests.

It works fine for the color part, for example if the HighlightState of an object is set to None, then I render the outline transparent so you can not see it.

If the HighlightState is Friendly then i render it as LighGreen, Enemy is Red and so on, the color switching is done with a parameter in the shader as I wanted to draw the objects in one batch (because I have to sort the sprites on Y position to render from TOP to BOTTOM to make sure that a tall object on a tile below another one is rendered on top of the one above).

However, this is where the trouble occurs. I need to change an Effect Parameter depending on the HighlightState of the object that is to be drawn. If I render with any SpriteSortMode other than SpriteSortMode.Immediate, every object will get the outline color of the last rendered object (since it is batched). Sadly, SpriteSortMode.Immediate is not a choice since there can be quite many objects on the screen at one time.

To avoid the issue with the same color upon rendering all the objects as one batch, I thought, why not split the object list into many, one for each HighlightState? This worked terrific, except for one small issue. The Y sorting. If I render them as separate batches, there is no way to tell that one object in one batch should be placed behind another in a different batch or vice versa, which makes me wonder if it feasible to render the outline using a shader or if I have to resort to two sprites per sprite, one slightly enlarged white sprite(color tinted) rendered behind the first one to fake a highlight..

How would I solve this issue in the best manner? If you need code, I will post it but the problem is not really the code I guess, more like the logic itself.

EDIT (SOLUTION):

Based on Nathan's(THANK YOU) answer I managed to implement a shader that can handle different color outlines depending on the state of the object, meaning if it is friendly, an enemy etc.

If you run into this problem yourself, trying to set parameters for each sprite drawn in a single batch and you notice that you only get the last set parameters for ALL the sprites in the batch, it probably be solved.

I for example, wanted to set the outline color individually for each sprite and it worked great using the SpriteBatch.Draw's Color parameter (which sets the vertex color in the VertexDeclaration I assume), I could then use that color in my pixel shader to set the correct outline color.

sentences:
How to seamlessly texture a cube in OpenGL I have been following this site as an intro to OpenGL.

After going through the model obj loading tutorial, I wanted to create my own .obj (a cube) as well as my own texture. Following this blender tutorial I created and textured the cube, and exported the .obj and .dds which I am loading in the OpenGL tutorial program.

My issue is that in both cases, the original tutorial .obj/.dds and my own custom one created with blender, the texture for each face of the cube has a slight black edge around it.

I can't figure out how to change this, so that I have a "seamless" texture around the cube, with no black or white edges.

I'm not sure if this is something that needs to be adjusted in Blender, or in the c++ application. Any help would be appreciated!

sentences:
How do I adjust the origin of rotation for a group of sprites? I am currently grouping sprites together, then applying a rotation transformation on draw:

private void UpdateMatrix(ref Vector2 origin, float radians)
{
     Vector3 matrixorigin = new Vector3(origin, 0);
     _rotationMatrix = Matrix.CreateTranslation(-matrixorigin) * Matrix.CreateRotationZ(radians) *  Matrix.CreateTranslation(matrixorigin);
}

Where the origin is the Centermost point of my group of sprites.  I apply this transformation to each sprite in the group.

My problem is that when I adjust the point of origin, my entire sprite group will re-position itself on screen.

How could I differentiate the point of rotation used in the transformation, from the position of the sprite group?  Is there a better way of creating this transformation matrix?

EDIT

Here is the relevant part of the Draw() function:

Matrix allTransforms = _rotationMatrix * camera.GetTransformation();

spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, allTransforms);

for (int i = 0; i < _map.AllParts.Count; i++)
{
    for (int j = 0; j < _map.AllParts[0].Count; j++)
    {
       spriteBatch.Draw(_map.AllParts[i][j].Texture, _map.AllParts[i][j].Position, null, Color.White, 0, _map.AllParts[i][j].Origin, 1.0f, SpriteEffects.None, 0f);
    }
}

This all works fine, again, the problem is that when a rotation is set and the point of origin is changed, the sprite group's position is offset on screen.

I am trying to figure out a way to adjust the point of origin without causing a shift in position.

EDIT 2
At this point, I'm looking for workarounds as this is not working.  Does anyone know of a better way to rotate a group of sprites in XNA?  I need a method that will allow me to modify the point of rotation (origin) without affecting the position of the sprite group on screen.

EDIT 3
I think if I was able to reset the screen coordinates to (0,0) at my sprite position, it would essentially allow me to re-position the origin without movement.  I essentially need a way to set the current position/rotation, then start from scratch.  Does anyone know if it is possible to make my sprite the new screen origin?

MOVING ORIGIN WITHOUT A ROTATION:

MOVING ORIGIN WITH A ROTATION (notice how it shifted upwards):

sentences:
What are the disadvantages and/or limitations of navigation meshes? I have a lot of materials on navigation meshes, what they are, their advantages over graphs made up of waypoints, etc. However, I haven't seen much information regarding the limitations and the disadvantages of using navigation meshes, other than the obvious time they take to be created manually (which is relatively solved by Recast).

Surely this isn't a completely "magical" technique that presents itself without any drawbacks? Could someone please explain what the limitations and disadvantages of using a navigation mesh over, let's say, a graph made up of waypoints? Or point me in the right direction?

sentences:
Sony PSM SDK's 2D game engine I have started with the Sony PSM SDK this week, I'm interested in creating a little 2D game and have been reading through the web about a so called "2D game engine" integrated into the SDK.

Some information I read suggested that it was added on January 2012, but I have been going through the documentation and haven't been able to find any reference to it.

Does anybody know if they finally introduced the 2D game engine for the PSM SDK?

sentences:
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:
How to make backgrounds for 3D games? I've started to study game design and I couldn't really find an answer for this one. Let's imagine a small level with a nice (non passable) background in the distance. The background has mountains, hills, town and a forest. The background, should it be a part of the skybox? or 2D sprites? or low poly models? What's the best approach?

(...and sorry for the bad english, long day and I'm really tired...)

sentences:
Quake d_draw.s versus d_draw16.s I decided to write my first Quake source port, but I'm a bit confused.

There are 2 rasterization code files: d_draw.s and d_draw16.s.

The first is, as John Carmack said, horizontal 8-bpp span-drawing code. The second is the same, but with 16-pixel subdivision.

Which is more preferable for full-color 320x200 source port?

Do they both feature non-power-of-2 texture distortion?

GL code is not an option, because the target system doesn't feature 3D API.

sentences:
How to get a safe index for glVertexAttribPointer without shader? I'm learning to use VBOs and trying to keep it simple before building up. Trying to do it without writing a shader right now. It looks like this is possible, but I cannot seem to find a way to get the index parameter for glVertexAttribPointer.

I've seen that you can get the index with glGetAttribLocation, but that function seems to require a shader be passed in to get the index.

I don't want to assign the index, because I'm worried about different pieces of a project accidentally using the same index and causing problems. (If there's some reason I shouldn't be worried about that, please let me know)

Question is: Without using shaders and without assigning the index, how can I get the index for glVertexAttribPointer?

sentences:
Do Game-Maker scripts save the variables or are they deleted after excecution? When i make a script that excecutes at the beggining and has a var ammo and that finishes excecution, will i be able to call the var ammo in other scripts or it will be deleted? If it will not be deleted, will I be able to change its value on other scripts?

Thanks in advance.

sentences:
How to search for all uGui scripts in scene in the Unity editor? I have many game objects whose properties I need to edit because of a bug/error.

However, this is very time consuming, because I need to check each game object one by one.

Is there any way to search for all game objects that (for example) contain uGui Scripts in a scene?

sentences:
How to do Colored Lights in CIE XYZ/LUV-like Space? I've a 2d background, some sprites, blitted onto it. And over all that in the final pass I draw colored lights, to make projectiles look cooler. Basically I apply a classic lightmap, which is colored in the process of blitting.

With RGB I used simple, but incorrect code:

//dr,dg,db - source before highlight
//e = light energy
//lr,lg,lb - color filter applied to the light energy
ResultColor = RGB(lighten(dr,e*lr),lighten(dg,e*lg),lighten(db,e*lb));

//light energy divisor (0x100*4*32)
#define EDIV 15
uint8_t lighten(int t, int e) {
  return clamp_byte(t + ((t*e)>>EDIV));
}

Now in CIE-style spaces, instead of RGB, we have luminance coordinate (L in LUV, or Y in XYZ), and two chroma coords, picking the chroma inside the color triangle.

Calculating light in CIE appears to be simple, it is just:

result_light = dst_light*incoming_light

But what about XZ or UV? I tried doing simple averaging:

result_x = 0.5*dx + 0.5*lx;
result_z = 0.5*dz + 0.5*lz;

but it gave too bland of a result, compared to the original RGB color-filter:

Maybe instead of taking 0.5, these weights should depend on the light component somehow? If so, what is the proper matrix? I'm sure it can exist, because the transform from CIE XYZ to RGB is linear.

sentences:
colliding btRigidBody objects behave strangely when moving slowly I'm trying to use Bullet Physics in my iOS game. The engine appears to be correctly compiled in that the demos work fine.

In my game I have the player's ship and some enemy ships. They're defined as btRigidBody objects and btCollisionObjects and I'm using btSphereShapes for collision.

At 'fast' speeds, collisions appear to happen sensibly - things collide and nothing goes 'weird'. If the speeds are very slow though and the player's ship touches a non-moving object the collision happens, but then the player's ship moves at incredible speed over the next few frames and appears a long distance from where it collided - completely out of proportion to the speed it was moving before impact.

To move the things around I'm using setLinearVelocity() each frame, ticking the physics engine, then using getMotionState() to update the rendering code I have.

Part of the issue might be I don't quite understand how to set the correct mass or what the best speeds are to use for anything. I'm mostly sticking numbers in and seeing what happens.

Should I be using Bullet in this way, and are there any guidelines for deciding on the mass of objects? (am I right in assuming that in collisions heavier objects will force lighter objects to move more)

sentences:
In Cricket games, how is the ball synced with batsman's shot animation? How does the ball hit right at the center of the bat? How does this work? I've been trying to figure this out for quite some time now.

In Cricket games, when the bowler bowls, and batsman takes a shot, how does the ball sync with batsman's shot animation?
For example, let's say the batsman hits a straight drive, how does the ball hit the bat perfectly?

Can anyone help me out with this?

I'm also curious  about how in football games, the player animations sync with the football. How does the player's foot correctly hit the ball?

Thanks in advance.

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 convert this shader from Worldspace into Localspace? Based on this question (LINK)

Shader "Unlit/WorldspaceTiling"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

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

So this has these two issues:

a) If the object moves through worldspace (eg. a moving platform), the texture will appear to crawl along it.
b) Rotating the object won't rotate the texture, so it will tile across it diagonally.

How is this code supposed to be to fix these two problems?
EDIT:
This is what I'm trying to achieve over all:

I have no idea if my current method is good or bad, but its basically:

Use a flat mesh created in blender with UVs unwrapped. They're all basically a bunch of quads with UVs having literally the shape same as the mesh itself.
Attach a material to each mesh in Unity with a particular texture.
Resize, rotate and align mesh into correct size and position.
Use as physics object in a 2D sideview game. May have additional meshes attached to it as non-interactive decorations, but otherwise using the same method to build them.

sentences:
Unity keeps reseting my Input Manager settings Basicaly, title. I want to change the second Horizontal entry in the Input Manager but when I do it won't save the changes afterwards. I rename the second Horizontal axis to "Strafe", and I'm reffering to it in the script like that, but when I run the game I get this error: "Input Axis Strafe is not setup". This is because there's not input axis called "Strafe", because Unity just reset the default settings for some reason. There's no save button on this window, and I actually got it to save one time and it worked, but the next time it didn't and it reset the axis again! How can I avoid this?

I set it up nicely:

Then it screws me over after running the game once:

sentences:
Unity Random.Range not repeat same position I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it?

 var dupeobject : GameObject;

 function Start(){
     yield WaitForSeconds(0);
     var position : Vector3 = Vector3(Random.Range(-50,10),Random.Range(-10,5),Random.Range(-100,20));
     Instantiate(dupeobject,position,Quaternion.identity);
     yield WaitForSeconds(0);
     //Destroy(gameObject);
 }

sentences:
Reversing plane projection texture mapping algorithm I found this algorithm in some old codebase, it takes two triangles from a mesh ABC and PMN, where ABC is the triangle that will be rendered and PMN is an extra triangle that is only used to generate the UV coordinate for ABC and is not rendered.
I am trying to create a reverse algorithm to calculate the PMN triangle positions based on UV coordinates of a triangle and ABC positions of the same triangle.
Vector3f A = /* stored in mesh data */;
Vector3f B = /* stored in mesh data */;
Vector3f C = /* stored in mesh data */;

Vector3f P = /* stored in mesh data */;
Vector3f M = /* stored in mesh data */;
Vector3f N = /* stored in mesh data */;

Vector3f PM = M.sub(P, new Vector3f());
Vector3f PN = N.sub(P, new Vector3f());
Vector3f PA = A.sub(P, new Vector3f());
Vector3f PB = B.sub(P, new Vector3f());
Vector3f PC = C.sub(P, new Vector3f());

Vector3f PMxPN = PM.cross(PN, new Vector3f());

// Calculate the U coordinates
Vector3f U = PN.cross(PMxPN, new Vector3f());
float Mu = 1.0F / U.dot(PM);
float Ua = U.dot(PA) * Mu; /* 1st U coordinate (for vertex A) */
float Ub = U.dot(PB) * Mu; /* 2nd U coordinate (for vertex B) */
float Uc = U.dot(PC) * Mu; /* 3rd U coordinate (for vertex C) */

// Calculate the V coordinates
Vector3f V = PM.cross(PMxPN, new Vector3f());
float Mv = 1 / V.dot(PN);
float Va = V.dot(PA) * Mv; /* 1st V coordinate (for vertex A) */
float Vb = V.dot(PB) * Mv; /* 2nd V coordinate (for vertex B) */
float Vc = V.dot(PC) * Mv; /* 3rd V coordinate (for vertex C) */

Formatted LaTex represention of the same algorithm:
$$
\vec{PM} = \vec{M} - \vec{P} \\
\vec{PN} = \vec{N} - \vec{P} \\
\vec{PA} = \vec{A} - \vec{P} \\
\vec{PB} = \vec{B} - \vec{P} \\
\vec{PC} = \vec{C} - \vec{P} \\
\vec{PMPN} = \vec{PM} \times \vec{PN} \\
$$
$$
\vec{U} = \vec{PN} \times\vec{PMPN} \\
Mu = \frac{1} {\vec{U} \cdot \vec{PM}} \\
Ua = \vec{U} \cdot \vec{PA} \times Mu \\
Ub = \vec{U} \cdot \vec{PB} \times Mu \\
Uc = \vec{U} \cdot \vec{PC} \times Mu \\
$$
$$
\vec{V} = \vec{PM} \times\vec{PMPN} \\
Mv = \frac{1} {\vec{V} \cdot \vec{PN}} \\
Va = \vec{V} \cdot \vec{PA} \times Mv \\
Vb = \vec{V} \cdot \vec{PB} \times Mv \\
Vc = \vec{V} \cdot \vec{PC} \times Mv \\
$$

sentences: Support function of Minkowski Difference I am watching this and if you stop at 7:25, you will find an implementation of the support function. The goal of the function is to give you the farthest point in a given direction. My question is how do we achieve this without looking at all the points in the Minkowski Difference? How is this not an O(m*n) algorithm ? Is there a way to get just the points that lie on the edges (I am asking because in the slide after that he just shows the edge points and not all the internal ones)? Am I missing something ?

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:
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:
How can I speed up slow loading of big levels? I created a level loader that loads levels saved in an XML format. This means I am using an XML parser to read the levels. It works, but slightly bigger levels take too long to load. So now I am looking for a way to speed up loading. I don't need the whole file to be loaded at once, as the player can't see the whole map anyway, so partial loading would be fine.

I thought about a tile based loading mechanism where there are multiple parts of the map, and the loader only loads the part/tile where the user is standing. But I am not sure if that is a good idea.

sentences: Playing a video in AR using Vuforia and Unity 5 I am trying to play a video in augmented reality using Vuforia and Unity5. I followed a few videos but I am still not able to play it. Can anybody help? I get the "error texture icon" instead of the play icon.

sentences:
glGenBuffers is NULL I'm using GLEW 1.13.0, (GLUT), SDL2 and OpenGL 3.3 core.

#include <GL/glew.h>
#include <GL/glut.h>

int main(int argc, char* args[]){
  Engine::init(); // Initializes SDL_GL_* attributes

  glutInit(&argc, args); // Don't know if needed
  glewExperimental = GL_TRUE;
  glewInit();

  WINDOW["main"] = new Window("Test", {800, 600}, false, true);

  GLfloat vertices[] ={
    -0.5f, -0.5f, 0.0f,
    0.5f, -0.5f, 0.0f,
    0.0f, 0.5f, 0.0f
  };
  GLuint VBO[1];
  glGenBuffers(1, VBO); // Here my program crashes as glGenBuffers is NULL
  glBindBuffer(GL_ARRAY_BUFFER, VBO[0]);
  glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

  ...
}

sentences:
Can not access GUIText in instantiated prefab I have a prefab with the following component structure:

Block

Quad
RawImage
GUIText

When I instantiate it and try to access the GUIText, I get the output of 'null'.

Here is the code, I am using to access the GUIText:

public GameObject Block;

GameObject obj = Instantiate(Block, position, orientation) as GameObject;
GUIText myText = obj.GetComponent<GUIText>();
print(myText);

How do I fix this?

sentences:
How does a server receive every player input with a server-authoritative structure? I've been having a lot of trouble understanding networking in fast-paced games. A server has a fixed tickrate, and the server receives input from clients at a fixed rate as well. Let's assume that a client is running at 300fps but is sending 64 updates to the server a second.
Clearly, the client did not send data about every frame, which means that certain inputs were not sent to the server. However, in every networked first-person shooter, the server still seems to pick up every input.

In this image, a client presses W at a certain frame, but that frame's data is not sent to the server.
A possible solution would be to send the server updates equal to framerate. But if a client is playing at a high framerate, they could be sending too much data for the server to handle.
So how does a server receive every input from clients?

sentences: What are some good methods of implementing RTS-style Box selection? I'm scouting around for different methods of implementing a typical RTS box selection. This is for 3D game - so I'm looking for methods for finding units within selection box in 3D world. Here is a quick screenshot of what a box selection looks like in 2D Starcraft:

sentences:
How do you have the clothing mesh hide the body mesh underneath? How do you have the clothing mesh hide the body mesh underneath, to prevent odd patches of body from sticking out in tighter modular clothing?
Is there some sort of shader trick that can have the clothing always render "in front of" the mesh?

sentences:
Designing a scriptable questing system I'm currently working on a scriptable questing system. As for scripting, I will probably use JavaScript, but I'd appreciate some help with the design of the system. My first attempt essentially resulted in something which was way too complicated to script, and wasn't plausible at all.

My objectives for the system are as follows:

Branchable (probably not a real word) - So there can be multiple different outcomes for the same objective depending on what the player chooses, and their choices will affect which quests they move onto next.
Not ridiculously complicated.

Obviously, I'm not here to be given a list of everything I need to do. Ideally, I'd like some tips on how to store progression and a basic idea of how branching would work.

Some details: I'm writing in Java, and I ideally want there to be many options in terms of types of objectives. I can implement these easily enough - my problem is more the structure of a quest. I'm writing the quest system on top of an already existing game - said game uses LWJGL and does it's own engine-stuff, it doesn't use an engine.

sentences:
How do you calculate a sprite's localScale to resize the sprite to a defined height? I'd like to uniformly scale a Sprite in Unity, so that its height on the screen matches the height of a button on a canvas. The scene setup looks like:

Canvas with a CanvasScaler and a reference resolution of 800x1280 pixels.
A button on the canvas with a height of 90 pixels.
A sprite with a texture size of 250x250 pixels.
The sprite's pixels per unit setting is set 100.
An orthographic camera with a size of 5.
The transform.scale values of all involved components are (1,1,1).

Now the question is, how do you calculate the sprite's localScale value so that it appears with the same height (90 pixels) as the button? What's the math behind it?

sentences: How to check if renderer is not empty? I have a SDL_Renderer in SDL2 that I use both to render textures on screen and to render textures on textures, my problem is that when I render to texture the renderer may have some content in it which needs to be drawn, but if it's empty and I call SDL_RenderPresent() on it the screen flickers. So how can I check if there's something drawn inside the renderer?

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:
Using compressed(ETC1) textures in LibGDX I use standard android tool for compressing PNG texture and archiving it with gzip:

/android-sdks/tools/etc1tool texture.png --encodeNoHeader
gzip texture.pkm

Then I try to load it:

FileHandle file = ...;
ETC1.ETC1Data data = new ETC1.ETC1Data(file);
ETC1TextureData td = new ETC1TextureData(data, false);
Texture texture = new Texture(td);

But I get an java.nio.BufferOverflowException inside ETC1Data (FileHandle pkmFile) constructor:

  in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(pkmFile.read())));
  int fileSize = in.readInt();
  compressedData = BufferUtils.newUnsafeByteBuffer(fileSize);
  int readBytes = 0;
  while ((readBytes = in.read(buffer)) != -1) {
      compressedData.put(buffer, 0, readBytes);//Exception occurs here
  }
  compressedData.position(0);
  compressedData.limit(compressedData.capacity());

How to fix it? Thanks.

ps if it's important: unarchived pkm file size is 33KB

sentences:
Moving a GameObject to a position, waiting, and then moving it again Hello hello :) Ive been attemping to move a platform (a door basically), and it has partually worked. What works so far is i can move an object from A to B and wait, however it will not move it towards C afterwards, here is my code (note that all of the Debug.Logs work). Here is my code.

 public class OpenDoor : MonoBehaviour
{
    public Transform origPos;
    public Transform targetPos;
    public float speed;
    public GameObject button;
    private ButtonScript bs;

    private void Start()
    {
        bs = button.GetComponent<ButtonScript>();

    }

    void Update()
    {
        if (bs.buttonActive) {
            Debug.Log("Button Active 2");
            StartCoroutine(MovePlatform());
            bs.buttonActive = false;
        }
    }

    IEnumerator MovePlatform()
    {
        float step = speed * Time.deltaTime;
        bool arrived = false;
        while (!arrived)
        {
            transform.position = Vector3.MoveTowards(transform.position, targetPos.position, step);
            if (Vector3.Distance(transform.position, targetPos.position) == 0)
            {
                Debug.Log("DISTANCE 0");
                arrived = true;
            }
            yield return null;
        }
        if (arrived) {
            Debug.Log("Arrived");
            yield return new WaitForSeconds(1);
            Debug.Log("Waited");
            transform.position = Vector3.MoveTowards(transform.position, origPos.position, step);
        }

    }
}

Any assisstance would be greatly appreciated :)

sentences:
How can I get the WAV data from the whole song? I'm using FMOD (with C++ syntax, not C) and I'm having trouble getting the wave data of a whole sound file.

Channel::GetWave() only gets the wave data of the area on which it is currently playing.

The documentation says:

  Do not use this function to try and display the whole waveform of the
  sound, as this is more of a 'snapshot'
  of the current waveform at the time it
  is called, and could return the same
  data if it is called very quickly in
  succession.

  See the DSP API to capture a continual stream of wave data as it
  plays, or see Sound::lock /
  Sound::unlock if you want to simply
  display the waveform of a sound.

Unfortunately, the Sound::lock and unlock functions are pretty confusing,  at least to me.

Lock:

FMOD_RESULT Sound::lock(
  unsigned int  offset,
  unsigned int  length,
  void **  ptr1,
  void **  ptr2,
  unsigned int *  len1,
  unsigned int *  len2
);

  offset

  Offset in bytes to the position you want to lock in the sample buffer.

  length

  Number of bytes you want to lock in the sample buffer.

  ptr1

  Address of a pointer that will point to the first part of the locked
  data.

  ptr2

  Address of a pointer that will point to the second part of the locked
  data. This will be null if the data
  locked hasn't wrapped at the end of
  the buffer.

  len1

  Length of data in bytes that was locked for ptr1

  len2

  Length of data in bytes that was locked for ptr2. This will be 0 if the
  data locked hasn't wrapped at the end
  of the buffer.

Unlock:

FMOD_RESULT Sound::unlock(
  void *  ptr1,
  void *  ptr2,
  unsigned int  len1,
  unsigned int  len2
);

  ptr1

  Pointer to the 1st locked portion of sample data, from Sound::lock.

  ptr2

  Pointer to the 2nd locked portion of sample data, from Sound::lock.

  len1

  Length of data in bytes that was locked for ptr1

  len2

  Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.

But as I said, my goal is to be able to get the wave data of the beginning of a song to the end.

sentences: How to apply constraints to limb movements of a 3D human model? I'm animating a 3D human model using playcanvas game engine according to the quaternion data provided by IMU sensors. How can I limit the movements of the limbs of the human model to avoid unrealistic postures? Is there a mathematical method to limit joint angels?

sentences:
Unity2D Collision Issue I have a crate setup (in pic below) with a rigid body component, box collider and 3 circle colliders(they allow me to push the crate most of the time without getting stuck on the floor textures which are normal box colliders) As you can see in the pic there are collisions detected between the crate and floor even though they are not physically touching.

How can i make the collisions more precise as my crate gets snagged on the floor textures when there is minuscule difference between the floor box colliders?

sentences:
Synchronization with game tick I'm working on a multiplayer game and it's currently set up like this. It accepts packets from the client on the fly and does whatever processing it needs to. There is also a main game tick which is set up like so:

for every online player
    update every player in the region

for every online player
    reset flags

The problem I see that can happen is that since it handles packets on the fly, it may modify something between the updating and the flag reset, which could cause it to completely ignore something. I don't think it's possible to synchronize it using the actual synchronize block since it can't update and reset flags at the same time - it needs to reset flags after it updates every player.

The only solution I see is not processing packets on the fly and doing it in the main loop, but this could hurt performance. Is this the best solution, or is there another option I'm not considering?

Thanks

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 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:
Building placement in tilemaps (pattern matching) I'm building a small RTS and in my code I've given my buildings a pattern, much like you would pieces in tetris, i.e. I want to place irregularly-shaped buildings on a map without overlaps.

The map could be 100x100 and my structure that I'm placing could be as follows:

OXO
XXX
XXX

I'm currently bruteforce-checking each building cell individually against cells in a map.

Is there an easier/nicer way to check a tile map for a matching pattern?

sentences:
How do I fix the "Failed to recompile android resource files." build issue? I've tried similar solutions I found on this website, nothing worked. There are thee errors that pop up... been banging my head for quite a while now, please help!

Also note: I updated my JDK using the download link (next to the browse option in the external preferences). Then linked it to this file, which I am lead to believe is the correct file. C:/Program Files/Java/jdk-9

Failed to compile resources with the following parameters:
-bootclasspath "C:/NVPACK/android-sdk-windows\platforms\android-24\android.jar" -d "C:\Users\Dylan\Desktop\ContentCreater\Repo\DoodlePlanes\DoodlePlanes\DoodlePlanes\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\android\vending\billing\R.java" "com\SoloDeveloperStudio\DoodlePlane\R.java" "com\unity\purchasing\R.java" "com\unity\purchasing\googleplay\R.java"
warning: [options] source value 1.6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings

UnityEditor.HostView:OnGUI()

UnityException: Resource compilation failed!
Failed to recompile android resource files. See the Console for details.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex)
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message)
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuildPointToConsole (System.String title, System.String message)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:263)
UnityEditor.HostView:OnGUI()

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
UnityEditor.HostView:OnGUI()

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:
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:
How can I convert this 2D pixel array into a 1D pixel array? I have this 2D array that works like this, and I made this image to help illustrate what my 'Screen' class's array represents.

Basically, the first part [x][] is how many scan-lines there are. And then, [][x] is how many pixels long that particular line is.

Now, I've researched 'flatting 2D arrays' or '2D to 1D array conversion' - and yes, they 'work', but they seem to just break it... What I mean is, have the screen goes a certain color, then crashes by going out of bounds. Then, other times, it just goes out of bounds, and nothing happens.

I've tried the following, which is what caused it to crash:

final int[] PIXEL_BUFFER = game.getPixelBuffer();

    int pixel = 0;
    for (int j = 0; j < SCANLINE_COUNT; j++)
    {
        for (int i = 0; i < SCANLINE_LENGTH; i++)
        {
            PIXEL_BUFFER[pixel] = this.PIXEL_BUFFER[j][i];
            pixel++;
        }
    }

I've searched high and low, but I can't figure this out. If anyone knows how, it'd be greatly appreciated if I could gain some insight. Until then, I'm going to keep trying.

Many thanks.

sentences:
Electing a host with WEBRTC This is similar to Host Migration (P2P) with RTMFP and AS3
I have a webRTC chat room, initially used Twilio and switching to skyway, the situation is that I have a bunch of peers with data broadcast and there is a firebase datastore with the game state.
I want to elect a host and deal with the host dropping. Currently all the peers just running the same code, so I was thinking I could have the one with the lowest uid propose being the host and then get accepted.
How can I make this robust to race conditions?

sentences:
AABB Collision Detection Confusion I am trying to understand and implement AABB collision to learn simple 2D game physics. I'm following a tutorial and its method is a bit different to other websites. It uses the center of the object and its "half-size" to determine collision. This is its code:

public bool Overlaps(AABB other)
{
    if ( Mathf.Abs(center.x - other.center.x) > halfSize.x + other.halfSize.x ) return false;
    if ( Mathf.Abs(center.y - other.center.y) > halfSize.y + other.halfSize.y ) return false;
    return true;
}

And this is the seemingly more popular option:

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.y + rect1.height > rect2.y) {
    // collision detected!
}

Which one is more efficient? And for the first option, would I define the center and half-size like this:

AABB = new AABB(new Vector2(Width / 2, Height / 2), new Vector2(Width / 2, Height / 2));

Center and half-size method source: https://gamedevelopment.tutsplus.com/tutorials/basic-2d-platformer-physics-part-1--cms-25799

Position and width/height source: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

sentences:
Viewport and Camera setting For my first game in LibGDX and Android I got a Problem:

I have a background picture which is 2560px * 720px. The screen is 1280 * 720. How do I have to set the viewport and camera in order to get the following result: The picture is fited in height and shows the first 1280px in width.

I tried so many things and it really confused me.

Gamescreen.java

package com.joelbrun.jetskirider.screens;

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.scenes.scene2d.ui.Label;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

public class Gamescreen implements Screen {

    public Texture jetski, wave, background;
    public SpriteBatch batch;
    public OrthographicCamera camera;
    public Label score;
    public static final int GAMESCREEN_WIDTH = 1920;
    public static final int GAMESCREEN_HEIGHT = 720;
    public static final int OBSTACLE_TYPES = 5;

    Viewport viewport;
    private Texture[] texture;

    @Override
    public void show() {
        texture = new Texture[OBSTACLE_TYPES];
        for (int i=0; i<OBSTACLE_TYPES; i++){
            texture[i] = new Texture(Gdx.files.internal("game/obstacles/obstacle" + Integer.toString(i+1)+".png"));
        }
        background = new Texture("game/background.png");
        jetski = new Texture("game/jetski.png");
        batch = new SpriteBatch();
        float aspectRatio = (float)Gdx.graphics.getWidth()/(float)Gdx.graphics.getHeight();
        camera = new OrthographicCamera();

        viewport = new FitViewport(GAMESCREEN_WIDTH, GAMESCREEN_HEIGHT);
        viewport.apply();
        camera.position.set(GAMESCREEN_WIDTH / 2, GAMESCREEN_HEIGHT / 2, 0);
        //camera.position.set(0,0,0);

    }

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

        camera.update();
        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        batch.draw(background, 0, 0, 5119, 720);
        batch.draw(jetski, background.getWidth()/2, background.getHeight()/2,128,128);
        batch.end();
    }

    @Override
    public void resize(int width, int height) {
        viewport.update(width, height);
        camera.position.set(GAMESCREEN_WIDTH / 2, GAMESCREEN_HEIGHT / 2, 0);
    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void dispose() {
        batch.dispose();
        background.dispose();
        jetski.dispose();
        wave.dispose();
    }
}

sentences:
2D Collision: Check before or check after? I'm using velocity to move my character, I just add/subtract 0.4f and then update the players position in the update loop.

I was wondering, when would be the best place to check for collision? Do I go ahead move the player, and then if I colliding push him out of the wall until there's no collision? Or do I check collision as soon as the key is pressed, and if there is - somehow find the distance and move the player?

My problem is that my game is tile based, but the world is constantly rotating around the player - I have a function that returns a list of objects of each block that the player is colliding with, and I'm having trouble separating wall collisions with floor collisions

sentences:
What do I need to do to my slope collision detection to prevent the player from passing through my collision? I've recently implemented slope collision detection for my project. The issue I'm having is that the character occasionally passes through the line.

This usually occurs when the characters MoveAcceleration is increased from 5000 to 8000 via a game mechanic. I was wondering if there is a way to make the line collision more reliable without reducing the MoveAcceleration variable ?

This is how the characters position is calculated

velocity.X += movement * MoveAcceleration * elapsed;
Position += velocity * elapsed;

This is how the slopeCollision is handled

private void HandleSlopeCollisions(GameTime gameTime)
        {
            isOnSlope = false;

            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (velocity.Y >= 0)
            {
                if (attachedPath != null)
                {
                    isOnSlope = true;

                    position.Y = attachedPath.InterpolateY(position.X);
                    velocity.Y = 0;

                    if (position.X < attachedPath.MinimumX || position.X > attachedPath.MaximumX)
                    {
                        attachedPath = null;
                    }
                }
                else
                {
                    Vector2 footPosition = position;
                    Vector2 expectedFootPosition = footPosition + velocity * elapsed;

                    CollisionPath landablePath = null;
                    float landablePosition = float.MaxValue;

                    foreach (CollisionPath path in collisionPaths)
                    {
                        if (expectedFootPosition.X >= path.MinimumX && expectedFootPosition.X <= path.MaximumX)
                        {
                            float pathOldY = path.InterpolateY(footPosition.X);
                            float pathNewY = path.InterpolateY(expectedFootPosition.X);

                            if (footPosition.Y <= pathOldY && expectedFootPosition.Y >= pathNewY && pathNewY < landablePosition)
                            {
                                isOnSlope = true;
                                landablePath = path;
                                landablePosition = pathNewY;
                            }
                        }
                    }

                    if (landablePath != null)
                    {
                        isOnSlope = true;

                        velocity.Y = 0;
                        footPosition.Y = landablePosition;
                        attachedPath = landablePath;

                        position.Y = footPosition.Y;
                    }
                }
            }
            else
            {
                attachedPath = null;
            }
        }

sentences:
Doing object movement in a loop in unity I have a Game Object at position (0, 0, 0). To move it to position (2, 2, 2), I'm using this code below -

void Update () {

Vector3 TargetPosition = new Vector3(2, 2, 2);

transform.position = Vector3.MoveTowards(transform.position,TargetPosition,

23 * Time.deltaTime);

}

How do I put this movement in a loop like behavior so that whenever the Game Object reaches position (2, 2, 2), it again starts moving from (0, 0, 0) to (2, 2, 2) ?

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:
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: 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:
How to make a levels map page? I'm trying to make a levels map page that shows number-buttons in the page. I want to make this page in a XML layout file and I'm actually trying to make something like this:

I know that I should provide a picture for the background and the background is not a problem, but I'm trying to place those buttons in certain places. I can do that by assigning margins to the buttons but then it won't show up the same way on a bigger or a smaller screen.
Is there any way to do this?

sentences:
How do I check user's unlocked achievement and leaderboard scores via GPG plugin I need to load user's achievement and their scores from leaderboard in my game. But the Social.LoadScore() and Social.LoadAchievements() both returns a 0 size array in callback.

When I checked the implementation in Google Play Gaming's PlayGamePlatform.cs, both the method has this summary -

Not implemented yet. Calls the callback with an empty list.

So my question is How do I get this data in Unity? Has anyone tried any other method to get the data?

sentences:
How can I prevent pinching and jagged edges when deforming joints in 3ds Max? I've rigged and skinned a character, but no matter how or how much I blend the weights, it doesn't look good:

Why does the weight map look pixelated? I don't get it. I've never been able to get past this point when animating. I don't think it's a model resolution issue, since as you can see in the picture, the model is quite detailed.

How can I prevent the indicated problems?

Here are some reference images of my wireframe and weight maps:

EDIT

After recreating a model entirely to try and have another go at this, Ive found that my new model is repeating the previous outcome. Here are some images

enter image description here

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:
Is it a bad idea to couple action and animation? I'm making an ARPG (like Legend of Zelda but with more action), and this question raised during the development:

Should action and animation be coupled? Or should they be independent?

With this I mean, the process of executing an action (eg. Attacking) should be:

Input
Start Animation
Frames 1-3 are transitioning, do nothing
Frames 4-7 are attack moves, do the attack action during these (searching enemies in front of the character, pick the closest and deal the damage)
Frames 7-10 are transitioning, do nothing again
Animation finished, release input again.

This way, it's like the action is triggered by the frames, as events on the animation itself.

If it helps, I'm making the game on an Entity/Component System.

Should it be done this way? Why yes/no? What are the advantages/disadvantages?

sentences:
Painter algorithm vs. 3D rendering with Z-buffer when drawing 2D Sprites I'm currently developing a tile base engine. I want it to look like your average old school tilebased RPG like Zelda - Link to the past (orthographic projection, squared tile texture, textures overlapping each other, alpha channels, etc.). The twist is that the world is internally 3d meaning that every tile has an elevation and entities are moving in a 3d space. Reason for this is beyond the scope of this question but I'm struggling on comparing the follow two ideas for the rendering. I'm using OpenGL with libGDX in Java but wouldn't mind writing my own code to interface OpenGL. That's also why I didn't tag it.
A screenshot of "Zelda - Link to the past" in case you don't know what it looks like.

Painter algorithm
Disable Z-Buffer and use painter algorithm to draw from back to front in the appropriate order with some overdraw and a lot of texture rebinding. I know a texture atlas can minimize the texture rebinding but the engine is supposed to act more like a sandbox so I don't want to rely too heavily on assumptions like a efficient texture atlas that I might not have all the time.
Pro: Easy to implement and very straight forward.
Con: I've no idea how big the impact will be since almost every sprite will cause a texture rebinding. And I don't know how to predict the performance costs of that many texture bind calls.

Full blown 3D
Rotate the camera 45 degrees up around the x axis with an orthographic projection matrix. Then use the 3d information from the game world to draw the tile textures with billboarding at the real position in the worlds 3d space. Same for entities and such. This way I can gather all sprites and then render them sorted by their texture which means one texture bind per texture and reduced overdraw due to usage of the Z-buffer
Pro: I can use a freecam to debug render problems. I assume it's significantly faster that the painter algorithm.
Con: Some sprites might share the same place which could lead to Z-fighting. I'm thinking about how to use multiple layers on a tile. For instance you may have a bridge tile with a railing where the railing is always overlapping an entity on the bridge but the floor of it is always overlapped by the entity. So I would have to add a little offset to different layers in the 3d space. I'm not really sure how that would work out and to be honest had a hard time figuring out how old games did it so maybe I'm overthinking it.

I guess I have a very rough idea of how each method will work out but I don't know how much the texture rebinding (or sorting and preparing the sprites for the 3d approach) is affecting the performance and while it's easy to find information regarding large 3D scenes I found it difficult to get information about 2D scenes with way less polygons.I hope this question is not too much a subject of personal preference. I know that Premature optimization is the root of all evil but due to how the decision is affecting almost the entire rendering process I don't want to make the wrong call.
I deliberately didn't mention any OpenGL functions mainly because I've mostly used the libGDX API which hides the function calls behind it's wrappers but generally I know how the internals work and just got into the internals and how the OpenGL API works. I don't think specific OpenGL calls do matter for the question but feel free to use them for your answer I'll just look them up.

sentences:
How can I map thumbsticks to cardinal directions? I've got a tile based game that has notions of moving up, down, left, right and the diagonals (by alternating horizontal/vertical movement).

I've found that if I use the default ThumbStick<Direction> buttons that XNA provides I'm often moving diagonally instead of in a straight line. E.g. moving the thumbstick left, often just triggers 'down' too (but only just).

How can I map moving a thumbstick to the 8 discrete directions so this accidental diagonal movement doesn't occur?

I'm starting to think about favouring up/down/left/right over diagonals (as you more frequently move straight in my game), however, I'm not sure how do put this into code.

sentences:
Steelseries Stratus XL controller: Keycode for middle button I'm working on an Android app (Java, level 19+) that uses a controller to e.g. walk and it's working (almost) fine with both the Steelseries Stratus XL and the Moga Pro Power. The only problem is that the Stratus XL has a button in the middle (the one with the circle: click) that closes the app.

I now want to disable that but I have no idea what the keycode for the button is and it also doesn't say anything about it on the official Steelseries homepage.

Has anyone here worked with the Stratus XL before and knows what keycode to use?

sentences:
Plot and Story design basics I have made several games but they have all been space invaders or mario style.

Following my last question (thank you for all the great answers) I am trying to write out a plot line and a plan for the events that will take place.

The problem I am having is that my story's tend to resemble things that already exist like films or other games I have played.

The events to feel like a mix of various other games I have played.

So apart form become a more creative person does anyone have any advice. Has anyone written a fairly lengthy story for a game and have pointers or does anyone know any good books on the subject.

Any thoughts would be welcome, story of event ideas to.

FYI the game has a final fantasy style battle system and a pokemon catch/raise system.

sentences:
How to convert an octree to a polygon mesh? So if I have dynamic voxel terrain data stored in an octree
  representation what would be the best way to go about converting the
  octree to a polygon mesh which I can render with OpenGL?

A lot of the meshing algorithms I have found online assume that voxel data is stored in a 3D Array however for the level of detail I am using storing chunk data in a massive array isn't really an option (chunk size 64x1024x64 with each block roughly 4bytes) split into several 64x64x64 small octrees, I could make the chunk size smaller but then that means more draw calls etc.

Basic searches on google for 'meshing an octree' seem to bring up lots of research on doing the inverse (converting from meshes to SVOs).

The problem with using these algorithms on the octree instead of the array is that the octree has a much slower access time not to mention the time cost of copying the data from the octree representation.

I have considered the possibility of converting to an RLE or spatial hashing system but these two systems both have their drawbacks especially since I plan to use the same octree when I come to implement collision detection.

I would guess that it would be best to traverse down the tree rather than iterating over it like  an array, but some more ideas about how I could optimise this would be appreciated.

sentences:
Unity XR Spectator Camera I would like to have a VR camera (for the player) but also have another camera (spectator).
I am using Unity 2019.4.8f1 on the Universal Render Pipeline
I have only been able to find outdated articles:
https://blogs.unity3d.com/2017/12/12/spectating-vr/
https://unity3d.college/2017/05/08/unity3d-spectator-mode-vr/
https://forum.unity.com/threads/using-a-second-cam-while-still-rendering-the-vr-camera-for-the-vr-headset.659434/
Thanks!

sentences:
How to load a spherical planet and its regions? I'm designing a game partially composed of planets exploration. I want to use pseudo-random generation for them, regenerating from a defined seed when I have to load them rather than store every detail, which would be too heavy. So I will just store in a file the random seed and modifications done by the player if any.
The player must be able to see the planet from orbit (with very low level of details, then go down to the ground, increasing slowly the level of details of the region where he/she is landing, and unloading the ones on the other sides of the planet, which go outside the player's field of view.
If I had to do it on a plane ground, I would do it easily with a square chunk system. But the problem here is that planets are - almost - spheres.
So what would be the best way to load ground details (relief and grounded objects) around a precise point ?
I already though on two solutions, but both have a weak point:
1. Cutting the sphere in square chunks.

Once the player is close enough of the ground, I just have to improve details of closest squares from his/her position.
If it is not enough, I still can cut each square in sub-squares to load when the players is on or really close of the ground.
But as you can see on the picture, there is a problem if the player try to land on a pole: squares become very slim rectangles, or even triangles for the last line, and additionally to the fact that they would be many to load, generation would appear distorted.
2. Starting from an icosahedron.

Here, I could just increase triangle tessellation around player's position when he/she is getting close.
But I don't know how to locate triangles close than player's position. I heard Cartesian coordinates could be usefull in that case, but I don't know how to use them.

I'm using C++/OpenGL for it, so the main thing to generate and load here are vertices representing the surface relief and color/texture.

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:
How can I generate random meaningful words in a typing game? I want to make a typing game where users have to type the words displayed on the screen. But I don't know how to generate meaningful English words not gibberish.

What technique can I use to achieve this?

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:
Multiple colored textures vs Color Overlay Let's say we're using DirectX 9/10/11. In our game we have a character wearing armor.

The armor has 50 different color variations.
So, if armor is red, the first method would load the red texture from file.
The second method would display the 1 base texture, with a red overlay.

Code wise the overlay armor would just contain an extra flag that would specify color.

Is it faster / more efficient to load different textures in? Or, is it faster / more efficient to color the texture on the fly?

I'm not aware if there is some huge overhead for dropping a tint over a texture...

sentences:
Javascript: Eventlistener 'keydown' not registering all keys pressed when holding down other keys Sollution provided in the comments. The issue is that my keyboard has what is called ghosting issues, this means it doesn't support some key combinations when pressed together.

When the user holds 's' and 'd' key at the same time (movement keys, so character would move south-east), and during this presses the 'n' or 'm' key, the keydown event of the 'n' and 'm' key is not triggered. This happens with other key combinations as well, but not with all. Per example: holding down the 'w' and 'a' key will trigger the 'n' and 'm' keydown events. Is there a way to allow any keydown event to be triggered, regardless of other keys pressed? You can test this behavior using the following code:

document.addEventListener('keydown', (e) => {
    console.log(e.key);
});

sentences:
How can I cut a graph representing 2D positions into two sub-graphs? I have a graph where each node is associated with a 2D position. I would like to use a finite line to "cut" this graph into two halves, as shown below:

Note that the cutting line does have a direction. All vertices in that direction remain and aren't cut away.

How can I implement this?

sentences:
How can I determine which Trigger is hit? I have a GameObject. It has 3 BoxCollider2Ds:

Body Collider - Not a trigger - Determines if body is hit
Weapon Collider - Trigger - Determines if weapon is hit
Vision Collider - Trigger - Determines what the GameObject sees

I can tell the Body Collider apart from the other colliders, because it has a different method (OnCollisionEnter2D).  However, I cannot tell the Weapon Collider and Vision Collider apart.  They both access the same method (OnTriggerEnter2D), and pass in the collider they are hitting.  I cannot determine which one is hit.

I could put each trigger on a separate child GameObject, and send a message to the parent, but this is very slow and feels messy to me.  What is the best way I can determine which trigger I am hitting?

From the Unity Docs for reference:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public bool characterInQuicksand;
    void OnTriggerEnter2D(Collider2D other) {
        characterInQuicksand = true;
    }
}

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:
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:
Which are the cons of using only non-member functions and POD? I'm creating my own game engine. I've read these articles and this question about DOD and it was written to not use member functions and classes. I also heard some criticism to this idea.

I can write it using member functions or non-member functions it would be similar. So what are the benefits/cons of that approach or when the project grows, does any of these approaches give clearer and better manageable code?

With POD & non-member functions I don't have to make struct members public I can still use object id outside of engine like OpenGL does with all it's stuff, so It's not about encapsulation.

POD - plain old data

DOD - data oriented design

sentences:
What is an active Indie iOS development community? I've just gotten into iOS development, and would love to develop some games, but need inspiration/support, all that stuff a great community gives you.

Does anyone know of a community to get involved with?

sentences:
Lwjgl or opengl double pixels I'm working in java with LWJGL and trying to double all my pixels. I'm trying to draw in an area of 800x450 and then stretch all the frame image to the complete 1600x900 pixels without them getting blured. I can't figure out how to do that in java, everything I find is in c++... A hint would be great!

Thanks a lot.

EDIT : I've tried drawing to a texture created in opengl by setting it to the framebuffer, but I can't find a way to use glGenTextures() in java... so this is not working... also I though about using a shader but I would not be able to draw only in the smaller region...

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:
Which console systems can indie developers officially develop for? As an independent developer, I would like to know what platforms I can use to reach what consoles, and under what prices. I'm assuming a small team (1-3 people) and low or non-existent budget (under $1000).

For the purpose of this question, a "console" is "anything other than a PC." So this includes mobiles phones and other devices.

For this question to be useful and not a collection of every game engine and platform in the world, maybe we should restrict it to technologies that support at least two platforms.

sentences:
Error detecting collision with another instance of the same actor? I have a project where after a certain time interval 2 NPCs are generated in different locations on the map.

Each of them collides with a collision box that defines its "class" (red or blue):

When 2 NPCs collide it was to be verified a condition (if the "class" of the involved ones is different) and from there both are destroyed, but nothing happens:

I put a print right after the Cast To NPC to see if it was happening and when they are generated the impression appears four times.

Blueprint:

Result in game:

I'd like to know how to set a cast only between two instances of the same actor.

Image showing that nothing happens when it (two instances of the same actor) collide:

I did the test with both codes (printing and destroying both).

EDIT 1 (I was being redundant)

In the code of destruction, I can simply put it to destroy itself only, because as it will run in both instances, the two will destroy themselves:

I'd still like to know how to correctly detect the collision between two instances of the same actor, but now I know that the code will be running twice, once in instance A and again in instance B.

sentences:
Using add_force and add_torque to turn a RigidBody2D Godot Scene tree
Scene (Node2D)
- RigidBody2D (Parent of Sprite and CollisionShape2D initially points to X direction/90 degrees)
-- Camera2D

When I use apply_force() with ui_up key, the Vehicle moves correctly and remains in motion. However when I use apply_torque_impulse() (such as ui_right) it turns but, then the Vehicle is moving/slipping sideways instead of towards the new direction. If I stop the motion by reversing the thrust, then start again it moves correctly in that new direction.
Seems I have to do some vector math math on the value of torque but I am not sure what.
extends RigidBody2D
var thrust = Vector2(0, 100)
var torque = 1024
var cot=Vector2(0,0)
var speed: int
var direction: int
func _ready():
    set_physics_process(true)
    set_process_input(true)
    can_sleep=false
    speed=0
    direction=0
func _integrate_forces(state: Physics2DDirectBodyState):
    if Input.is_action_just_pressed("ui_down"):
        speed -= 1
        add_force(cot, thrust.rotated(rotation))
    if Input.is_action_just_pressed("ui_up"):
        speed += 1
        add_force(cot, -thrust.rotated(rotation))
    if Input.is_action_just_pressed("ui_right"):
        direction += 1
        apply_torque_impulse(torque)
    if Input.is_action_just_pressed("ui_left"):
        direction -= 1
        apply_torque_impulse(-torque)

sentences:
Fixing text on the screen for Oculus Rift I would like to fix text to the screen for an Oculus Rift in Unity. The text should say something like "get comfortable and then press any key". It seems like OVRGUI.StereoBox should work for this and I've tried to copy an example I found on Github, like so:

public class TargetScript : MonoBehaviour {
    void OnGUI() {
            Debug.Log("Drawing Recenter dialog.");
            string loading = "LOADING...";
            OVRGUI guiHelper = new OVRGUI();
            guiHelper.StereoBox(300, 300, 300, 300, ref loading, Color.white);
            Debug.Log("Stereo Box should be visible.");
            Debug.Log (guiHelper);
    }
}

The log messages indicate that this code block is definitely being hit, but no text is visible on screen.

What am I doing wrong?

sentences: Unity - Blender models/animations showing gaps As part of a college project, a member of my group has made some simple chests with an open animation. Importing these into Unity though, I instantly noticed there were gaps where the faces should be. After a bit of experimenting, I figured it was because the Normals were facing the wrong way. The outside seemed fixed, but faces were missing when the chest opens during its animation. I'm guessing the inside of the chest will need another layer of faces with the Normals facing the right way...? Though surely this would means having doubles...?

sentences:
How can I make it so the baller/ball does not keep moving after it bounces? I am pretty new to Unity so how I did it may not be the best way, but when the character jumps it is inconsistent. When I press the up arrow key really quickly and then stop the jump will be further than it is supposed to be and it starts to glide. I want all the jumps to be the same size and the player can't bounce again until it is on the ground. Also if I start playing to quickly within the first second or two the ball jumps really far but if I wait a couple seconds it bounce like normal.

Here is my code:

    using UnityEngine;
    using System.Collections;

    public class MovePlayer : MonoBehaviour {

    public float distance;
    public float fspeed;
    public float uspeed;
    public float addToDistance;
    bool jumping = false;

    //PRIVATE
    private Rigidbody rigidBody;

    void Awake()
    {
        rigidBody = GetComponent<Rigidbody>();
        rigidBody.freezeRotation = true;
    }

    void FixedUpdate()
    {
        if (!jumping)
        {
                if (Input.GetButtonDown ("up")) {
                    rigidBody.AddForce (new Vector3 (0, uspeed, fspeed));
                }

                if (Input.GetButtonDown ("down")) {
                    rigidBody.AddForce (new Vector3 (0, uspeed, -fspeed));
                }

                if (Input.GetButtonDown ("right")) {
                    rigidBody.AddForce (new Vector3 (fspeed, uspeed, 0));
                }

                if (Input.GetButtonDown ("left")) {
                    rigidBody.AddForce (new Vector3 (-fspeed, uspeed, 0));
                }
         }

     }

    void OnCollisionEnter(Collision other)
    {
    if (other.gameObject.CompareTag("Ground"))
        jumping = false;
    }

    void OnCollisionExit(Collision other)
    {
    if (other.gameObject.CompareTag("Ground"))
        jumping = true;
    }
}

sentences:
Problematic cameraposition (Eye = (0,0,0), at=(0,-2,0) and up = (0,1,0))? I am taking a course in computergraphics and we talk a lot about OpenGL and the math you need to do everything OpenGL does "by hand". A Question which was asked in an old exam (I am preparing at the moment) was:

Why is the following Cameraposition considered problematic?
eye = (0,0,0), at=(0,-2,0) and up = (0,1,0)

Is it because the eye-at = (0,2,0) and therefore the cross product of up x (eye-at) = (0,0,0) and that means, that no real transformation matrix can be constructed?

I found a post where someone asked a similiar question ( https://gamedev.stackexchange.com/a/45328/50476 ), but the explanation is somehow strange for me, because he says that he wants to calculate the cross product of the eye vector and the up vector. But there is no need for that, if you want to be able to calculate the transformation matrix?

sentences:
Calculating framerate-independent values, for linear, quadratic, and exponential functions There are a few similar posts, but they only deal with one of the three components I'm looking for, and none seem to handle the case of using a fixed step size (they're all about simulations which use a variable deltaTime).
I'm using a fixed step simulation, and my lifelong (bad) habit has been to eschew units and just directly use parameter values which have deltaT "baked in". Now that I'm trying to add support for different fixed rates, it's biting me in the ass! :/
Here's a simplified example of my code, covering all three cases:
run_speed = 2;      //velocity, linear
brake_decay = 0.95; //viscous damping, exponential
gravity = 1;        //acceleration, quadratic

if(button_pressed)  vel_x = run_speed;
else                vel_x *= brake_decay;

vel_y += gravity;

pos_x += vel_x;
pos_y += vel_y;

I would like to support different fixed timesteps by scaling my existing parameters:
run_speed = 2 * A_to_B_vel;
brake_decay = 0.95 * A_to_B_damp;
gravity = 1 * A_to_B_acc;

My question is: if my fixed timestep is currently A ms/tick, and I want to switch to a fixed timestep of B ms/tick, how do I calculate these three new scaling factors, such that the object follows the same curve through space and time?
(I realize that the actual positions will vary between A and B since we'll be sampling the trajectory curve at a different rate, I just want the underlying curve itself to be identical regardless of how we sample it.)
A_to_B_vel: this is the case which has been covered by many other "framerate independent" questions, and it's relatively trivial because the relationship is linear: A_to_B_vel = B/A
A_to_B_damp: this seems to have been answered here Frame-rate independant movement with acceleration via the Pow() function. This makes sense since it describes an exponential curve; I'd still appreciate someone breaking down the formula though, because the answer given there involves "referenceFPS" and I'd prefer to stick solely to units of time, ie ms/frame, not frame/sec. (and it's not clear that I can simply substitute one for the other into the formula they give)
A_to_B_acc: this is where it gets confusing! According to the above answer, this should be treated similarly to A_to_B_vel (ie scale by the frame duration), however this is definitely wrong, since I've implemented it and it doesn't work. i.e A_to_B_acc = B/A doesn't work. My calculus is very rusty, but I would imagine that the scaling factor needs to involve a dT*dT term somewhere, since acceleration changes position quadratically.
Additionally, if anyone could point me towards a resource which explained the underlying calculus here, I would really appreciate it.
Thanks for your time! :)
Raigan

sentences:
reseting timer unity So I have been trying to reset this timer but for some reason I can't figure out why it isn't resetting.

Thanks,

public class controlborder : MonoBehaviour
{
    //varibles
    public static int time; //<== here I create my timer
    public static int random;
    public static bool boolreset = true;
    //varibles
    //get objects
    public SpriteRenderer m_spriteRenderer;
    //get objects

    public void Start()
    {
        m_spriteRenderer = this.GetComponent<SpriteRenderer>();
        StartCoroutine(Changecolortimer(2f));
    }

    IEnumerator Changecolortimer(float loopdaelay)
    {
        while (boolreset)
        {
            yield return new WaitForSeconds(1);
            time++; //<== here is set a interval
            if(time == 3)
            {
                boolreset = false;
                resettime();
            }
        }
    }
    public void changeColor()
    {
        if (random == 1 && time == 1)
        {
            m_spriteRenderer.color = Color.blue;
        }
        else if (random == 2 && time == 2)
        {
            m_spriteRenderer.color = Color.red;
        }
        else if (random == 3 && time == 3)
        {
            m_spriteRenderer.color = Color.green;
        }
        else if(random == 4 && time == 4)
        {
            m_spriteRenderer.color = Color.yellow;
        }
    }

    public void Update()
    {
        random = Random.Range(1, 4);
        changeColor();

    }

    public void resettime()
    {
        time += 0;
        boolreset = true;
        Debug.Log(time);
    }
}

sentences:
Is deferred rendering/shading possible with OpenGL ES 2.0 ? I asked this on StackOverflow, but it might make more sense here:

Has anyone implemented deferred rendering/shading under OpenGL ES 2.0? It doesn't support MRTs, so with only one color buffer, it's not something that can be implemented in the "usual" manner.

Specifically, I'm exploring on iPad, iPhone4 (maaaybe iPhone 3gs), and Android. On the GLESView app on iPad/iPhone4/iPhone3gs, the GL_OES_RGB8_RGBA8 extension is present, and I haven't looked too deeply yet, but with 8bits/channel, this idea is interesting: http://www.gamedev.net/topic/562138-opengl-es-20-and-deferred-shading/

Any other ideas? Is it even worth doing, performance-wise?

sentences:
How to detect whether or not a tile is occupied? I'm using Python 2.7 on Win7x64 with PyGame

What is the best way to iterate over all the tiles in the game or screen, efficienty? Ideally I have about 800 tiles, but that is a dynamic number I've been playing around with.

The way I've got it is the logic is looking through all the tiles per frame (at 60fps, and I haven't yet got GFX and Logic decoupled):

for tile in TILES: #tiles is a simple list
  if player_pos is in tile.coords: #coords is a list filled with (x, y) tuples
     tile.color = RED #a simple attribute change, performance hit whether this line is 'pass' or not

but the list of TILES is huge enough that looking through 800 tiles, 60x a second obviously isn't efficient.

What is the best way to proceed from here? How do I find the occupied tiles, without iterating over them every frame? I could split the map up into quadrants or something similar, but maybe there's a fancy concept I'm not familiar with that would work better.

edit: Solved, for now: I added an attribute to the Tile class that has the lowest and highest two coordinates and then every frame, the logic looks to see of the player's pos is between the two ranges like so:

for tile in TILEs: #pos is player pos
    if tile.range_x[0] <= pos[0] <= tile.range_x[1]: #range_x is the lowest and highest
                                       # x coordinate within the tile in pixels
        if tile.range_y[0] <= pos[1] <= tile.range_y[1]: #low and high y here
                     pos_tiles.append(tile)

edit2; I should mention that a tile holds several coordinates, meaning a unit (or player) can move within a tile.

sentences:
How to get interior uniform lightning? I'm trying to reach uniform lighting as in this image.
This scene i've bought is rendered with 3ds and v-ray (i suppose).

This is the same scene i've imported in Unity.

I've put a "big" point light on top of my room, i've added also directional light and a Reflection Probe.

This is my (unsatisfactory) result:

This is my baking settings:

Do you have some advice to improove my Unity lightining as the first scene ?

Thanks

sentences:
Physics engine recommendation which can simulate pool game correctly? I'm making a pool-game like game. This game requires correct (or very accurate) reflective bounces.
I tried Box2D and Bullet Physics, but they both have this problem.

If there is a wall on top of this image, red line is expected course of a real ball in a pool-game. But the engines often shows green line course. Especially,

This happens after a slowly moving ball hits the wall.
Sometimes a rapidly moving ball get slower suddenly.

I'm finding a physics engine which can simulate pool-game accurately as much as possible without these problems. Can I get some recommendations? Now I'm digging Newton Game Dynamics, but I am not sure the engine will show what I want. I'm considering the PhysX engine as a next trial, and have to make my own if nothing works. But it's obvious it'll take very long time, so I wish I won't do that.
I'll be very appreciated if you save my time. And of course, solution with Box2D / Bullet Physics are also welcomed.

I am working with C/C++/Objective+C on iOS.

I attach my configuration with Box2D.

Walls

static box shape
linear/angular damping = 0.1
restitution = 1.0
friction = 100
density = 10
bullet = false
fixed rotation = false
inertial scale = 1.0

Balls

dynamic sphere shape
linear/angular damping = 0.1
restitution = 1.0
friction = 100
density = 20
bullet = true
fixed rotation = false
inertial scale = 1.0

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: How do I calculate sprites/frame usage on my platform's ram? I plan on building a 2d game for mobile and possibly pc. I also plan on using sprites/frames for the animation of my 2d game. What's stopping me from doing so is because I can't figure out if the sprites/frames containing the animation is gonna use up a lot of RAM on my device. Does anybody here know what I'm talking about?

sentences:
My bullet changes the velocity depending on where I click I want to build a little 2D-Sidescrolling shooter and I'm now at the shooting script.

I already figured out how to shoot a bullet towards my mouse pointer. I got something like this :

Vector3 shootDirection;
        shootDirection = Input.mousePosition;
        shootDirection.z = 0.0f;
        shootDirection = Camera.main.ScreenToWorldPoint (shootDirection);
        shootDirection = shootDirection - transform.position;

        shootDirection.Normalize ();

        Rigidbody2D bulletInstance = Instantiate (rocket, transform.position, Quaternion.identity) as Rigidbody2D;
        bulletInstance.velocity = new Vector2 (shootDirection.x * speed, shootDirection.y * speed);

Now obviously the bullet goes faster if my Direction coordinates are big and slower if they are smaller. Have you some better code for me or how can I fix that issue?

I added now some loop like this, which brings a horrible performance, but kinda works out for the problem, but I'm still looking for a better solution.

while (((shootDirection.x * speed) + (shootDirection.y * speed)) < 20) {
            speed += 0.1f;
        }

So the loop makes sure that the overall speed is always almost the same, but this solution ends in an infinity loop if the values get too small.

sentences:
How can I change the rotatearound radius in real time when the game is running? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;

    private void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Using the xradius and yradius sliders I want to change the transform.RotateAround radius in real time.

UPDATE:

I added this to the Update:

if (radius > 0)
        {
            var newPos = (transform.position - Turret.transform.position).normalized * radius;
            newPos += Turret.transform.position;
            transform.position = newPos;
        }

The problem is now that some times when the radius the distance from the Turret is small for example 20 or less some times the transform is getting right above the turret not sure why. I want it to rotate around the turret at the fixed set distance(radius) but not to be above the turret. Can't figure out why sometimes it's moving right above the turret then after some time it's getting back to the set distance.

sentences:
How to make player jump to mouse position Currently I have the player moving towards the mouse position , using this example :
https://kidscancode.org/godot_recipes/3d/click_to_move/
now how would I achieve jumping to the mouse position, currently my script is like this:
  void Player::move(const float &delta) {
            velocity.y += gravity * delta;

            if (target != godot::Vector3::ZERO) {

                look_at(target, godot::Vector3::UP);
                rotate_x(0.0);
                velocity = -get_transform().basis.z * speed;

                auto distance_to_target = get_transform().origin.distance_to(target);
                if (distance_to_target < 0.5) {
                    velocity = target = godot::Vector3::ZERO;
                }

// weird behavior not what I'm looking for

                if (godot::Input::get_singleton()->is_action_pressed("Jump") && is_on_floor()) {
                    godot::Godot::print(std::to_string(distance_to_target).c_str());
                    velocity.y = 100;
                }
            }

            velocity = move_and_slide(velocity, godot::Vector3::UP);
        }

I tried messing around with velocity.y , but it always result in weird behaviors and the player when landing point/look at the floor.
how would I do it correctly ?

sentences:
Do "write once run anywhere" engines require platform specific code for multiplayer? I've been investigating the myriad selection of mobile game dev engines that allow compilation of your code onto multiple target platforms, but, something I can't seem to figure out is if multi-platform "write it once" development is possible when you bring multiplayer into the equation.

I've looked at Unity and Monkey mostly, so far, but aside from seeing threads on the Monkey forum such as "I've developed such and such networking library for Monkey"... I can't find a definitive answer. That example is one of many that causes me concern.

Is it the case that if you used a cross platform engine, you'd have to write platform specific code for the networking portion of your game/app? (Even if the rest of the game did work on your target platforms with no/minimal platform-specific "jiggery".

I'm not talking about cross-platform multiplayer, but I do presume that'd be a happy by-product of a write-once-deploy-anywhere (within reason) networking solution.

sentences:
What data should a generic collision detection system gather? I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?

sentences:
Health Bar is always 100% full I have this GUI to graphically display a variable similar to the health in a game. The variable 'test' goes up and down during gameplay.

To show this I have the following onGUI ():

public GUISkin btnskin1;
public Texture2D emptyTex;
public Texture2D fullTex;
public Vector2 pos = new Vector2(20,40);
public Vector2 size = new Vector2(60,20);

void OnGUI()
{
    float test;

    GUI.skin = btnskin1;

    if (LoadDiagram.diagramaCarga.TryGetValue (TimeManager.gametime, out test))
    {
        GUI.BeginGroup (new Rect (pos.x, pos.y, size.x, size.y));
        GUI.Box (new Rect (0, 0, size.x, size.y), emptyTex);

        //draw the filled-in part:
        GUI.BeginGroup (new Rect (0, 0, size.x * test, size.y));
        GUI.Box (new Rect (0, 0, size.x, size.y), fullTex);
        GUI.EndGroup ();
        GUI.EndGroup ();
    }
}

In the game scene I attached the empty bar to the emptyTex texture, and the full bar to the fullTex texture. When I play the game, he bar is always full. I have not inserted the minimum and maximum of the variable test because I don't know where, but I guess that may be necessary.

Any hints?

sentences:
Playing basic imported animations in UDK I'm trying to wrap my head around basic animations in UDK.

I've created a simple turret-like structure in Maya, rigged, skinned, and animated. It has 4 bones. I have done all the steps necessary for exporting and importing as an FBX (baked animations, etc.)

I've imported it into UDK, and can view both the AnimSet and SkeletalMesh in the Content Browser.

The AnimSet Editor previews the animation perfectly. This is a looping animation. I can load the SkeletalMesh into my scene, but I can't figure out how to trigger the animation.

What is the simplest way to trigger this animation at run-time?

I could have it start when the scene loads and loop indefinitely, or I could have it triggered by pressing a switch or using a trigger volume. I just can't figure out how to make that happen.

Also, any resources on diving deeper into this subject would be greatly appreciated as well. Thanks!

sentences:
Adding multiplayer to an HTML5 game I am interested in making a game that I currently have a co-op experience, however I'm curious as to the best method of implementing this in HTML5.

I have made games before using straight C sockets, and also with the Net library for SDL.

What are some of my best options for doing this in a canvas-based environment?

At present, all I can come up with are either AJAX/database solutions (with a high refresh rate), or somehow implementing a PHP server that would funnel the data through sockets.

The overall gameplay would be a 2.5D platformer-ish type of game, so both clients would need to be continually updated with player positions, enemy positions, projectiles, environmental data, etc.

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:
calculating occlusion in cube voxel engine This is more a conceptional (approach) question then the search for an implemented solution, since I was unable to find proper hints via google or similar.

The problem is as follows:

Given you have a 3D world that is encoded as voxels. So basically you have your 3D matrix were each position in the matrix is either solid or void ( for simplicity ). Now you look with your camera onto this cloud form a given ( in my case fixed for an isometric perspective ) angle. For each non void coordiante I draw an isometric projected block ( due to my choosen fixed camera angle ), while leaving void coordinates empty.

Of corse I want ot omit to draw coordiantes that are not vissible, so I alread exclude coordiantes that the camera would not see. But I also want to omit coordinates that would be hidden by other blocks, which are in the perspective closer to the camera.

I currently solve this by choosing a specifc camera angle that ensures that a block at coordiantes 0,0,0 would occlde a block at -1,-1,-1; -2,-2,-2; -3,-3,-3; and so on ( is that clear enought or should I add an image to explain? ). This is a rather cheap trick but it works and makes rendering faster as I have only to do a trace for each visible coordiante on the screen and draw the first non void coordinate in that trace. I saw this solution also used in Gnomoria for instance.

But I am wondering, if anyone has some keywords or hints if there is a more general approach to solve this occlusion problem without falling back using cheap camera tricks.

sentences:
How do I calculate the distance between a point and a rotated rectangle? This question is similar to another one about axis-aligned rectangles. However, I specifically want to calculate this for rotated rectangles.

I have a rectangle with a (cx, cy) for the center point and a width, and height, and a (x, y) for the test point, as well as a θ for the angle of rotation.

What's the fastest way to determine the distance between that point, and the nearest edge of the rectangle? If the point is inside the rectangle, the distance should be zero.

I believe that there is going to be only a small change to the equation in the linked question, but I have no idea what it might be.

sentences:
Input processing performance I'm building a game using SDL in Linux platform.

Now I want to read user input with SDL_GetKeyboardState, but my doubt is wich is the best way using a thread or a timer.

I tried both and I think they work well.

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:
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:
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:
Best algorithm for recursive adjacent tiles? In my game I have a set of tiles placed in a 2D array marked by their Xs and Zs ([1,1],[1,2], etc).

Now, I want a sort of "Paint Bucket" mechanism: Selecting a tile will destroy all adjacent tiles until a condition stops it, let's say, if it hits an object with hasFlag.

Here's what I have so far, I'm sure it's pretty bad, it also freezes everything sometimes:

void destroyAdjacentTiles(int x, int z) {
    int GridSize = Cubes.GetLength(0);
    int minX = x == 0 ? x : x-1;
    int maxX = x == GridSize - 1 ? x : x+1;
    int minZ = z == 0 ? z : z-1;
    int maxZ = z == GridSize - 1 ? z : z+1;

    Debug.Log(string.Format("Cube: {0}, {1}; X {2}-{3}; Z {4}-{5}", x, z, minX, maxX, minZ, maxZ));

    for (int curX = minX; curX <= maxX; curX++) {
        for (int curZ = minZ; curZ <= maxZ; curZ++) {
            if (Cubes[curX, curZ] != Cubes[x, z]) {
                Debug.Log(string.Format("        Checking: {0}, {1}", curX, curZ));
                if (Cubes[curX,curZ] && Cubes[curX,curZ].GetComponent<CubeBehavior>().hasFlag) {
                    Destroy(Cubes[curX,curZ]);
                    destroyAdjacentTiles(curX, curZ);
                }
            }
        }
    }
}

Update: I'm trying the recursive version of the Flood-fill algorithm, but I'm having trouble. In order to check the west adjacent tile, I use x-1, for the east, x+1 etc. Problem is, as soon as x = 0, it will infinitely loop between 0 and 1. I also have to check that that tile exists, so I'm using ifs to figure it out in order to not get an IndexOutOfRangeException (I tried using try/catch, but it's pretty much the same result, I figured this would be simpler). Here's my code right now (yes, I'm reproducing mineSweeper):

bool destroyAdjacentTiles(int x, int z) {
    int GridSize = Cubes.GetLength(0);
    int minX = x == 0 ? x : x-1;
    int maxX = x == GridSize - 1 ? x : x+1;
    int minZ = z == 0 ? z : z-1;
    int maxZ = z == GridSize - 1 ? z : z+1;

    Debug.Log(string.Format("Cube: {0}, {1}; X {2}-{3}; Z {4}-{5}", x, z, minX, maxX, minZ, maxZ));

    CubeBehavior thisCube = Cubes[x, z].GetComponent<CubeBehavior>();

    if (thisCube.isMine) { Destroy(thisCube); Cubes[x,z] = null; return false; } // TO DO: Make this = game over
            // BELOW: Always, no matter what, causes the object to destroy, dunno why. So I removed it for the time being.
    //if (thisCube.surroundingMines >= 1) Destroy(thisCube); return true;

            // if the function doesn't return by now, means it's a to-be-destroyed cube, so destroy it
    //Destroy(thisCube.gameObject);
    //Cubes[x,z] = null;

            //
    if (x > 0) {
        if (Cubes[x-1,z].gameObject) destroyAdjacentTiles(x-1, z);
        if (x < GridSize - 1)
            if (Cubes[x+1,z].gameObject) destroyAdjacentTiles(x+1, z);
    }
    if (z > 0) {
        if (Cubes[x,z-1].gameObject) destroyAdjacentTiles(x, z-1);
        if (z < GridSize - 1)
            if (Cubes[x,z+1].gameObject) destroyAdjacentTiles(x, z+1);
    }

    return true;
}

sentences:
Collision Detection doesnt work because some things move more than 1px at a time I'm writing a 2d scrolling game in javascript using canvas and since I'm limited to setInterval running at minimum once every ms, I need to have some objects moving at greater than 1 pixel a second. I have this for collision detection between objects:

// ** oversee collisions
collisionsInterval = setInterval(function() {

    // outter object
    for(i = 0; i < objectsToCollision.length; i++) {

        // inner object
        for(j = 0; j < objectsToCollision.length; j++) {

            // dont compare an object to itself
            if(i==j) continue;

            // check if they touch on x axis
            if(Math.abs(objectsToCollision[i].centerX - objectsToCollision[j].centerX) <= (objectsToCollision[i].halfWidth + objectsToCollision[j].halfWidth)) {

                // check if they touch on y axis
                if(Math.abs(objectsToCollision[i].centerY - objectsToCollision[j].centerY) <= (objectsToCollision[i].halfHeight + objectsToCollision[j].halfHeight)) {

                    // a collision was detected, do something useful
                    alert();

                }

            }

        }

    }
}, 1);

The problem is, since it wont alert() when two things are about to touch because my objects move at more than 1px at a time. The problem is, some objects might move 3px at a time, some might move at 8px at a time, and I also have gravity occurring so in the Y direction especially the velocity of my objects will really vary.

In my code above objectsToCollision is an array which contains all the objects I'm checking for collisions with. I've modelled what I've done so far after this https://gamedev.stackexchange.com/a/587 but it doesn't discuss how to solve the problem I'm experiencing!

sentences:
Unity WebPlayer : WWW GET Requests fail in webplayer only, not in editor My question is about my game requesting data from my server-side cloud-based storage (I have the option of free public Dropbox or Amazon S3) via GET and the WWW class, and it not working only in the WebPlayer (works fine in the Editor).  By not working, I mean that the request is sent successfully, authorized and responded to by the cloud-service, but that WWW shows an error in the logs.  In the case of using Amazon S3, the Web Player even crashes, otherwise it just fails gracefully and the user is unable to move forward.

The Error log left by the webplayer says the following:

  WWW Error: Error when creating request. GET request with custom
  headers is not supported. for URL:
  https://my-storage.s3.amazonaws.com/myDir/myFile.json

Here's when I use a similar request to a public directory on Dropbox.  There is no crash, but the request also fails.

  WWW Error: Failed downloading
  dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json for
  URL: dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json

Try it for yourself: http://webroleplay.appspot.com   (currently using Dropbox, so not crashing the player)

username: test1

password: t

sentences:
jMonkey Quest Database I am building a game in jMonkey (Java) and I have so far only used default quest text. But now I need to start populating a lot of quests with text. My design requires A LOT of quests texts.

What is the best way to build a database of quest texts in jMonkey? I don't have a lot of real experience with databases. Is there a database that integrates well with jMonkey?

Here are the ideal properties I want in my database, in order of priority:

Reasonably light learning curve
Easy portability (in Java) to Windows, Linux, and Mac OSX
Good interface with Java
Good interface with jMonkey
The ability to add properties to the quests: ID, level, gender, quest chain ID, etc.

Or am I wrong in thinking I need to use some giant monster like SQL? I haven't been able to find much information on this, so are people using some non-database methods for storing things like quest text in jMonkey?

sentences: Check Supported Platforms for Editor How can I find out from script(c#) did I download specific platfrom support for current Unity version?

sentences:
Working with multiple language text files in multilingual games What kind of tools and practices are used for maintaining text for multilingual games? By "text" I mean literally any piece of text you see in the game: dialog, menu options, tutorials, etc.

I want to keep it as modular as possible and make it very easy to add new language options by simply providing a new set of files.

Are there publicly available tools that I can use to maintain these text files and, preferably, pass it to others that can perform the translation process and allow them to put together all of the input data without me having to hardcode anything into the game?

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:
Simple openGL code paradox I'm trying to create the most basic application that will draw a cube using indices and textures for starters, but nothing about it makes any sense whatsoever.

I ran it on my machine with an nVidia card and the display driver (latest, not that it matters) crashes (null ref), along with the program on the glDrawElements(...) command (Renderer.cpp). Fine. Then I sent it to a friend of mine who has an AMD card to try to debug it because I was unable to find the bug in the code, and the program worked (didn't crash) on his machine.

That surprised me since I only did the most basic openGL stuff, no way it was vendor specific. To get to the bottom of this, I downloaded APItrace (http://apitrace.github.io/) to try to see what's going on under the hood of my machine and why does my driver crash.

Once I dumped the trace after I ran the program, it said that the shader program linker failed because I didn't write to gl_Position (which I have).

The problem is that the program links just fine in VS debugger and no error is returned there. So it just keeps getting weirder.

If you want to mess with this, you can get the code (commit with issue linked) at https://github.com/Karlovsky120/7DaysWorldEditor/commit/e86b8be40c81511c4416dc5e253b90e42a5a8ec0

I don't think you'd see the bug if I just pasted the code here, there must be a mistake with the setup somewhere.

I really made an effort to make this as hassle free as possible, it's just one click install: clone it, build it, and you're good to go, no additional setup required. You will need to open it with VS2017 though.

There's a lot of classes in the code, but all of the relevant code is in Scene.cpp and any of the classes it references.

Thank you for any help you give, even if it's just a guess at what might be wrong because I'm at my wits end here.

sentences:
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:
Making a sales curve over time from a static baseline figure I am making a game where there are objects that will be for sale.  The objects have a reputation score, which is the amount of sales they get each week.  This is calculated up front and remains the same for the entire release period.  The release period is also created up front and represents a period of time in weeks.

In my example Object#1 has a sales score of 10,000 and a release period 8 weeks.  This means it will sell 80,000 copies at 10k/week.

My aim is to take this flat line, and curve it, so it has rising sales at the start, a smoothed peak of sales in the middle, and lower sales at the end tailing off, like a gamma probability distribution curve.  The total sales across the period will be the 80,000, but the distribution of weekly sales will change.

I am looking to create this distribution shape from the flat sales total.  I'd ideally like to keep the sales volume the same, but as long as I have that curve, it doesn't matter too much.  I have looked at the Wikipedia entries etc, but they are all about the maths side of distribution, and calculating distribution from figures, I am just looking to fake that distribution from a median figure.

The idea is once I have this algorithm (or a good tutorial), I can play with it to create other unique distributions, adding variety to object releases, to help make things feel less procedural.

(Any help with improving title and tags greatly appreciated).

Edit -----

I realised I missed out a chunk about looking for help with the programming.  I have read a lot of math algorithms but converting what I am learning into code is proving more difficult.  Ideally I'd like links/references to solutions for this from a C# perspective, to help me see my way past issues like the one below.

I have a function in math:
    BetaCDF(x,a,b) = (x>=1)?1:(x<=0)?0:sum[k=1:b] ( Gamma(a+k-1)/(Gamma(a)*Gamma(k)) * xa * (1-x)(k-1) )

that i am trying to convert into a function.  I have everything covered except for the sum.  I need to sum b times the function on the right, however I cannot figure out how to do this in Unity C#.  The function currently looks like this:

public static double BetaCDF(double x, double a, double b) {
    double k;
    return ((x >= 1) ? 1 : (x <= 0) ? 0 : Sum(k = 1,b )(Gamma(a + k - 1) / (Gamma(a) * Gamma(k)) * Math.Pow(x, a) * Math.Pow(1 - x, k - 1)));
}

sentences: What's the difference between creating a Source mod and just creating some levels? I'm just starting to look into creating Source mods for HL2 and I'm a little bit confused. I've gone through some tutorials on level creating to get the basics and it seems to me that it's all that really goes into the creation of a mod. I know I'm wrong so could someone please explain to me where the programming comes in? Is it more than just sticking NPCs and objects on a map?

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:
Libgdx - accelerating string displaying My renderBoard is slow and it's because of font.draw function. I read that I should use stringBuilder instead of string, but it didn't help at all. I suppose I'm using it wrong. Could you guide me to the right way?

public void renderBoard(SpriteBatch sb, BitmapFont font) {
    int L = 0;
    String string;
    ...
    // "size" is a private variable of the class, the same goes for "stringBuilder"
    for(int k = - size + 1; k <= size - 1; k++) {
        for (int j = 1; j <= size - Math.abs(k); j++) {
            string = L + "";
            for(int g = 0; g < string.length(); g++) {
                stringBuilder.setCharAt(g, string.charAt(g));
            }
            sb.draw(
                    this.getTexturesArray().get(L),
                    x_j_k_position,
                    y_j_k_position
            );
            font.setColor(Color.WHITE);
            font.draw(
                    sb,
                    stringBuilder,
                    x_j_k_position,
                    y_j_k_position
            );
            L++;
        }
    }
}

If I comment out the font.draw line, the game accelerates, so I guess here lies the problem.

sentences:
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:
AS3 Air - Custom slider - limit drag position I'm facing issues with finding the right solution for detecting and limiting the Sprite object "Knob" moved on y axis inside it's parent sprite "Frame", using FlashDevelop 5.
Using the code bellow I'm creating the frame on stage
private function init():void{
var frame: Frame = new Frame;
frame.x = 100;
frame.y = 100;
addChild(frame);
}

And in the Frame class, I create the child named "Knob" and add touch event listeners (with multitouch support, therefore using dictionary - Thanks to this post ):
public class Frame extends Sprite
    {
        public var knob: Knob;
        private var curTouchPoints:Dictionary = new Dictionary();

        public function Frame()
        {
            addEventListener(Event.ADDED_TO_STAGE, addListeners);
            init();
        }

        private function addListeners(event:Event):void
        {
            stage.addEventListener(TouchEvent.TOUCH_MOVE, touchMove);
        }

        private function touchStart(e:TouchEvent):void
        {
        curTouchPoints[e.touchPointID] = {obj: e.currentTarget, offsetX: e.localX, offsetY: e.localY}; //store the current object in the dictionary
        trace(e.currentTarget)
        e.currentTarget.addEventListener(TouchEvent.TOUCH_END,touchEnd);
        }

        private function touchMove(e:TouchEvent):void
        {
          if (curTouchPoints[e.touchPointID]) {
          DisplayObject(curTouchPoints[e.touchPointID].obj).y = e.stageY-this.y - curTouchPoints[e.touchPointID].offsetY;
        }
        }

        private function touchEnd(e:TouchEvent):void
        {
        delete curTouchPoints[e.touchPointID];
        e.currentTarget.removeEventListener(TouchEvent.TOUCH_END, touchEnd);
        }

        private function init():void
        {
            this.graphics.beginFill(0xffffff, 1);
            this.graphics.lineStyle(1, 0x000000, 1);
            this.graphics.drawRect(0, 0, 120, 600);
            this.graphics.endFill();

            knob = new Knob;
            knob.x = 20;
            knob.y = 20;
            knob.addEventListener(TouchEvent.TOUCH_BEGIN, touchStart);
            addChild(knob);
        }

    }

The Knob class is simple sprite object:
public function FaderKnob()
        {
            this.graphics.beginFill(0x000000, 1);
            this.graphics.lineStyle(1, 0x000000, 1);
            this.graphics.drawRect(0, 0, 80, 80);
            this.graphics.endFill();
        }

With the current code, it all works as expected except that I want to limit the Knob to never leave it's parent - Frame! Means, it's top coordinate will be 0, and it's bottom should be "Frame.heigth - Knob.height", so it stays fully inside.
I've been searching for the HitTestObject, but that doesn't do the work as the Knob is in the Frame all the time... :/
If it matters: The window is/will be transparent with chroma:none, and both, frame and knob should have alpha 0 (whole app is supposed to be fully transparent, to implement multitouch support on non-multitouch game)
This is done fine now, just mentioning if it might matter for some HitTest procedures based on pixels or something.. I'm fairly new to AS3 and Air so please bare with me :-)
As a side note, I'd need to read the 8-bit "value" (0-255) based on the knob's position in its parent, which I have a slight idea of how to do, but I'm sure there's an easier way than what I imagined.. :)

sentences:
XNA Rotating a Rectangle? I am in the process of making a giant shooter game and I have got to the point where I needed to use rectangles to detect bullets and giants hitting the player. I did that however, if you look at this image:

It shows the giant and the players rectangle, as you can see they are not rotating with the player, any idea how to fix this? Also yes I know they are no the same size as the sprites, that is because I set the size as they were to big before.

Thanks for any help :)

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:
How closely can a game legally resemble another? Most games build on other games' successes and many are downright clones. Where is the limit of imitation before legal issues come into play? Is it down to literary or graphic work like characters and storyline that cause legal problems, or can someone actually claim to own gameplay mechanics?

There are so many similar clone games out there that the rules are probably very slack or nonexistent, but I'd like to hear the views of more experienced developers / designers.

sentences:
OpenGL - white edges on cubes In a minecraft-like game I'm making, I get white edges on my cubes:

It is much more noticeable in darker textures. The textures are being setup like this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Any help?

sentences:
What engine could I use for a simulation? I have a simple requirement:  I want to put some ships (I have some mesh models) on a body of water, with islands, and play with various collision avoidance and command and control algorithms.  So I need a environment where I can modify object behaviour but where the world and its mechanics are already coded.  I was expecting that this would be trivial to find as this is such an obvious requirement for say, AI experimentation.  But I haven't found anything open source or commercial.  I've looked at Glest, Delta3D, Spring, Unity, ORTS, Strive, and VBS2.  I looked for, but never found, the Homeworld Engine.  I also found Breve, Lagoon (seemed perfect), ECSLent, but these were/are either no longer supported or documentation (if it exists) is confusing enough that it isn't clear what can/can't be done or how to go about it.  Interestingly, it seems like you have to roll your own if you have a need eg. Breve, Lagoon.

So I'm putting the question to you:  is there a virtual environment out there, with physics, that would allow a person to focus just on behaviour creation?  What have I missed?  Thanks for any guidance you can provide.

sentences:
How to get map tiles to line up nicely? When I first created my code, there were quite a few cases where I would get horizontal and vertical gaps between tiles when displayed. I put this down to rounding issues with floats and just moved on to other things. Now that I've revisited the issue, I can't seem to get it working properly, even after trying my hardest to eliminate places where this sort of issue might happen. It seems to only happen when I place the camera at certain positions, which is why I think it's likely to be a float issue. If anyone could help me with the correct way to draw the tile layout, it'd be much appreciated.

This is my drawing method for the map:

public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
    var topLeft = Camera.ScreenCoordinateToWorld(new Vector2(0, 0));
    // Readjust the position of the topLeft element so we get the actual
    // drawing position for the tile here
    topLeft = new WorldCoordinate(topLeft.X - 1, topLeft.Y - 1,
                                  -TileSize / 2, -TileSize / 2);
    var topLeftDrawPosition = topLeft.DrawPosition;
    var screenWidthInTiles = Game.GraphicsDevice.Viewport.Width / TileSize + 1;
    var screenHeightInTiles = Game.GraphicsDevice.Viewport.Height / TileSize + 1;

    for (var y = topLeft.Y; y <= topLeft.Y + screenHeightInTiles; y++)
    {
        for (var x = topLeft.X; x <= topLeft.X + screenWidthInTiles; x++)
        {
            if (x < 0 || y < 0 || y >= MapData.Count || x >= MapData[y].Count)
            {
                // Ignore out of range tiles to avoid exceptions
                continue;
            }

            var tile = MapData[y][x];
            var drawPosition = topLeftDrawPosition +
                               new Vector2((x - topLeft.X)*TileSize,
                                           (y - topLeft.Y)*TileSize);
            Tileset[tile].Draw(spriteBatch, drawPosition);
        }
    }

    base.Draw(gameTime, spriteBatch);
}

Broken:

Semi-working:

sentences:
Vuforia is not rendering real world - Camera not rendering real world I follow this guide (How-to-build-an-ar-android-app-with-vuforia-and-unity) but added my own mobile picture in database (as a marker) so that I could see animated object on my mobile and i am able to run my app but camera is not rendering the real world object in scene. instead animated object showing only.
what i am doing wrong?

Remember vuforia doesn't recognize my web-cam profile and apply default profile on it.(Is this a problem )

sentences:
Lighting in 2d isometric games I want to add lighting to an isometric game that I'm working on.

The closest I've come so far is to do a pass over the blocks on the floor and build up a light intensity matrix (based on how far each one is from the nearest light source). Then I've been rendering that with overlay compositing enabled.

This sort of works as a rough prototype, but there are some problems and I don't know whether they're inherent limitations of the way I'm storing the scene.

The floor blocks are stored in a 2d array and the world entities are stored in a list with their own 2d coordinates and height.

That means that if I overlay a light map like I did in the example earlier, the shadow only covers the tile. Entities on the tile are only partially effected by that tile's light value.

Here's an example where the blue tile is the overlaying light tile without blending turned on.

If that character was at the edge of the map, the top half of their body would be unaffected by the lighting.

I could trace rays out through the scene and mark the colliding faces with lightness values, but at that point, I'm not sure how I'd actually render that lightmap onto the screen.

How can I construct a light map that can be rendered over this scene?

sentences:
What are the advantages of putting cheat codes into a game? Some games have cheat codes in them, but I'm not sure I want to add some to mine because I fear they'll ruin the game by making it too easy to beat.

What would be the advantages of putting cheat codes into my game?

sentences:
- 2 Parts: Object/Material displays at 90degrees + Material Mask will not rotate with object? Hi I have a 2 part issue.
Part 1: I have a planet in Unreal, in the object editor it is aligned properly and the material displays correctly but in the game even with the rotation set to 0 it displays as being flipped 90 degrees to one side? Why is this happening and how do I make it display correctly?
Part 2: The material for the planet has a mask on it to make it display day and night. However, when I attempt to manually rotate the object everything BUT the mask rotates which screws everything up. Why does the mask not rotate and how do I make it rotate with the rest for manual manipulation?

sentences:
Love2D : How can I keep up with lots of small sprites' collision data? So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the aforementioned SpriteBatch. Right now, the game determines when the current piece has hit the ground, then that piece is stopped and a new piece spawns that the player now can control.

In order to figure out when to stop dropping the piece, I need to do a collision check. This shouldn't be hard, because I should only have to check the falling piece (unless the current falling piece causes a chain reaction). But, what type of data structure should I use? I can't use the position data of the individual Quads, because the boundary boxes will actually be a different size/shape than the pieces (think triangle pieces, but I will need to use a slightly skinnier rectangle to fit upside-down pieces in between right-side up pieces).

Should I just duplicate the (x, y) pairs using offsets with a width and height, and store them in an array, or am I missing a more obvious/efficient way? I'm guessing that the play screen could fill up with several hundred of these pieces, and if I add two player mode, double that.

EDIT: Here's what the Quad size issue is all about:

sentences:
How to implement a game launch counter in LibGDX I'm writing a game using LibGDX in which I want to save the number of launches of a game in a text file.
So, In the create() of my starter class, I have the following code ..but it's not working

public class MainStarter extends Game {

    private int count;

    @Override
    public void create() {
        // Set up the application
        AppSettings.setUp();
        if(SettingsManager.isFirstLaunch()){
            SettingsManager.createTextFileInLocalStorage("gamedata");
            SettingsManager.writeLine("gamedata", "Launched:"+count ,FileType.LOCAL_FILE );
        }
        else{
            SettingsManager.writeLine("gamedata", "Not First launch :"+count++ ,FileType.LOCAL_FILE );
        }

        //
        // Load assets before setting the screen
        // #####################################
        Assets.loadAll();

        // Set the tests screen
        setScreen(new MainMenuScreen(this, "Main Menu"));
    }
}

What is the proper way to do this?

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: Is it worthwhile recording your own or buying stock sound effects? A unique graphical aesthetic is obviously important when developing a game.  I wonder if the same is true for audio?  Is it worth investing my time in recording, producing my own sounds or should I just buy stock effects?

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:
How to set up a game loop for a project targeting iOS? I'm a fellow game programmer who's done many game engines in Game Maker 8.1, Visual Studio XNA and MonoGame with C#, and one in Java Android with Eclipse. I'm very used to C# and love it plus the VS environment.

Now I'm trying to develop games for the App Store for iPhone and iPad (using Xcode 7 with a Macbook running Yosemite 10.10.5). I don't yet have an actual iPhone to test with, but the simulator is working with the blank and example projects I've found.

By way of googling, this is what I've looked at so far:

http://codewithchris.com/xcode-tutorial/

http://www.raywenderlich.com/40293/learn-to-code-ios-apps-2-strings-arrays-objects-and-classes

There was also a Storyboard example which I did not like. My intuition is to not use a wizard for anything, and the Storyboard builder seemed a lot like Windows Forms when I can just use the XNA draw functions.

Neither of those tutorials was very helpful and now I'm paranoid that I'm on the wrong track. Now I'm asking myself questions like should I be using SpriteKit or SceneKit? Should I be using Swift insteada Objective-C?

The thing is, if I can figure out how to draw pictures in a game loop, then I think I'm all set. However, I think I understand that I'm gonna need at least one UIView or Scene. What I want is a master_draw() function that gets called 30 times per second in main.m, and in master_draw() I loop through all objects and call their individual draw functions. Same thing with a master_update() function.

And I also found this open source example:
https://www.cocoacontrols.com/controls/1w-flappy

That example...I thought it would be the most helpful of all. But I couldn't find any game loop in it at all.

Am I on the right track? Does iOS stuff work totally different than a traditional game loop?

Specifically, I have 2 major questions:

What new project type should I chose? Blank, Single-View, or Game?
How to set up a game loop? (if possible)

What I'm thinking is something like this:

void master_update() // typically called 30 or 60 times per second
{
  foreach (GameObj G in ListOfGameObj)
    G.update(); // update all objects in the list of objects
}

and of course...

void master_draw() // typically called 30 or 60 times per second
{
  foreach (GameObj G in ListOfGameObj)
    G.draw(); // draw all objects in the list of objects
}

Where do I add that code and where do I call it? Is something like this possible in iOS or am i gonna hafta use a completely different architecture?

P.S. The kind of game I'm doing is a simple 2D puzzle where you hafta match up blocks. Nothing too fancy.

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:
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:
Chess Programming - Principal Variation and Transposition Tables Right now I am currently trying to implement a principal variation search algorithm for my chess engine (C++) as well as a transposition table. I have looked at various sources online and have become confused on how to properly store the principal variation. I have seen some sources/implementations use a seperate array of structs that can be indexed at a certain depth to extract the pv move and I have also heard about people storing the principal variation moves within the transposition table. Therefore I have a few questions that I would like to ask to perhapse clear my mistunderstanding.

Should I or should I not have a seperate array to store the principal variation and store it in the transposition table. Which is better?

If I store it in the transposition table the same as other moves, how would I go about preventing that entry from getting overwritten by another move????

Or am I thinking about this wrong? What then is the proper way to do this?

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:
assets access with index offsets My question if about resource management.
Is it a good idea to store resources like Sounds in an array and then make a second array(lets call this SoundCollections) as a sort of reference table(name + index of sounds array).

The SoundCollection structure looks like this:

struct SoundCollection{
    unsigned char name[64];
    unsigned int offset;
    unsigned int count;
};

GameObjects can aqcuire a SoundCollectionHandle and use the SoundCollection[SoundCollectionHandle].offset in the Sounds array.
GameObjects then can call

Audio.playsound(Sounds[SoundCollection[SoundCollectionHandle].offset + PlayerSounds::Jump])

for playing a jump sound.

The SoundCollection::count is used as offset for next SoundCollection and bound checking. The same thing I want to use for Sprites and Textures.

Are there any other methods you usually use in your games?

sentences:
Microphone channel not detected in Unity This is very specific to Unity.

A few testers are reporting that their microphone output isn't being detected. The code below works for the vast majority of users, but certain microphones seem to be outputting on the wrong channel (R maybe)?

 AudioClip current_microphone_recording_clip = Microphone.Start(microphone_name, true, 30, 16000);

How can I capture and analyze output from several channels? I don't see any channels parameter for Microphone.Start

sentences:
OnMouseUpAsButton not always called I'm working on a 2D implementation of Free Cell in Unity 4.6.1, and I'm having trouble getting my click-detection code working consistently. The code below should be called every time a card is clicked (they all have BoxCollider2D components) but it doesn't always happen.

// Handle Clicks on Card
void OnMouseUpAsButton()
{
    print ("test");

    int cardLayerMask = LayerMask.GetMask("Cards");

    RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, cardLayerMask);

    print ("Hit length: " + hit.Length.ToString());

    if (hit.Length > 0)
    {
        print ("Hit");

    }
}

Even the "Test" print statement doesn't get called consistently, so it's not a problem with the raycast. If it manages to print the test, the raycast always works.

Each time the game runs, the cards get dealt onto the playing field randomly into stacks. On each run, some subset of the cards don't call the above code. The number of cards that work correctly varies, as does their position on the field. It's not consistent with any particular card.

I'm wondering if maybe there's an issue with the BoxCollider2D instances overlapping. The other colliders in the scene, like the one on the "table", always trigger OnMouseUpAsButton() successfully.

I need to be able to register clicks on every card, so I need to find a way to make this work.

Have any of you run into a similar issue before? If not, is there a way for me to work around this? Maybe a different way to detect the clicks on the cards?

Here's a screenshot of an example card from the inspector. Aside from transform position & script property values, all of them are identical (from a prefab):

Update w/ Solution from Accepted Answer

Using @Byte56's solution, I was able to take care of this pretty easily. I've included sample code below.

Note that to get the sample to work, the "top" object has to have the highest transform.position.z out of all the objects the raycast hits. I also put all the possible hit objects into their own layers so I can trigger different behavior based on what type of object is clicked.

// Handle clicks
    if (Input.GetMouseButtonDown(0))
    {
        // Cast a ray, get everything it hits
        RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity);

        if (hit.Length > 0)
        {
            // Grab the top hit GameObject
            GameObject lastHitObject = hit[hit.Length - 1].collider.gameObject;

            // Determine layer of last hit object, take next steps as appropriate
            switch (LayerMask.LayerToName(lastHitObject.layer))
            {
            case "Cards":
                print ("Hit card!");
                break;
            case "Table":
                print ("Hit Table!");
                break;
            case "Cells":
                print ("Hit cell!");
                break;
            }
        }
    }

sentences:
How do I disable fog on specific camera/s I'm building an FPS with fog and I want to include a dynamic minimap, showing the locations of player and enemies in real time.
This is utilized by a second camera which is orthographic and looks at the scene from above.

In the minimap, I don't want to see the fog of course.
I've hidden other things from the minimap by using layers and culling masks, however the fog does not belong into any specific layer.

So, how do I disable the fog on just one (or some) camera?

sentences:
Find all tiles by ID in layer In phaser 2.6.2, is there a way to retrieve all tiles given their ID from a TilemapLayer? The method searchTileIndex on Tilemap works well to retrieve a tile. It has a skip parameter that allows to loop through the tiles, so I've come with the following code:

var walls = [];
var skip = 0;
do {
    var tile = map.searchTileIndex(Tiles.ID_WALL, skip, false, wallLayer);
    if (tile !== null) {
        walls.push(tile);
        skip++;
    }
} while (tile !== null);

but it looks very cumbersome to say the least. Am I missing a simpler method, kind of getAllTiles(id) or something?

sentences:
pygame - avoiding sprite 'jitters' on rotating the image Is there a common trick for getting around sprites that are changing directions 'too quickly' and causing their sprite to display erratically?

In this project, the player moves in 8 directions by determining the abs() distance between the mouse's X and Y coordinates and its own obj.rect.center. If the absolute value is less than obj.speed, it simply moves to that point. If it is greater, it moves the distance its speed allows it to move in that direction. When it's time to draw the sprite, PyGame rotates it in accordance to obj.direction by using a dict called SPINNER with stored default values to pass to pygame.transform.rotate.

def draw(obj):
    drawImg = pygame.rotate.transform(obj.img, SPINNER[obj.direction])
    drawCtr = drawImg.get_rect(center=obj.rect.center)
    DISPLAYSURF.blit(drawImg, drawCtr)

This is fine for the foolish AI characters which typically make very few course corrections - however, small movements of the mouse can cause the player's obj.direction to update very quickly, which looks chaotic.

Is there a simple way to curb this behavior? My first guess is to bog down the player object with values that retain its previous state and then determine the amount of rotation to apply, but I have a feeling the better solution is to assign that responsibility to the 'view' and not the 'model'. I'm not sticking to any hard and fast rules regarding MVC, but I am trying to engage in enough separation of concerns that 'view-like methods' don't make 'controller-like' changes to 'model-like' objects, if that makes sense.

sentences: 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:
What can cause shadow slicing while moving camera? Can't explain better than with video: https://youtu.be/4nIMIL6w-0M

The effect I'm trying to achive is a simple fog of war.

See, I have a point light casting shadows on a plane. The plane has a shader which takes light attenuation and either draws a black pixel if there is no light, or discards a pixel to draw background if the light touches that pixel.

After hours spent on this, I came up with a thought that I cannot do anything more.

A problem as I see it:

  Light successefully casts a shadow of shadow casters on a plane, however, with camera at a distance from the shadow, the shadow it self gets splitted and sliced, like it would've been, if some of the shadow casters' faces are suddenly removed from their meshes.

What I have tried:

Changing Z coordinate of a light.
Changing Z height of obstacles (shadow casters).
Changing vertices on the obstacles so that every face would have its own vertices so no faces could share a vertex.
Changing shadow quality in the settings.
Changing camera rendering mode, all four of them.
Changing point light to a spot light with wide cone radius.
Using nice and simple standart unity's shader for a shadow receiver (a plane) - Standart Diffuse.
Switching between hard and soft shadow types.
Changing light's shadow's resolution, shadow strength and biases
Trying out the compiled EXE on another machine.
Changing light's baking type, rage and intensity.
You name it.

None of those had any improvementes on an issue.

I would like to hear authoritive replies (best option would be from the developers) as well as any information you guys think I can try out (so I can do that).

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:
Making pickup objects with gravity that won't push the player on collision I am trying to create pickups, that appear after an enemy dies, and that the player can pick up, but I am running into some issues.
First of all, I want the pickups to be affected by gravity, so I need a rigidbody2d and a boxcollider2d (non-trigger), so this works.

Now, if I want to collect the pickups on contact, I need to make the layers for the loot and the player get in contact, so that they can interact.

Now, of course, I do not want to push the pickups around. I want to actually pick them up when I touch them, but the collider is not a trigger so I thought I would use OnCollisionEnter to handle this.
        void OnCollisionEnter2D(Collision2D other)
        {
            var loot = other.gameObject.GetComponent<ILoot>();

            loot?.PickUp(gameObject); // Destroys also the pickup
        }

While this works, I am still using a non-trigger collider, which means that there are some physics effects that are not desired. For instance, when I "jump" onto the pickups.

Notice the subtle, but still present, slowdown in the fall, when the player enters in touch with the pickups?
How could I solve this issue??

sentences:
Zooming into Mouse Position I'm trying to implement my camera class for a simulation. But I cant figure out how to zoom into my world based on the mouse position. I mean the object under the mouse cursor should remain at the same screen position. My zooming looks like this:

VOID ZoomIn(D3DXMATRIX& WorldMatrix, FLOAT const& MouseX, FLOAT const& MouseY) {
    this->Position.z = this->Position.z * 0.9f;
    D3DXMatrixLookAtLH(&this->ViewMatrix, &this->Position, &this->Target, &this->UpDirection);
}

I passed the world matrix to the function because I had the idea to move my drawing origin according to the mouse position. But I cant find out how to calculate the offset in to move my drawing origin. Anyone got an idea how to calculate this?

Thanks in advance.

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:
Bounce off of objects How do I make my ball bounce off objects on the screen? I'm having trouble detecting the collision, as well as calculating the response.

The picture below is a good example of how the program should be working once the ball runs into an obstacle

I made the ball bounce off the walls, but what's left is making it also bounce off of objects. Thanks for the help!

Here's the source code:

public class 2DGAME extends Application {

    public static Circle circle;
    public static Pane canvas;
    private long counter = 0;
    double X = 0;
    double Y = 0;

    @Override
    public void start(Stage primaryStage) {

        canvas = new Pane();
        Scene scene = new Scene(canvas, 800, 600);

        primaryStage.setTitle("2D Ball Game");
        primaryStage.setScene(scene);
        primaryStage.show();

        circle = new Circle(20, Color.BLUE);
        circle.relocate(100, 100);

        final Rectangle r = new Rectangle(20, 20, Color.DARKMAGENTA);
        r.setLayoutX(400);
        r.setLayoutY(300);

        canvas.getChildren().addAll(circle);
        canvas.getChildren().addAll(r);

        Timeline loop = new Timeline(new KeyFrame(Duration.millis(5), new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X);
                    circle.setLayoutY(circle.getLayoutY() + Y);

//Code to bounce off walls
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

   //Bugged and not sure how to make it work
                    final Bounds rectangleBounds = r.getLayoutBounds();
                    boolean rectangle_left = circle.getLayoutX() <= (rectangleBounds.getMinX() + circle.getRadius());
                    boolean rectangle_right = circle.getLayoutX() >= (rectangleBounds.getMaxX() - circle.getRadius());

   //If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                    }
    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }

    //Bugged code for boucning off obstacle object
                    if (rectangle_left || rectangle_right) {
                       // X = X * - 1;
                    }

                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

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:
Unity / How do I change the color of the "Screen" based on the Object's depth's (as a Screen Effect)? Yesterday I asked and solved my problem:

Unity / How do I change the color of an object based on its depth?

Today I tried to change the script(from yesterday) and apply it to the camera and it did not work.

Every pixel which is printed on the Display has a depth (float), is that right?

Based on that Depth - I want every object to fade grey, relative to the screen distance to that "pixel".

Is this possible?

Or do I have to use that vertex/fragment shader on every single Object and Plane and Sky and everything in the world?

sentences:
unity apply item animation to character I'm trying to change the attack animation of my player in relation to the attack animation for the item he has in his hand.

For example, the default attack animation of my player is puching and once he picked up a sword I want his attack animation to be sword attack, for a hammer a hammer attack, etc ..

I searched a lot on the internet but didn't find much, I saw a few post talking about AnimatorOverrideController but I'm not sure if it's what I need because it overrides every animation clip of the AnimatorController. In my case I just want to change the attack Animation Clip.

So if you cloud give me some tips about the right way to do it, I would really appreciate because I'm a bit confused.

Thanks

Edit : BTW, I'm in Unity 3d

sentences:
Alpha Blending: use the pixel with the smallest alpha I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other pixel(s).

Turn this:

Into this:

In pseudocode, something along the lines of…

if ( newPixel.alpha < currentPixelInFrameBuffer.alpha )
    currentPixelInFrameBuffer = newPixel;

I can't seem to find if there is a native alpha blending command that will do this. There exists DstAlpha, which is an alpha blending property that compares against the current fragment's frame buffer source alpha value, but I obviously cannot use that in the following manner…

AlphaTest Less DstAlpha

I've found there's a BlendOp Min, which is supposed to "Use the smaller of source and destination." but I can't seem to get that to work and I can't find documentation on what it means by 'smaller'.

sentences:
Peer-to-peer first person shooter I've been developing a first person shooter/massive multiplayer online roleplaying game for my small business, and was wondering if it would be feasible to use peer-to-peer technology to communicate between players, without the use of an intermediary server (as our company does not have enough funds for a high-speed connection to run a game server on). How would such Peer-to-peer technology be best implemented in such a game? Here's a few of the options I've been considering:
a) Divide the game into segments, and have each segment be played on a separate P2P "mesh" (currently named XRevolution)
b) Have one mesh for all portions of the game, and place all of the players on a single grid
c) Some other P2P solution
I've already used option A (considering only one area of the game is done) on a small scale (4 computers), but am wondering how well that would scale when thousands of computers would potentially be bound to the same mesh.
Here's a list of possible concerns with P2P technology

During penetration testing, it was identified that a client could spoof packets to lie about the state of the game to other peers, allowing people to cheat. This is identified as "medium" risk, as it could be prevented to a certain extent through various security routines that would be integrated within the game (such as encryption, movement prediction, double-checking state with other peers, AI, etc.)
Lag was originally a problem on slower networks, but now movement prediction and other techniques are used to reduce the effect of lag, and disconnect peers whose lag is too high. However, a problem which remains is the amount of time it would take on a larger-scale network to find peers (other players), and establish connections. Due to the amount of time it would take to connect to so many peers, solution A would seem optimal to solve this particular problem
A problem with solution A, would be in-game chat between meshes (as no two peers in different meshes can communicate with each other, except for the purpose of relaying), however, this problem could be potentially solved by using something in-between solutions A and B (such as creating a separate mesh for inter-mesh communication, which would be specific to each player or something)
What's the best way to do something like this? Solution A, or B, something in-between the two, or an entirely different solution altogether. Due to our budget, using a server to facilitate communication between players is completely out of the question, so it would be nice to use a P2P solution, otherwise the project would have to be abandoned.

sentences:
Why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix? I'm working on a 2D game engine project, and I want to implement matrices for my transformations. I'm going to use the GLM library.

Since my game is only 2D, I figured I only need a 3x3 matrix to combine the translation, rotation and scale operations. However, glm::translation is only overloaded to return a 4x4 matrix, and never a 3x3.

I thought a translation could be performed by using a 3x3 matrix; why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix?

sentences: How do you capture keyboard and mouse input for an HTML5 game? Is there an accepted method for capturing player input in HTML5 games? I have seen several methods, and the browsers seem to be in varying states of implementation; On MDN they tell you not to use both the newer and older implementations. I'm open to methods utilizing various libraries, but I would also like to see a pure JavaScript and DOM version as well.

sentences: New to creating AI - where to start? I am new to game programming and am trying to make a basic 2d top-down space game with 2 space ships that fight each other.  I am doing well with the user controlled space ship, but have no idea how to even start programming an AI.  Are certain methods/patterns better for this situation?  Where would I even begin?

sentences:
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:
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:
JavaScript - Updating a canvas real-time... from server-side or client-side I have this 2D tilemap game 13x13 viewport (169 tiles drawn on canvas at a time) of a 150x150 map. Each tile is 32x32px. Obviously I only update the 13x13 viewport...

I want to update a canvas in real-time as the world-map will be handled server-side. At least the logic... the drawning... should it be server-side or client-side?

Now, I am using Socket.IO for real-time data. Based on that current player's x and y, the canvas is drawn from where that person is on the map.

I can do this two ways:

(Server-side) Use node-canvas to draw the  server-side via NodeJS and
transmit back the new canvas. Is it possible? Because it seems I can
only do it once via a PNG.
(Client-side) Transmit the 169 array of the new tileset (when player moves or action happens). Doing the
logic server-side and draw it on the client-side from the array received from a callback.

Client-side problem: The problem here is that transmitting that large of an array does take seconds (2-3) so there is some lag.

Server-side problem: There is no continuous streaming of a canvas being drawn from the server that outputs to client... is there? Or am I not looking hard enough at node-canvas npm module.

I am not using any JavaScript game framework.

What are my best options here?

sentences:
Cascade(Waterfalls) particles animation - openframeworks, alternatives Has anyone tried to create a waterfall particles animation using openframeworks? Is it possible? Is it good?

If not, can you recommend any other frameworks for easier creation of cascade animation?

Thanks a LOT!

sentences:
When is the best time to consider performance? I am coming from software development background. During the software
  development cycle, we usually focus on functionalities and the working
  product. At the end of development, we start optimizing the code and
  improving performance.

Now the question is, do we need to think about performance in every single line of code in game development?

Doing so I feel we miss the design patterns and clean code. I was wondering if there is any best practice approach in game development industry?

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:
Looking for a square-to-hex pixel coords algorithm So as the headline suggests, I am looking for an algorithm/algorithms used for square-to-hex and hex-to-square pixel coordinates convertion.

I have an image which looks kinda "interpolated", meaning some pixels are of one colour, while some have a slightly different shade etc. So pixel colour kinda stores offset or whatever. If you're interested, it's here

It has to do with pathfinding, the logical part of map is made of hexmap while the visual part of map is made of squares. Here, size of the square = 1 pixel, same hex size is equal to 1 pixel.

So basically I will be trying to convert an image with hex pixel coords to image with square pixel coords and vise versa.

I'm sorry if this was answered already somewhere, I couldn't find it anywhere.

P.S. I reverse engineered the image, so in binary it was only X and Y coords stored plus a third byte value which I took as a greyscale colour (later compared with another image and it matched)

Image:

sentences:
Having problems with making a button class (checkIfClick) opengl Just basing how sfml does it, I get the globalbound of the object and then check if the mouseposition is within the object. I tried do something like that but I dont know exactly how to do it with opengl. I tried changing the projection from -1 to 1 coords to the size of the application in the hope I could just get the position of the object, but when doing std::cout, it still shows the position in -1 to 1 coords.
So my question is:  "How would I convert my mouseposition to -1 to 1 or vi-versa."
Its actually 0 to 2 and not -1 to 1
So far i have this:
I dont know exactly how to get the top left right with opengl I know with sfml. I would use the position and subtract the half of the width and height to get it but like I said, idk how to do that in opengl. I tried doing that but the object position i still -1 to 1 even though I passed in the
 glm::mat4 proj = glm::ortho(0,width, 0, height,-1,1);

I know my projection is working, because when I enter any big number, my object gets really small.
FYI, just because I see these types of answers alot; I'm not asking you to write me a fully functional button class. I just want a general idea on how it would be done or some article that could help me do that (or a very basic example).
void contain(glm::vec2 position)
{
    if (position.x >= button.left && position.x <= button.right
    && position.y >= button.top && position.y <= button.bottom) {
        std::cout << "True\n";
    }
    else {
        std::cout << "False\n";
    }
}

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: Unity 2d, Place object nearest to a coordinate without overlap? I am working on a game similar to Pool (Carrom actually). I need to place coins at the center of the board or nearest possible to it without overlapping any other coins. This is a 2d game.

sentences:
LibGDX buttons bounds are wrong I am making a simple gui in libgdx and run into this problem ; when you click on the button it's bounds (?) are wrong since if I click under it, the game registers it as a click.

On the other end, if I click it at the top it won't get the click. It seems like the bounds are a bit under the button. I tried to set manually but nothing.

Also i tried changing sizes.

Looked here : too this is almost the same but no answer..

tabl = new Table();
    stage =new Stage();
    tabl.setSize(stage.getWidth()/2, stage.getHeight()/2);
    tabl.defaults().size(500, 40);

    g = game;

    Gdx.input.setInputProcessor(stage);

    skin = new Skin();

    TextureAtlas te = new TextureAtlas(Gdx.files.internal("uiskin.atlas"));

    skin.addRegions(te);
    skin.add("default-font", new BitmapFont());
    skin.load(Gdx.files.internal("uiskin.json"));

    Pixmap r = new Pixmap(100,100,Format.RGBA8888);
    r.setColor(0xff0000ff);

    r.fillRectangle(1, 1, 13, 13);
    Texture s = new Texture(r);
    SpriteDrawable s1 = new SpriteDrawable(new Sprite(s));

    TextButton gam = new TextButton("new games",skin);

    gam.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
                int pointer, int button) {
            // TODO Auto-generated method stub
            //g.setScreen(null);
            new Logger("e").setLevel(10);
            return true;
        }
    });

    /*super.getS*/
    LabelStyle tt = new LabelStyle(new BitmapFont(), Color.BLUE);
    Label l = new Label("d",tt);

    tabl.add(gam);

    tabl.setDebug(true);

    stage.addActor(tabl);

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: Is it possible to make a text based game and filter bad stuff? I was thinking of a text based game where the users type in various "things."  But I know it will quickly degenerate into filth.  Is there any way to stop something like this?

sentences:
Create Script from custom templates issue: They are created with the default name and cannot been named on creation I was just being introduced to the AssetDatabase class, and I was curious of creating Script Templates, such as Interfaces, pure C# classes, and a MonoBehaviour template more suitable for my work style.

I tried to emulate a solution I found on Unity Forums, and the template creation goes well, except that the name gets setted once it is created, and it doesn't let you name the created asset, as the Unity Scripts let you once you create them. The fact that the name is not changed by the user, makes the script on its default state, with the exact code the template has, without changing the #SCRIPTNAME#s declared, throwing errors, and being counterproductive with the time optimization goals I had in mind.

using UnityEditor;
using UnityEngine;
using System.IO;

public class CustomScriptsCreator
{
    public const string CONTEXT_MENU_PATH = "Assets/Create/Custom Scripts";     /// <summary>Custom Scripts default Path.</summary>
    public const string CONTEXT_MENU_CUSTOM_C_SHARP = "/C# MonoBehaviour";
    public const string CUSTOM_TEMPLATE_FOLDER_PATH = "Assets/Custom Script Templates";
    public const string CUSTOM_C_SHARP_TEMPLATE_PATH = "C#Script_CustomMonoBehaviourScript.cs.txt";
    public const string PATH_NOT_FOUND_MESSAGE = "Script Template Not Found";
    public const string WINDOW_ERROR_MESSAGE = "There is no Template at path: \n\n";
    public const string WINDOW_OK_ANSWER = "Ok";

[MenuItem(CONTEXT_MENU_PATH + CONTEXT_MENU_CUSTOM_C_SHARP)]
public static void Create(MenuCommand _cmd)
{
    Object selection = Selection.activeObject;

    if (selection != null)
    {
        string path = AssetDatabase.GetAssetPath(selection);

        if (File.Exists(path))
        {
            path = Path.GetDirectoryName(path);
        }
        if (string.IsNullOrEmpty(path))
        {
            path = "Assets/";
        }

        /// THIS WAS JUST A FAILED TEST...
        /*Object obj = Resources.Load("ScriptTemplates/" + CUSTOM_C_SHARP_TEMPLATE_PATH);

        if(obj != null)
        {
            AssetDatabase.CreateAsset(obj, Path.Combine(path, "NewScript.cs"));
        }
        else
        {
            EditorUtility.DisplayDialog
            (
                PATH_NOT_FOUND_MESSAGE,
                WINDOW_ERROR_MESSAGE + (CUSTOM_TEMPLATE_FOLDER_PATH + "/" + CUSTOM_C_SHARP_TEMPLATE_PATH),
                WINDOW_OK_ANSWER
            );
        }*/

        //string newName = EditorUtility.SaveFilePanelInProject("Save Your Prefab", "NewScript.cs", "cs", "Please select file name to save prefab to:");
        //File.Copy((CUSTOM_TEMPLATE_FOLDER_PATH + "/" + CUSTOM_C_SHARP_TEMPLATE_PATH), Path.Combine(path, "NewScript.cs"));
        if(AssetDatabase.CopyAsset((CUSTOM_TEMPLATE_FOLDER_PATH + "/" + CUSTOM_C_SHARP_TEMPLATE_PATH), Path.Combine(path, "NewName.cs")))
        {
            // IT CHANGES THE FILE NAME SUCCESSFULLY, BUT NOT ON THE SCRIPT.
            //AssetDatabase.RenameAsset(Path.Combine(path, "NewName.cs"), "KillMePlease.cs");

            AssetDatabase.Refresh();
        }
        else
        {
            EditorUtility.DisplayDialog
            (
                PATH_NOT_FOUND_MESSAGE,
                WINDOW_ERROR_MESSAGE + ((CUSTOM_TEMPLATE_FOLDER_PATH + "/" + CUSTOM_C_SHARP_TEMPLATE_PATH)),
                WINDOW_OK_ANSWER
            );
        }
    }

}

}

The paths are ok, since the script is being created. If there is more information you need, let me know. Thanks in advance.

sentences: where can I get people to create project with me? I've almost finished my studies. Actually I am looking for job to get experience but besides this I have a lot of free time. Could you tell me where can I (make relationship with ) find new people who also likes create new games or apps in java/c# and work together?

sentences:
Set multiple render targets with OMSetRenderTargets using ComPtr I've recently decided to get rid of pretty much all of the raw pointers from my Direct3D code, and I ran into a problem with using ComPtr<T> template with multiple render targets.

Microsoft suggests using ComPtr<T> for D3D instead of unique_ptr<T> or shared_ptr<T>. However even their example shows how to use it with OMSetRenderTargets, but I couldn't really find anything how to use it when you have to bind an array of managed objects.

Here's some code of my current solution:

class Texture{
public:
    void Initialize(const Bitmap &bitmap){ /* ... */}

    ID3D11ShaderResourceView* GetShaderResourceView() const { return this->m_pResourceView; }
    ID3D11RenderTargetView* GetRenderTargetView() const { return this->m_pTargetView; }
    ID3D11Resource* GetTextureResource() const { return this->m_pTexture; }

    ID3D11Texture2D* GetTexture2D() const { return static_cast<ID3D11Texture2D*>(this->m_pTexture); }

private:
    ID3D11ShaderResourceView * m_pResourceView;
    ID3D11RenderTargetView * m_pTargetView;
    ID3D11Resource * m_pTexture;
}

class Renderer{
public:
    void Initialize(const Window & targetWindow){ /* ... */ }

    void SetDepthStencilView(ID3D11DepthStencilView* pDepthStencilView = nullptr){
        n = n < RENDER_TARGET_MAX ? n : RENDER_TARGET_MAX;
        if (!n && pRenderTargetView == nullptr) {
            m_renderTargetViews[0] = m_myRenderTargetView;
        } else {
            m_renderTargetViews[n] = pRenderTargetView;
        }
    }

    void SetRenderTargetView(ID3D11RenderTargetView* pRenderTargetView = nullptr, size_t n = 0){
        if (pDepthStencilview == nullptr) {
            m_depthStencilView = m_myDepthStencilView;
        }
        else {
            m_depthStencilView = pDepthStencilview;
        }
    }

    void ApplyRenderTargetView(size_t count = 1){
        m_renderTargetViewCount = count < RENDER_TARGET_MAX ? count : RENDER_TARGET_MAX;
        m_deviceContext->OMSetRenderTargets(m_renderTargetViewCount, m_renderTargetViews, m_depthStencilView);
    }

private:
    ID3D11Device* m_device; // device context, swap chain, raster state, etc ...
    ID3D11RenderTargetView* m_renderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT], *m_myRenderTargetView; // This is the screen as a default
    size_t m_renderTargetViewCount;
    // depth stencil buffer, etc ...
}

void some_use_case(Renderer & render){
    Texture colorMap;
    Texture normalMap;
    Texture positionMap;

    render.SetRenderTargetView(colorMap.GetRenderTargetView(), 0);
    render.SetRenderTargetView(normalMap.GetRenderTargetView(), 1);
    render.SetRenderTargetView(positionMap.GetRenderTargetView(), 2);

    // ... Render geometry
    // ... Render posteffects
}

Keep tracking and releasing all of the resources are way too tedious, and It's reasonable to introduce some smart pointer solution here. How could I replace the pointer definition, and how could I bind it m_renderTargetViews to OMSetRenderTargets?

sentences:
How to handle keyup events in game loop? I'm writing a simple game in JavaScript, which already handles basic keyboard input like so:

var input = {};
while (!done) {
    handleInput(input);
    update();
    render();
}

document.onkeydown = function(e) {
    input[e.keyCode] = true;
}
document.onkeyup = function(e) {
    input[e.keyCode] = false;
}

Now I need the game to handle key combos (like CTRL+X for example). I would like it to accept such combos on keyup only.

Two possible solutions that come into my mind are:

exposing an array containing a list of keyup events (object with "main" key plus modifiers). The handleInput function would be responsible for draining the queue every time it polls it
keeping track of possible key combos inside handleInput (watching for held down modifier keys) and trigger the combo behavior when the "main" key goes up (I actually don't like this that much)

Would you suggest me an elegant way to extend the current functionality?

sentences:
How can I write a dots effect shader when the character is behind an object? I watched an interesting effect while I was playing Super Mario Odyssey: when Mario or another character was behind an obstacle (walls, etc), a tiny gray silhouette mesh appears.

I tried to build something similar using an amplify shader with Unity but I could not achieve it.

How could I write this?

Here is an example from the game:

sentences:
In WebGL, how can I efficiently render a mesh many times per frame, without instancing? I'm using WebGL and I want to render a single mesh many times at different locations. I know about WebGL 2's drawArraysInstanced() and drawElementsInstanced() calls, but I think only Firefox supports them now.

The only solutions I see are :

Put all the meshes in a single buffer and render it with a single call to drawArrays()/drawElements(), but that would be a waste of memory because the mesh contains a lot of vertices and if the meshes are not static I would need to re-load the vertices in gpu memory every frame or so.
Have a single mesh in memory and render each instance with a separate call to drawArrays()/drawElements(), updating the model matrix between each call. I don't think that's the best way.

Any ideas?
Thanks

sentences:
translating canvas for rotating sprites that shoot I am trying to align bullets to my different sprites guns (top down 2D for android). Right now Im using this method to draw my bullets:

public void draw(Canvas canvas){
    update();
    canvas.save();
    canvas.rotate(angle, x + width / 2, y + height / 2);
    canvas.translate(translaterX, translaterY);
    canvas.drawBitmap(bitmap, x, y, null);
    canvas.restore();
}

The problem here is the translater, Im always having to add or substract from it to make the bullets spawn from my gun when my sprites rotate and I cant figure it out, is there any standard value for this, like translaterX = bitmap.getwidth()/2? I dont really understand how the translater works and I feel like Ive tried everything, what am I missing? For the examples sake lets say that my gun is always in the middle of the bitmap.

Or is there even another way to do this that is simpler?

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:
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:
Heightmap-based Terrain with a Road What's the best way to implement a detail feature, like a road, on a heightmap-based terrain?

Update: It's a bit hard to see in the image, but the road descends from the top of the quarry to do its base.

sentences:
add physics to a group or container body in phaser I'm developing a HTML5 Phaser game. In this game I do have a Group which I would like to behavior as a physics body (arcade-physics).

It is a character with a lot of moving parts (sprites) inside this group. In this case the group acts like a container for the sprites.

However I only able do add physics behavior to a sprite.

game.physics.arcade.enable(mySprite); // works good!

Doing the same to a group does not works. it only add physics to children sprites

game.physics.arcade.enable(myroup) // does no works
myGroup.body.(...)  // body is undefined

I would like to create a "virtual" body to this group, mannually set dimensions for it (body.setSize) and add all my sprites inside it. Is that possible in any another way?

sentences:
How do I draw multiple irregular polygons with OpenGL ES? In this post I was asking how to program a map of a Risk-like game.
Now that the map is pretty coded, both client and server-side, I'd like to finally draw the map.
I'll try to keep least broad as possible in this question, and also avoid XY problem.
So, my X problem is that I need an interactive map, based on (irregular) polygons.
Now, since this question would be really broad (there is a heavy number of possible solutions and libraries for a skilled programmer), this is how I imagined my Y solution:
Since the polygons have to be 10,  touch-interactive, filled with plain color, I think that OpenGL ES should go fine for me. I'm also attracted by Path and Point classes, but the problem is that

The map should be displayed for lot of different screen sizes, but at the same time it should keep its ratio, instead of appearing more large or more little in the Activity.

The polygons have to be drawn to fit each others.

Every polygon should be touchable and the event should differ from the others. Also their color could change depending of the situation.

I don't know if Path and Point classes would fit for this. My intent is more game-like than generic, so I think I'll stick with OpenGL ES solution.
The problem is that I don't understand

How can I map the polygons vertex and dimension for different screen sizes?

(considering we're talking about 10 polygons, there is a kind of environnment for doing this?)

Should I use triangulation or not? I've done lot of research but this point wasn't clear to me.

I followed Android Open GL tutorial, but it only shows simple polygons and alone, I'd need 10 with lot of vertexes and above all that can fit each others.
How can I do this?
EDIT: I also tried to follow this tutorial. This is an image taken from that one:

(source: xamarin.com)
To me instead, it's more little and near top-left corner. This is another trouble I'd like to avoid (as I said in point 1 above): my polygons should always fit the screen (and this is also why I want to use OpenGL ES).

sentences:
Isometric Collision Detection I am having some issues with trying to detect collision of two isometric tile.

I have tried plotting the lines between each point on the tile and then checking for line intercepts however that didn't work (probably due to incorrect formula)

After looking into this for awhile today I believe I am thinking to much into it and there must be a easier way.

I am not looking for code just some advise on the best way to achieve detection of overlap

sentences:
iPhone/OpenGL-ES partially texture mapping an object I only have a basic understanding of OpenGL, so I'm probably showing my ignorance here.

I'm looking for a great iPhone/OpenGL-ES example of applying a texture (preferably from a texture atlas, but not really a requirement) to specific parts of some arbitrary object/model.

I have a game where 3D tiles "flip" to reveal some other texture on the backside of the tile.  I created the model in Blender and exported it to an Objective-C header.  The tile isn't a simple "cube", but it is relatively cube-shaped.  Everything works great when I use a single texture that simply wraps the entire model.  But I'm struggling to figure out how I can restrict that texture to just specific parts of the model.

To complicate things even more, I ultimately want to texture it with three different images.  The top will have "image x", the sides of the tile will have "image y", and the back will have "image z".

Thanks!

sentences:
Game engine: a decent way, architecture-wise, to implement scripting support? I am developing a simple game engine (in C#, if it matters), and I can't think of a decent enough way to implement scripting in terms of architecture.

It's a simple turn-based strategy with custom, logic-independent animations for battles. It has a global architecture layer for system/low-level stuff and, most importantly, two main modules - logic and game-view thingy - that communicate using an event manager.

And the thing is, I would really like to have the scripts influence both stuff related to the game logic (changing unit parameters, etc) and stuff related to the game-view, such as special animations/dialogues for battles that might depend on a certain scripted trigger.

(To be honest, ideally I want the script to control the game flow, leaving only the core mechanics/graphics to the logic/view, but I'm new to this, so I'm not sure I can do it right now)

I've been thinking of three options:

Just let the scripting live in the logic, but let it know about the graphical side of the game. But this would make the logic/view division very vague, won't it...
Make the scripting a separate module that will exchange events with the others using the same event manager. But this would require to be very careful about event synchronization, I guess... and also add a whopping lot of event types to the manager. (Still, personal favorite)
Make the scripting a module above all, so it can directly influence/call functions of the logic/view. This allows for an inherently wider functionality at the cost of sort of screwing the entire event exchange scheme and being afraid that the script can break stuff even when it really shouldn't.

So, I can neither decide on one of these nor think of a better way to insert the scripting module... Any suggestions or useful links?

Thank you!

P.s. thanks for migrating the question, didn't know there was a specialized section for gamedev

sentences:
Alpha Value at 0 Shows Black for Android Canvas Bitmap There have been a few questions similar to this but none seem to give a straight answer. If I am creating a Bitmap from a .png image and want to set a color (i.e. true pink) to transparent, the color turns black instead. I am using get and set pixel methods, iterating through an array of pixel colors.

The method I wish to accomplish this in is as follows:

public Bitmap getFormattedBitmap(Bitmap bm, int newHeight, int newWidth, int r, int g, int b, int a) {
int width = bm.getWidth();
int height = bm.getHeight();
int pixNum = width * height;
int[] pixels = new int[pixNum];
int scaleWidth =  newWidth * width;
int scaleHeight = newHeight * height;

bm.getPixels(pixels, 0, width, 0, 0, width, height);

for(int k = 0; k < height; k++) {
   for(int j = 0; j < width; j++ ) {
        int red   = Color.red(bm.getPixel(j, k));
        int green = Color.green(bm.getPixel(j, k));
        int blue  = Color.blue(bm.getPixel(j, k));
        int alpha = Color.alpha(bm.getPixel(j, k));
        int index = k * width + j;

        if(red == 0 && green == 0 && blue == 0 && alpha == 255) {
            pixels[index] = Color.argb(a, r, g, b);
        }
        else {
            pixels[index] = Color.argb(0, 255, 255, 255);
        }
    }
}

bm.setPixels(pixels, 0, width, 0, 0, width, height);

Bitmap resizedBitmap = Bitmap.createScaledBitmap(bm, scaleWidth, scaleHeight, true);
return resizedBitmap;

}

As you can see, I am using the Color.argb() method to set the alpha to 0, but in reality, it just shows those parts as black on the screen. I recognize bitmaps don't take kindly to alpha channels (unless you configure it to ARGB_8888), but this has me stumped.  It is also interesting to note that I do have SOME control of alpha via the Color.argb() method, it is just if it is too close to 0 it turns black anyway. Something in that method or whatever I am doing does not like full transparency apparently.

sentences:
How to create a grid based on random shapes? How to create a "grid" using actionscript like the image below?

Basically you have an area of 1100x615 which should be filled with shapes that could be rotated and scaled...

Collision detection perhaps or something less cpu intensive for flash (as3) to manage?

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:
Poor text rendering quality with freetype This is my first time that I use freetype library and I think I've got some problems. Right now, I draw the bitmap generated by freetype, but the generated image is really low quality. I've been reading about hinting and anti-aliasing, but the thing is none of them helped me and the problem is still here.

Take a look at my picture:

You can actually see what I mean.

I have applied a vertical hinting before rendering in my font class:

float scale = 100.0f;
FT_Matrix transform =
{
    (int)((1.0 / scale) * 0x10000L),
    (int)((0.0) * 0x10000L),
    (int)((0.0) * 0x10000L),
    (int)((1.0) * 0x10000L)
};

FT_Set_Char_Size(this->mFace, 0, (int)(this->mSize * 64), (FT_UInt)(72 * scale), 72);
FT_Set_Transform(this->mFace, &transform, NULL);

I'm loading the character with:

FT_Load_Char(this->mpFont->Face(), this->mText[i], FT_LOAD_RENDER);

which is supposed to make the generated bitmap anti-aliased immediately as documentation has stated.

The part which I translate the buffer is here:

...
    BYTE intensity = bitmap->buffer[q * bitmap->pitch + p];
    D3DXCOLOR pixel(this->mColor.r * intensity,
    this->mColor.g * intensity,
    this->mColor.b * intensity,
    this->mColor.a * intensity);

    this->mpTexture->SetPixel(i, j, pixel);
...

My texture format is A8R8G8B8 and I don't think I have anything wrong with my texture rendering part. The only thing that I'm not sure this is related to is the resolution. Currently I'm using the window size (640x480) which turns to lower resolution for device because of borders. By the way, this is a regular Tahoma font that I've used.

sentences:
Collision Problems in Pacman Clone I am working on a Pacman clone. I am using Java for the project. I have been having problems with collisions, and allowing the player to pass through objects. Note that the tile size (and player) is 16x16px.

Here is the collision code in the player class.

private void processInput(Input input, int delta)  {
    if (input.isKeyDown(Input.KEY_LEFT) || input.isKeyDown(Input.KEY_RIGHT) ||
        input.isKeyDown(Input.KEY_UP) || input.isKeyDown(Input.KEY_DOWN))  {

        if (input.isKeyDown(Input.KEY_LEFT))  {
            velocity =  new Vector2(-1 * speed * delta, 0);

            rotation = 180f;
        }
        else if (input.isKeyDown(Input.KEY_RIGHT))  {
            velocity = new Vector2(1 * speed * delta, 0);

            rotation = 0f;
        }
        else if (input.isKeyDown(Input.KEY_UP))  {
            velocity = new Vector2(0, -1 * speed * delta);

            rotation = 270f;
        }
        else if (input.isKeyDown(Input.KEY_DOWN))  {
            velocity = new Vector2(0, 1 * speed * delta);

            rotation = 90f;
        }
    }

    processCollision();

    this.position.x += velocity.x;
    this.position.y += velocity.y;
}

private void processCollision()  {
    this.positionTile = new Vector2(position.x, position.y);

    this.positionTile.x -= board.getX();
    this.positionTile.y -= board.getY();

    this.positionTile.x /= 16;
    this.positionTile.y /= 16;

    Vector2 normalisedVelocity = new Vector2(velocity.x, velocity.y);
    normalisedVelocity = velocity.getNormal();

    if (collision(normalisedVelocity))  {
        velocity = Vector2.ZERO;
    }
}

private boolean collision(Vector2 direction)  {
    Vector2 index = new Vector2(positionTile.x + direction.x, positionTile.y + direction.y);

    if (!board.getTiles()[(int)index.y][(int)index.x].collidable)  {
        return true;
    }

    return false;
}

And here is the board class.

public class Board {
    TileSheet sheet;
    TileRenderer renderer;

    Tile[][] tiles;

    Vector2 initPlayerPosition;

    float x = 0;
    float y = 0;

    public float getX()  {
        return x;
    }

    public float getY()  {
        return y;
    }

    public TileSheet getSheet()  {
        return sheet;
    }

    public Tile[][] getTiles()  {
        return tiles;
    }

    public int getWidth()  {
        return tiles[0].length;
    }

    public int getHeight()  {
        return tiles.length;
    }

    public Vector2 getInitPosition()  {
        return initPlayerPosition;
    }

    public Board()  {
    }

    public void loadLevel(String name)  {

        // Temp, the following five lines (including the whitespace) look ugly
        // TODO: Make the map placing dynamic
        this.x = 800 / 2 - (tiles.length * sheet.getTileWidth()) / 2;
        this.y = 20;

        initPlayerPosition.x += this.x;
        initPlayerPosition.y += this.y;
    }

    public void init(GameContainer gameContainer, StateBasedGame game) throws SlickException  {
        Image sheetImg = new Image("data/textures/tileset.png");
        sheet = new TileSheet(sheetImg, 16, 16, 1.0f);

        renderer = new TileRenderer(this);
    }

    public void render(GameContainer gameContainer, StateBasedGame game, Graphics graphics)  {
        renderer.render(tiles, gameContainer, game, graphics);
    }

...

public class Tile  {
    int sheetX;
    int sheetY;

    bool collidable;

    public Tile(int sheetX, int sheetY)  {
        this.sheetX = sheetX;
        this.sheetY = sheetY;

        // If there is nothing (0,0) allow the player to collide
        if (sheetX == 0 &&
            sheetY == 0)  {
           collidable = true;
        }  else  {
           collidable = false;
        }
    }
}

Any ideas?

sentences:
Create shadow for SkinnedEffect model I've followed a tutorial that uses the XNA 4 SkinnedEffect for my animation on that model . How can i also make a shadow for my SkinnedEffect model ?

Thanks !

sentences:
Designing score system: Combos, chains, multipliers and bonuses I am making a breakout-clone, I not want only want it to feel "arcade" for home users, but it will have a arcade version (although probably noone will buy, and I will only use the machine to amuse other people...), this make scoring, and high-scores a important part of it, it has no multiplayer, with the community existing around how to score higher and higher scores.

Being a breakout game, if the score is just linear, everyone that "finish" the game, will attain the same maximum score... Obviously this is undesirable, specially because the game DOES have a end, you cannot play it forever until you lose...

So, how to design some decent score system? Currently I added a multiplier, and it increases when you kill several blocks fast, but this has the unintended side effect of creating absurdly high scores near the end of the game when you are highly powerful (yes, my game is not only about batting the ball :P) and can clear a whole bunch of blocks at once...

To make it more clear, you have 5 frames to kill another block and increase the multiplier, on the start of the game, only batting the ball, this only happen when you manage to get the ball stuck behind the wall (something that is desirable to reward... several players plainly have a CRAVING to attempt that), and if you are a MASTER breakout player, you can score on the first five levels something like 100k points... Yet, on one of the late levels, if you use in a mediocre way (not even good way) the powers, you can easily rack-up 2 million points in a single level (and no, my game does not have points padded with 0! Some stuff DO reward you with 1 point, or 10... It is just the multiplier increase of 5 frame kill that skyrocket...)

I want to add more mechanics, fix this one, and make lots of stuff rewardable, stuff that make the screen shine, blink, show pretty stuff and make the player go "WOW, DID YOU SEE THAT?" and tap his friend in the shoulder, and then when he make it on purpose he screams: "HAHAAAA, I AM AWESOME AND YOU SUCK!!! DO IT TOO!! I DARE YOU!!!"

Note: Although the theme here is breakout, no problem in crossing genres, shmups are particularly good in this area, Radiant Silvergun for example was plainly great... But of course, it need to still be applicable on a breakout :)

Meta question: How I create tags? If I really can't, can a moderator put some decent tags for me? Like scoring, or chain-system, or stuff like that? Otherwise we will end with thousands of stuff with the same tags: design, writing and C++... or generic stuff like that.

sentences:
What is the difference between resource.texture() and resource.image()? image = pyglet.resource.image('spritesheet.png')
image.blit(0,0)

And

image = pyglet.resource.texture('spritesheet.png')
image.blit(0,0)

doing the same thing - they are drawing a spritesheet (or only one image), and they returns Texture type.

sentences:
Error using Physics Body Editor for LibGDX In my game, I've been trying to use the physics body editor for libgdx, but I kept on getting an error. So I thought there was probably something wrong with my code so I took the example off of the website (http://www.aurelienribon.com/blog/projects/physics-body-editor/), and tried running that. But I got the same exact error on the same line of code.

The line of code from the website's example that's creating the error is

BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("data/test.json"));

and the error is

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.badlogic.gdx.utils.JsonReader.parse(Ljava/lang/String;)Ljava/lang/Object;
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:118)
Caused by: java.lang.NoSuchMethodError: com.badlogic.gdx.utils.JsonReader.parse(Ljava/lang/String;)Ljava/lang/Object;
    at aurelienribon.bodyeditor.BodyEditorLoader.readJson(BodyEditorLoader.java:179)
    at aurelienribon.bodyeditor.BodyEditorLoader.(BodyEditorLoader.java:41)
    at com.Jon.App.App.createBottle(App.java:129)
    at com.Jon.App.App.create(App.java:76)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:132)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:112)

Any ideas on how to fix this?

sentences:
Send Geometry Data to Multiple Shaders So I am implementing a deferred rending model for my engine, and I want to be able to send all scene geometry into a single shader to calculate ambient, diffuse, normal, ect thats not the question.
Once I have all of this data buffered into the GPU I can render all of that geometry from a camera perspective defined by a uniform for the cameras position in the scene. I am wondering if I can reuse this model data already in VRam in another shader translated by a light sources projection matrix to calculate the shadows on this scene geometry without needing to send the same data to the GPU again.
Is there a way to tell my light shader, hey all that juicy geometry/scene data you want is already in V-Ram, just use this matrix transformation instead.
Alternatively when I am sending the VAO to the GPU is there a way to send it to two shades in parallel, one for the deferred rending model, one for shadow casing light sources?
Thanks so much!

sentences:
opengl rotations for a human I currently can rotate around a pivot point by first translating to the pivot point then performing the rotation and finally translating back to the origin. I do that easily enough for the shoulder in my example. However I cannot figure out how to also add in a rotation around the elbow for the forearm.

I've tried the following for the forearm rotation around the elbow:

translate to shoulder, rotate, translate to origin, translate to forearm, rotate, translate to origin
translate to shoulder, rotate, translate to forearm, rotate, translate to shoulder, translate to origin

Neither work for me. Any suggestions? I'm really stuck on this one.

sentences:
Unity Engine - Move the Object According to Image tracking Motive : Want to develop Software which will track the Pad and move the four views of object accordingly.
What I did/Current Knowledge : I had placed the four camera around the object and change their viewport accordingly. Then, using Vuforia, tracked the pad(Image).
Problem : As I am beginner in Unity. I don't know how to move the object as the pad moves i.e. i don't want AR Projection on pad. but i want to use pad to move the object.
You can see my progress and work i done in these images. http://imgur.com/a/V5brG
Thanks.

sentences:
Z axis for player movement is being incremented, but i don't know how I'm currently learning and developing a 2D plataform game in Unity, but now i'm having some errors that i can't solve.

When I press the arrow keys to make my character move right and left, the Z axis is being incremented somehow,and the player is "getting into the screen", even though I didn't write anything about it in my script.

I read about the "Apply Root Motion" in the Animator segment, and I unmarked it as they said, but I think the error might still be there, but i'm not sure.

Does anyone know about it?

Here is a snippet of my code:

void Movement() {
    anim.SetFloat ("speed", Mathf.Abs (Input.GetAxis ("Horizontal"))); //Makes it record a value of speed between -1 and 1, so that the trigger of the animation can work.

    if (Input.GetAxisRaw ("Horizontal") > 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);//speed * Time.deltaTime makes things smoother, it updates frame by frame, so that it does not jump all around
            transform.eulerAngles = new Vector2 (0, 0);
    }

    if (Input.GetAxisRaw ("Horizontal") < 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);
            transform.eulerAngles = new Vector2 (0, 188);
    }

sentences: What does a C++ expert need to know? so the other day I was looking for jobs in the gaming industry (software engineer/game programmer/gameplay programmer, etc) just to get a look at what are some of the requirements. Most of these jobs require 5+ years of experience with C++, and to be an "expert" in this language. My question is, what does exactly an expert in C++ need to know, apart from pointers, STL, memory allocation, inheritance, polymorphism? Do you need to know the programming language from A to Z? Every bit of the language? Or what are some of the most important topics that you need to know in order to qualify as a "C++ expert"?

sentences:
Unity Combining Passes in Shader I have a shader which uses multiple passes to determine the thickness of an object at each point. I want to use this thickness value in order to sample from a texture, which will determine the color of the screen at that point. However, since the calculation is performed in two passes, I don't have any way to access the one value which results at the end, which is what I would be using to index the uv for the texture.
Thanks for any help in advance!

{
Properties
{
    _MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
    Pass
    {
        Cull Back ZWrite On ZTest Always
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float3 normal : NORMAL;
        };

        struct v2f
        {
            float2 depth : DEPTH;
            float4 vertex : SV_POSITION;
        };

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.depth = -UnityObjectToViewPos(v.vertex).z * 200 * _ProjectionParams.w;
            return o;
        }

        sampler2D _MainTex;

        fixed4 frag (v2f i) : SV_Target
        {
            float c=1-i.depth;
            fixed4 col = fixed4(c,c,c,1);
            return col;
        }
        ENDCG
    }
    Pass
    {
        Cull Front ZWrite On ZTest Always
        BlendOp RevSub
        Blend One One
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
        };

        struct v2f
        {
            float2 depth : DEPTH;
            float4 vertex : SV_POSITION;
        };

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.depth = -UnityObjectToViewPos(v.vertex).z * 200* _ProjectionParams.w;
            return o;
        }

        sampler2D _MainTex;

        fixed4 frag (v2f i) : SV_Target
        {
            float c = 1-i.depth;
            //fixed4 col = tex2D(_MainTex,c.xx);
            fixed4 col = fixed4(c,c,c,1);
            return col;
        }
        ENDCG
    }
}
}

sentences:
Throwing away inner faces of cubes of a transparent voxel structure in Unity3D? I want to create a "Building site is (not) obstructed." indicator for my building system.

How can I throw away those faces which would be hidden if the material would be opaque?

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:
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:
Depth of overlap between circle and rectangle I have a circle and a rectangle one of the two objects is moving the other is static. How can I prevent them from overlapping each other? For now there is only one thing that I don't know how to calculate - the depth between the two objects. Could you tell me how to do that? I am using monogame

public void CircleVsRectangle(CircleBody circle, RectangleBody rect)
{
  float circleDistanceX = Math.Abs(circle.CenterX - rect.CenterX);
  float circleDistanceY = Math.Abs(circle.CenterY - rect.CenterY);

  Vector2 circleDistance = new Vector2(circleDistanceX, circleDistanceY);

  if (circleDistance.X > (rect.Width / 2 + circle.Radius)) { return false; }
  if (circleDistance.Y > (rect.Height / 2 + circle.Radius)) { return false; }

  if (circleDistance.X <= (rect.Width / 2)) { return true; }
  if (circleDistance.Y <= (rect.Height / 2)) { return true; }

  float cornerDistance_sq = ((circleDistance.X - rect.Width / 2) * (circleDistance.X - rect.Width / 2)) + ((circleDistance.Y - rect.Height / 2) * (circleDistance.Y - rect.Height / 2));

  if( (cornerDistance_sq <= (circle.Radius * circle.Radius)))
  {
  float dept = CalcDept() // ??????
  if(circle.IsMoving) circle.position += dept;
  else if(rectangle.IsMoving) rect.position += dept;
  }
}

sentences:
Relative Position/Rotation calculation I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates.

How do I calculate the position and orientation of object B in relation to object A?

I'm using the JVector, JMatrix that are a part of the Jitter3D physics library. (http://code.google.com/p/jitterphysics/)

Any help would be greatly appreciated!

sentences: What are the technologies that makes physics engines so good for raycasting? again. This question is strictly related to this one so, what is the technology that makes physics engines suitable for raycasting? It is a particular data structure? Has it to do with the engine's internal representation of the objects? If so, how do they represent objects so to be able to make polygon-precise raycasting? Do they hold the whole information about a mesh?

sentences:
How can I view an R32G32B32 texture? I have a texture with R32G32B32 floats.  I create this texture in-program on D3D11, using DXGI_FORMAT_R32G32B32_FLOAT. Now I need to see the texture data for debug purposes, but it will not save to anything but dds, showing the error in debug output, "Can't find matching WIC format, please save this file to a DDS".

So, I write it to DDS but I can't open it now!  The DirectX texture tool says "An error occurred trying to open that file".

I know the texture is working because I can read it in the GPU and the colors seem correct.

How can I view an R32G32B32 texture in an image viewer?

sentences:
Unity Canvas hover image does not trigger event So i have the following setup:

This produces the following UI:

Now on each of the "HudCircle"(Bottom/Right/Left/Top), I have the following components:

As you can see I have a script that has the following code:

    public class HUDAction : MonoBehaviour,  IPointerEnterHandler, IPointerExitHandler
{
    public Color StartColor;
    public Color SelectedColor;
    public Image Image;

    private void Awake()
    {
        Image = GetComponent<Image>();
        StartColor = Image.color;
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        Image.color = SelectedColor;
        Debug.Log("Over");
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Image.color = StartColor;
        Debug.Log("Not over");
    }
}

Sadly when playing this scene nothing happens when I hover either of the circles.

Can anyone tell me what I've done wrong?

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:
Dot Product Vs Cross Product Turning a Turret Towards A Enemy and firing http://pastebin.com/iw9DHf7s is code demonstrating dot product turning a turretto a target and firing. It works and chooses best angle to spin.

A problem can occur when game goes faster (better computer) and that threshold no longer applies. Making the threshold bigger obviously stops the turret early.

My friend mentions cross product is the way to fix it. Then he disappears for long periods of time. Doesn't dot product NOT get a inner angle between two vectors? Ok lets just say I agree and dot product doesn't work ever.

So tell me how does vector product do the trick? I'm going from a single scalar that I can get degrees out of to a third orthogonal vector. I've read about cross product and the function and watched a you tube video and I don't get (given the same code pasted) how to use cross product here.

Update:
Would this work?

//towerFacing is the at/forward vector of the cannon
Vector v1 = cannonPos - targetPos ;
Vector v2 = towerFacing - cannonPos ;

//The z plane
double cross = v1.x*v2.y - v1.y*v2.x ;
if (cross > 0) { return Direction.Left ; }
if (cross < 0) { return Direction.Right ; }

Obviously the zero is not what we want to use in games. However The difference is now our zero means our at vector and target is perpendicular and on each other which a x b = 0. The dot product since it uses cosine I used the right vector which is orthogonal with the facing( a . b = 0).

Am I wrong on how the cross product works by what has listed for answers still?

sentences:
How do I run LibGDX's Particle Editor in Netbeans? I am trying to run the Particle Editor that comes with LibGDX in Netbeans.  The gdx-tools-1.9.10.jar file shows up in my dependencies, and I can see all of the packages and class files inside it:

Normally, when I want to run a file, I open the file by double-clicking it in the "Projects" panel, right click anywhere in the file, and then click the "Run File" option.  However, when I use the same process to try to run a class file in gdx-tools, the "Run File" option appears to be grayed out:

I have also tried using the Shift+F6 shortcut, with no effect.  Just as a sanity check, I did also make sure that the class file I am trying to run has a main method:

I have also tried running the Particle Editor from the command line (I'm using Windows).  I navigated to the gdx-tools directory using the following command:
cd C:\Users\<user>\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-tools\1.9.10\<hash>

I then tried to run the Particle Editor using the following command:
java -cp gdx-tools-1.9.10.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor.class

And the result is simply:
Error: Could not find or load main class com.badlogic.gdx.tools.particleeditor.ParticleEditor.class

How do I run the Particle Editor?  I would prefer to be able to run it in Netbeans, but I would be happy to get it to run at all.  I am using LibGDX 1.9.10, Netbeans 8.2, and Java (JDK and JRE) 8u111 on Windows 10.  I installed LibGDX using their setup app found here.

sentences:
Turn Based AI Algorithm (Small Board, Two Steps) This is my Game-Board:

-> The Red Balls are the AI-Controlled Actors.
-> The Blue Balls are the Player-Controlled Actors.
-> The Yellow Cells are the locations, from which the Red Balls can attack.
-> Each Red Ball can do 2 actions: move-move, move-attack, attack-attack.
-> At no time there can be 2 minions on one cell, but a minion can arrive on a cell another just left.

Its the AI's turn. Its planning the whole turn for all minions, each of them has the two moves.
The objective is to maximize the number of melee attacks, which can performed in a single turn (2 actions) on the player balls.

Problem I have in my current (brute-force) implementation:

Sometimes it is advisable for a minion to move, although it is already in a melee position, to make space for another minion, which can then move into melee range aswell.

Example:

In this situation its more effective for the front minion to move once, so another minion can move into melee range as well.

Do you know an effective algorithm for this job? Thank you for your time!

sentences:
Need info on creating a tile grid data structure in Java I'm trying to create a game with a fixed size map (2D Tile array).
I suppose I can inherit other tiles from this base Tile, e.g.: a BankTile.
Placing and removing tiles is all too easy, but forming rooms keeps me puzzled.

Rooms can only be formed by adjacent tiles (4-way: above, below, left and right)

This way, 2 tiles can form a 'room', e.g. a Bank with a maximum amount of resources it can hold (sum of both its tiles).

I am wondering on how I should be implementing this, if there are any existing (and optimal) solutions to this.

Some things I considered:

Tiles must keep a reference to the Room they are in AND rooms must keep a vector of all tiles they hold. So adding tiles and removing tiles becomes pretty efficient.
Only obstacle this poses is the splitting of rooms: if 1 tile connects 2 rooms and this tile is removed, it should split the room and creating a new room for the split-off part.
Rooms will be 2D vectors with a begin-position (the room will be a surrounding square of the actual room polygon)
Rooms are 4-way linked lists of tiles
?

What needs to be done with rooms:

tiles need to be added and removed
allowing rooms to merge and split
calculating size of a room
finding a room quickly on a map

This image clarifies what I need:

Should I pick data structure 1? Rooms are 2D arrays with null-pointers for not-room-tiles.
Or should I pick data structure 2? Rooms are 4-way linked lists of tiles.
Or should I think of something else, e.g. vector of tiles = room?
Given the operations I need to be able to perform on them, which is best?

sentences: Handling different version clients in a multiplayer game What are various ways of handling different version clients in multiplayer games? For example, when there's an update, some games allow you to play with people who have a different version of the client. How is this handled?

sentences:
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: colliding 2 moving and rotating sprites in xna 2d I recently started making a game in windows phone XNA, I have a rocket in the middle that I can rotate and has a thrust to speed up in the direction it is facing and meteors coming out. The point is to survive as long as you can and avoid collision with the meteors. I can't manage to implement the collision between two moving and rotating sprites which are the rocket and a random meteor. I've seen rectangular collision which to me appears bad but maybe I am coding it a bit wrong and the pixel collision is way complicated :/ any help would be appreciated, thanks in advance :)

sentences:
How to use Left Shift to run Unity? So, I need to use LShift to run, but I can't exactly figure out how to do so....
I don't know what to use....
Here my code:
using UnityEngine;
using System.Collections;

// This script moves the character controller forward
// and sideways based on the arrow keys.
// It also jumps when pressing space.
// Make sure to attach a character controller to the same game object.
// It is recommended that you make only one call to Move or SimpleMove per frame.

public class Move : MonoBehaviour
{
    CharacterController characterController;

    public float speed = 6.0f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Transform charBody;
    private Vector3 moveDirection = Vector3.zero;
    public float mouseSense = 11f;
    public float runSpeed = 12f;
    public bool isRunning = false;

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

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;
            moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        moveDirection.y -= gravity * Time.deltaTime;

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        float MOUSEY = Input.GetAxis("Mouse Y") * mouseSense * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * mouseSense * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

So, when left shift is clicked I want the speed to change to runSpeed...
Can I please have some help doing so?
Thanks

sentences:
Shader models, when to use "ps_4_0_level_9_x" instead of "ps_4_0" I've made a very simple post processing shader for my 2D game. It produces scanlines by dimming every other line. For this I use the position of the pixel on the screen.

When using ps_4_0_level_9_3, I receive the message:

shader model ps_4_0 feature level_9_3 doesn’t allow reading from position semantics

So I switched to just ps_4_0 and things work fine. I probably won't be using any advanced shaders in my 2D game.

My questions are:

By setting the pixel shader to 4_0 only, what impact does that have for my game (if any) - is it a mistake to 'downgrade' the pixelshader?
How do I know what pixelshader version to use? I found this: Direct3D featurelevels but I'm unsure when to use what shader? Is there a list like "for windows use this", "for mobile this" or is it, use the lowest version that supports the feature you need?

sentences:
Straightforward guidelines for converting OpenGL to OpenGL ES? Is there a straightforward list of finite steps that I need to follow to convert an OpenGL program into an OpenGL ES that's used on the iPhone and iPad? I'd be using GLKit.

I've seen some similar API functions but I gather that triangles have to be presented differently.

sentences:
CCActionMoveBy doesnot working properly when the action called for many of the sprite in cocos2d I have an issue with CCActionMoveBy when I call the movement action for many of my sprites. I need to move to a certain position and then remove it from the scene.

My problem is If the call the action for one or two positions its working fine, but when I call this action for more than 5 positions, the sprite doesn't move to the correct position.

My Frames are between 15 and 20, and I am not sure If there is a correlation.

Here is my Code :

[_sprite1[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(60,-10)], remove, nil]];
[_sprite2[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(10, 80)], remove, nil]];
[_sprite3[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(-10,- 80)], remove, nil]];
[_sprite4[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(-60, 10)], remove, nil]];

the above code is calling action for sprite with its position[1][1] like that i am calling many of the position at a same time for sprite.

Here the method for CCActionMoveBy

-(CCActionMoveBy *) moveWithPosition:(CGPoint) distance{

    return [CCActionMoveBy actionWithDuration:MoveTime position:ccp(distance.x, distance.y)];
}

MoveTime = 0.25f;

if you need more information i will update please help on this issue..

sentences:
How to handle animations? I am coding a simple 2D engine to be used with HTML5. I already have classes such as Picture, Scene, Camera and Renderer, but now I need to work on Animations.

Picture is basocally a wrapper for a normal image object, with it's own draw method, but this is unrelated, I'm interested in how animation in 2D games is usually done.

What I planned to do, is to have the Animation class as well act like a wrapper for a few image objects, and then have methods such as getCurrentImage, next and animate (which would use intervals to quickly change the current image). I meant to feed the animation a couple of PNG's at inicialisation.

Is quickly swapping PNG images acceptable for 2D animation? Are there some standard ways of doing this, or are there flaws in my ways?

sentences:
Delay/Pause game while displaying countdown 3,2,1 go I have already a running script of countdown and it works fine , the problem is that I want to pause or delay the game while the countdown is displaying, the moment countdown finished the player is already dead. Here is my code

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

public class jb : MonoBehaviour {
    private string countdown = "";
    private bool showCountdown = false;
    public AudioSource noise1;
    public AudioSource noise2;
    public Sprite sprite2;
    public Vector2 jump = new Vector2 (0,300);
    private SpriteRenderer spriteRenderer;
    void Start () {
        //GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
        StartCoroutine(getReady());

        spriteRenderer = GetComponent<SpriteRenderer>();
        noise1.GetComponent<AudioSource>().Play();

    }

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

        if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
           Vector2 touchPosition = Input.GetTouch(0).position;
            GetComponent<Rigidbody2D>().AddForce(jump);
            //noise1.GetComponent<AudioSource>().Play();
        }

        Vector2 screen_position = Camera.main.WorldToScreenPoint (transform.position);
        if(screen_position.y > Screen.height || screen_position.y < 0)
        {
            noise1.GetComponent<AudioSource>().Stop();
            noise2.GetComponent<AudioSource>().Play();
            StartCoroutine(Die());
        }

    }

    void OnCollisionEnter2D(Collision2D det)
    {
        noise1.GetComponent<AudioSource>().Stop();
        noise2.GetComponent<AudioSource>().Play();
        StartCoroutine(Die());

    }

    IEnumerator Die(){
        PlayerPrefs.SetString( "previousLevel", SceneManager.GetActiveScene().name );
        spriteRenderer.sprite = sprite2;
        yield return new WaitForSeconds (2);
        SceneManager.LoadScene("score");
     }

    IEnumerator getReady()
    {
        showCountdown = true;

        countdown = "3";
        yield return new WaitForSeconds (1);

        countdown = "2";
        yield return new WaitForSeconds (1);

        countdown = "1";
        yield return new WaitForSeconds (1);

        countdown = "GO";
        yield return new WaitForSeconds (1);

        showCountdown = true;
        countdown = "";
    }

    void OnGUI ()
    {
        if (showCountdown)
        {
            GUI.color = Color.red;
            GUI.Box ( new Rect (Screen.width / 2 - 100, 50, 200, 175), "GET READY");

            // display countdown
            GUI.color = Color.white;
            GUI.Box (new Rect (Screen.width / 2 - 90, 75, 180, 140), countdown);
        }
    }
}

what can I do to pause the game? I tried invoke (by creating another function and copying everything over there) in update call but it didn't work.

sentences:
How to sleep for the desired duration between game loop iterations? My game loop below doesn't sleep as log as it should. The delta value always ends up less than 1, when it's supposed to be 16.6666 or close to 16.6666

double targetTime = 1000.0 / 60.0;//1000 millisecunts / 60 fps
long startTime;
long endTime = System.currentTimeMillis();
long delta;

long timer = System.currentTimeMillis();
int frameCount = 0;
while(running){
    startTime = System.currentTimeMillis();
    delta = startTime - endTime;
    endTime = startTime;

    tick(delta);
    render();
    frameCount +=1;
    try{Thread.sleep(targetTime - delta);}catch(InterruptedException e){}

    if(System.currentTimeMillis() - timer >= 1000){
        System.out.println("Rendered frames: " + frameCount);
    }
}

sentences:
How could we use trigonometry for moving around a 3D World? Well I have a question about geometry and 3-Dimensional player movement in general. I'm using Java, OpenGL and LWJGL.

This is basically what I got:

currentFrontSpeed: Is a float that contains the speed of the Player.
player. increasePosition: Just adds the current Position of the Player to the value that is given on the X, Y and Z axis.

//The point we want to go: Forwards(+) Backwards(-). getFrameTimeSeconds
//just adjust the speed depending of the speed of the computer.

float distanceFront = currentFrontSpeed * DisplayManager.getFrameTimeSeconds();

//Distance of Movement
float fx = (float) (distanceFront * Math.sin(Math.toRadians(player.getRotY())));
float fz = (float) (distanceFront * Math.cos(Math.toRadians(player.getRotY())));

//This just increase the position of the player (x,y,z)
player.increasePosition(fx, 0, fz);

Another thing that I didn't explained is that the Player is always looking at the same position as the camera (if the camera turns to the right, the player would also turn to the right. Like Maincraft). That's why I use the Y-Axis to move.

The problem is that my player can only move forwards and backwards (if currentFrontSpeed is positive, my player will move FORWARDS, and if is negative BACKWARDS). And the only form to go to a place that is to the right is to move the Camera to the right and the press UP to go FORWARDS.

I've tried to achieve this doing this:

   //The same as above, the speed of the player this time Right(+) and Left(-)
    float distanceSides = currentSideSpeed * DisplayManager.getFrameTimeSeconds();

    float sx = (float) (distanceSides * Math.cos(Math.toRadians(player.getRotY())));
    float sz = (float) (distanceSides * Math.sin(Math.toRadians(player.getRotY())));

    //I just add the "horizontal" speed to the "vertical" one
    player.increasePosition(fx + sx, 0, fz + sz);

Of course this doesn't work good: if the player Y-rotation is 0, the player moves to the right and to the left perfectly; but for example, if the player rotation is 90 (looking at the right from the original position), moving up or moving to the right would take us to the same position (because is the "right" from the original position with the Y-axis 0).

I don't know if I should use another trigonometric function or add the sx and the sz to another value in the X, Y and Z axis.

EDITED

I've just edited and gived some information because of the bad explaining I did. Also this is one of my first long-writed post.

Thanks for helping!

sentences:
How to check if a variable is an integer? I'm going through my C++ book and have currently made a working Guess The Number game.

The game generates a random number based on current time, has the user input their guess, and then tells them whether it was too high, too low, or the correct number.

The game functions fine if you enter a number, but returns 'Too High' if you enter something that is not a number (such as a letter or punctuation). Not only does it return 'too high', but it also continually returns it.

I was wondering what I could do to check if the guess, as input by the user, is an integer and if it is not, to return 'Not a number. Guess again.'

Here is the code.

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
    srand(time(0)); // seed the random number generator
    int theNumber = rand() % 100 + 1; // random number between 1 and 100
    int tries = 0, guess;

    cout << "\tWelcome to Guess My Number!\n\n";

    do
    {
        cout << "Enter a guess: ";
        cin >> guess;
        ++tries;

        if (guess > theNumber)
                cout << "Too high!\n\n";

        if (guess < theNumber)
                cout << "Too low!\n\n";

    } while (guess != theNumber);

    cout << "\nThat's it! You got it in " << tries << " guesses!\n";
    cout << "\nPress Enter to exit.\n";

    cin.ignore(cin.rdbuf()->in_avail() + 1);
    return 0;
}

sentences:
Which tools are artists using out there and how for game development to produce the material used by game programmers? What processes, tools, methods are used by game artists to prepare materials for the programmers?

I am interested in tools (ie: photoshop, pixelmator, etc for drawing) and also how they are used together to produce texture atlases or individual images for the programmers.

Methods or way of working (tool-chains maybe), which can be used by the artist to

Present ideas (sketches)
Mesh up game images (photosop: front menu, in-game)
Cut up images/layers into (ie: copy paste?)

smaller individual pieces
texture atlases (some other tool)

Generate coordinates ie: (xywh) for button "Options" on the main screen which is stored as main_options.png or (uvhw, xywh) for in-game HUD which is in a texture_atlas.png.
Any way to automate some of the steps above?

============ before edit ============

The artist(s) might use hand drawings-scanner/sketch pad for illustration.
These are then imported and further improved in some other image manipulation tools.
The result then can be used to produce both preview of the game (menu, in-game meshups) and final elements which will be used by the programmer(s): individual images or texture atlases.

Which tools are artists using out there and how for game development to produce the material used by game programmers?

I am particularly interested if there are automated tools where a small change at the illustration part can be propagated to produce final production images/textures without the need for the artist to cut/merge them.

sentences:
Why can't I directly change the position of a prefab using transform.position? (Unity3D) I am relatively new to Unity, and I am currently working on some code. I am trying to change the position of Unity's standard assets first-person controller using

player.position = anotherObject.position + offset;

I'd like to add that I am setting the player's position when it collides with a box collider.

However, this isn't working for some reason. I've tried debugging it using print statements before and after the teleportation of the player, and this is what I see:

Player position: (0, 2, 0)
Player position after teleport: (32, 2, 0)
Player position one frame later: (0, 2, 0)

After one frame, the player returns to it's original position, as if it was never moved.

Here is my code, if it will help you better understand my problem.

public class PortalTeleporter : MonoBehaviour {

    public Transform player; // The player
    public Transform receiver; // Receiving portal

    private bool playerOverlap = false; // boolean to store whether player touches the box collider on portal

    void Update(){
        if(playerOverlap){
            Vector3 portalToPlayer = player.position - transform.position;
            float dotProduct = Vector3.Dot(transform.up, portalToPlayer);
            if(dotProduct < 0f){
                float rotationDifference = Quaternion.Angle(transform.rotation, receiver.rotation);
                rotationDifference += 180;
                player.Rotate(Vector3.up, rotationDifference);

                Vector3 positionOffset = Quaternion.Euler(0f, rotationDifference, 0f) * portalToPlayer; // Offset between player and portal
                Vector3 pos = receiver.position + positionOffset;
                print(player.position);
                player.position = pos;
                print(player.position);
            }
        }
    }

    // Triggered when player enters the portal
    void OnTriggerEnter(Collider other){
        if(other.tag == "Player"){
            playerOverlap = true;
        }
    }

    // Triggers when player untouches the portal
    void OnTriggerExit(Collider other) {
        if(other.tag == "Player"){
            playerOverlap = false;
        }
    }

Thank you for taking the time to answer my question!

sentences:
moving object in unity from a point A to point B no matter what the original position of the object is I'm moving a Game Object in unity from point A to point B no matter what the original position of the Game Object is.

Let us suppose that I have a Game Object at (0, 0, 0).

But I want to move that Game Object from (1, 1, 1) to (2, 2, 2).

How can I do this in C# ?

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:
Perspective projection in Open GL I am trying to convert a 3d point into a 2d point using a perspective projection. I'm new to OpenGL and may not have fully understood how this works. How exactly do I calculate the near and far values?

The vertex values I want to consider are between 1, 1, 1 and 16, 16, 16.
So if I consider a output texture of size 16 x 16. Will my near and far be 0 and 16 respectively?

Does this transformation take care of scaling my vertex values between 0 and 1 as well?

sentences: How can I replicate Quantum Break's distortion particle effect? Quantum Break has this fantastic particle effect, it's a distortion effect like broken glass. I want know how I can replicate this effect? You can see it below, and a full video is available on YouTube:

sentences:
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:
Using Tile Maps with cocos2d - how do I handle a large amount of images? I am building a game where the users (players) can build their own town. There they can build houses, add furniture to the houses etc etc. Basically similar to The Sims.

I am using the Tiled Map Editor to create a basis for each town. There I define the following layers

ground
floor
walls and furniture (basically everything)

All these layers are initially empty. It is up to the user to fill them.

I am using cocos2d v2 and its CCTMXTiledMap to render this tile map in my project.

One thing that I realised is that the layers defined in the map, CCTMXLayers, only support images from one tileset (#).

This has led to the following questions that I need to have answered before digging in to some serious game development.

Question 1. This game would be no fun if all my houses had the same walls. I really need numerous different kind of walls in the "walls and furniture" - tileset. How big can a tileset be? Note that I need to store not only different wall-textures here but also textures representing the furniture due to (#).

Question 2. The way you change the tiles in a CCTMXTiledMap is (as far as I know..?) using the setGID method for that particular layer. Going back to the example with different walls. Lets say the player can choose among different walls from a scrolling HUD-Layer menu. When a player selects a certain wall - how do I know which GID that particular wall has (during runtime)?

P.S I am very new to both cocos2d and Tiled so if I have taken the wrong approach here, please tell me what approach I should take in a game like this. I've been looking into Kobold Touch as well - perhaps that better suits my needs?

sentences:
How to rotate an object towards the walking direction? I'm working on a game where you move a object on a game surface of cells, every time you move this object it steps to a cell, up, down, left or to the right. I have been trying to find out a way to rotate the object soo it is facing the moving direction. The rotation should be 90 degrees. It's one thing if the object is going from Up to Left and then rotate it 90 degrees, but what if object is going from Up to Down, then it need to rotate 180 degrees. I need some help with this issue to solve this in a simple and good way? Thanks!

This is the code for moving upwards and the other moving directions are similar. I'm using a short delay, so that the player can't move to fast on the game surface.

    // Upp
    public void Up()
    {
        if (milliSeconds1 >= walkingTimer)
        {
            Position = new Vector2(Position.X, Position.Y - walkingSpeed);
            milliSeconds1 = 0;
        }
    }

And in the Update:

Position = Position + Direction * 1;

EDIT: I solved this by myself! I just used radian values for each directions! :)

sentences:
Rotate object always at same speed on screen, no matter camera distance? I am rotating a globe like XCOM's hologlobe,

I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta).

I found a good value for maxDegreesDelta, in my case it is 5.0f.

There is a limit on how close or far the camera can be, let's assume clos is 1.0f and far is 2.0f.

I want to be able to zoom into the globe, but obviously when I do, it rotates a bit too fast then.

When zoomed out, rotation speed is satisfying:

When zoomed in, rotation is too fast, making it more difficult to manipulate:

And the problem is even more evident as game view size gets bigger, i.e. fullscreen.

Using Mathf.Lerp and Mathf.InverseLerp, I've tried to make maxDegreesDelta and mouse delta proportional to the distance the camera is but it's hardly convincing.

Note: I rotate the globe, not the camera.

Question:

How can I ensure object rotates at same speed on screen, no matter how close or far camera is ?

Code:

(assumes there is a sphere of radius 0.5 at Vector3.zero and camera is positioned at Vector3.back)

using UnityEngine;
using UnityEngine.InputSystem;

namespace Test2
{
    public class GeoScapeController : MonoBehaviour
    {
        #region Public

        public Transform TargetObject;

        public Camera TargetCamera;

        [Range(0.01f, 1.0f)]
        public float Sensitivity;

        public bool Smooth;

        public float ZoomDistanceMin;

        public float ZoomDistanceMax;

        #endregion

        #region Private

        [SerializeField]
        [HideInInspector]
        private Quaternion TargetRotation;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevel;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevels;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVector;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVelocity;

        private void Reset()
        {
            Sensitivity = 0.05f;
            Smooth = true;

            ZoomDistanceMin = 0.625F;
            ZoomDistanceMax = 1.25F;
            ZoomLevels = 10;
        }

        private void Start()
        {
            TargetRotation = Quaternion.LookRotation(TargetObject.forward, TargetObject.up);
            ZoomVector = TargetCamera.transform.position;
        }

        private void Update()
        {
            var mouse = Mouse.current;
            var delta = mouse.delta.ReadValue();
            var scale = new Vector4(-1.0f, +1.0f, +1.0f);

            var x = mouse.leftButton.isPressed ? delta.y * scale.y * Sensitivity : 0.0f;
            var y = mouse.leftButton.isPressed ? delta.x * scale.x * Sensitivity : 0.0f;
            var z = mouse.middleButton.isPressed ? delta.x * scale.z * Sensitivity : 0.0f;
            var r = Quaternion.AngleAxis(x, Vector3.right) *
                    Quaternion.AngleAxis(y, Vector3.up) *
                    Quaternion.AngleAxis(z, Vector3.forward);

            if (Smooth) // hopefully, quaternion limits won't be crossed !
            {
                TargetRotation = Quaternion.RotateTowards(TargetRotation, r * TargetRotation, 2.5f);

                TargetObject.rotation = Quaternion.Slerp(TargetObject.rotation, TargetRotation, Time.deltaTime * 5.0f);
            }
            else
            {
                TargetObject.rotation = TargetRotation = r * TargetRotation;
            }

            var wheel = (int) mouse.scroll.ReadValue().y / 120;
            if (wheel != 0)
            {
                ZoomLevel = Mathf.Clamp(ZoomLevel + wheel, 0, ZoomLevels);
                var lerp1 = Mathf.InverseLerp(ZoomLevels, 0, ZoomLevel);
                var lerp2 = Mathf.Lerp(ZoomDistanceMin, ZoomDistanceMax, lerp1);
                ZoomVector = Vector3.back * lerp2;
            }

            TargetCamera.transform.position = Smooth
                ? Vector3.SmoothDamp(TargetCamera.transform.position, ZoomVector, ref ZoomVelocity, 0.3f)
                : ZoomVector;
        }

        #endregion
    }
}

sentences:
What engine/technology should I work with to accomplish my unique design goal? I'm looking to begin a procedurally generated open-ended sandbox game and would like some educated opinions on a good starting point. (Take a look at the "Engine Specifications" if you don't want to read the whole post) I do not expect there to be an engine/set of libraries that meets all my requirements, but instead meet some essential ones (like rendering/collisions). I realize I will be building many engine components from scratch and appreciate any extra advice you want to include in your answer.
A little background
I am a fairly experienced programmer with intimate knowledge of modern design practices and know most popular programming languages like C++ and C#.
I've dealt with other 3D engines before like the Source Engine (C++) and UDK (UnrealScript) for some personal projects. I'd like to think most of my knowledge is of FPS game design and what the standard components are of FPS oriented game engines.
My design goal
In a nuteshell: I plan for my game to be a procedurally generated open-ended sandbox game that consists of large blocks as the basic geometry. The player will play in the first person.
These uniformly sized blocks will be large enough so that it can act as a segment to a hallway that the player could walk through. A block could also act as a wall to a building, be completely solid, or be completely empty. These blocks are changeable, removable, and placable.
By now this should sound familiar but its important to understand some critical and defining aspects of the game:
Engine Specifications

Blocks themselves contain collisions meshes within themselves; a wall can be placed on any of the 4 sides of the cube and a ceiling/floor on the remaining top and bottom faces.

Example of block collision configurations:

Blocks contain (unless they are empty or fully solid) independent visual meshes on each of their sides that contain collision meshes. They will be relatively simplistic and contain generally low resolution textures (the right resolution would come from benchmarking tests).

No complex shaders, effects, or lighting will be implemented. Only very basic implementations for performance.

Blocks contain basic navigation information and when connected to eachother, form a navigation network of nodes. The blocks themselves act as nodes and their connectivity to other nodes are determined by wall placement and so on.

Basic node based pathfinding will be implemented for AI.

The most challenging aspect will be multiplayer I presume.

Ray tracing

Simple particle engine

Physics simulation not likely, just basic fps movement physics

I realize I have a sizable workload in front of me as most engines are not geared for this type of game and so common design paradigms will be sparse. However, I believe there is an engine out there that I can work with to speed things up.
Game engines I have knowledge of

Gamestudio (clight)
Source Engine (C++)
UDK (UnrealScript)
Panda3D (C++/Python)
Torque3D (C++/TorqueScript)
Unity (C#)

I don't really prefer to use any of the ones I've listed for different reasons (mostly because they're FPS engines), but if you think one of them would be a good choice let me know.
Do you know of a game engine or technology bundle that would best help me implement my specifications? Apologies for the lengthy post.
Note: I wouldn't mind investing a few thousand dollars if it justifies itself.

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:
Effecient tilemap rendering I have done mostly tile based games, but never really bothered with optimization. I always just rendered all the tiles that convered the viewport.
I am currently working on platformer for a mobile device, which has some performance issues, ecspecially when using multiple layers of tiles.

Most tiles are pretty static without animations. I wouldn't really have to render them each frame. The clear() -> draw() loop is really printed into my brain, I'm having a hard time thinking how the handle rendering without clearing the screen each frame.

I'm currently doing this:
 - start game, render screen once
 - Once a tile changes, save this in a "tile_changed" array
 - Each frame, re-render all the changed tiles and clear the array

This works pretty fine, and there is a notable boos in performance. However, there are a view issues
 - The PlayN framework offers no way to "erase" drawn items. Whenever I want to erase a single tile I have to completely clear the screen and redraw every tile. (PlayN SurfaceLayer). I'm using a scroll background, so can't just fill an empty tile with the background color.
I can imagine low level libraries like opengl having this same issue, do they use some sort of workaround for this?

I'm not sure how to recognize when new tiles come into the screen whenever the camera moves. I would normally just render the tiles in view each frame, so this never posed a problem.
I have no idea if having such a big drawn rendertarget in memory is a good idea. The player could have walked across a huge map and have thousands of tiles drawn. Should I worry about this?

Any other optimiztions that I'm missing are appreciated.

The awnsers note that most engines draw all tiles every frame. But I know that on some less powerfull platforms this is not the case. I believe flashpunk is using some sort of buffer that only draws new tiles when you make changes in the grid.
Unfortunately this is not possible for me because I have no way of clearing a single tile without clearing the entire buffer.

I'm looking into optimazations like this, which enable me to have a very large amount of tiles on the screen.

sentences:
If a MMORPG does not have a limit on the number of players, will all players eventually focus on the same server? Consider a WOW-like MMORPG game. The only difference between it and WOW is that there is no limit on the number of players (Suppose that there is no limit on hardware performance and network bandwidth).

For such a game, developers can still open multiple servers for players to play.

My question is:

Assuming that the game can run steadily over a long period of time, will it eventually lead to the concentration of all players on the same server?

Whether the answer is yes or no, is there a corresponding economic, sociological and ecological model behind it?

(This may be an open question, I am not sure if I should ask questions here, but there seems to be no better place to ask. I hope that I can get some inspiration through discussion)

Thanks.

sentences:
server coordinate to client coordinate I've a really quick and maybe dump question and I don't really know how it is handled generaly. I want to make a tile base multiplayer game.
Player doesn't teleport from a tile to another but just walks pixel by pixel. So my client position will be two floats based on the actual position of the sprite on the screen. But on the server, should the position of the player be based on the texture as well, or it must be clientPosition/textureSize ?

Imagine a player being on position x:150;y:100 on his screen, and a tile texture size of 32px, should the position of the same player on the server be 150;100 or 4.6875;3.125 ?

Thank you in advance :)

sentences:
Tracking how many people play my Unity game in which language? In my game the user can change the language of the game and I'd like to know how many people play it in English, German, etc.
I'm using Unity, so possibly I would like to implement in Unity Analytics.
I was thinking about adding segments for the languages, but in that case if a user tries all languages, the user will appear in all languages' segments. So it won't really provide that much info.
A possible solution:

When the user changes language, we signal a database to decrease the old language's counter and increase the new language's counter.

But there must be an easier, built-in solution than this.

sentences:
Java advice (Printing game data to the window) Does anybody know the best method for taking game data and setting up java to read the data then print it to the window... of which you want the game loop to start the game and read the data...

Here is what my code is right now mabe some advice would be in order..

import java.io.File;
import java.util.Scanner;

import DATA_Data.Data.readfile;

public class ReadFile {

private Scanner x;

public void openFile() {

    try {

        x = new Scanner (new File("DATA_1.Pak"));
        x = new Scanner (new File("DATA_2.Pak"));
        x = new Scanner (new File("DATA_3.Pak"));
        x = new Scanner (new File("DATA_4.Pak"));
        x = new Scanner (new File("DATA_5.Pak"));
        x = new Scanner (new File("DATA_6.Pak"));
        x = new Scanner (new File("DATA_7.Pak"));
        x = new Scanner (new File("DATA_8.Pak"));
        x = new Scanner (new File("DATA.Pak"));
        x = new Scanner (new File("DATAA_1.Pak"));
        x = new Scanner (new File("DATAA_2.Pak"));
        x = new Scanner (new File("DATAA_3.Pak"));
        x = new Scanner (new File("DATAA_4.Pak"));
        x = new Scanner (new File("DATAA_5.Pak"));
        x = new Scanner (new File("DATAA_6.Pak"));
        x = new Scanner (new File("DATAA_7.Pak"));
        x = new Scanner (new File("DATAA_8.Pak"));
        x = new Scanner (new File("DATAA.Pak"));
        x = new Scanner (new File("DATAE_1.Pak"));
        x = new Scanner (new File("DATAE_2.Pak"));
        x = new Scanner (new File("DATAE_3.Pak"));
        x = new Scanner (new File("DATAE_4.Pak"));
        x = new Scanner (new File("DATAE_5.Pak"));
        x = new Scanner (new File("DATAE_6.Pak"));
        x = new Scanner (new File("DATAE_7.Pak"));
        x = new Scanner (new File("DATAE_8.Pak"));
        x = new Scanner (new File("DATAE.Pak"));
        x = new Scanner (new File("DATAL_1.Pak"));
        x = new Scanner (new File("DATAL_2.Pak"));
        x = new Scanner (new File("DATAL_3.Pak"));
        x = new Scanner (new File("DATAL_4.Pak"));
        x = new Scanner (new File("DATAL_5.Pak"));
        x = new Scanner (new File("DATAL_6.Pak"));
        x = new Scanner (new File("DATAL_7.Pak"));
        x = new Scanner (new File("DATAL_8.Pak"));
        x = new Scanner (new File("DATAL.Pak"));

    }
    catch (Exception e) {

        System.out.println("Could not read file");

    }

}

    public void readFile() {

        while(x.hasNextLine()) {

            String a = x.next();
            String b = x.next();
            String c = x.next();

                System.out.printf("%s %s %s\n", a,b,c);

        }

    }

        public void closeFile() {

            x.close();

        }

public static void main(String[]args) {

 readfile r = new readfile();

 r.openFile();
 r.readFile();
 r.closeFIle();

}

}

sentences:
How can I copy an asset folder programatically depending upon a constant? I have a Unity project in which I have 200 games and some 350 scenes. Now I want to make separate builds for each game. All my assets are present in Assets/IgnoredAssets/ABC folder. To include these assets in my current build the assets of the current game (say ABC) needs to be in Assets/Resources/ABC.

I want Unity to take these Assets/IgnoredAssets/ABC files and copy them to Assets/Resources before making build depending upon a constant defined in some file.

I want a kind of automation so that when I mention in my constant file string gameName="ABC"; it automatically picks its assets, paste them in Resources and builds for me.

How can I do this?

sentences:
Preserving Cocos2D context between UIKit screens My app is designed to use Cocos2D in the "main game screen" but the rest of the screens are in UIKit. While I feel that this isn't ideal, I really don't have time to port the rest of the screens into Cocos2D for the time being.

One of the problems I face is that I am required to load all the textures each time I enter the main game screen, and discard them once I leave Cocos2D-land (and repeat the process all over again)... or am I?

I am actually wondering if I could preload all the textures needed in a CCTextureCache during startup, even when the EAGLView and context hasn't yet been set up until I visit the main screen (and in doing so preserve the texture cache contents). But whenever I try this the app crashes.

Any way in which I can do this?

sentences:
Single Letter/ Alphabet recognition in AR I am developing an AR game with unity where I need to recognize alphabets in runtime. I have tried vuforia but it does not support single letter recognition. OpenCV is an alternative solution, but I don't understand how to detect text in Runtime with OpenCV.

I have also tried object recognition, NFT and markerless tracking. But all of these failed because a single letter does not have enough feature to get detected.

I am really new in Augmented reality and image processing. Can anyone give me a guideline or plan what I should do?
I am using this letter blocks from amazon https://www.amazon.ca/gp/product/B0006MU23W/ref=s9u_simh_gw_i1?ie=UTF8&pd_rd_i=B0006MU23W&pd_rd_r=22ef1e20-b08e-11e7-91cc-bbe5f37c0d0f&pd_rd_w=wCg3M&pd_rd_wg=NG8Lg&pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=&pf_rd_r=TH85A9MZFVDZPD8YYR5P&pf_rd_t=36701&pf_rd_p=09a46553-65cf-45b2-8aaa-e9bb559981ab&pf_rd_i=desktop

sentences:
Assertion Failed: TextureRHI - Texture Casting Errors (UE4) I am taking a pointer to a UTexture2D asset "MyTexture2D", and casting it to an array of FColor using the following:
FTexture2DResource* Resource = (FTexture2DResource*)MyTexture2D->Resource;
uint32 Stride = 0;
void* MipData = RHILockTexture2D(Resource->GetTexture2DRHI(), 0, RLM_ReadOnly, Stride, false);
const FColor* FormatedImageData = static_cast<const FColor*>(MipData);

While this runs fine in the editor, and compiles successfully into a build (Windows10), I get the following error on running the .exe:
"Assertion Failed: TextureRHI"
Which corresponds to the line :
check(TextureRHI);
in the function FD3D12DynamicRHI::LockTexture2D_RenderThread
From what I can tell, I need to do some or part of this function on the rendering thread using ENQUEUE_RENDER_COMMAND but I don't know what such a call would look like as I've struggled to find any kind of documentation on the API.
If anyone could suggest the proper syntax for the required render call, I'd be extremely grateful.
Many thanks.

sentences:
camera relative movement with GL.Translate I'm using the OpenTK library, an OpenGL library, for C#. I'm trying to do camera-relative movement and though I'd use GL.Translate for moving and glRotate for rotation. I've not declared any vectors and every tutorial uses those, how do I do that?
Do I need to limit the user's resolution and just use if statements to check it and move, or something else?
I don't want to declare and use variables like yaw, pitch etc, I just want to directly calculate rotation and apply to movement.
I'm using an old version of OpenGL since my game should be able to run on old GPUs.

sentences:
How to make character respawn the position needed in Andengine? I want to make my character respawn in the last Checkpoint he has reached. I've already stored the position of the checkpoint but I'm not very sure of how to set that position to the Sprite/Body of the character to make it appear in the position I want to. Do I have to use the Sprite or the Body? Here's how I initialize my character:

    mPlayerSprite = new AnimatedSprite(mapOffset, 0, playerTexture);

    final FixtureDef mPlayerFixtureDef = PhysicsFactory.createFixtureDef(0, 0f, 0f, false, CATEGORYBIT_PLAYER, MASKBITS_PLAYER, (short) 0);
    mPlayerBody = PhysicsFactory.createBoxBody(this.mPhysicsWorld, mPlayerSprite, BodyType.DynamicBody, mPlayerFixtureDef);

    mPlayerSprite.setUserData(playerName);
    mPlayerBody.setUserData(playerName);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPlayerSprite, mPlayerBody, true, false));

    mScene.attachChild(mPlayerSprite);
    mEntityList.add(mPlayerSprite);

Thanks in advance!

sentences:
How can I ensure a radius variable doesn't get reduced below 0? For some reason when I'm using the mouse to change the radius in the Update, the minimum radius is -1 even if I set the range in the top of the script to be 0,50 and even if I check that the xradius is be 0 or higher it's still getting to -1.

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;

    public bool circle = true;
    [Range(0, 50)]
    public float xradius = 15;
    [Range(0, 50)]
    public float yradius = 15;
    LineRenderer line;

    public float drawSpeed = 0.3f;

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();

        line.positionCount = (segments + 1);
        line.useWorldSpace = false;
    }

    private void Update()
    {
        if (xradius >= 0)
        {
            if (Input.GetAxis("Mouse X") < 0)
            {
                xradius = xradius + 1;
                CreatePoints();
            }
            if (Input.GetAxis("Mouse X") > 0)
            {
                xradius = xradius - 1;
                CreatePoints();
            }
        }
    }

    private void CreatePoints()
    {
        if (circle == true)
            yradius = xradius;

        float x;
        float z;

        float change = 2 * (float)Math.PI / segments;
        float angle = change;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(angle) * xradius;
            z = Mathf.Cos(angle) * yradius;

            line.SetPosition((int)i, new Vector3(x, 0.5f, z));

            angle += change;
        }
    }
}

In the Update I did:

if (xradius >= 0)

But yet when using the mouse for the minimum radius it set both xradius and yradius in the sliders to -1 not sure how can it be -1 if I set the range in both xradius and yradius to be 0,50

You can see in the screenshot in the Inspector in the right both Xradius and Yradius are -1

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:
GL11.glTexCoord2f(1.0f, 1.0f); 1.0f screws the image up I recently started using LWJGL in my java programs for the graphics. I'm currently working on a simple game, which I make, to get better at this kind of programming. I ran into some trouble when adding textures to my 2D game.

To show my problem, I have made a simple program which shows one quad with a texture.
This is how the texture looks:

http://i1197.photobucket.com/albums/aa428/GWigWam/LWJGL%20problem/Test.png

However my program shows it like this:

http://i1197.photobucket.com/albums/aa428/GWigWam/LWJGL%20problem/showsme.png

You see the right and the bottom have some strange line hanging there. the shown picture is 100x100 from the top left to the little pixel right down.

The code used for drawing this is:

texture1.bind();
GL11.glBegin(GL11.GL_QUADS);
   GL11.glTexCoord2f(0f,0f);
   GL11.glVertex2f(100, 200);
   GL11.glTexCoord2f(1f,0f);
   GL11.glVertex2f(200, 200);
   GL11.glTexCoord2f(1f,1f);
   GL11.glVertex2f(200, 100);
   GL11.glTexCoord2f(0f,1f);
   GL11.glVertex2f(100, 100);
GL11.glEnd();

This code is called before drawing:

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glOrtho(0, width, 0, height, -1, 1);

When I use

GL11.glTexCoord2f(0.9f,0.9f);

so 0.9f instead of 1.0f the weird lines don't appear. But that's no real solution because I want to use the whole texture not 90% of it.

I hope I did not ask something which has been asked before, I really couldn't find I using google, it is however quite hard to think of the right search words.

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:
What is the most efficient way to blur in a shader? I'm currently working on screen space reflections. I have perfectly reflective mirror-like surfaces working, and I now need to use a blur to make the reflection on surfaces with a low specular gloss value look more diffuse. I'm having difficulty deciding how to apply the blur, though.

My first idea was to just sample a lower mip level of the screen rendertarget. However, the rendertarget uses SurfaceFormat.HalfVector4 (for HDR effects), which means XNA won't allow linear filtering. Point filtering looks horrible and really doesn't give the visual cue that I want.

I've thought about using some kind of Box/Gaussian blur, but this would not be ideal. I've already thrashed the texture cache in the raymarching phase before the blur even occurs (a worst case reflection could be 32 samples per pixel), and the blur kernel to make the reflections look sufficiently diffuse would be fairly large.

Does anyone have any suggestions? I know it's doable, as Photon Workshop achieved the effect in Unity.

sentences:
Creating Terrain of Golf Course in Unity? (use Unity Terrain or 3d software) Hi all I wanted to create some simple, but pretty, golf courses for a Unity game.

I've not found much success with the built-in terrain maker as the painting of textures is not sharp edges).

Is it best to have only the basic layout in the terrain and then have separate meshes for the fairways and greens (and if so, how would I go about making that 'wrap' exactly onto the terrains surface to lie flat on it?)

Perhaps I can paint the textures somehow with much more definition on the edges but I can't find how to do it. If this is the case, how is it best to identify to the other gameobjects such as the ball as to what kind of surface it is on?

sentences:
Love2D how to zoom out map? I've set up a basic map with Tiled, imported it with STI library (https://github.com/karai17/Simple-Tiled-Implementation) and everything looks in place.

How can i get a zoom-out feature now? I can kinda zoom in using scalex and scaley and i tried the same procedure to zoom out.

However, if i set i.e. scalex = 0.5, scaley = 0.5 the map actually scales in size but it only fit 1/4 the screen size, and the remaining 3/4 are just black space.

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:
Design pattern for creating multiple enemies I'm currently attempting to implement a factory method pattern for creating multiple different enemies after loading data from a file. But I'm having second thoughts on what would be the best design pattern to implement or if in fact I am even using it correctly, below is how I intended to use it:

The Enemyfactory determines which enemy to create according to enemy type specified in the xml level file. For example:

<enemy>
    <type>
    NORMAL
    </type>
   ...
</enemy>

<enemy>
    <type>
    BRAWLER
    </type>
   ...
</enemy>

This data is read in the LevelLoader and then can be used to construct enemies. In the LevelLoader class I could easily have somehting like this instead:

if(node.equal("NORMAL")){
 return new NormalEnemy(//parameters from file to construct enemies);
  }else if (node.equal("BRAWLER")) {
  return new BrawlerEnemy();
}

With this information, what would be the best way/best design pattern to use to create multiple enemies.

sentences:
How to Display hints to user when he is inactive for more than 5 sec in unity? I have made a 2D Game using unity in which user has to select objects of similar color and now i want to display hint when user is unable to select the color for more than four seconds.

I want something similar to candy crush hint displaying system in which candy crush shows hint by highlighting the possible combination if user is not able to identify any combination himself.

I cannot figure out how to find if the user is inactive so that i can display hints.

I would really appreciate if someone can help me in figuring it out. Thanks in advance.

sentences:
Continuous Collision Detection So I'm playing around with the separating axis theorem and collision. Obviously the problem of what face it collided with arose. I need the unit normal which is tangent to that face it collided with to resolve depth penetration. For rectangles it's easy.

Update Y velocity
If collision
    collision happened on the y axis.
Update X velocity
If collision
    collision happened on the x axis.

But I wanted a more general that would work with all cases. I came up with two solutions

1.) So I thought about the solution above with a triangle. Obviously it wouldn't work because the rectangles faces are axis aligned and a triangles faces are not. So I figured I could just project the face and velocity using the dot product to solve it like the rectangle but for every face with its own axis. This would of course involve checking collision with the whole shape again for each face.

2.) I also figured I could do Polygon v Ray collision detection to figure out what face it collided with.

My question is: Which solution is faster? Or is there a better one that hasn't come to my mind?

I don't know how to do Polygon v Ray collision but I would guess that foreach face, find intersection point between ray and segment of face.

sentences:
Skinning on simple model doesn't work as expected I have created a simple application to make skinning work with OpenGL. so I want to share with my vertex shader:
#version 330 core

layout (location = 0) in vec3 RealPos;
layout (location = 1) in vec3 vertex_color;
layout (location = 2) in vec2 vertex_textcoord;
layout (location = 3) in vec3 RealNor;

layout (location = 4) in vec4 Joint;
layout (location = 5) in vec4 Weight;

uniform mat4 u_jointMatrix[2];

out vec2 vs_text;
out vec3 vs_color;
out vec3 normal;
out vec3 FragPos;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool isSkin;

void main()
{

    mat4 skinMatrix = Weight.x * u_jointMatrix[int(Joint.x)] + Weight.y * u_jointMatrix[int(Joint.y)] + Weight.z * u_jointMatrix[int(Joint.z)] + Weight.w * u_jointMatrix[int(Joint.w)];

    vs_text = vertex_textcoord;

    vs_color = vertex_color;

    FragPos = vec3(model * vec4(RealPos, 1.0f));

    normal = mat3(transpose(inverse(model))) * RealNor;

    if(isSkin)
        gl_Position = projection * view * model * skinMatrix * vec4(RealPos, 1.0f);
    else
        gl_Position = projection * view * model * vec4(RealPos, 1.0f);
}

so as you can see, if my model is skinned then it will call the first statement.
and here my C++ code:
unsigned j = 0;
for (unsigned u = 0; u < m.numOfJoints; u++)
{
    glm::mat4 g = glm::mat4(inverseBindMatriceHandler.at(j), inverseBindMatriceHandler.at(j + 1),
    inverseBindMatriceHandler.at(j + 2), inverseBindMatriceHandler.at(j +
     3),inverseBindMatriceHandler.at(j + 4), inverseBindMatriceHandler.at(j + 5),
     inverseBindMatriceHandler.at(j + 6), inverseBindMatriceHandler.at(j + 7),
     inverseBindMatriceHandler.at(j + 8), inverseBindMatriceHandler.at(j + 9),
     inverseBindMatriceHandler.at(j + 10), inverseBindMatriceHandler.at(j + 11),
     inverseBindMatriceHandler.at(j + 12), inverseBindMatriceHandler.at(j + 13),
     inverseBindMatriceHandler.at(j + 14), inverseBindMatriceHandler.at(j + 15));
     m.inverseBindMatrice.push_back(g);
     glm::mat4 gTransform = glm::inverse(g);
     m.globalTransform.push_back(gTransform);
     j += 16 ;
}
                        }

 if (Model.isSkinned)
{
    for (unsigned l = 0; l < Model.numOfJoints; l++)
        jointM[l] = Model.globalTransform.at(l) * Model.inverseBindMatrice.at(l);
    int isSkinLoc = glGetUniformLocation(program, "isSkin");
    glUniform1i(isSkinLoc, 1);
    for (unsigned l = 0; l < Model.numOfJoints; l++) //2
    {
        std::string name = "u_jointMatrix[" + std::to_string(l) + "]";
        int jointMatrixLoc = glGetUniformLocation(program, name.c_str());
        glUniformMatrix4fv(jointMatrixLoc, 1, GL_FALSE, glm::value_ptr(jointM[l]));
    }
}
else
{
    int isSkinLoc = glGetUniformLocation(program, "isSkin");
    glUniform1i(isSkinLoc, 0);
}

inverseBindMatriceHandler is a vector.
I have 2 joints (numOfJoints).
I can't understand why my model doesn't work properly.
can someone help me?
Thanks

sentences: How do I create good looking plasma explosion effects? Is this just a billboard quad with a bloom shader?

sentences:
Getting error GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT I am getting error code GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when creating framebuffer on Mac (using glCheckFramebufferStatus).

I am using same code for rendering on Mac and iOS both. Maybe problem is in the buffers initialization. On iOS I am doing it this way:

    CAEAGLLayer* eaglLayer = (CAEAGLLayer*) super.layer;
    eaglLayer.opaque = YES;

    EAGLRenderingAPI api = kEAGLRenderingAPIOpenGLES2;
    m_context = [[EAGLContext alloc] initWithAPI:api];

    if (!m_context) {
        [self release];
        return nil;
    }

    if (!m_context || ![EAGLContext setCurrentContext:m_context]) {
        [self release];
        return nil;
    }

    [self layoutIfNeeded];

    NSLog(@"Using OpenGL ES 2.0");

    [m_context
        renderbufferStorage:GL_RENDERBUFFER
        fromDrawable: eaglLayer];

Variable m_context is object EAGLContext

On the Mac this way:

NSOpenGLPixelFormat *nsglFormat;

NSOpenGLPixelFormatAttribute attr[] =
{
    NSOpenGLPFADoubleBuffer,
    NSOpenGLPFAAccelerated,
    NSOpenGLPFAColorSize, m_colorBits, //16
    NSOpenGLPFADepthSize, m_depthBits, //16
    0
};

[self setPostsFrameChangedNotifications: YES];

///< Next, initialize the NSOpenGLPixelFormat itself
nsglFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];

///< Check for errors in the creation of the NSOpenGLPixelFormat
if(!nsglFormat) {
    NSLog(@"Invalid format... terminating.");
    return nil;
}

///< Now create the the CocoaGL instance, using initial frame and the NSOpenGLPixelFormat
self = [super initWithFrame:frame pixelFormat:nsglFormat];
[nsglFormat release];

///< If there was an error, we again should probably send an error message to the user
if(!self) {
    NSLog(@"Self not created... terminating.");
    return nil;
}

///< Now  set this context to the current context

[[self openGLContext] makeCurrentContext];

Maybe I am doing anything wrong when I initialize NSOpenGLContext. Can you see any error? Thankyou
UPDATE: Initialization of the OpenGL I am doing this way:

int m_width, m_height;

glGetRenderbufferParameteriv(GL_RENDERBUFFER,
                             GL_RENDERBUFFER_WIDTH, &m_width);
glGetRenderbufferParameteriv(GL_RENDERBUFFER,
                             GL_RENDERBUFFER_HEIGHT, &m_height);

// Create the depth buffer.
glGenRenderbuffers(1, &m_depthRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, m_depthRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER,
                      GL_DEPTH_COMPONENT16,
                      m_width,
                      m_height);

// Create the framebuffer object; attach the depth and color buffers.
glGenFramebuffers(1, &m_framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
                          GL_COLOR_ATTACHMENT0,
                          GL_RENDERBUFFER,
                          m_colorRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
                          GL_DEPTH_ATTACHMENT,
                          GL_RENDERBUFFER,
                          m_depthRenderbuffer);

// Bind the color buffer for rendering.
glBindRenderbuffer(GL_RENDERBUFFER, m_colorRenderbuffer);

// Set up some GL state.
glViewport(0, 0, 640, 480);
glEnable(GL_DEPTH_TEST);

sentences:
Unity: Unsharp edges I have a Unity Project and somehow the edges of objects in my Scene (Scene view and game view) look like this:

I think I already had that problem once, but in my recent projects, this didnt happen anymore.

Is there any solution to that?

sentences:
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:
Enemy class architecture I'm developing a game for Android in Java. I would like to know how a good Enemy class architecture could be implemented.

I've created an abstract class called Enemy. It stores common properties like Health and Animation data. It has methods like LoadContent, Update and Draw.

I want to inherit this class and implement different enemy classes. I want to be able to store all my active enemies in some sort of collection. Then in my Update function of my game loop, I'll do something like:

for each Enemy in Enemies
{
Enemy.Update()
}

And the Update method of the correct child class would be called.

How can this be achieved?

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:
Add buttons into List when mouse is HoldDown? I have three buttons in my menu. What I need to do is when I click on first button it becomes the first element in my list. Now, when I keep mouse button down and move it to the second button it becomes the second second element in my list. The same with the third button.
public List<GameObject> UI_Button_List = new List<GameObject>(3);

void Update()
{

    if (Input.GetMouseButtonDown(0))
    {

    if (UI_Button_List[0] == null)
    {
        UI_Button_List[0] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    if (UI_Button_List[0] != null && UI_Button_List[1] == null)
    {
        UI_Button_List[1] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    if (UI_Button_List[0] != null && UI_Button_List[1] != null && UI_Button_List[2] == null)
    {
        UI_Button_List[2] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    } // end if

}

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:
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:
Unity3D: AI follow player script for prefab enemy? So I am having an issue, I have an enemy prefab that is created when the new wave happens(think of Nazi Zombies from Call of Duty, same system) but every script I have found that deals with ai following player always involves a public transform variable. The issue is that the object I put in that variable in the inspector does not save with the prefab, rendering the script useless. Is there anyway I can get the enemy prefab when the enemy spawns to follow the player?

He is a script I tried and failed due to the issue:

    //The target player
public Transform player;
//In what time will the enemy complete the journey between its position and the players position
public float smoothTime = 10.0f;
//Vector3 used to store the velocity of the enemy
private Vector3 smoothVelocity = Vector3.zero;

private void Start()
{
}

//Call every frame
void Update()
{
    //Look at the player
    transform.LookAt(player);
    //Move the enemy towards the player with smoothdamp
    transform.position = Vector3.SmoothDamp(transform.position, player.position, ref smoothVelocity, smoothTime)*Time.deltaTime;

}

sentences:
Strange behavior of RigidBody with gravity and impulse applied I'm doing some experiments trying to figure out how physics works in Unity.

I created a cube mesh with a BoxCollider and a RigidBody. The cuve is laying on a mesh plane with a BoxCollider.

I'm trying to update the object position applying a force on its RigidBody.
Inside script FixedUpdate function I'm doing the following:

public void FixedUpdate()
{
    if (leftButtonPressed())
        this.rigidbody.AddForce( this.transform.forward * this.forceStrength, ForceMode.Impulse);
}

Despite the object is aligned with the world axis and the force is applied along Z axis, it performs a quite big rotation movement around its y axis.
Since I didn't modify the center of mass and the BoxCollider position and dimension, all values should be fine.

Removing gravity and letting the object flying without touching the plane, the problem doesn't show. So I suppose it's related to the friction between objects, but I can't understand exactly which is the problem.

Why this? What's my mistake? How can I fix this, or what's the right way to do such a moving an object on a plane through a force impulse?

sentences: In Unity - Move a GameObject at Animator State I want to move one of my GameObject to a different vector 3 position, when animator transit to a new state. How do I do it? Also there shouldn't be any delay.

sentences:
Box2D body jitters when colliding with static body I am developing a game where a body is moved within the scene using touch. The scene has a boundary wall made up of static rectangular bodies. When I move the object along the boundaries, on collision, it jitters.

This is because the boundary wall pushes the body outwards while the touch pushes it against the wall. I am using linear velocity to move the body using touch. I tried to avoid this by setting the linear velocity of the body to 0 on collision with the boundary wall but it didn't work. I am trying to have a smooth movement along the boundary walls with no jitters. How can I solve this?

Following snippet moves the body on touch. Linear velocity vector has direction towards the touch point. The movement is smooth within the play area but not at the boundaries.

 case TouchEvent.ACTION_MOVE:

                strikerBody.setLinearVelocity((pSceneTouchEvent.getX()-body.getPosition().x * PIXEL_TO_METER_RATIO_DEFAULT),(pSceneTouchEvent.getY()-body.getPosition().y * PIXEL_TO_METER_RATIO_DEFAULT));

These are the bounadry walls:

final Rectangle groundLeft = new Rectangle(camera.getWidth() / 2 - camera.getWidth() / 4, 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);
        final Rectangle groundRight = new Rectangle(camera.getWidth() / 2 + camera.getWidth() / 4, 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);

    final Rectangle roofLeft = new Rectangle(camera.getWidth() / 2 - camera.getWidth() / 4, camera.getHeight() - 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);
    final Rectangle roofRight = new Rectangle(camera.getWidth() / 2 + camera.getWidth() / 4, camera.getHeight() - 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);

    final Rectangle leftTop = new Rectangle(1, camera.getHeight() / 2  + camera.getHeight() / 4 + camera.getHeight() / 12 + camera.getHeight() / 16 , 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);
    final Rectangle leftBottom = new Rectangle(1, camera.getHeight() / 2  - camera.getHeight() / 4 - camera.getHeight() / 12 - camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);

    final Rectangle rightTop = new Rectangle(camera.getWidth() - 1, camera.getHeight() / 2  + camera.getHeight() / 4 + camera.getHeight() / 12 + camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);
    final Rectangle rightBottom = new Rectangle(camera.getWidth() - 1, camera.getHeight() / 2  - camera.getHeight() / 4 - camera.getHeight() / 12 - camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, groundLeft, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, groundRight, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roofLeft, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roofRight, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, leftTop, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, leftBottom, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, rightTop, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, rightBottom, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    this.attachChild(groundLeft);
    this.attachChild(groundRight);
    this.attachChild(roofLeft);
    this.attachChild(roofRight);
    this.attachChild(leftTop);
    this.attachChild(leftBottom);
    this.attachChild(rightTop);
    this.attachChild(rightBottom);

sentences:
Easily split up a ripped spritesheet with no downloads? So, I'm new and all to game development, and I use the free version of Construct 3.

I want to make a Mother 3 fan game, as it's one of my favourite games of all time and seems like fun practice for a top down RPG.

I downloaded a ripped sheet of Lucas, but the background is green, and also it's in one image.

Is there an easy way to split the sheet into multiple images, without any downloads? I'm using someone else's computer and I can't download anything.

It's a windows 7 computer, with like nothing but chrome

sentences:
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:
Automatically generate low detail collision meshes I lately integrated Bullet Physics into my little game engine, but for now I only use basic shapes as spheres or boxes for collision checks. For more realistic physics I need collision meshes for all models in the scene. They should be much simpler and in lower detail than the actual model for drawing to speed up computations.

Since I want adding new asserts to the engine as easy as possible, I am looking for a way to automatically generate collision meshes. I could just use the actual mesh loaded from file and that would result in very realistic physics calculations but that won't be fast enough. Therefore, how can I generate low detail collision meshes from a given set of vertices?

This task doesn't seem trivial since there many different cases to handle. For example a model of a house with furniture must retain details of floor and door frames while ornaments should be removed. I believe there already was research on this topic, but I couldn't find anything useful yet.

sentences:
Why do i get this error in VS2017 but game compiles and works as expected? I have this error, yet the game works and that variable ActorThatOpens get assigned correctly.

In my header the includes are:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "OpenDoor.generated.h"

As far as I can tell from the docs Components/ActorComponent.h contains the function  GetWorld().

I have to go work now, but been scratching my head over this for an hour or so, and will continue to when i get home later. If anyone can see what I am doing wrong and can help I will be so grateful.

(As you can probably tell I am completely new to C++) THANKS!

sentences:
JOGL KeyListener not functioning properly I have been having a problem with the JOGL KeyListener where if I hold down a key, it would register the key as pressed for around 1 second, then it would start quickly switching back and forth between pressed and unpressed. However, if I hold more than one key at once, sometimes the key listener "forgets" about one of the keys and keeps it held down (like it should) while releasing the other one (when it shouldn't).

Here is the relevant code in the class:

import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;

import java.util.HashSet;
import java.util.Set;

public class KeyInput implements KeyListener {
    private static Set<Short> key=new HashSet<Short>();
    public void keyPressed(KeyEvent keyEvent) {
        key.add(keyEvent.getKeyCode());
        System.out.println("added " +keyEvent.getKeyChar());
    }

    public void keyReleased(KeyEvent keyEvent) {
        key.remove(keyEvent.getKeyCode());
        System.out.println("removed " +keyEvent.getKeyChar());
    }

    public static boolean getKey(short k){
        return key.contains(k);
    }
}

I tried using other methods of storing the keys to no avail. How should I fix it so that it properly registers and remembers held down keys? I tried a different program with Swing and it worked fine. It has the exact same code as shown here.

sentences:
Why does my ID3DXSprite appear to be incorrectly scaled? I am using D3D9 for rendering some simple things (a movie) as the backmost layer, then on top of that some text messages, and now wanted to add some buttons to that.

Before adding the buttons everything seemed to have worked fine, and I was using a ID3DXSprite for the text as well (ID3DXFont), now I am loading some graphics for the buttons, but they seem to be scaled to something like 1.2 times their original size.

In my test window I centered the graphic, but it being too big it just doesnt fit well, for example the client area is 640x360, the graphic is 440, so I expect 100 pixel on left and right, left side is fine [I took screenshot and "counted" the pixels in photoshop], but on the right there is only about 20 pixels)

My rendering code is very simple (I am omitting error checks, et cetera, for brevity)

// initially viewport was set to width/height of client area

// clear device
m_d3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0,0,0,0), 1.0f, 0 );

// begin scene
m_d3dDevice->BeginScene();

// render movie surface (just two triangles to which the movie is rendered)

m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,false);
m_d3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); // bilinear filtering
m_d3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); // bilinear filtering
m_d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); //Ignored
m_d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
m_d3dDevice->SetTexture( 0, m_movieTexture );
m_d3dDevice->SetStreamSource(0, m_displayPlaneVertexBuffer, 0, sizeof(Vertex));
m_d3dDevice->SetFVF(Vertex::FVF_Flags);
m_d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);

// render sprites
m_sprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE | D3DXSPRITE_DO_NOT_ADDREF_TEXTURE);

// text drop shadow

m_font->DrawText( m_playerSprite, m_currentMessage.c_str(), m_currentMessage.size(),
&m_playerFontRectDropShadow, DT_RIGHT|DT_TOP|DT_NOCLIP, m_playerFontColorDropShadow );
// text
m_font->DrawText( m_playerSprite, m_currentMessage.c_str(), m_currentMessage.size(),
&m_playerFontRect, DT_RIGHT|DT_TOP|DT_NOCLIP, m_playerFontColorMessage ) );

// control object
m_sprite->Draw( m_texture, 0, 0, &m_vecPos, 0xFFFFFFFF ); // draws a few objects like this

m_sprite->End()

// end scene
m_d3dDevice->EndScene();

What did I forget to do here? Except for the control objects (play button, pause button etc which are placed on a "panel" which is about 440 pixels wide) everything seems fine, the objects are positioned where I expect them, but just too big.

By the way I loaded the images using D3DXCreateTextureFromFileEx (resizing wnidow, and reacting to lost device, etc, works fine too).

For experimenting, I added some code to take an identity matrix and scale is down on the x/y axis to 0.75f, which then gave me the expected result for the controls (but also made the text smaller and out of position), but I don't know why I would need to scale anything. My rendering code is so simple, I just wanted to draw my 2D objects 1;1 the size they came from the file...

I am really very inexperienced in D3D, so the answer might be very simple...

sentences:
Texture the quad with different parts of texture I have a 2D quad. Let say it's position is (5,10) and size is (7,11).

I want to texture it with one texture, but using three different parts of it.
I want to texture the part of quad from x = 5 to x = 7 with part of texture from U = 0 to U = 0.5 (replaying it after achieving 0.5, so I will have 4 same 0.5-lenght fragments).
The second one with some other part of texture (also repeating it) and third in the same style.

But, how to achieve it?

I know that:

float2 tc = fmod(input.TexCoord, textureCoordinates.zw - textureCoordinates.xy) + textureCoordinates.xy; //textureCoordinates.xy = fragments' offset

Will give me the texture part replaying.

sentences:
Unity rigidbody exhibits a premature max speed In effort to build a racing simulator, I have been working on a working model for the pistons in the engine, and have come to a bit of a stand still.

I have gone through extensive testing, through which we have "dumbed down" our prototype, in efforts to localise the actual problem.

We have a wheel, represented by a basic cylinder. I have added a second cylinder as a sort of knob, which allows us to run the system, and easily visualise its spin, using the following line;

Throughout various tests, a common observation is that the wheel does not appear to spin correctly. Using a collision plane to derive rotations per minute, we have determined that at a certain "thrust", the wheel reaches its maximum speed. Past a value of approximately 'thrust = 5,000', the wheel will not increase its speed. At present, this gives us a rotation of approximately 60 rotations per minute. Ideally, we want to be able to reach the breaking point of about 10,0000.

 rigidbody.AddTorque(transform.up * Time.deltaTime
                                  * rotatioonSpeed, ForceMode.Acceleration);

What causes the rigidbody to 'cap' its force? Everything is at default, as per various tutorials we have explored; As far as we have looked, various values might have an impact, but not to the point where speed hits a maximum on its own merit.

Incase it matters, a some extra information about the system:

We are not yet using conventional Unity measurements. While to scale, the pistons are quite larger then normal, with the cylinder housing the piston holding a length of approximately 2 meters.
Once "thrust" exceeds the maximum allowance to impact on speed, the value appears to weigh on breaking force, instead. Prior to reaching maximum speed, the user needs to "push" on the opposite direction, to reverse the rotation. It can take a second or two before the wheel slows down, and reverses its direction. The further past this maximum we go, the quicker the engine will immediately move in the reverse direction.
There is nothing else imparted on our model for this behaviour to take place. We are literally dealing with a wheel with a joiner pin on the side.
As stated, tutorials we have viewed tend to suggest that the values in the rigidbody should not effect the behaviour, this early. That said, here are our values:

Mass: 1
Drag: 0
Angular Drag: 0.05
Use Gravity: False
Is Kinematic: False
Interpolate: None
Collision Detection: Discrete
Constraints: FreezeRotationYZ

My best attempts to find a similar problem online ironically reaches a bunch of articles on users attempting to enforce a maximum speed. For best results within scope, we would hope to be able to reach infinite speeds, and separately work out whether the speed of our wheel would cause a major fault, in turn limiting the speed it would potentially reach in practice.

Personally, I suspect that the size of the object would make a difference, as unity perceives it. Another member on my team argues that because the rigidbody uses relative values, size should not make a difference. Unfortunately, this is as far as we can get in localising the problem.

sentences:
Unity Screen.height / Screen.dpi is *not* equal to the screens height in real life On mobile, I was planning on using Screen.dpi to work out the physical size of the screen and size controls accordingly.

But this quick test on my Galaxy S5 proves that the numbers from Unity are wrong.

1080 / 480 = 2.25 But the screen in real life is over 2.5 inches high.. So this is way off.

Any suggestions..? Right now I think I'll just leave this, and have the controls the same size in world space.. rather than risk making them worse.

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:
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:
MonoGame: PC + Mobile? I'm researching Monogame. Their goal is to allow "easy" porting of an existing XNA/Windows game to mobile.

Does this mean you can have one solution (theoretically) with shared code, and it works on all three platforms (PC, Android, iPhone)? Or do you need to port your game from PC to Android, and then again to iPhone?

I'm sure "write once, run anywhere" works 80% of the time, I'm not worried about that other 20% like support for GPS, acceleratometer, etc. which doesn't exist on all platforms.

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:
Testing for connected maze cells I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces.

I have a 'start' cell that is a different colour to the others,when cells are rotated in such a way that they become 'linked' to this start cell, then all the cells that are linked back to this cell should change colour.The start cell itself can be rotated as well so just because a cell is back in it's initial rotation it doesn't mean it's connected. Also any random cell can be rotated regardless of whether it's neighbour is already connected. E.g if the start cell is at [8,8] in a grid, then all the other cells bar it's immediate neighbours could get connected and then finally the closest neighbours get rotated to form a completely connected grid in which case all cells should change colour like a flood fill.

Are there any good algorithms to solve an issue like this? I was thinking of a flood fill from the start cell every time a cell is rotated somewhere but I'm not sure if this is the optimum way to do this, especially as I have to check what each type of cell is (e.g is it a corner piece, a straight piece, a T Junction or a dead end with only one connecting side) and then check what it's current rotation is compared to it's neighbours rotation and type. Obviously this is fine if you can stop at immediate neighbour to the start piece, but when other sections of the maze might be 'complete' and then an interjoining piece is linked I would need to flood fill all of them. I had started writing this but I found myself just pretty much duplicating switch statements for all the different types of piece and then what type of piece their neighbour was and comparing the rotations of each piece. It felt very 'DRY' even though the comparisons were changing

I'm writing this in swift, but I guess an algorithm would be generic

thanks

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:
libGDX collision detection / bounding the object I am trying to implement collision detection so I am drawing a red rectangle to see if it is working. When I put the code below into the update method to check if it is going to work the position is not in the right place. The red rectangle starts from the middle and not at the x and y point? So it draws it wrong.

I also have a getter method so nothing wrong there.

bullet.set(getX(), getY(), getOriginX(), getOriginY());

this is for the render

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.rect(bullet.getX(), bullet.getY(), bullet.getOriginX(), bullet.getOriginY(), 15, 5, bullet.getRotation());
shapeRenderer.end();

I have tried to do it with a circle but the circle draws in the middle and I want it to be at the tip of the bullet. At the front of the bullet. x, y point.

boundingCircle.set(getX() + getOriginX(), getY() + getOriginY(), 4.0f);

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.circle(bullet.getBoundingCircle().x, bullet.getBoundingCircle().y, bullet.getBoundingCircle().radius);
shapeRenderer.end();

I need it to be of the x and y as the bullet is in the middle of the sprite when drawn originally via paint.

sentences: Problems making a smooth character rotation My character has an angle rotation, when the player touches the screen it automatically face to the place that the player touched, using atan2(y,x) and Math.radiansToDegrees methods, but I want it to do that smoothly, is to say, save the required angle in a variable, and the current one in another, and depending of the 2 values, make it to rotate to left(if the required angle is to the right side of the current) or to the right. I've been almost an hour thinking about this, but I  couldn't solve it.

sentences: How can I have a value increase by multiples of 10 in the inspector? I have a number that I want to be editable in the inspector.  However, I want to restrict that number to be a multiple of 10.  I can always just go into the code and set it to the nearest multiple of 10, but I'd rather force it in the inspector.  I am willing to use an int, float, Vector, or really any sort that can hold a number.  How can I do this?

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:
How to improve my input handling in GLFW? Currently I'm busy working on a game engine. I have my own window class with GLFW functionalities. Currently, I have a very primitive way to handle input in my class:

It is not fast, and not "extendable" enough. I'm essentially using something along the lines of

void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_E && action == GLFW_PRESS)
        //do something
}

I would like to call something like the following:

// Create a window object
Window window("title",800,600);
//the parameters specify the key pressed and what the window has to do when the event occurs.
window.getKeyPressed(KEY,ACTION);

How would I go about implementing a more flexible input handling system?

sentences:
Should I write my own game engine, and if so what are the main features? Possible Duplicate:
  When to roll your own game engine?

I've been interested in writting games for a while, and now that I have acquired a bit of experience in programming, I feel like I could step up to making a little more complicated things. I've had some fun with SFML but since now I only had the basic classes I needed for my game objects, and a big run() method of my Game object to "run them all".

I've only written gameplay tests so far, but I feel like a complete game in the same style of programming would be a gigantic headhache source. I am now facing a problem/question : should I be considering creating my own little "game engine", learning through it, adding features as I need them ?
I think it could be a really good experience, but it would certainly take time as I'm no professional, and I don't have a clear view of "how-to" yet.

I am using SFML with C++.

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:
SpriteBatch.end() Issue because of a thread While playing, I use a thread to Load() and Unload() Texture2D.
I have multiple ContentManager to only Unload() Texture2D I want to unload.

But sometimes, I have this issue on the SpriteBatch.End() :

    ObjectDisposedException: Cannot access a disposed object
    Object name : texture2D

I don't understand very well the Threads, and I think it's the main problem.
Roughly :

    Game.Update(GameTime gameTime)
    {
        character.Update(gameTime);
        //...Things.Update(gameTime)...
        CheckThingsToLoadandUnload();
    //etc
    }

    CheckThingsToLoadAndUnload()
    {
        For each texture to check
        {
            if(HasPrerequists)
            {
                if(!thisTexture.isLoaded)
                {
                    ThreadStart ths_LoadInGame = delegate {
                        LoadInGame(param1, param2, param3); };
                    new Thread(ths_LoadInGame).Start();
                }
            }
            else
            {
                if(thisTexture.isLoaded)
                {
                    ThreadStart ths_UnloadInGame = delegate {
                        UnloadInGame (param1, param2); };
                    new Thread(ths_UnloadInGame ).Start();
                }
            }
        }
    }

I overrided the T Load<T<(string assetname) ContentManager to add a Lock.

I think this issue happens when the Unload() Thread unload a Texture used by the SpriteBatch().
But I really don't know how to prevent this.
Hope you can help.

sentences:
Unity - Sprite vertices in 3D world Rookie here, still learning the basics of Unity.
I've been using a quad as a cursor sitting flat on top of a hilly terrain mesh. I've been getting the terrain angle by raycasting down at all four corners of the quad and finding where it hits the floor, then editing the quad vertices to shape it to the terrain angle. Probably not the ideal way but it works great for what I needed.
So the next step is replacing it with a sprite. I changed from quad to a sprite renderer, and added a little animation to it. I went to edit the vertices and the setup is completely different (it seems to have 20+ vertices now instead of 4).
I did notice the SpriteRenderer has 4 triangles, but the points are Vector2s rather than Vector3, so I guess that won't work either since I'm applying it to a 3d world?
Can anyone with experience point me in the right direction with this?

sentences:
Can a user / a game developer get their credit back in dollars? If yes, at what cost? You can find every information about how to give money to facebook, but when it comes to take it back…

If I give credits to a user, can he get it back in dollars?

If a user gives me credits, can I turn it into dollars?

If so, how much does it cost?

sentences: How to debug a GLSL shader? I cannot find any tutorial in Google and Youtube. I have a C++ program that uses OpenGL ES 2.0 API to render something on the screen. How can I debug my shaders? Any step-by-step guide? What is the easiest way to at least print variable values?

sentences:
How to raycast in MonoGame 2D? Currently I am using a Ray class that I built myself. The following is for brevity.

public class Ray : GameObject
{
    public GameObject Shooter;
    public List<GameObject> Objects;
    public float Speed = 250f;
    public bool Collided = false;

    public void Update(){
        if (Collided) return;
        Position.X += Speed * gameTime;
        Position.Y += Speed * gameTime;

        foreach(var obj in Objects){
            if (this.Intersects(obj) {
                 obj.OnCollide(this);
                 Collided = true;
            }
        }
    }

This works, but only if I control the amount of rays, cause if I create too many rays, the game becomes laggy OR the ray/bullet get past through walls (idk why). I am trying to find out which objects that player can see and only draw the visible things, so I need to let out alot of rays. Is there a more efficient way to achieve this objective.

sentences:
Flexible and extendable system of level objectives (victory/failure conditions) in Unity I'm trying to come up with a flexible system of level objectives for a Unity game. What I'd like to achieve is to have a system that on each level (scene) can accept a different set of (configurable) success/failure conditions. Conditions can be repeated between levels but on every level a given type of condition should accept different parameters.

For example on one level success conditions would consist of destroying all enemy units and on the other level success conditions would require destroying a specific enemy unit and escorting a friendly unit to a specific place on map. Failure conditions would for example be player death (on all levels) or not reaching a specific destination within a given time.

First I've tried to approach this problem by using ScriptableObjects but abandoned this idea as it's not possible to save scene object references in a ScriptableObject.

So I've come up with a kind of polymorphic system like this (pseudocode):

public interface Condition {

    bool IsFulfilled();
}

public abstract class VictoryCondition : MonoBehaviour, Condition {

    public virtual bool IsFulfilled();
}

public abstract class AllUnitsKilledCondition : VictoryCondition {

    public List<Unit> units;

    public bool IsFulfilled() {
        foreach (Unit unit : units) {
            if (unit.IsAlive) {
                return false;
            }
        }
        return true;
    }
}

public abstract class FailureCondition : MonoBehaviour, Condition {

    public virtual bool IsFulfilled();
}

public abstract class TimeOutCondition : FailureCondition {

    public float timeLeft;

    void Update() {
        timeLeft -= Time.deltaTime;
    }

    public bool IsFulfilled() {
        return timeLeft <= 0;
    }
}

The idea here is to have a level manager that is given a set of victory/failure conditions in the editor and have it continuously monitor all those conditions. In a simplest scenario a level is won if all victory conditions are fulfilled and lost if any failure condition is fulfilled.

Unfortunately, I'm not sure how to create a LevelManager component that would expose those lists letting me add various conditions and configure them (for example letting me add a list of units from scene to AllUnitsDestroyedCondition). I think it would be doable with a set of custom property drawers for each type of condition but I'm wary of digging into this until I'm sure there is no other, easier way.

I've come up with a way of adding various conditions by adding multiple condition components to a GameObject and then dragging those components to victory/failure conditions lists in LevelManager. But this solution seems awkward and inflexible because it's not possible to dynamically add and configure new conditions in runtime and creating more complex conditions (for example some condition activating only after some other condition is fulfilled) seems like a sure way to create a huge pile of unmaintainable condition component mess.

Please, let me know if I'm approaching this problem correctly and if not, what are other, simpler, more flexible solutions.

sentences:
Easy road from DisplayObject to Molehill? I have a finished Flash game which is rendered using the built-in display tree, i.e. Bitmaps contained in Sprites (and a text here and there, few vector graphics, and one bitmap-filled shape).
For extra performance, I'd like it to use Molehill for rendering, but that's not possible out of the box.

What's the easiest way to make this game use Molehill when available, but fall back to the current method if it's not available?

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:
When and how often does Epic charge me royalties on my game? I want to know about that 5% royalties that Epic charges for the Unreal Engine if I sell games above $3000.

What about if my game just made $300? Do I still need to pay 5% royalties to them? And how many times should I pay? For example, I made a game that was sold for above $3000 so I paid 5% royalties but do I still need to pay it again for the same game?

sentences:
LPD3DX10FONT::DrawTextA/W messes up the depth buffer! why does calling this function mess up the depth buffer? I read somewhere that it cheekily changes the blend state, but to be totally honest I don't even know what that means. What is it doing, why is it doing it and what should I do about it?

Here is my code... instantiation:

RECT rct;
D3DXCOLOR fontColor = D3DXCOLOR(255,0,0,255);
LPD3DX10FONT m_font;
LPD3DX10SPRITE m_sprite;

and then...

rct.left=200;
rct.right=780;
rct.top=200;
rct.bottom=rct.top+20;

D3DX10CreateFont(device, 16, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS,     ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Verdana", &m_font);
D3DX10CreateSprite(device, 256, &m_sprite);

and THEN...

m_sprite->Begin(D3DX10_SPRITE_SAVE_STATE);

std::ostringstream oss;

oss << "This ruins the depth buffer!!!" << agents[0].State();

std::string test = oss.str();

m_font->DrawTextA(m_sprite, test.c_str(), -1, &rct, DT_LEFT|DT_NOCLIP , fontColor);

m_sprite->End();

as a side question, is there a more succinct way I can append variables to the string being written?

sentences:
Advice on how to approach building background glow for 3d galaxy? I've got a proceduraly generated 3d galaxy galaxy, very large. Milky Way scale. It is broken up into sectors, where I can relatively quickly get the star density and average star color of any given sector with a simple call:

Color GetColorAt(x,y,z); //where hue represents star color and intensity is density

I am already pulling in the sectors around the player's location, so that the player can fly through the stars. Works great, performance is fine. Now what I want to do is add in the collective glow from stars in the galaxy that are very far away. Just like when you look at the night sky (in a rural area) you can see the glow of the milky way.
So one approach is to build a skybox. For each pixel of the skybox, cast a ray through the volume of the galaxy, and check at some # of points along the ray for the star density/color there, and add it all up, then use that to set the pixel of the skybox.
However this is computationally extremely expensive. ~6x1024x1024x10 operations or thereabouts at a minimum.
Another idea was do to a much sparser sampling of the galaxy density around the player, and use that data to create a particle system. Where each particle will take up way more than just 1 pixel. The effect might even look pretty good.
Any other ideas? Is there a data structure that would let me do this quickly?

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:
Should the camera's rotation value be clamped? I noticed that when writing a camera for my 2D game that the camera rotational value of -6 and 6 is equivalent to 0.

That is, -6 = -12 = -18 = -24 = 6 = 12 = 18 = 24.

I was wondering if it was considered good practice to always keep the rotational value between -6 and 6, like so:

    public float Rotation
    {
        get
        {
            return rotation;
        }
        set
        {
            rotation = value;

            if (rotation <= -6 || rotation >= 6) rotation = 0;
        }
    }

Does it matter either way?

sentences:
Perlin noise looks uncoherent on higher z I was experiencing with my Perlin noise function and I tried to animate a 2D noise by changing the z value of a small amount every frame. However, as z increases, the result becomes stranger and stranger, looking like this:

Why is this happening? How could I solve this?

Here's the Lua code that could be wrong (as asked):

function perlin.fade(t)
    return t * t * t * (t * (6 * t - 15) + 10)
end
function perlin.lerp(t, a, b)
    return a + t * (b - a)
end
function perlin.grad(hash, x, y, z)
    local h = hash % 16
    local u
    local v
    if (h < 8) then u = x else u = y end
    if (h < 4) then v = y elseif (h == 12 or h == 14) then v = x else v = z end
    local r
    if ((h % 2) == 0) then r = u else r = -u             end
    if ((h % 4) == 0) then r = r + v else r = r -v end
    return r
end
function perlin:noise(x, y, z)
    y, z = y or 0, z or 0
    local X = math.floor(x) % 256
    local Y = math.floor(y) % 256
    local Z = math.floor(z) % 256
    x = x - math.floor(x)
    y = y - math.floor(y)
    z = z - math.floor(z)
    local u = perlin.fade(x)
    local v = perlin.fade(y)
    local w = perlin.fade(z)
    local A  = self[X + 1] + Y
    local AA = self[A + 1] + Z
    local AB = self[A + 2] + Z
    local B  = self[X + 2] + Y
    local BA = self[B + 1] + Z
    local BB = self[B + 2] + Z
    return perlin.lerp(w, perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AA + 1], x    , y    , z    ),
                               perlin.grad(self[BA + 1], x - 1, y    , z    )),
                       perlin.lerp(u, perlin.grad(self[AB + 1], x    , y - 1, z    ),
                               perlin.grad(self[BB + 1], x - 1, y - 1, z    ))),
               perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AB + 2], x    , y    , z - 1),
                               perlin.grad(self[BA + 2], x - 1, y    , z - 1)),
                       perlin.lerp(u, perlin.grad(self[AB + 2], x    , y - 1, z - 1),
                               perlin.grad(self[BB + 2], x - 1, y - 1, z - 1))))
end

sentences:
How to move points of a multi-segmented bezier curve to one side I am trying to move points from a multi-segmented bezier curve to one end of the curve using the following code which modified for my use from here. Only the last segment seems to give the desired behaviour. All other segments, basically just disappear or skip through briskly.

public Vector2[] MultiSegmentCubicCurveReduction(Path curve, float start, float end)
{
    List<Vector2> pointsForSubpath = new List<Vector2>();

    float oneMinusStart = 1f - start;
    float oneMinusEnd = 1f - end;

    float scale = (end - start) / (curve.NumPoints - 1);

    for (int i = 0; i < curve.NumSegments; i++)
    {

        var a =
            oneMinusStart * oneMinusStart * oneMinusStart * curve[3*i] +
           3f * oneMinusStart * oneMinusStart * start * curve[3 * i + 1] +
           3f * oneMinusStart * start * start * curve[3 * i + 2] +
                                     start * start * start * curve[3 * i + 3];

        var b = a + (3f * oneMinusStart * oneMinusStart * (curve[3 * i + 1] - curve[3 * i]) +
                     6 * start * oneMinusStart * (curve[3 * i + 2] - curve[3 * i + 1]) +
          3 * start * start * (curve[3 * i + 3] - curve[3 * i + 2])) * scale;

        ;

        var d = oneMinusEnd * oneMinusEnd * oneMinusEnd * curve[3 * i] +
            3f * oneMinusEnd * oneMinusEnd * end * curve[3 * i + 1] +
            3f * oneMinusEnd * end * end * curve[3 * i + 2] +
                                            end * end * end * curve[3 * i + 3];

        var c = d - (3f * oneMinusEnd * oneMinusEnd * (curve[3 * i + 1] - curve[3 * i]) +
                     6 * end * oneMinusEnd * (curve[3 * i + 2] - curve[3 * i + 1]) +
                                                        3 * end * end * (curve[3 * i + 3] - curve[3 * i + 2])) * scale;

        pointsForSubpath.AddRange(new List<Vector2>() { a, b, c, d });
    }

    return pointsForSubpath.Distinct().ToArray();

}

UPDATE

The brisk movement I was having earlier was actually a reduction of control points to four regardless of the number of segments.
Now I am getting the following behaviour. All the points for the first segment converge to one end point whiles all the points of the remaining segments converge to the other end point, resulting in a straight line.

sentences:
Level creation of Rayman Origins type game? Does anyone know the technique they used to create their levels (using rayman origin as an example)? I'm strictly speaking of the floors and walls. Doesn't look like tiled based.  What is the workflow that would be needed for a non-tiled based game?  I am trying to implement something like this (below) but I am stuck between two ways of doing it

First: Just have art assets and get/set positions of them, similar to tiled based but the objects would be more detailed (with different positions for the x and y)-seems slightly tedious, I could save the locations to a text file and load it from there.

Second: I have seen an article which I can't find, but the game dev pretty much drew the base level (the walls, floors) and then added a bit of imagery on top of it.  So in the picture below, they would've just drew green ledges and walls, then cover them up with leaf-like assets. - I would really like to implement this option, as I could for example, draw a straight line for a hill, then cover it up with some assets, but the collision would still be the straight line

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:
box2d not centered in sprite I am trying to create a bounding box for my sprite using box2d, but the box is being created at the wrong spot. I followed a tutorial on the wiki using this code

    BodyDef bodyDef1 = new BodyDef();
    bodyDef1.type = BodyDef.BodyType.DynamicBody;
    bodyDef1.position.set(player.getX(), player.getY());
    playerBody = world.createBody(bodyDef1);
    PolygonShape square = new PolygonShape();
    square.setAsBox(player.getWidth() / 2, player.getHeight() / 2);
    FixtureDef fixtureDef1 = new FixtureDef();
    fixtureDef1.shape = square;
    fixtureDef1.density = 0.1f;

Player is a just the sprite that I am trying to create the box around.

sentences: Identify whether object is off screen or not I have placed three game object in the scene.How to know whether the object is visible on the screen.Print a message if the object is not visible on the screen.

sentences:
How can I make player object collide and keep moving until it is as close as possible to click location? I am making a basic point and click adventure game. I can make the player object move towards the location of a mouse click and collide with walls, but movement stops the instant a collision occurs. I would like the player object to keep moving (slide along the wall) and get as close as it can to the mouse click location, without passing through a wall of course. I have Create, Step, Collision & Global Mouse click events. Please see below for code and diagrams.
Any help will be much appreciated.

Create Event code:
//stop player moving on create
enum mouse {
    none
}
xx = mouse.none;
yy = mouse.none;
player_move_speed = 2;

//init
collision_speed = player_move_speed + 1;

Step Event code:
//general keys
if keyboard_check_pressed(vk_escape) {game_end()}

//point and click movement
if (xx != mouse.none and yy != mouse.none) {
    move_towards_point(xx,yy,player_move_speed);
} else {
    speed = 0;
}

if (distance_to_point(xx,yy) < collision_speed) {
    xx = mouse.none;
    yy = mouse.none;
}

Global Left Pressed code:
xx = mouse_x;
yy = mouse_y;

sentences:
What does the keyword "interface" mean in GLSL? interface vs_out
{
  vec3 get_color();
};

struct vs_out_impl : vs_out
{
  vec3 get_color()
  {

    return vec3(1,0,0);
  }
}

Where is this behavior defined? None of the specifications uses the keyword interface. It is generally reserved in version 460. I myself accidentally, at Visual Studio, discovered that this keyword is recognized, thought about it and remembered the Nvidia language C for graphics. It has the ability to create interfaces. I tried it and it worked! This code does not crash with compilation errors. It compiles fine. To check, instead of the diffuse color, I used the method vs_out_impl::get_color(), and the objects were painted red.

Where to see the specification of this functionality? On the Internet, a bunch of words interface and GLSL leads to articles on interface blocks, which is not the same.

sentences:
Switch Vector 3 x,y,z Components Based on Rotation I have a cube that moves by rotating on its edge. I want my code to also work for cuboids. The following code is what I'm using to rotate my cube:

turnPoint = transform.position + new Vector3(0.5f * direction * x, -0.5f, 0.5f * direction * z); // Location of edge (resets every 90 degrees)
transform.RotateAround(turnPoint, axis, rotateSpeed * direction); // Turn around the edge

It works fine, however I want to get this to work when the cube is scaled to be a cuboid. I tried multiplying the new Vector3's x, y and z components by the objects respective x, y and z scale. This works, but only for the first rotation.

Is there a way this could work for all future rotations without using if/else for all 4 rotations?

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:
How do I activate a game action when a UI button is held? I want to make my button do stuff when the player holds it. In this case, I want to make a grab function: when the button is down the character can grab objects, but if the button is up they do not grab it.
I already have the function using the Standard Assets CrossPlatformInput.
Here is how I have configured my button so far:

Here is my script:
void Update()
{

    Physics2D.queriesStartInColliders = false;
    RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right * transform.localScale.x, distance, boxMask);

    if (PushKey())
    {
        isGrab = !isGrab;

        if (hit.collider != null && hit.collider.gameObject.tag == "Box" && isGrab)
        {
            box = hit.collider.gameObject;
            box.GetComponent<FixedJoint2D>().connectedBody = this.GetComponent<Rigidbody2D>();
            box.GetComponent<FixedJoint2D>().enabled = true;
            box.GetComponent<Rigidbody2D>().gravityScale = 1;
            box.GetComponent<Rigidbody2D>().mass = 1;

        }
        else if (!isGrab)
        {
            box.GetComponent<FixedJoint2D>().enabled = false;
            box.GetComponent<Rigidbody2D>().gravityScale = 6;
            box.GetComponent<Rigidbody2D>().mass = 6;
        }
    }
}

public bool PushKey()
{
    return CrossPlatformInputManager.GetButtonDown("E");
}

With this function, the first tap on the button means "grab activated" and the second tap means "grab deactivated", like a toggle. Instead, I want the grab to be active as long as the button is held.

sentences:
Problem with animating in Android, using batcher.draw in LibGDX I am having a problem with the last part of the GameRenderer class. I call batcher.draw() and receive this error:

  The method draw(Texture, float, float, float, float) in the type SpriteBatch is not applicable for the arguments (Object, float, float, float, float)

This only happens when I try to draw animation; images work fine. How do I fix this?

This is my GameRenderer class, which throws the error.

public class GameRenderer {
    private SpriteBatch batcher = new SpriteBatch();

    public void render(float runTime) {
        // Begin SpriteBatch
        batcher.begin();
        // The bird needs transparency.
        batcher.enableBlending();

        // Draw bird at its coordinates. Retrieve the Animation object from
        // AssetLoader
        // Pass in the runTime variable to get the current frame.
        batcher.draw(AssetLoader.birdAnimation.getKeyFrame(runTime),
                x, y, width, height);

        // End SpriteBatch
        batcher.end();
    }
}

Just in case, here is my AssetLoader class:

public class AssetLoader {
    public static Animation birdAnimation;

    public static void load() {
        Texture texture = new Texture(Gdx.files.internal("data/texture.png"));
        texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

        TextureRegion birdDown = new TextureRegion(texture, 136, 0, 17, 12);
        birdDown.flip(false, true);

        TextureRegion bird = new TextureRegion(texture, 153, 0, 17, 12);
        bird.flip(false, true);

        TextureRegion birdUp = new TextureRegion(texture, 170, 0, 17, 12);
        birdUp.flip(false, true);

        TextureRegion[] birds = { birdDown, bird, birdUp };
        birdAnimation = new Animation(0.06f, birds);
        birdAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);
    }
}

The class  where i call AssetLoader.load()

public class ZBGame extends Game {
    @Override
    public void create() {
        AssetLoader.load();
        /* Other stuff */
    }
}

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:
What is the best practice for handling touch events on different GameObjects in Unity2D? First of all I want to describe what I have in my scene.
1. Joystick.
2. Main character that has link to joystick and handles touch events from joystick.
2. Buttons.
3. Other GameObjects that must handle touch events.

But that's not all. When player is touching any part of screen (except of the above objects) main character must start fighting. The problem is in that I cant correctly handle all touch events on these game objects. When the player is touching to the joystick the main character starts moving but before this he is performing a single fight action. Can anyone give me some ideas how to correctly handle touch events on different gameobjects? Perhaps my question is confusing, I am sorry for this.

sentences:
Shadow mapping with directional light? I'm doing shadow mapping in my OpenGL 4.3 deferred renderer, and I'm starting with directional lights believing it to be the easiest.

What I do not understand is how the view projection matrix is to be constructed for the shadow mapping depth pass. I mean, all I have is the lights direction, and it affects the entire scene - so how do I construct the view matrix from only the direction, and what of the projection matrix?

Thanks

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:
OpenGL ES 2. How do I Create a Basic Fading Streak Effect? For the iPad app I am writing using OpenGL ES 2 I have a single quad - shaded using GLSL - that is dragged around the screen. Very basic. This works fine. But is rather boring.

I want to increase the coolness a bit in the following way: when the user drags the quad it leaves a streak behind that fades over time. Continuous dragging would be a bit like a streaking comet across the night sky.

What is the simplest way to implement this?

Thanks.

sentences:
Is there a way to prevent the user from playing the game simultaneously on 2 devices Our game uses Google Play Services for authentication, multiplayer and cloud saves. We save the users inventory as a cloud save, and as the player partakes in multiplayer matches they might use items out of their inventory (coins, etc). Also, they may use in app purchases to add items to their inventory.

I want to try and avoid the hassle of cloud save game conflicts when the player (for whatever reason) decides to play the game on 2 devices at the same time.

I worry they may lose data when resolving save games and as their save games may contain coins and other items obtained via IAPs, this is unacceptable.

Is there a way to check if the user is currently logged in to the game on anther device and is actively playing on that device? We don't have our own servers and use GPS for all our work. What is a possible solution here?

sentences:
(Realtime-) Global Illumination starting point What techniques should someone look at when getting into real time global illumination (for dynamic lighting scenarios)?

It's hard to get a real grip on the different mentioned techniques without knowing anything about the subject. If I wanted to incorporate GI into my graphics engine, where should I start reading as a baseline? Which algorithms are implementable in a reasonable timeframe by someone new (i.e. not a highly specialized algorithm that gains minor performance for months of work) and which are not completely outdated by now (i.e. straight up replaced by something simply prettier and faster)?

Photon mapping seems to come up a lot, and I've read about things like voxel cone tracing and more specific algorithms, e.g. this technique used in CryEngine 3. However, knowing next to nothing about the field it's hard to decide where to start.

What general techniques are worth looking into?

sentences:
Map not loading after building Quake 2 from source I'm a big fan of the game Quake 2. Recently I've decided to spend some of my free time for digging into the Quake 2 source code. There are 2 versions of the full game code, 3.19 and 3.21 (including the game exe as well as the game dll).
As regards to the Q2 Mission Packs, the source files for both The Reckoning and Ground Zero are for version 3.20 as the filename suggests (xatrixsrc320.exe and roguesrc320.exe)
I've compiled the 3.21 exe and 3.20 xatrix dll and when I run quake2 +set game xatrix I'm getting the following message in the game console:

... Dropped frame 21 > 20 ...

...and the map/game isn't loading.
How do I allow the map/game to be loaded?

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: Can a set of 3D positions be separated by plane? I have 3 points in 3D space: A, B and C. I also have another set of 3D points: P, Q, R, S, T and U. What would be the simplest algorithm to figure out if there exists a plane that completely separates the first and second set? I know all the coordinates of all points.

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:
Collision library for bullet hell in Python I am making a bullet hell game in Python and am looking for a suitable collision library, taking the following into consideration:

The library should do 2D polygon collision.
It should be very fast.  As a bullet hell game, I expect to do collision checks between hundreds, likely thousands of objects every frame at a consistent 60fps.
Good documentation
Permissive license (like MIT, not GPL)

I am also considering writing my own library in C/C++ and wrapping with python ctypes in the event that no such library exists, though I do not have experience with collision detection algorithms, so I am not sure if this would be more trouble than it's worth.

Could someone provide some guidance on this matter?

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: 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:
Only host can spawn object I am currently making a multiplayer game however only the host has the capability to spawn projectiles.

[Command]
void CmdSpawnEgg()
{
    if (cam == null)
    {
        return;
    }
    GameObject instance = Instantiate(eggPrefab, transform.position + (transform.forward * offset), cam.rotation);
    NetworkServer.Spawn(instance);
}

//cam is the transform of the players camera and if its not the local player the camera is destroyed

The projectile is also a registered spawn-able prefab for the network manager

sentences:
No sound in android using Phaser I have developed a simple game using Phaser.  It's work perfect on ios webkit, but on android there is no sound.  What causes this problem on one platform but not the other?

We are using this code to load:

this.load.audio('game_audio', 'audio/bgm.mp3');

Playing:

this.music = this.add.audio('game_audio');
this.boom.play()

sentences:
Issuing one-to-one inter-player challenges I have a small game I have written in Unity (at present only for Android). It is a very simple game where you get more points the longer you last. Nothing complicated.

In order to help "spread the word," I want to enable players to challenge others to see who can score higher. I am not talking about their all-time high scores (these I save in the Google Game Play leaderboards).

How can I easily manage a one-to-one challenge?

I can't seem to find a straight forward way to do it using the Google SDK.
It has the turn based play option but in my case each one plays separately. When both have played, the results get compared.

Short of setting up my own backend, how can I go about this?

Note: I am happy to use the FB SDK if necessary since that is how the challenges will be generally sent.

sentences:
What include first if I want to comply IWYU(Include-What-You-Use) in Unreal Engine 4? I read this article. https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/IWYUReferenceGuide/index.html

It says "IWYU mode is enabled by default for the Engine and Engine plugins." So, I turned on IWYU mode by adding PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; to my module. It makes a lot of errors because of ".cpp files include their matching .h files first."

So, my question is,

if some cpp files shares one header files(ex. one header file defines API and several cpp files have implementation), what header file should I include first?
Some Unreal engine file like 'AutomationCommandline.cpp' include "CoreMinimal.h" first. It looks like being against the IWYU rules. If it is, how it can be compiled without error?

Thanks.

sentences:
Why is addressing an array of vectors more efficient than addressing an array of matrices in Cg? According to Nvidia's Cg tutorial (in the note section right under 6.5.2), addressing an array of vectors seems to be more efficient than addressing an array of matrices. The reason it mentions is because the index is floating point value instead of integer.

Could anyone explain this a little bit?

Here is the quote:

  For performance reasons, the program treats boneMatrix as an array of float4 vectors rather than an array of float3x4 matrices. ThematrixIndex` array contains floating-point values instead of integers, and so the addressing of a single array of vectors is more efficient than accessing an array of matrices. The implication of this is that the indices in the matrixIndex vector should be three times the actual matrix index. So, the program assumes 0 is the first matrix in the array, 3 is the second matrix, and so on. The indices are fixed for each vertex, so you improve performance by moving this "multiply by 3" outside the vertex program.

And here is the Cg program it's referring to:

// Example 6-5. The C6E5v_skin4m Vertex Program
void C6E5v_skin4m(float3   position    : POSITION,
                  float3   normal      : NORMAL,
                  float2   texCoord    : TEXCOORD0,
                  float4   weight      : TEXCOORD1,
                  float4   matrixIndex : TEXCOORD2,
              out float4   oPosition   : POSITION,
              out float2   oTexCoord   : TEXCOORD0,
              out float4   color       : COLOR,
          uniform Light    light,
          uniform float4   boneMatrix[72], // 24 matrices
          uniform float4x4 modelViewProj)
{
  float3 netPosition = 0, netNormal = 0;

  for (int i = 0; i < 4; i++) {
    float index = matrixIndex[i];
    float3x4 model = float3x4(boneMatrix[index + 0],
                              boneMatrix[index + 1],
                              boneMatrix[index + 2]);

    float3 bonePosition = mul(model, float4(position, 1));
    // Assume no scaling in matrix, just rotate & translate
    float3x3 rotate = float3x3(model[0].xyz,
                               model[1].xyz,
                               model[2].xyz);

    float3 boneNormal = mul(rotate, normal);
    netPosition += weight[i] * bonePosition;
    netNormal   += weight[i] * boneNormal;
  }

  netNormal = normalize(netNormal);
  oPosition = mul(modelViewProj, float4(netPosition, 1));
  oTexCoord = texCoord;
  color = computeLighting(light, netPosition, netNormal);
}

sentences:
Can I publish the games I learnt from tutorials and modified as per my style of game-play? I am new to the world of making games and all. Well its been a few months or so. There are many tutorials that I have been watching. On the way, I made a few games that I saw and made. I am not asking about those. In fact I don't want to publish those games in my name ever.
But then there are some small games that I made which are modified version from what I learnt of those games. Like I changed the game-play style, made it simpler and ignored some features from a game.  Can I publish them in play store? Or this would be any break of law or something? or Something that I should not do?

sentences: Shadow mapping: what is the light looking at? I'm all set to set up shadow mapping in my 3d engine but there is one thing I am struggling to understand. The scene needs to be rendered from the light's point of view so I simply first move my camera to the light's position but then I need to find out which direction the light is looking. Since its a point light its not shining in any particular direction. How do I figure out what the orientation for the light point of view is?

sentences:
Calculating the 2D edge normals of a triangle What's a reliable way to calculate a 2D normal vector for each edge of a triangle, so that each normal is pointing outwards from the triangle?

To clarify, given any triangle - for each edge (e.g p2-p1), I need to calculate a 2D normal vector pointing away from the triangle at right angles to the edge (for simplicity we can assume that the points are being specified in an anti-clockwise direction).

I've coded a couple of hacky attempts, but I'm sure I'm overlooking some simple method and Google isn't being that helpful today - that and I haven't had my daily caffeine yet!

sentences:
Unity - movement code overriding rigidbody mass? Unity noob here...
I have a basic movement script, but whatever I set the objects mass at it still falls the same speed, floating down off ramps instead of sticking to the floor.
I saw some posts referencing that the movement translate can override the rigidbodys downward velocity. Well I tried several code adjusts but I couldn't get it to work correctly.
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");

// this code is to keep movement direction when switching to alternate camera
if (Input.GetButtonDown("Horizontal") || Input.GetButtonDown("Vertical")) {
    viewForward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1, 0, 1)).normalized;
    viewRight = Vector3.Scale(Camera.main.transform.right, new Vector3(1, 0, 1)).normalized;
    viewRight = new Vector3(viewForward.z, 0f, viewForward.x * -1f);
    }

moveDirection = v * viewForward + h * viewRight;
if (moveDirection != Vector3.zero) {
    // moveDirection.y = rb.velocity <-- not working
    transform.position += moveDirection * Time.deltaTime * moveSpeed;
    transform.rotation = Quaternion.LookRotation(moveDirection);
    }

Could someone point out what I'm doing wrong?

sentences:
How can I detect "rooms" in a 2D side scrolling game? I'm looking to create a system that recognizes certain types of buildings and rooms you can create in game, like how Terraria detects "residences." In that game, a house can be constructed in a tile-based world by constructing a zone of blocks satisfying a set of conditions:

The zone is completely insulated from the "outside" by player-placed blocks.
The zone can fit a 5x7 rectangle.
there is at least one table, one light source, and chair in the enclosed area.
There is a door leading out from the zone.
Terraria has both a foreground and background tile layer. The entire background of the zone must be filled with player-placed blocks.

How can I efficiently detect when a player has constructed a suitably-sized area, and how can I efficiently check that the area contains all the required furnitture/components?

Example of an interior zone that satisfies all the housing requirements:

sentences:
How do a make a smooth animation with images of different sizes in pygame? I have an animation where my player swings his sword, with 5 images in pygame. The normal resting image is 14x22, and the rest are 13x23, 21x23, 18x23, and 18x23. I am having trouble with my character 'Jumping' when he swings his sword, since the size of my image is constantly changing. Could anyone help my with this?

Here's my code for the animation

elif keys[pg.K_SPACE]:
            now = pg.time.get_ticks()
            try:
                if now - self.last_update > self.frame_rate:
                    if self.direction == 'left':
                        self.game.player_img = self.game.playerattackleft[self.frame]
                        self.frame += 1
                        self.last_update = now
            except IndexError:
                self.frame = 0

Thanks.

sentences:
How to achieve cavalier projection using OpenGL fixed pipeline? I want to make a quick demo program showing a cube, or a user loaded model, rotating in screen rendered with one of three projections: perspective, isometric and cavalier.

Using the fixed pipeline, how can I build a projection matrix for cavalier projection?

I think I can start with the orthographic projection matrix and then tweak the values, by eye, until I get the z of the vertices go to the right and up as farther the z is. I want the lines parallel to the z axis rendered as vertical lines 45 degrees rotated to the right.

sentences:
Get relative angle to collision Unity I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front of it.I tried to use Vector2.Angle with V1 and V2 (ControllerColliderHit.moveDirection as a Vector2) to get the difference between them.

However I get a different value (0, 90, 180) when running into the wall depending on the world direction. (left wall, right wall, etc.)

How can I get the angle of the collision point relative to the direction the camera is facing?

sentences:
How to update Unity? I have clicked on check for updates but it says I have latest Unity.

But latest is 5.6.

How to update it to 5.6?

sentences: Why are voxels used for landscape? According to Wikipedia many games have been using so far voxel engines for modelling landscape. Why is it only used for landscape and not characters etc?

sentences:
Simple Java networking game engine I want to create a simple java networking game and search a networking engine that eases use of sockets etc. I have already read some questions on here and the internet about java networking for games, but many of them were over 10 years old or not really answered.

I have no idea whatsoever about what exactly I need to send in terms of messages, but I figured simple strings or integers will be enough for my purposes.

It's basically a peer to peer game, so I don't need a centralized server structure. Messaging doesn't have to have an extremely low ping, yet of course all players need to have a synchronized view.

What are the possibilities I have here?

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:
How tightly should I stick to entities in a component based game? I apologize if the question is a little vague, It was hard to explain it in a short sentence.

I'm currently writing a component based game, it's getting along great but I'm starting to wonder how tightly I should stick to "the rules". Actually, I'm not even sure what the rules are!

It's clear that every interactive gameobject should be an entity. But what about the level elements? I'm using a tile based system, should every tile be an entity? I do have a GraphicsComponent ready with all it's displaying goodness that I need to display them. But coming from inherritance, it just feels strange threating a "gameobject" the same as a level element.

It also feels like I'm dumping everything in a big empty space right now, there is no dedicated environment for different game elements. Where a tile normally is part of a map, and an object normally is part of a world. The tiles and objects are now thrown in the same place.

Same goes for interface components, I was in need of animated button, and that GraphicsComponent looked very tempting again.

How is this usually handled in component based games?
Most articles online only mention the use of components for gameobjects, and looking into other component engine source code gives me a headache.

sentences:
how to create a Quaternion from an Orientation Vector in xna I have a Vector3 represents an Orientation in 3D , how to convert it to the corresponding Quaternion ?
Is there any quick way ?

EDIT :
I want to add an angular velocity vector to the Orientation Quaternion of the body

sentences:
Need help making a semi-simple javascript game I'm currently trying to make a fairly simple game in JavaScript and it isn't going too well.

Before I started, I thought I'd only need to know three things (on top of what I already know) which were:

How to 'spawn' an object (i.e. a bullet) by pressing an on-screen button.
How to make that bullet move across the screen.
How to make that bullet collide with something.

I thought the first two would be pretty simple, but I cannot find anything online to help me with them. Source code and tutorials appear to be either too simple or too complicated, and I'm starting to worry this project will be a lot more complicated than I thought.

So, can anyone help me do any of the listed things? If so it'd be much appreciated!

sentences:
Batching and performances I'm trying to understand batching and I'm not sure to understand how to do that, can I have more informations please? Here is what I found for the moment:

Batching informations

There is many types of batching:

Sprite batching
Geometry batching
???

Sprite batching

This method is useful to draw all sprites with only one draw call.
To do that, a SpriteBatcher class need to get all the mesh with the same Material and the same Geometry (sprite = square geometry).

Get Sprites with same Material
Send all Sprite's matrix to a Sprite shader    (http://antonholmquist.com/blog/sprite-batching-opengl-es-2-0/)

Geometry batching (With static geometry)

Merge meshes's geometry, so you we can draw all meshes in one draw call.

Get all static meshes
Merge meshes's geometry and calculate their position with there matrix (Compute a single VBO and IBO)
Hide original mesh to avoid twice draw.

Am I right with that?
Thanks!

sentences:
Vuforia jewellery try out without marker I need to create a virtual jewellery try out in unity 3d + vuforia. I have done it with  marker as a target but now i need to do it without marker. Is there any way we can track live objects using userdefined targets i mean face , neck ,arm, finger using vuforia.

I have done a lot of research but didnt got anything useful.

sentences:
TCG - how to program cards as separate entities So I'm planning to try making a card game (in Java) but I'm not sure what the best way to design it is. I understand the engine stuff but not how the cards should be coded an how they should interact with the engine. The scope is like so:

We have an engine that understands the flow of the game. It knows you draw at the start, play cards at some point, have a combat step, and end the turn (switching players). This much is fine, but the concern is the cards themselves.

I want to have cards be their own entities. I'm not sure if it would be better to:

a) Have each card be their own class
b) Have each card be programmed as an external script (say in Python)

I want the game engine to know as little as possible about a card. When you play a card, I want the game engine to go:

You're playing a card. Do you have resources? Ask the card how much it takes, then confirm you have it. When a card has an interaction, I want it to do as much as it can. For example, if the card says draw a card, I want it to forceably tell the engine to draw a card, or better yet, hook into the game, draw a card, and then force the engine to update itself.

Extreme cases would probably provide a better description, so if there was a card that said "players do not draw at the beginning of their turn", the engine would normally automatically draw, so we'd have to stop that. I could reasonably program something where the engine would check if anything special happens before each interaction and it would see "skip draw". Even still, how would I program that? Would I write a method in the engine to skip draw and then have the card add it as a special trigger? Would I actually have the card (perhaps programmed in Python) hook into the engine and end the draw method?

What would be the best way to go about this?

sentences:
Strange I'm getting exception but the scripts in the exception message are not exist on my pc. What should I do? I'm using unity version : 2019.2.5f1 personal

I searched on my hard disks the entire pc and none of the scripts in the exception message are exist. And the exception is happens only sometimes. When I stop the game in the editor by pressing the play button the exception is show sometimes and sometimes not.  I tried to close and open over agai the unity editor and the project. Still strange.

  MissingReferenceException: The object of type 'ReflectionProbe' 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.
  UnityEditor.ReflectionProbeEditor.OnPreSceneGUICallback (UnityEditor.SceneView sceneView) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ReflectionProbeEditor.cs:651)
  UnityEditor.SceneView.CallOnPreSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3359)
  UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1935)
  UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2320)
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
  UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
  UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
  UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
  UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
  UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
  UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
  UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

sentences:
Is SharpDX mature enough to adopt yet or should I just start using SlimDX right now? I'm about to stop my game-project in XNA because from what I can gather it's development is coming to an end (and it's already behind current technology). Therefore, I need to adopt a new framework or API.

I have just spent 2 days looking at C++ and decided it's really not for me - however I do find the raw access to DirectX appealing. SharpDX sounds like a good place to start, but it has no documentation and no code comments. I feel like it's not quite ready for use.

I'm interested in the opinions of people that have used either or both of these frameworks, to help me decide for sure which one I should learn? Thanks for any advice.

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:
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: Music Rhythm Game Difficulty Question I have curious question about music rhythm based genre while I'm making a code for the game. Is it really better if I set a random pattern encountered on every music played or there is a specific pattern depending on the music and the difficulty? I have observed the Guitar Hero 3 game for the game console where the difficulty is set on the number of strings used and possible number of combo (e.g. two-string combo). Compared to the Tap Tap Revenge for the Android and iPhone, the difficulty based on the number of BPM (Beat per Minute), meaning, number of targets spawn and must be hit.

sentences:
Can't get world position from reverse Z buffer I'm using this solution to render using a reversed Z buffer.

This looks fine and completely fixes all my z-fighting, but it breaks what I use in shader to derive the world position from the depth for various purposes such as deferred lighting and fog (it has worked for a regular projection matrix):

vec4 screenSpacePosition = vec4(texcoord * 2.0 - 1.0, depth * 2.0 - 1.0, 1);
vec4 worldSpacePosition = invProjView  * screenSpacePosition;
vec3 finalPosition = worldSpacePosition.xyz / worldSpacePosition.w;
return finalPosition;

I've thought that this was due to this using a single view projection matrix, so I've also tried this:

vec4 clipSpacePosition = vec4(texcoord * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
vec4 viewSpacePosition = invProj * clipSpacePosition;
viewSpacePosition /= viewSpacePosition.w;
vec4 worldSpacePosition = invView * viewSpacePosition;
return worldSpacePosition.xyz;

That must be suboptimal performance wise, but it doesn't work either anyway. Any idea what I'm missing?

sentences: Count Unity terrain size In blender? My unity terrain size is 150*150, and I want to create a plane in blender have the same size. How to figure the correct size ?

sentences:
How to stop this object from overlapping tile's corners in 2D tilemap I am using a tilemap to create my 2D world. All tiles and the player has an AABB. Currently, I'm detecting collisions with surrounding tiles the player is in, from the player's center. This works, but when the player's center is outside the tile and another point of the player is still in the previous tile, the wrong tile is getting checked and the player overlaps the corner of the tile getting checked previously.

How can I solve this?

This is my TypeScript code:

public checkAABB(ent: Entity): TileMap {

    let tileX = this.pxToTile(ent.bounds.centerX());
    let tileY = this.pxToTile(ent.bounds.centerY());

    let indices = [
        [0, -1],
        [1, 0],
        [0, 1],
        [-1, 0]
    ];

    let idx, tile, intersection;

    for (let i = 0; i < indices.length; i++) {
        idx = indices[i];

        tile = this.getTile((tileX + idx[0]), (tileY + idx[1]));

        intersection = tile.solid && ent.bounds.intersects(tile.bounds);

        if (intersection) {
            this.collisionInfo[i].tile = tile;

            switch (i) {
                case 0:
                    this.collisionInfo[i].penetration =   Math.abs(ent.bounds.min().y - tile.bounds.max().y);
                    break;
                case 1:
                    this.collisionInfo[i].penetration = Math.abs(tile.bounds.min().x - ent.bounds.max().x);
                    break;
                case 2:
                    this.collisionInfo[i].penetration = Math.abs(ent.bounds.max().y - tile.bounds.min().y);
                    break;
                case 3:
                    this.collisionInfo[i].penetration = Math.abs(ent.bounds.min().x - tile.bounds.max().x);
                    break;
            }

        }

        this.collisionInfo[i].active = intersection;
    }

    return this;
}

Visualization:

sentences:
Phaser BitmapData Pick Color and Paint Hi guys,

Could anyone kindly shows me a little bit of code about pick and paint color to the sprite?

here is my code that I have played around, but I still cannot find out and achieve it.

Thanks you in advance for your time and consideration.

preload: function() {
    this.game.load.image('test', 'test.png');
},

create: function() {

    this.color1 = this.drawRec('rgb(141,243,160)', 20, 20);
    this.color2 = this.drawRec('#6bd4e0', 100, 20);
    this.color3 = this.drawRec('#cb6be0', 20, 100);
    this.color4 = this.drawRec('#8df3a0', 100, 100);
    this.square = this.game.make.bitmapData();
    this.square.load('test');
    this.square.addToWorld(this.game.world.centerX, this.game.world.centerY, 0.5, 0.5);

    this.game.input.onDown.add(this.pickColor, this);
},

drawRec: function(color, x, y) {
    this.bmd = this.game.make.bitmapData(100, 100);
    this.bmd.ctx.beginPath();
    this.bmd.ctx.rect(0,0,50,50);
    this.bmd.ctx.fillStyle = color;
    this.bmd.ctx.fill();
    this.sprite = this.game.add.sprite(x, y, this.bmd);
},

pickColor: function(pointer, x, y) {
    console.log(this.bmd.getPixelRGB(x,y));
}

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:
Text based cards tracker I wish to build a card tracker that reads in game text and keeps track on the cards that are out.

Like an Overwolf app, but for a card game.  I mailed Overwolf and asked what are my options, they suggested to use image recognition.  However, it sounds complex (and I luck any experience in it).  Is there a simple way to do it?

The tracker that I want to build is for Twilight struggle and I would like to automate this card counter such that It will track the cards that been played from the a text box in the game that state their name.

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: 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:
Multi Resolution graphic for ios 4 and ios 5 I have used cocos2d-x to develop a game for iPhone 4, iPhone 4s, iPhone 5 with different screen sizes (3.5 inch and 4 inch)

First, my resource are designed for iPhone 4 and iPhone 4s with 3.5 inch screen size.

So if I want to use for iPhone 5 with 4 inch screen size. what should I do?

sentences:
Creating metadata/pack files for an existing sprite sheet I've just bought Oryx's Roguelike Tileset pack and I use LibGDX (flixel-gdx to be precise).

My question is, given this pre-made sprite sheet format, what's the best way to integrate the sprites into the game I'm making?

LibGDX uses TexturePacker, but that needs a special .pack file with metadata like where the sprites are located. I can't see a way to generate these from an existing spritesheet.

Is there any other recommended technique?

sentences:
LibGDX: How to detect remote button press for Android TV? On Android TV, I need to be able to detect the remote control centre button to start the game.

I tried:

if (Gdx.input.justTouched() || Gdx.input.isKeyJustPressed(Input.Keys.SPACE) || Gdx.input.isKeyJustPressed(Input.Keys.DPAD_CENTER) ||
                Gdx.input.isKeyJustPressed(Input.Keys.ENTER) ||
                Gdx.input.isKeyJustPressed(Input.Keys.BUTTON_SELECT) ||
                Gdx.input.isKeyJustPressed(Input.Keys.BUTTON_START))  {
...}

All does not work. The only one that works is isKeyPressed(Input.Keys.DPAD_CENTER), but that will return more than one key pressed.

sentences:
How to make bullets follow a rotating sinewave pattern I am trying to replicate the wave gun from Super Metroid where the bullets fly along a sine wave path. The cool part is that you can shoot in 8 directions and the bullet still follows the sine as if the whole sine function is rotated. I've tried using a 2d transformation to allow shooting in every angle but I cant get it to work. Here my code so far (JSFiddle.net). If you uncomment the line "Axis.dir += .02;" in the fiddle to start the rotation you'll notice that the black box doesn't follow it's axis at all.

var canvas = document.getElementById("can"),
  ctx = canvas.getContext("2d"),
  width = canvas.width, height = canvas.height,
  Axis = { x: width / 2, y: height / 3, dir: 0, vx: 0, vy: 0, speed: 4 },
  Sine = { x: Axis.x, y: Axis.y, angle: 0 },
  loop = function() {
      var rotatedX, rotatedY;
      // Draw
      ctx.clearRect(0, 0, width, height);
      ctx.fillStyle = "#F00";
      ctx.fillRect(Axis.x, Axis.y, 5, 5);
      ctx.fillStyle = "#000";
      ctx.fillRect(Sine.x, Sine.y, 10, 10);
      // Apply speed
      Axis.vx = Math.cos(Axis.dir) * Axis.speed;
      Axis.vy = Math.sin(Axis.dir) * Axis.speed;
      Axis.x += Axis.vx;
      Axis.y += Axis.vy;
      Sine.x = Axis.x;
      Sine.y = Axis.y + (Math.sin(Sine.angle) * 30);
      // Apply rotation
      rotatedX = Sine.x * Math.cos(Axis.dir) - Sine.y * Math.sin(Axis.dir);
      rotatedY = Sine.x * Math.sin(Axis.dir) + Sine.y * Math.cos(Axis.dir);
      Sine.x = rotatedX;
      Sine.y = rotatedY;
      Sine.angle += .03;
      Axis.dir += .02;
      // Keep drawn stuff on the screen
      if (Axis.x > width && Axis.vx > 0) Axis.x = 0;
      if (Axis.x < 0 && Axis.vx < 0) Axis.x = width;
      if (Axis.y > height && Axis.vy > 0) Axis.y = 0;
      if (Axis.y < 0 && Axis.vy < 0) Axis.y = height;
      window.requestAnimationFrame(loop);
  }
loop();

sentences:
How do I translate a spherical coordinate to a Cartesian one? Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me.

I'm looking for something like this (ideally in C#):

public Vector3 getCartesianFor(float elevation, float asimuth, float polar)
{
   return ????;
}

sentences:
How would I create classes for each map tile instead of using a tmx? LibGdx I am making a top down style game using LibGdx that I want to be randomly generated each new game load.

I already have the algorithm to generate the array for what tile should be what.

But i'm stuck on how I should handle the tile classes.

I have this class called Tile

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{ // Should I use sprite??? Seems wrong..

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

And I want to have multiple classes that exened this class for each tile. For example this is grass.

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

Should these classes be extended off of a sprite? Or some other class from libgdx?

Also These tiles are going to be 16 x 16 that are made up of 4 smaller 8x8 sprites.

sentences:
How to get max viewable X-Value in Viewport How can I calculate or get the farthest X-Value of a Viewport during gameplay?

Say a model is moving in from the right-hand side (beyond Viewport) and starting from a certain X-Value it is visible on the viewport. I'd like get that certain X-Value.

But the more I zoom out (Z-Axis) the greater the farthest visible X gets (Max X). How could I approach this?

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:
Unity 2D Hingejoints break under extreme force I have added a rope to my game that is made up of multiple small gameobjects, each connected to eachother by a HingeJoint2D. Since 1 unit of mass in Unity is supposed to represent 1 kg, I've made the player's mass 60 (60kg). When the mass of each rope segment (of which there are 40) is 20, the rope supports the player when they jump off a cliff.

Now 20 kg per rope segment sounds ludicrous. However when I make each rope segment weigh 1 (1kg) the hingejoints break completely and jitter around crazily. The force of the 60kg player against the 1kg segments seems to be too much.

I would much rather have the rope be lighter, so it doesn't move the player when throwing and being dragged as much. Any suggestions on how to fix HingeJoint2D's and make them act, as you know, a joint should?
EDIT: Increasing the Position and Velocity Iterations in File->Project->Physics2D menu from the default 3 and 9 respectively, up to a whopping 40 fixes this problem. This is a massive increase. Unsure if performance will suffer too much with these new settings.

sentences:
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:
Shader intersection radiate outwards I've been working on a water shader for a project I'm currently working on and have been trying to work on the intersections between objects in the water to create a foam effect that radiates outwards. I'm very new to shaders so my code is probably horribly inefficient! But here it is:

Shader "Unlit/WaterShader"
{
    Properties
    {
        _Color("Color", Color) = (1,1,1,1)
        _IntersectColor("Intersection Color", Color) = (0,0,0,0)
        _MinIntensity("Minimum intensity", Float) = 0.04
        _MaxIntensity("Max Intensity", Float) = 0.4

    }
    SubShader
    {
       Tags { "Queue"="Transparent" "RenderType"="Transparent" }
        LOD 100

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

            sampler2D cameraDepthTexture;

            struct appdata
            {
                float4 vertex : POSITION;
                float4 uv : TEXCOORD0;
            };

            struct v2f
            {
                float4 screenPos : TEXCOORD2;
                float4 vertex  : SV_POSITION;

            };

            float4 _Color;
            float4 _IntersectColor;
            float _MinIntensity;
            float _MaxIntensity;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.screenPos = ComputeScreenPos(o.vertex);
                return o;
            }

            sampler2D _CameraDepthTexture;

            fixed4 frag (v2f i) : SV_Target
            {
                float currentDepth = tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos)).r;
                float linearDepth = LinearEyeDepth(currentDepth);
                float depthDifference = linearDepth - i.screenPos.w;
                if(depthDifference < _MinIntensity)
                    _Color = _IntersectColor;
                return  _Color;
            }
            ENDCG
        }
    }
}

It works well enough :

But now Id like to maybe try increase the intensity of the intersection. I know increasing _MinIntensity doesn't really do what I want it to do, as it only shows more and more of the image submerged in water, which removes the effect of shoreline foam. I'd also like the outline of the objects in the water to spread out and fade out over time, I've tried using a sin wave for this but haven't been able to achieve the desired look.

sentences:
Unity 2D Sprite Bending between Hinge Joints I've created a tentacle that consists of multiple game objects, each attached to eachother using HingeJoint2D's. Gameplay wise this multiple segmented approach is great because I can use Unity's built-in physics, but it doesn't look very good art wise.

Is it possible to 'bend' 2D sprites, so the tentacle segments look like they're attached to eachother? Or perhaps take a single image and bend it using splines of some sort?

I would prefer to keep using multiple game objects to represent the tentacle.

sentences:
Calling functions that needs to be on update() So I have a function DialogueRun() for a Dialogue System that changes the line on the dialogue box whenever you click. Which means it has to be in Update(). My test works so far but my next problem is how to make the whole dialogue box only appear whenever I click on a character.
I tried making the characters as buttons and it does make the dialogue box show up whenever clicked, but it won't change the dialogue lines because that function has to be in an update method.
I'm looking at OnMouseDown() right now but the result will be probably the same. Any ideas?
 public void DialogueRun()
{
    dialogueBox.SetActive(true);
    dialogue.text = textLine[nextLine];

    if (nextLine < textLine.Length - 1)
    {

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {

            nextLine += 1;
        }
    }
    else
    {            //counter++;
        dialogueBox.SetActive(false);
        return;
    }

sentences: Why do unidentified items seem to solely exist in roguelikes? Playing a variety of games I noticed that some concepts are "trapped" in the realm of roguelikes. One of the most intriguing game-play elements in roguelikes is the unidentified item. The unidentified item can be used at any time adding another layer of randomness and chance to the game-play. I think the reason this element cannot co-exist with a saving mechanic is that you could save, use the item and then load if you are unhappy with the results. I am still puzzled if this mechanic is overlooked and it could possibly be successfully incorporated into some modern games? If you do know of examples where it is being used, please share.

sentences:
Getting array of points shaping curve from 2 vector3 points What I want is to get path for DoTween method DoPath(), which as a parameter expects array of vectors shaping the direction of the path. I googled some stuff and found out nothing. Just think bezier curve is good idea but i dont even know how it works. Here is an ilustration of my problem

The movement must be curved, don't need linear one.
Thanks in advance

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:
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:
How can I `draw` something on a JavaFX WritableImage? I'm migrating a project from Swing to JavaFX, and I have a problem. Since java.awt.BufferedImage provides getGraphics and it has lots of convenient methods (like drawLine, drawImage, etc.), I have some codes that uses these features.

But in JavaFX' WritableImage, I can't find any similar methods.
Did I miss something? Or should I use something else instead of WritableImage?

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:
VBO Performance issues I'm making a 2D Tile based game in OpenTK at the moment. Performance was really bad (laggy and slow) with direct drawing, so I switched to VBOs. The performance hasn't changed, it might even be slower than it was.

I render the tiles from a list, but use a single VBO.

public void DrawTiles()
        {
            foreach(Tile t in Tiles)
            {
                if(t != null)
                {
                    GL.Color4(System.Drawing.Color.White);
                    GL.BindTexture(TextureTarget.Texture2D, Global.LoadTexture(t.TileTexture.Path, 1));
                    var i = (CellNum * CellSize) / 2;
                    GL.PushMatrix();
                    GL.Translate((t.Position.X * CellSize) - i, 0, (t.Position.Z * CellSize) - i);
                    var x = CellSize;
                    verts = new Vector3[8]
                    {
                        new Vector3(0, 0, 0), new Vector3(0, 0, 0),
                        new Vector3(x, 0, 0), new Vector3(1, 0, 0),
                        new Vector3(x, 0, x), new Vector3(1, 1, 0),
                        new Vector3(0, 0, x), new Vector3(0, 1, 0)
                    };

                    GL.EnableClientState(ArrayCap.VertexArray);

                    GL.EnableClientState(ArrayCap.TextureCoordArray);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(Vector3.SizeInBytes * CellNum), verts, BufferUsageHint.StaticDraw);
                    GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes * 2, 0);
                    GL.TexCoordPointer(3, TexCoordPointerType.Float, Vector3.SizeInBytes * 2, Vector3.SizeInBytes);
                    GL.DrawArrays(PrimitiveType.Quads, 0, verts.Length / 2);
                    GL.Flush();
                    GL.PopMatrix();
                }
            }
        }

That method is called in OnRenderFrame, CellSize and CellNum tell me how big the tiles are supposed to be and how many there are each side of the grid. Even if I run say a 20 tile grid, my program is incredibly laggy.

Does any one know a more efficient way to render these tiles, or better yet, speed up my current method?

sentences:
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 avoid enemies overlapping each other when chasing player in Unity? I am trying to get enemies to chase player but without them overlapping each other when they get closer to the player.

So far what I have is that I check for the distance between current enemy and the another enemy in a list and if their distance is less than 2 then update their position away from each other.

But when I do that, the enemies instantly move away rather than smoothly moving away from each other. What can I do to improve this?

Here is my script for chasing player:

public void ChasePlayer()
{
    foreach (GameObject enemy in enemies)
    {
        if (enemy != null)
        {
            float currentDistance = Vector3.Distance(transform.position, enemy.transform.position);

            if (currentDistance < 2.0f)
            {
                Vector3 dist = transform.position - enemy.transform.position;
                transform.position += dist;
            }
        }
    }

    if (lantern.transform.GetChild(0).gameObject.GetComponent<Light>().enabled)
    {

        gameObject.GetComponent<MeshRenderer>().enabled = true;
        gameObject.GetComponent<Collider>().enabled = true;
        transform.LookAt(player.transform);
        transform.position += transform.forward * speed * Time.deltaTime;

    }
    else
    {
        gameObject.GetComponent<MeshRenderer>().enabled = false;
        gameObject.GetComponent<Collider>().enabled = false;
    }
}

sentences:
How could I improve this random map? following my previous post on random world map generation, I used several algorithms and obtained results similar to this: http://i.imgur.com/CKL2R.png (the height values are quantisied for viewing but they go from 1 to 500 before quantisation).
Now I am trying to improve the "lakes", as you can see, the water bodies that are inside the map are always at 0 altitude, which means that every lake would be at the ocean level.
I am willing to keep these "ocean-level lakes" (or remove them), but I would like suggestion on how to create from this heightmap real lakes that would be possibly at any height, while keeping most of the altitude structure (ie mountains positions, etc)

thanks

sentences: Remove Sprite Shape Controller Icons from 2D sprite shapes How do I get rid of those "purple icons in my scene"? They are so annoying ... they literally covers the entire 2d shape! GIF showcasing it

sentences:
Grappling hook script sometimes causing jitter I am trying to implement a grappling hook mechanic.

My grappling script is attached to my camera that is attached to the player.

Sometimes when I try to grapple onto a wall, it causes jitterting when the grapSpeed variable is 40 or more. When it's more than 40, it happens almost all the time and it's more intense.

My walls' rigidbodies are set to no gravity, kinematic, freeze position and rotation. My player isn't kinematic and has collision set to continuous dynamic.
Here is the grappling script:

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

public class graplin : MonoBehaviour
{
    public GameObject player;
    public GameObject cam;
    public float hookSpeed;
    Vector3 graPos;
    bool canClick = true;

    void FixedUpdate()
    {

        if(Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            if(Physics.Raycast(transform.position,(transform.position - cam.transform.position).normalized,out hit))
            {
                graPos = hit.point;
                canClick = true;
            }
        }

        if(Input.GetMouseButton(0) & canClick)
        {
            player.GetComponent<playerControler>().enabled = false;
            player.GetComponent<Rigidbody>().useGravity = false;

            player.GetComponent<Rigidbody>().velocity = ((graPos - player.transform.position).normalized * hookSpeed);

        }
        if(!Input.GetMouseButton(0))
        {
            canClick = false;
            player.GetComponent<playerControler>().enabled = true;
            player.GetComponent<Rigidbody>().useGravity = true;
        }
        if(Input.GetMouseButtonUp(0))
        {
            player.GetComponent<Rigidbody>().velocity = Vector3.zero;
        }
    }

}

here is the video I took of the problem
the video

sentences:
Box2d set sprite to body that rotates around specific point I want to rotate kinematic body around a specific point (I already done this part using

shape.setAsBox(1.8f / PPM, 0.2f / PPM, new Vector2(5.2f, 0), 0);

What I try is this:

PolygonShape shape = new PolygonShape();
shape.setAsBox(1.8f / PPM, 0.2f / PPM, new Vector2(5.2f, 0), 0); // !!!!

FixtureDef fdef = new FixtureDef();
fdef.shape = shape;
fdef.filter.categoryBits = categoryBits;
fdef.filter.maskBits = Constants.PLAYER;

bDef.position.set(((V_WIDTH / 32 - 3) / 2) / PPM, y / PPM);

body = world.createBody(bDef).createFixture(fdef).getBody();
body.setAngularVelocity(1f);
body.setUserData(new BodyUserData(categoryBits, colorArray[0]));

sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);
sprite.setPosition(
    body.getPosition().x * 32 - sprite.getWidth() / 2,
    body.getPosition().y * 32 - sprite.getHeight() / 2
);

and here how I draw sprite

public void draw(SpriteBatch sb){
    sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
    sprite.draw(sb);
}

Unfortunately my sprite position is not the same as my body. It seems that sprite is rotating around it's center, not my point. Is it possible to fix that?

sentences:
Turn based game in HTML/JS/CSS - new joiner messes with state of game while animations are still running for other players I developed a playing cards web app using HTML/JS/CSS.
Communication with the server is performed using WebSocket.
The server is developed in Java Spring.

The game proposes to join one of the many available tables where you can immediately perform an action.

The players who are already in the table are perfectly in sync with each other, as when they receive a message from the server, I show a screen overlay preventing them from clicking on any element on the table while an animation is running.
After the animation is terminated, the game becomes available and runs normally.

My problem is that if a new player joins the table after a message has been sent by the server, then he can perform an action while the animation is still running for the other players, thus starting a new animation for them at the same time and the game becomes messy.

Is there a way to either prevent the new joiner from performing an action before the animation has ended for the rest of the players ? Do you have any other idea how I can solve this issue ?

Thanks for your help

sentences:
Resize texture in code I need to change texture size from for example 800x600 to 80x60. I have two ideas of how to do that, but i have problems with both approaches.
1) changre render target then draw and save resized. the problem is blinking screen while this method is working.

public static Texture2D Resize(Texture2D image, Rectangle source)
        {
            var graphics = image.GraphicsDevice;

            var ret = new RenderTarget2D(graphics, source.Width, source.Height);
            var sb = new SpriteBatch(graphics);

            graphics.SetRenderTarget(ret); // draw to image
            graphics.Clear(new Color(0, 0, 0, 0));

            sb.Begin();
            sb.Draw(image, source, Color.White);
            sb.End();

            graphics.SetRenderTarget(null); // set back to main window

            return (Texture2D)ret;
        }

2) use Texture.SaveAsPng(); this aproach is extremly stupid but it works

public static Texture2D Resize(Texture2D banner,Rectangle rectangle)
        {

                using (var file = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    using (var IsolatedStream = new IsolatedStorageFileStream("banner.te2", FileMode.Create, file))
                    {
                        IsolatedStream.Position = 0;
                        banner.SaveAsPng(IsolatedStream, rectangle.Width, rectangle.Height);
                        IsolatedStream.Close();
                    }
                }

                if (IsolatedStorageFile.GetUserStoreForApplication().FileExists("banner.te2"))
                {
                    using (var file = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        var IsolatedStream = new IsolatedStorageFileStream("banner.te2", FileMode.Open, file);
                        IsolatedStream.Position = 0;
                        banner = Texture2D.FromStream(Consts.GraphicsDevice, IsolatedStream);
                        IsolatedStream.Close();
                    }
                }
                return banner;

        }

I'm looking for a clean fast solution, any suggestions? Resizing in Draw() method is not solution for me.

sentences:
Initializing entities vs having a constructor parameter I'm working on a turn-based tile-based puzzle game, and to create new entities, I use this code:

Field.CreateEntity(10, 5, Factory.Player());

This creates a new Player at [10; 5]. I'm using a factory-like class to create entities via composition.

This is what the CreateEntity method looks like:

public void CreateEntity(int mX, int mY, Entity mEntity)
{
    mEntity.Field = this;
    TileManager.AddEntity(mEntity, true);
    GetTile(mX, mY).AddEntity(mEntity);
    mEntity.Initialize();
    InvokeOnEntityCreated(mEntity);
}

Since many of the components (and also logic) of the entities require to know what the tile they're in is, or what the field they belong to is, I need to have mEntity.Initialize(); to know when the entity knows its own field and tile.

The Initialize(); method contains a call to an event handler, so that I can do stuff like this in the factory class:

 result.OnInitialize += () => result.AddTags(TDLibConstants.GroundWalkableTag, TDLibConstants.TrapdoorTag);
 result.OnInitialize += () => result.AddComponents(new RenderComponent(), new ElementComponent(), new DirectionComponent());

This works so far, but it is not elegant and it's very open to bugs. I'm also using the same idea with components: they have a parameterless constructor, and when you call the AddComponent(mComponent); method in an entity, it is the entity's job to set the component's entity to itself.

The alternative would be having a Field, int, int parameters in the factory class, to do stuff like:

new Entity(Field, 10, 5);

But I also don't like the fact that I have to create new entities like this.
I would prefer creating entities via the Field object itself.

How can I make entity/component creation more elegant and less prone to bugs?

sentences:
Maintain UI position with Aspect Ratio Fitter and anchor preset is set to stretch So i have a text UI using Aspect Ratio Fitter with Aspect Mode Height Control Width and i set anchor preset to stretch upward  .

To make it easier to understand , i want my text to stretch upward only when screen height is increased , and at the same time , using Aspect Ratio Fitter , i want my text to keep width and height aspect ratio by stretching width when height is increased . And don't worry about screen height size become bigger than screen width size because i have separate UI for portrait .

When i apply both anchor preset stretch upward and Aspect Ratio Fitter , UI cannot maintain it position anymore if screen height is increased . So my question here is straightforward , how do i keep my UI inside my camera view while using Aspect Ratio Fitter and anchor preset is set to stretch ? , if possible , can it be done using unity built in feature ? (without me writing the script)

Here are screenshot below to show my problem :

(ps : ignore the error it doesn't have any correlation with this problem)

Before screen height change :

After screen height change  :

sentences:
Why DirectInput is not recommended? I have read that the Windows messages are recommended way over DirectInput to control mouse and keyboard.

From http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx

  The use of DirectInput for keyboard and mouse input is not
  recommended. You should use Windows messages instead.

Why is it so? Because the DirectInput is still in version 8? Isn't it extending anymore?

sentences:
How can I implement the ability to combine items into new items? I would like to understand how to be able to combine items in a player's inventory, producing new items. For example, the scenario I have in mind is that the user picks up three key fragments and combines them to create a complete key.

What properties should I model on my item classes to support this behavior, and what should my basic algorithms be?

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:
get access to Transform of a Clone in Unity In my game when you lose, A panel with a button on it appears and if you don't have enough coins, You may be directed to shop by hitting shop button. when buying is completed you can return to the scene from where you left it and resume the game. I'm using PlayerPrefs to save properties like slider.value my player position timescale etc, But I can't access to Transform of an Instantiated GameObject (Clone). it acts like obstacle and is Instantiated continuously. Here is my script;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CodeStage.AntiCheat.ObscuredTypes;
using CodeStage.AntiCheat.Detectors;

public class Spawner5 : MonoBehaviour {

    public float maxTime=1;
    public float Timer = 0;
    public GameObject pipe;
    public float height;

    // Use this for initialization
    void Start () {

        pipe = GameObject.FindGameObjectWithTag ("Gear");
    }

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

        if (Timer > maxTime) {

            GameObject newpipe = Instantiate (pipe);

            newpipe.transform.position = transform.position + new Vector3(4, Random.Range (-height, height) ,0);

            Destroy (newpipe, 15);
            Timer = 0;

        }

        Timer += Time.deltaTime;
    }
}

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:
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:
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:
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:
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:
Fastest visibility calculation towards all possible directions I am searching for your advice. I have a massive voxelized model, like the one in the picture (but with a few million voxels more..). To reduce the total number of the model’s triangulations, I can remove the shared faces among the voxels, nevertheless, the triangles will indeed remain MANY. What I need to do is create an index that will hold a boolean list (of visible/not visible) information, coming from the following procedure:

Define a set of points, like the centroids of the 3 yellow voxels in the picture (but, this set might again contain millions of points) and for each point calculate which voxels (except their corresponding containers) can be seen (direct and unblocked line of site) towards ALL directions (something like a global illumination concept). If the ray-source (coming from a given point) can reach even at the minimum a target voxel, it means we have a "true" condition for that voxel. For example, if we assume that the ray-source point in the picture is the light source, then all voxels in the blue circle are "true" for the specific point.

This has nothing to do with game development, so I am sorry if my post should be somewhere else. I just felt I should better ask here, because most of my searches conclude to ray-casting, hard shadows, visible surface determination, OpenGL, etc which are quite relevant here.  I do not need to see any graphics (or have high fps :D), just store the results for future usage into a 3rd simulation process.

I get the feeling that if I go with implementing simply geometric calculations this indexing will run for too long (even though this can be parallelized quite easily I believe). Nonetheless, can I take advantage somehow of OpenGL and GPU maybe? Will this boost significantly my task? How should I approach the problem?
 I am working on an ASUS ROG-G752VY.

I only have to construct and store this index (which I would not be surprised if it would turn out to be tens of GBytes). The rest of the simulation runs on a cluster continuously. This indexing calculation operation will run more or less only once.

I just don't know what execution time to expect (days/weeks/years) with this amount of ray-source points that I am mentioning along with a "brute" check towards all directions and voxels (with or without the use of OpenGL and GPU). Yet, I can predict that the max number of visible voxels every time will be just a few thousand.

That, because (sorry for not mentioning it) there is a life-termination logic of this ray when the distance of its travel exceeds "x" units ("x" will be much much smaller than the size of the total model). Hence, for a ray further than "x" the searching process should break every time.

Thank you so much already for your time!!!

sentences:
No AA support in Godot 3.1? I'm using Godot 3.1.1 and just realized that there is no available AA options. According to some post, Godot 2 supports FXAA, but some reason it's took out from 3. So I try to get FXAA for Godot 3.1, but couldn't find any.

I don't want to publish my game without Anti Aliasing. Is there a way to apply FXAA in Godot 3.1.1 which using GLES3?

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 to use 3D transformation matrices with GLM old version that has simd functions I need matrix 3D transformation, model transformation i.e scale-rotate-translate and then that model into world space so model-projection-view matrices.

I need it with GLM specified simd vectors and matrices according to their old version.
But I can only find transformation functions without simd vectors or matrix in examples like this

#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
{
glm::mat4 Projection = glm::perspective(glm::radians(45.0f), 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
return Projection * View * Model;
}

I need it something like this

 glm::detail::fmat4x4SIMD MatrixMultiply()
    {
        glm::detail::fmat4x4SIMD m(1.0f);
        glm::detail::fmat4x4SIMD m1(1.0f);
        m1 = m1 * m;
        return m1;
    }

But If I try to give glm::lookAt, glm::rotate with fvec4SIMD/fvec4x4SIMD it gives me error that these built in functions does not support simd.

Any idea how to do this?

sentences:
Create extra bullets, offset according to angle of spaceship? I am trying to create a weapons upgrade for my Spaceship, using libGosu and Chingu (in Ruby). This question is about how to deal with this issue specifically in Ruby, and more specifically in libGosu.

In the player class I have tried several variations of the following:

def fire
  Bullet.create(:x => @x, :y => @y, :angle => @angle)
  Bullet.create(:x => @x + Gosu::offset_x(90, 25), :y => @y + Gosu::offset_y(@angle, 0), :angle => @angle)
end

It sort of works, but not exactly how it ideally should. For reference, this is what the Bullet class looks like:

class Bullet < Chingu::GameObject
  def initialize(options)
    super(options.merge(:image => Gosu::Image["assets/laser.png"]))
    @speed = 7
    self.velocity_x = Gosu::offset_x(@angle, @speed)
    self.velocity_y = Gosu::offset_y(@angle, @speed)
  end

  def update
    @y += self.velocity_y
    @x += self.velocity_x
  end
end

How should I construct "def fire" in order to get the extra bullets to align properly when the spaceship rotates?

In the first image (above) the bullets are separated as intended.

In the second image the bullets are clumping together when the spaceship is rotated.

sentences:
Unity2D: Frost Effect Time scale I downloaded this package ("Frost Effect by Steven Craeynest") on Unity Asset Store and altered it into making the effect happen once I click on a button (button 1), I first disabled the frost button (button 1) in my inspector before playing the game and created another button (button 2) to activate the frost button(button1). However I'm having issues with the frost effect. You see when I click on button 2 to activate the frost button (button 1) frost effect works for a bit but then stops at delayBeforeUnfreeze like time.timescale is equaled to 0 and the only way of making time.timescale is equaled to 1 is by pressing my pause button and clicking the resume button. Anyway this is my script:

private FrostEffect frost;
float duration = 0.2f;
float delayBeforeUnfreeze = 0.34f;
private float previousTimeScale;
public GameObject frostbutton;
public int buttonCount = 0;
int timesActivated =  0;

public void Check() {
    buttonCount ++;
}

// Use this for initialization

void Start () {
    previousTimeScale = Time.timeScale;
}

public void Activate ()
{
    frostbutton.SetActive (true);
}
public void CreateFrost ()
{
    if(timesActivated < buttonCount)
    {
        timesActivated++;

        GameObject.Find ("Main Camera").GetComponent<FrostEffect> ().enabled = true;
        //Slow timescale
        Time.timeScale = 0.06f;
        //Freeze time effect
        DOTween.To (x => FrostEffect.FrostAmount = x, 0.0f, 0.34f, duration)
    .OnComplete (() => {
            //Unfreeze tween effect
            DOTween.To (x => FrostEffect.FrostAmount = x, 0.34f, 0f, duration)
                .SetDelay (delayBeforeUnfreeze);

            //Set timescale back to previous.
            Time.timeScale = previousTimeScale;
        });
    }
}

}
Thank you. :)

Second Edit

This is my panel animation script:

public void DisableBoolAnimator(Animator anim)
{
    anim.SetBool ("Shown", false);
}

public void EnableBoolAnimator(Animator anim)
{
    anim.SetBool ("Shown", true);
}

This Youtube link will show you what my panel animation looks like: 31:47.
Thank you. :)

sentences:
How to make illusion of round world? I want to make a flat world, but i want to split it into pieces which will load in segments (for better optimization), and when you are at the end of map it will start loading segments from the beginning again. And I want to make an illusion of roundness (only optical effect if possible). For example, when you watch ships on the horizon, you see their masts first.

I'm asking only for theoretical ideas, so you don't need to send any scripts.

sentences:
Intersection of thick line with a grid There is a popular paper, and numerous examples, on how to efficiently perform collision detection for a line with a grid. However, I'm drawing up blanks on how to do the same thing but with a line that has thickness.
In my game, I'm considering adding projectiles that are not infinitly thin (for example, a giant plasma ball launcher), and I need to figure out which cells along a grid that it collides with. Initially I thought it'd be as simple as just using the Minkowski Sum method of adding the width/height of the projectile to each cell of the grid, and then treating the projectile as infinity thin line along a bloated-overlapping-grid, but that doesn't look like it's going to work with the existing algorithm.
Are there any other papers/algorithms that describe how to accomplish this? Or is there a way to modify the existing algorithm to accomplish this? Or are there any tricks to implementing this indirectly?

sentences:
360 degree video of my OpenGL game I want to make a 360 degree video of my OpenGL game.

Concerning the rendering: Is it enough to render it in OpenGL with a specific projection matrix? If yes, which one? Or can I render it into a cube map, and then encode it? (Which will require much more rendering power and be more complicated, which I want to avoid)

And how do I encode a 360 degree video with FFMPEG?

sentences:
cocos2d-x - object creation and management in game design How do others keep track of everything going on in their games? I am working on a new game and I am quickly realizing everything that I need to keep track of.

Example:

Maybe a layerManager that keeps track of all the layers and what is happening for a particular scene.

Maybe a sceneManager for sharing objects among scenes

But then getting to game play itself, what if you have 100 objects on the screen each with its own state and happenings, there needs tobe a way to keep track of all of that.

Drawing everything out is really helping me.

Can anyone share with me how they go about object tracking/management? I am seeing a few different managers and then maybe even a parent object that manages the managers..is my thinking way off?

Any design patterns that may be useful for me to read about?

Update: doing some reading and maybe a Factory pattern might apply.

sentences:
Working With D3D11/OpenGL Shader Reflection I've been working in my off-time to do some system design for a game engine as a fun and challenging project, and i've hit a bit of a wall. I've made an interface which is a renderer that i try to incorporate elements similar to both d3d11 and opengl so that implementations of both are still very functional behind said interface. In the process of working with abstracting shaders, i was wondering if there was a way to actually enumerate the uniforms / cbuffers in a shader using shader reflection, rather than query for them by name. In openGL, the only way to set a variable is if you query for it by name (I think), and in d3d11 you are able use the ID3D11ShaderReflection interface, but are only able to query cbuffers and variables by name. My knowledge is pretty new in opengl, but i was wondering if there was a way to grab or make a list of all the uniforms / cbuffers present in the shader, so that i could query the rest of my engine for the values needed.

What this would do for me is simple: Rather than my engine requiring compiled knowledge beforehand of what variables some specific shader might need, it can instead obtain the names and typenames of all the variables it requires to function correctly. Then i can code a resource container that can hold any number of types and resources, which are associated by variable name in a map or similar, which would allow me to compare the names of the values in the resource container, with what the shader required, and then tell you which uniform /cbuffer value you didn't bind to something. Is this possible, because it sounds incredibly useful.

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:
How do I convert between two different 2D coordinate systems? I'm trying to convert a coordinate from one coordinate system to another, so that I can draw it on an image.

Basically the destination coordinate system is as follows:

X range: 0 to 1066
Y range: 0 to 1600

(just a standard image I'm drawing onto with the size of 1066 x 1600)

The position I'm trying to draw onto the image actually has the exact same size, but the coordinate system is different.  The span all of the coordinates is 1066x1600.

But a coordinate example would be:

(111.33f, 1408.41f)
(-212.87f, 1225.16f)

The range of this coordinate system is:

X range: -533.333 to 533.333
Y range: 533.333 to 2133.333

I feel like this is VERY simple math, but for some reason I'm not getting it.

How can I convert the coordinates provided into the first coordinate system?

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:
endless Thorn (deal damage when taking damage) effect I'm developing a card-based combat system for my game. (imagine a game like Magic The Gathering, or Hearthstone, or any CCG)
I was writing the logic of the effect that I call "thorn".
If a player has the thorn effect, everytime he got struck with some damage, he deals damage to his attacker.

I already had an event raised everytime a character is being damaged, so it seemed logical to me to use it.

the thorn effect starts to listen to the onDamage event and then it deals its damage.

The issue with this solution is that it can create an endless chain of thorn effect, if both parties have the thorn effect.

Player 1 attacks player 2.

Player 2 raises onDamage event.

player 2 resolves its thorn effect, and it deals damage to player 1.

player 1 raises onDamage event.

player 1 resolves its thorn effect, and it deals damage to player 2.

and it goes on.

There are many solutions I can think of, but none of them are actually satisfying to me. Any suggestions? Thanks for the answers

sentences:
Unity 2D collisions imprecise I am trying to make a platformer. For the player character I am using a kinematic rigidbody because I want to calculate the jump curve myself (including physics & gravity). The platforms are also kinematic because I want them to move. I am having issues with the collision detection being imprecise causing the sprite to not stand exactly on the platform after jumping (as seen in the three images taken after three different jumps). This issue also causes the sprite to get stuck in the ground sometimes. The left image is the character inspector and the right is the platform inspector. The jump movements are done with movePosition, and I tried many things to fix this. I tried the following: decreasing the timestep from 0.02 to 0.01, using onCollisionStay to keep it exactly on the platform, adding a physics material with zero friction, using edge colliders & capsule colliders, using interpolate and extrapolate.
https://imgur.com/a/Kech2Qy

sentences:
How scanline rendering finds an intersection with an object I'm a newbie with graphics and after I read many articles on the web I still don't understand how in rasterizing from a pixel coordinate like (0;0) on the screen the intersection with an object (let's say a sphere) is found before determining its color and how the Z buffer comes into play.

I know something about ray tracing.. is a ray shot from the 0;0 pixel and the intersection point thus determined by the equality between the ray equation with the sphere equation? If it works that way I don't see what the Z buffer is useful to.

I don't know if I explained myself correctly, if not please let me know and I'll try to be as clear as I can on my doubt.

sentences:
Create a series of points round a globe (Polar to Cartesian) C++ I am trying to create a series of waypoints for my globe planet, in a little simulation I'm doing, and I'm trying to use polar to cartesian coordinates, I learnt this formula off its wikipedia page. Though I still don't quite understand it.

https://en.wikipedia.org/wiki/Spherical_coordinate_system
Attempt 1; This is the image of my first attempt, I do not want to cluster the points near the poles, the poles are also at the completely wrong point, I will supply my code later on. But also I do not want to put points too close to the poles, as they are not in use, and due to camera gimbal locking, there is no point me going too far close to the north or south pole in my program.

Attempt 2: Now I know how to create a single line, and the code I use for this is provided below. I sort of figured this out by just testing out different values and seeing how it came about.

Now what I want to do to this, I think as the way I wish to construct it, is to get the vector of each of those points, and rotate them round the centre of the planet which in this example is (0,0,0)

I want to create a single line of longitude per pas, so I can number the points 0-50 on each line, that will allow me to use it as a connected grid,lets say 0-50 going upwards, so that if i start at point 1 which would be the first point near the south pole, and I want to go to the next row I would add 50 to get to 51 (which would be the point right of it) or take 50 to get the point left of it), and so on and so forth, this will allow me to easily join waypoints for pathfinding setup.

I made another attempt in the link [ABOVE], where I try and make a nested for loop and change the latitude per step, but it does not get the desired result, I have even swapped the values of lat and longitude around in the code and the coordinates are the same.

Latitude = should be the angle from east to west.
Longitude = should be the angle north to south.

To do this I think but I am not sure, I assume I will have to store a temporary value of each of those points, and then create a new vector from them, by rotating their vectors around the origin of the planet (0,0,0) and then creating a new set of these points at the temporary vectors.

Does anybody have an idea how to help me solve my problem, as Image 4 is the best explanation I can think of showing my problem to explain what I am trying to achieve.

sentences:
delaying enemy attacks I have an enemy attack script that when a raycast hits the player it deals damage to the player, however the enemy attacks at multiple times per second and I wish for the enemy to have to wait 1 second after it attacks the player before it can attack again. The script is here, the main focal point is the void update(). Any help is appreciated, let me know if I've missed out any needed details. :)
public class DamagePlayer : MonoBehaviour
{
    int attackDamage = 10;

    [SerializeField]
    float agroRange;

    [SerializeField]
    Transform castPoint;

    Rigidbody2D rb2d;

    bool isFacingLeft;

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();

    }

    bool CanSeePlayer(float distance)
    {
        bool val = false;
        float castDist = distance;

        if (isFacingLeft == true)
        {
            castDist = -distance;
        }

        Vector2 endPos = castPoint.position + Vector3.right * castDist;
        RaycastHit2D hit = Physics2D.Linecast(castPoint.position, endPos, 1 << LayerMask.NameToLayer("Action"));

        if (hit.collider != null)
        {
            if (hit.collider.gameObject.CompareTag("Player"))
            {
                val = true;

            }
            else
            {
                val = false;
            }

            Debug.DrawLine(castPoint.position, endPos, Color.red);
        }
        else
        {
            Debug.DrawLine(castPoint.position, endPos, Color.green);
        }

        return val;
    }

    // Update is called once per frame
    void Update()
    {
        if (CanSeePlayer(agroRange))
        {
            PlayerHealth.currentHealth -= attackDamage;
            //Debug.Log("can see player");
        }
        else
        {

        }
    }
}

sentences:
Enemies and item drops issue Disclaimer: I'm relatively new to developing games so bear with me.

In my scene I have enemies and when they die, they drop items. No matter which item is dropped, the same prefab (the physical representation of the dropped item) is instantiated. That physical orb on the ground may represent different items. It could be a pile of coins, a sword, etc. Depending on which item is dropped, I want its name to appear in a UI label attached to the top of the item. Basic ARPG stuff really. The problem I'm running into is that I can't seem to get the references right.

DisplayItemNameLabel is a script which is attached to each item when it is dropped. I did it this way so each item can be in charge of its own UI label.

ItemDrops is attached to each enemy. SpawnItem(Item item) is a function which is called when the enemy dies.

The last relevant Monobehaviour script is the ItemData script which is attached to an Item Manager game object which is there from the beginning and persists forever. This class just defines the different items that are possible in the game.

So basically the structure is that when an enemy dies, if the random number generated is within some range, then some item will drop.

If (randomNumber < 0.5)
{
    SpawnItem(itemData.coin);
}

where SpawnItem(Item item) is something like...

private void SpawnItem(Item item)
    {
        itemDropped = true;
        nameOfDroppedItem = item.itemName;

        Instantiate(itemPrefab, transform.position - offset, Quaternion.identity);
    }

Again, this is attached to each enemy.

In the DisplayItemLabel script then, I would like to set itemNameText.text to that nameOfDroppedItem. But the DisplayItemLabel script is attached to each item. I don't think I can make each item a child of each enemy because enemies are destroyed when they are killed so the scripts would be destroyed. I also can't use GameObject.FindGameObjectWithTag("Enemy").GetComponent<ItemDrops>(); because it wouldn't always grab the enemy I want. I thought maybe I could set the text in SpawnItem but it would have to reference the correct item, so I couldn't use GameObject.FindGameObjectWithTag...

What should I do?

sentences:
JNI Error when Wrapping Jar with JOGL using Launch4j I have been trying to wrap my fat JAR file into an EXE using Launch4j, but I have been running into problems when I try to execute the EXE. Here is the error log I get from Launch4j:

Executing: E:\Downloads\CasualCaving.exe
JNILibLoaderBase: Caught IllegalArgumentException: No Jar name in <jar:file:/E:/Downloads/CasualCaving.exe!/jogamp/common/Debug.class>
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: E:\Downloads\natives\windows-amd64\\gluegen-rt.dll
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:624)
    at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
    at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:106)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:487)
    at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
    at com.jogamp.common.os.Platform$1.run(Platform.java:317)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.jogamp.common.os.Platform.<clinit>(Platform.java:287)
    at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:147)
    at org.graphics.Render.<init>(Render.java:20)
    at org.engine.Main.main(Main.java:18)

I am using JOGL 2.3.2 imported through Maven, with the assembly plugin to compile it to a fat JAR. Here is a picture of my library configuration:

I am not sure what is wrong, as the JAR file works fine.

sentences: How to smoothly move camera when the player is climbing a diagonal staircase in 2D tile-based side-scroller? I am working on a game, which is tile-based, similar to the way Terraria works. My player is 2 x 3 and can move over one-high obstacles, but this creates a very jittery effect, since my camera currently strictly follows the player. I was thinking of either somehow implementing a smoother camera movement or overhauling the player movement itself. I would love some feedback on how one might go about fixing this.

sentences:
Resultant Vector Algorithm for 2D Collisions I am making a Pong based game where a puck hits a paddle and bounces off. Both the puck and the paddles are Circles. I came up with an algorithm to calculate the resultant vector of the puck once it meets a paddle. The game seems to function correctly but I'm not entirely sure my algorithm is correct. Here are my variables for the algorithm:

Given:
velocity = the magnitude of the initial velocity of the puck before the collision
x = the x coordinate of the puck
y = the y coordinate of the puck
moveX = the horizontal speed of the puck
moveY = the vertical speed of the puck

otherX = the x coordinate of the paddle
otherY = the y coordinate of the paddle
piece.horizontalMomentum = the horizontal speed of the paddle before it hits the puck
piece.verticalMomentum = the vertical speed of the paddle before it hits the puck

slope = the direction, in radians, of the puck's velocity
distX = the horizontal distance between the center of the puck and the center of the paddle
distY = the vertical distance between the center of the puck and the center of the paddle

Algorithm solves for:
impactAngle = the angle, in radians, of the angle of impact.
newSpeedX = the speed of the resultant vector in the X direction
newSpeedY = the speed of the resultant vector in the Y direction

Here is the code for my algorithm:

int otherX = piece.x;
int otherY = piece.y;
double velocity = Math.sqrt((moveX * moveX) + (moveY * moveY));

double slope = Math.atan(moveX / moveY);
int distX = x - otherX;
int distY = y - otherY;

double impactAngle = Math.atan(distX / distY);

double newAngle = impactAngle + slope;
int newSpeedX = (int)(velocity * Math.sin(newAngle)) + piece.horizontalMomentum;
int newSpeedY = (int)(velocity * Math.cos(newAngle)) + piece.verticalMomentum;

for those who are not program savvy here is it simplified:

velocity = √(moveX² + moveY²)
slope = arctan(moveX / moveY)
distX = x - otherX
distY = y - otherY

impactAngle = arctan(distX / distY)

newAngle = impactAngle + slope
newSpeedX = velocity * sin(newAngle) + piece.horizontalMomentum
newSpeedY = velocity * cos(newAngle) + piece.verticalMomentum

My Question:
Is this algorithm correct? Is there an easier/simpler way to do what I'm trying to do?

sentences:
Creating a smooth transition between materials on large models using Unity and/or Blender I'm not sure if this is possible or not but I would like to create a smooth transition (cross-fade) between two textures on a 3D model made in Blender that can be imported to Unity.

For example if I have a model with two materials, the edges where the materials meet is an abrupt change. How would I go about creating a smooth transition across the edge where the materials meet?

I've seen some tutorials on using cycles in Blender to achieve this, but to the best of knowledge the cycles rendering cannot be brought into Unity.  Projection painting in Blender using an image as the brush is also a possibility, but the models I'm trying to do this on are rather large and would lose resolution in their textures because of this.  Is something like Substance Painter by Allegarithmic what I need?

sentences:
Implementing complex AI in an ECS? I'm having a hard time wrapping around how something quite stateful such as complex AI would be handled in a pure ECS (such as components being only data and systems operating on that data)
Things like different enemies in a game that cast different spells, or bosses with various phases and abilities like in an MMO.Usually i'd handle such a thing with data and behaviour components and state machines, but this violates the data-driven ECS paradigm.
Is there an easy way to handle this sort of behaviour in an ECS or is a different approach required?

sentences:
Required number of images for octagonal tiles I'm planing to write a game based on octagon tiles. Currently I'm wondering how many images I really need. That is something about graph theory, I know that, but not only.

I want to connect each side of the eight sides, but in some cases I also want to connect all eight sides or just two so the complexity grows immense. If I'm not totally confused that ends in 88 which is 2048. Well of cause there are already many dublicated e.g. left to right is equal with right to left. When I'm very tricky I can rotate the image of left to right which I rotate by 90° to get top to buttom. I'm sure there are quiet more things like like mirroring.

My question is now how many images do I really need?

Here is my basic idea as image, of cause it still has some problems, as you can see on my image too but I think it should not be too hard to find a simple solution for such cases.

sentences:
Why (SDL) animated filled-circle leaves trail of movement? I'm trying to achieve proper animation using SDL. Used flags are SDL_HWSURFACE and SDL_DOUBLEBUF.

That what I'm getting is technically smooth (I think), but I can figure out what should I do to remove that trail?
My animation is time-based (I'm calculating displacement with delta time).

Link to to video: https://vimeo.com/62065078

my (every-frame) drawing function is like:

for(int x = 0; x < screen->w; ++x)
    for(int y = 0; y < screen->h; ++y)
        draw_pixel(screen, x, y, 136, 136, 136);

and ball:

filledCircleColor(screen, ball.x, ball.y, 17, 0x000000ff);

and finally:

SDL_Flip(screen);

main loop is:

for(;;) {
    curr_ts = stopwatch_seconds_elapsed(sw);
    d_time = curr_ts - prev_ts;
    prev_ts = curr_ts;
    cpSpaceStep(space, d_time);
    draw_scene(screen);
}

sentences:
Creating a DPI and Resolution Independant GUI How would one best go about it? Assuming I'm using OpenGL to do all the drawing.

It seems like the best approach is to have the GUI elements maintain the same physical size regardless of the screen it is displayed on.It seems that Windows will act as if you had a screen with 72 DPI regardless of its actual size unless you specifically request tell it that you handle high DPI cases. Which would greatly simplify things, does this hold for Linux as well?

Does things change between running things in Windowed mode versus fullscreen? It seems like it should, as the Window changes size depending on resultion while in fullscreen the image is always the same size, just with less or more density!

sentences:
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:
How can I implement bounding volume subdivision for my sprite images? Lately, I have been researching different Collision methods, how to deal with multiple collisions and different types of bounding shapes, circles, rectangles, polygons and ellipsoids. Some common collision methods are the:

'Axis aligned bounding box'

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.height + rect1.y > rect2.y) {
    // collision detected!
}

'Circle Collision'

double dx = (circle1.x + circle1.radius) - (circle2.x + circle2.radius);
double dy = (circle1.y + circle1.radius) - (circle2.y + circle2.radius);
double distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected!
}

The bounding box/shape dilema

For one my projects, I am using images, which are rectangle by nature. However, to simply check for intersections with the images' edges would result in unsatisfactory collision detection. As Gamasutra puts it:

  " The experience of playing some of the early flight simulators
  illustrated how bad collision detection can ruin a game. Flying
  through a mountain peak and surviving isn’t very realistic. Even some
  recent games have exhibited collision problems. Many game players have
  been disappointed by the sight of their favorite heroes or heroines
  with parts of their bodies inside rigid walls. Even worse, many
  players have had the experience of being hit by a rocket or bullet
  that was “not even close” to them. "

From that resource I discovered an interesting method of making bounding boxes or circles which Gamasutra calls subdivision

I am having trouble thinking how to do this subdivision process for my images (as I am working with images) and how to properly implement either subdividing process within my collision reliant app.

For example take mario and a koopa shell. I wouldn't want their transparent space to trigger intersection

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:
how to make ascii ui like in dwarf fortress Only one text field, and inside it - different sections, menus, and popups, all in ascii. How to make that?

I mean something like this:

╔═════════════════╦══════╗
║                 ║      ║
║                 ║      ║
║                 ║      ║
║                 ║      ║
╚═════════════════╩══════╝

I see only the possibility to draw each line, calculating line length and somewhat manually. But maybe there is some kind of a simple way i am not aware of?

sentences:
LibGDX - Bundling Files I have 3 files. A JSON file, a PNG file, and a TXT file. Is there any possible way I can put all three inside a common file with a custom extension? (for example "fileName.abc")

I searched the web a little, and found this which is perfect, and exactly what I need:
https://gist.github.com/MobiDevelop/5514357
Which is a zip solution. But I don't want to compress the files and if the extension is not zip, I would be happier.

Question 1: Can we change a file's extension ("file.png" to "file.abc") and read it as if it had the same extension?

Question 2: How can I put multiple files into same file, just like AAA games do?

Question 3: Can I just create a non-compressed zip file and change the extension? And read it using the class in the link?

Question 4: Is there a better way than question 3? Maybe a third party solution or something?

EDIT: I don't want the files to be compressed because the game will be runned on mobile devices too. And the game might be loading files during gameplay. I am just worried that there might be staggers, fps drops while loading files.

sentences:
How to store sprite data in a VBO? I'm planning on rendering many sprites in my games, but I am not sure which method of storing their data to use. I haven't tried all of them yet, but I want to see if I also have anything important missing. Right now my options are:

Store information such as position, color, rotation, scale, and texIndex in a VBO, and then let the geometry shader output the triangles. (Not sure if possible)
Compute the vertices for all sprites in the CPU and put it all into one VBO to draw. (Sounds like a waste of CPU time, especially in a game)
Store repeated copies of the same four vertices in a VBO, and then use uniforms? (This is just an idea, I have no idea if it works or makes sense) Apparently I can just use instancing for this.

What design should I use to efficiently store sprite data? Do any of my ideas hold?

Edit: I would greatly appreciate if pseudocode could be provided for a solution, although certainly not necessary.

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:
Unity: Built In Scrollable Containers? Is there a way to get a scrollable container in Unity without purchasing a plugin such as NGUI or TK2D?

I want to create a scrollable container of interactive elements that can be clicked on individually and be scrolled horizontally by the user dragging their finger. You can kind of think of this as something similar to the shop menus in Clash of Clans. Here's a quick mock that I made to demonstrate the behavior I'm looking for: https://www.youtube.com/watch?v=bOJSMDPdFUQ

Is there a built in way to do this in Unity without the need of purchasing an extra plugin such as NGUI or TK2D?

sentences:
Moving sprite from one vector to the other I'm developing a game where enemy can shoot bullets towards the player. I'm using 2 vector that is normalized later to determine where the bullets will go.

Here is the code where enemy shoots:

private void UpdateCommonBullet(GameTime gt)
        {
            foreach (CommonEnemyBullet ceb in bulletList)
            {
                ceb.pos += ceb.direction * 1.5f * (float)gt.ElapsedGameTime.TotalSeconds;
                if (ceb.pos.Y >= 600) ceb.hasFired = false;
            }

            for (int i = 0; i < bulletList.Count; i++)
            {
                if (!bulletList[i].hasFired)
                {
                    bulletList.RemoveAt(i);
                    i--;
                }
            }
        }

And here is where i get the direction (in the constructor of the bullet):

direction = Global.currentPos - this.pos;
direction.Normalize();

Global.currentPos is a Vector2 where currently player is located, and is updated eveytime the player moves.

This all works fine except that the bullet won't go to player's location. Instead, it tends goes to the "far right" of the player's position.

I think it might be the problem where the bullet (this.pos in the direction) is created (at the position of the enemy). But I found no solution of it, please help me.

sentences:
Logical math behind jumping in a 3D world I'm unsure if I should ask the mathematic part of StackOverflow or the gamedev part. I'm trying to figure out how the gravity changes the position of an element in a 3D world. I've been trying to rescript the gravity in a game so I could attach it to every element I want.

As far as I know; The movement of the player has something to do with the current position ( obviously ), the velocity, the gravity and Delta Time. As far as I'm concerned too, I know that when an element makes some kind of jump, he should go up since the velocity is still positive. Each frame should update the player's position, depending on the current position and velocity, the new position will be created. I've been able to create it in a platformer ( 2D ) but I haven't succeeded to do this in a 3D game. As far as I came, the object just flew into the air at a massive speed and ended up landing in another galaxy..

I'm currently working with Lua, if you were trying to explain something in a language. If you're working with another language and want to give me an example in that.. feel free to do so. I'm known with a lot of languages ( programmer here. ). It's just about the logic behind it, the actual math.

Thanks in advance

sentences:
What is a faster alternative to a GetComponent from a RaycastHit? I have a basic AI car script which needs to interact with other cars around it. I would like to access variables from the other cars to help one car identify what the other cars are doing so they can avoid jams and crashes better.

One way to do this would be a raycasthit (ignore any errors there, you know what I mean):

if(Physics.Raycast(...))
{
    hitCar = hit.transform.gameObject.GetComponent<Car>();
}

However, I know that GetComponent can be very performance taxing especially if it's done every time there's an intersection with the raycast.

Another way would be to save all of the cars in an array or list before hand, and then test the name of it against all the names in the array or list.

if(Physics.Raycast(...))
{
    for(int i = 0; i < listOfCars.length; i++)
    {
        if(carName == listOfCars[i].name)
        {
            hitCar = listOfCars[i];
        }
    }
}

However, I've heard that string comparisons (again, especially if there's a lot of intersections with the raycast) can also be taxing on performance.

What's the best way to do this?

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:
TypeScript Space Shooter movement I'm trying to create a simple space shooter game using typescript and i've got kind of stuck at checking the movement.The thing is that if i only press one
key it works fine but if i press 2 keys at the same time it won't check for collisions with margins.Do i have to check for every case if i press multiple buttons or there's another way to do it? Here's the code:

update(canvas) {
        if (Game.keysPressed[KeyBindings.LEFT]) {
            this.xVel = -1;
            if (this.x <= 20) {
                this.xVel = 0
            }
        } else if (Game.keysPressed[KeyBindings.RIGHT]) {
            this.xVel = 1;
            if (this.x + this.width >= canvas.width - 20) {
                this.xVel = 0;
            }
        } else if (Game.keysPressed[KeyBindings.UP]) {
            this.yVel = -1;
            if (this.y + this.height <= 500) {
                this.yVel = 0;
            }

        } else if (Game.keysPressed[KeyBindings.DOWN]) {
            this.yVel = 1;
            if (this.y + this.height >= 880) {
                this.yVel = 0;
            }
        }

        else {
            this.xVel = 0;
            this.yVel = 0;
        }

        this.x += this.xVel * this.speed;
        this.y += this.yVel * this.speed;

    }

Thanks for helping!

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:
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:
Set sprite for UI2DSprite from NGUI at runtime How can I set sprite for UI2DSprite from NGUI at runtime?

This is what I tried:

gameObject.GetComponent<UI2DSprite>().sprite2D = Resources.Load<Sprite>("Assets/Content/UI/level/notLife.png");

I tried not to write .png in the end but it did not help as well.

Here is my Project view so that to prove you that I am using the right path:

And the problem here is that instead of showing me the newly placed sprite my old one disappears and nothing else happens.

So, how can I change sprite in UI2DSprite in NGUI from script?

sentences:
Blender arm rig not working the way it should I just bought a pair of arms from the unity asset store and imported them into blender, the IK seems to work just fine untill i use a Child of constraint on another bone(which is supposed to be a weapon) on the arm's wrist bone

the bone rotates but it wont move.

I'll leave a video of it right here,
https://www.youtube.com/watch?v=jfLmG2sQ_10

EDIT: the wrist bone seems to follow the child WHEN i disconnect the wrists parent, but if i do that the IK doesnt work in general.
Appreciate all help, thanks in advance :)

sentences:
Animation in OpenGL using 3D Models I have created a model in Blender. Now i want to read that 3D model in my c++ program. I figured that a model can be exported to various file formats e.g. .obj, .3ds or COLLADA and then can be read in a c++ program. I have been searching web for doing that for quite a while and found many tutorials. But i ran into issues with most of them. For example, IN the Nehe tutorial they are using glaux which I don't want to use in my program. And the remaining tutorials use md2 which is not supported by Blender.

So can anyone guide me which file format to use for exporting 3D model and how to load that in my OpenGL program? Also how can I animate that model? Is it possible to add extra effects like tone mapping after it has been loaded in the c++ program using OpenGL? if yes then how?

P.S. I am using Linux for game developement

sentences:
Unity - blur on one camera effects the other as well I'm trying to fake a DOF effect for Sprites by using 2 cameras, one for the sharp objects, one for the blurred ones. I have set up the layers like Blur and Sharp accordingly.

So I have these 2 cameras, and I use Unity's Blur (optimized) script to blur things, and I have this script on only one camera, the one that is responsible for the blurred render.

I have the cameras like:

Cam 1:

Clear flags: Don't clear (this is the main, sharp cam)
Culling mask: sharp layer
has no blur effect (or any other post proc effect).

Cam 2:

Clear flags: don't clear (this is the blur cam)
culling mask: blur
Has Blur (optimized).

Now, if this blur cam is on the back, meaning its depth is LESS than the main cam's depth, I have a sharp player ground and a blurry background. However, I need a blurry foreground too that should be on top of the player ground.

The issue starts when I set the blur camera's depth higher than the main cam's. In this case, everything gets blurred, no matter that the main cam has no blur effect on it.

Question is, how to set this up so only the desired layers get the blur?

sentences:
Lengthen Line (bidirectional) - crossing zero line I'm trying to lengthen a line, by a certain amount.
I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center point expansion would be acceptable, but I'n not sure how to apply it).
Exact details:
Line:
Point 1 [X = 1 , Y = 4], Point 2 [X = -1, Y = 6]
Line Normalized Vector: V = [X = -0.707106, Y = 0.707106]
Expand by: E = 1
So the result I'm looking for is
New Line = [ 1.707 , 4.707 ] ~ [ -1.707 , 6.707 ]
My problem happens when I multiply Point2[X] + ((0-V[x])*E) = - 0.292
Can someone give a SIMPLE example.  Psudo code, is great!
I know it is because I'm crossing the zero line, but I'm sure there's a better way to do this than testing if the point is greater than zero or less than zero.

sentences: Why do GPUs require game specific drivers? PC GPU driver updates often cite improvements made to performance of specific, recently released games. Why is this game-specific updating needed? How do the game-specific changes interact with the game code?

sentences:
Per-Texel lighting? (not per-vertex or per-pixel) In my game, I have a 3D shader that does lighting using color ramps on models with very low resolution textures. Basically, the vertex shader calculates color values for direct light and ambient occlusion, and then I look up into a color ramp what color to draw, and multiply this by the texture map.

Here's some pseudocode for that:

// vertex shader:
color_vert.r = ambient_occlusion(vertex)
color_vert.g = direct_lighting(vertex)
color_vert.b = shadow_lighting(vertex)

// fragment shader:
// First, the color is whatever the direct lighting was
color_fragment = direct_lighting_ramp_lookup(color_vert.g)
// Multiply by ambient occlusion and shadow
color_fragment *= ambient_lighting_ramp_lookup(color_vert.r)
color_fragment *= shadow_lighting_ramp_lookup(color_vert.b)
// Mutiply by the surface texture
color_fragment *= texture_lookup(color_vert.uv)

Now, this kind of lighting would be fine if I had very high resolution textures, but unfortunately my textures are very low resolution. So each texel (that is, the block of pixels corresponding to one pixel of the texture) is quite large, and lighting gets interpolated across the texel.

Here's an image of what that looks like:

And here's a closeup to show you what I mean:

Notice how the color is smoothly getting interpolated accross the low-resolution texels? How can I write my shader such that the lighting gets clamped on a per-texel basis? Is such a thing even possible? The only solution I can think of is to first generate a lightmap for the whole scene with 1-1 mapping to texels, but I'm afraid that would be too slow / use too much memory.

sentences:
Inconsistent movement / line-of-sight around obstacles on a hexagonal grid In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid."

In essence, I want the player's positioning to be tactical because of elements in the game world, not simply because some grid tiles are more advantageous than others in relation to enemies. I am fine with world geometry not being realistic, but it needs to be consistent.

In this process, I have run into most of the common problems (Square tiles? Diagonal movement, LOS, corner cases, etc.) and have moved to a hexagonal tile grid. For the most part this has been great, and I've not had too many inconsistencies.

Recently, however, I have been stumped by the following:

Points A and B are both distance 4 from the player (red lines). Lines-of-sight to both are blocked by walls (black tiles). However, due to the hexagonal grid, A can be reached in 4 moves, whereas B requires 5 moves (blue lines).

On a hex grid, "shortest path" seems divorced from "direct path"; there may be multiple shortest paths to any point, but there is only one direct path (or two in some situations). This is fine; geometry doesn't need to be realistic.

However, this also seems inconsistent: Similar obstacles are more effective in some positions than in others. A player running away from an enemy should be able to run in any direction, increasing the distance between the two actors. However, when placing obstacles or traps between themselves and enemies, the player is best served by running in one of the six directions that don't have multiple shortest paths.

Is there a way to rationalise this? Am I missing something that makes this behaviour consistent? Or is there a way to make this behaviour consistent? I am most certainly over-thinking this, but as it is one of my goals, I should do it due diligence.

sentences:
COLLADA, loading, the modelling/animation process? So, we're making a game in C++ using SDL - a TDS. It was originally intended to be 2D, but our lead programmer wanted to redo the engine and make it 3D. And, now, we really don't know how to go about it.

What model and animation formats should we be using? We're considering COLLADA, and if I understand correctly, we export models as .dae, then the animators import them, make the animation, then export as .dae. We then load them into the game using AssImp, then render, am I right? Or does the animator build a rig, save it as .dae, then the modeller builds on that, saves as .dae, then the animator makes the animations?

Thanks a lot for any help, really appreciate it.

sentences:
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:
Read an object from compressed file generated from ActionScript 3 I have made a simple game Map Editor and I want to save a array that contain map tile info to a file, as below:

var arr:Array = [.....2d tile info in it...];
var ba:ByteArray = new ByteArray();
ba.writeObject(arr);
ba.compress();
var file:File = new File();
file.save(ba);

I had successfully saved a compressed object to a file.
Now the problem is my server side need to read this file and decompress the array out from the file, then convert it to a Python list.  Is that possible?

sentences:
Tile Texture If Dimensions of Sprite Are Larger Than Texture I have a sprite that acts as a wall in a game that I am building. I would like to have the brick texture repeat itself instead of stretch to fit the height of the screen. I tried:

Texture lSideTexture = new Texture(Gdx.files.internal("wall.png"));
lSideTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);

lSideSprite = new Sprite(lSideTexture);
lSideSprite.setPosition(-50, -100 * (height/width) / 2);
lSideSprite.setSize(5,100 * (height/width));

But I am still getting a texture that has been stretched to fit the dimensions rather than repeated.

Any ideas?

sentences:
Starting a Coroutine after another Coroutine ends I have a method that fades the screen to black, then fades away back again using coroutines but I couldn't get the 2nd part to work.
FadeToBlack() works if I put yield return null instead of yield return StartCoroutine(LightUp()); so I know that isn't the problem
 private IEnumerator FadeToBlack()
{

    for (float t = 0.01f; t < fadeOutTime; t += Time.deltaTime)
    {

        color = new Color(0, 0, 0, 1);
        night.color = Color.Lerp(night.color, color, Mathf.Min(1, t / fadeOutTime));
        yield return StartCoroutine(LightUp());

    }}

If I put yield return StartCoroutine(LightUp()); in FadeToBlack instead of null it immediately turns black without the fading part. Here's what LightUp(); looks like
private IEnumerator LightUp() {
    for (float t = 0.01f; t < fadeOutTime; t += Time.deltaTime)
    {
        color = new Color(0, 0, 0, 0);
      Color colorD = new Color(0, 0, 0, 1);
        night.color = Color.Lerp(colorD, color, Mathf.Min(1, t / fadeOutTime));

        yield return null;

    }
}

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:
Algorithm for smoothing a network object's movement We are building multiplayer game where there's no central server managing the game.

Each player is responsible for sending out its state to all connected players.

In addition, all clients run prediction between received packets, to keep all objects moving in between state packets.

We also smooth out the positiobs received from remote clients, for example in scenarios where the received oosition is small enough and should be moved smoothly from the current predicted position.

The issue I am trying to handle is how should the algorithm behave in case it hasn't finished smoothing out the position yet, and a new state is being received?

The smoothing algorithm currently operates for a given configured duration (e.g: 80 ms). Should a new incoming state cancel the ongoing smoothing? What is done in such cases?

One option is to never reset started smoothing, that is, run for the whole 80  ms, but update the target position in case new state is received.

Another option would be to reset (start the 80 ms count all over again. This time with the new start/end positions).

Both options have their issues. I am wondering whether there's a formal way to deal with this.

sentences:
XNA - DrawIndexedPrimitives or DrawUserIndexedPrimitives? When rendering primitives in XNA, does it matter if I use DrawIndexedPrimitives() versus DrawUserIndexedPrimitives()? RB Whitaker uses the former, while Reimer's uses the latter.

From what I can tell, the intent is that if you're using a premade type that ships with XNA (such as VertexPositionNormalTexture), you should use the normal draw primitives function, while if you create a custom struct which satisfies IVertexType and/or VertexDeclaration, you should use the DrawUserPrimitives instead.

However, XNA places no such restriction on how they're used, and I am wondering why it wasn't just all rolled into one generic function to begin with.

sentences:
Octree Frustrum Culling times came when i had to implement some culling into my engine. I started by reading some stuff and so far so good. I managed to create an octree which can effectivly divide my geometry's vertices (per mesh)  into an octree. But here i have some Questions:

Currently i am using immediate mode to test if the culling works. And it does work, i am recursivly traversing the tree's nodes and testing against the node's bounding box if the frustum intersects with it. Repeat untill leaf is found and render that leaf's geometry (with immediate mode for testing) But now i would like to use VBO/VAO's to render the geometry in the leaves and here i see two options:
- 1.Each time the i traverse the tree push the leaves that intersect with the frustrum into a list then get the vertices out of them and construct a VBO and send it to be rendered.
- 2.Pre build a VBO for each leaf then just rebind for each visible leaf and render.

Anyway, which is the better option rebuilding a new vbo each time the frustum changes, or just rebinding multiple vbos (which is also expensive).
Also is this even the right approach , maybe i am missing something.

bool view_Culling(CFrustum& frusrum, COctree *node)
{
if (!node)
    return false;

if (frusrum.CubeInFrustum(node->GetCenter().x, node->GetCenter().y, node-       >GetCenter().z,(node->GetWidth()/2.0f)))
{
    if (node->IsSubDivided())
    {
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_FRONT]);
    }
    else
    {
        //use prebuilded vbo here
        //or push these vertices here in a list later build a dynamic vbo
        //from them
        node->DrawOctree(node);
        return true;
    }
}
return false;
}

sentences:
How to write a shader that only uses a bump map without a normal map So I understand that for best results one uses a height (or bump) map and a normal map together.

And I also understand that one can calculate a normal map from a height map using some sobel operator.

But out of curiosity I wonder how the first games that supported bump mapping did it.

I found this fragment shader code that seems to do it, but I am not sure:
OpenGL Bump Map -- Texture artifacts ?

If the code above does exactly what I am looking for, can someone explain the line

vec3 normalDirection = normalize(tangenteSpace*(texture2D( bump_tex, f_texcoord ).rgb*2.0 - 1.0));

How can you get a normal from a bump ?
I understand what tangent space is mathematically but how does it work here ?
Is it a vec4 or a matrix ?

So basically my question is:
How was bump mapping done without a normal map in the old days ?

sentences:
ECS -- Textures and Game Objects I'm developing a game using an entity-component system, and had a question about storing, using and linking textures to entities.

I have a GraphicsSystem that is responsible for storing and registering textures. Each entity has a GraphicsComponent including a textureID, which is just an integer used to look up the stored texture in the GraphicsSystem.

This works well for textures that are only used by one entity, for example player textures. In this case, I can create new GraphicsComponents by something like:

GraphicsComponent(graphicsSystem.addTexture("Player1.png"));

graphicsSystem.addTexture() adds a texture to the graphics system and returns an integer to its position, which is then stored in the component for later use.

My problem is that this approach doesn't work for textures that are registered once and then used across multiple entities. Examples are textures for bullets and world terrain.

My temporary solution to this problem is to register the texture once, and store the texture id centrally. Whenever I need to (for example) create a new bullet, I just need to remember that the bullet is texture id of (say) 1, and then pass this to the GraphicsComponent constructor for the bullet.

Similarly for my terrains, I currently just need to remember which texture ID is for which terrain type:

World::World() :    floorTerrain(1),
                    wallTerrain(2),
                    ...

I did think about storing these IDs somewhere, for example in the GraphicsSystem itself, but my world instance doesn't have direct access to the graphics system.

Anyway, as you can probably tell I am new to ECS game design and would appreciate any pointers!

Thanks,
Rich.

sentences: How to limit the distance of a point? I'm making an Angry Birds like game and I need to limit the distance that the user can pull back the slingshot, how do I do this?

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:
OpenGL rendering to multiple windows, having 1 main loop for each window I have written a little OpenGL framework in the past year that i would like to extend to support multiple windows in the near future. I have an idea about what I would like to do but I am not sure if that is possible so far.

I a nutshell the inner working of my framework is as following:

A window is created.
A render context for that window is created.
An application deriving from an interface is created.
window.run() is called, passing the application running in the window and the render context used as parameter.

sglr::W32Window w(nCmdShow);
w.create(L"DemoApp", sglr::DISPLAY_MODE::ENUM::WINDOWED, sglr::Resolution(800, 800));

sglr::W32Rendercontext r;
r.create(w, 4, 0, sglr::CONTEXT_TYPE::ENUM::DEBUG);

TestApp app;

return w.run(app, r);

The run method on the Win32 implementation looks like following (just some of the code):

        mRunningApp->onInit();

        // start message loop
        while (1)
        {

            while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
            {

                TranslateMessage(&msg);

                DispatchMessage(&msg);
            }

            // if message is WM_QUIT, exit loop
            if (msg.message == WM_QUIT)
                break;

            mRunningApp->onUpdate(mDt);

            mRenderContext->setAsCurrent();

            mRunningApp->onRender();

            mRenderContext->disableAsCurrent();

        }

    }

What I would like to do is to create a seperate window, rendercontext and application and start a seperate main loop by calling run() just like with the first window. I already have a seperate rendercontext for each window and know about setting it active before rendering to each window.
What possible solutions would exist to do that? Just running each run() method in a seperate threads sound like a kinda naive approach to me. (I admit I already tried it with failure :D)

sentences: In Android, is saving game data in a binary file a good approach? I am nearly finished with my Android game, but I want to make sure my save format is good. I am working on a fairly large game, so data such as high scores, stars, etc. are stored for around 80 levels, along with data for purchased items. Currently I save this data sequentially in a binary file. So when I need to load it, I have to go through all of the previous data to get to the data that I actually need. It seems to work fine, but I question how well this format will hold up for game updates. Is this is a bad approach to take? I considered using SQLite, but after trying to implement it into my game it didn't seem very effective. Updates seem as if they would be even more complicated.

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:
How can I set random speeds once inside Update? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spin : MonoBehaviour
{
    [Range(1, 500)]
    public float[] speeds;
    public bool randomSpeed = false;

    private GameObject[] objectsToSpin;
    private bool randomSpeedInUpdate = true;

    // Start is called before the first frame update
    public void Init()
    {
        objectsToSpin = GameObject.FindGameObjectsWithTag("ClonedObj");
        if (objectsToSpin.Length > 0)
        {
            speeds = new float[objectsToSpin.Length];
            for (int i = 0; i < objectsToSpin.Length; i++)
            {
                if (randomSpeed == true)
                {
                    speeds[i] = Random.Range(1, 500);
                }
                else
                {
                    speeds[i] = 100;
                }
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (objectsToSpin.Length > 0)
        {
            for (int i = 0; i < objectsToSpin.Length; i++)
            {
                objectsToSpin[i].transform.Rotate(Vector3.down, speeds[i] * Time.deltaTime);

                if (randomSpeed == true && randomSpeedInUpdate == true)
                {
                    speeds[i] = Random.Range(1, 500);
                    randomSpeedInUpdate = false;
                }
                else
                {
                    speeds[i] = 100;
                    randomSpeedInUpdate = true;
                }
            }
        }
    }
}

I tried to use a helper flag variable name randomSpeedInUpdate but still when I'm changing the randomSpeed flag to true while the game is running it keep changing the speeds all the time. I want it will change the speeds to random only once when changing it to true.

sentences:
Orbiting a specific point - Orbiting Camera How would I create a camera that with the mouse, it allows you to orbit around a specifc position, with the camera always facing that point? I would also like it to be able to always be at a constant distance from the point, and be able to orbit around it in every direction.

Any ideas?

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:
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:
Should I consider a cloud-based networking solution? In my spare time for the past few years, I have been working on both the front-end and back-end for a space-based online game. This game is initially designed for the PC, and is hopefully able to host thousands of players in a massively playable universe.

Along with the development of the game, I have been building the networking solution almost entirely from scratch. The architectural design of the networking solution is based on a fairly traditional master-server > sub-server model. I recently was able to run some fairly decent-scale tests on this model and was pleased to see that both my expectations and goals were met. Which leads me to my current fear.

The basic idea behind the current solution is that the master server acts as a router. It knows about all of the currently active sub-servers, including their load (cpu, memory, bandwidth etc) and what the sub server is assigned to handle. The master server has literally no other purpose.

Each sub server is designed to handle one (or more) solar systems. The idea being: as a player, you connect to the master server and tell it which solar system you want to go to. The master server looks to see if there is a sub server already assigned to this solar system and sends you there, otherwise it finds the sub server with the least load and assigns that sub server to the solar system before sending you there.

The part that I am worried about is that this is pretty much as much as I can get out of this model. Once you have been sent to a solar system, you (and everyone else in that solar system) are on that sub server until you leave that solar system. Although I am happy with my testing so far, and that it looks to be able to handle around 300 fairly active peers, fairly comfortable on a well-fitted server, I am worried if I ever end up in the situation where this isn't enough.

I discussed this recently with a few acquaintances of mine. The discussion lead to a cloud-based network maybe being a better solution than single server machines acting as sub servers. Atmittedly, cloud commputing is fairly unknown territory for me. With that being said I've spent some time looking into this and I am fairly confident with the basics, but I have the following questions:

I assume that if I were to re-design the networking solution to work within a cloud-based network, I would no longer need the master-server > sub-server model, since I could build a single application that would handle all solar systems and peers, and that the cloud would scale based on the number of solar systems and peers?

Any and all advice is welcome!

sentences:
Change Time.timeScale during an animation event - Unity I have an animation. A few seconds after this animation starts I set an animation event that is correctly being triggered. This animation event calls a method where I am trying to modify Time.timeScaleand set it to 0.05f.

This event is calling the following method:

public void Slowmotion()
{
    Time.timeScale = 0.05f;
    //Time.fixedDeltaTime = Time.timeScale * 0.02f;
}

But this Slowmotion method is not working.

Any ideas on what may be happening?

sentences:
How 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:
Shadow map shimmering, indexing outside the shadow map I have tried to reduce the shadow shimmering/flickering using the technique described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324%28v=vs.85%29.aspx

It works as I want and shimmering is reduced but sometimes I have artifacts. It looks like my code tries to index space outside the shadow map. The article above writes about it but I didn't find a solution.

When I played with the code I also got black strips on the corners.

Code:

// reduce shadow shimmering/flickering
Vector2 vecWorldUnitsPerTexel = Vector2(D.x() / (float)D.shadowMapSize(), D.y() / (float)D.shadowMapSize());

// get only x and y dimensions
Vector2 min2D = min.vector2(),
                max2D = max.vector2();

min2D /= vecWorldUnitsPerTexel;
min2D = Round(min2D);
min2D *= vecWorldUnitsPerTexel;

max2D /= vecWorldUnitsPerTexel;
max2D = Round(max2D);
max2D *= vecWorldUnitsPerTexel;

min.set(min2D, min.z);
max.set(max2D, max.z);

// crop matrix based on this article https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
Vector scale;
Vector offset;
scale.x  = 2.0f / (max.x - min.x);
scale.y  = 2.0f / (max.y - min.y);
scale.z =  1.0f / (max.z - min.z);

offset.x = -0.5f * (max.x + min.x) * scale.x;
offset.y = -0.5f * (max.y + min.y) * scale.y;
offset.z = -min.z * scale.z;

Matrix4 m;
m.x = Vector4(scale.x, 0, 0, 0);
m.y = Vector4(0, scale.y, 0, 0);
m.z = Vector4(0, 0, scale.z, 0);
m.w = Vector4(offset.x, offset.y, offset.z, 1.0f);

I think that I should store in the depth map a slightly larger area but I'm not sure how to do this. I tried to change the scale of the crop matrix but it doesn't help.

EDIT:
It seems I've found a solution. When I'm rounding (or flooring) min and max values I subtract one from the min value and add one to the max value. This makes the shadow map contain a slightly larger area and I don't see any artifacts.

sentences:
What methods are there to discard points on one side of a surface but not the other? Goal: Given a surface mesh (terrain), discard all points above a given elevation relative to the terrain. The terrain can change quite often due to tiling and LODs, so the point culling will need to be dynamic and have good performance. The camera in our scene is free floating, so no assumptions can be made in that respect.

Here is a side view of the problem:

My initial attempt was to draw the terrain, translated to the given elevation, only to the depth buffer. Then, when rendering the point cloud, discarding points that fail the depth test. There are a couple problems with this method though: I have to determine which side of the translated terrain the camera is on and, if above, flipping the depth test. Also, if the camera is looking at the terrain edge-on, points will be discarded that shouldn't be.

Any ideas are welcome, and let me know if I need to make clarifications regarding the task.

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:
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:
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:
Writing a glow shader I'm trying to learn writing shaders. And I've pieced together something that is kinda working. I want to create a transparent glow around a sphere.
The problem I have is that I can't seem to alter the transparency of the glow.
I tried experimenting with ZWrite off but that doesn't give me the desired results.

The red part around the sphere is the glow. But I'm unable to change its alpha.
I'd would also like to change the "blurriness" of the glow. How would I do that?

EDIT

so I did some more tinkering. I've changed the blending to
Blend SrcAlpha OneMinusSrcAlpha and enabled ZWrite off. This allows me to change the alpha. The problem with this is that the inside of the object is also colored by the glow. I just want the glow around the circle. not inside.

Shader "Custom/HoleShader" {
Properties {
    _holeColor ("Color", Color) = (1,1,1,1)
    _glowColor ("Glow Color", Color) = (1,1,1,1)
    _glowSize ("Glow Size", Range (0.0,5)) = 1.0
    _glowOpacity ("Glow Opacity", Range(0,1)) = 1
}
SubShader {
Tags { "LightMode" = "ForwardBase" }
    Pass {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        uniform float4 _holeColor;
        uniform float4 _glowColor;

        struct appData {
            float4 normal : NORMAL;
            float4 vertex : POSITION;
        };

        struct v2f {
            float4 pos : SV_POSITION;
            float4 col : COLOR;
        };

        v2f vert (appData v) {
            v2f o;
            o.pos = mul(UNITY_MATRIX_MVP,v.vertex);
            return o;
        }

        float4 frag(v2f i) : COLOR {
            return _holeColor;
        }
        ENDCG
    }
    Tags { "LightMode" = "ForwardBase" "Queue" = "Transparent" "RenderType" = "Transparent"}
    Pass {
        ZWrite Off
        //Blend One OneMinusSrcColor
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        uniform float4 _holeColor;
        uniform float4 _glowColor;
        uniform float _strength;
        uniform float _glowSize;
        uniform float _glowOpacity;

        struct appData {
            float4 normal : NORMAL;
            float4 vertex : POSITION;
        };

        struct v2f {
            float4 pos : SV_POSITION;
            float4 col : COLOR;
            float3 viewDirection;
            float3 normalDirection;
        };

        v2f vert (appData v) {
            v2f o;
            float4 pos = v.vertex + (v.normal * _glowSize);
            o.pos = mul(UNITY_MATRIX_MVP,pos);
            return o;
        }

        float4 frag(v2f i) : COLOR {
            return float4(_glowColor.rgb, _glowOpacity);
        }
        ENDCG
    }
}
}

sentences:
Limiting Rendering in my game loop (Not Game Updates) My Gameloop (code below), limits the game updates to 60 ticks per second. However, it renders as fast as the device on which it is being run can handle.

I'm using a fixed time step in my game and I want to be able to limit my rendering to a specified amount (in my particular case, that would also be 60).  However, I need to keep rendering calls uncoupled from game update calls.

I tried lumping the render calls in with the update calls but the problem with this is that they aren't uncoupled.  This could potentially lead to issues if the device can't handle rendering 60 fps.  Lets say it drops to 40fps, then the game updates will also drop to 40 ticks per second. Everything in my game is based on the game running at 60 ticks per second.  So everything will run at the wrong speed. (using a variable time step isn't an option, my whole game is build around a fixed time step)  So basically, if the device drops to 40 rendering calls per second, it should continue running game updates at 60 ticks per second so everything runs OK.

I am quietly confident that (virtually) every device on which my app runs will easily be able to handle 60 ticks (game updates) per second. I've tested this on a very old handset and it copes with 60 ticks no problem.

I would rather limit the rendering because as things stand it's rendering redundant frames and this must have a negative effect on battery life.

Would be grateful for suggestions on how I can limit the frames renders while keeping rendering and game updates separate.

Code

long nextGameTick = System.currentTimeMillis();
//loop counter
int loops;
//This is the amount of frames that we allow our app to skip before logic updating is affected (generally shouldn't happen)
final int maxFrameskip = 5;
//Game updates per second
final int ticksPerSecond = 60;
//Amount of time each update should take
final int skipTicks = (1000 / ticksPerSecond);

    public void onDrawFrame(GL10 gl) {

    //Set/Re-set loop back to 0 to start counting again
    loops=0;

    while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){

        SceneManager.getInstance().getCurrentScene().updateLogic();
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;
        tics++;

    }

    render();

}

Please note I've already read Fix your timestep! and the similar Android Game Loops but these articles don't mention how to limit the rendering in a loop like the one I have adapted - just the game updates.

Any help would be appreciated

sentences:
Getting Bodies to go "Super Fast" in Box2D I am making a breakout game in Android using the LibGDX version of Box2D. I have a ball that I am applying a force to with the following code...

getBody().applyForceToCenter(-10000000000.0f, -10000000000.0f);

This makes the ball move properly, but it never seems to gain a lot of speed (and I want to make it go super fast). I tried adding an accelerate method where I applied the force 40 times, but again it doesn't seem to move that fast. What is a good way to make a Body go "Super fast" in Box2D?

If there is acceleration I would like it to be as short as possible.

I tried adding the following....

World.setVelocityThreshold(1000000.0f);

But now the ball doesn't seem to "bounce" off walls, do I need to raise my restitution or something?

sentences:
How to determine the best approximate direction I want to determine which sprite to use when one agent is "facing" another agent.

My game is 2d, and uses 8-directional movement. Deciding which sprite to use for movement is easy enough since there are only 8 options when moving form one square to another.

def direction(self, start, end):
    # method for determining facing direction
    s_width = int(start[0])
    s_height = int(start[1])
    e_width = int(end[0])
    e_height = int(end[1])
    # check directions
    if s_height < e_height and s_width == e_width:
        return 'down'
    elif s_height < e_height and s_width > e_width:
        return 'downright'
    elif s_height == e_height and s_width > e_width:
        return 'left'
    elif s_height > e_height and s_width > e_width:
        return 'upleft'
    elif s_height > e_height and s_width == e_width:
        return 'up'
    elif s_height > e_height and s_width < e_width:
        return 'upright'
    elif s_height == e_height and s_width < e_width:
        return 'right'
    elif s_height < e_height and s_width < e_width:
        return 'downleft'

It's verbose, but gets the job done. start is the agents current coordinate position, and as you might guess end is the next step in the list of waypoints which makes up an agents path. The problem is that using the same function for determining which sprite should be used when attacking another agent does not look very good at all.

For example, if the target is down, but only one pixel to the right, we would want to show the 'down' sprite, but this function returns 'downright' instead. How can we change it to appropriately return the fitting sprite?

sentences:
Has "Killer Game Programming in Java" by Andrew Davison been rendered useless? What new tutorial should I follow? Its pathetic how it was created in 2005 not so long ago when the Java 3D 1.31 API was released. Now after downloading the source code off the books website and implementing it onto my work-space it cant run. (The 3D Shooter Ch. 23) I downloaded Java 3D 1.5 API, installed it- went back to my source code and javax.media ect.., and EVERY imported class within the game simply couldn't be resolved... they are all outdated..

Please do not say how its meant for a positive curvature in your game development skills. No ~ I got the book to understand how to code 3D textures/particle systems/games. Without seeing results how can I learn?

If there is still hope for this book please tell me. Otherwise what other books match this one in Game Programming? This one was very well organized, documented and long. I am not looking for a 3D game prog. book on Java. Rather one that has the same reputation as this one but is a bit newer..

sentences: Where can I find a free SDK for C#? I need a free and recent SDK for use with C#. I will work first in 2D games with visual effects. Thanks for now.  Can anyone help me?

sentences:
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:
InputLayout handling Where are you supposed to store InputLayout?

Suppose i have some basic structure like.

class Mesh
{
   List<MeshPart> MeshParts
}

class MeshPart
{
   Effect Effect;
   VertexBufferBinding VertexBuffer;
   ...
}

Where should I store input layout?

It's a connection between vertex buffer and specific pass, i can live with just 1 pass but I still have diffferent techniques so i need at least an array with some connection to effecttechniques, but I would appreciate something not crazy like dictionary. I could also create wrapper for Effect and EffectTechnique, but there must be some normal solution.

sentences:
How to edit WoW models with Blender? My situation is following, I am into role play, mostly me and my friends are using World of Warcraft. Since I am a bit into Blender too, I would like to try to edit some models(armor and weapon) for private use only(!). Problem is - I have no idea how to import and export them.

So far I have found only this forums.runicgames, but it looks very outdated, and I am not sure if it will work with Warlords of Dreanor extension.

How would I go about exporting the models from WoW and importing them into Blender?

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: Porting libgdx game to iOS using Multi-OS engine - how to add Admob ads I want to port my libgdx game to iOS using Multi-OS (RoboVM is no longer available). I've searched whole internet but can't find any info about how to use Admob with Multi-OS engine on iOS. Every resource I found is about RoboVM, but it's not available anymore since April 17 for new developers (you can only use it if you already have an account, but it's not possible to create a new one). Libgdx with Multi-OS is available in another branch on Github, but there is no info about ads and I want to publish my game this week. Can anyone help me?

sentences:
How to use LuaJIT the same that Lua in a C++ program? I'm using Lua in my C++ program, as an library. But I read that LuaJIT is a better implementation.

Is it posible to replace with LuaJIT with little change? How?

sentences:
How to interop between DirectX11 in C++ with XAML&C# or should I turn to SharpXD I'm writing a UWP program and I want to write the general UI in C#. But there would be some graphic demonstrations using DirectX on some SwapChainPanels in the app. I have found less than enough documents of how I can interop between these two parts in two languages. And problem occurs such as how I should instance a C++ class from another project from C#.
I might need a frequent calling between the two part for the demonstration(It's actually a scatter plot). And some suggested that this could cause a great performance damage.
So should I turn to SharpXD? And what should I do if I don't.
Thank you.

sentences: OpenGL ES and Screen Coordinates Is there anyway I can make OpenGL ES 2.0 to accept coordinates (for Vextex for example) in int meaning the pixels instead of the default float system? Also how can I set the point (0,0) to be at the top left corner of screen instead of the default one at the exact middle of the screen (to make using the pixel coordinates system easier)?

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: NavMesh going in the ground I'm trying to do a navmesh. Everything seems to work fine exept that my character in almost completely under the ground. The ground is a plane with a mesh collider. I have baked it and checked my heigth mesh. My character has a rigidbody and a collider. What could be the problem ?

sentences:
Pointer to member function of another class I have two classes, CEffect and CEffectPool. A third class CLevel, is doing most of the stuff in my code.

In every frame, it checks each CEffect in CEffectPool, and if it is currently inactive, it disables it.

What I would like to do is to give CEffect the pointer to the CEffectPool member function called Destroy(), so I don't have to check every single CEffect by another class whether it shall be destroyed or not.

With this function pointer, CEffect would simply call a function, which would destroy it.

Also, I am not talking about destroying in the C++ way (I don't want memory to be freed or to call the destructor).

Here is some code, that i have, but it unfortunately don't work and I am not sure why:

CEffect.h

class CEffectPool;
class CEffect {
    public:
        CEffect();
        CEffect(const CEffect& eff);
        CEffect& operator=(const CEffect& eff);
        void Initialize(CEffectPool* pool,
                        ushort id,
                        real x,
                        real y,
                        ushort timer);
        void Frame();
        void Draw();
        bool IsActive() const;
    private:
        CEffectPool* _pool;
        ushort _id;
        CSprite _sprite;
        ushort _anmfrm;
        ushort _timer;
};
void DestroyEffect(CEffectPool* pool,
                   ushort id);

CEffect.cpp

void CEffect::Frame() {
    if(_timer) {
        --_timer;
        return;
    }
    ++_anmfrm;
    if(_anmfrm == 24) {
        DestroyEffect(_pool,_id);
    }
}

CEffectPool.cpp

void CEffectPool::Destroy(ushort index) {
    if(index >= _size) {
        return;
    }
    CEffect temporary = _pool[index];
    _pool[index] = _pool[_size-1];
    _pool[_size-1] = temporary;
    --_size;
}
void DestroyEffect(CEffectPool* pool,
                   ushort id) {
    pool->Destroy(id);
}

Could you help me with this? What is the best approach to do this?

sentences:
How important is a single-player mode in a 2-player game? So say you have a 2 player game, taking Chess as an example (except it's an original game with no ready-to-go AI available).

Let's say there's also a social-aspect to the meta-game, so let's say it's a Chess game on Facebook where you can challenge your friends.

How important is it to have a single-player mode, knowing that an AI will need to be created (I've done minimax AI for tic tac toe, but nothing too sophisticated)?

Is it important enough that it should be in the initial launch of the game?

Can it wait for a future iteration (knowing that being hosted on the web means the game can be updated at any time)?

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:
Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle I'm working on a first person game, and I've ran into a problem. In my game, there's the player's gun being rendered, as well as a reticle in the center of the screen - like this:

First, Let's imagine there was no gun model being rendered. Then firing the bullet is easy - you just spawn the bullet exactly where the player's "eyes" are, and then use trig to calculate the velocity based on whatever direction the player is looking.

But now, when we add the gun model... we can't just spawn the bullet where the players eyes are, we have to spawn it at the tip of the gun (right?). So you do that, but then... how do you move the bullet in a way that it will hit wherever the reticle was pointing?

Keep in mind that the bullet in my game (it's actually a rocket, in this case) will be moving slow enough that its movement can be seen, so some workaround that would usually work if the bullet is too fast to be observed will not work. For example, if you didn't spawn it so it looks like it's coming out of the tip of the gun, the player would definitely notice that.

sentences:
Optimal touch controls for a twin-stick shoot 'em up? So we recently launched a shoot 'em up arcade-type game (think Smash TV or I Made a Game with Zombies in It!). You can move in one direction and fire in another, so the ideal control scheme is probably two analog joysticks (like the Xbox 360 has). We support WASD to move and arrow keys to fire. The best way to control though is to move with WASD and aim with the mouse.

We're getting a lot of people asking for mobile versions of the game (mostly for iPad and Android) and the problem is we just can't come up with a good way to translate the controls over to a touch device.

Interestingly, someone actually hacked an early version of our game a while back to work on Android by overlaying D-pads, and sure enough, it was almost impossible to control. The game gets really difficult later on, and the thought of releasing a game with a crappy control scheme that nobody could possibly ever use to beat the game does not sit well with me.

So I was wondering if anyone has any previous experience or suggestions on how to approach this problem? Overlaying two D-pads on the screen is clearly not the way to go and we're kind of at a loss for other ideas.

sentences:
Are you supposed to be looping through all PhysicsObjects at every step in a physics engine? I am currently making a small 2D game and I am trying to implement some basic 2D physics. I currently have  a list of around 100 PhysicsObjects which I loop through every frame in order to update and apply forces to that object based on user input. The basic code is as follows:
accumulator = 0
dt = 0.01

while running:
    for each object in PhysicsObjects:
        update object

    accumulator += time between last frame and current frame

    while accumulator >= dt:
        for each object in PhysicsObjects:
            resolve forces to get new position of object based on dt
        accumulator -= dt

    for each object in PhysicsObjects:
        render the object

I was going to resolve the forces and calculate the new position in the update method of each object, but I was told the dt was necessary in order to make the movement and physics independent of frame rate, which is why it is in a separate loop. I also can't update the objects in the physics engine loop as the update method needs to occur every frame.
This already seems incredibly inefficient, and I haven't even started to test for collisions or anything else more in the physics engine. Is there a better way to structure this where I don't need to loop through every object again in order to calculate their new position?

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:
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:
Unity launches both Visual Studio and Monodevelop simultaneously When I open a script for editing from Unity, both Visual Studio and Monodevelop are launched, resulting in two instances of the same solution to be open in two different script editors.

I am presently running the latest version of Unity 5.50fs (though I also experienced this issue in the previous build prior to installing Unity's latest update), in conjunction with Visual Studio Community Edition 2015, and Visual Studio Tools For Unity 2.3.0.

I also have my external script editor set to VS in the preferences window of Unity.

While investigating this issue I came across a forum thread of someone experiencing a similar problem, where MD opens instead of VS. This seemed to be a result of a hard coded reference to MD for redundancy in cases where VS might fail to load, which I thought sounds like a plausible explanation for my situation as well.

The general consensus was that when VS takes a little too long to open, Unity reverts to MD under the assumption that their is a problem with VS. This explanation seems even more likely in my case because this issue only occurs when I first open Unity for the day- if I have had VS open recently MD does not open, and VS opens quite quickly, likely a result of being cached in my computers memory.

The work around offered to avoid MD launching instead of VS in that thread, was to change the name of the MD executable, so that Unity would be unable to launch MD, giving VS time to finish loading. I was however hoping to find a better solution. I like the fact that Unity has that redundancy in place and would rather keep it intact, and I don't know why but changing the executable solely for that purpose makes me feel a little OCD.

Other ideas I have tried include reinstalling Unity, running both Unity and VS as an administrator, and launching VS prior to opening the script in Unity (in this case Unity opens a second instance of VS).

Has anybody else experienced both script editors being launched simultaneously and/or have any other ideas on how to resolve it? It's obviously not a critical issue or anything, but it is a bit annoying.

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:
How can I make my Camera's RenderTexture output have a transparent background? I'm writing a 3D game using Unity 2017.1.0b1.  I have a disabled Camera that takes a "snapshot" of the current scene and stores it in a RenderTexture when a button is clicked.  I then display the RenderTexture in a RawImage within my scene.

This works, except that the output from the Camera into the RenderTexture doesn't take into account the alpha value of the Camera's clear color.

Here's a snapshot of how my disabled Camera is configured.  Notice the Background property has an alpha value of 0:

Here's a snapshot of what the RenderTexture (displayed using a RawImage) looks like in the game.  The blue square is the RenderTexture:

How can I make the Camera render into the RenderTexture with a transparent background?  I didn't expect the blue background to show up in the RenderTexture since its alpha value is 0.

sentences:
Not So Beginner Tutorial Request So my game is done for now but every time it flashes on the screen and my game loop is awful. So crowded with logic.

I need to learn more about games and how they are running. My idea now is that at the heart of the game you have a while loop. Inside that you are checking for events to happen. Each time an event happens, you spawn a thread that accomplishes a task.

You then have a layer that draws on the screen the "map". Also a layer that says where objects collide. And finally the logic of how objects interact.

I am using C++ and SDL and I need a complete tutorial that takes me through a complex example to get started. I am a good programmer but have no experience with games. Any suggested tutorials would help.

All tutorials I have found so far are too easy and don't do anything worth while.

sentences:
Is reusing BitmapFonts possible in GDX? I'm loading multiple labels (100+) with different font types (max 10), but they have different sizes.

As I read the code and did the research, it's not possible to 'reuse' the font.

For instance, I have 5 labels made with GILL_SANS font but these labels must have different scales (font scales).

Should I really make 5 different BitmapFont objects for different scales (AND LOAD THESE TERRIBLE GRAPHICS AGAIN AND AGAIN) or is there any way to optimize this (without loading .fnt and .png again)?

One load takes 2mbs of RAM (huge png) + ~2ms which is unacceptable for 100 labels.

Edit
I've check that. Label caches fonts so you can scale the same font and use setFontScale() on each label. But what about TextField?

sentences:
Setting resizable to false in LibGDX I have a small working game prototype. I want to do something like

LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.resizable = false;

But I get "LwjglApplicationConfiguration cannot be resolved to a type"

What can I do? Or is there a different method?
Thanks.

sentences:
Game engine + editor + gameplay dependency I've tried to find my answer here but the other "similar topics" were different or just wasn't able to find the right one.

This is mainly a design (and some c++) question about the dependency between the different projects. Let me describe my problem:

So I've already used Unity and UE4 and I like the approach(es) they're using. They have a (game) engine an editor application and a user-created gameplay code. You can use your own gameplay code in the editor - you can assign scripts to objects, run/pause/step/stop (and debug!) the actual game in the editor.

I've checked the UE4 source code (which is actually pretty big) and the way this works is they're using custom build and preprocess tools (like Unreal Header Tool) and they've implemented everything they're using. As I could see, they're not using any STL class/function, they've implemented their own. This way they can make the "engine project" shareable, so they can build the libraries to dlls and that's it.

I'm using the same component-based approach. Different components can be attached to an object, and an important component base class is the Behavior. The "gameplay components" inherits from the Behavior base class.

So back to the problem: I (will) have 3 different projects:

Engine
Gameplay
Editor

The Engine is the core, that is a static library with every required thing except the game-specific code, of course. The Gameplay depends on the Engine and is built as an executable (*.exe). This contains the actual gameplay code while using the engine.

And here comes the real problem: the Editor depends on both the Engine and the Gameplay projects. Why? The Editor is using the Engine to create the window, draw buttons, log messages, etc. However it would be nice to be able to assign the "scripts" (in the terms of Unity) to objects and that would be the best if I could "play the game" in the editor, like in Unity.

Why is this a problem at all? Because I'm not able to use a shared library for the Engine project. Why? Because I should dll-export a lot of things which is not even possible while using the STL. It's a known "fact" that most of the STL objects cannot be used with dll-export (and I should write a lot of export code now, heheh). Also I don't want to use any bigger library like Boost or Qt.

However if I'm using static library for the Engine project then the Editor and the Gameplay will have its "own copy" of the Engine.

Maybe a half-solution could be the following: I could have a 4th project for the gameplay code exports which would be a dll. This project should only contain some functions which would be used in the Editor - eg. query the list of the available scripts with the visible variables, etc. However the game code is not actually available in the editor, so any "play in the editor" wouldn't be possible.

sentences:
Calculate Player Level in PHP So in my program, I currently know how much Experience a player has. I was using this formula to figure out what level the Player was:

function calcLevel($XP,$const){
     $L = sqrt($XP)*$const;
     return floor($L+1);
}

Then I wanted to figure out what Percentage of the way the player was to the next level, so I needed to figure out how much Experience they needed to get to that point. I thought this would work:

function xpNeeded($L,$const){
    $XP = pow($L,2)/$const;
    return $XP;
}

I would also need to know how much previous Experience the player had earned in other levels so I could calculate the percentage based on the Experience earned at the current level only:

function prevXP($L,$const){
    $XP = 0;
    for($i=1;$i<$L;$i++){
        $XP = $XP + xpNeeded($i,$const);
    }
    return $XP;
}

This all made sense to me, but the calculations are a bit off.

For instance, using Level 2, and Constant of .1:

$const = .1;
$lvl = 2;
$a = xpNeeded($lvl,$const); //returns 40
$b = prevXP($lvl,$const); //returns 10
$c = $a+$b; //50
calcLevel($c,$const) //returns 1, should return 2

I can't really tell where my calculations have gone wrong, obviously, it is in the xpNeeded function, I just do not know what I did wrong.

sentences:
Rotating an object towards a target on the Y axis I am attempting to rotate a 3D object on its Y-axis towards a target it is looking at. I have always struggled with rotations so I would like to try to avoid using Unity's built in functions, i.e transform.LookAt() in order to get used to using rotations. Gotta master the basics first, right?

Vector3 currentOrientation = transform.rotation.eulerAngles;
Vector3 directionVector3 = transform.position - target.transform.position;
float angle = Mathf.Atan2(directionVector3.z, directionVector3.x) * Mathf.Rad2Deg;
currentOrientation.y =angle;
transform.rotation = Quaternion.Euler(currentOrientation);

However when I do run this, the character is not looking in the correct direction at all!

Here is a screen shot with the character's parameters

The target object belongs in a hierarchy, where it's position in world space is (150,0,500)

Does atan2 somehow behave differently in 3D space vs 2D space? I ask because I've made 2D games where I would just use atan2(y,x) for a character's rotation.

sentences:
SourceTree doesn't show the differences in Unity scene files? Back in the day it worked, but for some reason in my new projects it isn't.

Every other asset's difference is shown correctly in a text format (i.e. .prefab), only .unity files won't work, in the diff view it says:

  No changes in this file have been detected, or it is a binary file.

I did these:

In Project Settings > Editor, Asset Serialization is set to Force Text.
Created a .gitconfig in the root of my repo, with this content: (the path is correct)

[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
Also in SourceTree > Tools > Options > Diff, I increased a few limits, set the external diff and merge tool to C:\Program Files\Unity\Editor\Data\Tools\UnityYAMLMerge.exe but none of them helped.

sentences:
Does SFML support these specific features that I require? I've been working on a game in c++ for about a week and a half, and I've been using SDL. However, my current engine only needs the following from whatever library I use:

enable double buffering
load an image from path into something that I can apply to the screen
apply an image to the screen with a certain x,y
enable transparency on an image
(possibly) image clipping, for sprite sheets.

I am fairly sure that SFML has all of this functionality, I'm just not positive. Will someone confirm my suspicions?

sentences:
How can I replicate the color limitations of the NES with an HLSL pixel shader? So since 256 color mode is depreciated and no longer supported under Direct3D mode, I got the idea to use a pixel shader instead to simulate the NES palette of all possible colors so that fading objects and whatnot don't have smooth fade outs with alpha channels.  (I know objects couldn't really fade out on the NES, but I have all objects that do fade in and out on a solid black background, which would be possible with palette swapping.  Also, the screen fades in and out when you pause which I know also was possible with palette swapping as it was done in a few Mega Man games.)  Problem is, I know next to nothing about HLSL shaders.

How do I do it?

sentences:
Which Entities should be in my Pooling System? Let's suppose that I'm designing a Tanks Battle Game, there will be a lot of projectiles and Tanks. Every Tank is composed with a Body, multiple Weapons such as Machine Guns, Missile Launchers, etc and different Shield Systems. I want to generate the Tanks at run-time and I will need to create and destroy them frequently. Should I add every type of Weapon, Shield, etc.. to my Pool System and recycle them when a Tank is destroyed, and later reuse them to assemble a new "Randomly" generated tank? Is this realistic? or should I just instantiate the Body, Weapons and Shields and don't use the Pool System for it? Do you have some tips for organize the Pool System?

I was looking for a advanced pooling system and I just got basic theory and examples. Any reference, suggestions, corrections or advice will be very grateful.

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:
Why are my Player Input Unity Events started twice? I'm using the (new) "Input System" package and the "Player Input" component on my player prefab like this:

public class Player : MonoBehaviour
{
    [UsedImplicitly]
    public void Fire(InputAction.CallbackContext context)
    {
        if (!context.started) return;
        Debug.Log($"Fire!");
    }
}

The odd thing is, this method is invoked twice with context.started == true. What am I missing here? Why is the method invoked twice?
A minimal working example to reproduce the behaviour can be found on GitHub.
EDIT
The player joins automatically through the "Player Input Manager":

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:
Manual response when 2 shapes made of rectangular volumes collide I have 2 compound objects made of rectangular blocks. One of them (the one that is moving) has a script that listens to OnTrigger callbacks. What I need is to position the moving compound object on the first compound object to make then not collide but stay in contact.

As an example you can thing of two "spheres" made of blocks. Both spheres are on the floor. Then I move one of the spheres (still on the floor) and I detect that it collides the other sphere, so, I need to push the moving sphere up to make it not collide with the first one but stay in contact.

I have a manual algorithm that make tests on the different blocks of the two groups to push it up enough to make them not collide but it is a bit intensive. Do anybody know if unity physic engine can help here? The main problem is that after I receive the collision I can not move the moving sphere up and recheck manually first of all because there's no Check for rectangles and on the other hand if I want to be notified by the physical engine after I move the moving sphere up (to see if it still collides)I need to wait a new frame which is not feasible in my case.

P.S. I'm using unity engine.

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:
C++ Multithreading: accessing objects together I'm kinda new to C++ Multithreading, and I'm keeping it simple right now. I will keep things simple and write psuedo-code. I'm making a Turn Based Strategy Game but let's keep it at Chess for now.

I have a basic draw thread and update thread.

function DrawThread
    CurrentScreen Drawn
end

function LogicThread
    CurrentScreen Update
end

Both of these functions run in their seperate threads.
Now I've run into a few problems.

For example: My pieces (units) are stored in a vector in the CurrentScreen

Class MapScreen
public:
    GetPieces returns VectorOfpieces

private:
    VectorOfpieces
end

The draw thread constantly draws the Chess pieces.

function Drawn
    for each chesspiece in VectorOfpieces
        draw chesspiece
    end
end

I have a cursor that moves grid-based and on, for example, ENTER checks if there is a Chess piece underneath it. (I've omitted any other code that has nothing to do with it)

function PollInput
    if KeyPressed is ENTER
        CheckUnderNeath
    end
end

function CheckUnderNeath
    for each chesspiece in MapScreen.GetPieces
        if chesspiece position is cursor position
            return chesspiece
        end
    end
end

Now as you might have guessed this Cursor update is in the other thread

function Update
    Cursor PollInput
end

And as you might have seen coming miles away, both threads will eventually end up using the same vector at the same time, causing a crash.

Is there any easy implementation to fix a problem like this, as my 2-3 problems right now are eventually down to this problem, threads bumping heads.

What bothers me is this crash isn't consistant.
Because it's a vector I will get a "map/set iterator not dereferencable" error.

I'd appreciate a C++ answer eventhough my question was in Psuedocode. Thanks in advance!

TL:DR One thread tries to update the position of the same pointer the other tries to draw.

sentences: How do I organize and sync multiple animated sprites in Unity2D? I have a human with three parts: legs, body and head, 2D, top down view (GTA 1-2 alike). Head does nothing, legs have walking animation and body has 2 animations: walking animation (moving hands which match with legs animation) and some additional animation. I have 3 gameObjects with SpriteRenderer, for each part, stored in parent. How do I animate all parts synchronously so that if human walks, then does additional body animation while legs are walking and returns to body walking animation so that if e.g. legs play 5th frame of its animation, body also plays its 5th frame, not 1st. Is it possible and if yes, then how? Also, do I need separate Animators for each body part or only one?

sentences:
How could you parallelise a 2D boids simulation How could you program a 2D boids simulation in such a way that it could use processing power from different sources (clusters, gpu).

In the above example, the non-coloured particles move around until they cluster (yellow) and stop moving.

The problem is that all the entities could potentially interact with each other although an entity in the top left is unlikely to interact with one in the bottom right. If the domain was split into different segments, it may speed the whole thing up, But if an entity wanted to cross into another segment there may be problems.

At the moment this simulation works with 5000 entities with a good frame rate, I would like to try this with millions if possible.

Would it be possible to use quad trees to further optimise this? Any other suggestions?

sentences:
Get MonoBehaviour components from Prefab I need to assign the script values for the following Prefab in Unity 3.5

The structure is the following

Kinect_Prefab

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

 -MonoBehaviour

    ·Script: Missing Mono Script

All the components have the same name.

I have tried to obtain all of them in an array, but the GetComponents method does not seem to work properly.

var mono : MonoBehaviour[];
mono = Kinect_Prefab.GetComponents(MonoBehaviour);

The thing is the resulting array is empty.

Any idea what might be wrong?

EDIT: When I do GetComponents(MonoBehaviour) I get the following error

InvalidCastException: Cannot cast from source type to destination type.

I have tried receiving the components in var mono : Component [] but I still don't receive anything

sentences: Pixelated Text in Game Maker Is there a way to make the text look smoother and less pixelated? It bothers me.

sentences:
Why am I running out of memory in D3DPOOL_DEFAULT? When trying to using my company's D3D9 renderer and allocating everything in D3DPOOL_MANAGED I would run out of memory in the 32-bit process space.

I tried using our D3D9Ex renderer and allocating in D3DPOOL_DEFAULT, but that's giving me an error of 0x8876017C (D3DERR_OUTOFVIDEOMEMORY).

I'm unclear on what this means. Is this implying that the driver will not manage anything in D3DPOOL_DEFAULT?

I have 2.5GB of AGP space and 4GB of device memory, and all of my application meshes and textures are only 2.4GB on disk. I'm only using about half of those at any given time. Is there some hidden limit I'm bumping into here?

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 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:
What is the MTV (Minimum Translation Vector) in SAT (Seperation of axis)? What is the MTV (Minimum Translation Vector) in SAT (Seperation of axis)? and how can i use it?

Im trying to create my first game, where a ball can hit a a static brick (rectangle). Now if a ball collides with a brick, then i need to figure out which side the ball collided with so i can tell the ball which direction it should bounce off to.

For example, if a ball is heading nortwest and hitting the brick on its right side, then it should bounce in a northeast direction.

however if the ball hit's the bottom side of the brick, then the ball should be heading southwest.

So can the MTV be used in this situation? can MTV tell me which side of a rectangle the ball has impacted?

Please note i have implemented SAT in my game, and the collision detection works fine, my question now is, can i use MTV to actually handle a collision response?

Any help is appreciated.

sentences:
Libgdx is Character on Screen Inside an entity class:

public boolean onScreen(Camera camera){
    if(position.x + getWidth() > camera.position.x
            && position.x < camera.position.x + camera.viewportWidth
            && position.y < camera.position.y + camera.viewportHeight
            && position.y + getHeight() > camera.position.y){
        return true;
    } else {
        return false;
    }
}

The function returns false even when the entity is on the screen. What am I doing wrong?

sentences:
glDeleteTextures - release data, but keep the texture ID? In OpenGL, is it possible to release texture data, but keep the same texture id? I want to unload textures when they aren't needed, but load them again later when they are.

There are a lot of objects that store texture IDs. (For example - spritesheets - multiple objects use the same texture ID and represent a part of the image). glDeleteTextures releases the id, so another texture (image data) can acquire the same ID. I'd have to walk all objects and change the texture IDs they use.

Is there a way to release the texture data only, but keep its ID, so that later I could do only glTexImage2D on the same ID and keep all references to this ID valid?

sentences:
Is naming an app similar to another app legal? I just finished my first ever app after 1 month of programming it and I'm ready to put it on the app store/google play. I searched the stores to see if the name i wanted to name my app was still available. Say i wanted to name my app "example App". I found an app named "exampleApp" but the name "example App" was still available. Could I still legally put my app name as "example App" without worrying about getting sued or having to get my app name changed? The game play and graphics are entirely different. Thanks.

P.S. That app also has over 1,000,000 downloads so if I could still name my app "example app" would that be a bad idea and make it harder for people to find my app? Or would it make my app more popular by someone accidentally finding it in the search?

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:
How to inherit of a scene tree structure in a way that a change in the ancestor is updated in the descendant? Consider this structure:
* KinematicBody2D (Actor)
|_ AnimationPlayer (able to make a rotation of 360)

Now I want to make a Player and an Enemy that inherits of that structure in a way that when I change the animation on the Actor Scene, Enemy and Player are updated.
Is there a pattern that allows that?

sentences:
How to only render part of an image in lwjgl/openGL I'm making a mining/building game in java using slick2D and I want to make it so you can only see a few blocks in any direction while you are underground. The best example I could find of what I want to do is the game miner dig deep.

One way I thought of doing it would be to have a large image and just draw transparent areas on it where you need to be able too see but even if that would be an efficient method I wouldn't be sure how to do that.

sentences:
C# JSONs not formatting array of objects stored inside another object. I know the title is a bit confusing because I don't really know how to phrase this. This is what I have:

[System.Serializable]
public class Sector
{
    public string name;
    public Vector3 sectorPosition;
    public float sectorRadius;

    public buildingComponent[] components;

}
[System.Serializable]
public class buildingComponent : ScriptableObject
{
    public string componentType;
    public Vector3 componentPosition;
    public Vector3 compenentRotation;

}

When I try converting this into a json string like this:

        Sector ssector = new Sector();
        ssector.name = "sTom";
        ssector.sectorPosition = Vector3.up;
        ssector.sectorRadius = 2;
        ssector.components = new buildingComponent[3];
        print("component length " + ssector.components.Length);
        ssector.components[1] = new buildingComponent();

        ssector.components[1].componentPosition = new Vector3 (1, 2, 3);

        string sdata = JsonUtility.ToJson(ssector);

I end up with the following:

{"name":"sTom","sectorPosition":{"x":0.0,"y":1.0,"z":0.0},"sectorRadius":2.0,"components":[{"instanceID":0},{"instanceID":-341752},{"instanceID":0}]}`

The components array is not actually being formatted, it's only saved with an instanceId or whatever this does. Is there any solution to this or will I have to go with an alternative formatting. I just want to save this data on a server but I only get one string to do so, so I have to format everything into one string. Thanks in advance!

sentences:
Unity animations - Is the animation component really deprecated? I was looking for a way to create simple transform animations for 2d objects. As example, I wanted to animate all the objects of the scene when the game is paused (i.e. I just want to move the objects outside the screen boundaries with a nice animation). I think that creating an Animator Controller for something like this is not really useful for two reasons:

I don't know where the objects are at runtime. Please correct me if I'm wrong,
I think I cannot dynamically change the value of a keyframe attached to an animation controller, so if I just start a transform animation the sprite will jump at the first keyframe value and then performs the animation. Terrible result.
If I have 200 objects I should create 200 animation controllers with 200 animations.

Creating animation programmatically would be great, but I read on forums and here on stackexchange that you cannot dynamically handle keyframes... and that I HAVE to use the Animation Controller, otherwise I can use the Legacy animation system (that to me sounds so... deprecated :P)

Then I checked this page of the documentation: http://docs.unity3d.com/ScriptReference/Animation.html

They talk about the "Animation" component... and they don't say this element is Legacy/Deprecated. Looking at this page it seems that I have a lot of control over Animation actually... but know I'm completely confused! Is this component deprecated or not? Should I always use the Animation Controller instead?

sentences:
RPG Chance to Dodge formula A friend and I are trying to develop a “chance to dodge” formula that will scale from level 1-1000. I would like to see if one formula can be utilized, using a difference ratio between Character A’s level and Character B’s level. The factors involved in the equation are as follows:

Dexterity (Max 38)

Acrobatics Skill (up to 5 possible skill points)

The equation in theory:

(Acrobatics Skill * 5) + ((Dex - 10) * 0.1) + ((CharacterB's Level - CharacterA's Level) * 0.1)

The formula has been varied a little to make it work better in one regard which has the inverse effect of making it not work in another area. For example, the formula may work and scale well if a lvl 700 is striking at a lvl 1000. Let’s say that works out that Character B has a 65% to dodge. Sounds good…..except if the same formula is applied to a lvl 5 is striking a lvl 20 (low levels).

We don’t want there to be a 100% chance to block. Then again, I guess if a level 1 struck at a level 1000, that would be a little bit ridiculous that he would succeed. But once again, it would be nice if there was a way to scale the entire level spectrum by use of perhaps cosine and the difference-between-level’s ratio.

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:
What should deliverables for a school game project be? I am planning on making a 3D hack-n-slash RPG with Unity for a school project. I have to come up with a project proposal. I am suppose to identify project deliverables.

I cannot think of what "deliverables" would be for this kind of game. I am hoping someone can give me some examples to get me started?

Would they be art work or characters? Content? Story? Core features? Technical requirements? What technology I am using? I am not sure.

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 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:
When to use a blend tree vs state machine for animation Im an experienced game dev hobbiest making my first game with 3d animated characters (in Unity) and am struggling to figure out when to use blend trees vs animation state machines. I understand both conceptually but have seen both blend trees and animation state machines used for character animation in a bunch of tutorials both from Unity and from other sources. I am not sure when / why one is better than the other am hoping someone can point me in the right direction.

My game is a 3rd person action rpg a'la WoW or KOTOR or Mass Effect (different systems I know but the perspectives and combat styles are kinda close at a high level). I have tons and tons of animations for attacks, blocks, feigns, deaths, walking, running, jumping, shooting etc but I am unclear on how to sequence them together naturally.

I have seen blend trees used for locomotion which makes sense to me when trying to keep character motion fluid, but I dont understand how to go from that blend tree to an attack state and nothing I have seen so far has gone past locomotion (no attacks etc). Do I need to make blend trees from my motion states to attack / death / dodge states? Do I have more control using just state machines? Im a little cautious of state machines because of the transition bloat that is so common with them and because I suspect there is greater potential for janky animation sequencing without blending.

I am planning to use the Unity character controller and write my own logic scripts to drive it. For the AI I will be using the built in nav mesh agents. Are character controller animations handled differently than the AI ones?

Any insights would be more than welcome!

Thanks

sentences:
Drawing an arrow using the LineRenderer in unity I'm trying to draw an arrow using a LineRenderer in Unity, using the code suggested here.

Based on the UI it all seems good, yet it draws a pin needle, rather than the arrow I would expect from the UI. If I understand the UI right, it should thicken 60% into the line and then become thinner again towards the end.

Any idea what might be going wrong?

sentences:
How to improve collision detection memory usage? I am making an action platform 2D game, something like Megaman.
I am using XNA to make it.

I already made player physics, collisions, bullets, enemies and AIs, map editor, scrolling X Y camera (about 75% of game is finished ).
As I progressed I noticed that my game would be more interesting to play if bullets would be destroyed on collision with regular(stationary) map blocks, only problem is that if I use my collision detection (each bullet with each block) sometimes it begins to lag(btw if my bullet exits the screen player can see it is removed from bullet list)

So how to improve my collision detection so that memory usage would be so high? :)
( on a map 300x300 blocks for example don't think that  bigger map should be made);

            int block = 0;
            int bulet= 0;
            bool destroy_bullet = false;

            while (bulet < bullets.Count)
            {
                while (block <  blocks.Count)
                {
                    if (bullets[bulet].P_Bul_rec.Intersects( blocks[block].rect))
                    {//bullets and block are Lists that holds objects of bullet and block classes
                        //P_Bul_rec just  bullet rectangle

                        destroy_bullet = true;
                    }
                    block++;
                }
                if (destroy_bullet)
                { bullets.RemoveAt(bulet); destroy_bullet = false; }
                else { bulet++; }
                block = 0;
            }

sentences:
Collision detection in pong style multiplayer network game I've recently implemented an authoritative server (node.js with socket.io) for a multiplayer pong game.

I've looked at client side prediction and fixing timesteps and starting to grasp the notion of simulated identical physics across server and clients.

However, I still can't quite figure out the approach to how to detect when the paddle truly hits the ball. The paddles can be controlled by touch or mouse movement which can be an almost instantaneous teleport to the location of the ball.

How can I determine if the paddle was in the right place at the right time taking into account the round trip time?

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:
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:
2d top-down map: normalisation or not? I am an absolute beginner with game programming, should this question be poorly formulated, be aware it was not sloppiness by my side, but lack of game programming experience.

The game I am planning to code will use a top-down 2D map as "world". The world might be larger than the window (the window can zoom in or out) and the vehicles can be located at any point of the world (= it's not a tiled map, the space is "continuous").

To clarify with an example: if the world is a terrain of 1000x1000 metres, a vehicle could be at location (327.31, 720.4) metres.

My question is: what is the most convenient way to represent the world internally? I could think to these possibilities:

do nothing and use metres as if I were working with the physical object,
normalise to pixels defining the world size as the number of pixels for representing 1000 metres at maximum zoom,
normalise to 1 defining the word as a square of size 1

...but I am sure there might be some other ones / some of mine could make no sense. It's just that being my first game I don't have a clear pictures of the problems ahead of me, and I would like some guidance in making a reasonably correct initial choice.

Thank you for your time.

sentences: Can I make color data not render as gradient? I would like for the color between my vertices to not be rendered as a gradient, but as a hard break. Is there any way to accomplish this in OpenGL/GLSL?

sentences:
Can I Use SetLOD with D3D9Ex? I need to limit the mipmap level loaded onto the device for certain textures, but I'm using a D3D9Ex-based engine, so I can only use D3DPOOL_DEFAULT, not D3DPOOL_MANAGED.

Microsoft's documentation says that I can use SetLOD

  for a managed texture.

Does that mean that I cannot use SetLOD in D3D9Ex?

sentences:
How should I render multiple objects in OpenGL? I am just getting my head wrapped around modern OpenGL. Let's say that I would like to draw 10 objects, how would I structure that? Would I call glDrawElements(...) in a for loop 10 times?

void render() {
  shader.bind(); // calls glUseProgram
  bindVAO();     // calls glBindVertexArray

  for(int i = 0; i < 10; i++) {
    glDrawElements(....)
  }

  unbindVAO;
  shader.unbind();
}

sentences:
How to reduce the size occupied by my video animations? I have a mobile game but my build size is currently 4gb. Furthermore, it crashes on open and I suspect it has something to do with the huge build size.

In my project are 10 animations made of a series of images, each one using around 250-300 images. Each one is quite large as the animation takes up most of the screen so they are high resolution. What can I do to reduce the build size?

I have tried converting it into a video file and using the raw image component to display it as a movie texture, however, it seems unity doesn't support videos with alpha channels, and the alpha channel is critical to my animation.

I thought about combining them into a single image, but lets be real, if each image is more than 1080p, then combining 250 - 300 images into a single file will be massive.

So what can I do to reduce the size of the animations?

sentences:
Shadow Map field-of-view I'm implementing a shadow map algorithm with a spotlight (a spotlight that always "looks" at a given object).

My issue is that for some configuration, part of the object the light is "looking at" is out of the light frustum. As a consequence everything that is not "seen" is shadowed.

To account for this I tried to increase the field of view of the "light camera", but as a result I get very blocky shadows.

Am I doing something wrong? Is there a more clever way to make sure the light can see the whole object? If not, how can I solve the above said artefact?

sentences:
Why does reading my depth texture in GLSL return less than one? I've created a depth texture in OpenGL (using C#) as follows:
// Create the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Create the depth texture.
var depthTexture = 0u;

glGenTextures(1, &depthTexture);
glBindTexture(GL_TEXTURE_2D, depthTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 800, 600, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);

Later, I sample from the depth texture as follows:
float depth = texture(depthTexture, texCoords).r;

But even when no geometry has been rendered to that pixel, the depth value coming back is less than 1 (seems to be very slightly above 0.5). This is confusing to me since, per the documentation on glClearDepth, the default value is 1. Note that this is not a problem of linearizing depth since I'm attemping to compare depth directly (using the same near and far planes), not convert that depth back to world space.
Why is my depth texture sample returning <1 when no geometry has been rendered?

sentences:
Can a texture's UV coordinates be animated (scrolled) when part of a SpriteSheet? Alright so my question is about texture manipulation in Flash Stage3D / Context3D using AGAL for the shader language. But I'm pretty sure this could be applicable in other situations involving GPU programming.

So the goal is, if I wish to have a "scrolling" animation on a certain tile (like a tile of water), can I still have that texture packed along with all the rest of my sprite assets? Or does it have to be alone to avoid bleeding nearby assets?

From what I can understand, when the FragmentShader samples the portion of the texture offsetted during a scroll animation, any coordinates outside the desired texture will reveal incorrect nearby textures.

Some example to clarify:

Fluid motion (lava, water waves, acid bubbles);
Background motion (cloud, trees, houses);
Directional indicators (lines on a conveyor belt, race-circuit dash regions);

Do I need to use some extra operations to wrap the texture if it tries to sample beyond a certain point? How could those constraints be defined / transferred to the FragmentShader?

- UPDATE -

To clarify, I would like to scroll only on 1 single tile that would be part of a SpriteSheet / TextureAtlas (meaning, mixed with other existing sprites part of a game / project).

Imagine you had something like this (but better artwork, of course):

So a 256 x 256 Texture with a "Wavy Water" tile in the top-left corner (128 x 128 in dimensions).

How would you write a shader that can scroll through ONLY the water portion to give a sense of motion without running over the adjacent textures (ex: faces and cars).

How would you handle situations where the Quad is much larger than the texture and could repeat many times as well in combination to being able to scroll it?

sentences: Why do games have hats? I noticed that a lot of games tend to have hats.  I was wondering why?  Is it some sort of tradition to add hats to your games?  What makes this trend so popular in game development?

sentences:
Extrapolation - synchronize destination point on a second device while moving First of all, I read all of the Valve and Gaffer articles but I still have no clue, how to achieve my goal.

I am creating a UDP multiplayer game with a lot of physics (knockbacks, attacks). Packets delivery and sequence numbers are done - there is no loss, but the problem is with synchronizing ME (when I'm moving) on the second client (my opponent's).

As I read, there are two options:

1) delay the client by 100 ms and draw everything from the past - which is unacceptable, cause it really has to be a real time game. I know that for Valve this is enough, cause they have only shooting and they go back in time for just couple of variables, check some timesteps and they're done, but here, I have to check everything, if the player was in the air, if he was punched etc.

There is also a second option which is in a REAL TIME:

2) Real time, but with dead reckoning/extrapolation:

we get last two received positions
we make a normalized vector
no matter what - we just move the player by that vector in an update method

And here is the problem. I decided to pick option two - with extrapolation, cause it's the only solution, but I have no idea, how to stop the character in a place on the opponents client, where it was stopped on it's own client.

An example:
Speed is constant - 5 pixels per move.
Perfect world - we send a packet with position every frame.
So we move by 5 steps on X axis:

0,0 -> 5,0 -> 10,0 -> 15,0 -> 20,0 -> 25,0 (We stoppped on the client)

So we've sent 5 positions to the server and he sent it to the opponent.

We receive these packets on a second client (opponent) and we have to move the character with received packets.

And here comes the question, HOW?
Of course, vectors, I know these, but I have no idea how to synchronize this, that at the end the character on the opponent's phone is still on the same position (25,0).

An example of a problem:
We move 4 right, 2 left on the client:
0 > 5 > 10 > 15 > 20 > 15 > 10.

Opponents gets: 0, 5, 10, 15, 20 (he's moving by 1,0 normalized vector) but this is extrapolation, he moves also to 25, 30 (WHICH IS OKAY, it doesn't matter if he runned too far, it's only 10 pixels), then he get's the newest packet, he changes the vector to (-1,0) to move left, he moves two times and here comes the total misunderstanding, he will move only two times and he will land on (20,0), not on (10,0), cause this is the end of the packets.

A quicker explanation - he wasted his moves by moving 20 -> 25 -> 30, he should have use them to move these two points left - from x = 20 to x = 10;

I really need help with this, I went through hell by implementing reliable UDP and this desynchronization is killing me, really.

If someone had some experience with these things in Java, or anything, I would be grateful.

sentences:
How to rotate player to face mouse on canvas? I'm building a basic game using plain javascript and I am trying to rotate my object to follow my mouse.

I've tried getting the client's mouse X and Y then subtracting the canvas width and height divided by two. Then taking those values and inputing it into Math.atan2(). However, I feel the issue may be in my transform and rotate. The code bellow is what I've tried.

WIDTH = c.height;
HEIGHT = c.width;
document.onmousemove = function(ve){
            let cX = -c.width / 2;
            let cY = -c.height / 2;
            let x = ve.offsetX;
            let y = ve.offsetY;
            var rX = cX + x - 8;
            var rY = cY + y - 8;
            player.angle = Math.atan2(rX, rY) / Math.PI * 180;
        }
function update(){
                        var now = Date.now();
                        dt = now - lastUpdate;
                        ctx.clearRect(0, 0, WIDTH, HEIGHT);
                        ctx.setTransform(1, 0, 0, 1, WIDTH / 2, HEIGHT / 2);
                        ctx.rotate(player.angle + 10);
                        drawCircle(player.x, player.y, 20, 0, 180, "red");
                        ctx.setTransform(1, 0, 0, 1, 0, 0);
}
setInterval(update, dt/10000);

The player spins around my mouse in wide circles with no apparent pattern.
Here's a gif showing what's happening.
https://gyazo.com/006c99879ecf219791d059de14d98b74

sentences: Am I allowed to release an app I developed with Xcode on windows? I want to develop an app for the iOS app store, but don't want to invest in a mac since they start very expensive. So I considered running Xcode via VMware using OSX Lion on my windows 7 computer. Would it be legal for me to create and sell an app if it was created on windows? Is Apple fine with it? Selling it on Cydia or other jailbreak stores are not an option.

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:
Terminology for the way Transformation Matrix Data is treated I recently asked a question at math stack exchange and realize a similar questions is more suited for this forum, but the original is here:

https://math.stackexchange.com/questions/1526601/terminology-for-transformation-matrices-update-or-rigid-body-transform

I'm attempting to describe transformation matrix operations within Sketchup's Ruby scripts, and I need some terminology.

Sketchup allows the selection of a group of "loose" drawing objects (i.e. edges and faces), and provides options to create a grouped object from them. The drawing elements inside the group have position data relative to the group's local coordinate system. The grouped objects respond to a getter "transformation" method that returns a transformation object that contains data representing the orientation, scale, and position of the group.

Sketchup's "world space" supports multiple grouped objects, and typically there are numerous grouped entities in the outer level entities, as well as loose drawing objects. Each grouped object has a separate transformation that determines their position, orientation, and scaling in world space.

The transformation can be altered or replaced with methods that include:

a) The "transform" method: Applies a transformation (i.e. like a rotation) to rotate the group; and

b) The "transformation=" setter method: Replaces the existing transformation with the supplied argument.

Lets say I have a grouped object called "entity1" and rotation transformation object called "rotation". To provide the same rotation effect I could perform either of the following in Sketchup's Ruby programming:

entity1.transform!( rotation )
    OR
entity1.transformation= rotation * entity1.transformation

Only groups and components support the "transformation=" setter method, while fundamental Point3d & Vector3d object provide "transform!" kind of methods. It is obvious, at least from within Sketchup (which uses OpenGL internally), that transformation matrix internal data can be treated as either:

Relative: A transformation performs an incremental operation
(Example "entity1.transform! identity" does not have an affect on the grouped model); or

Absolute: The data inside a transformation is treated as absolute position, orientation, and scaling of the grouped object.
(Example "entity1.transformation= IDENTITY" sets the model to Sketchup's origin position, the model is de-rotated to the orientation it was when first grouped, and it is descaled)

Questions:

1) What is the terminology for the type of transformation that is supplied to the "transform!" method?
I was calling it an "affine", now want to call it an "update transformation".

2) What is the terminology for the type of transformation that is the argument to the setter "transformation="?
I have been calling it a "rigid body transformation", and sometimes "absolute transform". It appears that OpenGL is calling this the "model matrix".

3) If I call it "model matrix", is more than one model matrix transform allowed in world space?

A previous english stack exchange article for a word to mean "position and orientation" is at:
https://english.stackexchange.com/questions/119883/word-for-position-and-orientation
The article responses recommend to use "pose matrix".

sentences:
Getting rid of texture bleeding Edit: I figured out what problem I was facing, it's called Texture/Pixel bleeding, which I was not aware of yet. I posted an answer below consisting of a small description of the problem and a link to a post, that I felt explained the problem pretty well.

I'm building a little engine for myself (okay, let's say framework) to learn using DirectX 11. I'm pretty pleased with the results so far but today I ran into a little problem I was not able to solve. When rendering a textured model there are ugly gaps at some polygon joints observable. I will depict the issue more clearly with images of the example I'm rendering at the moment. My model consists of simple cuboids, one of those uses the following part of the UV map (marked vertices and triangles in yellow to clarify, the lines and points are not actually part of the texture).

(As you can see, The cuboid has 14 vertices
Now, I want to display the the pixels discrete. That means: Don't smooth the pixels. Doing this I got visual issues seen in the screenshot below. This is a screenshot of the edge, where the two triangles meet.

(When I use smoothed pixels by using a linear filter when creating the sampler Description there are no real gaps, but the edges of the plane are influenced by the color that would have been the gap)
As you can see, there is a gap between polygons. The corresponding spot on the uv map is marked in red on the top picture. This behaviour is observable at every spot two polygons, that are not adjacent on the UV map, meet. Also note how the gap is partly filled with orange/pink, the color that is adjacent to the polygon on the UV map (Pixels of other meshes, in this case the right arm).
Steps I took to find a solution:

First I thought it could be caused by float inaccuracies. Moving every Vertex a little bit (the minimum a float can encode) to the inside of the UV-Map would probably solve the issues. But I think that this would be one hell of a workaround and can't be the solution.
Changed the texture to be 16x16 (instead of 13x12) because I thought this would decrease the inaccuracies with float, but it didn't help much.
I thought changing the filtering to something different could help, but I wasn't lucky.
I even tried modifying the uv coordinates inside the Pixel Shader, but this was doomed to fail and resulted in some weird (but in some way funny) results.
Googled around with various keyword, but couldn't find anything that appeared to solve this issue.
When I tested drawing it as a wireframe the edge was drawn in orange/pink

I'm probably missing the obvious here, but how can I fix this and get rid of the gaps?
I triple checked that all vertex data (x|y|z and u|v) are correct. Is there any kind of filter I am missing? Or do I even have to use some nasty workaround (like surrounding the actual texture on the uv map with an extra row of correctly colored pixels)? I would like to resolve this before going on.
Thanks in advance to anyone taking the time to read (and even answer or point me in the right direction) this presumably stupid question.
In case it's relevant here is the data for the 4 involved vertices(numbering as depicted above). First Vector is x|y|z, second one u|v:
vertices[ 0] = { { -1, -1.5f, .5f },{  9.f / 16.f, 5.f / 16.f }};
vertices[ 1] = { {  1, -1.5f, .5f },{ 11.f / 16.f, 5.f / 16.f }};

vertices[11] = { { -1, -1.5f, .5f },{  8.f / 16.f, 4.f / 16.f }};
vertices[12] = { {  1, -1.5f, .5f },{  6.f / 16.f, 4.f / 16.f }};

(A screenshot of the complete model in case the look of the whole thing wasn't clear. There are also fragments visible at the head and the top of the arm. )

sentences:
3D collision detection with meshes using only raycasting? I'm building a game using WebGL and Three.js, and so far I have a terrain with a guy walking on it. I simply cast a ray downwards to know the terrain height.

How can I do this for other 3D objects, like the inside of a house? Is this possible by casting many rays in every direction of the player?

If not, I would like to know how I can achieve the simplest collision detection possible for other meshes. Do you have to cast a ray to every triangle in every mesh nearby?

sentences:
Information about rendering, batches, the graphical card, performance etc. + XNA? I know the title is a bit vague but it's hard to describe what I'm really looking for, but here goes.

When it comes to CPU rendering, performance is mostly easy to estimate and straightforward, but when it comes to the GPU due to my lack of technical background information, I'm clueless. I'm using XNA so it'd be nice if theory could be related to that.

So what I actually wanna know is, what happens when and where (CPU/GPU) when you do specific draw actions? What is a batch? What influence do effects, projections etc have? Is data persisted on the graphics card or is it transferred over every step? When there's talk about bandwidth, are you talking about a graphics card internal bandwidth, or the pipeline from CPU to GPU?
Note: I'm not actually looking for information on how the drawing process happens, that's the GPU's business, I'm interested on all the overhead that precedes that.

I'd like to understand what's going on when I do action X, to adapt my architectures and practices to that.

Any articles (possibly with code examples), information, links, tutorials that give more insight in how to write better games are very much appreciated. Thanks :)

sentences:
XNA/MonoGame RenderTargets not working I'm having a problem with drawing 2 RenderTargets to the screen.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

namespace Please
{
    class Class1
    {
        RenderTarget2D rt;
        Texture2D temp;
        Vector2 v;
        public Class1(Vector2 v,GraphicsDevice g)
        {
            this.v = v;
            rt=new RenderTarget2D(g,800,600);
        }

        public void Draw(SpriteBatch sb,GraphicsDevice gd,ContentManager cm)
        {
            gd.SetRenderTarget(rt);
            sb.Begin();
            sb.Draw(cm.Load<Texture2D>("Untitled.png"),v,Color.White);
            sb.End();
            gd.SetRenderTarget(null);

            temp = (Texture2D)rt;

            sb.Begin();
            sb.Draw(temp, Vector2.Zero, Color.White);
            sb.End();
        }
    }
}

Here's my draw function in the actual "game"

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);
    base.Draw(gameTime);
    one.Draw(spriteBatch, graphics.GraphicsDevice, Content);
    two.Draw(spriteBatch, graphics.GraphicsDevice, Content);
}

one and two have positions (100,200) and (300,200) respectively, so, they should be drawn 100 pixels apart, however, only two is being drawn with the rest of the screen black

sentences:
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:
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:
Instantiated object not tracking collision I have an issue, and I'm not sure why it's happening. I have a prefab that I've built in a colour-changing game. It has the following:

Four 2D objects that if they collide with the player (2D collider attached to all), they cause the player to die.
One 2D object that if the player strikes, it generates a duplicate of itself with the Instantiate function.

All 2D objects are created; The four objects that cause the player to die are being created as normal and continue to cause the player to die. However, the object that instantiates the prefab and increments the score can no longer be collided with. The player appears to pass behind it. I'm pasting my code below. I would really appreciate if anyone can offer advice on this:

void Update () {
    if (Input.GetButtonDown("Jump") || Input.GetMouseButtonDown(0))
    {
        thing.velocity = Vector2.up * bounciness;
    }
    scoreText.text = score.ToString();
}
private void OnTriggerEnter2D(Collider2D collision)
{

    if (collision.tag == "plusScore")
    {
        score++;
        Destroy(collision.gameObject);
        Instantiate(barrier, new Vector2(transform.position.x, transform.position.y + 7f), transform.rotation);
        return;
    }

    if(collision.tag != currentColour)
    {
        Debug.Log("You DIED!");
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        score = 0;
    }
}

sentences:
How can I standardize ping? I hear pros playing Fortnite that have 20-50 ping complain that they cannot perform as well as pros with 0 ping due to wall taking, etc. It's easy to think that a 20ms ping difference is negligible but it is not in competitive situations.

It seems to me that it should be possible to standardize a lobby's ping to the current maximum player's ping at any given moment. Obviously in a competitive game like Fortnite, the worst ping a pro player can have is generally 50-60 ping.

This solution would involve psuedo latency. For example, in competitive Fortnite, if the worst ping among the players is 50, then all players will be forced to also have 50 ping by inducing an artificial server response delay. This would allow no single player to have an advantage based on internet connection.

How could I implement a feature like this, to provide a level playing field?

sentences:
How do I correctly shift arrays on a Tetris line clear? I'm writing a Tetris clone in C++ and I am at the last stage, I need to delete a row when it is full. Once a piece falls it is stored in a boolean array grid[20][10]. For example I check which row is full (or true), if so I call a method deleteRow, where n is a number of row:

void Grid::deleteRow(int n)
{
  for (j = 0; j < WIDTH; j++)
   {
     grid[n][j] = false;
   }
}

Once the row is deleted I call moveRowDown:

void Grid::moveRowDown()
{
  for (i = 0; i < HEIGHT; i++)
   {
    for (j = 0; j < WIDTH; j++)
     {
       grid[i+1][j]=grid[i][j];
     }
  }
}

This does not work, and all of the pieces disappear. What logic am I missing?

sentences:
Heightmap Physics Optimization/Improvement I'm working on implementing the physics surrounding a player walking on a heightmap. A heightmap is a grid of points which are evenly spaced on the x and z axes, with varying heights. The physical representation of my player (what is exposed to my physics engine/manager) is simply a point-mass where his feet are, rather than complicating the problem by treating him as a sphere or a box.

This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex that has some height.

Feel free to move this over to math, physics, or stack overflow, but I'm pretty sure this is where it belongs as it is a programming question related to games.

Here's my current algorithm:

Calculate the player's velocity from input/gravity/previous velocity/etc
Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame)
Figure out which triangle (all graphics is done in triangles!) of my heightmap the player's new position is vertically aligned with
Use the three vertices of that triangle to calculate the equation for the plane which that triangle lies in
Plug in the player's x and z coordinates into the plane's equation to get the y coordinate for the player's position on that plane
Set the y coordinate of the player's position to this (if newPos.y < y)

This is all fine and dandy, but I'm wondering if there's anything that I can optimize. For example, my first thought is to store the plane's equation with the triangle's vertex information. This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes.

Is there a faster way to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics engines go)

sentences:
3ds envelope underlap? I'm rigging up a man in 3DS Max 2012, but I'm having some envelope problems. I have this man, but I can't ever seem to catch those nodes along his inner thigh so they protrude, as you can see in the picture.

I've tried adjusting the numbers in Radial Scale, Parent Overlap, Child Overlap, Strength, and Falloff, and even the Exclude command to exclude the other limb but all with no success.

How can I somehow make these stray thigh vertexes conform into their thigh envelope?

sentences:
Time-passed check with Pause functionality I am working on a game that has a lot of time-passed checks of the following format. These work great, but there is a problem when the game is paused:

If paused for any meaningful amount of time, the if statement will become true.

const t = new Date().getTime(); // Get the current time (in ms)
const fireCooldown = 500; // The time to wait before firing again (in ms)

if(t > lastFireTime + fireCooldown) {
   lastFireTime = t;
   fire();
}

How can I integrate pause functionality into this - in a way where pausing does not make the if statement true?

sentences: Unity, shader, vertexID I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is something I can use.

sentences:
How to maintain char widths of non-monospace fonts? Having a font via spritesheet (as PNG), the easiest way to render fonts from that is just showing chars as monospace, but as you can imagine, that looks not pretty with chars like l, i, : and so on..

Is there a slick way to maintain the width of every char?

I already thought of storing it into an extra file, telling the width of each char in pixels.

Pro: Fast rendering.
Con: That's one load of work for about 100 chars.

I gave "counting" the pixel-width of each char on rendering it a thought.

Pro: Once that algorithm does it's job there's no work with that afterwards.
Con: As there is pretty much font-rendering going on each frame, this is plain bullshit - performancewise.

I'm open to suggestions and/or known algorithms for this problem.

EDIT: TTF or some other real font is not an option, because they render wayy to pixelated on the small sizes needed.

EDIT: Thanks to lorenzo-gatti, made simple marker-pixels in the spritesheet like so:

Distance between these gets counted on startup of the game and the markers are replaced with transparent pixels. So no heavy additional logic in render which would slow down and startup-time is not really slower than before, thanks!

sentences: Do I need to copyright my game before releasing it on the Android Play store? I am developing a game on Android and I was wondering if I have to copyright it before putting it on the store (so no one can steal the idea)?

sentences:
How do I sort with both depth and y-axis in OpenGL? Continuing my misadventures in pyOpenGL, I've refactored the whole thing to use 4 buffers:

tile vertices - all drawn at the start, probably never modified
tile texture co-ords - not modified often (but enables support for animated tiles later)
sprite vertices - modified often as sprites move around the map
sprite texture co-ords - modified often as sprites animate

My draw loop binds each buffer, and calls drawArrays() twice. I have enabled depth testing, and clear the depth buffer on each draw:

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH)
...
glDepthFunc(GL_LESS)
glEnable(GL_DEPTH_TEST)
...
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

For the moment, I've hard-coded the z coordinate for each of the things I'm drawing, just to be sure they're definitely in the right order - grass tiles are at 0.9, the tree (4 tiles) is set to -1.0 and the sprites are at 0.0. This is what I get:

In a previous attempt to build this engine without openGL, I was using Tkinter canvas images, which ended up very slow. To get the draw order right, I had to sort all the objects by their y-coordinate plus their z-coordinate, because it is all on a 2D plane. I want something similar, here. I don't understand why the grass tiles cause this problem, when they should be drawn right at the back. GL_DEPTH_TEST is definitely enabled - if I disable it by commenting out the glEnable() call, the sprites are drawn on top of everything (including on top of the trees). I want an illusion of depth by being able to walk behind high-sticking-up objects.

I've continued hacking away at this, and I've gotten a little further by modifying my shader:

fragment_shader = shaders.compileShader("""
    uniform sampler2D u_image;

    varying vec2 v_texCoords;

    void main()
    {
        vec4 tex = texture2D(u_image, v_texCoords);
        if(tex.a < 1.0)
          discard;
        gl_FragColor = tex; //texture2D(u_image, v_texCoords);
    }
""", GL_FRAGMENT_SHADER)

By checking for transparent pixels and throwing them away, I get a lot closer to my goal, however it is still not quite right, and I do not know how to fix it.

The wizard is at z:-0.5, and the tree trunk is at z:-0.2; it is doing what I'm telling it to do, just not what I want it to do. If I put them on the same z-level, the trunk is drawn over the wizard when he stands in front of the tree, and correctly when he stands behind it:

I don't just want depth sorting, I also want to sort on the y-axis. How can I do this in OpenGL?

sentences:
Invoking a common method after a button press I want to implement a common method that handles several numeric values and performs and action based on those values. So I have buttons with specific methods to change this values without affecting the rest. However I want to link them all to a final method that runs right after the press of a button, so this way the game will change only when the player chooses to change it and changes according to the players decisions. How can I implement this in my script?
Most of my methods are like this:

public void "ButtonIDGoesHere" (int "SpecificVariable"){
//Add, Sub, Multiply, etc.

}

What can I add so that it goes to a common method right after it executes its instructions?

sentences:
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: What middle tier and backend libraries exist for handling player matching and out of game information? Are there any libraries or frameworks readily available that handle player metrics, rankings, matching, tournaments, etc? Anything for managing the player community? (Please don't say DotNetNuke)

sentences:
C# - Network flooding I just created a simple MMO in unity3d, then me and my friends test it via LAN and the result is very smooth. But when I hosted it in public (100ms ping) the server became unresponsive and causes random disconnection.

Host Setup
- 1gbps
- 32gb ram
- 256 ssd
- off firewall

Server Setup
- max of 100 players
- every 100ms update
- no other updates, just only X and Y location of player by index
- c# sockets w/ async

Server Flow
- when 100ms tick reaches, server sends position of player base on index in a loop.

ex.

if (gtick >= 0.1f) {
    for (x < maxPlayers; x++) {

        // check ifs
        //couples of ifs here...

        // send
        sendToWorld(x ... player[x].posX ... player[x].posY);
    }

    // somewhere, gtick = 0, then counts up again...

}

then the result is delay, unresponsive, and random disconnection.
maybe it flooding itself, I don't know. but when we test it locally (10+ players), it is very smooth and no problem at all.

My question is, How can I update all players every 0.1 without server flooding itself?

sentences:
Is it a terrible practice to NOT initialize an object in its constructor? I'm currently working on my own game engine, more precisely on the resources management part.

For now, most of my assets inherits of the following - simplified - class:

class   Asset
{
public:
    Asset(const char* file);
    virtual ~Asset();

    virtual void    load() = 0;
    virtual void    unload() = 0;
}

As you can guess, the constructor and destructor do almost nothing, while load and unload functions respectively initialize and delete all asset's data.

I'm doing it because I don't want to load a file each time I create an asset object, but instead do it on a method of my AssetsManager that would load everything needed.
But I still want to be able to prepare other objects using these unloaded assets. For instance, an unloaded texture can be set on a mesh material. This material just won't be able to be rendered if the texture is not loaded.

The problem is, I heard this is a terrible way to code a class structure, especially from programmers supporting the RAII idiom.

Is it a correct way to handle assets? If not, what would be better for this class?

sentences:
2D Tile Movement in Java I have this tilemap and a player in my game, and I got the player to move by adding the velocity to the position. However, it is very hard to control the player exact this way of the tilemap. So, I began trying to do something like the old final fantasy games did (and a heap of other games too): moving tile by tile, but making it look smooth.

However, I failed. So, if anyone have any idea of what the best way to make the player move tile by tile is, then shout out. If you have played final fantasy V for example, then that's the kind of movement I want to try to implement in my game.

To explain it a bit further; each tile in  my game is 16x16, so is the player. I don't want the player to "jump" between the tiles, but I want it so that say, if you press "A", then move the player to the tile to the left in a smooth way.

I tried something like this:

    private Vector posA;
private Vector posB;
private double time = 0.6 / 60;
private void move(Direction dir) {
    if (!moving) {
        //Initialize Movement
        posA = new Vector(position);
        posB = new Vector(position);

        switch (dir) {
        case UP:
            posB.subtract(0, 16);
            break;
        case DOWN:
            posB.add(0, 16);
            break;
        case LEFT:
            posB.subtract(16, 0);
            break;
        case RIGHT:
            posB.add(16, 0);
            break;
        }

        moving = true;
    }

    //Update Position
    if (moving) {
        Vector v = new Vector();
        v.set((posA.x + (posB.x - posA.x) * time), (posA.y + (posB.y - posA.y) * time));

        //Set  Position
        position.add(v);

        if (position.x >= posB.x && position.y >= posB.y) {
            position.set(posB);
            moving = false;
            System.out.println("DONE MOVING!!!");
            posB = null;
            posA = null;
        }
    }

}

sentences:
How is this glowing with colors radiating outward 2D effect accomplished? I'm currently totally at a loss as to how this effect is done:
http://www.youtube.com/watch?v=zp8MHUNp7Cg

The glowing on the ship and the changing color. I want to do this effect in XNA 4.0 any hints and tips?

sentences:
How do I roll a ball with a Rigidbody? I have a ball in a game that rolls around just fine with Rigidbody.AddForce().  I have other non-physics balls, however, that I control directly with Rigidbody.MovePosition().

It seems that no matter what I do, no matter how interpolation and collision detection are set, the ball does not "roll" when moved with Rigidbody.MovePosition(). It teleports, but IsKinematic is not set , as instructed by the documentation.

How do I get the ball to roll properly with Rigidbody.MovePosition()? Alternatively, if that's not possible, how do I calculate the rotations manually?

sentences:
How 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:
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:
How are imaginary numbers useful in video game creation? I learned about imaginary numbers in school and they seemed so impractical, so I asked my teacher what they were used for and he said "video game creation".

I just want to know if this is true and if so how is it used during the creation process.

sentences:
Textures go black when changing Quality Settings at runtime Whenever I change my Quality Settings at runtime in editor mode or in build, all of my textures turn black. I use the following line to change the quality settings :

QualitySettings.SetQualityLevel(value, true);

I have tried to set the boolean at false and it does the same result. I am using HDRP and the shader "HDRenderPipeline/Lit" on pretty much all of my materials. There is an interesting fact, in editor mode, I just hover my mouse on any material inspector window, it updates all of my textures back to normal and solves the problem.
Here is a screen showing the textures (left is normal, and right is bugged):

Any idea ? Thanks.

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:
Power-up spawns 2-3 times after a restart, but enemies spawn normally I have two spawning objects that use the same behaviour. They are being called in the same function and in the same situations. The only difference is the variable of time that classifies what's an enemy and what's a power up.
The spawning of enemy objects is working fine: no matter how many times I restart the game, the behaviour is the same. But with the power up spawning object, it spawns the right way sometimes, but in other times it spawns like 2 or 3 times in the same place. This only happens when I restart the game.
How can I fix this bug?
I'm not fluent in english.
File 1:
public float enemySpawnSeconds = 2.5f;
public float powerUpSpawnSeconds = 6f;

public void Start()
{
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
}

private void Update()
{
    GameSpeed();
}

public void StartSpawnObjects()
{
    StartCoroutine(SpawnPowerUps());
    StartCoroutine(SpawnEnemies());
}

public IEnumerator SpawnEnemies()
{
    yield return new WaitForSeconds(2f);
    while (gameManager.startGame == false && gameManager.gameOver == false)
    {
        Instantiate(enemies[Random.Range(0, 2)], transform.position = new Vector3(9.8f, yPosition[Random.Range(0, 2)]), Quaternion.identity);
        yield return new WaitForSeconds(enemySpawnSeconds);
    }
}

public IEnumerator SpawnPowerUps()
{
    yield return new WaitForSeconds(2f);
    while (gameManager.startGame == false && gameManager.gameOver == false)
    {
        yield return new WaitForSeconds(powerUpSpawnSeconds);
        Instantiate(powerups[Random.Range(0, 3)], transform.position = new Vector3(11.1f, yPosition[Random.Range(0, 2)]), Quaternion.identity);
    }
}

File 2:
void Update()
{
    spawnPlayer();
    gameTimer();
    restartGame();
}

public void spawnPlayer()
{
    if (startGame == true) //starting the game
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Instantiate(player, player.transform.position, Quaternion.identity);
            spawned = true;
            startGame = false;
            uiManager.HideTitleScreen();
            spawnManager.StartSpawnObjects();
        }
    }
}

public void gameTimer()
{
    if (startGame == false)
    {
        timer += 0.0165447f; // game time
    }
}

public void restartGame()
{
    if (gameOver == true) // restarting the game
    {
        timer = 0f;
        spawnManager.enemySpawnSeconds = 2.5f;
        if (Input.GetKeyDown(KeyCode.Space) && uiManager.restart == true)
        {
            gameOver = false;
            uiManager.HideTitleScreen();
            spawnManager.StartSpawnObjects();
        }
    }
}

sentences:
How would I implement an endless road the player runs down? I want to create the illusion that a man is running down a long road i.e. this pic

http://camlinecambridgelimited.web.officelive.com/images/road%20graphic1.jpg

If you have played Temple Run on the iPhone, it's the same principle, but instead of a temple it's a normal road.

I want to know how this is implemented. For example, do I just repeat this road image in a loop?

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: If I own the rights to a third party game on a defunct console, can I republish it without the permissions of the console manufacturer? Suppose I owned the rights to a third party game published on the NES. Could I make a ROM of it and sell the emulated version?

sentences:
Equalling the rotation of an image with its object. Box2dweb I have some hard time making the rotation of an image equal to the rotation object that the image belongs to. Simply put it, I don't know how to do it properly but i am not asking for a how-to guide but for some tips/hint and/or infos that i am not aware of...

I was able to align perfectly the image with the object, and so if the object moves in a linear fashion the image is at all times on top of the object and everything is smooth and perfect.
But how is it possible to make the rotation of the image be the same as of the object it belongs to.

No-matter what i tried it is always somewhat off or the rotation of the image behaves weird when in the end the object stops rotating. I tried using using GetAngle(), GetAngularVelocity(), combinations of both, but never succeeded.

function Draw_and_Rotate(){
   for (b = world.GetBodyList() ; b; b = b.GetNext()){
      var angle = ((b.GetAngle()*180)/(Math.PI))/SCALE;
      var angle_vel = ((b.GetAngularVelocity()*180)/(Math.PI))/SCALE;
      var pos = b.GetPosition();
      console.log((angle));
      if (b.GetUserData() == "bo_img"){
         ctx.save();//save the ctx state prior changing it.This method pushes the current state onto the stack.
         ctx.translate(pos.x*SCALE , pos.y*SCALE );
         ctx.rotate(angle);
         ctx.drawImage(box_img, - (box_img.width / 2), - (box_img.height / 2));
         ctx.restore();//restoring ctx state.This method pops the TOP state on the stack, restoring the context to that state.
      }

   }
}

this is the part that deals only with one body and its image. If someone needs some more clarification please ask....

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:
How can I calculate force and acceleration? I have problem of calculating the movement of the object.

At the moment, I have a vectors calculated from the center of the screen minus the position of the object.

direction vector = centerScreen - positionObject

To calculate the new position of the object

position(new) = position(t) + directionVector * delta

The delta is the time frame rate.

Does anyone know how can I modify the above formula to calculate forces and acceleration? I want to have an object pulling other objects towards it.

sentences:
how to slide pieces for a slide puzzle game for android(libgdx) I want to make a small one-screen game in which the player has to slide pieces of an image until the image is completed. I used texture regions to create the pieces from an image

int numOfTiles_Horizontal = 5;
int numOfTiles_Vertical = 5;

float tile_width = img.getWidth() / numOfTiles_Horizontal;
float tile_height = img.getHeight() / numOfTiles_Vertical;

TextureRegion[][] tiles = new TextureRegion[numOfTiles_Horizontal][numOfTiles_Vertical];
for(int col = 0; col < numOfTiles_Horizontal; col++) {
    for(int row = 0; row < numOfTiles_Vertical; row++){
        tiles[col][row] = new TextureRegion(img, col * tile_width, row * tile_height, tile_width, tile_height);
    }
}

, but I'm unsure about how to allow the player to move the tiles into a blank space as well as making a "blank space" to allow tiles to move.

The game would look like this:

I followed some tutorials for libgdx but cannot find much on achieving this.

I am new to the engine and Android development so any help is appreciated.

sentences:
HLSL DXGI_FORMAT_A8_UNORM Texture - dark colors appear less opaque than white I am trying to render a DXGI_FORMAT_A8_UNORM texture (precisely, a font bitmap) in multiple colors by specifying the color per vertex and then apply the alpha value from the sampled texture in the pixel shader. When white is specified as the vertex color, the rendered texture looks as expected, however with darker colors the texture looks "thinned" or less opaque, as displayed in the attached picture.
These are the used shaders, with fontSampler using D3D11_FILTER_MIN_MAG_MIP_POINT as filter:

Texture2D shaderTexture : register(t0);
SamplerState fontSampler : register(s0);

struct VS_INPUT
{
    float2 pos : POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

struct VS_OUTPUT
{
    float4 pos : SV_POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

VS_OUTPUT VS(VS_INPUT input)
{
    VS_OUTPUT output;
    output.pos = mul(projection, float4(input.pos.xy, 0.f, 1.f));
    output.col = input.col;
    output.tex = input.tex;
    return output;
}

float4 PS(VS_OUTPUT input) : SV_TARGET
{
    input.col.a = shaderTexture.Sample(fontSampler, input.tex).a;
    return input.col;
}

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:
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:
How can I prevent pixel artifacts on programatically generated textures? In the game I'm developing, rooms can be of various sizes, which means I need to vary the size of the floor texture appropriately.

The way I've solved this problem is to generate a Texture2D programatically, and set each pixel to be transparent (or not) as appropriate appropriately.

I get something like this:

Where, if you look at the top left, you'll clearly see the pixel artifacts from the floor texture against the dark blue background.

When I run into this with static textures, the fix is simple. Set the Texture's wrapmode to clamp instead of repeat. But when I try to do that programatically... (and change nothing else!) I get this:

I'm not quite sure what's happening, or why setting the wrapMode changes the results so markedly. Anyway I can avoid the pixel artifacts? I suppose it's possible to add an extra border around the generated texture (so that all edges can be transparent), but that doesn't seem a particularly clean solution.

Code is here:

void DebugFloorTextureMerge()
    {

        //sizeVector makes up the rectangle circumscribing the room's parallelagram
        Vector2 sizeVector = new Vector2(roomBounds.topRight.x - roomBounds.bottomLeft.x, roomBounds.topLeft.y - roomBounds.bottomLeft.y);

        //get the texture of the filled sprite
        Texture2D patternTexture = (Texture2D) floorTexture.image;

        //make a new texture of the size of the room.
        Texture2D fillTexture = new Texture2D( (int) sizeVector.x, (int) sizeVector.y, TextureFormat.ARGB32, false);

            //COMMENTING THIS LINE OUT MAKES THE TEXTURE WORK WITH ARTIFACTS
        fillTexture.wrapMode = TextureWrapMode.Clamp;
            //LEAVING IT IN MAKES THE FOLLOWING CODE WORTHLESS

        int patternX = 0, patternY = 0;

        Vector2 pointVector;
        Color transparent = new Color(0,0,0,0);

        for(int x = 0; x < sizeVector.x; x++)
        {
            for(int y = 0; y < sizeVector.y; y++)
            {
                pointVector = new Vector2(x,y);
                if(roomBounds.Contains(pointVector))
                {
                    //get the next pixel
                    fillTexture.SetPixel(x,y, patternTexture.GetPixel(patternX, patternY));
                }
                else
                {
                //pixel was not in the room, so set it to transparent.
                    fillTexture.SetPixel(x,y, transparent);
                    //resultx = x; resulty = y;

                }

                //increment the pattern counter and reset if necessary.

                //if you only increment this when Contains is true, you'll warp the texture
                patternY++;
                if(patternY >= floorTexture.fillSize.y) patternY = 0;
            }

            //increment the pattern counter and reset if necessary.
            //also reset y, so the pattern will line up properly.
            patternY = 0;
            patternX++;
            if(patternX >= floorTexture.fillSize.x) patternX = 0;
        }

        //set the PixelChanges.
        fillTexture.Apply();
    }

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 can I access LWJGL's Keyboard from a thread other than the graphics thread? I'm loving LWJGL, but have been running into a number of odd problems with it. Most of it seems to deal with the fact that OpenGL is a state-machine and was only ever meant to be accessed from a singular thread.

However, I'm dealing with OpenAL and input as well, and they are both bound pretty tightly into LWJGL. In spite of the fact that they are entirely independent of graphics, I have been getting an IllegalStateException every time I try to access Keyboard.isKeyDown outside of the graphics thread. It's hard to emphasize how important it is to me that I have a new thread for each feature of this project; the classic game loop will not do the job.

How do I accomplish this? There must be a way.

sentences:
How can I diminish my voxel terrain's height smoothly instead of randomly? I have a script that is supposed to diminish height smoothly when an int is lowered, I tried perlin noise to make it lower like it would if it where terrain, which is the goal I'm after, but it only does removes entire layers.

public float heightIndex;
private height Height;

public void Start()
{
    Height = FindObjectOfType<height>();
    //the failed perlin test
    //heightIndex = transform.position.y + Mathf.PerlinNoise(heightIndex, heightIndex);
    heightIndex = transform.position.y + Random.Range(3, 10);
}
public void Update()
{
    if (Height.heightdetermine<heightIndex)
    {
        Destroy(gameObject);
    }
}

Thank you @DMGregory for fixing my dyslexic mess and bad grammar.

sentences:
How can I prevent/balance waiting and turtling as a response to cooldown mechanics I'm working on a turn-based RPG with classes. I want one of the spellcaster classes to have standard magic points, but another to have abilities with time limitations, one or more of

Use ability every N minutes of real time
Use ability every N turns of combat
Use ability once or N times per day (sleep to restore, or wait out day-night cycle)

There would be restorative items that could restore your "charge". These abilities would be more powerful than regular spells but constrained. This spellcasting class is a burster: gives you big hits but infrequently because of the limitations. The party carries them along as baggage until they get in a jam or run into a boss, then unleashes the hammer. I like it as an option to add depth, and it has interesting speedrun possibilities.

The last one is easy enough to balance if the party has to trek back to town and sleep to recharge, but I have a day-night cycle. Here are the problems as I see it:

Real time / N times per day

Player can just wait. I can make the duration punishing, but then it greatly reduces the utility. It also means that the player is not playing the game, this is after all supposed to be about entertainment. No fun.

Every N turns in combat

Player can just have every character defend/heal every round until the burster unleashes another round of big damage. I actually want this to be viable, but I don't want it to become the obviously best strategy for battles. So far it doesn't seem to be a huge issue as the caster just cycles through lesser powers until the big bang recharges. It's rough in the early game, but that's part of the balancing. The problem is that I'm having trouble getting it to be not so OP'd as to be obviously the best while still remaining good enough to be useful.

Any suggestion on how to balance these mechanics to mitigate camping/turtling?

sentences:
How do I import 2d character assets in unity? I recently downloaded a 2d platform assets that came with a player model. The character came in a lot of pieces like an image of eye, another for torso, etc. How do I go about making these images an actual character. The asset also came with a few animations like blinking, jumping, etc. How do I apply these?
I'm new to unity and game development(started about a few days ago) so please help even if this may sound like a really dumb question.

I use Unity BTW if it changes what the answer would be.

Link to asset:  https://assetstore.unity.com/packages/2d/environments/free-platform-game-assets-85838

sentences:
Can I remove Unreal Engine Splash Screen and put my own? In Unity, I can change the splash screen if I buy the Pro version.

Can I do the same with Unreal?

sentences:
What's the most efficient way to find the intersection point of a missile and a bitmap terrain? Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if any pixels under the missile intersect terrain, but say it has moved quite deep into the terrain.

What is the best way to step back to find where it initially collided? I could move back X pixels at a time towards the missile's previous position, but what would be a good value of X? And is there a smarter way? Maybe moving half the distance, then a quarter etc?

sentences:
Normalizing a homogeneous 3d point As I've seen corruption in geometry, why is it a bad idea to normalize a homogeneous (divide by w) the vertex position returned from vertex shader?

Update

Vertex shader:

// float4 pos : SV_POSITION;
output.pos = mul( mvpMatrix, float4(input.pos, 1) );
output.pos /= output.pos.w; // this line causes the visual corruption below

Three images as I move to the right of a sphere in wireframe. As I get closer the geometry starts corrupting. It seems the geometry immediately around the camera gets the most corrupt.

sentences:
What makes a good educational game? I'm currently creating a game framework/engine for educational games. My hope is that this can be used in elementary schools. It is of course extremely important that the games are both fun and educational.

Any ideas what should be in my initial requirement specification?

What makes a good educational game?

Which platforms should I target?

sentences:
How do I create 2D water with dynamic waves? New Super Mario Bros has really cool 2D water that I'd like to learn how to create.

Here's a video showing it. An illustrative part:

Things hitting the water create waves. There are also constant "background" waves. You can get a good look at the constant waves just after 00:50 in the video, when the camera isn't moving.

I assume the splash effects work as in the first part of this tutorial.

However, in NSMB the water also has constant waves on the surface, and the splashes look very different. Another difference is that in the tutorial, if you create a splash, it first creates a deep "hole" in the water at the origin of the splash. In new super mario bros this hole is absent or much smaller. I am referring to the splashes that the player creates when jumping in and out of the water.

How do I create a water surface with constant waves and splashes?

I am programming in XNA. I've tried this myself, but I couldn't really get the background sine waves to work well together with the dynamic waves.

I am not asking how the developers of New Super Mario Bros did this exactly—just interested in how to recreate an effect like it.

sentences:
Physics-perfect (or somewhere near) 3d sound engine I'm new to game programming, although I have some years of experience in console/web development. My problem is not so much that I can't find what I'm looking for, it's just that I don't have the terminology to actually perform a successful search.

I am looking for a physics engine which has great focus on sounds. In fact, I do not care at all for anything else. What I mean is better explained by an example:

Suppose a 1st person type game. You are facing North, and someone somewhere around you throws a flute at you (nevermind the absurdity of the situation). The flute spins while it is on its way, making sounds through its holes. There is a wind of say, 5 knots South.

I imagine a physics engine will be capable of calculating the trajectory of the flute, as well as the direction it takes after it hits. What I want is for the physics engine to calculate the precise sounds it will make, from any listener's perspective.

Does any such engine exists? If there are several, which one would be best for the example above?

sentences: Is it sensible to make all physics on GPU using transform feedback? I'm learning OpenGL and today I read something new to me. It's called transform feedback, and if I understand right, it can help to get information about vertex shader variables. And I read an example where a particle system was created, with collisions. After reading it I have a question: Is it sensible to make all physics like this, i.e. is there any kind of profit from this?

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:
Pathfinding With Speed Based Turning Restrictions I have been working on a path finding project and I’m a bit stuck at the moment. I have an object that can increase or decrease speed, but the faster it moves the larger it’s turn radius is - so a car basically. I’ve implemented A* with a smoothing algorithm to generate waypoints for the object, however, as you might guess, it doesn’t take into account anything with speed and such. Currently, I’m moving the object at a set speed along it’s forward vector and at each waypoint lerp the direction to the next waypoint.

Is there a method - or a place to start looking - to implement a system to find the best route that’s possible by slowing or taking larger turns? At this point I’d even settle for a way to tell the object exactly how much it needs to slow down for each turn. Thanks for any help!

sentences:
Scene with Node graph thread safe, with important efficeny I will try to be as explicit as I can, and I apologize for my grammar...

I am working on a game engine (specifically on the Render part) and I am facing some conception choice that will involve a lot of code and I would like to do the good one on first try. I am actually working on the Scene graph. I have to specify, that the engine have to be thread safe, and c++11/14 compliant while limiting the user mistake (not allowing engine user moving a pointer that shouldn't be moved...).
So my issue is that I do not know how to give the access too engine user and keep the thread safety without killing performance with 10000 of cache misses or if it is needed to be able to search for a specific Node (when you build the tree don't you know wich Node  you will use?).

Actually I started with a tree of Node something very standar

Each Node know all of its child and they know their parents.
For efficiency purpose every Node who will contain meshes, with associated texture will stock them in a Scene object who will old a pointer on every Node who hold a mesh (for querying the scene transformation matrix of the mesh). The scene will also hold the root Node of the scene.

My question is How should I handle the link between A Node and its family?

One of the solution I thinked about is to use the Observer design pattern.
Use shared_ptr between Node and it's family then only provide NodeObserver to the engine user. But with this solution I don't know how to link the scene ressource holding to the nodes because a shared_ptr will introduce unbreakable cycle and a wear_ptr will introduce to much cache_miss and to much synchronization (at least a lock on every Node every frame...) I could use a naked pointer stored into the Scene object, and at the end of its life Node destructor should removeit from the Scene?

I will be very happy if anyone know how to do that.
Thank you in advance for your time and your help.

sentences:
2d block based game storing water simulation I am making a 2d block based sandbox game like terraria.

I'm trying to think where is the better place to store water in, data structure wise.

That is, to store it in the block world array, or to store it in its own sparse data structure. Does doing this have any benefits?

If I store it in the world array I have to store the fluid level (which would be like 16 levels possible). The other way I could simply have a fluid cell struct or something.

It might make things more clear separating it, but not sure if it would possibly affect performance either way.

In a game like this, the simulation is of course usually done via cellular automata (just in case that affects which data structuring I should use)

sentences:
CPU - GPU memory data flow I'm a newbie graphics programmer and I've been wondering recently - how does model data (meshes and materials) flow from application (CPU memory) to graphics card (GPU memory?)? Say I have a static model (e.g. a building) that I load and setup once and don't change throughout the app lifespan.

Does its data get sent to GPU memory only once and sit there forever?
When the model gets actually rendered each frame do GPU processors have to fetch its data each time from GPU memory? What I mean is - if I had 2 models rendered multiple times each - would it matter if I first rendered the first one multiple times and then the second one multiple times or if I rendered the first one just once, the second one just once and kept interleaving it like that? I could call this question "internal GPU data flow" in this sense.
Obviously graphics cards have limited RAM - when it can't hold all the model data necessary for rendering 1 frame I guess it keeps fetching (some of) it from CPU RAM each frame, is that correct?

I know there's a lot of books and stuff about this on the internet but maybe you have some quick general guidelines as to how to manage this data flow (when to send what and how much, when and how to render)?

Edit:
I forgot to make one distinction: there's sending the data to the GPU and there's setting/binding the buffers as current. Does the latter cause any data flow?

Edit2:
After reading Raxvan's post I'd like to distinct a few actions:

buffer creation with initialisation (as he said I can store the data in either CPU ram or GPU one)
buffer data update (which I believe is straightforward when the data is kept in CPU ram and requires fetching from GPU to CPU ram (and then back) when it's kept in GPU ram)
binding the buffer as active (is it just a way to tell the API that I want this buffer to be rendered in the next draw call and it doesn't do anything by itself?)
API draw call (here I'd like to hear from you what actually happens there)

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:
get the closest points Let's say I have a bunch of points:

What is the best way to get a certain amount of closest neighbors.
For example I wan't the 8 closest points for point no 57.

This without using brute force.

O yeah, if possible, it would be great if it's efficient for moving points as well.

sentences:
Adding underwater shadow to 2D top down boat I have a boat/hovercraft sprite in my game. It's topdown 2D view, but it's actually a 3D scene, for better lighting and other effects.
I want to add a buoyancy effect, so that the hovercraft floats with the waves and has a little margin for going under water, like a real boat. So when idle or when going off a ramp, when landing in the water it will kinda "bounce" a bit under and then back up.
But the problem is: the water and boat sprites are on top of each other (because it's 2D). See this picture:

So it can not go underwater, because then the water will be on top. But I still want those edges of the vehicle to be a bit darker as it floats. I already have an effect that changes the Y value to make it float up and down. But now the edges have to become a bit darker to show they go underwater.

I kinda have this idea to add a 3D capsule and make it move up and down through the sprite to simulate this:

So as the boat and the capsule go down with each wave, it could mask the sprite, and the visible part (marked with black lines in the image below) could be made darker. To simulate the "under water" effect. Later I will also add foam and stuff, but the first problem is the underwater part. So how could I mask my sprite inside this capsule, and more importantly, make the "outsides" (so the parts of the sprite not touching the capsule darker? Any help would be greatly appreciated! :)

sentences:
Which coordinate space is the canonical default for each shader pipeline stage? I'm working with Direct3D 11 and HLSL. I use four different shaders (vertex, hull, domain and pixel).

I always have troubles using the right coordinate space in my shaders. Could somebody identify the appropriate space for the vertex, hull, domain and pixel shader stages?

sentences:
Matching game difficulty I'm currently making a matching game where the player is given a color or image type and the player has to click on all of the matching colors of images as fast as possible. My problem is how would I go about making a difficulty curve instead of just randomly generating what the next situation will be.

There's a link down below to show the first version of the game I made a while ago. As you can see the new scenario is chosen randomly and one scenario can be harder than the other with no thought of progression. What I want this time is for the game to progress over-time. So, the more of these "scenarios" a player does the more difficult it will get.

https://www.youtube.com/watch?v=sa2mtpv7RzA

sentences:
Screenshot preview freezes a game for a few seconds I have a screenshot preview at the end of the level, but when I show it my game freezes for a bit(low fps for a few seconds). This is code I use to load screenshot and crop it(for a little preview sample). Please, help me to solve this lag issue

private IEnumerator ShowScreeshotPreview()
{
    yield return 0;

    screenshotTexture = new Texture2D(2, 2);
    byte[] fileData = File.ReadAllBytes(destination);
    yield return 0;

    screenshotTexture.LoadImage(fileData);
    yield return 0;

    Rect croppedSpriteRect = new Rect();
    croppedSpriteRect.height = screenshotTexture.height;
    croppedSpriteRect.width = screenshotTexture.height;
    croppedSpriteRect.y = 0;
    croppedSpriteRect.x = 0;

    croppedTexture = new Texture2D((int)croppedSpriteRect.width, (int)croppedSpriteRect.height);
    yield return 0;

    croppedTexture.SetPixels(screenshotTexture.GetPixels((int)croppedSpriteRect.x, (int)croppedSpriteRect.y, (int)croppedSpriteRect.width, (int)croppedSpriteRect.height));
    yield return 0;

    croppedTexture.Apply(); // Memory leak occurs here
    yield return 0;

    screenshotPrview.mainTexture = croppedTexture;
    yield return 0;

    ScreenshotPreviewAnimator.SetBool("visible", true);
    screenshotLoaded = true;
}

sentences:
What problem does double or triple buffering solve in modern games? I want to check if my understanding of the causes for using double (or triple) buffering is correct:

A monitor with 60Hz refresh's the monitor-display 60 times per second.
If the monitor refresh the monitor-display, he updates pixel for pixel and line for line.
The monitor requests the color values for the pixels from the video memory.

If I run now a game, then this game is constantly manipulating this video memory.

If this game don't use a buffer strategy (double buffering etc.) then the following problem can happen:

The monitor is now refreshing his monitor-display. At this moment the monitor had refreshed the first half monitor-display already. At the same time, the game had manipulated the video memory with new data. Now the monitor accesses for the second half monitor-display this new manipulated data from the video memory. The problems can be tearing or flickering.

Is my understanding of cases of using buffer strategy correct? Are there other reasons?

sentences:
OpenGL - How to draw a transition of two textures on one quad? I know when drawing a rectangle, if we select red and draw two vertices, and then select yellow and draw the other two vertices, the entire rectangle will show a nice transition of color between those vertices and the middle of the rectangle will appear orange.

Suppose I have two textures, and I want to do the same kind of thing. On one rectangle, I want two vertices to use texture from one image and the other vertices to use the texture from the other image, and show a smooth transition in the middle.

Please show me how this can be done in OpenGL, thanks!

sentences:
Story and news-feed ideas for social network games I am currently working on a educational and fun 2-in-1 game. As I am not a professional, I need advice on story and news-feed. The goal is simple-get richer, the story is about a worker who is trying to get over his/her financial problems and become rich.

During the whole gaming process there is a news-feed (every day there are a couple of fresh news about what is going on). The news are fresh and individual so I need to write about 2000 pieces of news for 2 year gaming, maybe more.

The problem is that I am not sure whether repetitive news can interest in this game. What can be done to make the news-making process easier but not boring from the point of view of the player?

sentences:
How to align the Polygon Collider 2D in Unity to match the position of Sprite? How to align the Polygon Collider 2D in Unity to match the position of Sprite?
I have a game object. It has a Sprite Renderer with an image. Now I add a Polygon Collider 2D component to the game object, that generates a collider. The shape of the generated collider is correct as expected - i.e. it matches the image from the Sprite Renderer. But the position of the collider is wrong. Here you can see what I mean:

For sure I have a solution - I can manually configure the Offset of the Polygon Collider 2D. But that would take a significant amount of efforts and time (because I have a lot of such game objects, which need to have a sprite and collider). So, I am hoping to find a solution which would position the generated collider correctly. I.e. in such a way, so that the boundaries of the collider would match the boundaries of the sprite.

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:
What heuristic should I use for A* pathfinding? So, I've successfully implemented A* pathfinding (java) (http://www.cokeandcode.com/main/tutorials/path-finding/) in my game, but that pathfinding doesn't work as I wanted it to work. I don't know where should I look to change this behavior.

S - Start
E - End

I want it to work like on the left side. Now it works like on the right side.

I am using a Manhattan heuristic.

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:
Unity3D filling visible camera area with objects I'm developing an isometric tile-based game using Unity 3D.

I'm using an orthographic camera looking down yaw:45° and pitch:45°.

The game has an infinite world, which is loaded from a remote server. Because it is impossible to load everything at once, the game should only load visible areas of world.

But I don't know how to determine which tiles should be requested from server in order to fill up all the visible space on the screen.

I tried loading tiles by chunks e.g. 16x16 tiles chunk around camera. But this looks hacky to me and sometimes leaves blank edges visible on the screen.

Is there better solution to simulate a continuous world on the client side?

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:
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: Is object space the same as local space? I was in directx 11 and was wondering is local space the same as object space and if not, what is object space?

sentences:
Basic LibGDX Game won't run Relevant background information

I'm developing a game in Java & LibGDX. Well, I started a project. I made a game with LibGDX about a year ago before. I made a new project with the Gradle setup and imported it into eclipse. I ran it and it didn't work

The problem

In the basic template it displays the badlogic image. It says it's not there or it can't find it.

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:148)
at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.kymed.dank.rpg.GameState.create(GameState.java:16)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:145)

Though it's in the assets folder

sentences: Publishing a game on Steam without going throught Greenlight Is there any possible way to publish a game on Steam without going through Steam Greenlight?

sentences: Stop Unity UI Buttons from being clicked when a Facebook Window is overlayed Having an odd issue. When I play with the Facebook SDK for Unity, and the Windows popup like the login window or the Friend Selector window, if I use the mouse to click in the window I end up clicking the Unity 4.6 UI buttons underneath it. Anyone know how to avoid this?

sentences:
What is the most efficient method to load 2D dynamic chunks? Information/context

I'm writing a 2D sandbox game - similar to Terraria. The world is made up of many chunks, in a variable like this:

vector<Chunk> chunks;

There's no need to go too in depth about the Chunk class, but each chunk has these members:

int x, y;
Block blocks[256];

When a chunk is initialized, the blocks are all set (with a Perlin noise based algorithm.) There are 256 blocks per every chunk because a chunk is a 16x16 area filled with blocks. To the loading of the chunks, the members of the Block class are irrelevant.

Question

As the player walks around the world, I obviously need new chunks to load for them to explore. I don't think it needs saying but I shouldn't load every chunk in the world at once because:

It would be incredibly inefficient to render (even with my current system of block culling,) and
I don't know how many chunks will be in the world - there can be a huge amount, basically as many as the player wants to load.

I've tried a few different (but similar) ways to load and unload the chunks, but none of them worked very well. The main problem with both was that they sometimes gave segmentation faults.

What's the best way to dynamically load and unload chunks in a world?

By "best", I mean the most performance-efficient method.

Keep in mind I can easily load a chunk at any position - this isn't the problem. I just want a way of deciding which chunks to load.

sentences:
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:
Understanding arguments to a signed distance field function I'm looking into drawing a box using Inigo Quilez's code:

float sdBox( in vec2 p, in vec2 b )
{
    vec2 d = abs(p)-b;
    return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);
}

Do I understand correctly that for p is a point anywhere in 2d space?

If so, what is b?

I tried to draw a 2x2 rectangle at origin (assuming b is then vec2(2,2)) and do those calculations but nothing good came out. It should calculate the distance between the point and nearest edge, right?

sentences:
Loading next scene when counter is down to 0 I am trying to let my Unity project load next scene when the counter I have is down to 0. However I am unable to do that for some reason. The way I am trying to do it by :

    int i = SceneManager.GetActiveScene().buildIndex;

    void Update () {
     if (GameObject.FindGameObjectsWithTag("Birds") == null)
        {
            SceneManager.LoadScene(i + 1);
        }
    }

In the editor I have created a folder where I have made 3 scenes. Have called them Level 1, Level 2 etc.

What am I doing wrong?

sentences:
Unable to generate standalone noise I've been stuck this evening on getting a Perlin Noise function to generate by itself. Every time I run the program without adding to different types of noise together it calls an ArgumentException error.

Here is my code I'm using.

        //perlin gen
        Random rand = new Random();
        double freq = 1 / 32.0;
        double lacu = 3.0;
        int octave = 5;
        double pers = 0.5;
        int seed = 1;

        Perlin perlin = new Perlin(freq, lacu, pers, octave, seed, QualityMode.High);

        //init the noise map
        noiseMap = new Noise2D(128, 128);
        noiseMap.GeneratePlanar(1, 2, 1, 2, true);

And the error that it calls is here.

public void GeneratePlanar(double left, double right, double top, double bottom, bool seamless)
    {
        if (right <= left || bottom <= top || this.m_generator == null)
        {
            throw new ArgumentException();
        }

I've checked and re-checked the code multiple times, so I'm not sure what is going on that is making the GeneratePlanar function call the ArgumentException error.

sentences:
Rays starting in an octree node I just fixed a bug where rays starting and ending in an octree node were not detected as octree node hits (because the ray doesn't hit the sides).

I'm changing the code to check if a ray starts in the octree node, then it is an automatic node hit.

Any reason to not do this?

sentences:
Unity seperation of prefabs with two dimensional terrain generation I have the following function:

public void Spawn ()
        {

                GameObject g = ((GameObject)Instantiate (hills [Random.Range (0, hills.Length)], new Vector3 (0.0f, transform.position.y, transform.position.z), Quaternion.identity));
                g.transform.position = new Vector3 ((subs [subs.Count - 1].transform.position.x + (g.renderer.bounds.size.x) + (subs [subs.Count - 1].renderer.bounds.size.x) / 2), transform.position.y, transform.position.z);
                g.transform.parent = this.transform;
                NonLoopingScrollScript nls = (NonLoopingScrollScript)g.GetComponent ("NonLoopingScrollScript");
                nls.Setup (movSpeed, 0.0f);
                subs.Add (g);

        }

Which is being used to spawn terrain, the way this works is I have an array(hills) which is composed of a bunch of prefabs which together will make up terrain in the background of the game. This function is what actually instantiates the next prefab when it is needed, this prefab is then added to a list (subs). My problem is simply the spacing between the prefabs as I would like there to be no space, yet sometimes the objects overlap or there is a gap between the prefabs.

Explanation of code: In the first line I instantiate a random prefab with the argument:

hills [Random.Range (0, hills.Length)]

The next argument is where I am having trouble, what I am currently doing is setting the x value of the new prefab to the x value of the transform plus half the x width of both the previous prefab, and the new prefab. This is the issue as the spacing is not as desired. Then i simply set the y and z value to that of the spawner object and the rest of the code is irrelevent, save for where at the end of the function I then add the new gameobject to the end of the list.

I hope this was clear, if not please do not hesitate to ask questions.

Edit: The seperation of the prefabs works fine when there is only one type of prefab, but when I have several it doesn't. Here is an image of what I mean:

sentences:
Would it be better to use XML/JSON/Text or a database to store game content? I'm considering how to implement a component-based game, as that seems to be the hot thing and I like the idea of such a flexible design.  One of the features of such a design is that adding new things to the game can be done through data, often presented as loading content through text files such as XML.  This has the advantage of being human readable and easily editable in any text editor.  On the downside, text can be slower to deal with, and you have to manage a large collection of data files.  Similar text-based formats like JSON or config files would have similar benefits.

On the other side, there are small, portable databases like SQLite or Tokyo Cabinet.  While not directly human readable, these files are easy to interface with, and I'd imagine some kind of editing tool would be preferable for game content design anyway.  Using a DB allows for a consistent storage of config information and easy retrieval.  You could serialize data into a DB for save games as well.

Performance wise, I think generally XML is faster for small files but a database scales better to large amounts of data.  I'd imagine any real game is going to have a whole lot of game objects.

So the question:
Which is the preferable approach?  I'm leaning towards the DB, but I want to know if there are hidden pitfalls or real strong advantages to text files.  Or if there are other alternatives besides these (serialize to binary format I guess?)

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:
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:
Bad pixels on shader when loading cached binary programs I have been trying to cache binary shader programs in my game and load them accordingly using "glGetProgramBinaryOES" and "glProgramBinaryOES" respectively.

I was successfully able to cache and load the programs but there is one problem that can be seen in some of the shaders. The problem is that SOME pixels of the object that uses that shader appear black / white and keep flickering.

These are heavy shaders and I cannot skip their caching. Any help ?

Edit:

I compile and store the shaders on the device itself. So device/GPU dependency is taken care of.
I recompile the shaders on any new OS DLC, so software update is taken care of.

The white spots in the image below show the glitch that i am encountering.

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:
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:
Is Java viable for serious game development? I have scoured the internet, but there are not very many resources for Java game development, not nearly as many as C++. In fact, most engines are written in C++. I tried to play a game made with jMonkeyEngine, but the game was terribly slow, to the point where my computer froze. I had no other Java applications running, and nothing too resource intensive. In contrast, my computer can play most modern 3D games with ease. If I continue to learn and improve Java now, and it turns out that later I am required to learn C++, making the switch might be difficult.

Is Java an acceptable language for serious game development? By serious, I mean high quality graphics, without much lag on modern computers. I also want to consider making games for consoles.

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:
Clamp GameObject Into Isometric Camera Viewport I'm using the next code to move an objecto into an isometric projection (30/45)

[SerializeField] private Camera cam;
[SerializeField] private Transform target;
[SerializeField] private float speed;

private Vector3 forward, right;

private void Start()
{
    forward = cam.transform.forward;
    forward.y = 0;
    forward = Vector3.Normalize(forward);
    right = Quaternion.Euler(0, 90, 0) * forward;
}

private void Update()
{
    if (Input.GetKey(KeyCode.Mouse0))
    {
        var righMovement = right * speed * Time.deltaTime * (Input.GetAxis("Mouse X"));
        var upMovement = forward * speed * Time.deltaTime * (Input.GetAxis("Mouse Y"));

        if (righMovement != Vector3.zero && upMovement != Vector3.zero)
                target.forward = Vector3.Normalize(righMovement + upMovement);

            lastPosition += new Vector3
            {
                x = righMovement.x + upMovement.x,
                y = righMovement.y + upMovement.y,
                z = righMovement.z + upMovement.z
            };

            target.position = lastPosition;

            //target.position = Clamp(lastPosition);
        }
    }
}

At same time I want to clamp that object based on the screen size to avoid move the target when is off screen, so I made this:

private Vector3 Clamp(Vector3 position)
{
    var w2p = Camera.main.WorldToViewportPoint(position);

    w2p.x = Mathf.Clamp(w2p.x, .2f, .8f);
    w2p.y = Mathf.Clamp(w2p.y, .2f, .8f);

    return Camera.main.ViewportToWorldPoint(w2p)
}

But I'm getting some weird behaviours, the X axis clamp is fine, but Z is not working at all, and Y is on move what is not ok. It's quite probable I'm doing this in the wrong way. How it should be?

sentences:
Transforming normal vector in GLSL I'm looking at a basic diffuse light shader here http://en.wikibooks.org/wiki/GLSL_Programming/Unity/Diffuse_Reflection.

Diffuse light needs the normal vector in eye-space, so that it can dot it with the light position (also in eye-space), and figure out the diffuse contribution. (eye-space not world-space is used, because that simplifies calculating specular contributions).

The code calculates the normal vector in the following way:

        mat4 modelMatrixInverse = _World2Object; // unity_Scale.w
           // is unnecessary because we normalize vectors

        vec3 normalDirection = normalize(
           vec3(vec4(gl_Normal, 0.0) * modelMatrixInverse));

A linear algebra calculation shows that given a matrix M, Transpose(Inverse(M)) transforms normals.  The Wikipedia on normals page contains a derivation of the required formula: http://en.wikipedia.org/wiki/Normal_%28geometry%29#Transforming_normals (I've actually rewritten that section myself, as it was not lucid).

So does this mean that the 'vector * matrix' overload in GLSL is implemented as:

    Transpose(vector) * Matrix

just holding a row-vector instead of a column-vector in the output, i.e.:

    Transpose( Transpose(vector) * matrix )

or more simply:

    Transpose(matrix) * vector

?

I've also found what appears to be alternative: gl_NormalMatrix

But in lines 9-11 here http://pixelsorcery.wordpress.com/2010/07/13/fisheye-vertex-shader/ ) I see the following code:

normal = vec4(gl_NormalMatrix * gl_Normal, 0.0);
vec4 vVertex = gl_ModelViewMatrix * gl_Vertex;
light_dir = gl_LightSource[0].position - vVertex;

Would I be right to assume that gl_NormalMatrix gives a normal in eye-space, and gl_LightSource[0].position gives the light location also in eye-space?

http://www.opengl.org/discussion_boards/showthread.php/172231-gl_NormalMatrix-Replacement suggests gl_NormalMatrix is deprecated.

Does that mean the first implementation is the preferred approach?

EDIT: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-8-basic-shading/#The_Diffuse_part

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:
Error when trying to use VBO "array vertex_buffer_object must be disabled to call this method" EDIT

I have effectivley re-wrote this question in order to greatly imrpove its quality - see revision logs if you must

I have narrowed down my problem to the initialisation phase of my program, when I am trying to create my vertex buffer. The code that I am currently using is...

vaoID = new int[1];
gl.glGenVertexArrays(1, vaoID, 0);
gl.glBindVertexArray(vaoID[0]);
vboID = new int[1];
gl.glGenBuffers(1, vboID, 0);
gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboID[0]);
FloatBuffer vData = FloatBuffer.allocate(vertexData.length);
vData.put(vertexData);
vData.rewind();
gl.glBufferData(GL4.GL_ARRAY_BUFFER, vData.capacity() * (Float.SIZE / 8), vData, GL4.GL_STATIC_DRAW);
gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, 0); // With out this line my code throws the exception
gl.glEnableVertexAttribArray(0);
gl.glVertexAttribPointer(0, 4, GL.GL_FLOAT, false, 0, null); // This is the line where the exception is thrown
gl.glBindVertexArray(0);

So yes, at present my code is able to run with out crashing, but it must have a mistake some where as I am not able to get this to render. For the buffering the index data, I use this code, which does complete successfully when it runs

gl.glGenBuffers(1, bufferIDs, 0);
gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, bufferIDs[0]);
ShortBuffer iData = ShortBuffer.allocate(indexData.length);
iData.put(indexData);
iData.rewind();
indexCount = iData.capacity();
gl.glBufferData(GL4.GL_ELEMENT_ARRAY_BUFFER, indexCount * (Short.SIZE / 8), iData, GL4.GL_STATIC_DRAW);
gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, 0);

Then when it comes to drawing, I perform the following steps, and I don't think this really matters, as I am sure I am still not buffer correctly in the first place

// first I bind my VAO
gl.glBindVertexArray(vaoID[0]);
// then bind, draw, unbind the index buffer
gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, bufferIDs[0]);
gl.glDrawElements(GL4.GL_POINT, indexCount, GL4.GL_UNSIGNED_SHORT, 0);
gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, 0);
// finally I unbind the VAO
gl.glBindVertexArray(0);

I am fairly sure that this is the correct process for rendering buffered geometry. I have confirmed that my shader code is correct and valid by use of some immediate drawing commands, so I do I have full pipeline, it just seems I am not feeding data into it. As a point of interest, I also tried editing my vertex shader to set all points to (0,0,0,1) so that if any points where being passed in, I should see them, but this did not work, which I took to mean that I am not passing data into my shader in the first place.

Thanks for all the help so far.

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:
Synchronisation on a non authoritative networked peer to peer scene I currently have a piece of coursework that requires 3 or more 3d simulations connected via p2p to maintain a simulation that is visually consistent amoung all peers. A big issue is that I'm not allowed to use any form of authoritative server/peer logic and I'm struggling with potential designs.

The coursework has the following relavant constraints

each peer must be connected at the start and will have the same initial empty simulation
The network will be LAN only
Hardware is consistent in all computers in the network

I'm thinking about implementing it along the lines of

Each peer will regularly create a snapshot of all objects that have moved since the last snapshot
Each peer will maitain a local copy of the snapshot in addition to broadcasting it to all other peers
Each peer will combine the other snapshots possibly via averaging and and adding it to the current local state. I'm thinking I could also possibly use timestamps of each snapshot to weight the combination.
each peer runs their local simulation briefly
then repeat the process

Can anybody see any potential problems with this or recommend anything?

sentences:
Particle collision in Unity I want to count the number of particles (yellow balls) that hit the cube. When a particle hits the cube object, it must disappear.

This script is attached to the particle system:

    int P_ball = 0;

    void OnParticleCollision(GameObject other) {
       if (other.CompareTag("cube"))
       {
           P_ball = P_ball + 1;
           Debug.Log("Particles : " + P_ball );
       }
}

sentences:
Rotation of images in Slick2D I have have a rotation problem in the Slick2d library, the image is just not rotating (ie I set a rotation but no result is shown). Here is the rotation code:

if (input.IsKeyDown(Input.KEY_LEFT))  {
    velocity.x = -1;

    rotation = (float)Math.toRadians(180);
}

That is meant to set the rotation of image to 180 degress.

Then I render the image with an origin of the center of the image:

image.setCenterOfRotation(image.getWidth() * scale / 2, image.getHeight() * scale * / 2);
image.setRotation(rotation);

image.draw(position.x, position.y, scale);

Any ideas? Thanks.

sentences:
XNA How to detect collision between 2d sprites and 3d primitives (not models) My current status

I have already read some tutorials about 3d collision.
I know how ray trace works and how to convert mouse follow a vector to track the closest object that collides with out vector
I have also worked with 2d collisions before and I've seen some collision samples from "apphub".

My Problem

My problem is mainly because all the tutorials I have read are about collisions over 3d models on .fbx format but I don't use model files... I use simple primitives... So what methods do I need to check to be able to know if a 2d sprite has collided with my 3d isometric triangle? Also bounding box will have blank spaces outside my triangle borders that will return a false positive.

Main Questions

Is there a way to transform primitive into 3d models so i can use Ray.Intersect?
Do I need to  transform the vertices into 2d points and then check if any pixel from  sprite is between these 3 lines?
I'm also aware of boundingbox but it doesnt seems to be a good solution since we are talking about a triangle not a square. Or should I create a bounding box around the 2d sprite and then try to collide over all the Z's?

If you need clarification please let me know. I'm not very good in explaining myself.

thanks

sentences:
Clever way to do the Sonic 2 Bonus Stage effect saving memory What would be a good way to save memory to achieve an effect like this one?
http://www.youtube.com/watch?v=K89LkvL9JZ0

We're using pre-rendered 3D.

I'm asking this because this naive approach of just rendering all frames and putting them into a single file (sprite sheet) is producing a gigantic file, would we have to manage this loading creating multiple files?

If it helps, we are using Flex SDK.

sentences:
Establishing if a tile is available to move into I'm working on a grid-based game as a hobby project. Think of an ANSI game like ZZT. The grid is represented by a two-dimensional array of objects which contain both the UI element which takes care of displaying the sprite image and also the data accompanying whatever is in that position on the grid. I'm having trouble working out the mechanics of elements on the game grid determining whether they are able to move into a neighbouring cell.

Determining whether there is something in any given grid position is straightforward, as each instance of the class representing a cell on the grid has a property representing the sprite in occupation of the cell. Checking if this property is nil works fine in establishing if something static is there, but it becomes problematic if there are many objects moving from one grid position to another. The problems I'm having are:

Objects in grid cells will attempt to push objects out of their destination cell; this is intended behaviour, so that the player or NPCs can move objects around. The object which is pushed will check if it is capable of moving in that direction, and if the cell into which it is being asked to move already contains another object. If it does, it will attempt to push that object, and so on and so on until an object either agrees to be pushed (into an empty spot), or refuses (because there is nowhere for it to move or because it cannot move in that direction). The return values for the attempt to push will then cascade back up to the originating object and the sprites all move (or not). This causes a problem, however, if there are several sprites moving in a straight line in the same direction. Rather than all moving forwards together (which they should), the last object in the line thinks that the next cell is occupied so tries to push the object in that cell, which is unnecessary, because that object will be moving anyway. This causes the objects to spread out with gaps between them, which is abnormal.
Due to this, I considered having the objects check if the destination cell is occupied, and if so, check if the object in that cell will be moving out, and if anything else will be moving in. However, I'm concerned this could result in a condition where several objects may refuse to move because of each other's presence.

I have considered looking at source code for a similar game, but I don't want to copy another implementation, rather I'm looking for guidance on how I can solve the problem. Thanks in advance!

sentences:
Is DirectX free for commercial use? This question isn't gamedev per se but it is definitely relevant. Still, if it's off-topic, please direct me to the proper SE page.

This question has probably already come up many times but I'd like to take a complete approach here and also up-to-date (whatever I may find online might be from 1/5/10 years ago and so isn't of much value to me).

So - is DirectX free for commercial use? What do I mean by that? Is it free to download DirectX SDK (or whatever it's called nowadays) and develop my game? Are there any fees involved in publishing and selling my game if it uses DirectX? And in the spirit of covering it all - using DirectX implies using Windows (which isn't free) and maybe Visual Studio? To that last one - is it absolutely necessary to use VS? Also, is it practical to use any other IDE? And are there any other (implied) costs like that "using Windows" one?

Update:

My friend sent me this EULA snippet saying that it's only free if I'm the only user of the software I develop so this must mean I have to pay for DX for commercial use.

  SOFTWARE PRODUCT.  You may install and use the SOFTWARE PRODUCT on an
  unlimited number of computers, including workstations, terminals or
  other digital electronic devices ("COMPUTERS") to design, develop, and
  test software application products for use with Microsoft operating
  system products including Windows NT Workstation 4.0, Windows NT
  Server 4.0, Windows 95 and subsequent releases thereto
  ("Application").  You may install copies of the SOFTWARE PRODUCT on up
  to ten (10) COMPUTERS provided that you are the only individual using
  the SOFTWARE PRODUCT on each such COMPUTER.

sentences:
High quality specular reflections on Android I opened the Unreal Editor VR example, imported the TwinMotion materials and set the floor to a nice parquet. In the editor it looks like this:

However when I run it on my Oculus Quest it looks like this:

It's a little hard to see in this example because of the weird artefact on the floor, but the reflections are much lower quality. It seems like the bump maps aren't being used at all.

Is there any way to fix that? (Bonus points if you can tell me what is going on with the grey overlay, which doesn't show up in the preview.)

sentences:
How do multipass shaders work in OpenGL? In Direct3D, multipass shaders are simple to use because you can literally define passes within a program.  In OpenGL, it seems a bit more complex because it is possible to give a shader program as many vertex, geometry, and fragment shaders as you want.

A popular example of a multipass shader is a toon shader.  One pass does the actual cel-shading effect and the other creates the outline.  If I have two vertex shaders, "cel.vert" and "outline.vert", and two fragment shaders, "cel.frag" and "outline.frag" (similar to the way you do it in HLSL), how can I combine them to create the full toon shader?

I don't want you saying that a geometry shader can be used for this because I just want to know the theory behind multipass GLSL shaders ;)

sentences:
Improving SpriteBatch performance for tiles I realize this is a variation on what has got to be a common question, but after reading several (good answers) I'm no closer to a solution here.  So here's my situation:

I'm making a 2D game which has (among some other things) a tiled world, and so, drawing this world implies drawing a jillion tiles each frame (depending on resolution: it's roughly a 64x32 tile with some transparency).

Now I want the user to be able to maximize the game (or fullscreen mode, actually, as its a bit more efficient) and instead of scaling textures (bleagh) this will just allow lots and lots of tiles to be shown at once.  Which is great!

But it turns out this makes upward of 2000 tiles on the screen each time, and this is framerate-limiting (I've commented out enough other parts of the game to make sure this is the bottleneck).  It gets worse if I use multiple source rectangles on the same texture (I use a tilesheet; I believe changing textures entirely makes things worse), or if you tint the tiles, or whatever.

So, the general question is this:

  What are some general methods for improving the drawing of thousands of repetitive sprites?

Answers pertaining to XNA's SpriteBatch would be helpful but I'm equally happy with general theory.  Also, any tricks pertaining to this situation in particular (drawing a tiled world efficiently) are also welcome.

I really do want to draw all of them, though, and I need the SpriteMode.BackToFront to be active, because I use the layering quite essentially.

I don't have any easily digested sample code since the method has become somewhat complicated, but no extra tiles are being "drawn," and all the drawing is inside one SpriteBatch.Begin / SpriteBatch.End call.

sentences: Unity3d 2017 trail renderer behaving weird Please see the screenshot I attached, I am trying to make skid marks using trail renderer, but one side of trail is going upwards just after it renders, it was working fine Unity 5.4, but when I upgraded it to 2017, it is behaving like this.

sentences:
How do I convince my team to use less VO? I am a firm believer in using voice over (VO) only for necessary elements such as game narrative, and here and there to drive game play (e.g. instructions coming in over intercom, that sort of stuff). I think that game design should speak for itself, and generally, when lots of VO instructions are needed to drive game play, good design is lacking.

Unfortunately, my team doesn't really consider this, and feels that everything needs to be commented on by the main character's companion. As a result, I (sound designer) got a huge script in which I had virtually no say, with in my opinion lots of useless lines. Some examples:

  When there's only one tree in the scene with a very obvious squirrel in it.

  "Look at that squirrel in the tree!"

-

  In a room with one door.

  "I wonder what's behind that door."

-

  When facing a lot of bad guys.

  "Those are a lot of bad guys."

I feel we're dumbing down the player, and taking away lots of attention from the actual environment and player's initiative. However, whenever I mention this to the script writer or lead director (who is partially responsible for the script to), they're quite protective about it. I feel I have to ask line-by-line if this is really necessary, and this is not good for the atmosphere or productivity.

How can I convince my team that something more fundamental is wrong with the script?

Edit: Does someone have some good examples of games that use the above in a bad way, that I can use to demonstrate my point?

sentences: Is there a definitive reference on Pinball playfield design? I'm looking at designing tables for Future Pinball but I'm not sure where to start as I've little background in game design per se. I've played scores of pinball tables over the years so I've a fairly good idea of what is "fun" in those terms. However, I'd like to know if there is a definitive "bible" of pinball design as far as layout and scoring/mode design goes. I've looked but there doesn't seem to be anything really coherent that I could find. Is it simply a lost art or am I missing some buried gem?

sentences:
Finer collision detection with multi-path Polygon2DCollider from Tiled2Unity I'm in the process of incorporating Tiled2Unity prefabs into my code. Their exporter creates a collision object (shown below) that amalgamates the collider of each tile into a single Polygon Collider 2D made up of multiple "subcollider" paths, shown below as green polygons.

What I'm trying to do is to adapt my old corner detection code to work with the new collider, but when OnTriggerStay2D(Collider2D other) is triggered, I'm not provided with the specific path I've collided with. In the picture, each green polygon is a path, and together they make up the Collider2D (other) provided in the argument.

Is there any way to find out which path I've collided with, without looping through each of the 1000ish points every time I want to detect a nearby corner? So far I am only able to discover via events that I've collided somewhere in the ENTIRE collection of green polygonal paths.

Thanks!

sentences:
Exact sizing in Maya I'm coming from modo and want to try to create mesh assets for Unity3D in Maya. As a simple example how do I create an exact 1m cube in Maya? In modo it's easy to do.

In maya I draw a roughly 1m cube onto the grid and then want to set it's exact size but the channel box already displays scale 1x1x1 even if it's not an exact 1m for each size.

How do I set it to exactly 1m (or whatever exact measurement)? Surely it must be possible?

sentences:
Will scaling images at runtime impact my game's speed? I have read the android developer guide to working on different screen sizes. My question is, if I only provide one image in the drawable file, and let android scale it for me, will it impact the overall performance of my app?

For example, I am simply displaying a red square, and there aren't any details to the square. Should I provide alternative resources, will android's scaling impact my performance as an app on bigger/smaller screens?

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: How to scale objects and tiles without doubling view port in gamemaker How do I scale up tiles and sprites without acully making the view port larger than the acual view? I know that I can just scale up the images and the tileset but there must better alternative right? The reason why I dont want to make the port bigger is because then I get this kind of "pixel perfect" behaviour so 1 pixel on the image is one pixel on the screen (So it looks kind of choppy). I'm thinking I can use the draw event if there's no other alternative but how would I do that with the tileset?

sentences:
How can I create a precise touch in Unity Is there a way so that I can touch an object precisely?

I have these aerial cars and there pretty tiny like 32 by 32 and it's hard to touch them using a raycast. I thought I'd spawn an object with a circle collider on it on the first touch and destroy it after the touch.

sentences:
Using peer to peer for prediction in a client-server network model By implementing peer to peer connections between clients in a client-server network model I should be able to increase the prediction fidelity as this theoretically would provide the client with other clients commands for a given tick earlier than it would receive the servers game states for the same tick.

One problem I can think of is that clients would have to be able to interpret other clients commands (usually they just have to listen for game states, not commands). This would be a little bit like an RTS model I guess. This should be solvable without any negative effects on gameplay.

Another problem is that clients could cheat by sending fake data to their peers when it is beneficial to them. This can be mitigated by having the client aware of the real commands through the server and have them immediately stop listening to any clients that fed it false data. This should therefore be solvable with different degrees of negative effect on gameplay depending on the design of the game and how impactful a few ticks of wrong command info is at the worst possible moment.

(Unfortunately, you can't have the server punish any client because it has no idea who's lying, it can only help clients themselves understand if they are being lied to by providing them with correct data).

Am I correct in assuming that this would increase prediction fidelity or is there something I'm not accounting for? The idea is that this allows the client access to some information about the other clients faster than in a traditional non peer to peer model where it would base predictions solely on its own commands.

sentences: How do I make a video preview of my Android game? I noticed some apps have a link to a Youtube video instead of a screenshot in Google's Android Play store.  How can I make a video of my Android game running on a physical device?  The emulator won't work for me (my game uses the camera preview feed). I guess I could take a video of the phone with another device, but that seems a little cheesy to me.

sentences:
Combine textures with coordinates Is it possible to add one texture to another texture, at specific coordinates?
Like if I want to add a small texture(16x16) to big texture (1368 x 768) with coordinates ( 100, 100) so the small texture goes to specific coordinates (100, 100 ).

sentences: Is it possible to run two unity simulations at the same time on same computer? I know it is possible to open multiple unity projects at the same time on the same computer but is it also possible to run two unity projects at the same time and on the same computer. I tried running two unity simulations simultaneously, the one I run lastly, ran fine but the one which I ran first slowed down.

sentences:
How do I handle parallel lines when looking for intersections? I'm using the following method to determine the intersection point of two vector2:

public static Vector2 LineIntersectionPoint(Vector2 startPoint1, Vector2 endPoint1, Vector2 startPoint2, Vector2 endPoint2)
{
    // Get A,B,C of first line - points : startPoint1 to endPoint1
    float A1 = endPoint1.y - startPoint1.y;
    float B1 = startPoint1.x - endPoint1.x;
    float C1 = A1 * startPoint1.x + B1 * startPoint1.y;

    // Get A,B,C of second line - points : startPoint2 to endPoint2
    float A2 = endPoint2.y - startPoint2.y;
    float B2 = startPoint2.x - endPoint2.x;
    float C2 = A2 * startPoint2.x + B2 * startPoint2.y;

    // Check if the lines are parallel
    float delta = A1 * B2 - A2 * B1;
    if (delta == 0)
        throw new System.Exception("Lines are parallel");

    // Return the intersection point
    return new Vector2(
        (B2 * C1 - B1 * C2) / delta,
        (A1 * C2 - A2 * C1) / delta
    );
}

Currently the method throws an exception for parallel lines but I don't like the idea to wrap every call of that function in a try/catch.

Is there a better solution for this? I can't return null because Vector2 is a struct.

Maybe somthing like the following?

public static bool LineIntersectionPoint(Vector2 startPoint1, Vector2 endPoint1, Vector2 startPoint2, Vector2 endPoint2, out Vector2 intersectionPoint)

sentences:
LibGDX Textfield has no pointer cursor or blinking on hover / focus stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
    Gdx.input.setInputProcessor(stage);
    TextField.TextFieldStyle style = new TextField.TextFieldStyle();
    style.font = font;
    style.fontColor = Color.BLACK;
    style.cursor =
    style.selection = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    style.background = new Image(new Texture("core/assets/skin/textfield-big.png")).getDrawable();
    text = new TextField("Name", style);
    text.setWidth(500);
    text.setHeight(37);
    text.setPosition(50, 50);
    stage.addActor(text);

When I draw my stage, I can see my textfield, but when I hover it, my cursor doesn't change, and when I focus I can't see that blinking " | " at all, like normal textfields have.

What did I do wrong? Is it because style.cursor is null? If yes, how can I set it to the default cursor that libgdx uses?

sentences:
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:
Box2D collision between dynamic body I'm implementing Box2D for my 2d top down LIBGDX game and i have some struggle with two dynamic body.
Currently, my two bodies are created that way :

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DynamicBody;
    bodyDef.position.set(this.x, this.y);
    this.body = world.createBody(bodyDef);
    PolygonShape collider = new PolygonShape();
    collider.setAsBox(16, 16);
    FixtureDef fDef = new FixtureDef();
    fDef.density = 0f;
    fDef.friction = 0f;
    fDef.restitution = 0f;
    fDef.shape = collider;
    body.createFixture(fDef);
    body.setUserData(this);
    collider.dispose();

So basicly, no rotation, no friction and no restitution. Also, my world have a gravity of 0 (since it's a 2d top down game, i don't that want them to fall). When player 1 collide with player 2, player 2 is moved backward like it was push but i don't want that. I want it to stay where he is, blocking the path to player 1 but he can also move.

Is there a way to do that ?
I have looked for some tips like catching collision with the contact listener but i don't know what to do in the preSolve method.

I'd like some help, thanks !

sentences:
XNA Skinned Model - Keyframe.Bone out of range exception I'm getting an IndexOutOfRangeException on this line of AnimationPlayer.cs:
boneTransforms[keyframe.Bone] = keyframe.Transform;

I don't get what it's really referring to. The error happens when keyframe.Bone is 14, but I have no idea what that's supposed to mean. The 14th bone of my model? What would that even be? I read this thread, but nothing there seemed to work. I don't have many bones, stray edges/verts, unassigned verts, unparented/non-root bones, or bones with dots in the name. What else can I be missing?

Thank you for any help!

sentences:
Random Disconnects on UNET Using UNET, I can't host a game for more than a few minutes unless both server and client are on the same computer. It appears that I am not alone in this.

Essentially, any latency problems or packet loss triggers an immediate disconnect. Rather than just getting lag, the client gets booted.

Does anyone know how this could be dealt with?

sentences:
At this point in time, avoid XNA? XNA seemed like a valid option a few years ago, but XNA was never a real success, and now it seems like a footnote, even Microsoft seems to treat it that way.

Should I just go the DirectX route instead?

Ideally, eventually, I'd like my games to be playable on all major platforms (Windows, Linux, Mac + all consoles), but my primary focus is getting the games out the door on Windows XP, 7 and 8.

EDIT: This question and releated might already be answered here: What is the future of XNA in Windows 8 or how will managed games be developed in Windows 8?

sentences:
Why does Unity think my RectTransform has changed? I am working with UI.  I want to know when my RectTransform changes its position.  I am using transform.hasChanged:

void Update()
{
    if (transform.hasChanged)
    {
        Debug.Log("Updated Position");
        transform.hasChanged = false;
    }
}

However, it thinks it has always changed.  "Updated Position" is constantly printing out.  If I remove and then readd the component while in play mode, the issue resolves itself.  However, I don't want to have to do this, as it is very hacky.

I could just throw a bunch of if statements in there to check, but I'd prefer to make use of the build in transform.hasChanged property.

How can I check to see if my RectTransform has changed its position efficiently and elegantly?

sentences:
How 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:
Recommended book for cocos2d? I'm an experienced programmer that recently got into iOS development by working through the big nerd ranch book by Aaron Hillegass and Joe Conway. I loved the way the book was structured in terms of typing in the code and doing the challenges.

I'm interested in learning more about iOS gaming and cocos2d, but am a complete newbie in terms of game development/design. There are a number of books on amazon on cocos2d, can anyone recommend one in particular?

sentences:
Particles and gravity I don't really know how to search for what I'm looking for which is why I think it'll be easier to ask on here.

I'm creating a webpage and I had the idea of having random glowing particles floating around in the background. I've created something extremely basic where they spawn and then respawn when they go off the edge, however it doesn't really look very realistic and I wanted to have a similar effect to the intro screen in FF14:A Realm Reborn where the particles seamlessly float along in complete randomness but they do it in a way that looks so natural as if they're being brushed around by wind.

I don't really know where to begin on reading about this. I'm not really looking for a code solution, I want to create my own, instead what I'd prefer are explanations or links to guides that can get me started. Most of the particle systems I look up are just particle systems and they don't have this added gravity feel and I'm not really sure where to quickly learn about this specifically.

sentences:
What sort of data should be sent for mouse-based movement in a multiplayer game? I'm new to the Multiplayer Rodeo here so please bear with me...

I am just getting started and I'm trying to figure out how to deal with movement.
I've looked at the question Best way to implement mouse-based movement in MMOG which gives me a pretty good idea, but I'm still struggling with what kind of data should be sent to the server.

If a player is on position [x:0, y:0] and I click with the mouse on [x:40, y:40] to start movement, what information should I send to the server? Should I calculate the position based on velocity on client side and just send the expected location? Or should I send current location and velocity and direction? When the server is updating the clients on the players' whereabouts, should the position be sent only, and the clients expected to interpolate/predict movement, or can the direction sent from the client (instead of just coordinates) be used.

My concern(or confusion) is regarding the ping/lag frequency of data update and use of a predictive algorithm, as I'd like the movement to be smooth even with a high latency, and prevent ability to cheat(though that's not the top priority).

sentences:
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:
How to implement ECS architecture in C#? As C# is a strongly-typed language, I'm  having great difficulties associating all my data types together so that I can have a clean, if not performant, game loop.

Example #1: Keeping Components Together

Keeping components together means I need an interface or base class to store them in an array, which would require keeping track of each type separately so that it can be converted back to the derived type before being consumed. The constant type conversion seems like a bad idea in an ECS?

To compound the problem, I would prefer to use structs instead of classes for my components, which when cast to an interface will cause boxing. In some simple stop watch tests I've run it seems the casting/boxing is 16x slower than just looping over the raw type. (Pseudo code below)

IComponent sprite = new SpriteComponentStruct() // boxing

for(int i=0; i<iComponents.Length; i++)
{
    var type = GetComponentTypeByIndex(i);
    var system = GetSystemWithType(type);
    SpriteComponent sprite = Convert.ChangeType(...);
    system.Execute(sprite);
}

Example #2: Keeping Components Separate

To keep components separately in their own classes/managers/systems I would likely need a generic class to cut down on the code duplication. The problem I run into here is that looping over each class will require a base class or interface, which at the very least would force me to cast the component types again. (Pseudo code below)

ComponentManager<T>() where T : struct
{
    T[] components;

    // can't use with non-generic interface to put manager into a list
    public void AddComponent(T component) {...}

    // won't compile; type "T" will not cast to type "T"
    public void AddComponent<T>(T Component) {...}

    // requires casting and/or boxing, which defeats
    // the purpose of keeping components separate
    public void AddComponent(object component) {...}

}

It seems every which way I try to implement a ECS in C# ends with hacky/non-performant code, that's assuming I can get it to compile in the first place. From studying other ECS systems around the net, it seems some side-step these issues by using void/int pointers or storing component bytes directly in memory (like I believe the new ECS in Unity 2018 does). Either way those are unsafe operations in what's supposed to be a managed memory language.

So is C# the wrong tool for the job? Am I approaching this incorrectly? I'd love to hear some opinions as this just seem impossible...

sentences:
Is this a correct way to solve contact? Hi there,
I'm learning the impulse based physics engine these days. Can someone please check my image about solving a contact( a sphere resting on ground) , and please let me know where is wrong.
Thanks for any help!

sentences:
What other online descriptions exist for specific game engines 8-bit and 16-bit game engines? I found a good description of the engine in the Sonic games. It describes roughly how the engine works for people writing their own clones. In my case, I am simply interested in getting a general view of how the many 8-bit and 16-bit game engines worked on their respective consoles.

What other online descriptions exist for specific game engines 8-bit and 16-bit game engines?

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:
Check if the vector is behind another or maybe opposite directions? I'm doing a network game and on the client side, i interpolate the client position with the server sent extrapolated position. The client has its own physics simulation wich is corrected by the server in steps. The problem is when it laggs and i 'kick' the ball, the server gets a delayed message and sends me the position backwards of the client position wich makes the ball goes back and forth. I want to ignore those and maybe compensate that on the server, not sure though. The problem is the clock difference on those case are 0.07ms or 0.10 ms wich isn't that high to ignore the message i guess.

When i get the server position, i extrapolate with the clock interval * serverBallVelocity

Can i check if my new ball server position is behind my actual ball vector position? I tried to use the dot product after normalized the two vectors to check if they are opposite but it ain't working properly.

Any suggestions on checking that?

sentences:
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:
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:
Why does ForceMode.VelocityChange work but not Rigidbody.velocity = ... in script? I have a FPS movement script that I created that has a jump function that looks like this
public void Jump()
{
    if (jumpAble && grounded)
    {
        jumpAble = false;
        gameObject.GetComponent<Rigidbody>().velocity = (Vector3.up * jumpForce * Time.deltaTime);
    }
}

For some reason, this does not make the player jump. However, replacing the .velocity =... to
gameObject.GetComponent<Rigidbody>().AddForce(Vector3.up * jumpForce * Time.deltaTime, ForceMode.VelocityChange);

makes the player jump. Why is this? I'm under the impression that the two are essentially the same thing, but is there a slight difference?
Also, not sure if it affects the function, but this is the whole script
public class Player_Movement : MonoBehaviour

{
public Transform camera;
public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
public bool grounded;

public GameObject joystick;
public bool isWalking = false;
public bool isRunning = false;
public float walkForce = 12f;
public float runForce = 30f;

public float jumpForce;
public bool jumpAble = true;

public GameObject playerRotationHandler;
public float cameraTouchSensitivity;

public Animator animator;

// Update is called once per frame
void Update()
{
    grounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if (grounded)
    {
        jumpAble = true;
    }

    Vector3 direction = joystick.GetComponent<Joystick>().inputDirection.x * transform.right + joystick.GetComponent<Joystick>().inputDirection.y * transform.forward;

    if (isRunning)
    {
        gameObject.GetComponent<Rigidbody>().velocity = (direction * runForce * Time.deltaTime);
    }

    else if (isWalking)
    {
        gameObject.GetComponent<Rigidbody>().velocity = (direction * walkForce * Time.deltaTime);
    }

    else
    {
        gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
    }
}

public void Jump()
{
    if (jumpAble && grounded)
    {
        jumpAble = false;
        gameObject.GetComponent<Rigidbody>().velocity = (Vector3.up * jumpForce * Time.deltaTime);
        gameObject.GetComponent<Rigidbody>().AddForce (Vector3.up * jumpForce * Time.deltaTime, ForceMode.VelocityChange);
    }
}

public void Rotate(float xMoveValue, float yMoveValue)
{
    float xRotation = Mathf.Atan2(yMoveValue, cameraTouchSensitivity) * Mathf.Rad2Deg;
    float yRotation = Mathf.Atan2(xMoveValue, cameraTouchSensitivity) * Mathf.Rad2Deg;

    playerRotationHandler.transform.Rotate(xRotation, 0, 0);
    transform.Rotate(0, yRotation, 0, Space.World);

    if (playerRotationHandler.transform.localEulerAngles.x < 300 && playerRotationHandler.transform.localEulerAngles.x > 60)
    {
        if (xRotation < 0)
        {
            playerRotationHandler.transform.localEulerAngles = new Vector3(300, playerRotationHandler.transform.localEulerAngles.y, 0);
        }

        if (xRotation > 0)
        {
            playerRotationHandler.transform.localEulerAngles = new Vector3(60, playerRotationHandler.transform.localEulerAngles.y, 0);
        }
    }
}

}

sentences:
Line Intersection from parametric equation I'm sure this question has been asked before. However, I'm trying to connect the dots by translating an equation on paper into an actual function. I thought It would be interesting to ask here instead on the Math sites (since it's going to be used for games anyway ).

Let's say we have our vector equation :

 x = s + Lr;

where x is the resulting vector, s our starting point/vector. L our parameter and r our direction vector.

The ( not sure it's called like this, please correct me ) normal equation is :

x.n = c;

If we substitute our vector equation we get:

(s+Lr).n = c.

We now need to isolate L which results in

L = (c - s.n) / (r.n);

L needs to be 0 < L < 1. Meaning it needs to be between 0 and 1.

My question:
I want to know what L is so if I were to substitute L for both vector equation (or two lines) they should give me the same intersection coordinates. That is if they intersect.

But I can't wrap my head around on how to use this for two lines and find the parameter that fits the intersection point.
Could someone with a simple example show how I could translate this to a function/method?

sentences:
Replace black color by transparent color XNA I'm actually trying to replace black color of my texture by a transparent one.

How can I do to remove the black pixels, should I use a AlphaTestEffect, or can I use the BasicEffect?

Thank you.

sentences:
How can I take ingame images and videos? I’m using MonoGame and Visual Studio Community on my Mac to develop a game for iOS. I want to take ingame images and videos of the gameplay while the game is running on an iPhone/iPad. Afterwards, I want to use these images and videos for promotional reasons on my website or on facebook.

Is it necessary to install third party software or can I take images and videos in Visual Studio Community without installing additional software?

sentences:
Managing Character Bones in Unity 3D at runtime I'm trying to do the following:

Have a rotation only (no transforms) with x,y,z.
Each rotation axis above respectfully having a minimal and
maximum rotation angle with a current angle.
This will be for each bone of said character's skeleton, note
the weights will be applied as per usual when doing animations,
however there will be no animation data.

bones to rotation info, apply changes, info back to bones, apply changes, info back to bones...

Q: SetBones And GetBones, how would I get and set the bone data?

//imports...

public class BoneControllerClass : MonoBehaviour {
    //used to modify the bone data struct for each bone (ediable via Unity Editor)
    public BoneConstraintData[] BoneData;

    //gets refs to bone data from character
    public Bones[] GetBones(){ /*..Help..Here..*/ }
    public BoneConstraintData[] SetBoneConstraints(BoneConstraintData[] _BoneData) { /*..CODE..HERE..*/}
    public void SetBones(BoneConstraintData[] _BoneData){ /*..Help..Here..*/ }

    public void Start(){
        // generate bone data with zeros
        BoneData = GetBones();
        // set bone data constraints
        BoneData = SetBoneConstraints(BoneData);
    }

    public void Update(){
        // do something for smooth clamping, optionally this could be applied above as with Delta Time...
        // CODE EXAMPLE HERE, optionally another function can be added...
        BoneData[0].currentXAngle = 12.0f * Time.DeltaTime; //or BoneDataNew[0].currentXAngle = 12.0f;
        // END CODE EXAMPLE HERE

        // applies new bone rotation information, (note each bone carries the bone information of rotation like in IK Bone Logic...)
        SetBones(BoneData);
    }
}

//holds Min, Max, Current Angles And Bone Ref.
public class BoneConstraintData{
    string bone_name;
    float minXAngle, maxXAngle, currentXAngle;
    float minYAngle, maxYAngle, currentYAngle;
    float minZAngle, maxZAngle, currentZAngle;
}

I'm using version 5.x.x of Unity 3D.

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: What does a Game Designer do? what skills do they need? I know someone who is thinking about getting into game design, and I wondered, what does the job game designer entail? what tools do you have to learn how to use? what unique skills do you need? what exactly is it you'd do from day to day. I may be wording this a bit wrong because I'm not sure if the college program is become a game designer or learn game design. but I think the same questions apply either way.

sentences:
Rotating an object while moving I have an object the is a perfect circle.  The object is moving left, right and jumping with collision detection.  What I am trying to do now is rotate the object while it is moving, so it looks like rolling.

This is the code that I have so far:

key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);

//1  right, -1 left
var move = key_right - key_left;
hsp = move * walkspd;
vsp = vsp + grv;

if(place_meeting(x, y + 1, oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collisions
if (place_meeting(x + hsp, y, oWall))
{
    while (!place_meeting(x + sign(hsp), y, oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collisions
if (place_meeting(x , y + vsp, oWall))
{
    while (!place_meeting(x, y+ sign(vsp), oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}

sentences: Should a beta version of an engine be used to start a new project? Is it advisable to use a beta version of unity(2019.3b) to make an actual complete project? What are the disadvantages?

sentences:
Shrink a convex polygon Shrinking a concave polygon is quite hard, to do well. But I expect shrinking a convex polygon would be easy.

The naive approach of moving each vertex a certain distance to the centre gives me poor results though: Notice how for long edges, the displacement is much less than the other shapes.

static void shrink_poly( int numcoord, jcv_point* coords )
{
        jcv_point c = {0,0};
        for ( int i=0; i<numcoord; ++i )
        {
                c.x += coords[i].x;
                c.y += coords[i].y;
        }
        c.x = c.x / numcoord;
        c.y = c.y / numcoord;

        const float bordersz = 0.008f;
        for ( int i=0; i<numcoord; ++i )
        {
                float dx = coords[i].x - c.x;
                float dy = coords[i].y - c.y;
                float l = sqrtf( dx*dx+dy*dy );
                float dirx = dx / l;
                float diry = dy / l;
                coords[i].x = c.x + (l-bordersz) * dirx;
                coords[i].y = c.y + (l-bordersz) * diry;
        }
}

So for my second approach, I move the edges instead of the vertices, to get even spacing.
However, doing this causes the shapes to degenerate: non neighbouring edges start to intersect.
I would have to identify these and then collapse the superfluous edge to a new vertex at the intersection point. It also creates concave sections in the polygons, as seen below.

static void shrink_poly( int numcoord, jcv_point* coords )
{
        const float bordersz = 0.008f;
        float shiftx[ numcoord ];
        float shifty[ numcoord ];

        for ( int e=0; e<numcoord; e++ )
        {
                const int i=e;
                const int j = (i+1)%numcoord;
                jcv_point& v0 = coords[ i ];
                jcv_point& v1 = coords[ j ];
                float dx = v1.x - v0.x;
                float dy = v1.y - v0.y;
                float nx = -dy;
                float ny =  dx;
                float l = sqrtf( nx*nx + ny*ny );
                nx = nx / l;
                ny = ny / l;
                shiftx[e] = bordersz*nx;
                shifty[e] = bordersz*ny;
        }

        for ( int v=0; v<numcoord; v++ )
        {
                const int e0 = v;
                const int e1 = (v+numcoord-1) % numcoord;
                assert( e0 >= 0  && e0 < numcoord );
                assert( e1 >= 0  && e1 < numcoord );
                coords[ v ].x += shiftx[e0];
                coords[ v ].y += shifty[e0];
                coords[ v ].x += shiftx[e1];
                coords[ v ].y += shifty[e1];
        }
}

Is there a simple and effective way for shrinking convex polygons?

sentences:
Stats for testing a renderer I've been writing an OpenGL renderer as a learning process for the past few weeks. Now I wanted to test my renderer against some known numbers, for instance:

How many vertices/tris should it be able to render at 60 fps (rough estimate?)
How many draw calls before it is expected to drops the fps?
etc?

This is all assuming simple shaders (one that outputs a single texture) and a reasonable video card (3~4 yrs old).

sentences: Help to understand positive rotation direction on left/right handed cord spaces I began to study 3D math and noticed about left/right handed cord spaces and clockwise/counterclockwise rules. I understand that left-handed use clockwise positive rotation and right-handed counterclockwise. But what i don't understand is way this rules exists, on what technical problem this decision is based or this is just an agreement and nothing more?

sentences:
How do i calc what side the ball is of the rect? I have this nice drawing:

http://bildr.no/view/1085283

I know the ball's center and the rectangle's center, but how do I know (programming C#) what side of the rectangle the ball is?

By my drawing, the answer in this case should be the right side.

sentences:
Why does the lighting change the objects color? I have a code that draws a sphere. Without lighting it is white, but if I enable lighting, it's drawn in gray.

I don't know why the sphere changed it's color

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void init(void)
{
    GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat mat_shininess[] = { 50.0 };
    GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glShadeModel (GL_SMOOTH);

    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);
}

void display(void)
{
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glutSolidSphere (1.0, 20, 16);
    glFlush ();
}

void reshape (int w, int h)
{
    glViewport (0, 0, (GLsizei) w, (GLsizei) h);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity();
    if (w <= h)
        glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
                 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
    else
        glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
                 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize (500, 500);
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
    init ();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutMainLoop();
    return 0;
}

sentences:
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:
The difference between shading and data interpolation Using methods like Phong you can make mesh look smooth and real. However you can do the same interpolation at the data level creating a surface (for example B-Spline surface).

What is the difference and when would you use shading over data interpolation?

sentences:
what are texcoord tags in mesh.xml file in Ogrexml format? I exported a 3d model from blender 2.79 and using ogrexml import/export plugin.
but the texture will crash and UV map not working in that format.
I made the model by four parts head-body-hands-shoes and they have 4 material and 4 textures, so I made a texture atlas for it and join them in a mesh to More optimization.
I think removing other UV maps has a problem because when I check the model.mesh.xml in a note editor and every vertex has 3 texture coordinate tags and I compared it with a normal correct model that looks good in the blender and in ogrexml format, it has one texcoord tag inside of vertex tag.
1-what are texcoord tags? are they using for UV maps in ogrexml format?
2-how can I clear blend files from other unused uvMaps to avoid exporting them with the model?

sentences: rigidbody cube falls off the ground Inspite  my ground and cube contains colliders as i apply rigidbody it falls down....use gravity

sentences: How to stop rendering a gameObject that has no rendering component in unity I want to stop rendering this gameObject. But the all-available renderer.enabled = false is not working. Is it because it has no rendering component attached? If so, how can I see it when it is not rendered?!

sentences:
Low coupling and tight cohesion Of course it depends on the situation. But when a lower lever object or system communicate with an higher level system, should callbacks or events be preferred to keeping a pointer to higher level object?

For example, we have a world class that has a member variable vector<monster> monsters. When the monster class communicates with the world, should I prefer using a callback function then or should I have a pointer to the world class inside the monster class?

sentences:
Does anisotropic filtering need a previously generated mipmap? I have a GPU which supports anisotropic filtering and a 1024x1024 soil texture. I would like to know, if I even need to create a mipmap when I am using anisotropic filtering or if I can just leave it out and only use anisotropic filtering.

I looked it up in some tuts and posts and each one had mipmapping enabled too, but they did not mention why.

I am not sure, but I think that I need a mipmap because I don't think that anisotropic filtering scales a texture from 1024x1024 to something like 512x512 or 256x256. Am I right?

sentences:
How do I wrap my web browser game as a standalone for Steam? I've got a PHP/Java based game, which runs in the browser. However, I want to submit this game to Steam.

Now Steam doesn't allow web-based games unless they come in some kind of wrapper.

How can I package my web broswer game so that I could distribute it through Steam?

sentences:
Implementations of task-based parallelism in game engines_ I'm looking for implementations of this because I'm having an especially hard time understanding how data is usually handled. As I understand it, simply using critical sections and locking code regions where modification of shared resources happens is a no-go, because locking and unlocking imposes quite severe performance penalties on the program.

So another approach would be to simply copy all relevant data when I create the task and pass it to a thread and overwrite the original data at the end or at the beginning of the following frame with whatever the worker thread returns to me... which results in the problem that if two tasks modify the same resource... it's unclear to me how to meaningfully resolve that "result collision".

I guess it's theoretically possible to apply only deltas of incoming changes: Let's say each entity, at the beginning of a frame, checks the messaging system for modifications to itself. If there are n modifications to the entities component e, then the new e would probably just be the old e plus the sum of all "old_e - new_e" for each n. But that seems kind of ugly and I'm not sure if it even works for things which are not just simple changes to single numbers.

Are there any open source examples which implement this system that I could actually look at?

sentences:
How can I output multiple sprite sheets from a single .fla? I have to produce out three sprite sheets of differing sizes. To do so, I have three different .fla source files.

Obviously maintaining three files takes more time than maintaining one; is there some way that I can use one .fla and produce three differently-sized sprite sheets?

sentences:
Multiplayer network architecture - why do we need to verify local movements? I'm messing around with a 2D game using UDP. I've read some books and articles on the logic of a dedicated server to clients multiplayer game and I can't wrap my head around one thing:

What I've read:
When Client 1 moves, it sends it's input to the SERVER, the SERVER calculates the position, and then sends the new position back to all connected Clients, including Client 1 where the Client 1 player is drawn in the new position. Wouldn't this create a big amount of latency between the local player of Client 1 and their movements?

How I think it should work:
My question is, why not just move the local player based on the movement, and send the new position to the SERVER every time it moves? That what we you press a movement key, it's instant, instead of having to be calculated by the server and sent back and THEN moved.

NOTE: I'm not worried about anti-cheating verification

sentences:
How move sprite in Java 2d (swing) with keyboard? I'm practicing some simple techniques with Java swing games, to learn the basics. Right now I'm practicing how to move a sprite... but it's not working! whhyyyy

Here is what I've come up with so far (Main class):

public class GraphicsPracticeDrawing extends JPanel implements Runnable{

private CoinSprite coin2;
private Thread animate;

private final int DELAY = 25;

public GraphicsPracticeDrawing(){
    setBackground(Color.BLACK);
    this.addKeyListener(new InputHandler());

    Initialize();
    animate = new Thread(this);
    animate.start();
}

public void Initialize(){
    coin2 = new CoinSprite("images/coin.gif", 25, 25);
}

public void paintComponent(Graphics g){
    super.paintComponent(g);

    Graphics2D g2d = (Graphics2D)g;
    g2d.drawImage(coin2.getImage(), coin2.getX(), coin2.getY(), null);
}

@Override
public void run() {
    long beforeTime, timeDiff, sleep;

    beforeTime = System.currentTimeMillis();

    while(true){
        coin2.move2(); //move the 2nd coin based on the inputHandler
        repaint();

        timeDiff = System.currentTimeMillis() - beforeTime;
        sleep = DELAY - timeDiff;

        if(sleep < 0)
            sleep = 2;

        try{
            Thread.sleep(sleep);
        } catch(InterruptedException e){
            System.out.println("Animation interrupted!");
        }

        beforeTime = System.currentTimeMillis();
    }
}

/*
 * create a inner class to handle key inputs via the CoinSprite class
 */
private class InputHandler extends KeyAdapter{
    public void keyPressed(KeyEvent e) {
        coin2.keyPressed(e);
    }
    public void keyReleased(KeyEvent e) {
        coin2.keyReleased(e);
    }
}

}

and for my CoinSprite class:

public class CoinSprite {

private BufferedImage img;
private int speedKeyX, speedKeyY;

public CoinSprite(){ }

public CoinSprite(String fileLoc, int x, int y){
    try{
        this.img = ImageIO.read(new File(fileLoc));
    } catch (IOException e){
        System.out.println("Can't load file!");
    }

    this.x = x;
    this.y = y;
}

/*
 * move the sprite based on key inputs
 */
public void move2() {
    this.x += this.speedKeyX;
    this.y += this.speedKeyY;
}

public void keyPressed(KeyEvent e) {
    if(e.getKeyCode() == KeyEvent.VK_LEFT) {
        speedKeyX = -1; //when move is, called change the speed
    }
    if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
        speedKeyX = 1;
    }
}

public void keyReleased(KeyEvent e) {
    if(e.getKeyCode() == KeyEvent.VK_LEFT){
        speedKeyX = 0;
    }
    if(e.getKeyCode() == KeyEvent.VK_RIGHT){
        speedKeyX = 0;
    }
}

//GETTERS
public BufferedImage getImage(){ return this.img; }
public int getX(){ return this.x; }
public int getY(){ return this.y; }

//SETTERS
public void setX(int x){ this.x = x; }
public void setY(int y){ this.y = y; }

}

When I run the game and press left and right the sprite wont move! I don't know why...

sentences: Any tips for creating cross-platform games? Do you have any tips/recommendations when creating a cross-platform game in C/C++?

sentences: Can both High poly model go with a low poly scene? I'm in the process of developing a game, and I've found a model that would go perfectly for the character. However, the scentre I already have is low poly and I can't find a good enough high poly to go with it. So tell me whether or not I should I should carry on with the art I have or find a low poly model.

sentences:
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:
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:
How do I create a decal system? I'm currently given the task to design & create a simple decal-system in C++/DirectX.

Does anybody know a great tutorial, article or paper to start with? (Especially the part about 2D-texture to 3D-surface projection and clipping isn't entierly obvious to me.)

I'd also appreciate just simple hints and best-practices.

sentences:
Java - Genetic Algorithm - Multi Paint Components Currently working on a Genetic Algorithm in Java where I'm using a JPanel to draw my population and my target. The technical code works (generate population, mutate, crossover, get genes, etc...) but I'm stuck with the code to draw all my population.

Currently each individuals have x, y, x velocity ,y velocity and an array of directions ["up", "up", "down", ...] as attributes.

Tried to do:

// Draw the destination square in Red, individuals in Black
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setColor(Color.red);
    g2.fill(new Rectangle2D.Double(destinationX(),destinationY(), 10,10));
    g2.setColor(Color.black);
    // Draw each Individual in black
    for (Individual ind : Population)
      // read their genes one by one and repaint everytime to see the square move
}

But it's extremely messy, ugly and hard to debug.

How should I go from here? Should all individuals be JPanels that I'll add to the main JPanel? Do I need to use Threads? Any suggestion would be appreciated.

sentences:
Using enums for detecting object collisions As far as I know, I can detect what objects the player is colliding with is by the following code:

private void OnCollisionEnter2D(Collision2D collision)
{
    if(collision.collider.name.Equals(""))
}

But I have heard that I can use enums instead to reduce computations. Could anyone explain to me using examples?

sentences:
Calculating collision of polygons Say I have a multitude of 2D polygons floating about on a plane. These polygons can have any side count and aren't necessarily regular.

Assuming I know absolutely everything about the polygons (area, collision point, location, velocity, rotation, angular velocity... etc) how to I calculate what happens to two polygons after collision?

I.e. what will their resultant velocities and angular velocities be after collision?

If not an exact solution, what resources could help me learn how to accomplish this?

sentences:
Resolve Unity error about "Constructors and field initializers" on the loading thread The code below is producing an error message I don't understand:

  Constructors and field initializers will be executed from the loading
  thread when loading a scene. Don't use this function in the
  constructor or field initializers, instead move initialization code to
  the Awake or Start function

I don't know where the problem is in my code or what I need to change - can someone please explain?

var XPos : float = transform.position.x;
var YPos : float = transform.position.y;
var ZPos : float = transform.position.z;
var Waiting : float = 0.02;

function OnTriggerEnter (col : Collider) {
    if (col.gameObject.tag == "Player") {
        this.transform.position = Vector3(XPos, YPos+0.1, ZPos);
        yield WaitForSeconds(Waiting);
        // ...similar code omitted
        transform.GetComponent.<Collider>().isTrigger = true;
        Destroy(gameObject);
    }
}

sentences: (love2d)How would I go about drawing the same image multiple times? Obviously I could just copy and paste a love.image.draw() function multiple times for how many times I want the item to be drawn, but lets say I wanted to draw an image wherever the mouse is clicked at. How would I go about making it so it draw said item every time I clicked. If I only clicked twice it would draw two objects, and if I clicked it 500 times it would draw 500 items, without having to have 500 different draw functions?

sentences:
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:
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:
Torus World Collision Dection I am looking for a collision detection solution for use when 2d screen wrapping.  Specifically, when the image is split between the right and left side I can only detect a collision for a limited area.

For example, the program detects the collision when the rectangle intersects the circle in the first image.  However, it doesn't in the second image.  I am using the Rectangle.Instersects method to check for the collision in both cases.

I used the screen-wrapping solution at the following link:
How to create a 2D region where sprites are automatically wrapped?

However, since I am not using the physics engine, I am not using the related solution at:
How to create a very specific kind of joint in Farseer?

I am aware of the following question:
https://stackoverflow.com/questions/8679304/wrapping-drawn-image-in-xna-4-0, and incorporated part of the code to reset the draw rectangle's position when wrapping for both sprites:

 // reset draw rectangle for wrapping
        if (drawRectangle.X < -sprite.Width)
        {
            drawRectangle.X += parentWindowWidth;
        }
        if (drawRectangle.X > parentWindowWidth)
        {
            drawRectangle.X -= parentWindowWidth;
        }
        if (drawRectangle.Y < -sprite.Height)
        {
            drawRectangle.Y += parentWindowHeight;
        }
        if (drawRectangle.Y > parentWindowHeight)
        {
            drawRectangle.Y -= parentWindowHeight;
        }

This post also says that I have to check for the collision in the two separate positions, but I am having trouble doing so.

Any suggestions?

sentences:
Load custom resources in Unity The situation is I work in my free time on one study project. I have resources of one game packed in it's own format. My intent was to use those  with Unity without converting them into Unity's inner format.

But with brief analysis of Unity Api Reference I did not find anything that would help my in my efforts. Like I have custom binary files I would need to parse with Unity and upon that data create geometry, lights and so on using Unity's classes.

So I wonder if it's even possible? I would really appreciate if anyone would show make a hint on this subject

sentences:
How should I rotate vertices around the origin on the CPU? I have tried using glm::rotate and such. glm::translate works fine, but rotate doesn't work (if I rotate before/after a translation).

Here is my current setup:

glm::vec4 Off = glm::vec4(0, 0, 0, 1);
glm::vec4 result = Util::createTransform(offset) * Off;

for (int i = 0; i < Tvertex.size(); i++) {
    Tvertex[i] += glm::vec3(result.x, result.y, result.z);
    Tcolors[i] = currentColor;
}

And here is my Util::createTransform:

glm::mat4 Util::createTransform(glm::vec3 pos) {
    glm::mat4 trans = glm::mat4(1.0);
    trans = glm::translate(trans, pos);
    return trans;
}

glm::mat4 Util::createTransform(glm::vec3 pos, glm::vec3 rot) {
    glm::mat4 trans = glm::mat4(1.0);
    trans = glm::rotate(trans, glm::radians(rot.x), glm::vec3(1, 0, 0));
    trans = glm::rotate(trans, glm::radians(rot.y), glm::vec3(0, 1, 0));
    trans = glm::rotate(trans, glm::radians(rot.z), glm::vec3(0, 0, 1));
    trans = glm::translate(trans, pos);
    return trans;
}

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:
Encapsulating parameterised prefabs I'm currently using the following general pattern for most of my configurable components (i.e. MonoBehaviours):

public class MyComponent : MonoBehaviour
{
    // Configurable fields
    [SerializeField]
    private bool someParameter;
    [SerializeField]
    private int anotherParameter;

    // Fake constructor to act as a replacement for GameObject.AddComponent
    // with additional parameters.
    public static MyComponent AddTo(GameObject gameObject, bool someParameter, int anotherParameter)
    {
        var myComponent = gameObject.AddComponent<MyComponent>();

        myComponent.someParameter = someParameter;
        myComponent.anotherParameter = anotherParameter;

        return myComponent;
    }

    // Public properties and other methods
    // ...
}

This works around the lack of constructors for MonoBehaviours but still encapsulates the parameters in such a way, that they can only be set at the time the object is created, or through the Inspector (which is effectively the same thing once the game is built).

Unfortunately, this approach doesn't help once I want to use my component inside a prefab. When I instantiate the prefab, the component has already been created, and I can no longer touch those parameters. And as far as my google-fu can tell, there's no way to pass parameters into prefab instantiation (much like there isn't a way to pass a parameter into AddComponent). It seems like everyone just instantiates their prefabs and then fiddles with some public properties to configure them.

So the question is, is there any way to set things up, such that I can configure some fields on my prefabs, but without exposing them publicly and breaking encapsulation?

(I realise that I could add a similar static "factory" method which instantiates a specific prefab and then configures the component inside that prefab, but a) this means adding one such method for each prefab and b) it breaks down once I want to configure multiple components within the same prefab.)

sentences:
Why is my AABB vs AABB code returning false positives I am trying to do AABB vs AABB collision and the code is never finding a collision.

    private static boolean checkFullCollision(Entity entity, Entity entity1) {
    float[] amin = entity.getMin();
    float[] amax = entity.getMax();

    float[] bmin = entity1.getMin();
    float[] bmax = entity1.getMax();
    return  (amin[0] <= bmax[0] && amax[0] >= bmin[0]) &&
            (amin[1] <= bmax[1] && amax[1] >= bmin[1]) &&
            (amin[2] <= bmax[2] && amax[2] >= bmin[2]);
}

where I calculate my min and max.

    public float[] getMax() {
    final float[] max = new float[3];
    max[0] = position.x + this.max.x;
    max[1] = position.y + this.max.y;
    max[2] = position.z + this.max.z;
    //System.out.println(position);
    return max;
}

public float[] getMin() {
    final float[] min = new float[3];
    min[0] = position.x - this.min.x;
    min[1] = position.y - this.min.y;
    min[2] = position.z - this.min.z;
    return min;
}

Can someone help me please.

Thanks in advance

sentences:
What is wrong with my vertex declaration? What is wrong with my vertex declaration below? I am using it with instancing. After adding TextureInformation to it, it renders weird and has an epileptical seizure.

    public struct VertexInstance : IVertexType
    {
        public Matrix World;
        public Color Color;
        public Vector3 TextureInformation;

        // I use arithmetic here to show clearly where these numbers come from
        // You can just type 28 if you want
        public static readonly int SizeInBytes = sizeof(float) * 23;

        // Vertex Element array for our struct above
        public static readonly VertexElement[] VertexElements = {
            new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(sizeof(float) * 4, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 1),
            new VertexElement(sizeof(float) * 8, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
            new VertexElement(sizeof(float) * 12, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
            new VertexElement(sizeof(float) * 16, VertexElementFormat.Color, VertexElementUsage.TextureCoordinate, 4),
            new VertexElement(sizeof(float) * 20, VertexElementFormat.Vector3, VertexElementUsage.TextureCoordinate, 5)
        };

        public static VertexDeclaration Declaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }
    }

sentences:
Unreal Engine 4 - AI MoveTo always fails I try to move a character with AI MoveTo, but it always fails. I tried to do this with standart ThirdPersonController and a custom one. The blueprint is simple

When the event happens, it starts printing "failed". I checked many times if I have a NavMesh on the level or any other problems with it, but I don't think there are any problems with that. Any ideas?

sentences:
Why it takes some time to update the sprite draw order in libgdx SortedIteratingSystem? I have a rendering system that extends SortedIteratingSystem and created a comparator to sort the sprite draw order. But the problem is when I update the z index, it takes some time before it changes the order.

public class RenderingSystem extends SortedIteratingSystem {

    public RenderingSystem() {
        super(Family.all(...components).get(), new ZComparator());
    }

    private static class ZComparator implements Comparator<Entity> {
        @Override
        public int compare(Entity e1, Entity e2) {
            return (int)Math.signum(Mappers.index.get(e1).z - Mappers.index.get(e2).z);
        }
    }

}

IndexComponent implements Component {
    public int z = 0;
}

sentences:
C++ game architecture I'm trying to make a game, but I'm not sure of the best way to set up the main loop and classes. For really small games, I could put everything in the main() loop, including event handling, collision checking, etc. However, for large games, that's seems like a highly inefficient way to get things done. The architecture I want is kind like the way the Minecraft coders did it (I quote Minecraft code because I've seen the source code when downloading MCP).

They have objects entity classes EntityCow and EntityChicken and they have methods like onDeath(), onLivingUpdate(); and item classes like ItemSword have methods like onItemUse(). I've never seen these methods get called directly, but apparently, they get stored in a class called DataWatcher, which, I think "watches" all the data (as the name implies) and calls the appropriate methods in the objects.

Is that how most games do it? If so, how is the DataWatcher class implemented? Any help or alternate suggestions is really appreciated.

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:
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:
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:
Libgdx: how does dispose() work? My game uses a lot of images, for the over-world, battle screens, chats, etc. I'm really meticulous when it comes to memory management, and I've noticed that even though I dispose every image when I load in a new one, the memory never goes down.

Isn't this what Dispose() should do or is my understanding wrong?

sentences: Moving Sprite With Physics Frame Normally, a physics frame in pink (see image below) gives the body for detecting hit signal. It usually either falls down or lifts up depending on the gravity orientation. The question is: Is it possible to move or manipulate sprite through X and Y coordinate without needing to use the gravity code from a physics engine like bodyeditor-loader-sources.jar (e.g. ballBody.setGravityScale(100.1f);) so that I can move simply either by dragging, change the value initially, or moving it by D-pad?

sentences:
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:
Quite conflicted on advice given to "learn programming" for game development I have been reading a few sources online that talk about learning programming with the end goal of game development in mind. I have heard many people saying that starting with Unity is the best way to go but others stating that C++ is what you need to get started with in order to be a game developer.

But as far as I'm concerned, this leaves me in quite a dilemma. Am I right in thinking that if I'm not overly fussed about making little indie games at the moment and just want to get stuck in with learning how to program, is C++ the right choice?

I have begun my journey with C++ and I am really enjoying it. I think it is the time further down the line that I am confused about. I am quite unsure on where to turn and what direction to go down to try and do this game development thing.

My end goal isn't necessarily working on an indie game project, I'd much rather aim to work at a gaming company which in my mind is a bit more realistic.

Thank you in advance.

sentences:
Limit sprite to windows bounds? I'm making a game in XNA and I want to limit the movement of a sprite to the screen boundaries.
How would I do this?

http://i.stack.imgur.com/ZqH0M.jpg

sentences:
How can I add a button that opens a pop-up? I have developed a game with a libGDX game engine. I want to create a button on the game screen and add a popup to this button. How can I do this?
My current code:
public class GameScreen extends BaseScreen implements ShowDictionaryEvent
{
    private Preview preview;
    public GameController gameController;
    public Dial dial;
    private BoardView boardView;
    public DialAnimationContainer dialAnimationContainer;
    private LevelEndView levelEndView;

    private Rocket rocket;
    private BombDialog bombDialog;
    public AlertDialog bombBlastDialog;

    public ExtraWordsButton extraWordsButton;

    private ImageButton shuffleButton;
    private BoardOverlay boardOverlay;
    private Feedback feedback;

    private DictionaryDialog dictionaryDialog;
    private BonusWordsIncompleteDialog bonusWordsIncompleteDialog;
    private BonusWordsCompleteDialog bonusWordsCompleteDialog;
    public SideComboDisplay sideComboDisplay;

    private Smoke smoke;
    private Ufo ufo;
    public boolean offeredBoosterInThisLevel;
    public int nextBoosterType;
    private Label goldPackBubbleLabel;

    private RemoveAdsDialog removeAdsDialog;
    public Image comboLight;;
    public CameraShaker cameraShaker;

    private DelayAction comboLightDelay;
    private SequenceAction comboLightSequence;
    private RunnableAction comboLightRunnableAction;
    public int tempComboReward;

    public GameScreen(KelimeGame wordConnectGame) {
        super(wordConnectGame);
    }

    @Override
    public void show() {

        super.show();

        setTopPanel();
        topPanel.setY(stage.getHeight());

        topPanel.topComboDisplay.setGameScreen(this);

        dialAnimationContainer = new DialAnimationContainer(KelimeGame.resourceManager);
        dialAnimationContainer.setVisible(false);
        stage.addActor(dialAnimationContainer);

        cameraShaker = new CameraShaker();

        gameController = new GameController();
        gameController.setGameScreen(this);

    }
}

sentences:
How are game menus logically structured? I've been struggling with making a game menu system in Unity for some time now. I spent time developing a way to help myself understand how game menus are connected together. Right now, I'm calling it the Screen-Menu relationship.

In this relationship, Screens (e.g. Main-Menu, Game-Over and Inventory screens) hold access to Menus (e.g. Options Menu, Level-Select menu). These Menus are accessed via MenuButtons (e.g. Options menu button via the Pause Screen).

Is this a valid way of thinking about how game menus are structured? How should I be thinking about it?

sentences:
How can I optimise a Minecraft-esque voxel world? I found Minecraft's marvelous large worlds extremely slow to navigate, even with a quad core and meaty graphics card.

I assume Minecraft's slowness comes from:

Java, as spatial partitioning and memory management are faster in native C++.
Weak world partitioning.

I could be wrong on both assumptions. However, this got me thinking about the best way to manage large voxel worlds. As it is a true 3D world, where a block can exist in any part of the world, it is basically a big 3D array [x][y][z], where each block in the world has a type (i.e BlockType.Empty = 0, BlockType.Dirt = 1, etc.)

I assume that to make this sort of world perform well, you would need to:

Use a tree of some variety (oct/kd/bsp) to split all the cubes out; it seems like an oct/kd would be the better option, as you can just partition on a per cube level not a per triangle level.
Use some algorithm to work out which blocks can currently be seen, as blocks closer to the user could obfuscate the blocks behind, making it pointless to render them.
Keep the block object themselves lightweight, so it is quick to add and remove them from the trees.

I guess there is no right answer to this, but I would be interested to see peoples' opinions on the subject.  How would you improve performance in a large voxel-based world?

sentences:
Developing for Unity without Editor I want to write a Unity app that doesn't use the Editor. That's the goal. Please don't ask why or tell me the Editor "is really great, you should try it", I know all that, I love the Editor, I'd personally love to WORK on the Editor (at Unity). That's not how this particular project goes, however.

The goal is a 3D prototyping app. In the app, you make design changes to a set of 3D models, and the changes you make show up "live" in a Unity app. When you're done, you "bake" the changes into an actual Unity app, complete w/ the Unity project source code, so you can open it and further refine it. Sounds goofy, I know, I was assigned this project from somebody else.

I know that for the live changes shown in Unity, I could of course make a nearly blank Unity project, and add GameObjects at runtime, and set their attributes. That much is obvious.

What's not obvious is how to add C# script behaviors at runtime. If the Unity "live" app is running all the time, and I'm adding GameObjects at runtime, how then do I add compiled C# dlls at runtime, so the dynamically created GameObjects use the newly compiled C# code?

I'm thinking the GameObjects would call out to a C# dll by some kind of name-binding, each time the C# code is updated, the dll is written out with a GUID/hash, and in the GameObject code, it dynamically looks for that Dll and loads it, then steps into it. seems tricky and complicated, right?

Has anybody done this and had some insight into it?
Before anybody references "Futile", keep in mind I don't care much about looking into a 2D only answer for this, and don't want to dig though that 2D code even if it has the answer in it. I'd like to discuss the answer here, on this forum, about thoughts about how to approach this, in the hopes it may help other people too.

Goals:
1. I provide 3rd party users a prototyping app that throws together an "editor" or a "prototyper" which shows on one winodw, with live in-Unity results in another window. Let's say the "prototyper" object in question is a GIANT terrain, populated with houses, trees, humans, etc. You can move around, see what the generated stuff looks like. Then, when you're happy with the look, you press "bake" and out pops a Unity project that you can go edit and flesh out.
2. I need the live Unity view to accept c# code (over some kind of communication mechanism) that will get compiled and run by the live view. Examples for why might be trees in the scene waving in the wind, running waterfalls, etc.

Thoughts?

sentences:
How can I get Visual Studio to build FXOs when I build my game? I'm trying to compile a .fxo file when I compile my game.

The compile command-line is:

fxc.exe /T fx_5_0 /Fo Basic.fxo Basic.fx

Instead of manually using fxc.exe, where can I put this in Visual Studio so when I compile the game, the .fxo gets generated?

sentences:
Implementing invisible bones I suddenly have the feeling that I have absolutely no idea how to implement invisible objects/bones.

Right now, I use hardware instancing to store the world matrix of every bone in a vertex buffer, and then send them all to the pipeline. But when dealing with frustum culling, or having them set to invisible by my simulation for other reasons, means that some of them will be randomly invisible.

Does this mean I effectively need to re-fill the buffer from scratch every frame with only the visible unit's matrices? This seems to me like it would involve a lot of wasted bandwidth.

sentences:
Adapting motion controls to changes in the player's orientation I am using gyroscope data (pitch, roll) to move the player's space ship.

It works perfectly as long as you play in a standard position (e.g. sitting down).

Once you start using it lying down (e.g. in the bed), the control does not work anymore as the pitch and roll values I used become too big.

Here is the code I use, written in Objective-C. Any idea on how to improve/fix this?

-(void) gyroUpdate:(ccTime) delta
{
    CMAttitude * attitude;
    CMDeviceMotion * motion = [GameController sharedGameController].motionManager.deviceMotion;
    attitude = motion.attitude;

    float pitch =  attitude.pitch;
    float roll =  attitude.roll;

    ShooterScene * shooterScene = (ShooterScene *) [self parent];
    ShipEntity *playerSprite = [shooterScene playerShip];

    const float roolSpeed = 1000.0f;
    const float pitchSpeed = 1000.0f;

    //Midpoint of pitch is 0.5f, here the Player ship is NOT supposed to move.
    //Moving "forward" is equal to values towards 0.0f-
    //Moving "backwards" is equal to values towards 1.0f+

    float pitchProgression = 0.5f - pitch;

     CGPoint newPosition = CGPointMake(playerSprite.position.x + roll * delta * roolSpeed, playerSprite.position.y   + delta * pitchSpeed * pitchProgression );

    [playerSprite setPosition:newPosition];
}

sentences:
What are the advantages and disadvantages of using pointers to change data in my physics engine? I am working on an entity-component system, and I am thinking about this communication protocol:

The physics component of a game object sends an UpdateMyState message, with its state attached.
The physics engine receives this.
The physics component sends a pointer to its data, and the physics engine changes the state. Because it is a pointer, no messaging back is required.

The standard way involves the physics engine sending back an UpdatedState message, with the new state attached. This will be processed by the physics component. I am not sure if my way is a good exercise. It is not a complete message-based system, but it decreases the amount of required messages, and it simplifies the system.

What are the advantages and disadvantages of using pointers to change data in my physics engine?

sentences:
Is there a way to scale a texture via GPU rather than by CPU? For my game that I'm developing I want to have my cards dynamically drawn so if there is any changes done to them it could be drawn on the card itself.

What I have currently is that the cards are drawn to a RenderTarget at their originally designed size of 2100x1480 px. (I'll probably for game purposes have to scale that down to 1050x740 for its native size, but was designed that way to have 600 dpi for physical versions).

Anyway the way I want to do it is that after drawing everything to the RenderTarget I scale it down and store that scaled down texture to the card's texture (which will be 164 x 115 for the playing size, the 1050 x 740 is the zoomed in size that I want so players can view what the card does and stats). The issue that I'm facing is that the way I currently tried to do it was far too slow taking over 9 seconds to scale it down after drawing the original size to the RenderTarget.

Is there a way to scale a texture via GPU rather than by CPU? I'm currently using a CPU method as I'm new to working with textures and drawing.

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:
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:
How can I play a YouTube video in Unity if given the YouTube URL link? How can I play a YouTube video in Unity if given the YouTube URL link? I am using 2019.4.13
Is there a way to open webpages?

sentences:
Should I assign a unique ID to individual units of game currency? I am currently making a MMORPG.

At the moment, I am working on the currency part of the game but I'm confused whether I should assign a unique serial number for every unit of the currency generated.

I'm hoping to use this system to trace any misuse of the virtual currency but is this a common practice and if not, would this be a good idea on operational and / or performance point of view?

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:
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:
Efficiently storing game states history for physics? I would like to store the history of a box2d simulation. Currently I can't find any built-in mechanism for that.

I need to store the states of all non static objects in the last second, mainly for network latency correction.

I think I will use a multi dimensional array for all the rigid bodies positions and forces.

Is there a better way to achieve what I'm trying to do?

sentences:
How to rotate a 2d line? Its a very simple question.
How can i rotate a line by one of its endpoints by the angle rad?

Heres my current code ( I couldnt find a different solution )

void displayPlayer() {
    float rad;
    putpixel(x, y, 10);
    if (view > 360)
        view = 0;
    nx = (int)round(x*cos(view) - y*sin(view));
    ny = (int)round(x*sin(view) + y*cos(view));
    rad = (double)view / 180.0 * M_PI;
    line(x, y,nx,ny);
    putpixel(cos(rad)*(x + 10) - sin(rad)*(y + 10), sin(rad)*(x + 10) + cos(rad)*(y + 10), 10);

}

Heres a litte visualisation of my result:

The line is supposed to be 10 px long and keep rotating 360°. Ive indicated its origin with a green line.

What am I doing wrong?

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:
Best way to do multiple choice in Unity 2D? So I'm about to start development on a game in unity that is going to require multiple choice each choice having a some what unique function. I've thought of 2 ways of doing this but I'm unsure if there is an easier way as I've never really worked with unity.

So the first way I was thinking about doing this and I think better then the second would be to make a class for each choice with all the functions that belong to that choice in there and then just calling it when its needed. However, I don't know if this will scale very well as I will have over 100 different events with their own choices...

The second way I was thinking was to do it via JSON and then just code each function to parse that. So for example: addmoney, dothis, dothat etc... However this seems like a lot more work then it would be worth so I'm not 100% sure...

So I'm wondering what option would be better and if anyone else has any suggestions I'd love to hear!

sentences:
Wavefront *.obj loader in C++ I'm creating a game using OpenGL (via SDL) and C++ (via Visual Studios 2010 Professional). During the game, I will be using 3D character animation. I'd like to use wavefront *.obj files for all the 3D models (with the exception of terrain). The characters will need to have fluent movements (realistic), with as many as 250-500 frames (for walking, running, sprinting, jumping, crouching, crawling, etc.). I'd like to use either md2 or md3, but the 3D modelling/animation tool I'll be using (Blender 3D 2.57) doesn't support either one. The game will only be running on Windows.

What I need is a small yet powerful *.obj loader and parser that supports animation. It must be written in C++ and be usable by SDL.

Thanks

Alright, after looking at all the file formats that Blender can export to...I've decided to go with 3DS because it produces the smallest file format when I export the default cube. Thanks @Daniel For recommending 3DS!

sentences:
What is "ping pong" in the context of graphics rendering? I have to render a scene, once per light, and blend the result of the various passes. I heard and read that one way to increase performances and render targets to use would be ping pong.

I'm new to this context. What does this mean in terms of render targets + blending?

sentences:
Relative vertical alignment of 3 Texts on Canvas This is a menu that appears if I press Enter on the RE4 inventory if an item is selected. I have drawn a thin red rectangle around it:

And here is a video that shows some of the menu's effects.

I am familiar with a simple text canvas.
I understand that I need to make each line a separate "Text" object so that I can scroll up and down through them.

Here is what I have so far:

The problem that I'm facing now is that the Canvas will be scaled at runtime.
I don't work with fixed values.
This is a problem since I don't see how I could easily make it so that each TextLine object fills 33,3% of the canvas.

Am I right to assume that I can only solve this by making a scripts that holds a reference to each TextLine object and which then calculates their position when the scale of Canvas is known?

Or is there any easier solution?

Thank you!

sentences: 3D Particle-Geometry collision I am programming a particle engine for a 3D game written in XNA. I was wondering if somebody could point me in the right direction or perhaps give me some pointers in making the particles collide with geometry in game. In essence, I want to be able to make a spark emitter that will bounce and collide down say, a cylindrical tube.

sentences:
Resolving collisions after initial collision Given a sweep test for a ray, how do we check collisions after the 1st collision has been detected, and the ray has been deflected.

Physics system steps are:

Update velocities (gravity, etc)
Resolve collisions

The ray will intersect the floor, and will be moved back at the penetration amount.
The new velocity is calculated as a reflection

Update positions

The ray is now on the wrong side of the wall

This all happens in 1 frame

If the orange ray hits the floor just before the wall, the new velocity will tunnel the ray through the wall within one frame.
The naive way to fix this would be to after each collision check all the bodies again with the new velocity, but this can take multiple iterations if the ray bounces around in a corner. There is no way of knowing how many times the ray will need to be processed.

What would be a good way to fix this issue?

sentences:
How do I get pixel to hex coordinates on an array based hex map? I'm trying to make a pixel to coord function for a hex map but I'm not getting the math correctly, everything I try seems to be a little off, and the examples I've found were based on circled centered maps.

By 'array based' I mean the way the hexes are ordered, see pic.

The most accurate result I got was with the following code, but it is still off, and gets worse the more the values raise:

public HexCell<T> coordsToHexCell(float x, float y){
    final float size = this.size; // cell size
    float q = (float) ((1f/3f* Math.sqrt(3) * x - 1f/3f * y) / size);
    float r = 2f/3f * y / size;
    return getHexCell((int) r, (int) q);
}

Screen starts with 0,0 on top left, each cell knows its center.

All I need is a way to translate screen coordinates into hex coordinates. How could I do that?

sentences:
How do you make a camera look at a box and ensure all of it is visible? In most game engines (Unity, UE4) if we select a model and press F, the camera moves and focuses to the selected model. I want to implement that for my models.

I have a perspective camera and world space bounding box of the model.

How do I calculate the appropriate distance to view the entire model in the camera?

sentences:
How to align prefab to a accurate position with the best practice? I'm making a plumber game, I have a pump prefab, and pipe section prefab, which allows the user to connect the pipe during game, the pipe needs to be connected seamlessly during game, which means pipe prefab needs to be aligned in pixel level, please check below

User needs to add more and more pipe to connect the with each other, pipe is fixed length prefab.I've got choices,
1.Is the pipe prefab instantiated during game play a good practice? Because it might have many pipe prefabs, if the pipe goes a long way to another position, than there will needs to be so many pipe prefabs, compared to have procedrually generated pipe mesh during runtime, then a long pipe will not have to be cut off to the same small pieces?Which is good way to adpot?
2.If I use the same pipe prefabs to fabricate the piping system, how to accurately connect each other in pixel level, I can make the whole piping system in blender, then cut the system into pieces as my prefabs, then import to Unity as my first choice, this can do pixel level connection, but it seems to have better choice solely solved pixel level connection in Unity?
3.If I do it by generating the mesh during game play, then it could be complex especially it is hard to make elbow pipe mesh during runtime, or could you please advise me of some known library or package can do the work?

sentences:
How do we convert a pex file to a psc file? How do we convert a pex file to a psc file?

https://skyrim.nexusmods.com/downloads/file.php?id=2909

There used to be a file here that allegedly converted pex files to psc files, but it's no longer available, so I was wondering if there was a alternative GUI program that allows you to do this. I am trying to modify a pex file in a Skyrim mod.

sentences: Equivalent to Draw() method in Unity project? I have been using xna/monogame before this. So I read tutorials about unity, made some classes, loaded some sprites, everything "seems" to be going good, but I can't figure out how to add things into the environment, could anyone tell me or guide me to what's the equivalent of Monogame's Draw() method in Unity? Thank you.

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:
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:
Scalable server for MMO We are looking for the solution for game server for instantiating game instance on nodes.

We tried to use this solution, but it has scalable problems, as you can see on diagram:

Cause only 1 instance of Zone Master can be instantiate in same time and it doesn't support replication. So if it shuts down, players cant' play anymore.

So we are trying to find better scalable solution. Any suggestion?

P.S. game has more than 10k users online

sentences:
How do I detect whether mouse (or touch) is being pressed over thecurrent gameObject in Unity 5? I have a Canvas set as Screen Overlay, and an Image there. I want my image become an 8-direction custom pad, so I wanted to make a component script for the image.

In such behavior I would like to detect, on each frame (Update()) whether the mouse (or touch 0) is being pressed over the current object, say:

public class MyBehavior : MonoBehavior {
    void Update() {
        if (Application.isPlaying && Input.GetMouseButton(0)) {
            // TODO Verify the mouse is pressing over this.gameObject
        } else if (Application.isMobilePlatform && Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if (touch.phase != TouchPhase.Canceled && touch.phase != TouchPhase.Ended) {
                // TODO Verify the touch is pressing over this.gameObject
            }
        }
    }
}

What I need is:

Determine the pressed-over UI object is actually this.gameObject and not one which is overlapping in front.
Determine the position of the click, in the same coordinate space as the image being clicked.
My goal is to calculate the appropriate direction of the click (angle) wrt the pivot of the image. I will process that direction value. I will also calculate the appropriate distance to the pivot, and process it.

How can I achieve that goal?

(Notes: The test I want to do for standalones and mouse are actually for debug purposes)

sentences:
Keeping 2D camera within game bounds I have a simple camera class which works for following my character around, and has an adjustable zoom.  However, I cannot figure out how to keep the camera within the bounds of the world.  As far as I know, I can't just pull the X and Y coordinates of the Transform, so I don't know how to check if it is out of bounds.  Help greatly appreciated.

using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Game10
{
class Camera
{
    protected float _zoom;
    public Matrix Transform { get; private set; }

    public Camera()
    {
        _zoom = 1f;
    }

    public void DecreaseZoom()
    {
        if (Input.IsZoomDecrease())
           {
                _zoom -= 0.25f;
                if (_zoom < 0.25f
                {
                    _zoom = 0.25f;
                }
           }
    }

    public void IncreaseZoom()
    {
        if (Input.IsZoomIncrease())
           {
                _zoom += 0.25f;
           }
                if (_zoom > 4f
                {
                    _zoom = 4f;
                }
    }

    public void Follow(Player target)
    {
        var position = Matrix.CreateTranslation(
            -target.Position.X - (target.Bounds.Width / 2),
            -target.Position.Y - (target.Bounds.Height / 2),
            0);

        var offset = Matrix.CreateTranslation(
            Platformer.ScreenWidth / _zoom / 2,
            Platformer.ScreenHeight / _zoom / 2,
            0);

        var zoom = Matrix.CreateScale(_zoom, _zoom, 1);

        Transform = position * offset * zoom;

    }

}
}

sentences:
Unity - Make a Mirror character of player in movement What I want to achieve is :

I have a 3D game - with player in third person - and using cinemachine  Camera - imagine it like PUBG where you can look any where - the direction of the player does not change until the player is moving - the direction of character change in the same direction as camera

I want to make some sort of Shadow character as enemy , it will face the player - and mimic every movement exactly - not harmful

so when the player move forward - the other copy also move toward player - thus blocking his movement

so I want to achieve this using RigidBody - as Physics is needed to solve this puzzle

I tried different approaches- until I got to this code - it works OK - until I change the camera direction and then every thing is not working any more
     public Transform cam ;

    float speed = 10f;    //How fast the player can move
    float turnSpeed = 100;    //How fast the player can rotate

   public Animator animator; //Animation Control
    Rigidbody rigidBody; //Make sure you have a rigidbody

    void Start()
    {
        //Initialize appropriate components
        animator = GetComponent<Animator> ();
        rigidBody = GetComponent<Rigidbody>();
        cam = Camera.main.transform;
    }

    //No need for update function right now, physics work better in Fixed Update

    void FixedUpdate()
    {
        //right is shorthand for (1,0,0) or the x value            forward is short for (0,0,1) or the z value
        Vector3 dir =  (-cam.forward * Input.GetAxis("Vertical"))+ (cam.right * Input.GetAxis("Horizontal")) ;

        dir.y = 0;//Keeps character upright against slight fluctuations

        if (Input.GetAxis("Horizontal") != 0 ||Input.GetAxis("Vertical") != 0)
        {
                                                   //rotate from this /........to this............../.........at this speed
            rigidBody.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (dir), turnSpeed * Time.deltaTime);
            rigidBody.velocity = transform.forward * speed;
            animator.SetFloat ("Blend", 10);//Walk or run Blend works well here
        } else
        {
            rigidBody.velocity = new Vector3(0,0,0).normalized;
            animator.SetFloat ("Blend", 0);//Idle Blend works well here
        }
    }

    }

sentences:
How to handle collision detection & response in voxel engine with slopes? Voxels are fairly small
An object can span an area of 8x8x8 or more
Vertices of Voxel Type are always snapped to the grid:

Voxel types are convex (except the second type - which can be thought of as an OR between two rotated voxels of third type)
Including all the configurations of the above, there are 77 distinct voxel types.

Seems like there could be a fairly simple algorithm for doing collision detection and response between AABB / Bounding-Box / sphere and a single Voxel - considering the simple and rigid geometry restrictions in place, but I can't come up with one at the moment.

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:
Unity, Player isnt following along the waypoints I have a player with a Rigidbody, I want it to follow along the Waypoints, I have a script for it I tested it first on a Cube, everything worked fine, but on my character it just moves Towards the first waypoint then stays on the first waypoint instead of going ahead. Even if I comment out the LookAt Code section its not working. It could maybe cause the Y position of the waypoints that my player is stuttering, I changed it now. It is now moving along but stuttering much.

Here is a picture of the problem:

Here is my code:

public GameObject[] waypoints;

public float grindSpeed;
public float turnSpeed;

public int currentWaypoint;

private Animator anim;
private Rigidbody rb;

public bool isGrinding = false;

void Start()
{
    anim = GetComponent<Animator>();
    rb = GetComponent<Rigidbody>();
}

void Update()
{
    MoveAlongWaypoints();

    if(isGrinding)
        anim.SetBool ("isOnGrinding", true);
    else if(!isGrinding)
        anim.SetBool("isOnGrinding", false);
}

void MoveAlongWaypoints()
{
    if(isGrinding)
    {
        //TRANSLATE
        transform.position = Vector3.MoveTowards(transform.position, waypoints[currentWaypoint].transform.position, grindSpeed * Time.deltaTime);
        //ROTATE
        var rotation = Quaternion.LookRotation(waypoints[currentWaypoint].transform.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, turnSpeed * Time.deltaTime);

        if(transform.position == waypoints[currentWaypoint].transform.position)
        {
            currentWaypoint++;
        }
    }
}

void OnTriggerEnter(Collider other)
{
    if(other.gameObject.tag == "GrindWayPoint")
    {
        Debug.Log ("Waypoint!!");
        isGrinding = true;
    }
}

sentences:
Premake a texture in SDL (C++) and save it I am new with SDL, and am making a Conway Game of Life.

I want to make a grid appear on the screen, so of course I could make one manually with SDL_RenderDrawLine and two loops. But I don't want to create this grid every single time, once is enough, after I can just copy it to the screen.

So I want to create the grid once, and save it somewhere, like a texture.

The problem is, how do I draw to a texture ?

From what I understand, SDL_RenderDrawLine will need a renderer (which is associated with a window) and so it won't work for my purpose as it will be drawing to that renderer buffer or something, and then to a window.

How can I do that ? You can load an image instead, but I'll lose the whole point of drawing it algorithmically (what if the tile size change, etc).

EDIT :
So I'm trying to use SDL_SetRenderTarget, as well as the correct flag to create the texture. However it simply doesn't show up.

Here is the code that create the whole texture, and should render to it :

// part of my init function for SDL

SDL_SetRenderDrawColor(d_renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(d_renderer);
// Create square grid once
d_grid = SDL_CreateTexture(d_renderer, SDL_GetWindowPixelFormat(d_window), SDL_TEXTUREACCESS_TARGET, WINDOW_WIDTH, WINDOW_HEIGHT);
if (d_grid == NULL){
    fprintf(stderr, "Error creating blank grid texture: %s\n", SDL_GetError());
    return false;
}
SDL_SetRenderTarget(d_renderer, d_grid);
for (x = 0; x < MAP_WIDTH; x++){
    SDL_RenderDrawLine(d_renderer, x * 10, 0, x * 10, WINDOW_HEIGHT);
}
for (y = 0; y < MAP_HEIGHT; y++){
    SDL_RenderDrawLine(d_renderer, 0, y * 10, WINDOW_WIDTH, y * 10);
}
// TODO: Draw the grid to the texture
 SDL_RenderPresent(d_renderer);
// Renderer will now draw to screen again
SDL_SetRenderTarget(d_renderer, NULL);

I've checked it, the two loops does create what I want.

Now when I update the screen:

// Reset display
SDL_RenderClear(d_renderer);
SDL_RenderCopy(d_renderer, d_grid, NULL, NULL);

SDL_SetRenderDrawColor(d_renderer, 0x00, 0x00, 0x00, 0xff);

/* Code used to render the game grid, removed for clarity */

SDL_RenderPresent(d_renderer);

I don't understand how I'm supposed to do. According to LazyFoo tutorial, I need to use the SDL_RenderDraw* function, which will render to the texture, but using SDL_RenderPresent or not doesn't change anything. What am I doing wrong ?

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:
Make my Random.range not repeat same position So I want to make my array Gameobject transform to transform array points position but it will be randomized position when start only without repeating a position
so make some script like this:

    public GameObject[] collectibleAyatGO;
    public Transform[] transformPoint;
    public List<int> TakeList = new List<int>();
    private int randomNumber;

public void RandomTransformPosition()
    {
        TakeList = new List<int>(new int[transformPoint.Length]);

        for (int i = 0; i < transformPoint.Length; i++)
        {
            randomNumber = Random.Range(0, transformPoint.Length);
            while (TakeList.Contains(randomNumber))
            {
                randomNumber = Random.Range(0, transformPoint.Length);
            }

            TakeList[i] = randomNumber;
            collectibleAyatGO[i].transform.position = transformPoint[TakeList[i] - 1].position;
        }
    }

it seem not working or make my unity notresponding maybe due to while loop, Am I doing right here ?

sentences:
What happened to sprite::setSize in SFML2? I'm porting one of my old projects to sfml 2.0, and I had a background that I scaled using

sprite.setSize(windowWidth, windowHeight)

Now, it seems like setSize has ben removed in 2.0, and I'm wondering what the intended replacement is.

I know there is a setScale function, and that I could do something like:

auto size = sprite.getTexture()->getSize();
sprite.setScale(float(windowWidth)/size.x, float(windowHeight)/size.y);

but I think this is really ugly and clunky, is there another way to do it?

sentences:
Is there a way to reimport an asset with new import options? I'm trying to help out a friend with an Unreal issue.  He has a character model that's been imported and used in a map.  A bunch of work has already gone into setting up the scene before anyone noticed that the model was imported without morph targets, because for some bizarre reason Unreal's FBX importer has morph target import turned off by default and hides the option behind an "advanced options" section so you don't even notice it.
UE4 does offer the ability to reimport an asset, or even to reimport the asset with a new file, in the asset's right-click context menu, but neither of these actually fixes the problem because they don't pull up the import options dialog box that you get when importing a new model!  This makes it impossible to reimport the model with the morph targets turned on.
I could import the FBX as a new asset, which would give the import options box, but the existing asset is already in use, in multiple different places, and there doesn't appear to be any easy way to tell it "replace all instances of this model with that model."
Is there any good way to fix this that doesn't involve tearing everything down and rebuilding it from the ground up?

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 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:
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:
Why the cube is getting to the other cube instead stopping when both colliders hit? I don't want to use a script with OnTriggerEnter or something like that but to simulate the red cube as a wall and when the blue cube collider hit the red cube collider it should stop.
Both cubes have a box collider and on both the Is Trigger is checked true I also tried one of them or both when not checked true. And both colliders size on Z set to 3.

But the blue cube is getting to the red one and not stop when colliding :

The blue cube is getting inside the red one :

I tried to add a rigidbody to the moving cube the blue cube but if using Is Kinematic same behaviour if not using Is Kinematic the blue cube is falling down.

This is the script attached to the blue cube to move it to the target red cube :

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

public class MoveObject : MonoBehaviour
{
    public GameObject target;
    public float speed;

    // Update is called once per frame
    void Update()
    {
        transform.position = Vector3.MoveTowards(transform.position, target.transform.position, Time.deltaTime * speed);
    }
}

I want that the blue cube will stop when colliding the red cube collider that's why I set them on Z to 3.
I don't need physics for now.

Do I need must using OnTriggerEnter in my script for that ?

I thought I tried it too but this seems to be working :
Both box colliders on the cubes unchecked set false the is trigger and I added a rigidbody to the moving cube the blue one and unchecked the use gravity and now it seems to be working.

So I need a rigidbody even if I'm not using physics. I wonder why.

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:
Are there any alternative JS ports of Box2D? I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library.

I found out Box2D and its JS port.

http://box2d-js.sourceforge.net

It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?

sentences: Do I need to create an HLSL in XNA to display textures without content pipeline I currently have a jpeg texture stored as a Color array in XNA as RGBA. I also have the vertices of a cube in OBJ format mapped to VertexPositionColor vertex buffer using the VertexBuffer and Indices of the GraphicsDevice class. The OBJ has my jpeg mapped as a UV texture. I think I have all the Texture Coordinates as well(not sure, the array has 24 Vector3D values). I'm not sure where to go from here. I'm not using the Content Pipeline for my cube model or its texture though I'm wiling to add a custom .fx file if i need to. I realize I will have to add info about texture coords and color to my VertexDeclaration but do i need to write a custom effects file in HLSL to display my textured cube model or is there another way?

sentences:
Which opcodes are faster at the CPU level? In every programming language there are sets of opcodes that are recommended over others. I've tried to list them here, in order of speed.

Bitwise
Integer Addition / Subtraction
Integer Multiplication / Division
Comparison
Control flow
Float Addition / Subtraction
Float Multiplication / Division

Where you need high-performance code, C++ can be hand optimized in assembly, to use SIMD instructions or more efficient control flow, data types, etc. So I'm trying to understand if the data type (int32 / float32 / float64) or the operation used (*, +, &) affects performance at the CPU level.

Is a single multiply slower on the CPU than an addition?
In MCU theory you learn that speed of opcodes is determined by the number of CPU cycles it takes to execute. So does it mean that multiply takes 4 cycles and add takes 2?
Exactly what are the speed characteristics of the basic math and control flow opcodes?
If two opcodes take the same number of cycles to execute, then both can be used interchangeably without any performance gain / loss?
Any other technical details you can share regarding x86 CPU performance is appreciated

sentences:
Null instance on manager class extending from singleton class I have four classes:

class A, which is abstract and partial extending from singleton class C.
class A1, which is partial and extending from class A .
class B,  extending from class A.
class C, a singleton which has code to throw an exception if the instance is null, and otherwise uses DoNotDestroyOnLoad().

In scene view, I add class B to the scene. It works, but throws a null instance exception for class A, as it's instance is not present in scene. I think this is because class A extends from a singleton class, and it has ability to throw exceptions when the instance is null. I can not add the class A to the scene because it is abstract.

What can I do to in order to add the class A component to the scene, or otherwise not to get this error?

sentences:
Rigidbody physics concept: Why translate collision shape on-the-fly instead of mutating it? Crossposting at https://stackoverflow.com/questions/29993547/rigidbody-physics-concept-why-translate-collision-shape-on-the-fly-instead-of-m

I've spent some time going through physics engine's sourcecode in Java like JBox2D, Phys2D (both 2D) and JBullet (3D).

I observed that, while the rigid bodies move and are mutated in each step, the collision shapes that are attached to them, are not. Instead, they always stay located around the coordinate origin. When checking two rigidbodies for collisions, a "translation" object is fetched from each and is used to translate the two checked shape's vertices (or other defining properties, depending on the shape type) to their attachment's world position on-the-fly. These information are then used to detect collisions and react to them.

I've concluded the main purpose is, that you can reuse the same shape instance for multiple bodies, as they are stateless in the described scenario and save some memory as the needed information are calculated on-the-fly in each step.

However, I currently see more advantage in mutating the shape's positional properties as in their member values. Each shape's aabb and vertices would change ONE TIME in each step, so you don't need to calculate the same vertices multiple times when intersecting one shape to multiple other ones. Plus, you could also change areal properties (damage deformation) of the shape, because it is only used by one body.

So the questions is:

Why is it common to use positionally immutable collision shapes instead of mutable ones?

Edit:
Found quite the same question, but without much of an answer at Storing rigid body collision shapes in local or world coordinates

sentences:
Get shape of my bodies using Box2D I would like to get the shapes of my bodies, but I can't get anything, only null. Why?
Here is the relevant code section:

Body b;
while((b = box2d.physics.PhysicsWorld.world.getBodyList().getNext()) !=null) {
  Shape shape;
  while((shape = b.getShapeList().getNext()) != null) {

    Log.e("name",""+b.getUserData().toString()+" "+shape+" ");

    opengl.saveMatrix();
    Meshes.select(b.getUserData().toString())
              .translate((b.getPosition().x)*RATIO, (b.getPosition().y)*RATIO)
              .rotate((int) ((int) b.getAngle() * (180 / Math.PI)), 0, 0, 1)
              .draw(shape, 1, 1, 1);

    opengl.loadMatrix();

  }
}

shape = b.getShapeList().getNext() always returns null, and the log entry never ran.

sentences:
How 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:
Solve Constraints with linear factor of 0 in Bullet Physics In my code I need to set the linear factor for velocity to 0 (sometimes). For example, game->rigidBody->setLinearFactor(btVector3(0, 0, 0)); When this is done, collision detection continues to work, however, collision response fails to work. Essentially running as if there were not colliders at all. I think this is because it applies a velocity to solve the constraints.

Is there an alternative to setLinearFactor or is there another Constraint Solver which does not rely on velocity?

I am using the default btSequentialImpulseConstraintSolver();

sentences:
Access buttons individually made by a for loop (old Unity GUI, Unity Editor script) I've got a problem and I am struggling with this for a couple of days now.

I am making an Editor script and I want to access buttons individually when
created by a for loop. There is a public class ButtonNode which stores some variables
of the button like name and size.

public class ButtonNode
{
    public bool button;
    public string name = "O";
    public float sizeW = 25f;

    public void AlterButton()
    {
        name = "P";
    }
}

Then there is my Editor script in which I create the buttons. This is where I get stuck,
how do I access these buttons individually? For example, I want to change the name of the button
when that button is clicked. How do I do that? Because they are booleans (I don't
really know why, this is the legacy GUI) I can't access the transform.name components etc).

public static ButtonNode[] bn = new ButtonNode[10];

void OnGUI()
{
    GUILayout.BeginHorizontal();

    for (int i = 0; i < bn.length; i++)
    {
        bn[i] = new ButtonNode();
        if (bn[i].button = GUILayout.Button(bn[i].name + i, GUILayout.Width(bn[i].sizeW)))
        {
            bn[i].AlterButton();
        }
    }

    GUILayout.EndHorizontal();
}

sentences: What is the maximum value for a leaderboard entry in Google Play Services? What is the maximum value an entry in a leaderboard using the Google Play Services can have?

sentences:
Dynamic Game Server Architecture I'm trying to find a way to design a game server architecture for a real time mobile game. The design should be cost effective but still to some extend scaleable (later on).

Mobile client flow:

Connects to a distributor server which was given by DNS LB and gets grouped with x players. If y players are reached, the distributor server needs to contact a control server, which starts or uses a already running game server. The control server sends back the ip and port to the distributor server which then sends it to the grouped players.
The players then connect to the given game server. After the game the players will be send together to a new or same distributor server.

I wonder how the real server (VMs) for the game servers can be managed in a dynamic matter.
I have looked at AWS EC2 instances, but if we have 500 players with 6 players per group that play 6 hours per day, we would need ~84 EC2 t3.small (2 vCPU, 2GiB RAM) instances running. This will cost ~1,160.00 USD monthly. With this price it would be favorable to have real VMs and not dynamic cloud instances I guess?

Explanation of the components

Distributor:

Mobile clients will connect to these to get grouped with other players. It's like a lobby where players will sit until X players are reached or eg. a countdown ran out.

Control Server:

Need to take care of started server (VMs) and handle game server start requests from the distributors.

Game Server:

Is an authoritive like server client with physics etc. One game server (software) for X players in a group. Players will connect to these from the distributor after the lobby "phase".

Question:

How can this be dynamic scaleable/cost effective and is this a useable architecture?
I see one problem with the control server because it must take care of N game server vms and N distributors. But if we scale the control server, then every control server needs to know the same as every other.

(If anything is missing or can be improved, please let me know. English is not my native language so it's a bit challenging to express my goal in such a complicated topic like this)

sentences: Can I use the Minecraft avatar in my game as long as I texture it differently? I'm creating a block-based game and am ready to start developing the avatar. I would like to use the Minecraft avatar model but use my own higher resolution texture. Can I do this or will I be breaking some law or setting myself up to be sued?

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:
Game programming basics under Windows I've been trying to learn some Windows programming using the Win32 API. Now, i'm used to working with the OS layer being abstracted away, mostly thanks to libraries like SFML or Allegro. Could you guys help me out and tell me if i'm thinking right here.

The place for my gameloop is where i'm reading the messages?

while (TRUE)
{
     if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
     {
          if (msg.message == WM_QUIT)
               break ;

          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     else
     {
          //my game loop goes here
     }
}

Now the slightly bigger issue, that is, drawing. Do i run my drawing where i normaly do it, inside the game loop after the game logic? Or do i do it when WM_PAIN is being called and just call InvalidateRect (hwnd, NULL, TRUE); when i want to draw? This does feel weird, the WM_PAINT is a queued message, so i don't know for sure when it'll be called. So if i wanted to avoid this, do i just get the device handle inside the game loop and only ValidateRect (hwnd, NULL); in the WM_PAINT case (beside the ValidateRect (hwnd, NULL); called after drawing in the game loop)? Actually, now that i think about it, do i even need WM_PAINT in this situation or can i skip it and let DefWindowProc handle it (does it validate the screen if WM_PAINT isn't processed)?

If this is any important, i'm setting up my code for OpenGL.

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:
Autonomous robot - moving from 1 object to the next object This question falls in line with my last question: Unity 3D - create autonomous moving robot in house + first person camera movement

What I have

I have a 3D model of a house; a first-person camera with movement through the house; a robot that autonomously moves.

What I want

I want the autonomously moving robot to search the house for certain objects. I have placed 4 guns (same model) in the house.

This is the code I have now. This works for 1 gun; not multiple game objects:

using UnityEngine;
using System.Collections;

public class MoveTo : MonoBehaviour {

public Transform goal;

void Start () {
    NavMeshAgent agent = GetComponent<NavMeshAgent>();
    agent.destination = goal.position;
  }
}

What I want - extra

If possible, I want it to communicate with the person navigating the "game" with the first-person camera. For example, if it finds a gun, I want it to say to the person "playing" the game: I found a gun. If it finds the next one: I found 2 guns; I found 3 guns; etc etc.

For that, I used the following code for the player:

using UnityEngine;
using System.Collections;

public class UGV : MonoBehaviour {

    public Player player; //assign this variable in the inspector, or using another method

    public void CallMethodBInPlayer(){
        if(player != null){
            player.MethodB();
        }
    }

    public void MethodA(){
        //do something (Robot)
    }
}

And the same for the robot (but changed accordingly).

I will be honest with you that I have very little understanding of programming or Unity. I want you to know I've been looking for an answer for many hours but even though the idea might be too complicated for me just yet, I still hope you can (and want) to help me :)

sentences:
How to make a 2D sprite slowly vanish as it crosses a line — as if disappearing behind a wall? ...Except there is no wall. Only one of its edges.

Here is what I mean. Notice how the lines "sink" into the center square.

I've been trying to do something very similar, in Unity. My approach is to detect when the lines come into contact with the center square (hexagon, in my case), and first initiate an animation that decreases the width of the lines, precisely timed via math to last exactly as long as needed.

But there's a problem. The animation doesn't play. I've spent the last few hours debugging it, to no avail, and now have finally given up, because the problem is too complex to post here. Too many variables.

Are there any better methods of achieving this?

My own, even if it had worked, wouldn't have been perfect, because the width would've decreased on both sides (of the line running in the middle of the thick squares or hexagons that are to disappear), giving it a strange, swallowing effect, but I'd be satisfied, since it's just a practice project.

So, I'm giving up on this approach. What are easier ways to do this? (Preferably in Unity, but I'll take anything.)

Hasty edit: Keep in mind that my "lines" are not sprites but line renderers, but I'm looking for ways to work on either.

sentences:
How to find the resulting angle of a ball hitting a wall in 2D So there's a ball moving on a 2D plane with any vector. When it comes into contact with a collider, it should reflect in a linear fashion. What formula should be used in order to find the angle that this new direction should have? The pieces of information that are known are:

The X and Y velocity of the ball when it was hit
The angle it was travelling at when it was hit
The point of contact

I've found many solutions for if the ball can only hit vertical or horizontal walls, but have yet to find a one for a general case.

sentences:
Monogame apply tint to only some parts of sprite Each player is a different colour (Red, Blue, Green, Yellow) and I want a small part of each piece of armour to be tinted to the player colour.  Is this possible without using a second armour sprite that overlays?

I'm hoping for something along the lines of reserving a certain portion of colours (say various shades of magenta) to convert back to a player colour while drawing.

sentences: Import animated mesh without a rigged skeleton / armature How can I import an animation of a mesh that was not animated using rigging, skeletons, or armatures from blender? There's got to be a way.

sentences:
Scaling material texture to be 1pixel = 1 unit I have a mesh I use to render a sprite texture I set up in a material. This mesh is planar XY-aligned and stationary. It's vertexes are generated from a PolygonCollider.

The problem is that I'm using 1 PPU in the rest of my sprites, but the sprite rendered in the texture looks extremely small.

How can I make the scale of the texture's material, so the size of a pixel in the material is equal to 1 unit?

I can't just scale it, because I need it to be EXACTLY 1 unit.

sentences:
XMMATRIX XMMatrixRotationY wants the angle in radians or degrees? DirectX The documentation is totally unclear about it.
And also what does" Angles are measured clockwise when looking along the rotation axis toward the origin" mean? Are they measured clockwise looking from where?
Documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.matrix.xmmatrixrotationy(v=vs.85).aspx

sentences:
Particles to Denote Movement in Space I'm currently working on a WebGL project to realise an idea I've had for some years. On my desk is book on making a space sim written 15 years ago.

There I found some algorithm for particles in space. The idea is simple: A cloud of particles that stay in place so they fly past the player, but reset to be in front of the player when they move past the ship. This shows the player they're moving while there's nothing else around. For this, I reworked the algorithm found in the book a little:

ParticleField.prototype.updateCloud = function(frustum, position, direction) {
  var s = this.size, s2 = s * 2;

  for (var i = 0; i < this.vertices.length; i++) {
    if (!frustum.containsPoint(this.vertices[i])) {
      this.vertices[i].set(
        (position.x + s - Math.floor(Math.random() * s2)) + (s * direction.x),
        (position.y + s - Math.floor(Math.random() * s2)) + (s * direction.y),
        (position.z + s - Math.floor(Math.random() * s2)) +
                         ((s + Math.floor(Math.random() * s2)) * direction.z)
      );
    }
  }
};

Where s is the size of cloud. I played around with the sizes, but this simple function has several weaknesses.

The particles 'pop up' in front of the player when they're moving.
If the player backs up and moves backwards, the particles won't reset, leaving the cloud visible popping the illusion.
Particles appear to be flying through the player.

Without regard of how the particles look (they're simple points right now), how can I make this look more natural? I've seen the effect in games like Elite: Dangerous and Freelancer, and I'd like to be closer to them, and I'd appreciate any hint on the topic.

sentences: Is there a wall building tool in unity3d? I'm currently building a maze game in unity 3d and after building a few levels by placing and repositioning cubes by hand as walls, I think, that it would be nice if there was a tool to place walls, which are cubes with constant height and width, but have different length and rotations on the y-axis, by joints: you click to place a joint, and a wall goes in straight lines beetwen joints. So is there a tool like that?

sentences:
PhysicsJS on mobile devices: how to optimize for speed I'm (physics n00b) developing a small animation (gamification) in a mobile HTML5 app (PhysicsJS, HTML5, Cordova, Ionic, JavaScript).

This animation is derived from Basket of verlet constraints. This basket has to carry a lot more bodies (circles).

I'm experiencing performance problems, even on decent hardware (iOS and Android, the latter is worse). The bodies move like if they were in an aquarium. If I remove the basket, the performance is way better, but not yet satisfactory.

How can this be optimized in a sense that users don't have the feeling of watching a film in slow-motion?

Are there any tweaks to control the engine to do less calculation?

Am I using the appropriate physics engine or are there alternatives with significant better performance?

Remark: on my MacBook in Chrome, there is absolutely no performance problem and all movements are very smooth -> no aquarium.

sentences:
Variable Variables in unity using JavaScript? I'm working on a custom built save system for a project a friend an myself are working on. Currently all variables that are saved to file, are stored as static variables in a global variables script file. The current save system involves running through each variable individually and saving it a line on a document, completely hard coded and very annoying to expand upon with new variables and elements in the game. I've decided to look into serialization of the global variables file, however static variables are not serializable. My solution is to use a getter and setter function, that is called instead of the direct GV.whatevervariable, that we currently use.

Ive been looking for something that allows me to store a variables name inside of another variable and then call it.

for example, say the variable in the GV script is A , the function would look like

static function getter(vget){
    return GV['vget'];
 }
 var A : string = "testcode"

where the call code would look like:

 var stuff : string = GV.Getter("A");

the problem with this though is that I keep getting "system.type does not support slicing" I currently cannot think of any other way to do this, and would really prefer not to hard code a getter and setter for each variable.

sentences:
OpenGL Water reflection seems to follow camera yaw and pitch I'm attempting to add reflective water to my procedural terrain. I've got it to a point which seems like it's reflecting however when I move the camera left/right/up/down the reflections move with it.

I believe the problem has something to do with the way I convert from world space to clip space for the projective texture mapping.

Here is a gif of what is happening.
http://i.imgur.com/PDta5Qu.gifv

Vertex  Shader

#version 400
in vec4 vPosition;
out vec4 clipSpace;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main ()
{
  clipSpace = projection * view * model * vec4(vPosition.x, 0.0, vPosition.z, 1.0);
  gl_Position = clipSpace;
}

Fragment Shader

#version 400
in vec4 clipSpace;
out vec4 frag_colour;
uniform sampler2D reflectionTexture;

void main ()
{
    vec2 ndc = (clipSpace.xy / clipSpace.z) / 2.0 + 0.5;
    vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
    vec4 reflectColour = texture(reflectionTexture, reflectTexCoords);

    frag_colour = reflectColour;
}

I'm using this code to move the camera under the water's surface to get the reflection

float distance = 2 * (m_camera->GetPosition().y - m_water->GetHeight());
m_camera->m_cameraPosition.y -= distance;
m_camera->m_cameraPitch = -m_camera->m_cameraPitch;

If this is insufficient code to diagnose the problem, I'll post more. I tried to keep it to what I thought could be the problem.

sentences:
I can't create a "trap" block So, I am trying to make a "trap" block. It should kill the entity that will stand on it(or walk as in the code, if somebody knows how to make that it will do something while an entity stands on it, it will be helpful). Here's the code for the block:

package com.daniel_sl.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

public class Trap extends Block{

  public boolean isDead;

  protected Trap(Material material) {
    super(material);
  }

  public void setDead()
  {
    this.isDead = true;
  }

  public void onEntityWalking(Entity Entity){
    if(Entity instanceof EntityLiving){

      Entity.setDead();
    }
  }
}

When I stand on the block it doesn't do anything.

sentences:
Android Object get Jagged at the border I am new to OpenGL ES 1 in android. My 3D Model border getting Jagged. Please help me to look like a smooth border instead of jagged.

Screenshot : http://i.stack.imgur.com/1Gq83.png

private class Renderer implements GLSurfaceView.Renderer {
    public Renderer() {
        setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        getHolder().setFormat(PixelFormat.TRANSLUCENT);
        setZOrderOnTop(true);
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        gl.glClearColor(0.0f,0.0f,0.0f, 0.0f);
        gl.glDisable(GL10.GL_DITHER);
        gl.glEnable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_BLEND);
        gl.glBlendFunc(GL10.GL_SRC_ALPHA_SATURATE, GL10.GL_ONE);
        gl.glDepthFunc(GL10.GL_LEQUAL);
        gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glShadeModel(GL10.GL_SMOOTH);
    }

    public void onSurfaceChanged(GL10 gl, int w, int h) {
        mViewWidth = (float)w;
        mViewHeight = (float)h;
        gl.glViewport(0,0,w,h);

        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluPerspective(gl, 45, mViewWidth/mViewHeight, 0.1f, 100f);

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
        gl.glPushMatrix();

        gl.glDisable(GL10.GL_DITHER);

        GLU.gluLookAt(gl, 0, 0, 10, 0, 0, 0, 0, 1, 0);

        //draw_model
        gl.glPushMatrix();

        if(mOrigin != null && mRotate != null) {
            gl.glTranslatef(mOrigin.x, mOrigin.y, mOrigin.z);
            gl.glRotatef(mRotate.x, 1f, 0f, 0f);
            gl.glRotatef(mRotate.y, 0f, 1f, 0f);
            gl.glRotatef(mRotate.z, 0f, 0f, 1f);
        }

        if(mModel != null) {
            mModel.draw(gl);
            if(!RendererView.textureFileName.equals(""))
                mModel.bindTextures(mContext, gl);
        }

        gl.glPopMatrix();
        gl.glPopMatrix();

        if(isPictureTake) {

            w = getWidth();
            h = getHeight();
            b = new int[w*(y+h)];
            bt = new int[w*h];

            IntBuffer ib = IntBuffer.wrap(b);
            ib.position(0);
            gl.glReadPixels(0, 0, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, ib);
            createBitmapFromGLSurface(context);
            isPictureTake = false;
        }
    }
}

Thanks in advance.

sentences:
How do I set up a dedicated server for my multiplayer Unity game? I've made a multiplayer game with Unity and Mirror networking, and it all works perfectly when just running it on my own computer. However, I am trying to host on a dedicated server so that I can put the project on my portfolio and not have to worry about whether players can log in and test/play the game or not.
I tried a AWS Free server and I see that the Tanks example from Mirror is working just fine (although laggy), but my own project doesn't. I think this has something to do with the RAM limit of the free server but I'm not sure. I can see the task manager going up to 95% memory usage. When I remove some particle effects and geometry and enemies, it works.
I'm not sure if this is my code that is so cloggy or the server or both. In any case I would need a solution for this but I don't know what my options are.
Would be great if anyone can point me in the right direction. Thanks!

sentences:
Confusing with an articles wording on Clamping a Vector2 I have been reading an article on Collision Detection and how to resolve it.

http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/

In the section describing an AABB vs Circle, it states:

  The first step is to get the centre of the circle and project it on to the boundary of the AABB. Fortunately this is as easy as forming the vector V between AABB and circle and simply clamping it against the half extents of the AABB.

In the picture provided, it makes sense. You get the vector between the two objects, and then get the closest virtice to the circle and use that in your computation.

But, how DO you take the width/height into account to that new vector? He says "..simply clamping it against the half extends of the AABB"

Can anyone clarify what he means?

sentences:
Unity 5 Animation attaching I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update ()
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

sentences:
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:
How can I get visually accurate collision normals with sphere collisions? I'm solving simple 3D sphere collisions by checking the sphere for overlap with a mesh, finding the nearest point on that mesh's surface to the center of the sphere, and then resolving the collision by moving the sphere out of the mesh using the normal and the penetration distance.

To find the normal, I'm using the normalized vector from the nearest point on the mesh to the center of the sphere.

Now I'm trying to resolve a collision where the sphere has overlapped more than one collider. How I'm currently solving it is by iterating through all the meshes and checking to see if the last correction solved the collision.

In the scenario shown in the bottom image, this can cause a problem when trying to determine a collision normal. The two collisions return two different normals, as they should (Though, Depending on which collision was resolved first, the correction from the right box would solve the collision with the left box, in which case there would only be one normal).

Now, mathematically, that all makes sense, but visually causes a problem. If I'm trying to determine a single normal to, say, bounce the ball off the surface create by those two meshes, any normal that takes both collision normals into effect would be inaccurate. Visually, one would expect the collision normal to be straight op, but since one of the collision normals is at an angle, I would need to somehow determine that that is a sort of "false" normal.

The solution that comes to mind is to order the collision checks by their distance from the sphere, thereby ensuring that, in that scenario, the angled normal never even comes into play. Is this an accurate way to do this, or would that cause other problems I'm not seeing?

sentences:
Lighting changes when loading scene I have a script that changes the levels using

Application.LoadLevel (sceneNameToChangeTo);

Once a level is loaded using that code when testing with the editor, the lighting changes dramatically. I've checked if something changes in the light or lighting settings, but it doesn't.

This is a screen of how the scene looks when I simply press RUN in the scene in the editor:

Notice the blue tints from the sky etc. This is clearly PBS lighting.

Now after I use my code to change the scene to another one and then back to this one, the scene looks like this:

What am I doing wrong? I am using Unity 5.0.1. This effect does not happen on mobile devices.

sentences:
How can I customize an FPS game? I want to create a customized (modded) fps game where I can change the look and feel of the game to match my intended theme.

Some of the things I would like to do:

Create a custom map (terrain).
Add custom sound effects
Change AI (For example, running away instead of actively looking for combat).
Change menus and add some storyboard.
Script events in game (like a countdown until game over)
Change the models of the NPC's.

What options do I have? Is there any platform/game/engine/whatever that allows one to do the things above in a reasonable way?

I work as a programmer so I'm not afraid of coding some part of the project, but to save time it would be nice to work in some high-level way (like scripting or configuration files).

sentences:
how to handle interactive choice in the middle of the game loop? I am programming a turn-based game, 2D tile-based, overhead view.
I have an update function and a render function running in separate threads.
When it's the player's turn, the player can e.g.

select a target tile from the map
then a popup menu with the available interactions appears
player selects interaction and the interaction gets executed

One tedious way is the following:

GameLoopUpdate():
        switch( interaction_state )
            case tile_selected:
                lookup_interactions_for_selected_tile()
                break
            case tile_and_interaction_selected()
                execute_interaction_at_tile()
                break
             default:
                break

Of course the above does not scale when the interactions get complex.

Conceptually, I would like it to be more like:

KeyListener():
    if tile is clicked
        set_tile_selected()

GameLoopUpdate():
    if tile is selected:
        interaction  = spawn_thread_interaction_selection()
        execute_interaction_at_tile( interaction )

where the spawned thread would somehow override the input listeners AND the rendering. But this looks bad as well.

Another idea (I'm starting to consider implementing this) is the following:

GameLoopUpdate():
    if it's player's turn
        set next state as PlayerState_Base
    else
        run ai turn

PlayerState_Base():
    if tile is selected
        set next state as PlayerState_TileSelected

PlayerState_TileSelected():
    if interaction is selected
        execute interaction
        set player's turn as done

where each state above would have dedicated key listener and rendering functions

Any other ideas?

sentences:
How can we view 3d objects from top down view in TD game I am making a tower defense game. I am working in x and y axis only. I have made a grid, snapped towers and made a pathfinding algo to run enemy. Initially I have worked with cubes and spheres in place of towers and enemies.

Now I am going to place real towers (3D). Note that I haven't used z axis up till now. The user will analyze the game from top down view.

I want the user to see towers placement with a little bit of 3d view but I have made my all code in 2d thing. Is there any solution to my problem that somewhat tower placement would view a 3D touch or you can say 2.5D ?? (like fieldrunners) or should I have to involve z axis and ignoring y axis ?

sentences:
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:
How do I efficiently perform collision detection on an NxN rectangle grid? I have a simple level that is constructed from an NxN rectangle grid. Some of the rectangles are walls, and some of them are the path. The player is allowed to move only on the path they are on and also the path rectangles on the grid. So I have two kinds of rectangles in the grid:

"path"
"wall"

The player is a sprite above the grid. I want to efficiently find if the player is colliding with the wall. I want to loop through the rectangles, to see if they intersect. What is the best method?

sentences:
What is better? Lots of small TCP packets, or one long one? I am sending quite a bit of data to and from a server, for a game I'm making.

I currently send location data like this:

sendToClient((("UID:" + cl.uid +";x:" + cl.x)));
sendToClient((("UID:" + cl.uid +";y:" + cl.y)));
sendToClient((("UID:" + cl.uid +";z:" + cl.z)));

Obviously it is sending the respective X, Y, and Z values.

Would it be more efficient to send data like this?

sendToClient((("UID:" + cl.uid +"|" + cl.x + "|" + cl.y + "|" + cl.z)));

sentences:
How can I efficiently render to multiple screens? I know XNA is long dead, but I need it to update an old project. (I would have ported to MonoGame, but can't get multi-monitor support in it.)

My game does the following:

Wait for some objects which I get from server (in another thread)
I have some components which represent queue (about 5)
When the objects arrive, I generate texture based on the unique information, get a sprite from pool, apply the textures and add it on queue.
The game animates the queues from left to right (when one object is added to queue)

So you see lots of unique textures moving on the screen (the update is pretty fast).

Now I need to run two instance of the game to multiple monitors, and there is lag. The frame rate keeps dropping low and clearly the animation is not smooth.

Is running two games on two threads for two monitors a good idea? What could I do instead (running them on seperate processes)?
Could some one suggest a rendering optimization like skipping frames or something like that or how can i synchronize between the two instance ?
Or, even better, how can I draw on two screens from same game instance?

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

I came up with some solutions:

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

Is there any easier way to do this?

sentences: Can you embed a Unity3d mobile project into an existing native mobile app? I am creating an application for both Android and iPhone that will have a few mini games in it. I would like to create the non game section in native Android and iPhone. My question is, is it possible to have a native app that will incorporate the Unity mini game I am creating all inside one apk and ios project?

sentences:
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 change default third player controls in unity, to work with touch? I am developing a game for my project using Unity 3d and have currently used the third player controller available in standard asserts.

I have to export it in android phone so need to modify the player controls to work with touch inputs... But I am a beginner and finding it very complex to modify the ThirdPersonController script...

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:
Advantages and disadvantages of libgdx I've been an android developer for a while and am thinking about getting into gaming. While looking for a game dev framework, I thought libgdx provides very friendly documentation and functionality. So I would like to use it if there is no big obstacle.

But when I tried to see how many developers employ this library, I could find not that many. Is there anything wrong with this library? In other words, I would like to know its advantages or disadvantages from any experienced developer.

UPDATE: After reviewing its documentations and trying to build simple games with libgdx, I decided to go with it as its documentations are good enough and its community is very active. What I liked the most is that it provides a bunch of demo games that I can learn a lot from.

sentences:
Java Graphics - big images slowing down I'm working on a little game for learning purposes so please don't recommend me to use any library like libgdx or slickutils.

I have just one simple question. Does rendering bigger images with Graphits.drawImage(); slow the Process down?

I'm currently drawing about 200 little Objects (PNG, 64x64 resized to 48x48), but they don't seem to be an issue (i know resizing them each frame is not very performant).

The game slows down as soon as I draw the background with a parallax effect (several layers and at least 3 seamless fitting objects per layer).

They Art drawn in their original size 900x900 Pixel. But they keep slowing the game down. It's only the graphisch.drawImage(); Part. The Rest of the calculation doesn't seem to affect the game at all.

I store all Images I need once when starting the game in a class called Resources in BufferedImages.

I hope someone can explain this to me.

sentences:
Is it feasible to use a DHT to span an MMO over many servers for improving reliability? At the moment I have an idea for how to handle distributing MMO servers. At the core is a bunch of worker nodes that all share the same set of distributed hash tables. Each DHT stores a specific game component. Each frame a coordinator server (which there can also be many of) pushes work out to all of the connected worker nodes and wait for them to complete all of the assigned tasks.

The system is also divided up into four parts: the client, which obviously the player uses. The proxy server that sits behind load balancers and users connect to. All they do is process incoming user packets, verify them and passes the request to the work cluster. The work cluster receives packets from proxies and append them to a process queue and wait for the frame event from the controller node to process them.

I just want to know if adding a DHT to the worker nodes like this would be feasible? This should allow redundency and high availability out of the box as DHT's are quite good at that.

sentences:
Speed after an angled collision? I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle.

Physics paramaters:

Player Physics :
    radius : 15,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass : 2
    damping : 0.96101

Ball Physics :
    radius : 8,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass: 1,
    damping : 0.9902

Gif image(angled): haxball gif angled

Player speed on start: Vx: 5, Vy: 0

Ball speed on start: Vx: 0, Vy: 0

Player speed on collision: Vx: 3.4189778846153844, Vy: -0.9240480769230772

Ball speed on collision: Vx: 2.7721442307692317, Vy: 1.8480961538461544

The formula i use(this formula can calculate the speed when there is no angle):
Formula image: Formula image

V1 = (m1*u1*k1 + m2*u2*k2 + m2*C1*C2*(u2*k2 - u1*k1)) /(m1 + m2)
V2 = (m1*u1*k1 + m2*u2*k2 + m1*C1*C2*(u1*k1 - u2*k2)) /(m1 + m2)

C1 and C2 bounce coefficient of player and ball.

How can i do?

sentences:
Is my understanding of designing games in layers correct? I have started explaining how a game is designed in layers to a friend of mine. I want to make sure that I explained things, correctly, so I wanted to verify my thoughts.

Basically, the way I understand it, games are designed with the following layers, in the following order:

Rendering Engine
Physics Engine
Game Engine
Scripted Game

Is this correct?  Am I explaining this right?

sentences:
Semi-transparent mouse cursor on Windows I want to change the mouse cursor for a desktop game I am writing with libGDX. That is working well under Linux, however, under Windows semi-transparent cursor pixels are not being rendered at all. That means I am unable to anti-alias the cursor image.

For sure there must be a way to render semi-transparent mouse cursors under Windows, like it's possible under Linux. Any ideas what I could do to solve this issue?

sentences: Other than the ESA are there other sources for demographic data? I'm pretty interested in seeing demographic data as I find them good targeting tools. But other than the ESA reports (free) and NPD numbers (paid) does anyone know any other sources for such data?

sentences:
How to reconcile depth ordering with minimal shader context changes? We generally want to minimise shader-program switches (glUseProgram and all associated context changes) for the sake of performance. AFAIK it is not uncommon to render by shader program, i.e. group draw calls of all mesh instances that use the same set of shaders - or vertex shader at least (i.e. that have the same set of vertex attributes), for this reason.

How then do we go about doing both depth ordering and shader program changes, quickly? Because it seems to me one either orders primarily by program (thus minimal program context changes), or primarily by depth (frequent context changes), and that they're mutually exclusive in terms of maximising performance.

PS. In my current work I'm not using the hardware Z-buffer, instead I'm using the painter's algorithm prior to making all draw calls... If this affects the answer to the question at all, I'd be happy to hear solutions for both sorts of depth-ordering.

sentences:
How does Visual Studio integrate with Unreal Engine better than Code::Blocks does? Background: I want to start using Unreal Engine 4, but I'm not sure which IDE I should use. I've narrowed it down to Code::Blocks (which I want for a couple good reasons) and Visual Studio 2015 (which is the industry standard).

I know that Unreal is made to use VS and it thus integrates far better with it (e.g. debugging Unreal projects apparently works in VS but not C::B). However, I haven't found any other examples of VS's superiority in this situation, and without the context of Unreal I would definitely like to use Code::Blocks instead1.

So, how does VS integrate with Unreal better than C::B does?

Note: I am not asking which is better, and I am not asking for a general comparison between the two. I just want to know exactly why people say VS is better with Unreal, so I can make an informed decision.

1Reasons: I am likely going to want to be on Linux in the near future, so I would like to get used to Code::Blocks now instead of having to learn how to use two different IDEs. Also, I am working on coding with some of my friends and for various reasons they won't/can't use VS. I would prefer to use the same IDE as them, so that we can keep stuff consistent.

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:
On/off buttons in Phaser I am trying to make an on/off button for audio in Phaser, and when you click on the button once it shows the off button, but when I click on it again, the on button does not show.  Right now I did not implement the audio feature, I am just working on the button itself first.  Here is the code:
 soundOnOff() {
 gameState.on = this.add.image(this.config.width - 20 , 0 + 30, 'on')
 .setScale(2);
 gameState.off = this.add.image(this.config.width - 20 , 0 + 30, 'off')
 .setScale(2)

 gameState.on.setInteractive();
 gameState.off.setInteractive();
 gameState.off.visible = false;

 gameState.on.on('pointerdown', () => {
 gameState.on.visible = false;
 gameState.off.visible = true;
 });

gameState.off.on('pointerdown', () => {
gameState.on.visible = true;
gameState.off.visible = false;
});

}

Please tell me how I can fix this! Also, how do I make my bird, in gameState.bird, not jump when I click the button.  Thank You!

sentences:
How to test a 3D rendering engine? Me and some friends developing simple 3D rendering engine as practice for the university.
We used Ogre 3d as prototype and now we are developing it from base

The engine is wrapped up in simple game that asks the user to select shape (circle, triangle, square...), color and dimensions and renders the image to the screen. It also enables to move and rotate the shape on screen using mouse.

We would like to test automate the view rendering.
I could not find any test framework for this issue and I would like to know how 3D test is done in non manual matter

sentences:
What is a good rule for blocking projectiles on a square grid? Suppose we have a square grid, and each tile may or may not be occupied by an object. Some of those objects can be a unit that can launch a projectile at another unit. However, that projectile should be blocked if a third unit is "in the way" of the projectile path.

What I want is a rule for whether a projectile path is "blocked" from one tile to another, based on possible intermediate tiles blocked by an object. The blocking rule should satisfy the following criteria:

1) It should be based only on the information about the relative position on the grid of the two tiles, and the occupation of tiles by objects. Details such as which object is occupying a tile should not matter. Imagine the same rules would apply with placing stones on a Go board

2) It should be as obvious to the player as possible what the projectile blocking rules are. Imagine they could move a ranged unit to a tile to get a shot, and that movement is irreversible. If they later find out that the shot they wanted to make is blocked, they essentially got screwed over by a game mechanic. I don't want people to lose a game because of opaque mechanics. It should be as obvious as possible to the player that the shot they want to make form a tile is blocked before moving to that tile.

3) The rule should be generally applicable, not just a heuristic for a non-general set of possible scenarios. Given any two integer coordinates, {X1, Y1} and {X2, Y2} we should automatically be able to name the coordinates of all tiles that block those two coordinates.

4) The rule should be invariant to 4-way rotation, translation, and reflection along either axis.

Some rules would be obvious. For example, if your shot is completely horizontal/vertical (rook movement) or completely diagonal (bishop movement) and something is directly in that path, it should be blocked.

But there are cases that are not completely obvious to me, and different rules have been followed in different games. For example, what if the projectile launcher and target are separated by a knight's path? Is an object blocking the projectile if it lies on one of the two tiles that sit between the launcher and target along the long axis of separation? I have seen that being a valid block in the game Hero Academy, though it's not obvious to me that it should be.

EDIT: I realize that point #2 can be addressed with a nice UI that can inform the player of whether a path is blocked before they commit to their move. However, even if the UI does that, I still want it to be obvious to the player, independent of the UI. (If the player has to play a few games to learn how it works, that's fine, as long as it's easy to learn.) This aligns with my general philosophy that one should maximize the proportion of cognitive effort that goes towards strategic decision making, and minimize the proportion of cognitive effort that goes towards figuring out game mechanics on the spot.

sentences:
How to 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:
Processing periodical operations on the database I program MMO strategy game (C# monogame) like Goodgame Empire or Travian for Windows Phone.

The server part of the game will run on Windows Server and MS SQL database.

I'm trying to figure out a way to perform periodical operations over players' data. My point is that, for example farm will produce one piece of food every minute and I need store it to database in real time.

I thought about that when registering a new player would cause the database start new job, but for example at 2000 players on the server I'm not sure if I do not
kill performance. I want to find optimal solution and I wanted to ask your opinions on what you think would be the best solution.

sentences:
Game synchronisation in peer-to-peer online multiplayer game I am developing an online real-time multiplayer game using Google Play Game Service and Cocos2D-X. The game has two players where each player control their own ball.

The each player sends their own ball’s velocity and position to the other connected device. In my game, all the physics calculations are done locally on each devices i.e. ball velocities after physical calculations are calculated locally on each devices.

Issue:

When fast moving ball collides wth the opponent’s ball, there is no change in the movement velocity of the opponent’s ball. (According to real world physics, the fast moving ball should be able to push the opponent’s slowly moving ball.)

Reason:

During my code analysis, I understood that the velocity calculated by the local physics engine are overwritten by the data received from the opponent’s device.

For e.g.

Solution I tried:

To fix the problem, whenever the collision between balls occurs I am creating one of the device as server and other device as client. All the physics calculations occurs on the server device and data is send to the client device.

I have following questions:

Is the solution tried by me is optimal solution to fix the issue?
What other approaches can be tried to fix such type of issue?

I would appreciate any suggestions/thoughts on this topic. Thank you.

sentences:
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:
Angled topdown perspective camera for 2.5d game I have a 2d tile based game created using Unity's 2d tools and orthographic camera:

The tiles are created by programmatically generating a mesh, assigning a texture to each pair of triangles, and setting the normals to -Vector3.forward.

I'd now like to switch to a perspective camera, to add a 3d feel to the tiles, while still using sprites (and following the player):

How do I go about setting up this kind of camera, and will it still be possible to retain the player's x/y co-ordinates which are heavily used in my game logic.

Thanks in advance!

Update: I've realised that in terms of my original grid and sprites, I simply need to swap their vectors Y and Z co-ordinates so that the tiles and sprites are nicely positioned in the scene, however I'm still unsure about how to nicely position the camera and center it on the player.

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:
mixing forward and deferred rendering Simplified version of my deferred rendering looks like this:

bind fbo1
clear color and depth buffers
gbuffer stage (gbuffer contains only these pixels which pass a depth test)
unbind fbo1
bind fbo2
clear color buffer
draw a full screen quad, shading stage (render to the texture for some post processing effects)
unbind fbo2
clear color and depth buffers
draw a full screen quad and render to the default framebuffer

How to combine that with the forward rendering ?

sentences:
How do I load real-world map terrain? I'm new to game development and want know how to make or load a terrain from OpenStreetMap or Google Maps in your current city. (I'm using Unity3D.)

My idea is just load or generate a map of the current location, without collisions or anything else. A good example could be the Google's game "Ingress".

I found a few tutorials but only for a static city or mountain.

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:
How to work with edge Texture Im not sure if i use the right terms, but im not able to find something to start with.

Im trying to develop a little HTML5 game. I have a ground with a texture and now I want to make a surrounding texture. The texture is an image wich should be bend around the ground.

At the moment im using easelJS for display my images/textures. So im looking for some sort of Tutorial/Script/Advice. Im not even sure if I can bend a image in javascript. So the worst case I can think of is split the image in 100 pieces and then put it back together and rotate each piece.

for example like this:

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:
How can I implement smooth digging effects in a tile-based game? I'm trying to make a Dig Dug styled game where you will be digging into a material. This is going to be a tile-based HTML5 game and I have decided to use the Phaser framework.

One way to do the digging mechanic is to break the play area into tiles and remove tiles as the player sprite collides. But I would like to have a smooth digging animation/physics, so it appears that the player character "carves" out the soil as it digs through. Any tips on how I should do this? Right now I have 15x15px tiles while the player is 45x45px, this sort-of fakes the smooth digging I want. Is there a better way?

sentences:
What is the name of the perspective style of games like Final Fantasy 6, Chrono Trigger or Alundra? What is the actual term for the 'top-down' style of the Super Nintendo games such as Final Fantasy 6, Chrono Trigger, et cetera. I'm looking for the equivalent term of:

'isometric' - (Jaggered Alliance, Final Fantasy Tactics, Fallout),
'first person' - (Half Life, Doom, Quake),
'birds eye' - (Grand Theft Auto)
? insert term here ? - (Final Fantasy 6, Chrono Trigger)

sentences: Common mistakes when developing a game with Socket.io and Node.js I am not a game developer by trade but am working on a card game (that is real time, not turn based).  I was wondering what the common mistakes are that people make when new to this sort of development so that I can avoid them!

sentences: What are useful server metrics to gather for a table card game? When building a game server intended to accomodate large numbers of simultanous games (e.g. table card games), where the server manages lots of tables and each table has up to a small handful of users, what metrics are most useful to collect and why?

sentences:
How to implement camera pan like in Maya? I am trying to implement camera pan like the one in Maya. I've got it almost working.

The problem is that the mouse cursor is moving faster than the 3d mesh (in fact I am moving the camera but I said mesh, because it is more intuitive), while in Maya the distance between the mouse position and the mesh stays always the same.

This is what my code looks like :

glm::vec3 dist = cameraPos-modelPos;
float len=glm::length(dist);

float clipX = startX*2.0 / width - 1.0;
float clipY = 1.0 - startY*2.0 / height;

float clipEndX = lastX*2.0 / width - 1.0;
float clipEndY = 1.0 - lastY*2.0 / height;

// convert begin and end mouse positions into world space
glm::mat4 inverseMVP = glm::inverse(projection*view*modelMatrix);
glm::vec4 outVector = inverseMVP*glm::vec4(clipX, clipY, 0.0, 1.0);
glm::vec3 worldPos(outVector.x/outVector.w, outVector.y/outVector.w, outVector.z/outVector.w);

glm::vec4 outEndVec = inverseMVP*glm::vec4(clipEndX, clipEndY, 0.0, 1.0);
glm::vec3 worldPos2(outEndVec.x/outEndVec.w, outEndVec.y/outEndVec.w, outEndVec.z/outEndVec.w);

glm::vec3 dir = worldPos2 - worldPos;

glm::vec3 offset=glm::length(dir)*glm::normalize(dir)*angleFovRatio*len/2.f;
cameraPos-=offset;
cameraTarget-=offset;

Where angleFovRatio = std::tan(cameraFov*0.5f)
I am using glm::lookAt(cameraPos, cameraTarget, cameraUp); for my view matrix

I will add picture of what my problem is:

As you can see, when I drag to the right, the red dots are my begin and end mouse positions. But the teapot is on the blue dot, which is not what I want.
It must be centered on the second red dot (mouse end position, just like in maya).

sentences:
Why the plane is not black? I created a new material and changed the material colors to make it black:
R,G,B all value is 0 and A value is 255

The shader on the Plane is: Legacy Shaders/Transparent/Diffuse

But the Plane seems to be transparent.

The main goal is put a plane in front of the camera the FPSCamera and then using a script to fade in/out the alpha color.

sentences:
How do I calculate a new position from current and target position for intuitive non-instant dragging? I have a simple 2D game where I can move an object using the mouse. I've been improving on the 'feel' of the movement gradually, however it still doesn't behave as you'd expect if the object were to be moved by human hands in a real-world scenario. My improvements were as follows:

New position = mouse position
Sharp unrealistic movement. No max speed.

Cap the maximum speed
Nicer. Still stops abruptly. Doesn't accelerate smoothly

Add 'inertia', recording last change in position and applying it to subsequent moves

Vastly improved, however...

Object is dragged as if on elastic, slow to accelerate, very slow to stop.
Once moving, object oscillates or orbits around a stationary mouse position.

I'm looking for suggestions on how to make the movement more intuitive:

Moving an object from A to B a human would rarely overshoot

A user shouldn't need to correct against inertia to stop an object

I'd like to be able to adjust the weight of the object so that heavier things are harder to get moving

My current code is as follows:

float maxInertiaChange = 0.1;
Vector2 lastPosition = Vector2.negativeInfinity;
Vector2 inertia = Vector2.zero;

private Vector2 InterpretPosition(Vector2 mousePosition) {
    Vector2 newPosition;
    if (lastPosition.x != float.NegativeInfinity) {
        newPosition = lastPosition + (inertia * Time.deltaTime);
        newPosition = GetPointTowardsTargetWithMaxDistance(newPosition, mousePosition, maxInertiaChange);
        inertia = (newPosition - lastPosition) / Time.deltaTime;
    } else {
        newPosition = mousePosition;
    }
    lastPosition = newPosition;
    return newPosition;
}

private static Vector2 GetPointTowardsTargetWithMaxDistance(Vector2 startVector, Vector2 targetVector, float maxDistance) {
    float lerpScale = maxDistance / Vector2.Distance(startVector, targetVector);
    return Vector2.Lerp(startVector, targetVector, lerpScale);
}

Thanks in advance!

sentences:
Effective way to check if an Entity/Player enters a region/trigger I was wondering how multiplayer games detect if you enter a special region. Let's assume there is a huge map that is so big that simply checking it would become a huge performance issue.

I've seen bukkit (a modding API for Minecraft servers) firing an Event on every single move. I don't think that larger games do the same because even if you have only a few coordinates you are interested in, you have to loop through a few trigger zone to see if the player is inside your region - for every player. This seems like an extremely CPU-intense operation to me even though I've never developed something like that.

Is there a special algorithm that is used by larger games to accomplish this? The only thing I could imagine is to split up the world into multiple parts and to register the event not on the movement itself but on all the parts that are covered by your area and only check for areas that are registered in the current part.

And another thing I would like to know: How could you detect when someone must have entered a trigger but you never saw him directly in it since his client only sent you an move packet shortly before entering and after leaving the trigger area. Drawing a line and calculate all colliding parts seems rather CPU intensive if you have to perform it every time.

sentences:
3D Vector "End Point" Calculation for procedural Vector Graphics Alright, So I need some help with some Vector Math.

I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees and Plants. L-Systems, are drawn by using Turtle Graphics, which is a form of Vector graphics.

I first created a system to draw in 2D Graphics, which works perfectly fine. But now I want to make a 3D equivalent, and I’ve run into an issue.

For my 2D Version, I created a Method for quickly determining the “End Point” of a Vector-like movement. Given a starting point (X, Y), a direction (between 0 and 360 degrees), and a distance, the end point is calculated by these formulas:

newX = startX + distance * Sin((PI * direction) / 180)

newY = startY + distance * Cos((PI * direction) / 180)

Now I need something Similarly Equivalent for performing this Calculation in 3D, But I haven’t been able to Google anything that could show me how to do this.

I'm flexible enough to get whatever required information is needed for this method calculation, in any reasonable form (Vector3, Quaternion, ect).

To summarize: Given a starting point/vector position in 3D space (X, Y, Z), a Direction in 3D space (Vector3, Quaternion, ect), and a Distance, I need to find the “End Point” in 3D Space.

Thank you for your time and help.

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:
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:
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:
Shared Texture2D in XNA I am trying to define texture2d objects as shared. The reason of why I am trying to do is, I made an xna user control and my project loads unlimited (as much as the user wants) my XNA User Control. And all of the textures are same. I don't want to load textures for everyone of them (think how much ram size it will use if I do it)

The real problem is:

cmMaps = New ContentManager(Services, "Maps")

As you see, ContentManager news ServiceProvider for initialization. When I look at the codes where Services variant modified, I see this lines:

GraphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height)
m_services.AddService(Of IGraphicsDeviceService)(GraphicsDeviceService)

Why I can't define global Texture2D objects. Why is it specific for the window or control that the XNA tries to draw on?

Is it possible to define em as shared variant and able to use it in every XNA UserControl?

Note: I took UserControl source codes from this page:
http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_1

sentences:
Json Libgdx serialize / de-serialize a Object Map of Object Maps Any one have any ideas on how I can serialize / de-serialize an

ObjectMap<Enum, ObjectMap<String, Object>>();

(Object is usually a String Integer or Vector2 ) using libgdx's built in json classes?. On de-serialize the inner ObjectMap, is always null even though the values are written to the json file.

sentences:
What is the role of tessellation in terrain? I'm relatively new to graphically programming and I've been looking into ways to render larger heightened terrain. I keep seeing comments directing me to disregard things such as geometry clipmaps, in favor of tessellation.

From what I've read however, tessellation adds inner and outer triangles between a set of vertices. So from what I understand, you would lose the 1 to 1 relationship between height points and vertices. Additionally, the new vertices would be interpolated and therefore somewhat similar looking between points of similar height.

Is this the case or is there something I'm missing.  Is tessellation exclusively the way to go or can it (/should it) be combined with other techniques?

sentences:
How can bays and straits be determined in a procedurally generated map? I've got a procedurally generated map using Voronoi cells, with a defined sea level and a believable height map.

So far, I've been successful in labelling certain geographic features: land, ocean, lakes, rivers, estuaries, confluences, mountains, and biomes. Biomes include tundra, boreal forest, grassland, and temperate forest. There are also a couple other biomes there but for my purposes they aren't important right now.

I'd like to label bays, and straits next, but I'm at a loss on how to do this properly. A bay is a recessed, coastal body of water that directly connects to the ocean.

A strait is a naturally formed, narrow waterway that connects two parts of the ocean. Basically, where two pieces of land almost touch and there's ocean on both sides. Also called a "channel".

For determining features, I can loop through any feature by type like this:

for each (var feature:Object in geography.getFeaturesByType(Geography.LAND))
  // loop through lands
  for each (var cell:Cell in feature.cells)
  // loop through cells
    for each (var neighbor:Cell in cell.neighbors)
    // loop through a cell's neighbors
      trace(neighbor.hasFeatureType(Geography.LAND));

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:
2D Skeletal Animation Transformations I have been trying to build a 2D skeletal animation system for a while, and I believe that I'm fairly close to finishing. Currently, I have the following data structures:

struct Bone {
    Bone *parent;
    int child_count;
    Bone **children;
    double x, y;
};

struct Vertex {
    double x, y;
    int bone_count;
    Bone **bones;
    double *weights;
};

struct Mesh {
    int vertex_count;
    Vertex **vertices;
    Vertex **tex_coords;
}

Bone->x and Bone->y are the coordinates of the end point of the Bone. The starting point is given by (bone->parent->x, bone->parent->y) or (0, 0). Each entity in the game has a Mesh, and Mesh->vertices is used as the bounding area for the entity. Mesh->tex_coords are texture coordinates. In the entity's update function, the position of the Bone is used to change the coordinates of the Vertices that are bound to it. Currently what I have is:

void Mesh_update(Mesh *mesh) {
    int i, j;
    double sx, sy;

    for (i = 0; i < vertex_count; i++) {
        if (mesh->vertices[i]->bone_count == 0) {
            continue;
        }

        sx, sy = 0;
        for (j = 0; j < mesh->vertices[i]->bone_count; j++) {
            sx += (/* ??? */) * mesh->vertices[i]->weights[j];
            sy += (/* ??? */) * mesh->vertices[i]->weights[j];
        }

        mesh->vertices[i]->x = sx;
        mesh->vertices[i]->y = sy;
    }
}

I think I have everything I need, I just don't know how to apply the transformations to the final mesh coordinates. What tranformations do I need here? Or is my approach just completely wrong?

sentences:
How to solve artifacts caused by vertex lighting in my voxel engine? My current lighting system bakes the light amount based on ray-tracing from the light source to the 8 corners of the block (so per-vertex) and the distance to the light on the blocks. It works acceptable, but it's definitely not perfect.

Of course the blocks are made out of faces, which are made out of triangles. In the situation shown in the screenshot, where there is a light directly behind the camera, you get those weird triangle lighting issues.

How can I fix this problem?

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:
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:
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: What is scripting, and what is a scripting API? What is scripting, and what is a scripting API? Is scripting the process of writing the game program, and is the scripting API (such as the Unity scripting API) the API provided by the game engine, which we use to create games?

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

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

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

How could I achieve permanent rubbles?

sentences:
UE4 C++ - Add generated source code folders to Visual Studio solution? In Unreal Engine 4, using a Visual Studio solution and projects generated from the Editor using the First Person Template, the layout of the Solution looks something like the following:

I am not a fan of this flat horizontal folder structure. What I would like to do is put some new classes into a nested folder here.
I will be generating a new GameState subclass, and putting the sources into the Source\GameState folder that will also be created on the fly, using the UE4 editor:

Notice that the "Create New Folder" option is disabled.

Here I have appended the "GameState" folder to the normal source path.
However, the folder structure in the Solution Folder has not changed, and nothing I try to do is working. The things I have tried to do so far include:

Drag the folder into the solution from the file explorer
Right Click > Add > Existing Item... (Which just results in the files appearing horizontally to the other files without the new folder I have created, also add as link is not an available option)
Create a "Filter" (what the other folders appear to be) within Visual Studio. This results in the layout I desire, but I have to add the source code files to the filter manually which just copies them to the .vcxproj file directory. I end up not modifying the actual files I added.

How can I add this folder and it's files while keeping up with the original copies?

sentences: Does it make sense to include an index for linelists? Does it make sense to include an index by using DrawIndexedPrimitives, when using linelists performance wise? I could imagine it would be easy for the GPU to generate such indexes anyway.

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:
How can I modify the GUI of a default Unity window? How can I modify the GUI of a default Unity window?
E.g. I am trying to modify the Animation window. Here is what I am trying to do for the beginning:
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(Animation))]
public class AnimationExtended : Editor
{
    public override void OnInspectorGUI()
    {

    }
}

I would expect the code above to hide the content of the Animation window completely, but it does not. Why?
Here is what I mean by the Animation window.

Question which made me want to add a custom feature to the Animation tab.

sentences:
Vertex Skinning, Bone matrices question I'm creating a model/animation viewer in C# using OpenTK for a game's models. Before stating my problem I want to describe a bit what I've accomplished so far in case I'm fundamentally missing something.

First of all I parsed the model skeleton. Like described pretty much everywhere on the web, what I do is to traverse all the hierarchy starting from the root bone and start building up the joint matrices. The game file provides separately translation,rotation and scale vectors. In order to create all the joint matrices I'm using only the rotation values, which I am converting into a rotation matrix and I'm saving it as the localMatrix. I'm saving the translations as joint position (localPosition) and I'm using them later on to calculate the worldPosition of my joints by transforming that using the parent's worldMatrix.

The following methods are responsible for getting the joint world Matrix and its world Position

public Vector3 worldPosition {
        get
        {
            if (parent != null)
                return parent.worldPosition + Vector3.Transform(this.localPosition, parent.worldMat);
                this.worldMat);
            else
                return this.localPosition;
        }
}
public Matrix4 worldMat
    {
        get
        {
            if (parent != null)
                return Matrix4.Mult(this.localMat, parent.worldMat);
            else
                return this.localMat;
        }
}

Using that piece of code I can preview the skeleton perfectly. I also managed to parse the animations. I used the rotation information on each frame in order to update each joints local matrix and therefore I was able to successfully preview the animation on the joint skeleton.

Now the only thing I am missing is to bind the mesh on the skeleton (I'm trying to do that using a vertex shader). Wherever I search on the web, i find that i need to apply the following equation:

I got the blendIndices and the blendWeights so that's not a problem as well.
I'm completely confused with the bone matrices though. If I understand correctly matrix[i] is the joint's world transformation matrix. The other inverse matrix is supposed to transform my vertex back to the bindpose? Since my model is already in the bindpose what do I need this matrix for?

I tried applying just the joint worldmatrices that I have precalculated,  but the mesh was completely corrupted. So I'm definitely missing something.

And second question: I've found some matrices in the model file which seem like they are probably prebaked joint world matrices. In fact I compared their values and they are EXACTLY the same with the ones I'm calculating through traversing the bone hierarchy. Their only difference though is that they also contain translation information. So my question is: Do bone matrices contain translation information as well? If so, then this means that my way of parsing the skeleton is wrong? I just can't thing of another way to use the full matrices (rotation + translation) in order to correctly position the joints.

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:
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:
Importing Models from Maya to OpenGL I am looking for ways to import models to my game project. I am using Maya as modelling software, and GLUT for windowing of my game. I found this great parser, it imports all the textures and normal vectors, but it is compatible with .obj files of 3dsMAX. I tried to use it with Maya obj's, and it turned out that Maya's obj files are a bit different from former one, thus it cannot parse them.

If you know any way to convert Maya obj files to 3dsMax obj files, that would be acceptable as well as a new parser for Maya obj files.

sentences:
Game time and pausing I am writing a simple game where some things happen after some amount of time. I used simple time analog of the framework I use to schedule these events, however, I have found that I will not be able to pause the game because the time is continuously increasing and nothing can stop it. So I decided to have my own time which is updated each update() function call to a delta time (example in Lua):

current_time = 0.0

function update(dt)
    current_time = current_time + dt
end

So I am able to pause the game now by simply not incrementing the game time and not doing anything at all (simply return from the update function). The question is do I do this correctly? Does every game engine do this this way? I just could not think of any other method for implementing game time with pausability.

P.S. update function is called in the game loop on each iteration. The fps is locked to a constant.

sentences:
Using a web service for multiplayer games? I've been looking into web services for making multiplayer games and was just wondering how feasible would it be?

What I would like to do is make a simple MMORPG that uses a turn based fighting system, are there any inherent limitations with web services which would make this difficult and not worth my time?

Also out of curiosity would a faster paced multiplayer game be workable using web services? Something like a top/down shooter similar in pace to games like asteroid?

sentences:
How to handle collision detection So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that will be the unit's destination.

This is the process input method:

    public void ProcessInput(Vector2 mouseLoc)
    {
        // SO, I have to take this mouse location, which is the location on the screen
        // And convert it to a "world" coordinate

        Vector2 distance = new Vector2(mouseLoc.X - position.X, mouseLoc.Y - position.Y);

        if (distance.Length() < speed)
        {
            position = mouseLoc;
            isMoving = false;
        }
        else
        {
            distance.Normalize();
            Vector2 toMove = new Vector2((int)(distance.X * speed), (int)(distance.Y * speed));
            position += toMove;
            bounds = new BoundingSphere(new Vector3(position, 0), radius);
        }
    }

I have a basic Wall class that is essentially just another rectangle object but with different properties like textures and what not.

This is my check collision method with the wall:

    public Boolean checkCollision(Wall wall)
    {
        if (wall.Bounds.Intersects(this.bounds))
        {
            Vector2 direction = new Vector2((position.X - destination.X) * -1,
            (position.Y - destination.Y) * -1);
            direction.Normalize();
            position += direction * 5;
            destination = position;
            return true;
        }
        return false;
    }

The problem is that the unit just kinda gets stuck in the wall when it hits it. I'm wondering what is the best way to fix this problem. I know that I have to move the unit out of that spot, but I'm not sure how to.

Any thoughts on how to handle this are appreciated.

sentences:
Constantly interpolated splines Trying to implement a movement through a curve - I'm trying to find a type of curve/spline that interpolates constantly. What I mean: when I interpolate from t=0 to t=0.1, I want it be the same distance as when interpolating from t=0.1 to t=0.2. And I want it to happen for every delta t on the spline.

I dont' want to make lookup tables that map the interpolated values to distances in order to save the memory. Does anybod knows are there any kind of such mathematical constructs?

I could do a in depth research, but as far as I can, I dont wan go to deep into details. It would be great having some simple formula.

sentences:
Informing objects within a particular state of the world state Following the State pattern, every state in my game is a derived object that reflects a particular segment of the game (MenuState, PlayingState, GameOverState, etc.)

Each of those state objects holds a container of objects pertinent to that world state (eg. menuButtonOBject for MenuState, playerObject/enemyObject for PlayingState, etc.)

For each frame, every object from that particular state makes a call to its update() method:

#include "GameState.h"
#include "GameObject.h"

class MenuState : public GameState {

    public:

    // member functions...
    virtual void update() {
        //pseudocode
        foreach (object in objectContainer)
            object->update();
    }

    private:
       std::vector<GameObject*> objectContainer;
}

My question being: what is the most common way to make the GameObject's update() method to have access to every other object in the state?

Eg: my veryBadassEnemyObject needs to know if the playerObject is within a particular x0,y0 -> x1,y1 rectangular area.

The straightest approach I can think of is simply passing the object container to the update function as a parameter, but I have the feeling that there is a much more professional, better way to do it.

sentences:
Mobs living in the physics engine So, yeah. Mobs (including, and indeed especially, the player), physics engine running (cannon.js), first-person perspective, fairly low-poly-count world because I'm targeting WebGL. I'm trying to represent my mobs within the physics engine, moving them by applying forces or impulses, and I'm having some problems:

1) Ramps! The FPS Way seems to be that critters run uphill and downhill and on the flat, all at the same speed. But of course even-slightly-realistic physics really wants you to go slower uphill, especially if you add friction to prevent "standing" mobs from sliding downhill. I've tried compensating for this by calculating how fast the mob "wants" to go, and applying force proportionate to the difference between its actual velocity and desired velocity, but it just Ain't Right. Also, the mobs have a tendency to jump up off the top of staircases.

2) Falling over! To make the mobs collide with things, they have to be represented by some appropriate shape. I've tried a few different ones. Particles are an obvious lose, and fall into every possible crack in the geometry. A box the approximate shape of the bounding box for a standing person falls over constantly, especially on slopes. Putting the center of mass for the object at the bottom of the box helps, but only somewhat. Using a lower, flatter shape-- think "coin with beveled edges"-- prevents the falling down, but fails at detecting collisions. The last thing I tried was a sort of egg shape, which stays up but staggers like a drunken sailor.

Obviously, I'm missing something. What? Do people just have to have Special Physics Of Their Own? Should I toss the whole thing and write that car game instead?

sentences:
Havok Physics : "hkQuaternionf not normalized/invalid!" when hkpWorld::stepMultithreaded() today I want to ask a question about Havok Physics 2012.

My havok version is 2014.1.0-r1 (x86 SIMD version), and I'm using Visual Studio 2012 on Windows 8.

My problem is, that once I add a rigid body to the world, the next time I call hkpWorld::stepMultithreaded(), it breaks in some SSE math related function and gives me this error message through my error report function.

  C:\NightlyJobs\09-07-Sun-01\Source\Common/Base/Math/Vector/Sse/hkSseVector4Util.
  inl(307): [0x1FF88F0E] Assert: hkQuaternionf not normalized/invalid!

Here's the stack trace:

  (null)(0):'hkDefaultError::message'
  (null)(0):'hkError::messageAssert'
  (null)(0):'hkVector4UtilImpl::convertQuaternionToRotation'
  (null)(0):'hkRotationf::set'
  (null)(0):'hkTransformf::setRotation'
  (null)(0):'hkSweptTransformUtil::calcTransAtT1'
  (null)(0):'hkSweptTransformUtil::_stepMotionState'
  (null)(0):'hkRigidMotionUtilApplyForcesAndStep'
  (null)(0):'integrateJob'
  (null)(0):'hkpMultiThreadedSimulation::processNextJob'
  (null)(0):'hkJobQueue::processAllJobs'
  (null)(0):'hkpWorld::stepMultithreaded'

Here's how I create and add the rigid body.
It's so basic that I didn't think there would be any room for bizarre error in it...

hkpSphereShape* sphere = new hkpSphereShape(radius);  // radius is 10.0f here.

hkpRigidBodyCinfo rigidBodyInfo;
rigidBodyInfo.m_shape = sphere;

m_RigidBody = new hkpRigidBody(rigidBodyInfo);

world->markForWrite();
world->addEntity(m_RigidBody);
world->unmarkForWrite();
m_RigidBody->removeReference();

I don't set position or rotation of the rigid body myself, so why it breaks in some quaternion related function is beyond me.

I speculated it might be one of those multithreading-related bizarre errors, so I tried changing

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;

to

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;

and

m_World->stepMultithreaded(m_JobQueue, m_CpuThreadPool, timeStep);

to

m_World->stepDeltaTime(timeStep);

but the problem persisted.

Do you know something that I could be doing wrong ?
Please tell me in the comments if you need to see some of my other code to help!
Any help would be greatly appreciated, thanks!

sentences:
Input prediction and server re-simultaion I have read plenty of articles about multiplayer principles and I have basic client-server system set up. There is however one thing I am not clear on.

When player enters input, it is sent to the server and steps back in time to check if what should have happened at the time of that input and it resimulates the world again. So far everything's clear.

All articles took shooting as an example, because it is easy to explain and it is pretty straightforward, but I believe movement is more complicated. Imagine following situation:
2 players move towards each other.

A------><------B

Player A stops halfway towards the collision point, but there is lag spike so the command does not arrive on the server for a second or so. Current state of the world on the server (and on the other clients as well) at the time when input arrives is this:

[1]:

-------AB-------

The command arrives and we go back in time and re-simulate the world, the result is this:

[2]:

---AB-----------

Player A sees situation [2] which is correct, but the player is suddenly teleported from the position in [1] (center) to the position in [2].

Is this how this is supposed to work? Point of the client prediction is to give lagged player feeling that everything is smooth, not to ruin experience for other players.

Alternative is to discard timestamp on the player's input and handle it when it arrives on the server without going back in time. This, however, creates even more severe problems for lagged player (even if he is lagging just a bit)

EDIT:

To give you more info about my situation, I am making a game where exact position is quite important and the action is quite fast-paced. Imagine air-hockey with some perks on top.
Another thing worth considering is that this is flash game and I have to use TCP. From my previous experience, ping times of 200ms are the norm (unlike 50ms on pc games) in situations I will be facing.

sentences:
Creating models in 3ds max and exporting as .x for XNA I have created a few models in 3DS max which contains textures, geometry and animations . .however .fbx doesnt really support textures.. So im planning to use .x format.. I have seen a few converters in pandasoft but once i unzip the file and place the .dle file in the plugins folder of 3D max gives an error saying failed to initialize..
Is there any way to convert my .max models into .x format ? ? I dont know blender so that isnt an option. . I'm currently using 3ds max 2013

After adding the .3DS object content importer. . i get the following error:

.3Ds files along with the solution

sentences:
3d rotation of a Gunner unit to shoot the target I'm developing a scenario to shoot incoming targets by a specific gunner unit, however I'm confused to actual logic of shooting an object with a gun. I'm working in 3D environment.
I'v target's position vector i.e [x,y,z] and its rotation vector [x,y,z,angle], and also Gun's position vector i.e [x,y,z] and its rotation vector [x,y,z,angle]. The gun has two components, i.e a TopDondur and a set of Barrels, both components have the rotation along y-axis, i.e only angel of rotation vector [0 1 0 angle] is required to move the Gunner Unit to the target.

What rotataions shuould give the Gunner unit to rotate both TopDondur and Barrels, i.e TopDondur rotates to the target and Barrels are to move up/down with respect to that target.

sentences:
How can I build a C++11 vertex attribute class? How would you build a flexible and efficient vertex attribute class in C++11? What I have:

Vertex attribute roles for using them in shaders:

enum AttributeRole
{
    VERTEX0,
    TEXCOORD0, ...
    UNKNOWN_ROLE
};

static const char * AttributeRoleName[UNKNOWN_ROLE + 1] = {
    "vertex0",
    "texcoord0", ...
    "unknown role"
};

A class providing vertex attribute type information:

struct AttributeTypeInfo {
    GLint m_nrOfComponents;
    GLenum m_glType;
    GLsizei m_bytesPerComponent;
    GLsizei m_bytesPerAttribute;
    GLboolean m_normalize;
    AttributeRole m_role;

    AttributeTypeInfo(GLint nrOfComponents, GLenum glType, GLsizei bytesPerComponent, GLsizei bytesPerAttribute, GLboolean normalize, AttributeRole role)
    : m_nrOfComponents(nrOfComponents), m_glType(glType), m_bytesPerComponent(bytesPerComponent), m_bytesPerAttribute(bytesPerAttribute), m_normalize(normalize), m_role(role)
    {
    }
};

A class holding a single vertex attribute:

template <typename COMPONENTTYPE, GLenum GLTYPE, size_t NROFCOMPONENTS, GLboolean NORMALIZE, AttributeRole ROLE>
struct Attribute
{
    COMPONENTTYPE m_data[NROFCOMPONENTS]; //attribute data
    static const AttributeTypeInfo m_typeInfo = AttributeTypeInfo(NROFCOMPONENTS, GLTYPE, sizeof(COMPONENTTYPE), sizeof(COMPONENTTYPE) * NROFCOMPONENTS, NORMALIZE, ROLE); //attribute type information
    //... and some access functions...
};

typedef Attribute<GLfloat, GL_FLOAT, 3, GL_FALSE, VERTEX0> Vertex0_V3F;
typedef Attribute<GLubyte, GL_UNSIGNED_BYTE, 4, GL_TRUE, COLOR0> Color0_C4UB;

This is quite comfortable, but now I want to combine vertex attributes in an interleaved attribute format to be used in buffers later:

/// @brief Dual attribute vertex format
template <typename TYPE0, typename TYPE1>
struct AttributeFormat2
{
    TYPE0 m_attribute0;
    TYPE1 m_attribute1;
    static const size_t m_nrOfAttributes = 2;
    static const size_t m_sizeOfAttributes = sizeof(TYPE0) + sizeof(TYPE1);
    static const AttributeTypeInfo m_typeInfo[m_nrOfAttributes];
};

template <typename TYPE0, typename TYPE1>
const AttributeTypeInfo AttributeFormat2<TYPE0, TYPE1>::m_typeInfo[] = {
    TYPE0::m_typeInfo,
    TYPE1::m_typeInfo
};

typedef AttributeFormat2<Vertex0_V3F, Color0_C4UB> Format_V3F_C4UB;

This gets a bit out of hand when you have 3,4,5 or more vertex attributes...

Is there a (variadic) template solution to the problem with C++11 or 14 or can you suggest a better interleaved vertex attribute format class?

sentences:
Rotation and timer at the same time I have a project where I flip a card after 5 seconds, then I want to start a countdown timer of x seconds. After x seconds the card flips again.

I found a good example for the timer here, but that works inside a Update() method. My problem comes from the fact that the rotation of the card is made also inside the Update() method.

If I put the timer inside the Update() method, as soon as the Update() method is called the timer starts, and I don't want it to start it as soon as I call the Update() method, but when I want to start ip, wich is 60 seconds after I flip the card.

If I put the timer inside a method other than Update() then the timer start but never decrease.

 using UnityEngine;
 using System.Collections;
 public class Juego1Carta2 : MonoBehaviour
 {
     public float velocidadDeRotacion = 100.0f;
     public Sprite cartaBase;
     public Sprite cartaDelantera;
     private bool carta2Activada = false;
     private bool cartaDeLado = false;
     float tiempoDeJuego = 2;
     IEnumerator Esperar()
     {
         yield return new WaitForSeconds(5);
         transform.position = new Vector3(Screen.width / 2, Screen.height / 2 +GetComponent<SpriteRenderer>().bounds.size.y, 0);
         carta2Activada = true;
         Regresa();
     }
void Regresa()
{
    Update();
}
// Use this for initialization
void Start ()
{
    StartCoroutine (Esperar());
}
// Update is called once per frame
void Update ()
{
    if (carta2Activada)
    {
        transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
        if (transform.eulerAngles.y >= 90)
        {
            SpriteRenderer Carta = GetComponent<SpriteRenderer>();
            if (Carta.sprite == cartaBase)
            {
                Carta.sprite = cartaDelantera;
                cartaDeLado = true;
                carta2Activada = false;
            }
            else
            {
                Carta.sprite = cartaBase;
                cartaDeLado = true;
                carta2Activada = false;
            }
            tiempoDeJuego = 60;
        }
    }
    tiempoDeJuego -= Time.deltaTime;
    if (tiempoDeJuego <= 0)
    {
        print("Fin del tiempo");
    }
    if (cartaDeLado)
    {
        transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
        if (transform.eulerAngles.y >= 180)
        {
            transform.eulerAngles = new Vector3(0, 0, 0);
            cartaDeLado = false;
            carta2Activada = false;
            return;
        }
     }
   }
}

Is there a way to rotate the card and make a countdown timer at the same time?

I'm sorry, maybe this is a very obvious question but after 3 consecutive days working on this, I'm more than burnout...

sentences:
How to move Stage in LibGDX? How to move Stage?

I am looking for an example:

stage.draw(x,y); // ???

Thanks you

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:
Why is my FPS computation yielding higher numbers than I expect? I have following code:

void Game::execute()
{
    isExit = false;
    init();

    double dt = 1.0 / 60.0;
    boost::timer timer;
    double accumulator = 0.0;

    boost::timer fps_timer;
    int fps = 0;
    while (isExit != true)
    {
        handleEvent();
        accumulator += timer.elapsed(); timer.restart();
        while (accumulator > dt)
        {
            accumulator -= dt;
            handleEvent();
            update(); // updating physics
        }
        if (fps_timer.elapsed() > 1.0) //if 1 second is elapsed
        {
            fps_timer.restart();
            m_fps = fps;  //m_fps - is result, which is rendered
            fps = 0;
        }
        else fps++;
        render(); // main rendering command
    }
}

And usually m_fps is equal 300-400. But I expect to see 30-60. Where I did wrong?

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 to deal with differences between 2D screen coordinates and Cartesian coordinates Most 2D screen/bitmap coordinate systems have the positive Y axis pointing down (with the the origin in the upper left corner).
This is counter to how most people think geometrically with the positive Y axis pointing up (with the origin in the center).

How do most games manage the two different 2D coordinate systems? There are two main types of coordinates (screen vs. Cartesian), but there could be many different coordinate spaces: sprite space, world space, view space, screen space, etc...

Background:

I originally made the world coordinates in my game match the 2D screen coordinate convention. This made it very natural to use the graphics drawing routines, but subtle issues arose when using trigonometric functions like atan2(). The results of feeding atan2() 2D screen coordinates are very confusing because atan2() assumes the positive y axis points up.

So I changed my world coordinates to follow the classic Cartesian coordinate system (with the origin at the bottom left of the screen). Reasoning with atan2() is much more straight-forward, but now it is harder to do other types of reasoning:

If I click the screen here, what sprite is underneath?
Where did I click on that sprite?
If a sprite is drawn in the wrong location, what was calculated incorrectly? The screen coordinates or the world coordinates?

I realize conversion from screen to Cartesian coordinates involves simply scaling the y value by -1 with an optional translation of both (x,y) values. I'm more interested in best practices for game design:

Do most games just stick with the screen coordinate convention and change their thinking about how things like atan2() should work?
When/how are coordinate system conversions done? (Using matrices, OOP abstraction, etc)
Are sprite locations stored as the center of the sprite or one of the corners? The sprite's height/width going in the "wrong" direction seems to be a common problem when I draw them.

Although my question is mainly about 2D games, it seems OpenGL uses a coordinate system where the Y axis points up. OpenGL must eventually project those 3D coordinates onto a 2D screen coordinate system. Perhaps some guidance could be found in OpenGL's method...

sentences:
How can I animate the stretching of a sprite over time? My goal is to find the function to stretch a sprite like my example below, and then get it to animate during a certain time. It is like an interpolation, where the starting point is the original image, and the final point is the stretched image. Any idea?

Here is an example, hope it is clear.

sentences:
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 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:
'Resetting' Google Play Games Services so app forgets it previously connected (so it shows confirmation screen again) When I first integrated Google Play Games Services into my app, it came up with a 'confirmation screen', something like:

App Name wants to connect to Google Play Game Services

I don't recall the exact wording.

While Alpha testing my app, one of my users has discovered a potential issue where he presses 'cancel' at that point instead of connecting. I would like to try to resolve this issue, but I can't recreate it because I can't work out how I can get that confirmation screen again!

I have implemented a 'log out' button in my app and that works, but when subsequently connecting, it just goes ahead without displaying the confirmation screen again.  Any ideas how I can force that screen to show again for testing?!

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:
Geometry shader and triangle adjacency I'm currently trying to change my project to use GL_TRIANGLE_ADJACENCY instead of GL_TRIANGLES.

Following this question, I have managed to construct my index buffer fine, but when it comes to the drawing stage, I'm getting unexpected results.

Here is my geometry shader code.
Bare in mind that I store my indices like so:

(vertex1/adjacent1/vertex2/adjacent2/vertex3/adjacent3)

Geometry Shader

    #version 330

    precision highp float;

    layout (triangles_adjacency) in;
    layout (triangle_strip, max_vertices = 3) out;

    smooth in vec2 vVaryingTexCoords[];
    smooth in vec3 vVaryingNormals[];

    smooth out vec2 gsUV;
    smooth out vec3 gsNormals;

    void main(void)
    {
        int i;

        for(i = 0; i < gl_in.length(); i++)
        {
            switch(i)
            {
                case 0:
                case 2:
                case 4:
                    gl_Position = gl_in[i].gl_Position;
                    gsUV = vVaryingTexCoords[i];
                    gsNormals = vVaryingNormals[i];
                    EmitVertex();
                    break;

                default:
                    break;
            }
    }
    EndPrimitive();
}

Any ideas?

EDIT

Just like to point out that setting the adjacent index to be the same as the vertex index, i.e v1/v1/v2/v2/v3/v3 still produces the same results.

sentences: Unity3d: Find a point on the line which has shortest distance from the third point So, initially, I had points A and C. To get point B, I had to shoot a raycast down from point A and get the hit.point, which is point B now. Point D is somewhere between the raycast I shot from A and perpendicular to C. How do I find the point D.

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:
How to build a better game save? I am making a roguelike card game like dream quest, and I want to improve my dungeon/level save method.

Here's what my levels look like:

I checked dream quest saves but I don't like their method because it uses a simple text file for all the information. it's also really messy, repetitive and not extendable.

I used the format below for the first couple of months:

[
  [
    "Wall",
    "Wall",
    "Room",
    "Room",
    "Room",
    "Merchant",
    "Room",
    "Room",
    "Wall",
    "Wall",
  ],
  [
    "Wall",
    "Wall",
    ...
  ]
]

But at the time I did not have multiple enemies, merchants, items. I simply read the file by using an enum which matched the strings used in the save format (item, enemy, merchant etc.) then passed them into an array to create the board.

As I started to create different kinds of enemies, items, and merchants, my current game wouldn't support this. I don't want to create an enum like enemy1, enemy2, enemy3 ...

How can I improve the scalability & legibility of this save game format, so I don't have to keep adding new enum categories for each variety of content?

sentences:
Isometric 3d collision detection I'm making an isometric map for a game, I can draw it, but I don't know how to implement a sort of 3d collision detection without Threejs or other 3d library.

It is possible? Maybe make the block an Object can help? I have searched a lot on the web, but I found only libraries. Thank you!

This is my JavaScript code:

var canvas = document.getElementById('canvas'),
 ctx = canvas.getContext('2d'),
 width = canvas.width = window.innerWidth,
 height = canvas.height = window.innerHeight,
 stop = false;

var tw, th;
var player;

setup();
draw();

function setup(){
  ctx.translate(width/2,50);

  tw = 60; //tile width
  th = 30; // tile height
  player = new Player(2,3,2);

};

function draw(){

  ctx.clearRect(-width/2,-50,width*1.5,height+50);

    for(var i = 0; i < 5; i++){
      for(var j = 0; j < 5; j++){
        drawBlock(i,j,1,tw,th);
      }
    }

    if(!stop){
     requestAnimationFrame(draw);
    }
}

function drawBlock(x,y,z,w,h){

 var top = "#eeeeee",
     right = '#cccccc',
     left = '#999999';

 ctx.save();
 ctx.translate((x-y)*w/2,(x+y)*h/2);

 ctx.beginPath();
 ctx.moveTo(0,-z*h);
 ctx.lineTo(w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(-w/2,h/2-z*h);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = top;
 ctx.fill();

 ctx.beginPath();
 ctx.moveTo(-w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(0,h);
 ctx.lineTo(0,h);
 ctx.lineTo(-w/2,h/2);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = left;
 ctx.fill();

 ctx.beginPath();
 ctx.moveTo(w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(0,h);
 ctx.lineTo(0,h);
 ctx.lineTo(w/2,h/2);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = right;
 ctx.fill();

 ctx.restore();

}

function drawTile(x,y,stroke,col){

 ctx.save();
 ctx.translate((x-y)*tw/2,(x+y)*th/2);

 ctx.beginPath();
 ctx.moveTo(0,0);
 ctx.lineTo(tw/2,th/2);
 ctx.lineTo(0,th);
 ctx.lineTo(-tw/2,th/2);
 ctx.closePath();
 if(stroke){
  ctx.stroke();
 }else{
  ctx.fillStyle = col;
  ctx.fill();
 }

 ctx.restore();

}

function Player(x,y,z){
  this.x = x;
  this.y = y;
  this.z = z;
  this.w = 10; //width
  this.h = 10; //height
}
canvas{
  width:100%;
  height:100%;
}
<canvas id="canvas"></canvas>

sentences:
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:
Transparency problem / Expanding material fixes it magically? i stumbled upon a problem, can't figure out what's the reason and how to solve it.

I have glass-windows which use just the standard (specular setup) shader.
in the first place when the model is added to the scene the glass looks like this (wrong !)

Then JUST by clicking on the little arrow to deploy the extra infos about the material the glass suddenly looks like it is supposed to look :

Is this a unity bug ?
i actually change absolutely nothing, just click the material.

Is there a way to force this to occur on itself ?
i tried by disabling an re-enabling mesh renderer but it does not do the trick.

edit: seems that putting rendering mode to anything else and setting it back to transparent helps to obtain the same result as clicking the little arrow.
nevertheless this is very strange

thanks for any help

sentences:
Sharing game code between client and server I'm having a code design problem involving synchronization between the server and clients. I have a class GameWorld that handles all of the simulation details (positions, velocities, projectiles, what have you) that exists in two places:

on the server, it is contained in the class GameRoom which handles all of the players connected to a specific lobby, reads and sends messages.
on the client, it's in the class GameplayGameState (using the stack of states pattern).

The problem is that i want to include the simulation code in this single GameWorld class to avoid the various bugs involved in duplicating the code in both sides (maybe i change something in one but forget to do the same in the other). However, there is one thing that needs to change between the two: on the server, GameWorld needs to notify GameRoom somehow about events (like "this player died", "this player shot in that direction"), so that GameRoom can then broadcast the event to the clients. On the client, however, i need no such thing, but i do need a way for GameWorld to handle similar events for other reasons (for example, a dying player doesn't need to notify any clients but it does need to play a sound or display a message or something).

Programmatically, how would I go about implementing different behaviors for different sides? Keep in mind the code for GameWorld is separate and can't have ANY knowledge of its outside overlords. How can two different programs get the information they need without GameWorld knowing what to give them? keep in mind polling is off the table, because it would be ridiculously inefficient to scan the GameWorld every tick for changes, keeping the previous state for reference. GameWorld itself needs to generate the events.

sentences: Saving player's progress in a Unity game I am making a game using the Unity game engine. I want to save the player's progress including level, experience points, chosen character, etc. Presently I am using playerprefs but I want to know whether this will work for gamers who will run this game on their mobile devices (Android/iOS) as well as desktops (OSX/PCs)? If not, then how should I save this information? I want to auto-save player progress after clearing each stage.

sentences:
Fastest approach to 3D animation I'm currently tasked with designing a small HTML5 game.
Having done everything by myself so far (3D models, codebase, game design, etc) I'm now at a point where I'm running out of time.

I've less than a day to animate and bind everything together. However, that's exactly my problem.

I was under the naive impression that everything would be easier if I went with pre-rendered 3D models. However, I didn't consider the most difficult part. Animation.

After having spent over an hour trying to figure out messiahStudio, I figured it's time to ask for outside help.

Is there any easier solution to 3D animation than 3D rigging? What I'm basically looking for is some sort of tool that allows me to simply grab and move/deform select polygons.

It doesn't have to be as life-like and accurate as rigging, just efficient enough.

Were the circumstances any different, I might just learn how to rig. But that's sorely out of scope right now.

PS:The models were created in Sculptris but are fairly low-poly.

sentences:
Turn based battle and formula I'm building a game called DVP(Digimon Virtual Pet), and in this game other than taking care of your digimon, You can also battle and breed them. I'm working on the battle system (making it first cause the actual pet system will be easy compared to the netplay, or 39DLL)but here is the problem I don't want it to be "too" simple or "too" complicated, but I do want to go by a certain formula. There are str, def, spd, and int.

Strength: How hard the attacking digimon is hitting
Defense: How much damage your digimon can defend when being attacked
Speed: The chance of you missing the enemy
Intelligence (battle knowledge): The chance of you hitting a critical hit or defending a critical hit.

I can make a super simple turn based example, but I don't know how exactly to make the formulas for what I've explained above, any help?

sentences:
Writing to multiple RenderTarget2D's from HLSL shader I need to write to two render targets: one for colour and another for depth+normal (for post-processing).  I have a problem, though.  Both targets seem to be getting the value output by COLOR0, while the second should logically be getting the value from COLOR1.  What did I do wrong?

RT Initialization:

renderTarget = new RenderTarget2D(device, gameResolution.Width, gameResolution.Height, false, graphics.PreferredBackBufferFormat, DepthFormat.Depth24);
extraTarget = new RenderTarget2D(device, gameResolution.Width, gameResolution.Height, false, SurfaceFormat.Color, DepthFormat.None);

Using RTs:

Device.SetRenderTargets(new RenderTargetBinding(renderTarget), new RenderTargetBinding(extraTarget));

Relevant HLSL:

struct Pixel
{
    float4 Color : COLOR0;
    float4 Extra : COLOR1;
};

Pixel PS(Middle input)
{
    Pixel output;

    // perform other shader code

    output.Color = float4(totalDiffuse * matDiffuseColor * color.rgb + totalSpecular * matSpecularColor, color.a);
    output.Extra = float4(input.Position.z / input.Position.w, clippedNormal);

    return output;
}

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:
Getting ip address of connected network I have two scripts, a server script and a client script.
I built two parts of the app, one with the client script and another one with the server script.
I put both apps on devices, connected two devices with the local network and run the server.
First I wrote this line in the client to get the IP of the server device:

NetworkManager.singleton.networkAddress

But it gives me the IP of the client device.
Do you have any solution to this problem?

Thanks.

sentences:
How to structure a simple game server for a multiplayer game? I would like to create a simple multiplayer game server for a simple game:

The game is supposed to be similar to Command & Conquer, you have a few tanks and a few soldiers. You can select one soldier and than click on the map, to where the soldier should go. If the soldier comes to an area where he could not go, he walks around. And soldiers can be shot down by enemies.

How should I structure the game server, and what should be done at the client?

I.e if a soldier moves from X to Y but around building Z, I guess the server has to be able to calculate exactly where the soldier is located (in case an enemy shot at him), and the client also has to know the position for painting the soldier.

What should be done at the server and I think I have to desing a protocol for this. I think the server has to keep track of the game state and the time. Is anyone having suggestions on how to do this? or could recommend some reading?

sentences:
Pause updating but keep rendering I am creating an implementation of Snakes and ladders
and I run into some issues.The game is updating too fast and I want to limit the framerate kinda,or make a pause so that the move is actually visible.I tried using Thread.sleep() but that created issues of its own.Have you solved any similar problems that could point me to the right direction?
I have to point out that run method is in an abstract class and my actual game extends this abstract class

This is the game loop :

public void run() {
    init();
    this.requestFocus();
    long lastTime = System.nanoTime();
    double amountOfTicks = 60.0;
    double ns = 1000000000 / amountOfTicks;
    double delta = 0;
    long timer = System.currentTimeMillis();
    int updates = 0;
    int frames = 0;
    while (running) {
      long now = System.nanoTime();
      delta = delta + (now - lastTime) / ns;
      lastTime = now;
      while (delta >= 1) {
        update();
        updates++;
        delta--;
      }
      render();
      frames++;
      if (System.currentTimeMillis() - timer > 1000) {
        timer = timer + 1000;
        if (this.FPSLOG)
          System.out.println("FPS: " + frames + " " + "Ticks: " + updates);
        frames = 0;
        updates = 0;
      }
    }
    stop();
  }

The render method :

private void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if (bs == null) {
      this.createBufferStrategy(3);
      return;
    }
    Graphics g = bs.getDrawGraphics();
    g.setColor(background);
    g.fillRect(0, 0, getWidth(), getHeight());
    draw(g);
    g.dispose();
    bs.show();
  }

The game implementation of those methods:

@Override
    public void init() {
        setBackground(Color.black);
        board = new Board();
        player = new Player(Color.cyan,board.getTiles()[0]);
        dice = new Random();
    }

    @Override
    public void draw(Graphics g) {
        board.draw(g);
        player.draw(g);
    }

    @Override
    public void update() {
        for (int i = 0; i < dice.nextInt(7)+1; i++) {
            player.move();
        }
    }

public void move(){
        this.currentTile = this.currentTile.getNext() == null ? this.currentTile : this.currentTile.getNext();
        this.xPos = this.currentTile.getxPos();
        this.yPos = this.currentTile.getyPos();
    }

sentences:
Simple physics for modelling ship/submarine movement for a first iteration of my sim, I need a very basic physics model for ship/submarine movement. I'd guess it might be a good approach to use vectors here (ship heading but also considering sea states etc.). Basic acceleration and that stuff should be taken into account

I do not need any 3D stuff...the 'client' for that 'ship movement' physics is only the 2D rendering of a navigation map.

I've found some papers on the net but they are far too complex for my needs.

Anybody does know some 'simplified' vector algorithms etc. for that?

Thanks a lot.

EDIT: To be clear: I do not want to simulate ship movement/ocean physics in detail, because this is not the focus of my (naval) simulation. It 'just' must be somewhat believable in that sense that if you have different sea states(wind/waves/currents) that the vessel is somewhat believable influenced (on the navigation map) by those forces.

The main issue for me is how I model/calculate those forces (wind etc.) by simple vectors and (eg. for a given wind velocity like 50kn) in an easy way withouth studying physics ;).

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:
Coloring Terrain By Steepness Issue Also I am attempting to implement some simple coloring by "slope" onto my planet and to do this I take the normal mapped normal "y" component and subtract it from one. Yet I am getting some strange effects, using a small grid for example:

to get this image I had to use the following code:

float slope = 1.0 - normal.y;
if(slope < 0.89){
color = vec3(0.545,0.353,0.169);
}else{
color = vec3(0.237,0.457,0.137);
}

Which doesn't make much sense to me. Also, as you can see, only one side of the terrain is being colored in this way. Shouldn't lower values for slope being more level?
Thanks for the help

EDIT:
Here is the terrain colored according to the pixels normal:

sentences:
Moving objects in a circular path, and also moving the whole group I have eight elements distributed in a circle, with a common center.

All of them move along a circular path, just like the poster in this question asked:

Moving an object in a circular path

This solves half of my question, however I also need to oscillate the whole group of units from side to side, with an easing, or linearly, depending on the design.

I've been playing around with it, but I can't figure how to add or modify what I assign to the X and Y value so the objects move like if they were contained inside a Sprite, and I would be moving that Sprite.

Edit.:

I found that this:

var newX:Number = Math.cos(_angle) * 100;
var newY:Number = Math.sin(_angle) * 100;

y = _startingY + newY;

x = _startingX + newX + _incrementX;

_angle += 2 * Math.PI / 180;

_incrementX += 1 + Math.sin(_angle);

Gets close enough to what I need, however it still doesn't work. In theory, if I subtract the sin f the angle it should fix the rotation compensation.

Edit2: The stars moving in circle:

What happens when I just add a linear increment to each element: (it would represent in the code above doing _incrementX++)

sentences:
Programatically placing musical notes on a stave I'm trying to program a musical stave and have come against the problem of where to place a note, given its index.

The index of a note is defined from a model created from the table in the following: Piano Note Frequencies

For example, in the model, C4 has an index of 40 and D#5 an index of 55.

Here is an image of what the stave currently looks like:

The text in red shows the indices the stave has available to put notes (disregard the horizontal position). Only a few indices are shown, however they extend much further. For example, placing a note on the stave at index 0, it appears at A4 on the stave.

I'm having difficulty translating from an index in the note model, to an index on the musical stave.

At first, I've done a (knowingly) naive implementation. Index 0 in the stave corresponds to A4, or index 49 in the note model. Given an index from the model, calculate how many half steps away the index is and use this as the index in the stave. For example, C5 is index 52 and gives a stave index of 3. Looking at the above image, it's clear this is wrong for two reasons.

Firstly, we didn't account for a note and its sharp laying on the same index. Secondly, we didn't account that B4 and C5 have one half step between them, but are in different places on the stave.

I've been scratching my head over this for a while. What are the rules to follow for translating from a note index to a position on the stave?

EDIT: Each note in the note model knows whether it is sharp or not, its pitch (e.g. C, D, E, etc), and octave.

sentences:
How do I make the ui button to move my character? How do I make my character move left,right and jump when click ui buttons using this 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(1f, 1f);
public Vector3 groundCheckOffset = new Vector3(0f, -1f, 0f);
public float jumpFocre = 500f;
bool doubleJump = false;

void Start ()
{
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    grounded = Physics2D.OverlapCircle(transform.position + groundCheckOffset, 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:
Getting a pixel of Sprite at the cursor position in Unity Summary: I've been trying to figure out a way to use simple box colliders as a nice and efficient "first pass" collider. For the "second pass", I want to check that the area clicked has an alpha value > 10%. I know this is generally possible with graphics programming, but I'm struggling to find a way to do this in Unity2D with packed sprites (packed via the native Sprite Packer tool).

What I was hoping to do (but Unity will not allow) would've been something like...

// Check to see if a point intersects with a solid color
private bool CheckPoint()
{
    Vector2 cursorWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);

    //foreach (Collider2D col2D in Physics2D.OverlapPointAll(cursorWorld))
    foreach (RaycastHit2D hit in Physics2D.RaycastAll(cursorWorld, Vector2.zero))
    {
        if (hit.collider.gameObject != gameObject) continue;

        foreach (SpriteRenderer sprRend in hit.collider.gameObject.GetComponentsInChildren<SpriteRenderer>())
        {
            Texture2D tex = (Texture2D)sprRend.sprite.texture;

            // this is the missing link; easy with 3d, but impossible with 2d?
            Vector2 pixelUV = hit.??????;

            int uvX = (int)(pixelUV.x * tex.width);
            int uvY = (int)(pixelUV.y * tex.height);

            Color hitColor = tex.GetPixel(uvX, uvY);

            if (hitColor.a > 0.1) return true;
        }
    }

    return false;
}

So far: I've been able to find some solutions for doing this with (3D) meshes and 3D colliders. However, the 2D colliders do not include the UV data that would be needed to make this work.

Someone was also able to get this working for their specific game using SpriteManager2 (which we're not using since Unity 4.3 makes SM2 mostly unnecessary) and posted their solution here...  http://answers.unity3d.com/questions/17903/detecting-mouseclick-on-pixels-in-sprite-using-sm2.html and I think the same approach might work with minor adaptations for Unity2D, but I'm thinking there might be a more robust approach.

I'm also looking at trying to do something like http://answers.unity3d.com/questions/687116/what-is-the-easiest-way-to-convert-raycasthit2d-to.html but even if I can calculate the local UV, that wont help me with the real UV for the packed sprite unless I can somehow get the sprite's UV offset into the sheet.

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:
Intellisence doesn't show the ECS API Summaries I am not sure if this is more of an ECS topic problem or packages in general. but it would be really helpful for ECS programming with all the summaries the Unity has provided. For unity engine methods, intelligence show me descriptions and summary of classes and methods, but it doesn't work on packages I guess.

I have tested this with all IDEs, AutoComplete doesn't show the description for methods and classes. However, I can go to the declaration of packages source code and see the summary. for example, Below you can see a screenshot in the Jetbrain Rider IDE, as you see when I mouse over OnCreate method it doesn't show the description.

sentences:
How to create a 32 bit red texture byte buffer I want to make a red texture image buffer. Would anyone help me to make it in right way. I have tried following:

std::vector<BYTE> redTexture(w*h*4);
const auto stride = w * 4;
BYTE* buf = redTexture.data();

for (int i = 0; i < h; ++i)
{
  const auto redValue = Gdiplus::Color::Red;
  memcpy(buf, &redValue, stride);
  buf += stride;
}

sentences:
Unit conversion for physics I'm doing the physics for a 2D game which visuals are represented in openGl. Gravity is 9,8 m/s^2, how do i convert that to my screen size? OpenGl sets width to -1 to 1, and does aspect ratio of the screens real width and height to get height's size(normaly from -3 to 3, due is a smartphone game).

I know i have to convert meters to my screen size units, but what are those units and how do I convert meters to them? For example, lets say I want my screen to represent 20 meters, what are the maths?

9,8 m/s^2 * x screenUnits/m = y screenUnits/s^2

Those screen units are pixels? It doesn't make much sense cos OpenGl scales from -1 to 1 independend of the amount of pixels represented by that size. I want this to work the same on various smartphones.

Thanks in advance.

sentences:
How to prevent attackers from compromising multiplayer game servers? Consider a relatively small multiplayer game server, written by an individual or a small company. Some malicious user wants to boost their character stats by a factor of 100.

What paths of attack might they have and what are the most important safeguards to prevent these attacks?

sentences:
How do I scale and rotate around different points in Libgdx? I'm using a SpriteBatcher to rotate and scale a TextureRegion in libGDX. I'd like to rotate the texture around an origin outside of the region, but have the texture scaled around the region's center.

As far as I'm aware, this has to be performed in one action in the SpriteBatcher.draw() method. The region is scaled to the correct size, but scaled away from the origin.

I could compensate by adjusting the origin location, but is there a better method?

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:
Power, achievement and affiliation games for psychology research project For a psychology research project we're looking for short (ca. 5 minute) single-player games to observe people's basic motivation. We would like to ask people to list games that provide the closest possible (even if not perfect) fit to each description. We need 2-3 promising candidates for each of the following 3 categories.

We would be happy with anything we can use, build on, mod, change slightly etc. to fit our purposes.

A) Game that taps into affiliation

Affiliation involves being emotionally close to others and establishing new relationships. The game should revolve around meeting other characters. I.e. through simple means (clicking certain actions) one can explore possibilities to meet friends. Requests to establish relationships should be accepted in most cases, because the player is well-liked. This liking not related to status or performance, but to the warm fuzzy feeling of friendliness. When getting to know each other, many commonalities between player and character emerge and are happily acknowledged.

B) Game that taps into achievement

Achievement involves mastering difficult goals. In achievement games you would solve several quests by using some ability (speed, spatial thinking, strategy use). It should adapt to the player's ability, so that it is always possible to solve 60-70% of the quests. Player's should be able to improve their abilities and results with some training. Results should always be related to the individual performance, so there is no high score ranking with others or some such.The goal of this game should simply be to remain focused on a task of moderate difficulty, trying to become better at it.

C) Game that taps into power

Power involves obtaining social status and influencing other people. A power game would involve influencing characters and yielding reactions. It should have a low difficulty and work without points (kind of like a cheat mode maybe). In other words: Influencing other people should be easy, not dependent on achievement or liking. For example, the ability to change the lives of others could be due to insurmountable and unquestionable status differences between the person playing (e.g., a deity, a biologist) and the characters of the game (sticking to the example: mortals, ants).

Now, we hope to find resources we can re-use for our games. We don't have the ambition to create new games and many games already suit our needs. We only need the game to have at least 10 events relevant to the motive and to log these events (so we can align it with the reactions of our participants). If we can change it to do that, that'd be cool too.

Probably many quite simple games have been lost in the drawers of computer science students who made them as finger exercises and homework. We would only use these games in our research setting, so there is no commercial interest involved.

Many thanks in advance and best wishes from the whole lab!

we edited this in response to some comments

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:
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:
Tile pair matching algorithm I'm trying to make a tile matching game. User can select a pair of tiles from a square grid, and if they match, both are removed from the grid.

Tiles are matched if:

they are of the same type (many types of tiles are in the grid) AND
they can be connected in the grid (either adjacent, or has a clear path of empty spaces between them in the grid)

I would like to scan the grid in advance and find the currently matching pairs (desirably with the path that connects them). Thus I can:

give hint to users if they're stuck in finding a pair
detect a situation when no more pairs can be matched (so the tiles will be reordered)

Ideally during the scan each tile pair of the same type should be taken and checked for matching. Is there any algorithm/technique I can use in here to obtain an optimized approach in finding the connecting paths?
Also, is there anything I should take care of while initializing the grid (currently just random assignment) so as to ensure at least some tiles are adjacent in the beginning (and that I won't have to reorder them too much during the game) ?

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:
Workflow to animate character rig with an already animated model How should I go about animating character rigs (walking, running, ducking, ...) with already animated assets? Do I load the animated asset into the project file of my character rig or do I attach the animated asset to the rig in the engine?

I am using Blender for the models and Unity3D as the engine.

sentences: How do you create a funky moving background? I'm trying to create something similar to what you would see if you loaded a song in Windows Media Player (the cool abstract background that moves and produces various colors). I have no idea how this can be accomplished in libgdx. I've seen other games, such as puzzle games, on the Android store that having moving backgrounds to add visual effect so that the background isn't so static/boring. How can I achieve a similar effect without consuming a ton of RAM or without high CPU usage?

sentences:
How do I implement a subclass of CCSprite? Can someone tell me how to subclass CCSprite on Android?

I've added this snippet of code into my CharacterSprite:

public static CharacterSprite sprite(String fileName) {
  return new (CharacterSprite)CCSprite(
    CCTextureCache.sharedTextureCache().getTexture(fileName)
  );
}

But getTexture() can't be found. Can someone help me please?

sentences: Get the length of an animation from the Animator How do find the length of an animation that is included in the Animator attached to a GameObject?

sentences: Where can I find some good 3D character artists? I am searching for 3D artists for a 3D iPad game. Is there a good place in the net, where I could find one? He or she should have created game models before.

sentences:
Unity Additive particle effect blends with background I created a fire particle effect with the Particles/Additive (Soft) shader in Unity 5.2.2, and it looks fine against a dark background, like the editor background:

However, when I move it in front of a lighter background, it looks like this:

I think the additive property is blending with the background, is there a workaround to make the effect look like how it looks on a dark background, without using a different shader?

I've looked at this question: How can I achieve a good fire effect with alpha blending and particles? but I'm not sure how I would execute that in Unity.

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:
Improving an O(N^2) function (all entities iterating over all other entities) A little bit of background, I'm coding an evolution game with a friend in C++, using ENTT for the entity system. Creatures walk around in a 2D map, eat greens or other creatures, reproduce and their traits mutate.

Additionally, performance is fine (60fps no problem) when the game is run in real time, but I want to be able to speed it up significantly to not have to wait 4h to see any significant changes. So I want to get it as fast as possible.

I'm struggling to find an efficient method for creatures to find their food. Each creature is supposed to look for the best food that is close enough to them.

If it wants to eat, the creature pictured in the center is supposed to look around itself in a 149.64 radius (its view distance) and judge which food it should pursue, which is based on nutrition, distance, and type (meat or plant).

The function responsible for finding every creature their food is eating up around 70% of the run-time. Simplifying how its written currently, it goes something like this:

for (creature : all_creatures)
{
  for (food : all_entities_with_food_value)
  {
    // if the food is within the creatures view and it's
    // the best food found yet, it becomes the best food
  }
  // set the best food as the target for creature
  // make the creature chase it (change its state)
}

This function is run every tick for every creature looking for food, until the creature finds food and changes state. It's also run every time new food spawns for creatures already chasing a certain food, to make sure everyone goes after the best food available to them.

I'm open to ideas on how to make this process more efficient. I'd love to reduce the complexity from \$O(N^2)\$, but I don't know if that's even possible.

One way I already improve it is by sorting the all_entities_with_food_value group so that when a creature iterates over food too big for it to eat, it stops there. Any other improvements are more than welcome!

EDIT: Thank you all for the replies! I implemented various things from various answers:

I firstly and simply made it so the guilty function only runs once every five ticks, this made the game around 4x faster, while not visibly changing anything about game.

After that I stored in the food searching system an array with the food spawned in the same tick it runs as. This way I only need to compare the food the creature is chasing with the new foods that appeared.

Lastly, after research into space partitioning and considering BVH and quadtree, I went with the latter, as I feel like it's much simpler and better suited to my case. I implement it pretty quickly and it greatly improved performance, the food search barely takes any time at all!

Now rendering is what's slowing my down, but that's a problem for another day. Thank you all!

sentences:
Unity and Chartboost loading problems I implemented chartboost in my ios game and locally it wors great.

I can receive ads.

Now my game is online but in the google analytics I get only error messages from
the game, meaning the chartboost ads fail to load.

Here:
https://www.dropbox.com/s/cft98lk27mt7p3s/cb.jpg?dl=0

The iage show google analytics registering only failed loads and
there is no single successfull ad load?

What could be the problem here?

sentences:
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:
Need help solving an acute-triangle to find the distance to the outside of my object I recently asked a question here: How would I check the range against the entirety of an enemy object, and not just it's transform.position?
That was accurately answered, and works perfectly fine. However, now I need to find the distance from the center of a non-rectangular object to it's edge as illustrated here:
I have the length of Side A, and the angle between Side A and Side C, as well as the angle between Side A and Side B. I am missing a couple things:

The length of Side B
The length of Side C

My end goal is to get the length of side C. It is important to note that my math skills are barely comparable to first year college algebra. I heavily rely on the methods provided within Unity to calculate dot products, angles, and distances without much understanding of their inner workings.
How would I go about accomplishing this?

sentences:
Shadow Shimmering When Moving Objects I am having a shadow shimmering in my scene when using a shadow mapping technique. I know that there is a lot of posts over the internet dealing with this subject but my issue is slightly different.

I know that the problem comes from sub-texel issue when moving the camera BUT my scene is using a different technique as the camera and the light sources are stable and the objects inside the scene is moving Relative To Eye concept (RTE). The issue is when implementing cascaded shadow mapping and variance shadow mapping as stated in DirectX examples, everything goes well except that the shadows are shimmering (flickering). The shimmering is coming from the objects that are moving, not the camera. So when I try to solve the problem with adjusting the sub-texel problem with the camera movement it didn't solve the problem as the camera is stable but the objects are not.

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:
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:
Why is Cinemachine Virtual Camera locking my camera position to the Origin? I want the camera to follow a character as he moves around.  So I did the following:

Position the camera behind and slightly above the character.
Add a Cinemachine Brain component to the camera.
Create a GameObject containing a Cinemachine Virtual Camera component.  Set its LookAt and Follow properties to the character to be followed.
Run the game.

I expect for the camera to follow the character, more or less maintaining the relative position and orientation I had set for it. (ie. more or less as if the camera object was parented to it, but smoother.)
If I use the Cinemachine Free Look camera, this is basically how it works, except that it only deals with following and I have to maintain the orientation manually with the mouse.  But if I use Cinemachine Virtual Camera, because I don't want to deal with the free look part of it, for some bizarre reason it locks the position of the GameObject containing the camera to (0, 0, 0)!  And I don't just mean it moves it there; it's stuck there!  If I go into the Inspector and change the position at runtime, it instantly changes back to (0, 0, 0).
What can cause Cinemachine Virtual Camera to do this?  And how can I make it stop?

sentences:
Libgdx detect when player is outside of screen Im trying to learn libGDX (coming from XNA/MonoDevelop), and I'm making a super simple test game to get to know it better. I was wondering how to detect if the player sprite is outside of the screen and make it so it is impossible to go outside of the screen edges.

In XNA you could do something like this:

// Prevent player from moving off the left edge of the screen
if (player.Position.X < 0)
    player.Position = new Vector2(0, player.Position.Y);

How is this achieved in libgdx? I think it's the Stage that handles the 2D viewport in libgdx?

This is my code so far:

private Texture texture;
private SpriteBatch batch;
private Sprite sprite;

@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("player.png"));
    sprite = new Sprite(texture);
    sprite.setPosition(w/2 -sprite.getWidth()/2, h/2 - sprite.getHeight()/2);
}

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

    if(Gdx.input.isKeyPressed(Input.Keys.LEFT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(-1f);
        else
            sprite.translateX(-10.0f);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(1f);
        else
            sprite.translateX(10f);
    }

    batch.begin();
    sprite.draw(batch);
    batch.end();
}

sentences:
How to check if all switch objects in a room are set to true? I'm trying to implement a puzzle mechanic in Game Maker Studio 2.
Where you need to activate multiple switches for an event to happen (e.g. opening a door)

However, I'm currently stuck in recieving the booleans from all switch objects in a room. Currently It's only working when any (or only the first) switch is hit.

Here's an example of how it works:

Switch collision with projectile:

switched = !switched

'Switchdoor' step event:

if (switch.switched == true) //this only seem te register the first switch placed
{
    //do action
}

If I've used XNA, I could make a List<> to store all the rendered switches and get their boolean values. But what can I use instead in Game Maker Studio 2, who works with rooms?

sentences:
Changing DisplayMode seems not to update Input&Graphic Dimension I'm writing a small game using Slick and Nifty-GUI.
At the program startup I set the DisplayMode using the following lines:

AppGameContainer app = new ...
app.setDisplayMode( 800, 600, false );
app.start();

I wrote a Nifty-ScreenController for my settings dialog in which the user can select the desired DisplayMode. When I try to set the new DisplayMode within this controller class the game window gets resized correctly but the Graphics and Input objects aren't updated accordingly. Therefore my rendering code just uses a part of the new window.

I tried to set different DisplayModes in the main method to test if it's generally possible to invoke this method multiple times. It seems that changing the DisplayMode only works before I call app.start().

Furthermore I tried to update the Graphics & Input object manually but the init and setDimensions methods are package private. :(

Does someone know what I'm doing wrong and how to change the DisplayMode correctly?

sentences:
Tools for assembling textures into DDS files There are plenty of tools for making images. I'm not looking for one of those; I have many tools for creating an image. I've got tools for compressing images, generating mipmaps, and even for poking at their basic data format.

My issue is with texture assembly. DDS files support cubemaps, array textures, and even cubemap arrays. But I don't know of a tool that can pack a series of images into a cubemap or the like. What tools are available for doing this kind of thing?

sentences:
How to know if a game concept is "different enough"? For the past year or so, I've been designing a top-down zombie shooter game. However, after playing a 2d top-down battle royale game, it's given me inspiration to build a similar game. The graphics would be very similar, though there would be new things like building.

I'm trying to decide if this concept is different enough; there's another similar game, though it has different graphics and some other key differences.

I'm wondering at what point two games become too similar, and how to avoid taking too many ideas from one game (a common problem for me).

sentences:
How do I make a progress bar with letters that get "filled in"? I want to make a progress bar made of text! I have two images: One with the text in gray, the other coloured:

As my game is loading, I want the letters to "fill up" with color:

They would start out gray, then fill in.

I was thinking of overlaying a transparent rectangle over the gray image, then stretching the transparent rectangle to match the progress. But then the background will be coloured too. I want only the letters to be coloured!

How can I do this?

sentences:
Reducing APK File Size by using JPG instead of PNG for game background images I've just finished my (openGL ES 2.0 Android) game and it's almost ready for Alpha-testing.

When I export the application to an APK File, the file is taking up 16MB and I would like to reduce this as much as I can.

Here are some points about what the project contains and what I've tried to reduce the size already:

222kb of Ogg Vorbis files used for Sound Effects
1 x MP3 file at 5.59MB (128kbps Bitrate)
4 x sets of PNG files used for textures (XHDPI, HDPI, MDPI & LDPI - I'm not using XXHDPI)
Just over 1MB of code

What I've tried thus far to get where I am:

I've optimised the PNG files using Optiping
I've applied ProGuard to my code before exporting, this didn't really help by much as 99% of my app is resources.

So my question is, is there really much else I can do to reduce the size of the APK?  I was thinking about maybe using JPG format source files for my Background OpenGL textures instead of PNG - anyone have any experience with this?  Does it hurt performance at all?  I can see that it would make quite a difference - my atlas of backgrounds in PNG format for XHDPI is 1.7MB - and a 90% compressed JPG comes in at around 650KB.  I'm just not sure if it's a good idea as everyone always advocates PNG > JPG.

Any pointers from personal experience would be helpful & also if I've overlooked anything other than using JPG's.

sentences:
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:
Why does my object move faster at 45 degrees than at 90 degrees? I have objects in my game that move faster at 45 degrees then at 90 degrees.

Each object has

Point (x,y) position
Vector2D (x,y) direction
Int speed

And what I do during a update is that new position is calculated as:

position.x += direction.x * speed
position.y += direction.y * speed

How do I correct this? I want it to move with the same speed at any angle.

sentences:
Get all OffMeshLink objects in Unity What I'm trying to do is to make an edit-mode script that gets all off-mesh links and makes some of them bi-directional(depends whether a jump is possible).

My (obvious) attempt was:

FindObjectsOfType<OffMeshLink>();

However, it returns only the links I have created manually.

My question is the following: how to access the off-mesh links generated by unity in the baked NavMesh?

Any help would be greatly appreciated.

sentences:
How to convert screen to world coordinates while using gluLookAt / gluPerspective or similar matrix transforms? I am just starting an adventure in looking under the hood of graphics for a game project I've been working on for a while, and I could use some guidance.

I am using Python/Kivy (though that is not part of the concern), and am trying to use projection and modelview matrices to perform screen-to-world coordinate conversion.   I am using something similar to gluLookAt and gluPerspective matrix transforms for those.

The issue I'm running into, is that the coordinates I get out of multiplying the mv and p matrices together and inverting them, then multiplying by NDC screen coords, the resulting coordinates are only either a fraction of a pixel away from the world position look_at is currently centered on, or a max of a few pixels +/- that point.

I know I'm missing something, and I would love if someone could help me understand.  I wrote a standalone example gist, and made a short youtube video showing what problem I'm having.

https://youtu.be/UxbWQO9e0NE
https://gist.github.com/spinningD20/951e49cb836f08c434a0e9ab0e90c766

The code in question, is the screen_to_world method in the gist, when using the camera_look_at_perspective method to create the MVP, which I will list here:

p = Matrix()
p.perspective(90., 16 / 9, 1, 1000)

self.canvas['projection_mat'] = p
self.canvas['modelview_mat'] = Matrix().look_at(w_x, w_y - 30, self.camera_scale * 350, w_x, w_y, 0, 0, 1, 0)

That is for creating the matrices, and...

def screen_to_world(self, x, y):
    proj = self.canvas['projection_mat']
    model = self.canvas['modelview_mat']

    # get the inverse of the current matrices, MVP
    m = Matrix().multiply(proj).multiply(model)
    inverse = m.inverse()
    w, h = self.size

    # normalize pos in window
    norm_x = x / w * 2.0 - 1.0
    norm_y = y / h * 2.0 - 1.0

    p = inverse.transform_point(norm_x, norm_y, 0)
    # print('convert_from_screen_to_world', x, y, p)
    return p[:2]

Was originally written to convert coordinates when using the previous projection matrix built using translate and creating a clip space (also included in the example).

While the implementation appears to be specific to Kivy, it is just a modelview matrix and projection matrix being used, and their Matrix.transform_point method used above is the same as multiplying a vec against the matrix in question.  It can also include what appears to be the W part of a vec4, which I have also experimented with, with no apparent change.

Here is a screenshot of the standalone example, painting where I have moved the mouse on the screen (red) and where the resulting world coordinate ends up being (green).  The goal is for the converted coordinates in the world to fall directly under the red.

sentences:
Issues with spine animation alpha in iOS We are seeing a ton of artifacts and strangeness with alpha on iOS for our spine animation assets. You can see an example of one of these grid-like artifacts here, but we're also seeing pixelation etc.
Does anyone know why this is happening, whether we need to make adjustments or change certain settings to address this issue?

sentences:
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:
Mesh manipulation on GPU vs CPU Just a bit curious - where do you perform mesh manipulations, on the CPU or in the shader?
I've been doing everything on the CPU and a friend suggested moving things on to the GPU side.

If you're doing things like bone animations... on the GPU, how do you get back the mesh? (since I'm doing collision detection...)

sentences:
What are easing functions? I found this cool website for game development and it has a list of easing functions:

Although the site contains a description of what they're for, it goes over my head.  What are easing functions and what are they used for?

Update

I found a better example of the functions themselves from Phaser.io's source code.  These functions are much simpler than the answers here would suggest.  They only take one parameter, k.  As part of the answer, I'd like to know how to use these.

sentences:
Should I throw out game heavily using OpenGL 2.0 and rewrite it from scratch? I've picked up one old open source game (done with C++/Lua) with a lot of features and chosen to continue its development. It use SDL2 (ported by me from 1.2) and OpenGL 2.0. Now when I look at futher development it seems that mobile platforms don't support legacy OpenGL stuff, which is used really heavily: entire arhitecure is based on calling gl functions from lua side, where rendering functions are specified.

I'm not quite a pro in 3D development, so I'm not sure is it easier to change current architecture to modern OpenGL or re-write all the stuff. There are some other architecture problems (not GL related ones).

So, is it better to try changing exsisting architecture or start all from scatch, using modern stuff like OpenGL 3.1+ or Vulcan?

sentences:
How does this animation work? This project "Locomotion Skills for Simulated Quadrupeds" creates an animation for the dog model in the program. However if you go into the project's files the dog's skeleton is made of individual obj files for each bone. How were the bones loaded into the program to make the complete animation? It's as if the position of the obj's were attached to... the vector I guess? Can anyone elaborate a little more?

My reasoning for this is because I want to replicate it, create a model (to be animated) out of separate model files. I guess my question is how make one character out of several separate model files? Thanks

sentences:
How to send data from Unity to Mailchimp I have followed the WWWForm script reference to try to connect Unity with Mailchimp. According with the log, the form is sent without errors. Unfortunately Mailchimp did not stored any data.

This is my code:

public class EmailSendButton : MonoBehaviour {

    public GameObject emailInputText;
    private WWWForm form;

    ///
    /// In the Inspector we tell Unity to call this function when the button is clicked.
    ///
    public void onClick() {
        StartCoroutine(SendToMailChimp());
    }

    // TODO It seems to be working but Mailchimp did not store anything
    private IEnumerator SendToMailChimp() {
        form = new WWWForm();
        string email = emailInputText.GetComponent<UnityEngine.UI.Text>().text;
        form.AddField("mce-EMAIL", email); // I have also tried with: form.AddField("email", email);
        WWW w = new WWW("http://bustogames.us11.list-manage.com/subscribe/post?u=8855252b454d05c2f913c1d2b&amp;id=2ac022b22a", form);
        yield return w;

        if (!string.IsNullOrEmpty(w.error)) { print("Error sending the form: " + w.error); }
        else { print("Form sent without errors"); }
    }
}

This is the cut and paste code provided by Mailchimp:

<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">

<form action="//bustogames.us11.list-manage.com/subscribe/post?u=8855252b454d05c2f913c1d2b&amp;id=2ac022b22a" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

    Subscribe to our mailing list
    <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>

<input type="text" name="b_8855252b454d05c2f913c1d2b_2ac022b22a" tabindex="-1" value="">

<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">

</form>

sentences:
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:
Generating a town layout in a grid I want to generate a town layout in a square grid (rendered isometrically, but that doesn't matter) using the following elements:

2x2 Houses
Roads, 1 unit wide
Canals, 1 unit wide

Sample layout:

I always have a specific number of houses, and as many roads and canals as necessary to connect them all.
The houses need to have two pieces of road in front of their front door (which is always pointing to the right)
It would be nice to have fields of grass (emptiness) inbetween.

Is there a ready-made algorithm for this? If not, what direction should I be thinking of to implement this?

sentences:
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:
Precalculate the position of a rotating Aircraft To start honestly, this question is probably mostly handling math. But thats only the road I tried to go and failed miserably, so maybe theres a much more simple way to do.

Ok the game situation is pretty simple: A 3D space game with nearly no constraints. I don't care about physics in this game, besides from collision.

There is an aircraft (or actually more of them) that gets moved forward every frame according to it's speed and the delta time.  The movement of the aircraft occurs according to its own z-Axis. Before the translation the aircraft gets rotated, too. First around it's y-Axis and then around it's x-Axis. The result is a simply controllable aircraft.

Here some code for you:

void Update()
{
  //Rotate left/right
  float h = HORZ_SPEED * paramX * Time.deltaTime; //HORZ_SPEED is a fixed property of the aircraft, paramX an input value
  Quaternion deltaRotation = Quaternion.Euler(Vector3.up*h);,
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Vertical rotation
  float v = VERT_SPEED * (-1.0f) * paramY * Time.deltaTime;
  deltaRotation = Quaternion.Euler(v,0,0);
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Translation
  rigidbody.velocity = this.speed * transform.TransformDirection(Vector3.forward);
}

I simplified it a bit, but it's not really much more to that. The problem now is:
I want to predict this movement.

For different AI issues like collision avoidance and pattern recognition, I would like to calculate with constant parameters v and h and speed, where my aircraft would be at a point in time X seconds in the future.

What I tried is calculating it the hard way, starting with a start position of object axes, speed and rotation per second and constructing transformations and positions for a few frames progress, hoping it would collapse to a simple pattern. But I didn't find it.

If got the strong feeling that this kind of movement should form a simple pattern like a circle (ok, not soo simple) or an ellipse that I can calculate through a few variables. But I can't seem to make my mind up what that pattern should be and how I can calculate it's characteristics out of the data I have.

EDIT: What I managed to calculate is the transformation the local unit vectors take each frame:
e_z -> e_y * sin(a_y) + [e_z * cos(a_x) + e_x * sin(a_x)]*cos(a_y)
e_x -> e_x * cos(a_x) - e_z * sin(a_x)
e_y -> e_y * cos(a_y) - [e_z * cos(a_x) + e_x * sin(a_x)]*sin(a_y)

On the right all unit vectors are used in their state of the last frame.
a_x and a_y are the rotation parameters for the x resp. y axis:
a_x = VERT_SPEED * paramY
a_y = HORZ_SPEED * paramX

sentences:
Unity test/Play mode window problem I tried to find an answer to his problem but i wasn't successful. When i press play to test my game, instead of the play mode going to the Game tab and play the game there, with all the unity tabs and options still on the screen, it goes almost full screen, all of the unity window goes to the game mode and i can't see anything but the game, to see the scene, options, etc.. again i need to stop the play mode. For example, if i want to test triggers in play mode, i can't because all i see is the game window. How can i test the game just in the Game tab? Perhaps i changed some setting.

I'm not sure if im explaining my problem correctly.

Thank you

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:
Displaying possible movement tiles What's the fastest way to highlight all possible movement tiles for a player on a square grid? Players can only move up, down, left, right. Tiles can cost more than one movement, multiple levels are available to move, and players can be larger than one tile. Think of games like Fire Emblem, Front Mission, and XCOM.

My first thought was to recursively search for connecting tiles. This quickly demonstrated many shortcomings when blockers, movement costs, and other features were added into the mix.

My second thought was to use an A* pathfinding algorithm to check all tiles presumed valid. Presumed valid tiles would come from an algorithm that generates a diamond of tiles from the player's speed (see example here http://jsfiddle.net/truefreestyle/Suww8/9/). Problem is this seems a little slow and expensive. Is there a faster way?

Edit: In Lua for Corona SDK, I integrated the following movement generation controller. I've linked to a Gist here because the solution is around 90 lines of code.

https://gist.github.com/ashblue/5546009

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

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

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

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

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

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

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

:EDIT:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

sentences:
Libgdx scene2d not erasing old texture I've been having trouble with getting scene2d to erase my old texture when I switch screens, and also when I change my label the old label string is still drawn underneath.

public StartScreen(MainGame game){
    this.mainGame = game;

    viewport = new FitViewport(640, 360, new OrthographicCamera());
    stage = new Stage(viewport, game.batch);

    Texture button = new Texture("playButton.png");
    Button.ButtonStyle bs = new Button.ButtonStyle();
    bs.up = new TextureRegionDrawable(new TextureRegion(button));
    startGameButton = new Button(bs);

    Table table = new Table();
    table.top();
    table.setFillParent(true);

    table.add(startGameButton).expandX().padTop(10);

    stage.addActor(table);

    startGameButton.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            mainGame.SetClassScreen();
        }
    });

    Gdx.input.setInputProcessor(stage);
}

public void render(float delta) {
    mainGame.batch.setProjectionMatrix(stage.getCamera().combined);
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}

In the constructor I have tried using Dispose() when changing the screen and it doesn't work.

When the screens are changed, The playButton still shows in the next screen. I also have a Label which displays text depending on a button pressed, but when it's pressed it writes the string over the old string to look like a jumbled mess.

I have a feeling I'm not updating something to be redrawn somewhere but I can't find it.

public PickClassScreen(MainGame game){
    this.mainGame = game;

    viewport = new FitViewport(640, 360, new OrthographicCamera());
    stage = new Stage(viewport, game.batch);

    //All initialization of Scene2d stuff.

    stage.addActor(table);

    Gdx.input.setInputProcessor(stage);
}

@Override
public void show() {

}

@Override
public void render(float delta) {
    mainGame.batch.setProjectionMatrix(stage.getCamera().combined);
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

}

The screen that I am switching to. ^

sentences:
Moving Objects Relatively With Their Parent Object [Gamemaker] I have an object type, oFur, instances of which are generated in a random distribution over the sprite area of a parent object, oFurArea.

However, I would like the oFurArea to change its image_xscale and image_yscale dynamically, as well as its y position. This is easy to do, but I would also like all of the oFur instances to move with their parent (i.e. change their own 'y' values), whilst maintaining their relative positions on the parent object.

Either I'm having a brain-fart, or I cannot work out how to do this. Any help would be appreciated.

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:
Why does my palette swapping code in D3D9 not have any effect? I want to do palette swapping in my game, in a fast way and without shaders, so I couldn't replace pixels in a texture, then I tried to use the SetPaletteEntries and SetCurrentTexturePalette method, but it's not working.

static int counter = 0;

// Palette swapping experiment
PALETTEENTRY entries[256];

if (counter == 0)
{
    // Fill the palette entries with 0xFFFFFFFF
    FillMemory(&entries, sizeof(entries), 0xFF);

    // Set the palette entries in the palette index.
    if (FAILED(window.device->SetPaletteEntries(0, (PALETTEENTRY*) &entries)))
        throw std::runtime_error("SetPaletteEntries()");

    // Set the current texture palette
    if (FAILED(window.device->SetCurrentTexturePalette(0)))
        throw std::runtime_error("SetCurrentTexturePalette()");

    ++counter;
}
///////////////////////////////////////////
else if (counter == 1)
{
    // Fill the palette entries with 0x8080FFFF
    for (int i = 0; i < sizeof(entries) / sizeof(PALETTEENTRY); ++i)
        entries[i] = {0x80, 0x80, 0x80, 0xFF};

    // Set the palette entries in the palette index.
    if (FAILED(window.device->SetPaletteEntries(0, (PALETTEENTRY*) &entries)))
        throw std::runtime_error("SetPaletteEntries()");

    // Set the current texture palette
    if (FAILED(window.device->SetCurrentTexturePalette(0)))
        throw std::runtime_error("SetCurrentTexturePalette()");

    ++counter;
}

I'm loading the textures with DDSTextureLoader, and no exceptions are being thrown.
Thanks for reading.

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:
Staggered Isometric Map: Calculate map coordinates for point on screen I know there are already a lot of resources about this, but I haven't found one that matches my coordinate system and I'm having massive trouble adjusting any of those solutions to my needs.
What I learned is that the best way to do this is to use a transformation matrix. Implementing that is no problem, but I don't know in which way I have to transform the coordinate space.

Here's an image that shows my coordinate system:

How do I transform a point on screen to this coordinate system?

sentences:
Java 2d topdown collision Im making a game and Im working on the collision.
First Ill tell you what I want (Ill put in pictures), then Ill leave the code.

What I want: I want the player to stop exactly before its collision box (a rectangle) intersects with a wall collision box. Right now this only happens sometimes, sometimes it doesnt go all the way to the wall, that is probably because the velocity is too big I guess. Here are the pictures:

Left: it works good, it goes all the way to the wall (btw the red square is the collision box).

Right: The player only goes down that much and leaves a gap inbetween it and the wall (the circle shows the gap) and you can not go down to go all the way to the wall.

The movment code:

if(canMove){
    move(xVol, yVol);
    xVol = yVol = 0f; // resets the velotcity
}

public void move(float xv, float yv){
    if(!collisionv(yv)){
        y += yv; // moves the player on its y
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setY(y); // moves the collision box
            }
        }
    }

    if(!collisionh(xv)){
        x += xv; // moves the player on its x
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setX(x); // moves the collision box
            }
        }
    }

}

public boolean collisionv(float yv){
// Vertical collision checking
    boolean ret = false;
// makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x, y + yv, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){

        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
    // This true collision method just returns if the rectangles are intersecting
            ret = true;
        }
    }
    return ret;
}

public boolean collisionh(float xv){
// Horizontal collision checking
    boolean ret = false;
    // makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x + xv, y, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){
        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
            ret = true;
        }
    }
    return ret;
}

My question: How do I make it move all the way to the wall, never leaving a gap inbetween the player and the wall?

sentences:
How can I access game instance data in a window procedure callback? In the window procedure message processing function, I have come across a couple of things where I just have no idea what to do apart from declare a class globally so that my window procedure can see it.

Imagine I have a Game class that is created in the window loop function and has a handle to the window passed through into it:

class Game
{
    game( HWND hWnd );
    void Go();
    void ReCalculateViewportOffsets();
}

...// windows stuff and handle to window created
Game theGame( hWnd );
...// windows loop starts
theGame.Go();

Half-way through my game, someone changes the resolution so I need to fire a redraw with new offsets to center my viewport... I  would like to call that from my WM_RESIZE handler, but theGame has been declared as a local in my main function rather than a global. Probably a good thing? but how on earth can I get hold of theGame in my windows procedure function without declaring it globally:

case "WM_RESIZE":
    //...
    theGame.ReCalculateViewportOffsets( newWidth, newHeight );

sentences:
Prevent collisions between mobs/npcs/units piloted by computer AI : How to avoid mobile obstacles? Lets says we have character a starting at point A and character b starting at point B. character a is headed to point B and character b is headed to point A. There are several simple ways to find the path(I will be using Dijkstra). The question is, how do I take preventative action in the code to stop the two from colliding with one another?

case2: Characters a and b start from the same point in different times. Character b starts later and is the faster of the two. How do I make character b walk around character a without going through it?

case3:Lets say we have m such characters in each side and there is sufficient room to pass through without the characters overlapping with one another. How do I stop the two groups of characters from "walking on top of one another" and allow them pass around one another in a natural organic way.

A correct answer would be any algorithm, that given the path to the destination and a list of mobile objects that block the path, finds an alternative path or stops without stopping all units when there is sufficient room to traverse.

sentences:
Moving a sprite accelerometer Im trying to, in cocos2d for the iPhone, move a CCSprite (in this case "player" up and down (the app is in landscape). How can I accomplish this? I have been unable to do so. ex.

-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    player.position.x = acceleration.x * 10;
    NSLog(@"Accelerometer x value is %f\n", acceleration.x);
}

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:
Problem with the Layer System/Tilemap Layer from Unity This is my first time using Unity (and my third time creating a game in general), so I hope I can provide the needed information to solve this problem.

My character overlaps with the upper wall, but doesnt with the lower wall. This is the right behaviour given the layers (seen in the picture). But I want him to be behind the lower wall AND in front of the upper wall.

Side Information:
 - The Wall Tile is one piece, which covers two tiles.
 - Movement is depended on the existents of a ground tile. The reason behind this is, that I wanted the character to always move one tile at a time. And since this is my first time with unity, that was the easiest way of doing it. So there is no actual interaction with the wall. No collsions or anything.
 - There are three Layers (Ground, Creature, Wall) and two tilemap layers (Ground and Wall) (see picture) and the character doesnt interact with the tilemaps at all, he just gets drawn above the ground tilemap layer.

What I see as answers:
 - Split the wall tile into two tiles and let the wall part be on another layer, then the roof part.
 - Split the character into two parts and do the same thing.
Both seem like a good way of solving it, but I dont even know where do start there. I think I can split the walls into two tiles, but I dont know if this is a good way to solve this issue. The other option, to split my character, there I really dont know where to start.

What I tried:
 - Trying around with layers and order in layers.
 - Trying around with the tile atlas (adding the sprite, removing tiles)

sentences:
What is Unity Quaternion range? I've read somewhere that a Quaternion in Unity ranges between [-1,1] values. I mean the individual XYZW values. Ex: new Quaternion(.1f,.2f,-.3f,-.4f)

Is this true?

More clearly: I know they take float values therefore the theoretical limit is floating point value limitations, I'm asking the real rotation results. For instance when I look up Quaternion values while rotating a GameObject it is usually in the [-1,1] limits. But I'm not sure if that's my case or not.

sentences: Use code to disable player input unreal engine I have seen a lot of ways to use the node based visual scripts to stop player input; However, I have not seen a single example of how to disable the player input in visual studio?

sentences:
Isometric character from 3D blender model I am trying to make a character for an isometric game from a 3D model in Blender. I managed to create a simple humanoid model and implement an isometric camera, rotated by 60° on the x-axis and 45° on the z-axis. Following a screenshot of this model with camera settings:

I chose making a 3D model in blender because I want to be able to make changes to my models without having to change loads of images or sprite sheets and I also wanted to get into 3D modelling.

I looked into articles by clint bellanger - that's where I got the idea to make my graphics in blender, rather than draw in Illustrator or photshop - but I am not sure how I should continue now. My questions are

is this a good way to accomplish my goal of making an isometric character from a 3d model
if it is feasible to turn around the ratio of 2:1 between width and height for my character or if I should render it another way
if the settings of the camera I have in blender are correct to use for an isometric game with a 2:1 ratio of width and height for the tiles.

Thanks in advance

sentences: How do I access device camera in GameMaker Studio 1.4? I've looked everywhere in the documentation for GameMaker and I didn't find anything about how to access the camera.

sentences:
How can I select an audio output device in directshow I was wondering how I can select the output device for audio in directshow. I am able to get available audio output devices in directshow. But how can I make one of these to be audio output device. Its always going for the default audio device. I want to be able to output audio on my choice of device. I have been struggling through google but couldn't find anything useful. All I could get was this link but it doesn't really solve my problem.

Any help will be really helpful for me.

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

sentences:
Navigation Mesh, Chunks and Funnel Algorithm I am building a little RTS-like game as a side project and I am currently working on pathfinding. My approach to pathfinding is heavily inspired by things I saw in the Starcraft II map editor, which enables diagonal obstacles. My map consists of tiles that are subdivided into 4 triangles each and each triangle can be passable or not passable. I then build a navigation mesh by generating polygons (with holes) of the passable area and then triangulating them. See the following pictures for an example:

The colored areas are the triangulated polygons that make up the navigation mesh.

As an optimization I thought it would be a good idea to subdivide the map into chunks (i.e. 32x32 grid tiles) to allow for fast updates of the mesh (as soon as a triangle changes from passable/impassable I rebuild the whole chunk and update the navigation mesh accordingly). See the following picture for an example:

The red lines are the chunk borders (which is also why the color of the navigation mesh sometimes changes accross the borders).

The triangulation is a separate constrained delaunay triangulation for each chunk. For the chunk-wise updates to work I had to introduce constraints at the chunk borders for the triangles to line up. Up until now everything seemed to work fine. I then went to implement some pathfinding using A* on edge midpoints and path smoothing using the Simple Stupid Funnel algorithm (see "Efficient Triangulation-Based Pathfinding" by Demyen and Buro or How does the Simple Stupid Funnel Algorithm work?).

The problem is now that some triangles have their vertices at chunk borders that don't correspond to an obstacle. If such a triangle is part of a path found by A* the funnel algorithm uses it if it was a corner point of an obstacle and produces a wrong path. See the folowing picture for an example:

The red area is the passable area and has no obstacles inside. The green path is the path as it is found by e.g. A* and the blue path is the smoothed path using the funnel algorithm. Since there is an extra vertex in the navigation mesh introduced by the the chunk borders (where the 4 chunks meet) the funnel algorithm handles it the same as if it was the corner of an obstacle and thus the path is not a straight line but takes a detour around the corner. Ultimately I wanted to implement something along the lines of "Compromise-free Pathfinding on a Navigation Mesh" by Cui, Harabor and Grastien to find truly optimal paths in a navigation mesh. But all of those methods seem to assume that the navigation mesh contains no extra vertices except for the corners of obstacles (and the outer border of course).

I am looking for a solution for the problem of splitting the map into chunks for efficient updates of the navigation mesh while still being able to find optimal paths in an efficient manner (e.g. i don't want to do real line of sight checks instead of the funnel algorithm). My only other option it seems would be an algorithm for dynamic constrained delaunay triangulations and having a single triangulation for the whole map (since this would not introduce extra obstacles) which for one is pretty complicated and second (and more importantly) doesn't scale.

I know that this is a pretty open question. I hope it comes clear what I am looking for, since it was kind of difficult to phrase the problem :D
If anything needs clarification, please tell me :D

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:
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:
Swap Child and Child's Child Is it possible to use swapChildren() with a child and a child's child? Every time I try, I get this error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

Why can I not compare a child with a child's child? How can I?

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:
2D character controller in unity (trying to get old-school platformers back) This days I'm trying to create a 2D character controller with unity (using phisics). I'm fairly new to physic engines and it is really hard to get the control feel I'm looking for. I would be really happy if anyone could suggest solution for a problem I'm finding:

This is my FixedUpdate right now:

public void FixedUpdate()
{
    Vector3 v=new Vector3(0,-10000*Time.fixedDeltaTime,0);
    _body.AddForce(v);

    v.y=0;
    if(state(MovementState.Left))
    {
        v.x=-_walkSpeed*Time.fixedDeltaTime+v.x;
        if(Mathf.Abs(v.x)>_maxWalkSpeed) v.x=-_maxWalkSpeed;
    }
    else if(state(MovementState.Right))
    {
        v.x= _walkSpeed*Time.fixedDeltaTime+v.x;
        if(Mathf.Abs(v.x)>_maxWalkSpeed) v.x=_maxWalkSpeed;
    }

    _body.velocity=v;

    Debug.Log("Velocity: "+_body.velocity);
}

I'm trying here to just move the rigid body applying a gravity and a linear force for left and right. I have setup a physic material that makes no bouncing and 0 friction when moving and 1 friction with stand still. The main problem is that I have colliders with slopes and the velocity changes from going up (slower) , going down the slope (faster) and walk on a straight collider (normal). How could this be fixed? As you see I'm applying allways same velocity for x axis.

For the player I have it setup with a sphere at feet position that is the rigidbody I'm applying forces to.

Any other tip that could make my life easier with this are welcomed :).

P.D. While coming home I have noticed I could solve this applying a constant force parallel to the surface the player is walking, but don't know if it is best method.

sentences:
Detecting when a car is out of the track I am completely new to Unity 3D, just started to follow some tutorials y'day. I am trying to build a 2D car racing game as a part of my learning (time beating, no opponents). I have a racing track as texture (repeating). My problem is knowing when the car is outside/inside the track (I wouldn't prefer to limit it to the track boundaries).

What I have tried after searching around : I read somewhere about Mesh Colliders so:

I added a mesh collider to the track (with 'Convex' and 'Is Trigger' checked , to be honest I don't know what Convex is, but I couldn't check 'Is Trigger' w/out checking 'Convex').
Added OnTriggerExit and OnTriggerEnter methods to the Track script (the script that scrolls the track) hoping the two would be called each timer the car goes out of the track or gets back in.

Apparently the two methods aren't called at all, Would someone please help. Thanks.

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:
Player jittering against wall when held down button So, I'm making a top down RPG.

Everything's going excellent, but this problem is quite annoying. Now, when the character moves against the wall, the player jitters back and forth. I'm guessing it's because the player is trying to move into the wall, and then the wall collision is pushing it back, which makes an annoying back and forth movement. My question is obviously, how do I stop this from happening?

Thanks!

PS: I'm using transform.translate to move the player, and I'm using C#.

EDIT: I'm also using a 2D Rigidbody, and 2Dbox colliders on both.

sentences:
How to implement Vector3.MoveTowards follow with random movement I want to implement an AI behavior where an enemy runs towards the player while sidestepping randomly and aggressively (like in this video: https://www.youtube.com/watch?v=35Ut_C4eL40)
Currently I am just using Vector3.MoveTowards but that results in smooth movement which isn't exactly what I need. I've tried adding an offset to the target using Random.insideUnitCircle but it just doesn't work.
If anyone could give me an algorithm to implement it'll be great. Thanks

sentences:
Unity: Texture glitches on Build I'm getting the most horrible glitches on multiple materials and objects. In the Unity Editor everything is fine. When building individual scenes alone it is fine. But when I build all the scenes including main menu, things like this happen.
I have no idea what I should do in terms of diagnosis since it's fine when building the scene by itself. I've had similar, seemingly undiagnosifiable, encounters with unity builds.

sentences:
Bounding volume hierarchy for outdoor scenes I started with a very simple graphics engine a few weeks ago and I have finished a simple scene-graph and I am now at a point where I need to create a bounding volume hierarchy.

I never really thought about it that much and now I am stuck. Basically my current goal is to achieve view frustum culling and I know how to do this but I have no idea of how to generate a bounding volume hierarchy.

The problem that I have is that I don't know how to create bounding boxes spatially.

My scene-graph allows me to group objects together and at the moment I am doing this

[object_group1,object_group2,....object_groupN]

And now I just check if the object_group is inside my view frustum, but this is only a naive solution.

Which algorithm/data structure would you recommend for an outdoor scene?

sentences:
What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity] I came across the following declaration on unity tutorial

#pragma surface surf BlinnPhong addshadow fullforwardshadows
vertex:disp tessellate:tessEdge nolightmap

I think disp is the displacement shader but what does vertex:disp mean?
Likewise for tesselate:tessEdge.

from https://docs.unity3d.com/Manual/SL-SurfaceShaderTessellation.html

Thanks. I am rather new to HLSL.

sentences:
Unity vr device support I have been looking for a list of VR devices that unity supports (or that you can use to develop VR games with).

However i have been unable to find a list. Currently im looking at BOBO VR Z4

But to make sure i do not make any incorrect purchases so it would be really helpful to know supported devices.

Also it is worth noting i'm going to be using the newest version of Unity. (which is currently version 5.6)

sentences:
InvalidOperationException in build only, when trying to select object in a dynamically loaded scene using Linq Here is the relevant code:

private void Awake()
{
    StartCoroutine(LoadScenes());
}

private IEnumerator LoadScenes()
{
    this.sceneLoad1 = SceneManager.LoadSceneAsync(Scene1, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 1...");
        yield return null;
    }

    this.sceneLoad2 = SceneManager.LoadSceneAsync(Scene2, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 2...");
        yield return null;
    }
}

private void Start()
{
    SceneManager.GetSceneByName(Scene1)
                .GetRootGameObjects()
                .Where(root => root.GetComponent<God>() != null)
                .Select(root => root.GetComponent<God>())
                .Single()
                .SpreadGospel();
}

(Scene1 and Scene2 are const strings.)

The program works fine when running in the Unity editor. However, when I make a development build, I see the follow error message:

    InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Single[God] (IEnumerable`1 source) [0x00057] in /Users/builduser/buildslave/mono/build/mcs/class/System.Core/System.Linq/Enumerable.cs:1968
  at MySolution.GodInitializer.SpreadGospel () [0x00001] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:100
  at MySolution.GodInitializer.Start () [0x00012] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:77

... which indicates that the scene wasn't fully loaded before I tried to access the God singleton.

What changes should I make to fix the problem?

sentences:
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:
How to setup for live player / observer pair w/ voice chat in Minecraft I'm trying to build a setup for educational use of Minecraft:

One person plays Minecraft, another person watches live online with the least lag/latency possible, and the pair can talk over high-quality voice chat.

What is the best setup to allow this?

Scenario A:

1) Write a mod that allows a watcher to be a passive spectator through their copy of Minecraft? The watcher would see exactly what the player sees.  Would this be the fastest and clearest picture? Is it a trivial mod to write?

2) Connect together over Hamachi? Can that be dead-easy to set up?

3) Use a voice-chat in the game itself?

Scenario B:

1) Use a streaming video technology. (Twitch? Google Hangouts? Something else?)

2) Third party voice chat like Skype. (Or just Google Hangouts?)

My fear here is lag, low quality video, bandwidth.

Scenario C ?

Thanks very much for any help :)

sentences:
Cubes are separating from each other I recently asked this question

        public void spawnCube() {
      cubes = new Array < Rectangle > ();
      for (int i = 0; i < 3; i++) {
          Rectangle cube = new Rectangle();
          cube.x = xpos;
          cube.y = ypos;
          cube.width = width;
          cube.height = height;
          xpos += 28;
          if (Gdx.input.justTouched()) {
              cubes2.add(cube);
              score++;
          }
          cubes.add(cube);
      }
  }

  public void moveCube() {
      Iterator < Rectangle > iter = cubes.iterator();
      while (iter.hasNext()) {
          Rectangle cube = iter.next();
          cube.x += speed * Gdx.graphics.getDeltaTime();
          if (cube.x + cube.width > 800 || cube.x < 0)
              speed = -speed;
      }
  }

The first method generates 3 cubes, the second one moves them from right to left and back. Cube size 15w 30h. Screen size 800w 400h.

The problem I have is that after 2 or 3 cycles of the cubes going from right to left, the cube on the left gets seperated from the other two. It seems that the other two cubes are pushing the first one out of place. How to prevent that from happening?

sentences:
Is there a global "low resolution" filter for OpenGL? I'm trying to learn a little about OpenGL, so I'm making a simple 2D game (with OpenTK), and so far it's coming along well. I thought it would be fun to give it that, for lack of a better word, retropixelated look of games from the early nineties. I figured it would be an easy thing to do -- simply draw everything at half its normal size and scale up with no anti-aliasing.

But I can't find any resources on how to do this. I can set the min/mag filters of my textures to nearest and that works fine for my sprites, but I'm using lots of primitives and I'd like the effect to apply to them as well.

The one idea I had was to draw everything at half size, then somehow copy the render buffer to a texture, then render that texture full-size, but I don't know how to do that, and it seems like there must be a better way. Can anyone help me out?

sentences:
What is this type of camera called? I am trying to find a name like "perspective view" of how a camera like this is called:

It is 2d and 3d at the same time. I'm having a hard time trying to find the name.

sentences:
SDL2 reporting 24-bit pixel format on a 32-bit desktop setup I'm trying to figure out why calling SDL_GetWindowPixelFormat is returning SDL_PIXELFORMAT_RGB888, even though I'm creating the window with the flag "SDL_WINDOW_FULLSCREEN_DESKTOP", and my desktop uses 32-bit color.

Perhaps I'm misunderstanding what this flag means. I'm running my program on a Windows 7 machine, and I checked the display color-depth using
Control Panel -> Display -> Adjust Resolution -> Advanced Settings -> Monitor
(which displays "50 Hz, True Color 32-bit".)

I'm coding using SDL2 (version 2.0.6). I was expecting this call to return SDL_PIXELFORMAT_RGB8888 or some other 32-bit format. Any help appreciated on clarifying this. My code is below.

#include "SDL2/SDL.h"
#include <stdio.h>

SDL_Window* window;

int main(int argc, char* args[]) {

    SDL_Init(SDL_INIT_VIDEO);

    window = SDL_CreateWindow("TUTOR",
            SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
            0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);

    Uint32 global_pixel_format = SDL_GetWindowPixelFormat(window);
    const char* temp = SDL_GetPixelFormatName(global_pixel_format);
    printf(" SDL_Window created with pixel format %s\n", temp);

    SDL_Quit();

    return 0;
}

sentences: JMonkey scrolling 3D text I need to make a scrolling 3D text, which is not a gui. I have a 3d box display over which I should render a long scrolling text. I can render and move text, but how do I cut/make invisible the part that goes out of the display area?

sentences:
Converting back and forth between spherical and cartesian coordinates in glsl I have checked all the possible resources and I still don't know why my code is not working.

This code should convert uv (texture coordinates) or cartesian into spherical and back. But my code still can't convert the values back properly, even though it is the same as under that link:
http://mathworld.wolfram.com/SphericalCoordinates.html

#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;

const float PI = 3.14159265359;

vec2 toUV(vec3 n)
{
    vec2 uv;

    uv.x = atan(n.y, n.x);
    //uv.x = atan(n.y / n.x);   // Doesn't work either
    uv.y = acos(n.z);

    return uv;
}

// Uv range: [0, 1]
vec3 toSpherical(vec2 uv)
{
    float theta = 2.0 * PI * uv.x;
    float phi = PI * uv.y;

    vec3 n;
    n.x = cos(theta) * sin(phi);
    n.y = sin(theta) * sin(phi);
    n.z = cos(phi);

    // x, y, z range: [-1.0, 1.0]
    return n;
}

void main( void ) {
    // Range from 0 to 1
    vec2 p = gl_FragCoord.xy / resolution.xy;

    vec3 color = vec3(0.0);

    // The point of a sphere with radius 1.0
    vec3 n = toSpherical(p);

    // The cartesian coord
    vec2 uv = toUV(n);

    color = vec3(uv, 0.0);

    // uv should be p by now
    //color = vec3(p, 0.0);

    // Showing the color
    gl_FragColor = vec4( color, 1.0 );

}

To view this code, you can just paste everything into this site's editor http://www.glslsandbox.com/e

Any help would be appreciated.

sentences:
Creating animation by script with animation assets I'm very new to Unity (not to C# and programming as well) but I managed to achieve some goals very fast. But some concepts I still don't get in their full aspects.

I'm developing a small multiplayer game called skeet. It's about clay pigeon shooting. I have a static 2D scene, with 3 assets: A gun, a bullet and a pigeon. These sprites I'm able to deploy on the scene by an event driven script and I'm able to react on collisions between objects.

I reached the point I have to animate the pigeon and the bullets. First I have to animate the pigeon moving from border to border in a random direction on a random height. Second if a player presses its key to shoot its bullet must be animated from the bottom of the screen straight upwards.

My current idea is to create some animations as assets and to assign them to the sprites I'm creating dynamically. But I don't know what I need in the Unity GUI and in the script.

I'm not looking for a ready to run solution but an ordered list of concepts and advices I have to take a look into.

Edit:

The bullets and pigeons are created dynamically and should be destroyed after the animation finished (by reaching any border of the screen or a collision). So I need to create an animation with assignable position parameters.

sentences:
How do I calculate the visible area of a big isometric map? I have a simple isometric map of 128px x 128px, tile in a 2D field [xxxx][xxxx] I have a problem with my calculating. I need to get startx:[0], startY[0] and endX[20], endY[10], if I know the screen width and height, and the camera offset like this:

(not effective for big maps)

This is my current code:

starti = (-camera.xOffset - tileWidth) / 64;
int endi = (-camera.xOffset + camera.width + tileWidth) / 64;
int startj = (-camera.yOffset - tileHeight) / 64;
int endj = (-camera.yOffset + camera.height + tileHeight) / 64;

Point start = twoDToIso(new Point(startx,starty));
Point end = twoDToIso(new Point(endx, endy));
for (int i = start.X; i < end.X; i++)
{
    for (int j = start.Y; j < end.Y; j++)
    {

This does not work; it will create something like this:

It does something, but when I move and my offset is changed, it does not work at all. How do I calculate the visible lines on a big isometric map?

sentences:
Provide A Scrolling "Camera" View Over A 2D Game Map I'm in the process of attempting to create a 2D MMO type game with Kryonet and some basic sprites, mostly for my own learning. I have the back end set up great  (By my standards) and I'm moving on to actually getting some things drawn onto the map.

I cannot for the life of me figure out a solid way to have a "Camera" follow a player around a large area. The view pane for the game is 640 x 480 pixels, and each tile is 32x32 pixels (Thats 20 tiles wide and 15 high for the viewpane)

I have tried a couple things to do this, but they did not seem to work out so well. I had a JScrollPane with 9 "Viewpane"-sized canvases in it, and tried to have the JScrollPane move in accordance with the player. The issue came when I reached the end of the JScrollPane. I tried to "Flip" canvases, sending the canvas currrently drawing the player to the middle of the 9 and load the corresponding maps onto the other ones. It was slow and worked poorly.

I'm looking for any advice or previous experience with this; any ideas?

Thank you!

Edit and Clarification:
I did not mean to mention Kryonet, I was merely providing peripheral information in case there was something that would help which I could not foresee.

Instead of having an array of 9 canvases, why not just have one large canvas loading a large map every once in a while? I'm willing to have "load times" where as with the canvas array I would have none (in theory) to give the user a smooth experience.

I could just change the size and location of the map with a modified setBounds() call on the canvas in a layered pane (layered because I have hidden swing items, like inventories  and stuff)

I'll try it out and post here how it goes for people asking the same question.

sentences:
How to disconnect all signals of an emitter? This a follow-up question of this one
I want to disconnect multiple signals before using queue_free().
In docs we have:
void disconnect ( String signal, Object target, String method )

Is it possible to disconnect all signals of an emitter without using the names of the signals or methods involved?

sentences: What does NavMesh.AllAreas specify in Unity? I'm trying to calculate the path to a point in my game using NavMesh.CalculatePath, it takes an argument NavMesh.AllAreas. I read the Unity Manual and couldn't clearly understand what it meant.

sentences:
16bit triangle lists vs 32bit triangle strips When drawing geometry we may use indexed drawing, where we pass index of the vertex we want to draw in array. In this case we need to pick a topology for our geometry and the type of indices.
Popular topologies are triangle lists, where we have to specify 3 indices for each triangle, and triangle strips, where each new triangle shares its first 2 vertices with last 2 vertices of previous triangle.
As for index types - we have 16 bit indices, which allow for ~65k vertices per model, and 32 bit indices, ~4B vertices.
My GPU (1050ti) fetches 32 bit indices at half the rate of 16 bit indices, where 16 bit indices triangle list topology gets it at its maximum throughput, but so do 32bit triangle strips. As my GPU isn't that old, I expect many GPUs to be quite alike in this manner.
So, is the inconvinience of having to specify geometry in strips worse than having a limit to 65k vertices per model?

sentences:
How do you decide on the size of a tech tree? Is there any established metric with which a game designer might decide the best size for a tech tree?

In this case the game is a single player 4X game (thank you, Peter, for that term). I wanted to incorporate an appropriate length and breadth of tech tree as a basic design goal.

For instance, is there data on player reactions to tree size vs game scope or game length? Or even a reasonably established rule of thumb?

sentences:
Custom Keyboard run by Arduino not working in XNA I'm trying to make a stenotype-teaching game using the stenoboard as input.  The Stenoboard emulates an NKRO keyboard, using this code: https://github.com/caru/StenoFW/blob/master/StenoFW.ino, with an Arduino Leonardo as the controller.

My XNA code is unremarkable, and works fine with other keyboards.  The Stenoboard works fine with other programs.  However, when plugged into XNA, it registers nothing unless all keys are mashed repeatedly, in which case it will register one or two random keys for a single frame.

This issue also exists in Monogame and across multiple machines running both Windows 7 and 8.  The Stenoboard presents itself as a PS/2 keyboard on my W8 laptop, but as a USB keyboard on my W7 desktop.  I'm fairly certain XNA's keyboard library just doesn't like the signals the 'board is sending.

My question is: A) does anyone know a way to fix this, and if not, B) is there another way to harvest keyboard events from Windows and feed them into XNA?  I'm currently thinking of adding a Windows Form to the project and using it to catch Keydown and Keyup events and mail them to the game, but since the form would have to be in focus at all times, that seems like a recipe for user error.

sentences: Does Unity own my game? I made my first game in unity, and I was wondering if I can sell it without owing anything to unity?

sentences: How difficult is it to implement 3D models in a 2D game? Creating a full blown 3D game requires a lot more math for physics, but what if I just want to mix 3D models in a 2D game, such as in the New Super Mario Brothers? Would I be able to get the looks of 3D models with the ease of making a 2D game?

sentences:
Best approach to implement server authority in client/server game I am currently trying to create a 2D game with a client/server model, and was wondering how I could implement the server's authority over the client (when client moves, prediction happens, and server checks if the prediction was well done, and if not, client reverts to older state).

Should I create a State class where the local player's state is saved at every tick in a buffer, for revert being possible ? Or should I wait for the server to respond and should the client be a simple renderer ?

How could I make sure that client and server are synchronized ?

I use pure java Socket class as well as DatagramSockets.

sentences:
Why am I having these weird framerate issues with OpenGL on Windows? I'm using OpenGL on windows (have been for a while now), and I've come across a strange issue.

Once every so often, the rate at which frames are presented on the screen drops to roughly 10 fps. However, my framerate counter stays at the usual framerate (2000fps in the menu, 300fps in game).

My framerate counter is based on the time between draw calls, so the graphics card is definitly rendering 2000 frames a second.

What is the problem? How can I fix it?

EDIT: I forgot to mention, this only happens when running in windowed mode.

sentences:
Formula for three competing heroes, each has one they can beat and one they're beaten by I am trying to design a game for a project I have, The main idea is:

3 Types of heroes
3 Stats per hero

There are no levels involved so the differences must be located on stats.

Fight logic - The logic of fight is that type1hero has good chances winning type2hero, type2hero has good chances type3hero and type3hero has good chances winning type1hero.

For over a week I am trying to find a stats based formula that will allow me to fix this but I can't, I was meddling with numbers yesterday and it was decent but I can't extract the formula out of it.

Could you please guide me or give me hints on how should I start creating formulas on a Non lvl game that fulfills the fight logic?

sentences:
How to draw portion of a sprite in libGDX Let's say i have a sprite like this:

and i want to draw the lower portion of it, only the yellow color..
Initially the sprite has dimensions 10x10, i want it to be drawn 10x3

Do i have to redimension both the sprite and the texture region to mantain proportion between the two?

sentences:
More Efficient Data Structure for Large Layered Tile Map It seems like the popular method is to break the map up into regions and load them as needed, my problem is that in my game there are many AI entities other than the player out performing actions in virtually all the regions of the map. Let's just say I have a 5000x5000 map, when I use a 2D array of byte's to render it my game uses around 17 MB of memory, as soon as I change that data structure to a my own defined MapCell class (which only contains a single field: byte terrain) my game's memory consumption rockets up to 400+ MB. I plan on adding layering, so an array of byte's won't cut it and I figure I'd need to add a List of some sort to the MapCell class to provide objects in the layers. I'm only rendering tiles that are on screen, but I need the rest of the map to be represented in memory since it is constantly used in Update.

So my question is, how can I reduce the memory consumption of my map while still maintaining the above requirements? Thank you for your time!

Here's a few snippets my C# code in XNA4:

public static void LoadMapData()
    {
        // Test map generations
        int xSize = 5000;
        int ySize = 5000;
        MapCell[,] map = new MapCell[xSize,ySize];
        //byte[,] map = new byte[xSize, ySize];

        Terrain[] terrains = new Terrain[4];
        terrains[0] = grass;
        terrains[1] = dirt;
        terrains[2] = rock;
        terrains[3] = water;

        Random random = new Random();

        for(int x = 0; x < xSize; x++)
        {
            for(int y = 0; y < ySize; y++)
            {
                //map[x,y] = new MapCell(terrains[random.Next(4)]);
                map[x,y] = new MapCell((byte)random.Next(4));
                //map[x, y] = (byte)random.Next(4);
            }
        }

        testMap = new TileMap(map, xSize, ySize);
        // End test map setup

        currentMap = testMap;
    }

public class MapCell
{
    //public TerrainType terrain;
    public byte terrain;

    public MapCell(byte itsTerrain)
    {
        terrain = itsTerrain;
    }

    // the type of terrain this cell is treated as
    /*public Terrain terrain { get; set; }

    public MapCell(Terrain itsTerrain)
    {
        terrain = itsTerrain;
    }*/
}

sentences:
How do history generation algorithms work? I heard of the game Dwarf Fortress, but only now one of the people I follow on Youtube made a commentary on it... I was more than surprised when I noticed how Dwarf Fortress actually generates a history for the world!

Now, how do these algorithms work? What do they usually take as input, except the length of the simulation? How specific can they be?

And more importantly; can they be made in Javascript, or is Javascript too slow? (I guess this depends on the depth of the simulation, but take Dwarf Fortress as an example.)

sentences:
New clients don't see objects spawned before they connect I'm making a game with UNet where the server must create some objects when he connects to the game, and all clients play with these objects that the server has created.

A server connects to the game
In his start method he calls a function CmdbuildEverything to spawn some objects to the game.
A local player connects to the game. The local player should be able to see the objects that the server player has created.

The code:

public class GameScript : NetworkBehaviour {
    void Start() {
        if(base.isServer)
            CmdbuildEverything();
    }
    [Command]
    void CmdbuildEverything() {
        GameObject ob1 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(0, 0, 1), Quaternion.identity);
        GameObject ob2 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(0, 1, 0), Quaternion.identity);
        GameObject ob3 = (GameObject)Instantiate(Resources.Load("Temple"), new Vector3(1, 0, 0), Quaternion.identity);
        NetworkServer.Spawn(ob1);
        NetworkServer.Spawn(ob2);
        NetworkServer.Spawn(ob3);
    }
}

The problem is that the objects are created only on the server player and don't appear on the clients payers.

How can I solve that?

sentences:
How can I implement the ability to 'cut' sprites into arbitrary shapes? I want to create a game where you have scissors that cut a sprite in a shape that you create by dragging your finger on the screen.

My problem is that I can't figure out how can I cut my sprite in the specific shape that the user creates with their finger.

So far the only solution that I found searching the web is that I'll need to create my own shader that lets me make a specific part of a texture transparent, but don't understand how I can apply that to my scenario?

sentences:
Design of networked Asteroids I am looking for some advice on what would be a good way for users to play Asteroids over the network.

Its my first game and so far I have it working in 2D using polygons across a scrolling world in single player mode. Zoom in and out is also supported. Its not bad. I really want to develop it as a networked game as a learning vehicle. However, given all the work involved I want it to be a game people will enjoy playing.

My plan is that each player gets their own ship, exists in the same world and can shoot the same asteroids. The world can be big enough for ships to avoid each other. I want the players to also be able to attack other players ships.

Normally when playing in scrolling mode your ship stays in the middle of the viewport. This will limit the distance apart that ships can be if you are to see/shoot your opponent. Will this be a problem for the players or do these 2D multi player shooting games work well?

sentences:
Inventory implementation in Java RPG In my game (simple RPG with Java) there will be an abstract class Creature.

Critter, Beast, Vampire... will inherit from Creature. But not ALL classes that inherit from Creature will have an inventory.

Should I

a) make another abstract class such as CreatureWithInventory and inherit from it?

or

b) make an interface such as Inventory and make stuff as (Vampire implements Inventory)?

Is there a reason to prefer one over the other? Any considerable trade-offs?

Should Inventory itself be a class and let some Creatures have a field for it? If so, how would I test if Creature foo has Inventory? Is that even possible?

sentences:
Google Play exclude devices I have a game that I'm developing in Unity.
The game will be released for Android, so I'm working with the Google Play Console.
The thing here is that I don't know how to block (Made not available) some devices with certain properties.
For example, I need to made my game NOT available for tablets and for devices that don't have at least 1 GB of RAM.
Does anyone know how can I do this?

sentences:
Problem with making camera follow player in Javascript So I'm testing a few things in Javascript and something I was testing was making the camera follow the player. When I move the player, instead of the dots going away from the player, they follow the player and it looks very strange.

Here is the code: https://codepen.io/anon/pen/wLgEPO?editors=0010

Move the player using the arrow keys.

Thanks.

sentences:
Scale sprite between two points I need to start a sprite at a scale .6 (scale1) at a y position 40 (yPos1). Knowing the end y position 560 (yPos2) and the end scale 1 (scale2):

How do I calculate the scale at various y positions between yPos1 and yPos2?

sentences:
In Unity, how do I correctly implement the singleton pattern? I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating and validating a singleton.

Is there a correct, or rather, preferred approach to this?

The two main examples I have encountered are:

First

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                _instance = GameObject.FindObjectOfType<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        DontDestroyOnLoad(gameObject);
    }
}

Second

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                instance = new GameObject("Game Manager");
                instance.AddComponent<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        _instance = this;
    }
}

The main difference I can see between the two is:

The first approach will attempt to navigate the game object stack to find an instance of the GameManager which even though this only happens (or should only happen) once seems like it could be very unoptimised as scenes grow in size during development.

Also, the first approach marks the object to not be deleted when the application changes scene, which ensures that the object is persisted between scenes. The second approach doesn't appear to adhere to this.

The second approach seems odd as in the case where the instance is null in the getter, it will create a new GameObject and assign a GameManger component to it. However, this cannot run without first having this GameManager component already attached to an object in the scene, so this is causing me some confusion.

Are there any other approaches that would be recommended, or a hybrid of the two above? There are plenty of videos and tutorials regarding singletons but they all differ so much it is hard to drawn any comparisons between the two and thus, a conclusion as to which one is the best/preferred approach.

sentences:
OpenGL streaming from multiple windows I am using GLUT library for my research/game.

In my game I have 25 windows created using glutCreateWindow(title), and each of them have their own display callback registered using glutDisplayFunc(Draw).

I am trying to stream the screen of each of the 25 windows on my computer
to another client which will do some processing with all the screen capture of the 25 windows.

Currently I am capturing the screen of each of the 25 windows with:

glReadPixels(0,0,Xres,Yres,GL_RGB,GL_UNSIGNED_BYTE,pixels);

Just doing the call to glReadPixels for each of the 25 windows slows my fps down to 7 fps.

However I require the fps to be at least 25 FPS, is there any way I can improve the fps?

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:
Can't join to room through Unity's Matchmaking system on the Internet It works perfectly when I try to connect locally from my editor to my running build.

But after I start the server on my Android, and try to connect to it from my editor, it time outs:

As you can see, it finds the match, and then tries to join, but it can't.

If I try to do it from a build, the log says the following:

Log: cannot connect after {10} attempt address {::ffff:127.0.0.1:7777}
ClientDisconnected due to error: Timeout

Why does it tries localhost, when I obviously use the Matchmaking system?

When I tried it on 2 Android devices, the same happened.

Ps.: I know that it's going to be depracated, I just want to use it during a short term gift.

Thanks in advance!

Starting Matchmaker in a Start:

networkManager.StartMatchMaker();
networkManager.matchMaker.baseUri = new System.Uri("https://eu1-mm.unet.unity3d.com");

When the MatchScene ("Battle") is loaded:

if (this.isHost)
{
    networkManager.StartHost();
}
else
{
    networkManager.StartClient();
}

And the Play button's handle: (still same component)

public void Play()
{
    networkManager.matchMaker.ListMatches(0, 1, string.Empty, true, 0, 0, OnMatchList);
}

void OnMatchList(bool success, string extendedInfo, List<MatchInfoSnapshot> matches)
{
    if (matches.Count == 0)
    {
        networkManager.matchMaker.CreateMatch("match", 2, true, string.Empty, string.Empty, string.Empty, 0, 0, OnMatchCreate);
    }
    else
    {
        networkManager.matchMaker.JoinMatch(matches[0].networkId, string.Empty, string.Empty, string.Empty, 0, 0, OnMatchJoined);
    }
}

void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
{
    this.isHost = true;
    this.networkId = matchInfo.networkId;
    SceneManager.LoadScene("Battle");
}

void OnMatchJoined(bool success, string extendedInfo, MatchInfo matchInfo)
{
    SceneManager.LoadScene("Battle");
}

sentences:
Load large .obj file I am working with the 3D model and I am using the Scene Kit for rendering and Model I/O for loading the obj file. It works perfectly fine for the small size of obj. But now I have 250MB of file and when It starts loading it takes too much memory and lower end devices are crashing.

How can I read this obj files that is used by the scene kit or any alternate way to read this file? Below is the line of code I used for reading obj file:

MDLAsset *asset = [[MDLAsset alloc]  initWithURL:mapURL];
MDLMesh *object = (MDLMesh*)[asset objectAtIndex:0];

Is there any alternative way to load large obj files?

sentences:
How can I create a custom MeshCollider for my object, or fix my collision problem? I have a problem with collisions in Unity and I am unsure how to fix it.

I have an octree with a depth of 2, and each node in the tree has a Bounds object attached to it for collisions. I am trying to see which nodes have been intersected by a specific object however it is giving me unexpected results.

The colliding object is a flat triangle that I have constructed myself which is acting as a cutting plane and I have attached a MeshCollider component to the GameObject.

When there is an intersection with a leaf node in the octree, the node is outlined in yellow and if there is no intersection, it is outlined in purple.

Before rotation

After rotation
In this image I rotated the triangle a small amount on the Y axis and apparently Unity found a collision even though the objects are not even touching at all.

I am drawing the octree nodes using Gizmos.DrawWireCube, providing the center and size of the cube which are used to create the Bounds object of the node. Due to this it seems that the Bounds object for the nodes are correct, however the collider for the triangle may be incorrect.

When I test this with another 3D object such as a cube, it works perfectly, however not with the object I need it to work with. How can I fix this issue?

Collision checking code:

       public bool intersects(Bounds otherBounds)
        {
//bounds refers to the node's Bounds object
//otherBounds is the one I'm checking against, in this case the triangle's bounds from the MeshCollider
            if (otherBounds.Intersects(bounds))
            {
                return true;
            }
            return false;
        }

Octree traversal:

 if (node.intersects(triangleCollider.bounds))
        {

            if (node.isLeaf())
            {
                node.colour = Color.yellow;
            }

            if (node.hasChildren)
            {
                for (int i = 0; i < node.children.Length; i++)
                {
                    findIntersections(node.children[i]);
                }
            }
        }

It seems that perhaps a quad is being wrapped around the triangle as can be seen in the image below. This image has a triangle which is intersecting the top half of the octree, however the top left octant should have no collision.

How can I create a custom MeshCollider which I can specify the vertices manually?

See accepted answer for solution

int cutterMask = 1 << 9;
Collider[] intersectedColliders = Physics.OverlapBox(node.bounds.center, node.bounds.extents, Quaternion.identity, cutterMask, QueryTriggerInteraction.UseGlobal);

sentences:
Is it possible to mod a GameMaker game? I been google searching on how to mod Game Maker games (Hyper-Light-Drifter to be more specific) but so far everyone says it's impossible to mod the files. The reason I want to do this is I want to learn to program by modding first and seeing examples that is already made, I also really like this game.

If there is a more better place/website to ask this question please tell me.

sentences: How to 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 do games using physic engines for 2d games handle platform corners? I have seen games like latest "2'5D" sonics that handle collision detection at platform corners pretty well. The problem I'm having is that my game uses an ellipsoid as my player's body to let it move on slopes, etc... But when it gets close to the end of a platform (which has a rectangular collider) the collision is not correct because the player collider is not rectangular too.

How do they do collision on the edges to get an smooth movement and don't seem like the player is falling through the edge?.

sentences:
Best resources for Canvas Html 5 development I am at a competition at work for who can make the best canvas game.  Theme is a top down shooter... Winner gets dinner for free.

Anyways I have been looking around looking for some good resources on game deving on the canvas.  Any body got any good ones?

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:
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:
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:
Updating RigidBody rotation and velocity only updates it's rotation I'm currently making spaceship controller script. Control is simple, W/S to move forward/backward, A/D/ to rotate ship by Y Axis(yaw).

Spaceship is RigidBody node and has CollisionShape as children.

Here's the code for move forward/backward:

export var speed = 1
export var max_speed = 10
var current_speed = 0

export var key_acceleration = KEY_W
export var key_deceleration = KEY_S

func process_movement(delta):
    if Input.is_key_pressed(key_acceleration):
        current_speed -= speed * delta
    elif Input.is_key_pressed(key_deceleration):
        current_speed += speed * delta

    current_speed = clamp(current_speed, -max_speed, max_speed)

    linear_velocity = Vector3(0, 0, current_speed)

I need to limit it's maximum speed, so I updated velocity directly, not using something like add_force.

Next is rotating code:

export var yawing_speed = 0.01
export var max_yawing_speed = 0.02
export var yaw_stop_threshold = 0.001
var current_yaw = 0

func process_yaw(delta):
    if Input.is_key_pressed(key_yaw_left):
        current_yaw += yawing_speed * delta
    elif Input.is_key_pressed(key_yaw_right):
        current_yaw += -yawing_speed * delta
    else:
        if current_yaw > 0:
            current_yaw -= yawing_speed * delta

            if current_yaw < yaw_stop_threshold:
                current_yaw = 0
        elif current_yaw < 0:
            current_yaw += yawing_speed * delta

            if current_yaw > yaw_stop_threshold:
                current_yaw = 0

    current_yaw = clamp(current_yaw, -max_yawing_speed, max_yawing_speed)
    rotation.y += current_yaw

In this code, I updated rotation.y directly. Each of this function works if run separately, however run these together, it only changed rotation, not velocity.

func _physics_process(delta):
    process_movement(delta)
    process_yaw(delta)

Change order of process_movement and process_yaw doesn't change anything. If I just run one of process_movement and process_yaw, it works perfectly.

Why my rigidbody ignored velocity and only rotated? Any advice will very appreciate it.

sentences:
Stencil buffer VS conditional discard in fragment shader I have a continuous height-mapped mesh to represent landscape. I also have 1 to let's say 10 wells on this landscape represented by additional models. What I want to achieve is to create an illusion of an actual hole in landscape at the place where the well sits.

I see the solution in two ways:

Draw holes to stencil buffer an then use it in fragment shader to discard landscape fragments.
Send an array of uniforms (vec2) and then conditionally discard fragments if they are near those hole-points.

The question is what way should I prefer if I'm good with rectangular holes and want to get best performance?

sentences:
Implementing a SceneManager using OpenFL I'm trying to implement a basic SceneManager using OpenFL and Haxe. I don't have a lot of experience using OpenFL and Haxe so I have a few problems.

Here is how I designed the SceneManager class:

package;

import openfl.display.Sprite;
import openfl.Lib;

class SceneManager extends Sprite
{
    private var currentScene: ...;

    public function new(rootScene: ...)
    {
        super();

        currentScene = rootScene;
        Lib.current.addChild(currentScene);
    }

    public function changeScene(newScene: ...): Void
    {
        Lib.current.removeChild(currentScene);

        currentScene = newScene;
        Lib.current.addChild(SceneTwo);
    }
}

The "..." should be replaced with a general "class" type that can hold any of my scenes.

If anyone can help me solve this I would be really grateful.

sentences:
Canvas not scaling to screen size So I have a very simple scene set up with just a camera, a game object called TestGrid with a grid script, and then a canvas. I have a TextMeshPro prefab that I instantiate to fill the 10 x 20 grid with cells.
If I build and run the game, I see all the cells on my screen. However, in the editor play view, I can only see as many grid cell as would fit on startup. Making the game view smaller or larger will scale the ones already there, but everything that didn't fit initially is "clipped" out. The "canvas" is in the bottom left corner of the "grid"

I'll share my code as well:
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Diagnostics;

public class TestGrid : MonoBehaviour {
  private float _cellSize = 50.0f;

  [SerializeField]
  private float _width = 0.0f;

  [SerializeField]
  private float _height = 0.0f;

  [SerializeField] private TextMeshProUGUI labelPrefab;

  // Start is called before the first frame update
  private void Start() {
    if (labelPrefab == null) {
      Debug.LogError("You must set a label prefab.");
      return;
    }

    GameObject canvas = GameObject.Find("labelCanvas");
    if (canvas == null) {
      Debug.Log("Unable to find canvas");
      return;
    }

    // This is just a 2D array of ints.
    Grid grid = new Grid((int)_width, (int)_height);
    var canvasRect = canvas.GetComponent<RectTransform>().rect;
    _cellSize = Math.Min((canvasRect.width / _width), (canvasRect.height / _height));

    for (int x = 0; x < grid.Data.GetLength(0); ++x) {
      for (int y = 0; y < grid.Data.GetLength(1); ++y) {
        SpawnLabel(new Vector3(x, y, 0), canvas, grid.Data[x, y].ToString());

        // TODO: Replace this with LineRenderer
        Debug.DrawLine(GetWorldPosition(new Vector3(x, y)), GetWorldPosition(new Vector3(x, y + 1)), Color.white, 100f);
        Debug.DrawLine(GetWorldPosition(new Vector3(x, y)), GetWorldPosition(new Vector3(x + 1, y)), Color.white, 100f);
      }
      Debug.DrawLine(GetWorldPosition(new Vector3(0f, _height)), GetWorldPosition(new Vector3(_width, _height)), Color.white, 100f);
      Debug.DrawLine(GetWorldPosition(new Vector3(_width, 0f)), GetWorldPosition(new Vector3(_width, _height)), Color.white, 100f);
    }
  }

  void Update() {
    // NYI
  }

  private void SpawnLabel(Vector3 localPos, GameObject canvas, string text) {
    float x = localPos.x;
    float y = localPos.y;
    var world = GetWorldPosition(new Vector3(x, y, 0)) + new Vector3(_cellSize, _cellSize) * .5f;
    var label = Instantiate(labelPrefab,
      world,
      Quaternion.identity, canvas.transform);
    label.text = text;
    label.fontSize = 100;
    label.autoSizeTextContainer = true;
  }

  private Vector3 GetWorldPosition(Vector3 local) {
    return local * _cellSize;
  }

}

Additional images of environment:

I'm actually not too sure what is going on here, so here is everything I know:

I'm parenting my TextMeshPro prefab transform to the canvas transform, so that it scales properly
My Canvas Scalar is set to reference resolution of 2560 x 1440, with a RPPU of 108
Canvas Scalar is also set to Scale With Screen Size
Canvas Screen Space is set to Overlay

I've also read the following links with no luck:
https://stackoverflow.com/questions/32347009/unity-canvas-does-not-fill-screen
https://answers.unity.com/questions/943190/ui-panel-not-covering-whole-screen.html
https://answers.unity.com/questions/1331722/ui-scaling-issues.html
Expected Results:
No matter what the screen size is, I should see my full 10 x 20 grid of "cells" (in play view they're just 0's).
Question:
If my canvas is supposed to scale with screen size, why is it that when I choose a cell size calculated from the canvas size, that it thinks the canvas is 2560 x 1440 when the screen size is clearly much smaller than that?
Do I need to calculate with a different value? Must I dynamically resize everything I draw within the canvas? What's going on here?

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:
SDL2, OpenGL, Nvidia laptop screen tearing EDIT 2017-05-14 dvb. Issue still active to this very day, see geforce forum link in main question.

Note 3: "Stoltverd" has posted a "fix guide" on geforce forum. It has workarounds for non-OpenGL games.

https://forums.geforce.com/default/topic/1008527/geforce-mobile-gpus/-guide-diagonal-screen-tearing-problems-with-optimus-nvidias-control-panel-not-working-like-it-should-need-a-fix-get-in-here/

Note 4: My workaround for OpenGL games: use HDMI output to external monitor. (In my case, the only game I care about is my own, and I use a big cheap HDMI TV for demo.)

EDIT 2016-03-06.

Note 1: Apparently this is a known issue with Nvidia.
If you've found here due to same problem, please stoke the collective "please fix it" by filing a "question" at https://nvidia.custhelp.com/app/ask.

Note 2: Doesn't happen on external monitor. Also doesn't happen on internal display if external monitor is mirroring. (Surprise.)

I'm developing my game directly in C++, OpenGL, and SDL2.

On an Alienware 15 R2 laptop with Nvidia GTX 965M, I get screen tearing in a curious diagonal line like shown below. It goes across the window top left to bottom right.

The image below is taken during a screen fade-in, so shows just a brightness line. But it happens between any two different frames.

If my window is full screen, the line goes top-left to bottom-right of the whole screen.

Same code runs fine (no tearing) on: All macs, same laptop on Intel integrated GPU, desktop PC with Nvidia 730.

Same laptop looks fine with other games, Chrome+Shadertoy, &c.

Main loop looks something like:

// setup code
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetSwapInterval(1);
    flags = SDL_WINDOW_OPENGL;
    SDL_CreateWindow(... ,flags);
// main loop
while(1) {
    this->checkEvents();
    SDL_GL_SwapWindow(this->mainWindow);
    this->doGlDrawing();
}

Grepping forums, I've seen reports of some OpenGL games showing this on Alienware & other Dell laptops.

All suggestions welcome! Thanks.

Edit 2016-02-20, some links to similar user-side reports:
  https://forums.geforce.com/default/topic/903422/geforce-mobile-gpus/diagonal-screen-tearing-issues-on-gtx-860m-870m-960m-965m-970m-980m-/

http://en.community.dell.com/owners-club/alienware/f/3746/t/19658623

https://www.reddit.com/r/Alienware/comments/427ltv/anyone_have_diagonal_screen_tearing_when_playing/

sentences:
An API independent way of managing video memory? I'm developing a game. The game architecture is very modular. I have a "Graphics Engine", which uses either a Direct3D or OpenGL renderer. However the user does not have access to the renderers directly. Instead the "Graphics Engine" class is used, which uses a renderer interface.

I also have a resource management system. As for now, the renderers are respoinsible for allocating and releasing video memory. That couples my design in a bad way, since the "Graphics Engine" has undesirable logic for transferring resources between the RAM and the VideoRam through sending signals to the "Renderer". I want the resource management system to be responsible for allocating video memory.

I want to decouple the "Renderer" and "Graphics Engine" classes as much as possible, and make the renderer only responsible for rendering. Is there a way to obtain a universal pointer to a Video RAM buffer, and use it to render with both renderers?

My problem is basically that I can only obtain OpenGL or Direct3D handles, which can be used only from the relevant API. And the "Graphics Engine" should not know which renderer it uses.

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:
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:
Polygons vs sprites rendering performance in Unity for windows phone 8 I'm currently building a windows phone 8 game with unity, having 111 (no more no less) sprites being updated each frames. I have a strong overhead in the profiler (70% to 90% minimum) I tried the following to get higher frame rate,

I'm running it with minimum quality settings,
I tried disabling and enabling V-Sync

Finally I managedto get 60Fps, but I still have large overhead. I believe I should have more than 60Fps for such few amount. Moreover, I still have to implement the game logic over this so I'd like some room in my FPS to be able to work.

I was wondering if it would be better in terms of performance to use polygons instead of sprites? As sprites are quite new in Unity, (that would give me around 222 triangles).

Did someone tried to check the performance differences between sprites and actual mesh renderes in Unity when it comes to phones? If so what could be the best option in that case?

FYI : I'm using the Windows Phone 8 emulator on Visual studio, I have a compliant computer for that so it should normally reflect the behavior of a real phone (expecting some differences but still...)

EDIT : To clarify my question i wonder what is the most efficient in windows phone 8 : Sprites or Mesh renderers?

sentences:
Random undirected graph generation I would like to generate graphs randomly, like this:

I have found that Box2d maybe can do it to me. But I do not know, how to use it, so how can I generate bobies after world initialization?

sentences: libgdx - handling battery warning I want to pause my game when the battery warning on Android pops up. How do I do this? I have a method that pauses the game but how do I call it when the battery warning pops up?

sentences:
Handling of persistent key presses in an ECS I'm currently in the planning phase of a game. The whole thing should be based on the entity-component-system (ECS) pattern. All logic is concentrated inside of the systems, i.e. that the components hold data only. Communication across the systems is performed using asynchronous events.

Using this design, I'm unable to find a clean solution for the simple example task of moving player:
While the input system generates key press events, I'm looking for a way to query the key state, since the player will most likely want to move the player for more than one frame.

There are two possible ways I can think of solving this problem:

Retrigger the key press event every frame
Pass the corresponding systems a reference to the input system

Neither possibility sounds "correct", since they both require the abuse of the design.

Is there a better approach for solving this issue?

sentences:
What's the best way to handle numerous recurring log entries in game loop? I have a custom logging system, use of which is scattered all over the engine and game. The system is linked to a "LogStore" that has an std::vector<string> logs[NUM_LOG_TYPES] - each vector corresponds with it's log type (info, error, debug, etc.). There's one extra std::vector that has "coordinates" to all log entries in the order they were received.

Now, all the logging output is also displayed inside my development console in the game. The game console is handled by HTML-type GUI and therefore requires a new <p> element being added for each log output.

My problem is that the log entries that are generated in the main loop each frame freeze the engine, because they continue to add elements to the in-game console, and if the console or guy generates a warning - that creates an infinite logging loop.

I want to solve it by handling the recurring log entries in an elegant way that lets you know that something is critically wrong, but won't freeze the engine - like displaying the count of errors in the last 60 frames instead of displaying errors themselves. But how do you guys handle this? Does anyone know any nifty tricks to do this?

I understand the question may sound vague, but if someone came across this type of issue I'm sure they would know exactly what's happening.

Example problematic log entries:

OpenGL warnings (I actually do check for errors every frame in many
places)
Really any prints anywhere in the main loop (may be debugging, may
be warnings)

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:
How long does it take to ceate a game? I know that this question depends really very much on plenty factors: 2D-Pong and a MMORPG are two totally different worlds; it also depends on creators' experience, on game quality, on the available technologies, on target platform and so on, but well, I guess we can categorize games and study the average (or maybe focus on real-world examples).

How long, in man-hour, does it take on average to create a:

AAA MMORPG
AAA non-MMO game (like a RTS, an FPS etc, RPG)
Indie game
Game for mobiles
Amateur desktop game

What phases can we split the game creation process in (story designing, writing the engine, creating art, testing ...) and how long would each of these take (for the above categories)?

Examples of real games would be apprecciated!

sentences:
2D Object 'Targeting' / 'Selecting' I'm currently working with C# with the XNA framework.

I'm trying to create a list of objects that are individually target-able after they are created and set in a list and displayed on a tile map.

For example, I have a blank tile map and I cycle through the tiles and randomly set objects (we'll say a box) throughout the map. When I set the box object, I add that new iteration of Box to a Box List.

At this point I have a tile map with a series of randomly placed boxes. Within these boxes I also have randomly picked values for their name, size, color etc. And these values are correctly stored within the box object in its respective index in the List.

My question is how do I go about setting up a method for targeting/selecting a box so that when I click on any given box it's respective data values appear? I'm not worried about graphical representation of the selected object but the retrieval of the objects specific data via a mouse click on its position.

I've set up Events to handle the changing of my game states, does this require the same methodology or something all together different?

Thanks for your time.

sentences:
Is a warning about IAP in freemium games on iOS required? When I launch the successful iOS game "Clash of Clans", right in the beginning I get the following message in an iOS info pop-up:

"Clash of Clans is free to play, but you can speed up your progress with in-app purchases. If desired, purchases can be disabled in the general settings of your device."

What's the reason the developer shows this message right in the beginning? Is there any legal obligation to do so?

sentences:
I try to recreate a plasma gun from halo into my fps game this is my code:
public class WeaponTest : MonoBehaviour
{
    public float weaponHeat;
    public float weaponOverHeat = 100f;
    public bool weaponIsOverHeat;

    // Start is called before the first frame update
    void Start()
    {
        //weaponHeat at the start was 0
        weaponHeat = 0;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetButton("Fire1") && !weaponIsOverHeat)
        {
            if (weaponHeat < weaponOverHeat)
            {
                Weapon_Shoot();
                weaponHeat = IsHeating();
            }
        }
    }

    float IsHeating()
    {
        weaponHeat += Random.Range(5f, 10f);
        return weaponHeat;
    }

    void Weapon_Shoot()
    {
        RaycastHit hit;
        if (Physics.Raycast(playerCam.transform.position, playerCam.transform.forward, out hit, range))
        {
            // code for damaging the enemy
        }
    }
}

the shoot method was function exactly like what is want but I need the cooldown method I already try a few them but it not work exactly like I want. the I idea was went the left mouse was click the weapon heat will increase and when the left mouse was not been click the weapon heat will decrease until it reach 0. I hope you can help me solve this problem

sentences:
C++ timer function acts as if time limit is instantly reached if it is less than 1 second I'm trying to make a Snake clone with C++ and OpenGL/GLUT, but I've been having trouble with programming the timed input. I made a timer class, as you'll see below, to be used for the short time intervals allowed for input and movement. It's function checkTime() is called to start the timer. Then on following calls, it checks if the time limit (represented by the int variable limit) has been reached.

To test it, I set up a simple, looping console program, that displays keyboard input. When working properly, it displays what key is being held precisely at the point when the timer finds the time limit has been reached (it returns "true"). Given a limit of 1 second, it will only display current input every second. If it is given a value below 1 however, like 0.333, it will act as if the time limit has instantly been reached, and will display input instantly whenever a key is pressed. How can I get it to only display the input every 0.333 seconds?

Also - I realize my method of doing things here may not be the best, given the tools I'm using. However, I'm curious why this won't work properly.

#include <iostream>
#include "timer.h"
// Include all files necessary for OpenGL/GLUT here...

using namespace std;

Timer timer;

void update(int value)
{
    if (timer.checkTime())
    {
        if (GetAsyncKeyState(VK_LEFT))
            cout << "You pressed LEFT!" << endl;
        else if (GetAsyncKeyState(VK_RIGHT))
            cout << "You pressed RIGHT!" << endl;
        else if (GetAsyncKeyState(VK_UP))
            cout << "You pressed UP!" << endl;
        else if (GetAsyncKeyState(VK_DOWN))
            cout << "You pressed DOWN!" << endl;
    }

    glutTimerFunc(1000/60, update, 0);
    glutPostRedisplay();
}

timer.h

#pragma once

class Timer
{
public:
    Timer();
    bool            checkTime(int limit = 0.333);
private:
    unsigned long   getElapsed();
    bool            running;
    unsigned long   elapsed;
    unsigned long   start;
};

timer.cpp

#include "timer.h"
#include <ctime>

Timer::Timer()
{
    running = false;
    elapsed = 0.0;
    start = 0.0;
}

bool Timer::checkTime(int limit)
{
    (unsigned long) limit;

    elapsed = getElapsed();

    if (elapsed < limit)
    {
        return false;
    }
    else if (elapsed >= limit)
    {
        running = false;
        return true;
    }
}

unsigned long Timer::getElapsed()
{
    if (! running)
    {
        start = (unsigned long) clock();
        running = true;
        return 0.0;
    }
    else
    {
        return ((unsigned long) clock() - start) / CLOCKS_PER_SEC;
    }
}

sentences: What is a VAO in Opengl? i've just started out with Opengl, and i've got to know what Vertex Buffer Objects are, but i really don't understand what VAOs are. Can someone help me?

sentences:
Random map generation I'm starting/started a 2D tilemap RPG game in Java and I want to implement random map generation. I have a list of different tiles, (dirt/sand/stone/grass/gravel etc) along with water tiles and path tiles, the problem I have is that I have no idea where to start on generating a map randomly.

It would need to have terrain sections (Like a part of it will be sand, part dirt, etc.) Similar to how Minecraft is where you have different biomes and they seamlessly transform into each other. Lastly I would also need to add random paths into this as well going in different directions all over the map.

I'm not asking anyone to write me all the code or anything, just piont me into the right direction please.

tl;dr - Generate a tile map with biomes, paths and make sure the biomes seamlessly go into each other.

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:
How set and count Angle of sprite (turret) object in portrait mode in cocos2d? I am new in cocos2d.I follow Raywenderlich tutorial series.
I wish to set turrets in below of the screen in portrait mode.when user touch that location fire bullet and turret fire position at the touch location. how can i do that.
Below is my image of turret position.

sentences:
How do I implement dynamic objects in a voxel engine? I am writing my own voxel engine, based on cubes of different sizes and properties. In order to store and efficiently use voxels, I implemented Sparse Voxel Octree storage, but I plan to have many dynamic structures in the engine that would change their position in space.

How could that be implemented, in my case? Should I use a separate storage for dynamic objects? It would be more desirable to treat those objects as voxels, too, but how do I move them smoothly?

sentences:
Is it worth having AI opponents step in for disconnected players in an online multiplayer card game I have an online multiplayer card game resembling spades/bridge and I want to implement a system that autoplays when a client disconnects. Right now, there is a client and server. In the new system, there will be an autoplay server sitting between the client and the actual game server.

The client connects to the autoplay server which in turn connects to the game server. If the client disconnects during a match, the autoplay server is activated.

Both servers will reside on the same machine so communication cost should be minimal. Processing cost should be minimal as well as the autoplay will be programmed with limited skills only to keep the match going till the end. The idea is not to break the game flow once a player disconnects. But, I don't see autoplay systems in popular commercial games such as Zynga poker (maybe in this case because a disconnection can be easily be considered as a Check or Fold.) Well, is it really worth it to have an extra layer for autoplay?

Edit: Are there other drawbacks for having an extra layer for autoplay?

sentences:
How to offset a 2D GameObject by a pixel amount? I'm extremely new to game creation.

I'm playing around with creating a 2D Unity game. The scene is setup from the default Unity 5 2D template.  Following a tutorial, I've created a TerrainManager GameObject and Script.  The script instantiates tiles and sets their position using a standard double-loop.

I've found a 2D isometric tile set.
Each tile is visually rendered as rotated around the vertical axis by 45 degrees, creating more of a diamond shape rather than a square.  This requires that every second tile be offset by half the tile width on the x-axis, and half the tile height on the y-axis.

As each tile is of a different height, one can not simply offset the tile on the Y axis by half its height.  Each terrain "layer" is 16px tall in the PNG.  Some PNGs have a single "layer", some have multiple "layers".  (For instance, a single layer water tile is 83px in height, while a dual layer "grass on top of dirt" layer is 99px in height.

As the game object expects the transform.position as a Vector3 in (I assume) game units, I do not know how to compose this using pixel values.

So the question I have is, how do I achieve the 16px y-axis offset of the game object?

I'm more than happy to provide additional details if needed.

sentences:
Instantiate prefab button inside of panel I have a Canvas GameObject with a panel inside of it and a button prefab of the default button.

When I drag the button from my resources folder onto the Canvas in the hierarchy, it places itself where I expect it to, into the panel.

However when I instantiate it like below:

GameObject button = Instantiate(Resources.Load("UI/Dialogue/Button"), new Vector3(0, 0, 0), Quaternion.identity, MyCanvas.transform) as GameObject;

it gets placed into the center of the screen because of the second parameter. However, I can't set it as a child of the parent because that doesn't happen until the last parameter. It also doesn't feel right to figure out the exact Vector3 to plug in so that it looks like its on top of the panel.

Is there a way to instantiate the button onto the panel in code as it works when dragging it from the resources folder onto the Canvas in the hierarchy?

sentences:
In Box2D, what exactly does a fixture represent? In Box2dWeb, when we create a body we attach a fixture to the body object.
We make the shape, friction, restitution and so on by tinkering with the fixture object.

So from this can we conclude that the fixture is what we really need to tinker with to get the body we want, and the body object we create just an abstract entity? Abstract in the sense that by itself, it is invisible in the canvas after we draw and animate the canvas? The body is just the abstract, formless object that becomes physical once we attach the fixture. Is this right to conclude?

sentences: Getting started with Box2D for iOS I just want to run any Box2D "Hello World" or test apps.  I've downloaded the source twice (zip file the first time and via svn the second time), followed the build instructions (do stuff w/ cmake, "make", "make install" etc) and don't know where to go from there.  How do I run the test apps or Hello World apps that come w/ Box2D on my iPhone (or simulator)?

sentences:
Moving along a flat plane with accordance to camera view I'm making a 3D game, and I'm stuck on a little experiment.

I currently have a flat plane with a free camera running around, and a sphere (really, a light approximated as a sphere) that rests above the surface of the plane at, say, 50 units up. I'm trying to move the sphere, and I can do this easily by simply adding to the position in the X and Z direction. However, I got a bit messed up because when I move the camera, pressing the left arrow might move the sphere to the right, because of the coordinates. So I'm trying to move the sphere along the X and Z dependant on where my camera is looking.

For example, if I was looking at it from behind, down on an angle, I expect the sphere to move to the camera's left along the plane, or move down towards the camera, still along the plane.

I have seemed to get left and right working with
a.Position -= Vector3.Cross(((FreeCamera)camera).Forward, ((FreeCamera)camera).Up); but trying to move the sphere using just the camera's forward causes the sphere to move into or out of the plane, depending on the angle of the camera (this makes sense, because the camera's forward may be pointing into the plane).

My question is, how do I move an object left or right along a plane (remaining 50 units above the Y axis) in accordance to the camera's direction? For example, viewing the plane from its left facing towards the center, moving left should make it move towards the top of the plane if viewed from the back or to the camera's local left.

Here's two screenshots showing what I mean:

When viewing the red light from here:

Pressing right should give me this. Notice how the red sphere has moved (disregard the fact the camera angle changed slightly):

sentences:
Is learning OpenGL2.1 today a bad idea? Possible Duplicate:
  Is learning OpenGL 2.1 useless today?

This question was asked around 2 years ago and i have well read the answers to it, but that was 2 years ago, i would like to know if it's a bad idea for me to learn OpenGL2.1 today.

I bought the OpenGL superbible (4th edition) and not the 5th because some user in the ratings said that it was much better and i believed him. But now i'm affraid that was a long time ago.

Thanks for all your feedback!

sentences:
Setting up a low res viewport to stretch in Unity I am working on porting a low-res game over to Unity. In my previous engine, I had the option to set a native resolution (say, 160 x 144), and it would automatically stretch when the player entered fullscreen (with options for whether you wanted to keep the same aspect ratio, or stretch).

I am having trouble figuring out how to set up something similar in Unity. I see that you can play around with resolution settings from Edit > Project Settings > Player. I tried various combinations of Default Is Fullscreen, Default Is Native Resolution, and Default Screen Width and Default Screen Height, but I haven't been able to get it to work.

When I play the scene in the editor, the viewport is still much larger than my desired resolution. And when I Maximize On Play, the FOV is even larger.

I Googled around, but couldn't find an answer that helped.

Any advice?

sentences:
Game engine and data driven design I've heard about data driven design and have been researching about it for a while. So, I've read several articles to get the concepts.

One of the article is Data Driven Design written by Kyle Wilson. As he described, it seems to me that the application code (i.e. the code for controlling resources such as memory, network...) and the game logic code should be separated, and the game logic code should be driven by external data sources. At this point, I can imagine that the developer would write some sort of game editor which accepts external data about in-game objects (such as character information, weapon information, map information...). The scenario design will be scripted by custom language/tool written by programmer to let the game designer create interaction between in game objects. The game designer will either use an existing/custom scripting language to write script for the game, or drag and drop tool to create game world. Example of tool approach I can think of is World Editor, which usually packaged along with Bliizard's games.

However, another article is against the use of Data Driven Design, The Case Against Data Driven Design. The author suggests to not let the game design driven by data, because it would take more time to develop a game, since the game designer has the burden of programming. Instead, there will be a game programmer to program the game freely from the sketch design, and is verified by the game designer after the game programming is finished. He calls this is programmer driven. What I think of this method is similar to the way I used to do: The game logic is the application itself, as apposed to the above idea, the application is the game editor, and the actual game is designed based on the tool.

To me, the first method seems to be more reasonable, since game components can be reused for many projects. With the second method which opposes data driven design, the game code belongs to that game only. This is why I think Warcraft has so many game genres in it, such as the original Warcraft and various custom maps, and one of the most famous: DOTA which actually defines a new genre. For this reason, I heard people call the World Editor is the game engine. Is this true how a game engine should be?

So, after all of this, I just want to verify that is there any flaw in my understanding about these ideas (data driven, programmer drive, scripting etc...)?

sentences:
Great realtime shader tool? I often develop 2D games. I would like to know if there's a program like EvalDraw out there, that makes it easy to quickly make (for example) a square, out of a black quad, and then write some shader code, and see how that shader code modifies the square in realtime.

That would be really great for my future development processes.

Edit:
The shader tool must work with HLSL.

sentences:
OpenGL light calculation I want to add somebasic point lights to my OpenGL application. I read here that I have to caluclate the light in a pre-projection space:

  Lighting can be done in any pre-projection space (e.g., world coordinates or eye coordinates), as long as all the objects and lights are all in that same space.

And here is my problem. My Renderer currently looks something like this:

public void onDrawFrame(GL10 unused)
{
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    Matrix.multiplyMM(camProjection, 0, projection, 0, camera, 0);

    for(int i=0; i < sceneObjects.size(); i++)
    {
        SceneObject object = sceneObjects.get(i);
        object.draw(camProjection);
    }

    // ...
}

As you can see I multiply my projectionMatrix with the viewMatrix and I think that is a good solution because I only have to do this once. To draw I give the PVMatrix to all objects and multiply it with their modelMatrix and then I push the finall MVPMatrix to the shader. This is a problem because I can not calculate the light direction in eye space in the shader because I do not have any pre-projection matrix here. Do I really have to push a MVMatrix to the shader and calculate the normals and so on with it? I think this is really inefficient because I have to do much more matrix multiplications, isn't it? What would you suggest to calculate this efficiently?

sentences:
Libgdx handle screen resolutions I know there are some questions to this topic, but i didnt find a
satisfying answer for my problem yet.

I'm learning to use libgdx right now, and I'm not sure about handling different screen resolutions. I can use Viewports and a Camera of course, to fit the content
to the screen. But - how do i achieve, that my game doesnt appear kind of stretched if a device has a different resolution?

For example: Do you know the game Clash Royale? It feels like this game looks the same on all devices with every different resolution and screen size.
How do they do this?

Thank you.

sentences:
Rotate camera around offset to player position (third person shooter view) I'm trying to rotate my camera 'next to' the player object so that the player is not in the way of the screen-centered reticle. What I am trying to achieve is something like the targetting system of Fortnite, GTA 5 or Red Dead Redemption (or most third-person shooters), where the camera/player are offset slightly so that you can see directly in front of them.
My code so far allows me to rotate the camera about the player (object here) and it follows the player's position. I cannot figure out how to offset it.
public void update(final GameObject object)
    {
        this.newMouseX = Input.getMouseX();
        this.newMouseY = Input.getMouseY();

        final float dx = (float) (this.newMouseX - this.oldMouseX);
        final float dy = (float) (this.newMouseY - this.oldMouseY);

        // Rotate the camera on mouse move
        this.verticalAngle -= dy * this.mouseSensitivity;
        this.horizontalAngle += dx * this.mouseSensitivity;

        // Distances from side view
        final float horizontalDistance = (float) (this.distance * Math.cos(Math.toRadians(this.verticalAngle)));
        final float verticalDistance = (float) (this.distance * Math.sin(Math.toRadians(this.verticalAngle)));

        // Distances from top view
        final float xOffset = (float) (horizontalDistance * Math.sin(Math.toRadians(-this.horizontalAngle)));
        final float zOffset = (float) (horizontalDistance * Math.cos(Math.toRadians(-this.horizontalAngle)));

        this.position.set(object.getPosition().getX() + xOffset, object.getPosition().getY() - verticalDistance + VERT_OFFSET, object.getPosition().getZ() + zOffset);

        this.rotation.set(-this.verticalAngle, this.horizontalAngle, 0);

        this.oldMouseX = this.newMouseX;
        this.oldMouseY = this.newMouseY;
    }

This is the sort of thing I'm trying to achieve:

sentences:
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:
TileMapRenderer in libGDX not drawing anything So I followed the tutorial on the libGDX wiki to draw Tiled maps but it doesn't seem to render anything.

Here's how I setup my OrthographicCamera and load the map:

camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

map = TiledLoader.createMap(Gdx.files.internal("maps/test.tmx"));
atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8);

And here is my render function:

Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

camera.update();
tileMapRenderer.render(camera);

Also I did pack the tile map using the TiledMapPacker.

I'm completely stumped... am I missing anything obvious here?

EDIT:

While debugging I noticed that the TileAtlas seems to be empty, which I guess shouldn't be the case, but I have no idea why it's empty.

sentences:
Marble / Wheel Game Physics - Kinetic vs Static Friction? I've read a bit about the "normal force" modeling of friction here. I gather that it isn't a full picture, but a decent approximation, if it fits the needs of what you are trying to model.

It mentions that there's a static friction and a kinetic friction where the static friction is the amount of force that needs to be overcome before an object will begin moving, and then the kinetic friction specifies how much force you need to apply to keep the object moving.

For the case of a ball rolling or a wheel spinning, I know that a little bit of force will cause it to roll, while applying a lot of force will cause it to "slip" and lose contact / friction with the ground and start spinning.

In this case, is it the static friction that determines how much force you can apply to a wheel or a ball before it starts to slip, and then it's the kinetic friction that determines how it acts when it is slipping?

sentences:
Upgrades in game with leaderboards? I am working on an endless mobile game right now and I'm currently in the designing phase. Most (or all) mobile games especially endless ones now have leaderboards and a player's position in the board is determined by their score. I want to implement a store from which people buy upgrades, new cool stuff that help them gain more score. Will this cause an unfair leaderboards. Should I remove the upgrades and replace them with only customizations in the store like clothes that don't affect the score?

Thanks in advance.

sentences:
How to make counter unity? How do I count how many diamonds my player has collected in my 3d world
What I need to do is to make a script which will update my text ui when the player collides with a diamond but I do not know how as I auto generate the diamonds
How could I go about writing a script that will update the text score
What I tried so far, but I'm not sure where to place it. (taken from comment)
void OnTriggerEnter(Collider other) {
   if (other.CompareTag("Diamind")) {
      Debug.Log("Picking up...");
      GetComponent<Counter>().ScoreAmount += 1;
   }
}

sentences:
What is pokemon-like game's view called? I'm trying to make a game with a top down view, but angled, like pokemon, zenonia, zelda(I think), and most rpgs(specially the ones made with rpg maker).
But I don't know what is this view called so I'm finding it tricky to get resources or even assets. I heard things like bird-view, 3/4. But I don't really know the exact name.
I would also apreciate any resources or guide with this type of games.

Thanks!

sentences:
Path planning for volumes in games How would you path plan a volume for a game?

For example a 1 km cube with tunnels and caverns. Also the terrain is destructible.

You have walking and flying modes.

I would separate it into phases. Create a volume of the open space. Find a path that takes into account dynamic destruction.

Performance is a huge concern and the ability to find paths that are used in a short time.

Concrete example:
Mine something deep in the ground efficiently.

The ground is destroy-able. "Caverns" are easy to dig areas. Mining is like flying. Need to see with sensors. The dataset is huge. Need to construct a transportation path to the target. May be multi-agent.

sentences:
Is it acceptable to have a global singleton engine class, in an entity component model? I am in the process of writing an entity component model game engine, and I wanted to ask about the best way to lay out the code. I have run into an issue that I know will quickly cause me to run into more problems, down the road. In short, I currently have a render component, that I attach to the entity class. The problem is, I need the render component to signal the render engine, and add itself to it.

I thought about creating a singleton for the render system, but I quickly realized that was a bad road, and sooner or later, I would be creating singletons for just about everything (Ex, physics for the physics component). What I am currently thinking of doing is creating the base engine class as my only singleton. The engine class is responsible for initializing all of the systems available, such as the graphics and file systems, storing references to them, calling the game loops update method, and keeping track of all the entities in the game. If I did that, then my components or any other part of the code could easily reference the important systems they need to deal with via a simple Engine.MySystem. In the case of my render component, Engine.Graphics3D.addModel().

I am wondering is if this is an acceptable way of doing things, or not. If not, what would be better? I could, in theory, pass a reference to the GFX system to the render component, but that seems like a really bad idea. I feel like this is a nice middle ground between the two options.

sentences:
What is "convexity" in the context of game design? I have overheard game designers mentioning something called convexity in games. This seems to be a game-design-specific concept, different from (although possibly related to) that in geometry or game theory. Unfortunately there are very few sources online mentioning it, let alone a definition. From what I could gather, it has something to do with player choices.

So what is convexity? How does it manifest in a game? What's an example of it, or the lack of it? Is it a good thing, a bad thing, or if it depends, when is it good, when is it bad?

sentences:
Unity C#: Using Linecast with collider bounds I'm trying to to detect when two 3D objects overlap each other 'visually' without actually touching. For example, if I have two spheres in a scene that are 1 meter apart and I rotate my camera around the objects so that one sphere is blocked by the sphere in front of it, I want to detect when this occurs.

After many searches in this forum, I patched together the solution below. However, it only partially works: it only detects overlap when the center of the occluded object is reached (i.e., "bounds.center"). I read that there is a way to use the bounds in this scenario so that it samples multiple rays from around the object. This way, overlap is detected at the objects visual boundary and not just it's center. Unfortunately, my coding abilities are meager and I can't figure out how to do it.

Any help would be greatly appreciated.

using UnityEngine;
using System.Collections;

public class OverlapCheck : MonoBehaviour {

     public Transform myCamera;
     private Color mouseOverColor = Color.green;
     private Color originalColor;
     private Vector3 objectExtents;

     // Use this for initialization
     void Start () {
         originalColor = gameObject.GetComponent<Renderer> ().material.color;
         objectExtents = gameObject.GetComponent<Collider>().bounds.center;
     }

     // Update is called once per frame
     void Update () {
         if (Physics.Linecast (objectExtents, myCamera.position)) {
             gameObject.GetComponent<Renderer> ().material.color = Color.yellow;
         } else {
             gameObject.GetComponent<Renderer> ().material.color = originalColor;
         }
     }
 }

sentences:
How can I control how quickly a character levels up in an RPG? I am working on an RPG and I've mostly followed formulas from the Dragon Quest series and they've all been fairly simple. (For example, dmg = (Attack/2 - Defense/4), where Attack is Weapon Power+STR.)

Experience points are more complicated though. I want one of the characters to level more slowly compared to the others. I'm not comfortable with the maths, but how would I go about creating a suitable exponential growth formula that is slow from let's say levels 1 through 40 and then speeds up to 99?

sentences: What kind of databases are usually used in an MMORPG? Do people write their own DB for some reason?

sentences:
Why does my collider behave strangely after a coroutine So I'm trying to create a simple script that is going to handle the logic for cutting down a tree
I'm experiencing some strange behaviour with my script.
I have a private field which holds the "HP" for the tree which starts at 100, and when I hit the tree it goes down by 25 every time, so I need to hit it four times in order for me to cut it down.
Once the tree reaches <= 0 in terms of HP it should play an animation which simulates the tree being cut down, wait a couple of seconds and then play another animation of it appearing again.
Most of this works fine, it's not until after the animation, where I start my CoRoutine to wait for a couple of seconds it starts messing up.
ISSUE
The first time I cut it down, it works fine.. However.. After it respawns I need to hit it like 4-5 times for it to go down to 50 health and then it works like normal.
So I hit it once, it gets to 75, I hit it twice, still at 75, 3 times.. still at 75.. And eventually, it starts going to to 50, 25, 0 etc..
This only happens after I cut it down the first time, and the first time it works fine.
Here is my Tree script NormalTree.cs
public class NormalTree : MonoBehaviour
{
    public static NormalTree instance;
    private int health = 100;

    public Animator animator;
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        animator = GetComponent<Animator>();
    }

    private void Update()
    {
        if (health <= 0)
        {
            KillTree();

        }
    }

    private void KillTree()
    {
        StartCoroutine(TreeSleep());
    }

    IEnumerator TreeSleep()
    {
        animator.SetBool("treedead", true);
        gameObject.tag = "DeadTree";

        yield return new WaitForSeconds(3f);

        animator.SetBool("treedead", false);
        gameObject.tag = "Tree";
        health = 100;
    }

    public Item DamageTree(int damage)
    {
        health -= damage;
        Debug.Log($"Tree health {health}");
        if (health <= 0)
        {
            return new Item { Amount = 1, ItemRarity = Item.ItemRarityEnum.Gray, ItemType = Item.ItemTypeEnum.Log };
        }
        else
        {
            return null;
        }
    }
}

And in my PlayerController I have this, which essentially checks if my hitbox collides with an object that has the tag "Tree"
private void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Tree"))
    {
        var wc = Skills.FirstOrDefault(x => x.Name == "Woodcutting");

        var tree = other.GetComponent<NormalTree>().DamageTree(25);

        if (tree != null)
        {
            inventory.AddItem(tree);
            wc.AddExperience(25);
            Debug.Log(wc.Level);
        }
    }
}

sentences:
Ray picking - get direction from pitch and yaw I am attempting to cast a ray from the center of the screen and check for collisions with objects.

When rendering, I use these calls to set up the camera:

GL11.glRotated(mPitch, 1, 0, 0);
GL11.glRotated(mYaw, 0, 1, 0);
GL11.glTranslated(mPositionX, mPositionY, mPositionZ);

I am having trouble creating the ray, however. This is the code I have so far:

ray.origin = new Vector(mPositionX, mPositionY, mPositionZ);
ray.direction = new Vector(?, ?, ?);

My question is: what should I put in the question mark spots? I.e. how can I create the ray direction from the pitch and roll?

Any help would be much appreciated!

sentences:
Tweening Colors in OpenGL I'm making a sky gradient in OpenGL by drawing with glColorPointer and glDrawArrays. I would like to be able to change the sky colour from morning to daytime to evening etc. I can either:

Make a number of sprites and fade them in with my framework
Somehow tween the color vector in openGL over time and use a single sprite

The second one seems like a more efficient option, but my framework doesn't pass the time delta into the draw method for me to decide how far I've progressed into fading.

Here's my current code:

glDisable(GL_BLEND);
glDisable(GL_DITHER);
glDisable(GL_FOG);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);

CGSize size = [[CCDirector sharedDirector] winSize];
float w = size.width;
float h = size.height;

const GLfloat vertices[] = {
    0, 0,
    w, 0,
    0, h/3,
    w, h/3,
    0, h*2/3,
    w, h*2/3,
    0, h,
    w, h,
};

const GLubyte colors[] = {
    254,255,134,255,
    254,255,134,255,
    230,157,0,255,
    230,157,0,255,
    230,60,0,255,
    230,60,0,255,
    167,0,86,255,
    167,0,86,255,
};

glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glEnable(GL_TEXTURE_2D);

Which gives me:

sentences:
XNA Deserialization Error: XML element "Type" not found I want to deserialize an xml file that contains a path for an image
I have 3 projects:

One with the Program.cs class and the main template stuff from xna,

another with classes such as the default 'Game1" as well as others,

and a final project containing the resources.

The build order is: Classes -then-> resources + Program.cs last
Resources (the xml) depends on the classes, and program also depends on classes

Here is a screenshot of the solution explorer: http://imgur.com/a/lUFbB
(Game1 is renamed to Main.cs)

Here is the class which loads the image:

namespace WORLib
{
    class SplashScreen : GameScreen
    {
        Texture2D image;

        public string Path;

        public override void LoadContent()
        {
            base.LoadContent();
            image = content.Load<Texture2D>(Path);
        }
...

Here is the class that manages the screens:

namespace WORLib
{
    class ScreenManager
    {
        //fields
        public static ScreenManager instance;
        public Vector2 Dimensions { private set; get; }
        public ContentManager Content { private set; get; }
        XmlManager<GameScreen> xmlGameScreenManager;

        GameScreen currentScreen;

        public static ScreenManager Instance
        {
            get
            {
                if (instance == null)
                    instance = new ScreenManager();
                return instance;
            }
        }

        private ScreenManager()
        {
            Dimensions = new Vector2(640, 480);
            currentScreen = new SplashScreen();
            xmlGameScreenManager = new XmlManager<GameScreen>();
            xmlGameScreenManager.Type = currentScreen.Type;
            currentScreen = xmlGameScreenManager.Load("SplashScreen.xml");
        }
...

This is the xml code:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:ns="WORLib">
  <Asset Type="WORLib.SplashScreen">
    <SplashScreen>
      <Path>SplashScreen/image</Path>
    </SplashScreen>
  </Asset>
</XnaContent>

And this is the error I get upon building:

XML element "Type" not found

This error does not appear in any thread ive found anywhere, and most other threads did not get me very far. This thread:
C# XNA - Can't Deserialize Element   helped me the most, but I did not know how to get rid of the xnamanager class without breaking my content loading.

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:
Unity ScrollRect many objects perfomance issue I have scrollrect setup and over 1000 objects to scroll through. Currently i'm Instantiating all the 1000 objects at once and notice fps drop. I'm using 2d mask and disbale pixel perfect. Both gave a perfomance boost, but i still Think the bottleneck is that i have 1000 objects already created on the scene. Instead create what is visible to the eye.

What can i do? I've looked into pools. But i dont know how i should use it in my case. Since the inventory is dynamic.

public void ShowInventory(PlayerObject player)
{
    for (int i = 0; i < inventory.GetContainerSize; i++)
    {
        Item item = inventory.GetContainer[i];
        Button itemButton = Instantiate(buttonPrefab, content);
        itemButton.GetComponent<InventorySlot>().SetInventorySlot(player, item, item.amount);
    }
}

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:
libgdx - Check if body is touch I have some bodies around the screen(Ball[] balls), and I would like to delete them when user touches them.

Also, I have an Image as userData of the bodies.

I dont want to make a function to all Image, because the balls have to be deleted in an order.

What is the best way to detect if a body is touch?

sentences: What size window should i use for making an Xbox 360 game in XNA I have a basic understanding of XNA 4.0 and i want to create an xbox game. What size window should i use? should i use the 16:9 aspect ratio then put it in full screen?

sentences:
How to make a PROPER main menu (or any other UI windows/modals) in Unity? So, I'm currently learning both about Unity for the first time as well as the 'new' 2D UI system, but I'm having a hard time figuring out how to make windows, modals/dialogs, main menus etc. which are not only functioning, but also modular, reusable and written following proper coding standards. Most how to's, blogs, Q&As or tutorials I find only cover the most basic parts of UI development (e.g. how to drag a button from the toolbar to the scene window in 2 hours).

So basically, I'd like to have a main menu which meets those (very common) requirements:

A button which 'starts' the game (e.g. by simply loading another scene)
A button which 'quits' the game, but also opens up a confirmation dialog before
A button which opens up an options dialog, which again is composed of multiple parts (audio, video...)
and finally, it should be possible to go back to the previous screen using a 'back key/button', for example Escape

What I started with is a canvas which I called GameMenu. This canvas has several nested canvases, such as

MainMenu
OptionsMenu

OptionsMenuAudioPart
OptionsMenuVideoPart

CancelMenuModal

Then I created a menu script which works as some sort of state machine:

public class MenuScript : MonoBehavior {

    private GameObject _currentStateObject;
    private GameObject _previousStateObject;

    public void SetState(GameObject newStateObject) {
        if(newStateObject == null || newStateObject)
            return;

        if(CurrentStateObject != null)
            CurrentStateObject.SetActive(false);
        _previousStateObject = _currentStateObject;
        CurrentStateObject = newStateObject;
        CurrentStateObject.SetActive(true);
    }
}

Every button has now an event trigger attached which calls the SetState(...) method on MenuScript.

However, I've got the following problems:

How do I pass multiple parameters to methods invoked by event triggers? As soon as I add another parameter to SetState(...), for example bool isModal = false to tell the method that it shouldn't disable the previous state, then it disappears from the event trigger action selection menu.
How to I register key press events within the event triggers? It's easy by script (Input.GetKey(...) etc.), but I didn't find one on the event type selection.
How do I make e.g. event triggers conditionally? So that certain events cannot be called when certain states are active?

I know I can solve all those problems within the script and make a fully functional main menu which does exactly what I want, but then...

I cannot use it for something else
I don't use the new Unity UI system, which makes me wonder what's the purpose of it
I got to reference all involed game objects (the canvases, buttons etc.) in script, which makes it not really 'extendable' anymore as this means for every changed requirement, I have to alter the script (e.g. a new state, menu, button etc)

The main goal in the end is a script which I can use for all kinds of UIs without writing the same logic over and over again just because it's another scene, game state etc.

sentences:
Why does my Outlined Diffuse 3 shader seem "detached" at a distance? I'm using the Outlined Diffuse 3 shader from Unity and I'm having a problem with it: the outline looks great when the camera is near the object, but at a distance, it looks detached.

From nearby (looks good):

From afar (looks bad; see the shelf and books):

How can I fix this graphical anomaly?

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:
why does Physics.Raycast always return my player game object instead of the object I clicked? I have 3D world. I want to detect when the player clicks on a game object in the world.

In this image, I have 2 objects I want to detect mouse click on. The white sphere does have collider on it. The dumpster does not. The behavior is the same as noted below.

I am getting the mouse down detection.  When I check the RaycastHit, I always get the player game object transform and not the game object I clicked on in the world. If I remove the raycaster checks, then I get mousedown for anything in the game not just mouse down over the game object. I need to be able to distinguish between clicks on different game objects.

I found a post here and added a PhysicsRayCaster, but it didn't change the behavior.  The problem isn't getting the event.  My problem is detecting which game object the player clicked on in the world.

Here's my code:

public class InventoryItemSearchHandler : MonoBehaviour
{
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                // CompareTo always fails because hit.transform.name is always "Player" and
                // not the name of the object clicked on
                if (0 == hit.transform.name.CompareTo(transform.name))
                {
                    print("mouse down");
                }
            }
        }
    }
}

EDIT:
In the image below (compared to the one above) I do get the correct transform in the RaycastHit type when I click on the white sphere (and when I click on the dumpster I get the player transform as noted above).

So it looks like the player object is getting in the way.  What would be causing that?

sentences:
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:
(LIBGDX) args instead of variables names I added Kryonet to my libgdx project like this...

Created a "libs" folder in core project, droped kryonet.jar in there.
In build.gradle of the root project added this line:

project(":core") {
   ...
   dependencies {
    ...
    compile fileTree(dir: 'libs', include: '*.jar')
   }
}

But I keep seeing "arg" instead of the variable names

When I try to see the class this is what it shows:

No button to attach source is being displayed..
Any Ideas?

sentences:
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:
Depth sorting 2D textures in a batch with OpenGL ES 2.0 I have a combo of texture atlases and sprite batches in an OpenGLES 2.0 2D game I'm developing which is working well, but I have a problem with depth sorting.

I'm using atlases to reduce the number of texture bind operations, and sprite batches to reduce the number of draw calls and everything is rosy but I've hit a logical problem when it comes to how to arrange the sprites in the game.

Because the whole point of using the atlas together with the batch is to save on bind/draw calls I inherit a limitation that I can't draw sprites in the same batch which have textures across multiple atlases.

This means I have to think carefully about the z ordering of the 2D sprites.  If sprite "A" should sit behind sprite "B" then I have to draw sprite A's batch first.. ok fine.  The problem arises when there are three sprites, A,B and C where A is behind B and B is behind C but A and C are on the same atlas.

That is,

Atlas 1
---------
| A | C |
---------

Atlas 2
-----
| B |
-----

Scene
-----------------------
[CAMERA] -> C -> B -> A

Now obviously I could achieve this with multiple bind/batch operations but that kind of defeats the purpose of having it in the first place.  Ideally I don't want to have to think about which sprite is on which atlas and just change the 'z' value for the sprite.

I experimented with enabling GL_DEPTH_TEST but most of my sprites use textures with some level of transparency so this won't work for me.

Is there a "standard" approach to this?  Or have I painted myself into a corner I should never have?

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:
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:
Is there any way to use events without breaking class and component separation? I just started using events, and got stuck a little. I have a problem with the following code:

class InputHandler
{
      public delegate void Shooting();
      public static  event Shooting OnShoot;

      void Update()
      {
            if( fireButtonPressed)
                OnShoot();
      }
    // Rest of the class.
}

class Weapon
{
     void Shoot()
     {
         //Do the shooting.
     }

    void OnEnable()
   {
         InputHandler.OnShoot += shooting;
   }

   void OnDisable()
   {
         InputHandler.OnShoot -= shooting;
   }
}

class UI
{
     void UpdateBulletsCount(int bulletsLeft, int magSize)
     {
         //Update the UI.
     }

    void OnEnable()
   {
         InputHandler.OnShoot += UpdateBulletsCount; //  clearly can't do that.
   }

   void OnDisable()
   {
         InputHandler.OnShoot -= UpdateBulletsCount;
   }
}

My UI class has a method to update the bullet count when you fire, reload or change the weapon. As you can clearly see, it takes in different parameters.  This allows me to change the UpdateBulletsCount() to accept no parameters, and find the weapons info through GetComponent or Find, in order to update UI.

However, then the UI class will depend on the Weapon class, which breaks the separation of classes and components that I am trying to achieve. Is there any way to use events without breaking class and component separation?

sentences:
Avoiding orbiting in pursuit steering behavior I have a missile that does pursuit behavior to track (and try and impact) its (stationary) target.

It works fine as long as you are not strafing when you launch the missile.  If you are strafing, the missile tends to orbit its target.

I fixed this by accelerating tangentially to the target first, killing the tangential component of the velocity first, then beelining for the target.

So I accelerate in -vT until vT is nearly 0.  Then accelerate in the direction of vN.

While that works, I'm looking for a more elegant solution where the missile is able to impact the target without explicitly killing the tangential component first.

sentences:
Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).

This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.
How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts?

sentences:
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:
Moving an object (pong paddle) along the x,y axis in 3d-space with mouse/touch First of all: Sorry, my English isn't quiet good, I'm very new in 3D and I'am using JMonkeyEngine.

What I would like to do?:

A 3d pong game and I want to control the paddle with the mousecursor and/or touchscreen.

What I have done so far:

placed some boxes as floor and walls and the paddle with a coloured material(not included in the example code), put them in a geometry and then in a node an attach it to the root node to make it visible.

Box a = new Box(Vector3f.ZERO, 2, 0.01F, 5);
Box b = new Box(Vector3f.ZERO, 2,0.01F, 5);
Box c = new Box(Vector3f.ZERO, 0.01F, 1F, 5);
Box d = new Box(Vector3f.ZERO, 0.01F, 1F, 5);
Box e = new Box(Vector3f.ZERO, 4, 2, 0.01F);
Box paddle1 = new Box(Vector3f.ZERO,0.25F,0.15F,0.02F);

geomPaddle1 = new Geometry("paddle1", paddle1);
Geometry geomBottom = new Geometry("bottom", a);
Geometry geomTop = new Geometry("top", b);
Geometry geomLeft = new Geometry("left", c);
Geometry geomRight = new Geometry("right", d);
Geometry geomWall = new Geometry("Wall", e);

geomBottom.move(0, 0, 0);
geomTop.move(0, 2, 0);
geomLeft.move(-2,1,0);
geomRight.move(2,1,0);
geomWall.move(0,0,-5);
geomPaddle1.move(0,1,5);

nodePaddle1 = new Node("PaddleNode");
nodePaddle1.attachChild(geomPaddle1);

Node walls= new Node("walls");
walls.attachChild(geomBottom);
walls.attachChild(geomTop);
walls.attachChild(geomLeft);
walls.attachChild(geomRight);
walls.attachChild(geomWall);
rootNode.attachChild(nodePaddle1);
rootNode.attachChild(walls);

The camera is set in z-axis "-1" direction in front of the paddle and the flying cam is disabled

cam.setLocation(new Vector3f(0,1,8));
flyCam.setEnabled(false);

So, where is my problem?

I would like to attach the middle of the paddle to the mousecursor(mouseposition). I have read around and I think I have to translate the 2d mousecoordinates to 3d worldcoordinates. I found some code to do that:

Vector3f origin = cam.getWorldCoordinates(inputManager.getCursorPosition(), 0.0f);

Then I thought I only have to adjust or fix the z-axis in the simpleUpdate loop, because I only want the x,y-movement.

 Vector3f origin = cam.getWorldCoordinates(inputManager.getCursorPosition(), 0f);
 Vector3f dir2 = new Vector3f(origin.getX(), origin.getY(), 5F);
 geomPaddle1.setLocalTranslation(dir2);

but it doesn't worked as I thought:

mousecursor at paddle-origin

mousecursor right from paddle

The paddle move in the correct direction but not to the mousecoordinates.

Well.. I'm very new at this things, I dont know wheter I'am completely wrong or how I can implement the mousecontrol in another way. It would be wonderful if you can help me.

Best regards

sentences:
How do I connect the seams between my terrain? I'm using c++ and D3D11 and I'm trying to create a (pretty) large terrain, lets say 4096x4096, maybe larger.
I've got the basics of terrain creation and already split it up into chunks.

But, when I'm rendering them (every chunk has its own vertex and index buffer, as well as its own heightmap), there are still little pieces missing between them. I read a lot about LOD(Level Of Detail) and GMM(Geometry Mipmap), but I can't really implement the theory I read.
At the moment, it looks like this:

I could really use some help, everything is welcome.
If you have some good tutorials on any of this, please share them.

sentences:
Box2D + Citrus Engine - Proper Pong Paddles I am creating a pong clone for my first Citrus Engine project using Box2D. I've tried two types of paddles, both do not fully work.

1) Paddle is a dynamic body with a restitution of 1.0 and friction of 0.0.

Problem: The bouncing ball will move the paddle when it collides.

2) Paddle is a kinematic body type.

Problem: The paddle will not detect collision with the walls of the game screen.

Question: How can I create a paddle object that will not be affected by the collision of the ball while colliding normally with the game walls?

sentences:
Unity LLAPI Connection Problems: NAT/Routers? I have created a bespoke networking system using Unity's LLAPI.  It works fine on the same machine, and sometimes works even to direct connect across the internet!

The problem however, is that it sometimes does not want to connect to other players across the internet.  It seems impossible to host the game on some ISPs, as clients cannot detect or connect to them.  I assume this is related to Router/NAT issues.

I would like to know how I can deal with this problem, integrating with Unity's LLAPI.

sentences:
Game Maker Studio Gravity Problems I've started messing around with Game Maker Studio. The problem I'm having is trying to get a gravity code for orbiting.

Here's how i did it in XNA

        foreach (GravItem Item in StarSystem.ActiveItems.OfType<GravItem>())
        {
            if (this != Item)
            {
                Velocity += (10 * Vector2.Normalize(Item.Position - this.Position *
                    (this.Mass * Item.Mass) / (Vector2.DistanceSquared(this.Position,
                    Item.Position)) / (this.Mass));
            }
        }

Simple and works well, things or bit and everything is nice.

but in Game maker i don't have the luxury of Vector2's or a For-each loop to loop threw all the objects that have a
mass. I've tried a few different things but nothing seems to work

distance = distance_to_object(obj_moon);

//--Gravity
hspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)
vspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)

thanks for the help

sentences:
How to Make Different Instances of an Object Have Different Sprites In Game Maker, I am trying to make it so that three instances of an object have three different sprites. Using DnD, what would be the optimal way to do this? If it helps, the three instances are different sizes and are in separate, fixed places.

EDIT: I have added the following, and it gives an error that the global variable has not been set.

sentences:
Center a 3D model to cursor's position I am having a hard time understanding how to go about this. I have a 2D game with some 3D models in it. I want to move a 3D model to where the mouse cursor is currently at in every frame (In other words, center a 3D model in a specific Point(x,y)).

This is my drawing code to position the model in the center of the screen:

Matrix[] transforms = new Matrix[Model.Bones.Count];
Model.CopyAbsoluteBoneTransformsTo(transforms);
ModelMesh mesh = Model.Meshes[0];
BasicEffect effect = (BasicEffect)mesh.Effects[0];
Vector3 modelPosition = new Vector3(0, 0, 0);

effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
    aspectRatio, 1.0f, 10000.0f);
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
    Matrix.CreateTranslation(modelPosition);

    mesh.Draw();

I suppose I would need a formula to convert the (camera position,model position, aspect ratio, field of view) into pixels ? Does anyone know how it works ?

sentences:
Drawing very large slowly rotating planets I'd like to draw very large (~500 px) graphics of planets slowly rotating. These graphics are meant to impress. What's the best way of doing this? I don't have experience with any particular 3D engine, and I'm not even sure what platform this game would run on,  so:

I could pre-render each frame, but at 500px and a rotation period of 10 seconds, that's a ludicrous amount of data per planet.
I could use a 3D engine and map the planet's texture onto a mesh approaching a sphere, but at 500px, I fear the polygon count would have to be huge to make it look good.
I could write a kind of custom 3D engine that does nothing but efficiently render a textured sphere, by converting the x/y coordinate of each view pixel into the coordinate space of the sphere's texture - but this is involved, and couldn't benefit from graphics acceleration.
Something else I haven't thought of?

Here's an example animated GIF of what I mean. (At 100x100 px and 60 frames, it's already pretty huge, sorry.) Imagine this much, much bigger, rotating much slower, and animated more smoothly:

But if this were 500x500 px and 10 x 25 = 250 frames, we'd be talking about hundreds of MB of data, so this straightforward approach doesn't work.

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:
Errors happen when using World.destroyBody( Body body ) on Android application using libgdx, when I use World.destroyBody( Body body ) method, once in a while the application suddenly shuts down.

Is there some setting I need to do with body collision or Box2DDebugRenderer before I destroy bodies?

Below is the source I use for destroying bodies.

private void deleteUnusedObject( ) {
    for( Iterator<Body> iter = mWorld.getBodies() ; iter.hasNext() ; ){
        Body body = iter.next( ) ;
        if( body.getUserData( ) != null ) {
            Box2DUserData data = (Box2DUserData) body.getUserData( ) ;
            if( ! data.getActFlag() ) {
                if( body != null ) {
                    mWorld.destroyBody( body ) ;
                }
            }
        }
    }
}

Thanks

sentences:
How to calculate corner positions/marks of a rotated/tilted rectangle? I've got two elements, a 2D point and a rectangular area. The point represents the middle of that area. I also know the width and height of that area. And the area is tilted by 40° relative to the grid.

Now I'd like to calculate the absolute positions of each corner mark of that tilted area only using this data. Is that possible?

sentences: How to get started with a game engine? I'm a 3rd year Computer Science student and I would like to get started with building a game engine or at least tinkering with making one. I am curious if there are any good resources to use to get started. I get the idea behind different pieces in the engine, but I'm not really sure about how they fit together. Is there anything out there to help teach me the skeleton of a  game engine? So far I've been playing with the idea of a game engine that uses modules built in a circular linked list so that each can do it's computing and then pass move to the next piece of the engine to work.

sentences:
How do you disable frame skips in a game, in SFML preferably by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it:
static class Globals
{
    static public Time dt = new Time();
    static public Vector2f Friction
    {
        get
        {
            return new Vector2f(2 * dt.AsSeconds(), 0);
        }
    }
}

class Player
{
        private void StartMoving(int _direction)
    {
        moving = true;
        direction = _direction;
        heldfor =  1;
        Move(direction);
    }
    public void Move(int _direction)
    {
        if(!moving)
        {
            StartMoving(_direction);
            return;
        }
        if(direction == _direction)
        {
            if(heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }
        else
        {

            direction = _direction;
            heldfor /= 2;
            Velocity = new Vector2f(Velocity.X / 1.5f, Velocity.Y);
            if (heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }

    }
    public void StopMoving()
    {
        moving = false;
        heldfor = 1;
    }

    public void Update(Time dt)
    {
        if(!moving)
        {
            if(Math.Abs(Velocity.X) - Globals.Friction.X < 0)
            {
                Velocity.X = 0;
            }
            else
            {   // i really should make this direction independent and apply direction at end of the update
                Velocity.X = Velocity.X > 0 ? Velocity.X - Globals.Friction.X : Velocity.X + Globals.Friction.X;
            }
            if (Math.Abs(Velocity.X) <= velocitySnapX) Velocity.X = 0;
            if (Math.Abs(Velocity.Y) <= velocitySnapY) Velocity.Y = 0;
        }
        if (Math.Abs(Velocity.X) > XMaxvel) Velocity.X = XMaxvel * direction;
        if (Math.Abs(Velocity.Y) > YMaxvel) Velocity.Y = YMaxvel * direction;
        Position += Velocity;
    }
}

class Program
{
    Player player = new Player();
    while(game.isrunning) // this is made up as the genuine code is too messy
    {
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Right))
            {
                player.Move(1);
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.Left))
            {
                player.Move(-1);
            }
            window.Clear(Color.White);
            window.Draw(player);
            player.Update(Globals.dt);
            window.DispatchEvents();
            window.Display();
            window.SetView(mainview);
            Globals.dt = deltaclock.Restart();
    }
}

sentences:
Mip Maps on 2D Sprite causing black line above. Why is this? I am new to Unity. I'm trying it out and using Futile for a code-first approach, but still importing textures using the Unity system.

The problem I'm having is that when I use mip maps to scale large sprites down to smaller sizes without jagged edges, I'm getting a black line artefact above said sprites.

A little hard to see, but they're there. If I turn down the resolution, you can clearly see them:

These are my texture settings:

My question is, why are these black lines here? Is it a mistake I've made? Is it just a common side effect? How can I reduce these? Also, if this is the wrong approach, how can I use smooth sprites in a game with the ability for them to scale up smoothly?

Thanks!

sentences:
How can I make a character crouch? I tried to make a crouch system. In my script I changed .height and .center properties of collider in CharacterController component. But there are some problems. First, once I press "crouch button" collider is changing its height and center position but when I release the key the collider isn't returning to its previous state. Secondly, if I change its height and position by hand when collider is under a block, it's just stuck. How can I fix this problem?

Here's my script:

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

[RequireComponent(typeof(CharacterController))]
public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    public float jumpForce;
    public CharacterController controller;
    public GameObject myCamera;

    private Vector3 moveDirection = Vector3.zero;
    public float gravityScale;

    public Animator anim;

    // Use this for initialization
    void Start () {
        transform.tag = "Player";
        controller = GetComponent<CharacterController>();
    }

    // Update is called once per frame
    void Update () {
        Vector3 forwardDirection = new Vector3 (myCamera.transform.forward.x, 0, myCamera.transform.forward.z);
        Vector3 sideDirection = new Vector3(myCamera.transform.right.x, 0, myCamera.transform.right.z);
        forwardDirection.Normalize ();
        sideDirection.Normalize ();
        forwardDirection = forwardDirection * Input.GetAxis("Vertical");
        sideDirection = sideDirection * Input.GetAxis("Horizontal");
        Vector3 directFinal = forwardDirection + sideDirection;

        if (directFinal.sqrMagnitude > 1)
        {
            directFinal.Normalize ();
        }

        if (controller.isGrounded)
        {
            moveDirection = new Vector3(directFinal.x, 0, directFinal.z);
            moveDirection *= moveSpeed;
            if (Input.GetButtonDown("Jump"))
            {
                moveDirection.y = jumpForce;
            }

            if(Input.GetButtonDown("Crouch"))
            {
                controller.height = 1f;
                controller.center = new Vector3(0f, -0.5f, 0f);
                moveSpeed = 3f;
            }
        }
        moveDirection.y = moveDirection.y + (Physics.gravity.y * gravityScale * Time.deltaTime);
        controller.Move(moveDirection * Time.deltaTime);

        anim.SetBool("isGrounded", controller.isGrounded);
        anim.SetFloat("Speed", (Mathf.Abs(Input.GetAxis("Vertical")) + Mathf.Abs(Input.GetAxis("Horizontal"))));
    }
}

Thanks for any help!

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:
OUYA and Unity set up problems I'm having trouble with the Unity / OUYA plugin.

I'm using Unity 4 with the latest update on a Windows 7 machine.

When I open the starter kit and try to compile the plugin I get the following error:

  Picked up _JAVA_OPTIONS: -Xmx512M

And if I try to Build and Run I get this error:

  Error building Player: ArgumentException: Illegal characters in path.

I'm stumped, I've gone through lots of forum posts here and on stackoverflow and I can't seem to resolve it.

My environment variables look like this:

PATH - C:\Users\dave\Documents\adt-bundle-windows-x86_64-20130219\sdk\tools;
       C:\Users\dave\Documents\adt-bundle-windows-x86_64-20130219\sdk\platform-tools\

JAVA_HOME - C:\Program Files (x86)\Java\jdk1.6.0_45\

Everything in the OUYA Panel is white

Any ideas?

sentences:
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:
Cocos Creator - orientation change event in native build for iPhone and Android I am making some Hybrid app which has some native part in Both iOS and Android and common functionality (which includes and games/animation and UI) which I make in Cocos Creator.

The problem I am facing while I am trying to change the device orientaiton from Portrait to Landscape of vice-versa.

I tried to get the current frame size or get notified about the change, but no success.

Anyone face this issue? Any ideas are welcome!

sentences:
Simple thruster like behaviour when rotating sprite I'm prototyping some 2D game concepts with XNA and have added some basic keyboard inputs to control a triangle sprite.

When I press key up the sprite accelerates in it's current facing direction, when I release the key it brakes down.

For rotation, when I press left/right keys I rotate the sprite.

Currently the sprite immedately changes direction when I rotate it. What I want is for it to keep moving in the same direction when I rotate, until I hit key up, adding thrust in whatever direction the sprite is pointing at.

This would simulate thrusters on a classic space shooter like Asteroids.

I'm adding an image to describe the behaviour I'm after and some code samples of how I'm doing things at the moment.

This is my player struct, holding information of the sprite.

    public struct PlayerData
    {
        public Vector2 Position;  // where to draw the sprite
        public Vector2 Direction; // travel direction of sprite

        public float Angle;       // rotation of sprite

        public float Velocity;
        public float Acceleration;
        public float Decelleration;
        public float RotationAcceleration;
        public float RotationDecceleration;

        public float TopSpeed;
        public float Scale;
    }

This is how I'm currently handling thrusting / braking (when pressing/releasing key up) (simplified, removed some bounds checking etc):

player.Velocity += player.Acceleration * 0.1f;
player.Velocity -= player.Acceleration * 0.1f;

And when I rotate the sprite left and right:

player.Angle -= player.RotationAcceleration * 0.1f;
player.Angle += player.RotationAcceleration * 0.1f;

This runs in the update loop, keeps the direction updated and updates the position:

Vector2 up = new Vector2(0f, -1f);
Matrix rotMatrix = Matrix.CreateRotationZ(player.Angle);
player.Direction = Vector2.Transform(up, rotMatrix);

player.Direction *= player.Velocity;

player.Position += player.Direction;

I am following along various beginner tutorials and haven't found any describing this, but I have tried some on my own without success. Do I need to change my velocity and acceleration fields to Vectors instead of floats to accomplish this type of movement? I realise my Angle and the Direction vector is currently tied together and I need to disconnect these somehow to be able to rotate freely without changing the direction of the movement, but I can't quite figure out how to do this while keeping the acceleration/decceleration functional.

Would appreciate an explanation rather than pure code samples.

Thanks,

sentences:
Getting sprites to move exactly the same on different devices Background

When moving a sprite along the X axis, this is my code:

spriteXReal = spriteXReal + (spriteXVel * dt);  //.5 would be halfway point of, 1 would be right hand side screen etc...
spriteXScreen=spriteXReal*deviceWidth;

And the spriteXVel value above is worked out as:

spriteXVel = 1/spriteXTime;

So I would set spriteXTime to 10 if I wanted my sprite to work it's way across the screen in 10 seconds.

My code:

Uses a fixed delta time
Has tics per second capped at 60 (so my delta is 1/60)

The issue

This is great and works well, however, I am getting odd results when running on a different device (with a different screen res).

When comparing the 2 devices (simply by starting the game on both devices at the exact same time, they are almost identical save for a tiny difference in speed.

The game world is tile based. Let's say the play area on my development device is 16 tiles wide.  16 tiles fit perfectly onto this device So, if I'm moving between 8 tiles, I'm effectively crossing 1/2 of the screen.

Initially, the sprite appears to move the same on both devices, (going back and forth between say the 1st 'proper' tile and the 8th 'proper' tile), but after about 25 seconds, they are clearly out of sync.

On this device, the tiles would look something like this:

So, I'm working out my sprite movement using the device's width as above.

However, if the tiles don't fit exactly, I'm centering the original tiles and adding 'padding' tiles to the play-area like so:

Therefore, my confusion lies in how I should be working out my sprite's new position.  because, now 8 tiles is actually less than 1/2 of the device's screen.  So should I still be using the code above or something like this:

spriteXScreen=spriteXReal*(Block18X - Block2X);

I have actually tried both and when I did, the problem was still evident, so I'm not sure which one I'm supposed to be using.

What is really odd is that when I set my sprite's Time variable to certain amounts, it appears that everything stays in perfect sync between these 2 devices so I'm completely stumped - that's what I've observed thus far anyway.  I'm going to test that theory a bit more.

What else could be causing this discrepancy?!

Really appreciate some help with this one!

Edit

I've pretty much tried everything I can, I've even tried implementing a very simple 'test' game loop that updates sprite positions once every second, and put the two devices side by side, however, the Samsung Galaxy Ace Always runs ahead of the Google tablet, is it possible that System.CurrentTimeMillis(); is actually running faster on the Ace than on the tablet?

sentences:
How can I get my first-person character in Unity to move to a ledge with an animation? I'm trying to get this to happen:
The character walks up to a large crate, the player presses a button, and an animation starts playing where the character climbs up on to the crate. (all in first person view).

So far I tried this with normal "First Person Controller" Prefab in Unity.

My code so far:

function OnTriggerStay(other : Collider){
    if(other.tag == "GrabZone"){
        if(Input.GetKeyDown("e")){
            animation.Play("JumpToLedge");
        }
    }
}

However when i use this on The FPC it will always play from the position the animation is created on.

I also tried to create an empty game object, placing the FPC in there. Gives same effect.

I also tried just animating the graphics of the FPC alone. This seems to work but since the Character Controller itself is not animated that stays onthe ground. So the whole FPC wont work anymore.

Is there anyway i could let this animation play on the local position the player is on at that time?

Or can you think of any other logical solution for a grab and climb?

sentences:
Why do mobile games have delays for certain actions? Many phone games restrict the number of actions you can take in a given amount of time. I don't get what is the purpose of this limitation. Is it only to force the player to buy additional turns? Some games don't even allow this for some turn "kinds" (like action A can be played again by spending real money while action B cannot be played again by spending money).

Another possible reason would be to limit the bandwidth usage to their server and make it more predictable over time, but I can't see phone games using so much data.

sentences:
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:
Could I use Direct3D to make 2D games? My goal is to make a completely 2D game using DirectX, but I'm new to it and I'm confused about all of the different APIs that are available.

From Wikipedia:

  Direct3D is used to render three-dimensional graphics, ... Integration
  with other DirectX technologies enables Direct3D to deliver such
  features as video mapping, hardware 3D rendering in 2D overlay planes,
  and even sprites, providing the use of 2D and 3D graphics in interactive media ties.

So I guess that I can use Direct3D to make HUD and GUI (2D) elements of the game using sprites, but can I use it for a completely 2D game or should I use Direct2D instead?

The reasons because I'd prefer to use Direct3D rather than Direct2D (please correct me if I'm wrong on any of this points) are:

I don't want to use an API that abstracts me too much from what's
going
Direct2D uses Direct3D at the end
I could find myself wanting to
learn 3D programming in the future

And in case that I could use (and maybe choose) Direct3D, since it is such a massive API, which subset of it would someone need to make a 2D game?

I hope the question is not too broad, thanks in advance.

sentences:
Mining cubes out of marching cubes I originally built the start of my game world with a fully minecraft style structure: chunks, only visible faces rendered, noise, etc. Too blocky. I implement marching cubes. Looks great, horrible to work with:

The problem is when you try to add or remove blocks to the marching cubes as... exactly as they are supposed to... everything gets smoothed. It becomes difficult to raycast on a neighbor and if you do all the blocks around him get changed. Obviously.

I see a lot of marching cubes/metaball looking games that implement area based organic molding. You don't place "blocks" you shape an area or deshape it like Landmark mining etc.

On the otherhand Blockscape and Landmark seem to be a blend of the two? The land starts out marching but you can cut clear square chunks out of it and place square cubes onto it.

How can you make straight corners with marching cubes? Or is it a combination of two entirely different systems?

(UPDATE):
There is probably more than one answer to this, does anyone have any experience trying to do this though? I can think of a couple of possible approaches:

Separate player built objects into a separate mesh/object per chunk keeping terrain as terrain. Run smoothing (marching cubes or others) algorithms and normal calculations only on terrain. Would probably need some sort of a half-transparent cube highlighter showing what the cursor is currently selecting. I can see a number of benefits to this system, though feel as if there are some downsides I'm just not thinking of immediately that would crop up if I started coding it...?
Define a "smooth" bool per cube, only assigned at initial calculation of the mesh on any surfaces (floor/ceiling/etc). Any built/added/removed blocks are not re-labelled as "smooth" when generating the mesh use different math for smooth cubes than for blocky cubes. This is what I'm currently working with and it works, but it's still only about a third as smooth as a full marching cube approach would be. Basically I'm average each vertices y value with its surrounding four cubes height(noise) values while never letting it go beneath 0 or above 1 (to stay within the cube). I also had to re-write the raycast click detection to use the surface normals.
Re-code the marching cubes algorithms to work only on the cells I want them to/do what I want them to. This seems like the most difficult but possibly most visually rewarding approach.

or ??

sentences:
Phong lighting - there is something very strange with specular lighting I implemented Phong lighting. Everything seems to work - torus and spheres are lighted as expected, etc. But I notices something strange regarding specular lighting of directional light.

Here are two screenshots.

First:

Second:

As you can see more area has specular lighting when camera is far from an object.

Here are simplified vertex shader:

#version 330 core

layout(location = 0) in vec3 vertexPos;
layout(location = 1) in vec3 vertexNorm;
layout(location = 2) in vec2 vertexUV;

uniform mat4 MVP;
uniform mat4 M;

out vec2 fragmentUV;
out vec3 fragmentNormal;
out vec3 fragmentPos;

void main() {
  fragmentUV = vertexUV;
  fragmentNormal = (M * vec4(vertexNorm, 0)).xyz;
  fragmentPos = (M * vec4(vertexPos, 1)).xyz;

  gl_Position = MVP * vec4(vertexPos, 1);
}

... and fragment shader:

#version 330 core

in vec2 fragmentUV;
in vec3 fragmentNormal;
in vec3 fragmentPos;

struct DirectionalLight {
  vec3 Color;
  vec3 Direction;
  float AmbientIntensity;
  float DiffuseIntensity;
};

uniform sampler2D textureSampler;
uniform vec3 cameraPos;
uniform float materialSpecularFactor;
uniform float materialSpecularIntensity;
uniform DirectionalLight directionalLight;

out vec4 color;

void main() {
  vec3 normal = normalize(fragmentNormal); // should be normalized after interpolation

  vec4 ambientColor = vec4(directionalLight.Color, 1) * directionalLight.AmbientIntensity;

  float diffuseFactor = clamp(dot(normal, -directionalLight.Direction), 0, 1);
  vec4 diffuseColor = vec4(directionalLight.Color, 1) * directionalLight.DiffuseIntensity * diffuseFactor;

  vec3 vertexToCamera = normalize(cameraPos - fragmentPos);
  vec3 lightReflect = normalize(reflect(directionalLight.Direction, normal));
  float specularFactor = pow(clamp(dot(vertexToCamera, lightReflect), 0, 1), materialSpecularFactor);
  vec4 specularColor = vec4(directionalLight.Color, 1) * materialSpecularIntensity * specularFactor;

  color = texture(textureSampler, fragmentUV) * (ambientColor + diffuseColor + specularColor);
}

Full source code without any simplification could be found in this repository.

I wanted to know if I implemented something wrong. Or is it OK for Phong lighting?

sentences:
Is it better to make a cpp and hpp file for every new object or is it better to make one parent class and define types in there? Let's say we make a game. The game has items, enemies, allies, etc and there are multiple of them, like zombies and robots as enemies. Do you think it would be better to make one parent class called "Enemy" (and the corresponding cpp/hpp files) and making a class for each enemy (zombie or robot in this example) and making 2 files per enemy or would it be better to make an enumcalled "type" in the Enemy class and having all child objects in that one class?

Thank you for your help!

sentences:
Room Detection on a Tilemap I am working on a 2D top-down game inspired by Prison Architect.
What I just can't wrap my head around is recognizing rooms built by the player.

The game is built on a tilemap, meaning the map is always a rectangle, while the rooms can be of any shape. I'd like to be able to detect whenever walls & doors create a new wall, like in the example below.

Since I have no formal education in CS (yet), I can't think of any algorithm or class of algorithms that might be of use here and also can't figure out one by myself. So if you have any ideas, suggestions or resources, I'd be very thankful!

In case this is relevant, I am using a custom implementation of a tilemap using Monogame, a reimplementation of XNA and Nez.

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:
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:
QuadTree nice design for nodes I'm using c++ and have some problems with the QuadTree design.

I have some components which are not related to the QuadTree directly. These components are eg. RenderableMesh, PointLight, etc. Some of them should be handled by a QuadTree and some of them should not.

I have a "reflection" system, so I can determine the type of a given component, that's not a problem.

A simple restriction is if I want to use a component in a QuadTree, it has to be inherited from the IBoundComponent which can be used to get the bounding box of the object (using a pure virtual function which is implemented in the exact Component)

This seems okay for me but for fast remove/insert operations of "changed components" (eg. the point light's radius is changed) I should store the current node/cell of the QuadTree. And here comes the real problem. Or actually problems.

1)

Because the IBoundComponent does not know about the QuadTree directly, it has to have a public function pair which can be used to set/get the current node. I could use "friend class QuadTree" but that would restrict the spatial implementation to the QuadTree class.

2)

The Node class of the QuadTree is hidden (private). Of course I could store a void* in the IBoundComponent and cast it. Or a base class (eg. ITreeNode) could be used and the QuadTree's Node should inherit from it.

Maybe a cleaner design would be the following:

Don't store anything in the IBoundComponent (expect the bounds...). When a component is changed, I could store the pre-update bounds as well as the post-update bounds. This way I can find which node contains the component and which will contain it. However this is an extra search. So it's a performance loss for cleaner design.

Do you have any good idea? I've searched here but cannot find a good answer for this situation.

sentences:
Math > Logic for a Logarithmic Score Meter I'm trying to implement a score meter whereby I specify a maximum value (say 15,000) and I can render values on it in a logarithmic manner ie:

+------+---+--+-++        +------+---+--+-++
|==              |        |======          |
+------+---+--+-++        +------+---+--+-++
 200 pts                   1,000 pts

+------+---+--+-++        +------+---+--+-++
|=============   |        |================|
+------+---+--+-++        +------+---+--+-++
 5,000 pts                 15,000 pts +

The upper bound needs to be variable, and need to be able to convert a score to a percentage, using the above mockup as an example:

score2pct(15000, 200)   = 0.2
score2pct(15000, 1000)  = 0.4
score2pct(15000, 5000)  = 0.8
score2pct(15000, 15000) = 1

Does anyone have any pointers for me?

sentences:
Phaser Pulling Data from Firebase and Loading it as a sprite I am trying to pull img data from database to replace it with player sprite url.

    ionViewDidLoad() {
        this.profileData = this.fire.authState.switchMap(auth => this.db.object(`profile/${auth.uid}`).valueChanges());
        this.profileData.subscribe(profile =>{
        this.avatar = profile.avatar;
        console.log(this.avatar);//i got data(its an url string)

        });

        console.log('ionViewDidLoad ZombiePage');
        this.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'game', { preload: this.preload.bind(this), create: this.create.bind(this),update:this.update.bind(this),render:this.render.bind(this) });
    console.log(window.innerHeight);

      }

    preload(){
    console.log(this.avatar); //Undefined
this.game.load.image('player', this.avatar);

Why i cant reach data from preload function ? btw im using ionic/angular framework.i combined it with phaser.

sentences:
Determine animation frame from interval I have an array of sprites that are displayed in-order to make an animation. There is code in an update loop that has access to a value 'time' indicating how far along the animation is. Time is a float between 0 and 1 inclusive. It uses this value to calculate which frame to display.

update(time) {
  frames // An array of animation frames
  current_frame_index = time / animation_length
  display_frame(frame[current_frame_index])
}

This works if you assume that each frame is displayed for the same amount of time.

I would like to enhance this by allowing frames to have arbitrarily defined durations. So if I have a set of frames and durations:

name           duration

frame_one      0.2
frame_two      1.1
frame_three    1.0
frame_four     0.75
frame_five     1.4

and a value indicating the animation's progress, how can I determine which frame to display?

Thanks!

sentences:
What is best for 2D movement: velocity or AddForce? So I have tried both Velocity and addForce but I'm not getting the result I was expecting which makes me wonder if I fully understand what they do.

Move script (test script 1)

void Update () {

    if(Input.GetKeyDown(KeyCode.Space)){
        rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
    }

    if(Input.GetKeyDown(KeyCode.A)){
        rb.velocity = new Vector2(-moveSpeed, rb.velocity.y);
    }

    if (Input.GetKeyDown(KeyCode.D)){
        rb.velocity = new Vector2(moveSpeed, rb.velocity.y);
    }
}

Move2 script (test script 2)

void FixedUpdate() {
       float x = Input.GetAxis("Horizontal");
       float y = Input.GetAxis("Vertical");

       rbody.velocity = new Vector2(x*speed, y*speed);
  }

Both scripts are used independently.

Velocity when I press the key down (D or A) it stops after short time but addForce seems to do the same while that is set in FixedUpdate() or Update(), which is confusing as I thought it would keep it moving till the key was released? I have also found that if I press D it moves then stops but if I release D and press again and repeat the player does not move until I press a different move direction. Any ideas?

sentences:
Pixel-perfect collision against rotated sprite in Flixel I've got a roughly 500x50 graphic of a lockpick that I need to be able to rotate very finely while doing pixel-perfect collision detection against the lock object.

There's no way to do pixel perfect collision detection in Flixel, so I'm using the Power Tools' FlxCollision class to accomplish this. The problem is that this class only works with rotated sprites if they were loaded with loadRotatedGraphic.

...the problem with that is that it only allows you to rotate to discrete angles. You pass it how many angles you need to be able to rotate to and it, I think, pre-prepares all the frames for you.

And the reason that's a problem is because I need such fine rotation. I need at least 128 different angle values, but when I do that I get Error 2015: Invalid Bitmap, which I'm assuming is because the resulting 128 frames of a 500x50 lockpick results in a bitmap larger than AS3's limit. I can load the graphic using loadGraphic instead, which I think just calculates the rotated image real-time, but then FlxCollision won't notice that it's been rotated. Another problem is that with the pre-rotated graphics, you can't rotate about a specific point, and I need the lockpick to rotate around the tip of its handle.

...so how the heck do I do pixel perfect collision against a rotated sprite? I'm trying to mod FlxSprite so that FlxCollision will see the rotated sprites even when they're calculated in real time, and to do this I Ctrl+F'd through the class looking for appearances of "angle", the variable that you set to rotate a sprite, but all I can find is some obscure calculation in it's used to compute a frame number, and I can't find a single call to any function that looks like it's doing real-time bitmap rotating.

So, I was able to solve this problem. All FlxSprites hold the bitmap for their currently visible frame in an internal variable called framePixels. If you load a graphic using loadGraphic, then you can do real-time rotation: in this case, the draw() function rotate s framePixels "at the last minute", right before rendering it. Meaning the rotated bitmap is not stored, and FlxCollision has no way of seeing it. FlxCollision runs its collision checks against the unrotated bitmap.

So this is what need to be done:

Get the sprite to store its rotated graphic somewhere rather than just sending it to the renderer and then abandoning it.
Get FlxCollision to use that stored rotated graphic rather than framePixels.

This is summarized in the following diagram. Flixel's default logic is in black, my changes are in red.

I applied all of this in a sub-class of FlxSprite that I called PerfectCollisionSprite.

Here's my code.

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:
How do I make an 8 bit sprite sheet using GIMP or Paint.NET? I'm looking to create a sprite sheet for an 8 bit, 2D RPG I'm making. All I need to do at the moment is render in some textures. To do this, I want to make an 8x8 sprite sheet. Now, I am really bad at using anything to do with GIMP or Paint.NET, so I came here for some help.

Are there any ways to create an 8x8 blank sprite sheet using either GIMP or Paint.NET?

I have some other info you might need for whatever reason down here:

I'm using Java to code this game.
I'm following Ryan van Zeben's (DesignsByZephyr) tutorials, and I'm trying to make the same sprite sheet he made in Episode two of his series.
At the moment, I don't have access to Photoshop or anything that requires a lot of money (I'm quite young).
I'm willing to use plugins and/or other free photo-editing programs.
I am using Windows 7 as my OS, and Eclipse Luna as my IDE.

sentences:
How can I fix my audio? (prioritize) When two audio's are played at the same time... the sound is cancelling out. How do I fix this weird phenomenon?

I have some code where there is audio on button click and audio in ten second intervals (in a background service). I have the following code to stop the button audio when the ten second interval plays, and it works fine:

public static void myPop(Context context){
    AudioManager manager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
    if(!manager.isMusicActive()) {       //Only if there isn't any other audio playing
        MediaPlayer pop = MediaPlayer.create(context, R.raw.pop);
        pop.start();
    }
    else{
        Log.v(TAG, "Audio is already playing");
    }
}

This works fine, and it stops one audio from playing (pop) to let the other audio play (the one from the background service). Now, I am getting the issue when they both play at the same time. For example, when I tap the button at the exact same time as when the audio from the background service is about to start. When they are both played at the same time, the audio just gets cut off.

Is there any way to give a preference to the background service audio? Somehow say that: If two audio pieces start at the exact same time, I want to let the background service audio to play.

To think of this visually:

I want to say that if I have the choice between apples and oranges, pick apples. AKA If I have two audio players playing at the same time, pick one (the apple).

Image source

sentences:
Accounting for waves when doing planar reflections I've been studying Nvidia's examples from the SDK, in particular the Island11 project and I've found something curious about a piece of HLSL code which corrects the reflections up and down depending on the state of the wave's height.

Naturally, after examining the brief paragraph of code:

// calculating correction that shifts reflection up/down according to water wave Y position
float4 projected_waveheight = mul(float4(input.positionWS.x,input.positionWS.y,input.positionWS.z,1),g_ModelViewProjectionMatrix);
float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;
projected_waveheight = mul(float4(input.positionWS.x,-0.8,input.positionWS.z,1),g_ModelViewProjectionMatrix);
waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;
reflection_disturbance.y=max(-0.15,waveheight_correction+reflection_disturbance.y);

My first guess was that it compensates for the planar reflection when it is subjected to vertical perturbation (the waves), shifting the reflected geometry to a point where is nothing and the water is just rendered as if there is nothing there or just the sky:

Now, that's the sky reflecting where we should see the terrain's green/grey/yellowish reflection lerped with the water's baseline. My problem is now that I cannot really pinpoint what is the logic behind it. Projecting the actual world space position of a point of the wave/water geometry and then multiplying by -.5f, only to take another projection of the same point, this time with its y coordinate changed to -0.8 (why -0.8?).

Clues in the code seem to indicate it was derived with trial and error because there is redundancy. For example, the author takes the negative half of the projected y coordinate (after the w divide):

float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;

And then does  the same for the second point (only positive, to get a difference of some sort, I presume) and combines them:

waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;

By removing the divide by 2, I see no difference in quality improvement (if someone cares to correct me, please do). The crux of it seems to be the difference in the projected y, why is that? This redundancy and the seemingly arbitrary selection of -.8f and -0.15f lead me to conclude that this might be a combination of heuristics/guess work. Is there a logical underpinning to this or is it just a desperate hack?

Here is an exaggeration of the initial problem which the code fragment fixes, observe on the lowest tessellation level. Hopefully, it might spark an idea I'm missing. The -.8f might be a reference height from which to deduce how much to disturb the texture coordinate sampling the planarly reflected geometry render and -.15f might be the lower bound, a security measure.

sentences:
Is there any equivalent to glPushMatrix in XNA? I'm trying to implement a scene graph for my 2D game in XNA, and I was looking for a way to draw every object while saving only the local transformation of the object. This seems a bit like glPushMatrix. If such a function exists I can just push a matrix for every node and then call the draw function for all its children.

The whole idea is to avoid passing parent transformations to children. Is there anyway to do so?

sentences:
Pick a color and then Chop image with that color into 7 easy pieces I have an image with 8 colors - (ROYGBIV and white) - I want to create 7 images - each has only one of the colors in the resulting image. I can do that fairly easily in GIMP.

Next I need to chop each of the 7 images into 7 layers - 7 pieces across with identical widths - with full height.

Finally I need to overlay the 7 layers on top of each other and see the resulting locations of the selected color.

Any ideas how to automate this image processing?

sentences:
Using textureGrad for anisotropic integration approximation I'm trying to develop a real time rendering method using real time acquired envmap (cubemap) for lightning.

This implies that my envmap can change as often as every frame and I therefore cannot use any method base on precomputation of the envmap (such as convolution with BRDF...)

So far my method worked well with Phong BRDF. For specular contribution I direclty read the value in my sampleCube and I use mipmap levels + linear filter for simulating the roughtness of the material considered:

int size                = textureSize(envmap, 0).x;
float specular_level    = log2(size * sqrt(3.0)) - 0.5 * log2(ns + 1);
vec3 env_specular       = ks * specular_color * textureLod(envmap, l_g, specular_level);

From this method I would like to upgrade to a microfacet based BRDF. I already have algorithm for evaluating the shape (including anisotropic direction) of the reflection but I cannot manage to read the values I want in my sampleCube.

I believe I have to use

textureGrad(envmap, l_g, X, Y);

with l_g being the reflection direction in global space but I cannot manage to find which values to give to X and Y in order to correctly specify the area I want to consider.

What value should I give to X and Y in orther for

textureGrad(envmap, l_g, X, Y);

to give the same result as

textureLod(envmap, l_g, specular_level);

sentences:
Should I care about CPU affinity of threads? I am currently developing a rendering engine, which I plan to use for creating games. The engine makes heavy use of multithreading; I have a thread for OpenGL rendering, a thread for updating, a thread for processing user input, a thread for audio, etc. I have heavily tested it, and the threads work like clockwork. The multithreading approach has shown to be faster, more robust and flexible on a multicore processor, which I verified by profiling.

However, something which I have not considered is CPU-core affinity for threads. Should I care about it? What benefits does pinning threads provide, and to which CPU core do I pin which thread?

sentences:
glsl Expected token ')', found 'identifier' with function mix I have a Fragment shader that contains:

[...]
float c = texture2D(tex, tc).a;
float alpha = mix(0.0f, 1.0f, c);
gl_FragColor = vec4(1, 1, 1, alpha) * color;

This works fine on my desktop and Nexus 5. However I get an exception while running on a Wiko mobile:

0:22: L0001: Expected token ')', found 'identifier'

Line 22 is the line containing the mix function.

What I'm doing wrong?

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:
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 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 find all shortest paths using A*? It is possible for A* Path Finding to return all the shortest paths given a graph/map?

For example, given the map below:

-----------
--a--X--b--
-----------

The said map can return four (4) distinct path.

-----1-----
--a11X11b--
-----------

-----------
--a22X22b--
-----2-----

----333----
--a3-X-3b--
-----------

-----------
--a4-X-4b--
----444----

The paths follow the Manhattan Heuristic and a Eight (8) directional transition with a default G-value of 1.0f for testing.

The question given the Pseudocode of A* will only return me one (1) of the four (4) distinct paths which I wish to return all four (4) paths instead.

sentences:
How to make walls opaque in PuzzleScript On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player passes below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player. And adding the rule

[ > Eyeball | ... | Wall | ... | Player ] -> [ Eyeball | ... | Wall | ... | Player ]

in an attempt to correct the movement doesn't work as two ellipses in a single match pattern isn't allowed.

sentences:
Difference between reflection mapping and raytracing Both methods involve casting a ray unto the reflecting object. It will be reflected. In reflection mapping - the intersection of this reflected ray with the environment map (texture) will yield the result.

Isn't it the same for ray-tracing, though? Or is ray-tracing classified only as ray-tracing if it works with the real 3D geometry in the scene (not pre-computed images).

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:
Linking error at tessellation shaders in GLSL I'm testing the triangle tessellation from the link http://prideout.net/blog/?p=48#shaders . All the shader are compiled correctly, but when I try to link the program using the command:

glLinkProgram(programID);

I got the following error:

Tessellation control info
(0): error C6029: No input primitive type
----------------------------------------
Tessellation evaluation info
(0): error c7005: No tessellation primitive mode specified
-----------------------------------------------------------
Geometry info
(0): error C6022: No input primitive type
(0): error C6029: No ouput primitive type
----------------------------------------
Not valid

It's so strange I declare output for TC Shader using command:

layout(vertices = 3) out;

And input layout for TE shader using command:

layout(triangles, equal_spacing, cw) in;

Why I still got this error?
I hope to see you answer about it.

I put my shaders in below:

Vertex shader:

#version 410 core

in vec4 Position;
out vec3 vPosition;

void main()
{
    vPosition = Position.xyz;
}

TC shader:

#version 410 core

layout(vertices = 3) out;
in vec3 vPosition[];
out vec3 tcPosition[];

#define ID gl_InvocationID

void main()
{
    float TessLevelInner = 3;
    float TessLevelOuter = 2;
    tcPosition[ID] = vPosition[ID];
    if (ID == 0) {
        gl_TessLevelInner[0] = TessLevelInner;
        gl_TessLevelOuter[0] = TessLevelOuter;
        gl_TessLevelOuter[1] = TessLevelOuter;
        gl_TessLevelOuter[2] = TessLevelOuter;
    }
}

TE Shader:

#version 410 core
//TessEval

layout(triangles, equal_spacing, cw) in;
in vec3 tcPosition[];
out vec3 tePosition;
out vec3 tePatchDistance;
uniform mat4 Projection;
uniform mat4 Modelview;

void main()
{
    vec3 p0 = gl_TessCoord.x * tcPosition[0];
    vec3 p1 = gl_TessCoord.y * tcPosition[1];
    vec3 p2 = gl_TessCoord.z * tcPosition[2];
    tePatchDistance = gl_TessCoord;
    tePosition = normalize(p0 + p1 + p2);
    gl_Position = Projection * Modelview * vec4(tePosition, 1);
}

Geometry shader:

#version 410 core
//geometry shader
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in vec3 tePosition[3];
in vec3 tePatchDistance[3];
out vec3 gFacetNormal;
out vec3 gPatchDistance;
out vec3 gTriDistance;
uniform mat4 Modelview;
uniform mat3 NormalMatrix;

void main()
{
    vec3 A = tePosition[2] - tePosition[0];
    vec3 B = tePosition[1] - tePosition[0];
    gFacetNormal = NormalMatrix * normalize(cross(A, B));

    gPatchDistance = tePatchDistance[0];
    gTriDistance = vec3(1, 0, 0);
    gl_Position = gl_in[0].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[1];
    gTriDistance = vec3(0, 1, 0);
    gl_Position = gl_in[1].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[2];
    gTriDistance = vec3(0, 0, 1);
    gl_Position = gl_in[2].gl_Position; EmitVertex();

    EndPrimitive();
}

Fragment Shader:

#version 410 core
//fragment shader
out vec4 FragColor;
in vec3 gFacetNormal;
in vec3 gTriDistance;
in vec3 gPatchDistance;
in float gPrimitive;
uniform vec3 LightPosition;

float amplify(float d, float scale, float offset)
{
    d = scale * d + offset;
    d = clamp(d, 0, 1);
    d = 1 - exp2(-2*d*d);
    return d;
}

void main()
{
    vec3 AmbientMaterial = vec3(0.04f, 0.04f, 0.04f);
    vec3 DiffuseMaterial = vec3(0, 0.75, 0.75);
vec3 LightPosition = vec3(0.25, 0.25, 1);
    vec3 N = normalize(gFacetNormal);
    vec3 L = LightPosition;
    float df = abs(dot(N, L));
    vec3 color = AmbientMaterial + df * DiffuseMaterial;

    float d1 = min(min(gTriDistance.x, gTriDistance.y), gTriDistance.z);
    float d2 = min(min(gPatchDistance.x, gPatchDistance.y), gPatchDistance.z);
    color = amplify(d1, 40, -0.5) * amplify(d2, 60, -0.5) * color;

    FragColor = vec4(color, 1.0);
}

sentences: Is it safe to use Sleep() in game loop (on Windows)? Is it safe to use Sleep() function on Windows in game loop (C++)? I want to have fixed frame rate.

sentences:
How can I quickly check if my sprite tiles well? I am trying to create tilemap sprites that tile nicely, but checking how well they tile is really cumbersome.

Ideally, I'd like to have an image editor that shows a layout like this, so I could see if it tiles well without a manual check:

     [img]
[img][img][img]
     [img]

What programs can do this, or how can I otherwise make this easier?

sentences:
Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls? I've got this NPC walking around and I'm trying to create a cone to represent their line of sight, including how it would be blocked by buildings, similar to how Nicky Case has implemented it as described here: https://ncase.me/sight-and-light/

My main problem with this, right now, is that it seems like I'm not detecting collisions between my 2D box colliders and Physics2D.Raycast when I would expect to much of the time. The green rays in the image below are NOT colliding (this is fine on the corners, I don't really care, but when the rays are going straight through walls, that's a big problem for me). Red rays are colliding.

Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls?

I believe everything is in the same z-plane and has the correct collision matrix in place.

![
]image of my NPC and raycasts from them at various points along their path

    List<UnityEngine.Vector2> endPoints = new List<UnityEngine.Vector2>();
    GameObject[] corners = GameObject.FindGameObjectsWithTag("verticies");
    //corners MUST BE WORLD-ORIENTED!

    for(int i = 0; i < corners.Length; i++) {
        UnityEngine.Vector2 corner = new UnityEngine.Vector2(corners[i].transform.position.x, corners[i].transform.position.y);
        RaycastHit2D endPoint = Physics2D.Raycast(this.transform.position, corner);
        if(endPoint.collider != null) {
            endPoints.Add(endPoint.point);
            Debug.DrawLine (this.transform.position, endPoint.point, Color.red);
        } else {
            Debug.DrawLine (this.transform.position, corner, Color.green);
        }
    }

sentences:
Help for choosing a cost effective game server for Flash client I am developing a flash-based game primarily for desktops, to be hosted on facebook platform (like cityville, sims social etc). The gameplay doesn't involve real-time communication between players unlike an mmorpg. Here each player plays in his own world without any knowledge of other online players. I've written almost 95% of the game logic in actionscript on the client side.
I used Smartfox Server pro on the server side (mostly used for getting data from the DB) and the entire server code is an extension written in java. I'm using json as the protocol for communication.
Although I love smartfox server, as an indie, its tough for me to afford the unlimited users license. Morever its limited just to one machine. So I'm looking for an alternative to smartfox server now.

The reason for choosing smartfox server earlier was to use the server properties supported by it.

Server properties on smartfox server take advantage of the socket connection and are essentially server side objects in java which store some data for the player which he can change frequently during the game. And when he logs out of the game, the extension can write out the final state in the DB (I'm using MySQL). This significantly reduces the number of DB UPDATE/INSERT calls made during the game.

I love the way this works since the data is secure as its on the server side and smartfox server is known to be scalable. (although I'm not sure whether this approach is used widely by gaming industry or not, since this is not an mmorpg, I'm putting all player in the lobby).
So my question is whether any of the free and community supported servers like reddwarf, firebase, BlazeDS etc can provide a similar architecture so that I can use server properties without many code changes?

EDIT : I am not insisting on the exact same feature (thats asking too much!), but atleast a viable messaging system on the server so that I can send actionscript objects from the client using json/binary so that its fast. OR maybe some completely different way to implement what I need here. Thanks in advance.

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:
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:
Splitting a prefab into two These hands are in a single prefab. I want to split this into two so that I can make bones for each of them separately and use them with leap motion.

How can make each of these hands as a single prefab? Also, I'm using Unity 2018.

sentences:
How real time volumetric light beam effect could be achieved in opengl? Here is 1.5 mins long video to give you an example of what I meant. From research that I did , regarding lighting effect, usually it is done offline (post-processing) using algorithms like "god rays" or "ray marching" with "volumetric fog" but how to achieve the same result in real time? Do I have to draw a cone? If yes, then should it be only the shell of a cone  meaning   that cone is empty inside? Or even inside of a cone there should be vertices?
Question: What techniques or algorithms are used to achieve such a result?
EDIT 1:
Just an example what I am working on.
Here I do have 2 objects (a human object and a cube). I am using cube to simulate x-ray machine and currently I am trying to added x-ray beam effect which has to be in the shape of pyramid. However I have troubles building the effect of the beam.
My scene:

god ray fragment shader:
#version 330 core
out vec4 FragColor;

in vec2 TexCoords;

uniform vec2 lightPositionOnScreen;
uniform sampler2D screenTexture;

const float exposure = 0.3f;
const float decay = 0.96815 ; // 0.96815
const float density  = 0.926;
const float weight  = 0.1; // 0.587
const int NUM_SAMPLES = 100;

void main()
{
    vec2 deltaTexCoord = vec2(TexCoords.xy - lightPositionOnScreen.xy);
    vec2 texCoord = TexCoords;

    deltaTexCoord *= 1.0f / NUM_SAMPLES * density;

    vec3 color = texture(screenTexture, TexCoords).rgb;

    float illuminationDecay = 1.0f;

    for (int i = 0; i < NUM_SAMPLES; i++)
    {
        texCoord -= deltaTexCoord;

        vec3 sample = texture(screenTexture, texCoord).rgb;

        sample *= illuminationDecay * weight;

        color += sample;

        illuminationDecay *= decay;
    }

    FragColor  = vec4(color * exposure, 1.0);
}

god ray vertex shader:
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;

out vec2 TexCoords;

void main()
{
    gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
    TexCoords = aTexCoords;
}
```

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:
Game engine tool generating game entities I'm writing a game engine with an editor that allows you to create individual components like sprites, fonts, and particles. Then you're able to combine these individual components into what I call an "Entity", to create something more complex and whole.

Currently you can only construct an Entity through code. You derive a new class off of an Entity interface and its derived members are the components you wish it to have (sprites, texts, etc). You can then implement whatever new logic this Entity is supposed to do.

I want to be able to create these entities in my editor, so you're able to simply read a file at run time that loads in all the required components and initializes them to specified values.

I can auto generate the c++ derived Entity class file, then deal with either auto importing it into the code project (or relying on the user to do so). I can directly generate the specified initialization code in the constructor. Makes for easiest access to components when implementing custom logic, and can ensure components' memory is contiguous for better cache.
Or simply have the Entity base class read the file and stores all its required components in a std::vector. Initializing the components will require a robust, hefty function for parsing the file and applying the specified values. Accessing the components when implementing your logic will also be a pain, either remembering their indices, or using string names in a map (bleh).

I like the first auto generating solution better, but I'm afraid of the maintenance and upkeeping it may require. Also I can't just keep overwriting their class source file so I'll need them to separate their custom logic in another source file. Would want a clean way to do that, and possibly a clean way to auto import the source code into the project (The tool knows the source directory, and I guess I could put the whole declaration/definition in a header file).

Any insight on which implementation? Have you ever auto generated C++ code before and regretted it? Or is there an entirely better way?

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:
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:
Data structure to store breakable parts of a mesh I have a wall mesh that is divided into destructible pieces. As it gets destroyed, the wall can collapse into separate objects with physics that can be destroyed as well. (Cut the wall in half horizontally and the top wall becomes a separate object with its own physics).

I already have the adjacency info to know neighbors, but how should I store the pieces so that I can detect when to split them into separate objects?  What kind of tree would suit this and know when the branch was severed and what pieces to make a new object out of?

A test would be to smash a circle out of the wall, and the middle of the circle would fall out and contain only those remaining connected pieces as a new object.

Any examples out there?

Thanks!

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: Open GL ES 2.0 with Android I was wondering if someone could recommended a book that covers both android game developement and OpenGL ES 2.0. I have found some books with OpenGL 1.0, but I have heard that the syntax for OpenGL es 2.0 is totally different.

sentences:
Rotating the playing field. (MonoGame) My maths isn't as good as it should be, I need to pick up some reference books on Trig.

Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point?

It's a 2D system in MonoGame.

I'm going to try to describe the scenario, I can't think of anything quite like it to reference.

Imagine a game screen, you are looking down on the world, with my character in the middle, my character sprite will never change, but if I turn left or right I want everything else to rotate around the central point.  Of course every sprite will have to be moved, and also rotate to account for the spin.

Can someone point me in the right direction?
Thanks.

sentences:
Aggregation of value in GLSL loop results in 0 I'm banging my head against a wall trying to understand why this code is giving me some reasonable results with some visible colors on parts of the screen...

#version 130

in vec2 vTex; // must match name in vertex shader
flat in int iLayer; // must match name in fragment shader

out vec4 fragColor; // first out variable is automatically written to the screen

uniform sampler2DArray tex;
uniform sampler2DArray norm;

#define MAX_LIGHTS 4

struct Light {
    vec3 position;
    vec4 color;
    vec3 falloff;
    vec3 aim;
    float aperture;
    float aperturehardness;
};

uniform Light lights[MAX_LIGHTS];

void main()
{
    vec4 DiffuseColor = texture(tex, vec3(vTex.x, vTex.y, iLayer));
    if (DiffuseColor.a == 0)
        discard;
    vec3 NormalMap = texture(norm, vec3(vTex.x, vTex.y, iLayer)).rgb;
    NormalMap.g = 1.0 - NormalMap.g;
    vec3 FinalColor = vec3(0,0,0);

    for (int i=0; i<MAX_LIGHTS; i++)
    {
        vec3 LightDir = vec3((lights[i].position.xy - gl_FragCoord.xy) / vec2(320.0, 200.0).xy, lights[i].position.z);
        float D = length(LightDir);
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);
        vec3 Diffuse = (lights[i].color.rgb * lights[i].color.a) * max(dot(N, L), 0.0);
        vec3 sd = normalize(vec3(gl_FragCoord.xy, -1.0) - lights[i].position);
        float Attenuation = smoothstep(lights[i].aperture * lights[i].aperturehardness, lights[i].aperture, dot(sd,lights[i].aim))
            / (lights[i].falloff.x + (lights[i].falloff.y*D) + (lights[i].falloff.z*D*D) ) ;
        vec3 Intensity = Diffuse * Attenuation;
        FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity);
    }
    fragColor = vec4(FinalColor, DiffuseColor.a);
}

... but when I change FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity); to FinalColor = clamp(FinalColor + DiffuseColor.rgb * Intensity, vec3(0,0,0), vec3(1,1,1)); everything goes black. Is there something I don't understand about aggregation of variables in loops in GLSL, or about the + operator operating on vectors? By my logic, the changed code should return more brightness than the original code because the changed code would be adding all the values whereas the old code would just be taking the highest one.

sentences:
Unity LoadLevelAdditive and baked light scene settings I am a programmer for a small game.
For our levels, I separated the UI from the level data, so one scene is a scene which contains only the UI, the other scene has all the gameobjects and models and ... the light.

So when loading a level, I first load the UI scene (LoadLevel), then the actual play scene (LoadLevelAdditive).

Now that our graphics guy wants to bake some lights, he is telling me it doesn't work, because whatever his settings in the play scene, Unity ignores them and uses the settings of the UI scene.
He also tells me we cannot just ignore the light settings of the UI scene ...

So my question is, how do I make Unity ignore the light settings of a certain scene (UI scene in my case) or how can I enable a settings override?

Thanks.

sentences:
Tips on how to architect your JavaScript game with classes OK, so I'm creating a <canvas> game using JavaScript (ES6+) features like Classes. It's straight from the vue-cli and webpack.

So, I have these Classes with the following (and such) variables

class Player {
    this.x = 1;
    this.y = 5;
    this.name = 'Guy';
    this.stats = [];
}

class Map {
    this.level = 1;
    this.config = {};
    this.images = Image();
    this.canvas = null;
    this.context = null;
    this.board = []; // From a tileset
}

// POINT OF ENTRY STARTS HERE
// const game = new Game();
class Game {
    this.map = null;
    this.player = null;
    this.assets = Images();
}

The problem I'm having is that sometimes, I'm having to access a created object that was instantiated elsewhere.

For example, this.player was instantiated inside the Game class. But in the Map class, I have the drawMouseSelection method where it needs the current Player's X and Y and Map's board array of tiles.

For example, I pass the all of board[2500] to a static helper method in UI class to get the correct tile hovered on.

** What I am doing**

I just pass the whole object and deal with it as such. Am I passing too big of objects?

sentences:
Limitations of p2p multiplayer games vs client-server I am reading up on multiplayer game architecture.

So far most of the articles i've found deal with the client-server model.

I'd like to know what are the limitations for using a p2p architecture? what "class" of games are possible (or more common) to implement using it? which aren't? and in general, what are its main differences and limitations against the client-server model.

sentences:
Why do I need to offset my aim rotation angle by 90 degrees? I have this simple code to rotate an object (gun barrel) towards a target object (rocket ship).

The gun barrel rotates towards the ship but is always 90 degrees off. I have fixed this in my code as you can see by subtracting 90 degrees from the angle but I would like to know why it is happening and if there is a more elegant solution.

I have checked the rotation of all objects involved but that doesn't seem to change anything. Any help is much appreciated!

using UnityEngine;

public class RotateTowardsObject : MonoBehaviour {

    public float speed = 5f;        // how fast this rotates towards the target
    public Transform target;        // target to follow

    public void Update()
    {
        Vector2 direction = target.position - transform.position;                                               // direction between this position and target position
        float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;                                    // calculate the angle
        angle = angle - 90f;                                                                                // ** Temporary fix(?) for rotation being +90 degrees off
        Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);                                     // create rotation from quaternion
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, speed * Time.deltaTime);            //  set rotation acceleration towards target
    }

sentences:
How to make a cylindrical collider for a cylindrical mesh in UE4 When I am importing Axis Alligend cylindrical mesh in UE4 here is what I get as an automatically generated collider:

But if I rotate the mesh in Maya and again exprot FBX to improt in UE4 here is what I get:

As you can see the object is the same but the collider is much worse. How can I make the same callider in spite of the orientation of the cylinderical mesh?

BTW if I remove collider and do auto convex collider:

I get this:

Which is very good but the problem is that I want it to be generate from the beginning and not later when I edit the mesh collider. How can I achieve that?

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:
texlod() is not supported on ps_4_0_level_9_3 , how can I do a similar operation in this case? Ihave an interesting problem for you guys

I am trying to compile a pixel shader that I ported from GLSL and I am having trouble with a texCUBElod() function that the compiler say's is not supported on the current target, which is ps_4_0_level_9_3  in this case.

Here is the function I am trying to  compile:

uniform samplerCUBE EnvMap;
uniform float EnvMapLod;
float4 FS():COLOR:
{
   float4 color;
  float4 reflected;

   /*
   Processing values
   */

  color = texCUBElod(EnvMap, float4(reflected, EnvMapLod));
  return color
}

The compiler returns this error:

error X4532: texlod not supported on this target

Thank you very much

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:
Triangle-Triangle Intersection Code Does anyone have experience implementing this triangle-triangle intersection code that I found online? I don't understand it. I made a post on Stack Overflow about this and got the advice that:

  From the sample code it seems like what it mean by an edge is the vector from the originating vertex to the end vertex. In the case of a triangle with three vertices C1, C2, C3, the two >input edges would be P1 = C2-C1, P2=C3-C1

I tried feeding it my triangles like that, but ended up with a pretty wildly inaccurate false positive:

Triangle* triangle1 = new Triangle(glm::vec3(-0.323523998f, 1.68264794f, -1.20740700f),
        glm::vec3(-0.478354007f, 1.68264794f, -1.15484905f),
        glm::vec3(-0.465537012f, 1.80764794f, -1.12390494f));
Triangle* triangle2 = new Triangle(glm::vec3(1.00000000f, -0.682647943f, -0.999998987f),
        glm::vec3(1.00000000f, -2.68264794f, -1.00000000f),
        glm::vec3(-1.00000000f, -0.682647943f, -1.00000000f));
collisionDetector.checkForCollision(triangle1, triangle2)

returned true, with the collisionDetector being a wrapper for this function and checkForCollision defined as:

bool TriangleTriangleCollision::checkForCollision(Triangle* triangle1, Triangle* triangle2)
{
    return checkForCollision(triangle1->_vertex0, triangle1->_vertex1, triangle1->_vertex2,
        triangle2->_vertex0, triangle2->_vertex1, triangle2->_vertex2);
}

bool TriangleTriangleCollision::checkForCollision(glm::vec3 t1vert0, glm::vec3 t1vert1,
    glm::vec3 t1vert2, glm::vec3 t2vert0, glm::vec3 t2vert1, glm::vec3 t2vert2)
{
    double C1[3], P1[3], P2[3], D1[3], Q1[3], Q2[3];

    glmVecToArray(t1vert0, C1);
    glmVecToArray(t1vert1 - t1vert0, P1);
    glmVecToArray(t1vert2 - t1vert0, P2);

    glmVecToArray(t2vert0, D1);
    glmVecToArray(t2vert1 - t2vert0, Q1);
    glmVecToArray(t2vert2 - t2vert0, Q1);

    return (tr_tri_intersect3D(C1, P1, P2, D1, Q1, Q2) > 0);
}

void TriangleTriangleCollision::glmVecToArray(const glm::vec3 vector, double v[3])
{
    v[0] = vector.x;
    v[1] = vector.y;
    v[2] = vector.z;
}

unless I am wrong, these two triangles are not at all near each other.

If not, does anyone have any reliable triangle-triangle intersection code? I'm on a time crunch working on a collision detection system for a school project and spent all my time implementing the code to weed out triangle-triangle collision detection so I'm going to have to use some code from someone else and just cite it in my program.

sentences:
Changing a single component of a prefab? I'm working on a unity project and I'm looking to show the range of a certain character.

However, the terrain is generated through a script at run time, and considering that the script uses the same prefab for each tile, any modification made to one prefab affects the others as well.

Hence, I'm looking for a method in which I can independently tweak the settings of each prefab. The unit in question is to shoot a ray-cast to determine which tile it is on, and a script would then modify the colour of the neighboring tiles so as to determine the range of the unit.

Any advice on how to achieve this will be highly appreciated.

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:
Pure functional programming and game state Is there a common technique to handle state (in general) in a functional programming language? There are solutions in every (functional) programming language to handle global state, but I want to avoid this as far as I could.

All state in a pure functional manner are function parameters. So I need to put the whole game state (a gigantic hashmap with the world, players, positions, score, assets, enemies, ...)) as a parameter to all functions which wants to manipulate the world on a given input or trigger. The function itself picks the relevant information from the gamestate blob, do something with it, manipulate the gamestate and return the gamestate. But this looks like a poor mans solution for the problem. If I put the whole gamestate into all functions, there is no benefit for me in contrast to global variables or the imperative approach.

I could put just the relevant information into the functions and return the actions which will be taken for the given input. And one single function apply all the actions to the gamestate. But most functions need a lot of "relevant" information. move() need the object position, the velocity, the map for collision, position of all enemys, current health, ... So this approach does not seem to work either.

So my question is how do I handle the massive amount of state in a functional programming language -- especially for game development?

EDIT: There are some game frameworks for building games in Clojure. There approach to solve this problem partially is to thread all objects in the game as "entities" and put it in a huge bag. A gigant main function is holding the screen and the entities and handle events (:on-key-down, :on-init, ...) for this entities and run the main display loop. But this is not the clean solution I am searching for.

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:
Find Minion with shortest path I'm working on a game like Settlers III/IV.
There are buildings which produce goods which have to be gathered by carrier units.

I have to find the carrier with the shortest path to collect the goods.
So far, not a big deal. I simple do a expanding circle, starting from the production building, and choose the first carrier found due it has the shortest direct way.

If this carrier can't reach the building (e.g. is on another island or so), the search goes on.

But now take a look at my awesome paintskills.
The black line is an obstacle which my minions can't get over.
Red lines are direct paths, blue is absolute path.

The first carrier is A, but it's direct way is blocked.
Second is B, direct way blocked as well and third, C, has the longest path of all.

As you easily can guess, I want to sent B due it has the shortest absolute path.

What's the lowest affort do determinate if a carrier with blocked direct way has a shorter way then a carrier with a longer direct way?

I'd love to have some lecture about that, but I only was able to find (a lot) of pathfinding where the unit itself searches the path, not the target searches the unit with shortest path.

Edit:
Simply trying out until the minion with shortest path is found is no solution.
I don't want to make it stuttering on a i7 or so. Settler 3 is a 17 years old game and somehow they have implemented such a functionality without needing over 9000 gigahertz.
If you have any idea which involves routing tables or whatever, I'm happy.
Goal is simply to find the minion which could arrive as fastest, in the shortest time possible. Not a big deal if therefore 200mb of routing table have to be generated or whatever.

sentences:
Bouncy Ball stops without enough force I am building a 3D Pong clone and want to implement a frictionless bouncing ball.

These are the steps i took:

Create a box in which the ball can bounce, consisting of standard cubic objects.
Create a ball using a spherical object
Add a Rigidbody to said ball (Mass: 1, Drag: 0, A.Drag: 0, no Gravity)
Add a bouncy Physics Material to the balls Sphere Collider (D.Friction: 0, S.Friction: 0, Bounciness: 1, Fraction Combine: min, Bounce Combine: max)
Add a script to the ball that adds force to the ball on start:

Script Snippet:

void Start() {
    this.getComponent<RigidBody>().addForce(0, 0, 100);
}

When i play the scene, the ball will fly towards the wall and then stop. If i change the added force to (0,0,101) it works as intended. If i lower the mass of the ball and use the old force (0,0,100) it also works. But it will always stop at the wall, if the added force is <= mass*100.

What am i missing?

sentences:
Issue with Sorting Layers with an NPC and Tilemap I have a weird thing happening, that I can't quite explain.  I have two scenes, my starting town, and an Arcanist's shop.  When I go into the Arcanist's Shop, the Arcanist NPC stays on the same sorting layer (background layer 0) as my checkered tiles, and the table is background layer 1.  When I start the game, the NPC will switch between being "behind" the table, or on top of it whenever I reenter the Arcanist's Shop scene.  It seems to switch between background layer 0 and 1 with no cause.

I've double checked my sorting layers, they're all where they should be.  I've checked the camera's culling mask, it's fine.  I've checked to see if there are any weird components on anything in my shop scene, and there aren't

See the image attached, this is the same instance of the game, just different times when I enter the Arcanist's Shop.

Screenshot of my tilemap setup:

sentences:
Controlling the movement of player by sprite using Mouse I want to move the player by pressing down on the mouse and moving around by dragging. The player won't move to the position of the mouse. Instead it should be relative to the players current position.

https://youtu.be/oGSpX6GEYa0?t=5m55s

The way this works, your finger can be anywhere on the screen, and when you move down, the player moves down. This is what I have so far, but it's not as elegant as I want it to be. For example, if your mouse is not moving, it still applies acceleration.

public static inline var EASING:Float = 0.1;

private var mouseX:Float;
private var mouseY:Float;
private var vx:Float;
private var vy:Float;
private var distance:Float;

/**
 * Function that is called once every frame.
 */
override public function update(elapsed:Float):Void
{
    if (canMove == false) {
        return;
    }

    if (FlxG.mouse.justPressed) {
        this.mouseX = FlxG.mouse.screenX;
        this.mouseY = FlxG.mouse.screenY;
    }

    // if we are pressing down, we should move ronnie
    if (FlxG.mouse.pressed)
    {
        vx = getVelocityX();
        vy = getVelocityY();
        distance = getDistance(vx, vy);

        if (distance > 0) {
            this.x += vx * EASING;
            this.y += vy * EASING;
        }

    }

    if (FlxG.mouse.justReleased) {
        //
    }

    super.update(elapsed);
}

/**
 *
 * @return
 */
function getVelocityX():Float
{
    return FlxG.mouse.screenX - this.mouseX;
}

/**
 *
 * @return
 */
function getVelocityY():Float
{
    return FlxG.mouse.screenY - this.mouseY;
}

/**
 * Return distance
 *
 * @return
 */
function getDistance(vx:Float, vy:Float):Float
{
    return Math.sqrt(vx * vx + vy * vy);
}

sentences:
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:
How do I get the position and rotation of an animated object in Unity? I have this object which is being animated, the animation moves a arm and hand. I want it to look like it's holding something but I can't move the object to the hand because even though the animation appears to move the world position of the animation object stays the same, the objects parent is the hand but it's still not moving to it. So how do I move the object to the animations hand while it's being animated in unity?

Maybe this could help to visualize what my problem is:

I found another way around the problem: attached the object as a child of the bone instead of the hand mesh. I still don't know why it didn't move with the hand.

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:
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:
Fuzzy State Logic or Finite State Machine for AI My question is regarding the use of fuzzy state logic and finite state machine with AI. What I would like to know is what the key benefits are for both and also some examples of situations where you might want to use a particular state machine. My main areas of interest are the questions the follow.

Which is better for group AI?
Which is better for individual AI?
Which is more efficient?

Also some links to any demos of each that exist would be really cool!

Thank you all who answer/comment!

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 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:
Unity Animator animations fail to play only when triggered by user input I have a unity animator setup like so. When the game runs, I can trigger each state in the state machine with user input. I can use HasExitTime flag to trigger the animation, and it will play through and loop infinitely as expected.
However, when I try to use the GearChange trigger, the state machine progress bar plays, the correct box is triggered, but the animation itself doesn't play! I'm at a total loss as to what the problem is here, as everything else is exactly the same, minus the user input.
The console isn't showing any errors, the animation simply doesn't respond to the state machine. What am I missing here?
Unity version 2020.1.0f1
So I deleted the animator, and setup everything again the exact same way. Now the animation won't play, period. The state machine progress bars are still triggered as expected, but the animation won't play.
In the transition preview, the animation won't play there either.

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 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:
What methods do game hacks use to counter anti hack systems? In popular multiplayer first person shooter games, there are often hacks such as Aimbot, Noclip, Speed, and other similar hacks which I know game developers deploy anti hack features to combat, but, wanting to know why some of these hacks are able to get past these systems, I looked up a hack for the game I'm currently playing and they claim to deploy "counter measures" against the anti hack systems.

My question is, when everything happening is being seen by the game server, how can hacks avoid the anti-hack system? Movement that's too fast for example seems impossible to hide. Moving through walls also seems impossible to hide. Finally aimbot is a difficult one, maybe there's no very good solution to detecting it, if the hack developer, for example, purposely makes it imperfect.

My question to game developers is: How can anti hack systems fundamentally detect speed, noclip, and aimbot hacks, and how can hack developers fundamentally deploy counter measures against systems to detect those three types of hacks?

sentences:
Low traffic client synchronization with server in MMO I am implementing MMO where player flies in space on his starship controlling it with arrow keys and cooperate with other players.

I want to implement it so that player will be able to dodge his ship from rocket or something else, so I am trying to predict whole game state on client side using the same world simulating algorithm as server use. That game world is written on C# and will be called within client directly (it's written on Unity3D) and through CLR on C++ server (under Linux). Connection through UDP.

Problem is how to maintain, for example, 1000 players within single map (exclusing all other game objects, mobs...):
Let's say I will:

synchronize server with clients 50 times per second
send to each client states of just that game objects (and players) which he is able to see (within some radius)
have to send 100 objects to each player within his view radius
must send averagely 50 bytes per game object (it's id, x,y coords, rotation, state...)

so, it will need to have such network bandwidth: 1000 (clients) * 50 (times per second) * 100 (objects to send to each player) * 50 (bytes per object) = 250 000 000 bytes per second! It's impossible!

Is it possible to reduce this value somehow? For example let clients to fully simulate their game worlds (for a long period of time) and send them just inputs of other clients and synchronize game worlds, let's say, each several seconds but it will cause weird desynchronization issues at leash because of float computations.

Anyway, how such games are programmed in common way? Thank you.

sentences:
Making more complicated systems(entity-component-system model question) I'm using a model where entities are collections of components and components are just data. All the logic goes into systems which operate on components. Making basic systems(for Rendering and handling collision) was easy. But how do I do more compilcated systems? For example, in a CollisionSystem I can check if entity A collides with entity B. I have this code in CollisionSystem for checking if B damages A:

if(collides(a, b)) {
HealthComponent* hc = a->get<HealthComponent();
hc.reduceHealth(b->get<DamageComponent>()->getDamage());

But I feel that this code shouldn't belong to Collision system. Where should code like this be and which additional systems should I create to make this code generic?

sentences:
Collisions between sprites in SpriteKit I'm making a game in XCode using SpriteKit. The game has a player and different types of projectiles that he has to avoid. When the player collides with the projectiles, the score changes and the projectile disappears. However, when two projectiles collide, they kind of bounce away.
I want to make that every time two projectiles collide, they act like nothing happened and they keep going in their original path. What should I do?

*Note: This is not the whole code, it's just what matters.

    import SpriteKit

    struct Physics {
        static let player : UInt32 = 1
        static let missileOne : UInt32 = 2
        static let missileTwo : UInt32 = 3
    }

class GameScene: SKScene, SKPhysicsContactDelegate {

    var player = SKSpriteNode(imageNamed: "p1.png")

    override func didMoveToView(view: SKView) {

        physicsWorld.contactDelegate = self

        player.position = CGPointMake(self.size.width/2, self.size.height/5)
        player.physicsBody = SKPhysicsBody(rectangleOfSize: player.size)
        player.physicsBody?.affectedByGravity = false
        player.physicsBody?.dynamic = false
        player.physicsBody?.categoryBitMask = Physics.player
        player.physicsBody?.collisionBitMask = Physics.missileOne
        player.physicsBody?.collisionBitMask = Physics.missileTwo

        var missileOneTimer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("SpawnMissileOne"), userInfo: nil, repeats: true)
        var missileTwoTimer = NSTimer.scheduledTimerWithTimeInterval(1.2, target: self, selector: Selector("SpawnMissileTwo"), userInfo: nil, repeats: true)

        self.addChild(player)
    }

    //When contact happens
func didBeginContact(contact: SKPhysicsContact) {
    var firstBody : SKPhysicsBody = contact.bodyA
    var secondBody : SKPhysicsBody = contact.bodyB

    if ((firstBody.categoryBitMask == Physics.player) && (secondBody.categoryBitMask == Physics.missileOne)) {

        CollisionWithMissileOne(firstBody.node as SKSpriteNode, missileOne: secondBody.node as SKSpriteNode)

    } else if ((firstBody.categoryBitMask == Physics.player) && (secondBody.categoryBitMask == Physics.missileTwo)){

        CollisionWithMissileTwo(firstBody.node as SKSpriteNode, missileTwo: secondBody.node as SKSpriteNode)

    } else if ((firstBody.categoryBitMask == Physics.missileOne)&&(secondBody.categoryBitMask == Physics.missileTwo)) {

        CollisionBetweenMissiles(firstBody.node as SKSpriteNode, missileTwo: secondBody.node as SKSpriteNode)

        }

    }

//For Player and MissileOne
    func CollisionWithMissileOne(player: SKSpriteNode, missileOne: SKSpriteNode) {

        missileOne.removeFromParent()
    }

//For Player and MissileTwo
    func CollisionWithMissileOne(player: SKSpriteNode, missileTwo: SKSpriteNode) {

        missileTwo.removeFromParent()
    }

//For MissileOne and MissileTwo
        func CollisionBetweenMissiles(missileOne: SKSpriteNode, missileTwo: SKSpriteNode) {

        ???WHAT SHOULD I CODE HERE???

    }

}

sentences:
Unity3D - Resources load to materials, how to? I think is a simple question, but I don't know nothing about it:

I have an created material in my materials folder, I just want to apply it to the GameObject by script.

I am trying

this.GetComponent<Renderer>().materials[0]=Resources.Load("Test", typeof(Material)) as Material;

The material name is Test and it is in materials folder, but the return is always the default material applied to the GameObject, so I think Unity didn't found it.

sentences:
Learning to code first game, few questions on basic game development and 3D I've been programming for a while, and I'm concurrently learning how to make a basic game and slimdx, and wanted to talk to someone to hopefully get a few pointers. I've read that Tetris is the "Hello, world" of game programming, which made sense to me, so I decided to give it a shot.

I've been able to code up a basic version in a few hours, which I'm quite happy with, but I had a few questions about 3D programming. Right now I'm using Direct3D to do display the blocks without any textures (just colored squares). I have a data structure (2d array of bytes, where each byte denotes the presence of a block and its color) which is the "game board," and on every render() call I create a new vertex buffer of the existing squares in the game board, and draw those primitives.

This feels very inefficient, and I wondering what would be the idiomatic way of doing this in a 3D world, with matrix/rotations/translation operations. I know 3D is overkill for such a project, but I want to learn any 3d concepts that I can while I'm doing it. I understand that what you'd usually want to do is keep the same vertices/vertex buffers but manipulate them with matrices to achieve rotations/translations, etc. To do so, I assume what would happen is I'd have one vertex buffer for the "active" piece, since that'll be constantly rotated and moved, and have one vertex buffer for the frozen pieces on the bottom of the board, which is pretty much stationary, but will need to be changed/recreated when the active piece becomes frozen.

Right now I'm just clearing and redrawing on every render call, which seems like the easiest way to do things, although I wonder if there's a more efficient way to deal with changes.

Obviously there are a lot of questions I'm asking here, but if you can even just point me a step or two ahead in terms of how I should be thinking, it'd be great. Thanks

sentences:
Match-three puzzle games algorithm I am trying to write a match-three puzzle game like 'call of Atlantis' myself. The most important algorithm is to find out all possible match-three possibilities. Is there any open source projects that can be referenced? Or any keywords to the algorithm? I am trying to look for a faster algorithm to calculate all possibilities.

Rules:

Diagonals don't count.
The size is 8x8

Thanks.

sentences:
Why do I get this crash when dealing with SDL_Events? I do not know if this is the best way to handle these SDL_Events, but I am attempting to create a very abstract and generic code that will update my game object. I have a Scene which in my case is just a map from a string to a game object that has special functions to Add(string key, gameobject value), Remove(string key), Render(), and Update(SDL_Event& event). I think this last method is the problem.
Scene.cpp
void Scene::Update(SDL_Event& ev)
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Update(ev); //where the game crashes
    }
}

void Scene::Render()
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Render();
    }
}

void Scene::Add(const std::string& key, GameObject& value)
{
    x_ObjectDictionary.insert(std::pair<std::string, GameObject&>(key, value));
}

GameObject& Scene::Get(const std::string& key)
{
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    return iterator->second;
}

GameObject& Scene::Remove(const std::string& key)
{
    GameObject removed;
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    removed = iterator->second;
    x_ObjectDictionary.erase(iterator);
    return removed;
}

This iterates my map and updates all of the GameObjects. My game object update method is defined like this in the header file:
GameObject.h
class GameObject
{
public:
    GameObject() {}
    virtual ~GameObject() {}

    virtual void Update(SDL_Event& ev){}

    virtual void Render(){}

    virtual void Destroy(){}

};

Now, I created a scene. This Scene is called Splash and extends Scene properly. I created it like so
void Splash::CreateScene()
{
    Add("something", GameObject());
}

Every time I execute/debug my project now, my program "breaks" on the it->second.Update(ev); line and inside the console after I stop "debugging" the message says something along the lines of Exception thrown at 0x00007FF7CB457024 in XXXXXX.exe: 0xC0000005: Access violation reading location 0x00001CFA67BC13F9.
Am I going about this completely incorrectly? Or did I just make a stupid mistake?

sentences:
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:
Split a region into arrays based on point region I have an array of points forming a grid. I want to split this array into multiple arrays that each contain a region of point. Let's say each point as a value like on this image

The points having the same value and being connected would go into the same array. If it was only an array of all the 8 or all the 7, it wou;d be easy, but in thsi case I need the arrays to contain connected equal values. For example, the purple region of 1 would make an array, the 8 region on the left would make an array and the one on the right too, but a different one.
I just don't know how to use a loop to navigate in the grid and affect each point to an array based on they relation with other points of the same value. As this is the objective, think of the values as biome that I want to assign to an array.

sentences:
Object has its heading stored as Euler angles. After it makes a turn, how do I calculate the new angles? Assume said object is an aircraft. I store three angles (in degrees) that describe where it's headed: yaw, pitch and roll - in that order. Let's say the plane is flying vertically, upwards. The angles would then be: (0, 90, 0). Then, I command the plane to turn left; this results in the following angles: (0, 0, 90).

Given the plane's current angles and a command (turn left, right, up, or down), how can I calculate its new angles?
Would it be easier if I were using a directional vector and an extra "up" vector (i.e., the normal of the surface that cuts the plane in half, horizontally)?

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:
Calculating the weight of an object irrespective of the triangle or vertices count in Unity I have a meat piece which I want to weigh. Now there can be anything like fish, cheese, or other items that we can cut and measure. I want the weight to be determined by myself instead of determining from getting the surface of the item as it varies with different tris count.
Currently, I am calculating the weight from the following code.
public static float CalculateSurfaceArea(Mesh mesh)
{
    var triangles = mesh.triangles;
    var vertices = mesh.vertices;

    double sum = 0.0;

    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;

        sum += Vector3.Cross(a, b).magnitude;
    }
    // weightMultiplier is a constant value for getting a reasonable weight value.
    return (float)(sum / 2.0) * weightMultiplier;
}

So if there's a meat piece like bellow and I want it to be a weight of let's say 3kg(6.6lb)

then when I cut it into half it should give me values respectively (1.5kg).

So I want the weighing factor to be in my control so that if in the future we have really detailed high poly items the weight shouldn't get affected by that.

sentences:
sfml drawing text c++ using visual studio 2015 and SFML .
relevant code:

sf::Font font;
font.loadFromFile("Arial.ttf");
sf::Text text;
text.setFont(font);
text.setString("hello ");
_mainWindow.draw(text);

It doesn't display the text.
I put a breakpoint, the font gets the correct value.
but the text's string stays empty.
for the main window I get:
+       _mainWindow     sf::RenderWindow

Can anybody help?

thanks

sentences:
What should I enter in Debug user and Release User in android export section in Godot? I just want to export to android.

I have tried by adding my name, I got install error.

sentences:
What are the tools, programming languages and development processes of AAA games? Only thing I am able to find about "big" games like ac, hl, bf, cod is engine used to run the game. But I am interested in what software development methodology, programming and scripting languages were used. As well as tools for creating models, music, animations and other media. Further, were the team team organisations and so on for a certain game (or game series).
Is this information even available to the public?

sentences:
Converting designs from photoshop/flash/after effects into code I work as part of a two person team, I am the developer and my partner is the designer. We are currently having great difficulty working out the best way to convert his work into the actual app. We prototype all our animation in either Flash or After Effects and then I implement it into the actual application.

The implementation is not a problem, but converting the information is what we are struggling to do efficiently. We have tried making large story boards that show the change in position/scale/rotation and the time for each of these tweens but they are time consuming to make. Currently I am running an After Effects trial and just dissecting the info straight from his design but my trial will run out soon.

Just wondering if anyone can shed some light on how they do it or what is the standard practice in the industry?

Thanks

sentences:
What steps should I take to learn level design/programming? I'm still in high school, and I've been playing games for 12 years, and I've always wanted to eventually learn level development and design, and programming. However I'm no good at art and as of now have absolutely no education what-so-ever about either of these things.

I was wondering which fields of study should I branch into in order to learn these things? Is it even reasonable to attempt to learn level creation if I'm no good at art anyway?

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

sentences:
Do you need special permission to personify companies as characters? in the Hyperdimension Neptunia series a number of human characters are personifications of games companies ie.

Compa = Compile Heart
Red = Red Entertainment
Tekken = Namco
Falcom = Nihon Falcom
Cave = CAVE Interactive
IF (Iffy) = Idea Factory
Nippon Ichi-chan/Nisa = Nippon Ichi Software/Nippon Ichi Software America

I am wondering if the creators of Hyperdimension Neptunia had to get special permission/licences from companies to personify them in the game? (ie. a developer personifying Valve or Square in their own game)

sentences:
Need help with objects moving toward the player I am making a 2D game with simple "gravity": everything is just pulled toward 0,0. The speed at which they accelerate towards it is GravityAcceleration up to MaxGSpeed.

I also want the player to be able to pull these objects too. I'm using Magnitism and MaxSpeed to deal with the acceleration and speed at which the objects move towards the player.

However, it doesn't work, and I have no idea of what I'm doing wrong. The MoveToPlayer function is only called if the player is within 500 units of the object.

Can anyone see where I'm going wrong?

public virtual void Update(GameTime gameTime)
{
    var vectorToSun = new Vector2(0, 0) - Position;
    var distanceToCenter = vectorToSun.Length();

    vectorToSun.Normalize();
    _velocity += vectorToSun * GravityAcceleration * (float)gameTime.ElapsedGameTime.TotalSeconds;

    if (_velocity.Length() > MaxGSpeed)
    {
        _velocity.Normalize();
        _velocity *= MaxGSpeed;
    }

    Position += _velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

    rotation += 0.003f;
}

public void MoveToPlayer(Vector2 playerPos, GameTime gameTime)
{
    var vectorToPlayer = playerPos - Position;

    vectorToPlayer.Normalize();
    _velocity += vectorToPlayer * Magnitism * (float)gameTime.ElapsedGameTime.TotalSeconds;

    if (_velocity.Length() > MaxSpeed)
    {
        _velocity.Normalize();
        _velocity *= MaxSpeed;
    }
}

sentences: What is the best way to implement host-migration application design? I'm trying to wrap my head around how any one of the clients could become a new host should the current host leave the game. I'm not looking for any code, but more of a high level application design of how a feature like this would work.

sentences: b2DistanceJoint with frequency equal to 0 vs b2WeldJoint What is the difference of b2WeldJoint and b2DistanceJoint? They both have frequency and also when you put frequency of Distance Joint to 0 it acts like Weld Joint. It seams that you can create Distance Joint effect using Weld Jonit and vice versa.

sentences:
Which style/technique is more time efficient for an inexperienced artists? For a top-view 2D mobile game where you have to create and animate humanoids (human, golems) and "objects" like fire, boulders, levers, etc.

Considering the artist has no prior experience with drawing, nor with any related software.

sentences:
Orientation changed event in Unity3D? I'd like to listen to orientation change events, so for example my UI layout or the components themselves can be changed.
All I've found is that I should check the value of Screen.orientation every frame, and check if it has changed since previous frame.
But this isn't really efficient, and I wonder why doesn't Unity provide an event for this.
This asset seems to have what I need. Anyone knows how is it implemented?
As a last resort I could make a singleton behaviour which starts a coroutine which checks every X seconds whether it has changed, and if it has, I fire an event. But this still seems like a suboptimal solution.

sentences:
Fast mesh collision 3D (C# XNA) I'm trying to write a simple program where a 3D landscape can be walked about with a basic camera. However, I've found it very difficult to do even simple collisions with my terrain. I'm wondering if anybody has encountered a similar issue before and possibly might know how to solve it a better way?

I've seen a lot of 3D collision questions, but I noticed that a lot of the answers are to approximate the mesh objects with spheres or cubes - however I find this impractical with something as complicated as terrain. I'm using a .fbx model of terrain made with blender, grabbing its entire list of vertices, finding the one closest to the camera, and trying to set the camera Y to the vertex Y + a constant. However, I keep running into a bunch of problems such as:

finding the closest vertex is difficult because if the model is too big, distances measured between the camera and the vertices will overflow some variable types, but if the model is too small, distances will often be indistinguishable and inaccurate.
my method is very slow, because the terrain has a lot of detail, so I find myself only checking every 20 vertices or so.
I end up with very bad collision detection because my method appears to be inexact and malfunctioning.

Here's some of my code, if anybody wants to see what I'm doing... (btw the d_check array is a list of vertices of the model, and C is my camera.)

    private void BasicCameraCollisionTest(int radius, int offset)
    {
        float smallest_d = float.MaxValue;
        float c_d = 0;
        int i_cache = 0;
        for (int i = 0; i < d_check.Length; i+=20 )
        {
            c_d = Vector2.Distance(new Vector2(d_check[i].X, d_check[i].Z), new Vector2(C.position.X, C.position.Y));

            if (c_d < smallest_d)
            {
                smallest_d = c_d;
                i_cache = i;
            }
        }
        C.position = Vector3.Lerp(C.position, new Vector3(C.position.X, d_check[i_cache].Y + radius + offset, C.position.Z), 0.02f);
    }

If anybody could point me in the right direction, I'd be very grateful. Thanks!

sentences:
How can I emulate Diablo 3's Isometric view using Perspective? Using DX11, SimpleMath I am building a isometric game like Diablo 3 in 3D and I want to use a perspective camera that emulates their top down view.

Projection Matrix: CreatePerspectiveFieldOfView(1, width/height, 0.1f, 100.0f);

But after this I am a bit unsure how I am suppose to rotate the camera. I assume I could just do p - Vector3(10, 10, 10) to get a 45 degree angle at any given p.

How do I properly position, and rotate the camera and point it at position p, to mimic Diablo 3 view?

sentences: 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:
Java High-Resolution Timer for a simple game I want to work on a model of some kind of simple shape shooter game I would develop for either the desktop or the Android, using the libGDX library. There's something I want to incorporate into the game, and that is a countdown timer with the smallest unit in centiseconds.

The trouble I'm having is which resource to use to incorporate a fully-accurate game timer where it is in sync with real time, meaning that every second on the game timer, when the game is running at full speed, is equal to one second in real time. (I should understand what is a high-resolution timer)

Java's Swing Timer class won't do, and so are the two methods from the static System class. And I'm not very confident about the timer classes I've looked up online, unless I accidentally ran into one of them and never realized it's completely accurate.

I have practiced implementing my own countdown timer except that it ain't synchronized because I'm doing an update for every 10 milliseconds. I asked a similar question on StackOverflow, but I am getting a little too obsessed in trying to find a perfectly good timer.

sentences:
Problems about oriented bounding boxes collision detection I get a question for the following code which detects if two OOBs collide by SAT. The OBBs struct is also listed below.

struct OBB {
Point c; // OBB center point
Vector u[3]; // Local x-, y-, and z-axes
Vector e;  // Positive halfwidth extents of OBB along each axis
}

int TestOBBOBB(OBB &a, OBB &b)
{
float ra, rb;
Matrix33 R, AbsR;
// Compute rotation matrix expressing b in a’s coordinate frame
for(inti=0;i<3;i++)
   for(intj=0;j<3;j++)
      R[i][j] = Dot(a.u[i], b.u[j]);
//Compute translation vector t
Vector t = b.c - a.c;
// Bring translation into a’s coordinate frame
t = Vector(Dot(t, a.u[0]), Dot(t, a.u[2]), Dot(t, a.u[2]));

// Compute common subexpressions. Add in an epsilon term to
// counteract arithmetic errors when two edges are parallel and
// their cross product is (near) null (see text for details)
for(inti=0;i<3;i++)
    for(intj=0;j<3;j++)
        AbsR[i][j] = Abs(R[i][j]) + EPSILON;

// Test axes L=A0,L=A1,L=A2
for(inti=0;i<3;i++) {
    ra = a.e[i];
    rb = b.e[0] * AbsR[i][0] + b.e[1] * AbsR[i][1] + b.e[2] * AbsR[i][2];
    if (Abs(t[i]) > ra + rb) return 0;
}

// Test axes L=B0,L=B1,L=B2
for(inti=0;i<3;i++) {
    ra = a.e[0] * AbsR[0][i] + a.e[1] * AbsR[1][i] + a.e[2] * AbsR[2][i];
    rb = b.e[i];
    if (Abs(t[0] * R[0][i] + t[1] * R[1][i] + t[2] * R[2][i]) > ra + rb) return 0;
}

// Test axis L=A0xB0
ra = a.e[1] * AbsR[2][0] + a.e[2] * AbsR[1][0];
rb = b.e[1] * AbsR[0][2] + b.e[2] * AbsR[0][1];
if (Abs(t[2] * R[1][0] - t[1] * R[2][0]) > ra + rb) return 0;

//reset code are omitted

For the part "Test axes L=A0,L=A1,L=A2",
why do we multiply each b.e[i] by the component from each axis in a's coordinate frame then add the result together?
I know this part want to project the half positive extents onto each axis in a's coordinate frame, but it should do the dot product with the b.e vector and the projected axis, am I wrong?
(that is b.e[0] * AbsR[0][i] + b.e[1] * AbsR[1][i] + b.e[2] * AbsR[2][i])

For the part "Test axes L=B0,L=B1,L=B2",
It seems a.e vector is multiplied by each axis in a's coordinate frame, why don't transform the a.e vector into the b's coordinate frame since they are not at the same coordinate frame?

For the part "Test axis L=A0xB0",
Why can we get ra and rb values by that arithmetic operation?
What does Abs(t[2] * R[1][0] - t[1] * R[2][0] mean?

sentences:
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:
Importance of scripting engine at Cocos2d Game Engine Each Game Engine is different and solves different problems in different ways, so the engine design does vary greatly from engine to engine (even though a lot of principles are shared from engine to engine).

Cocos2D is a great product on it’s own, but it doesn’t expose engine functionality to a scripting Language like Lua, JavaScript etc.

My Question: How much important to integrate a Scripting Engine at Cocos2d?

sentences:
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:
How do I create selectable menu options in C#/XNA? Ok, I have my game's menu system set up. There are 3 screens (Controller Detect Screen, Title Screen, and GamePlay Screen). I wish to improve on this by having the ability for the player to select options on the screen, but I do not know how.

I don't know how to make menu choices that can be highlighted or making transitions from screen to screen rather than having it warp the way it presently does.

sentences: How to export an animation from blender to Ethan (third person character) in unity 5 I've made a human animation in blender with the intention of exporting it into unity to add to the animations of the third person character 'Ethan'. Does any one know how I can export the animation into unity for the third person character and make a trigger for the animation?

sentences:
RK4, Derivatives, Understanding Game Physics Gafferon Games has a great article on RK4 Integration for building physics simulations which can be found here: Integration Basics

Personally my mathematics and physics knowledge could use improvement. I feel comfortable within the realm of vector mathematics, trig, some stats (I've had to use linear line regression formulas for software, etc. ), and basically most things high school level to first year college.

Now to the question, I've read this article, downloaded the associated source and debugged line by line to try and get an understanding of what is happening and still feel like I'm clearly not getting what I'm looking at. I've searched the internet trying to find the "For Dummies" versions, frankly I learn a little differently and staring at formulas all day with the emphasis on memorization isn't going to cut it as I need to understand what is happening so I can be flexible applying it.

So here's what I think I understand so far, but I am hoping someone else can clarify or completely correct me. The RK4 uses a Euler step, then bases that to move forward in time to calculate several more essentially Euler steps(?) and determines using a weighted sum what the best position and velocity is for the next frame?

Furthermore that acceleration method (converted into AS3):

private function acceleration(state:State, time:Number):Number
{
    const k:int = 10;
    const b:int = 1;
    return - k*state.x - b*state.v;
}

takes a constant mass(10) and force(1)? and returns some weird calculation I have no idea why...-mass * position - force * velocity? what?

Then for my last bit of confusion, in the evaluate methods which look like (AS3):

private function evaluateD(initial:State, time:Number, dtime:Number, d:Derivative):Derivative
{
    var state:State = new State();
    state.x = initial.x + d.dx*dtime;
    state.v = initial.v + d.dv*dtime;
    var output:Derivative = new Derivative();
    output.dx = state.v;
    output.dv = acceleration(state, time+dtime);
    return output;
}

We store a new state with the time step, then set a derivative to return...I sort of understand this as it's used in the approximation process, but what is this!:

output.dx = state.v;
output.dv = acceleration(state, time+dtime);

// ok I get we are getting the new velocity since v = a * t, obviously I
// don't what acceleration() is returning though.

We set the derivative output change in position to the states new velocity? Huh?

Lastly this test simulation runs doing this:

var state:State = new State();
state.x = 100;
state.v = 0;

t = 0;
dt = 0.1;

while (Math.abs(state.x)>0.001 || Math.abs(state.v)>0.001)
{
    trace(state.x, state.v);
    integrate(state, t, dt);
    t += dt;
}

So we are setting a new state with a positional value of 100, and a velocity of 0? What is the point of this simulation if we have no velocity...

Anyway, needless to say I'm pretty confused and have drifted off planet Earth. Hoping someone out there can clarify this for me.

sentences:
How did they make the screen move in Dangerous Dave? I've made games in BASIC when I was a child, and I was curious about how the graphics were done in the 1988 version of Dangerous Dave made in C++; especially because they didn't have any worthwhile graphics packages those days.
Remember how when Dave reached the edge of the screen, the entire screen graphic used to move leftward in a sweeping motion? I remember reading that Romero had used a special technique to do that.
I've been wanting to create something like Dave, and was wondering

what graphics package/method they
used for Dave?
and how to make the entire screen
graphic move like they did?

sentences:
How to create an endless scrolling background? I need to add a scrolling background to a my game, the image is 512x512px. It's for a car game with two way traffic and I want to be able to cross over to the opposite side and drive against the traffic too. The game is in portrait mode and I use cocos2d.

How can I make this in the best possible way?

sentences:
How can I deduce my RPG lags for better performance? Okay, so I've started making a game using Khan Academy's Processing JavaScript, and I'm trying to delag it a bit since the framerate is very shaky. So, I've taken the advice of someone, and they told me instead of new object_name(), I could instead use something like object_name.create() by having this code:
Object.constructor.prototype.create = function() {
    var obj = Object.create(this.prototype);
    this.apply(obj, arguments);
    return obj;
};

So, I'm assuming it's helping since the framerate improved a bit, but not at all that much. I've been using a lot of OOP, and people have told me that Khan Academy's memory is acting weird, so it's not as good to use OOP, but I'm used to using it, so I'd like to see what kind of things there could be to help improve my program in framerate. I'm planning to check if the NPCs and enemies are in range, then draw them, but I'm not sure if this would help, because I'm not very familiar with the computers and how fast they would run certain things. Thank you.
For reference, this is my game Quests of a Warrior
This is the comment that someone posted that I happened to see, and that's why I used the object_name.create() for now. Discussion post (expand_key will lead you there)
If you are unfamiliar with Processing JavaScript, you can go to the documentation, although it doesn't include much (Khan Academy version). You'll find it here, but you can also glance at the real Processing JavaScript (notice that some can't be used for Khan Academy purposes) here
EDIT: I've figured out that you can do object pooling! The method shown here uses gEntityObjectPool. Is this in pure JavaScript?

sentences:
LibGDX - how to detect touchUp with GestureListener? I'm making a game and I have implemented GestureListener as my inputprocessor. It came with a bunch of methods such as fling, pan, tap etc etc including touchDown. However, there is no touchUp method!

What I want to do is have something happen when the user does a 'fling', but I want something to happen when the user then takes their finger off the screen after flinging, probably setting a flinging boolean and testing if true when taking finger off the screen.

However, I don't see how I can get a touchUp method into my inputprocessor! Is there any work around to this or an alternative solution?

Thanks!

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:
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: how do I instantiate something with only the y axis rotation matching the instanciators y rotation i'm making a swimming mechanic for my game and i need to instantiate the swim camera under neath the fps player when it hist the water. no mater what I try the swim cam wont have the same y rotation as the fps when its instantiated, and vice versa. what am i doing wrong? here is the scriptInstantiate(swim, new Vector3(transform.position.x, transform.position.y -2, transform.position.z), rotation: transform.rotation=Quaternion.AngleAxis(0,0,0));

sentences:
XNA 4 / Monogame 3d tunnel collision I am trying to collide an aircraft with a FBX tunnel model. I don't know how to create multiple bounding boxes for a tunnel. The tunnel is contains a single mesh. I tried using the triangle picking sample here http://xbox.create.msdn.com/en-US/education/catalog/sample/picking_triangle
I also created a bounding sphere around the tunnel to be able to detect if the aircraft is inside the tunnel. If the ship is inside the tunnel then I check the triangle & ray intersection. I also detect the intersection. I tried changing the rotation and position of the ship when intersection occurred but although I can detect the intersection ship passes through the tunnel surface mostly and my rotation doesn't work well.

I also tried to calculate ray & plane (here it is triangle) reflection as below:

            if (intersection < 0.4f)
            {
                Plane pickedTriangle = new Plane(vertex1, vertex2, vertex3);
                Vector3 reflectionVector = Vector3.Reflect(direction, pickedTriangle.Normal);
                newPosition = modelPosition + direction * gameSpeed * reflectionVector;
                newDirection = reflectionVector;
                tIntersected = true;
            }

As I see newPosition isn't calculated correctly.

My question is; how can I calculate a new position after a ray & plane intersection.

I think this causes the ship sometimes pass the tunnel surface sometimes.
If there is a better way to detect and calculate tunnel collision I'll appreciate it.

Thanks

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:
Best way to organize models with multiple meshes and textures? I have character models which have different parts, ex: upper body, head, lower body; each part is a separate mesh in the same model. Each part has several textures associated with it (diffuse, normal, etc).

I'm wondering if there is a best practice for associating the textures with the meshes, given a .obj file as the model, for example, and .tga files for the textures.

So for instance, making sure the head textures get mapped on to the head object.

One way would be having a separate file for each mesh, and using the file names to associate them with their textures, but that seems impractical.

Is there a nice, clean way to do this, which is both easy to program (importing and rendering) and easy for the artist?

sentences:
Godot / GDscript label text not updating every frame like intended I am very new to Godot and coding in general, so I apologize in advance for any simple mistakes. I am trying to have my text display the variable ammodisplay on my object Marine. When I launch the game, the text sets to 7 (the correct value) but as I play the game and the variable changes, the text does not update with it. Any insight as to how I can fix this? Thanks in advance!
extends Label

var NODE = load("Marine.tscn")
var ammo = NODE.instance()
var ammod = ammo.ammodisplay

func _process(delta):
    text = (str(ammod))

sentences:
Composing Game Metrics So I'm running into a bit of a roadblock with the way I'm currently keeping track of game metrics. By "metrics", I mean little bits of information that I can compose together to get useful information about my game. My primary application for this being so that I can detect certain events in the game and disperse achievements.

The way my current system works, I have metrics represented as a long value, where each bit represents a certain metric... for example, there's a flag for enemies, a flag for the player, a flag for a kill, a flag for each weapon, a flag for when a wave starts, etc, etc. I can then compose these into a single value to tell me things like "an enemy of this type was just killed by this weapon". My achievements controller looks at each metric posted in the last update and I have state machines that transition to the next state based on what metrics are posted.

The problem with this method is... I'm quickly running out of bits to use for my long value. I have plenty more weapons I want to add, so this hard limitation on the number of bits I can use as flags means it's probably time to find a better way to keep track of these.

Does anyone have a recommendation? Preferably one that would require the least amount of effort to refactor my current metrics and achievement systems to integrate?

EDIT: Is there a better term than "metric" to use? I haven't been able to find articles on this topic of game engine design because whenever I use the word "metric", all I find are articles about revenue-related analytical metrics.

sentences:
Debugging Shader Code? I'm writing a game engine, and when I use a perspective camera I get a black screen. I am not going to ask exactly why this is because there would be a lot of code to share and, frankly, I think that's a bit petty a question even to bother you all with.

The trouble is that I don't know how to debug it. All that changes is my projection matrix, and if my projection matrix looks fine, I don't know why it doesn't work. Ideally I'd print out the values of various things as the shader did its calculations, but GLSL inconveniently doesn't have a printf() function.

So my question is: how do I debug my problem? The only thing I can think of is checking as many values as I can client-side and then programming by permutation, but I've done that and gotten nowhere. Is there a way I can see what's happening in the video card? Is there a completely different technique I could be using?

I'm using GLSL version 420 (and features specific to that version), so I don't think that glslDevil is an option, considering that it was last updated in 2010.

EDIT

I managed to solve my problem through some completely unrelated debugging.

sentences:
OpenGL tile rendering Currently I'm trying to render a TileMap using OpenGL 2.1, GLSL 1.2.
I would like to draw every tile in just one draw call.
I use a single texture with all tiles, identifying each one by an index.

The vertex data per tile is:

vec2 worldPos; // the position to transform the tile Quad in world coordinates
vec2 texCoord; // the uv coordinates, calculated using the tile index, by CPU (top-left corner).

But I can't find a way to draw everything with one draw call:
    - The uv coordinates can't be calculated in shader because the vertex shader don't know which corner of the quad it is processing.
    - Can't draw by element because my quad vertex data only contains 4 vertices, store repeated vertices is a memory waste. Only if I could use a separate element buffer just for the vertex (0, 1, 2, 3, 0, 1, ...).

Does someone have any suggestion about how should I proceed?
Thanks!

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:
Scene2D set table cell size in percentage of tables ´s size Is it somehow possible to set Scene2D table cell´s size in percentage of the table?

I would like to have orientation independent menu, with buttons filling let´s say 75% percent of the screen, and also to respond on window resizing (desktop version). I have tried several methods, for example using Value

table.add(button).width(Value.percentWidth(.75F));

but when value.get(actor) is called inside cell, it is supplied with inner button actor not its container (table).

I have also tried to set it in fixed fashion

table.add(button).width(Value.percentWidth(.75F).get(table));

This works fine, but since I set pixel value insted of Value object it is not recalculated upon resizing.

Is there any way to achieve this?

sentences:
using DirectX to generate a sprite sheet I am building a site in HTML5 for my client and it must run on the iPad/iPhone (i.e. Safari on iOS).

They want a 3D effect where they have a simple, yet, specific product they want to show on the site in 3D with user generated data as the texture.

Normally, I would use either flash/silverlight/webgl but these are not supported on iOS.

Also, CSS 3D transforms are close, but since I need a specific shape and size, creating hundreds of div elements and transforming them just wont work in the long run.

My idea, is to use server side code to generate a sprite sheet that could be used on the site to fake the 3D-ness of the object.

What I really lack is the knowledge around DirectX/OpenGL in order to automate this process.

My question is, can I use DirectX/OpenGL from a command line (or programatically) to pass is a model and textures to generate a PNG/JPG sprite sheet of a rotating object?

sentences:
Efficient Collision detection for polygons (fleet) in an RTS I'm trying to make an RTS for android using libgdx. I would like to have collision detection to be able to detect ships inside the range of weapons and collision between my bullets and the ships.

So far my strategy has been to use a PM QuadTree that I coded myself to store every segment of every polygons. A polygon being the hitbox of a ship.

Every frame I clear and add all the segments back in the quadtree. Every segment has a reference to the ship it belongs to. When I add a ship, I add it recursively to the nodes of the quadtree based on the intersection with the bounds of a node.

Detection collision is done by polling every polygon inside a rectangle that look into every node that fit entirely or partially inside the rectangle.

My problem is that adding every ship every frame gives bad result on Android. On Desktop it is fast enough but on Android it can takes up to 100 ms just to add around 200 segments.

Is there something wrong with my implementation (it shouldn't be this slow ?) or should I use another strategy for collision detection ? I thought about clearing the quadtree only every 5 frames but it would make the detection unprecise.

I have measured that some simple math operation to calculate intersection takes up to 50 more times on my android and I'm not sure why. Surely my phone cpu is not 50 times slower than my laptop, is it ?

It's a sufficiently fast moving RTS. Often the whole fleet is moving, thus every segment.

I heard about RDC in that article. Would that be a better algorithm ? My issue is that some ships are hard to be bounded by a sphere if they're very long but not wide.

sentences:
Detecting Light Intensity Around Characters Later Edit

Since there seemed to be a bit of confusion: I am asking this for purely didactic reasons, I'm not searching for the most efficient solution. Reformulated question: I'm working under Unity, and I'd like to know if it would be possible to somehow query the material + shader of each GameObject that has a Mesh Renderer attached to itself, in order to find out how much light has fallen on the 3D model. I'm not very experienced in computer graphics, so this may seem like a stupid question. I'm thinking of something along the line of pixel by pixel comparison of a texture's brightness at any given point in time.

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:
Numerical differentiation to calculate size of circular buffer I'm using Allegro 5 to create a software-generated "motion blur" effect for my 2D sprites. I basically just have a boost::circular_buffer of some length which holds "snapshots" of the sprite going back in time. Each render cycle a new "snapshot" of the main sprite is pushed onto the front of the buffer, and the last is popped off the back. The "snapshots" are then rendered with alpha values scaled by how old/far back in the buffer they are.

To save on CPU power I'd like to have the circular buffer dynamically resized so that the length of the trail is proportional to the object's velocity, i.e. don't store and push back lots of snapshots for trail sprites that won't be needed anyway because the object is moving too slowly.

The inputs I have to the data structure that holds the main sprite and its associated effect buffer are just the dx and dy values of how much its position vector changed since the last update cycle of the game logic. So I'm looking for a suggestion for an algorithm that can use that to increment/decrement some kind of unsigned counter that can be used to resize the buffer proportional to velocity.

sentences: How can I implement gravity? How can I implement gravity? Not for a particular language, just pseudocode...

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:
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:
What am I missing for this flycam to work correctly? Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following:

  camX (Plane) -- Value is a float ranging from negative to positive
  camY (Plane) -- Value is a float ranging from negative to positive
  camZ (Up/Down) -- Value is a float ranging from negative to positive
  camH (Horizontal/Yaw) -- Value is a float in degrees from +180 to -180
  camV (Vertical/Pitch) -- Value is a float in degrees clamped to +89 to -89

I've written a script in Lua which allows me to bind directions (forward, backward, left, right, up, and down) to keys (W, A, S, D, Q, and E); however, those simply add/subtract to/from XYZ values along with a speed modifier, meaning if I'm facing forward and moving forward, everything is fine. Turning 180 degress with the mouse, though, effectively means back is forward, left is right, etc.

What I'm looking to achieve is having those directional keys apply to wherever I'm aiming the mouse pointer. So, forward is always where I'm facing, etc.

I've been piecing together the necessity of sin/cos for calculations related to this; however, I'm apparently in over my head with understanding everything I'm reading/watching. I've found a number of calculations for this based on degrees, radians, converting degrees to radians, etc., but I'm just completely lost as nothing I've tried has panned out (even though I think I understand what I'm reading).

I've ascertained that, where applicable, respective games have sin/cos values stored somewhere in memory which I could use in lieu of calculating those values myself, but I'm honestly not sure what those values look like to seek out in the first place...or exactly what I need to do to make the calculations myself. They're probably staring me right in the face in nearby memory or on the stack as I trace through code, but I simply don't know.

Are there multiple ways to calculate the appropriate angles via sin/cos? Can I use some combination of the 5 values I listed above, along with a speed modifier and Lua's math.* methods (math.rad, math.sin, math.cos), to get this flycam to work properly?

Thank you for any guidance you can provide!

sentences:
Question-Answer Game with coin rewards, how to validate answer? I'm making a game that is basically a typical question-answer type. With coins as reward per answered question.

Stacks and requirements:

UI frameworks of iOS and Android, no game engine.
REST API.
No offline feature.

I'm a newbie in making games, and so my questions are:

Is it okay if I let the client side validate the answer and let it decide how much coins to add in the database?
Or do I make the client side ask for validation of the answer in the server? But I'm thinking this is not ideal because in the game, when you choose an answer, and if the answer is right, the congratulations screen must be instantly popped out.

sentences:
Godot: How do I get the id mask for a physics layer by name? I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings:

func _physics_process(delta):
    var collision = move_and_collide(direction * delta * speed)
    if collision and (collision.collider.collision_layer & get_collision_layer("Walls")) != 0:
        direction = direction.bounce(Vector2.LEFT)
    # more behaviors based on other layer tests

Walls is the name of the physics layer and I am trying to find get_collision_layer.

I am using Godot 3.2.1.  self is a KinematicBody2D & colliders are StaticBody2D's & also KinematicBody2D's.

I have figured out the collision id (as an int) but still think it would be cleaner to use layer names, preferably using a built-in function.

sentences:
How to pass PNG image data directly to SDL? Well passing just external PNG to SDL is very easy with the SDL_image library. I have a class that does just that. The code looks like the following:

SDL_Surface* Texture::LoadImg(const char *filename) {
    SDL_Surface* Image = IMG_Load(filename);
    if (Image == NULL ) {
        printf("Unable to load picture%s\n",SDL_GetError());
        return NULL;
    }
    return Image;
}

Later on I can just call it with

//some code
SDL_Texture* Texture = SDL_CreateTextureFromSurface(Renderer,LoadImg(filename));
//some code

But I don't have just a PNG file. I have a binary file that consist of many PNG files inside. Basically I combine binary(PNG) files into one larger file. Later on I just open that binary file and load pictures into memory from one single file. So now I have an array of vectors or pointers or any other types (depending how you read the binary file). Now I need to pass this from memory into SDL or SDL_image to load it as texture. How would I pass already loaded PNG (binary) data into SDL to use as an SDL_Texture?

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: Add a tag in Unity editor in code How to add a tag in editor? I am working on automatic asset generation and I would like to use tags for certain objects.

sentences:
Reading from Streaming Assets in WebGL I'm trying to set up my Unity game for WebGL, but I quickly found out that you can't access your streaming assets as you would in a standalone build. For example, I have a code snippet below of how I load in all of my game's text for localization (i.e. get english translations of all text in my UI).
public void LoadLocalizedText(string fileName) {
        localizedText = new Dictionary<string, string>();
        // StreamingAssetsPath will always be known to unity, regardless of hardware
        string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
        if (File.Exists(filePath)) {
            string dataAsJson = File.ReadAllText(filePath);

            // deserialize text from text to a LocalizationData object
            LocalizationData loadedData = JsonUtility.FromJson<LocalizationData>(dataAsJson);

            for(int i = 0; i < loadedData.texts.Length; i++) {
                localizedText.Add(loadedData.texts[i].key, loadedData.texts[i].value);
            }
        }
        else {
            // ideally would handle this more gracefully, than just throwing an error (e.g. a pop up)
            Debug.LogError("Cannot find file");
        }

        isReady = true;
    }

I've been looking at online examples, and there's a lot of obsolete examples regarding the use of unity's WWW class and php. From what I understand the UnityWebRequest is now the way to go, but I'm confused how to use it with regards to the example above. I'm also trying to figure out how to connect to my SQLite database which is also stored in streamingAssets.
        public SqliteHelper(string databaseFileName) {
        if (Application.platform == RuntimePlatform.WebGLPlayer) {
            // ????????
        }
        else {
            tag = databaseFileName + ":\t";

            string dbPath = Path.Combine(Application.streamingAssetsPath, databaseFileName);
            if (System.IO.File.Exists(dbPath)) {
                dbConnectionString = "URI=file:" + dbPath;
            }
            else {
                Debug.Log ("ERROR: the file DB named " + databaseFileName + " doesn't exist anywhere");
            }
        }
    }

Now that I can't just open an SqliteConnection, I have no idea if there's a c# only solution, or if I have to learn php as suggested from tutorials such as this one. If someone could walk me through how to solve either of these problems I would greatly appreciate it.

sentences:
Isometric painter's algorithm problem Note: I dont use tiles, I use 3D Polygons :)

I'm currently working on a real-time renderer for scanned real life objects. My main goal is to have an isometric viewer with the simple ability to rotate the object.

This alone is a simple problem. I basically had the full solution for it, but I wasn't happy with the performance at all.

As you might know, software rendering based on the CPU is slow (but I don't want to code a game engine, just a small viewer which should be okay with a low poly count like < 10000) but for what i need it works surprisingly good.

The only part where my renderer is toooo slow is the z-buffer (multiple seconds for a 3000 poly obj). Mainly because it loops xyobjects*polygons.

Currently I'm using some sort of painters algorithm to draw polygons one after another, which brings me some problems: https://youtu.be/PDq4xtrgoi8

As you can see the distances per poly are calculated very poorly, just the center of the poly to world point 1000,1000,1000.

My question is not just about the pointers algorithm but I'd love to use a minimal failing method of drawing the polygons in a specific order rather than calculating every pixel by z-buffering.

If you have other simple methods which work fast on a CPU, I' d really appreciate hearing about them! :)

sentences:
Voice Recorder in Unity I am using Unity for a user study and I am trying to integrate audio interview questions in the game itself. I need to record the user's input to an audio file. The closest thing I found was in this thread.

https://forum.unity.com/threads/save-microphone-recording-to-disk.378038/

It works but it tries to save a 5 minutes clip at once. So, it takes a few seconds and the whole game is stuck for a few seconds. I want to create a thread that will continuously write the shorter clips to the file. I tried using a coroutine but I am having a hard time managing the header as it is dependent on the whole clip.

Any suggestions or links to any threads I might have missed will be appreciated. Thanks!

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:
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:
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:
Unity Rigidbody click to move issue I'm wanting to have a script that when I click in my scene, my player will rotate and have a force added to it and will travel until it has reached the clicked point in my scene.

Right now I have it working using Vectors and having my player lerp from one point to another. But I want to amend it so I can use physics and get a better sense of my player moving. Like have him speed up to start moving and slowing down as he reaches my target loction

My script now looks like this

public GameObject isActive;
public float speed;
public Ray ray;
public Rigidbody rigidBody;

public Vector3 targetPoint;
// Use this for initialization
void Start ()
{
    targetPoint = transform.position;
}

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

}

void FixedUpdate()
{
    if (Input.GetMouseButton(0))
    {
        targetPoint = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        ChangeRotationTarget ();
    }

    Quaternion targetRotation = Quaternion.LookRotation (targetPoint - transform.position);
    transform.rotation = Quaternion.Slerp (transform.rotation, targetRotation, speed * Time.deltaTime);

    rigidbody.position = Vector3.Lerp(transform.position, targetPoint, speed * Time.fixedDeltaTime);
}

void ChangeRotationTarget ()
{
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    Plane playerPlane = new Plane (Vector3.up, transform.position);

    float hitdist = 0.0f;

    if (playerPlane.Raycast (ray, out hitdist))
    {

        targetPoint = ray.GetPoint (hitdist);
    }

}

However, when I run this, he just slides from one point to another. Regardless of the drag or mass I put in my rigidbody.

Can someone help me make my changes? Or point me in the right direction

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:
Segmenting an MMO market I've been considering a segmented market for an MMO:

There is a different market for each in-game level (Level 1 players can only buy/sell items from the Level 1 market)
If a player levels up with items still in the market, they remain there, but can be removed if the player wishes.
The levelled market is the only way to trade items between players.

A few things I expect to happen:

The market won't be completely segmented.  If the Level 2 market's price for X is higher, then I'll just keep it to sell (and vice versa).
However, despite the above, there will still be X sold, as buying/selling makes it easier for the player to level up.
Therefore, there will be an inflation curve, where gold will be worth less and less on each level.
Inflation over time will occur faster at level 20 than at level 1.

Are my assumptions above correct?

sentences:
GUI Layering (Enemy health bars appear above Inventory) I have set up an enemy prefab that gets instantiated during Start. Each enemy object has a health bar GUI object attached to a Canvas which is a child of these spawned enemy objects. So, when I spawn 10 enemies, 10 health bars get spawned as well. I have another GUI object for the inventory which I can open and close at the press of a button. When I open my inventory and there are enemies behind it, their health bars show on top of my inventory. I would like to layer the GUI objects such that these enemy health bars do not appear above my inventory. How do I do this? I have tried ordering them differently in the hierarchy as per someone's suggestion in a forum post, but that didn't seem to work.

Again, every enemy object has its own Canvas of which the health bar is a child.
The inventory GUI object is attached to a different Canvas which has no parent.

sentences:
How can I create 2D shadows that let me detect when the player is inside them? I'm working on a 2D platform game, and I want my platforms to cast shadows along with some way to detect if the player is inside the shadow area (that is, not hit by the sun).

More specifically: I have a character, some platforms and a sun. When the player is under the shadow of some platform he is safe. If he goes to a location when the sunlight hit him, then he starts losing heath until he enters other shadow spot.

Right now the shadows are boxes with a transparent/diffuse material. Boxes are good because I can determine when the player enters or leaves them, but they are are ugly and don't have any animation. I need a shadow that changes when the sun changes its position, without losing the ability to determine when the player is inside a shadow (I think this can be done using a ray cast)?

How can I accomplish this?

sentences:
Why is my obj file imported into pyglet showing a blank screen? I am trying to figure out how to import .obj files generated using Blender into my Pyglet game. There is an importer object, example code, and an example .obj/.mtl file within Pyglet's contrib directory.

The pyglet contrib version works (and is flickery; comment out w.flip) with the pyglet/contrib .obj/.mtl files. When I try to run it with my .obj and .mtl files I get a blank screen.

Why am I seeing a blank screen instead of my Blender-generated object?

FWIW, here's my test repo.

sentences:
Storing large layered tilemap My game consists largely of "sea" tiles and areas of tiles to form "islands". Each "sea" tile is exactly the same.

The map is initially large and going to get larger. I'm trying to reduce the map size since, the majority of it is the same.

My initial thought:
Store just the islands with their locations within the map. The map consists of, total map size and islands only.

Any other suggestions or perhaps how I could implement the above whilst still being able to use a* pathfinding?

sentences:
Creating installer for WinForms XNA with compiled content I have a Windows Forms application that uses a custom Graphics Device control based on Microsoft's "WinForms Series 1: Graphics Device" sample. The application makes use of a single model (the spaceship model included with the second sample) and its associated texture.

My main project includes a reference to an XNA Game Library project, which contains a Content reference to my Content project.  When I build and run the project in either Debug or Release configuration, my model and texture are compiled into XNB format and loaded into the application as expected.

However, when I create an installer (either Windows Installer or ClickOnce) and run it, the content files are not present in any form in the installed location, so obviously I get a runtime exception. I've toggled every option I can find that looks relevant. Am I missing something?

sentences:
Matrix multiplication order for multiple model transformations I have a problem in terms of what frame of reference, I should construct, scaling (S), rotation (R) and translation (T) for a model matrix (in that order). Let us assume the use of glm (or glsl), i.e. to mean column major representation.

I believe, it should be a matrix multiplication of:

M = T * R * S // S * R * T is what we want to apply, but due to being column major, the order gets reversed, due to (AB)^T =B^T*A^T

Now, if I have a previous transformation already applied (say M_prev), and I want to apply a transformation M on top of that, then is the correct form:

M_new = M_prev * M // M_new and M_prev are both column major. I'm post multiplying due to being column major, but this is incorrect, I guess?

I believe this is incorrect (at least in some experiments I carried out, please correct me if I'm wrong), and it should be the reverse. What is the flaw in my calculation of M_new?

sentences:
Sprite not rotating around its centre after Scaling at its centre If I scale a sprite at its centre, then try to rotate it around its centre as well, the rotation does not occur around its centre.

If you need to rotate, for example a scaled ball,the way its working it is set the scale center at the top left (0,0) set the scale that you want, and then set the rotation center to the middle of the scaled sprite, and then apply the rotation modifier.

blaBloBliSprite.setScaleCenter(0, 0);
blaBloBliSprite.setScale(0.667f);
blaBloBliSprite.setPosition(557, CAMERA_HEIGHT / 2 - blaBloBliSprite.getHeightScaled() / 2);
blaBloBliSprite.setRotationCenter(blaBloBliSprite.getWidthScaled() / 2, blaBloBliSprite.getHeightScaled() / 2);

But I want to scale a sprite at its centre as well.

Is there any way of doing it?

sentences:
What do you call the Call-of-Duty-style health system? In games like Call of Duty (and many, many other FPSs), there is no visible health bar; instead, as the player takes damage, their vision is slowly obscured by blood that seeps in from the edges. As they heal, the blood clears.

This has become a very prevalent mechanic in modern shooters, but I'm not sure if there is a definitive name for it.

I vaguely remember it being called the "blood barrel" in the game adaptation of 007: Quantum of Solace, but I never actually played that game, I only glanced through the manual a while ago. Also, Quantum of Solace came out after Call of Duty 2 (the first game I know that used this mechanic), so "blood barrel" probably isn't the original term.

This mechanic is very common, so I imagine there must be some term for it.

sentences:
Libgdx InputListenner not working I've added an InputListener to my libgdx actor and I've added the actor to the stage. The stage (and all of its actors) gets drawn just fine.

The problem is my actor doesn't seem to be receiving keyboard inputs as nothing happens when I press keys.

@Override
public void show() {
 stage = new Stage();
 player = new Player();
 player.setPosition(600, 600);
 stage.setKeyboardFocus(player);
 player.addListener(new InputListener(){
   @Override
   public boolean keyDown(InputEvent event, int keyCode) {
    System.out.println("Key Down");
    return true;
   }
 });
 stage.addActor(player);
}

sentences:
How to make user move in virtual reality with Google Cardboard and Unity? I am working on a virtual walkthrough using Google Cardboard in Unity 5.3.5.

I have a building, and I need to move around inside the room using google cardboard. How can I do that? Is it possible to move around when we walk holding the Google Cardboard? I have done movement using arrow key. I am able to turn around the building with Google Cardboard.

sentences: Java LWJGL Windows 10 native files Hello I made a simple game and I want to share it to my friend but he cant run it. I'm assuming it's because he has windows 10 and the LWJGL 2 native files don't support that (I've asumed that based on the .bat run file (a standard Java -jar a.jar line) wich crashed right before it is supposed to initialize windows 10). Maybe that isn't the problem but I don't see any other issue. Do the native files support newer systems? If not, then could you give me suggestions on getting new native files or something. Thanks

sentences:
get the new vertices after rotating in JOGL I had rotate an object with openGL (JOGL).
Is there a simply way how I can get the new vertices?

sentences:
Most efficient way to convert Vector3 to Vector2 What is the most efficient and fastest way to convert a Vector3 to a Vector2?

Casting:

Vector2 vector2 = (Vector2)vector3;

Initializing a new Vector2:

Vector2 vector2 = new Vector2(vector3.x, vector3.y);

Or is there another method that I don't know?

sentences:
What is the kd tree intersection logic? I'm trying to figure out how to implement a KD tree.

On page 322 of "Real time collision detection" by Ericson

The text section is included below in case Google book preview doesn't let you see it the time you click the link

text section

Relevant section:

The basic idea behind intersecting a ray or directed line segment with a k-d tree is straightforward.  The line is intersected against the node's splitting plane, and the t value of intersection is computed. If t is within the interval of the line, 0 <= t <= tmax, the line straddles the plane and both children of the tree are recursively descended.  If not, only the side containing the segment origin is recursively visited.

So here's what I have: (open image in new tab if you can't see the lettering)

The logical tree

Here the orange ray is going thru the 3d scene.  The x's represent intersection with a plane.  From the LEFT, the ray hits:

The front face of the scene's enclosing cube,
The (1) splitting plane
The (2.2) splitting plane
The right side of the scene's enclosing cube

But here's what would happen, naively following Ericson's basic description above:

Test against splitting plane (1).  Ray hits splitting plane (1), so left and right children of splitting plane (1) are included in next test.
Test against splitting plane (2.1).  Ray actually hits that plane, (way off to the right) so both children are included in next level of tests.  (This is counter-intuitive - shouldn't only the bottom node be included in subsequent tests)

Can some one describe what happens when the orange ray goes through the scene correctly?

sentences:
How do I drag my widgets without dragging other widgets? I have a bunch of drag-able widgets on screen.  When I am dragging one of the widgets around, if I drag the mouse over another widget, that widget then gets "snagged" and is also dragged around.

While this is kind of a neat thing and I can think of a few game ideas based on that alone, that was not intended.  :-P

Background Info

I have a Widget class that is the basis for my user interface controls.  It has a bunch of properties that define it's size, position, image information, etc.  It also defines some events, OnMouseOver, OnMouseOut, OnMouseClick, etc.  All of the event handler functions are virtual, so that child objects can override them and make use of their implementation without duplicating code.

Widgets are not aware of each other.  They cannot tell each other, "Hey, I'm dragging so bugger off!"

Source Code

Here's where the widget gets updated (every frame):

public virtual void Update( MouseComponent mouse, KeyboardComponent keyboard ) {
    // update position if the widget is being dragged
    if ( this.IsDragging ) {
        this.Left -= (int)( mouse.LastPosition.X - mouse.Position.X );
        this.Top -= (int)( mouse.LastPosition.Y - mouse.Position.Y );
    }
    ... // define and throw other events
    if ( !this.WasMouseOver && this.IsMouseOver && mouse.IsButtonDown( MouseButton.Left ) ) {
        this.IsMouseDown = true;
        this.MouseDown( mouse, new EventArgs() );
    }
    ... // define and throw other events
}

And here's the OnMouseDown event where the IsDraggable property gets set:

public virtual void OnMouseDown( object sender, EventArgs args ) {
    if ( this.IsDraggable ) {
        this.IsDragging = true;
    }
}

Problem

Looking at the source code, it's obvious why this is happening.  The OnMouseDown event gets fired whenever the mouse is hovered over the Widget and when the left mouse button is "down" (but not necessarily in that order!).  That means that even if I hold the mouse down somewhere else on screen, and simply move it over anything that IsDraggable, it will "hook" onto the mouse and go for a ride.

So, now that it's obvious that I'm Doing It Wrong™, how do I do this correctly?

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 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:
2D Physics library for multiplayer in c++ Im trying to create a top down shooter with multiplayer functionality.
So far im using Box2D for my physics Simulation.

The last few days I played around with syncing movement between Clients and Server without box2d. I now feel like Box2d might be too complex for my rather simple needs(players are the only moving bodys, the Rest of the scene consists of static polygons) and after reading online it seems like Box2D isnt the best pick to sync physics over a network.

Especially when thinking about implementing client side prediction and entity interpolation where I have to manually correct values and interpolate between others I feel like box2d might be more of a Problem then a help.

As I noted my physics Simulation isnt too complex(just polygon-polygon intersection and raycasting) and so im currently thinking about implementing the physics myself so I have complete controll over it.

Maybe somebody here has already used box2d and networking or can point me to another library? Maybe im wrong and box2d is the best solution for networked 2d physics? :D

What about my idea of implementing the physics myself?

sentences:
Unity multiplayer (online) - How to connect to a 'Client-Host' without using Unity Paid Service I'm slightly annoyed with the official Unity guides here, because I have been following through some, and they have indeed helped me create a local network mulitplayer situation. However, at no point did they mention that using these methods (ie. UnityEngine.Networking // NetworkManager // NetworkManagerHUD // NetworkIdentity) will require me to pay Unity for Pro, and a monthly server usage fee, if I wanted to play via internet.

I've set up my own Rust server in the past and it was very simple. I just installed a Rust Dedicated Server on my desktop PC (which I have fibre internet connection) and ran the server. I could then have 20 people playing with me and we didn't notice any slow-down or lag or any problems with it. (Rust is made in Unity I believe)

I've tried searching lots on this matter, and there are many many differing voices of how I can do this (many out-of-date, and many explicitly stating its impossible without hiring a server) - I disagree, and think I can make my desktop run the server, BUT I haven't a clue if I'm correct and also how I would be able to make it.

Unity docs seem to be trying to hide this solution if it exists (perhaps I'm being paranoid).

I have the NetworkManagerHUD all working and can play locally as I say.

So, it appears that the NetworkManager allows a user to start my game in 'Client-host' mode, it also allows another instance elsewhere to click "Connect Client" and has a space for IP address.

Would I even need a dedicated server if a player has clicked to start as 'Client-Host'? assuming I don't, how can I then connect to this host from another machine? Does typing the client-hosts external IP allow this?

Sadly, I don't have anybody to help me test this right now.

If a dedicated server version is the preferable way to go, could anybody please help me in the direction of how to start creating this?

For info: The game at this stage is a very simple FPS shooter. The NetworkManager is assigning the 'isLocalPlayer' flag correctly to one instance of the player object. I see in the Editor Hierarchy that it is handling the game overall and has two player objects once I have logged in with two instances locally.

sentences:
Does XNA provide any special class to make a game server? For my multiplayer game server, I made a class inheriting from "Microsoft.Xna.Framework.Game", just like I did for the client-side part.

The thing is, I don't need any graphical display for the server, so I end up with a useless blank game window floating around. Also, the LoadContent/UnloadContent and Draw overrides are left empty. On the other hand, I still need to use Microsoft.Xna.Framework.Game for the game loop and logic update parts.

So is there any special class in XNA made especially for the server-side part, or is everyone else doing it just like I do?

sentences:
Getting the Bounds of a 2D Cameras View with Zoom I am using a 2D camera, which does rotations and zoom. Currently, I am using the following to get my MinX, MinY, MaxX and MaxY...

    public float MinX
    {
        get
        {
            return pos.X - gameEngine.screenWidth / 2;
        }
    }
    public float MaxX
    {
        get
        {
            return pos.X + gameEngine.screenWidth / 2;
        }
    }
    public float MinY
    {
        get { return pos.Y - gameEngine.screenHeight / 2; }
    }
    public float MaxY
    {
        get { return pos.Y + gameEngine.screenHeight / 2; }
    }

How would I now take into account Zoom? Default Zoom is 1.
I think this will require Matrices, but any help is appreciated.

sentences:
Event error: "...can only be called from the main thread" I have some custom networking classes which I'm trying to use in a unity game (c#).  The network class raises events, which I want to subscribe to in the game code.  However, whenever I try to do anything substantial in response to an event, I'm running into and error like this:

  SomeFunction can only be called from the main thread

How can I get this to work?  Presumably I have to communicate the event back to the main thread in some synchronous fashion.  Is there a 'best practice' way of doing this in Unity?

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:
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:
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:
What's the equivalent of wglShareLists for Mac OS? I'm trying to share lists between two contexts on Mac OS but despite my research I couldn't come up with an answer so far. I've found that NSOpenGLContext was able to initialize a context with a shared context but not to set it afterward.

What's the equivalent of wglShareLists on Mac OS?

sentences:
How can I spawn items based on probabilities? I'm working on a game where I want to choose which object to spawn based on probabilities. Assuming the decision to spawn the object has been done by some other process, I'd like the object with the highest probability to have a higher chance of being spawned. An object with 50% spawn probability should spawn more often than an object with 15% spawn probability. I also need to account for instance where a game object has the same spawn probability

GameObject 1 .50
GameObject 2 .25
GameObject 3 .25

How can I implement this logic?

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:
When to stop taking items from ever-growing queue and start processing them? I am developing a fast-paced multiplayer shooting game and following instructions from this source http://www.gabrielgambetta.com/entity-interpolation.html. In the article it says that:

several clients may be sending inputs simultaneously, and at a fast pace (as fast as the player can issue commands, be it pressing arrow keys, moving the mouse or clicking the screen). Updating the game world every time inputs are received from each client and then broadcasting the game state would consume too much CPU and bandwidth.
A better approach is to queue the client inputs as they are received, without any processing. Instead, the game world is updated periodically at low frequency, for example 10 times per second. The delay between every update, 100ms in this case, is called thetime step. In every update loop iteration, all the unprocessed client input is applied (possibly in smaller time increments than the time step, to make physics more predictable), and the new game state is broadcast to the clients.

now I am wondering how to implement such a queue system? I can have an in memory queue where each input is added. and after say 100ms how many number of inputs do I process? i.e when should I stop popping events from queue and apply simulation?
from my point of view clients are sending inputs constantly which are being added to the input queue. below is the psuedocode.
queue inputQueue;

gameloop() {
   while (inputQueue not empty) { //<------obviously i cannot use this condition, what should i use then?
      inputEvent = inputQueue.front()
      updateState(inputEvent)
   }
}

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:
Instantiation of a GameObject not working for a threading reason I receive the following error

  "INTERNAL_CALL_Internal_InstantiateSingle 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."

whenever I try to instantiate some GameObject's using this function:

public void DisplayCalls () {
    for (int i = 0; i < calls [0].Count; i++) {
        for (int j = 0; j < impFields.Length; j++) {
            GameObject textClone = Instantiate (textBox, Vector3.zero, Quaternion.Euler(Vector3.zero)) as GameObject;
            textClone.transform.SetParent (canvas.transform);
            Text text = textClone.GetComponent <Text> ();
            text.text = calls[impFields [j]][i];
            text.alignment = TextAnchor.MiddleCenter;
            textClone.transform.localPosition = new Vector3 (-262.5f + (175f * j), (182f + (30f * i)), 0f);
        }
    }
}

The function is called using this other function:

public void GetPanelInfo () {
    string file = "getpanelinfo.php";
    string hash = Md5Sum (mostRecentID.ToString () + SecretKey1 + SecretKey2);
    string parameters = "?mostrecentid=" + mostRecentID.ToString () + "&hash=" + hash;
    string fullURL = baseURL + file + parameters;
    Uri fullURI = new Uri (fullURL);
    WebClient client = new WebClient ();

    string jsonString = string.Empty;
    client.DownloadStringCompleted += (sender, e) => {
        if (!e.Cancelled && e.Error == null) {
            jsonString = e.Result;
            JSONNode json = JSON.Parse (jsonString);
            for (int i = 0; i < json["calls"].Count; i++) {
                for (int j = 0; j < calls.Length; j++) {
                    calls[j].Add (json["calls"][i][names [j]]);
                }
                mostRecentID = json["calls"][i]["callID"].AsInt;
            }
        } else if (e.Cancelled && e.Error == null) {
            Debug.Log ("Cancelled");
        } else {
            Debug.Log ("Error: " + e.Error);
        }
        loading = false;
        LogCalls ();
        DisplayCalls ();

    };
    client.DownloadStringAsync (fullURI);
}

Which is called once using a button.

I cannot seem to find the problem, but as stated above, the error says that it is a threading problem and that I cannot call instantiate from another thread other than the main one. I do not know how to change the instantiation to another thread, but any help to solve this problem would be much appreciated.

sentences:
Basic A star implementation tutorial Possible Duplicate:
  Pseudo-code examples of A*?

Hey guys Iam making a TD game and now I am stucked in implementing A star algo. I know there are many 3d party softwares but they are difficult to understand and modify. I want to make own for my game. I need a step wise programming tutorial for implementing A* OR if someone has basic snippet. I am using unity and c#.

sentences:
Velocity Relative To A Vector So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation in image below:

So on the left you can see the vectors in world space, but on the right - vectors in a space. I need to get the vector b in the _a_space from the worldspace.

sentences:
What is the best method to update shader uniforms? What is the most accepted way for keeping a shader's matrices up to date, and why?

For example, at the moment I have a Shader class that stores the handles to the GLSL shader program & uniforms. Every time I move the camera I then have to pass the new view matrix to the shader, then every different world object I must pass it's model matrix to the shader.

This severely limits me as I can't do anything without having access to that shader object.

I thought of creating a singleton ShaderManager class that is responsible for holding all active shaders. I can then access that from anywhere and a world object wouldn't have to know about what shaders are active just that it needs to let the ShaderManager know the desired matrices but I'm not sure this is the best way and there's probably some issues that will arise from taking this approach.

sentences:
How to make the main menu screen fade out when the game starts in libGDX? I am creating the main menu of my game, and I want the main menu screen to disappears with a fade out. I thought that if I used a Stage to make the menu and added buttons as actors, the menu would work...

But I get the following problem: If I add the fadeOut(1) in the click event of the button used to start the game, instead of having the whole screen fade out, only the buttons of the menu disappear. Probably using Stage is the wrong way to make menus, and I do not know the right way ...

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.phillips.mrbulb.MrBulb;

public class MenuState extends Estado {
    private Stage menu;
    private Texture fondo;
    private Drawable empz, instr, acrc, slir;
    private ImageButton empezar, instrucciones, acerca, salir;
    public MenuState(GameStateManager gsm) {
        super(gsm);
        fondo = new Texture("fondo_temp.png");
        empz = new TextureRegionDrawable(new TextureRegion(new Texture("Empezar.png")));
        instr = new TextureRegionDrawable(new TextureRegion(new Texture("Instrucciones.png")));
        acrc = new TextureRegionDrawable(new TextureRegion(new Texture("Acerca.png")));
        slir = new TextureRegionDrawable(new TextureRegion(new Texture("Salir.png")));
        empezar = new ImageButton(empz);
        empezar.addCaptureListener(new ClickListener(){
            public void clicked(InputEvent event, float x, float y){
                menu.addAction(Actions.fadeOut(1));
            }
        });
        empezar.setPosition(MrBulb.ANCHO/2 - 90,MrBulb.ALTO/2);
        instrucciones = new ImageButton(instr);
        instrucciones.setPosition(MrBulb.ANCHO/2 - 80,MrBulb.ALTO/2 - 90);
        acerca = new ImageButton(acrc);
        acerca.setPosition(MrBulb.ANCHO/2 - 62,MrBulb.ALTO/2 - 180);
        salir = new ImageButton(slir);
        salir.setPosition(MrBulb.ANCHO/2 - 33,MrBulb.ALTO/2 - 267);
        menu = new Stage();
        menu.addActor(empezar);
        menu.addActor(instrucciones);
        menu.addActor(acerca);
        menu.addActor(salir);
    }

    @Override
    public void update(float dt) {
        Gdx.input.setInputProcessor(menu);
        handleInput();
    }

    @Override
    public void handleInput() {

    }

    @Override
    public void render(SpriteBatch batch) {
        batch.begin();
        batch.draw(fondo,0,0,MrBulb.ANCHO, MrBulb.ALTO);
        batch.end();
        menu.act(Gdx.graphics.getDeltaTime());
        menu.draw();
    }

    @Override
    public void dispose() {
        fondo.dispose();
    }
}

What would be the correct way to make a menu for the game? Or, if using Stage, what would be the right way of coding it?

sentences:
Algorithm to generate small tree-like branches? I'd like to seed a void map with "branches" of sine waves or any other waveform. Something like:

Know of any algorithm? Has to be one to generate trees or something like that.

sentences:
How to work properly with different coordinate-systems Let's say we got a little set {S} wich has 4 possible coordinate systems (LH=left handed, RH=right handed):

LH-y_up
LH-z_up
RH-y_up
RH-z_up

Now, let's say my Opengl engine is using a RH-y_up coordinate system and I want to import models from some 3d package which uses a RH-z up coordinate system (like 3ds max). One way to do it would be at the exporting/preprocessing stage flipping the y&z model's components. That solution doesn't seem like a really good idea though... what about if i decided to change eventually on my engine from coordinate system 3) to 1) or 2)?

So, my question would be. Let be A & B 2 coordinate systems from set S. What's the proper way to use models from A onto B?

sentences: Can a prefab of a complete Unity scene be created? Can we create a prefab out of a complete unity scene, so that we can instantiate the complete scene like we instantiate gameobjects in unity.

sentences:
How to create a 2d procedural spline based road with 2 edge colliders? I am trying to make a top down 2d spline-based road that is procedurally generated and endless. The aim is that the player starts inside the road and has to navigate the road and if he touches any of its edges he "dies" and the game reloads. I have looked at various resources online for help but can't seem to find the answer. I have tried using the Path creator tool (by sebastian lague) and followed his YouTube series and I have even tried to use Unity's 2d sprite shape asset. The issue is, with the Path creator tool, I am able to create the road procedurally, but I can't figure out how to add multiple edge colliders on its boundaries. The same issue is there for Unity's sprite shape asset except with that, I don't know how to generate the road also (procedurally) and I can't find any tutorial or resource that explains how to do so.
Can someone explain an easy way to achieve this (also, it has to be procedurally since my goal is to make it endless)?

sentences:
Navigating to android app settings > permission from unity I am trying to rout from my unity application to android app settings permissions. till now I achieved to rout to app settings, But i want to take 1 step more to go inside permission i mean App Settings > Permissions.

Code:

try
        {
#if UNITY_ANDROID
            using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            using (AndroidJavaObject currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
            {
                string packageName = currentActivityObject.Call<string>("getPackageName");

                using (var uriClass = new AndroidJavaClass("android.net.Uri"))
                using (AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
                using (var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.APPLICATION_DETAILS_SETTINGS", uriObject))
                {
                    intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
                    intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
                    currentActivityObject.Call("startActivity", intentObject);
                }
            }
#endif
        }
        catch (System.Exception ex)
        {
            Debug.LogException(ex);
        }

Help if it is possible... any help is appropriated. Thank in advance.

sentences:
When mapping the surface of a sphere with tiles, how might you deal with polar distortion? It's easy to deal with the way locations interact on a clean Cartesian grid.  It's just vanilla math.  And you can kind of ignore the geometry of the sphere's surface for a bunch of it if you want to just truncate the poles or something.  But I keep coming up with ideas for games where the polar space matters.  Geo-coded ARGs and global roguelikes and stuff.

I want square(ish?) locations -- reasonably representable by square tiles of the same size across the globe, anyway.

This has to be a solved problem, right?

What are the solutions?

ETA:

At the equator -- and assuming that your square locations are reasonably small, it's close enough to true that you can get away with having one square in the rows north and south of the most equatorial row.  And you could probably get away with that by just hand-waving the difference up to like 45-degrees or so.  But eventually, you need to have fewer squares in a pole-ward circumferential row.  If I reduce the length of the row by one and offset the squares by 1/2 then they're just like hexes  and it's relatively easy to do the coding to keep track of the connections.  But as you get pole-ward, it gets more and more extreme.

Projecting the surface of the world onto the surface of a cube is tempting.  But I figured there must be more elegant solutions already in use.

If I did the cube thing (not dissecting it further through geodesy) Are there any pros and cons related to placing the pole at the center of a face or at the vertex of three sides?

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:
create ipa without RoboVM in a project libgdx I am creating an application with libgdx , and I wish I could produce an IPA without using RoboVM , because since version 1.9 became a fee . I saw on the original documentation that you can do with the gradlew.

https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-the-project

command:

gradlew ios:createIPA

but I saw that still requires robovm . you can create an IPA without robovm ? or if there is a plugin that makes the IPA.

I use Android studio (IntelliJ)

Thank you

sentences:
Do I have to keep textures in Android games smaller than 1024^2? I have read tips in books and article that point out, if you are making a game for Android, make sure your textures are =< 1024^2, or you'll not reach all your potential customers.

I have never found a concrete statistic that proves this claim. What are we talking about, here, 5% of Android devices only support 1024? 10%? 80%?

sentences: Frustum culling + instancing I've implemented instancing in my app and right now I have an instance buffer holding position data for all instances. But I'd like to also implement frustum culling which would cull some of the instances depending on the camera view. Now, how can I render only some of the instances in the buffer but not all? Do I have to rebuild the buffer every frame (so that it only holds visible instances) or is there a way in DirectX 11 to "tell" API which instances from the buffer I want drawn?

sentences: Algorithm for random flight of a fly I'm new to game development. What is a good algorithm to model the random flight of a fly? I've been looking at path-finding algorithms, but they don't give any interesting random behaviour.

sentences:
OpenGL Texturing Isn't working: displaying just white Basically, see the title: for whatever reason, I load a texture into OpenGL, bind it, draw a quad with texture coordinates specified, and the quad remains totally white regardless of what the texture is.

I have made sure that GL_TEXTURE_2D is enabled. I have verified (using glGetTexImage) that the Texture has the correct data in it (or, if not the correct data, data that should be visible, as the pixels have different values).

My glTexture2D function is called as follows:

        glTexImage2D(GL_TEXTURE_2D, 0, pixelFormat, this->width, this->height, 0, pixelFormat, GL_UNSIGNED_BYTE, &(pixelData[0]));

This is where pixel format is either GL_RGBA or GL_RGB (according to pixel depth), and pixelData is the array of pixels. I verified that pixelFormat and pixelData and width and height have within them the correct values. Note that pixelData is a std::vector.

I bind the texture as such:

    glActiveTexture(GL_TEXTURE0 + this->multiTexNumber);
    glBindTexture(GL_TEXTURE_2D, this->texID);

For the purposes of my testing, this->multiTexNumber = 0;

Have I done something wrong here? Is the problem elsewhere?

EDIT: via very thorough checking, I have ensured that OpenGL doesn't throw any errors. The problem persists.

sentences:
C# XNA: Effecient mesh building algorithm for voxel based terrain ("top" outside layer only, non-destructible) To put this bluntly, for non-destructible/non-constructible voxel style terrain, are generated meshes handled much better than instancing? Is there another method to achieve millions of visible quad faces per scene with ease? If generated meshes per chunk is the way to go, what kind of algorithm might I want to use based on only EVER needing the outer layer rendered?

I'm using 3D Perlin Noise for terrain generation (for overhangs/caves/etc). The layout is fantastic, but even for around 20k visible faces, it's quite slow using instancing (whether it's one big draw call or multiple smaller chunks). I've simplified it to the point of removing non-visible cubes and only having the top faces of my cube-like terrain be rendered, but with 20k quad instances, it's still pretty sluggish (30fps on my machine).

My goal is for the world to be made using quite small cubes. Where multiple games (IE: Minecraft) have the player 1x1 cube in width/length and 2 high, I'm shooting for 6x6 width/length and 9 high. With a lot of advantages as far as gameplay goes, it also means I could quite easily have a single scene with millions of truly visible quads.

So, I have been trying to look into changing my method from instancing to mesh generation on a chunk by chunk basis. Do video cards handle this type of processing better than separate quads/cubes through instancing? What kind of existing algorithms should I be looking into?

I've seen references to marching cubes a few times now, but I haven't spent much time investigating it since I don't know if it's the better route for my situation or not.

I'm also starting to doubt my need of using 3D Perlin noise for terrain generation since I won't want the kind of depth it would seem best at. I just like the idea of overhangs and occasional cave-like structures, but could find no better 'surface only' algorithms to cover that. If anyone has any better suggestions there, feel free to throw them at me too.

Thanks,
Mythics

sentences:
XNA 2D Board game - trouble with the cursor I just have started making a simple 2D board game using XNA, but I got stuck at the movement of the cursor.

This is my problem:

I have a 10x10 table on with I should use a cursor to navigate. I simply made that table with the spriteBatch.Draw() function because I couldn't do it on another way.

So here is what I did with the cursor:

public override void LoadContent()
{
    ...
    mutato.Position = new Vector2(X, Y); //X=103, Y=107;
    mutato.Sebesseg = 45;
    ...
    mutato.Initialize(content.Load<Texture2D>("cursor"),mutato.Position,mutato.Sebesseg);
    ...
}

public override void HandleInput(InputState input)
{
    if (input == null)
        throw new ArgumentNullException("input");

    // Look up inputs for the active player profile.
    int playerIndex = (int)ControllingPlayer.Value;

    KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];

    if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
    {
        ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
    }
    else
    {
        // Otherwise move the player position.
        if (keyboardState.IsKeyDown(Keys.Down))
        {
             Y = (int)mutato.Position.Y + mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Up))
        {
            Y = (int)mutato.Position.Y - mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Left))
        {
              X = (int)mutato.Position.X - mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Right))
        {
             X = (int)mutato.Position.X + mutato.Move;
        }
    }
}

public override void Draw(GameTime gameTime)
{
    mutato.Draw(spriteBatch);
}

Here's the cursor's (mutato) class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Battleship.Components
{
    class Cursor
    {
        public Texture2D Cursortexture;
        public Vector2 Position;
        public int Move;

        public void Initialize(Texture2D texture, Vector2 position,int move)
        {
            Cursortexture = texture;
            Position = position;
            Move = move;
        }

        public void Update()
        {
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Cursortexture, Position, Color.White);
        }
    }
}

And here is a part of the InputState class where I think I should change something:

public bool IsNewKeyPress(Keys key, PlayerIndex? controllingPlayer,
                                       out PlayerIndex playerIndex)
{
     if (controllingPlayer.HasValue)
     {
           // Read input from the specified player.
           playerIndex = controllingPlayer.Value;

           int i = (int)playerIndex;

           return (CurrentKeyboardStates[i].IsKeyDown(key) &&
                   LastKeyboardStates[i].IsKeyUp(key));
     }
}

If I leave the movement operation like this it doesn't have any sense:

X = (int)mutato.Position.X - mutato.Move;

However if I modify it to this:

X = (int)mutato.Position.X--;

it moves smoothly. Instead of this I need to move the cursor by fields (45 pixels), but I don't have any idea how to manage it.

sentences:
Anti-Aliasing + Atlas Texture + VBO = nasty looking artifact With my research I have found that using a VBO to render graphics is much faster than using depreciated OpenGL. I've found with this that you can't switch textures mid VBO render, so if I have multiple objects in a single VBO, they all have to use the same texture. I solved this problem by using a texture atlas to combine multiple textures together into one texture used throughout the whole VBO.

Now all this works perfectly. It's fast, it's efficient, and it looks good until you turn on SFML's anti-aliasing. If you look at the pictures, it appears that it's merging textures in the texture atlas at a distance. These pictures should help clear up what that means.

Without Anti-Aliasing:

With Anti-Aliasing:

The Atlas Map as it looks in memory:

Also if it helps, I experimented with adding blank space between these individual textures to see if that would hide the problem. The problem persists, only it makes objects far away appear translucent because of the alpha between the textures.

sentences:
Advice on Story Text-Based Game I am currently in preparation on making a game. This game will be looks like Lifeline by 3 Minute Games, which is a story text-based game.

My game will have the same concept with it. Where there will be a scrollable history of conversation between player and characters in game. However, my game will has more than one conversation history. He will be able to interact with more than one character. Therefore, when the game start, it will show list of interactable characters in game, and player can choose who he will interact with when any available.

I am planning to make it with Unity. But I don't know is it possible to create some scrollable history of text, each with different content, like chat history, in Unity.

So I wanna ask your opinion, is it good to just continue with using Unity, or should I change the game engine I use? If I should change, what is the best game engine to cope with this kind of game?

Thank in advance :)

sentences:
Collision Detection Unresponsiveness I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive.

The only problem is that the collision detection for when the player just touches the ground, it:

1) Looks a little bit like there's a hitch in the repainting (because it tends to go a y axis little too far before being brought back to above 0).

2) Can't jump right away again (a very small, but annoying delay).

Here is the code that checks for collisions:

public void update(float dt) {
    if (location.y < screenBounds.y) {
        location.add(MOVEMENT * dt, 0, 0);
        velocity.y = 0;
        location.y = 0 + dt;
    } else {
        velocity.add(0, GRAVITY, 0);
        velocity.scl(dt);
        location.add(MOVEMENT * dt, velocity.y, 0);
        velocity.scl(1 / dt);
    }

}

I know why, it does this though:

LOCATION BEFORE RESETTING -0.45871875
LOCATION AFTER RESETTING 0.017244088

It takes too long to realize that the location on the y axis is below 0. This creates a hitch as well as a small delay between the times where it lets the player jump again.

I don't know how to fix this problem. I've looked at many posts that discuss collision detection, but none address the same problem I'm having.

For example, these tell me to do what I'm currently doing:

Collision detection
Collision detection in libgdx

But they both don't solve my issue.

Any help would be greatly appreciated.

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:
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:
Press button event instead of onClick() in Unity I want to add a nitro in my arcade game and i want to detect press UI button instead of click. unfortunately only onClick() event is available for UI button

what kind of options do I have ?

Thank you

sentences:
Can't get Direct3D11 depth buffer to work I can't get the depth buffer to work correctly.  I am rendering 2 cubes in a single Draw function, and from one angle it looks great

But swing the camera around to view the opposite sides, and I discover it's just Painter's Algorithm.

This is my code to setup the depth stencil buffer:

void Graphics::CreateDepthStencilBuffer(ID3D11Texture2D* backBuffer)
{
    D3D11_TEXTURE2D_DESC dsTextureDesc;
    backBuffer->GetDesc(&dsTextureDesc);
    dsTextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    dsTextureDesc.Usage = D3D11_USAGE_DEFAULT;
    dsTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    dsTextureDesc.MipLevels = 1;
    dsTextureDesc.ArraySize = 1;
    dsTextureDesc.CPUAccessFlags = 0;
    dsTextureDesc.MiscFlags = 0;
    Microsoft::WRL::ComPtr<ID3D11Texture2D> dsBuffer;
    ASSERT_SUCCEEDED(g_Device->CreateTexture2D(&dsTextureDesc, NULL, dsBuffer.ReleaseAndGetAddressOf()));

    D3D11_DEPTH_STENCIL_DESC dsDesc;
    dsDesc.DepthEnable = true;
    dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
    dsDesc.DepthFunc = D3D11_COMPARISON_LESS;
    ... snipped stencil properties ...
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilState(&dsDesc, g_DepthStencilState.GetAddressOf()));
    g_pDevCon->OMSetDepthStencilState(g_DepthStencilState.Get(), 1);

    D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
    depthStencilViewDesc.Format = dsTextureDesc.Format;
    depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    depthStencilViewDesc.Texture2D.MipSlice = 0;
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilView(dsBuffer.Get(), &depthStencilViewDesc, g_depthStencilView.GetAddressOf()));
}

And I'm calling g_pDevCon->OMSetRenderTargets(1, g_renderTargetView.GetAddressOf(), g_depthStencilView.Get()); after every Present call.

I've been scratching my head for ages wondering what the problem is.  Any clues will be much appreciated!

Edit:
I used the graphics debugger, and apparently the output merger is doing its job, as seen in the screenshot below, but that isn't what I am seeing on screen.
At the top of the pic is the state of the depth buffer, but I can't make sense of it to determine if it's correct or not.

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:
Implementing material deformation I want to implement deformation of plastic material, like plasticine for example. Where should I start to study? What technique should I use?

Thank you for any advice.

EDIT

I want to use it in real-time in kind of a 3D game, not a physics simulation. When I "push" on the plasticine, it is expected to spill. I want to rotate it or any other actions.

Look at this video: http://www.youtube.com/watch?v=mDbVHEg5qC4

sentences:
Random Range Without Duplicates I have an array of gameobjects (some questions) if player hit some triggers a question from the array is displayed randomly, I want to avoid duplication of displaying questions.

 public GameObject[] Q;
 public static int ColliderCounter = 0;
 int WrongAnswerCounter = 0;
 public int i,old;

 private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Obstcle")
        {
            i = Random.Range(0, Q.Length);
            old = i;
            ColliderCounter++;
            Q[i].SetActive(true);
            GetComponent<PlayerMovement>().enabled = false;
        }

    }

 IEnumerator waitWrongAnswer()
    {
            WrongAnswerCounter++;

            yield return new WaitForSeconds(3f);
            Q[old].SetActive(false);
            i++;
            Q[i].SetActive(true);
            old = i;
    }

And I want to know how to check if all questions are displayed do something.

Thanks in advance

sentences:
A terrain with underground tunnels The Terrain tool in Unity is great for constructing 3-D landscapes that are open from above. I am working on a game that happens entirely inside tunnels (specifically, blood vessels in a human body. But it can also be tunnels in an ant nest, or sewers below a city). There is nothing "overground" - all movement is inside the tunnels. I am looking for a tool, similar to Terrain, for easily constructing this complex system of tunnels.
One solution I thought of is to construct a terrain with "half tunnels" (i.e., open from above), then duplicate it, rotate 180 degrees, and "glue" on top of the first copy. But it can only handle one layer of tunnels, and in addition, for some reason I could not rotate the terrain.
Is there a way to construct such underground tunnels with the Terrain tool, or with a different tool in Unity?

sentences:
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:
Apply two animation on one object in unity I am looking for a perfect example to apply two animation on same object and to run those animations simultaneously. In my game, a player is jumping as well as flapping. As per my research, I have got something like this. create both animation in different layer in animator control and then blending those animations. But I could't do that as I can't understand it properly. I need an example that can solve my problem. And I am not importing animations from anywhere. I am creating it in unity only.
Hope for good example.
Thanks in Advance.

sentences: Creating an efficient 2D mobile game background I am working on a 2D unity mobile game and would like some advice on how to save as much MB's as possible with my background images. I can either create 15 600 x 1000 png images through an image manipulation program and import them into unity, each image is roughly 300 kB's before building the project. Or I can import a base background image that i would use multiple times, and also import a sprite sheet with scenery, and just place the sprites on the background layer of my game scene. Note, if i choose the second option there will be 30 - 100 tree sprites, along with enemy and player game objects in view of the main camera at a time. I'm not sure if this second option will bog down the game, because of all the individual sprites on the screen at once.

sentences:
Action Script 3.0 datatype to match C++ iterator? (Code convertion) I am developing a game with Action Script 3.0 using Starling Framework, converting it from C++

C++ Code :

for (std::vector<MyObject*>::iterator i = m_listEnemy->begin();i!= m_listEnemy->end();)
{

    (*i)->update(dt);
    if ( (*i)->m_Hp <=0 )
    {
            (*i)->release();
            i = m_listEnemy->erase(i);
            continue;
    }
    i++;
}

MyObject is the class.

What Action Script 3.0 data type matches the C++ iterator?
Also , how can I convert this C++ code to Action Script 3.0 code?
Thanks in advance!

sentences:
How to pass an argument with ref keyword to a local funtion/ how to work around it? Unity 2019.3

I am writing a few extension methods to make my life a little bit easier, but this one is bogging me down.

I am loading stuff with Unity's Addressable system, and I would like use it by extension methods.

I am passing in my variables (reference type & value type, doesn't matter) to my extension methods, hoping to set them and and hide some complexity and source of bugs, and errors. It seems to me they are passed by value, because when I am trying to use them outside the extension methods, they are not set, null, etc. Not working.

There is a callback called Completed, and I am subscribing with a lambda expression...

I tried with the ref keyword, but obviously the compiler is yelling, that she doesn't want to pass my ref, out whatever parameters to local functions... :(

I tried it out with no local functions, and it did not work without the ref keywork, but it did with it!

You get the idea! Please see my code below!

This is the one that I can't get to work...

///Trying to set the generic variable data from the Addressable assetref
public static void TryLoadData<T>(this AssetReference assetref, T data)
    {
        var handle = assetref.LoadAssetAsync<T>();

        handle.Completed += loadedresult =>
            {
                T result = loadedresult.Result;
                if (result == null) return;
                data = result;
            };
    }

This one does, but only with ref...

///Setting the generic data parameter to the parameter g.
public static void SwapTest<T>(this T g,ref T data) where T : class=> data = g;

I am not sure if there is a workaround, I thought of pointers, or global variables, but not sure which one is the right way to go.

Thanks

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:
How to move objects in any direction by swiping with libgdx android game development first of,  I'm new to android game development so I don't know all the classes and dictionaries within android and libgdx. I'm actually following a game development tutorial for the first time (kilobolt) but I already have some ideas for games I want to make after finishing the tutorial. So here's my question:

Let's say you have a box with a small ball in it. When you touch-hold the ball, you hold the ball "in your hand". Then you swipe across the screen with the ball in hand and "let go" (release touch), the ball rolls in the direction you swiped with the speed of your swipe, decreasing in speed according to a set friction.

Is it possible to implement such a function with libgdx? If yes, could you please explain how to make it?

sentences:
Poor mobile performance when running from Eclipse So after weeks of thinking my rendering code was bad, I accidentally discovered the following:

Running my game on a Nexus S

From Eclipse (Debug as -> Android application): 12fps
From the device
while still attached to USB (getting log info in Eclipse still):
24fps
From the device while not attached via USB: 56fps

I was wondering if anyone else has issues like this?  I mean, the problem really isn't a problem since the final release build will likely have good performance, but for the time being I don't want to have to keep (un)plugging my device in and out when testing code all day long.

Is there some remedy for this or does anyone have any input/advice?

Thanks.

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:
Given a grid system where some coordinates are marked as impassable, how to find natural-looking car driving path between two locations? I can compute an A* path, but I get only cardinal directions from that.   A 45˚ path would look like "up 1 left 1 up 1 left 1 up 1 left 1..."

My specific question is, given a grid with a pathing solution involving non-90˚ paths, how do you figure out those paths?

I have curves working as described here: https://gamedev.stackexchange.com/a/121016/66189

but I just don't know how to combine it with areas that block the path.  I've seen a little bit about "pulling the string", but very little detail.

Another issue I have is that A* will suggest that I immediately go "backwards" for the facing of my car or take way too sharp of a turn.

edit:  How do I make sure I get the blue line, not the red line, which is unusable, even though A* loves it:

The issue I'm seeing here is that a block that isn't usable on the red path is usable for the blue path -- but A* would mark it as unusable or as having a very bad score when checking the red path.

sentences:
Flicking issue on Linux build only I'm about to release my second game in the next couple of days. A tester now reported that he has a flicker issue running the game on Linux. It´s related to objects like the water, the hex tiles and object on top of the hextiles.
In Windows everything works like a charm but on Linux all the graphics flicker. I think it´s a graphical problem related to the Z-buffer since the flicking objects all have the same world space position. I´m using the URP and created all the shader by Unity Shader Graph.
Does anyone know how I can fix the issue?
This it how it looks:

Any kind of help is appreciated!
Thanks in advance!

sentences:
Programming a climbing system like tomb raider I was wondering if anyone knew or had knowledge of how to program a climbing system like the one found in tomb raider/uncharted.

I had thought of just having bounding boxes at all the climbable positions in the game world and then check for collision. If the player was inside the box then they would be "hanging" from the edge. Anyone have any better ideas/improvments?

I already have my rendering set up using directx9 and was going to worry about animation later on.

sentences:
How can I run on multiple platforms using a custom engine? Game engines like Unity and Unreal can run on mutiple platforms. I am wondering how they do this.

I have been using C++ and OpenGL for a while, and what I am looking for is resources to integrate something that will allow me run on different platforms without rewriting.  Something like LibGDX where you write code using a base API and then the API converts it to HTML, Android, iOS, et cetera. I am aware that I can use another engine instead of writing my own but I'm interested in the learning experience.

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:
C# - Monogame- Collision Detection Sprite walking through platforms I am blanking on the logic here. How do I get it so that my sprite doesn't run through a block. It only repels if the center of the player sprite is higher than the bottom of the block.

But when it is lower, it walks right through. It gets lower because my jump function or my grounded function is a bit funky. Anyway, how do I get it so that a player can't go underneath a block unless the sprite is not touching the block at all.

Here is the collision code in my player class, the one that does the collision detection.

public void checkYCollisions(block[] platforms)
    {

        if (position.Y > 700)//this is my ground with no blocks.
            grounded = true;
        else
            grounded = false;

        float Xradius = Width / 2;
        float Yradius = Height / 2;
        block collidedPlatform = null;
        List<block> collidedBlocks = new List<block>();

        foreach (block p in platforms)
        {
            if ((position.X > (p.position.X - p.Width / 2 - Xradius )) &&
                (position.X < (p.position.X + p.Width / 2 + Xradius )) &&
               (position.Y > (p.position.Y - p.Height / 2 - Yradius  )) &&//on top
                (position.Y < (p.position.Y + p.Height / 2 + Yradius   )))//below

            {
                collidedBlocks.Add(p);

            }
        }
        //collisions work for all side of blocks.
        foreach (block p in collidedBlocks)
        {
            if (p != null)
            {
                if ((position.Y <
                    (p.position.Y - p.Height / 2 /*+ radius*/)))//landing on a block
                {

                    grounded = true;

                }

                else if ((position.Y >
                    (p.position.Y + p.Height / 2 /*- Yradius*/))) //jumping up into a block
                {
                    if (y_vel < 0)
                        y_vel *= -1;
                    //player1.direction.Y = -1.0f * player1.direction.Y;
                }

                 else if ((position.X <
                (p.position.X + p.Width / 1.5 /*+ Xradius*/))) // one of the sides
                 {
                     x_vel *= -2;
                 }

                 else if ((position.X >
                     (p.position.X - p.Width / 1.5 /*+ Xradius*/))) // other side
                 {
                     x_vel *= -2;
                 }

            }
        }
    }

Note that I have tried to remove YRadius in the the if loops at separate occurences, and it works to no avail because my guy will not hit the ceiling.

sentences:
Procedual terrain generation and biomes/predetermined variation So I already have some (currently 2D possibly 3D later) simplex noise generation going, and with some experimenting I can make a map for plains, hills, mountains, etc

The problem now is I want to combine those together to create a larger more interesting map. For each "pixel" in the height map I provide/generate a biome type which has a bunch of parameters to define how the height value is calculated etc. i.e. I want to be able to say mountains here, river through there, flood plains next to it, etc and have them blend together.

The problem is this leaves nasty borders since between them even the simplex input values change suddenly (due to the x/z scaling being different, perhaps not the best way?). I considered just doing like a post process to smooth out the height values along the borders, but this would still leave often steep (and uninteresting near constant gradient) slopes since I could have a valley one side and a mountain peek the other side.

I am sure there must be a better fairly standard way to do this, but have not found much searching around, at least for this sort of noise function (midpoint displacement can be seeded with initial values at a low resolution, but doesn't seem viable if not generating the entire map at once)

double getHeight(int x, int z, Biome biome)
{
    double nx = x;
    double nz = z;
    nx *= biome.xzNoiseScale();//e.g. 1/64
    ny *= biome.xzNoiseScale();
    double noise = fbm(nx, nz, biome.noiseOctaves(), biome.noiseLacunarity(), biome.noiseGain());
    return biome.baseHeight() + noise * biome.heightVariation();
}

double fbm(double x, double z, int octaves, double lacunarity, double gain)
{
    double amp = 1;
    double freq = 1;
    double sum = 0;
    for (int i = 0; i < octaves; ++i)
    {
        sum += amp * noise(x * freq, y * freq);
        amp *= gain;
        freq *= lacunarity;
    }
    return sum;
}

sentences:
How do I position a 2D camera in OpenGL? I can't understand how the camera is working.
It's a 2D game, so I'm displaying a game map from (0, 0, 0) to (mapSizeX, 0, mapSizeY).

I'm initializing the camera as follow :

Camera::Camera(void)
  : position_(0.0f, 0.0f, 0.0f), rotation_(0.0f, 0.0f, -1.0f)
{}

void            Camera::initialize(void)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glTranslatef(position_.x, position_.y, position_.z);
  gluPerspective(70.0f, 800.0f/600.0f, 1.0f, 10000.0f);
  gluLookAt(0.0f, 6000.0f, 0.0f,
            0.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);
}

So the camera is looking down. I currently see the up right border of the map in the center of my window and the map expand to the down left border of my window. I would like to center the map.

The logical thing to do should be to move the camera to eyeX = mapSizeX / 2 and the same for z. My map has 10 x 10 cases with CASE = 400, so I should have :

gluLookAt((10 / 2) * CASE /* = 2000 */, 6000.0f, (10 / 2) * CASE /* = 2000 */,
            0.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);

But that doesn't move the camera, but seems to rotate it.

Am I doing something wrong?

EDIT :

I tried that:

gluLookAt(2000.0f, 6000.0f, 0.0f,
            2000.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);

Which correctly moves the map in the middle of the window in width. But I can't move if correctly in height. It always returns the axis Z. When I go up, It goes down and the same for right and left.

I don't see the map anymore when I do :

gluLookAt(2000.0f, 6000.0f, 2000.0f,
                2000.0f, 0.0f, 2000.0f,
                0.0f, 1.0f, 0.0f);

sentences:
Recognize L-Shape in a 4x4 Matrix I'm trying to make a board game, there the player has to press four buttons to make the L. It can be mirrored or rotated, it just has to be an L.
But if the player press four buttons and make another shape, like a line or a Z, the system must recognize it and alert the player.

sentences:
Free camera rotation in 3D space I'm using a view matrix to do camera movement and rotation.

viewMatrix = new Matrix4f();
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), viewMatrix, viewMatrix);
Matrix4f.translate(new Vector3f(x * (-1), y * (-1), z * (-1)), viewMatrix, viewMatrix);

I'm manipulating the rotation values around each axis here:

//left and right
public void rotateY(float amount)
{
    ry += amount;
}

//Up and down
public void rotateUp(float amount)
{
    rx += amount;
    if(rx < -90)
        rx = -90;
    if(rx > 90)
        rx = 90;
}

This all works fine. Now i'm trying to create a more "free" camera so that i always turn left an right and don't simply rotate around the Y-Axis.

For the rotation up you simply remove the if-cause. But for the rotation sidewards you need to calculate the parts for the x- and the z-axis using sin and cos. That's where i get confused. How can i rotate sidewards correctly?

sentences:
OnCollisionEnter only triggering if colliding object starts inside collider Despite the absurdly high number of "OnCollisionEnter not working" threads around the internet, no one else seems to have had this specific problem.

To start off with, I have a spherical "shield" object around my ship, which has a shader designed to give off impact effects when hit by an object. To trigger the shader impact effect, you need to give it the position from which do the effect. So, the easiest way to do this is to give the shield a Collider and, whenever OnCollisionEnter is called, it sends the contact.point details to the shader. That's not the difficult part. The part that isn't working is that OnCollisionEnter is not being called when the laser bolt fired at the shield actually collides with the shield.

Both the shield and the laser bolt have Sphere colliders, both are not triggers. Only the shield has a rigidbody, which is not kinematic.

void OnCollisionEnter (Collision collision) {
    Debug.Log (Time.time);
    if (collision.transform.tag == "Impact") {
        Debug.Log ("go");
        //Does the shader stuff
        }
    }
}

That script is attached to the shield object. Not only is "go" never being logged, but neither is the Time, so OnCollisionEnter is not being called.

The odd thing about this scenario is that, OnCollisionEnter will be called by objects that begin inside the shield's collider - so if I start the laser bolt inside the shield, then the function gets called as usual. But when I start the laser outside the shield and Translate it into the shield, nothing happens. For the life of me, I can not work out what's going wrong with it.

sentences:
java slick2d - key press being ignored I have the following in my update funtion. The first input for key_enter when textPos!=2 works fine, but the one when textPos==2 doesn't work. The key up and down work fine though.

The System.out.println("Enter: " + choice); never gets printed

public void update() {
        Input input = gc.getInput();
        if (input.isKeyPressed(Input.KEY_ENTER)) {
            if (textShowing && textPos != 2) {
                textPos++;
                textShowing = false;
            }
        }
        if (textShowing && textPos == 2) {
            if (input.isKeyPressed(Input.KEY_ENTER)) {
                System.out.println("Enter: " + choice);
                if (choice == 0) {

                } else if (choice == 1) {

                } else {
                    textPos++;
                    textShowing = false;
                    System.out.println("Text Pos: " + textPos);
                }
            } else if (input.isKeyPressed(Input.KEY_UP)) {
                if (choice > 0) {
                    choice--;
                }
            } else if (input.isKeyPressed(Input.KEY_DOWN)) {
                if (choice < 2) {
                    choice++;
                }
            }
        }
    }

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:
How to disable Monogame pixel font antialiasing? I am using Monogame 3.4 (I have held off upgrading to 3.5) and am on Windows 10. I'm drawing using the PointClamp setting (as suggested in this similar question).

Whenever I render text with DrawString(), the text is extremely antialiased, as shown below. However, any stretched textures I draw are NOT antialiased, and seem to use the PointClamp setting as expected.

Here are some examples of drawn text:

How do I disable text antialiasing so that fonts don't blur?

EDIT:

It seems that changing some import settings in the .mgcb changes the quality of the AA? When "processorParam:TextureFormat=Color" is changed to "processorParam:TextureFormat=Compressed", it makes the AA more pronounced. The issue is still not solved, but I feel like the font import settings may have something to do with it. Here is the .mgcb

#begin DwellFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Color
/build:DwellFont.spritefont

EDIT 2

Since this question got flagged as a duplicate, let me explain. The other question I have already referenced above uses PointClamping. I already use PointClamping, and it works fine with the textures I render (they aren't antialiased). It does not, however, work with my fonts. Therefor, that other question isn't applicable. I'm wondering why that is.

sentences:
Whats the mobile touch version of raycast2D and Input.GetAxis Mouse X and Y in Unity? I tried
      float pointer_x = Input.GetAxis("Mouse X");
      float pointer_y = Input.GetAxis("Mouse Y");
      if (Input.touchCount > 0)
      {
          pointer_x = Input.touches[0].deltaPosition.x;
          pointer_y = Input.touches[0].deltaPosition.y;
      }

`
for Mouse X and Y but didn't do the results i wanted. I basically have shapes that I want to move on the X and Y axis. So when I move up and Down only move on Y axis, and when I move left and right only move on X axis.
The Raycast2D mobile version of this I'm not sure either.
         Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);

         RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero);

         if (Input.GetMouseButtonDown(0))
         {

             for (int i = 0; i < empty.Length; i++)
             {
                 empty[i] = true;
             }

             if (hit.collider != null)
             {
                 startPos = transform.position;

                 offset = gameObject.transform.position -
                          Camera.main.ScreenToWorldPoint(
                          new Vector3(Input.mousePosition.x,
                          Input.mousePosition.y, screenPoint.z));
             }
         }

         if (Input.GetMouseButton(0))
         {

             if (hit.collider != null)
             {

                 Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
                 Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;

                 if (!posY)
                 {
                     if (Input.GetAxis("Mouse X") > 0.1 ||
                         Input.GetAxis("Mouse X") < -0.1)
                     {
                         posX = true;

                         if (Mathf.Round(transform.position.y * 2f) * 0.5f == Mathf.Round(hit.transform.position.y * 2f) * 0.5f)
                         {
                             transform.position = new Vector3(curPosition.x, startPos.y, curPosition.z);

                         }
                     }
                 }

                 if (!posX)
                 {
                     if (Input.GetAxis("Mouse Y") > 0.1 ||
                         Input.GetAxis("Mouse Y") < -0.1)
                     {
                         posY = true;

                         if (Mathf.Round(transform.position.x * 2f) * 0.5f == Mathf.Round(hit.transform.position.x * 2f) * 0.5f)
                         {
                             transform.position = new Vector3(startPos.x, curPosition.y, curPosition.z);
                         }

                     }
                 }

 Mathf.Round(transform.position.y * 2f) * 0.5f + " " + Mathf.Round(hit.transform.position.y * 2f) * 0.5f);
             }

         }

         if (Input.GetMouseButtonUp(0))
         {
             posX = false;
             posY = false;

             if (hit.collider != null)
             {
                 transform.position = new Vector3(outputX, outputY);
 Mathf.Sign(hit.transform.position.x) * (Mathf.Abs((int)hit.transform.position.x) + 0.5f));

 Mathf.Round(transform.position.y * 2f) * 0.5f + " " + Mathf.Round(hit.transform.position.y * 2f) * 0.5f);
             }

             if (Mathf.Sign(transform.position.x) * (Mathf.Abs((int)transform.position.x) + 0.5f) >= 2.5f ||
                 Mathf.Sign(transform.position.x) * (Mathf.Abs((int)transform.position.x) + 0.5f) <= -2.5f ||
                 Mathf.Sign(transform.position.y) * (Mathf.Abs((int)transform.position.y) + 0.5f) >= 1.5f ||
                 Mathf.Sign(transform.position.y) * (Mathf.Abs((int)transform.position.y) + 0.5f) <= -4.5f)
             {
                 Destroy(gameObject);
             }

             clicked = false;
         }

sentences: Using Smaller Textures in Unity on Older/Smaller devices In Unity, when you have MipMapping selected, will this cause the full size texture to always be brought into memory? I have a game which runs on high end mobile devices with ultra-high resolution textures, but I have complaints of it crashing on smaller/old devices. Will this fix it, or is there a more fitting way to address this problem?

sentences:
ArmA 3 Scripting: Delete vehicle depending on present players I'm fairly new to ArmA 3 scripting, and I'd like to know how to only spawn starting vehicles depending on how many players opt in to the mission. Say, the mission has four slots, but only two people fill them. There would be four vehicles, but two would be deleted on the mission start because those players weren't present. I've tried putting this code in the initialization of each vehicle;

sleep 1; if (isNull unit1) then {deleteVehicle this} else {};

But it only gives me errors when the mission starts.

sentences:
Art Guide Theory: Lighting an Game Environment (Objectives, approach/workflow and mood) in PBR What's the theory behind the Lighting an Game Environment in a Physically Based Renderer?

As far my research, lighting an scene is done with different Rules and Different Ways of Lighting an Scene depending upon the scene.

For an Interior scene - Omni Lights, Area Lights, point Lights and Spot Lights with baking is used to give proper amount of illumination.

whereas for an Outdoor Scene - Directional Lights, Area Lights, Point Lights are used to illuminate the scene with baking Lightmaps.

Usually to Light Individual Objects, 3 point Lighting is used and colors signify the Mood of the Scene.

But, the 3 point lighting is unfavorable for Game Environment, So, what's the Good way to start and what are the main objectives in Lighting an Scene?

How Lighting an Scene Contributes to the mood of the scene? like here -

sentences:
What is the minimum of shader I need to use to run basic calculation on GPU? I read, that the Hull Shader, Domain Shader, Geometry Shader and Pixel Shader can be used optional. So, is the Vertex Shader optional too? If no: What does a basic Vertex Shader look like? Just like a simple pass through? Is the Vertex Shader necessary to tell what kind of datastructure (Van Stripes or Meshes) are used? What can I do, with just the vertex shader?
Are the fixed functions working without any help of programming a programmable stage?

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: Is point texture filtering the same as nearest? Is point texture filtering the same as nearest (different names for the same technique)?

sentences:
Calculate turn rate between xy and target xy on a moving sprite with variable speed My First question on here so be kind...

I am writing an aerodrome simulator in as2, I need to calculate a turn rate between 2 points so that the aircraft turns nicely. I have tried a few things but the maths forums on this type of subject use complex calculations and I struggle to understand them. I need an answer in a more variable specific format.

I have the XY of both tile and target, the speed of tile and the distance of target from the tile.

I use vector math, with frame time calculations to move the tile. I already have a good calculation for shortest turn i.e. left right.

I need to calculate the turn rate required to go from point a to point b in a nice fluid motion and turn the tile/aircraft in a nice fashion.

Any help would be much appreciated.

sentences:
Is there a way to check if an object is currently colliding with anything? I need to test from another Script on a different GameObject, whether a particular GameObject is colliding with anything (in particular using trigger).

So, for my purpose, I don't need OnCollisionEnter/OnTriggerEnter events, but I need something like this:

if ( myObject.isOnCollision )
   do something

How can I do this?

sentences:
Sprite animation frames in Adobe Photoshop CC I am creating 64x64 px sprites for my game and want to test the animation play before saving the sprite sheet in game.

I watched this video to learn, which told me:

1) Click Window->Timeframe

2) Add selected Frame

3) Click duplicate frame, then Tween frames in between. These icons on the bottom left of timeline:

The issue is, he doesn't show how to do it if my sprite needs to animate in place... only if it moves across a canvas as such:

My game uses Texture Packer to pack individual 64x64px images and then renders the frames. Therefore, I need to make little adjustments to the single frame in place, and animate them:

I tried selecting my next frame layer for my sprite and duplicating it, but it only ends up duplicating the first frame.

How can I add my selected layer in my Layers to the timeline?

sentences: How should the physics be on an halfpipe like in a skate game in Unity? I am making a inline skating game. My player is skating based on the normals of the surface of the ground. But when I skate up a halfpipe it flies in the Air but doesnt comes down like it should be, it changes position in the Air and my player falls horizontally on the ground I cant get up anymore like this when he is lying on the Ground. I want it to be physically jump up and come down again the player should align on the ramp again not just fly in the air and drop down on the ground? What infos should you need to answer this question properly I will edit the question then?

sentences:
Reimplemented steering seek behavior from PyGame to LÖVE is much slower than original I'm learning about steering behaviors and watched this nice explanation tutorial - https://www.youtube.com/watch?v=g1jo_qsO5c4&feature=youtu.be with the source code available at https://github.com/kidscancode/gamedev/blob/master/tutorials/examples/steering/part01.py. The example app is written in python and PyGame and behaves like:

The main code parts of it are:

MAX_SPEED = 5
MAX_FORCE = 0.1

def seek(self, target):
    self.desired = (target - self.pos).normalize() * MAX_SPEED
    steer = (self.desired - self.vel)
    if steer.length() > MAX_FORCE:
        steer.scale_to_length(MAX_FORCE)
    return steer

def update(self):
    self.acc = self.seek(pg.mouse.get_pos())
    self.vel += self.acc
    if self.vel.length() > MAX_SPEED:
        self.vel.scale_to_length(MAX_SPEED)
    self.pos += self.vel
    # ...

I tried to reimplement this example in lua with Love2d framework and HUMP vector utility, source code is available at - https://github.com/voronianski-on-games/sandbox/blob/master/src/steering/seek_love2d/main.lua.

The code is pretty similar with the same constant values of MAX_FORCE and MAX_SPEED:

function Mob:new ()
  -- ...
  self.maxVelocity = 5 -- a.k.a MAX_SPEED
  self.maxSeekForce = 0.1 -- a.k.a MAX_FORCE
  -- ...
end

function Mob:seek (target)
  self.desired = (target - self.pos)
  self.desired:normalizeInplace()
  self.desired = self.desired * self.maxVelocity

  local steer = (self.desired - self.vel)

  if steer:len() > self.maxSeekForce then
    steer = steer:trimmed(self.maxSeekForce)
  end

  return steer
end

function Mob:update (dt)
  self.acc = self:seek(vector(love.mouse.getPosition()))
  self.vel = self.vel + self.acc * dt

  if self.vel:len() > self.maxVelocity then
    self.vel = self.vel:trimmed(self.maxVelocity)
  end

  self.pos = self.pos + self.vel * dt
  -- ...
end

But behavior is different. Square is much more slower in lua implementation though the values are the same:

What could be a problem? Or what is the difference that I couldn't notice?

sentences:
Using Lazer with a Quadtree I have a quadtree implementation that works well with what I need for handling collisions between enemies, projectiles, and heroes.

However, most of these types of entities are pointbased, with varying radius but that's about it.

I have a weapon idea for lazer or ray weapon that's essentially a line.  How does something like that fit in to working with something like a quadtree?  Normally when we have a quadtree, we are essentially letting that data structure handle point masses to figure out which subset of objects we need.  How then might we handle something like a line?

The dumb way to do it is to just query the enemies and do something like a circle line intersection test on all the enemy objects.  This is obviously not efficient especially when we already have a quadtree.

One idea i have are to just put some dummy projectile object along the line and submit those to the quadtree.  Then if we get any returned objects from those dummies, then we can use the circle line intersection test on it.

Any ideas pertaining to how to use ray weapon that requires some line intersection test with a quadtree would be appreciated.  Thanks.

sentences:
Improving bouncing logic - Atari breakout clone I'm creating an Arkanoid clone using Haxe and Openfl. I'm thinking the bouncing algorithms could be improved. But I'm not sure how to handle those. I was hoping you guys could help.

    private function bounceBall():Void {
    var direction:Int = (ballMovement.x > 0)?( -1):(1);
    var randomAngle:Float = (Math.random() * Math.PI / 2) - 45;
    ballMovement.x = -1 * Math.cos(randomAngle) * ballSpeed;
    ballMovement.y = Math.sin(randomAngle) * ballSpeed;
}

Since I've never coded anything in Haxe I followed a tutorial to build a pong game. This is one of the functions that was used in the pong exercise. I think it's causing the ball to bounce left/right and rarely up or down. Can you guys help me out? How can I recreate the arkanoid bouncing ball logic?

You can find the rest of the source Here

sentences: Creating an alphabet with numbers in 3d using opengl-es How should I create an alphabet with numbers in 3d in opengl-es? I'm trying to create them with the existing primitives, but it's not looking good. Do we have any alternate way to get these things done? If so, please let me know! Thanks in advance.

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:
How does normal mapping really work? I'm trying to grasp the concept of normal mapping, but I'm confused by a few things. In short, I'm not sure whether a normal map is viewpoint dependent or not (i.e. whether you'll get a different normal map of the same object when you rotate around it). Secondly, I don't get why the blueish color is the predominant color in normal maps.

How I think about normals, and their relation to RGB colors, is as follows. The unit sphere represents any unit normal possible — in other words, the X, Y and Z components of a unit normal vector range from -1 to 1. The components of an RGB color all range from 0 to 255. Therefore, it makes sense to map -1 (normal component) to 0 (color component), 0 to 127 or 128, and 1 to 255. Any value in between is just linearly interpolated.

Applying this mapping to the normals of an arbitrary 3D object results in a very colorful picture, not at all predominantly blue. For example, when taking a cube, all six faces would have a different, but uniform, color. For instance, the face with the normal (1,0,0) would be (255,128,128), the face with the normal (0,0,-1) would be (128,128,0) and so on.

However, for some reason the normal maps of a cube I found are completely blueish, i.e. (128,128,255). But clearly, the normals are not all in the positive z-direction, i.e. (0,0,1). How does this work?

[Edit]

Ok, so the approach described above seems to be referred to as the object space normal map or the world space normal map. The other one is called the tangent space normal map. I understand how such a tangent space normal map can be used to modify the normals of a geometry, but I'm still not completely sure how it is actually calculated (see my comment at Nicol Bolas' answer).

[Edit 2]

I should probably mention that I'm working with piecewise parametric surfaces. These surfaces consist of a set of surface patches, where each patch is associated with its own parametric space (u,v) = [0,1] x [0,1]. At any point on the surface, the normal can be calculated exactly. Apparently, the vectors T (tangent) and B (bi-tangent) — required to span the tangent space — are not simply the partial derivatives of the surface patch in the direction of u and v...

sentences:
How can I Debug.Draw different shapes in unity? I want draw new shapes in Sence for example I want Debug.DrawSphere can I Debug.DrawCollider?
Is possible that I Debug.DrawSphereCast

sentences:
Smoothing edges on procedural terrain Using perlin noise to create a procedural island for a tile-based game. My map is stored in a 2d array, with each tile having a type (deep water, shallow water, beach, grass, forest, hill, mountain).

What would be the most efficient way to go through my map, after it's generated, and smooth out the edges of the terrain? Using a tileset, we run into issues with a 1x1 tile that sticks out by itself.

sentences:
How to create a depth-recording shader for shadow mapping? I am attempting to implement shadow maps.

I am first going to implement spotlights over directional lights (I am aware this is harder).

Since I was already rendering the geometry, my attempt was to recycle my old shaders and modify them to make shaders to create the depth maps.

This created the following vertex shader:

#version 450

layout(location = 0) in vec3 position; //(x,y,z) coordinates of a vertex

layout(std430, binding = 3) buffer data_buffer
{
    vec4 cubes_info[];//first 3 values are position of object
};

uniform mat4 view = mat4(1); //Camera orientation and position
uniform mat4 proj = mat4(1); //The projection parameters (FOV, viewport dimensions)

void main()
{
    gl_Position = proj*view*(vec4(position, 1.0) + vec4(vec3(cubes_info[gl_InstanceID]),0));
}

And fragment shader:

#version 450

layout(location = 0) out float fragmentdepth;

void main()
{
    fragmentdepth = gl_FragCoord.z;
}

As you can see, both shaders are pretty basic, they are a little more complex than they would otherwise be since they are using instancing, but overall they are simple.

However the output of these shaders is:

Where the original image is:

As you can see, the depth is being lost.

I think this is because my perspective, projection and model matrices are identical for both shaders.

In other words, I think that the camera I use for rendering the second image does not store the depth information. I wanted to know how can you generate a similar projection matrix to store the depth?

sentences:
How to create a similar 2.5D art style character EDIT: I am asking about the characters not the 2.5 scene

I am the graphic designer of a game and I want to recreate the look and feel of these images:

My questions are:

Does this style have a specific name?
Can you link me to tutorials for this game style?

sentences:
What are the common character animation techniques used in tile based hack&slash games? I wonder what kind of animation techniques are used for creature and character animation in modern hack&slash type tile based games? Keyframing for different actions may be one option. Skeletal framing may be another. But how about the physics? Or do they use a totally hybrid system of inverse kinematics supported with a skeleton,physics and mixed with interpolated keyframing for more realistic animations? If so, how and for what reasons? I can think of many different solutions for the issues below but I wonder what's used and best suited for issues like:

Walking or moving on an uneven terrain
Combat interaction, combat physics and collisions
Attaching rigid items to character and their iteractions ih physics world
Soft body dynamics like hair, vegetation, clothes and fabric in line with animations and iteractions.

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:
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:
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:
Is it possible to avoid global data in a Multi User Dungeon (MUD)? I am currently designing a Multi User Dungeon (MUD). For those who do not know what it is, they are the ancestors of MMORPGs. There is no graphics, everything is played in a console by typing commands. Players move into rooms, fight monsters, earn xp, and so on.

I am programming in C++ and use Boost. I am inspired by several examples of MUD that I found on the internet whose source code is available.

In each of the examples I found, global variables are often used: the list of players, the list of connected players, the list of rooms, etc. Indeed, these data are used absolutely everywhere in the program. They are at the heart of the game. 80% of the code consists in manipulating these data. I understand that others have been tempted to declare these data as global variables.

But I understand the danger of global variables and the problems that their use raises.

The problem is that I cannot imagine a viable solution that would prevent me from using global data.

I will try to give you a description of my architecture to illustrate my problem:

a class Server (linked to a list of sessions)
a class Session (linked to a connection instance)
a class Connection Instance (linked to a Player, a Session and a Context)
a class Player (linked to a Room)
a class Area (contains Rooms)
a class Room
a class Context (used to differentiate the different contexts: normal play, or when the player types his name and password, etc)
a class Command (for example, “kill a mob”)
many others…

I am not sure to know how I can have an access to every room/player/npc/object in the game in all these classes without passing everywhere a reference or a pointer to an object containing the whole game as parameter.

For example, a player might have a "kill every player in the world" command. "KillEveryoneCommand" that would inherit "Command". But where would this list of players be stored? How could it be accessed from the "Player" class or from the "KillEveryoneCommand" class?

Theoretically, a player could also have a command to ignite all the rooms of an area, or to communicate with another player from a distance... All these things are done without any problem with global data.

Would an online game with such central and shared data be a good exception for using global data?

sentences:
Fill closed object with water - maintaining volume I'm showing the problem in 2D, but basically given a volume V (can be approximate), where should the center point of an upwards facing plane P be for any given rotation of the object? I'm not doing a strict fluid simulation, it doesn't need to pool in isolated areas or slop around, it's just (I think) a volume preservation exercise.

To reiterate, V is known, P is what i'm trying to solve.

Do I need to voxelize the object and essentially count boxes from the lowest bounds up?

Edit: Here's the code based on Bálint's response. Note that I haven't tested it yet (you'd call the top function and the second one is iterative).

https://pastebin.com/N4Mimnwg

sentences:
Game loop in Javascript I've been into javascript game programming with html5 and canvas lately. So far I've only been able to implement a game loop with setInterval, but I'm aware this means using fixed timestep. I've always used game engines with the "delta time" approach, I'm sorry I can't recall how that timestep was called. But anyway, I had several questions.

How could I implement a game loop with the delta time approach?
Will I get benefit from it in any particular way?

Also any information you point out related to that is welcome.

sentences:
How would you code an AI engine to allow communication in any programming language? I developed a two-player iPhone board game. Computer players (AI) can either be local (in the game code) or remote running on a server. In the 2nd case, both client and server code are coded in Lua. On the server the actual AI code is separate from the TCP socket code and coroutine code (which spawns a separate instance of AI for each connecting client).

I want to be able to further isolate the AI code so that that part can be a module coded by anyone in their language of choice. How can I do this? What tecniques/technology would enable communication between the Lua TCP socket/coroutine code and the AI module?

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: What uses are there for multiple UV maps on a model? I'm trying to think of some reasons why there might be more than one UV map on a mesh. Usually I just unwrap the model, and the same UV map works for both the diffuse color texture, the bump map texture, and any other textures I chose to add. Are there any examples of when a model might need more than one UV map?

sentences:
Unity: Render only select objects but show previously rendered objects I am making an RTS game which is having performance issues.

Is it possible to render the ground and units separately so I can only render the ground when the camera moves but keep the result displaying the units over the top?

I'm not sure what details to include but:

*The camera is fixed angle and orthographic

*The profiler says drawing takes up about 50% of CPU when units are moving.

*All the logic is done by a c# script outside of monoDevelopment but called through a gameobject each frame, (takes 2% of cpu in tests).

*Units are put in place using the "transform.position" command each frame.

*Units and tiles are instantiated and destroyed when the Camera passes them.

*The game is using rigged .3ds models for the units.

*The units have disabled rigidbodies.

*Each tile in the game is a separate sprite.

*The performance drops with ~100 low poly units without animation or ~20 higher poly units with animation.

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:
What is a cheap (better free) way to make multiplayer in a shooter? I'm a newbie indie, so I don't have a budget for a game. But I'm making a 3rd person shooter and I need multiplayer for it.
It's a mech shooter, so it won't have very fast movements, meaning I don't need fast sync between participants.

I've thought about peer-to-peer, it seems good, but what if the host's PC crashes or they just kill the game? It would be the end of the whole match!
So it seems like I need to have some sort of centralised server, but do I really need a dedicated server, and even a number of servers to be able to host thousands of matches? Or can I sync it through database services like playfab somehow?

sentences:
Entity Component Architecture and Scripting without using threads I am working on a small game engine for practicing purpose and also for putting
some of my ideas into action. What I have so far is a couple of systems for
rendering, sound etc. The next step is to put all these things together.
I already looked into entity component systems, in particular the following
article:
http://www.gamedev.net/page/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

I think that this approach would suit my needs to a certain level, but I also
would like to implement the game logic itself inside scripts. I came up with a
slightly different approach:

The rendering, sound, physics, input and simulation systems perform actions
on the data, which is basically a level object and a list of entities
(for technical reasons I have to distinguish between entities and level
geometry). The particular systems only perform actions on those entities which
match their criteria (e.g. the physics system only handles entities with a
bounding volume). In my approach the systems do not directly implement behavior.
Instead they are either creating output (rendering, sound) or input
(physics, input). The simulation system manages the scripts which may be
assigned to entities. The script of an entity consists of two parts, first the
initialization code which is executed when the entity is added to the scene,
and second the code which is executed once per frame (or less, depending on
whether the code contains a wait-statement). Additionally every entity may
implement event handlers which are called whenever the input or physics system
throws an event (e.g. a CollisionEvent, KeyDownEvent etc.). Entity scripts may
define parameters, which can be modified inside the level editor.

My question is, whether this architecture has some severe weaknesses. Since I
want to avoid threading, my scripts will be scheduled by the simulation system,
which lead me to the restriction that an entity script is called once per frame
(which means that loops should be avoided, since basically everything already is
inside a big loop). Is this reasonable or is there any better way?

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: 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 render text above a mesh in DirectX 9? I want to render some text over a mesh in my DirectX app. It will have a similar application to health bars for units in games, just as text rather than a bar. I'm looking for the simplest way to do this.

It's a Win32 app, I'm using DirectX 9 and I need it to be in 3D (i.e. when the unit is moving around the Z-axis, the text above moves with it).

Any ideas?

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:
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:
How can I use tilt sensor in iOS iPad to steering a car I am absolute beginner with unreal engine , I am working in car race project

here is my situation : I need to navigate my car in left and right direction using tilt

Here is what I do  I read tilt sensor value then break vector to (X,Y,Z)

as appear in image I need to read Y value , I call set steering input passing Y value.

I hope my question be clear  , I appreciate any help

sentences: How can I use Jung, GraphStream or JGraphT with LibGDX? All libraries I found (JUNG, JGRAPHT, GraphStream) use Swing when I use libGDX. How you can use them with LibGDX

sentences:
How do I find out if this particular puzzle can still be solved? A while ago, I made a simple game that involved swapping birds to combine them and release them to create points. The idea is that eventually, the birds would get stuck and your game is over, but I found it tremendously hard to think of a way to detect a game-over, so I published it without such an algorithm and just hoped people would see it for themselves. However, I'm still very interested in a solution and hoped someone could help me.

The game works as follows:

6 different kinds of birds are distributed over an n x n (usually 4 x 4) grid.
For every two birds of the same type, if they would form a perfect rectangle together, they merge into one bigger bird of the same type. This means you can have birds that are, for example, 4 x 1 or 3 x 2.
Birds that are big enough can be removed from the grid, generating points. What's 'big enough' depends on the type of bird, some only need to cover 1 square on the grid, others 2 or 3.
Empty squares on the grid will get filled up with new, random birds falling from above. That is, of course, as long as other birds don't block the way. All birds always fall down when they can, and moving a bird upwards is therefore impossible (though, swapping upwards is allowed).
Two birds can swap places if they are of the same width when swapping vertically, or of the same height when swapping horizontally, but only when they are aligned perfectly. A bird can always move to an empty spot, given that its new position would be large enough to contain it and that the new spot wouldn't deny gravity.
Eventually, groups of 2 tall/wide birds will prevent anymore progress. Some birds can still be swapped, and maybe some would even become big enough to be removed when combined with certain others, but they will never get near each other, resulting in a game over.

I'm not too sure whether this is clear enough. I don't really want to post a link to the game here because I'm really only interested in the algorithm, not new downloads. Also I'm not too sure if I'm allowed to, as it could be seen as an advertisement. But please request more clarity where needed!

sentences:
Unity applying forces using animation I'm trying to make a croquet mallet swing to hit the ball using an animation that rotates the mallet mesh. The mesh appears correctly positioned to hit the ball in the center but the ball doesn't go straight. Using a script with rigidBody.AddForce works fine. I do have Animate Physics selected on the animator and have explored many other options. Is there a way to debug the physics in this situation? Am I going about it the wrong way to use an animation to apply a force?

This is what it looks like now:

sentences:
variable number of lights in a glsl shader? I want to render an arbitrary number of lights in my fragment shader. I do not understand how you can properly pass them into the shader though. For example, I want something like this:

uniform int numberOfLights;

struct PerLight
{
    vec4 position;
    vec4 intensity;
}

uniform Lights
{
    vec4 ambientIntensity;
    float lightAttenuation;
    PerLight lights[numberOfLights];
} Lgt;

I've only seen documentation and examples use 'numberOfLights' as a constant and I cant get above to work so I am guessing you cant have a dynamicly sized struct in glsl.

So, how are you supposed to pass any given number of lights to the shader?

sentences:
Multiple Key Presses in XNA? I'm actually trying to do something fairly simple.

I cannot get multiple key presses to work in XNA. I've tried the following pieces of code.

else if (keyboardState.IsKeyDown(Keys.Down) && (keyboardState.IsKeyDown(Keys.Left)))
{
      //Move Character South-West
}

and I tried.

else if (keyboardState.IsKeyDown(Keys.Down))
            {
                if (keyboardState.IsKeyDown(Keys.Left))
                {
                      //Move Character South-West
                }
            }

Neither worked for me. Single presses work just fine. Any thoughts?

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: how to apply force/impulse perpendicular to the moving direction in box2d How can i apply or impulse to an object perpendicular to its moving direction in a top down game. Like if object is moving up, i press left or right, then force or impulse should be applied to left or right direction(object can be at any angle).

sentences:
Replacement memory allocators - pros and cons I am developing a hobby project to learn game engine development and to have a platform where I can test new ideas and have fun. Currently I have a quick-and-dirty multiplayer server and client using some third party libraries (enet for networking and Ogre3D for rendering). My "game" is mostly like a free-ride sandbox.

I have read some great articles about custom memory allocators and all the benefits - complete control, different strategies for different game objects, tracing and profiling. But also I have read that it is hard to develop an allocator which is better than the default one and that it might be hard to get it to play nicely with 3rd party libraries.

As it seems so hard to develop a custom allocator, I thought about using jemalloc but I'm not sure if it is a good choice for game server and/or client.
I tried to find some 3rd party free/open source memory allocators designed specifically for game engines but I could not find anything production-ready.

I really would like to track allocated objects by their type - to see how many network packets I have, how much memory is taken by meshes, static objects, NPCS etc. and also to see where exactly are some memory leaks coming from. Also I would like to avoid having to restart my game server regularly because of memory fragmentation issues.

What is your experience? Is it a good idea to use some general purpose memory allocator (like jemalloc or tcmalloc) for game servers and clients or should I develop my own custom allocator (which seems a daunting task considering that I don't have enough experience with advanced C++)?

How do I integrate my custom memory allocator with popular 3rd party libraries (enet, Ogre3D, some physics libraries) if I have no idea what allocation mechanisms are used inside of those libraries?

If I decide not to use a custom allocator and stay with the one provided by MSVC runtime, is there any simple way to track my memory usage and prevent memory fragmentation without sacrificing performance?

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:
Instantiate unity sometimes lags the game some times it doesnt I have a script that instantiates a object lets say every half a second. THis object is of the type .fbx and has a file size of 53kb, lets call this object A. When i use this object my script instantiates the objects without any freezes or any other problems.

Now i have an other object also of type .fbx and also with a filesize of 53kb lets call this object B. Now when i want to instatiate object my my game freezes a few frames upon instantiation.

Why? Is there a way to instatiate objects more efficiantly? I already looked at using object pooling but this doesnt really works in my case.

See here a screenshot for object A, and its components:

See here object B and its components:

Per request the code that does the instantiation of the objects:

public class ForLoopVisualization1 : MonoBehaviour {

    public DetectorAreaScript ElementDetector;
    public GameObject TowerElement;
    public Transform TowerElementsParent;
    public bool WigglyTower = false;
    public float ElementSpacing, Wiggeliness;

    private Collider BuildElementCollider;
    private Transform BuildElementTransform;
    private Vector3 TowerElementPos;
    private int TowerElementCount, CreatedElements;
    private bool StartBuildingTower = false;
    private float Delay = 0.5f, TowerElementSize;

    // Use this for initialization
    void Start () {
        ElementDetector.DetectedData += OnObjectEnterDetector;
        Destroy(TowerElement.GetComponent<Rigidbody>());
        TowerElementSize = TowerElement.GetComponent<Collider>().bounds.size.y;
        TowerElementPos = TowerElementsParent.position + new Vector3(0, TowerElementSize * 1.5f + ElementSpacing, 0);
    }

    // Update is called once per frame
    void Update () {
        if(StartBuildingTower && CreatedElements < TowerElementCount)
        {
            Delay -= Time.deltaTime;
            if(Delay <= 0)
            {
                CreatedElements++;
                var te = Instantiate(TowerElement, TowerElementPos, Quaternion.identity);
                te.transform.SetParent(TowerElementsParent);
                if(WigglyTower) TowerElementPos += new Vector3(Random.Range(-Wiggeliness, Wiggeliness), TowerElementSize + ElementSpacing, Random.Range(-Wiggeliness, Wiggeliness));
                else TowerElementPos += new Vector3(0, TowerElementSize + ElementSpacing, 0);
                Delay = 0.4f;
            }
        }
        else if(StartBuildingTower)
        {
            StartBuildingTower = false;
            // StartCoroutine(EjectVar()); // add when bugs are fixed..
        }
    }

    void OnObjectEnterDetector(System.Object sender, DetectedVariableData data)
    {
        if(data.DetectedObjectType == DetectedType.Variable)
        {
            var vals = ElementDetector.DetectedVariable.GetVariableValue();
            TowerElementCount = vals.IntValue;
            if(CreatedElements > 0)
            {
                foreach (Transform child in TowerElementsParent)
                {
                    Destroy(child.gameObject);
                }
                CreatedElements = 0;
            }
            TowerElementPos = TowerElementsParent.position + new Vector3(0, TowerElementSize * 1.5f + ElementSpacing, 0);
            StartBuildingTower = true;
        }
    }

    IEnumerator EjectVar()
    {
        yield return new WaitForSeconds(0.8f);
        ElementDetector.EjectDetectedElement(new Vector3(-1, 0, -1));
    }
}

If something is unclear let me know so i can clarify the post!

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:
Circular draggable UI element in Unity canvas I am trying to implement my own runtime color picker that's easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when dragged.
I have scavenged enough code to get a raw image object rotating when dragged in a UI canvas in the manner I'm looking for:
    private float baseAngle;
    private Vector2 pos;

    public void OnBeginDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.pressPosition - pos;
        baseAngle = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg;
        baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;
    }

    public void OnDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.position - pos;
        float ang = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg - baseAngle;
        transform.rotation = Quaternion.AngleAxis(ang, Vector3.forward);
    }

Since it doesn't use colliders, how can I limit the draggable region to a circle within the square bounds of the texture? Even better, also limit it to a ring rather than a whole circle. Will I have to implement my own check based on some pure math or is there a built in way?
thanks!

sentences:
Find distance from Vector2 to nearest point in Rectangle I'm setting up collision detection and I have Walls which store their positions as rectangles. I need to figure out the distance from a Vector2 to the nearest side of a rectangle. If this was two Vector2's I could just do Vector2.Distance() but I can't find similar methods for Vector2s and Rectangles. Here is an image to illustrate what I need:

So the red dot would be my Vector2 and the blue would be my Rectagle, and I need to get the distance of the orange line. Once I have this I can check the distance for my collision detection.

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:
Subclasses in unity editor I would like to implement an action system where gameobjects offer different actions available to characters.
Actions are composed of several steps holding the details to be performed. These steps have different logic applied to them (go to location, play animation for a time, change variables), so I would like to have them as subclasses.
However I would also like to be able to set up the actual data for an action in the UnityEditor. I know it is possible to do this using ScriptableObjects, but that requires creating an asset for each instance of a step, which I'd like to avoid, since only the classes get reused, the instances being pretty much unique to each gameobject.
Is there a way to work with subclasses in the unityeditor without requiring a dedicated asset for each of the subclass instances cluttering up my folders?

sentences:
How can I read a portion of one Minecraft world file and write it into another? I'm looking to read block data from one Minecraft world and write the data into certain places in another.

I have a Minecraft world, let's say "TemplateWorld", and a 2D list of Point objects. I'm developing an application that should use the x and y values of these Points as x and z reference coordinates from which to read constant-sized areas of blocks from the TemplateWorld. It should then write these blocks into another Minecraft world at constant y coordinates, with x & z coordinates determined based on each Point's index in the 2D list.

The issue is that, while I've found a decent amount of information online regarding Minecraft world formats, I haven't found what I really need: more of a breakdown by hex address of where/what everything is.

For example, I could have the TemplateWorld actually be a .schematic file rather than a world; I just need to be able to read the bytes of the file, know that the actual block data starts always at a certain address (or after a certain instance of FF, etc.), and how it's stored. Once I know that, it's easy as pie to just read the bytes and store them.

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: Import FBX with multiple meshes into UDK I used this script to generate a few buildings that I was hoping to import into UDK. Each building is made of about 1000 separate objects. When I export a building as FBX and import the file into UDK it breaks it up into its individual objects again, so I was wondering how I would avoid this. Whether there was a tool to combine all of the objects into one mesh automatically before exporting or if I could prevent UDK from breaking them upon import.

sentences:
Can I use an AI engine written in C++ in my Unity game? If yes, how can I do this? I am studying some chess and others AI algorithms and the majority of these implementations are made in C and C++, my question is, if I make a chess board and all the graphic thing in Unity, can I make it run with my algorithm written in C++? And how can I make this interface?

Sorry if is it a noob question, I'm just starting at this whole gamedev world.

sentences:
Get a Jump normal gravity based on Attractor Points, lines or Quad placed in the Level Design (in a Mario galaxy like gravity) I have an algorithme to find.

I have a player in a 3D space on a random planet. My goal is to have an oriented gravity toward my planet. And when I jump: Find the right normal direction.

BUT I can't just get the normal of collision, here is why:

As you can see, the gravity must NOT be depending on the Normals collision, but must depend on this gravity point, line or quad I place in the Level Design

(see the 2 cube at the bottom of the planet, the jump of the player must NOT depend on the normal of collision (orange arrow), but must depend on the red arrow)

I have to find out depending on the position of the player, if the gravity will depend on the closest Gravity Point attractor, OR the closest line, OR the quad's normal direction.
Here a real screenShot exemple:

I want this algorithm to be dynamic enough to be able to place points, lines or quad in the LevelDesign as I want. This algorithm will be called at each frame when the player is in the air.

And here an exemple of the most complexe shape I would like to manage:

Here I have a white point alone, a cyan line, and 2 quad (or 4 triangles)

sentences:
Multiplayer card game using PHP/Ajax and mysql I am designing a map game, using PHP and MYSQL. I don't know how to make the players who sign-in to the website to see other players who are also connected to the site and be able to chat with one another.

I want to design the game in such a way that 2 players can play with each other and be able to send messages during the game while others groups are playing at the same time.

I have designed the map game successfully, but the problem is making the player 1 who log-in to site to see the player 2 who will also log-in and both can get connected to play each other.
http://i.stack.imgur.com/YyCPG.png

I will appreciate your responses.

sentences:
Food Game using Online Searchs I am thinking of making a simple game with Unity. The aim would be to keep a person healthy by feeding it well balanced food and drinks.

Rather than hard codding every single type of food or drink I can think of I was thinking of letting the player choose any type of food he wants and then screen the internet for it's calorific value, saturated fat, sugars etc ...

This would make the game much more enjoyable than being limited by the foods I can think of.

I was wondering how you would go about doing that ? Could I use an API to extract data from google or wikipedia.

I noticed that when you type "[food] calories" in Google you get a return from the Wikipedia page like this:

Obviously, there is a way of extracting the data from Wikipedia and I could automate the searchs by taking the player's entry as a string and running a search with it.

How would one recommend going about this ? Also, is it safe ?

Thanks

sentences:
UDK: Playing two audio tracks simultaneously I have some environmental music playing in the background, but when I try to play another track (door opening sound effect) at the same time the background music stops playing.

How can I play two audio tracks simultaneously?

sentences:
Find the 4 Corners of a Bounding Box of a Rotated, Offsetted Square How does one find the coordinates of the 4 corners of a bounding box of a square of width w and height h that is rotated theta degrees and is offset from the origin x in the x direction and y in the y direction?

Here is a visual example of what I mean:

Here is some python3 code that I came up with, but it only works in the right quadrants except when theta = 0 or 360 or etc.:

import math

def bounds(x,y,w,h,theta):
   theta = theta * math.pi / 180

   A = ( x, y+round((math.sin(theta)*w), 2) )
   B = ( x+round((w/math.sin(theta)), 2), y+round((math.sin(theta)*w), 2) )
   C = ( x+round((w/math.sin(theta)), 2), y+round((math.cos(theta)*h), 2) )
   D = ( x, y+round((math.cos(theta)*h), 2) )
   print(A)
   print(B)
   print(C)
   print(D)

I was reading this but I could not figure it out for my specific problem.

Any help is much appreciated. Next time I will use matrices to store all the transformation data because this would be so much easier that way.

sentences:
Why wouldn't games be published with Map Editors included? 15 years ago, in 2002, Warcraft 3 was released. Aside from being a great RTS game, it had lived for years past its release mostly due its World Editor - a fully-functional industrial-grade Map Editor that gave players all the tools the devs had during the development process. It has lead to creation of millions of custom maps, cinematics, campaigns, and first MobAs.

Very few companies have released their own Editors with their games since then. Even Blizzard didn't do it again with the new Starcraft release (the version which was eventually released wasn't nearly as powerful as the Warcraft's one). As we see from the history, something as seemingly trivial as this may tremendously prolong the game's lifetime. So why wouldn't developers release World Editors they used alongside with their games?

sentences:
How to determine the amount of experience needed for leveling up Related questions under this topic might include:

How should I base how much experience points it takes to get to the next level?
What factors are involved in this?
How do I keep the player not entertained long enough till he levels up?
How can I vary the way the player gets experience points?

sentences:
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:
What tools are available for developing 2D games like Tetris or Angry Birds for Android? I would like to ask the following regarding developing Tetris- and Angry Birds-like 2D games for Android:

Is Java the official development language for Android?
What free or commercial Android development environments (like Xcode is for iOS) are available?
What open source game development engines, like cocos2D, are available for Android?
Are there any great tutorials available for developing such games?

sentences:
What is the meaning of this line algorithm? I have been looking at codes of several open source 2d games and I have found this function.

GetLineCollisionHit(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2)
    {
      int tile1X= Position1.X + Width1 / 16.0);
      int tile1Y= Position1.Y + Height1 / 16.0);
      int tile2X= Position2.X + Width2 / 16.0);
      int tile2Y= Position2.Y + Height2 / 16.0);
        do
        {
          int dx= Math.Abs(tile1X- tile2X);
          int dy= Math.Abs(tile1Y- tile2Y);
          if (tile1X== tile2X && tile2Y== tile1Y)
            return true;
          if (dx> dy)
          {
            if (tile1X< tile2X)
              ++tile1X;
            else
              --tile1X;
            (check collision)
          }
          else
          {
            if (tile1Y< tile2Y)
              ++tile1Y;
            else
              --tile1Y;
            (return true if collision)
          }
        }
        while (true);
        return false;
    }

What is really checking is if there is any collision of solid tiles between two points, for this look for the line between the two tiles. But I do not know if it is a coding problem since it is not implementing neither Bresenham's line algorithm nor DDA or similar. So what are you trying to find in this line dx>dy? What sense does it have to advance x while x > y since that way a line is not correctly created.

sentences:
Pick and Drop the Ball Testing Without Replicating the Physics Frame I am making a program that pick, drag, and drop the ball. In real life, once you pick the ball and drop it, whenever the available object is (what you see is what you get) will only be picked and dropped again and again. However, in the game program, there is something that at first you did pick and drop the ball. When you did the second time, something hit like some sort of an "invisible object" and the physics frame (in pink) is replicating while the frame in green is the wall and the floor. Take a look at these pictures.

Before picking up and drop a ball for the first time...

When the ball in dropping... (Showing in pink frame for physics frame)

When picking up the second time, the previous pink physics frame did not come off and ended hitting something invisible.

So tell me, did I made something wrong in this touchDown() code or not? I have observed something here after I run in debug mode.

@Override
public boolean touchDragged(int screenX, int screenY, int pointer)
{
    // TODO touchDragged

    float change_x = (Gdx.input.getX()/(cv.getPhysicsCamera().viewportWidth))*5000;
    float change_y = (Gdx.input.getY()/(cv.getPhysicsCamera().viewportHeight))*15;

    x = ((change_x/cv.getPhysicsCamera().viewportWidth)/2) - (rc.getSoccerBallWidth()/2);
    y = (((cv.getPhysicsCamera().viewportHeight) - (change_y/2)) - (rc.getSoccerBallWidth()/2));

    Vector3 touch_point = new Vector3(change_x, change_y, 0);
    cv.getPhysicsCamera().unproject(touch_point);

    // Set new body frame.
    ballDef.type = BodyType.DynamicBody;
    ballDef.position.set(x, y);

    ballBody = wc.getWorld().createBody(ballDef);
    ballBody.setActive(false); // --> Allows you to display a cursor for dragging without letting your soccer ball to fall off while holding.

    return true;
}

sentences:
Box2d Raycast C++. Always returning false? (trying to check if player is grounded) I'm trying to add Box2d to my C++/SFML platformer game. I have my ground tiles with a b2staticBody. And the player character is b2_dynamicBody.

My usual method to check if player is grounded is to Raycast straight down from centre of sprite to just below the foot level. (NOTE: I do note that SFML is y-down).

For now, I just want the raycast to return true if it hits anything. But it always returns false. I watch the player land on the ground and can walk along the floor and fall off it (ie. The built-in box2d collision is working)

Here is my code (I am brand new to using Box2d in c++, so sorry if it's wrong. There aren't too many good examples to be found online)

void guy::update() {
bool bGrounded = false;
b2RayCastOutput output;
b2RayCastInput input;
input.p1 = bodyPtr->GetPosition();
input.p2 = bodyPtr->GetPosition() + b2Vec2(0, 1.f * Constants::PPU);
input.maxFraction = 1.0f;
b2Fixture* fixture = bodyPtr->GetFixtureList();
std::cout << "p1: " << input.p1.x << " , " << input.p1.y << " / p2: " << input.p2.x << " , " << input.p2.y << std::endl;
std::cout << "sprite pos: " << sprite.getPosition().x << " , " << sprite.getPosition().y << std::endl;
if (fixture->RayCast(&output, input, 0))
{
    bGrounded = true;
}
else
{
    bGrounded = false;
}
std::cout << "isGrounded: " << bGrounded << std::endl;
}

The console outputs seem ok (ie. p1 and p2 are where I expected them to be), but the bool always returns 0.

Of course I am very open to an improved jumping function. Eventually I want to be able to add the ability to hold the jump button for some time to get a bigger jump. But the only way I can think to start with is checking if the player is touching ground first.

NOTE: Here is the ground Tiles start function (at the bottom you see i CreateFixture():

void Tile::start(size_t x, size_t y, sf::Texture& texture, bool isSolid, b2World* world)
{
worldPtr = world;
bIsSolid = isSolid;
sprite.setTexture(texture, true);
sprite.setOrigin(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);
sprite.setPosition((float)x * Constants::PPU, (float)y * Constants::PPU);

if (isSolid)
{
    bodyDef.position.Set(sprite.getPosition().x, sprite.getPosition().y
    );
    bodyPtr = worldPtr->CreateBody(&bodyDef);
    b2Vec2 topEdge(-1, 0);

    box.SetAsBox(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);

    bodyPtr->CreateFixture(&box, 0.f);

}

}

Here is the player start() in case it will help:

void Guy::start(b2World* world)
{
worldPtr = world;
texture.loadFromFile("Textures/guy.png");
sprite.setTexture(texture, true);
sprite.setOrigin(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);
setPosition(4 * Constants::PPU, 10 * Constants::PPU);

bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(sprite.getPosition().x, sprite.getPosition().y); // TODO: Does this need to be offset?
bodyPtr = worldPtr->CreateBody(&bodyDef);

box.SetAsBox(sprite.getTextureRect().width / 2.f, sprite.getTextureRect().height / 2.f);

fixtureDef.shape = &box;
fixtureDef.density = 65.0f; // TODO Magic numbers
fixtureDef.friction = 0.05f;

bodyPtr->CreateFixture(&fixtureDef);
bodyPtr->SetFixedRotation(true);

}

sentences:
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:
Unity 5.5 Android scaling The questions I've seen are outdated, explained, not to my liking, or just don't work.

Problem: I want to be able to create a game that can scale on all mobile devices with ease and with no pixelation.

Extra Info:

I'm very new to unity and tackling the the software with all my might I'm sorry for being a noob.
I already paired unity with my phone and set the build to android (Nexus 5).
Aspect ratio is 10:16, The game is going to be portrait.
I have no scripts or anything, Its legit a blank game with a camera that has a blue background.

I have some pictures, if you need anything else for my assistance don't hesitate I'm here to learn and take, GULP, Constructive Criticism.

PC

Android

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:
How can i start rotating object slowly smooth and then stop the rotation also slowly smooth? In the top of the script:

public FirstPersonController fpc;
public float speed;

In the Update

void Update()
{
  fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation,
  Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
}

The problem is that the rotation start immediately. And i want it to start slowly smooth then it will get some speed and then near the end to slowly smooth again until stop.

Update:

This is the complete script for now:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public UnityStandardAssets.ImageEffects.Blur blur;
    public UnityStandardAssets.ImageEffects.BlurOptimized blurOptimized;
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float startAcceleration = 0.6f;
    public float endAcceleration = 0.6f;
    public float maxSpeed = 1.0f;

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

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;

            if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                rotationSpeed = Mathf.Clamp(rotationSpeed + startAcceleration * Time.deltaTime, 0, maxSpeed);
                rotationSpeed = Mathf.Clamp(rotationSpeed - endAcceleration * Time.deltaTime, 0, maxSpeed);
                clampedTargetRotation = Quaternion.RotateTowards(fpc.transform.localRotation, whateverRotationTokeepGoing, rotationSpeed * Time.deltaTime);
                fpc.transform.localRotation = clampedTargetRotation;
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;

                blur.enabled = false;
                blurOptimized.enabled = false;

                rotated = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

My problem is in the rotation part:

if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                rotationSpeed = Mathf.Clamp(rotationSpeed + startAcceleration * Time.deltaTime, 0, maxSpeed);
                rotationSpeed = Mathf.Clamp(rotationSpeed - endAcceleration * Time.deltaTime, 0, maxSpeed);
                clampedTargetRotation = Quaternion.RotateTowards(fpc.transform.localRotation, whateverRotationTokeepGoing, rotationSpeed * Time.deltaTime);
                fpc.transform.localRotation = clampedTargetRotation;
            }

The rotation should start from the current fpc rotation state and end at 0,0,0
This is where the rotation should be end when fpc is 0,0,0

if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))

If fpc rotation is at 0,0,0 then stop. Between the start and stop make the whole rotation operation.

sentences:
Is it reasonable to use FreeType Won't it slow my game if I use FreeType lib and convert 2 fonts from .ttf instead of using preloaded BitmapFont .png? Or may be FreeType so fast, that I can use fonts both ways?
All I need is to change color and size of my text.
P.S. I use 3 fonts in my project

sentences:
a simple 2D rectangle collision algorithm that also determines which sides that the rectangles collide? I initially tried out implementing rectangular intersection, which works well. However, when I have to apply the physics system, such as velocity, acceleration, and directional vectors, I would have to find a way to determine which side of the rectangles collide. Now, in my system, there is no rotated rectangle, so this simplified the problem. However, I couldn't find an easy way to determine which rectangle side collided. I have once deal with this problem before but failed miserably.

What I did in the past is determine the distance between each parallel rectangular sides and check if the distance is close to 0 (use some initially defined distance range) or is 0. However, for floating-point arithmetic, this proves to be unstable because of unknown time elapse. Sometime, the rectangles would actually intersect each other before it meets the defined range.

On the other hand, I was thinking about spawning multiple rectangles, each rectangle for each sides. However, after thinking again, it would be the same thing as having a parallel side with distance range checking, just that that distance range is the width of each mini-rectangle.

Therefore, any suggestion to this problem?

sentences:
When updating app from Google Play will the app data be deleted? My question is pretty simple.

I developed a game, uploaded it on the store. In order to keep player level record and UI prefs it writes an ini file.

When the next update is up on the store and the users will update will they lose their progress? Will the file be deleted?

Thanks

sentences:
Usage of standardized syntaxes in gaming: yea or nay? TL;DR: Using CSS as an element in defining rulesets in Civ-style turn-based strategy games: Madness or just plain old insanity?

Real question:

Designing ruleset parse rules is a pain. Every single game out there seems to define its own ruleset for how rulesets are to be parsed (insofar as the game features customizable rulesets, of course).

Is it time for the game dev. community to embrace standardized synatxes for rulesets?

Is CSS a viable option for customizable games?

Example: Consider a Civ-like with customizable rulesets; how nice would it not be to be able to design rulesets as follows:

artillery:era(modern) {
  range: 2;
  sprite: url(/isophex/artillery.png);
}

artillery:era(classical) {
  range: 1;
  sprite: url(/isophex/cannon.png);
}

sentences:
Unity, tell matched players to go pick characters (Matchmaking) I need to tell all the players in the match to go to some method that'd take them to character pick. The thing is that the pick happens inside the menu scene after the level get's preloaded (ascyncroneously). So the players stay in the same menu scene but they have to pick characters before the time runs out and the level itself starts.
Is it possible to do that in multiplayer using the matchmaker?
How can it be done if so?

Thanks in advance!

sentences:
Browser-board-game and server push I want to start developing a browser game. Not for success, just for the sake of doing it and learning something from it.

Now, a point where I have serious problems figuring out how to deal with it is; how does one player receive message of another player does something that is somehow time-critical.

Easy example for a trading card game; Player 1 plays The devious flames of hell and Player 2 has to react to this card by playing Watery waves directly afterwards, before the card of Player 1 takes effect (so to say a counter-card).

Of course, I could just request the server every second and see if the other player did something, but I was hoping for a less request-frequent solution, like the server pushes the event of Player 1 playing a card to Player 2.

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:
In some games, we just let the main() loop be the Player object or Table object? I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for Blackjack or as the person giving hints for MasterMind).

And then there should be a Player object, and the way to play one game is

aPlayer.playGame

but I noticed that a book was just using the main() loop to act as the player (or as the Controller of the game), calling the Dealer methods to dealer the cards, ask for player's action, etc...

1) Is this just a lazy way to model all the proper objects?

2) If more objects are to be added, who should call the aDealer.dealCards and then ask for aPlayer.askForAction?  (because it is strange to let the Player handle all the logical steps).  Should there be a Table object that handle all these logic and then to play one round of game, use aTable.playGame?  What is a good object design for such game?

sentences:
Rotate Camera as an Object Manoeuvres There are loads of questions (all of which I have looked at) on here about cameras following objects. Using them, I have successfully got my camera to follow my car when driving, but I am unable to make the camera swing right when the car turns left (so it stays directly behind it) and vice-versa.

So far, this is how I've got my camera following my object:

    camOrigin.x  = (0   +globalPos.x+velocity.x); //Camera Position
    camOrigin.y  = (0   +globalPos.y+velocity.y);
    camOrigin.z  = (100 +globalPos.z+velocity.z);
    camLookingAt.x = (0 +globalPos.x+velocity.x); //Camera Looking at Object
    camLookingAt.y = (0 +globalPos.y+velocity.y);
    camLookingAt.z = (0 +globalPos.z+velocity.z);
    camNormalXYZ.x = (0);                         //Camera Normal = Y
    camNormalXYZ.y = (1);
    camNormalXYZ.z = (0);

I have tried to use the same algebra I've used to calculate the cars direction and velocity because I figured the angle the camera moves would be the inverted angle the camera needs to move, but it didn't work.

    camOrigin.x  = (0   +globalPos.x+velocity.x-sin(rotX_rad)); //Camera Position
    camOrigin.y  = (0   +globalPos.y+velocity.y);
    camOrigin.z  = (100 +globalPos.z+velocity.z-cos(rotX_rad));

I'm unsure how to take this further.

Edit:
Little drawing to help describe the movement. I'm looking to move the camera from c to d when the car turns in the left direction (and vice-versa when turning right).

Update:

    rotX_rad = rotX*PI/180;     //convert to radians
    velocity.x = sin(rotX_rad); //calculate X coord
    velocity.z = cos(rotX_rad); //calculate Z coord

    //globalPos + velocity;
    globalPos.x + velocity.x*delta;
    globalPos.z + velocity.z*delta;

    ModelViewMatrix = glm::translate(viewMatrixMovingCube,globalPos);           //move/update car

    ModelViewMatrix = glm::translate(ModelViewMatrix,  glm::vec3(0,-48,0));     //position low on screen
    ModelViewMatrix = glm::rotate(ModelViewMatrix, rotX, glm::vec3(0,1,0));     //manually turn/control rotation of car

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:
Where should multiplayer games start? Client or server? I'm starting to make a small multiplayer game, and even though I have experience with games and networking, there's just one thing that keep me from making this.

The question is: When starting a multiplayer game, should one start making the server first, or the client first?

This looks like a dead-lock for me, because while starting on the client, seems to be the a good option (you'll make a game, which you are already very good at doing probably, and you'll have something to look for progress), you will fall on the trap that probably most of the code effort you put into making that game will have to be thrown away and remade on the server side.

And starting on the server-side is just the opposite: You'll have nothing to look upon, so you can't know if you're making progress. And if that wasn't bad enough, you'll also have to throw lots of stuff away, since you have no game to check if that will have to indeed work like that.

Is there a correct answer for this?

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:
Test if Jump can reach target I have an object that can jump.

When it jumps, its Y velocity becomes -600 (pixels/second).

For up to .2 seconds, it can ignore gravity.

After .2 seconds, it begins to accelerate downward at 2100 (pixels/second).

Independently from its Y velocity, the object can move on the X axis up to 220 (pixels/second) or -220 (pixels/second).

How do I calculate whether or not, with a given starting x/y coordinates it can jump to a target x/y coordinate?

Also, how do I calculate the necessary X velocity to reach its target in the proper amount of time so that it doesn't overshoot or undershoot?

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:
Texture Wrapping isn't getting applied to my object I have a Drawable Class, a Cube Class, and a Texture class. I feel like the texture wrapping isn't being applied due to some values being passed by reference, or just being discarded. My cube just derives from Drawable and only implements the render function and some other small overhead that shouldn't be a factor.

This is the error:
http://imgur.com/Dj2hCkp

Drawable:

// A structure to define each vertex of a model
struct Vertex
{
    glm::vec3 Position, Color, Normal;
    glm::vec2 UV;
};

class Drawable
{
public:
    Drawable();
    // cleans up our shaders, textures, and buffers
    virtual ~Drawable();

    // loads the buffers and shaders for our drawable
    virtual void loadBuffers();
    virtual void loadShaders();
    virtual void loadTextures();

    GLSL shaders;

    std::vector<Vertex> vertices;

    glm::mat4 model, view, projection;
    GLint modelLoc, viewLoc, projLoc, textureLocation;

    GLuint vao, vbo;

    GLTexture texture;
};

loadBuffer function:

glCreateVertexArrays(1, &vao);
glGenBuffers(1, &vbo);

glBindVertexArray(vao);

glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, Position)));

glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, Color)));

glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, UV)));

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);

My texture is created with this function:

GLuint& GLTexture::createTexture(int texWrap, int textureFiltering, const std::string filePath)
{
    glGenTextures(1, &_texture);
    glBindTexture(GL_TEXTURE_2D, _texture);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texWrap);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texWrap);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureFiltering);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureFiltering);

    sf::Image image;
    image.loadFromFile(filePath);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
    glGenerateMipmap(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    return _texture;
}

draw:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture.getTexture());
glUniform1i(textureLocation, 0);

shaders.use();

glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(projection));
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
glBindVertexArray(0);
shaders.unuse();

My UV is calculated by clamping the positions from -1 ~ 1 to 0 ~ 1

vert.UV = glm::vec2((vert.Position.x + 1.0f) / 2.0f, (vert.Position.y + 1.0f) / (2.0f));

I feel like i'm doing everything right, based on looking at the source code of two tutorials, yet it ends up warped no matter if i use

GL_CLAMP_TO_EDGE / BORDER
GL_REPEAT

Vertex shader:
    #version 330 core

layout (location = 0) in vec3 in_Position;
layout (location = 1) in vec3 in_Color;
layout (location = 2) in vec2 in_UV;

out vec2 vs_TexturePos;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
    gl_Position = projection * view * model * vec4(in_Position, 1.0f);
    vs_TexturePos = in_UV;
}

Fragment shader:

#version 330 core

in vec2 vs_TexturePos;

uniform sampler2D t_Texture;

out vec4 color;

void main()
{
    color = texture(t_Texture, vs_TexturePos);
}

It might be that the texture parameters aren't being stored, is there a openGL debugger I can use to verify this?

sentences:
Finding the normal from one 3d vector/line to any point on another 3d vector/line Say I have two 3d vectors, v1 and v2 (you can consider them both lines if you like). I'm trying to figure out a normal for v1 so that it intersects along any point of v2.

I keep drawing blanks on this one. It's easy enough to find a vector that points from v1 to v2 (just do v2 - v1), but that result isn't always perpendicular to v1.

How would you go about making that result perpendicular to v1?

sentences:
libgdx automove Actor does not work I am trying to make my sprite start moving from the moment it is created and do its animation. It draws on the screen right and animates but doesn't move. It should start moving towards the direction it is facin this means right and if collision detected to stop the animation do whatever and continue the animation.
Here is my code:

public class grt extends ApplicationAdapter {
 Misheva mshv;

@Override
public void create () {
    mshv = new Misheva();
    mshv.init();

}

@Override
public void render () {
    mshv.drawIt();
    mshv.act(Gdx.graphics.getDeltaTime());

}

@Override
public void dispose() {
    mshv.disposer();

     }

 }

Misheva.java

public class Misheva extends Actor {
int state;
TextureAtlas atl;
TextureRegion [] walk;
SpriteBatch batch;
Animation anim;
float stateTime;
float elapsed = 0;
int horizontalspeed = 10;

public void reset (){
    state = 0;
    stateTime = 0;
}

@Override
public void act(float delta) {
    super.act(delta);
    stateTime += delta;
    switch(state){
    case 0: setX(getX()-horizontalspeed*delta);

    }
}

public void drawIt(){
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    elapsed += Gdx.graphics.getDeltaTime();
    batch.draw(anim.getKeyFrame(elapsed,true), 0, 0);
    batch.end();

}

public void init (){
    atl = new TextureAtlas(Gdx.files.internal("data/tomaton.atlas"));
    batch = new SpriteBatch();
    walk = new TextureRegion[3];
    walk[0]=atl.findRegion("tomato");
    walk[1]=atl.findRegion("t_walk2");
    walk[2]=atl.findRegion("t_walk1");
    anim = new Animation(1/10f,walk);
}

protected void disposer(){
    batch.dispose();
    atl.dispose();
    }

 }

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:
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:
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:
Get local coords from global coords I need to get local coords from global coords. I did not find ready-made examples.

Please help me how to do it on the example image. Thank you!

UPDATED:

Here's the method in the java, created thanks to your help! It works for me :) Thank you!

public static double[] getLocalFromGlobal(int pointX, int pointY, int localX, int localY, float angle) {
    float px = pointX - localX;
    float py = pointY - localY;

    double cos = Math.cos((Math.PI / 180) * angle);
    double sin = Math.sin((Math.PI / 180) * angle);

    double finalX = (px * cos) + (py * sin);
    double finalY = -(px * sin) + (py * cos);
    return new double[]{finalX, finalY};
}

sentences:
What kind of physics to choose for our arcade 3D MMO? We're creating an action MMO using Three.js (WebGL) with an arcadish feel, and implementing physics for it has been a pain in the butt.

Our game has a terrain where the character will walk on, and in the future 3D objects (a house, a tree, etc) that will have collisions. In terms of complexity, the physics engine should be like World of Warcraft. We don't need friction, bouncing behaviour or anything more complex like joints, etc. Just gravity.

I have managed to implement terrain physics so far by casting a ray downwards, but it does not take into account possible 3D objects.
Note that these 3D objects need to have convex collisions, so our artists create a 3D house and the player can walk inside but can't walk through the walls.

How do I implement proper collision detection with 3D objects like in World of Warcraft? Do I need an advanced physics engine? I read about Physijs which looks cool, but I fear that it may be overkill to implement that for our game.

Also, how does WoW do it? Do they have a separate raycasting system for the terrain? Or do they treat the terrain like any other convex mesh?

A screenshot of our game so far:

sentences:
What pattern is this, and should I do it? I'm making a game in as3 using flash develop and flash cs5. Everything is object oriented. I was wondering, should I have one "gateway" class that has a property-reference to all instantiations of other classes, and I just pass this gateway class to new objects, so they have access to every class. Like so:

 var block:Block = new Block(gateway);

 //In the block class:
 this.gateway.player.setHealth(100);
 //Or:
 this.gateway.input.lock();

Is this like a singleton pattern or something? Should I do this?

sentences:
Buffer resource as shader resource view I am trying to build a shader that change the output color according to something that happen in my c++ code

In my code I create a buffer with four element(each element containe four float - RGBA)

then I create four shader resource view associate with that buffer.
the first shader resource view contain the first element in the array the second shader resource view contain the second element in the array and so on.

in my code there is no exceptions and I can see in the diagnostic that my correct shader resource view with the correct resource associate to the pixel shader but in my pixel shader I get nothing.

Here is my pixel shader:

cbuffer cbChangesEveryFrame : register( b0 )
{
matrix worldMatrix;
};
cbuffer cbNeverChanges : register( b1 )
{
    matrix viewMatrix;
};
cbuffer cbChangeOnResize : register( b2 )
{
    matrix projMatrix;
};
float4 outPutColor : register(s0);
struct VS_Input
{
    float4 pos  : POSITION;
};
struct PS_Input
{
    float4 pos  : SV_POSITION;
};
PS_Input VS_Main( VS_Input vertex )
{
    PS_Input vsOut = ( PS_Input )0;
    vsOut.pos = mul( vertex.pos, worldMatrix );
    vsOut.pos = mul( vsOut.pos, viewMatrix );
    vsOut.pos = mul( vsOut.pos, projMatrix );

    return vsOut;
}
float4 PS_Main( PS_Input frag ) : SV_TARGET
{
    return outPutColor;
    //return float4(0,0,1,1);
}

The shader resource view should associate to outPutColor but when I debug the shader I get four float of zero.
Why I getting zero instead my buffer?

sentences:
3-in-a-row or more logic This is a bit more difficult than it seems and the one other post on here isn't sufficient. You have a row of n items, and each item could be any one of 5 colors. You need to find if there are any runs of 3 or more items together of the same color and destroy them.

Yellow, Red, Blue, Green, Red, Red - destroy nothing

Red, Red, Red, Green, Yellow, Red - destroy the first set of 3 Red, but not the 6th red

Red, Purple, Red, Red, Red, Red - destroy only the set of 4 Red

You can't simply check each item to see if the item previous to it has the same color, and destroy them when that happens twice in a row (meaning 3 matching items), because then you are not accounting for the fact that there could be 4 or more in a row. Are there any robust algorithms out there for this?

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:
var=time() vs time()=var pico8/lua time() is a preset function in pico8 gameengine.

I don't understand whatsoever why I get an error when I write:
time() = var

But it's fine if I write (where var is any variable)
var = time()

What are the rules dictating order? This makes no sense to me.

For some context consider a time function:

time_diff=0

function time_change()
if time() - time_diff > 1 then
time_diff=time()
end
end

if You change to time()=time_diff.....it generates an error.

sentences:
How can I test if an object will "fit" during pathfinding? I'm tinkering around with a 2d game where obstacles are polygons of arbitrary shapes, sizes and locations, and movable entities (players/enemies) can also be of arbitrary sizes.

What's a good general approach for detecting whether a given entity can "fit" between two obstacles during pathfinding? Basic graph-based pathfinding algorithms like Dijkstra's or A* typically involve merely a boolean (and possibly a weight). It's not immediately clear to me what's the best way of extending that to restrict narrow passages to small entities.

Presumably each entity size would need to have its own graph of the map?

I'm not familiar with the literature on this subject but I'm sure it exists - any pointers would be welcome.

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:
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:
Creating an asset library accessible from all classes The idea of what I'm trying to do is to create a class that will automatically pull in all of the assets needed using the ConstructorHelpers and store them in a library with IDs. Then from there, any class that includes the asset library should be able to access the library and the objects within.

So far I have created an empty C++ class and added all of the backend needed, and I've used the GameModeBase to instatiate the class as a static variable, however I can't include the asset library elsewhere and use it.

I have thought about creating an actor class and just plopping it into the world, but I really don't like the idea of that and would prefer something more robust.

I've tried searching for a way to do it online, but I can't seem to find it, does anyone know of a solution?

Below is the code I am using to create a singleton class and it will not compile, giving me an LNK2001 error

unresolved external symbol "private: static class AssetLibrary* AssetLibrary::Instance"

.h

static class UE4Testing_API AssetLibrary {
public:
    static AssetLibrary* GetInstance();

private:
    static AssetLibrary* Instance;

    AssetLibrary();
    ~AssetLibrary();
};

.cpp

AssetLibrary* AssetLibrary::GetInstance() {
    if(!Instance) {
        Instance = new AssetLibrary();
    }

    return AssetLibrary::Instance;
}

AssetLibrary::AssetLibrary() {

}

AssetLibrary::~AssetLibrary() {
    delete Instance;
}

Regards,

sentences:
2D Platform character getting "unaligned" with the map I'm trying to make a 2D Platform game and so far I can have my character moving around in a tiled map and collisions are working too. So far so good.

The problem I'm having is that the character can get "unaligned" with the map if I spawn it without double checking the X coordinate. This means that, on certain conditions, the character could walk over a small gap (just large enough for it to fit in) on the floor.
This happens because the X speed is a constant value, so in one frame the character is standing before the gap but the next frame it's past the gap.

I can solve it by simply making sure the spawning coordinates will be aligned with the map (and the X speed allows it since the tile size is a multiple of it), but it does sound like a fishy solution to me since I may want to add power-ups in the future that increase the speed.

So I'm wondering if I'm missing something on how characters should move or maybe I should actually just double check the spawning coordinates? Or maybe it is a normal thing to happen in a game??

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

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

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

But what can I do if:

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

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

sentences: Map Positions in LibGDX I am developing an RPG game where there is a main world map, locations such as towns or ruins on that map and buildings in those locations where players can interact to go into. For example, I have a map and my character goes to a local town where there is a inn that I can freely enter and interact in. Once I wish to leave the building, I leave and I'll be at the same position that I had once entered the building from, albeit facing the opposite direction. The one problem that I have with imagining a map system that could be complex like this are the coordinates. Is there a way of accomplishing this with the use of universal coordinates, such as only one x and y position throughout all 3 stages of this map system, or would I need to have 3 coordinates, a Map coordinate system for the world map, a Local coordinate system for the town or ruin and a Temporary coordinate system for when I am in a building? Also, is there something in libGDX that could help out with this?

sentences:
How do particle systems work? I want to implement a particle system in my game, but I've never programmed a particle system and don't know where to start.

I only want to display pixels (GL_POINTs) with different sizes in different places, something like Terraria or Minecraft when you hit a block, without the texture.  Just a dead simple example.

Google search results for this tend to be very complex, or don't explain the concepts, or are written in hard-to-read C without OOP…

I'm using Java and OpenGL.

sentences:
How do I convert the coordinates of a click to a tilemap position? How do you turn a tilemap (produced by TileD) for cocos2d where I can click on individual items and get a callback?

Is it just a case of converting captured touch and finding out where it is on the tilemap and then converting that to pixels  -- but that doesn't say what item was clicked on.

I have a tilemap of a city with buildings on it, and I'd like to be able to click or press on a specific building, get a callback.

What would be the best way to accomplish this?

sentences:
Using my pathfinding more efficiently I'm making a roguelike in C# with the Roguesharp libraries, in which the map can be as large as 200x200 cells. When I have an entity requiring pathfinding, I am using Roguesharp's built in pathfinding system (which I believe uses a variation on A*, with Manhattan movement instead of orthogonal movement).

When I have an entity pathfinding every turn (to path to the player, which may constantly move) the framerate roughly halves, but the game is still playable. However, when I add in more entities the framerate drops greatly. 10 entities leaves the game running at less than 1 fps and completely unplayable.

Clearly I am doing something wrong, games like Dwarf Fortress manage to have hundreds of entities running around maps this size with little trouble. Does anyone have suggestions for how I can get better performance.

The way it currently works is: whenever the player takes his turn (attacks, moves, etc.) the game loops through every entity, does the pathfinding for that entity and moves them. Is there a more efficient way to do this when the player is moving every turn?

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 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:
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:
How deep does the GameObject.GetComponentsInChildren() , Go? So I have a GameObject which my scene will be it's children.
I wanted to get the BoxCollider of all the objects and their sub-objects and their sub-objects's sub-objects and ... .
So can I do that with just the GetComponentsInChildren(), or should I navigate through them all and find them one by one?

sentences:
How to draw a rectangle at x,y where x & y are in pixel? Here is my code :
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glViewport(0, 0, screen_width, screen_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0, screen_width, 0.0, screen_height, -1.0, 1.0);

glMatrixMode(GL_MODELVIEW_MATRIX);
glTranslatef(0, 0, -5);

glColor4f(rect.color.R(), rect.color.G(), rect.color.B(), rect.color.A());
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);

glRectd(rect.transforms.position.x, rect.transforms.position.y, rect.transforms.size.width, rect.transforms.size.height);

glEnd();

glfwSwapBuffers(window);

glFlush();

Where rect.transforms.position.x is in pixel.
Issue :
Nothing shows up.
The color was tested before & works on a rectangle that use opengl coordinates.

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:
XNA 4.0 Post-Processing Libraries? Are there any free XNA 4.0 post-processing libraries that are easy to hook into projects? I am looking specifically for a glow effect (although anything is great), and I should also mention that I'm using the Reach profile.

EDIT: I should add that I'm not concerned about the Windows phone, because it can't support custom shaders.

sentences:
2d Tile Based Collision Response Right now I am trying to make a 2d collision response system for a platformer, and the algorithm I have for it works quite well. The only problem is that if the player is standing exactly on a tile, he cannot move. I think this is related to the fact that the manager is checking if he is colliding on the X axis, instead of the Y Axis.

I have thought of making one big AABB for a check, using all applicable tiles, but I feel as if there is a simpler way. I don't really understand normals, so I have not tried anything with them yet.

Right now, I am getting the centers of both objects, the distance inbetween them, and the minimum distance between them, returning the overlap. And then applying the overlap to the players position. It looks like this

sf::Vector2f centerA(
  AABBFirst.left + (AABBFirst.width  / 2),
  AABBFirst.top  + (AABBFirst.height / 2));
sf::Vector2f centerB(
  AABBSecond.left + (AABBSecond.width  / 2),
  AABBSecond.top  + (AABBSecond.height / 2));

sf::Vector2f distance(centerA.x - centerB.x, centerA.y - centerB.y);
sf::Vector2f minDistance(
  (AABBFirst.width  / 2) + (AABBSecond.width  / 2),
  (AABBFirst.height / 2) + (AABBSecond.height / 2));

return sf::Vector2f(
  distance.x > 0 ? minDistance.x - distance.x : -minDistance.x - distance.x,
  distance.y > 0 ? minDistance.y - distance.y : -minDistance.y - distance.y);

I apologize if this question has already been asked and answered before, I have not found the proper terms to search for.

sentences:
Adding gravity to arrival steering behavior I trying to write an autopilot for the classic Lunar Lander or its clones.

According to this paper, the arrival behavior is exactly what I need for a soft landing. In this example, it accelerates at max_speed until it's near the target and decreases near the target to zero. Adding gravity and a engine to decelerate makes this a lot more complicated, at least for me since I couldn't wrap my head around the concept for the past few hours.

Currently my spaceship moves in the right direction but doesn't counter gravity and just throttles the engine, crashing near the target. I know my current position, velocity and the gravity is constant. I need to output thrust-levels (0-4) with a -90° to 90° angle.

Can you give me some pointers as to how I could incorporate gravity into this steering behavior?

sentences:
unity 5.x performance After I downloaded unity 5, it became very power consuming. For example, my pc becomes hotter and makes a lot of noise. Also building, compiling, baking of game takes a lot of time. I am making a multiplayer game and need to build the game almost on every change, but it takes hours or sometimes it doesn't even build the game. There are also bugs with directional light, it doesn't work. So yeah, any suggestions?

My internal PC specs: Intel core i3-3130M, 8gb of ram, video card: Intel R4000

I installed unity 5 after Windows 10 came out, maybe it's something with the OS? Also yesterday, I updated Unity but with the same problems.

Also here are some screens:

Directional light is turned off but everything except models is dark, i mean terrain is black.

Also this baking process is more than one hour and stays on 5/11 clustering | 41 jobs

sentences:
How would one get the pixel value of a texture under the cursor? I have a requirement to detect which pixel of a texture is under the cursor in the 3D world. I assume that Ray casting is involved however, after that I'm not sure how one would accomplish this.

Can anyone please point me to an example? Preferably one that does not require a PhD to understand... lol

sentences:
viewing fbx files in windows via xna 4.0 I've made some models in Blender and exported them in Autodesk fbx format.  I'm trying to view them using XNA 4.0 Refresh.

Loading them isn't much an issue, but I'm not familiar enough with XNA 4.0 to, well basically I want to load in the model at say the origin (0,0,0) world coordinates, and then rotate and/or zoom the camera about the world coordinates origin as well so that I can test the model.  Typically the mouse, and maybe some arrow keys for zooming/rotating the camera.

Anyways, this seems like a simple task and I shouldn't have to re-invent this, isn't there a skeleton code somewhere for this kind of thing for XNA 4.0?  I couldn't find a solid example for this on the web.  I found a couple that seemed like they might work for xbox, but I'm trying to do this on windows only.

Anyways, just looking to be pointed in the right direction on this one, thanks.

sentences:
Can I use trilinear filtering for my sprites, but keep their outlines unfiltered? Suppose that I have two images of equal size. They both contain a square:

https://i.stack.imgur.com/BI62X.png
https://i.stack.imgur.com/Nev5Z.png

When overlapped, both squares will appear next to each other.

If both images use Point (no filter), they will contact without issues regardless of the amount of zoom or scale:

If you use either Bilinear or Trilinear, there will be an artifact visible in certain zoom/scale levels:

Of course, that is to be expected from the very nature of the filters. As much as I would like to just leave it at Point (no filter), my game looks far better using Trilinear instead - except of course, for the "borders" or points of contact.

The ideal scenario for me as bizarre as it may sound, is to be able to use Trilinear filtering generally, but force the "outlines" of my sprites to stay as if they were Point (no filter). This way, my game looks painterly when zoomed in/out (the game isn't pixel art), and I also avoid the "glitch" in specific contacts.

Yes, the glitch is only noticeable if you use a scale/zoom that is higher than 100%. Unfortunately, due to the nature of the game, the player should be able to zoom in/out if they desire, so I can't just pick "the" ideal camera size or sprite scale because it can't be constant.
I've tried using Canvas and its Pixel Perfect checkbox to no avail. I didn't really expect that to work though.

What can I do to achieve the desired effect, then?

sentences: Is the "Match-3" mechanic unpatented? Can I use a match-3 mechanic in my commercial game without being sued by some company holding the patent? I will add some extra features to the mechanic.

sentences:
How to build a hidden 3D snapping grid effect? Looking to build a 3D grid similar to the image below taken from Google Blocks.

Seems like it consists of these main components:

A set of spheres that can go transparent.
A stencil that follows the controller's location.
When stencil overlaps with spheres, they show up, otherwise, alpha fades to zero.

Any advise on how to approach building this?

sentences:
How would one determine the position of a participant in a racing game? Now, for the record, I'm currently not implementing any racing game whatsoever, but this problem just popped into my mind and now I'm curious.

So how would one go about finding out which participant of a race is currently the first one? It can't be something trivial like just sorting by distance to the finish line because that would be highly inaccurate on most courses. I've thought about doing something like separating the route into straight segments, each of which has a direction vector. The game would then check for when someone outruns somebody else by projecting their positions onto that vector and checking which one is ahead. If the position has changed, the game would increment/decrement them appropriately. But that does seem a little too complicated.

Does anybody know of any established methods or has any experience in implementing some?

sentences:
Better animation of elements in SFML/C++ This is not about animating individual characters or elements, I'm happy with spritesheets for that. What I'm looking for is the animation of elements on screen.

For example my game starts and the logo comes in flying from a random direction, then rotates or something and stops in one position, then a game character (one or more) comes from the side and does some action.

I haven't done many projects yet, I have written just one complete game, so I don't know whether I've correctly worded the question.

What I've been doing is giving the element an initial and final position and make it move accordingly and using status flags to check its state. The problem is when I want to move it in more than one way. Of course, I can just use the state variables and make it move, but I've been thinking there's got to be an elegant method for it

EDIT: I'm looking at animations such as in World of Goo etc.

sentences: How to display number of collisions on UI in Unreal Engine using nodes only? I am using Unreal Engine and I want to show on UI the number of collisions using nodes only. How can I achieve that?

sentences:
How can I place the player into a 360° video in UE4? I have a 360° video (6 separate videos stitched together into a panorama) with a first person view walking through an environment. I would like to put this in a game engine such that the actor can walk forward and backward and it will feel like they are in the environment.

I have tried this in UE4 but am somewhat new to all this. I'm not opposed to using UDK or Unity if that is easier. I have created a MediaTexture from the video asset. Now I'm trying to create a Material sphere that uses the MediaTexture and reflects it back so the actor is essentially in a spinning sphere. I keep getting stuck with these errors:

I understand that I must next construct a blueprint that reads the actor's movement to play back the video, and also rotate the texture coordinates according to the view of actor.

How can I do this?

sentences:
Some help understanding and modifying a 2D shader I have a similar question as the one posed here, except that I don't wish to use a 1D Color Palette.

I simply wish to have it display 1 color of my choosing (red, for example).  I plan to use this as a "shield" effect for a 2D ship.

I also wish to understand how it works a little bit better, as I'll be the first to admit that shaders in general are not my strongest suit.  I'm not asking for an overview of HLSL (as that is too broad of a subject), just an explanation of how this shader works, and the best way to implement it in a 2D game.

Code examples would be ideal (even if they are theoretical) but if the answer is explained well enough, I might be able to manage with plain old text.

This is also in XNA 4.0.

Thanks in advance.

sentences: Opponent car logic in race games I'm developing a race game in Andengine. I have created a car which player is controlling. But since this is a race game, there should be 3 or 4 car which snatch with the player's car. My question is: How do the opponent cars move along the path? How their logic works? Must I know certain path?

sentences:
Seek Steering Behavior with Target Direction for Group of Fighters I am implementing steering algorithms with group management for spaceships (fighters). I select a leader and assign the target positions for the other spaceships based on the target position of the leader and an offset. This works well. But when my spaceships arrive they all have a different direction. I want them to keep to look in the same direction (target - start).

I also want to combine this behavior with a minimum turning radius that is based on the speed. The only idea I have is to calculate a path for each spaceship with an point before the target position, so the ships have some time left to turn into the right position. But I dont know if this is a good idea. I guess there will be a lot of rare cases where this can cause a problem.

So the question is, if anybody knows how to solve this problem and has some (simple code) or pseudocode for me or at least some good explanation.

sentences: How to sub-divide a hexagonal grid reference system I have been using @amitp's excellent guide (and javascript library) to create a hexagonal grid system https://www.redblobgames.com/grids/hexagons/. I'm using flat-top, inverse-y cubic/axial system. However, I have elements that are located on the vertices, rather than "within" a tile. How would I refer to their position? I have considered using the index of the corner, but then the question is which  tile do I use as my base? I would also like to extend the concept so that I could precisely position an element anywhere within a tile. I am thinking of something relating to the Ordnance Survey's method of sub-division within the British National Grid (OSGB 1936) but I cannot get my head around how this relates to a cubic/axial coordinate system.

sentences: What is an OpenGL equivalent to ID3DXSprite? As a Direct3D developer I can use the ID3DXSprite class (in D3DX library) for drawing 2D graphics. What's the best way to implement this functionality in OpenGL?

sentences: Should I use a VBO if the vertex data changes from time to time? If I have a very large number of vertices, but they're static for about 70% - 80% of their life time, should I use a VBO for them? If so, what usage should I specify? This doesn't sound like a case for GL_STATIC_DRAW.

sentences:
Gamepad default trigger identification in Windows I'm currently writing an interface driver for my Moga Power Pro controller on Windows.  I'd like to release it for others to use, but first I have some questions on expected default mappings for the triggers.

Specifically, how do other gamepads map the triggers, as viewed from the Windows joy.cpl Game Controllers panel?  And which axis are they normally mapped to?  Some axes default to the center value, others can default to zero, and the different axes might be treated differently inside games.  Triggers are naturally zero-to-full, but I don't want someone to download my interface driver and suddenly find the triggers are always active because Windows thinks the axis ought to be centered and reads it always tilted to one side.

I realize every controller is different, so this may be a bit subjective, but the closer I can set it to some form of standard the better.  Or is this something I shouldn't even need to worry about, that games which expect a trigger input will handle on their own?

sentences:
main camera not covering whole screen in unity3d I have been using unity and i got a problem where my main camera is covering only the first half of the floor i made.
camera position is left and the floor is rotated ,i m posting an image please help .
I have shown a player white coloured and an enemy pink coloured .player is not shown as you can see.

sentences:
What research areas exist in game programming? I'm currently in a group that researches network optimizations and various distributed applications, I'm much more interested in games but more from a research side.Is there a resource that focuses on research topics specific to game development and what are some common areas of research?

Note:I understand game development is made up of various topics that are thoroughly researched, my question is more geared towards the areas that are exclusive to gaming applications or at least only important for gaming.

One example could be maybe a "genetic algorithm approach to character skill progression". Which would focus on building a skill progression that is most optimal to player returns. Etc etc...Random idea, but you get my point. I also mean the technical side of development too, but I didn't want to limit this.

sentences:
How to get tile rotation from TiledSharp and convert it to XNA/MonoGame I am currently working on a game using XNA and Tiled. I use Tiled to create my maps and load them using TiledSharp. Some of my maps have tiles that are rotated by using one or more of the left rotate, right rotate, horizontal flip, vertical flip options in combination.

In the tiled documentation, it shows there are certain ways to find out if an object is horizontally, vertically, or diagonally flipped. TiledSharp tells me this information. However, I don't know what to do if a tile is diagonally flipped. How many degrees should I rotate the tile (in multiples of 90 degrees)?

sentences:
Following a set of points? Lets assume that i have a set of path that an entity should follow :

const int Paths = 2
Vector2D<float> Path[Paths] = { Vector2D(100,0),Vector2D(100,50)   };

Now i define my entity's position in a 2D vector as follows :

Vector2D<float> FollowerPosition(0,0);

And now i would like to move the "follower" to the path at index 1 :

int PathPosition = 0; //Start with path 1

Currently i do this :

Vector2D<float>& Target = Path[PathPosition];
bool Changed = false;

if (FollowerPosition.X < Target.X) FollowerPosition.X += Vel,Changed = true;
if (FollowerPosition.X > Target.X) FollowerPosition.X -= Vel,Changed = true;
if (FollowerPosition.Y < Target.Y) FollowerPosition.Y += Vel;,Changed = true;
if (FollowerPosition.Y > Target.Y) FollowerPosition.Y -= Vel,Changed = true;

if (!Changed)
{
    PathPosition = PathPosition + 1;
    if (PathPosition > Paths) PathPosition = 0;
}

Which works except for one little detail : The movement is not smooth!! ...So i would like to ask if anyone sees anything wrong with my code.

Thanks and sorry for my english.

sentences:
Maintaining facing direction at the end of a movement I want to make my 2D top-down walking animation stop and revert to the idle animation while continuing to face in the same direction as the previous movement.
For example, when I go up then stop, my character should continue to look up. If I go down, it should continue to look down.
I use lastmoveX and lastmoveY floats for idle and for walking I use moveX and moveY floats. moveX and moveY change when I move with the joystick, but lastmoveX and lastmoveY do not change, and I don't know how to fix this.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D myRB;
    private Animator myAnim;
    public Joystick joystick;
    public MoveByTouch controller;

    [SerializeField]
    private float speed;

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

    }

    // Update is called once per frame
    void Update ()
    {
        myRB.velocity = new Vector2(joystick.Horizontal, joystick.Vertical) * speed * Time.deltaTime;

        myAnim.SetFloat("moveX", myRB.velocity.x);
        myAnim.SetFloat("moveY", myRB.velocity.y);

        if(joystick.Horizontal == 1 || joystick.Horizontal == -1 || joystick.Vertical == 1 || joystick.Vertical == -1)
        {
            myAnim.SetFloat("lastMoveX", joystick.Horizontal);
            myAnim.SetFloat("lastMoveY", joystick.Vertical);
        }

    }
}

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:
Does Pokemon use any deep A.I in battle? A Pokemon wild battle. The enemy may have up to 4 moves.

I am wondering, is there any.. A.I going on here, or does the enemy simply take a random move and then executes it? Are there not any battle factors/conditions that may change the enemy's behavior?

I guess it makes sense to categorize moves by "Offensive" "Defensive" and/or "Healing", and from there make choices depending on HP etc... dunno.

sentences:
OutOfBounds Exception when creating a PolygonShape using jbox2d So here's the deal, i'm parsing a file that contains the vertices for a polygon, that i want to create in box2d. I create a new PolygonShape() and then call .set() giving it a defined array of Vec, and that defined array's .length property. I expected this to work, since the documentation for jbox2d says this method takes a Vec array, and the count of Vec objects in that array. However, it errors out, and it seems to be unrelated to my code. The error i get is Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
    at org.jbox2d.collision.shapes.PolygonShape.set(PolygonShape.java:174) and, upon looking at that line in the jbox2d svn repository, i still cannot figure out the issue.

Any help is appreciated!

sentences:
How do I make UIText scale properly in a VerticalLayoutGroup in Unity? I have a Panel with an AspectRatioFitter on it.

In there, I have a vertical layout group, with three buttons, Standard Mode, Speed Mode, Chaos Mode.

I have the Layout Group's anchors set to keep its size relative to the parent Panel.

The problem is that the text doesn't resize when I change the screen resolution. You can see it's cut off to say "Standard M" in the bottom image.

But if I say "Best Fit", the texts aren't the same size, because the boxes are big enough to allow the shorter text to be bigger. The only way I've been able to fix this is to adjust the sizes and anchors of the text boxes by hand. Is there an automatic way to do this?

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: Populating Static Mesh Array I'm trying to populate a Array of Static Meshes from the On Begin Play event with all the static meshes that are children of the primary object but can't seem to access them as static meshes, any suggestions?

sentences:
How can I make a look around effect of the player some kind of cutscene? I want that at some point in the game the player will be looking over the view out of the window.
So I added a new Camera and positioned the camera close to the window.
Then using a small script I'm turning the Camera on.

But after turning the camera on I wan to make that the camera will rotate around the window area so it will give a natural feeling that the player is looking over the view outside.

And the script that is attached to another GameObject that activating the Camera:

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

public class ItemAction : MonoBehaviour
{
    public Camera viewCamera;

    private void Update()
    {

    }

    public void ViewCamera()
    {
        viewCamera.enabled = true;
    }
}

The part I'm using is the ViewCamera method.
But I messed it up.
But the idea is after turning on the Camera to make it feel like looking around the view outside.

How can I make the camera move first to one direction and then mirrored to the other direction ?

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

public class ItemAction : MonoBehaviour
{
    public Camera viewCamera;
    public float Speed;

    public void ViewCamera()
    {
        viewCamera.enabled = true;
        StartCoroutine(animate());
    }

    IEnumerator animate()
    {
        while (transform.localEulerAngles.y > -45)
        {
            transform.Rotate(0, -Time.deltaTime * Speed, 0);
            yield return null;
        }
        //and then possibly the same but mirrored to look in the other direction
        while (transform.localEulerAngles.y < 45)
        {
            transform.Rotate(0, Time.deltaTime * Speed, 0);
            yield return null;
        }
    }
}

The way it is now it's just keep rotating to the same direction nonstop.

sentences:
How to use Input.GetAxis("Mouse X/Y") to rotate the camera? I want to make a first person camera that rotates with the mouse.

I looked at the Input.GetAxis Scripting API page and found a sample code, which I have included at the bottom of my post. Upon trying it out, I realized that although it has the same basic functionality I hoped it would have, it does not keep the camera parallel to the xz plane, particularly when moving the mouse in circles. After a while the camera would be at an odd angle, and the player would be completely discombobulated!

Is there a quick fix to this code that would restrict the camera movement somehow, or is there a better way to rotate the camera?

 using UnityEngine;
 using System.Collections;

     public class ExampleClass : MonoBehaviour {
         public float horizontalSpeed = 2.0F;
         public float verticalSpeed = 2.0F;
         void Update() {
             float h = horizontalSpeed * Input.GetAxis("Mouse X");
             float v = verticalSpeed * Input.GetAxis("Mouse Y");
             transform.Rotate(v, h, 0);
         }
     }

sentences:
How do I repeatedly move an image by 1 pixel? I have a method that is moving a UIImageView called shootImg across the screen:

-(IBAction)shoot{
if (appDelegate.shootInt > 0) {
    if (direction == 1) {
            shootImg.center = CGPointMake(shootImg.center.x+1, shootImg.center.y);
            appDelegate.shootInt = appDelegate.shootInt - 1;
            shootLabel.text = [NSString stringWithFormat:@"%d", appDelegate.shootInt];
                }

This does seem to work. But it only moves shootImage 1 pixel. What I want to do is make it repeatedly move 1 pixel. I tried a while loop but that didn't seem to work. I'm not using cocos2d or anything like that and if you need to see more code just ask.

Thanks :)

sentences:
Should an NPC shop provide a unique or shared inventory for each player? I am working on a browser-based text game. I have implemented NPC shops where the players can buy items in exchange for coins.

Currently, the inventory of the NPC shop is shared among all players. For example, if I sell the shop a Sword, any other player can go to the shop and buy that Sword. This also means if I purchase an item before one of my fellow players, it is no longer available for them. Shop stock is randomly regenerated from a database of possible items and quantities periodically.

I see two options: A shared NPC inventory, or private instances of the NPCs inventory.

What considerations should I have, as far as user experience and the virtual economy, when trying to determine which option to go with?

sentences:
How to create and populate a 2D Texture Arrays in DirectX11 I have generated a bunch of ID3D11ShaderResourceView that are a 2D textures that have a depth map screen shot for my lights shadows. I would like to take all of these textures and put them into a single 2D Texture Array.

I have seen examples of how to create a 2D Texture array like in this question here but I don't know how to copy the data to the newly created texture array.

sentences:
Efficient way to store information about neighbour chunks I've finally managed to implement an infinite chunk loading system for my voxel engine. Since every chunk needs to have information about the border of the neighbouring chunks, I need to access them fast. First some information about how I'm storing the voxel data: I have an Integer array of block information on each chunk (rather than byte because of the read/write access speed), which is stored in an Dictionary(Vector3i chunkPos, Chunk chunk).
When building a chunk I have to access the voxel data of the chunk and of the neighbouring chunks several times.

Without information about their neighbours it currently looks like this:

So I've tried the following two things:

getting the chunk data every time like this:

public static int getBlockAt(int x, int y, int z) {
    Vector3i chunkIndex = new Vector3i(
        x >> ChunkManager.logChunkSize,
        y >> ChunkManager.logChunkSize,
        z >> ChunkManager.logChunkSize
    );

    if (chunkManager.chunkData.ContainsKey(chunkIndex)) {
        return chunkManager.chunkData[chunkIndex].data[x & ChunkManager.chunkMask, y & ChunkManager.chunkMask, z & ChunkManager.chunkMask]} return 0;

storing chunkSize + 2 information on each chunk, which makes editing much, much slower, but improves chunk loading alot

In general I want to implement something like using approach 1 only when the block data isn't on the chunk.

I really don't know how I could do it! Do you have an idea, or experience from writing voxel engines?

Thanks in advance!

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:
How to make player seem bigger / world smaller, without changing world coordinates I am making a voxel game with OpenGl, I've got the major parts working, except the camera seems small compared to the the blocks.
How do I make the camera bigger?
Do I do a scaling on the model matrix for each chunk? Or do I do something with the view matrix of the camera? When i tried these things, it messed up the coordinate system of my game, the blocks were not where they really were. I just want the player to be visually 2x bigger.
// the view matrix
glm::mat4 Camera::GetViewMatrix()
{
    glm::mat4 view = glm::lookAt(position, position + target, up);
    return view;
}

    // Where i do the chunk rendering
void WorldRenderer::RenderChunck(Chunk *c)
{
    glActiveTexture(GL_TEXTURE0);
    worldTexture->BindTexture();
    worldShader->Bind();
    worldVertexBuffer->BindVertexArrayBuffer();
    worldVertexBuffer->PutVertexData(c->meshData.verts, c->meshData.indices, c->meshData.textureCoords);

    glm::mat4 model = glm::mat4(1.0f); // model = local space to world space
    model = glm::translate(model, vec3(c->pos.x * Chunk::CHUNCK_SIZE, c->pos.y * Chunk::CHUNCK_SIZE, c->pos.z * Chunk::CHUNCK_SIZE));

    worldShader->setMat4f("model", model);
    glDrawElements(GL_TRIANGLES, c->meshData.indices.size(), GL_UNSIGNED_INT, 0);
}
void WorldRenderer::Render(glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
{
    worldShader->setMat4f("view", viewMatrix);
    worldShader->setMat4f("projection", projectionMatrix);

    for (Chunk *c : renderedChunks)
    {
        this->RenderChunck(c);
    }
}

sentences:
Projecting a light onto a quad I need to project the light onto the quad and use its value for translating the vertices.

I'm currently having 6 vertices,  two quads,
The points are
A  X  C
B  Y  D

Point X, Y are coming from two ray casting downwards.

C =  X + RightVector
D =  Y +  RightVector
A =  X - RightVector
B =  Y - RightVector

Now I want to translate the vertices based on lightDirectionVector, how would I do that ? I have a directional light, and that mesh of the two quads acting as a shadow quad.

    Vector3 lightDir = mDirectionalLight.transform.forward;
    Vector3 normLight = lightDir.normalized;
    normaLight.y = 0;

sentences:
Wandering motion in Unity I am trying to come up with a smooth wandering motion for my game-object using Unity. What I currently doing is rotate the object by some random angle calculated every 1.5 second delay. But I am aiming getting a smooth rotation whenever it transitions to a different randomly generated angle.

Below is my script attached to my character.

 void Update () {
     if (canWander && (currTime + delay < Time.time)){
        changeAngle();
        currTime = Time.time;
     }
     if(canWander){
        Wander();
     }
}

private void changeAngle(){
    float prevPosY = transform.position.y;
    Vector3 waypoint = Random.insideUnitSphere + new Vector3(10,prevPosY,10);  //waypoints are generated based on random unit sphere + ( bounds of the plane they are on )
    Vector3 relative = transform.InverseTransformPoint (waypoint);
    float angle = Mathf.Atan2 (relative.x, relative.z) * Mathf.Rad2Deg;
    transform.Rotate (0, angle, 0);
}

private void Wander(){
    transform.position += transform.forward * Time.deltaTime * acceleration;
    if (acceleration < maxSpeed) {
        acceleration += 0.5f;
    }
}

So the character wanders with newly generated random angles every time but its not a smooth transition. It suddenly transitions to the new angle and it does not feel realistic at all. What could I possibly change with my current code to make it more smooth and realistic?

sentences:
How to compile with OpenGL ES on Windows? I downloaded OpenGL ES 3.1 sdk here.

But when I tried to run (or compile and run) the executable in "samples" directory, I got the following message:

  The program can't start because libGLESv2.dll is missing from your computer. Try reinstalling the program to fix the problem.

This sounds strange, because the sample program is directly linked with libGLESv2.lib, so it shouldn't even look for dll files.

But when I wanted to install dll files (libGLESv2.dll and libEGL.dll), I got the following error:

regsvr32 libGLESv2.dll

  The module "libGLESv2.dll" was loaded but the entry-point DllRegisterServer was not found.
  Make sure that "libGLESv2.dll" is a valid DLL or OCX file and try again.

So it looks like these dll files are kind of invalid.

Is the problem from my dll files? Or did I miss something in installation process?

sentences:
What are some of the more commonly used projectile rendering techniques? couldn't find a duplicate question (bit surprising to me) but anywho I'm starting to get near implementing the rendering of projectiles for my game.

My question is what are some good techniques for efficiently rendering projectiles? I would like emphasis on techniques that leave room for the projectiles to be "rich" and dynamic (Cool to look at!)

I'm also using DX11 for my rendering engine so bleeding edge techniques that can make use of that would be much appreciated too.

Thanks!

sentences:
How do I create a big multiplayer world in UDK? I want to create a big multiplayer world in UDK and I'm having a few difficulties.

I created the biggest terrain possible but then any terrain related action I do takes forever. However, I've seen videos of people make same size terrain and working without a problem. My pc is strong enough, so maybe someone can tell me what I'm doing wrong.
I want to make it even bigger then the biggest terrain size, so I was thinking of doing level streaming but then I read that streaming is working server side which means if I have a player on every terrain all terrains will still be loaded and I want to save as much memory possible so it will work well online.

Thanks for any help you can give.

sentences:
What was the typical toolchain for DOS game development? I'm wondering how people used to write DOS games (like Doom), I can't find much on this, but would love to learn more about the earlier days of game development.

What language was used predominantly?

I presume it was C. Or C++ already?

What IDEs (or editors/compilers) were popular?

Microsoft Visual C/C++ (or Microsoft C/C++ as I believe it used to be called) didn't exist back then AFAIK. So what did people use? edit and a command-line compiler from Intel or something?

What APIs where used?

What was common for 2D games? What about 3D games like Doom and Tomb Raider?

Anything else that's different from today?

I'd be happy to hear any other differences, like what image/audio formats were used.

sentences:
Convert a .fbx to a .x model I'm trying to convert a .fbx model to a .x for use in my DirectX 9 project. Does anyone know of any software to allow me to do this?

Been googling for a few days and not really found anything that has allowed me to do this.

sentences:
How can I check if a point(Vector3) is in Matrix4x4 I'm placing random objects in an imaginary cube in front of my target. I am using following code to do this:

var center = Vector3.zero;
center.z = (m_size.z / 2) + m_offset.z;
center.x += m_offset.x;
center.y += m_offset.y;
var mat = Matrix4x4.TRS(m_target.position, m_target.rotation, m_target.lossyScale);
Vector3 pos = center + new Vector3(Random.Range(-m_size.x / 2, m_size.x / 2), Random.Range(-m_size.y / 2, m_size.y / 2), Random.Range(-m_size.z / 2, m_size.z / 2));
pos = mat.MultiplyPoint(pos);
m_instantiatedObject.Add(Instantiate(m_object, pos, Quaternion.identity));

And it's working as expected. but now my problem is as my target moves, the previously placed objects may not be in this imaginary cube anymore. how can I check if my placed objects are in this imaginary cube and if they are not I can remove them?

sentences:
What is the easiest genre of game to make? Before you down vote let me give some restrictions.

I like RPG but they seem long and hard to make but after you make the framework the rest sort of falls into place where as platformers never get faster as each map starts from scratch.

So under these conditions what is the easiest genre of game to develop as a hobby project.

I am on my own.
The style of graphics must be available. Can be ripped (not publishing).
Not bothered about commercial quality.
Must be real size game, multiple levels and stuff.

Thanks

Edit:

I build games in C++ and Direct x 9.c

sentences:
OpenGL Blending GUI Textures I'm currently creating a menu for my project and I'm trying to get the textures to blend so I'm only left with the actual Image on the texture and not the background. The problem is the whole texture is somewhat transparent, it's not just removing the background.

My RGBA texture looks like

And the black background needs to be removed from the image.

I was using GL_SRC_ALPHA, GL_ONE_MINUS_SRC, ALPHA for my blend function but it wasn't blending anything. I changed to GL_ONE, GL_ONE and now I'm at where I am now.

You can see the text is there but its also transparent, but the background has been removed which is good.

This is how i'm drawing my button. The world behind it is drawn after (i've tried switching order didnt change anything) and it's drawn using VBO's whereas the Buttons are drawn in immediate mode.

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);[/left]
// get button pos
Point3<float> pos = button->getPos();
// get button dimensions
int width = button->getWidth();
int height = button->getHeight();
// bind button texture and draw quad
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, button->getState() ? button->getDownTex()-
>getTextureID() : button->getUpTex()->getTextureID());
glBegin(GL_QUADS);
glTexCoord2i(0, 1); glVertex3f(pos.x, pos.y, 0.0f);
glTexCoord2i(1, 1); glVertex3f(pos.x + width, pos.y, 0.0f);
glTexCoord2i(1, 0); glVertex3f(pos.x + width, pos.y + height, 0.0f);
glTexCoord2i(0, 0); glVertex3f(pos.x, pos.y + height, 0.0f);
glEnd();

I'm using sdl to load the texture

SDL_Surface* image = IMG_Load(textureName);
data.m_w = image->w;
data.m_h = image->h;
data.m_bitsPerPixel = image->format->BitsPerPixel;
data.m_alpha = image->format->alpha;
int colourMode = image->format->BytesPerPixel;
if (colourMode == 4)
   internalFormat = GL_RGBA;
if (colourMode == 3)
   internalFormat = GL_RGB;
if (colourMode == 1)
   internalFormat = GL_LUMINANCE;
if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
{
if (colourMode == 4)
  format = GL_BGRA;
else
  format = GL_BGR;
}
else
{
if (colourMode == 4)
  format = GL_RGBA;
else
  format = GL_RGB;
}
GLuint texture = -1; // create texture handle
glGenTextures(1, &texture);    // gen texture
bindTexture(GL_TEXTURE_2D, texture);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, image->w, image->h, 0, format,
GL_UNSIGNED_BYTE, image->pixels); // normal texture

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:
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:
NullReferenceException in save game function I was making save system to save position of player.

I get an exception:

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

It comes from this line: FloatPos[0] = DataG.transform.position.x;

Here is my Save Manager:

[System.Serializable]
public class SaveManger
{
    public float[] Player, Top, Ground, ET, ED;
    public int PN, PCN;

    public SaveManger(SaveGame SaveGame)
    {
        PosMath(Player, SaveGame.PlayerPos);
        PosMath(Top, SaveGame.TopPos);
        PosMath(Ground, SaveGame.GroundPos);
        PosMath(ET, SaveGame.EfTop);
        PosMath(ED, SaveGame.EFDown);

        PN = SaveGame.TransformMover.GetComponent<TransformMover>().PuzzleNumper;
        PCN = SaveGame.TopPos.GetComponent<PuzzleSetUp>().PuzzleCloneNumper;
    }

    public void PosMath(float[] FloatPos, GameObject DataG)
    {
        FloatPos[0] = DataG.transform.position.x;
        FloatPos[1] = DataG.transform.position.y;
        FloatPos[2] = DataG.transform.position.z;
    }
}

Here is my saved game component:

public class SaveGame : MonoBehaviour
{

    public GameObject PlayerPos,TopPos,GroundPos,EfTop,EFDown,TransformMover;

    public void Start()
    {
        string path = Application.persistentDataPath + "/GSave.GSF";
        if(File.Exists(path))
        {
            LoadButton();
        }
        else
        {

        }
    }

    public void SaveButton()
    {
        SAVESYSTEM.VoidSaver(this);

    }

    public void LoadButton()
    {
        SaveManger Data = SAVESYSTEM.LoadSave();

        TransformMover.GetComponent<TransformMover>().PuzzleNumper = Data.PN;
        TopPos.GetComponent<PuzzleSetUp>().PuzzleCloneNumper = Data.PCN;
    }
}

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:
Resize font when screen resizes desktop Libgdx I create my font using the following code:

public BitmapFont createFont(FreeTypeFontGenerator ftfg, float dp)
{
    FreeTypeFontParameter f = new FreeTypeFontParameter();
    f.size = (int)(dp * Gdx.graphics.getDensity());
    f.color = Color.BLACK;
    f.minFilter = Texture.TextureFilter.Nearest;
    f.magFilter = Texture.TextureFilter.MipMapLinearNearest;
    ftfg.scaleForPixelHeight((int)(dp * Gdx.graphics.getDensity()));
    return ftfg.generateFont(f);
}

myFont = createFont(new FreeTypeFontGenerator(Gdx.files.internal("Fonts/Roboto-Black.ttf")), 16);

I have some labels to which I set the font using:

Label myLabel= new Label("Text", uiSkin);
        myLabel.setWrap(true);
        myLabel.getStyle().font = myFont;

How I create the stage:

Stage collectionStage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()));

I also tried with no viewport or with other viewports.

In my resize method:

public void resize(int width, int height) {
    Viewport viewport = collectionStage.getViewport();
    viewport.update(width, height, false);
    viewport.apply();
}

The problem is that when I resize the window on Desktop the font gets distorted. Do I have to create another font in the resize method, and then for each label that I have, reassign the new font? Or should I do something else?

sentences:
How to use TensorFlow in Unity I am trying to implement a deep reinforcement learning IA with TensorFlow for a checker game in Unity. How can I do this?

I've searched for it on Google and found a lot of videos and tutorials on how to use machine learning agents with Unity, and other people who explain how to import a TensorFlow trained neural network in Unity, but I didn't see anything related to using directly TensorFlow in Unity to create (and train) neural networks.

If someone knows another package to create CNNs with C#, I am interested.

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:
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 to handle game objects in DirectX Coming from XNA, I would use the content pipeline and create XML files for game objects.  However, if I changed something in the XML, I would need to do a rebuild of the project so it will create the XNB file.

Do I need to create XML files on my own and create* encrypt/decrypt process and XML parser?  Or should I simply hard code (since any changes would need a rebuild anyway)?

Most of the things in my game project will be random.  However, the base types (like Armor types) will be static.  Meaning one type of armor will give 20% armor.  And another type of armor will give 50% armor.

I do not want to use any third party solutions.  I want to do everything myself so I can learn how to handle these situations.

sentences:
What matrix operations do I perform to translate then rotate then translate then rotate? In an android game I want to draw a running leg. To output the thigh I do something like:

// legCX,legCY is the location on screen about which the leg rotates.
Matrix m = new Matrix();
m.postTranslate(-legCX,-legCY);
m.postRotate(legRot);
m.postTranslate(legCX,legCY);

So, the above translates the 0,0 point over to the point of rotation about which I want to rotate the leg, then it rotates by the amount I want the leg rotated, then it translates 0,0 back to the original origin.

I then use that matrix to draw the thigh. It ends up rotated as expected. So far so good.

How do I draw the second part of the leg below the knee? It rotates differently than the part of the leg above it and has a center point which moves with the leg above it. I tried the following, but it turns out that the end result is rotation around some single point which doesn't follow the thigh.

Matrix m = new Matrix();
m.postTranslate(-legCX,-legCY);
m.postRotate(legRot);
m.postTranslate(0,-thighLength);
m.postRotate(shinRot);
m.postTranslate(0,thighLength);
m.postTranslate(legCX,legCY);

I suspect that it's probably necessary to do the two rotations in two different Matrix objects and then combine them somehow, but I can't figure out how exactly to do that.

I've tried reading the various wikipedia articles on matrix operations, but I'm having trouble finding the sort of operation that I'm trying to perform.

EDIT: This type of matrix seems to be called a "transformation matrix". Combining multiple operations is called composition of transformations. However, none of the pages on this topic mention how to do a series of translations and rotations.

Surely, if you can use a matrix to do rotation about one point, it must be possible to do multiple matrix operations somehow to allow rotation about one point and then an additional rotation around a different point.

I've tried looking at pages on skeletal animation, but I can't make head nor tail of what they're talking about. My game won't involve many characters, so I don't need to use a physics engine to do super complex stuff. I just want to do the calculations to draw a character that runs.

EDIT: Hooray! Thanks dkantowitz! Your answer wasn't quite right, but you got me really close. I've edited your answer to be correct now. The second matrix needed to translate from the origin, not relative to the leg's center of rotation. And, the combined matrix needs to preConcat the shin matrix first and then the thigh's matrix. Thanks!

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:
Determining Rectangle-Circle Collision Point I'm developing a 2D game engine currently. I stuck on determining position of a rectangle that collides with a circle when its speed is added to its position. Rectangles have only x axis speed.

On picture rectangles are same. Left sided rectangles x,y,width and height values are known. Second rectangle should be next position. Circles radius, x and y values are known also. (x and y values are top left position of an object). I need to find second position of rectangle.

Edit: I can detect collision perfectly. But I need its new position.

sentences:
How 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:
Unity Guitext object always triggering a collision - 2D I have a guitext object which I can drag.  I have attached a 2d rigid body.  I have also attached the collider with the following code:

void setCollider()
    {
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        var boxX = box.width;
        var boxY = box.height;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

I have a sprite with a collider set as trigger.  However, it triggers as soon as the game starts and is not anywhere near the trigger sprite.  It will only trigger the one time when it starts.  My Trigger on my sprite is as follows:

void OnTriggerEnter2D (Collider2D other){
        Debug.Log ("Order Right Arm");
        Debug.Log (other.bounds);
    }

EDIT: based on answer I have changed the size of the collider to account for the pixel/unit difference:

void setCollider()
    {
        float pixelRatio = (Camera.main.orthographicSize * 2) / Camera.main.pixelHeight;
        Debug.Log ("Pixel Ratio "+pixelRatio);
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        float boxX = box.width * pixelRatio;
        float boxY = box.height * pixelRatio;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

Any ideas on how I can get this to trigger only when I drag the guitext over the sprite?

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:
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: Why is there no glClear() and glClearColor() method in GL30? In the GL30 interface, both the methods glClear() and glClearColor() are absent. I tried to call the method Gdx.gl30.glClear(GL30.GL_COLOR_BUFFER_BIT) inside render() but it threw me a null pointer exception. So I checked the interface. There's no glClear() method in GL30. Only in GL20. But OpenGL documentation says that they are supported in both v2.0 and v3.0. Why is it not included in LibGDX?

sentences:
Keep cube spinning after fling So I've been trying to get started with game development for Android using Unity3D. For my first project I've made a simple cube that you can spin using touch. For that I have the following code:

using UnityEngine;
using System.Collections;

public class TouchScript : MonoBehaviour {

float speed = 0.4f;
bool canRotate = false;
Transform cachedTransform;

public bool CanRotate {
    get { return canRotate; }
    private set { canRotate = value; }
}

void Start () {
    // Make reference to transform
    cachedTransform = transform;
}

// Update is called once per frame
void Update () {
    if (Input.touchCount > 0) {
        Touch touch = Input.GetTouch (0);

        // Switch through touch events
        switch (Input.GetTouch (0).phase) {
        case TouchPhase.Began:
            if (VerifyTouch (touch))
                CanRotate = true;
            break;
        case TouchPhase.Moved:
            if (CanRotate)
                RotateObject (touch);
            break;
        case TouchPhase.Ended:
            CanRotate = false;
            break;
        }
    }
}

bool VerifyTouch (Touch touch) {
    Ray ray = Camera.main.ScreenPointToRay (touch.position);
    RaycastHit hit;

    // Check if there is a collider attached already, otherwise add one on the fly
    if (collider == null) gameObject.AddComponent (typeof(BoxCollider));

    if (Physics.Raycast (ray, out hit)) {
        if (hit.collider.gameObject == this.gameObject)
            return true;
    }
    return false;
}

void RotateObject (Touch touch) {
    cachedTransform.Rotate (new Vector3 (touch.deltaPosition.y, -touch.deltaPosition.x, 0) * speed, Space.World);
}

}

The above code works fine. However, I'm wondering how I can keep the cube spinning after the user lifts his finger. The user should be able to "fling" the cube, which would keep spinning and after a while would slowly come to a stop due to drag.

Should I do this using AddForce or something? I'm really new to this stuff so I'd like it if you guys could point me in the right direction here :) .

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:
Load 3D model from external directory I am developing a desktop application that want to load the 3D model from desktop. Using file explorer user wants to choose the 3d model then it want to show in the application scene.I tried to find the object, the path is detecting but if i tried to Instantiate it on unity it showing this error.

  ArgumentException: The Object you want to instantiate is null.

here the code is used

public class ReadData : MonoBehaviour {
string path;
GameObject go;
public void OpenExplorer(){
    path = EditorUtility.OpenFilePanel("Overright with model", "", "dae");
    Debug.Log(path);
    GetObj();
}

void GetObj()
{
    if(path!=null)
    {
        UpdateObject();
    }
}

void UpdateObject()
{
    WWW www = new WWW("file:///" + path);
    go = GameObject.Find(path);
    Instantiate(go);
}}

Anybody please help me to do this. Thanks in Advance.

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:
Add action to GameObject So I'm creating a Unity project that has a bunch of buttons (like hundreds) that each do a different thing when pressed.  This is a 3D project and these buttons are also 3D.  I already know how to detect if the player has pressed a button, so I just need to know how to attach an action to one of these buttons.

Should I create a script for each?  From what I've found, it's very memory-expensive and will definitely drop FPS especially for hundreds of buttons.

Should I try to use a UnityEvent?  I don't know if this helps for what I'm doing...?

sentences:
How do I simulate a crowd in the stadium stands? I'm working on a mobile sports game with Unity. I'm wondering how I could create an efficient effect of an audience in the stadium.

I know that with more than 15 characters in my games (with 1800 faces and 20 bones) the game slows down, so I guess that even with a small number of bones, using 3D characters for even the first row of seats isn't feasible... Would you have some tips on how to do this another way?

I have also tried to "paint" them, and add a blur effect, but the result is not very good...

sentences:
OpenGL shows a black screen I am new at OpenGL, I try this example:  https://stackoverflow.com/a/31524956/4564882

but I get only a black widget. The code is exactly the same. this is the code associated to the QopenGLWidget:

OGLWidget::OGLWidget(QWidget *parent)
: QOpenGLWidget(parent)
 {

 }

 OGLWidget::~OGLWidget()
{

}

 void OGLWidget::initializeGL()
 {
   glClearColor(0,0,0,1);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHT0);
   glEnable(GL_LIGHTING);
   glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
   glEnable(GL_COLOR_MATERIAL);
}

 void OGLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_TRIANGLES);
    glColor3f(1.0, 0.0, 0.0);
    glVertex3f(-0.5, -0.5, 0);
    glColor3f(0.0, 1.0, 0.0);
    glVertex3f( 0.5, -0.5, 0);
    glColor3f(0.0, 0.0, 1.0);
    glVertex3f( 0.0,  0.5, 0);
glEnd();
 }

 void OGLWidget::resizeGL(int w, int h)
 {
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, (float)w/h, 0.01, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5,0,0,0,0,1,0);
  }

I tried the example here: https://doc.qt.io/archives/qt-5.3/qtopengl-2dpainting-example.html. It works fine (trying the both base class: QGLWidget and QOpenGLWidget. this is the code associated to the Widget:

  GLWidget::GLWidget(Helper *helper, QWidget *parent)
  : QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper)
 {
 elapsed = 0;
setFixedSize(200, 200);
setAutoFillBackground(false);
}

void GLWidget::animate()
{
 elapsed = (elapsed + qobject_cast<QTimer*>(sender())->interval()) % 1000;
 repaint();
 }

void GLWidget::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.setRenderHint(QPainter::Antialiasing);
helper->paint(&painter, event, elapsed);
painter.end();
}

I use  Qt 5.5.1 binairies built on my machine. I let the Build Configuration by default, so it is based on Qt ANGLE not Desktop OpenGL.
My Graphic card Driver is updated.
What is the problem of such a behaviour?

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:
Bouncing ball slowing down over time I use the unreal engine 4 to bounce a ball off of walls in a 2D space, but over time the ball gets slower and slower.

Movement happens in the tick function of the ball

FVector location = GetActorLocation();

location.X += this->Velocity.X * DeltaSeconds;
location.Y += this->Velocity.Y * DeltaSeconds;

SetActorLocation(location, true);

When a wall gets hit I get a Hit Event with the normal of the collision.
This is how I calculate the new velocity of the ball:

FVector2D V = this->Velocity;
FVector2D N = FVector2D(HitNormal.X, HitNormal.Y);

FVector2D newVelocity = -2 * (V.X * N.X + V.Y * N.Y) * N + V;

this->Velocity = newVelocity;

Over time, the more the ball bounced around, the velocity gets smaller and smaller.
How do I prevent speed loss when bouncing off walls like that? It's supposed to be a perfect bounce without friction or anything.

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 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:
Unity engine memory usage issue - taking up more than it should I'm making a 2D game that consists mostly of sprites. As a lot of them were too large in file size, I swapped them into meshes with unlit materials without textures. Now, The problem is that Unity by default, just opening a blank scene, uses 20 MB of texture memory according to the profiler.

So I checked instantiating 100 of my sprites (294 kb each), where the profiler showed 100MB used.

After that I had only those meshes in the scene, still 100 pieces, vertex count 124 each, tri count 47.
The memory usage was still around 100 MB, texture usage 20 MB

Lastly I instantiated 100-100, so the sprites and meshes together.
I got around 106 MB used memory.

This is my used memory with the sprites:

And this is my used memory with the meshes.

Now, as far as I know the meshes should rock in terms of memory as they are low res and have no textures attached.
Could someone tell me what's going on, why are my meshes worse than using sprites? And how to sort this out?

sentences:
terminology: a position and a facing my units have a function that returns a position (vec3) and a facing (quaternion) for any point in time.

A position and direction is perhaps called a ray or, in some contexts, a line segment; however, neither of these sounds appropriate in this context and neither normally has a quaternion...

What better name should a compound position and facing be called?

sentences:
Preventing rapid inversions of boolean on Collision detection I know this is both a strange question and a stupid question. But this is an issue I have dealt with in every single game I've made, and I have yet but to find a solution. I can't be the only one who's run into this problem. My google-fu must suck though, because I can't find any information on how to fix this.

Here's the situation:

A dynamic object is moving in a certain direction.
This dynamic object then hits a static object.
This dynamic object now changes the direction, and heads the other way until it hits an object, and then it changes the direction once again. Kind of like paramecia movement, but not exactly. Seems simple enough.

Now here's the issue. I detect the collision, but I can simply inverse the velocity. Using OOP, I have my own class for this object, which performs all movement and actions. So, instead, I have a boolean in this class. A simple boolean that asks whether I'm moving left. If I am, my velocity is negative. I may also need to flip the sprite. If, however, the boolean is false, my velocity is positive. So, all is fine and dandy.

Now, here is where the common issue comes in. I detect collision, and inverse the boolean(object.movesLeft != object.movesLeft). This is performed EVERY time it detects a collision. The issue now comes in. I inverse the boolean and start to move it in the opposite direction; however, it is not quick enough, and before it gets moving, it still detects the collision, reversing the boolean once again, turning in back into its original value.

I have yet to find a good solution to this. I have found workarounds, but often times I still get this issue.

Currently, I am using Box2D for collision detection, so my flexibility for solutions are constrained. Box2D provides a method for when specific collisions are happening, and when the specific collisions end. I tried only changing the boolean when a collision ends, but there was a pretty big issue. It would only run when a collision ended, obviously. It didn't have to be the moving object that I'm trying to inverse, it could be any dynamic object. The obvious issue is that I need some kind of collision to end before the object will inverse the direction.

So anyways, this is the issue I have faced in even simple games such as pong, and really, really need to find a way to solve it. I can't be the only one of us who have run into this issue.

If anybody understands the issue I'm having, or has experienced it themselves, and has a solution, help would be greatly appreciated. Thanks in advance.

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 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:
How to rotate object just like in the scene? Look at this image, I selected an object and pivot is set to local:

When I rotated selected object in the scene by X axis, it rotates exactly I wanted.

But if I rotate axis from inspector or script, it doesn't rotated to desired angle.

I'm not sure, but it seems it's related about Quaternion, but everything I tried doesn't worked well.

How do I rotate that object just like in rotated from scene?

sentences:
Weird black lines when rendering in my Java Game Engine I have an issue regarding weird horizontal and vertical lines that occur in my game engine. The lines is in the background color. It occurs when I draw a lot of tiles in this way:
for (int y = iy; y < camera.getY() + renderer.getpHeight(); y+= image2.getHeight()) {
    for (int x = ix; x < camera.getX() + renderer.getpWidth(); x+=image2.getWidth()) {
        renderer.drawImage(x, y , image2);
    }
}

The lines appear when I move the "camera" around.
The way I am rendering the tiles is not a good way to do it, which I have understood due to the drop in FPS. I am currently thinking on a way to make it more optimized. I don't think that the bad optimization is the reason for the black lines however. Here is a GIF of the phenomenon:

sentences:
AudioSource not working. Empty Exception I'm trying to load and play an wav file that exists in my Application.dataPath but when the game gets to the line _GoAudioSource.PlayOneShot(audioLoader.audioClip); It justs throws a empty exception and no sound is played.

I've already checked if the path is correct and it is. I've also tried uploading this wav file to an FTP and loading it via HTTP instead of File:/// but nothing changes.

This is my full code:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "file:///" + Application.dataPath + "/" + FILENAME_RESPONSE;
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the version with HTTP request:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "http://www.raphaelrosa.com/response.wav";
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the console:

sentences: 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:
Why nearby triangles tend to disappear? I've just enabled back face culling and I'm noticing a weird behavior: when all vertices of my triangle is outside the view and 2 of them is behind me (I think) the triangle disappears.

So to see it, here is a GIF.

I suspect the projection matrix reverses the order of the two vertices when they fall behind me, and changes the winding of my triangle.

But it's unclear why does the triangles disappear only if all vertices out of view...

How can I work around this problem, if possible?

I develop on Linux if that matters.

UPDATE:

It's pointed out it might not be due to the back face culling. I disabled it and I can indeed reproduce it. The cubes are 20×20 and the vertical field view is 90°. Its vertical apparent size roughly fills the window.

UPDATE 2:

Ok I'll post the relevant part of the code, projection and view matrixes are set up using my own functions:

void createViewMatrix(
    GLfloat matrix[16],
    const Vector3 *forward,
    const Vector3 *up,
    const Vector3 *pos
)
{
    /* Setting up perpendicular axes */
    Vector3 rright;
    Vector3 rup = *up;
    Vector3 rforward = *forward;

    vbonorm(&rright, &rup, &rforward); /* Orthonormalization (right is computed from scratch) */

    /* Filling the matrix */
    matrix[0] = rright.x;
    matrix[1] = rup.x;
    matrix[2] = -rforward.x;
    matrix[3] = 0;

    matrix[4] = rright.y;
    matrix[5] = rup.y;
    matrix[6] = -rforward.y;
    matrix[7] = 0;

    matrix[8] = rright.z;
    matrix[9] = rup.z;
    matrix[10] = -rforward.z;
    matrix[11] = 0;

    matrix[12] = -vdp(pos, &rright);
    matrix[13] = -vdp(pos, &rup);
    matrix[14] = vdp(pos, &rforward);
    matrix[15] = 1;
}

void createProjectionMatrix(
    GLfloat matrix[16],
    GLfloat vfov,
    GLfloat aspect,
    GLfloat near,
    GLfloat far
)
{
    GLfloat vfovtan = 1 / tan(RAD(vfov * 0.5));

    memset(matrix, 0, sizeof(*matrix) * 16);
    matrix[0] = vfovtan / aspect;
    matrix[5] = vfovtan;
    matrix[10] = (near+far)/(near-far);
    matrix[11] = -1;
    matrix[14] = (2*near*far)/(near-far);
}

Projection matrix set up with this call:

createProjectionMatrix(projMatrix, VERTICAL_FOV, ASPECT_RATIO, Z_NEAR, 10000);

(VERTICAL_FOV = 90, ASPECT_RATIO = 4.0/3, Z_NEAR = 1)

Level drawing is simply:

void drawStuff()
{
    GLfloat projectView[16];

    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    createViewMatrix(viewMatrix, &camera.forward, &camera.up, &camera.pos);

    multiplyMatrix(projectView, viewMatrix, projMatrix); /*< Row mayor multiplication. */

    glUniformMatrix4fv(renderingMatrixId, 1, GL_FALSE, projectView);
    bailOnGlError(__FILE__, __LINE__);

    renderLevel(&testLevel);
}

Cubes are rendered wall by wall (optimizing this will be another story):

    for (j = 0; j < 6; j++)
    {
        glBindTexture(GL_TEXTURE_2D, cube->wallTextureIds[j]);
        bailOnGlError(__FILE__, __LINE__);

        glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, (void*)(sizeof(GLuint) * 4 * j));
        bailOnGlError(__FILE__, __LINE__);
        glUniform4f(extraColorId, 1, 1, 1, 1);
        bailOnGlError(__FILE__, __LINE__);
    }

Vertex shader:

#version 110

attribute vec3 position;
attribute vec3 color;
attribute vec2 texCoord;

varying vec4 f_color;
varying vec2 f_texCoord;

uniform mat4 renderingMatrix;

void main()
{
    gl_Position =  renderingMatrix * vec4(position, 1);
    f_color = vec4(color, 1);
    f_texCoord = texCoord;
}

Fragment shader:

#version 110

varying vec4 f_color;
varying vec2 f_texCoord;

uniform sampler2D tex;

uniform vec4 extraColor;

void main()
{
    gl_FragColor = texture2D(tex, f_texCoord) * vec4(f_color) * extraColor;
}

The depth buffer simply set up by enabling it.

sentences:
How to make a multiplayer game work reliably behind NAT? Even games that are 100% client/server sometimes have issues when the client is behind NAT. Peee-peer games are even a bigger issues. Some games need to use multiple transports (such as UDP and TCP) or multiple connections (such as a different UDP port for voice).

What are some ways to make sure a game works reliably when running behind a NAT router?

Peer-Peer: No centralized server exists. Player A starts a game and Player B wants to join
Client-Server: A centralized server on a well known address (hostname) accepts all incoming connections. Each client only communicates with that server.
Combo: Where the server is just matchmaking, but game updates are peer-peer. Different peers may see each player with a different IP/port potentially (e.g. some clients are behind the same NAT and some are on a different router)

sentences:
Quaternion Orientation / Sensor I am posting here even though this isn't technically a game development question, but involves quaternions.

I have a 9-axis sensor which gives me a world-frame (gravity, magnetic-north) quaternion representing it's orientation. It's mounted on the laces of a running shoe (meaning there is a 'pitch' offset for the sensor, relative to the shoe). Which means that the axis of rotation of the sensor and of the shoe are different. If I 'roll' the shoe along it's lengthwise axis, then the sensor traces out a cone, with the quaternion returning the x,y,z,w components for that cone.

What I'd like is the 'equivalent' quaternion for the axis of the shoe. Ultimately, deriving Pitch, Roll, Yaw for some of our (non)quaternion metrics, like pronation.

Appreciate any pointers, as what I've tried thus far doesn't seem to be working.

Thanks!
-Tim

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:
Effect version is unrecognized. This runtime supports fx_5_0 to fx_5_0 I'm reading the "Introduction to 3D game programming with DirectX11" (Frank Luna) and i'm having problems with lighting.
I have this error: Effect version is unrecognized.  This runtime supports fx_5_0 to fx_5_0.
When i use the D3DX11CreateEffectFromMemory function i have that error and an exception (this->mFX was nullptr)
Can you help me? Thanks
EDIT: I have no D3DCompileFromFile

std::ifstream fin("Ligthing.fx", std::ios::binary);
        ///
        fin.seekg(0, std::ios_base::end);
        int size = (int)fin.tellg();
        fin.seekg(0, std::ios_base::beg);
        std::vector<char> compiledShader(size);

        fin.read(&compiledShader[0], size);
        fin.close();
        hr=D3DX11CreateEffectFromMemory(&compiledShader[0], size, //ERROR IS HERE
            0, device, &mFX);

        if (FAILED(hr)) {
            MessageBox(0, L"err", 0, 0);
        }

sentences:
Backtracking in A Star Hello, can anyone tell me how can i implement backtracking in a a star search algorithm?
I've implemented the a star search according to wiki, but it does not backtrack, what i mean by backtrack is that if the open list(green cells) contains 2,0 and 3,3 as shown in the picture, upon reaching 2,0 the current node would "jump" to 3,3 since the cost is now more than 3,3 and continue the search from there, how can it be done so that it would backtrack from 2,0->2,1->2,2... all the way back to 3,3 and continue?

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:
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:
C++ MMO: Best approach to store creatures in a multi-level world map for the purpose to find spectators I'm developing a game which is a multi-level game, my game can have a maximum of 15 floors, and a fixed amount of tiles width/height.

Each tile in the map can have a creature. All fine until here;
I need to find spectators within a range / radius of the map, and sometimes within specified floor ranges, this can happen multiple times per second (players interacting with the world)

Currently this is how I search for lets say all spectators in all floors:

for (int floor = 0; floor != 15; floor++)
{
    for (int x = posx - range; x != posx + range; x++)
    {
        for (int y = posy - range; y != posy + range; y++)
        {
            Tile* ....
            Spectators.Add(Tile->GetCreature());
        }
    }
}

As you can tell, this isn't the best approach, I've thought about using a hash / chain of creatures on which each hash entry points to a X-Y coordinate in the world map, this would take a lot of trouble to worry about floors, and it's also more performance-friendly.

How can I achieve this?

sentences:
Does Libgdx being "for Desktop" mean dependency-free native executables? I want to clarify whether the Java Framework "LibGDX" can be used to compile games to native executables. The description/tagline says "Desktop/Android/HTML5/iOS Java game development framework".

I presumed that when they say "desktop", what is meant is native executables and not that they'll be .jar that needs JVM/Java installed on the native machine to run.

Can Libgdx games run without a Java dependency?

sentences: Age Rating: female nipples poking through clothing? Pretty simple and straightforward question, what rating would a game get for something like this?

sentences:
How difficult is it to add vibration feedback to a open-source driving game? I'm looking to use SuperTuxKart as a basis for a PhD research project. A key requirement for the game is to provide vibration feedback through the controller (obviously dependant on the controller itself).  I don't believe that the game currently includes this feature and I'm trying to get a feel for how big a challenge it would be to add.

My background is as a J2EE and PHP developer/architect, so I don't know C++ as such, but am prepared to give it a crack if there are resources and guides to assist, and it's not a herculean task.

Alternatively, if you know of any open source games that do include vibration feedback, please feel free to let me know!  Preferably the game would be of the style that the player had to navigate a character (or character's vehicle) over a repeatable course/map.

sentences:
OpenGL are strips/fans faster for rendering or just data bandwidth When we send data for drawing we can mark it as TRIANGLE_STRIP or TRIANGLE_FAN to reduce the number of vertices we have to specify. Now, does this actually improve the rendering speed on the graphics card, or does it merely reduce the amount of data that has to be sent to the card?

I'm using a very simple model. To construct it correctly I need multiple calls to glDrawArrays using TRIANGLE_STRIP. If I switch to using just GL_TRIANGLES I could have just one call to glDrawArrays. Is this type of apporach useful, or is the overhead of an the call to glDrawArrays low enouhg that it won't make a difference.

I will profile, but since I have only one card I don't know if my result will be indicative of the general case. (NOTE: I need to be ES2 compliant, so some of my options are limited).

sentences:
Layered UI architecture I'm working on GUI system and I want to implement tooltips and dialogs.

Base components hierarchy looks like this:

So every panel extend ComponentContainer class, and other controls like button extend Component class

This is my current component hierarchy:

My main idea to add layers. For example first for components, second for tooltips, third for different dialogs, but I can't realize where they should be in this structure... and if dialog will contain some fields with tooltips, how should it work?

Any ideas?

UPD:
The question about layers and class structure with layers.
How they should be organized considering the fact that they will be used to hold dialogs and tooltips.

Event handling already implemented and it will not be so complicated to add it for layers.

sentences:
How can I change this isometric engine to make it so that you could distinguish between blocks that are on different planes? I have been working on an isometric minecraft-esque game engine for a strategy game I plan on making. As you can see, it really needs some sort of shading. It is difficult to distinguish between separate elevations when the camera is facing away from the slope because everything is the same shade. So my question is: can I shade just a specific section of a sprite? All of those blocks are just sprites, so if I shaded the entire image, it would shade the whole block. I am using LWJGL.  Are there any other approaches to take?

Here is a screenshot from the engine:

sentences:
lookAt with orthographic camera (gl-matrix) Technically this is a webgl question though I think it's generic enough to get some opengl, erm, perspective on it too...

If I setup an orthographic camera (perspective matrix) like this:

mat4.ortho(output, 0, screenWidth, 0, screenHeight, 0, 1)

And compose it with an identity matrix as the view, and then compose my model matrix with that - everything is fine and I see the items at the correct size on the screen. However, if instead of using an identity matrix as the view I use lookAt via:

mat4.lookAt(output, [0,0,0], [0,0,1], [0,1,0])

I do not see anything. I've tried some other variations like moving the eye parameter from [0,0,0] to [0,0,-1] and increasing the far value of ortho() but nothing worked.

What exactly is the relationship between lookAt and ortho - are they compatible for perspectivexview, if so what settings can I use for lookAt such that it works correctly here?

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: 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:
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 create glowing line with andengine? today I have played this game and still wondering about this effect: when I touch the target, some lines will appear (as those yellow lines in the image). How could I create this effect in andengine. In more detail, I want to create effect lines like that, I have no clue about methods they used.

sentences:
android - How Do I Replace A Scene in Cocos2D I am using Cocos2D for Android:
I have two scenes MainScene and LogoScene. I want to show a Splash screen on LogoScene then, I want to go to MainScene.

I am wondering how I can go from LogoScene to MainScene using:

CCDirector.sharedDirector().replaceScene(MainScene.scene());

What is an example of Scene Transition from a splash screen to the main scene?

sentences:
Detect collision without reaction Okay, so this has been bugging me for quite some time now. I'm making an old school platformer type of game in 2.5D, I want objects to pass through each other, but I still want a collision to be detected.

If the player gets hit by an enemy, I just want to detect a collision for receiving damage to the player, I don't want the player to move on impact, and I just want the enemy to continue moving where he was heading.

I'm using rigidbodies and box colliders on my objects. First I thought using triggers combined with ignoring layers was the solution, but apparently trigger events aren't called when ignoring layers.

I still want to be able to use AddForce and stuff for moving objects.

Is there someway I can still utilize Unity's OnCollision.../OnTrigger.../Or other... for just detecting a collision and having no impact movement added when a collision occurs?

Have a nice day!

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:
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:
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 can I defy competing games who are forcing their users to write 5 star reviews? Background
I've developed an app in a pretty contested category. It's one of the top three games in terms of quality (out of about 200 relevant games in this category; there are no large publishers with this type of game).
The Problem
While I have the best ratings overall (4.92 of 5 stars; ~1000 reviews), nearly all competing games started to force their users to write 5 star reviews (including a minimum amount of characters). While these apps can't actually verify the rating afaik, most users are fulfilling their demand because of psychological reasons. They even write things like:

This app is ****, but I have to write this review... 5 stars.
Not that good, but I want to get XYZ, so I have to write this review... 5 stars.

Unfortunately the poor algorithms of Google Play will rank an app higher, the more ratings they have (My app does fine in Apples App Store, since the manual review process seems to punish these fraudulent apps).
But with Google, even if you are below a 4 star average, you'll rank better if you have a ton of reviews. Number of downloads and update frequency doesn't seem to count at all.
The Consequences
This all started about three years ago and since then my Play Store ranking is on a downward spiral but I refuse to join this unethical train of fake reviews. Not only that it's a huge financial loss, it's highly depressing.
From rank 1-3 my app went down to about 30 for the most relevant keywords.
What I tried
I talked to multiple people from Google, but none of them feels responsible and sends me to the Developer Policy over and over again. Some of them even had the nerve to recommend Adwords to me as a counter measure.
I also reported some of these apps using Google Plays "Report App" feature. Nothing happened.
What I have already thought about

Join the train of manipulated reviews

This would work for sure, but as stated above, it's a no-go to me.

Asking the competitors to stop

This would require massive administrative work and probably wouldn't work out well. Especially since there are many profit-oriented trash developers.

Making my users aware of this issue

Since my competitors already copied multiple unique features of my game, I know for sure they are constantly checking my app for new updates. So they would quickly notice this whiny cry for help, which could lead to a massive backlash and make things even worse. Also it's nearly as dishonorable as faked reviews.
The Question
Do you have any advices how I could preserve my game without risking its, and also my personal reputation?

sentences:
collideWith Call Back Method In my class, I extend Sprite class. I override one of the method collideWith(). But my problem was that when current sprite collide with other sprite it does not call the call back method collideWith(). Here is my implementation.

@Override
public boolean collidesWith(IShape pOtherShape) {
    System.out.println("collide with called");
    return true;
}

Any member please help me.

sentences: How do I get my iOS game to have custom background Sometimes when you go on the App Store to look at games, some have a custom background, instead of the default white. Does this cost extra money to do? Or do certain conditions for the game have to be met?

sentences:
How do I calculate the forces exerted by a taut wire wrapping 2D objects? Assume I have a physics primitive I am going to call a "wire", wrapped around a 2D environment (as described in this question).

Here's an illustration of what that might look like:

In the example illustration: The box is being pulled upwards (held up) by the wire, and the box is pulling the wire downwards. The object on the spring is being pushed downward by the wire, but is also pushing the wire upwards.

While I haven't figured out how to implement it yet, assume the wire will slide freely across the points that it is wrapped around.

In a 2D physics simulation (ie: frame based) how do you calculate the forces (or impulses) to apply to the objects that are attached to or wrapped by a wire like this?

As I alluded to in my first question, I imagine that if the only non-static object "on" the wire was the mass at the end, then the force would be identical to a fixed-length joint between the mass and the point before that on the wire.

sentences:
ECS - System calling other systems I'm trying to build my first (2D) game with ECS but I always end up with some system calling other systems. Here's an example.

There is a RegionSystem that manages RegionComponents. On each frame, this system loops through all the RegionComponents and checks if the player is inside any of them.

When the player enters the water, the player's sprite must be changed from PLAYER_RUNNING to PLAYER_SIWMMING.

When the player steps onto a teleporter, an animation will play around the player, he'll be rotating and a new level will be loaded.

When the player steps into a hole, he will lose some health and will be repositioned in the level.

So, first of all, it needs the coordinates of the player's body to check if it is in a region (check point in rectangle). Hence it will ask the RigidbodySystem to get the coordinates.

Then if the player is inside a region, it will call PlayerSystem_OnInsideRegion(regionInfo).

In turn this function, PlayerSystem_OnInsideRegion must react differently depending on the type of the region:

for the water case, it needs to call the SpriteSystem to change a sprite, the PlayerSystem to set a boolean (m_inWater = True;) and the RigidBodySystem to get the coordinates of the player's body;
for the teleporter case, it needs to call the LevelSystem and tell him to switch to another level on the next frame;
for the hole case, well, simply descrease the member m_health of the player component, so no need to call another system here.

I have the feeling this is a horrible design and does not fit the ECS architecture. I read that people use a message system where systems can subscribe and unsubscribe to particular type of message. But I also read that it can be tricky to react to them in a proper order.

sentences:
Persistent elements of offline players interacting with online players For a long time I was thinking about a quite abstract game design problem, to which I didn't see a good solution yet. In abstract: How can a player have owned bases, units and infrastructure in a persistent multiplayer world, which can be interacted or attacked by other players, all the while the owning player may be offline and unable to give his input?

As a concrete example:

Assume you have a very large 2D world, in which you can build bases and have units guarding them. The bases can be visited or used by other players as automated trading stations, in which you represent the vendors. But the bases should also be able to be contested by hostile players - be it plundering or outright destruction.

How can I solve the issue that the owner of the base may be offline during an attack? Or that a player attacks at times where people are usually not online (sleeping, working, school)? Or that a player may actively go or stay offline in order to exploit potential protection mechanisms? How can I avoid forcing players to go online for a certain time at certain time ranges in order to maintain such protection?

Ideas (which are not satisfactory though):

Bases cannot be attacked in normal ways. People can send "troops" with a delay hopefully long enough to ensure the other player can give his optional input. The outcome of these battles is an automatically calculated result. Such sieges may go over multiple days.
Bases can only be attacked while their owners are online - or have been offline for too long. The explanation why those cannot be attacked is severely lacking though - given that trading should still be possible.
When a player intends to attack, both players somehow have to make an appointment in order for both to be online and to start the battle. This is a bad solution for obvious reasons.
Bases are inactive and invulnerable while their owners are offline or setting it inactive, and trading/other activities continue only temporarily based on the previous online/active time. This raises issues with visible bases and ongoing infrastructure, as they'd essentially need to be hidden or hideable, and other players may get bothered by it becoming inaccessible.

What other methodology does exist or could be employed in order to tackle this online-offline issue with persistent elements? I am also open for mathematical or systematic solutions. Be reminded that other players should be able to assist either side as well, and that their online/offline times would require some consideration as well.

sentences:
Unity splash is starting in progress after white screen When I export my Unity project (on Windows), there is a brief white screen before the Unity splash screen renders, already in progress. Discretely cutting to the already in progress splash screen looks pretty bad, so I'd like to fix this.
Here is a video showing what I mean.
After some googling, I did find other reports of a white screen, but only on Android. My project is very simple and I am not loading anything intensive on boot, so I'm not sure what is causing this white screen.
Does anyone know what might be causing this issue or have ideas to troubleshoot it?

sentences:
How can I convert a tilemap to a Box2D world? I want to use Box2D physics and lighting with a .tmx map. How can I "convert" a tilemap to Box2D world? My basic idea is to go through the tiles on the map and create an object for them in Box2D.

I'm using the Tiled map editor for the tilemap, and the target platform is PC.

Firstly, is this a good solution for my idea? Or is this even possible?
Secondly, if yes, then I dont know how to get the tile's position.

My code so far:

public class WorldLoader {
public static TiledMap map;

public static void loadMap(String mapName) {
    map = new TmxMapLoader().load(mapName);
    TiledMapTileLayer collisionLayer = (TiledMapTileLayer) map.getLayers().get("collision");

    for (int x = 0; x < collisionLayer.getWidth(); x++) {
        for (int y = 0; y < collisionLayer.getHeight(); y++) {
            Cell cell = collisionLayer.getCell(x, y);

            if (cell != null && cell.getTile() != null) {
               // float tileX = collisionLayer.getProperties().containsKey("x");
               // float tileY = cell.getTile().getProperties().get("y", Integer.class);

                BodyDef bodyDef = new BodyDef();
                bodyDef.position.set(tileX, tileY);

                PolygonShape shape = new PolygonShape();
                shape.setAsBox(16, 16);

                Body body = GameWorld.world.createBody(bodyDef);
                body.createFixture(shape, 0f);

                shape.dispose();
            }
        }
    }

}

}

sentences:
Why does Unity in 2d mode employ scaling and the default othographic size the way it does? I previously used SFML, XNA, Monogame, etc. to create 2d games, where if I display a 100px sprite on the screen, it will take up 100px. If I use 128px tiles to create a background, the first tile will be at (0, 0) while the second will be at (128, 0).

Unity on the other hand, has its own odd unit system, scaling on all transforms, pixel-to-units, othographic size, etc, etc. So my question is two-fold, namely:

Why does Unity have this system by default for 2d? Is it for mobile dev? Is there a big benefit I'm not seeing?
How can I setup my environment, so that if I have a 128x128 sprite in Photoshop, it displays as a 128x128 sprite in Unity when I run my game?

Note that I am targeting desktop exclusively.

sentences:
How to change TPS camera angle in Unity I'm very new to Unity and this may simply be a failure of google-fu but I hope someone here can help me out.

I'm working through a series of tutorials on how to create an RPG in Unity, making small improvements and embellishments as I go to make sure I understand the concepts.

I've built a player character with walk and run animations and a camera which follows the player around and stays aimed at the centre of the character model using the following code.

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

public class CameraFollowPlayer : MonoBehaviour
{
    GameObject target;

    // Start is called before the first frame update
    void Start()
    {
        target = transform.parent.gameObject;
    }

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(target.transform.position);
    }
}

The problem with this is the angle this leaves the camera pointing at in-game is to acute, making it difficult to see what is ahead of the character. How can I adjust the target of the LookAt instruction to result in a shallower X-axis rotation of the camera?

sentences:
Testing SFML sf::Touch on ordinary PC So I’ve created a small app that is designed to be used on smartphones and tablets. Accordingly the app makes use of the sf::Touch class which determines the point on the screen of the device that the finger of the user is touching. This is required because central to the functionality of the app is that it allows the user to swipe across the screen to flick between different images. The end result should be that once a user’s finger (being pressed against the screen) has moved far enough to the left or right periphery of the screen, a swipe function is initiated and the next image moves into view. This appears in the code like so:

if (touchInput.isDown(0))
{
    sf::Vector2i currPos;
    currPos = touchInput.getPosition(0);
    if (currPos.x < 540.0)
    {
        leftSwipe(currPos);
    }
    else if (currPos.x > 540.0)
    {
        rightSwipe(currPos);
    }
    oldPos = currPos;
}

The problem is that I am testing the application on the PC and when I click the left mouse button down (which I assumed would cause the function touchInput.isDown(0) to return true) it does not appear to update the position of touchInput and was therefore wondering if touchInput should be used on the PC at all and also if it even functions with PC inputs (like a mouse)? or whether for PC testing it would be better to use sf::Mouse instead?

sentences:
Game Development at iOS, Android and PC with OpenGL ES I'm beginning iOS apps development, and my aim is to make games to launch on App Store.
But I want to know if it's possible to program a game on Xcode with OpenGL ES (C++ game logic), integrate it on iOS with ObjC, and with that same game code (OpenGL ES + C++), implement it for Android with Java and to PC.

I have great interest to publish the same game on App Store, Google Play and specially Steam, and intent to build my personal 2D engine/API when I have more experience on graphic programming.

Do you know where can I find material to learn this?

sentences:
Frame independent acceleration To make my game fps independent I move entities with

pos += speed * time

where time is the delta time since last frame.

That works perfectly well with speed but how do you do that with acceleration?

sentences: When to use LOD and when not to? I have a simple question: are there any cases where game LOD models don't need to be created? Obviously you need LODs for landscapes, large props, characters, vehicles etc. But what about small indoor props which are unlikely to be seen from large distances? I understand that it depends on genre and other factors like the distance to the camera, but still, is there any common standard regarding when LODs need to be made?

sentences:
Where would I update a graphical representation of a b2Body in Box2D's solver? Hey i'm trying to make a class called BodyRep Which is supposed to use SFML too sync a graphical representation and Box2D Bodies orientation/location.

To do this i plan to ovveride some Box2D function so that it does it's original steps, plus one extra: to update the graphical representaions orientation based on the new Body orientation.

However I found this is not as easy as it seems as my class must be a descendent of another class that does the actual updates to the bodies in the World, so it CAN ovveride the function. On top of that, I know there is a ton of itterating in Box2D's solver, and i don't want my graphical reps. being updated if they don't have to yet....

So... What CLASS should I Descend from and what FUNCTION should I ovveride?

if you have any other ideas on how i could accomplish my goal of
syncronization between SFML and Box2D bodies, feel free to suggest
them! =)

sentences:
XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4 Beginner question. Synopsis: my water effects does something that causes the drawing of my sky sphere to throw an exeption when run in full screen. The exception is:

  XNA Framework HiDef profile requires TextureFilter to be Point when
  using texture format Vector4.

This happens both when I start in full screen directly or switch to full screen from windowed. It does NOT happen, however, if I comment out the drawing of my water.

So, what in my water effect can possibly cause the drawing of my sky sphere to choke???

sentences:
Fb.Feed dialog closes before saving I'm having trouble with the Facebook UnitySDK when I use the FB.Feed() method for posting on user's timeline. The share dialog closes before the post is completed, Right after i press the "Post" button. This only happens when I test the app on the iOS Device since on the Unity Editor it works fine and I can post on the user's wall. User Login and getting username and profile pic, for example, work fine. The problem is when I try to share the user's score on facebook. Here's my code for the method:

public void Share_Score(){
        FB.Feed (
            toId: "",
            link: "http://www.facebook.com/appname",
            linkName: "App Name",
            linkCaption: "I just scored " + " points",
            linkDescription: "Playing this game is awesome!",
            actionLink:"http://www.facebook.com/appname",
            actionName: "Appname Fan Page"
                );
    }

The only error that appears on XCode is the following: 2015-02-11 10:13:07.025 hotdogcontest[749:224865] FBSDKLog: FBLinkShareParams: only "http" or "https" schemes are supported for link thumbnails

sentences:
2D Scrolling Background on XNA How do I create a scrolling X and scrolling Y background without weird things happening like the player disappearing or not getting the offset correct?

I have code at https://vanillity.kilnhg.com/Code/Repositories/Group/Aremac

Looks like this:

      var s = game.gd.Viewport.Bounds;
      var g = game.world.Bounds;
      var p = game.player.Bounds;
      var v = viewRectangle;

      var x = p.X  0 ? p.X - s.Width/2 :
              v.Right >= 1090 ?  90 :
              p.X > s.Width/2    ? p.X - s.Width/2 :
              0;

      var y = //v.Bottom >
              p.Y > s.Height/2 ? p.Y - s.Height/2:
              0;

      var w = s.Width;
      var h = s.Height;

      //view Rectangle
      Offset        = new Vector2(x , y);
      viewRectangle = new Rectangle( x, y ,w, h);

and then:

     //source rectangle
     var x = (int)0;
     var y = (int)0;
     var g = game.world.Bounds;
     var w = g.Width;
     var h = g.Height;
     var rect =  new Rectangle(x,y,w,h);

      spriteBatch.Draw(  w.boundsTexture
                        ,rect
                        ,viewRectangle
                        ,w.Color
                        ,0
                        ,Vector2.Zero
                        ,SpriteEffects.None
                        ,1
                        );

Before center, the grey guy is holding the rock in his left hand:

After center, the rock (and the white guy) drifts evermore to the right:

sentences:
How do I write an interface for the keyboard and mouse input? I have started to develop a simple 3D engine. I use OpenGL for rendering, and it is developed for Windows. It is all written in C.

How do I write an interface for the keyboard and mouse input? I would like to keep it as simple as possible - in contrast to the native Win32 input system.

sentences:
How can I disallow the changing of a parent? I want to disable transform.SetParent(Transform) for a particular GameObject.

I am not sure where to start, so it is really difficult to show what I have tried.  Is this even possible?

sentences:
How would you declare a Texture object in the libgdx skin json file, using a region from a texture atlas? I have a texture atlas that is linked to my skin.json file. The atlas contains a region named "game-title".
I would like to declare a com.badlogic.gdx.graphics.Texture object in the json file, to retrieve it later in my code via skin.get(name, Texture.class).
I tried declaring it as follows, but it does not work - exception gets thrown - com.badlogic.gdx.utils.SerializationException: Class cannot be created (missing no-arg constructor): com.badlogic.gdx.graphics.Texture:

"com.badlogic.gdx.graphics.Texture": {
  "game-title": {name: "game-title"}
}

What am I doing wrong here? What would be the correct way to do this?
Is trying to declare a Texture in such a way a correct thing to do, in the first place?

Many thanks in advance for your feedback.

sentences:
Cocos 2D - Hold down CCMenuItem I am using the following code to move a CCSprite left and right.

-(id)init{
    CCMenuItemImage * moveLeftButton = [CCMenuItemImage itemFromNormalImage:@"Move Left Button.png" selectedImage:@"Move Left Button.png" target:self selector:@selector(moveLeftVoid:)];
}
-(void)moveLeftVoid{
    id moveLeft = [CCMoveBy actionWithDuration:.3 position:ccp(-10, 0)];
                [_mainSprite runAction:moveLeft];
}

This does work, but only as a single tap. What I want for the CCSprite to move continously in that direction when the CCMenuItem is held down. Then when it's released the character stops moving. If you need to see more code, please just ask. :) Thanks

sentences:
How can I create a tile set that will allow me to render a soccer pitch in perspective? I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels).

I know I should use the Tiled map editor to create a tile map so that I can create the whole soccer pitch by using just a few tiles, but I'm not sure how I can create a tile set that will allow me to create good-looking fields like in these games:

As you can see, the soccer pitch is not a rectangle but more of a trapezoid, so it changes the way we draw border and grass stripes. The grass stripes are sloping, and the slope changes the closer they are to the goal. That makes it very hard to replicate in a limited amount of tiles.

Currently, I have 3 layers for my field. Each tile is 64 * 64 in size, and I create them this way:

The border tiles. Since the border is not repeating, I take the border, cut it up into tiles, and add them to the tile set. It's fussy, but it seems this is the only way.
Light colored grass. I have a single, repeating 64 * 64 tile that is used to cover the base layer of the field.
Deep colored, sloping stripe grass. This is the one I can't figure out how to create.

How can I create that last set of tiles or otherwise achieve my effect?

sentences:
XBOX + Xna != DirectX? I'm a bit confused. The question is: when I'm developing a XNA game for Xbox (or Windows), is it possible to use DirectX (to make use of the GPU)? Or is everything getting calculated by the CPU?

A quick Google search didn't gave any results of combining those two...

sentences:
How do you filter entities in an Entitiy Component System? I am currently writing my own ECS in C++ and I am using std::bitset.

I register a component at compile time and give it an ID.

Position has ID 1
Direction has ID 2
..

vector<bitset<numberOfComponents>>

And so on. The problem with this approach is the more components I register the bigger my bitset for every entity will get.

If I overshoot my goal a bit and say that I will have 1000 components and 5000 entities.

A std::bitset<1000> is 128 bytes big of my machine and for 5000 entities that is 640kbytes of overhead. To be fair that is actually not that big considering that many machines have 8 gigs of ram.

But I am wondering how you guys are doing it? How do you filter your entities? Are you also using something like a component mask?

Update based on congusbongus answer:

vector<DrawComponent> c1;
vector<MoveComponent> c2;

vector<Entity> draw = {1, 2, 8, 42,128}
vector<Entity> move = {8,128};

I assume that is how you think it works right? Two questions:

1.) How do you make vector<Entity> draw = {1, 2, 8, 42,128} contiguous in memory? If the id is just the index into a vector there will be a lot of "holes".

2.) Because there is no filter, how do you then associate entities together? If you have system System<Draw,Move>, you need the Draw and Move component and because of

vector<Entity> draw = {1, 2, 8, 42,128}
vector<Entity> move = {8,128};

if you just iterate over both of them it doesn't work. because move[0] = 8, and draw[0] = 1.

I mean if you draw something you actually need the draw and move component because u need to draw at a specific position.

sentences:
Fix Pixel Shader "Stage did not run. No output" I'm trying to set up a minimal D3D11 renderer but fail to get the pixel shader stage to run. The available answers here or the ones I found through Google couldn't help me, unfortunately.

Using Visual Studio's Graphics Debugger I could verify that my vertices are set correctly and the vertex shader also runs as expected. The debug layer doesn't report any issues either. As a test I disabled depth testing, stencil testing and backface culling as shown below with no changes.

I made sure that the viewport is set correctly as well as this seems to be a common source of this problem.

At this moment I can't think of any other cause for this issue and would be happy about any advice of what else to look out for.

Disable depth/stencil test:

D3D11_DEPTH_STENCIL_DESC dsstate_desc = {};
dsstate_desc.DepthEnable             = false;
dsstate_desc.StencilEnable           = false;
dsstate_desc.DepthFunc               = D3D11_COMPARISON_ALWAYS;
dsstate_desc.DepthWriteMask          = D3D11_DEPTH_WRITE_MASK_ALL;
dsstate_desc.BackFace.StencilFailOp  = D3D11_STENCIL_OP_KEEP;
dsstate_desc.BackFace.StencilPassOp  = D3D11_STENCIL_OP_KEEP;
dsstate_desc.BackFace.StencilFunc    = D3D11_COMPARISON_ALWAYS;
dsstate_desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
dsstate_desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
dsstate_desc.FrontFace.StencilFunc   = D3D11_COMPARISON_ALWAYS;
d3d11device->CreateDepthStencilState(&ds_state, &this->ds_state);
d3d11context->OMSetDepthStencilState(this->ds_state, 0);

Disable backface culling:

D3D11_RASTERIZER_DESC rasterizer_desc = {};
rasterizer_desc.AntialiasedLineEnable = false;
rasterizer_desc.CullMode              = D3D11_CULL_NONE;
rasterizer_desc.DepthBias             = 0;
rasterizer_desc.DepthBiasClamp        = 0.0f;
rasterizer_desc.DepthClipEnable       = false;
rasterizer_desc.FillMode              = D3D11_FILL_SOLID;
rasterizer_desc.FrontCounterClockwise = true;
rasterizer_desc.MultisampleEnable     = false;
rasterizer_desc.ScissorEnable         = false;
rasterizer_desc.SlopeScaledDepthBias  = 0.0f;
d3d11device->CreateRasterizerState(&rasterizer_desc, &this->rasterizer_state);
d3d11context->RSSetState(this->rasterizer_state);

Pipeline view in debugger:

Vertex shader transformation:

Vertex shader:

struct VertexIn
{
    float3 position : POSITION;
    float3 normal   : NORMAL;
    float4 color    : COLOR;
};

struct VertexOut
{
    float4 color    : COLOR;
    float4 position : SV_POSITION;
};

VertexOut main(VertexIn i)
{
    VertexOut o;
    o.position = float4(i.position, 1.0f);
    o.color = i.color;
    return o;
}

Pixel shader:

struct FragmentIn
{
    float4 color    : COLOR;
    float4 pos      : SV_POSITION;
};

float4 main(FragmentIn i) : SV_TARGET
{
    return float4(1.0f, 0.0f, 0.0f, 1.0f);
}

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: Play .mp4 videos using Irrlicht In the game I'm making, I'll sometimes need to play videos of the .mp4 format. Does Irrlicht support .mp4 playback? And if so, can anyone recommend a good tutorial on doing so?

sentences:
Wavefront mesh: determine which face a point belongs to? I have a 3D mesh Wavefront .obj file.

Is there any algorithm that takes an arbitrary point coordinates as input and determines which face of the mesh that point belongs to ??

The mesh is rendered on the screen, then the user clicks on it, I want to determine which part of the mesh the user has clicked on ?

Here's the code using LibGDX:

Vector3 intersection=new Vector3();
Ray ray=camera.getPickRay(x, y);
//vertices is an array that hold the coordinates of the mesh
boolean ok=Intersector.intersectRayTriangles(ray, vertices, intersection);

Thanks

sentences: How to work with libddx and Android studio I am new in game development.I am getting problem with libgdx. when i download libgdx i get zip file.where is setup

sentences:
Storing data for a pokemon like game The game I'm developing is close to Pokemon. How should I store the data? I am currently thinking of text files where I save the map and have a corresponding textfile for the trainers and their teams on the "current" screen. However this leaves me with a LOT of textfiles.

At the moment I'm thinking of something like this, however I haven't coded this yet so I can still easily change this.

@Trainer;5;
@Pokemon;12;1;3;4;6;
@Pokemon;13;1;2;5;
@Pokemon;13;1;4;5;
@Pokemon;11;1;3;5;
@Pokemon;16;1;2;7;
@Trainer;3
@Pokemon;13;1;4;5;
@Pokemon;11;1;3;5;
@Pokemon;16;1;2;7;

Where the first column is the "type" of the entry. If the first is Trainer the second is his number of Pokemon. If the first is Pokemon the second is the level, the third the type, the fourth/fifth/sixth the IDs of his attacks. (How should I store the attacks? A seperate textfile where I just store the attacks?)

I am currently finding myself with having such a huge amount of data that I'm starting to wonder wether I should be using a Database instead?

Edit:
Using Java(LWJGL).

sentences:
Authenticating users without a username or password I'm curious about what the process is for anonymously authenticating users when it comes to mobile games. There are quite a few examples out there, but the ones that immediately come to mind are Lords Mobile, Family Guy: Quest for Stuff, and Clash of Clans. When you first open the game, you're assigned an account id and that id is tied to your device until you choose to register an account with a password or sign in through some SSO service.

In that initial step where you're not creating a password or using SSO, how are these games making sure the requests are from both the user/device that they come from? Or is it that they actually don't?

I can imagine a simple setup where you're providing a key that needs to be refreshed every now and then just like you would with something like OAuth, but other than that you don't care that the user is who they say they are. After all, you're dealing with a request that already has to be validated for legality within the game rules.

sentences:
How to make variables restart when the game restarts? My game is all in one scene so when my player dies and the user clicks restart the game (when it shows the game over screen) the script below doesn't restart with it so the enemies are still going fast when the user is replaying the game. How do I make it restart when the game restarts?

if (Score % 10 == 0) {
    //Increment movespeed variable from Movement script
    Movement.movespeed += 4;
}

This is used in my score script. The Movement.movespeed is a reference to my movement script attach to my enemies making them go faster when the player collects 10 points.

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:
Instancing with empty data, or varying vertex counts? I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering.

I have implemented instancing before, but this is only my 2nd time doing it. I have a question regarding instancing.

To do instancing, I have a geometry buffer having a vertex declaration (for instance) 32 VertexPositionColor elements. This is because I have a few elements with 32 vertices in them.

I am rendering all elements as linelists. However, there are some elements in the list that doesn't have 32 vertices. I would like to include these in the instancing render process too.

So my final question is, what happens if I (for instance) fill out 8 of the vertices with their indexes, but then still send all the 32 vertices into the instancing shader? Is it possible?

Is there a better approach to be able to instance all kinds of elements, with various vertex counts?

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:
Weird blending behavior on PowerVR SGX544MP2 On PowerVR SGX544MP2, sometimes blending behaves in a very strange way for me.

Instead of blending with the actual color from the previous draw calls, it tries to blend with black:

(sorry about the low quality, it's not my tablet and not my photo)

Some polygons render correctly, however (that blue hit decal on the left (which is blended with black in the middle, however), the beam and the HUD), but certain decals are broken.

How do I fix or work around the problem? It seems to be related to deferred rendering of tiles, but I don't really know. On other GPUs, it looks alright.

sentences:
Game asset "objects" consisting of several meshes vs continuous mesh When building game objects in a 3D modeler like Blender I'm finding it's easier to get greater detail and still have fewer vertices if I separate certain elements. For example, I need to make cuts along certain edges to add appendages to that part of the mesh, which could potentially increase the poly count by a large number. If I simply add another mesh I don't need to cut new vertices into the mesh I'm extending. I'm talking about buildings and other structures that never move.

With static objects (that don't move, ever) I was thinking this wouldn't have any drawbacks... but someone may know otherwise. Will this have any visual artifacts or mess up lighting in an engine like Unity or UE4?

Thanks. Sorry if I didn't explain that clearly enough.

sentences:
How would I warp a mesh with code? I recently asked a question about putting a camera at the head of a 3D human model here and it worked out rather well and whatnot, but there is still a problem that bothers me:

How would I contort/warp the mesh of the human model with code? I'd only really have to turn the head a bit using the mouse, and the rest can be animated (i.e. walking, moving arms, speaking, etc).

I was initially thinking about an animation for moving the head in a certain direction, and you would move the mouse and the animation would go along with the mouse movement until it reached the maximum angle (about 85 degrees) on either side of the model.

Is there a better way of doing this, and if so, how can I do it?

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:
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:
Bullet Projectile Verticle Rotation I'm very new to C# and Unity, and have been working on a projectile based weapon, and for the most part it's been working well. However, although the bullet fires facing the direction it's being shot horizontally, when shot up or down, the bullet is still parallel to the ground when shot. Any help would be appreciated, thanks!

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

public class PlayerWeapon : MonoBehaviour
{
public GameObject bulletPrefab;

public Transform BulletSpawn;

public float bulletSpeed = 30;

public float lifeTime = 3;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Mouse0))
    {
        Fire();
    }
}

private void Fire()
{
    GameObject bullet = Instantiate(bulletPrefab);

    Physics.IgnoreCollision(bullet.GetComponent<Collider>(),
        BulletSpawn.parent.GetComponent<Collider>());

    bullet.transform.position = BulletSpawn.position;

    Vector3 rotation = bullet.transform.rotation.eulerAngles;

    bullet.transform.rotation = Quaternion.Euler(rotation.x, transform.eulerAngles.y, rotation.z);

    bullet.GetComponent<Rigidbody>().AddForce(BulletSpawn.forward * bulletSpeed, ForceMode.Impulse);

    StartCoroutine(DestroyBulletAfterTime(bullet, lifeTime));
    }

private IEnumerator DestroyBulletAfterTime(GameObject bullet, float delay)
{
    yield return new WaitForSeconds(delay);

    Destroy(bullet);
}
}

sentences:
Tips for developing 3D games on newer engines targeting old hardware I see a lot of examples and tutorials for 3D engines like Unity3D, UDK, Source etc.  They all seem to be under the assumption that you are making a game for current(ish) hardware.

I would like some tips or tutorials on how to develop a game using UDK, Unity3D or any other modern game engine while targeting what might be considered ancient hardware.

Hardware specs might be as low as

1GHz-1.8GHz single core CPU
8MB-64MB Video chip
512MB-1GB RAM

Thinking along the lines of older laptops or old business class machines that might have, at most, an Intel GMA900 chip or a ATI Radeon 9000 chip onboard.

sentences:
WinAPi OpenGL Borderless Fullscreen - Alt Tab problems I'm implementing a borderless fullscreen functionality and managed to make something that almost works. Using: C++, Winapi, OpenGL 3.3.

When  in fullscreen borderless mode, if alt tab the game window loses focus but is still on top, not even the alt tab window shows.

I managed to track it down to SwapBuffers. If i disable it, no problems but also no rendering.

If i force the window to hide when it loses focus, the entire screen flickers. And if i alt tab back, only the game window flickers.

If i put the game in windowed mode, it works as normal.

Window Styles are first set to(windowed mode stops  here):

WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE

And then are set to(if fullscreen):

GetWindowLong(window, GWL_STYLE) & ~WS_OVERLAPPEDWINDOW

My gameloop:

while(isRunning)
{
    loopNewTime = timeGetTime();
    loopDuration = (r32)(loopNewTime - loopOldTime);
    loopTime = Clamp(0.0f, (loopDuration - sleepTime), 250.0f);

    loopOldTime = loopNewTime;
    loopAccumulator += loopTime + sleepTime;

    while(loopAccumulator >= loopFixedDeltaTime)
    {
        if(isFocused || canRunWithoutFocus)
        {
            DoStuff();
        }

        loopAccumulator -= loopFixedDeltaTime;
    }

    if(isFocused || canRunWithoutFocus)
    {
        DoStuff();

        glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

        DrawStuff();

        SwapBuffers(deviceContext);
    }

    framerateTimeThreshhold += loopTime + sleepTime;
    ++framerateCount;

    if(framerateTimeThreshhold >= 1)
    {
        framerate = framerateCount;
        framerateCount = 0;
        --framerateTimeThreshhold;
    }

    sleepTime = Max(timeStep - loopTime, 0.0f);

    Sleep((u32)sleepTime);
}

So, how can i solve this problem?

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 is load balancing achieved in MMOs? I believe it's a common requirement of MMOs that processing for a single shard or realm can be done over several servers to ease the load. I'm curious as to how this can be done whilst maintaining a unified consistent world where all the players, and all the NPCs can interact.

My question is how is load balancing achieved in MMOs?

Any links, books or general information on how to improve my knowledge on this subject is also appreciated.

sentences:
Using libGdx and Box2d for game and getting this error- "incorrect checksum for freed object" I am new in game development and I am using libGdx with box2d in my game, whenever I try to switch screen (both screens has box2d bodies with Tiled map), I encounter the following error.

  java(610,0x70000297a000) malloc: * error for object 0x7f8d642fd600:
   incorrect checksum for freed object - object was probably modified after  being freed.
   * set a breakpoint in malloc_error_break to debug

The code which I use to switch screen is in render method

if((mapPixelWidth - 200) <= frog.body.getPosition().x * PPM){
        game.gm.setPrefLevel(0);
        Gdx.app.postRunnable(new Runnable() {
            @Override
            public void run () {
                Array<Body> bodies= new Array<Body>();
                world.getBodies(bodies);
                for (Body b: bodies) {
                    world.destroyBody(b);
                }
            }
        });
        game.manager.unload("maps/World1Level3.tmx");
        game.setScreen(game.levelLoading);
    }

Apart from this error, I want to ask that the way I am using Asset Manager and Box2d bodies are correct or not?

sentences:
How does mouse input work in 3d games? How does a game process cursor movements?
I know it calculates offset from the middle of the screen, but how?
What constraints is that cursor having?
Is it locked to the middle of the screen/a certain area/teleported to the middle of the screen?

Those are my questions.I didn't ask this question for game development(but i didnt find a better subsection for it), as I want to emulate this 'different' mouse input (vs desktop usage) to fix the bug that many remote computer software have(if possible, not sure it is) on linux, by emulating the mouse movement restrictions in a game (agiain, not sure if it's possible).

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:
Instantiation taking too long? I have a game where there are about 4 empty objects that are my object "spawners". I have two scripts attached to all of them, one that will keep spawning objects from "basictable", and then switch to the other component which will then spawn objects from  "complextable".

This is my first script :

public void SpawnA() {

    if (destroyer.spawncount < destroyer.spawnchange) { //if condition

        int randomi = Random.Range (0, basictable.Length);
        Instantiate (basictable[randomi], new Vector3 (this.transform.position.x,this.transform.position.y,basictable[randomi].transform.position.z), Quaternion.identity);
        Invoke ("SpawnA", Random.Range (mini, maxi));

    }
    else if (keep){
        this.GetComponent<spawnscript2>().SpawnB();
        keep = false;
    }

And the second script :

public void spawnB()  {

        int randomi = Random.Range (0, complextable.Length);
        bobo = (GameObject) Instantiate (complextable [randomi], new Vector3 (this.transform.position.x, this.transform.position.y, complextable [randomi].transform.position.z), Quaternion.identity) as GameObject;
        StartCoroutine ("DelayedSpawnC");

}

IEnumerator DelayedSpawnC () {

        yield return  new WaitForSeconds (6);
        destroyer.spawncount = 0;
        this.GetComponent<basicSpawner> ().keep = true;
        this.GetComponent<basicSpawner> ().SpawnA();
}

Logically, this should work. And indeed it does. But the problem I'm having is that my "spawner", sometimes works, and sometimes doesn't, some objects from the complextable are always spawned, but in other cases the spawner just does nothing, until it switches to the first script. Is there anything I can do to optimize the spawning process and avoid this? I can't get ahold of why are some blocks spawned and others take much longer, while other blocks don't get instantiated at all.

sentences:
Should clients in an online game access the database directly or through a game server? first im total noob about c# and mysql. Just trying to find which way is better. i believe your answers prevents me from losing plenty of time.

Online game(not more than 50 users at pre-alpha. Not expecting than 500+ at the end.)
Text based game / console like ( minimum graphics )
PVP -> Players are able to destroy other players.
Simlpy a hacking simulation.
There will be some servers.(NPC servers and player made servers)
players can reach that servers made by other players.

Q: Which one is the good way to store that servers data?

game client --> Mysql server ?
or
game Client --> a Server Client(which is localy running a mysqL server)

If it's totaly wrong to use mysql server how can i make it?
Thank you...

sentences:
How do I change windows commands to android commands? I created a game and would like to test it on android, but it does not respond to any touch on the screen, I think it's because I have to adapt the game code for android. Click => Touch

I developed it and tested it with the selected target (windows):

I was able to put it to run on an android virtual machine, but it does not respond to any commands:

How could he do that?

How to adapt the function => if (point_in_rectangle(window_mouse_get_x(),window_mouse_get_y(),60,250,104,313)) && config==false for example? For something that works for android.

I hope I have been clear. What I want exactly is to turn all game mouse clicks into screen touches.

Sorry for any translation error and thank you already

sentences:
Mixing 3D and 2D content on the iPhone? I am at the design phase of a board game on the iPhone and am considering a couple of options for rendering the view:

Quartz to render top down views of the board with core animation to do the transitions to close ups etc. Using a 3D library (or GL directly) to render dice rolls on top of the 2D view.
Full 3D interface to render the board and do the transitions (something like the Monopoly app on the iPhone).

Keeping most of the game in 2D simplifies the implementation and the artwork, but I wonder if the overall finish will suffer.  Is it practical to render 3D views (for the dice rolls) on top of a Quartz 2D app?

Should I just bite the bullet and go 3D?

sentences:
Animation shown as playing in the animator, but it doesn't show in game (Unity 2D/C#) I have an Animator on this gameObject. The Animator hits one state when some parameters are true, it can transition to this state from any state. The parameters are fine because i can see in the animator that the state is getting hit when i want it to. The blue progress bar is showing, but the animation doesn't play on the screen in the game, it just shows the state before it.
I have tried changing exit time, apply root motion, update mode, static batching.
Nothing works
Help pls internet gods

As requested here are some images, first this is my animator and the transition that is set up: (I have also tried this with the same transition but from flies buzzing directly and the same behaviour happens)

Also here is what the animation state looks like and the preview of it, showing that it works in scene (just not in game)

And here's how it behaves in game, as you can see the blue bar is progressing (and this is going into the state at the correct time, after dealing 2 damage to the fly, isDead gets set to true). However the only animation that plays is the fly buzzing one.

Here's my code:

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

public class FlyCombatAndFollow : MonoBehaviour
{
    [Space]
    [Header("References:")]
    public Animator animator;
    public GameObject fly;

    [Space]
    [Header("Character attributes:")]
    public int maxHealth = 2;
    int currentHealth;

    // Start is called before the first frame update
    void Start()
    {
        currentHealth = maxHealth;
    }
    public void TakeDamage(int damage)
    {
        currentHealth -= damage;
        //Play hurt animation
        animator.SetTrigger("IsHit");
        animator.SetInteger("Hit", damage);

        if (currentHealth <= 0)
        {
            StartCoroutine(Die());
        }
    }
    public IEnumerator Die()
    {
        Debug.Log("Fly died");
        //play death animation
        animator.SetBool("IsDead", true);
        yield return new WaitForSeconds(1.0f);
        //Disable fly
        Destroy(fly);
    }
}

sentences: Resume option on game in android I made simple puzzle game. I want to add a "Resume" option to it, so when user opens the game, he can pick up where he left off last time.

sentences:
How often do big MMORPG update the physics? As far as I understand, most big games use fixed timestep to have a stable simulation.

Regarding the game server, which "frame rate" do they impose? Or said it another way, what fixed timestep do they tend to use?

I know many would say: "As fast as they can get away with". I'd like to know how fast is that, if you have direct experience of established MMORPG.

sentences:
Reduce Blur and headache during gameplay I am implementing a browser based Javascript game here.

On tougher levels when the speed of the game increases, what we observe is that the user will experience headaches and the view will start to blur when the user stares at the screen for some reason.

How can we find the reason for this reaction in the user and avoid it?

How to simulate the problem -

Go the link
Click on Play
Play the third level for 5 - 10 seconds

sentences:
What's the implication of right-handedness when building camera to world matrix? I found these slides which go through the viewing transform in what I think is a easy way. However, I have hard time understanding two thigs:

What would be the implication of using a right-hand coord system when building this matrix?
In order to get the final camera-to-world matrix, I thought I should do a matrix composition, i.e. C = T * R. Why on slide 18, it just puts the translation vector in the last column instead of doing such a multiplication?

sentences:
SDL_TTF Manual Line Ending With SDL TTF I've already gotten automatic line wrapping down using the built in "wrapped" function.

However, now I want to do what I guess you could call manual line wrapping. Basically, at certain points I want to start a new line.

Specifically, every time there is a open square bracket "[" I want to do a line ending, and continue the text on a new line. (The equivalent of hitting enter)

Any help would be awesome! (/n doesn't work with SDL TTF as far as I know)

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:
How do I draw thick lines in XNA 4.0? I can draw some curves using this:

GraphicsDevice.DrawUserPrimitives<VertexPositionColor>
           (PrimitiveType.LineStrip, Points, 0, count);

Now I try to set the PointSize to make the line thicker but I can only find a solution for XNA 3.0 using:

GraphicsDevice.RenderState.PointSize

How can I make my lines thicker in XNA 4.0?

sentences:
Is C++ necessary to learn if I ever want to get a job in the game industry? Is C++ necessary to learn if I ever want to get a job in the game industry? I am extremely familiar with C# and have a basic mastery of making 2D games in XNA 4.0. Right now I am only 13 years old and love making games, and hope to someday get a game programming job. I have heard a lot of people say that C++ is the 'industry standard' and that it will hurt your career not knowing it. I am also trying to target more platforms than just windows and  i am aware of Monogame but for some reason i am having lots of trouble with the visual studio templates, and i find many bugs with monogame. Since i technically can't get a job yet, and probably couldnt get a programming job until i am like 22 or something (unless im self employed). And in that 9+ year time-span the game industry will most likely change a lot. So here is some questions

Will not learning C++ hurt my chances at getting a programming job?
By the time i can get a job will C++ still be the 'industry standard' programming language
If i am an indie developer does it really matter whether i learn C++ or not, and stick with what i know?
Should i even start learning it now seeing as i have many years before i can even get a job?

I am also having a worry that even though i am familiar with object oriented programming, i may spend lots of time on C++, and get very frustated and confused then just quit learning it, and by this time i've forgotten lots of XNA and i have to learn everything all over. So in short: Should i learn C++ if i ever want a programming job?

UPDATE

Thank You All For Your Answers And Suggestions. Recently I Picked Up SFML and C++ and it is going pretty good. I am getting the hang of C++, and starting to open my eyes to not worrying about learning new things because i was able to transfer all my C# knowledge into making C++ easier to learn. Thank You All Once Again.

sentences:
Unity3d - Attach to Unity not working I need to debug my scripts, but if I click "Attach to Unity" or "Attach to Unity and Play" then the button is just grayed out and after a few seconds it is clickable again, but nothing happens.

I already tried to restart visual studio, but it did not helped.

I restarted unity, but this brings no success too.

sentences:
What data should be cached in a multiplayer server, relative to AI and players? In a virtual place, fully network driven, with an arbitrary number of players and an arbitrary number of enemies, what data should be cached in the server memory, in order to optimize smooth AI simulation?

Trying to explain, lets say player A sees player B to E, and enemy A to G. Each of those players, see player A, but not necessarily each other. Same applies to enemies. Think of this question from a topdown perspective please.

In many cases, for example, when a player shoots his gun, the server handles the sound as a radial "signal" that every other entity within reach "hear" and react upon.

Doing these searches all the time for a whole area, containing possibly a lot of unrelated players and enemies, seems to be an issue, when the budget for each AI agent is so small.

Should every entity cache whatever enters and exits from its radius of awareness? Is there a great way to trace the entities close by without flooding the memory with such caches?

What about other AI related problems that may arise, after assuming the previous one works well? We're talking about environments with possibly hundreds of enemies, a swarm.

sentences:
Fastest way to neutralize scale in the transform matrix? Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is represented by float[16] array.

By fastest way I mean, the most performance accurate way, that will be low CPU cost.

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:
How to iterate through members of lists of members of lists within members of previous lists? I'm sorry for the clumsy title, and for what will be the continuation of further clumsiness in my question - I'm not even sure how to properly ask this, so please allow me to illustrate:

I'm writing a game using XNA and C#.

I have 'nodes' in 2d space, and I'm trying to create a network of nodes representing traverse-able world-space.

The nodes themselves store a list of their 'neighbors', and an associated dictionary that refer to how an AI might travel from one node to a node's neighbor, either by walking, or jumping.

I'm trying to find a way that I may iterate from the list of one node's neighbors, to its neighbor's neighbors, to its neighbor's neighbor's neighbors, etc. etc. etc., to test each for contiguous neighboring connections based on whether or not they are all reachable to each other by 'Walk' (so I can find whole walkable platform segments).

sentences:
One Android app, dynamic load several Unity games I'm a newbie in this unity world, exciting about everything in it.

Days ago I came up with this idea:

One day someone finds this android app, naming "Blahblah Game Engine" or anything else. This app has to be very small, containing only some simple activity and Unity runtime, without further resources related to any specific game.
He installs it and sees an android activity, maybe a webview, showing a list of unity games the server currently hosting, produced by the very same Blahblah company.
Then he clicks on one and this "Blahblah Game Engine" loads the game build via network, starts an Unity activity, without prompting an installing dialog.
He can exit the current game whenever he likes, returns to the previous game list, and plays another, all working well in one app's lifetime.

In a word, the user experience is very much like how we play games on www.kongregate.com with pc browsers: light-weight app, mutiple games in one list, all loads via network, playing right away and installing-less.

Any game that listed in this app should not be installed as a standalone android app, it should be part of the "Blahblah Game Engine", stored as a file inside data folder of "Blahblah Game Engine", run as an activity of "Blahblah Game Engine".

Is it possible with Unity 5, both technically and legally? If I were to start this "Blahblah Game Engine" project, should I choose Unity 5 personal or pro licence?

sentences:
Projectile Rotation During Flight (Tank Game) I have a tank firing projectiles into the air.

I want the projectiles to be rotated relative to their position along their flight path.

See the diagram I drew in the image below.

At any given point I know the x and y of the projectile, z represents initial velocity, theta is also known.

sentences:
Godot Camera shake without target I'm working with godot 3.2 to make this screen shake, but my issue is that i don't have a target, like in the example, in the example code, it's a kinematic body that is being followed by the camera, i don't have that, i'm  making a match-three type of game, so i don't use those.
What i tried it's to use the main node, in which the game loop logic is executed but the camera shake didn't work, also tried with another elementsd but it failed beacuse they are mostly HUD elements
and shows an error about global positions.
Also i not sure how to get the board/grid, since it's instantiated by code.
How i can make shake camera without a target or get a similar effect?

sentences:
Why is my canvas being rendered underneath everything? I'm currently trying to implement a UI that will overlay a scene and follow a scene's main camera, but I'm running into some issues. When I set canvas's mode to Screen Space - Camera, the Z position of the canvas is always set to 89.5, which is behind all of the objects that are generated into my scene, making the canvas and the UI elements on it completely invisible to the player.

This is the game preview before running the game, with the UI elements clearly visible:

This is the game while it's running in the editor, with the UI elements not visible at all:

This is what my hierarchy looks like:

This is what the properties for the canvas look like:

Why is my UI not visible when I run my game? How can I fix this?

sentences:
Raycast a ray to the tip of another ray I'm using unity to raycast a line from the center of my camera viewport to a world position (yellow line).

I also want to cast a ray from the center of my character to this same point (blue line).

I have tried two methods to get this to work, however neither has worked.

The two methods are the following:

        if (Input.GetKey (KeyCode.Mouse0)) { //if left click is held down

        Ray crosshairPoint = viewCamera.ViewportPointToRay (new Vector3(0.5f, 0.5f, 0.0f));
        Vector3 crosshairEnd = (crosshairPoint.origin + crosshairPoint.direction * 15);
        Debug.DrawRay (crosshairPoint.origin, crosshairPoint.direction * 20, Color.yellow, Time.deltaTime, false);
        Vector3 intersect = crosshairPoint.GetPoint (20);
        Debug.DrawRay (Vector3.zero, intersect, Color.red, Time.deltaTime, false);

        Debug.DrawRay(_charFace.position, intersect, Color.cyan, Time.deltaTime, false);

    }

The red line being drawn is a line from the origin, which has no problem intersecting my camera ray line. The one from my character just refuses to point at the given point.

The second method is the same as above, but using vector math (origin + direction * distance) to get the same point.

Any ideas why the ray from my character won't point the right way, but one from the origin would? Something to do with world vs. local coordinates?

Thanks]1

sentences:
How to create a 3D grid in Unity3D? What is a easy way to generate a 3D "hollow" and square grid around a central point, more like a cube (that can vary in size), with each cell being evenly spaced (based on a value)?

Note: I know how to make a 2D grid but not a 3D one.

Edit: I'll try to explain it more: I'm looking for a way to create a grid at every face of a cube (6 faces) at runtime, that lets suppose is 3x3x3m, and each cell being every 1 meter apart from each other. Something like that:

sentences:
Unity build shows wrong date I made a 3D game in Unity named Sniper Shot.

I am facing a problem when I build the project: at the end it shows the wrong date of build.

I have tried many scripts resolving this issue but I did not find any accurate way to fix it.

I completed this project on 4 march 2019 but this is showing me a wrong date, 23 July 2017.

sentences:
What do you think about Ogre3d as first time engine for first time 3d Game? This is a question for the experienced 3d game developers.

I'm a long time programmer (c++/java), and after 15 years, I'd like to get into 3d gaming.

After some internet research, I saw that the trend is mostly with Ogre as a 3d engine.

What do you think? I'll be targeting OSX, Linux and Windows.

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: stop the camera clipping objects I'm using RTS_camera as it is the player in my scene, how can I stop the camera clipping into buildings?

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:
Cocos2d-x : Socket.io-client-cpp crashes after creating scene I'm using https://github.com/socketio/socket.io-client-cpp with cocos, because the built-in socket.io doesn't support callback (http://discuss.cocos2d-x.org/t/doesnt-work-with-socketio-2-0-1-and-failed-calling-back-with-old-version/37225/3)

Everything is fine, until i want to push new scene after receiving server signal
Here is my code

SocIO::SocIO() {

    // client object
    _client = new sio::client();
    _client->connect("ws://localhost:3000");
       ....
       _client->socket()->on("joinedRoom", bind(&SocIO::joinedRoom, this, placeholders::_1));
}

void SocIO::joinedRoom(sio::event &a)
{
    Scene* newScene = PlaygroundScene::createScene(1); // crash on this line
}

I don't know what happened here, didn't get this error with built-in socket.io.
Is it because of threading?

sentences:
Doubt about font inclusion (GAMEMAKER)? The default font of the GameMaker is arial, but it does not contain special characters that are present in the portuguese language.

Soon I had to add a new font, but I activated the ASCII option so that the characters I needed were included.

Hence come my doubt: Even the new font being arial I need to enable the option include in Asset Package for the game to work properly?

And if I have to enable it, where I put the file, and more. Does it need to have a specific name?

sentences:
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:
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:
Managing lists of different types of entities  - is there a better way? I am developing a 2D space game for mobile devices, but it gets realy complex and my solution is realy confusing and produces lots of repeated code segments.

I hava a world class in which i have multible lists of different object like:

List<Enemy> enemys;
List<Projectile> projectiles;
List<Collectable> collectables;
List<Asteroid> asteroids;
List<Effect> effects;
..

Each list gets updated by the world class. but thats not all..
Each enemy has a list of engines, and list of weaponlunchers which gets updated by the enemy. Now each engine adds some fire effects to the world list 'effects', and each weaponluncher adds projectiles to the world list 'projectiles'.
All these classes have different parameter, so i need an extra update AND extra render function for each class.

At least they are all childs of 'GameObject' which provides them basic things like position, velocity and acceleration vectors, bounding Polygons and functions like applyForce and a finite state machine

Is there a better or more common way to do this? like one catch-all class which contains all possible parameters and methods for all different objects. (i think this would produce even more confusing code)

sentences: Is there any way to change compression type of TMX file? Basically it's all in the title, you can choose compression type then you create new tile map, but after it's done the "Save As..." option doesn't provide compression type selection.

sentences:
Creating maps and tileset for a 2d java game I'm not a completly beginner to java, so I decided to write a map loader and a tileset loader myself instead of using a tilemap editor like Tiled. I'm using Slick & LWJGL for my game.

The plan was to load every map and tileset from external files. When creating a new map, you'd be able to assign tilesets to your map which define the tiles used to paint the map.

I've already written a tileset loader which creates tiles from an external file.
For example:

  0|floor|tiles/floor.png;

is a tile where id=0, floor means the player in the game would be able to walk on that tile, tiles/floor.png is the texture of the tile.

The tiles are stored in an array in the tileset class.

But I don't know how to create the map loader.
Example for a map:

  1, 1, 1, 1, 1;

  1, 0, 0, 0, 1;

  1, 0, 2, 0, 1;

etc. The numbers symbolize the id's of the tiles.

Is there any way to realize my plans? Or is there a better way?

Thanks in advance.

PS: Sorry for my english, I'm no native speaker.

My current solution:

public void createTiles() {
    for(int y = 0; y < map.length; y++) {
        for(int x = 0; x < map[y].length; x++) {
            for(int i = 0; i < tileSets.length; i++) {
                for(int j = 0; j < tileSets[i].tiles.length; j++) {
                    if(map[y][x] == j) {
                        Tile tile = new Tile(tileSets[i].tiles[j].texture, x, y, xOff, yOff, tileSets[i].tiles[j].isWall);
                        tileList.add(tile);
                    }
                }
            }
        }
    }
}

sentences:
How to place grass on custom terrain mesh I made a custom terrain mesh and textured it, now I want to place grass on it, but I don't know how. I only find info about grass with the unity terrain.
I am not even sure what exactly to look for.

What is the best/easiest way to place grass on a terrain?
I'd like to do it in the shader if possible, but I guess I will need additional geometry if I want it to "stick out"?

(Random example picture
http://www.beamng.com/attachments/stuff-png.16516/)

I'd appreciate a general outline on how to tackle this problem and maybe some links for further reading.

Thanks.

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:
Term for compositing textures according to colors in an index texture mask? I have utilized a tool for a number of years that uses a "masking" technique to 'texture' a 2D graphic, by which it checks a series of solid colors to specify where to 'draw' textures in a final render. I have seen one other example of this in my searches on Google, and even that did not explain exactly what was happening or the name of this process. It seems to be used for creating sprites or video game graphics, as the only example I was able to find online was a gamedev postmortem discussing how they applied 'texturing' to some of their sprites. All I can do is show an example using the software I have (Which itself, barely explains what this process is called, just the way it works within the context of the software)

So in this case, the solid colors Black, Gray, Blue, and Green (In the "Mask" window at the bottom left) correspond to where specific textures/colors are going to be drawn in the final Hourglass graphic. There are additional colors available to use in this particular software, but I cannot for the life of me find any other software that does something like this. Let alone the name of the particular "colored mask/index" technique. It is capable of doing several other things by reading the colors in a mask, including rendering textures at angles or curves with the same kind of process.

The company I purchased the software from no longer exists, so there is no way to even contact them about their own software. Any ideas what this is even called? Or does anyone know any alternative way to do something like this?

sentences:
Unity: onEditEnd and onSubmit only firing from Return key I have an InputField in my UI, but currently I can only submit its contents via the Return key. I tried mapping other buttons to the Submit action (e.g. the tab key on keyboard and the X button on my joystick), but neither worked. I tested both onEndEdit and onSubmit (via the Event Trigger component).

That said, onClick is being called correctly when I remap my Submit button. I can navigate the menu with my joystick and alternate keyboard controls, but I can't submit the InputField without pressing Return. Why is this?

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:
How to avoid the cutoff of a Sprite when overlapping in a terrain? I have a scene where I have a terrain as a PlaneGeometry. And I'm trying to locate a building on it as Sprite. But I'm not able to put that building/sprite centered on the terrain without getting a cutoff.

Make sense because the terrain is cutting the half. But I'm just wondering if there is a technique to solve this problem.

I tried to rotate the sprite as a 3D object. But does not have this property. Also tried using a PlaneGeometry with a MeshBasicMaterial, but the result of the Image looks blurry and without transparency.

sentences: GPU friendly bezier storage/evaluation? Let's say that you want to do bezier curve or surface evaluation on the GPU (fragment shader, geometry shader, compute shader, OpenCL, etc).  Does anyone know of any interesting tricks of techniques to do so?  Im looking for GPU specific techniques, but I already know the equations for n degree bezier curves, triangles and tetrahedrons.  Thanks!

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 to use ROAM algorithm to adapt terrain's mesh? I have a hard time understanding the idea behind ROAM algorithm

"Real-time, continuous level of detail rendering of height fields" Peter Lindstrom, David Koller, William Ribarsky, Larry F. Hodges, Nick Faust, Gregory A. Turner SAIC http://dl.acm.org/citation.cfm?id=237217
"ROAMing terrain: real-time optimally adapting meshes" Mark Duchaineau, Murray Wolinsky, David E. Sigeti, Mark C. Miller, Charles Aldrich, Mark B. Mineev-Weinstein http://dl.acm.org/citation.cfm?id=267028

The problem that I cannot grasp is that the whole idea behind the algorithm is that the terrain mesh is at all times divided to isosceles right angled triangles but when we arrange the terrain in a non flat mesh then the triangles that we divided the mesh into are supposed to be extended(?) to meet the height field requirements?

From what perspective is the terrain divided into those triangles and should they be isosceles right angled triangles generally or only when looked upon in up-down projection?

sentences:
Jagged Edges Even With Anti Aliasing 8x Multi Sampling I have an interior scene where I have imported a model for the apartment and many of the interior objects such as lamps, windows, etc. Unfortunately I have a lot of jagged edges on almost all the objects in my scene even on Fantastic Quality settings with Anti Aliasing pushed to its maximum. What else can I do to reduce the jaggies seen here:

Here are my quality settings:

And here are my model import settings:

sentences:
Determining if a character is within the field of view in XNA I'm trying to creating a field of view for the camera I'm making for a game. It rotates around a circle for 180 degrees while the head moves accordingly. I'm going to bound the field of view within an isosceles triangle using the method described on this website.

The problem I'm having is that I don't know how I'm going to detect if the field of view has intersected with the character as seen in this link.

Any help with this would be greatly appreciated.

[EDIT]

sorry I meant an asset in game representing a camera much like the enemy in the second link, not an actual camera class in XNA(really sorry)

sentences:
How can I put a Unity3D game on an Xbox 360 disc? I've made a simple shooter in Unity that I'd like to play on an Xbox 360. Mass production not required, just a one-off game, completely non-profit. Perhaps burning to a DVD?

Is it a relatively simple procedure to burn the game to disc? I have a nasty feeling the Xbox 360 needs to be chipped. Is this the case?

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:
Rotate an image and get back to its original position - opengles glkit I need to rotate an image in opengles GLkit and get it back to its original position in GLkit.

rotation += 5;
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(5), 1, 0, 0);
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(rotation), 1,0,0);

I need to move it in x axis for certain amount and getting back to its original position from where it started. How should i do it?

sentences:
Where and how to promote an HTML5 game engine? I've recently completed an engine, called Irenic.

Now, I was wondering, how could one promote it? The process surely is different than promoting a game, because a game can be played by almost anyone, and a game engine can be used only by developers. Aside from obvious things such as posting on Gamedev.net, are there some lists or wikis I could post it to? Other ways?

I'm not really interested in people using my engine, but rather giving some feedback and so on. Just getting it out there would be cool.

sentences:
How can I improve my isometric tile-picking algorithm? I've spent the last few days researching isometric tile-picking algorithms (converting screen-coordinates to tile-coordinates), and have obviously found a lot of the math beyond my grasp.

I have come fairly close and what I have is workable, but I would like to improve on this algorithm as it's a little off and seems to pick down and to the right of the mouse pointer.

I've uploaded a video to help visualize the current implementation:
http://youtu.be/EqwWcq1zuaM

My isometric rendering algorithm is based on what is found at this stackoverflow question's answer, with the exception that my x and y axis' are inverted (x increased down-right, while y increased up-right).

Here is where I am converting from screen to tiles:

// these next few lines convert the mouse pointer position from screen
// coordinates to tile-grid coordinates. cameraOffset captures the current
// mouse location and takes into consideration the camera's position on screen.
System.Drawing.Point cameraOffset = new System.Drawing.Point( 0, 0 );
cameraOffset.X = mouseLocation.X + (int)camera.Left;
cameraOffset.Y = ( mouseLocation.Y + (int)camera.Top );

// the camera-aware mouse coordinates are then further converted in an attempt
// to select only the "tile" portion of the grid tiles, instead of the entire
// rectangle. this algorithm gets close, but could use improvement.
mouseTileLocation.X = ( cameraOffset.X + 2 * cameraOffset.Y ) / Global.TileWidth;
mouseTileLocation.Y = -( ( 2 * cameraOffset.Y - cameraOffset.X ) / Global.TileWidth );

Things to make note of:

mouseLocation is a System.Drawing.Point that represents the screen coordinates of the mouse pointer.
cameraOffset is the screen position of the mouse pointer that includes the position of the game camera.
mouseTileLocation is a System.Drawing.Point that is supposed to represent the tile coordinates of the mouse pointer.

If you check out the above link to youtube, you'll notice that the picking algorithm is off a bit.  How can I improve on this?

sentences:
How can I use a display as a background in unity? I have a dancing game that I am trying to make and I have a stage where a character dances and a script to switch cameras inside that stage.
What I am trying to do is set those cameras to display 2 and use that display as a background for the place where the game actually takes place.
Is there a way to do that?

sentences:
What are some good namespaces for gameplay code? I always struggle with naming namespaces when working in a team. I'd be very thankful if someone could share your preferred way of namespacing gameplay code? At least the root namespaces.

Edit: As this question has been downvoted I'm adding more details -
I'm basically looking for a namespacing template/examples that could be easily reused on many projects and won't have names like MarioCharacterNamespace which will obviously last a week. Also no maintenance greedy dependencies like depending on the company name or project name. I also tend to end up with very long namespaces like Game.Battle.BattleLogic.Controllers.Enemy and such that I'd also like to avoid.

So some template that's not too specific nor too general and can easily be reused on many projects at least in the beginning.

sentences:
What is the state of the art of ray tracing on the GPU? I think ray trace rendering had to be done on the CPU for a long time. But since we have compute shaders in OpenGL 4.3 now, it might be possible to move the computations on the GPU and perform passable real time rendering.

What approaches for GPU based ray tracing are there already? Can it compete with rasterization rendering nowadays?

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:
OpenGL RTT FrameBuffer question and Rendering to texture while sampling it What i need to do:

Blur the selected texture and pass the texture to another effect for postprocessing.
Notice that i want one texture passed all over.

How do i want to do this:

Bind the FBO ( with texture to be blurred attached as colorbuffer )
Change the FBO viewport size to match the texture size
Enable the shader
Bind the texture
Render viewport sized quad with the texture and output to that texture via FBO colorbuffer
Unbind texture
disable shader
Disable fbo
...
pass that texture to another effect..

What i have already done:

A FBO with ColorBuffer attached ( the texture i want to blur ),
The shader
All the other reqd stuff..

What's the problem?

When i want to blur texture and i bind that texture as a color buffer to my FBO, and then pass the texture via uniform to the shader while rendering to sample it (and blur), the results are not stored. Seems like FBO can't have the same texture stored as output and sample it at the same time ( kind of understandable ).

Question:

Is this normal behavior ? How do i approach 'blur a selected texture' so that i can pass one texture over to another effect to work on it ?

I can imagine a 'dummy' texture within the effect class to which FBO renders to and then it gets copied to a texture that was requested to be modified..
Any better option ?

Thanks for shedding a bit of light on this, i think i need some logic help in here.

sentences: Should I use octree or quadtree for my spacial data structures? I would like to know the advantages and disadvantages of using octree or quadtree for spacial data structures? In a 3d gaming setting would you ever need more than 4 children nodes? Does it take longer to traverse through oct tree than quad tree? Is one of the two by all means faster than the other or is it a trade off sort of thing?

sentences:
Methods to remove horizontal world slices of voxels in a 3D voxel world I've recently been working on a hobby voxel world recently.

I'm currently interested in ideas or solutions which would enable me to basically step up and down the Y-axis 1 horizontal block slice at a time, effectively making all upper horizontal slices transparent so that I can see objects/terrain/units under the earth.

[A quick visual attempt at describing the problem]

I've done a bit of googling on the subject but perhaps I'm not describing the problem set correctly because I'm unable to find anything satisfactory.

Goals :
1.) I dont' want to have to recreate the chunk meshes across the entire world everytime I step up and down the Y-axis blocks. It would destroy performance and probably crash Unity.
2.) Reasonably optimized quick stepping up and down the Y-axis i.e. no perf drops.

I know that a few options must be out there as I've seen examples in other engines and games (Byte56's Age of Goblins tech demo and Gnomoria etc). I'm guessing an algorithm via some magic shader math would be perfect.

All ideas greatly appreciated!

sentences:
Render Texture shows opposite view of camera when rendered? I am using render texture (cube) to render what camera sees into it. However, the render texture shows me opposite side of cameras view (flipped) instead of what camera sees. Any solution for this?

    void Update()
    {
         renderTexture.isPowerOfTwo = true;
         //Graphics.SetRenderTarget(renderTexture, 0, CubemapFace.PositiveZ);
         renderTexture.dimension = TextureDimension.Cube;
         camera.RenderToCubemap(renderTexture, 63);
    }

What camera sees:

What Render Texture shows:

What happens when I rotate Render Texture manually by hand 180 degrees:

So, instead of rotating per hand, what I want is for the render texture to be rotated via code so that what is in camera view is shown exactly the same in render texture view.

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:
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:
2d games unity vs Flash do people find unity better than flash for 2d games while unity is 3d engine , or Flash still better because it's made for 2d games and flash can get the job done faster ,and now flash is better for ios/android 2d games .
so what platform is the best for 2d games?

sentences:
Create YUV texture for GL_TEXTURE_EXTERNAL_OES format 0
down vote
favorite

I need to create a yuv texture for GL_TEXTURE_EXTERNAL_OES format.

source : https://github.com/crossle/MediaPlayerSurface/blob/master/src/me/crossle/demo/surfacetexture/VideoSurfaceView.java

I am doing all processing on YUV, so it would save clock cycles, if I can generate a yuv texture as output of texture2D.

To get 'y' value, I need to take dotproduct of each texel with vec3 of (0.3,0.59,0.11) Since, for my purpose I need to take 3x3 pixel block's 'y' value and take a convolution of them, this results in performance impact. So it would save clock cycles, if I can generate a yuv texture as output of texture2D.

sentences: Scene management for 3D editor I need a scene graph/management method for a 3D editor (brute force rendering is not really a possibility), where lots of data (geometry) are constantly being modified, it also would need to work great for picking (casting rays from the camera to select objects). Octrees seem to be a great solution, but i'm not quite sure.

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:
Why do KD trees put the median split exactly on a point? I've understood that KD tree split points using the median while cycling on each axis. I've also understood that at each node traversal, a nearest search must use a sphere to store to nearest neighbor (in case the query point is very close to the split median).

What I don't understand, is why median are always aligned with one point? Does that mean nodes are always storing one point? Does that mean each node can only have one point and 2 childs nodes ?

sentences:
3D rotation math/code for plane I am making a simple 3D game with plane in space.
With c++ (win32).
But the plane rotation is not realistic.
The code I am using for the rotation is the following:

point3D AxisRotation(point3D point,point3D Rotation){
float sx = Sin(Rotation.x*PI/180);
float cx = Cos(Rotation.x*PI/180);
float sy = Sin(Rotation.y*PI/180);
float cy = Cos(Rotation.y*PI/180);
float sz = Sin(Rotation.z*PI/180);
float cz = Cos(Rotation.z*PI/180);
float xy,xz, yx,yz, zx,zy;
xy = cx*point.y - sx*point.z;
xz = sx*point.y + cx*point.z;
yz = cy*xz - sy*point.x;
yx = sy*xz + cy*point.x;
zx = cz*yx - sz*xy;
zy = sz*yx + cz*xy;
point.x = zx;
point.y = zy;
point.z = yz;
return point;}

The axis of the rotation needs to be (Roll,Yaw,Pitch).
Does anyone know the code or the math for it ?
Thank you. Dave

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

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

sentences:
Sprites saved in INA and AN format? I'm not sure if this is a suitable question but I found a game that had all it is sprites and stuff saved in INA and AN format and I got curious to know which program is it.

Or is it some sort of compressing or alike and how it is usually done?

Anyone know?

Here is the content of one of the files:
http://pastebin.com/EzUsFvdG

Here is a hex dump of the above file: http://pastebin.com/CTErFBcS

The above one is the AN file and the bellow one INA.

Hex dump of a INA file which seems to be some sort of map or data file (I believe because of the layers info, etc?) http://pastebin.com/2fWn8izR

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: Knockback enemy based off of direction sprite is facing Today I am trying to make it so if I hit the enemy then the enemy will be knocked backwards in the direction the sprite is facing. I am rotating the sprite around 360 degrees using a joystick on the screen and wanted to know the best practice or ways to accomplish this.  I have come up with a few ideas but none of them make use of the sprites angle he is facing just a check to see if I hit the bottom then move him upward and so forth. I am just stumped on how to apply the sprites angle to the enemies x and y coordinate and move him accordingly. Has anyone tried this and have suggestions or things to look for?

sentences:
C++ Ray Traversing in 3D Voxel game I'm currently working on a Voxel game in 3D and need a tad bit of help to figure out what Voxel the player is looking at. This is the data I currently have:

GRRLIB_Camera3dSettings(Player.x, Player.y, Player.z + 4, 0,0,1, Player.x + Camera.lookx,Player.y + Camera.looky,Player.z + Camera.lookz);

And the two 3d arrays that contains the player cords and block cords:

struct Player{
  int X;
  int Y;
  int Z;
}
int World[X_MAX][Y_MAX][Z_MAX];
//The cords are ALWAYS positive. ( and the array data: 0 Means air, anything higher is solid), The player

(GRRLIB camera is described here: http://grrlib.santo.fr/doc/group___all_func.html#ga7300940a38526ab5aa9be0f4abe4a32a)

So what I basically need to understand is how I would implement ray tracing using this data.
The whole project can be found here: https://github.com/filfat/WiiCraft

For clarification I am asking for a simple way in C or C++ to create a Ray tracing algorithm that would be used in a Minecraft like game for selecting the block the player is looking at, all data that is needed is above. So in short I need help to understand the math in a Ray Tracing algorithm and need a simple example so I could implement it myself.

Thanks! :)

sentences:
High-definition Full-motion background system in XNA I'm mostly just working on this as a hobbyist thing, but here's my problem:
I got a bit excited over finding the 'Video' and 'VideoPlayer' classes in XNA 4, and hoped to make a game that works a little bit like how Myst does - with very active backgrounds, but no actual 3D graphics. (Technically, Myst 1 had static backgrounds, but maybe you get the idea) I threw together a small test game in XNA, with a pretty simple WMV included.

The problem I have is that it's not quite responsive enough. I'd like my system to be able to swap the current video in a millisecond, so that the player could click a contraption in the background and instantly see it move. Right now, when I press my trigger key that calls this code:

    private void cycleVideos()
    {
        videoIndex++;
        if (videoIndex == videos.Count)
        {
            videoIndex = 0;
        }
        activeVideo = videos[videoIndex];

        vp.Stop(); // Couldn't find a 'Seek(0)' method
        vp.Play(activeVideo);

    }

...it takes about a full second to re-seek the position it needs, and start playing again. In this example, I hadn't even encoded my video to the HD (1920x1080) resolution I had been planning on. I can understand if XNA's video system is really only meant for full cutscenes between missions or that sort of thing; I'm willing to use additional memory to have large parts of my videos cached, or even include a bit of a dynamic caching system so that things are loaded/unloaded over time (after all, this is the main visual of the game), but I'd like to hear if I have any decent options to accomplish this.

I'm also somewhat open to the idea of using a different engine or coding environment entirely.

EDIT: I've been doing some experimentation in my eagerness to solve this. I can definitely get some faster responsiveness by avoiding the 'stop()' calls, and by maintaining multiple instances of VideoPlayer. A paused video will resume much more quickly; and it's possible to play(), then pause() a video immediately (at the beginning of the program, in order to 'cache' it). It's not a full solution yet - I want to be able to seek back to the beginning of a video, and I still feel like there should be some possibility of that somewhere.

sentences:
Is it possible to tell Unity3d to ignore part of its hierarchy? One aspect of the game I'm making is each level is made up of room objects, which contain the sprites, physics objects and so on. When you enter a level the whole level is deserialsed and loaded into memory but only the room you are currently in is considered, nothing else is drawn, updated or whatever.

I was wondering how I would achieve this in Unity3d. I can imagine having a hierachry with lots of rooms with the various room contents as children, can I tell unity to ignore everything (for updating, drawing, physics and so on) in the hierarchy but the current room and its children?

sentences:
Collisions not working as intended I'm making a game, it's a terraria-like game, with 20x20 blocks, and you can place and remove those blocks. Now, I am trying to write collisions, but it isn't working as I want, the collision successfully stops the player from going through the ground, but, when I press a key like A + S, that means if I walk down and left (Noclip is on atm), my player will go into the ground, bug up, and exit the ground somewhere else in the level. I made a video of it. The red text means which buttons I am pressing.

You see, if I press A and S together, I go into the ground.
Here is my collision code:

Vector2 collisionDist, normal;

private bool IsColliding(Rectangle body1, Rectangle body2)
{
    normal = Vector2.Zero;

    Vector2 body1Centre = new Vector2(body1.X + (body1.Width / 2), body1.Y + (body1.Height / 2));
    Vector2 body2Centre = new Vector2(body2.X + (body2.Width / 2), body2.Y + (body2.Height / 2));

    Vector2 distance, absDistance;

    float xMag, yMag;

    distance = body1Centre - body2Centre;

    float xAdd = ((body1.Width) + (body2.Width)) / 2.0f;
    float yAdd = ((body1.Height) + (body2.Height)) / 2.0f;

    absDistance.X = (distance.X < 0) ? -distance.X : distance.X;
    absDistance.Y = (distance.Y < 0) ? -distance.Y : distance.Y;

    if (!((absDistance.X < xAdd) && (absDistance.Y < yAdd)))
        return false;

    xMag = xAdd - absDistance.X;
    yMag = yAdd - absDistance.Y;

    if (xMag < yMag)
        normal.X = (distance.X > 0) ? xMag : -xMag;
    else
        normal.Y = (distance.Y > 0) ? yMag : -yMag;

    return true;

}

private void PlayerCollisions()
{
    foreach (Block blocks in allTiles)
    {
        collisionDist = Vector2.Zero;
        if (blocks.Texture != airTile && blocks.Texture != stoneDarkTexture && blocks.Texture != stoneDarkTextureSelected && blocks.Texture != airTileSelected && blocks.Texture != doorTexture && blocks.Texture != doorTextureSelected)
        {
            if (IsColliding(player.plyRect, blocks.tileRect))
            {
                if (normal.Length() > collisionDist.Length())
                {
                    collisionDist = normal;
                }

                player.Position.X += collisionDist.X;
                player.Position.Y += collisionDist.Y;

                break;
            }
        }
    }
}

I got PlayerCollisions() running in my Update method.
As you can see it works partly, but if it runs perfectly, it would be awesome, though I have no idea how to fix this problem. Help would be greatly appreciated.

EDIT:

If I remove the break; it works partly, then it is just the thing that it spasms when it hits two or more blocks at once, like, if I touch 2/3 blocks at once, it does twice the force up. How can I make it so that it only does the force for one block, so it stays correct, and does not spasm? Thanks.

sentences: Formula to calculate the changes in the fortunes of a stock based on how many shares are bought or sold I am creating a stock market simulator for an event in my college. Supposing I have 20 companies in it all starting with a common base price, I need a formula to calculate the changes in the fortunes of a stock based on how many shares are bought or sold.

sentences:
What is GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS? I am a beginner in OpenGL. I am learning about textures in OpenGL. What I don't understand is how to determine how many texture units are in the GPU. I heard someone said that you can see how many texture units by writing the following code.
int total_units;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &total_units);
std::cout << total_units << '\n';  // the result is 192

Is there 192 texture units in my GPU?  In documentation, it says:

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
params returns one value, the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined. If both the vertex shader and the fragment processing stage access the same texture image unit, then that counts as using two texture image units against this limit. The value must be at least 48. See glActiveTexture.

So I wanted to know how many texture units can be used to access texture maps from the vertex and fragment shaders. So I wrote and run the following code.
int vertex_units, fragment_units;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_units);
std::cout << vertex_units << "\n";   // the result is 32
glGetInteferv(GL_MAX_TEXTURE_IMAGE_UNITS, &fragment_units);
std::cout << fragment_units << "\n"; // the result is also 32

So 32+32=64. But why does GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS shows me the result of 192? I think I am missing something. What do I need to calculate to get 192?
And also, in OpenGL, why are there only GL_TEXTURE0 to GL_TEXTURE31 macros? I think these macros are for each shaders. Am I right?

sentences:
How to simply print (write) text on a Surface in SDL.NET? as i told in previous question, i'm using SDL.NET (wrapper in C# of SDL). Unfortunately the API website is down so i'm trying to learn it by myself.
I would like simply to print text on my screen / surface ... i don't know how to do!

My goal is to print variable status/values, to "debug" directly on the run and on the screen (in the lower corner for example).
Can somebody help me ?

Thank you

sentences:
Unreal Engine Player Quality I had to force Unreal to use my integrated graphics card because VR wasn't working with my NVidia card.

When I did this, the framerate dropped terribly and it popped up a dialogue "Frame rate's bad, would you like to lower quality?"  Which I said yes to.

Now, I've set it to use my NVidia card again, but it's stuck in this low quality state.  It seems to be tied to the engine, not the project.  All my 4.9 projects run in this garbage state, but my 4.10 projects are fine.

How can I reset the engine player settings for 4.9?

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:
In Unity, how do you check if a camera is rendering anything? (Unity 2018.3) I'm trying to have a camera automatically disable if it's not rendering anything.

Is there a simple way to check if a camera is blank/empty?

Edit: Alternatively, is there a way to prevent a camera from rendering if there is nothing in it's view?

For example, I do not want MSAA applied to a blank camera. (I'd hope it would attempt AA, but effectively do zero work)

sentences:
How to access a prefab's boolean property through collision (with the same Prefab but different Instance)? I am a trying to recreate the first stage of Super Mario Brothers, but I am having a bit of trouble with the collision system between Koopa Shells. I have written two different scripts in hopes to achieve this:

This First script is to handle the Basic movement and start shell movement on Player Collision

It's Rather long so I took the liberty of including only parts that were in direct correlation/ causation of the problem

     public class KoopaShell : MonoBehaviour
     {
         //Makes this accessible to other Scripts
         public bool Moving;

         // Boolean Flags to be inherited
         bool shellLeft, shellRight, rightBlocked, leftBlocked;
         public float rayDis;
         public LayerMask enemyMask;
         public Transform rCast;

 [... Rest of the code..]
         void OnCollisionEnter2D(Collision2D coll)
         {
             if (leftBlocked || rightBlocked) // If the either side of the shell is hit
                 if (coll.gameObject.tag == "Player" && Moving == false) // If the player makes contact with a resting shell
                 {
                     MoveShell();
                 }
         }

         public IEnumerator MoveShell() //Courotine for 2D Collision
         {
                     //The Courotine will wait for the end of the frame
                     yield return new WaitForFixedUpdate();
                     //Then set moving to true
                     Moving = true;
         }
     }

The Second Script handles all other collision and inherits from the first in an attempt to simplify the calling from script to script.... Could also be the cause of my problem.

public class MovingShellScript : KoopaShell
{

//This is a continuation of the KoopaShell Script
//Dealing with 2D Collision

void OnCollisionEnter2D(Collision2D col)
{
   if (col.gameObject.tag == "Koopa Shell") //  if contact is made with another shell that is moving
     if(col.gameObject.Equals(Moving) == false) //if the shell is not moving
     {
      {
          Destroy(col.gameObject);  // Then the resting shell is destroyed
          Debug.Log("Looks like another shell is unemployed");
       }
     }

    if (col.gameObject.tag == "Enemy") // If a Enemy is hit by the Shell
       if (Moving == true) // and If the Shell is moving
       {
                     // The GameObject hit is Destroyed
                     Destroy(col.gameObject);
       }
     }
 }

Currently the script above does not destroy the various gameobjects under the Enemy and Player tag. Maybe this could be done implicitly with an associated script to the desired gameobject that correlates with the tag....

Also the script destroys both shells during a collision. I don't understand why my various boolean flags aren't creating the desired result(s)

If both shells are moving then both shells are destroyed.
If only one shell is moving then the resting shell is destroyed.

I am seeking to understand the error in my logic for this to work as desired.

Thank you for your time!

sentences:
Create sprite sheet (texture atlas) from video with alpha What's the best way to make a sprite sheet (texture atlas) from a video?

In my case, I have videos of animated character expressions (e.g., smiling, frowning, sad, excited), which I intend to use as frames on quads in my app. I have video sized for retina 2x of a small character, so it's approx 150px square for a 75px character, with alpha/transparency. My animator can output any common format. I'll have 50-100 frames. I do not need a power-of-two size output, any rectangle is ok. I'm working on MacOS.

Is the best workflow still: video -> folder with PNGs -> TexturePacker

Or is there any smarter way to do this? I'll be having a lot of iterations, so I'd like to make it as easy and fast as possible.

There are two older questions from 2010 and 2012 about making sprite sheets.

sentences:
Can you trilinear sample a non volume texture? Let's say that i have a regular 2d texture (not a volume texture).  Is it possible to do trilinear texture sampling of that texture even though it isn't a volume texture in opengl or directx?

Specifically, if i had a 2x4 texture laid out like below where A through H are pixels:

A B
C D
E F
G H

What I'd like to get is a trilinear sample being the result of linearly interpolating the bilinear sampling of (A,B,C,D) and (E,F,G,H).

I know i could take two bilinear texture samples and lerp them to get what I want, but is there a hardware supported way to do this?

sentences: Add object to a Terrain? It's possible to add object made by blender to unity terrain ? this object will become a part of it. I can add grass and trees on it.

sentences:
Say I've got a list of a hundred unique weapons, how can I programmatically and easily identify them all? I've got a class, WeaponFrame, that has an int member, weapon_frame_id, that I intend to use as a way to identify the weapon, and I use that compare against other WeaponFrame instances.

The problem is that I want to pull the weapon from the global list of WeaponFrames and equip it on an Actor. As the designer, I might know that weapon_frame_id #2 is the bow weapon I want, but what is the best way to programmatically identify them?

If I assign an ID to the WeaponFrame on instantiation, I am unable to rely on the value being identical the next time the game is run, unless I assign the value to an enum or int then. That might work though.

I'm using C++11, would I just create a namespace somewhere, and enumerate all the weapon types,

enum class WeaponFrameIDs {
  Sword = 1,
  Bow = 2, //repeated a hundred-plus times
};

or would I make a ton of const integers in a header somewhere, even if effectively an enum that way too:

namespace WeaponFrameIDs {
  const int Sword = 1;
  const int Bow = 2;
}

I could also use strings mapped to an integer, but I'm losing compile-time verification (and I can't use constexprs with VS2013), and run the risk of duplicating entries. However it supports dynamic assignment to the list:

std::unordered_map<std::string, int> WeaponFrameIDs {
  {"Sword", 1},
  {"Bow", 2},
};

Is there an alternative that I'm missing? What is the best way to write a system for identifying weapons in a game?

If it's relevant, here's an example situation I'm trying to solve via code. I am not using a visual editor where I can drag a weapon onto an actor.

void set_up_actor()
{
  Actor actor;
  WeaponFrame* weapon_frame = AllWeaponFrames.at(WeaponFrameIDs::Bow);
  actor.weapon_frame = weapon_frame;
};

Points I'm looking to avoid:

Filling an entire header with enums
Needing to recompile the entire project because I changed that header
Losing the ability to verify the id at compile time
Eventually add user-generated ids. This conflicts a lot with the compile-time  verification.

I'm trying to solve the best way to pull the Weapon from a list, whether it's by ID, index, specially mapped key or something else.

If I use a literal ID, actor->weapon_id = 1, I don't know what weapon is tied to the ID of 1.
If I use an enum, or a const int, to represent the 1, I need to recompile the game for each of the new weapons I add.
If I change the id type to a string, I lose the ability to programmatically validate the string against the existing list of weapons.

sentences:
Orbiting multiple objects evenly around a changing radius I have multiple objects (circles) and I want to place them in a circle, with even distance between each one, and have them orbit the center of the screen.

If I remove one object, I want the orbit radius to reduce and the other circles, as a result, end up getting closer and closing the circle again.

Below are some images to help explain what I'm trying to achieve.

A. is the objects evenly distributed around the center.

B. is after destroying one of the objects, the "circle of objects" need to close in and evenly distribute the objects once again.

C. is just after another object has been destroyed.

I know that the solution is some "basic" math, but it's been a while, and I'm super rusty.

Thanks for the help, if anything further is needed please let me know!!

Cheers!

o7

sentences: Get actual button by input name How would I get the physical button name (A, B, C) by the name set up in the Input Manager (Fire1, Reload, Jump)? For instance, if the player needs to reload his gun, I want to print "PRESS [RELOAD BUTTON] TO RELOAD" on screen where [RELOAD BUTTON] is whatever he assigned it to. I don't see anything helpful in the Input class, where else can I look?

sentences: Animate an element from ngui in Unity How can I animate an element from ngui in Unity? For example, how can I move it from the left to the scene when the button is clicked?

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:
Porting to Android...what is the equivalent of Properties.Settings.Default? I'm porting my MonoGame/OpenGL app to Android.  My game uses Properties.Settings.Default to store user preferences.

What is the equivalent of this in Android?

sentences:
Need the co-ordinates of innerPolygon Let say I have this diagram,

Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon co-ordinates?
Edit:
I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.

sentences:
Turn a spaceship at a max rate Using the following to turn a spaceship in a C# FarseerPhysics simulation.

 var turnPower = _Inventory.EngineTurnPower * time;
 body.ApplyTorque(turnPower);

If the user keeps holding in the turn key the ship will go into a superspeed turn och chaos were it eventually is impossible to tell which direction it is facing.

What would be some good way of limiting the turn speed that the user can cause, without limiting the simulation itself.

sentences:
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:
Need to join 2 bodies via weld joint but not on center of mass I have successfully join 2 bodies via weld joint , but my problem is I want to join corners of bodies not on centre of mass. Is there any way to achieve this?

Above image consist 3 polygon body that I want to join via weld joint. feel free to ask more information.
Any help will be appreciable.

sentences:
Most efficient way to hide out of bounds object in tile based environment I am working on a desktop game in C#, with Monogame framework. I am storing the tile instances in a 2D Array, for the sake of easy collision detection. But the levels are big (often 100x100 or bigger) and there are lots of tiles out of the screen bounds all the time which I should not draw. At the moment I'm running through the arrays and checking whether they are in the screen bounds or outside, but that may not be too efficient due to the big count of the tiles.

Is there any better way to hide out of bounds tiles?

sentences: Ball passing through box collider My ball which has a circle collider 2D component occasionally passes through my box collider2D object. Both objects have rigidbodies attached. I have set a high mass for my box collider and a small mass for my ball. Strangely enough, it doesnt pass through every time (maybe due to varying velocity). Basically i am making pong.

sentences:
How to randomly place entities that don't overlap? I am creating a randomly-generated environment for a game I'm developing. I am using OpenGL and coding in Java.

I am trying to randomly place trees in my world (to create a forest), but I don't want the models to overlap (which happens when two trees are placed too close to each other). Here's a picture of what I'm talking about:

I can provide more code if necessary, but here's the essential snippets. I am storing my objects in an ArrayList with List<Entity> entities = new ArrayList<Entity>();. I am then adding to that list using:

Random random = new Random();
for (int i = 0; i < 500; i++) {
    entities.add(new Entity(tree, new Vector3f(random.nextFloat() * 800 - 400,
    0, random.nextFloat() * -600), 0, random.nextFloat() * 360, 0, 3, 3, 3);
}

where each Entity follows the following syntax:

new Entity(modelName, positionVector(x, y, z), rotX, rotY, rotZ, scaleX, scaleY, scaleZ);

rotX is the rotation along the x-axis, and scaleX is the scale in the x-direction, etc.

You can see that I am placing these trees randomly with random.nextFloat() for the x and z positions, and bounding the range so the trees will appear in the desired location. However, I would like to somehow control these positions, so that if it tries to place a tree too close to a previously placed tree, it will recalculate a new random position. I was thinking that each tree Entity could have another field, such as treeTrunkGirth, and if a tree is placed in the distance between another tree's location and it's treeTrunkGirth, then it will recalculate a new position. Is there a way to accomplish this?

I am happy to add more code snippets and details as necessary.

sentences:
How could I implement a movement system like Intrusion 2 has? Here is a trailer of the game Intrusion 2. The characters seem to move with physics, but look animated as well.

I'd like to know how such a movement system works and how I could go about implementing something similar.

sentences:
Why can't a blueprints project edit BPs derived from c++ classes? I am working in a relatively small team.

Now, because our IT guy is incredibly unhelpful, we don't yet have VS on all the machines (as I know this would solve the error). However, I'm still curious as to the answer to this question.

Computer A:

C++ project
Creates C++ classes
Creates BP derived from said C++ classes.
Sends project to Computer B.

Computer B:

Gets project
Tries to edit BP classes
Can't open them
Reason: 'They derive from parent C++ classes'

So my base question is really why is this?

I understand that this can be solved easily, but I'm interested as to why Unreal imposes these limitations.

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:
(DX11.1) CreateSwapChainForHwnd fails with E_NOINTERFACE when using Graphics Diagnostics The CreateSwapChainForHwnd fails with E_NOINTERFACE "No such interface supported" when I use the Graphics Diagnostics on Visual Studio 2013 Update 4 on Windows 7 sp1 under DirectX 11.1. The program runs fine in debug mode. Has anyone come across this problem before or know of a solution?

Here is the initialisation code:

#include <d3d11_1.h>

// Set feature levels supported by our application
D3D_FEATURE_LEVEL eFeatureLevel1[] =
{
    D3D_FEATURE_LEVEL_11_1,
    D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1,
    D3D_FEATURE_LEVEL_10_0,
    D3D_FEATURE_LEVEL_9_3,
    D3D_FEATURE_LEVEL_9_2,
    D3D_FEATURE_LEVEL_9_1
};

D3D_FEATURE_LEVEL           eReturnedFeatureLevel;

D3D11CreateDevice(nullptr,                  // default adapter
    D3D_DRIVER_TYPE_HARDWARE,
    0,                          // no software device
    uiCreateDeviceFlags,
    eFeatureLevel1,
    ARRAYSIZE(eFeatureLevel1),
    D3D11_SDK_VERSION,
    &m_spDeviceOld,
    &eReturnedFeatureLevel,
    &m_spContextOld);

if (eReturnedFeatureLevel < D3D_FEATURE_LEVEL_11_0)
{
    //MessageBox fails silently here!!!
    return false;
}

// Fetch the underlying interfaces and store them:
m_spDeviceOld.As(&m_spD3DDevice);
m_spContextOld.As(&m_spD3DImmediateContext);

SETPRIVATEDATA(m_spDeviceOld, "CD3DObject::m_spDeviceOld");
SETPRIVATEDATA(m_spContextOld, "CD3DObject::m_spDeviceOldspContextOld");

// This is the earliest the Debug Layer can be created
MyDebugLayer.CreateD3DDebugLayer();

SETPRIVATEDATA(m_spD3DDevice, "CD3DObject::m_spD3DDevice");
SETPRIVATEDATA(m_spD3DImmediateContext, "CD3DObject::m_spD3DImmediateContext");

m_spD3DDevice->CheckMultisampleQualityLevels(DXGI_FORMAT_R8G8B8A8_UNORM,
                                            4,
                                            &m_ui4xMsaaQuality);

assert(m_ui4xMsaaQuality > 0);

DXGI_SWAP_CHAIN_DESC1 stSwpChainDesc = { 0 };
stSwpChainDesc.Width = 0;
stSwpChainDesc.Height = 0;
stSwpChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
stSwpChainDesc.Stereo = false;
stSwpChainDesc.SampleDesc.Count = 1;
stSwpChainDesc.SampleDesc.Quality = 0;
stSwpChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
stSwpChainDesc.BufferCount = 1;                                 // Used to be 1
stSwpChainDesc.Scaling = DXGI_SCALING_STRETCH;
stSwpChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
stSwpChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

// Use 4X MSAA?
if (m_bEnable4xMsaa)
{
    stSwpChainDesc.SampleDesc.Count = 4;
    stSwpChainDesc.SampleDesc.Quality = m_ui4xMsaaQuality - 1;
}
// No MSAA
else
{
    stSwpChainDesc.SampleDesc.Count = 1;
    stSwpChainDesc.SampleDesc.Quality = 0;
}

Microsoft::WRL::ComPtr<IDXGIDevice1> spDXGIDevice;
m_spD3DDevice.As(&spDXGIDevice);

IDXGIAdapter1* pDxgiAdapter = 0;
spDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pDxgiAdapter);

IDXGIFactory2* pDxgiFactory = 0;
pDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&pDxgiFactory);

// Create DXGI swap chain targeting a window handle (the only Windows 7-compatible option)
HRESULT MyHr = pDxgiFactory->CreateSwapChainForHwnd((ID3D11Device*)m_spD3DDevice.Get(), m_hMainWnd, &stSwpChainDesc, nullptr, nullptr, &m_spSwapChain);

//MessageBox fails silently here!!!
//MessageBox(m_hMainWnd, _com_error(MyHr).ErrorMessage(), "Error Caputed", MB_OK);

ReleaseCOM(pDxgiAdapter);
ReleaseCOM(pDxgiFactory);
spDXGIDevice->Release();

Why does the code fail when I use the graphics diagnostics tool and not normally? Basically the main window appears then the application shuts down. Also any calls to MessageBox([NULL/or not]) fails silently too.

Supplemental: m_spDeviceOld and m_spContextOld are ID3D11Device and ID3D11DeviceContext used for getting the 11.1 interface they then are detached at exit and the 11.1 interfaces are released instead.

Thanks in advance for your indelible advice.

sentences:
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:
Grid movement of game units I am trying to achieve a grid movement for a character and enemies. This is what I have so far.

public float moveSpeed = 5f;

Rigidbody2D rb;
public Animator animator;

Vector2 movement;

private void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

void Update()
{
    animator.SetFloat("Horizontal", movement.x);
    animator.SetFloat("Vertical", movement.y);
    animator.SetFloat("Speed", movement.sqrMagnitude);
}

private void FixedUpdate()
{
    rb.velocity = movement;
}

public void MoverHaciaDelante()
{
    movement.y = 1 * moveSpeed;
}

public void MoverHaciaAtras()
{
    movement.y = -1 * moveSpeed;
}

public void MoverHaciaDerecha()
{
    movement.x = 1 * moveSpeed;
}

public void MoverHaciaIzquierda()
{
    movement.x = -1*moveSpeed;
}

public void Parar()
{
    movement = Vector2.zero;
}

And on the part of the enemies I carry this movement system.

private Animator myAnim;
private Transform target;

[SerializeField]
private float speed;
[SerializeField]
private float maxRange;
[SerializeField]
private float minRange;

void Start()
{
    myAnim = GetComponent<Animator>();
    target = FindObjectOfType<Player>().transform;
}

void Update()
{
    if(Vector3.Distance(target.position, transform.position) <= maxRange && Vector3.Distance(target.position, transform.position) >= minRange)
    {
        FollowPlayer();
    }
}

public void FollowPlayer()
{
    transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);
}

sentences:
What does "GL_CLAMP_TO_EDGE should be used in NPOT textures" mean? I have two sRGB PNG images I am using for textures. One is 64x64, and works fine. The other is 64x47, and when I attempt to use it I get an error:

reason: 'GL_CLAMP_TO_EDGE should be used in NPOT textures'

What does this mean, and how do I address it?

sentences:
How do you keep the gameplay and music in sync in a rhythm game? What's the best way to program a rhythm based game in XNA? (Some sort of game like Dance Dance Revolution) Would you use the built in GameTime? What logic would you use to make sure the game constantly stays in sync to the music? Any tips would be much appreciated!

What I am basically asking is how you would keep the gameplay in sync with the music. For example in DDR how would I correctly sync the arrows to the beat of the music?

sentences: Radial/circle placement of meshes How to place 10 static meshes in circular pattern so they are equaly aligned from the center ?

sentences: Play .mp3 with Craftyjs I want to play .mp3 sound files in a game I built with Crafty.js. Is this possible without converting the sound file?

sentences:
libgdx - Image artifacts when downscaling image Why does this border appear around the edges when I downscale a bitmap and how do I avoid it? I tried every filter I know, the results go from bad to worse.

Here's the original bitmap:

sentences:
More smaller maps among which player can travel I am developing 2d game, where maps are tile based, small about 20x20 tiles and player can travel between a lot of maps (in my game rooms) like this. The maps are connected sometimes verticaly and sometimes horizontaly and together they make one big cave.

Should I create a class where one 2d array holds all the maps (another 2d arrays), or is there any other way? Whats the most efficient way to create them in this class? Thank you for your help.

sentences:
2D HUD overlay drawing based on 3D coordinates and camera azimuth and elevation Assume you have the 3d coordinates of the player and another unit N as well as the azimuth and elevation of a camera always looking at the player. In the following illustration the sun would be the camera of course:

(source: permetix.com)
Let's say one wants to draw something on a different transparent window (not using the game window or any hooks) that is always displayed on top of the unit. An example would be TurboHUD for Diablo. In the linked video you can see that it displays affixes using textboxes right on top of the blue elite mobs.
In Diablo doing this is much simpler since the camera cannot be rotated and moved thus only simple projections depending on the distance are necessary, but what about situations with more degrees of freedom? How can one estimate 2d coordinates to draw at that match the position of the 3d units on the screen without access to more than described in the first paragraph? What is the mathematical background and what are the necessary computations?

sentences:
How to fix edge scrolling on a 2d scrolling camera? Afternoon all,
I just cannot get this to work properly and I'd really appreciate any help. I have a camera that follows the player around a 2d tile based map. However, I want the camera to move only when the player touches the outer edge and at that point to only move enough to get the player out of the edge. So if the player is 2 tiles into the left most edge then move the camera 2 tiles to the left.
I currently have the following bugs:

The camera doesnt move to the player on game start, until the player moves.
The camera doesnt render differing amounts of tiles around the edges.
The camera follows the player at all times, rather than scrolling when at the edge.

The camera's movement code seems to work fine so I believe the issue is in the way I am assigning the target or obtaining the offset. Here's the specific code for that.
def set_target(self, position: Tuple[int, int], ignore_edge: bool = False):
    """
    Set the target position.
    """
    x, y = position

    # centre the target
    half_width = (self.columns // 2) - 2  # -2 to offset against the rounding of row/columns
    half_height = (self.rows // 2) - 2

    if self.is_in_camera_edge(position) or ignore_edge:
        offset_x, offset_y = self.get_edge_offset(position)

        new_x = x + offset_x
        new_y = y + offset_y

        self.target_x = clamp(new_x - half_width, 0, self.map_width - half_width)
        self.target_y = clamp(new_y - half_height, 0, self.map_height - half_height)

    self.is_dirty = True

    def get_edge_offset(self, target_pos: Tuple[int, int]) -> Tuple[int, int]:
        """
        Determine how far the player is into the edge of the camera
        """
        x, y = target_pos
        edge_size = self.edge_size
        dir_x = 0
        dir_y = 0

        if x < self.start_x + edge_size:
            dir_x = x - (self.start_x + edge_size)

        elif x > self.end_x - edge_size:
            dir_x = x - (self.end_x - edge_size)

        if y < self.start_y + edge_size:
            dir_y = y - (self.start_y + edge_size)

        elif y > self.end_y - edge_size:
            dir_y = y - (self.end_y - edge_size)

        return dir_x, dir_y

And here's the code in full.
I would really appreciate any suggestions or thoughts. I am pulling my hair out after days of getting nowhere with this.

sentences:
Creating color texture from greyscale heightmap in shader I'm trying to create a shader that takes a grayscale map as input, and returns a colored albedo that I want to use as texture for my PCG planets, I think that the code below should work, but it only produces flatly white objects.

I'm a total shader noob, so I'm terribly sorry if I'm missing something obvious here.

    Shader "Custom/Planet" {
    Properties{
        _height("HeightMap", 2D) = "white" {}
    }
    SubShader{
        Tags { "RenderType" = "Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        struct Input {
            float2 _heightMap;
        };

        float minHeight = 0;
        float maxHeight = 1;

        float inverseLerp(float a, float b, float v) {
            return saturate((v - a) / (b - a));
        }

        //UNITY_INSTANCING_CBUFFER_START(Props)
        //UNITY_INSTANCING_CBUFFER_END

        void surf (Input IN, inout SurfaceOutputStandard o) {
            float hv = inverseLerp(minHeight, maxHeight, IN._heightMap);
            o.Albedo = hv;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Tile palette off-centered Unity has a wonderful Tile Palette feature. However after I drag and drop the sprites to the Tile Palette, the tiles are off-centered like so (Notice the white square, it's the cursor):

I've tried fiddling with the Cell Size/Gap within the Grid object, and the Tile Anchor from the Tileset object with no difference.

Although I can place the tiles right in the scene, it's a headache to re-arrange and place the tiles within the Tile Palette with this off-center tile issue.

Did anyone of you faced and solved this issue before? Perhaps I overlooked something?

sentences:
ADMOB: Why my match rate never increase? I have a game deployed in the store, here are some app and admob metrics:

It makes ~120k requests per day
It have ~800 active devices in the last 30 days
It have less than 1% match rate(~0.3%)
Some math: 120k/0.8k(800) -> ~ 150 requests per user(really high I think)

I have read some articles and questions about this, what I did was:

Make sure to only request an ad when it needs to be displayed, I can't always ensure this, but I tried my best.
Make sure my app are not enrolled in the 'Designed for Families' program.
Make sure my ad content rating is for mature audiences(M).

All this was done last week, since then I have seen not a single change in the admob reports, everything stills the same, after changing the request rate I should have seen a decrease in the ad requests, it didn't happened, of course I'll wait more since only 400 active devices were updated with this new version(although I think it should have been reflected in the statistics already).
It is really frustrating, feels like I have no control over this, is there other reasons for admob to have low match rate? can someone help me here? Thanks all in advance.

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:
Testing for 2D collision outcome I'm currently building a small 2D game in Processing (and it has to be Processing) for a school project. The basic makeup of the game is 4 different cells (objects, all are circles): An avatar, controlled by the player, a number of cowardly cells fleeing from all other cells, huntercells hunting and attempting to eat everything, and passive disruptorcells which will burst apart other cells in differnt ways depending on what they hit. Also, whether one cell is bigger than another affects the outcome of collisions. All these different cells are child classes of the cell superclass, all stored in a cells ArrayList, which is handled inside a World class, which is updated/displayed in the main Draw loop.

My main problem right now is how I should handle the outcome of all these different collisions, without too much code-duplication: My idea is to do it through a double for-loop, which would then again need 16 different if-like methods to figure out who's colliding with who, and what to do about it.

E.g. if a predator cell collides with prey cell, the latter will be eaten and the predator will grow a certain amount in size and speed. The outcome should be the same (predator grows, prey dies) if the tested subjects are found in reverse order through the for-loops. Cells also need to know where they are in relation to eachother all the time, so they know when/what to flee from/chase.

Any thoughts/suggestions on best practices and how to do this most efficiently are much appreciated.

sentences: Is HTML5 and Canvas good for rapid prototyping of games? Are there frameworks and processes for HTMl5 that can be used for the rapid prototyping of 2D games?

sentences: Minecraft Optifine - where is the zoom class? I'm working on a mod where I want to have a zoom feature like Optifine. To start out, I want to try messing around with the zoom in the actual Optifine mod. There are a lot of .class files, and I don't want to decompile all of them one by one, so if anyone knows which one(s) have the zoom that would be super helpful.

sentences:
Game Programming Junior Demo Design Consider the following demo:

http://www.ashereinhorn.com/post/11140243390/short-capture-from-the-last-xna-version-direct3d

(It has now almost been converted to C++ and DirecX10, and so the code is not important here, it's the substance I'm interested in)

Basically the little agents move around killing each other, their states are displayed in a corner and you can select one so as to see the items it can see, it's field of view and the things it is holding in memory.

I showed it to someone that works in the industry and they said I should focus on tracking a single agent and make what's going on more clear - so maybe animate each state with simple animations or model swapping to make it more obvious when they are searching / in combat / running away. The other thing they said I should change was the fact that the agents simply disappear when killed, and reappear when spawned because again, it's not clear what's happeneing. As a result I'm going to implement a simple particle system so that agents 'shatter' when killed and possibly reassemble when spawned.

My question is, are there any really obvious changes that I should make to this demo with a view to getting my first game programming job? If you work or know about the industry, is there anything that jumps out at you that should be included? Or is bad? or good for that matter?

Are there any things that would particularly impress or grab your attention in a game demo?

Thank you very much for any help you can give!

EDIT - The walls are actually solid in the C++ version

sentences:
Processing - implement a first person camera? First off, I'm sorry if there are duplicates of this. I did an extensive Google search but was unable to find anything that made sense to me. (I am new to 3D rendering and such.)

I want to make a first person camera that the user can control with the mouse. My current implmentation in Processing looks like this:

PMatrix3D cam;
int oldMouseX=0, oldMouseY=0;
void setup(){
    // ...
    cam = new PMatrix3D();
}
void draw(){
    // ...
    int deltaX=oldMouseX-mouseX;
    int deltaY=oldMouseY-mouseY;
    oldMouseX=mouseX;
    oldMouseY=mouseY;
    cam.rotateY((PI/600)*deltaX);
    cam.rotateX((PI/600)*deltaY);
    PVector x = cam.mult(new PVector(1, 0, 0), new PVector(0, 0, 0));
    PVector y = cam.mult(new PVector(0, 1, 0), new PVector(0, 0, 0));
    PVector d = x.cross(y); d.normalize(); d.mult(R);
    float fov = PI/3.0;
    float cameraZ = (height/2.0) / tan(fov/2.0);
    perspective(fov, float(width)/float(height), cameraZ/10.0, cameraZ*1000.0);
    camera(0, 0, 0, d.x, d.y, d.z, y.x, y.y, y.z);
    // render objects
}

It works well, but there is a problem. When the mouse is moved along the x-axis of the screen, and then the y-axis, or in some way one axis at a time, the camera rolls. I understand that 3D rotation is supposed to work like that, 2 consecutive rotations around 2 axes make a rotation around the third. The problem is that once the camera is in this rolled state, it is difficult to get it to be straight again.

How can I make it so it is easy to point the camera in any direction?
Please explain in easy to understand terms, if possible.

Also, I am a bit confused on

cam.rotateY((PI/600)*deltaX);
cam.rotateX((PI/600)*deltaY);

Before, I had it as

cam.rotateX((PI/600)*deltaX);
cam.rotateY((PI/600)*deltaY);

But that cause the x and y axes to be switched. (i.e., moving the mouse horizontally caused the camera to rotate vertically.) Why is this?

sentences:
Are GPU drivers hand optimized for specific games using low-level APIs? The GPU drivers often have slightly different behavior depending on game or program, which is using them. It optimizes performance, bypasses bugs and improves overall experience in popular games, especially demanding AAA ones. There was even a question on this stack about it a few years ago.

This strategy seems reasonable in the world of high level GPU APIs, like Direct3D up to 11 and OpenGL. These standards are very complicated, drivers don't comply with them perfectly and much of computation burden is pushed to the driver.

But what about the new, low level APIs like Direct3D 12, Vulkan and Metal? The standards are simpler for drivers to implement correctly and less computations are hidden inside the driver, they are in the hands of game authors. There seems to be just much less to do on driver side about improving game experience.

Are GPU drivers hand optimized for specific applications using low level APIs?

sentences:
Default Game Window Size To Take While Making Games I am planning to make a game for mobiles and tablets, I wanted to know what would be the default resolution that I should set for my game so that it covers all or most of the devices out there.
I read an article someplace that says we should design the game for lowest resolution like 480 x 360 and then scale it according to devicePixelRatio for the target device, Is this the right approach because according to me it will be good only for devices that have 3:2 resolution but what about other 16:9, 16:10 etc
So What should be the base resolution I design my game so that it gets scaled to all mobiles and tablets?

sentences:
How do I start the process of looking for playtesters for an iOS game? How does an independent developer typically go about finding a group of people to playtest their iOS game in 2013?

Is it through Reddit? College campuses? Steam Forums?

For example my game is targeted at males, ages 25-33 and the initial test I want to do on an iPad.

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:
UnityEngine.PlayerPrefs corrupts string? I need to use PlayerPrefs to store arrays of bytes for my game. For some reason, the string I save with PlayerPrefs doesn't come out with the same length.

I.e.

byte[] TestArray = new byte[256];
for (byte i = 0; i < 256; i++)
{
    TestArray[i] = i;
}

char[] charBuffer = new char[TestArray.Length];
for (int i = 0; i < TestArray.Length; i++)
{
    charBuffer[i] = (char)TestArray[i];
}

PlayerPrefs.SetString ("Storage", new string(charBuffer));

PlayerPrefs.Save ();

Debug.Log (new String(charBuffer).Length);
Debug.Log (PlayerPrefs.GetString ("Storage").Length);

Log:

256
5

Is this possibly an issue with encoding? How do I fix it?

sentences:
Controlling Instantiation I have an problem where I instantiate a GameObject and it keeps on instantiating a million times over, even though I put the line of code under the start function.

I am trying to have the player collide with the coin(then a point is added to your score) , then the coin deletes itself and then re-instantiates at a random coordinate, but I cant get past the initial instantiation.

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

public class Coin : MonoBehaviour {
public GameObject coins;
Vector2 randomPosition;
public UIScript _UIScript;

// Use this for initialization
void Start () {
    _UIScript = GameObject.FindWithTag("UI").GetComponent<UIScript>();
    randomPosition = new Vector2(Random.Range(-8f, 8), Random.Range(-4f, 4f));
    Instantiate(coins, randomPosition, Quaternion.identity);
}

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

}
private void OnTriggerEnter2D(Collider2D coinCollision)
{
    switch(coinCollision.tag)
    {
            case "Player":
            collisionWithPlayer();
            break;
    }
}
private void collisionWithPlayer()
{
    _UIScript.highScore = _UIScript.highScore + 1;
    Object.Destroy(coins);
}
}

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:
Texture coordinates from world position Im making an editor in which I want to build a terrain map. I want to use my mouse to increase/decrease terrain altitude to create mountains and lakes essentially.

Technically I have a heightmap I want to modify at a certain texcoord that I pick out with my mouse. To do this I first go from screen coordinates to world position - I have done that. The next step going from world position to picking the right texture coordinate puzzles me though. How do I do that?

sentences:
Determining which way a wall faces in a 2D grid with minimal boilerplate I have a 2D grid of quadrilateral tiles, some of which are walls, some are floor; each tile has four vertices, which are shared with the tiles around it (so each rendered "wall" is at least two wall-tiles thick). In order to render this scene, I need to know, for each tile:

is it a wall?
if so, is it a straight wall, a convex corner (pointing outwards), or a concave (inwards) corner? (so that I can select an appropriate texture to use – for the sake of example, ignore tiles that are totally surrounded by walls)
which direction is the free space in? (so that I can rotate the texture correctly)

e.g. for tile @ with walls W and floor ., this would render a straight wall facing east:

WWW
W@.
WWW

whereas this would be a convex corner facing north-west:

...
.@W
.WW

Some more interesting arrangements: this would ideally be treated as a special case (with a valley down the middle of two walls):

WW.
W@W
.WW

and something like this would ideally be two convex corners at A and B, as if there were two independent 2x2 squares of walls:

WW..
WABW
..WW

I'm not worried about handling invalid patterns of walls (e.g. a cross-shape of 5 walls) for now.

It's easy to track whether each tile is a wall or not, but I don't see a clean way to determine the other two conditions from that data. Is there a nice algorithm to do this without enumerating every possible arrangement of neighbouring tiles?

sentences:
How animated block in voxel engine? In my voxel engine (XNA 4.0) I'm use a vertex buffer for the entire chunk and update it after the set block, changing block metadata or light level. This is not too frequent operation compared with the time of mesh rebuild. But now I want animate some blocks, for example, make door opening or lever switching smooth.

If I remember right, in Minecraft all draw on the fly using OpenGL (correct if wrong), but in my case this is not an option.

I'm know what is a bone animation and how it works, and I think that I can make something like this for animatable block X:

rebuild chunk mesh without animated part of block X;
create entity looking like removed animated part and animate it;
remove entity and rebuild chunk mesh with that part in another static position.

I'm not shure this is a correct way. Any better ideas?

Also, how to make a block with animated textures? Do I need to use for this purpose a separate shader or I can somehow a correct texture coordinates of vertices in existed meshe?

Thanks.

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:
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:
What are the disadvantages of using multiple inheritance to implement components? I've been doing research on component-based game engines and would like to use that model for future game projects. From what I gather, objects in a component-based system are just collections of attributes and behaviors. The examples I've seen have a high-level interface such as Attribute<T> *Entity::getAttribute<T>(int id) but discussions about those systems often talk about performance problems. It seems like this could be implemented with greater efficiency in C++ using multiple virtual inheritance since the compiler could inline attribute accesses and behavior method calls:

// Layer 1: Base
struct Entity {
  virtual ~Entity() {}
  virtual void draw() {}
  virtual void update(float seconds) {}
};

// Layer 2: Attributes each extend from Entity
struct Position : virtual Entity { Vector3 pos; };
struct Velocity : virtual Entity { Vector3 vel; };
struct Health : virtual Entity { int health; };
struct Target : virtual Entity { Position *target; };

// Layer 3: Behaviors extend from the attributes they need
struct Renders : virtual Position {
  Model model;
  void draw() { model.draw(); }
};
struct Moves : virtual Position, virtual Velocity {
  void update(float seconds) { pos += vel * seconds; }
};
struct Seeks : virtual Moves, virtual Target {
  void update(float seconds) {
    if (target) vel = (target->pos - pos).unit();
    Moves::update(seconds);
  }
};

// Layer 4: Definitions extend from the behaviors they need
struct Rocket : virtual Health, virtual Renders, virtual Seeks {};

However, many component-based engine resources discount multiple inheritance without really saying why. I'm sure I'm missing something, but what are the disadvantages of using multiple inheritance like this over lists of components? I know calls to base classes when using multiple inheritance incur an additional constant offset, but that seems better than going through a run-time map for each attribute access. The only disadvantage that I can think of is not being able to swap out components at run-time.

Resources:

http://www.gdcvault.com/play/1911/ (PPT)
http://www.richardlord.net/blog/what-is-an-entity-framework

sentences:
Responsibility of rendering in a component/entity game engine I am developing a simple component/entity game engine in C# (https://github.com/alexvm/BlueShift) and have a few questions regarding the responsibility of certain items in the engine itself. I have the following:

Scene
Entity
Component

I am planning to have the scene maintain a collection of entities. To draw components on screen, the scene will loop over entities draw any components that extend from a drawable parent.

E.g. a drawable component might look like:

public class SpriteComponent : Drawable {

}

And in as scene I would call:

foreach(var entity in entities) {
    Scene.DrawComponents(entity.DrawableComponents());
}

Does the responsibility of each class make sense? I.e. does it seem like good design for the scene to maintain all entities and for the entity to present the drawable components to the scene to draw?

sentences: Why Some objects or prefabs don't respond to mesh collider? I imported some assets and, I used some prefabs from that assets. Some of them responds when I add the component of mesh collider to it and disable the ability of going through with it. But some of the is not is not. I can still go through them. Is it a good practice to add 3d cube and disable that or, is there any other way to disable of going through it?

sentences:
Uniform Buffer Binding-points I believe Uniform Buffers/Blocks has been the hardest thing to grasp in OpenGL. Hopefully this will be my final issue regarding this.

I have created a uniform buffer that contain data of Light objects. Where Light is a structure containing ambient, diffuse, etc. When I have added all my lights with glBufferSubData then I can either call glBindBufferBase to bind the entire buffer to a binding-point, or glBindBufferRangeto bind different Lights to different binding-points.

I can get the latter one to work. For example, If I have added 3 lights, in my program I can do like this to point the uniform-block-array to correct offset in the buffer.

// First parameter: binding-point, second: uniform block name
program->UniformBlockBinding(1, "UBLight[0]");
program->UniformBlockBinding(2, "UBLight[1]");
program->UniformBlockBinding(3, "UBLight[2]");

// Fragment shader code
layout(std140) uniform UBLight
{
    vec3 PositionOrDirection;
    vec3 Diffuse;
    vec3 Specular;
    int Type;
} lights[3];

But what I want to do is just to map the entire uniform buffer to one binding-point, and still be able to use these 3 lights in the shader, that is lights[3]. I've tried to do like this without success:

glBindBufferBase(GL_UNIFORM_BUFFER, 1, id);

program->UniformBlockBinding(1, "UBLight");

It works for the first light, but if I try to use the 2nd or the 3rd light in the shader my model gets black.

Is it possible to solve this in some way, or do I have to bind each Light to a different binding point?

UPDATE #1:

Code showing UniformBlockBinding:

void Program::UniformBlockBinding(GLuint uniformBlockBinding, GLchar *name)
{
    GLuint index = glGetUniformBlockIndex(program, name);

    if (index != GL_INVALID_INDEX)
    {
        glUniformBlockBinding(program, index, uniformBlockBinding);
    }
    else
    {
        printf("Error: the uniform block \"%s\" doesn't exist in program\n", name);
    }
}

sentences:
How would I add a sound variable to my code? I am writing some code in JavaScript for a ray cast shooting program. I have all the variables I need except for sound, and I'm not too sure on how to add that variable into my code. I would really appreciate any help people can give to solve this problem, and show me how to add a sound variable to my code.

#pragma strict

var Effect : Transform;
var Damage = 100;

function Update () {

 var hit : RaycastHit;
 var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));

 if (Input.GetMouseButtonDown(0))
 {
  if (Physics.Raycast (ray, hit, 100))
  {
   hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
  }
 }
}

sentences:
How can I implement multiplayer cloaking with visuals that resists client-side hacking? I've been thinking about implementing stealth in a multiplayer game. It's a MOBA style game, so think League of Legends (LoL) and Heroes of the Storm (HotS). Multiple clients connect to a single server, which broadcasts the game state to all clients. Clients send their input data to the server, which might reject it when encountering invalid commands, thus rendering cheating impossible (well, in theory).

Now, I mention these games on purpose because both implemented stealth differently. LoL has stealth with two possible states: you're either completely visible or completely invisible. HotS on the other hand, implements stealth in such a way that you can tell by a shimmer in the air:

I think this is a neat mechanic, as it promotes / rewards paying attention to your surroundings. However, this being a multiplayer game made me realize that this might prove easily exploitable.

When you implement stealth in 'the LoL' way, you can simply stop sending player coordinates to the other clients. When the player's character breaks stealth, the server can broadcast the location again.
However, with the HotS model, a shimmer can be seen in the air where the character is moving about. This means that the server must be sending the player's location to the other clients. Which means that players that change the texture or model or even the game code itself could render the cloak mechanic useless. Here is a thread on the HotS boards about it.

My question is whether there is some way to implement cloaking (with a 'shimmer', à la HotS), without having the issue that crafty players can modify the game (data) and 'beat the system'. Is this possible, and if not, how do other multiplayer games with this mechanic deal with this? Is only the LoL style of invisibility uncheatable?

I thought about having the server send bogus 'cloak' locations every now and then, but this also harms fair players that are just paying attention, so that won't do.

sentences:
Why are we not using integers in game physics? We can use integer for game physics (or without physics, simply object representation): mass, position and rotation, where the integers represent, for example, the number of milligrams, millimeters or (1/56000) of a degree. However, almost all game code I've seen recently use floating points.

Is it slower to use integers for game physics calculations? Are there any other advantages and disadvantages from the developer's point of view for using integers? Or it is because all our hardwares

sentences:
Constant rotation of a revolute joint in box2d I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to -45 degrees (i.e. I would like to have it swing like a rope back and forth 90 degrees).

Is this possible or should I use non box2d objects to do this (cheat box2d engine)?

sentences:
What would be the most simple following target and neighbors avoidance algorithm in 2D space on plane? I have ~20 or more enemies and they need to follow a target and avoid to go on top of themselves. I mean follow a target and avoid to collide with each other. Area, on which they are walking, is just a rectangle plane in 2D space.
What would be the most simple and efficient algorithm for this?
Thanks.

sentences:
Particle system appear inside UI? How to make the particle system appear inside the Canvas ? No need for unity store assets.
I'm using Unity 5.5.0

sentences: How would I implement render scaling in a DX11 game? I would like to implement render scaling that could render a scene at a certain % of the window resolution. How would I do this? I've tried resizing a number of things, then resizing them up or down to match the window size but I've never gotten it to work.

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:
Having a list of rooms with theirs connection to each other, how do I find isolated room groups? I'm trying to create a small roguelike and went as far as random generating rooms and corridors. Each room is an instanced object and contain an arraylist of the others rooms connected by a corridor.

I can single out unconnected rooms but how can I know the rooms that are connected only to each other but not to most of the others, forming an island?

to illustrated better the problem here is an image from the console on a bogged level. Rooms 5 and 6 are connected only to each other. What algorithm can I use to detect that?

sentences:
Using HTML for interface? The game I've been working on uses opengl/sfml for graphics. I'm currently working on the interface and I've found determining all the proper offsets/positioning etc. to be a pain. To make it configurable, I'll likely end up parsing a making a bunch of xml files to parse that tell my program what images to use/where to position them stc. for the interface.

Since I'm going to need to do that anyways, I was curious if it's possible to embed an html renderer into an app, and have it display over graphics drawn in opengl? That way i could theoretically use html pages to design the interface

If it is possible, how difficult would it be and is it a good idea? are there any projects that do this already?

Thanks

sentences:
When do you give in-game advice? I'm interested in the process of automatically generating advice when a player is consistently struggling through parts of a game.  Suppose I already know what advice I want to generate (e.g., "Press A twice to double-jump across long gaps").  My question is twofold:

Has it been shown that this intervention can be useful to gamer experience?
Has it been shown that excessive intervention will be ignored or will cause frustration?

References to game design or psychology research papers is a plus!

sentences:
How to impale and stack targets correctly according to the collider and its coordinate? I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how:

At the start, the falling object (in red) will fall in a vertical direction (in blue)

When aimed properly, the target will fall down along the line of the skewer. (in blue) Then, another target is spawned and will fall vertically. (in red)

When aimed successfully again in a streak, the second target will fall along the skewer and stacked. Same process over and over when another target is spawned.

However, when I test run it on the scene tab in Unity, when impaled several targets, instead of a smooth flow and stacking it ended up overlaying it instead of stacking it up like a pancake. Here's what it look like:

As I noticed when reaching the half-way of my progress, I tried to figure out how to deal with collider bodies without sticking each other so that it will actually stack like in the example of the image at no. 3. Here's the script code I added in the target game object:

using UnityEngine;
using System.Collections;

public class ImpaleStateTest : MonoBehaviour {

    public GameObject target;
    public GameObject skewer;

    public bool drag = false;

    private float stack;
    private float impaleCount;

    void Start () {
        stack = 0;
        impaleCount = 0;
    }

    void Update () {
        if(drag) {
            target.transform.position = new Vector3 (DragTest.dir.transform.position.x, DragTest.dir.transform.position.y - 0.35f, 0);
            target.transform.rotation = DragTest.degrees;
            target.rigidbody2D.fixedAngle = true;
            target.rigidbody2D.isKinematic = true;
            target.rigidbody2D.gravityScale = 0;

            if(Input.GetMouseButton(0)) {
                Debug.Log ("Skewer: " + DragTest.dir.transform.position.x);
                Debug.Log ("Target: " + target.transform.position.x);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D collider) {
        impaleCount++;
        Debug.Log ("Impaled " + impaleCount + " time(s)!");
        drag = true;
        audio.Play ();
    }

}

Aside from that, I'm not sure if it's right but, the only way to stick the impaled targets while dragging the skewer left or right is to get the X coordinates from the skewer only. Is there something else to recommend it in order to improve this behavior as realistic as possible? Please help.

sentences:
Are there copyrights for board game Risk and can I make the game, or similar, for mobile? are there copyrights for board game Risk? It's popular and with lots of versions floating around, so I don't know if someone has rights or just for specific version. I'm not planning to make money with it, it would be a free game. If not, can I make something similar to that, and how much do I need to change it? I like the game a lot, it's for fun and learning purpose.
Thx in advance :)

sentences: HLSL problem with divide by homogeneous component When I try to divide my position.z by my position.w in HLSL I get as result always 1.0f or higher. Is this a common problem for some reason? When I divide my position.x or y by the w this works fine. But the divide for the z gives a wrong result. I use the view matrix for my camera and the projection matrix as i use it in the game because I want to create a depthmap from the cameraposition. Can anybody explain what I'm doing wrong? Do I need another view matrix?

sentences:
Getting distance between point of an object and another object in Unity First, I'd like to apologize because this is a very basic and repetitive question, but I am completely new to game development.

I understand that I can find a distance between two objects using:

float dist = Vector3.Distance(other.position, transform.position);

However, how can I find the distance between a point of one object to other object?

For instance let's say my object is this sphere

Now, how can I return an array that says that there are no objects to the left (null), in the front there is an object at 1, and to the right there is an object at 0.5?

Thank you for your patience and understanding

sentences:
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:
Simple project - make a 3D box tumble and fall to the ground Possible Duplicate:
  Resources to learn programming rigid body simulation

Hi guys,

I want to try learning rigid-body dynamic simulation. I have done a fluid and cloth simulation before, but never anything rigid. My maths knowledge is limited in that I don't know the notation that well.

Are there any good cliff-notes, tutorials, guides on how I would accomplish a simple task like this? I don't want a super complex pdf that's only a little relevant.

Thanks.

sentences:
Factors to consider when building an algorithm for gun recoil What would be a good algorithm for calculating the recoil of a shooting guns cross-hairs?

What I've got now, is something like this:

Define min/max recoil based on weapon size
Generate random number of "delta" movement
Apply random value to X, Y, or both of cross-hairs (only "up" on the Y axis)
Multiply new delta based on time from the previous shot (more recoil for full-auto)

What I'm worried about is that this feels rather predicable, what other factors should one take into account when building recoil? While I'd like it to be somewhat predictable, I'd also like to keep players on their toes. I'm thinking about increasing the min/max recoil values by a large amount (relatively) and adding a weighting, so large recoils will be more rare -- it seems like a lot of effort to go into something I felt would be simple.

Maybe this is just something that needs to be fine-tuned with additional playtesting, and more playtesters? I think that it's important to note, that the recoil will be a large part of the game, and is a key factor in the game being fun/challenging or not.

sentences:
Colour intersection of two alpha-blended sprites In XNA, is it possible to merge two alpha blended sprites so they look like one contiguous shape, eliminating the merge of colour at the overlap? At the moment when I try, the intersection is quite visible:

I'd like it to look more like this mockup:

This is the drawing code for this example, but it's similar to what's being used in the actual game:

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

        spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null);

        for (int x = 10; x <= 1000; x += 10)
            for (int y = 10; y <= 1000; y += 10)
                spriteBatch.Draw(Content.Load<Texture2D>("dot"), new Vector2(x, y), null, Color.Gray, 0, Vector2.Zero, 1, SpriteEffects.None, 0.1f);

        spriteBatch.Draw(Content.Load<Texture2D>("circle"), new Vector2(200, 200), null, Color.FromNonPremultiplied(255, 255, 255, 50), 0, Vector2.Zero, 1, SpriteEffects.None, 0.5f);
        spriteBatch.Draw(Content.Load<Texture2D>("circle"), new Vector2(300, 200), null, Color.FromNonPremultiplied(255, 255, 255, 50), 0, Vector2.Zero, 1, SpriteEffects.None, 0.5f);

        spriteBatch.End();

        base.Draw(gameTime);
    }

I suspect the answer is somehow combining the textures before passing them to the spritebatch to be drawn, but I'd prefer to avoid that if at all possible.

Thanks for any help!

sentences:
How should I implement an Observer patter in the following example I am wondering how I implement an observer pattern in the following example. I am mostly wondering what should be in charge of subscribing.

The Example

A factory produces cars (Observable), they drive from A to B. Once at B the car has finished.  The scoreboard increases by +1 (Observer).

The Solution?

Option A.) The factory spawns a car, it then calls a method to subscribe the car to the scoreboard

observableCar.FinishedEvent += observerScoreboard.HandleEvent;

Option B.) Should the cars on being created register / tell the the scoreboard to subscribe itself to it the cars finishedEvent()

this.FinishedEvent += observerScoreboard.HandleEvent;

Option C.) The scoreboard is subscribed to a 'carSpawned' event on the factory. On recieving this event it then subscribes itself to the cars finishedEvent(). It then unsubscribes.

Option D.) I am missing something fundamental about the observer pattern, do more homework

I'm thinking its something more akin to option C? I'm not sure.

Thanks very much

Jim

sentences:
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:
Choosing size of frustum based on objects I would like to show camera frames using OpenGL and rotate the frame in 3D. The frame is placed at (0,0,-frameDepth), and will rotate about the origin.

Should I decide the size of frustum based on the frame size, or decide the frame size based on frustum? I would like the frame to cover as much of the screen as possible (maintaining camera aspect ratio), and rotate about the center to say maxPitch, maxRoll amount.

Specifically which of the following make more sense?

    /* (frameWidth, frameHeight) is calculated based on */
    screenWidth = displaySurface.getWidth();
    screenHeight = displaySurface.getHeight();
    float screenAspect = screenWidth / screenHeight;

    float l = -screenAspect, r = screenAspect, t = 1.0f, b = -1.0f, near = 1.0f, far = 10;
    frameDepthZ = 5f;

    Matrix.frustumM(projectionMatrix, 0, l, r, b, t, near, far);

    frameWidth = (r - l) * frameDepthZ / near; // fill the width of screen
    frameHeight = frameWidth / inputCamera.getCameraAspect(); // assign height based on above width and camera aspect

Or,

    /* frustum parameters are calculated based on (frameWidth, frameHeight)*/
    screenWidth = displaySurface.getWidth();
    screenHeight = displaySurface.getHeight();
    float screenAspect = screenWidth / screenHeight;

    frameWidth = inputCamera.getWidth();
    frameHeight = inputCamera.getHeight();

    float l = -frameWidth/2, r = frameWidth/2, t = r / screenAspect, b = l / screenAspect, near = 1.0f, far = 10;
    /*the above values don't work, and I can't figure out how to get my frame to fit to the screen. But hypothetically, if these were right, is this the right way to go about it?*/
    frameDepthZ = 5f;

    Matrix.frustumM(projectionMatrix, 0, l, r, b, t, near, far);

Image of Camera frame rendered to screen using method 1

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:
Is there a book describing how old-school 2D games were programmed? This fellow over on Stack Overflow has many questions on how 8/16-bit era games were programmed. I'd like to point him at a basic primer on how game loops worked, static entity arrays and rendering loops and the like; but I don't know of any such book. (And it's been so long since I was there that I've totally forgotten how I learned in the first place.)

Is there any book describing how those old cartridge games were built; or in general any single resource I can point people at for native game programming basics?

sentences:
In Unity/UNet: How do you properly spawn a `NetworkPlayer`? In Unity/UNet:
How do you properly spawn a NetworkPlayer? Right now, I'm doing it like this from inside a NetworkManager derived class:

   public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId) {
        NetworkPlayer newPlayer = Instantiate<NetworkPlayer>(m_NetworkPlayerPrefab);
        DontDestroyOnLoad(newPlayer);
        NetworkServer.AddPlayerForConnection(conn, newPlayer.gameObject, playerControllerId);
   }

This code snippet works pretty well and both clients can communicate with each other. However, there are a few little issues that arise only on the host:

In Unity's hierarchy-view on the host, there are only two NetworkPlayer instances. Shouldn't there be four NetworkPlayer instances on the host? Two client instances and two server instances? If so, do you have any ideas what could cause the missing NetworkPlayer instances?
The two NetworkPlayer instances have both, their isClient and isServer flags set to true. But only one of the has it's isLocalPlayer flag set. Now I wonder if this behavior is as intended? And if so, how do you distinguish between the client and the server instance of a NetworkPlayer?
Two player behavior: If the remote client sends a [Command] that changes a [SyncVar] on the server, then on the host, the [SyncVar]-hook is called only on the NetworkPlayer instance that represents the remote NetworkPlayer. The [SyncVar]-hook is not called on the host's "isLocalPlayer-NetworkPlayer" instance. Shouldn't the [SyncVar]-hook be called on both NetworkPlayer instances?

Any advise is welcome. Thank you!

sentences:
Why does my tile palette not arrange nicely? I made my own Hex Point Top Tile sprite sheet, ensuring it's pixel perfect and align well. Slicing in Sprite Editor has no problem too. However, when I drag the sprite sheet to a new Palette in the Tile Palette panel, the tiles show up with random spaces. See screenshot below:

What did I miss?

The sprite sheet is here, 30 x 30px offset, 24 x 24px padding, 66 x 66px tile size:

I'm using Unity 2019.3.10f1.

sentences:
Creating A Bounding Box around each item in a list XNA 4.0 I have asked a similar question before except i am more experienced and have more understanding of XNA. I have bullets that shoot whenever you press RightTrigger. I am having trouble though creating bounding boxes around each bullet in the list though. I want to have this so you can shoot the man and when he is hit he will die, except for some reason no bounding boxes are being drawn.
I have updated this now because im trying the same method in a platformer after i gave up on the shooter game because i gave up on it because i couldnt get the collision detection right. Now im trying this method again and am having trouble. The thing is, it does work but only on the last ground piece added to the list. Here is the code for the collision detection in the Game1 class:

OLD CODE (DISREGARD)

public bool hitBullet()
    {

        foreach (Bullets bullet in bullets.bulletAmm)
        {
            bulletRect = new Rectangle(
                (int)bullet.position.X,
                (int)bullet.position.Y,
                bullet.size.X,
                bullet.size.Y);

            manRectangle = new Rectangle(
                (int)man.position.X,
                (int)man.position.Y,
                man.pistolTexture.Width,
                man.pistolTexture.Height);
        }

        return bulletRect.Intersects(manRectangle);
    }

NEW CODE (PAY ATTENTION)

 public bool HitGround()
    {
        foreach (Ground newGround in ground.groundAmmount)
        {
            groundRectangle = new Rectangle(
                (int)newGround.position.X,
                (int)newGround.position.Y,
                newGround.shortTexture.Width,
                newGround.shortTexture.Height);

            iceBoyRectangel = new Rectangle(
                (int)iceBoy.position.X,
                (int)iceBoy.position.Y,
                iceBoy.texture.Width,
                iceBoy.texture.Height);
        }

        return groundRectangle.Intersects(iceBoyRectangel);
    }

now the same method of

    foreach (Bullets bullet in bullets.bulletAmm)

or
        foreach(Ground newGround in ground.groundAmmount);

works for updating and drawing each bullet which works. but not for the bounding boxes. Any suggestions?

EDIT 1:

i noticed now that this method works sometimes, but only for about 1 in every 20 bullets which makes this even stranger.

EDIT 2:

i thought that i had solved this issue but it turns out i havent. I have updated the code to what it is now.

sentences:
Reducing total file size of multiple Unity games Our product consists of many small stand-alone games, some made in Unity and some made in other languages. These games can be launched from a hub. The file size of the Unity games is quite large, since each game is being build to work as a stand-alone game. When looking inside the folders, I can see that many of the files, folders and dlls are the same, so I thought that it would be possible to re-use these across all the games to reduce the file size of our installer.

So far I have successfully moved the games' exe and _Data folders into one folder so they can re-use the MonoBleedingEdge and UnityPlayer.dll, but I was hoping to be able to share even more resources than this. All the games are built using Unity 2019.1 and all of them are using many of the same libraries and dlls.

Does anyone have experience bundling many Unity games like this? Is there some configuration for Unity that will help with allowing shared resources?

sentences:
How to fuse 2 sprites as they approach each other in Unity2D? Hi i seen this video by Sebastian Lague on ray marching. Link: https://www.youtube.com/watch?v=Cp5WWtMoeKg&t=204s At 3:19 mins.

I want this merging effect but for 2D sprites. Please can someone instruct me on how it can be made or the steps to make it.

sentences:
Monogames Most efficient way of checking intersections between multiple objects I've created a top-down shooter with multiple objects such as enemy AI (tanks), walls, power-ups etc.

At first I was able to create about 300 AI units which aims to move the player character, checks for collision and shoot a bullet. This bullet also checks for collision on each frame until it encounters an intersection to be destroyed.

I wasn't long after I encountered massive performance issues. I immediately identified that the main performance drop was caused by the collision detection.

Each object's bounds is represented by a rectangle. If this rectangle intersects with any other rectangle the collision event is raised.

I'm currently unsuccessful in deciding what to do to reduce performance, but still maintain all the characters' capabilities. I want to check if the player or AI will collide with any object before it moves to the given location. I also want to check when the bullet collides with any other object.

I'm currently flagging all my objects by using different interfaces. I then created a Dictionary>> (GroupedObjects) Dictionary that filters the objects into different flags where the first type represents the interfaces the object inherited and the second type identifies the object's type. For e.g. I check only the Hostile tanks of type AITank for collision with the bullet. GroupObjects[Hostile][AITank].

I've read that I need to create trees where collision is only checked with all the objects in the current tree.

After a few benchmarks I identified that checking collision between 1 million rectangles uses 38ms on the CPU and checking the distance from a fixed point to 1 million other points take 136ms.

QUESTION

With the benchmarks above in mind, how would I group objects by their range (for e.g. within the screen size) if calculating the distance takes more processing than checking the intersection with a rectangle representing the screen?
What will be the most efficient way to check for collision between objects, meaning the player checks for collision AND the AI tank checks for collision since both of them can't move through the walls? Keep in mind that the AI isn't static and moves on each frame. Also, object A checks for collision between itself and object B and object B checks for collision between itself and object A.
I created an object called CollisionMap that contains points, that represent collision, generated by an image with a specified colour as collision. These points need to be updated every time an object moves and an other object needs to check for collision with this object's CollisionMap (that can contain hundreds of points). I've created this CollisionMap to represent shapes that isn't rectangular or circular so that colliding object will treat each intersection according the shape of the shape. Does this sound possible to process if you have hundreds of objects with hundreds of points representing collision?

I'm new to game dev and I have no idea on what's the most efficient way to check for collision between multiple objects. And for all the algorithms (AABB, Rays) I've seen: it's only for one object or it's still too inefficient...

P.S. I know I typed allot, but I'm trying to explain my problem so that I don't get referenced back to sources I already examined and show what I've tried.

Thanks in advance!

sentences:
Duplicate a Prefab as a separate asset in Unity 5.2 I have a Asset which is a collectable object [Pickup] and I currently have eight in my scene, I'd like to duplicate this asset and use it to harm the player [Bad Pickup].

I decided to duplicate the asset because I wanted both assets to have the same components (Animation script, rigid body, mesh colider, etc...). However, when I edit the texture of my new asset [Bad Pickup], it changes the texture used for the original asset [Pickup] as well.

I've tried GameObject -> Break Prefab Instance on the object with the new asset but it doesn't appear to make a difference.

Is there a way to break this instance so that I don't have to make a completely new GameObject and add the same components manually?

sentences:
How to change the start position of my 2D game I am trying to create a game where you have to move a ball on a platform. At the start of the game, the ball is dropped on the platform and then you can move it around. This is al working, no problems here.

To keep the overview, the ball is centered in the middle of a div. When you move the ball you actually move the platform (giving the illusion the ball moves). This function should stay as it is. The platform is build in javascript as follows:

var levels = [
    [
        [1,1,1,1,1],
        [1,1,1,1,1],
        [1,2,1,1,1]
    ]
];

Where 1 = green tile, 0 = no tile and 2 is a yellow tile.

When loading the level it will generate the first tile (in this case the first 1) in the center of the div, then the next one and the next, etc. Al good so far, but if I change the first 1 tile to a 0 tile (= no tile), it will generate the platform, but since the platform is created in the middle of the div and since 0 is no tile, no tile will be generated and the ball will fall endlessly.

This is no good, I want to have different platforms and not always start with a 1 tile at this position. So I figured to make a "start tile". This is the yellow 2 tile. The idea is that this tile is the tile that always should be shown in the middle of the div at the start of a game, so that the ball always drops on the yellow tile. Therefore the whole platform should be moved at game start/load in order to center the yellow tile.

And this is my problem. How to do this?

I hope my problem is clear. I've also made a fiddle (click the 1 to start the game), so you can try things out

Many thanks

ps so in short:

Ball always drops in middle (must stay this way)
Yellow "start tile" should be moved/centered in the div, so the ball drops on it at game start

pps: The yellow tile can have a different position, it depends on the platform design

sentences:
Hardcode per-instance properties into the shader in unity I am using one of the packages from the asset store and using its Polyline feature for wire rendering. There are thousands of wires and its taking much fps/Batch counts. The reason of the lack of support for static batching. Now there is a workaround suggested by the author of the package.

if you don't use polylines for anything other than that, and all your
shaders use the same properties, you could hardcode all per-instance
properties into the shader

Due to a lack of shader knowledge(I am developing the knowledge currently and it will take time) I am unable to hard code the above properties: I tried and here is the current scenario:
#define int _ScaleMode = 1
#define half4 _Color = (0,0,0,0)
#define float4 _PointStart = (0,0,0,0)
#define float4 _PointEnd = (0,0,0,0)
#define half _Thickness = 0.5
#define int _ThicknessSpace = 1
#define half _DashSize = 1
#define half _DashOffset =1
#define int _Alignment =1

HOw do i correctly hard code above values?

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:
My money will only save for one game run I am trying to make a money system my problem is that the money value only saves for 1 game run then the value returns to 0.
Here is my code. What should I do.

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

public class Money : variables {

    public Text cash;

    // Use this for initialization
    void Start () {

        if (counter < 9 && counter > 1)
        {
            money = money + 2;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 10 && counter < 20)
        {
            money = money + 5;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }

        else if (counter > 21 && counter < 30)
        {
            money = money + 15;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 31 && counter < 40)
        {
            money = money + 25;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 41 && counter < 70)
        {
            money = money + 50;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 71 && counter < 100)
        {
            money = money + 75;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 101 && counter < 200)
        {
            money = money + 100;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 201)
        {
            money = money + 150;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);

        }

        cash.text = "Credits: " + PlayerPrefs.GetInt("money", money);
    }
}

sentences:
Pros and cons of different integrators When creating things like physics in games you need an integrator. I've seen Verlet integration mentioned several places as a great alternative to Euler integration. For instance in the famous document by Thomas Jakobsen. However in this article Glenn Fiedler writes:

  Rather than introduce you to the vast array of different integrators that exist, I’m going to cut to the chase and go straight to the best. This integrator is called the Runge Kutta order 4 integrator aka RK4.

So apparently there's no silver bullet. What is the pros and cons of different integrators? Regarding simplicity, speed, accuracy, stability, etc. Which integrators is most suitable for which types of games? When would you use Verlet, RK4 or others? Should you ever use Euler?

sentences:
Displaying (3D) objects' name above them The Elder Scrolls: Morrowind has a rather interesting way to display each focused objects' name. It's all a bit fuzzy in my memory right now, but the most important part I remember perfectly: the object's name is always displayed in the proximity of the object (most of the time on top of it).

My question is: given a 3D mesh, how should I proceed to calculate the name's position on the screen? I'd like to always position it on top of the given mesh for now. Like in this screenshot of Morrowind:

I'm working under Unity, if it helps. The first thing that comes to my mind is to somehow use the distance between the player and each object, then take the object's actual height in consideration, and determine a line in 2D space (the screen) that just "touches" (intersects) the top of the 2D representation of the mesh (what we're actually able to view on the screen). Something like this:

But this feels a bit complicated and clunky, and might not work for characters that are not standing tall for example.

The 2nd thing that comes to my mind: would there be a way to achieve this using matrix multiplication, in the same way 2D representations of 3D objects are obtained?

Thanks!

sentences:
Monogame Dragging 3D object edges I am having trouble rendering 3D models with monogame.
The problem only occurs when I export the object from blender with two materials on it. Example:

Monogame sees those two different materials and renders them correctly.
Here comes the problem.. When you start moving the object around you can clearly see the edges which are with the snow material dragging or glitching. Image to see what I mean:
As you can see the edges on the bottom with the Stone_Normal material appear ok but the edges with the snow material are glitching. This is only happening when you move the object around and it doesn't have to be fast. In this example, I am just rotating the object around its axis.

sentences: What is the best way to draw a big 3D model I am currently using ModelMesh.Draw() to draw the each mesh of the model and thus the whole model. Note that my models are very heavy -- around 30MB of data, I think if there is any other way to draw the models which is more efficient then performance of my application will better.

sentences:
Why does my game not update unless I'm moving the mouse? I'm pretty confused by what's happening. Now that I've finally put something moving on my screen, I notice it doesn't update unless I move the mouse, or press a key, or trigger other events.

Using PIX, the "Frame: #" counter only goes up when I fire these events. This is all that happens in my game loop:

while(GetMessage(&msg, NULL, 0, 0) > 0 && m_isRunning)
{
        TranslateMessage(&msg);
        DispatchMessage(&msg);

        m_gameGraphics->BeginRender();
        m_gameGraphics->EndRender();
}

BeginRender clears the screen, and EndRender presents to the swap chain. I thought maybe it was a problem with WndProc, but comparing it to other DirectX 11 game WndProcs, I don't see any major differences. I'm pretty confused, never seen this problem before, and I have no idea what causes it. I'm just hoping maybe someone will have some insight on why this might be happening.

sentences:
Zoom into character upon collision When a character collides with an object in my game, there is a slow motion effect. That's coool, but how would I zoom into a sprite when it collides with another object?

Here is my code currently...

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

public class GameManager : MonoBehaviour
{
    public float slowness = 2f;

    public int index;

    private AudioSource hitSource;

    public Vector3[] Target;
    public Camera Cam;
    public float Speed = 0.012f;

    public void Start()
    {
        Cam = Camera.main;

    }

    public void EndGame()
    {
        Application.targetFrameRate = 300;

        StartCoroutine(RestartLevel());

        hitSource = GetComponent<AudioSource>();

    }

    IEnumerator RestartLevel()
    {
        Cam.orthographicSize = Mathf.Lerp(Cam.orthographicSize, 3, Speed);
        Cam.transform.position = Vector3.Lerp(Cam.transform.position, Target[1], Speed);

        Time.timeScale = 1f / slowness;

        Time.fixedDeltaTime = Time.fixedDeltaTime / slowness;

           yield return new WaitForSeconds(1.5f/slowness);

        Time.timeScale = 1f;
        Time.fixedDeltaTime = Time.fixedDeltaTime * slowness;

        SceneManager.LoadScene(2);

    }

    private void OnCollisionEnter(Collision collision)
    {

    }
}

sentences:
How do I build interesting mechanics-driven puzzles for my stealth game? I'm currently working on a turn-by-turn puzzle stealth game (as a student group project), inspired by Tiny Heist. The basic mechanic is that every time the player moves a square / does a thing, every NPC moves as well.

My objective is to make an experience similar to Portal: the player goes from room to room, each room has an entrance and an exit, with obstacles between them. The player can see where the exit is, as well as the obstacles, and must leverage the game mechanics to bypass the obstacles and reach the exit.

An example room would be:

There is a corridor, with a guard going back and forth. The exit is at the end of the corridor.
There is a closet in the middle of the corridor.
The player must exploit the guard's patrol to hide in the closet, let the guard pass him by, get out of the closet and reach the exit.

I want the player to feel perplexed when they're trying to solve the puzzle; ideally, I want them to feel there is a solution just within their grasp, but they can't find it; and I want them to feel smart once they do solve the puzzle.

The problem is, I don't know how to design puzzles to give that experience. I have a few ideas, some of which feel like they'd make fun "early game" levels, but after a while all the levels I'm sketching feel same-y and boring, or too complicated with too many moving parts (I had the same problem back when I tried to design Portal 2 levels).

I want to create dependencies, levels where the mechanics overlap with one another to make the player think "I need to do X, but I can't do X before I've got Y, but how do I do Y without having done X?". I could add additional mechanics like dogs, or security cameras, but I don't know how to exploit them.

When I try to design a level, the kind of ideas I come up with follow a pattern of "you need to turn off the cameras to progress, but you need to give a bone to the dog to reach the camera, but you need to distract the guard to acquire the dog". These ideas are convoluted, but shallow; they don't feel like they'd make for intellectually stimulating (or even difficult) levels.

What methodology or design pattern can I apply to create richer problem-solving opportunities for the player in this stealth game context, or in any kind of puzzle game?

sentences: How to find a valid point if NavMeshObstacle is blocking path? Is there any way to find the closest valid point to my target if a NavMeshObstacle is blocking my agent's path? This point can be any point along the red line in the image above.

sentences:
How do game developers target multiple platforms (Xbox 360, PS3, PC and Linux)? How do game developers target multiple platforms at once?  For example, Xbox 360, PS3, PC and Linux.  For 2D games, is it possible to also target the iPhone?  I'm be interested in engines used (2D/3D, etc), how the build pipeline is setup and generally how much of the "core code" can be centralized without having to write platform specific code branches.

Or, if completely separate code trunks are usually maintained for each platform, how are libraries / code reused (in terms of linking and modularization)?

sentences:
GLSL - std140 uniform block - fields(vec, float, mat4) always 0.0 Ok,

First of all, if just use uniforms everthing works like it should. Switching to uniform blocks nothing goes, as all values look like 0.0.  I tested this with various if-then-else stuff within the vertex shader and modifying the output color.

According to CodeXL 1.3(here the data is listed as VBO, but I think this is only cosmetic), GL.BindBuffer with GL.MapBuffer, or GL.GetBufferSubData there is really the proper data within my ubo but nonetheless the uniform block in the shader contains 0.0 only.

workflow:

    //Create UBO
    BufferUBOName = new int[2];
    GL.GenBuffers(2, BufferUBOName); // Generate the buffer
    BufferIndex = 0;

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]); // Bind the buffer for writing
    GL.BufferData(BufferTarget.UniformBuffer, (IntPtr)uboWorldData.SizeInBytes, IntPtr.Zero, BufferUsageHint.StreamDraw);  // Request the memory to be allocated
    GL.BindBufferRange(BufferRangeTarget.UniformBuffer, BufferIndex, BufferUBOName[0], IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes); // Bind the created Uniform Buffer to the Buffer Index

Creating and linking the shaders works fine and gives the following ouput :

GL   4.3
GLSL 4.30
Shader: basic_fs ok
Shader: basic_vs ok
ShaderProgram :hexgrid [ basic_vs, basic_fs ]
    Active Uniform Block : UboWorld
      Size         : 144
      BlockBinding : 1
      BufferPoint  : 0
        Name : UboWorld.time
          Type[n] : Float [4]
          Offset  : 0
        Name : UboWorld.screenwidth
          Type[n] : Int [4]
          Offset  : 4
        Name : UboWorld.screenheight
          Type[n] : Int [4]
          Offset  : 8
        Name : UboWorld.promat
          Type[n] : FloatMat4 [64]
          Offset  : 16
          matrix stride: 16
        Name : UboWorld.mvpmat
          Type[n] : FloatMat4 [64]
          Offset  : 80
          matrix stride: 16

    // Done after successful program linking
    uniformBlockIndices["ubodata"] = GL.GetUniformBlockIndex(shaderprog.Handle, "UboWorld"); // Gets the uniform variable Location
    if (uniformBlockIndices["ubodata"] != -1)
        GL.UniformBlockBinding(shaderprog.Handle, uniformBlockIndices["ubodata"], BufferUBOName[0]);

Then VBO / VAO are created and working fine, incl. drawing elements.

On UpdateFrame the UBO data will be processed like:

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]);
    GL.BufferSubData(BufferTarget.UniformBuffer, IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes, ref uboWorld);

The offsets are taken from the information after program linking and reading the various values for the UniformBlockActiveUniforms. I skip the output here as the struct should reflect it properly.

    [StructLayout(LayoutKind.Explicit)]
    struct uboWorldData
    {
        [FieldOffset(0)]
        public float time;
        [FieldOffset(4)]
        public Int32 screenwidth;
        [FieldOffset(8)]
        public Int32 screenheight;
        [FieldOffset(16)]
        public Matrix4 projectionMatrix;
        [FieldOffset(80)]
        public Matrix4 modelviewMatrix;

        public static readonly int SizeInBytes = 144;
    };

Vertex shader for testing:

    #version 400
    in vec3 in_position;
    in vec3 in_normal;
    out vec3 normal;
    out vec3 colortime;
    out vec3 colortimeubo;

    // These uniforms work
    uniform mat4 mvpmat;
    uniform mat4 promat;
    uniform float time;

    // This compiles fine. But always 0.0
    layout(std140) uniform UboWorld {
        float time;
        int screenwidth;
        int screenheight;
        mat4 promat;
        mat4 mvpmat;
    } w;

    const float pi = 3.1415;

    void main()
    {
      // This uses the UNIFORM FLOAT
      colortime = vec3(abs(sin(time * 360.0 * pi / 180.0)), 0.3, 0.3);
      // Here the uniform UboWorld
      colortimeubo = vec3(abs(sin(w.time * 360.0 * pi / 180.0)), 0.3, 0.3);

      normal = (mvpmat * vec4(in_normal, 0)).xyz;
      gl_Position = promat * mvpmat * vec4(in_position, 1);
    }

Any hints why w.time and also w.mvpmat or w.promat are always zero filled ???

sentences:
Separating axis theorem implementation flaky minimum translation vector based on triangle orientation I've implemented some collision detection using separating axis theorem. Works fine for axis-aligned rectangles and two out of four possible right triangle orientations. For some reason when the hypotenuse is oriented down left or up right, the minimum translation vector being calculated is that of the normal of the base or height of the triangle rather than the hypotenuse that is being collided with.

http://i.stack.imgur.com/W5WHH.png

I've got a jsfiddle demo of my implementation. The center box and right side triangles all show a correct MVT when the collision box collides with them. The ones on the left side do not. Move your mouse over the canvas to move the collision box.

http://jsfiddle.net/XLtdB/

sentences: Blender Video Sequencer: I try to load 76 images, but length is 48 frames, can't change In Blender 2.8, I am trying to load a sequence of already-rendered images from a previous project I did (also in 2.8, but hey, these are just .png's) into the image sequencer. I set the frame rate in the render context menu from 24fps to 30fps, which seems to have no effect on the video sequencing window, because the markers for 1 second are stuck at 24 frames. Anyway, when I try to load all 77 frames of my animation into the VS as an image sequence, I get an animation that is only 48 frames long. I can scrub through the entire sequence, but the frame count does not match the number of images in the sequence--and I can't change it. I can't even stretch the animation out. What the heck? Can somebody explain how I can make this work properly?

sentences:
Identify objects of the same type from each other, even between game restarts? So I have a simple Character class:

class Character:

    def __init__(self, type, level, health, items=None):
        self._type = type
        self.level = level
        self.health = health
        self.items = items if items is not None else []

    def __getattr__(self, attr):
        return getattr(self._type, attr)

And a CharacterType:

class CharacterType:

    def __init__(self, name, max_level, max_health):
        self.name = name
        self.max_level = max_level
        self.max_health = health

    def new(self, *args, **kwargs):
        return Character(type=self, *args, **kwargs)

This allows me to easily spawn multiple instances of the same character type:

t_dragon = CharacterType('Dragon', 30, 2080)
t_mage = CharacterType('Mage', 100, 610)

dragon0 = t_dragon.new()
dragon1 = t_dragon.new(health=437)  # Damaged one
mage0 = t_mage.new(level=50)

But now I need to store these into a database table, and be able to somehow identify the character's type. I can't create a separate table for each type, since these types will be manageable by designers through JSON and thus new types can be added dynamically and old types be removed. So as it stands now, the above characters would populate the character table like so:

 id | level | health | type_identifier
----+-------+--------+-----------------
 0  | 0     | 2080   | ????
 1  | 0     | 437    | ????
 2  | 50    | 610    | ????

I would highly prefer if there's a solution which doesn't require the designers to have to come up with an unique ID themselves, so while something like this would work, where the designer comes up with an unique ID:

{
    "name": "Dragon",
    "max_level": 30,
    "max_health": 2080,
    "unique_id": "#dragon_2017-04-12"
}

and keeps it even if they change the character's name, it's very bothersome to have to maintain something like this in the JSON itself.

How can I get a string/integer/value to identify the character types (Python objects) from each other, in a consistent manner between server restarts, without the designer having to manually come up with an unique ID?

sentences:
How to generate doorways procedurally, on the fly, and guarantee acessibility I'm currently creating a spaceship exploration game, and I have a massive problem I've been trying to solve for months, and through the rest of my group deciding to opt for a rewrite to fix some massive spaghetti.

Anyway, the problems goes as follows:

The player starts in a room, from which they can travel to some other adjacent rooms through doorways.

These doorways are stored in a map of the direction they're in, and the doorway object they reference. Each Doorway object keeps track of the two rooms it links, and will direct the player to each one when necessary.

However, all rooms need to be accessible by at least one route, and going through a doorway on the starboard side means that the other room needs to have the same doorway on the port side. I can do this by just having every wall be a door, but that gets boring to explore.

Pre-generating these proved enough of a glitchy mess for me to fail it, but now, the spec has changed. The world will be theoretically infinite, and as such, the pathing cannot be pre-generated, and instead must be done as new rooms are needed, or expected to be requested soon.

So I need to generate what is essentially a maze, with loops allowed, drawn on a grid, one square at a time, where not only is every room not directly aware the others exist, but acessible from every other. On top of this, going through a doorway on one side of a room means that the same doorway needs to be on the opposite side of the next room.

What's a good way to guarantee all these properties? I am willing to part with rooms having no knowledge of others, but would rather keep it this way for ease of re-generating a room's type later, should that become necessary.

Below is a text file ascii mockup of a 5x5 example I created
https://pastebin.com/EtdAWAwD
Lines are walls, Xs are doors, and the S is the player starting position.

Any advice at all is appreciated, even on alternate routes to consider for generating these.

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:
Tilemap not rendering properly I'm making a single-screen scrolling platformer (OpenGL/SDL) and I've made a tilemap out of a 2D array, pre-sized with variables of the LEVEL_HEIGHT and LEVEL_WIDTH.  Each element in this 2D array corresponds to a position in the spritesheet that I'm loading from. In my render function, I have the following code to iterate through the matrix,and put each element into a 1D vertex buffer:

for (int y = 0; y < LEVEL_HEIGHT; y++) {
        for (int x = 0; x < LEVEL_WIDTH; x++) {
            if (levelData[y][x] != 0) {
                float u = (float)(((int)levelData[y][x]) % SPRITE_COUNT_X) / (float)SPRITE_COUNT_X;
                float v = (float)(((int)levelData[y][x]) / SPRITE_COUNT_X) / (float)SPRITE_COUNT_Y;
                float spriteWidth = 1.0f / (float)SPRITE_COUNT_X;
                float spriteHeight = 1.0f / (float)SPRITE_COUNT_Y;
                float vertices[] = {
                    TILE_SIZE * x, -TILE_SIZE * y,
                    TILE_SIZE * x, (-TILE_SIZE * y) - TILE_SIZE,
                    (TILE_SIZE * x) + TILE_SIZE, (-TILE_SIZE * y) - TILE_SIZE,
                    TILE_SIZE * x, -TILE_SIZE * y,
                    (TILE_SIZE * x) + TILE_SIZE, (-TILE_SIZE * y) - TILE_SIZE,
                    (TILE_SIZE * x) + TILE_SIZE, -TILE_SIZE * y
                };
                GLfloat texCoords[] =  {
                    u, v,
                    u, v + (spriteHeight),
                    u + spriteWidth, v + (spriteHeight),
                    u, v,
                    u + spriteWidth, v + (spriteHeight),
                    u + spriteWidth, v
                };
                glBindTexture(GL_TEXTURE_2D, sSheetIds[0]);
                glVertexAttribPointer(program->positionAttribute, 2, GL_FLOAT, false, 0, vertices);
                glEnableVertexAttribArray(program->positionAttribute);
                glVertexAttribPointer(program->texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords);
                glEnableVertexAttribArray(program->texCoordAttribute);
                glDrawArrays(GL_TRIANGLES, 0, 6);
                glDisableVertexAttribArray(program->positionAttribute);
                glDisableVertexAttribArray(program->texCoordAttribute);
            }
        }
    }

For some reason, when I run the code, the textures are overlapping between tiles. Consider the following example:

sprite sheet with tiles

2D Array for with the indices into the sprite sheet

int levelData[LEVEL_HEIGHT][LEVEL_WIDTH] = {
        { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
        { 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 },
        { 4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,6,6,6,6,6,6,6,6,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,6,6,6,6,6,0,0,0,0,0,0,0,0,6,6,6,6,6,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,6,6,6,6,6,6,6,6,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,6,6,6,6,6,6,6,6,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0 },
        { 0,5,0,0,0,0,0,6,6,6,6,6,6,6,6,0,0,0,0,0,5,0 }
    };

Tile map being rendered when the game is run

I've tried varying the size of each tile, but the textures just seem to scale up or down accordingly. I think the problem could be with the orthographic projection, but I'm not sure. What is causing the distortion here?

Here is the full code for reference

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:
Should I use Game Engines to learn to make 3D games? HI i am a software engineering student in his second-last year.

I am proficient with C,C++,C# and java programming languages, and being a student of engineering I have studied calculus, vectors etc in both 2D and 3D & various other mathematical, probability and statistical topics.

I have made several 2D games, my most recent being a Super Mario-like game with side-scrolling and multiple levels.

Due to my these small game projects,i have become really interested in making games.

So now i want to move ahead to learn to make games in 3D.

Now I know that there are several game engines available which can take care of rendering details and other "low-level" stuff for me...

My Question is:

1) Is it a good idea to learn to program everything yourself, from making 3D shapes, terrains (using polygons meshes) etc, to programming mechanism for collision detection, lighting etc, considering my motive is to learn how to make games in 3D (but am not too eager to get into the game industry quickly, want to build a solid foundation first)

Or could I do without these details & work on the abstraction-level which the game engines (like UDK) provide ??

3) If I should try to develop from scratch, then  can anybody suggest which API to use: Direct3D or OpenGL?? (which i would be more comfortable with, in light of my above mentioned skills) & can anybody also give me references to some good books, reading materials, tutorials, etc to get me started?? (I wouldn't mind theory as long as it helps me make a sound foundation)

Many Thanx in advance (for even reading my question, i know it's lengthy... but i need a DETAILED answer... :D :D )

sentences:
Unity shader to pick 1 of 2 base colors for individual instances (picture) I am building this scene in 3D using Unity 2019.3.13's Universal Render Pipeline. I have a block prefab that I want to instance, but I want to choose which are yellow and which are blue (you can see the materials are basically the same). How can I write a shader that will allow me to pick either yellow or blue in the editor for each one? Is this possible? What is the most optimal way to make dozens of identical blocks where the color is different for specific instances?

(I would prefer a script to a graph, something with a simple switch/boolean input and hex values:
yellow: e4c658
blue: 32676a

sentences:
How do I draw a scrolling background? How can I draw background tile in my 2D side-scrolling game? Is that loop logical for OpenGL es? My tile 2400x480. Also I want to use parallax scrolling for my game.

batcher.beginBatch(Assets.background);
for(int i=0; i<100; i++)
    batcher.drawSprite(0+2400*i, 240, 2400, 480, Assets.backgroundRegion);

batcher.endBatch();

UPDATE

And thats my onDrawFrame.I'm sending deltaTime for fps control.

public void onDrawFrame(GL10 gl) {
    GLGameState state = null;

    synchronized(stateChanged) {
        state = this.state;
    }

    if(state == GLGameState.Running) {
        float deltaTime = (System.nanoTime()-startTime) / 1000000000.0f;
        startTime = System.nanoTime();

        screen.update(deltaTime);
        screen.present(deltaTime);
    }

    if(state == GLGameState.Paused) {
        screen.pause();
        synchronized(stateChanged) {
            this.state = GLGameState.Idle;
            stateChanged.notifyAll();
        }
    }

    if(state == GLGameState.Finished) {
        screen.pause();
        screen.dispose();
        synchronized(stateChanged) {
            this.state = GLGameState.Idle;
            stateChanged.notifyAll();
        }
    }
}

sentences:
How to detect whether an Object came to sleep at a specific position? I'm currently writing a small game with box2dweb and I need some direction for this: I'm throwing a Box and have to hit a specific place and trigger an event when the object that's been thrown isn't moving anymore, "fell asleep" so to say.

What's the proper way / best practice for this?

I'm currently thinking of asking the b2World whether an Object is within a specific AABB and then wait a few seconds, check if it's still there and then trigger the event. But this seems to me like the roundabout way and the object might still be moving inside of that AABB and eventually even drop out of the AABB.

sentences:
SFML - How to implement a simple 2D lighting system Lately, I've been reading a lot about 2D lighting systems in a game, and have observed just how much lighting can add to a game's graphics appeal. However, as for implementing one of these in SFML, I am clueless. The lighting system I would like doesn't have to be too complex - I don't need things such as shadows. What I would like is something like this, which I made in Java using swing:

How this works:

I draw a black rectangle over the whole image with an alpha that changes based on the in-game time of day - 0 during the day, 128 during the night.
On top of that rectangle, I draw a gradient on top of the player's x and y coordinates - from (255, 255, 255, 100) to (0, 0, 0, 0)

What would be the ideal way to impement this in SFML?

sentences:
Puzzle game: clipping of non-convex polygons on the figures I have an original figure in the SVG file. I need to break it randomly on parts, an example of which is specified below:
I have an idea, to use for partitioning Voronoi diagram (Fortune's algorithm). Can I then change the line of intersection of figures to give them a curvature? Can be obtained to identify each shape as a path?
To create a game I'll be using cocos2d-x.

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 to add a JSON object / model into your whitestorm world / scene? I am loading the object from my json file.

var loader = new THREE.ObjectLoader();
loader.load("blue-car.json",
function ( car ) {
  car.position.set(2, 0, 0);
  car.addTo(world);
 }
);

How can I add the object to my world? In regular three.js it works when I load the json file, but how do I do it in whitestorm?

Update: I tried using the importScene whitestorm method. No errors but it still doesn't show up. Here is an image of logging out a regular plane in whitestorm and the car that is loaded from the json file.

Thank You!

sentences:
Unity Animation Curve to change value over time I am trying to learn how to use AnimationCurve to change a float value over time.

However i am not really sure how to do it

Say i have the following class:

    public class SpiritAway : MonoBehaviour
{
    public List<SkinnedMeshRenderer> MeshList;
    public List<Material> DissolveList;
    public float percentage = 0.0f;
    public bool IsDissolveing;
    public AnimationCurve Curve;

    private void Start()
    {
        percentage = 0.0f;
        for (int i = 0; i < MeshList.Count; i++)
        {
            for (int j = 0; j < MeshList[i].materials.Length; j++)
            {
                if (MeshList[i].materials[j].shader.name == "Dissolve")
                {
                    DissolveList.Add(MeshList[i].materials[j]);
                }
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (IsDissolveing)
        {
            if (percentage < 1)
            {
                    percentage += 0.01f;
                    for (int i = 0; i < DissolveList.Count; i++)
                    {
                        DissolveList[i].SetFloat("_alphaClipDissolve", percentage);
                    }
            }
        }
    }

Now i wish to incrase the percentage value with the percentage of the animation curve to get a more smooth and controlled transition of the value.

Could anyone explain how this is possible?

sentences: Unity Capture And Display Live Camera Feed I want to display the video using the device camera on specific part of the screen on iOS, android and Editor. I was able to find the WebCamTexture which display the camera video on the Quad (3D Object). Now I want to record the video and save it on the disk. Is there are way to do that ? Or is there a better way to do that using unity or through plugin ?

sentences:
What makes a game a game vs something else like a puzzle or a toy? Famously the Sims and similar games have been described by some designers as Toys and not "really" games.

I'm curious if there is a good answer to what makes something a game.

For example many companies sell Sudoku games - EA has an iPhone one, IronSudoku offers a great web based one, and there are countless others on most platforms.

Many newspapers publish Sudoku puzzles in their print editions and often online.

What differentiates a game from a puzzle? (or are all Sudoku "games" misnamed?)

I'm not convinced there is a simple or easy answer - but I'd love to be proven wrong. I've seen some definitions and emphasize "rules" as core to something being a game (vs. "real life") but puzzles have rules as well - as do many other things.

I'm open to answers that either focus only on computer games (on any platform) or which expand to include games and gameplay across many platforms. Here to I'm not fully convinced the lines are clear - is a "game" of D&D played over a virtual tabletop with computer dice rollers, video & audio chat a computer game or something else? (I'd lean towards something else - but where do you draw that line?)

sentences: How to add tiles randomly? I made a set of 10 different "ocean" tiles, all interchangeable with one another, and I'd like to randomly attach these 10 different tiles together in different combinations over a large rectangular area -- what would be the best way to do so? I've thought of just adding each sprite into a script and then calling a for/foreach loop to add it into my world but that seems extremely expensive since I'd be adding over 1000 sprites. I don't want to reduce the number of sprites I have to add, I'm just seeing if there's a typical way people do this sort of thing.

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:
In a multiplayer game, should I store the list of character names on the Player class? I am writing a multiplayer game that has account system and character creation system like standart MMORPGs. I have a question about name creating issue. I think that I can create a static variable on Player class that keeps created player names but it confused me. It will tell me name is valid or unvalid depends on the other players has this name.

Questions;

Does implementation does make sense ?
If i have 1000 players, is it means it consumes 1000 times of memory of this list? Or it just consume as like there is one?
What is your suggestion for place that I can keep player name list? A new class?

sentences:
Why Index Particles? This is a general question, but as a specific example, I'll use the XNA Particles3D sample (http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d).

What is the point of the index buffer in a particle system? If the advantage is indexing repeated vertices, wouldn't only a connected mesh take advantage of these? The probability that the vertices in a particle system will be shared for extended periods of time is extremely low.

sentences:
How do I deal with the problems of a fast side-scroller? I'm making a side scrolling airplane game and when I begin going very fast I begin to experience some problems as a player:

Elements are not distinguishable, like power-ups from bullets, etc
I start to feel dizzy and uncomfortable
There isn't enough time to see what's coming

How can I sort this out? Do I use less details in all the grahpics?

Tiny Wings has the same horizontal movement speed as in my game but it doesn't suffer from these problems. Are there any other really fast side-scrollers I could take as a reference?

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:
How to translate vertex buffer coordinates in 2D I am trying to (using a 2D Directx9 engine library) rotate/translate a set of points in a vertex buffer.

I understand how this would be done in a 3D system - i.e using the vertex shader stage of the rendering pipeline with transformation matricies...

But Im not sure that applies in 2D? (or am I wrong).  I don't know where any of the vertex shader stage happens in 2D? or whether it happens at all.

Basically I can create a transformation matrix using some thing like D3DXMatrixTransformation2D()
and I know how to apply that to an LPD3DXSPRITE object (using Sprite->SetTransform()),  but how can I apply that transformation matrix to a set of 10+ coordinates stored in a vertex Buffer instead of a sprite.

Any help or suggestions would be greatly appreciated.
Thanks

sentences: Problem with modifying dice in another players turn I have the following problem: I want to create a multiplayer game where each player has a turn where he has to roll a lot of dice again and again. But the other players are capable of modifying each single dice with a special action. But since this is a rare action because each player has a limited amount of modifications, I do not want to implement a simple dialog where you have to approve each roll. This would make the game rather sluggish. Any suggestions for the best way to implement a UI which allows to modify every single dice, but makes the game as fast as possible?

sentences:
Unity InputSystem using Unity Events not maintaining values I am testing out using the new Input System and cannot get the values from context.ReadValue<Vector2>() to pass into a private variable.
The simple setup is below:
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    Vector2 leftThumbstickValues;

    void Start()
    {
        leftThumbstickValues = Vector2.zero;
    }

    void FixedUpdate()
    {
        Debug.Log("FixedUpdate: " + leftThumbstickValues); //Always displays "FixedUpdate: (0.0, 0.0)"
    }

    public void Move(InputAction.CallbackContext context)
    {
        leftThumbstickValues = context.ReadValue<Vector2>();
        Debug.Log("Move: " + leftThumbstickValues); //Displays correct values
    }
}

As you can see, in the Move function it correctly pulls the values from the thumbstick, but when it tries to use the values in FixedUpdate it always equals Vector2.zero. It seems like it should just work, but I think I must have overlooked something very simple.
Player Input Settings

Input Action Move Properties

Input Action Left Stick Properties

EDIT: I decided to remove the Player Input component and subscribe to the events in code:
 controls.Player.Move.performed += cntxt =>
 {
     Move(cntxt);
 };
 controls.Player.Move.canceled += cntxt =>
 {
     leftThumbstickValues = Vector2.zero;
 };

This now works as expected. I'm not sure I should mark this as the answer though as it doesn't explain why it doesn't work with the original setup, just offers an alternative solution.

sentences:
Leading a target with edge casting I am trying to write a movement prediction code. I have found the quadratic method with these topics:

[1]: How to calculate shot angle and velocity to hit a moving target?
[2]: http://howlingmoonsoftware.com/wordpress/leading-a-target/

I have implemented this without problems. The problem is how can I add enemy hitbox calculation (I want to fire at edge of enemy for precision)

local cos = targetDirection:dot(toTargetDirection)
local absCos = math.abs(cos)

local sin = math.sqrt(1 - (cos * cos))
local absSin = math.abs(sin)

local cot = cos / sin

local absCot = math.abs(cot)
local delta = 1 - ((cos * cos) + (sin * sin))

local position = targetPosition + targetVelocity * delay
position = position + targetVelocity * network.latency

position = position - toTargetDirection * (target.boundingRadius + width)
position = position - targetDirection * (target.boundingRadius + width)

position = position - toTargetDirection * (absSin * (target.boundingRadius +
width))
position = position - targetDirection * (absCos * (target.boundingRadius +
width))

local toPosition = position - sourcePosition
local toPositionDirection = toPosition:norm()
local spellVelocity = toPositionDirection * speed

local a = targetVelocity:dot(targetVelocity) -
spellVelocity:dot(spellVelocity)
local b = targetVelocity:dot(toPosition) * 2
local c = toTarget:dot(toPosition)

local discriminant = b * b - 4 * a * c

if (discriminant < 0) then
   return
end

local time = 2 * c / (math.sqrt(discriminant) - b)

So far tried this but it's still not casting edge with precision.

sentences:
How to use the unreal "automation spec" with the "automation driver" and latent actions? I would like to be able to create an automated test for Unreal that will load a specific map/level and then use the automation driver, which as I understand it, is a way of faking user input, to do things on that level.
My goal is simply to load my "main menu" level and then exit out of it.
My problem is this:
The documentation shows you how to use the automation driver with the automation spec style of automated test. But none of the automation spec tests in the UE4 source do anything with assets (or anything resembling a latent action, as with the other style of tests). Most of the automation spec tests are more akin to unit tests that have no dependency on data, or AutomationDriver.spec.cpp, which has its own hard coded test UI made using SAutomationDriverSpecSuite
There seem to be no examples at all for using the automation driver with the "simple" or "complex" tests (IMPLEMENT_SIMPLE_AUTOMATION_TEST / IMPLEMENT_COMPLEX_AUTOMATION_TEST), and the automation driver documentation just states that it can be pretty tricky unless you're using it in conjunction with an automation spec

sentences:
Predicting enemy position in order to have an object lead its target In my 2D game I have AI turrets that should assist the player by automatically firing towards enemies. I would like to make them fire intelligently and lead their target instead of just targeting an enemy's current position. So, given the (always constant) velocity and position vector of both the enemy and the turret's projectile, how can I find a vector that represents the actual position the turret must target in order for the projectile to intersect (and hit) the enemy?

Any links to articles that describe the math, algorithms, etc. would be appreciated!

sentences:
How do display a "mucus spreading" effect in a 2D environment? Here is an example of such a mucus spreading. The substance is spread around the source (in this example, the source would be the main alien building).

The game is starcraft, the purple substance is called creep.

How this kind of substance spreading would be achieved in a top down 2D environment? Recalculating the substance progression and regenerate the effect on the fly each frame or rather use a large collection of tiles or something else?

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:
OpenSceneGraph, multiple instances of a model Im working on my first project using OpenSceneGraph. The project is a model flight simulator for one of my university courses,

I want to be able to load airplanes (consisting of multiple models) and then depending on what plane the user/users choose a new airplane (entity) is created that a user controls.

A loaded airplane will have the following structure. Main body and then the rudders/propellers translated using translation nodes to there right positions. There also needs to be a translation node for each of the rudders/propellers used to rotate the rudders depending on player input.

My problem is i dont know how i should structure it so that i dont need to load the whole model once for every instance of the same type of airplane or store the model parts of the airplanes multiple time.

The only thing that needs to be hard copied is the translation nodes so that the different instances of the same airplane can have rudders and things modified separetely from other planes.

If the planes would consist of only one model i would just create a entity class containing a translation node and add the model to that node so that all entities share the same model, but now the planes are more complex so i dont know how i should do it.

So if someone could give me a hint or a suggestion for further read i would appreciate it.

I hope someone understood what i was trying to describe.

Thanks for answers

sentences:
How do I accept only one directional input per update? I'm coding "Snake" as my first game and I'm facing the logical fail when pressing multiple keys simultaneously eg. { up, right}; {up, left}; {down, right}, etc. Snake is able to go back and forth and eat his own body (that's not supposed to be).

My question is how can I write the keypress condition for only one press per one update is allowed?

Thank in advance.

public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
    if (dir == DOWN ) {
        head = new Point(head.getX(), head.getY() + SPEED * delta);
    }
    if (dir == UP) {
        head = new Point(head.getX(), head.getY() - SPEED * delta);
    }
    if (dir == RIGHT) {
        head = new Point(head.getX() + SPEED * delta, head.getY());
    }
    if (dir == LEFT) {
        head = new Point(head.getX() - SPEED * delta, head.getY());
    }

}
public void keyPressed (int key, char c) {
    if ((key == Input.KEY_LEFT) && dir != RIGHT) {
        dir = LEFT;
    }
    if ((key == Input.KEY_RIGHT) && dir != LEFT) {
        dir = RIGHT;
    }
    if ((key == Input.KEY_UP) && dir != DOWN) {
        dir = UP;
    }
    if ((key == Input.KEY_DOWN) && dir != UP) {
        dir = DOWN;
    }

}

sentences:
Allegro 5 compiling with GCC on mac I have the following code from a tutorial and i am trying to compile it on a mac using g++/gcc however every time it complains about the native dialog but i am referencing the library correctly i think

#include<allegro5/allegro.h>
#include<allegro5/allegro_native_dialog.h>

int main()
{
ALLEGRO_DISPLAY *display;

if(al_init())
    al_show_native_message_box(NULL, NULL, "Error", "Could not initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR);

display = al_create_display(800, 600);

if(!display)
    al_show_native_messagebox(NULL, NULL, "Error", "Could not create Allegro 5 display", NULL, ALLEGRO_MESSAGEBOX_ERROR);

al_destroy_display(display);

return 0;
}

The error i get is

main.cpp: In function ‘int _al_mangled_main()’:
main.cpp:17: error: ‘al_show_native_messagebox’ was not declared in this scope

And the command i use is

g++ -o main main.cpp -lallegro -lallegro_main -lallegro_native_dialog

I have also tried with

g++ -o main main.cpp -lallegro -lallegro_main -lallegro_dialog

Any help would be great.

Thanks

sentences:
Ogre3d 2.1 - How to apply texture on mesh? I have searched forums and tried to read the Ogre 2.1 samples, but I still have no clue how to apply texture on mesh  :(

Here what I've done so far.

I use Easy Ogre Exporter to export the scene (actually I just need the model and texture). I got the following files:

modelRoot.mesh
modelRoot.skeleton
model.material
model.tga

Note: I also use OgreMeshTool_d.exe to upgrade the mesh from v1 to v2.

I render this model into Ogre:

In the file resources2.cfg:

[Essential]
Zip=../Data/DebugPack.zip

I add the model files (4 files I got from Easy Ogre Exporter at step 1 above) into DebugPack.zip file.

And I use this code to add the model into the Ogre scene

void MeshHelper::CreateMesh(Ogre::String szFileName, Ogre::Vector3* scale)
{
    /*Bring the mesh to scene*/
    m_meshItem = m_sceneManager->createItem(szFileName,
        Ogre::ResourceGroupManager::
        AUTODETECT_RESOURCE_GROUP_NAME,
        Ogre::SCENE_DYNAMIC);
    m_meshSceneNode = m_sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)->
        createChildSceneNode(Ogre::SCENE_DYNAMIC);
    m_meshSceneNode->attachObject(m_meshItem);
    if (nullptr != scale)
        m_meshSceneNode->scale(scale->x, scale->y, scale->z);
}
...
meshHelper.CreateMesh("modelRoot.mesh", &meshScale);

But I can only render the model without texture  :(

Please help me to apply these texture into my model

model.material
model.tga

Thanks for reading :)

sentences:
Map tile terrain transitions with 3-4 different types Making transitions between two different tiles is a fairly well understood problem. The easiest way is to look at the 0.5, 0.5 and use the resulting 4 corner points to select a transition tile, as mentioned here for example: http://playtechs.blogspot.se/2007/04/tileset-design-tip.html

The problem comes when three or four tiles meet, for example:

(s for swamp, p for plains and . for water)

pppp
..sp
..pp

If we look at the offset in the corner, the edges in our transition tile looks like:

pp
.s

In this case there are no suitable transition tiles to be found, as they typically are created to work between 2 types only. Unless we work out a three way transition tile with these types, we appear to be stuck.

I'm well aware of this often referenced article on the tile transitions in Artifact: http://archive.gamedev.net/archive/reference/articles/article934.html

But looking at the actual screenshots from that game, it doesn't seem like it will yield professional looking maps: http://www.samugames.com/artifact/screenshots.htm

Aside from using intermediary tiles (which frankly would be problematic since two out of grassland/swamp/desert would then not be able to border directly to water), are there any solutions?

EDIT

I think I've found a solution that can will create terrain transitions for 3-4 different types, using only one extra transition tile to each set of transition tiles. I've yet to make an implementation of the algorithm, but the mockups look fine. This solution will work well for pixel art.

sentences:
When should design give way to marketing and vice versa? When should a Designer draw the line in design decisions when marketing does step in?

Where should the bounds be set?

(For most part I know this is might mostly be situational. Gut feel like thing. But would like to get some inputs on this as well)

sentences:
Randomly instantiate avoiding overlapping in Unity 5 I'm starting a 2D game where I want all the letters A-Z displayed in a random position and, then, the player collects them all in the correct order.
I need to randomly instantiate the letters without overlapping. I use C#.

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:
How do you know when you are ready for game programming? I've been programming for a while now and I want to make games or game engines. But I don't really know how much of programming one does need to learn to have the proper knowledge to make games. My question is, how hard it it really ? And what is the proper knowledge of programming when you're getting started ?

I've programmed mostly in C#, Java and C++.

sentences:
Offscreen waypoint indicator using X and Y screen position I was wondering how I could achieve an offscreen indicator effect that helps direct the player to the next waypoint.  My game is 3D, most solutions I have found are for 2D games (i.e Asteroids).
See this example of Warzone.  I have highlighted the parts that I am interested in creating.

The engine I am using has an API call to convert from world to screen position.  This only returns the X and Y components though.  Do I need the Z component to achieve what I am after?
From what I understand so far:

Check if target is off screen
If off screen convert 3D world position to 2D screen position (only X and Y components)

The Math for snapping the 2D UI icon to the side of the screen so it moves around is where I get lost.  I read something about slope intercept is something that can solve this but am not sure how to apply it to my problem.
If it helps I will be writing this in JavaScript, however, I'm not after a language specific solution, am really interested in understanding the Math so I can write it myself for any language.

sentences:
How to properly overflow 2D coordinates on an overflowing/circular map? I made a simple Snake game designed for trying Snake bots. I thought the base map functions work, but now I found there is an error. What I need is to properly translate any coordinates outside the actual map to coordinates within it.
For example, if you're at the right edge of a 10x10 map and you go to (zero-indexed) [10, 5], you'd expect to pop out at [0, 5]. That works in my implementation, but not the negative overflow. I tried a lot of formulas in the dev console and just can't figure it out. Consider this code:
    /**
     * Normalizes overflow of a point so that it is within the map
     * @param {number|Vector2} x
     * @param {number} y
     * @returns {Vector2}
     */
    normalizePoint(x, y) {
        if (x instanceof Vector2) {
            y = x.y;
            x = x.x;
        }

        // auto overflow
        if (x >= this.size) {
            x = (x % this.size);
        }
        else if (x < 0) {
            // ???
        }
        if (y >= this.size) {
            y = (y % this.size);
        }
        else if (y < 0) {
            // one of the formulae I tried, does not work for all values
            y = this.size + (y-1) % this.size;
        }
        return new Vector2(x, y);
    }

Vector2 is a simple object with properties x and y. this.size represents the map size. For negative coordinates, I am not getting the correct results. I want overflowing X and Y coords to resolve to the same numbers. For example for a 5x5 map, all rows should be equal X coords after normalizing:

Real map coord X:
0
1
2
3
4

Negative alternatives:
-5
-4
-3
-2
-1

Negative alternatives:
-10
-9
-8
-7
-6

I would prefer it to be a O(1) formula, rather than some weird loop. With a loop, I solved it like this:
if (x < 0) {
            while (x < 0) {
                x += this.size;
            }
        }

```

sentences:
how to move a char value "down" in a two dimensional array? I managed to move it up, left and right but when i try to move it down it goes to the last Y position in the array instead of the Y position below it.

the code i wrote to move it up, left and to the right works!

the name of the array is "mapa[h][b]", the "help" variable has the same value as the values i want to move but as an int instead of a char, the variable "i" is for the Y position and the variable "j" is for the X position

//movement upwards
         for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i-1][j];
                    mapa[i-1][j]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }
//movement to the left
        for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i][j-1];
                    mapa[i][j-1]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }
//movement to the right
        for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i][j+1];
                    mapa[i][j+1]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }

And as I said before, this part works, what I did its just to exchange the value I want to move with the one on the position I want to move it to, to locate the value I want to move I use the for() cycles to "scan" the array and the if() is meant to find it, when the if() finds the wanted value I add one to the Y or X position, but when i try to move it down using the same logic

for (i=0;i<h;i++){
        for (j=0;j<b;j++){
            if(mapa[i][j]==help){
                aux=mapa[i+1][j];
                mapa[i+1][j]=mapa[i][j];
                mapa[i][j]=aux;
                break;
                break;
            }
    }
    }

it just moves to the bottom of the array regardles of its current location on the Y position

sentences:
Representing feelings such as temperature, pain, smell, taste, hunger, and thirst immersively In a totally immersive, simulation-type role-playing game, the player should not look at bars or numbers to keep track of his or her stats, so another method of showing these stats is needed.  For example, the player needs to know when to eat, because games (currently) cannot incite a real feeling of hunger.  The player also needs to know if they are hurt, so they can take appropriate measures.

Somehow, these feelings must be represented visually or audibly.  I'm not a fan of coloring and blurring the screen to show feelings like how most first-person shooters show that you have been shot.  What are some ways to represent these feelings immersively?

sentences:
Can I release any sort of app or game on the PlayStation Store? I'd like to develop a game, and try it out mainly on the Playstation 4.

Can I build any game, or app, and release it on the Playstation Store? Or does Sony only allow what it wants in the store, much like Apple and the AppStore? Note that I'm not asking how to build a game, but whether or not there are restrictions that would prevent me from releasing certain kinds of games or applications to the Store.

sentences:
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 set up in-app purchasing in iOS? I am using Unity and I developing an app for iOS. How do I implement in-app purchases that work world-wide?

sentences:
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:
How to detect collision only in non-transparent texture? I am developing a game using libGDX. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision.

if(player.getBounds().overlaps(boundsBot)){

}

player is a bee and boundsBot is Rectangle of tube. Since there is some transparency in bee image, this returns true even if it doesn't seem to collide. I understand the reason why this is returning true.

I read this solutions. I understood the theoretical concept to the solve the problem but I couldn't achieve it using libGDX.

Here is what I tried,

if(Intersector.intersectRectangles(player.getBounds(), boundsBot, rectangle)) {
    //Gets the intersected rectangle
    System.out.println("Rectangle Bottom: " + rectangle);

    //Converting texture to pixmap
    Texture texture = player.getTexture().getTexture();
    if (!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //Trying to find transparency.....
    System.out.println("Format: "  + pixmap.getGLFormat());
}

How can I solve this issue?

Thank You!

sentences:
Pre-render 3D object from multiple angles, save as PNG I'm looking for a tool or script that takes a 3D object (any format) and makes multiple renders of it automatically (using a raytracer or other high-quality offline renderer). It would then save the output as a series of PNG files.

Example: let me render a car from angles 0,90,180,270 and save the images to car0.png, car1.png, car2.png and car3.png with a single command.

Is there such a tool?

sentences:
Replicating Flight Mechanics of Star Wars Battlefront (2015) I'm trying to replicate the flight mechanics from Star Wars Battlefront (2015) in Unity and I can't get my head around what exactly is going on.

Specifically, how do I get the camera to behave like this using Unity and C#:

https://youtu.be/gxZdOUiEiyY?t=1m1s

I don't mind if you don't give code, I'm just struggling to understand what happens and when in terms of camera movements and rotation.

sentences:
Can I sell games made with LibGdx on Steam my question is pretty self-explanatory, there is any technical or legal issue in selling libgdx games on steam?

EDIT

It is possible to show some kind of evidence, maybe a exemple of a game that is made with libgdx and already is on steam?

sentences:
Generating Normal map from a Image with a given Albedo map I am working on a research problem part of which involves generating normal map from a given image of a rusted object. I searched the internet for techniques to achieve the above and apparently crazybump is mentioned a lot. I tried it but it didn't produce the desirable effects. Also I am looking for a method which draws inspiration from an existing research paper not some closed source software. I turned my attention to the technique described in the this paper. Results from this technique are satisfactory for normal objects because of bias in the training data but it doesn't work very well in the case of rusted objects.
After this I focussed my attention on generating Albedo map (the above problem would become more solvable if Albedo map is obtained). Fortunately I am able to generate pretty good albedo maps for images of rusted objects. I used this paper's approach to generate Albedo maps. Now I want to know a good technique to get Normal map given an image and it's corresponding Albedo map. To give you an idea of what kind of images I am working with I am attaching a sample.

Links to research material would be really appreciated. Thanks!

sentences:
What is the preferred starting address for a C64 game? When writing a C64 game in 6502 Assembler and loading the game using LOAD "Game",8,1, I can choose the address where the game is loaded to. The most popular address I saw is $c000, closely followed by $0810, but I also saw $1000 and $2000 used a lot.

Why would I choose one over the other? I understand $0810 because it's close to $0801 which you have to write the SYS instruction to, but the other addresses all seem arbitrary.

Can someone shed some light into this?

sentences:
Project 360 video on the inside of a iso sphere / polygon sphere I'm creating a game in Unity. I have a iso sphere or polygon sphere, and I want to project a 360 video on the inside of the polygon sphere.

I've learned thow to put a 360 video on the inside of a sphere, following this thread, but how can I do it inside a polygon sphere, since the 360 video was created based on a sphere but not a polygon sphere?

Shader "Flip Normals" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {

        Tags { "RenderType" = "Opaque" }

        Cull Off

        CGPROGRAM

        #pragma surface surf Lambert vertex:vert
        sampler2D _MainTex;

        struct Input {
            float2 uv_MainTex;
            float4 color : COLOR;
        };

        void vert(inout appdata_full v) {
            v.normal.xyz = v.normal * -1;
        }

        void surf (Input IN, inout SurfaceOutput o) {
             fixed3 result = tex2D(_MainTex, IN.uv_MainTex);
             o.Albedo = result.rgb;
             o.Alpha = 1;
        }

        ENDCG

    }

      Fallback "Diffuse"
}

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 I resolve a collision of a circle with two rectangle corners? I'm writing a simple non-physical one-circle-to-many-rectangles collision detector/resolver.

For collision detection, I'm using a very common algorithm, and it's working pretty well.

For collision resolving, once a collision is detected, I calculate the penetration vector, and reactively move the circle in the opposite direction. Once again, it is working pretty well.

However, when there are two adjacent colliders, and the circle is moving right in the place where the two colliders meet, the situation is more complex. This is a screenshot of the situation:

The white rectangles are the rectangle colliders (walls), the yellow circle is the circle collider (player), and the magenta lines are the vectors from the center of the circle to the closest point in each collider.

The problem happens when I get a collision on more than one rectangle. As you can see in the picture above, the top rectangle will have a penetration vector which is not in the direction of the normal of the entire surface, and as such will create artifacts as the circle slides through the wall, depending on how I handle it.

There are many solutions I have tried, but they all create artifacts. In particular, using any algorithm to pick only one collision and solving only for that one, may yield different solutions depending on the order in which they are evaluated, especially on cases where both collisions must clearly be chosen, like the following one:

Just for reference, these diagrams are meant to show a top-down, not a side view of the playing field.

Is there a known way to resolve such a collision correctly?

sentences:
Aspect ratios for sprites in Unity3d I'm using Unity3D version 5.0.

I'm wondering what the best way to deal with changing resolutions in Unity is.  In Swift I can just use the @x2/@x3 in order for it to pick the correct sprite for it to use.  Is there a similar mechanism in Unity?

Thanks

sentences:
Using instancing for everything? Instancing improves performance (significantly) when rendering multiple (hunders? thousands?) copies of the same mesh at once. But how much overhead does it have when rendering exactly one copy with one draw call? Would it be a good or a bad idea to use instancing for all geometry rendered by engine?

Edit:
Let's say we're creating an FPS game. Most of the objects have only one instance: a knife, a gun, a machine gun, a building and a radio tower. But there are also some objects with multiple instances: trees (e.g. 3 kinds of trees with hundreds of instances), grass and so on... What I mean is: instead of rendering the one-instance objects the "traditional" way and trees and grass using instancing, we render all of them using instancing. So our radio tower has only one instance (whose information we store in an instance data buffer) and we render that tower using some kind of DrawInstanced() call with instance count equal 1. Same with all other objects (of course, trees and grass have multiple instances).

So my question is: is it a bad idea to draw a single instance of an object using instancing? Does instancing have too much of an overhead (memory- and performance-wise) or is it in any way undesired for rendering single-instance objects?

sentences:
Efficient way to load chunks of a 2d level to prevent game from loading stutters I am building a 2D sidescroller game in Unity3D.

It's tile-based. To get better performance I divided the level into chunks. I activate these chunks when the player enters 2D Triggers and deactivate it again when he exits the 2d trigger. So I normally only have a max of 2 chunks loaded.
This works good BUT I do have some loading stutters of a few frames when I load a new chunk. How can I prevent that from happening?

Thank you!

sentences:
2D collisions between 2 arrays I'm trying to do collision detection between bullets and enemies in my game. But it's very unpredictable and sometimes it works, sometimes it doesn't (bullet goes straight through without doing anything) and sometimes it kills the script returning "Uncaught TypeError: Cannot read property 'x' of undefined".

The collision detection is just a trivial for loop like this:

if (enemies.length > 0 && bullets.length > 0) {
    for (a = 0; a < bullets.length; a++) {
        for (b = 0; b < bullets.length; b++) {
            if (bullets[a].x + 36 >= enemies[b].x && bullets[a].x <= enemies[b].x + 56 && bullets[a].y >= enemies[b].y && bullets[a].y + 6 <= enemies[b].y + 69) {
                bullets[a].Delete();
                enemies[b].Delete();
            }
        }
    }
}

The .Delete() function is just a reference to arr.splice(index, 1) in the objects. Of course I didn't expect this to be perfect, but I'm surprised by the random behaviour of it. What could cause this and how can I improve the collision detection?

sentences:
Collision detection C++ I'm currently trying to make a small ball-like game in C++. I have two disc-like objects with varying radii. Let's say Disc 1 is on coordinates (100,0) and Disc 2 is on coordinates (400,0). Now Disc 1 has a velocity vector of (300,0) and Disc 2 has a velocity vector of (-300,0). In my program, the Discs just swap places and no collision happens.

Now how do I program in the collisions? Do I have to program my own manual raycasting or something?

sentences:
Passing data to objects and sub-systems I am currently creating a game in C++ using SDL. Many game objects and sub-systems require the use of variables such as an SDL_Renderer for drawing to the screen and delta time for updating positions and there may be more added in the future (such as a TextureManager object). In this case the code for a game object might look something like this:

void Update(float deltaTime)
{
    // ...
}

void Render(SDL_Renderer* renderer)
{
    // ...
}

However, if another variable was added as a parameter, any subclasses would have to be updated and other systems made consistent with the new parameter.

Another way of passing data around would be to have one "storage class/structure" to store these variables and pass that instead. For example:

struct Data
{
    SDL_Renderer* renderer;
    float deltaTime;
    TextureManager textureManager;
};

My question is: what a good way of passing around data in a game engine? The first example would be bothersome to update if any changes were made to the parameters and would make adding more classes difficult. What about the second example? Would it be good design to have objects depend on a single class? Are there any other design patterns for passing around data without causing dependency issues?

sentences:
Saving settings when exiting the application I created a static class CustomPlayerPrefs, it has a WriteToDisk() method that writes the saves to disk.
For saving I am using Application.quiting event:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
static void Init()
{
    Application.quitting += WriteToDisk;
}

But on android it never works. I know that applications are not closed but paused, but it doesn't even work when I restart the device or force the application to stop.
How to fix this or how to make it better?
Need IOS and Android support.

sentences:
How can I legally allow modders to use my tools that are dependent on licensed assets? I am making a moddable game with Unity. I actually have working system for serializing/deserializing items etc.
For purpose of easy item creation in Unity, I made editor-only windows that help you with process of creating objects and setting their properties. The thing is these windows are dependent on bought asset.
My question is how to let users create their own items with those editor-only windows? I wanted to make project open source (so they can put it in Unity and just do it as I did) but obviously I can't put licensed files there.

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:
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:
How are realistic 3D faces created and animated in video games? I'm interested in being able to create realistic faces and facial expressions for the 3D characters of a game I'm working on. Think something similar to the dialog scenes in games like Mass Effect.

Unfortunately I'm not sure where to begin. I'm sure the faces/animations are created through 3D Modeling software, but otherwise I am lost.

Do facial animations use the same "bones" that normal body animation uses?

Is there any preferred 3D software for realistic faces and animations? Is there a preferred format to export these faces and animations in?

sentences:
How does 3D mesh morphing work? In the Sims 4, you can drag to reshape the face and body when you create a sim. You can see a similar system implemented in this Body Visualizer.

How can I implement similar geometry morphing in my game?

Related: What are some ways to implement variable body shapes?

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:
Issue with removing sprites on collision I'm trying to make a very simple collision detection procedure just for test purposes.
The problem is with the send/receive information between functions

I have these lines on the update method (could be later implemented for checking what kind of subclass node is)

CCSprite *sprite = [background spriteCollisionWithRect:player.boundingBox];
if (sprite!=nil) {
    [sprite removeFromParentAndCleanup:YES];
}

and this is the spriteCollisionWithRect method

-(CCSprite*)spriteCollisionWithRect:(CGRect)bounds
{
    for (CCSprite *sprite in _spritesArray) {
        if (CGRectIntersectsRect(sprite.boundingBox, bounds)) {
            return sprite;
        }
    }
    return nil;
}

Now, this way not all the sprites are removed. It only works occasionally. But if I remove the node inside the collision method instead of returning it, it works nicely.

-(CCSprite*)spriteCollisionWithRect:(CGRect)bounds
{
    for (CCSprite *sprite in _spritesArray) {
        if (CGRectIntersectsRect(sprite.boundingBox, bounds)) {
            [sprite removeFromParentAndCleanup:YES];
        }
    }
    return nil;
}

Why is this?

sentences:
Solving constraints/joints in 1D For n points moving in 1 dimension.

Position and velocity are known for each point.

Each frame a basic integration is done for each point:

velocity += forces * timestep;
forces = 0;
position += velocity * timestep;

Each point (except for the first one) is attached to the point following it (e.g to its right) with a distance joint of the form

point2 - point1 < distance
&&
point2 - point1 > 0

Which means that the points shouldn't be further appart than distance or closer than 0.

Energy should be conserved, i.e a point should be able to push/pull another.

I tried to solve every constraints with impulses, but it messes with velocities. (at least the way I did it..)

Searching around, I found a lot of resources but I'm unfortunately not able to understand all of it.

If anyone can give me a general idea / starting point ?

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:
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:
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:
SFML - Completely Unlimit Framerate I am trying to completely unlimit the SFML framerate, so that as many frames will be displayed as possible. The reason for this is I want to loop through one section of code which calculates positions of objects in a physics simulation, and update the screen after perhaps 100 iterations.

I have done:

window.SetFramerateLimit(0);
window.UseVerticalSync(false);

The SFML documentation says this should set the frame rate to "infinity", but I still think it's stuck at about 60-ish...

Does anyone know how I can get more performance out of this?

Also once unlimited, I need to be able to do the equivalent of this in SFML, from SDL:

SDL.Delay(1000);

Is there a way of doing this? The SDL Delay is good because it frees CPU time for other processes. Any help would be greatly appreciated, especially as it's Christmas and you probably have better things to do! (I don't I'm a student.)

sentences:
Setting Square to Dim in Color on MOUSEUP I'm trying to create a simple recreation of the popular memory game "Simon" using C and SDL2. The idea is that the game is a small window with four squares of different colors that are purposefully dim. When the player clicks on a square, I want it to "light up" until the player let's go of their mouse button, in which it returns to it's original dim color.

I have this working to an extent, but the problem is that it only works if the player let's go of the mouse button while the pointer is over the square. If they let go anywhere else, the square stays lit up.

Here is the example code:

if(e.type == SDL_MOUSEBUTTONDOWN && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

if(e.type == SDL_MOUSEBUTTONUP && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 50, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

As you can see, I'm looking for the user to be clicking in a very specific area, and waiting for them to "unclick" in that same specific area. There has got to be a better way to do this. Would anyone do me the pleasure of offering a few hints?

sentences:
Unity blue sprite always showing on top regardless of order I have 3 SpriteRenderer

SpriteRenderer - Green Sprite
SpriteRenderer - Blue Sprite
SpriteRenderer - Brown Sprite

The problem is that the blue sprite always shows on top of the others. I even tried to keep the SpriteRenderer in the same order and change the images but no matter which SpriteRenderer I put the blue image into it always shows on top.

I have the sorting layer set to 0 for all 3 and I cannot change them because I will have to change so many other objects in the game.

sentences:
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: Can a standalone WPF application create an interface that looks like a Flash interface? It seems like WPF was created as the application answer to Adobe's Flash.  Silverlight is used for creating web pages.  But, can that same functionality be pulled into a standalone WPF application.  Scaleform allows Flash to be used within unmanaged C++ games.  Can WPF be used to create the same type of interfaces?  What I've read seems to make me believe it can.  But, I haven't seen any sheetshots of applications that show this kind of interface.

sentences:
Panning a 3d viewport in 2d direction with rotated camera I am using below code to pan the viewport (action script 3 code using flare3d framework)

_mainCamera.x-= Input3D.mouseXSpeed;
_mainCamera.z+= Input3D.mouseYSpeed;

Where as Input3D.mouse[X|Y]Speed gives the displacement of the mouse on the X/Y axis starting from the position of the last frame.

This works perfect if my camera is not rotated. However, if I rotate the camera (x by 30, y by 60) and pan the camera then it goes wrong. Which is actually correctly panning according to the code. But this is not desired and I know I need to do some math to get the correct x/y which I am not aware of it.

Can some one help me achieving it?

Update:

I am getting an Idea but I am not sure how to do it :(

Get the mouseX/Y deltas (xd,yd)
Get the current camera coords (pos3d)
Convert to screen coords (pos2d)
Add deltas to screen coords (pos2d+ (xd,yd))
Convert above coords to 3d coords

sentences:
Drawing simple geometric figures with DrawUserPrimitives? I'm trying to draw a simple triangle based on an array of vertex. I've been searching for a tutorial and I found a simple example on riemers but I couldn't get it to work.
I think it was made for XNA 3 and it seems there were some changes to XNA 4?

Using this example:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/The_first_triangle.php

I get this error:

  Additional information: The current vertex declaration does not
  include all the elements required by the current vertex shader.
  TextureCoordinate0 is missing.

I'm not english so I'm having some trouble to understand everything.

For what I understand error is confusing because I'm trying to draw a triangle color based and not texture based and it shouldn't need a texture.

Also I saw some articles about dynamic shadows and lights and I would like to know if this is the kind of code used to do it with some tweaks like culling because I'm wondering if its heavy code for performance in real time.

    public void LoadContent()
    {
        effect = Game.Content.Load<Effect>("Effect1");
        playerVision = new VertexPositionColor[3];
        playerVision[0].Position = new Vector3(-0.5f, -0.5f, 0f);
        playerVision[0].Color = Color.Red;
        playerVision[1].Position = new Vector3(0, 0.5f, 0f);
        playerVision[1].Color = Color.Green;
        playerVision[2].Position = new Vector3(0.5f, -0.5f, 0f);
        playerVision[2].Color = Color.Yellow;
    }

    // comes from draw method
    private void drawPlayerVision(GameTime gameTime, SpriteBatch spriteBatch)
    {
        effect.CurrentTechnique = effect.Techniques["Pretransformed"];
        Game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, playerVision, 0, 1, VertexPositionColor.VertexDeclaration);
    }

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

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

sentences:
How to handle a negative coordinate 2d map with a growing map size I love this procedural generation theory and have been messing around with it. However I'm having trouble wrapping my head around how to store my map data. Usually I store my map data in a 2d array and that works in a limited space. However my map grows as the player explores new territory. So the size of the map changes and what's more the array will only support positive indices. So if the player tries to explore west or north he runs into a black abyss of nothingness. But I what more map to generate in those directions. Unfortunately those are the negative coordinate parts of the map. Is there a way to support a negative coordinate as the player explores new area? Here is an example of the problem in action.

https://76295db93db3812642fa5ba984c042fa81ffc37c.googledrive.com/host/0B6H3TRExU5M9eEkyd2FreHhiNlU/

Try moving West or north and you'll run into the edge of the map.

sentences:
Moving Draw functions out of GameObjects This is basically the issue as in Tactics for moving the render logic out of the GameObject class with the topic already discussed here and here
However I'm not really satisfied with the given answers.

What I have is an event-driven GameEngine, where each object only reacts on events happening at given GameFrames (GFs) and enqueue Events for future notifications. Example: Change state to WALKING and direction to SOUTH and enqueue event for curGF + 10 GFs. After the Engine ticked of 10 GFs, the object is notified, updates its position and decides what to do next (start walking again, start working, disappear, ...) Note here that new state is influenced by current state and event ID.

Now each object has the simple Draw(x, y) method which need to be implemented differently for each object while some stuff can be inherited (e.g. a pig farm lets the base class draw the building and adds a couple of animated pigs depending on current state, productivity,...)

However these 'simple' methods are quite complex and make a bad design as Drawing is coupled to the logic. Also I found animations are using a global object which I'd like to remove, but that means passing an animation 'thing' into each Draw method.

But I don't see how I could possibly uncouple these things, as the drawing functions need to know quite some stuff about the objects internals (state, position, next event execution time) E.g. walk animation drawing must know that, where and how long the object is walking and the object type/sprite set to draw the object interpolated between start and end position. Also objects may be quite different, have attached decorations or goods that need to be drawn etc.

Solutions I see:

Create an all-knowing renderer that knows how to render each object -> Not an option due to many classes and hence large dependencies
Replacing the Draw calls by Renderer instances that render a specific object -> This would mean creating a mirrored class hierarchy which might be hard to maintain and to implement in the first place (Building->BuildingRenderer, Pigfarm->PigfarmRenderer, Mill->MillRenderer)
Introduce basic renderers (sprite, position, animation?) that can be composited to create the final renderer for each object -> GameObjects need to push their state into those, possibly recreating/recompositing them on each update which sounds like a lot of overhead especially if an object is never rendered at all (offscreen). Also does this look very similar to the actual rendering so I doubt a real gain here but a lot of work

Due to long code I just post links to the Draw functions on GH: Drawing building, Base worker drawing, Derived working drawing, Walking drawing functions

I don't see how I could possibly move all this out of the object classes.

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:
What functional abstraction to use for multi-agent simulation? this is quite a broad question, touching a few different fields, so let me know if there's a way to narrow it down.

What I would like to know is your opinions on what abstraction to use for my use case.

My game is a grid-based trading game (it's more complicated than that, but for now  think of a Patrician on a grid) and I want to do some heavy simulation in the settlements. Heavy here means that the decisional processes and actions of every individual is simulated. I already managed to do a stress test and I know I can handle about 1 milion individuals without any slow down for the game.

The game is written in Scala in a functional style. The problem is that I achieved those performances using a naive copy of immutable states. So for every entity and settlement I compute the next state, I aggregate it in a global state and in the next iteration, I replace the old state with the new one. The issue is with the garbage collector: if the state grows too much after a while it tries a full garbage collection to free up memory and considering that with this approach I may have two whole sized states (the old one and the just computed new state), this gargabe collection may happen at every step.

What I did to solve this was to break the global state in N parts, computing and replacing parts of the state in N iterations. This works because every settlement is assumed to be in isolation and so it won't conflict with the others. This  is a strong assumption though and in such an early state of development I don't want to be bound to it.

So what I need is a way to structure this simulation, settlement by settlement but that allows the agents on the map to interact with the settlements. The abstraction must be functional and match the requirements for the memory issue.

An obvious answer may be to use actors but I fear that using frameworks like Akka, the overhead may be too great for a game.

sentences:
Rotate & Translate a MatrixTRS Hello I have a question about translation & rotation of a MatrixTRS...
So basicly I have a given MatrixTRS A in space, define by a positionA, rotationA and scaleA.
(DISCLAIMER: I am using Unity, but I do not use Transform, therefore I have a Matrix4x4, created like that:
Matrix4x4 A = Matrix4x4.TRS(position, rotation, scale);
Ok, Now I have a Point in space, with a given rotation, named PositionB, and RotationB.
I would like to translate & Rotate my TRS matrix to that positionB, and rotationB.
I know I have to do something like b.transform.TransformPoint() and Quaternion.Inverse(b.transform.rotation)*a.transform.rotation, but i didn't manage to make it right yet.
Thanks!

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:
When to read/write to database with a game server My question is fairly simple but maybe hard to answer. I'm currently building my own game server and I've done to login server now. So, on to the actual game server. I have a question for this server though. Say, a thousand players are moving around on this server, how do I manage this with the database (MySQL) that should hold the player positions and such?

I understand I can't query the database every time something small changes or a single player moves because that would be a huge load for that server. How is this done in real game servers? When do they read or write to the database?

sentences:
How would you implement chromatic aberration? How would you implement the effect of chromatic aberration with shaders?

Would rendering of the world with different focus distances for each color solve the problem (maybe with the usage of only one depth rendering pass)?

sentences:
How does SDL2 renderer work? Does it make sense to render to only part of a window? In order to run a game without using the CPU/GPU too much, I want to only update the section of the window that has changed.

Does this goal even make sense? How does the texture objects/renderer work when updating the screen? My idea is that the renderer builds a matrix of ints (pixel colours) and when SDL_RenderPresent is called, this edits a matrix stored on the memory that controls the colours for each pixel on the screen.

If what I've said so far makes sense, then is my implementation below correct (not updating more of the screen than needed)? I've tried to keep my code very, very simple so that it's easy to read.

The programme jumps the character (picture of a prince) from the top-left of the window to the bottom-left, and visa-versa, whenever the user inputs anything. This is just to keep the code simple for the example.

#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>

using namespace std;

int main ()
{
    // Screen dimension constants
    const int WINDOW_WIDTH = 639;
    const int WINDOW_HEIGHT = 1015;

    const int PRINCE_WIDTH = 74;
    const int PRINCE_HEIGHT = 114;

    SDL_Init ( SDL_INIT_EVERYTHING );

    SDL_Window * window =
    SDL_CreateWindow ( "example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN );

    SDL_Renderer * renderer = SDL_CreateRenderer ( window, -1, SDL_RENDERER_ACCELERATED );

    SDL_Texture * background = IMG_LoadTexture ( renderer, "./images/background.bmp" );
    SDL_Rect rect_background = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT };
    SDL_RenderCopy ( renderer, background, & rect_background, & rect_background );

    const SDL_Rect rect_place_one = { 400, 600, PRINCE_WIDTH, PRINCE_HEIGHT };
    const SDL_Rect rect_place_two = { 40, 60, PRINCE_WIDTH, PRINCE_HEIGHT };

    SDL_Texture * prince = IMG_LoadTexture ( renderer, "./images/prince.bmp" );
    SDL_RenderCopy ( renderer, prince, NULL, & rect_place_one );
    SDL_RenderPresent ( renderer );

    SDL_Event input;

    for ( uint8_t count = 0; SDL_WaitEvent( & input ); ++count )
    {
        // User requests quit
        if ( input.type == SDL_QUIT )
            break;

        if ( input.type != SDL_KEYDOWN )
            continue;

        if ( ( count % 2 ) )
        {
            SDL_RenderCopy ( renderer, prince, NULL, & rect_place_one );
            SDL_RenderCopy ( renderer, background, & rect_place_two, & rect_place_two );
        }
        else
        {
            SDL_RenderCopy ( renderer, prince, NULL, & rect_place_two );
            SDL_RenderCopy ( renderer, background, & rect_place_one, & rect_place_one );
        }

        SDL_RenderPresent ( renderer );
    }

    SDL_DestroyTexture ( prince );
    SDL_DestroyTexture ( background );
    SDL_RenderClear (renderer);
    SDL_DestroyWindow ( window );
    SDL_Quit ();

    return 0;
 }

sentences:
Render rivers in a grid I have created a random height map and now i want to create rivers. I've made an algorithm based on a* to make rivers flow from peaks to sea and now i'm in the quest of figuring out an elegant algorithm to render them.

It's a 2D, square, mapgrid. The cells which the river pases has a simple integer value with this form :rivernumber && pointOrder. Ie: 10, 11, 12, 13, 14, 15, 16...1+N for the first river, 20,21,22,23...2+N for the second, etc. This is created in the map grid generation time and it's executed just once, when the world is generated.

I wanted to treat each river as a vector, but there is a problem, if the same river has branches (because i put some noise to generate branches), i can not just connect the points in order.

The second alternative is to generate a complex algorithm where analizes each point, checks if the next is not a branch, if so trigger another algorithm that take care of the branch then returns to the main river, etc. Very complex and inelegant.

Perhaps there is a solution in the world generation algorithm or in the river rendering algorithm that is commonly used in these cases and i'm not aware of.

Any tips? Thanks!!

sentences:
Why can't my .exe find my .fx file? I'm having a problem with my .fx file in my D3D 11 application.

I can run the application just fine from Visual Studio, but when I run the .exe it fails when trying to load the .fx file.

I've checked the file name in the code and tried all sorts of paths but I can't figure this out, why is this happening?

sentences:
Turn based game - how to deal with partial world state updates? I'm implementing a simple "turn based" game where the player sets up a bunch of "actions" on a board and "objects" move on the board and are influences by those actions. The player is no longer involved after setting up the board and just watches the actions play out. Each "turn" of the game loop, a "move right" action will move any objects on its square one square to the right, for example.

My problem is now that each time I run the game loop, all actions are executed as follows:

for(auto& go: gameObjects) {
    go->update();
}

Each of these game objects mutates the world state in its update() method. What I'm seeing now is that when the board is updated by one object, the next one will immediately use that updated board state and perform its action "too soon".

For example: When I place three "move right" actions on the board and run the game loop, the object will be moved three spaces in one "turn" while it should actually take 3 "turns" for the object to move through all 3 of those actions.

How can I delay the board state update until all actions have had their chance to decide what to do? I'm considering two strategies:

Copy the board state for each turn and create a new board state as the result of a turn. This is complicated because all my views are tied to the objects on the board. If I copy the board, I'll have to re-create all views?
Have each action not update the world state, but only return a function which, when executed, will do the update. Once I have all the functions collected, execute them all to update the board.

Any suggestions?

sentences:
Spreading server load for a multiplayer game My online game is more of a "highly interactive website", as it is played in-browser using webpages and AJAX to communicate with the server, which uses PHP to generate output.

The server is fairly standard, using PHP7, MariaDB, and Memcached (to avoid constantly reloading data from the DB, cache hit rate is about 95%).

All of this works. Fairly well, at that, and it can comfortably handle about 1,000 users actively hammering at the core gameplay element. The problem is that it's not scalable. The only scaling strategy we've had so far is "throw stronger hardware at it", which again works but it's not sustainable.

I want to look into options for spreading the load over multiple servers, but it's daunting.

Most of the game involves manipulating your own characters, and then visiting other player profiles to "interact" with their characters (which awards EXP and bonuses to both parties). There is also trading between players.

Of course if this were just a regular website then I could probably just replicate everything and stick a load-balancer in front of it, but I'm not sure that'll really work here.

I think the most sensible option would be some system of assigning users to a specific server. When you log in a cookie is set to indicate which server you're on, which the load balancer can use to direct your actions to the server your data is on. When visiting another player's profile, the server will request that data from the other player's server. Things like trading will also be handled by having "player one" send a request to their server, which will communicate with "player two"'s server to move data around and complete the action.

Is this realistic? Or am I overthinking it? Are there other options? Ideas?

sentences:
What is a direction vector and why should it be normalized? I've been trying to get the hang of vectors and I read Wolfire's blog about linear algebra and I seem to understand most stuff except when it comes to storing a direction as a vector and using it by multiplying the velocity by it. I know it has to be normalized (have a length of 1), but why does it have to be 1 specifically and how would I use it?

Also how would I represent it in 2D [x,y] coordinates. For example if I wanted a direction such as North-East?

sentences:
How to implement ECS in a videogame with C++? What do I need to know in order to implement ECS in a video game? I'm developing a video game and so far I wasn't using any complete architecture, I was just using inheritance but I don't like it because the code became messy.
So far, I've seen so many articles in which the subject is treated, but I don't understand how to implement it. All what I get is there is that a component is a bunch of information, an entity is a bunch of components, and each system deals with the logic of its own components. But I've got a question about it, they're a bunch of IDs, how do those IDs store data? How to retrieve data from it? I've got a problem, since I was trying to implement components, in order to do it all what I did was declare a parent abstract class in which I'd store members of that class and then I would be able to access to those members. The problem came when I was trying to declare children of that abstract class, since that parent class can't have all the members of all the another components (and I need a way to iterate all the components in a vector).
So... I want to keep the things as simple as possible. Any advice for someone like me? How can I implement ECS in a simple platformer?
Please, Thanks in advance!

sentences:
Corona SDK Continuous Integration Is it possible to build corona applications from console?
Or how can I automate build process?

sentences:
Make a place or city feel crowded in procedural generated worlds I have thought about this while thinking about a game concept, but it should be applicable to many game types.

Imagine an RPG or something else with an open-world. Normally you would want to populate your world to make it feel alive and allow for interaction with NPCs in any form (talk, steal from, kill.. whatever).

Now, what if you don't have the option to fill it with NPCs or similar. My example would be a procedural generated RPG world where you want to enter a house filled with people or even a city. It would be strange for none of the NPCs to talk to you.

Another example might be a space station your ship is docking to. There might be only one or two NPCs you are able to talk to, but the space station could be steaming with other people, but you might not acces them somehow.

Sure, one possibility would be to have procedural generate NPCs with random messages as well, but depending on the size of the city and/or the amount of NPCs you would need a lot of NPCs with different messages. And then it would be easily possible to have to NPCs with identical messages.
The other problem would be that you would end up with to many NPCs, that make the place feel overfilled instead of just crowded. I image that a hard number or relation for space to NPCs is impossible to pinpoint, but you surely get my point.

So, my question is, what other possibilities are there to make a city / place feel crowded? Maybe with NPCs, or maybe even without?

sentences:
Unity - Access to svPosition in fragment shader I am trying to access to the svPosition in my fragment program in Unity but I keep having this error.

  invalid input semantic 'POSITION': Legal indices are in [1,15] invalid ps_3_0 input semantic 'POSITION'

Here are some information about my whole shader.

struct : float4 pos : SV_POSITION;
vertex : o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
fragment : col.rgb = i.pos.xyz;

Any idea how to access this value?

sentences: Unity change default settings for standard components How can I change the default settings for the standard components or is this even possible? E.g. setting the default font-size for a text component so that each new text component I add will have the same font-size?

sentences:
How do I stop the player from rotating when they collide with a tile? I use Touch movement and if I jump and hit a corner with the feet of my player, my player rotates but I don't want this. Can anyone help me jumping without rotating if I hit anything ?

here is my Script:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed = 10, jumpVelocity =  10;
    public LayerMask playerMask;
    public bool canMoveInAir = true;
    Transform myTrans, tagGround;
    Rigidbody2D myBody;
    bool isGrounded = false;

    private Animator anim;

    // Use this for initialization
    void Start ()
    {
        myBody = this.GetComponent<Rigidbody2D>();
        myTrans = this.transform;
        tagGround = GameObject.Find (this.name + "/tag_ground").transform;

        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate ()
    {
        isGrounded = Physics2D.Linecast (myTrans.position, tagGround.position, playerMask);

        #if UNITY_ANDROID && !UNITY_IPHONE && !UNITY_BLACKBERRY && !UNITY_WINRT
        Move(Input.GetAxisRaw("Horizontal"));
        if(Input.GetButtonDown("Jump"))
           Jump();
        #endif
    }

    public void Move(float horizontalInput)

    {
            //Er klebt nicht mehr an den Waenden
        if (!canMoveInAir && !isGrounded)
            return;

        Vector2 moveVel = myBody.velocity;
        moveVel.x = horizontalInput * speed;
        myBody.velocity = moveVel;

        anim.SetFloat ("speed", Mathf.Abs (GetComponent<Rigidbody2D> ().velocity.x));

        if (horizontalInput < 0)
        {
            transform.localScale = new Vector2 (25, 25);
        }
        if (horizontalInput > 0)
        {
            transform.localScale = new Vector2 (-25, 25);
        }
    }

    public void Jump()
    {
        if (isGrounded)
            myBody.velocity += jumpVelocity * Vector2.up;
    }
}

sentences:
Building an Octree for terrain generation I've previously implemented marching cubes/tetrahedra to render an IsoSurface. It worked (YouTube), but the performance was dire as I never got around to implementing variable Level of Detail based on view distance (or even removing old, distant chunks).

I decided to have another go and do it properly this time.
I've started by creating an OctreeNode that works as follows when Build() is called.

If the chunk is too small to build, return immediately.
Work out if the surface passes through this chunk's volume.
If so, then decide if we want to raise the LOD (because the camera is close)
If so, then spawn 8 children and call the same process on them
If not, build the mesh using the current node's dimensions

Some PseudoCode:

OctNode Build() {
    if(this.ChunkSize < minChunkSize) {
        return null;
    }
    densityRange = densitySource¹.GetDensityRange(this.bounds);
    if(densityRange.min < surface < densityRange.max) {
        if(loDProvider.DesiredLod(bounds)² > currentLoD) {
            for(i 1 to 8) {
                if(children[i] == null) {
                    children[i] = new OctNode(...)
                }
                children[i] = children[i].Build();
            }
        } else {
            BuildMesh();
        }
        return this;
    }
}

¹ As well as returning density at a point, the density source can determine the possible density range for a given volume.

² The LoD provider takes a bounding box and returns the max desired LoD based on camera position/frustum, user settings, etc...

So... This all works fairly well. Using a simple sphere as the Density source, and showing all nodes:

And just the leaves:

However, there are a couple of issues:

I have to define the initial bounding volume (and the larger it is, the more processing I need to do)
At the root of the tree, I have no idea how deep the leaves will be, so my LoD numbering starts at lowest quality (root) and increases as chunks get smaller. Because LoD is now relative to initial volume, it's not much use when I want to do things at specific sizes / qualities.

I've thought of a couple of options but both seem flawed:

Maintain a collection of Octrees and add/remove depending on distance. Can't see how I'd mesh across nicely¹, plus I'd need a list of known-empty nodes, especially if I want arbitrary 3D surfaces (to avoid re-calculating empty volumes repeatedly)
Add a parent Node to the current root, then add seven siblings for the original node. This would work and be on-demand but it seems complex to shrink back down sensibly as the player moves through the landscape. It would also make LoD numbers even less meaningful.

¹ [In clarification to Q below] At present, if 2 physically adjacent nodes in the tree are at different LODs, I have some code to coerce the verts such that there's no seam when the meshes are generated. I'm able to do this by knowing the the density for multiple of surrounding nodes. In a scenario where I have 2 independent octrees side-by-side, I'd have no easy way to retrieve this information, resulting in seams.

What's an optimal way to approach this?

sentences:
Transform.Rotate micro stutter? Hey all I have a quick question.

I am new and obviously still learning the basics of programming/scripting. However I am confused by the result of a simple script.

The goal is to have a Start Menu with a 3d background.The camera is attached to an Empty Object, which has a script that is meant to constantly rotate.

My confusion, is whether I am live testing in Unity, or a built executable. When the empty object is rotating, it will have a pause or a few milliseconds, and then continue with its rotation. Almost like a planned micro stutter. Regardless of where it is in its cycle. How can I make the rotation as perfectly smooth as possible?

Below is the script for rotating the empty object that the camera is attached to.

public class cameraAnchor : MonoBehaviour {

public float speed = 5f;

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

    //rotate camera anchor around y axis
    transform.Rotate(Vector3.down, speed * Time.deltaTime);
}

}

sentences:
Which data structure should be used to represent voxel terrain? According to the Wikipedia page about voxels, "[...] the position of a voxel is inferred based upon its position relative to other voxels (i.e., its position in the data structure that makes up a single volumetric image)."

How should one implement such a data structure?  I was thinking about an octree but I'm wondering if there's something else that I never heard about.

sentences:
HLSL 5.0 vector interpolation issues I'm having issues with the depth components of my shadowmapping shaders.
The shadow map rendering shader is fine, and works very well.
The world rendering shader is more problematic.
The only value which seems to definitely be off is the pixel's position from the light's perspective, which I pass in parallel to the position.

struct Pixel {
    float4 position : SV_Position;
    float4 light_pos : TEXCOORD2;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

The reason that I used the semantic 'TEXCOORD2' on the light's pixel position is because I believe that the problem lies with Direct3D's interpolation of values between shaders, and I started trying random semantics and also forcing linear and noperspective interpolations.

In the world rendering shader, I observed in the pixel shader that the Z value of light_pos was always extremely close to, but less than the W value.
This resulted in a depth result of 0.999 or similar for every pixel.

Here is the vertex shader code :

struct Vertex {
    float3 position : POSITION;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

struct Pixel {
    float4 position : SV_Position;
    float4 light_pos : TEXCOORD2;
    float3 normal : NORMAL;
    float2 texcoord : TEXCOORD;
};

cbuffer Camera : register (b0) {
    matrix world;
    matrix view;
    matrix projection;
};

cbuffer Light : register (b1) {
    matrix light_world;
    matrix light_view;
    matrix light_projection;
};

Pixel RenderVertexShader(Vertex input) {

    Pixel output;

    output.position = mul(float4(input.position, 1.0f), world);
    output.position = mul(output.position, view);
    output.position = mul(output.position, projection);

    output.world_pos = mul(float4(input.position, 1.0f), world);
    output.world_pos = mul(output.world_pos, light_view);
    output.world_pos = mul(output.world_pos, light_projection);

    output.texcoord = input.texcoord;
    output.normal = input.normal;

    return output;
}

I suspect interpolation to be the culprit, as I used the camera matrices in place of the light matrices in the vertex shader, and had the same problem.
The problem is evident as both of the same vectors were passed to a pixel from the VS, but only one of them showed a change in the PS.

I have already thoroughly debugged the matrices' validity, the cbuffers' validity, and the multiplicative validity.
I'm very stumped and have been trying to solve this for quite some time.

Misc info :
The light projection matrix and the camera projection matrix are the same, generated from D3DXMatrixPerspectiveFovLH(), with an FOV of 60.0f * 3.141f / 180.0f, a near clipping plane of 0.1f, and a far clipping plane of 1000.0f.

Any ideas on what is happening?

sentences:
How Can I generate a shield block from a Turn based medieval game fight? Imagine the char below, a Spartan that in his turn attacks and in the opponent turn tris to block. What would be the logic behind the block process? I just don't want to rely generating random numbers to decide

Update:

This is what I want to do, depending of the kind of the shield it would be more likely to block than others:

sentences:
Is it legal to use a generic celebrity names in a card game? Before tagging this as a duplicate to
Legality of using names in a game?, please be aware that it is a more special case than that generic question

So I am working on a card game similar to Cards Against Humanity, where some cards would have celebrities names, the case I am interested in is if the celebrity name is too generic that they can't really claim that this name can only be them, specially there is no context where their field of famous is referred to to confirm the identity.

Example

Lady Gaga - no one can argue that this name doesn't refer to the known celebrity.

But

Will Smith - is too generic, searching linkedin or facebook you will find thousands of people called Will Smith.

I guess if the card says the actor Will Smith then that is different.

Am I wrong in this assumption?

sentences:
Learning GLSL: What's a good intermediate project to work on? I know the basics of OpenGL and I'm starting to love computer graphics more and more. I have a computer science background and have been programming for 5 years. I've been reading the orange book and kind of want to figure out a project that can push me to the next level. I don't want it to be over overwhelmingly hard, I just want a project that can help me progress.

As, of right now I've played around with basic programs in the book. Changing parameters seeing how data moves from one shader to the next.

Any Ideas of what might be a good intermediate project to tackle?

sentences:
How to add only 1 value in a list in the Update function when a GameObject is active for many frames In my C# script, I get the active gameobjects during play mode. Those gameObjects that are active are:

1- First, I get the ones that the application has selected randomly 2- and then after the first ones get disabled (setActive(false)), I get the selected gameObjects which are those that the user has pressed using their button.

So basically the application is: The user hears a sound being played (here I set active the gameObject that has that sound) and then after some frames, the sound gets disabled and then the user needs to press a button in screen to make a choice depending on the sound (here I set active the gameObject that has the button) and then I disable that game object after some frames.

Now every time one of those gameObjects gets selected, I try to add to my list some sort of value (lets say 1 in this case). But what happens is that I only manage to add the value in the Update() function but in this function I do not get only 1 value added in the list every time I get the first gameObject selected but because it updates every frame, this value gets added for like 125 times in the list until this gameObject gets diselected and the next gameObject (the one that holds the button) get active.

  if (DogSelected.activeSelf && NoCarSelected.activeSelf)
    {
        enable = true;

        if (enable)
        {
            DogLionSelected.Add(0);
            NoCarCarSelected.Add(0);

            enable = false;
        }

        if (DogPressed.activeSelf && NoCarPressed.activeSelf )
        {
            enable = true;

            if (enable)
            {
                string[] data = new string[] { scene.name.ToString(), "0", "0", "0", "0", "1" }; orientationStringWriter.Write(string.Join(delimiter, data) + "\n");
                DogLionPressed.Add(0);
                NoCarCarPressed.Add(0);
                PrimaryCorrectIncorrect.Add(1);

                enable = false;
            }

        }

Ideally, I would want to:

1- Hear the sound (gameObject is active) => add only 1 value in list until the gameObject is deselected. 2- Then do the same thing for the gameObjects that hold the button. So when that gets selected = > add only one value in the other list until this gameObject is deselected. Then do the same process 72 times (because the number of trials in this application is 72).

Can anyone give me any advice how to achieve this?

Thanks

sentences:
How to find sequences of consecutive cards of the same suit in a hand, including wild cards? (Indian Rummy) I have a hand of 13 cards (chosen from 2 standard decks of 52 cards + 4 jokers, so it's possible for the same card to appear multiple times).

I want to search this deck to find sequences according to the rules of Indian Rummy:

A sequence must contain at least 3 cards, or up to 10 cards

(We need at least two sequences to win / minimize loss penalties, so at least 3 cards in the hand of 13 need to be left over to form another sequence)
Cards in a sequence have consecutive rank:

2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A (wild cards count as any rank)
A sequence must be all of the same suit:

♦, ♣, ♠, ♥ (wild cards can count as any suit)
A sequence is called "pure" if it contains no wild cards standing in for other cards.

eg. if Jacks are wild, the sequence 10♥, J♥, Q♥ is a pure sequence, while the (also valid) sequence 3♣, 4♣, 5♣, J♥, 7♣ is not a pure sequence.

Here's what I've come up with so far, but it does not correctly find all sequences matching the rules above.

private List<Card> FindSequences()
{
    List<Card> sequence = new List<Card>();

    int Count = 0;

    //sort in order
    cards = cards.OrderBy (i => i.FaceValue).ToList ();
    sequence.Add(cards[Count]);

    //------------------------------------------------------------------------------------------------------//

    for(int i = 1; i < 9; i++)
    {
        if((cards[i - 1].cardRank == cards[i].cardRank - 1) && (cards[i].cardRank == cards[i + 1].cardRank - 1) && (cards[i + 1].cardRank == cards[i + 2].cardRank - 1) )//&& (cards[i + 2].cardRank == cards[i + 3].cardRank - 1))
        {
            sequence.Add (cards [i - 1]);
            sequence.Add (cards [i]);
            sequence.Add (cards [i + 1]);
        }
        else
        {
            Count++;
            //check If Sequence Less Then 3 Clear Data
            if(sequence.Count < 3)
                sequence.Clear ();
        }
    }

    wildCard.Clear ();
    return sequence;
}

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:
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:
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:
Java Slick2d image depth/layering I'm making a topdown 2d game, and I've made a decent entity system so far.
But I want to do the following with it:
I want to have drawing depth, so if, for instance, a tree is above another tree, then it should be drawn underneath the other tree. Here is basically a picture of what I mean.
This is what I'm trying to avoid:

Instead of that I want something like this:

If you have any idea how to do this, please tell me. If you need any code, here's basically what I do:
In my main class I call a generate entities class. In that then I add Tree class-es to an arraylist through which it renders them.
Thanks.

sentences:
Why the while loop is not pausing the coroutine? I'm trying to find a way to pause the game the whole game. timeScale = 0f is not working on coroutines.

I have this script that pause the game on escape key :

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

public class BackToMainMenu : MonoBehaviour
{
    public static bool gamepaused = false;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            gamepaused = true;
            Time.timeScale = 0f;
        }
    }
}

And a script with a coroutine :

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;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        var depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, clipLength));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        while(BackToMainMenu.gamepaused)
        {
            yield return null;
        }

        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            if (Time.timeScale == 0)
                counter += Time.unscaledDeltaTime;
            else
                counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }
}

But when I hit the escape key the freeze for a second or two but then the blurry effect in this script is keep on going then it also keep on running the game after this script part. It seems that the timeScale is not pausing the game at all but only for few seconds if at all. Or pausing only some stuff.

What I want is to pause the whole game. Maybe I should use a game state somehow? I don't want to disable/enable the gameobjects in the hierarchy.

I checked again now. For example the player I can't move it with the keys but I can rotate the player looking around with the mouse while in pause mode. But other things are paused like other npc's I have they stopped moving(Not using animation). So some stuff is paused but some stuff not.

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:
How to stop Players and Enemies from pushing each other I am developing 2D Top-Down RPG game. I have script that makes my enemy follow the player, and when they touch the player, the player will start to lose HP.
Everything works well, but when they touch each other, the enemy starts pushing the player and also I can push the enemy too.
I use a Rigidbody2D and BoxCollider2d for each of them.
Here is my enemy controller code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyController : MonoBehaviour
{
    private Animator myAnim;
    private Transform target;
    public Transform homePos;
    private Rigidbody2D myRB;

    [SerializeField]
    private float speed;
    [SerializeField]
    private float maxRange;
    [SerializeField]
    private float minRange;
    // Start is called before the first frame update
    void Start()
    {
        myAnim = GetComponent<Animator>();
        target = FindObjectOfType<PlayerController>().transform;
        myRB = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Vector3.Distance(target.position, transform.position) <= maxRange && Vector3.Distance(target.position, transform.position)>= minRange)
        {
            FollowPlayer();
        }

        else if(Vector3.Distance(target.position, transform.position) >= maxRange)
        {
            GoHome();
        }
    }

    public void FollowPlayer()
    {
        myAnim.SetBool("isMoving", true);
        myAnim.SetFloat("moveX", (target.position.x - transform.position.x));
        myAnim.SetFloat("moveY", (target.position.y - transform.position.y));
        transform.position = Vector3.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
    }
    public void  GoHome()
    {
        myAnim.SetFloat("moveX", (homePos.position.x - transform.position.x));
        myAnim.SetFloat("moveY", (homePos.position.y - transform.position.y));
        transform.position = Vector3.MoveTowards(transform.position, homePos.position, speed * Time.deltaTime);

        if (Vector3.Distance(transform.position, homePos.position) == 0)
        {
            myAnim.SetBool("isMoving", false);
        }
    }
}

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:
Unity Json utility does not serialize DateTime Like the title said the unity json utility does not seem to allow me to serialize the DateTime structure. Just to clarify the problem is that I'm serializing this class:

[Serializable]
public class SaveData {

public Vector3 playerPosition;
public Quaternion playerRot;
public List<Item> inventory;

public DateTime saveTime;

public int playerHealth;

public int strength;
public int attack;
public int defense;
public int agility;

}

When I actually write to the json file I get everything but the DateTime and no errors. This is the result:

{
"playerPosition": {
    "x": -142.27000427246095,
    "y": -7.000000476837158,
    "z": -112.80999755859375
},
"playerRot": {
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "w": 1.0
},
"inventory": [],
"playerHealth": 100,
"strength": 0,
"attack": 0,
"defense": 0,
"agility": 0
}

Is there a way around this?

A little update to this question so that I can show another way I've worked around this problem if the answer below isn't for you.

I was recently working on a similar problem and solved it by doing the follow:

I created a new class called "NewDateTime":

[System.Serializable]
public class NewDateTime {
public int second;
public int minute;
public int hour;

public int day;
public int month;
public int year;

public NewDateTime CreateNewDateTime(DateTime dateTime) {
    NewDateTime newDateTime = new NewDateTime();
    newDateTime.second = dateTime.Second;
    newDateTime.minute = dateTime.Minute;
    newDateTime.hour = dateTime.Hour;
    newDateTime.day = dateTime.Day;
    newDateTime.month = dateTime.Month;
    newDateTime.year = dateTime.Year;

    return newDateTime;
}

public override string ToString() {
    return day + "/" + month + "/" + year + " at " + hour + ":" + minute + ":" + second;
}}

and then for example when I want to save the date to json I would do something like the following:

saveDateTime = newDateTime.CreateNewDateTime(DateTime.Now)

it's a rather simple workaround but I thought it might help.

sentences:
Mathf.Approximately: should I use it & for what cases? For comparing floats they recommend using Mathf.Approximately
At the same time, they don't use it, for example, for comparing types such as vectors.
From Vector3.cs:

public bool Equals(Vector3 other)
{
    return x == other.x && y == other.y && z == other.z;
}

If I understand it correctly it wouldn't cause any problem when using == operator to compare floats that are formed the same way (or copied from the same source).  For example:

float x = 10f / 10f;
float a = x; // or `a = 10f / 10f`;
float b = x;
bool equal = (a == b); // always `true`

but it can cause a problem if floats are formed differently even if their results are supposed to be the same. For example:

float a = 10f / 10f;
float b = 11f - 10f;
bool equal = (a == b); // result is unpredictable

Is my understanding correct?

sentences:
How to create the "drunk camera" effect in GTA 4? If you have played GTA 4, then you have probably been drunk at some stage. This is one of the best intoxicated simulators I have ever seen. It is actually hard or sometimes almost impossible to drive a vehicle while drunk in this game.

I know that a lot of the things that make up this drunk experience are changes to the controls or having random changes in direction, but how would the camera be done?

The camera seems to wave in and out and side to side. It also has changing blur, and other effects going on. Would this be some kind of shader? What are the effects that are used on top of each other to create the experience?

sentences:
Correct way of texture-mapping a 2D mesh in libgdx this is a question regarding the libGDX framework.

I have managed to UV-map a texture to vertices (in 2D) but have come across a few problems that I think might be caused by incorrect order of vertices.

In the first two pictures, you can see a rendering produced by the code-bits below (without blending enabled). It seems fine at first, but you can clearly notice that the lower triangle seems to have a rough transition. Is there an easy way to prevent this (without writing too much low level stuff) or is this an expected limitation of this approach?

The second problem occurs with the same code but with blending turned on. In the fragment shader, you can see that I adjust the alpha level of each pixel in the region, but with this mesh, it produces a rather weird and distorted image in the right triangle area.

Here's the code:

Shaders

//Vertex shader:
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
 v_color = vec4(1, 1, 1, 1);
 v_texCoords = a_texCoord0;
 gl_Position =  u_projTrans * a_position;
}

//Fragment shader:
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main() {
 gl_FragColor = v_color * texture2D(u_texture, v_texCoords) + vec4(0, 0, 0, -0.50);
}

Mesh

Mesh m = new Mesh(true, 5, 0,
         new VertexAttribute(Usage.Position, 2, "a_position"), //x,y
         new VertexAttribute(Usage.TextureCoordinates,2,"a_texCoord" + 0)); //u,v
         m.setVertices(new float[]{20f, 360f, 0f,0f, //upper left
                                   60f, 20f, 0f, 1f, //lower left
                                   180f,20f,1f,1f, //lower right
                                   220f, 360f, 1f, 0f, //upper right
                                   20f, 360f, 0f, 0f}); //upper left (closure)

Render

//Gdx.gl.glEnable(GL20.GL_BLEND);
//Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
shaderProgram_mesh.begin();
shaderProgram_mesh.setUniformMatrix("u_projTrans", camera.combined);
texture.bind();
m.render(shaderProgram_mesh, GL20.GL_TRIANGLE_STRIP, 0, 5);
shaderProgram_mesh.end();

sentences:
How to increase the selectable size of an object for dragging I am currently dragging a gameobject like this.

   Vector3 screenSpace;
   Vector3 offset;
   void OnMouseDown(){

 //translate the cubes position from the world to Screen Point
 screenSpace = Camera.main.WorldToScreenPoint(transform.position);
 //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
 offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y, screenSpace.z));
 }

  private float speed = 7.5f;

  void OnMouseDrag(){
     Vector3 curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y,    screenSpace.z);
     Vector3 curPosition =  Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
     transform.position = curPosition;
 }

Sometimes a user doesn't click directly on an object so is there a way that if a user is between 3-7 pixels off, it still counts as a click and drag? Any help is appreciated.

sentences:
Implementing Branching Conversation Dialogue in C# with XNA How could I add logical branching conversation dialogue in C# with XNA? What I mean by this is a dialogue tree similar to this:

If the user is wearing red:
     DisplayText "You're wearing a red shirt!"
Else:
     DisplayText "You're not wearing a red shirt!"

The key is that I can't hard-code these logic questions into C# itself; it has to be readable from some sort of external file and still executable.

My question is very similar to this question: How can I implement dialog trees into my game?

But my focus is more on how I can actually begin to implement this feature into my game.

sentences:
DX11 Losing Instance Buffer Data I've got a function that basically creates different instance buffers into an array for me to use in my DrawIndexedInstanced call.

But when I pass the vertex buffer and instance buffer through to my shader, my instance data is completely lost when the shader goes to use it, so none of my objects are being relocated and are thus all rendering in the same place.

I've been looking at this for hours and literally cannot find anything that is helpful.

Creating the Vertex shader input layout:

D3D11_INPUT_ELEMENT_DESC solidColorLayout[] =
{
    //Vertex Buffer
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },

    //Instance buffer
    { "INSTANCEPOS", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { "INSTANCEROT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 12, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { "INSTANCESCA", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 24, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
    { "INSTANCETEX", 0, DXGI_FORMAT_R32_FLOAT, 1, 36, D3D11_INPUT_PER_INSTANCE_DATA, 1 }
};

Creating an instance buffer (called multiple times per frame, to create all necessary buffers):

void GameManager::CreateInstanceBuffer(ID3D11Buffer** buffer, Mesh* mesh, std::vector<Instance> instances)
{

    D3D11_BUFFER_DESC instBuffDesc;
    ZeroMemory(&instBuffDesc, sizeof(instBuffDesc));

    instBuffDesc.Usage = D3D11_USAGE_DEFAULT;
    instBuffDesc.ByteWidth = sizeof(Instance) * instances.size();
    instBuffDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    instBuffDesc.CPUAccessFlags = 0;
    instBuffDesc.MiscFlags = 0;
    instBuffDesc.StructureByteStride = 0;

    int i = sizeof(Instance);

    D3D11_SUBRESOURCE_DATA instData;
    ZeroMemory(&instData, sizeof(instData));

    instData.pSysMem = &instances;
    instData.SysMemPitch = 0;
    instData.SysMemSlicePitch = 0;

    CheckFailWithError(dxManager.GetDevice()->CreateBuffer(&instBuffDesc, &instData, buffer),
        "An error occurred whilst building an instance buffer",
        "[GameManager]");

    meshBuffers.push_back(mesh->GetBuffer(VERTEX_BUFFER));
}

The draw command:

dxManager.GetContext()->DrawIndexedInstanced(instanceIndexCounts[buffer], instanceCounts[buffer], 0, 0, 0);

I've used the graphics debugger built into Visual Studio. Initially it appeared to be assigning variables in the Vertex shader back to front, however removing APPEND_ALIGNED_ELEMENT from the AlignedByteOffset has fixed that, however the per-instance data seems to be corrupt and is not getting recieved.

If there is anything else you need let me know and I'll update the post as necessary.

sentences:
LibGDX 2D Silhouette recently I decided to implement in my game the drawing of a silhouette of the player when he is behind objects (the top layer of the map). Found a similar question here, but it doesn't matter to me to understand anything. Can someone please explain how it all works? I will be very grateful to you! Specifically, I'm interested in the issue of creating the Vertex and Fragments of the shaders? And why is only one shader passed to two setSheader methods.
Code that I do not understand:
// Rendering the upper map layer:
// Simple "if (gl_FragColor.a == 0.0) discard;" fragment shader
renderer.getBatch().setShader(shader);

//Rendering the silhouettes:
// "gl_FragColor = vec4(0.0, 1.0, 1.0, 0.2) * texture2D(u_texture, v_texCoord0).a;"
batch.setShader(shader);

EDITS:
I tried adding this code and this is what I got:
Java code:
//above render the normal player texture outside the shader code

mapRenderer.render(lowerLayer);
player.update(mapMgr, game.batch, delta, world);
mapRenderer.render(upperLayer);

Gdx.gl20.glClear(GL20.GL_STENCIL_BUFFER_BIT);

Gdx.gl20.glEnable(GL20.GL_STENCIL_TEST);
Gdx.gl20.glStencilFunc(GL20.GL_ALWAYS, 0x1, 0xFF);
Gdx.gl20.glStencilOp(GL20.GL_REPLACE, GL20.GL_REPLACE, GL20.GL_REPLACE);

mapRenderer.getBatch().setShader(shader);
mapRenderer.render(upperLayer);
mapRenderer.getBatch().setShader(null);

Gdx.gl20.glStencilFunc(GL20.GL_LEQUAL, 0x1, 0xFF);
Gdx.gl20.glStencilOp(GL20.GL_KEEP, GL20.GL_KEEP, GL20.GL_KEEP);

game.batch.setShader(shader);
player.update(mapMgr, game.batch, delta, world);
game.batch.setShader(null);

Gdx.gl20.glDisable(GL20.GL_STENCIL_TEST);

Fragment GLSL code:
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;

void main() {
  vec4 c = vec4(.5, .5, .5, texture2D(u_texture, v_texCoords).a);
  if (c.a == 0.0) {
    discard;
  }
  gl_FragColor = c;
}

It didn't work out that way. In addition to the fact that the color of the top layer changes, the player is also completely painted, regardless of whether he is under the top layer or not.
I think the problem is in some of this:

This part of the code does not work. Because even if you remove it, nothing changes.
Gdx.gl20.glClear(GL20.GL_STENCIL_BUFFER_BIT);
Gdx.gl20.glEnable(GL20.GL_STENCIL_TEST);
Gdx.gl20.glStencilFunc(GL20.GL_ALWAYS, 0x1, 0xFF);
Gdx.gl20.glStencilOp(GL20.GL_REPLACE, GL20.GL_REPLACE, GL20.GL_REPLACE);
Gdx.gl20.glStencilFunc(GL20.GL_LEQUAL, 0x1, 0xFF);
Gdx.gl20.glStencilOp(GL20.GL_KEEP, GL20.GL_KEEP, GL20.GL_KEEP);
Gdx.gl20.glDisable(GL20.GL_STENCIL_TEST);

Fragment shader is not written correctly

I spent all day solving this problem. Nothing works. I hope someone will figure it out! Thanks.

sentences:
Ease Rotate RigidBody2D toward arbitrary angle I'm trying to make a rigidbody2D circle return to an orientation after a collision. But there is a weird behavior I do not expect - it always orients to the same direction.

This is what I call in FixedUpdate():

rotationdifference = -halfPI + rigidbody2D.rotation;
rigidbody2D.AddTorque (rotationdifference * ease);

I would expect this would rotate 90 degrees (1/2 Pi Radians) off of the neutral axis. But it does not. In fact it performs exactly the same as:

rotationdifference = rigidbody2D.rotation;
rigidbody2D.AddTorque (rotationdifference * ease);

What is going on? How would I be able to set an angle I want it to ease towards, and then have it ease towards it when its not colliding with some other force?

=====

Edit

For those who want to try this themselves, here is a MonoBehavior. Apply it to a sprite with a rigidbody2D.
I have a boxcollider going througha  field of pegs like in pachinko.

using UnityEngine;
using System.Collections;

public class MarchingMovement : MonoBehaviour {

public Vector2 speed = new Vector2(50, 50);
public float ease = 0.01f;
private float rotationdifference;
private float halfPI = 1.57079632679f;
// Use this for initialization
void Start () {
    //rotationdifference = 3.0f;
}

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

}
void FixedUpdate()
{
    // 5 - Move the game object
    rigidbody2D.velocity = speed;
    rotationdifference = -halfPI + rigidbody2D.rotation;
    rigidbody2D.AddTorque (rotationdifference * ease);
}
}

sentences:
Correcting for a collision overlapping too much? I have a TileMap with a TileMapCollider2D and a Sprite with a BoxCollider2D. I'm not using physics at all so I'm correcting for the collision on my own. Here's my attempt:

void FixedUpdate() {
    float h = Input.GetAxis("Horizontal") * Time.deltaTime * this.Speed;
    float v = Input.GetAxis("Vertical") * Time.deltaTime * this.Speed;
    Vector3 pos = this.transform.position;
    pos.x += h;
    pos.y += v;

    foreach (Tilemap map in this.Maps) {
        TilemapCollider2D mapc = map.GetComponent<TilemapCollider2D>();
        ColliderDistance2D dist = this.boxCollider.Distance(mapc);
        if (dist.isOverlapped && dist.isValid) {
            Debug.DrawLine(dist.pointB, dist.pointA, Color.white);
            Vector2 correction = dist.normal * dist.distance;
            pos += (Vector3)(correction);
        }
    }

    this.transform.position = pos;
}

This logic is on the blue square in this gif:

According to the documentation, dist.normal * dist.distance should be exactly the distance and direction required to make the two colliders touch. However you can see that I can push a few pixels into the red walls. When I release the button it takes several frames to back out of the wall. It goes a little haywire too when I go diagonally into the corner.

sentences:
What is the most efficient way to render a 2D scene objects? What is the most efficient way to render scene objects according to the current position of the camera (which will follow the player position)?

A friend told me that since processors are powerful these days, it is okay to set up everything virtually and then just update the surface according to what is inside the camera position, after a loop inside the sprites filtering only what should be rendered by the GPU.

But seems to me that this is taking more processing power from the CPU. Why process objects that aren’t visible by the player? What if I need to target mobile devices? What if I want to make my game available in a raspberry pi or very old computers?

sentences:
How do I calculate rotational impulses in rigid body collisions? I'm writing a simple 2D physics engine to help me understand the inner workings of physics engines. I'm following Randy Gaul's tutorial which can be found here and It's been extremely useful and interesting. I'm now on the fourth and final article in the series which covers rotation, but I've spent weeks trying to figure it out and I've hit a brick wall. I've looked all over for other tutorials or explanations, but I have yet to find any that help. No matter how I impliment it, to the point of translating the source code of the tutorial to C# I seem to get completely counter intuative behavour.

The first cause of confusion is that the tutorial states that the collision resolution impulse for two bodies according to the tutorial is the first of the equations below, but the source code accompanying the tutorials appears to be using the second. These two don't appear to be equivalent to me, but I may be wrong.

I'm using the second equation in my code, as implemented in the example source code. I alter the angular velocity as follows:

angularVelocity += ColumnVector2.crossProduct(contactVector, impulse);

Assuming neither of these are the problem, then I must be doing something fundamentally wrong. Can anyone explain, or point me to a good explanation of how to calculate the angular components of my physics engine because I am completely stuck!

Thanks in advance (and sorry for the lengthy question),
Adam

sentences:
How to detect speed on collision The problem with OnCollisionEnter2d is that it only gets called when there is a collision but what I wanted is to get the current speed of object at the moment of impact until the object stops moving. So that I if the object stops moving after impact I will call another function.

void OnCollisionEnter2d(Collision2D collision){
   Debug.Log(speed); //problem this will only give the speed at the moment of impact
   if(speed <= 0){
     blah blah
   }
}

I also tried putting speed variable on the Update()

void Update(){
     var currentVelocity = player_rb.velocity;
     speed = currentVelocity.magnitude;
}

sentences:
Create prefab asset from object without creating object in the scene I am writing an editor tool that is supposed to generate prefab objects from a parsed TMX file.

Since this is a special case because I don't want to instantiate objects, but rather create them there are not much documentation on how to do this.

I have come up with a way that actually creates an .prefab file from a gameobject. But the problem is that when I do this, the gameobject itself is created and put into the hierarchy. I only want the .prefab asset file.

This is they way I am doing it now.

static void ConvertFile(string filepath) {
    // This function returns a "new GameObject()" with attached components
    // However, this function still puts the new game object in the scene & hierarchy
    // which is not what I want
    GameObject mapObject = mapLoader.fromFile (filepath);
    string filename = System.IO.Path.GetFileNameWithoutExtension (filepath);

    // Create prefab file from an object
    PrefabUtility.CreatePrefab ("Assets/" + filename + ".prefab", mapObject);
}

public GameObject fromFile(string filepath) {
    // Removed code that parses file for easy read
    GameObject gameObject = new GameObject ();
    return gameObject;
}

sentences:
In a 2D tile engine, how do I figure out which tiles are culled and which to draw? I'm trying to make a simple 2d tile engine here, and I've got a problem with getting a proper cells from a tile grid map when I'm trying to cull off tiles which aren't needed to be drawn.

I've got a tile which is 16 by 16 pixels and
 a tilemap represented as a grid of 0, 1 etc

For example

{1,1,1,1}
{1,1,1,1}
{1,1,1,1}
{1,1,1,1}

Then I translate it to a Tile[,] matrix like this

public void SetMap(Int32[,] tileCodes, int sizeX, int sizeY, TileTextures tileTextures) {
        //A simple check that sizes are equal
        if (sizeX == mapBounds.width && sizeY == mapBounds.height) {
            for (Int32 i = 0; i < mapBounds.width; i++) {
                for (Int32 j = 0; j < mapBounds.height; j++) {
                    if ((TileType) tileCodes[j, i] != 0)
                        map[j, i] = new Tile(new Vector2(i, j), (TileType) tileCodes[j, i], tileTextures.GetTexture((TileType) tileCodes[j, i]));
                }
            }
        } else
            Console.WriteLine("Map.SetMap: Unable to set map of diffent size than defined one");
    }

So it's basically tile grid now (tile[x,y]), but I can't figure out, which tile I should draw. I've already got a vissible area as a rectangle (va):

public void Draw(SpriteBatch spriteBatch) {
        // How to get positions in tile[x,y]?
        int startX = va.area.Left/ 16;
        int endX = va.area.Right/16;
        int startY = va.area.Top/16;
        int endY = va.area.Bottom/16;

        for (Int32 i = startX; i < endX; i++) {
            for (Int32 j = startY; j < endY; j++) {
                Tile tile = map[i, j];
                tile.Draw(spriteBatch);
            }
        }
}

Any ideas?

sentences:
Destroying non-monobehaviour derived classes I'm building an inventory system with different items classes deriving from a 'Item' base class.

When an inventory slot runs out of the item it holds I want the item to be destroyed. I cannot null the inventory slots reference to it, and I cannot destroy it. How are non-monobehaviour classes supposed to be handled in Unity? Any tips on how I can get rid of the used up item?

sentences:
change random number into specific range using resolution I am having a simple mathematical problem that i would like to scale a randomly created decimal points using numpy , then apply a formula to align this decimal points to range

range \$:\$-  \$x_\min : x_\max\$

number of points of the interval [xmin : xmax ]  :  M

number of points to be created  :  N

$$ \\resolution = \frac{(x_\max-x_\min)}{M}$$

equation if found \$:\$-

\$t_s\$ \$:\$- first point

$$ \\ t_s  = { random *  ( x_\max\ - x_\min\ - N*resolution)}\ $$

i would like to understand this equation

sentences:
Ocean visible through the island's lake in Unity3D? I'm working on a puzzle game featuring islands: there is a plane with a water shader, and objects colliding with that plane.

Now I'd like to make lakes on the islands, with different (higher) water levels than the ocean's.

The problem is that if I put a water plane in a "hole", I can see the ocean below at best, or even worse, the upper water surface just glitches out and disappear.

One option is that I move the lake's basin higher than the ocean's see level. This works, but I it doesn't look so good, because the lake becomes too shallow.

Another option is that I cut holes in the ocean's plane, but that seems a bit overengineered, isn't it?

Is there a better solution?

Also having a water plane for every "lake tile" causes some problems:

but I want to have dynamic lakes, so having a 2x2 water plane for a 2x2 group of lake tiles isn't a walkable path.

sentences:
"Highlighting" Faces/Edges/Corners How would I "highlight" faces/edges/corners?
I would prefer an explanation OpenGL if possible.

Here's an example:

sentences:
Anyone can suggest some Game Frameworks for GNU/Linux? So I've been developing a little bit with XNA + C# in Windows, not really much: just some 2D stuff, but I've found that XNA is a really good framework.

I'm a GNU/Linux user, and I'm definitely migrating my desktop to Gentoo Linux (I've been using Arch in my laptop for a while now).

But, of course, I need a C# + XNA alternative... I'm not really an expert in any language, so I can really pick up anything (except, maybe, Functional ones), I prefer C-Like languages like Java or Ruby, I tried Python but found the Whitespace syntax confusing.

I would like to hear some of you'r suggestions, I'm not asking for "the best", but for "some suggestions", so I think this is objective enough.

Probably you're going to suggest C++ + SDL, but I would prefer something more "High Level" like XNA, but I'm open to discuss anything.

So... any ideas ?

Note: I think this questions meets the guidelines for this site, if it doesn't: please not only downvote this question, but comment on what can I do to improve it.
Thanks.

PS: 2D Games, not 3D

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:
XNA transparent objects? I've working on a voxel like game like Minecraft, but I'm not sure how I should handle alpha.  I've got the world split into chunks and I render each chunk, I have things like leaves which have alpha which is either on or off, but if you look through them you can only see other chunks which have already been rendered, here's a picture because I can't explain it.

http://i.imgur.com/EIRLa.png

It also works with leaves from the same chunk, for example if I'm looking through them from one direction to another then I can see the other leaves through the leaves, but if I'm looking the other way I get the same effect.

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:
Reliability of Google Analytics data I have developed an iOS game and currently the game is in beta phase. I have integrated Google Analytics (GA) to understand the users' behavior. I am distributing the game to my beta testers using TestFlight.

Recently, I found that number of sessions shown by TestFlight data is not matching with that of GA's data.

I have following questions:

Is GA's data is more reliable than the TestFlight's data?
Is GA suitable analytics solution for mobile games? If not, what are the reasons for that? Is Firebase analytics more reliable compared to GA?
I am looking for an analytics solution which can help to analyze behavior of each user (per user tracking instead of aggregated data). Can Firebase analytics provide this feature?

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
How to clip or mask entity in android/andengine? I want to implement masking with sprite in Andengine. I want same functionality as in ios class called

  SKCropNode

which works like an masking node!
Is there any workaround like this in andengine/opengl ?
Thanks.

Edit:
This is something I was trying to mask an entity, got no effect, any suggestion?

public class ClippingEntity extends Entity//BaseSprite
{

protected int mWidth;
protected int mHeight;

public ClippingEntity(float pX, float pY, int pWidth, int pHeight, TextureRegion t)
{
    super(pX, pY);//, pWidth, pHeight, t);
    mWidth = pWidth;
    mHeight = pHeight;
}

@Override
protected void onManagedDraw(GL10 pGL, Camera pCamera)
{

    pGL.glPushMatrix();
    {

        pGL.glEnable(GL10.GL_SCISSOR_TEST);
        pGL.glScissor(0 + (int) mX, 800 - mHeight + (int) mY, mWidth, mHeight);

        super.onManagedDraw(pGL, pCamera);

        pGL.glDisable(GL10.GL_SCISSOR_TEST);

    }
    pGL.glPopMatrix();

}

}

I have also tried Stencil Test but it just clears the color of rectangle. ref: opengl mask tests

Ultimate goal is to disable drawing changes in specific entity where it may aslo have transparent background.

sentences:
Mixing old and new state of game objects? If I have a group of game objects that are being updated each frame, and some of them query each others data like position and such, is it common practice to not care that a game object might get another game object's old state or new state depending on what got updated first? I could see that working out alright as long as the time delta between frames is small. Or is it typical to handle this either via saving one frame of old state or perhaps sorting the updates in some way?

What do well known game engines do?

Also if sorting / saving state is done, are NPCs given the new or the old state of other NPCs and the player's character?

sentences:
How to run Unity in "headless" mode? I need to run my game without graphics and user input (headless mode).

I googled it but I actually couldn't find a solution, except something like this:

using UnityEngine;
using System.Collections;
using UnityEditor;

public class a : MonoBehaviour {

    public static void BeforeBuild()
    {
        EditorUserBuildSettings.enableHeadlessMode = true;
    }
}

Unfortunately, this doesn't work for me as it seems to work only on Linux.

Am I forced to run my instance on Linux?

I would be really thankful if anyone could help me!

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:
Unity5 mixing animations with different properties Maybe there are tons of questions about this but i dont know what to look for. I have 2 animations, one is aiming a weapon and the other one is shooting.

When i aim the weapon i animate only its position upward and a little bit to the left so its in front of the camera.

When i shoot, i just rotate it a bit on the x-axis.

My problem is, when i shoot while the weapon is aimed (animated upwards and left) the whole Weaponholder get back to its initial (not aimed) position.

I thought when i just animate the position in one clip and only rotation in another i can mix them together. Am i on the wrong way or just did something wrong?

Thank you

sentences:
Transforming bounding spheres When testing bounding spheres as part of the collision detection process, I'm using this method:

    public static BoundingSphere TransformBoundingSphere(Matrix m, BoundingSphere b)
    {
        var center = b.Center;
        var edge = b.Center + Vector3.Right * b.Radius;

        var worldCenter = Vector3.Transform(center, m);
        var worldEdge = Vector3.Transform(edge, m);

        return new BoundingSphere(worldCenter, (worldEdge - worldCenter).Length());
    }

... to get a sphere in world coordinates (where m is a world matrix for the object encompassed by the original sphere).

(Yes, I'm aware that this relies on uniform scaling.)

This is obvious, reliable and easy, but is there a better way?

sentences:
How to show the bow string stretching animation (?) I was wondering how the animation in the angry birds of pulling the slingshot is done. One similar animation is available in this game but with a bow and arrow. I think both of them use the almost similar technique for it.

I tried to search for this on Google and all I got was the trajectory related stuff like calculating the trajectory of object once it is thrown. I could not find anything related to how the animation (?) for stretching the slingshot/bow string with respect to the force applied by user the bow string is achieved.

Can anybody point me in right direction in how to achieve that effect. Tutorials are welcome!

sentences:
How to get display resolution (screen size)? How to get display resolution in XNA/Monogame ?
I tried these on my monitor (1600x900):

The below give me 800,600

//1.
GraphicsDevice.DisplayMode.Width
GraphicsDevice.DisplayMode.Height

//2.
GraphicsDeviceManager graphics = new GraphicsDeviceManager(this);
graphics.GraphicsDevice.DisplayMode.Width
graphics.GraphicsDevice.DisplayMode.Height

//3.
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

//4.
foreach (DisplayMode dm in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{
    Console.WriteLine(dm.Width);
    Console.WriteLine(dm.Height);
}

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:
Object Touch/Drag Problem: Object moving to next finger My Code is as follows:

 foreach (Touch touch in Input.touches) {

        switch (touch.phase) {

        case TouchPhase.Began:

            touchPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            offset = touchPosition - GOCenter;

            break;
        case TouchPhase.Moved:
            touchPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);

            newGOCenter = touchPosition - offset;
            newGOCenter.y = 0.0f;
            newGOCenter.z = 0.0f;
            gameObject.transform.position = newGOCenter;

            gameObject.transform.position = new Vector3 (
                Mathf.Clamp (gameObject.transform.position.x, -boundary.xMinMax, boundary.xMinMax),
                0.0f,
                0.0f
            );

            break;
        default:

            break;
        }
    }

What i am doing is i am moving the player left and right along x-axis by dragging in the screen.

When i drag/move the player with one finger then it works as expected.

But when i keep another finger in the screen and take out the first finger from the screen the player comes of the second finger.

I want the player to be moved from the place where it was left instead of coming to the second finger.

[I have done]
- disabled multiTouch but it does not worked.
- user fingerIndex

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:
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:
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:
Subtracting magnitude from 2D circle contact I'm trying to create an agar.io clone. In agar.io, each player can have multiple cells that "chase" the mouse pointer. The cells can also have multiple masses and the velocity is tied to the mass. The bigger the cell, the slower it moves. The first picture in this question is a good representation of how this plays out

The cells can't overlap (mostly), so I've already implemented

check to see if they are touching
calculate how much they overlap -> distance between circle centers, minus both circle's radius
calculate a push vector -> subtract the two centers, normalize the resulting vector, and multiply by overlap value

The above code mostly works, but in the regular game if you have a smaller/faster blob moving behind a larger/slower blob, the faster blob will start to slide around the larger blob. I'm not sure how to implement that.

I think you should be able to calculate the normal to the point where the circles touch, and remove the magnitude of the "chase the mouse" velocity  in the direction of the normal? I'm not sure how to do that. Math is not my strong suit.

I took the idea for the circle collision from this link and I think my question of how to remove the velocity from the circle normal is in this link which talks about how to calculate the reflection off of a circle, but I haven't been able to translate that to code.

I'm using C++, not that that matters.

There's also the open source agar.io clones, Ogar and Agar.io-clone, but I haven't found much digging through the code with how they handle that.

sentences:
Getting an angle in degrees from north This may have been asked already, but I was unable to find it, because I don't really know what I'm looking for. I drew a picture:

I need theta. I've seen various solutions using Vector.Dot, and Math.Atan2, but they don't seem to work...

BTW, I need the output in degrees. On previous tries, I ran my results through MathHelper.ToDegrees(), but got values over 360, which shouldn't be possible.

This is my current code:

    Vector2 mouse = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
    Vector2 delta = mouse - Position;
    angle = Math.Atan2(delta.X, -delta.Y);
    angle = MathHelper.ToDegrees((float)angle);

EDIT: A little more info. I'm making a 2D game, and need the angle to 'rotate' one of  my sprites (simply changing which sprite I'm displaying). The code for how I'm doing this is below.

public static Direction GetDirection(double radians)
        {
            if (radians > GetRadians(Direction.Up).Lower && radians < GetRadians(Direction.Up).Upper)
            {
                return Direction.Up;
            }
            else if (radians > GetRadians(Direction.UpRight).Lower && radians < GetRadians(Direction.UpRight).Upper)
            {
                return Direction.UpRight;
            }
            else if (radians > GetRadians(Direction.Right).Lower && radians < GetRadians(Direction.Right).Upper)
            {
                return Direction.Right;
            }
            else if (radians > GetRadians(Direction.DownRight).Lower && radians < GetRadians(Direction.DownRight).Upper)
            {
                return Direction.DownRight;
            }
            else if (radians > GetRadians(Direction.Down).Lower && radians < GetRadians(Direction.Down).Upper)
            {
                return Direction.Down;
            }
            else if (radians > GetRadians(Direction.DownLeft).Lower && radians < GetRadians(Direction.DownLeft).Upper)
            {
                return Direction.DownLeft;
            }
            else if (radians > GetRadians(Direction.Left).Lower && radians < GetRadians(Direction.Left).Upper)
            {
                return Direction.Left;
            }
            else
            {
                return Direction.UpLeft;
            }
        }
public static Radians GetRadians(Direction direction)
        {
            Radians r = new Radians(0,0);
            switch (direction)
            {
                case Direction.Up:
                    r = new Radians(15 * increment, increment);
                    break;

                case Direction.UpRight:
                    r = new Radians(1 * increment, 3 * increment);
                    break;

                case Direction.Right:
                    r = new Radians(3 * increment, 5 * increment);
                    break;

                case Direction.DownRight:
                    r = new Radians(5 * increment, 7 * increment);
                    break;

                case Direction.Down:
                    r = new Radians(7 * increment, 9 * increment);
                    break;

                case Direction.DownLeft:
                    r = new Radians(9 * increment, 11 * increment);
                    break;

                case Direction.Left:
                    r = new Radians(11 * increment, 13 * increment);
                    break;

                case Direction.UpLeft:
                    r = new Radians(13 * increment, 15 * increment);
                    break;
            }

            return r;
        }

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:
Why the shareware (not demo) model died? In the early days of the industry, instead of fighting piracy, companies let the users share their games freely, and put some nag screen or something like that on the game.

Then they would sell DLC and expansions (yes, DLC is 20 years old actually :P), hintbooks, cheat codes, swags, etc...

Why this model died?

Note: I am talking about classic shareware, not the crippleware or demo crap.

sentences:
Was my horizontal drag performed from left to right or from right to left? I want to determine if a horizontal drag was performed from left to right or from right to left.
In addition, I want to do the same with the vertical drag.

How can I do that?

How can I check if the horizontal drag was performed from left to right or from right to left?

protected override void Update(GameTime gameTime)
    {
        while (TouchPanel.IsGestureAvailable)
        {
            GestureSample gs = TouchPanel.ReadGesture();
            switch (gs.GestureType)
            {
                case GestureType.HorizontalDrag:
                //from left to right
                Count += 1;
                //from right to left
                Count -= 1;
                break;
                case GestureType.VerticalDrag:
                //downwards
                Count += 1;
                //upwards
                Count -= 1;
                break;
            }
        }
        base.Update(gameTime);
    }

sentences:
Line renderer in 3D sorting order I'm using a line renderer as a laser aim for my character. If the aim hits an object it ends at that object. If the aim doesn't hit an object it continues a predefined distance.

If I aim at an object it works fine, if I stand behind the object it also works, but if I stand in front of it, the line is rendered behind the object creating the illussion that the character stands behind the object.

If I change the sorting order for the line I can make it to be in front of the object, but this is a bit tedious because then it will be in front of this object when it is in fact behind it.

In the screenshot below a line is drawn from the picked up C4 which is in front of the pillar, but the line is drawn behind the pillar.

Is there any way to solve this issue with a line renderer? I've been thinking of just using a cube and stretch it instead.

Thanks in advance!

Update 1: I made a cube-solution instead, but soon realized that the issue is with a shader that is set to fade/transparent and that this is due to sorting order. How can I dynamically change the sorting order in code so that my moving transparent object always appear in the correct place?

Update 2: I noticed that my own answer below isn't working 100%. It works for most scenarios but if I'm standing at origo and aiming behind a pillar the sight is rendered in front of the pillar. In the image below it is clearly visible from the top view that I'm aiming behind the pillar. (This is done with a deformed cube, the line renderer had even more issues).

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:
is mvc design pattern good for developing video games? how mvc design structure works in game development and specially in unity game development.

I know what mvc is and how it works but in coding structure for game development specially in unity I don't know how it really works.

as you may know is it a good structure for developing video games? if its a yes, why and how it should be used?

thank you for helping

sentences:
Procedural generation of heightmap for non rectangular surface I'm working on procedural generation of terrain for a continent, meaning I need a wide range of hills, mountains and valleys generated around the continent. For mountains I've adopted Amit's algorithm for island generation, which produces quite good looking mountain with very clear ridges, slopes and everything else mountain tend to have. Now my problems is with some smoother hilly terrain.

Due to a hexagonic nature of my continent, the mesh is subdivided into triangles. Also due to needing multiple mountains/hills/valleys I also split my continent into sectors, which are then stitched together easily due to the fact the edges of the sectors always have zero elevation. So the constraints are the following:

The surface is hexagonal, this actually is less of a problem, since I can still generate elevation for "square" grid and use bilinear interpolation on "real" hexagon verts.
The surface is not a square, this I have absolutely no idea how to deal with.

Now most of the terrain generating algorithms always generate the terrain on a square surface, midpoint displacement, noise, you name it. Also they don't generate zero values on the edges, which is a strict requirement for me.

Now I would really like to adopt the double simplex noise approach, but once again, I need a way to force it to always generate zeroes outside of the bounds of my polygonal sector (which obviously varies), and smooth values inside the bounds, which would form nice hilly terrain. Question is... is it even possible, or should I be looking for a diferent approach?

sentences:
JBox2D - how to get vertex positions? I've created a triangle for jbox2d...

public void createTri(){

    PolygonDef shape = new PolygonDef();

    shape.density = 2.0f;

    shape.friction = 0.8f;
    shape.restitution = 0.3f;
    shape.addVertex( new Vec2(35/RATE,35/RATE) );
    shape.addVertex( new Vec2(65/RATE,35/RATE) );
    shape.addVertex( new Vec2(45/RATE,55/RATE) );

    BodyDef bodyDef = new BodyDef();
    bodyDef.position.set(50/RATE, 50/RATE);
    bodyT= world.createBody(bodyDef);
    bodyT.createShape(shape);
    bodyT.setMassFromShapes();
}

... but when drawing it on canvas, how to I get position of all the vertexes?

with bodyT.getPosition().x and .y I can get only the center spot.

Thanks!

sentences:
What is the use case for slerp in 2D? When searching for slerp, I get this text:

  Slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation.

As far as I understand it, slerp is important for rotations in 3D, since the rotation is composed of multiple angles and it's important to consider the whole structure rather than each number individually.

However, I've also heard of people choosing between lerp and slerp for a single angle for rotation in 2D (where lerp is done with a lerp_angle method takes into account rotations in both directions). I don't understand what slerp would mean in 2D or how it would be different. Is there some case in which lerp doesn't work right in 2D? Is the behavior different, how?

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:
Unity prefab script "GameObjects" can't be ones on the scene? Currently, I have an object on the scene, and one in prefab. I want the prefab's script to reference to the object on the scene through the

public GameObject obj;

code. However, when I tried to add the object in the editor, I cant seem to be able to select any objects from the scene, only ones in prefabs.

I am quite new at unity, so am I missing something really basic here?

Thanks for any help!

sentences:
Calculating pitch angle to hit a target using a projectile that has fixed speed I am trying to calculate a vertical angle needed to hit a target at [distance, elevation] 2D coordinates relative to shooter given a fixed projectile
velocity, air drag and gravitational acceleration.

Although I operate in 3D world (minecraft) the task itself eliminates the 3D problem. Once you calculate the rotation around your axis, which is in my case just atan2(-x3D, -z3D) what I'm solving is described on this picture:

From a wikipedia article about balistics I have picked this equation. As you can see, it seems to directly solve for my angle:

$$ \theta = arctan \bigg( \frac{v^2 \pm \sqrt{v^4-g(gx^2+2yv^2)}}{gx} \bigg) $$

So I rewrote the equation in javascript as Math.atan((v*v+Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/g*x); where v is speed, g is gravitational acceleration, x is distance and y is elevation of the target.

I implemented the whole algorithm as following:

//Assumed constants
var g = 9.81;  //Gravitational acceleration
var v = 35.9;  //Experimantally measured arrow speed
//The point of player head 3D [x,y,z]
var mepoint = this.bot.entity.position.offset(0, this.bot.entity.height, 0);
//The point of the target center assuming we're at [0, 0, 0] again using 3D [x,y,z]
var point = this.target.position.offset(0, this.target.height/2, 0).minus(mepoint);
//Transfer the coordinates with regards to the bot rotation
//That is, the 2D X coordinate is the distance as seen from the top
var x = Math.sqrt(point.x*point.x+point.z*point.z);
//The 2D Y coordinate is just plain difference between elevation
var y = point.y;
console.log("|BOT: TaskShoot| Target 2D coords [distance, elevation]: ",[x, y]);
//Calculate the horizontal angle - look at the target 3D [x,z] coordinates
var yaw = Math.atan2(-point.x, -point.z);

//Calculate the pitch using the equation from wikipedia
var pitch =  Math.atan((v*v+Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/g*x);
//Since it has 2 solutions, solve for bot + and - variant
var pitch2 = Math.atan((v*v-Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/g*x);
console.log("|BOT: TaskShoot| Angles: ",[pitch, pitch2]);
//NaN test: !(NaN>=0 || NaN<=0)
//Test two pitches and avoid NaNs. If both pitches are NaN, the target is out of range.
if(!isNaN(pitch))
  this.bot.look(yaw, pitch, false, function() {_this.finished();});
else if(!isNaN(pitch2))
  this.bot.look(yaw, pitch2, false, function() {_this.finished();});
else
  this.bot.look(yaw, 0, false, function() {_this.finishedError(123, "Couldn't calculate aim pitch - out of range? Aiming straight.");});

But this calculation allways returns almost the same values for the angles:

|BOT: TaskShoot| Target 2D coords [distance, elevation]:  [ 13.027689861406742, 3.032749999999993 ]
|BOT: TaskShoot| Angles:  [ 1.5704302724148764, -1.5643119398157057 ]

1.5704 is about pi/2. I never got significantly different result than this. So what's wrong with my calculation and how should I fix it? Did I even pick the right formula?

sentences:
How to move player on unity3D? I checked the input settings. I added a speed value. I also added Time.deltaTime, but the body is not moving.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed;
    private Rigidbody rb;

    void Start () {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate () {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * speed);
    }
}

sentences:
Pathfinding with lock and key? I'm working on a game with maps that resemble lock and key puzzles. The AI needs to navigate to a goal that may be behind a locked red door, but the red key may be behind a locked blue door, and so on...
This puzzle is similar to a Zelda-style dungeon, like this picture:

To get to the Goal, you must defeat the Boss, which requires going over the pit, which requires collecting the Feather, which requires collecting the Key

Zelda dungeons tend to be linear. However, I need to solve the problem in the general case. So:

The goal could require one of a set of keys. So maybe you need to get either the red key or the blue key. Or there could be an unlocked door the long way around!
There could be multiple doors and keys of a kind. E.g. there could be multiple red keys in the map, and collecting one will grant access to all the red doors.
The goal may be inaccessible because the right keys are behind locked doors

How would I perform pathfinding on such a map? What would the search graph look like?
Note: the last point about detecting inaccessible goals is important; A*, for example, is extremely inefficient if the goal is inaccessible. I would like to deal with this efficiently.
Assume that the AI knows where everything is on the map.

sentences:
Making specific Enemy Classes So I was just looking through an old game I had made for android, and was second guessing how I was sub-classing enemy for each particular enemy in my game.  My enemy class had all kinds of properties, like sprite speed size and different bools that related to the state of the enemy...etc.  But then for each enemy in the game I created a sub-class from enemy, and all I did was set all those properties to a specific value.  Something like this:

public class Ninja extends Enemy
{
     public Ninja(Vector2 pos)
     {
         super(pos);
         this.speed = 10;
         this.sprite = Content.Ninja;
         this.size = spriteSize.Medium;
         this.hitPoints = 200;
         //..etc
     }
}

That was basically the whole class.  Looking back it seems like a waste of making a class at all, it left me with nothing else to change about that enemy, but just a convenient way to declare them.  Is this common practice?  I suppose it is nice to have all these stats grouped into 1 place, but it seems like a small amount of information to have for a whole class, maybe I'm just over-thinking this.  Does anyone else ever do similar things in their games?  Maybe it would be better to just make a static method somewhere that generates a Enemy with these stats called like CreateNinja, and save myself the clutter of having a whole class for it.  What do you guys think?

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:
Changing the position of a Gravity Controller - Farseer I'm trying to create mini black holes for my XNA game using farseer physics.

Problem is I can not get the gravity source to stick to the Body I've attached it to, as it scrolls across the screen, the gravity source simply stays in the same position. This is the code I've used.

Body blackHoleBody;
blackHoleBody = BodyFactory.CreateBody(world);
CircleShape ballShape =
new CircleShape(ConvertUnits.ToSimUnits(imageItemList[i].texture.Width / 2f), 1f);
Fixture ballFixture = blackHoleBody.CreateFixture(ballShape);

blackHoleBody.BodyType = BodyType.Static;
blackHoleBody.Position = ConvertUnits.ToSimUnits(imageItemList[i].Position);
blackHoleBody.Restitution = 0.0f;

blackHoleBody.CollisionCategories = Category.All;
blackHoleBody.CollidesWith = Category.All;

//Create the gravity controller
GravityController gravity = new GravityController(10f);
gravity.DisabledOnGroup = 3;
gravity.EnabledOnGroup = 2;
gravity.DisabledOnCategories = Category.Cat2;
gravity.EnabledOnCategories = Category.Cat3;
gravity.GravityType = GravityType.Linear;

world.AddController(gravity);

gravity.AddBody(blackHoleBody);

ballBodyList.Add(blackHoleBody);

My guess is that I need to get in the GravityController inside world, and update it's position there, but when I look I can only find the world global gravity.

If anyone could point me in the right direction it would be much appreciated.

sentences:
How do I provide incentive to a player to choose a specific option in a choice driven narrative I am making a game where the choices you make are very real and have consequences that change the way the game plays. The game is styled after Chrono Trigger or Final Fantasy, in the way it plays and the style of art.

I am writing the flow-chart for the choices and the inciting event happens when the player chooses a specific choice. I want the game to stay open and I don't want to force the player into any choice by only presenting one option.

The inciting event occurs when the player goes out to get food for his dog (or cat, depending on what pet the player chose when he was creating his character) How do I provide enough incentive to cause the player to go out and get food for his pet?

sentences: RK4 integration and Continuous Collision Detection I'm using this method to detect collision between two AABBs. The algorithm is simple, fast and works great. It uses the relative velocity between the two objects to calculate TOI. This works fine with Euler, but now i'm trying to switch to RK4, which makes it hard for me to determine the TOI since i can't just divide the distance between the two AABBs by their relative velocity. Since RK4 is so popular, how do people deal with this issue? How to calculate a TOI for a swept AABB with RK4?

sentences:
Every Item is colliding but 1 In my game I have a BULLET, MOONS, STARS, and A SHIP. I shoot bullets from the ship and hit stars or moons and collisions occur. Yet when a moon runs into my ship there is no detection even though I set the a Collider for 2D on both of them.

    void OnCollisionEnter2D (Collision2D col) {
        Debug.Log (this.transform.tag);//moon hit ship not printing
        Debug.Log (col.transform.tag);//only bullet hit moons and stars
    }

Heres a quick snippet
https://i.gyazo.com/acc0bbf5d2aab994db3a6598bfd206aa.mp4

sentences:
Why does my sprite shifts position on specific animationframe? I have created a spritesheet to create animation. Everything is working fine untill I come to a specific frame in one animation.

I have currently 3 animations loops

Idle Animation
Moving Animation
Shooting Animation

Nr 1,2 is working fine and behave like they should but when I am shooting my sprite shifts a little to the left. And I don't why it does.

Here is a gif for the animations

Here is the spritesheet I am using for the animations

And here is the code I am using for looping and shifting different animations

public void DrawSpriteSheetFrame(CustomTexture2D ct, Vector2 position, StateOfObject soo, GameTime gt, SpriteFont sf)
    {
        if (!_currentstate.Equals(soo))
        {
            _currentframe = 0;
        }
        _currentstate = soo;

        List<SpriteFrameInfo> currentLoopsheet = ct.SubTexture.FindAll(x => x.name.Contains(soo.ToString()));
        _timeSinceLastFrame += gt.ElapsedGameTime.Milliseconds;
        if (_timeSinceLastFrame > _frameUpdateSpeed)
        {
            _timeSinceLastFrame -= _frameUpdateSpeed;
            if (_currentframe <= currentLoopsheet.Count - 1)
            {
                _currentframe++;
            }
            else _currentframe = 0;
        }
        var t = currentLoopsheet.Where(x => x.name.Contains(_currentframe.ToString())).FirstOrDefault();
        Vector2 origin = new Vector2(t.width, t.height);
        var rec = new Rectangle(0,0, 400,200);
        _spriteBatch.Begin();
        _spriteBatch.DrawString(sf, "Currentsheet: " + t.name, new Vector2(100), Color.White);
        _spriteBatch.DrawString(sf, "Position X: " + position.X, new Vector2(100,150), Color.White);
        _spriteBatch.DrawString(sf, "Position Y: " + position.Y, new Vector2(100,200), Color.White);
        _spriteBatch.DrawString(sf, "SheetCord X: " + t.x, new Vector2(100, 250), Color.White);
        _spriteBatch.DrawString(sf, "SheetCord Y: " + t.y, new Vector2(100, 300), Color.White);
        _spriteBatch.Draw(ct.Texture, position, new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), Color.White, 0, origin, 1, SpriteEffects.None, 1);
        //DrawBorder(new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), 1, Color.Black);
        //_spriteBatch.Draw(ct.Texture, position, new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
        //_spriteBatch.Draw(ct.Texture, position, rec, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);

        _spriteBatch.End();
    }

sentences:
Understanding Scriptable Objects I am trying to understand the logic and functionality behind Scriptable Objects. I 've watched the provided video 2 times and I keep getting lost. I tried to follow the code as well but with no luck.

Can someone please explain to me what the Scriptable Objects are and how they work in a few lines?

[EDIT:] This Video as well as the following answers helped me understand Scriptable Objects and even better incorporate them in my own game.

sentences: How to create transfer function for temperature in 2D space I am looking for ways that can transfer temperature from tiles to tiles in space such as in Rim World, when you click on a tile, it will display the temperature on that particular tile and you can regulate the temperature in a confine space by installing air conditioner. Wonder is there any method in unity that can perform such function? Would like to learn it by myself. I am new to programming so not even sure where should I start my search.

sentences:
Handling data logic on libgdx ai state machine or in ashley system? In this below example, I've combined libgdx ashley and AI state machine. Do you think it's a good idea to handle the logic in state machine or stick on handling the data logic on System?

public enum TrollState implements State<Entity> {
     MOVE_AWAY() {
         @Override
         public void enter(Entity entity) {

         }

         @Override
         public void update(Entity entity) {
              PositionComponent position = Mappers.position.get(entity);
              ...
         }

         @Override
         public void exit(Entity entity) {

        }

        @Override
        public boolean onMessage(Entity entity, Telegram telegram) {
             if (telegram.message == 0) {
                 Gdx.app.log("Slime", "Waaaah, goo away, big daddy! yummmmmmy");
                 return true;
            }
            return false;
        }
     }
}

sentences:
Any open source editor to make video games online without programming knowledge? With Scratch we can create video games online, from its web platform, and publish them on the same web. I could download its source code and use it, as many others already did (see Scratch modifications). Unfortunately, we need programming knowledge to use it. Actually, Scratch is mainly for teaching kids to code.

I also found editors like Construct 2, GameSalad Creator and many others (just type on Google: create a video game without programming). With those editors we can create video games without coding. Unfortunately they are neither open source nor web platform. They need to be installed on Windows or Mac.

Do you know some editor like Construct 2 or GameSalad Creator but open source and executable from a web server? Maybe some HTML5 game engine can do it?

sentences:
Maya loading custom attributes from file I am trying to use Maya as my level creator. I have created some custom attributes for objects to use, and saved them out (into a .mel file). However, when I try to apply this preset to an object, the only values it uses are values intrinsic to Maya, such as traslation and scale.

The documentation on this subject is very sparse and there doesn't seem to be much information on this, so any help would be greatly appreciated.

sentences:
Is Unlimited Detail real? Many aspects of Unlimited Details Unlimited Detail Technology seems dubious to me, even the introductory paragraph (because of the usage of the word unlimited):

  Unlimited Detail is a new technology
  for making realtime 3D graphics.
  Unlimited Detail is different from
  existing 3D graphics systems because
  it can process unlimited point cloud
  data in real time, giving the highest
  level of geometry ever seen.

The quote above is from the no longer existing Unlimited Detail Technology Site (archive.org snapshot from 2011)

My question is: Does this unlimited detail technology actually exist?
And if it does, why isn't it currently being used in games?

Other references to the Unlimited Detail Technology:

Article on Rock Paper Shotgun
A video demonstration on Game
Trailers.com
An interview With
The Creator (Bruce Dell)
Article
on Download Squad

Update

Unlimited Detail recently released a new YouTube video. I'm not any more convinced. I wrote a blog post about it, as did Notch (he thinks it's a scam).

sentences:
Basic 3D Collision detection in XNA 4.0 I have a problem with detecting collision between 2 models using BoundingSpheres in XNA 4.0. The code I'm using i very simple:

private bool IsCollision(Model model1, Matrix world1, Model model2, Matrix world2)
{
for (int meshIndex1 = 0; meshIndex1 < model1.Meshes.Count; meshIndex1++)
{
    BoundingSphere sphere1 = model1.Meshes[meshIndex1].BoundingSphere;
    sphere1 = sphere1.Transform(world1);

    for (int meshIndex2 = 0; meshIndex2 < model2.Meshes.Count; meshIndex2++)
    {
        BoundingSphere sphere2 = model2.Meshes[meshIndex2].BoundingSphere;
        sphere2 = sphere2.Transform(world2);

        if (sphere1.Intersects(sphere2))
            return true;
    }
}
return false;

}

The problem I'm getting is that when I call this method from the Update method, the program behaves as if this method always returns true value (which of course is not correct). The code for calling is very simple (although this is only the test code):

 if (IsCollision(model1, worldModel1, model2, worldModel2))
                {
                    Window.Title = "Intersects";
                }

What is causing this?

The way Im drawing the scene is to load the number of elements and their coordinates from a file like this (it is called from Update method):

OpenFileDialog Otvaranje = new OpenFileDialog();
        if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.L))
            {
                this.GraphicsDevice.Clear(Color.CornflowerBlue);
                Otvaranje.ShowDialog();
                try
                {
                    using (StreamReader sr = new StreamReader(Otvaranje.FileName))
                    {
                        String linija;
                        while ((linija = sr.ReadLine()) != null)
                        {
                            red = linija.Split(',');
                            model = red[0];
                            x = red[1];
                            y = red[2];
                            z = red[3];
                            elementi.Add(Convert.ToInt32(model));
                            podatci.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSinglez)));
                            sfere.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));

                        }
                    }

And then in the Update() method I had the following code (this was my first attempt):

if(sfere.Count != 0){
for(int i = 1; i<sfere.Count; i++)
{
 if(sfere[0].Intersects(sfere[i])) Window.Title = "Intersects";
}
}

This code never returned that collision is true because the bounding boxes are moving when the box moves, and I don't know why. The code that moves the box is this:

if (Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton)
                {
                    worldKutija = Matrix.CreateTranslation(new Vector3(0.01f, 0f, 0f)) * worldKutija;
                }

So if the model is set to be the box it is drawn into the worldKutija, and all other models are drawn into world matrix so they would not move with the box model. So why are their BoundingSpheres moving? After this started happening I tried the code I posted in the original question, and got the problems I was talking about

sentences:
How to get what button was clicked on? Other contexts in which this was done I'm sure have been answered for this kind of problem before. But this has thus far been a 2 week long impasse of wittling down all the other suggestions I've seen and not one has worked.

I've got a prefab GUI with a singleton instance based script, which automatically disables itself at the start (I've tried commenting that out to see if that was it). The gui has a title text, body text, and 8 buttons. The script is meant to allow other scripts for interactive objects to safely access it and "start a conversation", using a coroutine.

I created a script for the buttons that I attach to each, that when called should set a public bool to true, indicating it was clicked, this bool is polled among the buttons to see which button the user clicked. This is then return to the script which called the GUI, and the GUI closes or waits for the next piece of the conversation. I've set everything to be enabled, and removed anything that disabled the components. I've made sure that the buttons are higher in the hierarchy than everything else, to make sure nothing else was intercepting the clicks.

I'm unable to get OnClick, OnMouseOver, OnMouseDown to be called. Debug messages never show. I've tried setting OnClick as part of the GUI where you select a function from the list, and inside of the button's code by adding a listener manually to the button. I've tried IPointerExitHandler, IPointerDownHandler, etc, also never seen anything come back from the methods.

I've tried several other methods to date to get which button I clicked, such as ray casting when the mouse button is down and checking the name for the button's name, however it always passes through to the terrain. I've tried getting the button's rect and using Rect.contain with the mouse position to see if the mouse was over the button when clicked, but this never returns true.

I'm really interested in seeing a working example where something like this has been done, so that perhaps if that doesn't work, I could at least start hunting down what might be causing a functioning example to fail, as I've no idea what's wrong at this point. Not to vent but this is very frustrating, and I feel it could be made so much simpler.

Thank you all for any help you can give, you guys have been very wonderful with my short time here.

sentences:
How to balance hybrid classes? In RPGs sometimes there will be hybrid-classed characters, ie, characters that can fill the roles of multiple characters. Sometimes they're really weak and useless because despite filling out many roles they're just not good enough to do it, and othertimes they're extremely overpowered because they can do the job of characters with a single dedicated role just as well, while still being able to do other jobs.

This often leads to either using those characters all the time, or avoiding using those characters because they're dead weight. Even just "fine tuning the numbers" doesn't seem to work because the weaker they get in regards to a dedicated role character the less useful they are overall, and then when buffing their numbers to make them more capable of holding their own makes a small reduction in power compared to a dedicated role character a minor tradeoff, because they're doing the roles of two characters in one spot.

Is there a way to actually make hybrid-role characters useful while still making players want to carry single-role characters too?

sentences:
Will Geolocations for IPs ever change? I'm making a game where the geographic location of a user is used to give them a little flag icon next to their user name. To do this, I've been using the ipstack API. However, the API only allows up to 10,000 requests per month, and since I make a request every time a user connects, this could easily lead to overuse.

Would it make sense to just store geolocation data on my server and only make a request when an unknown IP connects? Or will the geolocation data ever change for an IP?

sentences:
Formula to measure uv-mapping distortion Does anyone know a simple way of calculating (offline) the amount a texture is distorted when mapped to a triangle like the following?

Vertex   Position       UV Coordinates
A        (Ax, Ay, Az)   (Au, Av)
B        (Bx, By, Bz)   (Bu, Bv)
C        (Cx, Cy, Cz)   (Cu, Cv)

I'm expecting two outputs: one scaling factor along each of two perpendicular axes. (These axes may or may not align with the u and v coordinate axes, eg. for a texture that has been stretched diagonally)

For my present purposes I don't need to know the direction of the stretch/compression, just how much of it there is. I do not want a single area scaling factor, because a stretch in one direction plus a compression in the other could cancel out to give a result that is close to equal-area but far from undistorted.

I think I can get this by computing a matrix that maps (Bxyz - Axyz) onto ((Buv - Auv), 0) & (Cxyz - Axyz) onto ((Cuv - Auv), 0) (and the triangle normal onto (0,0,1)), then finding its eigenvalues, but it seems like this should simplify or offer some shortcut. Working out all the intermediates on paper gets pretty hairy.

My searches so far are returning a lot of advice on subjectively dealing with distortion using 3D modelling packages, not analytical methods for measuring distortion.

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:
Unity animations in iOS I'm an iOS developer and I'm trying to make 2d animations with Unity 4.3 + RageTools Pro + RageSpline. I want to integrate the animations into a native iOS application.
In Unity I have different kind of animations, different characters, and I want to control these separately in Xcode.

I know how to build unity project to Xcode and I know how to customize the Unity view in Xcode, my problem is that I can't access individually the animations, I can't loop them and I can't switch them in a specific view.
My another problem is that the built Xcode project from Unity is too large (more than 300 MB).

So the question is if I continue to develop the character animation within unity is it possible to handle separately the animations in Xcode? Or do I have to find a another solution (use another animation tool, or export from unity into some different file format like FBX).
In summary I want to make a simple iOS app with simple animations and i'm looking for the simplest solution.

Thanks in advance for your help.

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:
How do I render a cylindrical world space onto a flat, 2D view port in Unity? The question is just a logical extension of this question.

So, how should I render a cylindrical world space onto a flat, 2D view port in Unity?

Thank you.

sentences:
Adding multiple materials to a single mesh in three.js I've been doing some reading and can't seem to figure out a good way to do this..

I have a simple globe with a material on it like so:

const earthGeomerty = new THREE.SphereGeometry( 4, 48, 48 );
const earthDiffuse = loader.load('assets/drought_earth_texture.png');
const earthSpec = loader.load('assets/drought_earth_texture_bump.png');

const material = new THREE.MeshPhongMaterial( {
    specular: 0xffffff,
    map: earthDiffuse,
    specularMap: earthSpec,
    normalScale: new THREE.Vector2( 1, 1 ),
    shininess: 5,
    transparent: true,
    depthTest: true,
    depthWrite: false,
    polygonOffset: true,
    polygonOffsetFactor: - 4,
    wireframe: false
} );

and I apply this material to my earthGeometry like so:

const sphere = new THREE.Mesh( earthGeomerty, material );

but now I want to add an atmospheric glow, which I found a nice extension for and created like so:

const atmosphereMaterial = THREEx.createAtmosphereMaterial();

but after doing a ton of reading I'm unsure of how to use both material and atmosphereMaterial to my single sphere mesh.

Any help? Thanks!

sentences:
Player must places the object in the preset position I want to know how to do like this video:
https://youtu.be/6gouxqSxeG8
At the minute 3:09, the player can put the street vendor in the predetermined location (with the green arrow show that place).

Please tell me some keyword about this or video tutorial about how to implement it in unity 2d.

Thanks.

sentences:
A python script controlling a Unity game I wish to build a simple game in Unity such that the objects in the game can be controlled via a Python script (or a code in any other programming language). Is this possible? If yes then how? If no then are there any other alternatives to achieve similar results?

To make it more clear, say that I have 10 objects in my current scene. What I wish to do is to address each object individually via Python. One way of doing this is setting up keyboard bindings to select a particular object and then using keyboard and mouse events to control this object. But, is there a more cleaner (a native) way of doing the same?

sentences:
Trouble projecting pixel back to worldspace in PixelShader [DX11] For the last two days, I've been trying to get some code working to project pixels back to world space in my pixel shader. Im working on a fairly basic deferred renderer, and I'm using this world space position to calculate distance to a light, so I can calculate the light falloff/intensity.
My first thought was to take the view and projection matrix from the g-buffer pass, multiply them, take the inverse, transpose and then write to the constant buffer.
.cpp file

auto gBufferWorld       = DirectX::XMMatrixIdentity();
auto gbufferTransform   = DirectX::XMMatrixMultiply( gBufferWorld, gBufferView );
gbufferTransform        = DirectX::XMMatrixMultiply( gbufferTransform, gBufferProj );
gbufferTransform        = DirectX::XMMatrixInverse( nullptr, gbufferTransform );

---------------------------------------------------------------------------------------
pixel shader code

float4 pixelWorldPos = float4( input.TexCoord.x * 2.f - 1.f, ( 1.f - input.TexCoord.y ) * 2.f - 1.f, ( depth - nearClip ) / ( farClip - nearClip ), 1.f );

pixelWorldPos = mul( pixelWorldPos, invViewProjMatrix );
pixelWorldPos /= pixelWorldPos.w;

But, I end up getting totally incorrect values. I also tried using just the TexCoords for pixelWorldPos.xy, using the depth value sampled from the gbuffer for pixelWorldPos.z, and still, nothing seems to give me the correct world position.
I also tried using trigonometric functions to achieve this, I dont have the exact code on hand anymore, but it looked something like...
float tanHalfY = tanf( fovY / 2.f );
float tanHalfZ = tanHalfY * aspectRatio;

---- In Pixel Shader ----
float3 dir = normalize( float3( x * tanHalfX, y * tanHalfY, 1.f ) );
float4 pixelWorldPos = mul( float4( dir * depth, 1.f ), invViewMatrix );
pixelWorldPos = normalize( pixelWorldPos );

Of course I could just write an extra GBuffer texture containing each pixels worldspace position, since it would be trivial to compute in the GBuffer pass, but I'm unsure if the extra VRAM consumption is worth it, since I can just calculate in the final lighting pass.
I was hoping someone can point me in the right direction, I really didnt expect to have so much trouble with something that I thought would be so trivial.

sentences:
libgdx get rotated sprite coords points I would like to get the position of each edge of a sprite when he has been rotated.

I have no idea how to do it, I made a image to explain it.

I would like to get the X and Y position of each Red circles please thanks you
.

Sprite sprite = new Sprite(texture);
sprite.setRotation(-20);

sentences:
What are some good examples of exuberant in-game instructions for telling the player to repeatedly smash a button? What are some good examples of exuberant in-game instructions for telling the player to repeatedly and quickly press a button or perform an action? I'm especially interested in examples in retro games (e.g., from the NES, SNES, and 1980-90s arcade eras), and I would love to see examples with text, graphics, or both.

To illustrate, here are a few examples of the type of instructions that I'm thinking of:

Smash the A button to lift something heavy!
Toggle the joystick back and forth to break free!
Quickly press the button to build power in a meter!

I'm working on a 2D iOS game with retro-style pixel art, and there's a point where I want the player to quickly tap on a sprite to complete an action. I have a serviceable starting point -- the word "TAP" flashing with an arrow repeatedly moving downward beneath it:

But it still doesn't feel quite right.

I would love to see some actual examples from the golden days of 2D gaming to use as reference material. I know examples abound, but I'm just struggling to think of any concrete ones at the moment.

Can you think of any examples of this type of thing in old games?

sentences: How to make lens flare ignore layers work with first person character in Unity 5? I have a simple lens flare on my directional light (sun) and I would like the flare to only be visible when the sun is directly visible, naturally...But right now with the default ignore layers, the flare is only visible when 'Everything' is ticked. Obviously this therefore means you can see the flare through other objects which I don't want. I first thought that the camera must have been sitting 'inside' the standard assets first person character's collider, but it was definitely outside the collider so I don't see why it won't show...Could someone show me how to fix this? Thanks.

sentences:
Get device rotation in Y axis So using LibGDX accelerometer methods, I'm able to get the rotation of the device in the X and Z axes in degrees with this code:

 @Override
public void render(float delta) {
    float accX = Gdx.input.getAccelerometerX(),
            accY = Gdx.input.getAccelerometerY(),
            accZ = Gdx.input.getAccelerometerZ();

    float moduleValue = (float) Math.sqrt(accX * accX + accY * accY + accZ * accZ);

    //Here I do the gravity compensation
    accX /= moduleValue;
    accY /= moduleValue;
    accZ /= moduleValue;

    float xRotation = (float) Math.atan2(accY, accZ) * MathUtils.radiansToDegrees,
            zRotation = (float) Math.atan2(accY, accX) * MathUtils.radiansToDegrees;}

However, get the rotation in the Y axis is not that easy to obtain, and if I try to get it by this way, it returns erroneus values.

sentences:
using rperp or perp to find perpendicular of a vector i have code local coordinate

Vec2 velo = Vec2(100,0);
Vec2 Heading = velo.getNormalized();
Vec2 side = Heading.perp();
Vec2 trans = Vec2(12,12);

then i can generate toWorldCoordinate for trans vector:

word.x = heading.x* trans.x + heading.y * trans.y + pos.x;
word.y = side.x* trans.x + side.y * trans.y + pos.y;

im trying to apply example from book: game ai by example, using cocos2dx.
in cocos2dx we have rperp and perp for aplying perpendicular.
and in my POV,  cocos y is pointing up then we should use (-y,x) that is perp function.

but its seem the actor movement y is reversed then.
im realy confused with concept right hand / left hand. using rperp is fix the issue. but im still not understand why rperp should be used? afaik to make y pointing up we should use perp (-y,x) which is (1,0).perp = (0,1);// the destination is upward

sentences:
Is there evidence that downloading assets on first use rather than bundled with a game download makes a mobile game more popular? I've noticed quite a few mobile games on the Android platform recently that prompt you to download their assets package when you first run the game. As an example, The Sims 3 is available for iOS and Android devices (Android Marketplace, Apple App Store) but the iOS version seems to be much larger in size and as such probably doesn't use this system.

I can think of several advantages and disadvantages to doing this:

Advantages (to developer):

The game's store page reports the size of the app as much smaller than it is.
When a patch or update is released you don't need to download the entire application again. (Does the App Store release patches, or do you need to download the whole app again)?

Disadvantages (to developer):

You need to provide your own bandwidth and ensure download availability.
You need to poll your server for updates in the assets and ensure that you make assets available for old versions of the game.

Advantages (to a consumer):

You don't need to ensure you have space for app+assets before installing. Downloading the package manually means you can install the libs/logic/executable on your device and the assets on eternal storage such as SD card, rather than installing all to the device and moving afterwards.
It could be possible to download lower resolution versions of the assets depending on install device (somewhat unnecessary for Android as the market provides a way of supplying different packages to different devices)

Disadvantages (to a consumer):

More difficult for app to enforce that download is done over wifi rather than using up their contract bandwidth.

While I understand that direct comparisons of the two methods are difficult, I'm looking for statistics/reports preferably of the same app with control and sample groups. If that's not available, can anybody with experience with this method indicate whether users preferred not bundling assets? Does user opinion on this vary based on platform? Does the value to users outweigh the extra effort for the developer?

sentences:
xna split tileset into individual tiles I am trying to break a tileset image from my content folder into individual tiles during program. What I would like to have happen is that i can fill a list (of thing) with each possible tile so I can reference it by calling list(x).

However, in XNA I can't access the bitmap class and I can't Import it either (I might be doing it wrong) nor can I create a texture2d since where this is being called at comes from a different class file.

How do I split apart the tileset image into the separate tiles that I need and store them into a list?

sentences:
A simple "beam tracing" simulation I am trying to implement a simple beam tracing simulation. Basically it models the path of a beam within a pipe:

In the picture, the beam starts emitting from p1, hitting the boundary at p2 and reflects to p3. I was thinking of the algorithm of such a system. Assuming that all equations of the 2 blue curves are known:

1) Get the parametrized representation of original line from p1, say p1(t).

2) Equate p1(t) with both curves.

3) Find the first intersection p2, determined by the lowest value of t.

4) Get the normal at the intersection and get the equation of the reflected beam, p2(t).

5) Equate p2(t) with both curves, eventually solving for p3.

6) Repeat for as many iterations as needed.

My question is that, is there more sophisticated way of doing this? Or is there a library out there that implements this kind of functionality directly? Currently I am using C#, and looking into WPF and also OpenGL, but I am afraid that OpenGL may be too low level (?) and requires much code to achieve this.

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 get independent from GLEW dll file I'm literally an absolute noob in GL. I just wrote my first GLEW piece of code yesterday:

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw.h>

int main(void)
{
    glfwInit();
    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_WINDOW);

    glewInit();

    glfwSetWindowTitle("OpenGL Rules!");
    glfwEnable( GLFW_STICKY_KEYS );

    do{
    glfwSwapBuffers();
    }while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) );
}

This compiles just fine with (using mingw on win8 x64):

gcc opengl.c -lglfw -lglew32 -lopengl32

However, in order to run the output, I have to copy the glew32.dll to the same directory from which I'm running the program. Is there a way to get independent from the dll? Like, compiling once and using without having to carry the dll around?

sentences:
How to make this C++ game server cross platform? [Focusing on Ubuntu compatibility right now] The question's description will evolve depending on requested information or evolution of answers.
I made this C++ server for a game, which works on Windows, and would like to make it cross-platform, so it at least works on Linux (Ubuntu), macOS would be a plus i'd really appreciate, but not indispensably necessary (specially if single "cross-platform executable" isn't a possibility).
The server was programmed using VisualStudio IDE. These are all my source files I copied to another directory, including a custom static library (this one is in the same directory, the rest are all in C:/libraries):

Project dependencies are the following as configured in VisualStudio:

All libraries are to be linked statically. These are the ones my server uses:

GLM: Header only, cross platform.
Cereal: Header only, cross platform.
SFML modules: Can be linked statically. Cross platform according to them, even though this surprises me, since, for example, sfml_network module depends on winsock, which is a windows library...
MORPH_Shared_functions, My own library: Is static. It's own dependencies are the same as already listed for server, so I'm asuming that would make it cross-platform.

The entire server fits in a single executable without dynamic library dependencies. I tried moving the exe to another computer, and it works fine without the libraries installed in the system since they're merged into the executable.
According to the first answer I got, Every platform should be considered separately. So I'm focusing on Linux/Ubuntu first:
- Progress 1:
Begining with Ubuntu, I tried the g++ compiler for windows. I installed it on windows by installing MinGW, and now I can use it from windows's cmd. I tried following this nice and simple guide: https://courses.cs.washington.edu/courses/cse373/99au/unix/g++.html
From what I read, I understand a propper approach would be first compiling each .cpp individually, so I made myself a list of commands:
g++ -c -o Game.o Game.cpp
g++ -c -o CommandManager.o CommandManager.cpp
g++ -c -o ServerPlayer.o ServerPlayer.cpp
g++ -c -o ServerProp.o ServerProp.cpp
g++ -c -o ServerWorldState.o ServerWorldState.cpp
g++ -c -o UDP_Server_CS.o UDP_Server_CS.cpp

then I would do something like:
g++
-Wall
-o MORPH_Server
-Xpreprocessor SFML_STATIC
-I MORPH_Shared_Functions
-I C:\libraries\SFML\SFML-2.5.1\include
-I C:\libraries\GLM\glm
-I C:\libraries\CEREAL
-L C:\libraries\SFML\SFML-2.5.1\extlibs\libs-msvc\x64
-L C:\libraries\SFML\SFMLx64SourceAndCompile\lib\Debug
-l MORPH_Shared_Functions.lib
-l winmm.lib
-l ws2_32.lib
-l sfml-system-s-d.lib
-l sfml-network-s-d.lib
Main.o Game.o CommandManager.o ServerPlayer.o ServerProp.o ServerWorldState.o
UDP_Server_CS.o

In order to link them all together
However, the first individual module compilation attempt (Game.cpp) results in a header from my custom shared library not being found with error:
In file included from Game.h:2:0,
                 from Game.cpp:1:
UDP_Server_CS.h:1:33: fatal error: udp_network_manager.h: No such file or
directory
 #include "udp_network_manager.h"

I really don't know if I should link all libraries for each compiled module, so for now I at least tried:
g++ -c -o Game.o -lMORPH_Shared_Functions.lib Game.cpp

In order to point to my shared library, hopefully helping with pointing to it's header, but this returns the same error.
I imagine if I continued with this approach (which works for ubuntu, and no other OS's I know of), I'd first try to get the commands right for compiling, and then I could try making visual studio compile with CMake using that same commands, or something like that. I don't know too much about cmake, I only used it for compiling some libraries like sfml a few times.
Note: I already did a similar question some weeks ago (How to remotely host my c++ game server on Ubuntu?). This one is based on the same objective, but with more specifics on the case, and some actual strategies already developed.
In general I'm still looking for advice, ideas, and even specific guides.

sentences:
Sprite Animation in Android with OpenGL ES How to do a sprite animation in android using OpenGL ES?

What i have done :

Now I am able to draw a rectangle and apply my texture(Spritesheet) to it

What I need to know :

Now the rectangle shows the whole sprite sheet as  a whole
How to show a single action from sprite sheet  at a time  and make the animation

It will be very help full if anyone can share any idea's ,
links to tutorials and suggestions.

Advanced Thanks to All

sentences:
Meaning of errors when compiling Source animated assets This question will be composed of 3 somewhat separate questions regarding the creation of animated assets in Source. The documentation is quite poor and I am having a hard time understanding the errors that the model compiler throws.

1. Parent bones

I was trying to modify the collision mesh of an existing animated asset. I was able to make it work OK when animated in Blender but when compiled it throws something along the lines of "joint1 and joint2 have no parents, there can't be two root bones".

In the model viewer I can see two collision boxes, one static and another that is animated but which doesn't behave as I expected (it moves like the original collision mesh of the asset).

The problem disappears when I make all the vertices of the collision mesh have the same parent bone.
See https://developer.valvesoftware.com/wiki/Studiomdl_Data#Triangles
, it would be the  field (first column).

So the question is: does source allow you to have a collision mesh where all vertices don't share the same parent bone ? if not, how could I go around making a collision box that could be deformed (not only translated with the common parent bone) ?

2.  Conflicting bone names?

Sometimes, when creating certain skeletons the compiler throws the following error:

<Sergiy> Conflicting bone names: root vs root vs aaaa, try deleting one of the bones.
This is an old bug in studiomdl code that is about to be deprecated, so it may not be worthwhile fixing it

and the compilation is totally stopped. I tried renaming the bones, and changing the bones hierarchy to no avail. It should be noted that there are no two "root" named bones as the error might suggest. Even more, sometimes it shows three different named bones.

I don't understand what could be the cause of the error.

3. bone_followers

Finally, I noticed that the .qc of the decompiled model of some asset has a part like this:

$KeyValues
{
    bone_followers
    {
        "bone" "joint15"
    }
}

what does this (bone_followers) do?

sentences:
XNA Tile from Screen Location I have a tile based game that is in a semi-isometric view created by a transformation. The tiles are created by a Texture2d rendered on a 3d surface.

Map Image: http://balancedcms.com/Capture.PNG

I am using the following code for transformation:

View = Matrix.CreateLookAt(new Vector3(0, -1.1f, 1.6f), new Vector3(0, 0, 0), new Vector3(0, 53, 0));
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi - 2.4f, 4.0f / 3.0f, 1, 500);

quadEffect = new BasicEffect(device);

quadEffect.World = Matrix.Identity;
quadEffect.View = View;
quadEffect.Projection = Projection;
quadEffect.TextureEnabled = true;

quad = new Quad(new Vector3(0, 0, 0), Vector3.Backward, Vector3.Up, 3, 3);

My problem comes along when I attempt to get the current tile that I am hovering the mouse over. I have a mouse X and Y however I can't seem to figure out how to transform these screen coordinates into a tile X and Y. The tiles are 128px by 128px; however, after the camera transformation they are smaller on the top and larger on the bottom(to create the isometric view)

I've tried transforming the mouse X and Y with the same projection matrix. However, this didn't work. I think it is due to the view matrix not being taken into account... sample below:

Vector3.Transform(new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0), Projection);

This image may provide more information... is also shows the hours I've put into figuring this out: http://balancedcms.com/1111.png

sentences:
Efficient datastructure to store a galaxy map I'm working on a project for an intro level Ai class, and the project I've closen is to create a simulated universe in which Ai actors play against each other economically and militarily. I have the actual Ai fundamentals planned out, but I've hit a bit of a snag in trying to properly store the randomly generated game world.

The solar system objects are generated and populated randomly and the aim I'm going for is to place them in a 3d world, with x,y,z positions relative to a galactic center.

Each system should be reachable from any other system, limited only by the jump range of a given ship. Which I assume would mean that id need a 3d bounding algorithm to determine what other systems are in range.

For storing them, would a weighted edge graph be best, although the number of edges would be huge as in theory each system is reachable from any other. Or would an octree be better. And if so how would I calculate a list of reachable systems from the current system with an octree.

sentences:
How to split 2 teams for a FPS death match game in Unity? I'm making a playable one level only FPS death match game in Unity. I'm in the part where the AIs now can find and shoot their own target and keep looping to find targets until nothing left. Every AIs and including player were tagged with tag "Target" for the AIs to randomly find their target. (I already excluded self finding).

Now I want to split them in 2 teams. And here is the thing that I keep wondering. Should I use 2 tags for 2 teams (like team red, team blue for ex) then make and attach 2 scripts separately for each AI in the team (the logic in the script will be like "team red" will find game object with tag "team blue" and vice versa). Is that how it works? Is there more efficient way or should I say, "smarter" way to work around this problem?

Here is the script if you need to know more about what I am trying to say https://github.com/Bezari0us/FPS_AI_Behaviour

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:
Audio Engines , do they work on CPU, GPU or DSP I have been reading design specifications of the audio engines. What I am trying to achieve requires performance and I want to parallelize.

Only and only while reading openAL specification it was mentioned very very shortly that if hardware supports than openAL will use DSP as well.

But I am curious for other engines as well and couldn't find information for wwise for example.

In general do audio engine takes advantage of DSP or even GPU maybe ?

sentences:
How do I 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:
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:
achieve transparent object How can i achieve transparency and shadowing for a model in XNA ? Do you have a good tutorial ?

For the shadow i can manage the effect but how can i implement the transparency also ? Do i have to use the pass in effects ? And if so, how can i make an object transparent ?

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:
Canvas setTransform function clarification I'm currently building some kind of fake-3D dungeon, and I'm facing some difficulties understanding the behavior of the setTransform() function.

Here's my simplified code:

var can = document.getElementById('c'),
    ctx = can.getContext('2d'),
    angle = Math.PI / 4;

ctx.fillStyle = "grey";

ctx.setTransform(1, Math.tan(angle), 0, 1, 0, 0);
ctx.fillRect(100, 0, 50, 50);

Here's also s JsBin with the same code for you to see the result: http://jsbin.com/oxaSIpe/7/edit

Changing the x coordinate in the fillRect seems to also affect the y coordinate.
It makes no sense. Skewing an element changes its position? No documentation mentions anything like that.

If anyone could please try to explain this function and its weird behavior, I would be very grateful.

sentences:
2 cameras that each player sees through a different one Im very new to Networking in Unity 5.
Im trying to bring the finished basis for my 2 player, 1 vs 1, turn-based game I made for local multiplayer (both players on same computer) to an online matchmaking system.

In the game currently (for local), there are 3 cameras.
2 centered on separate canvases for selecting attacks for each player.

that once p1 chooses his attacks and presses continue, the camera is deactivated and the 2nd camera for p2's attacks is activated.
Once p2 presses to continue the 2nd cam is also deactivated

and the 3rd cam is put on, this camera is set on the battle arena and plays out in turns the moves picked by the 2 players through a turn-determining system.

What I want to do for the online is have both canvas cameras activated at the same time and each player to be assigned to a different camera.
So is there a good way i should do this? NetworkView on one of the cams?
Hope I explained the premise enough :P

sentences:
Randomly spawning bitmaps on cnvas I need some ideas in order to finish algorithm. I'm randomly placing objects (bitmaps) on canvas without overlapping. Time needed to finish it is my problem. When I need to spawn for example 80% of canvas it takes to long. So i was thinking : I should make some change when the bitmaps take off 50 % of canvas. I want to tell algorithm that it should generate new locations (x,y) where it is free space.

My question is : How to render new location (x,y) in place where is free space.

In summary:

Things I know :

object location (x,y)
4 corners (x,y) of object
object width, height
canvas width, height

Any suggestions?

Thanks for ideas. Now I've got problem.

OK, thanks for ideas. I've got a problem.

Link to picture: Picture with grid

I'm incrementing number of objects in cell after each adding object to grid. In the picture there are 9 possible locations for object.  Should I check 9 conditions which tells where I should increment number of objects in cell? I assume that if object is on both cells than I increment number of objects in both cells.

sentences:
What torque should I apply in Bullet to maintain a vertical orientation? I have a RigidBody in Bullet. Each frame, I want to apply torque to correct its orientation toward an upright position (i.e. near-zero pitch and roll). I know its angular velocity and orientation.

Bullet is not very well documented. I don't even know what the parameters to btRigidBody::applyTorque() mean.

How should I approach this?

sentences:
How do you develop the model matrix for an object? This might be a misunderstanding on my part but let me give you my superficial understanding of Model-View-Projection pipeline and different coordinate systems. Then I will ask a question.

As we know, we might have many models in our scene. You might load vertex attributes for each using a model loader etc. When you load the coordinates, these are in object space or model space. So they describe the object wrt a local frame. We use model matrix to transform this to world space shared by all models, a global frame let's say.

After this, we are in a huge world space. We might think this as an endless Euclidean 3D space. Here coordinates may have any value. Somewhere in the world, we have a camera and these objects in the world have different coordinates wrt. camera's frame. This is where view matrix comes into play. After applying this transformation, coordinates are in view space. In the OpenGl world, we think like the camera lies at the origin. We specify a view frustum and we do (actually delay) the clipping etc.

After this we apply projection matrix and transform this viewing pyramid into a cube that spans [-1, 1] in all the axes. This is homogeneous coordinates and we do perspective divide, clipping etc. This is my view of the whole thing, roughly.

The question is, we have routines to generate view and projection transformations given the required parameters. But how about the model matrix? For example, I load a bunny model stored in an OBJ file. It might have a coordinate value like (32.657, -12.545, 8.444). In which space are these coordinates? If it's in the model space, what is the best strategy to develop a model matrix to put this object into world space? Another OBJ model of same bunny might have coordinates all lying in [-1, 1] range for example. Does this mean this object is already transformed with an MVP? Are those model matrices related to only skeletal, hierarchical models?

I think this is a strange question so I don't see this really mentioned anywhere. But this bugs me, leaves me with a superficial understanding of whole matter. I want to truly understand.

sentences:
Script no longer working now that it is attached to a child object. Why is this? So I decided I wanted to make this script part of a separate swap-able weapon so I made a child and put the script there. Before the script worked fine but now it won't work. The script works as follows: if the left mouse button is pressed send a ray cast out forward, if it hits something matching the condition (a tag check, and distance check) parent it to the player, and if the right click button is pressed than un-parent it.

The code:

public class PhysGun : MonoBehaviour
{
    public GameObject Player;
    private bool isPlayerHolding;
    private GameObject RayCastHitObject;

    // Update is called once per frame
    void Update()
    {
        Vector3 fwd = transform.forward;

        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit, 10f) && hit.collider.gameObject.CompareTag("Pickable"))
        {
            Debug.Log("Press detected");
            isPlayerHolding = true;
            hit.transform.SetParent(Player.transform);
            Debug.Log("We hit: " + hit.transform.name);
            hit.rigidbody.constraints = RigidbodyConstraints.FreezeAll;
            MoveScrollWheel();
        }
        if (Input.GetMouseButton(1) && Physics.Raycast(ray, out hit, 10f))
        {
            hit.transform.parent = null;
            isPlayerHolding = false;
            hit.rigidbody.constraints = RigidbodyConstraints.None;
        }
        if (isPlayerHolding != false)
        {
            MoveScrollWheel();
        }
    }

        void MoveScrollWheel ()
        {
            if (Input.GetAxis("Mouse ScrollWheel") > 0f) // forward
            {
                Debug.Log("Mouse wheel up");
            }
            else if (Input.GetAxis("Mouse ScrollWheel") < 0f) // backwards
            {
                Debug.Log("Mouse wheel down");
            }
    }
}

What is wrong with my setup?

To clarify a few things...

It's not working - By this mean it does not parent the object to the player like it should.
Steps I've taken to resolve the issue (some are already above)...
Remove tag check requirement - this causes a weird issue no matter where I am it always parents the terrain to the player and causes the player fall through it.
Manually attach the player GameObject to the script.
Detach the child (and make it a sibling) and put in front to see if it works that way (it doesn't).
The raycast is hits something without the tag check (in this case the terrain as described above) but that is totally the wrong thing.
No error messages appear in the console or anywhere.
As per request here is a demonstration of the issue.

sentences:
How to implement "Flick" gesture for throwing an object in the 2D realm I am trying to implement a FLICK gesture for throwing a ball from point A to point B on the iPhone.  This is my current plan....

Using touchesBegan and touchesEnd I can find the direction I need to move the ball, and with a small counter, I can impact a certain velocity on the object.

My question is simple...

Is there a better way to do this ?

I am unaware of the physics engine and how I could use it in this scenario. Any good suggestion will help !

sentences:
Do I have to commit the downloadable assets for Unity to the repo? Or a reference for the team to download them? QUESTION (Short version)

I am going to use the Unity Test Tools asset to do unitary testing.
Q: Do I have to commit the Unity Test Tools to my repo? (using git, by the way).

CONTEXT

Team / Workflow

We are an indie team of 10 people (of which 4 coders, 2 graphics, 1 music, 2 marketing, 1 automation-test QA), remotely located.
We built the team 2 weeks ago, have explored Unity, decided that unity shall be our devel framework, and finally we did an internal silly tic-tac-toe internal for us to check the workflow.
Now we want to start developing our 1st game. Clean code. Clean repo.
Using git for version control.
We configured Unity to write all forced in text and visible metas.
We are using Unity5 free edition.

Coding

Up to now, I've managed to create a MVC schema. MonoBehaviour acts as the Controller and then we have non-dependant classes that act as the Model of our game. The controller calls methods of this model. The model throws events to notify the changes in its state.
We want to unit-test the model.

Assets

Yesterday I discovered the Unity Test Tools.
This is the only downloaded asset, the rest of the assets are made by us.
The wonderings presented by this question may happen again if we download other assets or if we want to keep a common own-made library across several games.

QUESTIONS (Long version)

As far as I've seen, assets get "copied" into your project. Okey for working. But... comitting?? I'm feeling uncomfortable.

The same way in PHP you may use composer to handle "dependencies" so if you need a library you do not commit it inside your project, you just commit a text file saying "I want this library, this specific version" -for the sake of example, you can tell composer to install PHPUnit for unit testing, and you commit the composer text file, you do not commmit a full copy of PHPUnit-, these are our questions/wonderings:

Q1) Do I have to commit all the Unity Test Tools in my repo? It is 10 Megas - may seem an overkill or not, depending on your optics... but, as it carries "examples" and I don't know how to filter what is needed and what not, it seems so overkill to me to commit all of it - but worse: this might happen with another asset that is 500 Megas for example. Committing downloadable assets seems anti-pattern. Do I have to commit?

Q2) Or it is better that I don't, and have all the members in the team to manually download the Unity Test Tools?

Q3) If they delete that repo and download it again, the Unity Test Tools seem to be kept local to the project, then a new download is imposed if it's not kept in the repo? Or Unity may store "local in your computer; still global to your projects" things like "the testing library" you are likely going to use in several projects?

Q4) Case one thinks "maybe each project needs its own version of libraries, best practice is do not keep anything global" then, committing them to the project still seems overkill... is there any standard of "config file" that I can place and then once the "git repo" is cloned, run some kind of "dependency installer" or so (much like the composer install action is to a recently cloned repo in PHP)?

I've seeked for information, but I'm still confused on this. I've seen it exists something like an "asset manager" but I'm not sure if this is what I need. Any pointer to documentation I must read will be highly appreciated.

Note that the documentation in Unity website, as for example this one: Mastering Unity Project Folder Structure - Version Control Systems does not address my specific question.

Thanks!

sentences:
Aggregated assets from demo projects in UE4 Unreal engine allows you to download demo projects under the "Learn" tab of their launcher.

 How do I access the resources and assets used in these projects in an aggregate form?

To put it simply, there are textures and meshes and such that i would obviously like to utilize in my projects. These assets do not however seem to be readily available for use in any and all projects. How do i get them all in one place so i can access them?

Thanks in advance.

EDIT: I should note that i am aware of the "Hard way" of doing it, im kinda just hoping there is a better solution...

EDIT: The hard way doesn't seem to be immediately effective... Thinking...

EDIT: It seems that some are able to be directly added to projects, im still working on figuring out how to add these to the viewport. But others (like "a boy and his kite") provide no such option. thinking...

sentences: Object floating on "top" of tilemap I've made a character design and added Rigidbody 2D and Box Collider 2D to it but when I put it on top of the ground which is in tiles in a tilemap it floats on top i.e. the tilemap consists of a hill going up then down but when I put it on the ground it goes up again in a position level to the peak of the hill   and even on top of hill it floats a little above the grid line

sentences:
Finding unoccluded tiles in tile-based game I am working on a 2D tile-based game, and right now I'm trying to get a 2d equivalent of shadow volumes to work. I'm having trouble finding the surfaces that should cast shadows. From any point in the game, I need to find either the unoccluded faces, or the whole tile.

My question is, is how can I find these tiles/edges as fast as possible given a point?

sentences: Affecting all instances of a GameObject at once I want all instances of a prefab to change their velocity when one of them is clicked, and I think having each object constantly check a variable with a coroutine might not be the best solution. How can I reference all instances of the prefab in a script efficiently?

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:
Does LibGDX share preferences with Android API? Can I get a value from LibGDX preferences like this:

Preferences preferences = Gdx.app.getPreferences("someName");
int value = preferences.getInteger("intValue");

And then in the same project, in a different activity, do this:

SharedPreferences preferences = getSharedPreferences("someName",Context.MODE_PRIVATE);
int value = preferences.getInt("intValue",0);

So assuming there is a value already stored, would both methods retrieve the same value?

sentences:
HTC Vive Grabbing Object Trigger I'm doing a HTC Vive VR game with Unity.

I have 3 objects, and I want to trigger different events when the player pick up different objects.

Since I set the rigidbody to the controller and don't want these events to be triggered by moving the objects by accident, I need to set up two rules: 1) the object is out of the invisible bounding box it is in; 2) object is being hold by he player with the trigger.

How should I script that?

sentences:
Stencil inside Stencil? (Multiple masks on same object) So please take a look at what I want to achieve

The Red and Blue part is the object I want to mask. The thing is that it will be masked by the green area, and only after that it will be masked by the cyan area, which shall act like a scrollview. Currently I use stencil shader and the first mask works, but I don't know how to apply the second mask. Also, I don't want to use the built-in UI mask system for this. All the objects in the scene are sprites.

The thing is that I would like to achieve a hierarchy masking system, where the kids are masked by a parent.

Could you please give me a tip about what I should do in this case?

sentences:
Can and should a game design be patented? I have an idea for a game that I want to develop and I feel is unique, and I'm wondering if I should patent it.  I read on the web that games can be patented, but just because it can be done doesn't mean that it makes sense to do it.

I actually don't really want patent it (it's expensive, a hassle and I don't believe in patenting of ideas... unless it's something truly revolutionary). However, I'm concerned a bigger company could come along, with more experienced game designers and developers and steal the idea.

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:
C++ - How to create an engine editor without frameworks like qt and wxWidgets? Basically sometimes I like to try to venture into the world of graphics computing, sometimes I have a project or another that uses opengl plus all the "blind" with opengl, I wanted to be able to create an editor like unreal editor or cry editor, basic functionality like dock widgets, buttons etc, and if it can be integrated with the engine, I've tried to create a windows program with WINAPI but God, that's a torture, a lot of code and in the end it's all blind, you end up having to to guess where each element should be, is usually quite limited having practically no legal content about it, on the other hand it was a hand in the wheel for me, very simple indeed, just the way I wanted it, but it does not give me the freedom that I wanted when it comes to computer graphics, I wanted to do something that was my own, without third-party codes (other than libraries like opengl, vulkan and directx of course).

I've been looking at the banshee code but I'm not sure how they did it to create that WINAPI editor, if companies like capcom and others can, then it should not be difficult.

sentences:
Why are so many games not fully voiced? I'm wondering why so many MMOs are only partially voiced? I asked makers of games (Thimbleweed Park, in their Q&A) how expensive voiceover is, and they said it wasn't especially expensive unless you hire A-list stars. So why would so much game dialogue be only present as text to be read onscreen?

The only reason I can think of is the same that exists for localization in all software: You can't record VO until all the dialogue is finished and frozen, so it is another fixed delay between finishing the rest of the game and shipping. So it doesn't seem like it's not manageable.

To be clear: I'm not looking for opinions or theories (that would only make the mods close this question) but actual reasons and experiences from people who have shipped games with partial voiceover.

sentences:
GameObject.Find() finds objects in the old scene I'm trying to create a simple scene transition. On entering a collider, there is a black canvas that's slowly faded in over the duration of 3 seconds. Then, a new scene is loaded, and the scene slowly fades from black to invisible. Now, I've almost finished it. However, I'm running into a small problem I cannot seem to fix.

The animation consists out of two text elements and one image. The hierarchy looks like this:

SceneLoader is an empty object, SceneFader is a canvas. Image is a black image stretched across the screen, and RegionName and RegionSubtext are two text elements that are filled as soon as the transition begins.

The code I'm using to load the scene is this:

private IEnumerator _loadSceneWithTransition(string sceneToLoad, Vector3 spawnCoordinates, string regionName, string regionSubtext) {
    this.screenFade.SetTrigger(SceneLoader.AnimatorTrigger);

    GameObject.Find("SceneLoader/SceneFader/Image/RegionName").GetComponent<Text>().text = regionName;
    GameObject.Find("SceneLoader/SceneFader/Image/RegionSubtext").GetComponent<Text>().text = regionSubtext;

    yield return new WaitForSeconds(4f);

    SceneManager.LoadScene(sceneToLoad);

    GameObject.Find("SceneLoader/SceneFader/Image/RegionName").GetComponent<Text>().text = regionName;
    GameObject.Find("SceneLoader/SceneFader/Image/RegionSubtext").GetComponent<Text>().text = regionSubtext;

    GameObject.Find("Player").GetComponent<PlayerMovementController>().spawnCharacterToLocation(spawnCoordinates);
}

Now, this doesn't work as I'd expect it to. The first part runs perfectly fine: The animation is started, the text is displayed and the scene changes. However, that's the part where everything breaks. As soon as the scene loads, there is no text. Also, the player position is not set to where it should be.

I really do not know why, the only reason I could think of was that the script was called in the first scene, and therefore, the GameObject.Find() calls return the elements in that scene, not in the currently used one (actually, I'm fairly sure of that because GetInstanceID() returns the same for both calls). Now, the problem at this part is that I do not know how to make that work properly. One idea I had was to do try and fetch a new instance of the script with something like: GameObject.Find("SceneLoader").GetComponent<BaseSceneLoader>() and work with that, but then I remembered I still need GameObject.Find() for this, which would probably yield the result of the old scene, so it's not helping at all. On top of that, I'm not even sure if that is the actual problem.

I'm kinda out of ideas here. I also do not know what's the best practice in that situation, and I couldn't find anything meaningful on DDG either.

Lastly, I've created a small video clip showing off the problem. I hope this helps in identifying the issue.

https://imgur.com/a/1eS8rcG

sentences:
How to clip cut-off text in a textbox? I'm writing a textbox class for my XNA game and I'm using SpriteFont to draw the text. It's only a single line textbox so when the text width exceeds the size of the rectangle box, it currently just keeps going.

In Windows textboxes extra text is cut off so that you may only see half a letter. I'd like to emulate this with my custom control. However, I see no overload with SpriteBatch.DrawString that would allow for anything that could cut off text that didn't fit within certain bounds.

Does anyone know of a method that would allow for this? I'm still quite new to the XNA API so I'm not sure what out there exists for this sort of thing.. Thanks

sentences:
Character on Moving Platform Shaky. How to Fix? I have an elevator (rigid body platform) that is meant to transport a character. The character (RigidBodyFPSController) shakes while platform descends.

What is an elegant way to fix their relative motions while the elevator is in motion, still allowing the character to move around in it?

NOTE: I tried parenting the character but that flips him on his side.

sentences:
How to handle a Google Play game's privacy policy I am trying to release a mobile game (insert obligatory sellout statement for Chunk of Space) on Google Play, and I'm worried about their privacy policy system. Basically, if you mark your game as "directed primarily towards children," you need to include a privacy policy (mostly to adhere to COPPA regulations). Now, my game isn't primarily for children, but because it's made to appeal to all ages, it's likely that I might have children playing it (or, I might have nobody play it. Hooray for insecurity). The question is, do I need to make the app say that it is "Designed for Families," or can I leave that option unchecked? Will the game not be marketed/available to children if I do not do so? And if I do need to set that option, how might I go about creating the privacy policy? I know there are several privacy policy generators online, so if you've used one or more in the past, could you recommend it to me? And how would I need to modify the policy to allow children to use it?

As for information the app uses, here's a short list:

Anything needed for Unity analytics, IAP, and ads
Anything needed for Google play IAP and ads

That's all that I know it uses, although there might be some additional information that each uses, along with any hidden Google Play and Unity stuff.

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: Can packet latency fluctuate? Can the time it takes for a packet to be transmitted from a client to the server fluctuate?

sentences:
Common practice when handling sprite animation Let's say I'm using the following sprite as a sample to try LibGDX Animation and TextureRegion.

http://www.smackjeeves.com/images/uploaded/comics/7/8/78bc6b62fEySW.gif

As you can see, the provided image above has different width & height per image. The width when Zero performs a slash is different when Zero stands.

Is it a good practice to create a padding / margin for every image so they have similar width & height. Or should I just have all the sprite cramped like that and try to handle it in the backend?

Thanks

sentences:
FPS - How to handle accuracy with red dot sight on guns I have a gun which you can aim down the red dot sight. If you are moving while aimed down sight, there is some bobbing that comes into play. The arms are bobbing, not the camera itself.

Currently when the player fires their gun, I fire a ray from the center of the camera and check for a hit on a player.

The problem is, if the player is aiming and moving, the red dot is bobbing(since the arms are) but because the camera isn't, the ray always fires down the center which doesn't line up with the red dot. It Doesn't feel right in gameplay.

I was hoping someone may have some ideas to offer on how to handle this..

sentences:
Elastically Object movement in unity3d I want to move an object towards the destination elastically. Currently I am using Vector3.Lerp it working to move the object, start with high speed and reached at destination with low speed but missing elastic effects.

float i = 50, t = 0;
        while (t < 1)
        {
            t += Time.deltaTime / i;
            transform.position = Vector3.Lerp(transform.position, newPostionAtDistance, t);
            transform.LookAt(targetFollow.transform);
            if (transform.position.ToString() == newPostionAtDistance.ToString())
            {
                //StartCoroutine(CamElasticMoveBackEffetcts());
                Debug.LogWarning("Object reached to the point.");
                yield break;
            }

            smoothTime += Time.deltaTime;
            yield return 0;
            i++;
        }

sentences:
Any good pathfinding algorithm for lots of different speed zones? NavMesh seems not work I have a terrain map with lots of different areas: roads, grass, swamp, forest, mountains. Each has different speed for the player. The map is continuous 3D map, not grids.
Given a start & end point, I want to find the shortest time path instead of shortest distance path.
I tried NavMesh with area cost as the standard solution. But it could not solve system with different speed zones correctly.
For example, given a simple NavMesh graph, each square is a nav mesh (you can think of two triangles if you like), gray is road, which has fastest speed; green is swamp, which has slowest speed. Given the start point s1 to end point e1. The NavMesh algorithm will give the direct path p1 since it's translating within one mesh, no matter what the area cost is. But the actually shortest time path would be p2: get out of swamp, then travel along the road, finally get into the swamp again.

Another example is s2 -> e2. The actually shortest time is the direct path, but the NavMesh would give the red path since each mesh only count once, without considering the path length.
So for my use case, what would be a good path finding algorithm?

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:
Unity - warning: animations neck and head have scale I always get this warning if I import my model to unity:

Clip 'soldier_idle' has import animation warnings that might lower retargeting quality:

Note: Activate translation DOF on avatar to improve retargeting quality:

    'neck' has scale animation that will be discared.

    'head' has scale animation that will be discared.

Even though there are in fact no scale animations on the bones neck and head as you can see in my blender dopesheet.

So why is this warning showing?

sentences:
How to get DXGI_ERROR description? In a D3D12 program, I encounter a DGXI_ERROR (CreateSharedHandle return an int <0), but I could not find a way to translate it into the "error description" or "error name" (or both).

I have a description by Microsoft: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-error

Is there such function out there ?

sentences:
Prevent VS Code opening the Unity scripts twice Is it possible to prevent VS Code opening the Unity scripts twice?

E.g. I opened Unity project, double clicked a script and got my project (Assets folder) opened in VS Code, now I go to Unity make a few changes and open another script file. The script file opens another instance of the VS Code. I would like to have the file opened in the currently opened instance instead of opening a new one. Is it possible?

Thank you.

sentences:
Should I use a database for storing game content? I have a 2D Game written in C++ using SFML.  I want to make the game expandable in such a way that content like items or entities could easily be added by adding a line/entry/row to a file or database.

I am looking for something that does not need to be compiled into the program, but instead can be read from and written to at runtime.  When would it be appropriate to use a database?

sentences:
Help understand Z value of CameraToWorldPoint I do not understand what this CameraToWorldPoint function is used for, what is the use case of this function:
1.From my understanding, my cursor is sitting on the near clipping plane, so I am actually clicking all the points on the near clipping plane, the near clipping plane represents my screen, am I right?
2.When I use this function to convert B point to world point, I am getting the point C position, is that true?
3.Is part A->C represent the Z value, or part B->C is the Z value?
4.Then finally, is this function useless? Because I get a world position in the predefined Z position, and I do not even know what Z value should be in the first place, I can randomly assign a pointless Z value, so what is use case for this function, I know raycast can do anything I want, but when to use this function?

sentences:
Good technological solutions to build an ascii map and moving characters in a browser (like dwarf fortress)? I'd like to build a webapp for my game website that involves using text characters to represent animals and people, and have them move around on map squares with independent (server driven) AI.

So essentially, a dwarf-fortress map in the browser:

With moving creatures, mobs, npcs and pcs.  Though not that I'm not looking to acheive this scale, I'd probably start of showing a quarter of this content or so at any time.

Probably some of the background/immobile tiles could be loaded statically.  But for creatures/animals and things that can move, I'm not sure what technology solutions would be most effective.

I'm aware of <canvas> though I don't know whether its capabilities fit this use case.  Certainly some amount of javascript is going to be necessary.

Are there javascript libraries or canvas libraries out there that fit this use case?  Another technology that I am not aware of?  Anyone know of any examples of websites that have done anything similar to this, so that I can crib ideas from them?

sentences:
Is there a free and open source 3D engine for Android? Is there a free and unlimited open source 3D engine for Android? Something that is a direct, thin layer to the NDK?

I have only found two engines: Unity and Shiva 3D. But no free or open source ones.

sentences: Pixel perfect, sharp uv mapping I'm having trouble understanding how the uv map that Blender gives you works. It gives you a map with outlines which you should color in. But if I have a low-res texture I don't know where should I color in exactly. Should I place my textures between the outlines, or should my textures overlap the outlines?

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:
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:
What would make a good cursor movement sound effect? I know specific questions like this are very borderline on acceptable - but I am having massive trouble finding a non-annoying sound effect for moving the cursor in my game.

The game is a Fire Emblem like SRPG and think it would be cool if I could have a little sound each time the cursor ticks in a menu/selection of character/etc. - it should be a non-intrusive sound (keeping in mind I can adjust volume).

What have you guys used for something like this? Going to various free soundclip sites putting in "cursor move" isn't doing much for me.

sentences:
Transforming a 2D Grid in 3D Space Hi everyone,

I'm trying to implement a 2D Grid in a simple 3D Editor. Here are some debug-rays I already implemented:

Everything is working as intended as long as the object is not rotated.
For demonstration purpose the box is aligned with the grid center (the purple box).

(I can move the object along the grid without changing the grid location):

Now if I rotate the large white cube I want the grid to rotate as well.

Here is the problem: I dont want the origin of the grid to change it's relativ location. The grid location of the green line should still align with the upper left corner of the large white box.

And I just cannot figure out the offset I have to translate the grid :(

Here is what I've tried:
Calculate the difference between the two collision points (Yellow and Green) and use this as offset but on rotation the offset is too large and the grid is shifting.

Here is the data I have available:

Vector3 Origin = new Vector3();
Vector3 GridPlaneNormal = new Vector3(0, 0, 1);
Plane GridPlane = new Plane(Origin, GridPlaneNormal);
Plane objectPlane = /*.... (it's the plane of the cubes front)*/

Vector3 GridNormalInDirectionOfObject = Vector3.TransformNormal(GridPlaneNormal, Matrix.RotationQuaternion(Object.RotationQuaternion));

float angle = GridPlaneNormal.SignedAngle(GridNormalInDirectionOfObject, GridPlane.Normal);
Vector3 rotationAxis = Vector3.Normalize(Vector3.Cross(GridPlane.Normal, objectPlane.Normal));

Please help me! :)

sentences:
Servers do not remove spawned prefab after disconnection I built a multiplayer game with the Unity UNET. For doing this I bought a VPS server. Everything works fine.
But sometimes when players want to quit the game, the servers do not destroy him from the scene!!!
& the other players still can see him in the scene till the servers being restarted and ran again!!
For quitting the game I wrote this code :
NetworkManagers.singleton.client.Disconnect();
Destroy(NetworkManagers.singleton.gameObject);

For more explanation, this is my ConnectionConfig for server & client:
MinUpdateTimeout:15
ConnectTimeout:1200
DisconnectTimeout:2000
PingTimeout:500
NetworkDropThreshold:50
OverflowDropThreshold:50
AckDelay:32
AcksType:1
MaxSentMessageQueueSize:150

Why this happening?! Did I miss something?! & how can I avoid that?!

sentences:
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: All sides shadow outline in Unity NGUI How can I make such exactly the same shadow using NGUI?

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:
libgdx continuous movement while touch and hold (even after jump)? So, I have these buttons where I have implemented a method to handle 'touch and hold' (without polling). If the player touches and holds the walk button ..it will keep walking till the button is released. Problem is when I combine jump with it ...
In the update method,

if (activeTouch) {
        translateScreenToWorldCoordinates(touchCoords.x, touchCoords.y);
         if (touchPoint.x < 5) {
           // Code for walk left
        } else if (touchPoint.x > VIEWPORT_WIDTH - 5)
        {
            // Code for walk Right
        } else if ((touchPoint.x > 6 && touchPoint.x < VIEWPORT_WIDTH - 6) && player.isGrounded() && player.getState() != Player.State.Falling) {
           // Code for Jump
        }
    }

The touchdown and touchup events,

 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        touchCoords.set(screenX, screenY);
        activeTouch = true;

        return false;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        activeTouch = false;
        return false;
    }

So i can move right,left and also jump. But my problem is, while walking if I jump ... it will jump and then stop walking. How to continue walking after the jump if the player is still holding onto the walk button?

sentences:
Unity - Tile based river generation I have made a map generation in my tile based game. It almost exactly does what I want, except for 1 thing. The rivers look like this:

The problem with this is, the water is not realistic. It are just some spots random over the world. I want to make a realistic river generation. Which would include different sizes (between 5 and 20 block wide), branches, lakes and different depths (by changing the colour of the water). What is the best way to do that?

Here is an Simcity 4 example of what I mean with realistic rivers:

My code:

waterOffsetX = Random.Range (10f, 300000f);
waterOffsetX = Mathf.Round (waterOffsetX) + 0.5f;
waterOffsetY = Random.Range (10f, 300000f);
waterOffsetY = Mathf.Round (waterOffsetY) + 0.5f;

for (float x = -gridX; x < gridX; x += 1)
{
    for (float y = -gridY; y < gridY; y += 1)
    {
        Vector3 spawnPos = new Vector3 (x, y, 0);
        float perlinWater = Mathf.PerlinNoise (x * seedWaterX + waterOffsetX , y * seedWaterY + waterOffsetY);

        if (perlinWater > perlinThresholdWater) {
        GameObject waterTile = Instantiate (water, spawnPos, Quaternion.identity) as GameObject;
    }
    }
}

Values:
seedWater (X & Y) = 0.1
Grid (X & Y) = 50
perlinThresholdWater = 0.6

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:
Intermediate AI for Java games I want to know how to create good AI for a Java game,  I'm still learning the language and I'm not an expert.
I can do static AI but wanna know about  writing an AI that follows the player and considers how to reach him via pathfinding.

sentences:
Implementing vector based movement in a 2d environment Good evening.

I apologize if the title is a bit vague, I really could not come up with anything better.
I am currently reading a book called the nature of code and as a side project, I am working on a small 2d game in javascript.

One of the core concepts of this book states that a game object should incorporate three vectors, acceleration, velocity and location, where only acceleration is directly modified by the player. This translates to the following code;

    acceleration.add(0, 0.001);
    velocity.add(acceleration);
    location.add(velocity);

This works perfectly fine and so does the the .sub() method, when I want to move backwards.
However, this requires two functions. Also, all vectors have to be positive. This is quite a pain because I now have to decide whether the applied vector is a positive or a negative one, thus requiring methods like applyForceNeg(vec) and applyForcePos(vec). I'd much rather have one method where I could pass any vector.

I have pasted some of the code here.

How would I implement this without turning the code into a complete mess?

Any help would be much appreciated.

EDIT:

I figured out what actually caused all this;

As you can see here, I initially wrote the if statement so that upon every run, acceleration gets incremented by 0.001. Then acceleration gets added to velocity, which in turn gets added to location. The problem was that I did not set acceleration back to zero.
So in the first run, acceleration is set to 0.001, so is velocity and location. However, in the second run, acceleration increases by 0.001, yielding a total value of 0.002 which in turn gets added to velocity and location. Therefore we now have acceleration = 0.002, velocity = 0.003 and location = 0.003. After the third run, velocity and location are at 0.006 while acceleration is at 0.003.

Now, when I set acceleration to zero, it reduces the problem. Only if I also reset velocity, the problem is gone. However, I doubt this is the right way to do it...

sentences:
Implementing tile-based movement on 2D platformer I'm trying to make a cinematic platformer, in the veins of the first two Oddworld games, Flashback, Prince of Persia, Blackthorne and so on. This article describes very well how this kind of movement should work:

  (...) The algorithm is then as follows:

  Create a copy of the character where he’d like to move to (e.g., if moving one tile to the right, make a copy where every tile of the
  character is shifted 1 tile to the right)
  Check that copy for intersection with the background and other characters.
  If an intersection is found, the character’s movement is blocked. React accordingly.
  Otherwise, the path is clear. Move character there, optionally playing an animation so the transition looks smooth.

  This kind of movement is very ill-suited for traditional arc-shaped
  jumps – so games in this genre often have no jump at all (Toki Tori,
  Lode Runner), or only allow vertical or horizontal jumps (Prince of
  Persia, Flashback), which are nothing but special cases of linear
  movement.

Eventhough the idea seems very clear to me, the actual implementation of it raises a lot of questions in my mind. For some of them I feel I have very complicated solutions, while I have no idea how to solve others.

For starters, the basic mechanism for moving: if the player presses right, the character will enter a "walking right". While on that state, the character will move from the starting tile until the next one, even if the player releases the right key; if the player is still pressing the key when the character reaches the next tile, the same thing will happen. However how exactly should that movement inbetween tiles work? Should it be just a regular speed being applied to the character's x position? What should that speed be in order to assure that the character will stop in the precise location in the next tile? And should that speed work with the update's delta time?

Another thing that has me at a loss is how much of the sprite's positioning has to be done by the actual x,y positioning and how much should be done inside the sprite. For example, in the case of a running jump, which is, as noted, a special case of linear movement, should there just be empty space below the character (and position the sprite by its bottom) or should the y position be adjusted accordingly?

I'd really appreciate some help with implementing this kind of platformer. That article above is the only thing I've found that sheds any light on how to do it, and I'm struggling to figured out the rest on my own.

sentences:
Using world coordinates instead of pixels I've been told that having a set pixels-per-world unit number is bad practice because it will not look the same at different resolutions. Because of this, I am trying to learn about using abstract world-space coordinates instead, however I am having some trouble understanding.

I've setup a quick test project for learning this: http://pastebin.com/GiUiR2NS
As I understand it, CAM_WIDTH and CAM_HEIGHT should be the dimensions of the world in world units. However, I must be missing something because the end result seems to have made the world 50 pixels by 30 pixels. (My "wall" texture drawn at (0,0) in the bottom left is 16x16 pixels)

I am trying to achieve a view with which I can see 50 walls on the x-axis and 30 on the y-axis. I was able to do this when using direct pixel coordinates and multiplying by 16 (the pixels-per-world-unit number), however as stated before, I don't think I want to use this method anymore because of negative affects at different resolutions.

sentences:
Why does my 2D top-down joystick code occasionally stop working? I'm working on a 2D top-down game, and am working on the player controls.

I have the following code currently controlling a player sprite:

void Update () {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        float headingAngle = Mathf.Atan2(moveHorizontal, moveVertical);
        Debug.Log("Heading angle: " + (headingAngle * Mathf.Rad2Deg).ToString() + " degrees.");
        Quaternion newHeading = Quaternion.Euler(0f, 0f, headingAngle * Mathf.Rad2Deg);

        if (transform.rotation != newHeading && (moveHorizontal != 0f || moveVertical != 0f))
        {
            Debug.Log("Turning. Rotation: " + transform.rotation + " | New Heading: " + newHeading);
            transform.rotation = Quaternion.Slerp(transform.rotation, newHeading, turnSpeed * Time.deltaTime);
        }
        else
        {
            Debug.Log("Heading in the right direction, moving...");
            transform.position += new Vector3(moveHorizontal * moveSpeed * Time.deltaTime, moveVertical * moveSpeed * Time.deltaTime, 0);
        }
    }

This code sort of works, but occasionally the player will stop moving, even though it's rotated in the direction that the joystick is pointing. When that happens, the transform.rotation quaternion will be something like '(0, 0, -7, -7)', but the newHeading quaternion will be '(0, 0, 7, 7)', like they've flipped around. When that happens, the transform.rotation != newHeading in the if condition is always true, so the else condition is never reached.

If I keep moving the joystick to different locations, eventually the player will start moving again.

By the way, I have a sprite attached as a child to a game object, and the sprite is rotated 90 degrees in the z-axis, if that makes any difference.

Any help would be appreciated!

sentences:
Change opacity of a texture in XNA 4.0 I have created a terrain using VertexPositionNormalTexture in XNA 4.0, but now I would like to allow the user changing the opacity of the terrain (from 0%, totally opaque, to 100%, totally transparent), so that user can see through it. Is there a simple way to do that?

I would also like to know how to do that if I use VertexPositionColor instead of VertexPositionNormalTexture (i.e., creating a colored terrain)

Thank you very much in advance.

sentences:
Sticking to a moving platform My character is not sticking on the platform when jumping on it, but I don't know why. I checked, and I have rigidbodys and colliders. The problem appeared when I moved the game to another hard drive.

Here is mycode:

void OnCollisionEnter2D(Collision2D other)
{
    if (other.transform.tag == "MovingPlatform")
    {
        transform.parent = other.transform;
    }
}

void OnCollisionExit2D(Collision2D other)
{
    if (other.transform.tag == "MovingPlatform")
    {
        transform.parent = null;
    }
}

Why doesn't my character stick to the platform?

sentences:
Overriden Event does not execute on Unreal I've been learning Unreal Engine through this tutorial and I am having an issue with overriding an event I created on C++ using blueprints.
So here is what I've done:

I created a class called ABasePlayer that inherits from APawn. And I am trying to make this jump.

On the unreal project settings > Engine > Input, I created an Action Mapping called "Jump" and set it to the space bar.

On the ABasePlayer, I created a function called Jump, like this:
UFUNCTION(BlueprintImplementableEvent)
void Jump();

I also created a jump impulse property, looks like this:
UPROPERTY(EditAnywhere, BlueprintReadWRITE)
float JumpImpulse;

In the SetupPlayerInputComponent function, I added the next line :
InputComponent->BindAction("Jump", IE_Pressed, this, &ABasePlayer::Jump);

Then I went to the blueprint editor of my main player, and override the function:

I then created the next blueprint to add Jump to my player:

I then added the jump impulse :

-After building and compiling, I ran the scene but nothing happened. When I press space nothing happens.
So what I did next was to try to implement jump by code instead, just to see if I can see what is going wrong with my blueprint. I went to C++, and implemented the Jump function in this way:
void ABasePlayer::Jump() {

    FVector ForceToAdd = FVector(0, 0, 1) * JumpImpulse ;
    Mesh->AddForce(ForceToAdd);

    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Jump!"));

}

Curiously enough, whenever I press space I see the "Jump" message, but there is no jumping.
My question would be, did I did something wrong? Did I oversee something in these steps that does not allow my character to jump?
Thanks in advance!

sentences:
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:
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 revert to MonoDevelop's old "ctrl-tab" behavior? I believe MonoDevelop (bundled with Unity3D) has changed its ctrl-tab and ctrl-shift-tab behavior and I would like to get back to the old behavior, as the new way frustrates my workflow.

Ctrl-tab (and ctrl-shift-tab) previously (and ought to) go to the "last viewed tab", in a similar way to how alt-tab works on Windows. Unfortunately there seems to have been a change and now it goes to the "tab on the left of the current one".

An example of why this is frustrating: quickly looking at a class definition, you hit F12 to load the definition (perhaps in a new tab), and then you want to go back to the code you were working on. Previously you could hit ctrl-tab and you'd be back there. Now you can't do that and you have to actually remember what you were doing, which isn't good for my workflow (read: ailing memory).

I'm not sure when the change happened, or if it's a setting somewhere (I can't find it). I'm running Unity 5.1.2p2 and its bundled MonoDev 4.0.1. Noticed it after a clean install of Windows 10.

How can I fix this to revert to the old behaviour, or is there some other method to jump back to the last viewed tab?

It seems pedantic but it has a major impact on my productivity.

sentences:
How to stop a host from the client script? I am developing a two player multiplayer game. Since its only two players, I don't want to keep my connection open if a player disconnects.

Now this works well from the host side, through usage of StopHost(). If the player who hosts disconnects, it disconnects both the players from the game.

But using StopHost() in the client(Player B) side does not remove the host player(Player A). In other words, the client is out of the game, but the host is still in the game.

So, what I want is if one player(host or the client whoever it is) disconnects, I want both of them to be disconnected.

So, how can I do it? Please help me with this. I have almost lost hope with UNET. Thanks

EDIT:

My setup is like this, my LobbyManager comprises of UI elements like "TitlePanel", "MainPanel", etc.  The Disconnect button is part of the title panel and gets enabled on press of Esc key. The button is linked to a script attached to the "TitlePanel". This script uses a MonoBehaviour which I changed to NetworkBehaviour in order to use [Command]. But it doesn't work as my "Title Panel" does not have a NetworkIdentity. Adding one creates even more problems

So, I thought if there was a way to send mesages from client to server without NetworkBehaviour, then maybe I could send a flag there to the server.

So is it possible?

sentences:
Memory usage increasing ~10kb every frame I am currently developing a game for Android (using the SDK) and have been trying to reduce the memory usage. I have discovered that during each frame, the memory usage increases by about 10kb. The game runs at 60fps so adds over half a megabyte every second which, over time, significantly increases the total memory usage of the game.

This is not a huge problem as, after a short while, the memory is released by the garbage collector and it returns to a normal level. Despite this, I would like to know if such per-frame memory increases are normal for games developed in Java. If not, are there any tips or solutions to reducing the framely memory increase (other than not instantiating objects in every update/draw call - I have made sure I'm not doing this).

This is the draw method for my game:

public void draw(Canvas canvas){
    if(screenScaleX > 1f || screenScaleY > 1f)
        canvas.scale(screenScaleX, screenScaleY);

    canvas.drawColor(Color.BLACK);
    if(skipFrames > 0){
        skipFrames--;
        return;
    }

    pp.preDraw(this, canvas);

    scrollX = (player == null ? 0 : player.getBounds().getX()) * SCALE_FACTOR - 1280f / 2f;
    scrollY = (player == null ? 0 : player.getBounds().getY()) * SCALE_FACTOR - 720f / 2f;

    if(battle != null)
        battle.draw(this, canvas);

    popTranslate(canvas);

    canvas.scale(SCALE_FACTOR, SCALE_FACTOR);

    synchronized(objects){
        if(objectModCount > 0){
            Collections.sort(objects, GameObject.RenderLayer.RENDER_COMPARATOR);
            objectModCount = 0;
        }

        uCopy.clear();
        uCopy.addAll(objects);
        for(GameObject obj : uCopy){
            if(battle != null)
                if(!(obj instanceof Dialog))
                    continue;
            if(!obj.shouldScale())
                canvas.scale(SCALE_FACTOR_1, SCALE_FACTOR_1);

            obj.draw(this, canvas);

            if(!obj.shouldScale())
                canvas.scale(SCALE_FACTOR, SCALE_FACTOR);
        }
    }

    pp.draw(this, canvas);

    canvas.scale(SCALE_FACTOR_1, SCALE_FACTOR_1);

    pushTranslate(canvas);

    windows.draw(this, canvas);
    guis.draw(canvas, this);
    pp.postDraw(this, canvas);

    if(FRAME_SYNC){
        if(delta > 17L && delta < 33L){
            dSyncDiff = 33 - delta;
            try{
                Thread.sleep(dSyncDiff);
            }catch(InterruptedException e){
                e.printStackTrace();
            }
        }
    }

    frameCounter++;

    if(screenScaleX > 1f || screenScaleY > 1f)
        canvas.scale(1f / screenScaleX, 1f / screenScaleY);
}

As can be seen in the code above, I do not instantiate any objects, even primitives so the memory should not increase. All of my rendering and update code follows this sort of style so should be the same. Unless Androids SDK is memory inefficient (which I don't imagine it is), I really cannot see why or how the memory increase so much every frame. I have moved all primitives that are used to members of the class that owns this draw method and done the same for all others.

Update: Could it possibly be due to unavoidable creation of strings. For example, because strings are immutable, I would have to create a new string every time I want to update the contents of some text being drawn to the screen (and this does happen framely).

sentences:
Locating point on a closed path to maximize sum of distances to a sample of weighted points I'm doing AI for a simple puzzled game and need to solve the following problem efficiently (less than 1 sec for the range specified since I need to do many iterations in a game).

  A sample of N (1 to 100,000) monsters with strength from 1 to 10,000
  are distributed on the sides of a square (0 to 200,000,000) at 1 unit
  interval starting from the upper left corner. Move hero to a point X
  on the square to maximize sum of the weighted distances to the
  monsters. A weighted distance to each monster is calculated by
  MonsterStrength*ShortestDistanceToX (by going clockwise or
  anticlockwise). X must also be on the 1 unit interval mark and the
  monsters and hero move on the sides of the square only

I have tried several approaches but none are fast or accurate enough.

The possibly complementary of this problem (minimizing the sum of distances to set of points at furthest distance from each corresponding monsters in the original set) seems to related to finding the geometric median, facility location problem, Weber problem etc.

Linear programming is also possible but might be too slow and overkilled.

Does anyone have any idea for a good approach?

Here is an illustration on a square of sides of length 3:

1-------2(M/3)-------3------4(M/1)
|                              |
12(M/2)                        5
|                              |
11(M/1)                        6
|                              |
10--------9---------8(X)-------7

if you put a monster of strength 3 at 2, one with strenth 1 at 4, one with strength 2 at 12 and one with strength 1 at 11 and the hero(X) at 8. the sum of weighted distane is:
3*6 + 1*4 + 1*3 + 2*4 = 33, which is also the maximum in this case

sentences:
Looking for an easing equation I am looking for an easing equation with the following properties:

It starts at a velocity of zero, and eases into a constant velocity of 1 for a duration of t_1 seconds (cubic, exp, or quintic, doesn't matter)
It then has a constant velocity of 1 for t_2 seconds.
Finally, it eases down to zero velocity for a period of t_3 seconds.
t_1 + t_2 + t_3 = t_max
The function starts at zero and ends at 1.
t_2 will be chosen by the easing function to satisfy (4) and (5), given t_1, t_3, and t_max.

Therefore the function has the form:

float EaseConstantVelocity(float current_time, float t_1, float t_3, float t_max)
{
    // ?
}

How do I construct such an easing function?

Edit:

What I'm looking for is conceptually similar to the CubicInOut function, except in the case of CubicInOut, t_2 is 0.

sentences:
Combining Minecraft and Dwarf Fortress: Simulating autoplay in a pseudo-infinite procedurally generated world? One of the interesting things about Dwarf Fortress (and other procedurally generated games like Civilization) is that the game simulates multiple AI factions interacting with each other over time (what might be termed "autoplay") to generate an evolving world which changes over time, even whilst the player is playing the game.

On the other hand, simulating all the factions simultaneously is surely going to become a bottleneck as the map grows. With a bigger map and more factions, the performance requirements become exorbitant. Minecraft gets around this problem by simply storing the inactive chunk in memory as-is as soon as the player leaves the area. The minecraft world is a static, never-changing place. When a player comes back from a trip, the chunk is exactly as he left it. No world evolution occurs. Everything is always the same.

The most straightforward approach to this, which is to just to make chunks remain loaded in memory even after the player is no longer in them, has the same performance issues as mentioned earlier - as the player moves across thousands of blocks, you will sooner or later run into computation limits. Moreover, this does not solve the general problem of faction simulation - factions can expand or contract through many chunks, whereas keeping one chunk loaded in memory would not affect its neighboring chunks, so that doesn't quite achieve the same effect as autoplay.

The "solution" that I thought of is to come up with a closed form formula that simulates autoplay somehow. That is, a function f(time,coordinates), such that given the time and and coordinates of a block, will tell you what state that block should be in. The problem with this is that this assumes a truly predeterministic world evolution, in which players have control over only their local chunk and no others. In other words, no butterfly effect. Furthermore, when a player leaves a chunk, he has made some changes to it, but the function cannot take those changes into account when computing the state of the block the next time the player enters it, in other words all changes that the player made to the block are lost as soon as he leaves. This is obviously not ideal.

Am I asking for something impossible?

sentences:
Orion Leap Motion`Hand' does not exist in the type `Leap.Leap' - Compile error for core assets I was playing with the example scenes provided by the Core Assets pack. Everything was working perfectly in Unity 5.3.2f1 until I opened the PinchingSandbox scene and added two script components to the HandControllerSandbox. I added Hand Cycler and Recording Controls. These scripts were available from the add component drop-down list. Naturally I planned to add my own code, but I first wanted to see if the scene would still run.

Instead of running I suddenly get hundreds of AABB aabb errors which by the look of things is still an unresolved Unity issue. So, I remove the two script components but this doesn't resolve the issue. Perplexed, given that the PinchingSandbox scene worked fine just before I added those two scripts, I waste no time deleting the project and starting afresh.

I imported the unity core assets from the unity asset store like before and now I am very perplexed that I get the following error messages (I have tried reimporting the assets):

I am using Orion, and am not using VR just yet

Related (here for reference)

https://community.leapmotion.com/t/asset-cant-work-correctly-in-unity/1716 - except the assets worked before, so I shouldn't need Unity Pro
https://community.leapmotion.com/t/error-from-new-leap-motion-core-assets-2-2-4/2759 - not exactly the error messages I get, but I have already tried reimporting so remain stumped

sentences:
Multiplayer architecture in games like Diablo 2 So I've been wondering, what kind of architecture would games like world of warcraft, diablo 2 (which is most probably a different beast than WoW) use?

As far as I know, RTS games state-syncs every client and server, and the input from the clients get relayed to the server, and all states from all clients will get the same input, because everything is synced.

And because everything is synced, state changes can be done safely, thus allowing large numbers of entities in the game (e.g zerglings), because the clients only need to know the players' inputs.

This is all fine and well, but AFAIK diablo 2 allows players to join servers mid-game, which leads me to believe they use a different architecture. I'm stumped on how they do this though, and if elegant solutions exist for such a thing. Does anyone have a better idea?

sentences:
Is there a reason not to delete the System.Collections namespace in Unity3D? I find various scripts on tutorials, books and even on the community wiki using the System.collections namespace without ever actually using it.

Is this an obscure Unity3D requirement, or are the authors using the default script template and forget/don't bother deleting the import?

sentences:
Ocean waves / ripples Any suggestions for creating ocean waves / ripples as seen in the pictures here:

http://www.pocket-lint.com/news-gallery/42042/crimson-steam-pirates-ipad-review/10#image

and video here:

http://www.youtube.com/watch?v=AtrZX3e4AL8

I was thinking of setting a background repeating tile. Then making some kind of noise tile which would mostly transparent and moving this in sections across the background tile.

Any improvements or further suggestions on this?

Cheers

sentences:
Kinetic sand simulation I want to simulate Kinetic sand's behavior in my game. I could implement operations such as slicing and cutting using simple mesh cutting algorithms but I want to implement complicated operations such as follows:

Ref video link: https://www.youtube.com/watch?v=3clqk2U3T9Y

Squishing (Time frame 1:37 to 1:40 in the ref video)
Scooping (Time frame 8:53 to 8:57 in the ref video)

I have the following questions:

What physics simulation algorithms can be used to implement the above 2 operations?
I want to implement this concept for mobile devices. Will it be computationally heavy to simulate such physics on mobile devices? if yes, are there any workaround solutions for this type of simulations?

I would appreciate any suggestions and thoughts on this topic. Thank you.

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:
calculating the weights for direction vectors to a target I have an entity that is allowed to move in a fixed amount of directions. Let's call a the angle between two directions. r is the length of each direction vector. Now the entity wants to head from its current position (x1,y1) to a target (x2,y2) in one of the fixed directions. Instead of getting the direction that the entity should head into, I want to get a weight for all directions that is based on how close the entity gets to the target with that direction, so that I can combine those weights with other things like avoiding some direction for example.

I thought about calculating the distance from the new positions to the target and then use the closest distance (the one in which the entity heads in the direction directly to the target) to get a weighting from 1 to zero for the other directions.

Now I was wondering if there is some other way to get the weights without having to calculate the distance for each direction. Maybe there is some sort of relation between the angle from the ideal direction and the distance that could be used to calculate the weights instead? So far I've figured out that at least there is no no linear relation between the angle and the distance.

Here is an image to hopefully clear things up a bit:

sentences:
c++ opengl unproject not working first of all, sorry for the bad english.

I need to convert my mouse coordinates to world coordinates,
I'm trying to use the glm unproject method.
1280x720 is the size of the window, It's hard coded just for the test.
The View and Projection are my matrices, they're fine and are not related to the problem (or so I guess).

EDIT: Success. The solution is:

int x,y;
glfwGetMousePos(&x, &y);

GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);

y = viewport[3] - y;
float depth;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);

mousePos = glm::unProject(vec3(x, y, depth), View, Projection, vec4(viewport[0], viewport[1], viewport[2], viewport[3]));

This method seem to have worked.

sentences:
How to limit camera pitch (x rotation) between two angles I use this script rotate the camera on its local X axis:

 float v = verticalSpeed * Input.GetAxis("Mouse Y");
 transform.Rotate(-v, 0, 0);

Right now this lets the player look up & down without limit, wrapping around a full 360 degrees. How can I limit this so they can look only 90 degrees up or 90 degrees down from the horizon?

sentences:
C++ Opengl transforming a glm::vec4 with a glm::mat4 Its easy enough doing it on the gpu via GLSL, but how would I do this in c++? When I try it gives me an error telling me I cant cast a glm::mat4 to float, Which makes sense, but how should I do it?

EDIT

A little code example of my failed attempt:

glm::vec4 Off = glm::vec4(0, 0, 0, 1);
Off *= Util::createTransform(offset); // Util::createTransform(...) Creates a glm::mat4

for (int i = 0; i < Tvertex.size(); i++) {
    Tvertex[i] += glm::vec3(Off.x, Off.y, Off.z);
}

sentences:
How do I set up moving platforms in a 2D side scroller to interact with the player properly? Edit: I changed the way that gravity was applied so that it is applied even when a player is standing on a block, so instead of the game outputting that you are stepping on a tile as true and false (because if it is true gravity isn't applied, and it is moved out of collision thus in the next frame it does not collide) so now I'll be easier to check if the player is still colliding with a moving tile. I think that I will make a bool that checks if the player was colliding with the tile in the last frame, and if so set the velocities to equal that of the tile plus whatever they are doing (jumping, gravity, walking left and right).

I am trying to create moving tiles such as the ones in basically any platformer. The game is a 2d sidescroller, and the problem that I am running into is handling standing on moving tiles.

The tiles are stored in a vector, but I am unsure how to make it so that the play will have the same y and x velocity as the tile they are standing on, as well as not fall off it.

I was thinking of creating a pointer to the tile they are colliding with on the top (that is standing on it) and setting the velocities to be equal to that plus whatever the player presses (so going left or right or jumping).

However, I am unsure how to check if they collide and how to check if the player had jumped off the tile. I know how to check if the player's collision is at the top using half widths and half heights, but beyond that is a mystery.

sentences:
2.5D game development 2.5D ("two-and-a-half-dimensional"), 3/4 perspective and pseudo-3D are
  terms used to describe either:

  graphical projections and techniques    which cause a series of
  images or    scenes to fake or appear
  to be    three-dimensional (3D) when
  in fact    they are not, or
  gameplay in an otherwise    three-dimensional video game that is
  restricted to a two-dimensional
  plane.

  (Information taken from Wikipedia.org)

I have a question based on 2.5D game development. As stated before, 2.5D uses graphical projections and techniques to make fake 3d or a gameplay restricted to a two-dimensional plane.

A good example is a TQ Digital made game: Zero Online (screenshot) the whole map is made of 2d images and only NPCs and players are 3d.

The maps were drawn manually by hand without any 3d software rendering. As I'm playing the game I feel like I'm going from a lower part of the map (ground) to a higher one (some metal platform) and it feels like I'm moving in 3 dimensions. But when I look closely, I see that the player size didn't change and the shadow too but I'm still feeling like I'm somehow higher then before (I had rendered a simple map myself that I made in 3dmax but it didn't quite give the result I wanted).

How can you accomplish such an effect?

sentences:
OpenGL: Drawing to a texture Well im just a bit stuck wondering how to draw an item to a texture.

Edit:
Well unfortunately my graphics card doesn't support FrameBuffer Objects :/. So i've been trying to get the copy contents from backbuffer method working.

Edit:
So i've been trying now for the best part of a couple of hours to get this thing working. Unfortunately all i still get is a white square.

Here's my little testing code that i have set-up. What it should do is draw a red square at 100, 100. But even this isn't working for me :/.

glViewport(0 , 0, 512, 512);

glPushAttrib(GL_CURRENT_BIT);
glColor4ub(255, 0, 0, 255);
glBindTexture(GL_TEXTURE_2D, Texture);

glBegin(GL_QUADS);

// Top-left vertex (corner)
glTexCoord2i(0, 0);
glVertex2i(100, 100);

// Bottom-left vertex (corner)
glTexCoord2i(1, 0);
glVertex2i( 100 + 200, 100);

// Bottom-right vertex (corner)
glTexCoord2i(1, 1);
glVertex2i( 100 + 200, 100 + 200);

// Top-right vertex (corner)
glTexCoord2i(0, 1);
glVertex2i(100, 100 + 200);

glEnd();
glPopAttrib();
glLoadIdentity();

//Copy Our ViewPort To The Texture
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 512, 512, 0);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
//Reset Viewport
glViewport(0, 0, 768, 480);

glBindTexture (GL_TEXTURE_2D, Texture);
glEnable(GL_TEXTURE_2D);

glBegin(GL_QUADS);

// Top-left vertex (corner)
glTexCoord2i(0, 0);
glVertex2i(0, 0);

// Bottom-left vertex (corner)
glTexCoord2i(1, 0);
glVertex2i( 0 + 512, 0);

// Bottom-right vertex (corner)
glTexCoord2i(1, 1);
glVertex2i( 0 + 512, 0 + 512);

// Top-right vertex (corner)
glTexCoord2i(0, 1);
glVertex2i(0, 0 + 512);

glEnd();
glDisable(GL_TEXTURE_2D);

Screenshot of the current output:

Any help is greatly appreciated!

sentences:
Run a Script at Game Startup in Unity I have a script that is made to run when the game is loading.
That script set the resolutions, fullscreen, and loads other screen and important settings and it applies them.
I have the script attached to a gameObject in the main screen that have some game and scene scripts.
The problem is that everytime that you return to the main scene, that script runs again and cause several bugs.
So, there is a way to run a script only at game startup?

sentences:
How to use touch screen for movement instead of keyboard narrow keys I wrote this code and run the game on my desktop, now I need to build this game for android and I need to change to touch to move the player, what it should be changed in the following code and what is the necessary steps to build my desktop 2D game to be run on android device, the following is the player code:

#pragma strict

var speed : int = 5;

function Start () {
}

function Update () {

  if(Input.GetAxis("Horizontal") >0){

    if(collided_with != null) {
      if(collided_with.tag== "Right") {
        //collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }

  if(Input.GetAxis("Horizontal") <0) {
    if(collided_with != null) {
      if(collided_with.tag == "Left"){
        // collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }
}

sentences:
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:
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:
Unity3d crash on Launching on Ubuntu I have a problem that bugged me for quite some time now
I'm trying to Install Ubity3d on Ubuntu
I Followed some instructions that i've found after some research
I downloaded and installed UnityHub and the latest release (UnitySetup-2019.1.0f2) that i found on Unity on Linux: Release Notes and Known Issues

and i moved the installed unity file from Home to opt folder and made it run on command unity3d and here is what i did exactly

sudo mv Unity-2019.1.0f2 /opt/Unity3D
sudo ln -s /opt/Unity3D/Editor/Unity /usr/bin/unity3d

and the problem is that every time i open Unity editor (via both the command line and UnityHub) the unity Launcher appears for moments to proccess and then crashes and the editor doesn't open and the error changes everytime i try to open the program here are 3 forms of errors that appeared to me, here is the first

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
[Unity Package Manager (Upm)]
Parent process [5258] was terminated
Segmentation fault (core dumped)

and the second

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
(unity-editor:6651): Gtk-CRITICAL **: gtk_file_chooser_widget_set_current_name: assertion 'priv->action ==
GTK_FILE_CHOOSER_ACTION_SAVE || priv->action ==
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER' failed
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
[Unity Package Manager (Upm)]
Parent process [6651] was terminated
Segmentation fault (core dumped)

the third is

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
[0616/110743:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See
https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[0616/110744:ERROR:browser_main_loop.cc(207)] Gtk:
gtk_window_present_with_time: assertion 'GTK_IS_WINDOW (window)' failed
ATTENTION: default value of option force_s3tc_enable overridden by environment.
USER@USER:~$ [Unity Package Manager (Upm)]
Parent process [7583] was terminated

and stuck on that....
well i know that there's something wrong with GTK but i have no experiace with it and i didn't find anything useful on this matter on google

  OS: Ubuntu 16.04 LTC

sentences:
Why scale of my new UI texture differs so much comparing to other GUI elements? I have created an UI Texture and set Texture to my .png file. The size was only 256x256 but in the canvas it appears huge. I can change it to minimum 2x2 which is still big.

If I compare it to other elements that are 135x135, they are a lot smaller...

So why is that happening and how can I fix it?

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:
Scaling a GameObject for a progress bar representation I am trying to implement a progress bar system for my game. I know that it could be done with Unity's OnGUI and scaling with width of the texture but I don't want it to be a GUI element because in my game we would have several progress bars for each specific item.

In the below image you can see two of the progress bars and they are textures mapped on to a plane.

The actual progress bar that needs to increase/ decrease in width is just a gameObject. I could just localScale and just scale it in the x direction of the gameobject but that scales in both directions. So scaling is not a solution. How do I make it work such that it I could control its width? Is there any other way I could implement this system? Or could I just use Unity's OnGUI for this purpose? Thing is this progress bars need to show up in the game on top of several gameOjects in the perspective camera view. So I am not sure if OnGUI would work for that. Any ideas?

I want something similar to what we see in games like LoL where they have health bars on top of the in game characters like in the image below

sentences:
Can i make a Game for play store on my own I am not sure what i am asking for. Sorry if this question look stupid.

I love to play games on android and pc . Some times very cool  ideas strike me , but i don't know what to do with them. and they vanish over time.

I got no computer science background , since i am a math student . Although i learned C++ for a week for a exam. In short I know C++ but just the alphabets.

Is it possible that i can learn to make games. What should i have to learn.
Is it possible to learn from youtube. Since it's like side hobby i can give it few hours a day ( not money ).

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: 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:
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:
Altering pixel value in an SDL2 texture Alright, I have spent a lot of time on this one, so I need some help. I like the ability to draw pixels directly to the screen, sometimes I do this to trace the path of objects for debugging etc. In SDL 1.2 you could do something sort of like this :

//make screen
SDL_Surface * screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
//make surface
SDL_Surface * pSurface = SDL_CreateRGBSurface( SDL_SWSURFACE, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, 0x000000ff,0x0000ff00,0x00ff0000,0xff000000);
//get the pixels
Uint32 * pixels = (Uint32 *)pSurface->pixels;
//set a pixel to red
pixels[ x + ( y * pSurface->w ) ] = SDL_MapRGB(pSurface->format, 255, 0, 0);
//blit to screen
SDL_Rect offset = {0,0,0,0};
SDL_BlitSurface( pSurface, NULL, screen, &offset );

This would result in a red pixel being displayed, you could make a simple line across the screen with a loop. Now SDL2 is really blowing my mind at the moment, here is what I've got:

//setup
window = SDL_CreateWindow("test",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,SCREEN_WIDTH, SCREEN_HEIGHT,SDL_WINDOW_SHOWN);
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 32, 32, 32, 255);
//make surface and texture
SDL_Surface * pSurface = SDL_CreateRGBSurface( 0, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, 0x000000ff,0x0000ff00,0x00ff0000,0xff000000);
SDL_Texture * pTexture = SDL_CreateTexture( renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_STREAMING,SCREEN_WIDTH,SCREEN_HEIGHT);
//from texture into surface
SDL_LockTexture(pTexture, NULL, &pSurface->pixels, &pSurface->pitch);
//get the pixels
Uint32 * pixels = (Uint32 *)pSurface->pixels;
//set a pixel to red
pixels[ x + ( y * pSurface->w ) ] = SDL_MapRGB(pSurface->format, 255, 0, 0);
//surface back to texture?
SDL_UnlockTexture(pTexture);
//clear the screen, then copy the texture to framebuffer, then update
SDL_RenderClear( renderer );
SDL_Rect renderQuad = {0,0,0,0};
SDL_RenderCopy( renderer, source, clip, &renderQuad );
SDL_RenderPresent(renderer);

This does nothing, except to fill the screen with the RenderDrawColor. What am I doing wrong..?

sentences:
Farseer Player Movement and Collision I have added a video link for any one who whats to see what the problems are by watching the game.

I am trying to create a player movement system and there are small problems that I am running into.

I want to find the most accurate way of knowing if player is colliding with another object. I tried using if (Player.Body.LinearVelocity.Y == 0.0f) then player is not jumping and on ground. But if I add force to the X axis the y will fluctuate.   I also tried to use OnCollision but am confused on how to use it.

What is the best way to know if the player is colliding with the ground and can jump?
The player slides across the ground like it's ice how do i fix this problem? How would I make it into quick and sudden stops with little sliding.
Lets say I had a one color texture, and I wanted to use it on a rectangle and a circle but could not bother to make 2 textures and just want to do it in the coding. How could I make this texture go from a rectangle to any shape I want?
If OnCollision is the best way for me to detected where the player is hit (left, right, top, or bottom) and then use for the best and quickest collision test, were can I learn how to use this thing properly?
Here is the Video.
How do you delete an object, I got the texture to go but not the object itself. The objects are spawned in and then stored on a list. How do you remove them from the list?
How come the player on the top left is more clearer then the player being controlled?

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:
Sprites rendering blurry with velocity After adding velocity to my game, I feel like my textures are twitching. I thought it was just my eyes, until I finally captured it in a screenshot:

The one on the left is what renders in my game; the one on the right is the original sprite, pasted over. (This is a screenshot from Photoshop, zoomed in 6x.)

Notice the edges are aliasing -- it looks almost like sub-pixel rendering. In fact, if I had not forced my sprites (which have position and velocity as ints) to draw using integer values, I would swear that MonoGame is drawing with floating point values. But it isn't.

What could be the cause of these things appearing blurry? It doesn't happen without velocity applied.

To be precise, my SpriteComponent class has a Vector2 Position field. When I call Draw, I essentially use new Vector2((int)Math.Round(this.Position.X), (int)Math.Round(this.Position.Y)) for the position.

I had a bug before where even stationary objects would jitter -- that was due to me using the straight Position vector and not rounding the values to ints. If I use Floor/Ceiling instead of round, the sprite sinks/hovers (one pixel difference either way) but still draws blurry.

sentences:
Shading a concave cube as a convex cube with forced perspective Context
I'm building a graphics pipeline for voxel volumes. I'm using an existing game engine (Bevy) which provides a way to put an object in 3D space. In my application, the voxel volumes can be oriented arbitrarily and are not necessarily axis aligned with respect to the world space. The pipeline does front-face culling of these voxel volumes to allow the camera to go inside the bounds of the volume without clipping (imagine a player walking into a sparsely populated volume and looking around). The voxel volumes are rendered using ray marching, starting from a ray's contact point with the front face of the voxel volume.

The Problem
Now of course, this works if there are front faces, but as I said I'm culling them. So what really happens is my frag shader is shading the near side of the cube's back faces. What I need to do is: given the point of contact with the cube's back face, and the direction to the camera, find the point that would have been hit on the front face. This will allow the rest of the program to ray march as though the ray hit a "convex" cube. I've spent quite a while looking at this answer but so far I've been unable to implement it into my shader -- I think it's relevant: https://stackoverflow.com/questions/4248090/finding-the-length-of-a-ray-within-a-cube
Assumptions:

Voxel volume axes are perpendicular to each other, but are not necessarily the same length
A ray from the camera to a back face can hit any one of the 3 back faces, and will only pass through any one of the 3 front faces

Expected Result
Here's an example of what I expect. Below (first image) is what is rendered without "simulating" the front face positions. The second image is what would be rendered with correct front face simulation.

Partial Code
I've removed the irrelevant code. Right now what is rendered for a voxel_volume_size = (16, 16, 16) is 3 16x16 walls along the axes. Of course what should be seen is a 16x16x16 voxel cube.
voxel.vs
#version 450

layout(location = 0) in vec3 Vertex_Position;
layout(location = 1) in vec3 Vertex_Normal;
layout(location = 2) in vec2 Vertex_Uv;

layout(location = 0) out vec3 v_Position;
layout(location = 1) out vec3 v_Normal;
layout(location = 2) out vec2 v_Uv;

layout(set = 0, binding = 0) uniform Camera {
    mat4 ViewProj;
    mat4 View;
};

layout(set = 1, binding = 0) uniform Transform {
    mat4 Model;
};

void main() {
    v_Normal = Vertex_Normal;
    v_Position = Vertex_Position;
    v_Uv = Vertex_Uv;
    gl_Position = ViewProj * vec4((Model * vec4(Vertex_Position, 1.0)).xyz, 1.0);
}

voxel.fs
#version 450

layout(location = 0) in vec3 v_Position;
layout(location = 1) in vec3 v_Normal;
layout(location = 2) in vec3 v_Uv;

layout(location = 0) out vec4 o_Target;

layout(set = 0, binding = 0) uniform Camera {
    mat4 ViewProj;
    mat4 View;
};

layout(set = 1, binding = 0) uniform Transform {
    mat4 Model;
};

layout(set = 3, binding = 0) buffer VoxelVolume {
    vec3 voxel_volume_size;
};

void main(void) {
    vec3 Normal = mat3(Model) * v_Normal;

    vec3 scale = voxel_volume_size / 16.0;

    mat4 InverseView = inverse(View);
    vec3 CameraPosition = (Model * vec4(vec3(InverseView[3]), 0.)).xyz;

    vec3 BackFacePosition = v_Position;
    vec3 BackFaceModelPosition = (Model * vec4(BackFacePosition, 1.0)).xyz;
    vec3 BackFaceRayDirection = normalize(BackFaceModelPosition - CameraPosition);

    vec3 FrontFacePosition = ?;
    vec3 FrontFaceRayDirection = ?; // Differs from BackFaceRayDirection when front face is perpendicular to back face

    vec3 ScaledPosition = ((FrontFacePosition + (scale / 2.0)) / scale) * voxel_volume_size;

    o_Target = vec4(floor(ScaledPosition) / voxel_volume_size, 1.0);
}

I would be extremely grateful if someone could help me fill in those missing variables! Thanks.

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:
Plotting 2D map coordinates to OpenGL 3D projection I’m trying to convert a 2D map created in my map editor to a 3D plotting with OpenGL. This is my map generated in my map editor:

Those vertices are relative to my Cartesian origin world coordinate (top up of the picture) and I’m applying this formula to convert it to an OpenGL object coordinate:

World size: 800x600

x = (X / 800) -0.5
y = (Y / 600) -0.5

Getting this result:

(First object face)

−0.48625, 0.068333333
0.12625, 0.07
0.12875, −0.481666667
−0.4875, −0.486666667

Plotting this vertex buffer in OpenGL, I got a very weird result. So how can I get a 3D model from those vertex positions? Like this picture:

I’m rendering OpenGL in triangles mode and using this example as the start point: https://github.com/JoeyDeVries/LearnOpenGL/blob/master/src/1.getting_started/7.4.camera_class/camera_class.cpp

Edit:

Using the conversion formula + the Earcut tessellation (https://github.com/mapbox/earcut.hpp), I've finally got this rectangle rendering correctly inside OpenGL. With two planes with just the Z-axis different, now the problem is how to render its laterals since Earcut just works with 2D coordinates...

sentences:
Applying multiple forces on a particle If I have a particle, say in a polar coordinate grid, and I want to apply multiple vectors to it, how can I calculate where it's final position will be given those vectors?

Ex. Imagine there's a force represented as a vector, that moves the particle a radius magnitude of 8 at an angle of 45°. Another vector that acts on it at the same time, at magnitude 3 at 90°. How would I calculate the final position of the particle?

sentences:
How do I keep my character centred on screen? I am making a game similar to Legend of Zelda: Link to the Past (top-down 2D action-adventure). I want the character to stay centred on the screen when he moves.

Currently, whenever the player wants to move, I move all of the map in the opposite direction. This works, but as I add more objects to the world, moving them all gets more complicated.

Is there a better way of approaching this?

sentences:
Unity: Disable push on dynamic Rigidbody2D objects I have a player, and several NPCs.
I also have several static colliders in the world (trees, water, fence, etc), I want my NPCs to collide with this, so the Rigidbody2D needs to be dynamic, since kinematic does not collide with static colliders (colliders without a rigidbody).

My problem is that since both player and NPC have dynamic rigidbodies, they push each other when they collide.
I could disable this by setting the following in the NPC script:

void OnCollisionEnter2D(Collision2D other){
    if (other.gameObject.name == "Player") {
        isMoving = false;
        myRigidBody.isKinematic = true;
    }
}

However, the NPC still gets pushed a few pixels before it stops, its barely noticable, but it is noticable, and if you keep colliding with the NPC you could move it as far as you wanted (tedious, but possible).

I've spent a few hours looking and cannot find a good solution to this.
I want my NPC to collide with static colliders, but I don't want them to get pushed by the player. How can I solve this?

sentences:
undo touchdown in LibGDX with scene2D i'm making a game in libgdx and i have a question.

I have a Button from scene2d. If there is a touchDown event on this button, i want the touchUp event  only inside my button.

Now if i touchDown a button, then swipe outside my button, libgdx consider this like a touchUp.

I know that i can extend stage and work with it, the question is if there is a simple way to do this...

sentences:
Is there a reason to keep maps in memory? I've noticed for a long time that games (mostly FPSes) do not unload the map when the user has finished with it (aka, disconnecting from servers, server changing maps).

The result of this is that the maps are kept in memory, which can lead to colossal memory usage in the region of 5GB for a 2 hour session of CoD:Black Ops 2 or around 8GB for a session of the same time of Crysis Wars.

Games most notable for this behaviour (that I've noticed) are the Crysis series and Call of Duty: Black Ops 2.

I've noticed this for years, but now as I am 'upgrading' Crysis Wars (fixing bugs, adding features, and porting it to my new multiplayer network) I have been able to unload maps when the game is done with them. As a result after two hours of playing the memory usage has dropped from an average of 8GB to just 2GB (I jumped between servers a few times when testing this out).

Is keeping maps in memory when the game doesn't need them anymore a bug, or is it purposeful? This 'memory-leak' exists in other Crysis games and also the Call of Duty series (also on consoles, although I'm not certain of this), so it seems to be purposeful rather than a bug.

I've also had a look at what is actually kept around after disconnecting from a server, and it seems that all entities are left behind but the terrain and hightmaps are removed. A similar thing probably happens with CoD:BO2 where I've also observed this.

Obviously I wouldn't want to purge the map from memory if there was a reason behind it, but however I've noticed no adverse effects so far in Crysis Wars.

sentences:
SDL2 Textures bleeding / 1px border around tile maps - SDL_RenderCopyEx taking integer arguments https://forums.libsdl.org/viewtopic.php?t=9486 This post gives a good indication of my question.

Basically if you set SDL2 logicalScale or otherwise and render textures at native window resolution they appear fine. However, with tile maps if you resize the window in anyway, you get a bleed where an integer rounding issue creates a 1px border around certain tiles.

Is my only option to create a 1px border around all my images to stop this bleed / rounding error? Or a semi-transparent border with the main color. What are my options? Is this solved in any of the latest SDL2.X.Y ?

EDIT: A simpler method I have used is reducing my images from 64x64px to 62x62px in SDL2 (not the actual sprite) and using it's own sprite as a 1px border, and using Render Scaling to scale up that 1px, which stops bleed. It reduces the quality on background images ever so slightly, but it requires no tweaking of any code or sprites... but again wondering if there's a more elegant solution.

sentences:
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:
XNA and C# Draw method question If I missed the answer to this question being already posted I apologize but I was unable to find it.

I'm new to C# and XNA and converting a VB game I created into them. Im finding a problem I'm not sure how to get around.

I'm using a generic list that contains information about nonplayer characters including the Graphic, Vector2, Rectangle. I'm reading this information from a file. So I have a class to receive all the information then I add it to the generic List. It then passes that information back to the main Game1.cs.

My problem is when it gets to the Draw method after loading all the information into the generic List<> the other methods in the main see the list EXCEPT the Draw and Update methods. I thought this would be because of the protected status of those methods but it will not let me change them to public.

So to sum up NPCClass.cs creates a class to accept the information. LoadLevel.cs reads from a text file and loads a instance of the NPCClass and adds it to a generic list of the NPCClass that is contained in the Game1.cs. The Draw Method in Game1.cs will not see the generic List even tho I have it publicly declared in Game1.cs main.

Thank you for any help and if i'm going at this completely incorrectly please don't hesitate to tell me.

sentences:
How to move a Box2D body towards a mouse click? In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation part, but cannot figure out the movement.

Every time the screen is touched, the target point (mouse click) is updated:

if (Gdx.input.isTouched())
{
    Vector3 tmp = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
    touch_prev = touch_target;
    touch_target = new Vector2(tmp.x, tmp.y);
}

Here is the Rot2D class:

package com.elsealabs.ghostr;

public class Rot2D {

   public static Rot2D fromDegrees(double angle) {
      return fromRadians(Math.toRadians(angle));
   }

   public static Rot2D fromRadians(double angle) {
      return new Rot2D(Math.cos(angle), Math.sin(angle));
   }

   public static Rot2D fromVector(double dx, double dy) {
      float length = (float) Math.sqrt(dx * dx + dy * dy);
      return new Rot2D(dx / length, dy / length);
   }

   public double getAngle() { // radians
     return Math.atan2(sin, cos); // atan2(y, x)
  }

   public double cos, sin;

   private Rot2D(double cos, double sin) {
      this.cos = cos;
      this.sin = sin;
   }

   public Rot2D load(Rot2D that) {
      this.cos = that.cos;
      this.sin = that.sin;

      return this;
   }

   public Rot2D copy() {
      return new Rot2D(cos, sin);
   }

   public Rot2D rotate(Rot2D that) {
      double cos = (this.cos * that.cos) - (this.sin * that.sin);
      double sin = (this.cos * that.sin) + (this.sin * that.cos);

      this.cos = cos;
      this.sin = sin;

      return this;
   }

   public static double cross(Rot2D a, Rot2D b) {
      return (a.cos * b.sin) - (a.sin * b.cos);
   }
}

(Source)

I am showing these because it may be helpful, but what I need to get working is the movement. I do not want to use setTransform, as it may end up letting the player travel through walls.

Using the vectors below, and any other variables needed, how would I move the player gradually towards a point on mouse click?

private Vector2 touch_prev = new Vector2(0, 0);
private Vector2 touch_target

sentences:
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:
Get Vertices of a Shape/Body in Box2D Is there a way to do it? I can get only polygon_shape's vertices, but i want circle, box, etc too.

How to do it?

sentences:
Touch point on the near plane I have a matrix created with either orthoM or frustumM GL function, where the near plane is logically the surface of the tablet. I would like to translate touch locations to their location on the near plane (that is, from device coordinates to the world coordinates).

I assume this is a common enough activity so I'm wondering if a standard API function exists (or simple sequence) which can provide me with this data?

sentences:
How can I assign a layer to tiles on an individual level? I've just started out with my first game in Unity. It's a simple 2D Platformer with a tile-based level.

When coding in the movement, I used the Physics2D.OverlapCircle() and an empty to check whether my player was touching the ground. However, I need to use a layer to make sure only the ground is detected.
my code below
//fixed update used for physics calculations
void FixedUpdate()
{
    //right or left arrows being pressed
    float moveX = Input.GetAxis("Horizontal");

    Vector2 moveDir = new Vector2(moveX * playerSpeed, rb.velocity.y);
    rb.velocity = moveDir;
}

//update used for spacebar input and force
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        rb.velocity = Vector2.up * jumpForce*Time.deltaTime;
    }

    //is my circle overlapping any other colliders
    Collider2D collider =  Physics2D.OverlapCircle(feet.position, checkRadius, groundLayer);
    Debug.Log(collider);
}

When I tried assigning layers to my tiles, I couldn't find a way to do it.
I would be really grateful if anyone could show me how to, or if anyone can tell me a more efficient way to deal with jumping in a 2D platformer.

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:
Collision Scenario, Detection and Response I have AABB, BSphere, a Polygon Soup, a Triangle, a Plane, a Point and a Ray objects with a collision test that returns 'bool' if two objects collide or not.

How can I use the above objects to implement an appropriate collision detection for my game?

It's a simple game where a player walks inside a rooms, and does the 'escape the room' scenario.

My levels is much like old Resident Evil with those 'static' cameras inside the rooms, some items inside containers, a monster and few items laying around so you can pick them up if you want.

A room is just a 'Sector' - it would be a 'Polygon Soup'
A player and all Entities are AABB

My question is:

Is my collision tests that returns (true/false) is enough for appropriate collision detection or do I need extra  info like the normal vectors?
Should I go writing this myself or stop playing around and use some open/free physics engine for a simple game like this?

sentences:
How can I rig an SVG humanoid? I have a template SVG file for an articulated doll and it looks something like this:

I can manually rotate and pose it in Adobe illustrator, but is there a better workflow to rig 2D segmented assets?

sentences: 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:
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:
Help understanding camera/scene Unity I'm a brand new unity developer and I watched a few tutorials and then found a game on the Asset Store to provide a nice base for my game. However the setup, especially with multiple scenes is quite different than the tutorials I watched and I can't figure out what is happening. Here is my Scene view from the main menu:

When I click on Main Camera the tiny little thing with the green outline in the corner is highlighted.

Now if I click play, that whole menu fits in the screen, even though the Main Camera is apparently tiny? Then, while playing, I click back to scene view I see this:

It shows the camera as being empty, even though in Game View I can see/interact with the menu.

When I swap to my Scene 1, which is the game view, it is the exact opposite. This is what I see in Scene View while the game is playing:

Note the game running in the preview in the corner. Those tiny circles are the same circles on the main menu, how does the same asset fit in what appears to be two wildly different sizes?

So I ask, what is the different between the two scenes. One appears in the preview while one doesn't. One fills in the huge canvas while the other apparently fits in the tiny camera. What am I missing?

sentences:
Developing for iOS on Linux I am looking for an engine or library to develop a game for iOS on Linux.

High level, low level, GUI, no GUI, does not matter too much. I am really looking for anything.

I'm not actually talking about deploying to iOS from Linux or anything like. I just want to do the bulk of the work on Linux, with minimal changes required to run it on iOS.

Edit: YES, I do have access to a Mac, but it is limited. So I want to be able to work on the project on my regular Ubuntu box.

Also, I am in the paid developer program, so I can deploy to iOS devices from the Mac.

sentences:
LibGDX getYpercent of a child inside scrollpane So I have this scrollpane with a bunch of labels alfabetic organized, its quite anoying scrolling all the way down to select a label starting with Z letter

So I put the whole alfabet in the right of the screen and my goal is that when users touch the letter 'X' it scrolls all the way to the names starting with 'X'

So I hard coded it like this...

if(letter.equalsIgnoreCase("a"))      setSPy(0);
else if(letter.equalsIgnoreCase("b")) setSPy(0.112212256f);
else if(letter.equalsIgnoreCase("c")) setSPy(0.21482526f);
else if(letter.equalsIgnoreCase("d")) setSPy(0.32874277f);
//etc...
private void setSPy(float percent) {
    scrollPane.setScrollPercentY(percent);
}

It works, but 2 problems:

it looks ugly and I refuse update it every time I decide to add another label.

Then since I could not find a function that tells me the percentY of the item I did this:

private void scrollToLetter(String letter) {
     //loop tru items inside scrollpane
    for (int i = 0; i < spItems.size; i++) {
        BrandSelectorItem  item = spItems.get(i);

        if(item.getString().substring(0, 1).equals(letter)){
            int number = i+1;
            //This gets the posY axis-Y starting on top
            float posY = (number*item.getHeight())- item.getHeight();
            float percentY = posY/(spItems.size*item.getHeight());

            scrollPane.setScrollPercentY(percentY);
            break;
        }
    }
 }

I thought this was going work, but if I hover the "A" works fine, go to 0%, if I hover the "B" its off by little bit, "C" more off, "D" more more off and etc..

seems like something about scrollpane coordinates that i do not understand.

Thank you!

Solution:

 private void scrollToLetter(String letter) {
     //loop tru items inside scrollpane
    for (int i = 0; i < spItems.size; i++) {
        //This is the label
        BrandSelectorItem  item = spItems.get(i);
        if(item.getString().substring(0, 1).equals(letter)){
            int itemNumber = i+1;
            //This gets the posY axis-Y starting on top
            float posY = (itemNumber*item.getHeight())- item.getHeight();
            scrollPane.setScrollY(posY);
            break;
        }
    }
 }

sentences:
walking up/down slowed by z coordinate layering I am making a 2D topdown sprite game. I got myself a controller script that handles input and makes the character move/attack etc. I eventually added objects you could walk in front of or behind, like trees, houses, and flowers, so naturally I needed a script to handle that. This answer gave me two solutions one using sprite renderer sorting layers and the other by altering the z-coordinate of objects. The former solution worked but was finicky, and the last one worked just fine.
However, now I am noticing a bug. I have two scenes and if you die, you respawn to the first scene. The bug only occurs if I die and respawn or if I go all the way back to scene 1 e.g. scene 1 > scene 2 > scene 1 (I have pathways that lead between scenes with triggers). The bug is that walking up or down is significantly slower than walking right or left and if I uncheck my Z-Layer script on the player, the speed goes back to match the left/right movement.
This bug doesn't happen in any other scenario, if I start the game in either scene it is fine, but whenever I respawn or go all the way back to scene 1, the up/down movement is slowed. It seems to me the extra work of changing the Z-Coordinate is causing the slowness but it is odd that it only occurs on looping back to scene 1, or respawning (which puts you back to scene 1, as well). I am not creating additional players each time he dies, or saving any data between loads yet.
Is there any idea on what could fix this or what is causing this without having to go deep into all my scripts?
EDIT
Here is my Z-Layer script. It is attached to my Player.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ZLayer : MonoBehaviour {

//sets the Z coordinate of a sprite to its Y. if the camera settings are reversed, youll need to multiply by -1,
    float initial;
    Vector3 temp;

    void Awake () {

        SetPosition();
    }
    //note since Update is called every frame, you must disable the scripts that on static objects
    //e.g. trees, walls etc, (disabled scripts dont get their updates called
    //for moving objects keep it ticked. (note this is why we used start and not awake too.
    void Update()
    {
        SetPosition ();
    }

    void SetPosition () {
        temp = transform.position;
        temp.z = transform.position.y;
        transform.position = temp;

    }
}

For reference, here is the code that moves my player
void Move(float h, float v)
{
    movement.Set (h, v);
    //normalize movement vector and make it proportional to speed per second

    movement = movement.normalized *speed*Time.deltaTime;

    //move the player to the current position

    temp = new Vector2 (transform.position.x, transform.position.y);
    temp2 = temp + movement;
    playerRigid.MovePosition (temp2);

}

Move(h,v) is called in Update() if a boolean walking is true, and h and v are the horizontal and vertical inputs obtained from Input.GetAxisRaw.
A key part I want to reiterate is that it works fine on start, it only slows up/down movement when I respawn or get back to scene 1 from scene 2. Doing one scene transition seems to work fine, but 2>1>2 or 1>2>1 bugs out.

sentences: How to display a GUI text at run time in unity? I'd like to display a GUI text at run time in my game for a second, so I want to know if it's possible to add or remove a GUI label to the scene at run time?

sentences:
Unity, Steam and updaters! I am probably asking a question answered here already; but I have yet to find the answer! Can anyone here help me with how updates work for your games? I know that through visual basic you can create batches to make shorter updates and everything like that but overall I am completely confused:/

How to get your game from Unity to Steam and how can you update the version and files efficiently?

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:
Shader | Special Effect - Unit selection I would like to know how the shaders used to show which unit is selected are made. Here is an image to illustrate.

How the merge effect of the blue circles can be achieved ? I didn't found any explanation concerning this effect. I know that to project those texture I can develop a decal system but I don't know how to create the merging effect.

sentences:
Calculate initial velocity of a 3d vector-based projectile Okay, so I got a Projectile with 2 Vectors, position and velocity.
I now want to calculate the initial velocity for it in order to reach a specific point on the map.

Or actually, how high has the start z-velocity to be (because x and y are probably defined by a speed variable) in order for the projectile to hit the marked position.

The projectile is influenced by a constant gravity vector.

All calculations are done 32 times per second.

I want this, because I don't want to use a parabola function, so the projectile can still be influenced by other sources, simply adding some velocity.

I didn't really find anything referring to that topic and would be glad for every helping answer, Thanks.

sentences:
In Unity, How to format Old RPCs into new "PunRPCs" In older unity versions you could simply used RPC. With newer verisons of Unity my code now doesn't work and it says that it needs to be transformed into "PunRPC" , Pun being "Photon Unity Networking." I am not sure how to reformat it to work with current unity versions. Can anyone shed light on this?

My Code

FXManager.cs

1 using UnityEngine;
2 using System.Collections;
3
4 public class FXManager : MonoBehaviour {
5
6   [RPC]
7   void SniperBulletFX( Vector3 startPos, Vector3 endPos ) {
8       Debug.Log ("SniperBulletFX");
9
10  }
11}

PlayerShooting.cs

1 using UnityEngine;
2    using System.Collections;
3
4    public class PlayerShooting : MonoBehaviour {
5
6   public float fireRate = 0.5f;
7   float cooldown = 0;
8   public float damage = 25f;
9   FXManager fxManager;
10
11  void Start() {
12      fxManager = GameObject.FindObjectOfType<FXManager>();
13
14      if(fxManager == null) {
15          Debug.LogError("Couldn't find a FXManger.");
16      }
17  }
18
19
20  // Update is called once per frame
21  void Update () {
22      cooldown -= Time.deltaTime;
23
24      if (Input.GetButton ("Fire1")) {
25          //Player wants to shoot...so. Shoot.
26          Fire ();
27      }
28  }
29
30  void Fire() {
31
32      if (cooldown > 0) {
33          return;
34      }
35
36      Debug.Log ("Firing our gun");
37
38      Ray ray = new Ray (Camera.main.transform.position, Camera.main.transform.forward);
39      Transform hitTransform;
40      Vector3 hitPoint;
41
42      hitTransform = FindClosestHitObject (ray, out hitPoint);
43
44      if (hitTransform != null) {
45          Debug.Log ("We hit:" + hitTransform.name);
46
47          // We could do a special effect at the hit location
48          // DoRicochetEffectAt (hitPoint);
49
50          Health h = hitTransform.GetComponent<Health> ();
51
52          while (h == null && hitTransform.parent) {
53              hitTransform = hitTransform.parent;
54              h = hitTransform.GetComponent<Health> ();
55          }
56
57          // Once we reach here, hitTransform may not be the hitTransform we started with!
58
59          if (h != null) {
60              // This next line is the equivalent of calling;
61              //                  h.takeDamage( damage);
62              //Except more "networky"
63              PhotonView pv = h.GetComponent<PhotonView> ();
64              if (pv == null) {
65                  Debug.LogError ("Freak out!");
66              } else {
67                  h.GetComponent<PhotonView> ().RPC ("TakeDamage", PhotonTargets.AllBuffered, damage);
68              }
69          }
70
71          if (fxManager != null) {
72              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
73          }
74      }
75      else {
76          // We didn't hit anything (except empty space), but let's do a visual FX anyway
77          if (fxManager != null) {
78              hitPoint = Camera.main.transform.position + (Camera.main.transform.forward*100f);
79              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
80          }
81      }
82
83      cooldown = fireRate;
84  }

If anymore information is needed, please let me know, I would love to figure out how the new "PunRPC(Photon Unity Neworking)" works so I can use it in future projects.

Edit: This is the error I get "PhotonView with ID 2 has no method "SniperBulletFx" marked with the PunRPC or @PunRPC(JS) property! Args: Vector3, Vector3
UnityEngine.Debug:LogError(Object)"

sentences:
Unity3D Sprite tearing on Android Smartphone The game was running on Samsung Galaxy Trend 2.

On other smaptphones and emulator it seems running properly without glitches.

Sprites import settings are following:

Could someone explain why this happens?

sentences:
How do I determine the draw order in an isometric view flash game? This is for a flash game, with isometric view. I need to know how to sort object so that there is no need for z-buffer checking when drawing. This might seem easy but there is another restriction, a scene can have 10,000+ objects so the algorithm needs to be run in less than O(n^2). All objects are rectangular boxes, and there are 3-4 objects moving in the scene. What's the best way to do this?

UPDATE

in each tile there is only object (I mean objects can not stack on top of each other). and we access to both map of Objects and Objects have their own position.

UPDATE2

see these figures:

in first one first blue object should be drawn then green then red. while in second one you have to draw them in reverse order. you need to draw red first and then green and finally blue object. as you can see there is no difference in position of blue and red objects ,they both have different distance from camera and so on. but because of their relative position to green box, you need to change their draw order between two images. that's what makes this problem a mess.

side-note: since all objects are rectangular prism, it's mathematically provable that there is at-least one draw order to satisfy problem needs.

sentences:
Creating single texture for all materials in substance painter with ID map. ID map doesn't bake properly I am trying to create single texture for multiple materials in substance painter according to this tutorial. https://www.youtube.com/watch?v=HMP2xpGHimY

I have two models made in Blender. One with several materials(for generating ID map), another with one material.

Mesh for ID map:

Main mesh:

Both are totally identical from geometry and scale standpoint.

Generating ID map settings(it is a mobile game so I use only Unlit texture and don't require other maps and channels except for BaseColor):

Painting the model with masks created with ID map and actual problem.

Id map:

Model's materials in Blender (everything is great here):

How can I handle this issue?

sentences:
ECS how to access multiple components (not the same one) in a system? I'm implementing a basic entity component system from http://entity-systems.wikidot.com/rdbms-with-code-in-systems#java in C++, but I don't quite understand how I could do multiple components (not the same component. I don't see a need to have 2 of the same components yet) in a system. In an inherited System, for example, MovementSystem, I want it to be able to act on all entities that have a position component and a velocity component. However, in my code, I would do

std::vector<Component *> positionComps = entityManager->GetAllComponentsOfType(POSITION_COMPONENT);
std::vector<Component *>::iterator it = components.begin();
for (; it != positionComps; it++) {
    PositionComponent *pos = dynamic_cast<PositionComponent *>(it);
    pos->x += velo->x;
}

I don't know how I could get the velocity component in there, as it is looping through the position components. I could get all of components of type velocity inside that loop and have a nested loop, but that would be bad on the performance. Also, how would you know which component goes with which? There is a function of GetAllEntitiesPossessingComponent which returns a list of integers so I can later then get the specific component of the entity and check if the entity has the two components. Also, if the component returned was NULL, I would have to check in the system before I do anything if it's NULL or not. But all of this doesn't seem right.

I COULD merge PositionComponent and VelocityComponent into one and then act on that in the system, but that wouldn't help me with future components.

sentences:
Rendering only a part of text FTGL, OpenGL I'm using FTGL library to render text in my C++ project.

I can easily render text by using:

CFontManager::Instance().renderWrappedText(font, lineLength, position, text);

Unfortunately there is a situation in which this Button which displays text, is partly hidden because of resizing container in which it is situated. I'm able without any problem to draw Button's background to fit the container, but I've got a problem with doing the same with a text. Is it possible to somehow draw only text for given width and the rest just ignore?

This is a screen which presents my problem:

As you can see, the Button "Click here" is being drawn properly, but I can't do the same with "Click here" text.

sentences:
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:
C++ OpenGL More textured objects equals less FPS So I'm creating a game engine with many features, last time I focused on textures.

When I finished implementing some new code (Made by myself) I created new Entity with texture, and it was working really nice.

But If I create 2 or more textured objects game starts lagging..

1 Cube without texture = > 60 FPS
1 Cube with texture = > 60 FPS
2 Cubes without texture =  > 60 FPS
2 Cubes with texture = 40-50 FPS
10 Cubes without texture = > 60 FPS
10 Cubes with texture = 20 FPS
100 Cubes without Texture = > 60 FPS
100 Cubes with Texture = < 1 FPS
10000 Cubes without Texture = > 60 FPS

I'm using GLSL sampler2D, texture UV from VBO, here is my renderer code:

bool textured = false;

if(entity->hasComponent("MaterialComponent"))
{
    MaterialComponent *materialComponent = (MaterialComponent*) entity->getComponent("MaterialComponent");

    if(materialComponent->material != NULL && materialComponent->material->texture != NULL) textured = true;
}

if(component->cullFaces)
{
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
}

if(textured) glEnable(GL_TEXTURE_2D);

glBindVertexArray(component->model->vaoID);
glEnableVertexAttribArray(0);
if(textured) glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);

//glDrawElements(GL_TRIANGLES, component->model->getVertexCount(), GL_UNSIGNED_INT, 0);

if(textured)
{
    MaterialComponent *materialComponent = (MaterialComponent*) entity->getComponent("MaterialComponent");

    if(materialComponent->material->texture->textureID == 0) glGenTextures(1, &materialComponent->material->texture->textureID);

    glBindTexture(GL_TEXTURE_2D, materialComponent->material->texture->textureID);

    SDL_Surface *surface = IMG_Load(materialComponent->material->texture->textureFile->getPath().c_str());

    if(!surface) Error::throwError("Cannot load texture file!");

    S32 colorMode = GL_RGB;

    if(surface->format->BytesPerPixel == 4) colorMode = GL_RGBA;

    glTexImage2D(GL_TEXTURE_2D, 0, colorMode, surface->w, surface->h, 0, colorMode, 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);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    //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_LINEAR);
   // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
   // glGenerateMipmap(GL_TEXTURE_2D);

    glActiveTexture(GL_TEXTURE0);

    glUniform1i(baseShader->loc_sampler, 0);

    SDL_FreeSurface(surface);
}

glDrawElements(GL_TRIANGLES, component->model->getVertexCount(), GL_UNSIGNED_INT, 0);

if(textured)
{
    //glBindTexture(GL_TEXTURE_2D, 0);
    glDisable(GL_TEXTURE_2D);
}

glDisableVertexAttribArray(0);
if(textured) glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glBindVertexArray(0);

if(textured) glDisable(GL_TEXTURE_2D);

if(component->cullFaces)
{
    glDisable(GL_CULL_FACE);
}

So I can create new TextureAsset for each cube or I can use one TextureAsset for each cube, it makes no difference about FPS.

I'm creating new TextureAsset like this:

TextureAsset *textureAsset = new TextureAsset(new FilePath("PATH_TO_TEXTURE"));

Then putting it inside Entity' MaterialComponent:

MaterialComponent *materialC = (MaterialComponent*) cube1->getComponent("MaterialComponent");

materialC->materialAsset->texture = textureAsset;

I think there is something bad inside my renderer method, it happens only if there is more than 1 textured object. Maybe I have to clean-up texture in different way?

I'm using SDL2, SDL2_image and GLEW.

If you need more code - just tell me.

sentences:
How to parse HTTP response (JSONdata) in cocos2d-x I am making a HTTP request to a server and I am getting data from the database. Now I want to parse the JSON data and get the data into variables like this:

std::vector<char> * buffer = response->getResponseData();
char * concatenated = (char *) malloc(buffer->size() + 1);
std::string s2(buffer->begin(), buffer->end());
strcpy(concatenated, s2.c_str());

Json * json = Json_create(concatenated);
std::string test1 = Json_getString(json, "id", "default");
std::string test2 = Json_getString(json, "pass", "default");

CCLog("HTTP Response : id : %s", test1);
CCLog("HTTP Response : pass : %s", test2);

But I am getting an error on:

Json *Json_getItem (Json *object, const char* string) {
Json *c = object->child;  //error on this line -- exc_bad_access
while (c && Json_strcasecmp(c->name, string))
c = c->next;
return c;
}

When I log...

 log("%s",concatenated);

...it outputs data like this:

 id:mtpass:thkr

Reference - https://gist.github.com/Tetz/81686772

So how to get the data in variables id and pass?

sentences:
How to change Alt+Drag and Shift+Drag shortcut in Unreal Engine? As a 3DS Max user, the ALT/SHIFT commands are reversed in Unreal, and for the life of me, I cannot easily switch between these differences. I always try to copy an asset by Shift+Click+Dragging it, and end up panning with it instead. The alt key is supposed to deselect, and instead it duplicates in Unreal.
I've looked everywhere in the General - Keyboard Shortcut settings and don't see those keybinds.

sentences:
Unity2D: wait for coroutine to finish to activate it again is there a way to start another coroutine once the last coroutine is finish. I have a button that activates a coroutine, the button can be pressed any time you want, when pressed you activate a coroutine. However I notice that when you press the button twice the coroutine  happens twice, which is not want I want. Is there a way to make sure that once my Boomerangeffect(coroutine) is activate the coroutine  can't start (if button is pressed) until the present coroutine is finished.

public GameObject BoomerangOn, BoomerangOff;
public static int buttonCount = 4;
static int timesActivated =  0;

void Start()
{
    if (PlayerPrefs.HasKey ("boomerangbutton")) {
        buttonCount = PlayerPrefs.GetInt ("boomerangbutton");
    }
}

void Update()
{
    PlayerPrefs.SetInt("boomerangbutton", buttonCount);
}

public void Activated ()
{
    if(timesActivated < buttonCount)
    {
        timesActivated++;
        StartCoroutine(BoomerangEffect());
    }
}

IEnumerator BoomerangEffect()
{

        BoomerangOn.SetActive (true);
        yield return null;
        yield return new WaitForSeconds (10.0f);
        yield return null;
        BoomerangOn.SetActive (false);
        yield return null;
        BoomerangOff.SetActive (true);
        yield return null;
        yield return new WaitForSeconds (1f);
        yield return null;
        BoomerangOff.SetActive (false);
        yield return null;
}

sentences:
How should I handle interrupting the current goal with goal-oriented action planning? I'm reading about goal-oriented planning for AI, but there I'm having difficulty finding an implementation so that I can address some questions that I have.  Specifically, I don't understand how to handle scenarios in which an agent is in the middle of a goal, but then another goal gets calculated as higher priority.  For example, suppose I have the following goals/subgoals/actions
MineGold (goal)
|--> MoveToGoldMine (goal)
|    |--> MoveToPosition (action)
|--> SwingPickaxe (action)
|--> TakeGold (action)
|--> DeliverGold (goal)
|    |--> MoveToTownHall (goal)
|    |    |--> MoveToPosition (action)
|    |--> DropGold (action)

AvoidEnemy (goal)
|--> MoveToHidingSpot (goal)
|    |--> MoveToPosition (action)
|--> Wait (action)

AttackEnemmy (goal)
|--> MoveToEnemy (goal)
|    |--> MoveToPosition (action)

When the game starts, my agent calculates its goal priorities and its highest priority is the MineGold goal.  So it pushes the list of subgoals and actions for MineGold onto its planning stack.
Suppose the agent moves to the gold mine, mines the gold, takes the gold, and then starts to move back to the town hall.  While it's moving back to the town hall, an enemy soldier gets close enough such that the AvoidEnemy goal becomes higher priority than the MineGold goal.  So now the agent pushes the AvoidEnemy subgoals and actions into its stack, ahead of the remaining DeliverGold subgoal.
While the agent is avoiding the soldier, an enemy assassin sneaks up on his team's commander.  The commander calls for help so the AttackEnemy goal becomes the highest priority.  So AttackEnemy is pushed onto the stack ahead of AvoidEnemy.
Eventually the assassin is killed, so the AttackEnemy goal is no longer valid and gets popped off the stack.  Now the topmost goal is AvoidEnemy to avoid the enemy soldier.  But if my agent just attacked the assassin, it would be weird for him to then start running away from the soldier (or maybe the soldier is already far away and I don't want to keep moving to a hiding spot), so I would rather him return to his original goal of DeliverGold.
Here are my questions:

Am I correct in assuming that I should be periodically recalculating the highest priority goal and switching to the highest priority goal if it's different than the existing goal?
Am I correct that when a new goal becomes higher priority than the current goal, then I should be pushing that new goal onto the stack ahead of the current goal, as opposed to overwriting the current goal with the new goal?
Assuming I'm correct that new goals are additive, how do I handle this situation where sometimes I don't want an agent to return to certain prior goals?  I know that I could accomplish this through a set of "mutually exclusive" flags or something, but that seems like an inelegant way and that it would start to return me to using finite state machines instead of goal-oriented planning.

sentences:
Why isn't this physics code scaling velocities separately? I'm working my way through this book and I'm trying to work this code out:

var squaredVelocity = this.velocity.x*this.velocity.x
                    + this.velocity.z*this.velocity.z;

if (squaredVelocity > Player.SPEED*Player.SPEED) {
   var scalar = Player.SPEED / Math.sqrt(squaredVelocity);
   this.velocity.x *= scalar;
   this.velocity.z *= scalar;
}

The book doesn't explain it. I've been staring at it for an hour. I can see exactly what it does (in the technical sense), but what's its purpose?

I understand bits: The scalar variable is always a fraction, so multiplying the velocity by it scales back that velocity.

Is this code for limiting speed? Then why are the x and y velocities added together? Shouldn't the X and Y be scaled independently?

Do I need to know this stuff for a career in video games? I understand that all this math is educational, but will I still have to do this sort of thing in an engine like Physijs?

sentences:
GLSL: #define vs const What is the difference between #define NAME VALUE and const int NAME = VALUE in GLSL 410 core?

As far as I can see, they both create a constant integer.

sentences: What format should I choose? I am making models in blender to export them then in unity, and unity can import .blend formats as well as .fbx, so which one is better, is there even any difference.

sentences:
In a multiplayer game, should everything that is not user input be done server-side to prevent cheating? I've heard this said before, but it seems somewhat unrealistic.

These are the two scenarios I'm working with:

  User Presses move key, moves themselves, and tells the server -> server tells other clients

or

  User presses move key, and tells the server -> server calculates if the user is allowed to move there -> server tells all clients

It seems like option one would make the users movements feel very floaty and delayed. Do most multiplayer games use a combination? (user moves itself, gets confirmation from the server, and moves itself back if it was an illegal move.) Maybe it's a non-issue and I'm overthinking it.

sentences:
How to generate Spritefonts for monogame I just want to render some text to the screen using:

monogame 3.0
MS Visual Studio 2010 C# Express

In XNA, you were able to add fonts to the content pipeline quite easily. But this doesn't seem to be the case in monogame. Loading TTF Files using Content<SpriteFont>.Load() doesn't work. Is there any way to generate or download *.spritefont files or *.xnb files containing the font data (without resorting to install XNA)?

sentences:
How to save/persist a GameObject with incremental levels? Dictionary? List? I create buildings and they have child Text objects that will reflect the building level.

The Problem:

What can I use to store the buildings a player has built so the data can be persisted?

I've looked at Lists, but when I upgrade a building, how would I update the list so that particular building has its new level reflected?

I'm working on a dictionary so I can update the key with the new value (level) but running into a problem with the keys and names. If I have lets say 10 "Farms" and try to add them to the dictionary, even though they have different properties, I get an error that I have a duplicate.

Currently I am learning how to persist that data through scenes;

GameManager.CS

public class GameManager : MonoBehaviour
{

public static Dictionary<Building, int> playerBuilt = new Dictionary<Building, int>();

public void SaveState()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/EmpireGame", FileMode.Open);

        SaveClass sc = new SaveClass()
        {
            food = Player.food.amount,
            buildingList = playerBuilt
        };

        bf.Serialize(file, sc);
        file.Close();
    }
}

[Serializable]
class SaveClass
    {
        public int food, wood, iron, stone;
        public Dictionary<Building, int> buildingList = new Dictionary<Building, int>();
    }

Building.CS

public abstract class Building : MonoBehaviour, IUpgradable {

    public int ID;

    //level this building is
    public Text levelText;
    public int level = 0;

    //starting cost to amplify the upgrade cost
    public int foodBase, woodBase, ironBase, stoneBase;

    //Upgrade cost
    public int foodCost, woodCost, ironCost, stoneCost;
    public float BuildingCostPercentage = 5f;

    public void UpdateDictionary()
    {
        if (GameManager.playerBuilt.ContainsKey(this))
            GameManager.playerBuilt[this] = level;
        else
            GameManager.playerBuilt.Add(this, level);
    }
}

Note: I have not tested the save function so I expect errors.

sentences:
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:
LibGDX Change mouse cursor to custom image......and keep it there I'm able to create a custom cursor no problem using the following code running in my GameScreen's Show method:
Pixmap pixmap = new Pixmap(Gdx.files.internal("ui/cursor.png"));
Cursor cursor = Gdx.graphics.newCursor(pixmap, pixmap.getWidth() / 2, pixmap.getHeight() / 2);
Gdx.graphics.setCursor(cursor);
pixmap.dispose();

The problem is...if I deselect the game window and return back...the cursor has returned back to the default one. At least that happens for me on Mac desktop. If I move the cursor out of the screen (without deselecting) and then back again I get the custom cursor image back but I don't think people would know to do that.
But after searching I couldn't find any way for LibGDX to detect when the game window is deselected? I thought I would be able to find that since it would seem useful for something like automatically pausing when deselecting the game window and such.
That would seem to be the way to reset the cursor every time returning to the game window, unless there's some other way to make it more permanent?
EDIT: The cursor in fact just seems to randomly disappear for no reason during gameplay and then sometimes reappear briefly....seems like it's a bug.

sentences:
How do I expose a variable from a class in Unreal Engine 4 to blueprints? I would like to expose to blueprints the variable CurrentTouchInterface in the class APlayerController, just like the method APlayerController::ActivateTouchInterface.

So, I'm guessing I have to change the header file PlayerController.h from this

/** The currently set touch interface */
UPROPERTY()
class UTouchInterface* CurrentTouchInterface;

To something like this

/** The currently set touch interface */
UPROPERTY(BlueprintReadOnly, Category="Game|Player")
class UTouchInterface* CurrentTouchInterface;

The point is, what do I need to do for the engine's editor to start showing the exposed variable CurrentTouchInterface in blueprints?

I'm working with UE 4.9 downloaded from the Epic Games Launcher application.

sentences:
Mouse click coordinates not mapping to Box2d world I'm using Box2d in Java with OpenGL, trying to detect if a mouse has clicked on a Body. But having trouble mapping mouse coordinates to Box2d world.

I have a Body positioned at 20.0f, 30.0f in the Box2d World, but find that those coordinates are not available in my viewport?

When the app is running the following locations are clicked on canvas and output:

[00:40:01] INFO (0.05,0.05) // top left corner
[00:40:02] INFO (28.716667,0.05) // top right corner
[00:40:06] INFO (28.666666,16.5) // bottom right corner
[00:40:08] INFO (0.06666667,16.616667) // bottom left corner

OpenGL has this view ..

gl.glViewport(0, 0, getWindowWidth(), getWindowHeight());
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(
    -45.0f * 60.0f,
    45.0f * 60.0f,
    -45.0f * 60.0f,
    45.0f * 60.0f,
    0.0f,
    10.0f);

The MouseListener is attached to a GLCanvas and implements mousePressed()

public void mousePressed(MouseEvent e) {
    log.info(new Vec2 (e.getPoint().x / 60.0f, e.getPoint().y / 60.0f));

    for (Body b = world.getBodyList(); b!=null; b = b.getNext()){

        for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()){

            if(f.testPoint(new Vec2 (e.getPoint().x / 60.0f, e.getPoint().y / 60.0f))){

                log.info("Clicked body");

            }else{
                log.debug("Did not hit body");
            }
        }
    }
}

sentences:
How can i use StartCoroutine to set the speed for each scaling step of the walls? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WallsTest : MonoBehaviour
{
    // using a GameObject rather than a transform
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float length = 2;
    public Camera wallsCamera;

    void Start()
    {
        wallsCamera.transform.position = new Vector3(wallsStartPosition.x, wallsStartPosition.y + 100, wallsStartPosition.z - 235);

        StartCoroutine(BuildWalls());
    }

    IEnumerator BuildWalls()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (length * sign) / 2;
                yield return new WaitForSeconds(0.1f);
                scale.x = width;
                scale.y = height;
                scale.z *= length + width;
            }
            else
            {
                adjustedPosition.z += (length * sign) / 2;
                scale.x *= length + width;
                scale.y = height;
                scale.z = width;
            }

            adjustedPosition.y += height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
        }
    }
}

What it does now it's creating two walls at once it's just waiting 0.1 millisecond before creating them.

But instead i want it to show the scaling of the walls how they scaling and moving same for the else part for the adjustedPosition.z and not only the adjustedPosition.x

The problem is it's just waiting until it's placing the walls at once. I want to see the walls being building step by step like it's placing cube after cube.

sentences:
Are there alternative game distribution methods? According this source, publishers account for about half the cost of a game's price to consumers. Could there be an alternative means of distribution that allows people to pay game developers more directly without a publisher?

i.e.: something like peer-to-peer torrents be used for distribution, while using something like Paypal to pay for keys to unlock the games?

sentences:
How to avoid rows on screen when cutting spritesheet tiles? I'm having a problem with my spritesheet, I generate a map but when I zoom in on it I can observe these lines as in the image below:

When I used the tiles each in their separate image, that did not happen, how do I avoid this case?

I'm drawing like this, the problem happens when I give a "ctx.scale":

ctx.drawImage(
    imgSolos.img,
    (imgSolos.width * resultSolo), // resultSolo is current frame in the spritesheet
    0,
    32,
    32,
    x,
    y,
    imgSolos.width,
    imgSolos.height
);

sentences:
Sampling from Normal Map and Diffuse Map in Pixel Shader I'm having some issue changing a basic lighting shader to take a normal texture and a diffuse texture for a model and then using the normal texture for lighting.
The code is very simple and i can't see where i have gone wrong at all, am i not allowed to sample two textures with the same sampler?
This is the output i am getting:

Using the two textures:

THe basic shader code is:

Texture2D shaderTexture : register(t0);
Texture2D heightNormalTexture : register(t1);

    float4 PS(VOUT pIn) : SV_Target
{
    float4 diffuseColour = shaderTexture.Sample(SampleType, pIn.texCoord);
    float4 normal = heightNormalTexture.Sample(SampleType, pIn.texCoord);

    float3 litColour = float3(0.0f, 0.0f, 0.0f);

    for(int i = 0; i < 3; i++)
    {
        SurfaceInfo sInfo = {pIn.posW, normal.xyz, diffuseColour, pIn.spec};
        [branch] switch(gLight[i].type)
        {
            case 0: //Parallel
            {
                litColour += ParallelLight(sInfo, gLight[i], gEyePosW);//
                break;
            }
            case 1: //Point
            {
                litColour += PointLight(sInfo, gLight[i], gEyePosW);
                break;
            }
            case 2: //Spotlight
            {
                //litColour += SpotLight(sInfo, gLight[i], gEyePosW);
                break;
            }
        }
    }
    return float4(litColour, diffuseColour.a);
}

The lighting code seems to work just fine when i pass in the normals as part of the vertex buffer, but goes this odd mash-up of diffuse and normal when i try to use the normals from a texture. From what i can tell i am setting the texture right in C++.

    ID3D11ShaderResourceView *pixelShaderTextures[2];
pixelShaderTextures[0] = m_textureManager.GetTextureResourceView(std::string("TestHeightMapNormal"));
pixelShaderTextures[1] = m_textureManager.GetTextureResourceView(std::string("TestTexture"));

context->PSSetShaderResources(0, 2, pixelShaderTextures);

If you guys have any help/advice for me to resolve this, that would be great.

sentences:
How to correctly set window size in Libgdx scene2d.ui dialog In my libGDX application I am using the scene2d.ui classes to render my game's GUI. One of the things I render via these classes is a dialog window with a background image set. I have created the uiskin.json file accordingly, and the dialog is shown correctly with the background image.

There is one catch however: The size of the dialog window is exactly set to fit the text elements, but not more. If not much text is shown on the dialog, then the background image is rendered much smaller than it really is.

I can override or hard-code the window size by overriding getPrefWidth() and getPrefHeight() in my custom Dialog class. But that does not feel right.

My question: What is the correct way to set a scene2d.ui dialog with a background image to be as large as that background image, regardless of how much text is being shown?

sentences:
connecting multiple anti-aliased lines together I implemented/copied the wu line algorithm from pseudo-code on wiki-pedia and other places.

When drawing a sine wave it breaks down at the point where the line changes from y dominant to x dominant (or vice versa). (I did not copy the endpoint code because it looks terrible and I do not need them for my purposes. )

Does anyone know a solution for this issue?  If not I will modify the algorithm myself to get it to work.  I am just curious if someone else has run into this and knows exactly how to fix it.  Is it possible to implement without the lines being globally aware of each other?  Or is this why drawing API's implement moveto and lineto functions?

The pseudo code

sentences:
How can I determine the contact point of a collision? I have two Farseer bodies. A static rectangle and a dynamic ball that is flying around. I want to determine where the ball touched the rectangle. I need the exact coordinates of the contact point.

How can I do that? Is there a way to determine the contact point?

 bool BlueRectangle_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
   {
       if (fixtureB.Body == RedBall)
       {
          Vector2 normal;
          FixedArray2<Vector2> worldPoints;
          contact.GetWorldManifold(out normal, out worldPoints);

          if(contact.Manifold.PointCount >= 1)
          {
            Vector2 contactPoint = worldPoints[0];
          }
        }

        return true;
    }

It works with the following code.

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:
Animate some tiles of tile map I have a game where each "tile" of the terrain is a triangle (Settlers 2). Those are placed next to each other and in way creating an infinite world (right/bottom jumps back to left/top). There is a 3D component (each triangle point has a height) but that gets translated into an Y-position offset, so everything can be considered 2D.

Everything (texture coords, screen coords, color (white<->black, FoW)) is put into VBOs already and usually does not change (FoW may disappear which updates the color VBO, but rarely)

When drawing I iterate over the visible tiles (currently in view) and collect "runs" of tiles with the same texture. After that I do:

Bind current texture
Draw current run (offset into VBOs + num of same textured tiles)
Repeat until all runs are drawn

To reduce the number of texture switches I wanted to create a texture atlas. But the problem: Some textures are animated (texture animation so all tiles use the same frame of the animation at any given time) and those animations may be different.

To give some numbers:

~30 textures, pretty small (~30-60px each)
8 are animated, rest static
animation length is 4-8 frames
animation frame time is constant

How would I best go with those animations?

Put all static textures into 1 texture, animated ones into separate ones?
Unroll animations so I have ~8 textures (possibly 24 if I have 8 frame and 6 frame animations) where each texture is 1 frame (so static textures are copied into those unmodified)
Repeat all textures into 1 texture and do some U-coordinate shifting in a shader (not used ATM, but will add soon) -> again possible waste
Some shader magic?

Using OpenGL 2.1, C++.

Visualization of 3 textures: Triangles cut out from squares in any position (in fact only 6 are possible: Top to bottom, top to middle, top to middle rotated by 135° and their mirrored counterparts). Shown is 1 of 2 triangles per square, the other one is mirrored horizontally. All tiles may have different sizes

sentences:
Wrong contineous rotation to car In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision.

Here is my straight movement related code:

myRigidbody.MovePosition (transform.position + transform.up * Time.deltaTime * GameManager.Instance.VehicleFreeMovingSpeed);

For better collision purpose, I have used Rigidbody position change approach.

Here is my collision time code:

public void OnCollisionEnter2D (Collision2D other)
{
 if (other.gameObject.CompareTag (GameConstants.TAG_BOUNDARY)) {
     ContactPoint2D contact;
     contact = other.contacts [0];
     Vector3 reflectedVelocity = Vector3.Reflect (transform.up, contact.normal);
     direction = reflectedVelocity;
 }
}

if (direction != Vector3.zero && pathGenerator.positionList.Count <= 0) {
        float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion targetRot = Quaternion.AngleAxis (angle - 90f, Vector3.forward);
        transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);

        if (Quaternion.Angle (transform.rotation, targetRot) < 5f) {
            transform.rotation = targetRot;
            direction = Vector3.zero;
        }

    }

Rotation get applied within other code so that car was changing its face correctly and that method not affecting here that I have checked by placing debug statement.

Share you side thought for this.

sentences:
Game states vs calling new activities I am trying to decide what the best method is to call "level complete-screen" and "game over-screen" in my real-time android 2d game. Currently I am using game-states and only updating my game when its in gamestate==GAMEPLAY, but this sometimes makes resetting some stuff awkward. Another method I have tried is calling a new activity during real-time using context, like this:

public void startMenu() {
    final Context context = this.getContext();
    ((Activity) context).runOnUiThread(new Runnable() {
        public void run() {
            thread.setRunning(false);
            try {
                thread.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            // Context context = getContext();
            Intent intent = new Intent("nielsen.happy.activities.MENU");
            intent.putExtra("level", level);
            ((Activity) context).startActivity(intent);
        }
    });

This method calls another activity during real-time from a View-class. But it seems a bit clumsy and forced. Just want to know if there is a preferred way to call these screens in real-time games?

sentences:
Skeletal animation: unexpected quarternion values I'm following ThinMatrix's skeletal animation tutorial and his custom written Collada parser is deriving a different rotation quaternion from each keyframe matrix than the Assimp importer library does. They are close, except the values are signed inversely and unpredicatbly.

I dug around his importer code but it's a mess. I assume he is manually performing an additional axis calculation somewhere, any ideas what it could be and why?

Original Matrix

1 0 0 0
0 -0.06466547 -0.997907 0
0 0.997907 -0.06466556 3.810999
0 0 0 1

Assimp rotation quaternion : (0.7296115 , 0 , 0 , 0.683862)

ThinMatrix's rotation quaternion : -0.72961134 , 0, 0 , 0.68386203)

And for reference, the position vec3: (0, 0, 3.810999)

Update:

With an identity matrix both Assimp and the ThinMatrix code produce (0, 0, 0, 1)

sentences:
What would be the level of effort required to implement a screencapture command on a PS3 game? Looking to see what the level of effort is for implementing a screen capture command into PS3 game by a mid-level PS3 game developer.

Bonus for a description of what is involved in the process...

EDIT

Not sure how to get back my question since it was the first but let me clarify some things. @Nate Bross, nope I am not the actor although i've fielded calls for him on occasion

@coderanger my intent was to try and speak to other PS3 developers, however coming from a web development no one in my social circle close or extended develops on the PS3. Additionally i'm interested in hearing the effort required in terms of hours so that this information can be passed on to a client. A client who has a game on the PS3 using the unreal engine. Convo with devs sometimes go something like "can you implement feature a" which gets a response "this will take us 8 weeks and an army". Trying to be educated before the ask. I hope that helps

If anyone here is a PS3 game dev and would like to respond off site so as not to break NDA that would be awesome.

@Roger it would be from within the game, something that users can use. Something akin to the iphone screencap utility. No need to get fancier than that.

sentences:
Texturing a mesh generated from voxel data I have implemented the Marching Cubes algorithm to display an isosurface based on voxel data. Currently, it is displayed with triplanar texturing. I'm working with unity, so I have a material with the triplanar shader attached. Now, the whole isosurface is rendered using this material.
And thats my problem: I want the texture to represent the voxel data. I'm storing a material value for every point in the grid, and based on this value, I want the texture of the isosurface to change. Sadly, I have no clue how to do this. So if the voxel is sand, I want sand to be displayed; if it's stone, then there should be stone. Right now, everything is displayed as sand. Thanks in advance!

sentences:
How to render a bevel effect with SDL2 Texture? I develop 2D games using CodeBlocks (C++) with SDL2.

I can load a texture (ex. a gray square) and render it to the screen. All is fine. If I want to change the color of the square? Yes, I can do it. I can rotate too, without an issue.

But here's what I'd like to know:

I'd like to render the square border with a bevel effect. This is for displaying icons on the screen: I'd like to avoid having to load 2 images, one for the icon picture (with a transparent background) and one for the bevel; I'd like to add the bevel effect on some parts, dynamically in the program.

How can I do it?

sentences:
ID3D Query Where should I put them? I'm currently trying to time different parts of my rendering to see how long it takes. I've got the queries working and I'm getting some results.

My question is where should I actually start and end the query?

If the query is wrapped around the ID3D11DeviceContext::VSSetShader function will this tell me how long it took to set the vertex shader? Or will the tell me how long it took to call the function in c++?

I am trying to query the GPU and as far as I know the pipeline isn't executed until I call the ID3D11DeviceContext::DrawIndexed function.

Do I need to do the queries in the shader code?

sentences:
XNA - Getting HLSL pixel of current render target? I'm setting a render target in XNA using the following lines of code:

        Game.GraphicsDevice.SetRenderTarget(physicsTexture);
        Game.GraphicsDevice.Clear(Color.White);

        noiseEffect.CurrentTechnique.Passes[0].Apply();

        DrawQuad();

        Game.GraphicsDevice.SetRenderTarget(null);

        physicsTexture.GetData<Color>(physicsBuffer);

Now, physicsTexture is a RenderTarget2D. This texture already has some of its pixels colored by the CPU before it gets set as the render target.

So when my pass in the HLSL pixel shader runs, my question is: Can I get the current pixel color of a given texture coordinate using tex2D or something similar on the render target, before drawing a new pixel at that area?

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:
2D Rivers/Lakes in infinite terrain I've been looking into generating lakes and rivers for a 2D infinite tilemap but I'm stuck with how to handle them for an infinite map.

I can use noise/heightmaps for determining the lakes and the starting points for rivers but for an infinite map I can't use the  "flow downhill" or "carve out" technique because the player could come across the river at any point.

If I have a river that's a max of 200 tiles long, I'd have to calculate noise/map values for 33x33 chunks (my chunks are 6x6 tiles) around the player which feels excessive and very inefficient.

I have not found a way to make noise alone work for this, rivers would always be too circular if I find a range narrow enough and they'd encircle lakes, not extend outward.

Calculating voronoi cells and putting rivers at certain edges, with some extra noise to make the paths more natural, might work.

I just can't seem to find any good examples where they aren't working with known-dimension maps.

sentences:
client-side array in the OpenGL 3.3. core It is possible the topic (not using VBO)?

in the OpenGL 3.0 compatible profile I can to draw this way:

GLint position_index = attrib_location_get("VertexPosition");
gl::EnableVertexAttribArray(position_index);
gl::VertexAttribPointer(position_index, 3, gl::FLOAT, false, 0, pos_Data);
gl::DrawArrays(gl::TRIANGLES, 0, count_of_vertices);

Bat in the OpenGL 3.3 core profile it displays a blank screen. It is right?

sentences:
Tile based game data structure I've been working on a top down 2d game and the character moves freely around the map, like zelda link to the past.

How would you model the data structure for such a game in order to implement pathfinding, astar, etc.

As far I understood one could go with this approach:

Tile {
 sprite,
 walkable,
 position,
}

Board {
  width
  height
  tiles: Tile[]
}

In a board of 5x5 there will be a sprite rendered for each tile. But here comes the problem:

The player is at position (+1,+1). Now it moves to the right side (+2,+1). This will mean that the player is moved immediately from one tile to another. So, we could make the player move pixel by pixel. How would you translate this back to the grid position?

If player moves pixel by pixel (using floating point instead of integers) and is at position (1.5,1),doest it means we need a separated data to store player position and later on round its current position (1.5, 1) to find its current cell in the grid?

I'm kind lost in this subject, i would love if you could share some thoughts on it, articles, videos, books, etc.

Thanks!

sentences:
Actions abstraction in Goal Oriented AI I am back with another question about Goal Oriented AIs.

To explain my problem, I will use a specific example.

In my game, population nodes are spawned on a world map, and important characters called "Migration leaders" can spawn, take in migrants, lead them to a good spot, and then establish a new population node there and finally despawn as they have served their one-time purpose.

What I want to achieve is having only one action called "MoveToTarget" which has no pre-conditions apart from having a target location, and has the effect of setting the fact "Reached target location" to true, which itself is the precondition for other actions. Not sure this is the right way to structure that in the GOAP but that's not exactly my problem, at least I do not think so.

My problem is that, since you can't work with actions that take in an argument, I have little notion of how the AI should determine the location which it will move to when the "MoveToTarget" action triggers, for the following reasons :

Depending on the character type and generally what is happening, each character will think differently about where they're interested in going. Furthermore, what happens when I have to interrupt the AI's "plan" for some reason ? The original target location for, say, transporting migrants is lost !
I do not which to make different actions like "MoveToMigrationTarget" because then I'll have to make many MANY more actions, like "MoveToCombatTarget" or "MoveToRessources" and I do not think that will work as that will make me have to keep a "Migration target", a "Combat target".. in memory even for characters that have nothing to do with either of those.

So my question exactly is, where is the AI supposed to do the "practical thinking" in a GOAP ? The Actions themselves must be abstract, and can't take in any argument so I have to somehow have target location(s) in memory and have the GOAP planner know which target corresponds to which action.

I could also extend that question to basically any action that need a specific target / object to work.

sentences: Accessing and changing texture data in SlimDX How can I access and change texture data in SlimDX?  I have a Texture2D and a Texture3D and I need to be able to go in and change either a single or group of pixels.

sentences:
Correct order of tasks in each frame for a Physics simulation I'm playing a bit around with 2D physics. I created now some physic blocks which should collide with each other. This works fine "mostly" but sometimes one of the blocks does not react to a collision and i think that's because of my order of tasks done in each frame.

At the moment it looks something like this:

function GameFrame(){
    foreach physicObject do
        AddVelocityToPosition();

        DoCollisionStuff();      // Only for this object not to forget!

        AddGravitationToVelocity();
    end

    RedrawScene();
}

Is this the correct order of tasks in each frame?

sentences:
Where does the roughness map go? So I used Quixel, and created a great item. I want to view it in Unity with all the maps the problem however is I have 5 maps but only know how to insert 4.

Diffuse
Normal
AO
Specular
Roughness

I don't see a slot for roughness (AKA gloss).

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:
2D Rendering in DX11. Texture Storage and Reference I'm trying to think of the best way to manage textures in my 2D game.

First, I am using DX11, so right now my "textures" are just pointers to a ID3D11ShaderResourceView created by D3DX11CreateShaderResourceViewFromFile. Is this how I should be loading content?

Right now my basic idea is to create a hashmap of textures with string references.

When an object is created that uses a texture it passes the reference of the texture to the hashmap and gets back a pointer to the texture. If the texture isn't loaded it will use the string to find the correct texture to load, add it to the map and pass back the pointer, so it automatically loads new textures as required (my game is turn based, and many small pauses would have no real effect).

But here are my issues:

Is the above method the best method I could be using (without it becoming overly complex)
ID3D11ShaderResourceView. Is this how I should be storing texture data in DX11?
Ideally I want to have all my texture data compressed in a file. Right now I am simply loading jpgs and so on. But I have no idea how to compress these images and selectively re-load them as required. Ideally I would want to compress them to be locatable in the file using the reference string used when searching the hashmap too.

sentences:
Need material for character anatomy in a 2D game. Spartan Like, See Picture I'm creating my art for an 2d based IOS game. I know some basic anatomy as you can see by the picture but I have no idea how I will make draw the pics for animation of the character walking, attacking with his sword and protecting himself with shield.

Is there any anatomy reference for 2d game out there, book or anything else?

for your information, I did try to find but all of stuff I found are very amateur and incomplete

The picture was my attempt of creating a example of the character walking, which I'm not happy with

please help, thanks

Update:

Since I am in a hurry I decided I would copy the anatomy from other 2d games, it is not that clean but at least I wanna be able to start it. The question is still open.

sentences:
is there any method to simply ignore some files in unity build? as im trying to build my new app on unity android specially when i want to use gradle, there is always some conflict with manifest or libraries and .....

for debug and problem exploration i need to ignore some folders to check for those bugs instead of need to move them somewhere else.

i just thought about git branching but it can cause lots of branches and maybe not efficient

sentences:
How can I find and get all enabled cameras and switch between them? I have 5 cameras in the scene.
In the Inspector I added to the cameras array 3 cameras.
In the script I store this cameras using storedCameras array.
In cameras array there are 5 cameras.

I added a flag allCameras to change between the stored cameras mode and all cameras mode.

And I'm using the G key to switch between the cameras either the stored or the all cameras.

But when I press on G I see in the Inspector that each press on G remove one camera from the array cameras in the end I left with one camera.
And the idea is to press G and switch between the cameras either if it's on stored cameras mode or all cameras mode depending on the flag.

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

public class SwitchCameras : MonoBehaviour
{
    [Header("Cameras Init")]
    public Camera[] cameras;
    public Vector3[] originalPosition;
    [HideInInspector]
    public Vector3 currentCameraOriginalPosition, currentCameraPosition;
    public bool allCameras = false;
    private Camera[] storedCameras;

    [Space(5)]

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

    private int currentCamera = 0;

    void Start()
    {
        storedCameras = cameras;

        if (allCameras == true)
        {
            cameras = new Camera[Camera.allCameras.Length];
            cameras = Camera.allCameras;
        }

        lastCameraPosition = new Vector3[cameras.Length];

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

        if (cameras.Length == 1)
        {
            Debug.LogError("Need more then 1 camera for switching..");
        }
        else
        {
            Debug.Log("Found " + cameras.Length + " cameras");
        }

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

    void LateUpdate()
    {
        if (allCameras == true)
        {
            cameras = new Camera[Camera.allCameras.Length];
            cameras = Camera.allCameras;
        }
        else
        {
            cameras = new Camera[storedCameras.Length];
            cameras = storedCameras;
        }

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

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

            cameras[currentCamera].enabled = true;
            currentCameraName = cameras[currentCamera].name;
            currentCameraOriginalPosition = originalPosition[currentCamera];
        }

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

sentences:
How can I process extra mouse buttons using Monogame? I use Monogame for game development. For processing mouse input, I can use the Mouse class to query basic information like left click state, right click state, and screen position. That works fine for a generic three-button mouse (left, right, and scroll wheel), but falls short for more complex gaming mice with side buttons. My question is, how can I query those extra side buttons?

Since Mouse doesn't include that functionality, are there additional C# libraries I can use? How do I account for the fact that mice can have any number of extra buttons and wheels? Is there some standard for representing those additional buttons programatically?

Edit: This question originally also asked about complex keyboards with extra buttons or wheels. Now, I'm asking only about processing extra mouse buttons (ideally any number of extra buttons).

sentences:
How can I transform a Point2f with a matrix on Android? I'm developing for Android and I'm using the android.renderscript.Matrix3f class to do some calculations.

What I need to do now is to now is to do something like mat.tranform(pointIn, pointOut);

So I need to transform a matrix by a given Point class. In awt I would simply do this:

AffineTransform t = new AffineTransform();
Point2D.Float p = new Point2D.Float();
t.transform( p, p );

But in Android I now have this:

Matrix3f t = new Matrix3f();
PointF p = new PointF();
// Now I need to tranform it somehow..

But the Matrix3f class in Android doesn't have a Matrix.transform(Point2D ptSrc, Point2D ptDst) method.

So I guess I have to do the transformation manually. But I'm not really sure how that works. From what I've seen it's something like a translate and then a rotate?

Could anyone please tell me how to do this in code?

sentences: Draw rectangles on Cube and remove I have 3d object as Wall ( Cube with texture and width and height large ) with some texture and attached c# ( Unity 5.3.2 ) script to that wall. I want to programmatically draw rectangles on that Wall with green semitransparent color and after 5 seconds remove them. I am new to Unity and found OnGui but it is not drawing in 3d space but in front of screen. How to achieve this to draw and remove rectangles on Wall ?

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:
What is a good length for looping background music in a Tower Defense game? We know that the soundtrack is important and expensive for an indie's budget.
I requested a looping background track for for my Tower Defense game, where zombie/monsters attack the player. So, for the entire level, the player will keep hearing this music.
In this kind of game, is 30 seconds good for a looping music track, or I need to increase it?

sentences:
pygame on windows doesn't load sounds I had written a program using PyGame that should play sounds. I created sounds in Audacity, saved it as WAV (Microsost) signed 16 bit PCM. They are played well on Linux, but aren't loaded in Windows. There is exception:

    self.start_signal = pygame.mixer.Sound(open('start.wav'))
pygame.error: Unrecognized file type (not WAVE)

Same error if I try to use Ogg Vorbis:

    self.start_signal = pygame.mixer.Sound(open('start.ogg'))
pygame.error: OGG bitstream is not valid Vorbis stream!

But I can play sounds in both formats in Windows Media Player.

pygame-1.9.1.win32-py2.7.msi

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:
Problem of saturation of ram on XNA? I developed a small xna games.
For some time I have a problem with the saturation of RAM. In fact everything works perfectly, the game runs with a "Frame" of 60fps. But strangely I do not know for what reason my games every 4 seconds freeze half a second.

Yet my average call time of the "Update" function is approximately 7 ms (which is supposed to be good ..)

Here is a screen capture of the Task Manager. I can see the ram flush periodically.

Have you any idea why the ram saturates at only 50%?

sentences:
How to use a normal map for light effects with an AnimatedSrpite? I am trying to add light effects with normal map on an AnimatedSprite. I was following that tutorial but with no success.
I am using a Ligth2D, this sprite sheet:

and have created a shader on Material to apply the normal map with this code:
shader_type canvas_item;

uniform sampler2D normal_map;

void fragment(){
    NORMAL = 2.0 * texture(normal_map, UV).rgb - 1.0;
}

Here is the result:

One can observe a light reflection on the left upper of the hourglass, but the light is neither smooth nor consistant.
NB: I have made the spirte sheet myself, feel free to use it.

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:
What are the semantics of glRotate and glTranslate's parameters? I have been trying to play with OpenGL after watching some tutorials and I don't understand how the glTranslatef and glRotatef functions work. I believe a simple picture would help me.

I understand that glTranslatef changes the position of the "camera" (but does it change the position in wich the shapes are getting drawn)?

However, I don't understand the rotation concept at all. If I do glRotatef(1,0,0,1) it makes my quad spin around. If I just do glRotatef(1,0,0,0) it makes the quad smaller (further away) but if I try to rotate around the X or Y axis, I get a black screen. I don't understand the angle either. Help would be appreciated.

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 run JarSplice from the command line? I've tried java -jar jarsplice.jar --help and "" /? which just launches the UI. I'd like my game to automatically be packaged into a single jar when it's built so it would be very useful to be able to call it from the command line.

e.g-

java -jar jarsplice.jar -jars "..." -natives "..." -output "..." -exe -sh -mac

sentences:
Registering InputListener in libGDX I'm just getting started with libGDX and have run into a snag registering an InputListener for a button. I've gone through many examples and this code appears correct to me but the associated callback never triggers ("touched" is not printed to console). I'm just posting the code with the abstract game screen and the implementing screen. The application starts successfully with a label of "Exit" in the bottom left hand corner, but clicking the button/label does nothing.

I'm guessing the fix is something simple. What am I overlooking?

public abstract class GameScreen<T> implements Screen
{
    protected final T game;
    protected final SpriteBatch batch;
    protected final Stage stage;

    public GameScreen(T game)
    {
        this.game = game;
        this.batch = new SpriteBatch();
        this.stage = new Stage(0, 0, true);
    }

    @Override
    public final void render(float delta)
    {
        update(delta);

        // Clear the screen with the given RGB color (black)
        Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(delta);
        stage.draw();
    }

    public abstract void update(float delta);

    @Override
    public void resize(int width, int height)
    {
        stage.setViewport(width, height, true);
    }

    @Override
    public void show()
    {
        Gdx.input.setInputProcessor(stage);
    }

    // hide, pause, resume, dipose
}

public class ExampleScreen extends GameScreen<MyGame>
{
    private TextButton exitButton;

    public ExampleScreen(MyGame game)
    {
        super(game);
    }

    @Override
    public void show()
    {
        super.show();

        TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle();
        buttonStyle.font = Font.getFont("Origicide", 32);
        buttonStyle.fontColor = Color.WHITE;

        exitButton = new TextButton("Exit", buttonStyle);
        exitButton.addListener(new InputListener() {
            @Override
            public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                System.out.println("touched");
            }
        });
        stage.addActor(exitButton);
    }

    @Override
    public void update(float delta)
    {
    }
}

sentences: What is the best time to implement Multiplayer system? I have been starting a new online multiplayer game project this week and as the title says - Is it better to implement the Multiplayer feature right away, or is it ok to implement it when the game already has some other stuff, like maps and physics?

sentences:
How can I make sprites from multiple images using SDL2? Using SDL2 in C++ I can load textures with out problem however, I have sprites that are from about 15 different png's that I was hoping I could load them all up and for loop through them. However, when I try this it looks like the image is still .

I am hoping that I wouldn’t have to photo shop them into one image and shift/pan through that considering I have about 3K of images to go through.

can some one provide an example of how this could be done cleanly?

I have been working on this for a while for a bit and yes, this is probably a coding mistake as I am learning C++ still and know that for me to learn is to take up a project.

int main ( int argc, char *argv[] )
{

    SDL_Init(SDL_INIT_EVERYTHING);
    Window = SDL_CreateWindow("NEW WINDOW",100,100,300,300,SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    renderer = SDL_CreateRenderer(Window,-1,SDL_RENDERER_ACCELERATED);

    if (Window == NULL)
    {
        std::cout << "Window Couldn't be Created!\n";
    }

    struct imagebatch
    {
        const char *image;
    };

    imagebatch foto;

    //  A for loop is needed here to loop through Healer0.png Healer1.png to Healer15.png
    foto.image = "DData/towners/healer/healer/Healer0.png";
    HealerTexture = IMG_LoadTexture(renderer,foto.image);

    //loads an image;
    //HealerTexture = IMG_LoadTexture(renderer,"DData/towners/healer/healer/Healer0.png");

    //defines the rect of this image;
    SDL_Rect HealerRect;
    HealerRect.x = 0;
    HealerRect.y = 0;
    HealerRect.w = 90;
    HealerRect.h = 90;

    while (!quit)
    {
        while( SDL_PollEvent( &event ) != 0 )
        {
            //User requests quit
            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }
        SDL_RenderClear(renderer);

        //Blit everything here.
        SDL_RenderCopy(renderer,HealerTexture,NULL,&HealerRect);

        SDL_RenderPresent(renderer);
    }
    close();

    return 0;
}

Full code is here: http://pastebin.com/H5fD6cfX

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:
Why does Unity3D crash in VirtualBox? I'm running Unity3D in a virtual instance of Windows, using the Virtual Box software on Linux.  I have guest additions installed with DirectX support.  I've tried using Windows XP SP3 32-bit, and Windows 7 64bit.  My host is Ubuntu 12.04 64bit.

I installed and registered Unity on both.  It loads up fine, and then crashes my entire VirtualBox instance (equivalent of a computer shutting off with no warning).

sentences:
Why use Time.deltaTime in Lerping functions? To my understanding, a Lerp function interpolates between two values (a and b) using a third value (t) between 0 and 1. At t = 0, the value a is returned, at t = 1, the value b is returned. At 0.5 the value halfway between a and b is returned.

(The following picture is a smoothstep, usually a cubic interpolation)

I have been browsing the forums and on this answer I found the following line of code: transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime);

I thought to myself, "what a fool, he has no idea" but since it had 40+ upvotes I gave it a try and sure enough, it worked!

float t = Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, toRotation, t);
Debug.Log(t);

I got random values between 0.01 and 0.02 for t. Shouldn't the function interpolate accordingly? Why do these values stack? What is it about lerp that I do not understand?

sentences:
How can I rearrange layers in Unity 2D? I'm new to using Unity (2019.30a2) and am currently learning by watching Brackey's (youtube) "How to make a 2D Game in Unity"

At 6:58 he is able to rearrange his layers easily.  On my hand, I can create but am unable to change the order of the layers.

Looking at other questions on similar subjects hasn't provided me with a solution yet.  I'm currently working around it but feel this will hinder me in the future.

The screenshot of the unmovable layers is included below:

sentences:
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:
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:
Bloom does not work for Mobile [Unity] I've added the Mobile Bloom shader to the camera and I have Emissive HDR objects in my scene and I've set the graphics quality to the highest. I do not have anti-aliasing enabled but the bloom effect only appears in the editor play mode and not on my android mobile device.

If anybody could tell me all the setting I have to check or post screenshots of a working setup it would be very helpful.

Thanks.

sentences:
How do I measure the bounds of a string in PyGame? I am trying to position some text on my screen using pygame, and knowing the size of the string would help.

When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size of the rendered string.

Is there any way to do something similar in pygame?

sentences:
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:
Newbie game programmer - Where do I start? Okay, so I have been really inclined towards game programming this past few weeks. I have primarily been a web programmer and know a fair number of lanugages like PHP, Java, javascript, python, etc. I also know a little bit of C++ as I heard that it's used heavily in the game industry. I have no experience in game development, but I am a fast learner.(I am 15 so I guess I still have a lot of time.)

So, is there any language I should learn to develop 2d and 3d games? Also which IDE(free) is a nice place to start compiling your ideas(something like Polycode:-  http://polycode.org/). I looked up Polycode but it was a little confusing for me to build it. I have a fair idea about what DirectX, OpenGL, SDL and shaders are but I have absolutely no clue about programming them. I know it's a little early to start jumping into this stuff already but you gotta start somewhere right? Please help me as I really want to get into serious game programming. Thanks!

I am running Windows 8 Pro 32 bit. Please suggest me any software accordingly!

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:
Loading Screen And Coroutines Unity When I want to load another scene and show my loading screen to the user - my loading screen is a game object holding a canvas, I use coroutines, but when I type something like this: LoadingScreen.Show ();
        Application.LoadLevel ("PlayerMenu");

Loading screen is shown less than a second, so I wanted to use coroutines, I typed this:

IEnumerator LoadLevel(string levelName) {
    LoadingScreen.Show ();
    yield return new WaitForSeconds (2f);
    Application.LoadLevel (levelName);
}

The problem when calling the coroutine is that my LoadingScreen.Show() code is not executed, so basically I'm just waiting 2 seconds looking at the background of my current scene and then it goes to another scene, I'm confused here as to what is going on, shouldn't my LoadingScreen.Show() code be executed and then I would see the loading screen and wait 2 seconds and the next scene will appear. Anyone has an idea?

sentences:
Angle between two planes I have two triangles in 3d space which share 1 edge and I would like to determine if the angle between their normal vectors is "uphill" or "downhill". In other words, if you set one flat, would the angle between them be acute (uphill) or obtuse (downhill). Hopefully that makes sense.

So far I have the normal vectors of each triangle and have calculated the angle between the two triangles, however this angle is always >= 90 degrees.

Vector3 v1 = triangle1.Normal;
Vector3 v2 = triangle2.Normal;
float cosAngle = Vector3.Dot(v1, v2) / (v1.magnitude * v2.magnitude);
float degAngle = Mathf.Acos(cosAngle) * Mathf.Rad2Deg;

Is there a trick I am missing that lets me determine which direction this angle is in?

sentences:
Is it possible to use unnormalized texture coordinates from a GLES2 GLSL fragment shader? I want to look up a texel from my GLES2 GLSL fragment shader using un-normalized texture coordinates (0-w, 0-h instead of 0-1, 0-1). The reason is that this texture is used as a look up table and I get precision problems with normalized coordinates.

I see that GL_TEXTURE_RECTANGLE is not supported wihtout extensions and neither is texelFetch(), so I have ruled out those options.

Thanks!

sentences:
How to use Particle start color in unity3d 2017 I want to create a particle(prefab) and use another object color to change those particle's color but it seems everything is changed and I don't know the new method to use it.

Here my code:

 GameObject breakpart = Instantiate (smoke, gameObject.transform.position , Quaternion.identity) as GameObject;

 breakpart.GetComponent<ParticleSystem>().startColor = gameObject.GetComponent<SpriteRenderer>().color;

So how can I fix it?

sentences:
Given the size of far and near plane, find other parameters of a frustum I am trying to find the correct parameters for setting up my perspective camera. But I don't know the mathematics involved in that. Can somebody point me to the right direction?

My near plane should have width 1920 and height 1080 while my far plane should have width 3840 and height 2160. Aspect ratio is 1.7

Now how do I get the appropriate fovy, near plane distance and the far plane distance so that I get the desired frustum?

Edit: The world size is 3840 x 2160, and the entire world is divided into four quadrants. The size of a quadrant is 1920 x 1080. The user can zoom out and look at all four quadrants (Eagle eye view) or zoom in and look at one quadrant at a time. The important thing is, the world size should always be twice the size of a quadrant (and the area should be four times the area of a quadrant). When the game is actually being played, I just modify the Z position of the camera to zoom-in/zoom-out. Decrease the Z position to zoom in, increase the Z position to zoom out.

sentences:
Cocos2d Box2d Problem, Follow doesn't work in the physical world bool TestImageLoaderScene::init()
{
    if (!Scene::init())
        return false;

    bgLayer = Layer::create();
    this->addChild(bgLayer);

    BasicRUBELayer::init();

    playerNode = new PlayerNode;

    playerNode->addSprite();
    playerNode->addBodyToWorld(m_world);
    playerNode->addCircularFixtureToBody(0.2f);
    this->addChild(playerNode);

    bgLayer->runAction(Follow::create(playerNode));

    return true;
}

bgLayer is the layer that contains the background.
The background has a static body and is 3500 x 2700 in size.

PlayerNode is an arbitrary class created to manage sprites and bodies together, and inherits node.

class PlayerNode : public cocos2d::Node
{
public:
    void addSprite();
    void addBodyToWorld(b2World* world);
    void addCircularFixtureToBody(float radius);

    void createFixture(b2Shape* shape);

    cocos2d::Sprite* getTextureSprite() { return playerTexture; }

protected:
    cocos2d::Sprite* playerTexture;
    b2Body* playerBody;
};

Any idea why it is not working?
I am making a top-down view type game, and the phenomenon of not following the player's movement is very fatal.

please answer me.
bad engilsh so sorry...

sentences:
Loading textures as a method I want to load a texture when I need it, so I'd need a method in order to do so.

      LoadTexture(string fileName)

I'd only use that one parameter, but what would I put in the method? So far I've only ever loaded content at startup with something like

    content.Load<Texture2D>("blah");

But I want to move away from loading everything at startup and only load content when I need it.

EDIT: In order to explain what I'm going for, I'll give more detail. Say I have a chunk of blocks 50x50x50. Most of these won't be drawn, so it doesn't make sense to load the texture for the cubes not drawn. This is why I want a method that I can call whenever the  texture needs to be loaded for the cube. Instead of loading 6 textures for 6 sides for 125,000 cubes, I cut back the amount of loading to only the visible cubes.

sentences:
Can't get simple OpenGL texture working using SDL2 and FreeImage3 I created a simple OpenGL program that display a quad with texture, but it doesn't seem to be working as it only displays a white quad. What could possibly be wrong? I checked everything I could think of that could cause the issue. The bitmap is also 256x256. Any clues?

Here's the source code: http://pastebin.com/5nVbMPVp

I'm also on Linux if that helps. Thanks!

sentences:
FindNextValidTechnique fails My effect file compiles successfully, but FindNextValidTechnique fails.

Technique part of the shader:

technique Diffuse
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VertexShaderMain();
        PixelShader = compile ps_2_0 PixelShaderMain();
    }
}

I try to get the first valid technique after compilation:

pEffect->FindNextValidTechnique(NULL, pValidTechnique);

This returns some minus value which doesn't go along with D3D_OK.

I've used other flags than D3DCREATE_HARDWARE_VERTEXPROCESSING to test, but no result with them either.

UPDATE

I've read in documentation that, "Applying Compiler Flags or Assembler Flags to the incorrect API will fail shader validation.", but I'm not sure this applies to the compile time validation or afterwards. I have no problem in compile.

I compile with these flags:

D3DXSHADER_DEBUG |
D3DXSHADER_NO_PRESHADER |
D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT |
D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT

sentences:
What algorithms exist for generating collision geometry from an image? I am currently working on a game using SFML and Box2D. I am interested in generating collision geometry from the sprite data that I load into SFML. So, for example, an algorithm that would do this would take an image and find the edges (for example where the alpha area starts) and then generating a polygon that fits to those edges.

Can I be pointed to any resources that describe an algorithm to do this?

sentences:
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:
Need help to make and optimize a dense forest in Unity with bird view camera I'm currently developing a RTS game that has a bird view camera operating while playing the game. One of the core aspects of my game are trees.

So in the previous days i was playing with trees in Unity.

First i played with Unity Tree Creator however later i realized it is broken since 2018.3, and devs said it wont be fixed because it will be a community developed package in the future
Then i downloaded assets from the store that are said to be highly optimized trees, however they are mostly for "3rd person camera projects" thus having around 7-14k triangles.

After these experiences, i decided to export a tree prefab to fbx, then manually decrease the triangle count to around 2.5k in 3ds max, then reimport it to Unity. With this technique i was able to produce quite good results, but still not very satisfied with it.

My camera view, and my "dense forest" 180-300fps... and only like 3-4 shadows

For the above picture i used a Tree with 2 LOD and one billboard(BB).

After playing with this i realized i can sure do better especially with playing LOD numbers, material optimization, and with the default tree trinagle optimization.

However the problem is i can't model pine trees that satisfy my needs in 3ds max. So i started looking into SpeedTree documentation, however it seems a bit too professional for my needs(All the tutorials also make trees with like 20k poly/tri).

So regarding this story. I would like to ask the following question + a bonus one about LOD:

Can you model quality trees with SpeedTree for Unity that have like around 1k-2k triangles, or SpeedTree is for high quality/high poly trees, they algorythms won't work with lower polygon count etc? (I heared they have a simplify modifier is it good? like make a 7k triangle tree then cut it to 1k-2k)
I'm thinking about using 4-5 LOD and a BB for smooth transition. In my picture i use 2 LOD and a BB and sometimes when moving the camera fast, transitions are not as smooth as i want it to be. So i would like to rather have more lower detailed meshes before trasitioning to BB. So does having a 4-5 LOD-s a common practice or any better ides for this?

sentences:
How to prevent constant adjustments form collision? I'm try to clone a popular 2D platformer as a project. For both the player character and enemies, whenever I constantly check to see if they are walking on the ground or floating platforms, they "vibrate" or "Bounce" instead of walking smoothly, as gravity pushes them downward, and the platform pushes them upward. I have tried searching for this problem, but can't seem to find anything relevant to my problems (which probably means I am searching the wrong thing because I'm sure everyone runs into this problem at some point.)

Essentially, the player and enemies are always effected by gravity, but the collision acts against it and pushes them upward. I tried having a boolean that was set once they appeared to be on solid ground, but this made them float artificially once they walked off of floating platforms.

Here is the code for enemy collisons:

public void EnemyBlockResponder(IEnemy enemy, IBlock block, Rectangle intersection)
{
    enemy.YLocation -= intersection.Height;
}

I'm currently assuming that a side collision with a block will never happen for debugging.

Here is the Update method for the enemy:

public void Update()
{
    if (currentDirection == Direction.LEFT)
    {
        xLocation--;
    }
    else if (currentDirection == Direction.RIGHT)
    {
        xLocation++;
    }
    if (NoFloor())
    {
        yLocation += 3;
    }

    goombaSprite.Update();
}

Where NoFloor is a method that checks all the blocks on camera to see if the enemy is colliding with any of them.

Where is this code causing the sprite to continually bounce? I appreciate any help and criticisms. Thanks.

sentences:
Play store leaderboard not working unity I added a leaderboard on my android game using  cloudOnce and than i built an aab file and uploaded it on playstore to internal tester but leaderboard is not working.
Here is what happens when I click on leaderboard button using logCat

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 to ignore one unity package in source control I've just installed the Unity quick search package. This is an editor extension which each developer should choose if they want installed or not. My problem is that because this was added as a package it also made changes to my project which would end-up in our repository.
The changes are:
Project root/
|── Assets/
|   |── Assets.index
|   └── Assets.index.meta
|── Packages/
|   |── manifest.json
|   └── packages-lock.json
|── UserSettings/
    └── QuickSearch.settings

Questions:

Should this files be added to source control?
How can I ignore the changes in manifest.json and packages-lock.json without filters?

sentences: How do games make fire and smoke effects? I was wondering around, searching internet about particle system and fire effects but I haven't found any good answers. On some games I have realized that some sort of movie is being shown as the fire, which is pretty good but not for the fires which are close to the viewer. Please let me know how to make realistic fire and smoke effect in a game. Also if you have a good sample code or good description of how to make these kinds of cool fires please note them too.

sentences:
Floating Point Precision (fp:precise vs. fp:fast) In C or C++, does the compiler option of floating point precision really make a difference in real world (small/indie) games?

From my observations, setting fp:fast is many times faster than fp:precise and from what I understand here ( https://stackoverflow.com/questions/6889522/fpfast-vs-fpprecise-what-kind-of-errors-can-i-encounter ) the precision difference between the two compiler options only changes from the 16th digit of a floating point number.

Has anyone encountered an example when using fp:fast went terribly wrong for 2D or 3D games?

Edit: To clarify, I am not asking about the precision of floating point values themselves (ie. float vs double vs decimal). Only about precision related to the compiler option.

sentences:
I'm implementing a sort of isosurface extraction and theres a bunch of holes i'm implementing a isosurface extraction algorithm losely based on dual contouring but theres a bunch of holes it looks like what i want though other than that
can you look at code and fix it maybe it's not much code
basically i'm looping through all the blocks and finding all of the changes in sign the interpolating the vertex and averaging all those out (as opposed to qef ) the problem is the second part of the code looking for vertexes to connect up get messed up ones when i have no changes in the block of the first code (i tested that with that bit of commented out code it just looks really jagged though)

darray3d<glm::vec3> verts(sidel);
    LOOP3D(sidel-1){
        glm::vec3 changes[12];
        size_t inc=0;
        LOOP2Da(1){
            if ((getpt(i+ia, j+ja, k+0,data,sidel)>0) != (getpt(i+ia, j+ja, k+1,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+ia,j+ja,k+0),glm::vec3(i+ia,j+ja,k+1),getpt(i+ia, j+ja, k+0,data,sidel),getpt(i+ia, j+ja, k+1,data,sidel));
                inc++;
            }
            if ((getpt(i+ia, j+0, k+ja,data,sidel)>0) != (getpt(i+ia, j+1, k+ja,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+ia,j+0,k+ja),glm::vec3(i+ia,j+1,k+ja),getpt(i+ia, j+0, k+ja,data,sidel),getpt(i+ia, j+1, k+ja,data,sidel));
                inc++;
            }
            if ((getpt(i+0, j+ia, k+ja,data,sidel)>0) != (getpt(i+1, j+ia, k+ja,data,sidel)>0)){
                changes[inc]=VertexInterp(0.f,glm::vec3(i+0,j+ia,k+ja),glm::vec3(i+1,j+ia,k+ja),getpt(i+0, j+ia, k+ja,data,sidel),getpt(i+1, j+ia, k+ja,data,sidel));
                inc++;
            }
        }
        glm::vec3 pos=glm::vec3(0.f);
        for (size_t ia = 0 ; ia < inc ; ia++)
            pos+=changes[ia];
        pos/=float(inc);
        //if (inc > 0)
            verts(i,j,k)=pos;
       // else
           // verts(i,j,k)=glm::vec3(i+0.5f,j+0.5f,k+0.5f);
    }
    LOOP3D(sidel-1){
        if (i > 0 && j > 0){
            bool solid1 = getpt(i, j, k + 0,data,sidel) > 0;
            bool solid2 = getpt(i, j, k + 1,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i - 1, j - 1, k),
                    verts(i - 0, j - 1, k),
                    verts(i - 0, j - 0, k),
                    verts(i - 1, j - 0, k),tris,solid2);
            }
        }
        if (i > 0 && k > 0){
            bool solid1 = getpt(i, j + 0, k,data,sidel) > 0;
            bool solid2 = getpt(i, j + 1, k,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i - 1, j, k - 1),
                    verts(i - 0, j, k - 1),
                    verts(i - 0, j, k - 0),
                    verts(i - 1, j, k - 0),tris,solid1);
            }
        }
        if (j > 0 && k > 0){
            bool solid1 = getpt(i + 0, j, k,data,sidel) > 0;
            bool solid2 = getpt(i + 1, j, k,data,sidel) > 0;
            if (solid1 != solid2){
                addquad(
                    verts(i, j - 1, k - 1),
                    verts(i, j - 0, k - 1),
                    verts(i, j - 0, k - 0),
                    verts(i, j - 1, k - 0),tris,solid2);
            }
        }
    }

picture of holes:

sentences:
Bullet Physics: Applying a force at the point of collision Suppose I want to simulate some kind of gripper with two "fingers" (such as pair of pliers, or two-fingered robot hand), picking up an object from the ground. Both the gripper and the object are dynamic rigid bodies.

I want to start with the object roughly in the centre of the gripper, and then move the two fingers towards the object, to determine the point at which they make contact with the object's surface. Then, I want to apply a certain force from the fingers onto the object, before finally lifting the fingers (and hence the object) upwards.

Is there any simple way to achieve this just by treating the two fingers as two individual rigid bodies? I want to just move the fingers towards the object to find the point of collision -- so can I treat them as kinematic objects (with zero mass so they don't fall under gravity, which is what I want), and move them manually by slowly changing the pose of each finger over time? But how will I know at what point the fingers and object collide, so that I should stop moving the fingers and start applying a force?

Thank you!

sentences:
Best practice for handling "dead" objects and their particles I'm developing a side-scrolling run'n'gun game (but with planes! :P). I'm an experienced coder, but new to game development.

When an enemy plane collides with a friendly missile, I start an explosion particle emitter on the enemy plane. The emitter is accessible as a private property of the plane object and its flow is controlled by the plane's update function (which is called from the game update function). The particle emitter's "render-update" method is called directly from the game renderer class.

I don't like these things:

When the enemy plane is destroyed, I can't simply remove the object from my game's "enemyPlanes" array, as this would result in the particle sequence not completing itself.
If I continue with this scheme, I have a very complex if statement in every execution of the render function, that will
(a) check if the enemy is not shot down (b) check if the emitter is active (c) remove the plane as well as the emitter (if both previous conditions are met)
The particle system is both accessed from the GameRenderer and from the plane object. I mean, I call something like plane.getParticleEmitter().update(blabla).

Is there a better way to do this?

EDIT: The library I'm using is libgdx (Java).

sentences:
How to scroll Select objects in the hierarchy tab? So I am creating breakable objects in unity and I have to select around 200 objects in the hierarchy tab so that I can apply some components to each the pieces. My problem is that once I select more than 100 objects in the hierarchy tab, it starts to bug out and it becomes incredible difficult to select objects. So I was wondering if there was a way to a scroll select or something like the box select like you can use on windows to easily select multiple items, or maybe some other way I didn't mention. It would really help me if someone could tell me a quick way to select multiple things in unity, in the hierarchy tab.

Thanks, Nova

sentences:
How do I modify a Boids algorithm to be player controlled? Found source code on Boids in C#.

http://3carrotsonastick.wordpress.com/2012/11/01/boids-in-c-xna/

How do I go about making the raven class in the above player controlled?
If I could control it myself, it would be a great help, but I don't know how to go about it.

sentences:
What format is this 3D model in or how can I change my rendering code to accept obj files? I have a file in my project that defines 2 numbers and 4 arrays:

#define NUM_TEAPOT_OBJECT_VERTEX 824
#define NUM_TEAPOT_OBJECT_INDEX 1024 * 3

static const float teapotVertices[NUM_TEAPOT_OBJECT_VERTEX * 3] =
{
    // ...
};

static const float teapotTexCoords[NUM_TEAPOT_OBJECT_VERTEX * 2] =
{
    // ...
};

static const float teapotNormals[NUM_TEAPOT_OBJECT_VERTEX * 3] =
{
    // ...
};

static const unsigned short teapotIndices[NUM_TEAPOT_OBJECT_INDEX] =
{
    // ...
};

These, together with a texture as jpeg, define a teapot 3D model.

How can I generate these arrays from a 3D model? Our 3D models are in .obj (and a .jpeg for texture).

I use these arrays in the following code:

Vuforia::Matrix44F modelViewMatrix = Vuforia::Tool::convertPose2GLMatrix(result->getPose());
// OpenGL 2
Vuforia::Matrix44F modelViewProjection;

VuforiaApplicationUtils::translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
VuforiaApplicationUtils::scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale, &modelViewMatrix.data[0]);
VuforiaApplicationUtils::multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);

glUseProgram(shaderProgramID);

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)teapotVertices);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)teapotNormals);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)teapotTexCoords);

glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, augmentationTexture[0].textureID);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (const GLfloat*)&modelViewProjection.data[0]);
glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/);
glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT, (const GLvoid*)teapotIndices);

glDisableVertexAttribArray(vertexHandle);
glDisableVertexAttribArray(normalHandle);
glDisableVertexAttribArray(textureCoordHandle);

If you know how I can adapt this code to load standard 3D models, such as .obj files, please help.

sentences:
What methods should save/load a game state There are a lot of articles about how to save a state of a game and they are pretty good. But I have one conceptual misunderstanding where should I save the state?

My game has number of screens and pair of them are MainMenuScreen and MainSceneScreen these are inherited from Screen class. MainMenuScreen is shown at start of the game the MainSceneScreen little later.

What is the problem? I navigated to MainSceneScreen, forced Android to stop the application (I change a language settings on the device to achieve it, please let me know if I'm wrong). After that I select the application again and I can see MainMenuScreen is shown. But I want MainSceneScreen to be shown.

I suppose I should override resume method. But what class I should override? I have class PsGame that extends Game class of libgdx. I put breakpoints to its resume method and  it turned out that method was not called. I investigated the problem and I've found little strange code in onResume method of  AndroidApplication class of libgdx:

    if (!firstResume)
        graphics.resume();
    else
        firstResume = false;

My debugger said firstResume was true and didn't go to *graphics.resume()*line.

Sorry for a lot of words but could you answer following question:

What did I do wrong?
What methods should I override?

Thank you in advance.

sentences:
Creating refraction map problem I'm reading riemers tutorial on how to make a water effect and trying to translate it from xna 3 to xna 4. So far I figured out I have to create a shader in order to clip the planes for my refraction map. I'm new to hlsl and how to implement custom shaders into my program, so I am wondering what I am doing wrong here.

  float4x4 World;
  float4x4 View;
  float4x4 Projection;

  float4 ClipPlane0;

  void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0)
  {

clipDistances.y = 0;
clipDistances.z = 0;
clipDistances.w = 0;

position = mul(mul(mul(position, World), View), Projection);

    clipDistances.x = dot(position, ClipPlane0);
  }

  float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0
  {
clip(clipDistances);

return float4(0, 0, 0, 0); // TODO: whatever other shading logic you want
  }

  technique
 {
pass
{
    VertexShader = compile vs_2_0 vs();
    PixelShader = compile ps_2_0 ps();
}
  }

This is the fx file that I found on an xna forum just for reference.

Major edit:

I was able to get the program running successfully but when I viewed the saved screenshot of the refraction map, nothing was clipped.

    public void DrawRefractionMap(Effect clipEffect, Camera camera, GraphicsDevice device)
    {
        Plane refractionPlane = CreatePlane(waterHeight + 1.5f, new Vector3(0, -1, 0), camera, false);
        clipEffect.Parameters["ClipPlane0"].SetValue(new Vector4(refractionPlane.Normal, refractionPlane.D));

        device.SetRenderTarget(refractionRenderTarget);

        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

        foreach (EffectPass pass in clipEffect.CurrentTechnique.Passes)
        {
            pass.Apply();

            DrawTerrain(clipEffect, camera, device);
        }

        device.SetRenderTarget(null);
        refractionTexture = (Texture2D)refractionRenderTarget;

        FileStream stream = File.OpenWrite("Screenshot33.png");

        refractionTexture.SaveAsJpeg(stream, refractionTexture.Width, refractionTexture.Height);
    }

sentences:
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:
SDL2 LogInfo not outputting with different category? So this is probably really simple but I just cannot see it.

I've made my own log class using the SDL_Log functions to output to the console. Only thing is, is that it only outputs using one category type only.

For example. I use this:

Log::getInstance()->info(Log::getInstance()->CAT_APPLICATION, "This outputs fine.");
Log::getInstance()->info(Log::getInstance()->CAT_INPUT, "This doesn't get outputted");

which, in the log class, that uses the following code:

void Log::info(int category, const char* message, ...) { SDL_LogInfo(category, message); }

and:

int CAT_APPLICATION = SDL_LOG_CATEGORY_APPLICATION;
int CAT_INPUT = SDL_LOG_CATEGORY_INPUT;

I've also tried the normal method:

SDL_LogInfo(SDL_LOG_CATEGORY_INPUT, "but this doesn't get outputted either if the app cat is outputted first");

Any ideas on why it's not outputting "CAT_INPUT" but is outputting "CAT_APPLICATION"? And how I could get it outputting all of them?

sentences:
How to avoid obvious triangle pattern when shading 2d quads? I'm in the very early stages of writing a 2d tile-based game using Allegro. I've hacked the Allegro source to allow me to specify tint values at each corner of a bitmap, however the resulting image has very obvious patterning where the quad for the bitmap has been rendered as two triangles:

As you can see, there are clear diagonal patterns going from top-left to bottom-right of each quad.

I'm not really sure of the correct terms to be able to search for a solution...

Are there any techniques I can apply to avoid these sorts of artifacts?

Thanks!

UPDATE: To show an example, here is the lighting system with all corners red, except for the bottom-left green:

And now, here's the equivalent with all corners red apart from the bottom-right green:

You can see the patterning is very different - not simply a 90 degree rotation.

Here's some of the Allegro code I modified:
https://github.com/stu-smith/allegro5/blob/al_draw_corner_tinted_scaled_bitmap/src/win/d3d_bmp.cpp#L187

sentences:
Monogame Drawing Text I'm really new at XNA. I've been following some tutorials at gameprogrammingadventures.org but when it comes to conversations I don't really like how the author does it so I've been trying to understand how to create a rectangle over the game and writing text inside it.
This is done very poorly but I just wanted to understand how to do the basics first and perfect it later. This is what I have so far:

public void CheckConversation(GameTime gameTime)
    {
        if(Xin.CheckKeyReleased(Keys.Space) || Xin.CheckKeyReleased(Keys.Enter))
        {
            foreach (string s in map.Characters.Keys)
            {
                ICharacter c = CharacterManager.Instance.GetCharacter(s);
                float distance = Vector2.Distance(player.Sprite.Center, c.Sprite.Center);

                if (Math.Abs(distance) < 72f)
                {
                    DialogueBox dialogue = new DialogueBox(gameRef, "Text here");
                    dialogue.Draw();
                }
            }
        }
    }

The "game" itself runs on a GamePlayState class. And this is some code for the DialogueBox class:

public DialogueBox(Game1 game, string text)
    {
        TextBox = new Rectangle(1, 1, 300, 200);
        Text = text;
        gameRef = game;
        background = gameRef.Content.Load<Texture2D>(@"Scenes\scenebackground");
        font = gameRef.Content.Load<SpriteFont>(@"Fonts\scenefont");
    }
public void Draw()
    {
        SpriteBatch spriteBatch =gameRef.SpriteBatch;
        spriteBatch.Begin(
            SpriteSortMode.Deferred,
            BlendState.AlphaBlend,
            SamplerState.PointClamp,
            null, null, null,
            null);
        spriteBatch.Draw(background, TextBox, Color.White);
        spriteBatch.DrawString(font, text, new Vector2(1, 1), Color.White);
        spriteBatch.End();
    }

But I can't get it to draw anything on screen. I know for sure the dialogue.Draw call is executed (game crashes if I load a non-existing texture) and I'm going crazy. Like I said, this is probably some stupidly easy question but I can't really figure it out.
Thanks for any help!

sentences:
SDL2 and frames per second I'm diving into the world of SDL2 and C++ and have a few questions after my first few weeks in. Seems like a lot of the tutorials are (from what I understand) limiting the frames per second with a formula that uses the SDL_GetTicks() function to calculate current and last ticks and setting it back, as to limit the frames per second. I could be wording that wrong. Anyways, I've learned about the SDL_RENDER_PRESENTVSYNC flag for SDL_CreateRenderer() and according to fraps it seems to be working quite nicely and locking my FPS at 60 (instaed of 2000+).

My question is, Is SDL_RENDER_PRESENTVSYNC enough to solve the issue or should I also be using that common formula I've been seeing in many tutorials with all the SDL_GetTicks() stuff? Are both methods doing something different that I'm not aware of? I thought they were both just setting/limiting the FPS.

sentences:
Upgrading Unity from 5.1 to 5.3.4 has broken game, specifically models made in Blender I recently decided to upgrade Unity after putting it off for some time as I have a rather sizable project started in 5.1.  I knew there would be some hurdles, however, I have had very little luck in getting the game back up and running in the new version.  My Blender model animations seem to be gone and many of the faces are disappearing.  For example a characters arm is just missing and other similar issues across models.  The warning I'm getting seems to be due, at least in part, to a shader I'm using attached to a prefab, however, when I change it to even the standard shader Im still getting the warnings and the issues persist.

My question is:  Is there something I'm missing in the upgrade process that can make the transition easier, because right now, it would seem I need to recreate all of my Blender assets and reassign all of my materials and not be able to use some of my shaders?

The process in which I upgraded was very simple.  I just opened the project folder with the new version of Unity and rebuilt the project for the new version.

Any help from anyone who has experience migrating projects between different versions of Unity would be appreciated.

sentences:
How to make simple game from max model Possible Duplicate:
  Are there any video tutorials available for game programming with Max?

Suppose i have model of simple 3d ball made in 3ds max. i just want to make simple game for fun . the scene will have only one ball , which will move with cursor.

I know there may be other tools for game but i just want to know how to export 3ds max model in game

sentences:
this.BoundingBox.Intersects(Wall[0].BoundingBox) not working properly I seem to be having this problem a lot, I'm still learning XNA / C# and well, trying to make a classic paddle and ball game. The problem I run into (and after debugging have no answer) is that everytime I run my game and press either of the movement keys, the Paddle won't move. Debugging shows that it never gets to the movement part, but I can't understand why not?

Here's my code:

    // This is the If statement for checking Left movement.
    if (keyboardState.IsKeyDown(Keys.Left) || keyboardState.IsKeyDown(Keys.A))
        {
            if (!CheckCollision(walls[0]))
            {
                Location.X -= Velocity;
            }
        }

    //This is the CheckCollision(Wall wall) boolean
    public bool CheckCollision(Wall wall)
    {
        if (this.BoundingBox.Intersects(wall.BoundingBox))
        {
            return true;
        }
        return false;
    }

As far as I can tell there should be absolutely no problem with this, I initialize the bounding box in the constructor whenever a new instance of Walls and Paddle is created.

   this.BoundingBox = new Rectangle(0, 0, Sprite.Width, Sprite.Height);

Any idea as to why this isn't working?

I have previously succeeded with using the whole Location.X < Wall.Location.X + Wall.Texture.Width code... But to me that seems like too much coding if a simple boolean check could be done.

sentences:
Why does transform.forward appear to be void? I have the following line of code from a project I'm working on:

this.transform.position += (keyMapping.Value * this.movementSpeed).Scale(this.transform.forward);

At a first glance, this line of code looks like it should work, yet, I get the following error when I try to run it:

error CS0019: Operator `+=' cannot be applied to operands of type `UnityEngine.Vector3' and `void'.

I'm stumped as to what might be causing this. How do I fix this?

sentences:
Game state management techniques? First off, I'm not referring to scene management; I'm defining game state loosely as any sort of state in a game which has implications about whether or not user input should be enabled, or if certain actors should be temporarily disabled, etc.

As a concrete example, let's say it's a game of the classic Battlechess.  After I make a move to take another player's piece, a short battle sequence plays.  During this sequence, the player shouldn't be allowed to move pieces.  So how would you track this sort of state transition?  A finite state machine?  A simple boolean check?  It seems the latter would only work well for a game with very few state changes of this sort.

I can think of a lot of straightforward ways of handling this using finite state machines, but I can also see them quickly getting out of hand.  I'm just curious if there's a more elegant way to keep track of game states/transitions.

sentences:
How do I handle user input with good class structure/architecture for an Android game? How do I handle user input having "good" class structure and following normal game architecture*?(see below). At first I didn't think this question was Android specific, although, after seeing a great response in C++ I would appreciate some insight on this question using Android architecture.

Current way I handle input for my Android Game:

Created controller class that takes X,Y screen events and X,Y
character position and returns an int that represents a direction the
character should move.

Call the controller method in the game's
update.

Send that direction value to my character update.

Character's update calls move (which is also passed this value).

Basic switch statement determines the direction my character moves.

Getters and setters for the position of the character.(should
I have them for this direction also)

Is there a better way of handling input? This doesn't feel like the best way. Where does input fit in with class structure and game architecture?
I'm going to accept the C++ answer but I would really like to see a Java answer for Android in the future. :D

sentences:
How would I create an HLSL effect like an animated "working" image? I want to create the effect in the image in HLSL specifically get a block of pixels to move from a specified start point to an end point, so that it can go across the entire screen, but I don't have a clue where to start. Could someone please point me in the general direction ?

This is the effect I want to replicate

This is the image I will be working with

sentences:
2D Circle detection algorithm partially working Hello GameDev stack exchange!

I'm adapting a rectangle to circle collision detection algorithm from the second (not the accepted) answer from here: https://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection. This is C++ code. Here is my adaptation:

bool Collision::checkCircleToRectCollision(sf::CircleShape circle, float rectX, float rectY, float width, float height)
{
    sf::Vector2f circleDistance;

    circleDistance.x = std::abs((circle.getPosition().x - rectX) + circle.getRadius());
    circleDistance.y = std::abs((circle.getPosition().y - rectY) + circle.getRadius());

    if (circleDistance.x > (width / 2 + circle.getRadius())) {
        return false;
    }

    if (circleDistance.y > (height / 2 + circle.getRadius())) {
        return false;
    }

    if (circleDistance.x <= (width / 2)) {
        return true;
    }

    if (circleDistance.y <= (height / 2)) {
        return true;
    }

    float cornerDistance = ((circleDistance.x - width / 2) * (circleDistance.x - width / 2)) +
                          ((circleDistance.y - height / 2) * (circleDistance.y - height / 2));

    return cornerDistance <= (circle.getRadius() * circle.getRadius());
}

The problem is the collision detects only the lower right section of the circle. Without the + circle.getRadius() inside of circleDistance.x = std::abs((circle.getPosition().x - rectX) the algorithm detects even less area. Here is a a picture to visualize. I want the algorithm to detect the entire blue area. It currently only detects the red area. This is a an approximate, but very accurate from what I can tell. The white box is my players hitbox.

I've spent a few days googling and this is the closest I've gotten, but now I'm stuck. How can I make the algorithm detect the entire blue circle? Thanks in advance! :)

sentences:
How to pass arguments with BungeeCord/Bukkit plugin messaging I am trying to send a plugin message from Bukkit, to BungeeCord, but can not figure out how to send arguments.
Here is the code from the Bukkit plugin, which sends the message:

  ByteArrayDataOutput out = ByteStreams.newDataOutput();
  out.writeUTF("BungeeCord"); out.writeUTF("Argument");

  // If you don't care about the player // Player player =
  // Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
  // Else, specify them
  Player plr =  Bukkit.getPlayerExact("spacegeek224");

  plr.sendPluginMessage(p, "BungeeCord",
  out.toByteArray());

Here is the code in the main class of my BungeeCord plugin:

@Override
    public void onEnable() {
        this.getProxy();
        ProxyServer.getInstance().getPluginManager().registerListener(this, new ChannelListener());

        this.getProxy();
        ProxyServer.getInstance().registerChannel("Return");
    }

And finally, here is the code for the ChannelListener:

package net.spacegeek224.metro.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class ChannelListener implements Listener {

    @EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        if (e.getTag().equalsIgnoreCase("BungeeCord")) {
            DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
            try {
                String channel = in.readUTF(); // channel we delivered
                if(channel.equals("BungeeCord")){
                   ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()).create());

                } else {
                    ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()+":"+channel).create());

                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    }

    public void sendToBukkit(String channel, String message, ServerInfo server) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(stream);
        try {
            out.writeUTF(channel);
            out.writeUTF(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        server.sendData("Return", stream.toByteArray());

    }
}

I have tried many things, including Google, and looking at what other methods are available, but have come up with nothing.

sentences:
Why Won't Image Drawing Work In JavaScript In my game at the beginning the first thing that you'll see is a campfire with this code:

 var campfire = new Image();
   campfire.onload = function () {
      ctx.drawImage(campfire, campfireX, campfireY);
 };
 campfire.src = "Sprites/Campfire.png";

However, it doesn't work, I put an

alert("All systems a-ok");

at the end and i get the alert so i don't understand why it's there. You can find the actual image file here   and the full code here. Sorry if I didn't format this well or something, I'm not very good at this =3

This may seem similar to an older question of mine in which I stated how to add a sprite onto the canvas, though in this case, I'm asking why the image doesn't appear on the canvas at all, even though there's no errors.

sentences:
How do I use GetComponent on multiple children? I'm a beginner and I'm making a game in Unity where I set random colors for four enemies. I made an empty object called "enemies" for me to use it as a folder for the four enemies. I want to get the colors of the enemies and pick randomly one of them for my player.

I wrote this piece of code and I wanted it to store the colors in a list, but whenever I try to print it I find out that it only stores the color of the first child in the "enemies" hierarchy. How do I fix this?

enemies = GameObject.Find("enemies");

GameObject[] allenemies = new GameObject[enemies.transform.childCount];
List<Color> colors = new List<Color>();

foreach (Transform child in transform)
{
    allenemies[i] = child.gameObject;
    i++;
}

foreach (GameObject child in allenemies)
{
    thecolor = enemies.GetComponentInChildren<Renderer>().material.color;
    colors.Add(thecolor);
}

finalcolor = Random.Range(0, colors.Count);
//Debug.Log(finalcolor);

mr.material.color = colors[finalcolor];

sentences:
Passing data into a vertex shader for perspective divide In OpenGL and GLSL, I am just learning about perspective projection and the vertex shader. However, I am a little confused about what data actually needs to be passed to the vertex shader, and what needs to be done in the shader code itself.

I have two questions:

Suppose I have a triangle defined in 3D coordinates (x,y,z). Do I need to pass a 4D vector with values (x,y,z,w), where w = z? Or do I just pass the 3D vector? The reason I ask is that I know that somewhere in the pipeline, the x and y coordinates are divided by the w component, in the perspective divide.

In the vertex shader code, do I need to manually divide the x and y components by the w component myself? Or is this taken care of automatically?

Thanks!

sentences:
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:
Implementing axonometric bird-view in XNA I made all kinds of logic (waypath, aso) for my strategical game, based on XNA (monogame).
Now I "misused" the Vector2 a little bit:
As I'm working from a "top-down" perspective, I'm using the Y-axis of Vector2 as Z-axis.

My next step is to draw the elements on the screen:
I think the axometric-view called "bird view" would suit the game most.

I spent most time of the weekend searching for a way to achive this, but without any luck.

I know how I would draw the objects and defining the depths, but I have no idea how to "calculate" the top-down-position to the one with the perspective.

Here's a picture of what I want to do:

How do I calculate the "real" position (here on the right-side) to the perspective-view (on the left side)?
From my research I know the key-word is matrix, but that's all I’ve got.

I don't know to define this bird-view, nor how to proper set up the matrix.
I guess with something like Matrix.CreateLookAt?
And if so: Would I have to change all my Vector2s to Vector3, to use the "real" axis, or is there another way I could achive this?

Any help would be greatly appreciated.

Cheers, Richard

sentences:
Where is the XACT documentation? All the links here are broken:

http://msdn.microsoft.com/en-us/library/bb172314.aspx

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:
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: 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 to stretch Movie Clip according to user's touch coordinates? I have code like this:

touchX = e.stageX;
touchY = e.stageY;

I also have a player movieclip that I'm trying to make shoot lasers.  So I got the MovieClip to appear and rotate according to the player's location and the user's touchX and touchY.  How do I make the laser MovieClip stretch according to the distance between the player's coordinates and the touchX and touchY coordinates?

sentences:
How to get a difference of angles in one mathematical expression? I need to do this for AI and also range calculation over a curved surface.

I have two angles, a1 and a2, which can be in the range from 0 to 359. I need to calculate the difference between them, and it has to be the inside angle (smallest angle), not the "reflexive" outside angle. And it has to preserve the direction from a1 to a2, which will be positive if going counterclockwise and negative if going clockwise.

Examples of what the function should yield:

scr_ang_diff(30, 50) == 20

scr_ang_diff(80, 310) == -130 // NOT 230 !!!

scr_ang_diff(130, 130) == 0

Now I could do this with test cases, but it seems there should be a way to do this in one mathematical expression. I can no longer use the simple min of abs of the two differences (without test cases) because that doesn't preserve direction.

EDIT: in order to differentiate between this post and this, I've decided to make it mandatory to preserve direction between a1 and a2.

Super bonus points if a1 and a2 can have range -359 to +359.

NOTE: yes efficiency matters. That doesn't mean you can't use trig functions, it just means I'll pick the least complex solution.

sentences:
Do unused vertices in a 3D object affect performance? For my game I need to generate a mesh dynamically. Now I'm wondering does it have a noticeable affect in FPS if I allocate more vertices than what I'm actually using or not? and does it matter if I'm using DirectX or OpenGL?

Edit

Final output will be a w*h cell grid, but for technical issues it's much easier for me to allocate (w+1)*(h+1) vertices. Sure I'll only use w*h vertices in indexing, and I know there is some memory wasting there, but I want to know if it also affect FPS or not? (Note that mesh is only generated once in each time you play the game)

sentences:
Dynamic Tilemap size changer I have started coding this project using the library SFML a few months ago.

I have implemented a random map generation everytime I load the game thanks to Biome and the Perlin noise Algorithm.

I wish i could increase the TileMap size on the border of the map according to the player position  (Chunk system in minecraft) .

I have managed to do it on the bottom and the right of the map :

But this isn't dynamic.
There is a snap of my code where i add a new "chunck" :

void TileMap::AddChunckToTileSet(sf::Vector2i PlayerTile, char * direction)
{
    int previousWidth = _width;
    int previousHeight = _height;

    _height = _height + 24;
    _width = _width + 24;
    m_vertices.resize(_width * _height * 4);

    int tileNumber = 384; // ToDO

    // on en déduit sa position dans la texture du tileset
    int tu = tileNumber % (m_tileset.getSize().x / _tileSize.x);
    int tv = tileNumber / (m_tileset.getSize().x / _tileSize.x);

    if (direction == "Down")
    {

        for (int i = previousWidth; i < _width; ++i)
        {
            for (int j = previousHeight; j < _height; ++j)
            {
                // on récupère un pointeur vers le quad à définir dans le tableau de vertex
                sf::Vertex* quad = &m_vertices[(i + j * _width) * 4];

                // on définit ses quatre coins
                quad[0].position = sf::Vector2f((i - previousWidth) + PlayerTile.x * _tileSize.x, j * _tileSize.y);
                quad[1].position = sf::Vector2f(((i - previousWidth) + PlayerTile.x + 1) * _tileSize.x, j * _tileSize.y);
                quad[2].position = sf::Vector2f(((i - previousWidth) + PlayerTile.x + 1) * _tileSize.x, (j + 1) * _tileSize.y);
                quad[3].position = sf::Vector2f((i - previousWidth) + PlayerTile.x * _tileSize.x, (j + 1) * _tileSize.y);

                // on définit ses quatre coordonnées de texture
                quad[0].texCoords = sf::Vector2f(tu * _tileSize.x, tv * _tileSize.y);
                quad[1].texCoords = sf::Vector2f((tu + 1) * _tileSize.x, tv * _tileSize.y);
                quad[2].texCoords = sf::Vector2f((tu + 1) * _tileSize.x, (tv + 1) * _tileSize.y);
                quad[3].texCoords = sf::Vector2f(tu * _tileSize.x, (tv + 1) * _tileSize.y);

            }
        }
    }
}

I call the function AddChunckToTileSet like this :

void TileMap::Update(sf::Vector2i PlayerTile)
{

    if (PlayerTile.y + 15 > _height)
    {
        // Increase map on Down according to our X
        printf("Add Chunck Down\n");
        AddChunckToTileSet(PlayerTile, "Down");
    }

}

Do you have any hints on how I could achieve this correctly ?

sentences:
Collision detection not working in Phaser 3 I am new to phaser. So I started working on a game but I am stuck at implementing collision detection. I want to do it between a static group(dot) and a Sprite(obs).

function create(){

dot = this.physics.add.staticGroup(dotx, doty, 'dot');

dot.create(dotx, doty, 'dot');

obs = this.physics.add.sprite(obsX, obsY, 'obs');

this.physics.add.collider(obs, ball, alert, null, this);

}

sentences:
Minimum number of moves algorithm in Java I'm looking to implement the minimum number of moves algorithm for the java game I'm developing but I can't quite figure it out.
Here's an example picture:

There are also some specifications about this:

The solution in the example above is not unique; other solutions would also be valid as long as the "final character layout (or the positioning of the characters in the nodes)" matches a certain condition (I don't think that's very relevant now so won't go into detail). Also, the nodes aren't actually moved, only it's content.
Adjacent elements cannot be swapped (i.e. in the example above, on the starting side's first swap, 'E' couldn't be swapped with neither 'A' or 'B'; B could be swapped with any character but 'E' and so on.)
The same character can be swapped as many times as one wishes. So, for example, 'B', in the starting side of the picture, could be swapped with 'D'
in the first move (B and D trade places) and then 'B' could be swapped with, let's say, 'E' (so B and E trade places).

So how exactly should I approach this, in order to get the minimum moves? I don't need a full solution, but some pseudo-code or a couple of hints would be greatly appreciated!

sentences:
How to keep balance / Unlock items / achievement rules I'm working on an engine for a game, too learn javascript and just because its fun. I'm a flashdeveloper, I know how to build websites. Now making games is a different challenge, javascript is a challenge, but I'd love to learn how to structure code and what patterns are common. I dont mind if the game ever finish, I'm mostly interested in the programming part of it. I dont have a particular endresult in mind, so I'll see where it takes me.

I currently have a system where you can buy items. The items cost a specified amount of gold, silver, diamonds etc. When you have selected and bought the item, it takes time before getting rewarded. When time is over, you are getting rewarded with other properties (gold, energy, diamonds).
For example, you can buy an apple for 50gold, It takes a minute, you get rewarded with 75energy. Or if you take a run, it cost 50energy, it takes 5minutes, reward is 25gold and 25silver. These definitions is what i call actions. Currently I already have a system where this already works and I can define as much actions with as much properties as I want.

The definitions I have kinda looks like this:

{id:101, category:544, onInit:{gold:-75}, onComplete:{energy:75}, time:2000, name:"Apple", locked: false}
{id:102, category:544, onInit:{gold:-135}, onComplete:{energy:145}, time:2000, name:"Banana", locked: false}
{id:106, category:302, onInit:{energy:-50, power: -25}, onComplete:{gold:100, diamonds:2}, time:10000, name:"Run", locked: false}
{id:107, category:302, onInit:{energy:-70, silver: -55}, onComplete:{gold:100}, time:10000, name:"Dance", locked: false}
{id:108, category:302, onInit:{energy:-230, power: -355}, onComplete:{gold:70, silver:70}, time:10000, name:"Fitness", locked: false}

Now, I would love to add a system where I can lock/unlock the actions using achievement rules. Lets say, if you buy 10 apples, you unlock a new action, like bananas which cost more, and reward more. In the future I maybe want to restrict achievements and actions to levels. I am kinda stuck how to structure this.

I have 2 questions:

Which patterns are used to define achievements? How/where are they defined? Should it be part of the action, or should it be a separate controller? Is it a good idea to register all completed actions to it? I think I want multiple types of achievement rules, Id love to hear some ideas how to develop it.
How do you create/find a good balance, so the user does not get stuck or can cheat by repeat a pattern of actions to get too much rewards. I know there is not a simple answer and i'm lacking of a good game-concept, but I wonder if anyone created such a game and how you dealed and played with it.

sentences:
Handling player/background movements in 2D games Suppose you have your animated character controlled by the player and a 2D world (like the old 2D side-scrolling games). When the user presses right on the keyboard, the background is moved to the right. If the path is always horizontal, this is simple to do (incrementation/decrementation of the x-coordinate).

But suppose that the path is instead a polygonal chain. My questions are:

How do you move the background?
How do you move the background if the game objects are managed with a physics engine like box2D?

Note.

What I wanted to ask is, how do you move a 2D character in a side-scroller?
For example, consider the following path:

A---------B     C'--------D'
           \
            \C__________D

You start from A, move horizontally to B, then move diagonally to C, then move horizontally to D OR, from B, jump on C' and continue till D' and so on.

sentences: Libgdx--how to store every single point drawn using touchdragged? Basically i am trying to detect line collision. The problem is when intersection occurs quickly(touch dragged is done quickly like fling), the collision is not detected. It seems as if 'touch dragged' doesn't store all points.

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:
Optimising Voxel World Rendering There are a couple of questions like this already. This one is different because it is specifically about rendering, as opposed to navigation and generation. I've implemented suggestions from here already.

The current optimisations are:

Only render block faces that aren't adjacent to another face
Render blocks in chunks, each chunk as one mesh (VAO)

According to the NetBeans profiler, 96% of time is spent on the glfwSwapBuffers(long window) method, which is when OpenGL renders the scene. This implies that my other operations are efficient enough, compared to rendering.

What else can I do to improve rendering performance?

The chunk size is 16x16x16 voxels. Sample renders and FPS:

64 chunks : 500 FPS
125 chunks : 300 FPS
1000 chunks : 45 FPS
4096 chunks : 12 FPS

sentences: Navmesh string pulling vs funneling I'm creating a path-finder for navmesh. I'm wondering which method should I use after the A* has been completed, funneling or string pulling? What are the advantages/disadvantages of using them on a triangle-based navmesh?

sentences: What are some techniques used for mouse tracking, with a bit of "emulated lag"? I am trying to implement a system, where the cursor (in my case the player's avatar) is always about 1.5 seconds (a configurable interval) behind where the mouse actually is. If I change the cursor's location every time through, I get an emulated mouse cursor with no delay, I'm wondering if there are any pre-canned type of solutions I can throw at this before I "roll-my-own." Source code or even just basic steps you've used would be helpful.

sentences:
Does ZBrush's ZRemesher set it apart from other software for game models? I'm trying to figure out the most efficient way to model game assets as an indie developer. From what I can tell, sculpting is much quicker than manual polygonal modelling for things like characters. However, it requires a retopology step to get the polycount acceptable.

I've seen the following methods of retopology:

Shrinkwrap edge modelling - can take an hour
Tool-assisted shrinkwrap edge modelling - speeds it up a lot, but still a lot of work
Decimate (automatically remove vertices) - instant, but ugly and inefficient end-result
ZRemesher - automatically creates a near-perfect low-poly model

But the part I'm confused about is that ZRemesher came out 4 years ago and other programs are still lacking any similar built-in features. I did find an open-source alternative called "Instant Meshes" which seems to work okay, but not as good as ZRemesher.

Why is this feature still unique to ZBrush after 4 years? Is it a company secret nobody has been able to replicate, or is it not as important of a feature as I think it is? It seems like it can save 10-60 minutes of tedious work for every model. I'd like to use Blender because it's free and I've already gotten familiar with it, but this makes it seem very inferior to ZBrush.

sentences:
Jumping distance due to X velocity I would just like to know if there is a way to work out the distance of a jump depending on how fast the player is going. For example if the player has a velocity X of 10 and he presses the jump button he should jump further than if his X velocity was, say 4.

I have a working jump mechanic that when the jump button is pressed the velocity is set to a predefined value like -10; Then slowly gravity brings it down but I want it to feel more realistic by applying the jump distance according to his speed

Any way to implement this?

sentences:
What's the state of the art in Space Partitioning for games? I know about BSP trees, Octrees and Portal that where used for a long time. But modern games still use this systems or they are using new things?

If it's possible with pros and cons, considering rendering and collision detection.

sentences:
Placeing stones/tiles on a board game I am a beginner at libGdx.

I am building a board game (the Fanorama game). I would like to use a pic as the board and place the pieces on the board on top of the board sprite. Is there a nice way to pre-determine what (x,y) co-ordinate locations on the board sprite are valid for placing a piece. Later on, when the game is being played I would like to move the pieces from location to location.

Right now, the only way I can think of is to calculate each piece location pixel co-ordinates and hard-code it in an array. I am not sure if there is a better way to do this and a best practice way for me to learn. I am also concerned if this will be affected when the user resized the screen or uses a different sized device (mobile).

How to solve this problem?

sentences:
Why does compiling Unreal Engine fail in Xcode on OS X? I'm following Ben Tristem's latest course on using Unreal Engine and coding in C++. I have issues getting into Unreal however: when I create a project, it does its stuff, i.e. generates code, compiles it etc. but then I get this message:

I tried to open it with Xcode but I don't know what to do next… could someone help me out?

sentences:
How to detect the device type in UnrealScript? How can I recognize if the player device is an iPad or an iPhone?

Now I can do it by checking the viewport size. But I think is just a tricky way, is there any other, more standard way?

sentences:
Get direction vector of camera in voxel game I am currently working on a Minecraft clone (a voxel game). The feature I'm working on is the ability to break blocks. I have a ray-casting/ray tracing algorithm for traversing the voxels, but the only thing I don't know how to do is find the direction vector of the ray.
How can I find a unit vector representing the direction of a ray in 3D space given the pitch and yaw degrees of the ray (and the ray origin, of course)?

sentences:
Faces on 3D model not rendering in the correct I seem to be having trouble with rendering models in monogame. I'm trying to draw several cubes, in a minecraft style world. It's a simple .obj file, nothing special. But... for whatever reason, both the top and the bottom are rendering over the sides, as can be seen here in these four cubes.

My code is simple as can be, so I can't imagine the problem is directly the fault of this:

public static void DrawModel(Model model, Matrix modelspace, Texture2D texture)
    {

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {

                //effect.EnableDefaultLighting();
                effect.TextureEnabled = true;
                effect.Texture = texture;
                effect.World = modelspace;
                effect.View = Cameraworks.ActiveCamera.View;
                effect.Projection = Cameraworks.ActiveCamera.Projection;
            }

            mesh.Draw();
        }

    }

How do I fix this?

sentences: Walking Sprite animation Cocos2D I am new to cocos2D development. Basically I want to develop game in which i want to move sprite forward with walking kind animation, must look real. Any help will be appreciated.

sentences:
Writing Hull shader in directx hey i am studying different types of shaders in directx.
and it comes to hull shader.
so i write hlsl codes for both constant hull shader and control point hull shader in same file in visual studio 2019 .

i compile this file
 and this is showing these errors

the shader type is hull shader and 5.0 model.

struct VS_OUT
{
    float3 pos : TEXCOORD0;
};

struct Patch
{
    float edgeTessFactor[3] : SV_TessFactor;
    float inTessFactor : SV_InsideTessFactor;
};

struct HS_OUTPUT
{
    float3 pos : TEXCOORD0;
};

Patch ConstantHS(InputPatch<VS_OUT,3> patch, uint pI:SV_PrimitiveID)
{
    Patch p;
    p.edgeTessFactor[0] = 3.0f;
    p.edgeTessFactor[1] = 3.0f;
    p.edgeTessFactor[2] = 3.0f;
    p.inTessFactor = 3.0f;

    return p;
}

[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(3)]
[patchconstantfunc("ConstantHS")]
[maxtessfactor(16.0f)]
HS_OUTPUT ControlPointHS(InputPatch<VS_OUT, 3> patch, uint i : SV_OutputControlPointID, uint pI : SV_PrimitiveID)
{
    HS_OUTPUT output;
    output.pos = patch[i].pos;

    return output;
}

any advice would be really helpful.

sentences:
How to change the color of an image when getting points Currently I have a car game which I give points when a car touches the monster.Now extra to that I also wanted to change the color of the car or replace the car image with a different color car image when it is touching the monster.

So where I give point is

monsters.array.forEach(monster => {
            if(monster.isTouching(this)){
                monster.reset();
                monstersCaught += 1;
            }
        });

So now when I give point I also want to change the color of the car.
Any help is appreciated.My pen for the game :pen

sentences: Do I need Microsoft authorization to support Xbox 360 controllers for a pc game? Do I need to pay Microsoft, or do I need some kind of license so I can support the xbox controller on a pc game? Or I just implement it and let people use their Xbox 360 controllers?

sentences:
How to properly scale from natural coordinates to screen coordinate system in OpenGL? I am working on a Physics Engine, and I have been using opengl to visualize what it's doing.  I think I have a scaling issue when going from natural coordinate system to the opengl screen coordinate system, which is between -1 and 1.  I am saying that 1 is 150 meters and -1 is -150 meters.  Therefore, to get to scale I should be able to take the natural coordinate system point say <0,100>, and scale to screen by doing <0,100/150>, which is approximately <0,.667> screen coordinates.

When I watch a 1 kg ball fall from 100 meters, it seems too be falling to slow, as if it's falling under water (see https://www.youtube.com/watch?v=KiZODHIvJ4A for reference).  The physics engine seems to be correct.  I think it has something to do with the coordinate system translation (just dividing by 150 scalar right now).  Does anyone know if I am doing this correctly?

sentences:
Show 3d object on device live camera in Unity3d for iOS Possible Duplicate:
  How to add render able Texture in Unity 3d for iOS

How render a 3d or 2d(.jpg or .png )object at device live camera in Unity3d, and this 3d object shouldn't stuck with camera. It has to show at specific point, like we can set any object in game scene at particular location.

sentences:
Dynamically Generated Mesh Not Visible Unless In Wireframe Mode I'm trying to create a dynamic mesh using ArrayMesh but my mesh isn't visible unless I turn on wireframe debug mode.
Here is a minimal example of a plane mesh consisting of 2 triangles (this script is currently placed on a Spatial node):
func _ready():
    # With these two lines added I can see the wireframe of the mesh (picture below) otherwise I see nothing.
    VisualServer.set_debug_generate_wireframes(true)
    get_viewport().set_debug_draw(Viewport.DEBUG_DRAW_WIREFRAME)

    var ve : PoolVector3Array = PoolVector3Array()
    ve.push_back(Vector3(0, 0, 0))
    ve.push_back(Vector3(10, 0, 0))
    ve.push_back(Vector3(0, 0, 10))
    ve.push_back(Vector3(10, 0, 10))

    var uv: PoolVector2Array = PoolVector2Array()
    uv.push_back(Vector2(0, 0))
    uv.push_back(Vector2(1, 0))
    uv.push_back(Vector2(0, 1))
    uv.push_back(Vector2(1, 1))

    var co : PoolColorArray = PoolColorArray()
    co.push_back(Color(1, 1, 1))
    co.push_back(Color(1, 1, 1))
    co.push_back(Color(1, 1, 1))
    co.push_back(Color(1, 1, 1))

    var id: PoolIntArray = PoolIntArray()
    id.push_back(0)
    id.push_back(2)
    id.push_back(1)
    id.push_back(1)
    id.push_back(2)
    id.push_back(3)

    var no: PoolVector3Array = PoolVector3Array()
    no.push_back(Vector3(0, 1, 0))
    no.push_back(Vector3(0, 1, 0))
    no.push_back(Vector3(0, 1, 0))
    no.push_back(Vector3(0, 1, 0))

    var array_mesh = ArrayMesh.new()
    var arrays = []
    arrays.resize(ArrayMesh.ARRAY_MAX)
    arrays[ArrayMesh.ARRAY_VERTEX] = ve
    arrays[ArrayMesh.ARRAY_COLOR] = co
    arrays[ArrayMesh.ARRAY_INDEX] = id
    arrays[ArrayMesh.ARRAY_NORMAL] = no
    arrays[ArrayMesh.ARRAY_TEX_UV] = uv

    var m_i = MeshInstance.new()
    array_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
    m_i.mesh = array_mesh
    add_child(m_i)

Now with wireframe debug mode on I see the following:

Otherwise, I can't see anything. If I add an albedo_color to the material_override then the lines will change to be that color. I'm pretty new into procedural generation but I've found that a similar thing will work in Unity so I'm not sure what I'm missing here.

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:
How can I estimate the difficulty of user-generated content in my puzzle game? I'm making a puzzle game where one player makes a puzzle, and other players attempt to solve the puzzle the first player made.  The puzzles are a grid of squares that may contain different kinds of traps.  There's a wide variety including the following:

Traps that do initial damage, but don't fire again when you step on them again
Traps that do initial damage, and continue to fire every time you step on them again
Traps that do initial damage, and then do damage over time, but who's effect can be stopped with an antidote
Traps that do initial damage, and damage over time, but who's effects can not be stopped

In addition to all these traps, I have walls, keys, locks, and blank tiles as well.

I'm currently showing the players attempting to solve the puzzle a "difficulty" rating that I got by taking all traps that deal damage divided by all tiles total.  It seems accurate with small puzzles (4x4, 5x5), but when you scale it up (20x20, 25x25), you get deceptively low ratings for extremely difficult puzzles because of the sheer size of the puzzle.

This has led me to try to find a better solution for a difficulty rating.  Things I've considered:

Figuring out a "damage per tile" average by taking the damage all the tiles do divided by all eligible tiles a player can walk on (factor out walls), but with this approach, I can't figure out how to factor DoT (Damage over Time) tiles into it.  For instance, after 10 tiles, I can give an average amount of damage a player will take with regular traps, but how do I give them an average with a DoT trap? They could activate it on the first tile or the last, and the damage numbers are significantly different.
Figuring out a "difficulty score per tile" and trying to factor that into a rating.  All tiles are currently given a "cost" (the amount it costs the player to use them when creating the puzzle), and that number roughly correlates to how much difficulty the tile adds.  I was thinking about using that number to get a difficulty rating, but I'm unsure how I'd use it correctly.
Trying random solutions and seeing how long it takes a bot to solve it.  I don't think this is a good solution for a number of reasons.  It could be solved on the first try by sheer luck, and hide how difficult the puzzle is.  Plus, with keys and locks, backtracking is required, and I think the computing time to run these simulations would be cost prohibitive.
Ditch difficulty ratings all together.  If I can't figure out an intuitive way to show the player how difficult a puzzle is at a glance, I might just have to remove it.

I realize some of this might be hard to visualize, so here are some pictures of a puzzle and it will hopefully help you see what I mean:

The user starts at the star and makes their way to the exit.  This is a view with all the tiles visible, and when the user attempted to solve it, a lot of the tiles you see in that picture would be hidden from them until they were "activated" (by the user stepping on them).

sentences:
When doing network programming, is it always a good idea to optimize packet size as much as possible? My question is relatively straightforward, but I haven't been able to find a concrete answer yet.

I'm programming a real-time networked multiplayer game, and I'm finding many examples of places where I could optimize packet size (i.e. minimize packet size) in small ways. As an example, one packet type stores player input (running, jumping, firing a weapon, etc.) along with an integer ID for that player. In practice, there will never be more than four players in a single game, meaning that ID could be represented with only two bits (four possible values) rather than the full 4-byte integer.

My question is, should I send only those two bits across in a network message or just send the full integer?

To clarify, I'm not referring to storing the ID in the main code itself. For that, I'm just using an int. I'm only curious about what I should be sending in a network packet. That's also just one example of a few I've run into.

The reason I ask is that this feels like a "don't prematurely optimize" scenario. Ordinarily, I know to not worry about optimization (within reason) until I've run profilers, but I'm less familiar with networking than "normal" programming. Is it better to optimize packet size as much as possible, or would that be overkill?

Thank you.

sentences:
What is your Unity 3D physics engine budget for iOS games? I'm testing Unity for a game that I'm building, and I've touched its limit.

My test scenario: a wanna-be house with 200 elements (cubes rescaled) no textures, box colliders and rigid bodies for each "cube" and fixed joints to hold them together (400+ fixed joints). The house is on a plane, and above it I put 2 sphere at different altitudes, spheres which will crash in the poor house.

This moves very slow on an iPod Touch 3rd generation. Therefore I'm looking for some documentation to create a reasonable budget for the number of polygons, physics collisions and so on. What is your recommendation?

sentences:
How to redraw the node canvas when the zoom changes on the Godot editor? I have an addon that extends EditorPlugin and a companion script attached to a node. The companion script draw a rectangle with a size stablished by an exported property that can be edited from a gizmo on the editor. The general idea is that the plugin shows a handle that allows to drag the visual representation of the exported property, but is the companion script the one that draws its representation on the editor. The only problem is that the node won't redraw itself when zoom changes. Is there a way to fire a redraw event when the zoom changes instead of using _process(delta), since doing it every frame would increase CPU consumption dramatically for the Godot editor on a MacBook Air laptop.
This video shows the issue I'm describing https://youtu.be/wv382kOCKHY

sentences:
Changing colour of multiple prefab instances when dragging over them So I am having some issue trying to get it so that when I touch/mousedown that an instantiated prefab changes color and then with mouse down still any other prefab that mouseenters, that prefab should change color as well. the bit of code that i have is shown below. Nothing happens though, other than the one prefab that received the OnMouseDown changes color, but not the others OnMouseEnter. If i remove the if statement though, they do change color OnMouseEnter. Any suggestions on how to do this or what i may be doing wrong?
Thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Letter : MonoBehaviour
{
    Color clkColor = Color.red;

    private bool _clicked;

    void Start()
    {
        _clicked = false;
    }

    void OnMouseDown()
    {
        _clicked = true;
        this.GetComponent<SpriteRenderer>().color = clkColor;
    }

    private void OnMouseEnter()
    {
        if (_clicked == true)
        {
            this.GetComponent<SpriteRenderer>().color = clkColor;
        }

    }
}

sentences:
How do you gather and collate information you need to make a post-mortem? After the game is done (either shipped or the project was canned), what is the best way  to make the post mortem, so that it maximizes the chances to never make the same mistakes again?

How do you gather all the needed informations from the team?
How do you condense them in the final postmortem?
How do you avoid to make the same mistakes in the following project?

sentences: Is it possible to run GLFW eventhough my graphic card(Nvidia) supports Direct3d API? I have Nvidia 820M GPU installed in my windows 7 machine. In nvidia control panel it is showing it supports Direct3d API version 11. Am I able to run OpenGL applications(using GLUT,GLFW) on my machine with this configuration? see the below screenshot for configuration details.

sentences:
How to make a part of an object with navmesh agent rotate separately? I have a game object (a Humvee jeep) and it has a turret gun on top of it.

What i want to do is while the vehicle is moving in a line the turret look at player. I tried rotating the turret gun with "Transform.rotation" and "transform.lookat()" but nothing happened.
Is it possible to move/rotate some part of an object with navmesh separately?

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:
Space & Sound? Defying Physics? Why are there sound effects in space shooter games like asteroid and such?

There is no medium in space for sound to travel by. Yet we get hear gun shots & explosion.

I am not talking about the background music/sound.

sentences: How to handle day and night in a 2D sprite game Do I need to draw, for example, a tree how it looks in the day (normal colors) and how it looks at night (colors aligned according to the moonlight)? Or does Unity have a function for that?

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:
Unity - Ambient Occlusion artefacts When I create two cubes from Unity > Component menu. And turn on AO the bottom cube is not shaded properly. I mean the upper cube is alright but the bottom cube does not have any shadow present. What am I doing wrong ?

Lighting setup:

Result:

sentences:
Should widgets be part of a scene in a 2D game? I'm in the middle of separating logic and drawing of a 2D game, i.e. I'm moving from scenes/entities that draw themselves to scenes/entities that merely store and update data, getting drawn by a renderer.

This works pretty well for scenes and entities, but I can't figure out how the UI fits in. Right now, I draw widgets in the draw routines of some scenes. Scenes can currently also handle input, so it's relatively close to how UI toolkits do things. There are even scenes with nothing but UI, e.g. the main menu. But with the new approach where scenes don't draw themselves anymore, I need a new approach.

How could I do this? Are widgets even supposed to live in scenes, alongside entities? Or should they be in their own kind of scene, e.g. windows or dialogs?

sentences:
Which university shall I choose in UK? ( game programming ) I'm starting my undergraduate studies soon, but as I'm not from UK, I completly don't have idea what university should I choose.

Do you know any good game programming universities?

Is it good idea to make computer science as undergraduate studies and game-programming as postgraduate one? I'm thankfull for all your replies, as they help me alot.

sentences:
Unity: running GPU intensive operations in editor mode I have written an erosion simulator that I want to execute from the editor (for generating terrain and such outside of play mode). Unfortunately, when I crank the parameters on my simulation, unity hangs. The UI becomes unresponsive, none of the menus work anymore. However, the process is still running - windows doesn't claim that the program is no longer responding.

The weird thing is that task manager claims that the GPU is sitting at zero utilization while Unity hangs. My (CPU side) erosion code looks something like this (executed via editor script):

    HydraulicCompute.SetFloat("_ErosionRadius", ErosionRadius);
    HydraulicCompute.SetBuffer(_erosionId, "HeightMap", heightMap);
    HydraulicCompute.SetBuffer(_erosionId, "Droplets", _dropletBuffer);

    int threadGroupsX = Mathf.CeilToInt(mapSize / 8.0f);
    int threadGroupsY = Mathf.CeilToInt(mapSize / 8.0f);
    for (int i = 0; i < 100; i++) {
        HydraulicCompute.Dispatch(_dropletId, Mathf.CeilToInt(_dropletBuffer.count / 1024.0f), 1, 1);
        HydraulicCompute.Dispatch(_erosionId, threadGroupsX, threadGroupsY, 1);
    }

When the size of the _dropletBuffer is bigger than 12,000 (32 bytes per droplet), and the heightMap buffer larger than 1024x1024 (4 bytes per pixel), then I run into the aforementioned problem.

I would guess that the issue occurs either because there is a problem with the buffer sizes, or that the frame takes too long and Unity times out.

When I comment out the Dispatch calls Unity is able to allocate and populate the buffers instantaneously (at least it looks really quick). While that doesn't rule out the potential buffer problem, it certainly makes it seem less likely.

So what exactly is the problem here? Is it a memory problem? Or is the frame timing out? Or something else entirely?

Is there a prescribed way to doing this kind of intensive GPU work in the background in editor mode? I've looked at the Job system, but that seems to be CPU side only...

[EDIT]

I have managed to put together the following snippet which always crashes on my GPU (NVIDIA 980ti):

[numthreads(1,1,1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    for (int i = 0; i < _NumIterations; i++) {
        HeightMap[1024*512 + 512] = 0;
    }
}

When executed as 1 thread group for 1 iteration (_NumIterations = 1), this crashes my GPU driver. I am running on the latest version. I have no idea as to what might be causing the problem, windows event viewer just lists a nvlddmkm error, which apparently means it could be just about anything. It's frustrating to say the least.

sentences:
How can I calculate the orthographic projection needed to encompass an object with arbitrary rotation? So I need to set up the dimensions of a orthographic projection that will encompass the entirety of a bounding box when viewed from any arbitrary position.

That's an eye (programmer art); and the vertical line next to it is my view. How can I work out what the size of this view should be so that it encompasses the furthest corners of my rotated rectangle (from the viewports perspective)?

I want to do this in 3D obviously, I thought 2D would explain it better.

So far, I've considered that if I have:

The coordinates of each corner of my bounding box from it's model matrix perspective
With this, I could easily work out what the furthest ones are IF I was able to multiply it with my view matrix. However, it's the view matrix I'm trying to calculate...

sentences:
Problem with collisions detection on canvas platformer Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float.  Also the corners let the block sink right through and the walls are sticky. It's a bit of a mess. I know for the floating my gravity is a big issue. If anyone could help me out i'd be so so happy.

Heres the collision code:

  const calculatedTileSize = 1.0 / mapTileSize;
  const nextX = guy.x + guy.velX;
  const nextY = guy.y + guy.velY;

  const currentMinX = (guy.x * calculatedTileSize) | 0;
  const currentMaxX = ((guy.x + guy.width) * calculatedTileSize) | 0;
  const currentMinY = (guy.y * calculatedTileSize) | 0;
  const currentMaxY = ((guy.y + guy.height) * calculatedTileSize) | 0;

  const nextMinX = (nextX * calculatedTileSize) | 0;
  const nextMaxX = ((nextX + guy.width) * calculatedTileSize) | 0;
  const nextMinY = (nextY * calculatedTileSize) | 0;
  const nextMaxY = ((nextY + guy.height) * calculatedTileSize) | 0;

  // X axis collision
  if (guy.velX !== 0.0) {
    for (let i = nextMinX; i <= nextMaxX; i++) {
      for (let j = currentMinY; j <= currentMaxY; j++) {
        if (map[j][i]) {
          guy.velX = 0.0;
          break;
        }
      }
    }
  }

  // Y axis collision
  if (guy.velY !== 0.0) {
    for (let j = nextMinY; j <= nextMaxY; j++) {
      for (let i = currentMinX; i <= currentMaxX; i++) {
        if (map[j][i]) {
          guy.velY = 0.0;
          physics.gravity = 0;
        } else {
          physics.gravity = 0.4;
        }
      }
    }
  }

The full game is in this codepen:

https://codepen.io/charlie1172/pen/OeGdvJ

sentences:
glGetActiveAttrib on Android NDK In my code-base I need to link the vertex declarations from a mesh to the attributes of a shader. To do this I retrieve all the attribute names after linking the shader. I use the following code (with some added debug info since it's not really working):

int shaders[] = { m_ps, m_vs };
if(linkProgram(shaders, 2))
{
    ASSERT(glIsProgram(m_program) == GL_TRUE, "program is invalid");

    int attrCount = 0;
    GL_CHECKED(glGetProgramiv(m_program, GL_ACTIVE_ATTRIBUTES, &attrCount));

    int maxAttrLength = 0;
    GL_CHECKED(glGetProgramiv(m_program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttrLength));

    LOG_INFO("shader", "got %d attributes for '%s' (%d) (maxlen: %d)", attrCount, name, m_program, maxAttrLength);

    m_attrs.reserve(attrCount);

    GLsizei attrLength = -1;
    GLint attrSize = -1;
    GLenum attrType = 0;

    char tmp[256];
    for(int i = 0; i < attrCount; i++)
    {
        tmp[0] = 0;
        GL_CHECKED(glGetActiveAttrib(m_program, GLuint(i), sizeof(tmp), &attrLength, &attrSize, &attrType, tmp));
        LOG_INFO("shader", "%d: %d %d '%s'", i, attrLength, attrSize, tmp);
        m_attrs.append(String(tmp, attrLength));
    }
}

GL_CHECKED is a macro that calls the function and calls glGetError() to see if something went wrong. This code works perfectly on Windows 7 using ANGLE and gives this this output:

info:shader: got 2 attributes for 'static/simplecolor.glsl' (3) (maxlen: 11)
info:shader: 0: 7 1 'a_Color'
info:shader: 1: 10 1 'a_Position'

But on my Nexus 7 (1st gen) I get the following (the errors are the output from the GL_CHECKED macro):

I/testgame:shader(30865): got 2 attributes for 'static/simplecolor.glsl' (3) (maxlen: 11)
E/testgame:gl(30865): 'glGetActiveAttrib(m_program, GLuint(i), sizeof(tmp), &attrLength, &attrSize, &attrType, tmp)' failed: INVALID_VALUE [jni/src/../../../../src/Game/Asset/ShaderAsset.cpp:50]
I/testgame:shader(30865): 0: -1 -1 ''
E/testgame:gl(30865): 'glGetActiveAttrib(m_program, GLuint(i), sizeof(tmp), &attrLength, &attrSize, &attrType, tmp)' failed: INVALID_VALUE [jni/src/../../../../src/Game/Asset/ShaderAsset.cpp:50]
I/testgame:shader(30865): 1: -1 -1 ''

I.e. the call to glGetActiveAttrib gives me an INVALID_VALUE. The opengl docs says this about the possible errors:

  GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.

This is not the case, I added an ASSERT to make sure glIsProgram(m_program) == GL_TRUE, and it doesn't trigger.

  GL_INVALID_OPERATION is generated if program is not a program object.

Different error.

  GL_INVALID_VALUE is generated if index is greater than or equal to the number of active attribute variables in program.

i is 0 and 1, and the number of active attribute variables are 2, so this isn't the case.

  GL_INVALID_VALUE is generated if bufSize is less than 0.

Well, it's not zero, it's 256.

Does anyone have an idea what's causing this? Am I just lucky that it works in ANGLE, or is the nvidia tegra driver wrong?

sentences:
Metaballs created through raycasting in fragment shader - billboards are still recognizable Good day everyone,

I'm currently programming a fluid simulation through use of metaballs and I have a very specific problem/question.

The steps I use for metaball simulation:
1. Simulate particles' positions
2. Create billboards that always face the camera with the particles' positions at its center
3. Cast a ray from camera to every fragment/pixel and determine the value of every particles' contribution along the ray.

Currently, I have nice looking metaballs with lighting, however, when you look closely you can see the edges of a billboard that is infront of another metaball because the colors are slightly off. The fragments that fail the raycasting test get discarded, but they are obviously still somehow interfering and I just don't know how or why.

Want I want to know, because I have thought about it and didn't come to a conclusion: since the actual fragments of the billboards where there is no implicit surface are discarded, that means that not the color value of the "obstructing" discarded billboard gets changed, but instead that of the actual goal billboard.
where are possible points of conflicts that may create this behaviour?

Thanks in advance!

EDIT:
I think I am wrong about my earlier assumption: the raycast used to determine the implicit surface most likely hits a metaball BEHIND the billboard, so it actually doesn't get discarded... it then takes the normal of the actual intersection, but uses the light direction vector that is made by using the fragment's position, not the actual intersection. So, my guess is that I need a better condition to let the raycast know it didn't hit anything instead of continuing and hitting a ball that is a little further away.

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:
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:
Unity: What's the difference between SRP batching & GPU Instancing? I've been researching a lot about Draw calls and how to reduce them, i'm using GPU Instancing and it's amazing, but i did not succeed in making SRP batching work.

What's the difference between the two and when to use which?

can we use them together?

sentences:
Blender to UE4 eye mesh is getting detached I've created a rigged and animated mesh using MakeHuman and Blender and exported it as FBX file to be used in Unreal Engine, all seems to be working well except the eyes. I've tried parenting the eye mesh to the head bone which works fine in Blender but unfortunately doesn't work with Unreal Engine. My second approach was to create a bone for each eyes and parent the eye mesh with weights which is better but it's still doesn't work as it shows in blender.
In Blender 2.82 ( works through out the animation )

In UE4 - 4.24.3 ( sometimes the eyes are inside the body, sometimes it pops outside, never in the right place. )

sentences: How to show specific item in question on trigger entry? (Unity & c#) So I have multiple, random objects on a plane, and when my player walks into them, I want them to be 'picked up'. The player can only hold one object at a time, and needs to return the item to the base before he can pick up another. Using the OnTriggerEntry function in a collider script, a set of commands are called when the player touches the object. Within the function, the 'itempickup' function from the player script is called using 'col.transform.SendMessage()'. How do I tell the itempickup function which specific object was 'picked up' in the trigger script? That is, is there a variable of some kind that acts as an ID for game objects? Thanks :)

sentences:
LibGDX - ShapeRenderer as principal game entity renderer I am trying to make a 2D game that is just a bunch of default figures like circles, arcs and quadrilaterals with no textures (similar to Super Hexagon), and for that I was using C# and XNA long time ago, but recently I move my code to Java and LibGDX mostly using the ShapeRenderer library.

The problem appears when, reading in internet, I found that render this figures is a more computational cost task than just draw a texture or sprite. But by the nature of this project I just can't use sprites or similar, mostly because I will drastically scale this entities in the game, and when I scale an image the result is just not nice, blurry and/or pixelated.

What I asking for is if is a bad idea to render pure shapes for a game (no images, except maybe the background and text)? is ShapeRenderer a good approach? Do I should try with another way to manage this "not-affected-by-scale"-entities?

I have read some answer from here (like this or this) but they are focused on sprites, not just pure shapes.

For now, I got acceptable results and the game run smootly even when I create a lot of shapes, but in the future I plan to use effects and so, and I don't know if render shapes is the best answer or if this will affect the performance of my game (the game is focus for PC platform). I'm not limited only to Java, and if exist another language/framework that manage this with better result, I'm opened to learn it.

Thanks!.

sentences:
Accessing enum value in other scripts I am attempting to make a global MaterialAssign script that I can assign to anything and have an enum selector in the inspector to assign a material type.  This would then drive hitFX and soundFX variation in other scripts.
My selector script MaterialAssign.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MaterialAssign : MonoBehaviour
{
    public enum MatSelection
    {
        defaultMat,
        metalEnemy,
        metalWall,
        dirtWall
    }
    public static MatSelection currentMat;
}

Attempt at usage in another script:
if (MaterialAssign.currentMat == MaterialAssign.MatSelection.metalEnemy)
{
    selectedHitFX = bulletMetalEnemyFX;
}
else if (MaterialAssign.currentMat == MaterialAssign.MatSelection.metalWall)
{
    selectedHitFX = bulletMetalWallFX;
}

I have no errors in the console BUT the enum selector doesn't show up in the inspector, so I'm assuming no value is ever passed. I read that enums can't have a static value, but not sure how to handle that.
Any assistance would be most appreciated or alternate approaches welcome! I'm purposely trying to stay away from tags, but can go down that path if needed.

sentences:
Algorithm for spacing points out among a line I'm writing an angled tile system, and my implementation is to have a starting height and an ending height inside the tile.

Like so:

The starting and ending height allow me to get the length of the angle and the angle in degrees using atan2.

For collision against the angled tiles I give the tiles a collection of points along the line, and as a bounding box intersects any of a tile's slope points it will move the box's y position to that point.

This implementation works fine for 45 degree tiles, however with other degrees I don't know how to create the points on the line.

What algorithm could I use to space the points out along the line when they are not in a perfect 1 to 1 ratio angle? (e.g. 17 degrees instead of a nice 45 degrees)

EDIT: Here's a way to interpret my question perhaps more academically:

Given a length of a line and its angle, and an arbitrary number of points, find an algorithm that will space the points out among the line that will as closely resemble the angle.

sentences:
Bullet holes on curved surfaces and corners So right now I am making an FPS game where the gun creates bullet holes (plane with texture) on impact, but there is a problem with that, if I shoot at the edge the plane will stick out and also bullet holes will not look proper when I shoot at a curved surface. I know there's at least 2 ways one is shaders and another mesh manipulation, but I could not find any tutorials on how to do it and never understood neither of them. Is anyone able to explain in detail exactly how I would achieve the effect?
Thanks in advance.

sentences:
Retrieve variable from another class and send to another scene in Unity Sorry for asking a noob question, but I have never used c# in Unity, only unityscript.

Basically I have a public int score variable stored in Players Class.

I need to retrieve it in the following method:

void OnTriggerEnter(Collider c)
{
    if(c.tag == "PlayerCollision")
    {
        if(!c.gameObject.transform.parent.gameObject.GetComponent<Player>().isDead)
        {
            Debug.Log("Hit");
            //Load next scene
        }
    }
}

How can I retrieve the score variable in this method below and send the variable to the next scene? (In unity script I had to do something like Application.LoadLevel(1); after of course building the scene as levels. Thanks

sentences: How create a respawn area in a tiled map I'm creating a RPG game, I need to create a monster respawn area like the Pokemon games where if I walk through the long grass areas a Pokemon can appear. I already created the battle scene, I've seen examples of tile collision with solid objects but I don't know how  create a collision action with passable objects.

sentences:
Does LibGDX have methods capable of creating dynamic text like in candy crush? As you see, the "Retry" button and the "Invite Friends" button are both animated, smoothly and cleanly.

If I were to do this in Libgdx, would I have to use the Animation class and provide multiple texture regions of the buttons to create this animation effect? Or are in built methods included to help simulate this effect?

I've seen examples of people claiming you must use OpenGl ES methods directly. Is that true? Are there extensions to help create this effect?

sentences:
Super mario bros "rounded" tile collision detection I'm working on a Mario bros clone with SDL and C++ (purely for educational porpuses / and for fun)
I got collision detection working by using AABB collision detection and resolving one axis at a time:

Check collision with X-axis first
Move entity if not collision is detected
Check collision with the Y-axis.
Move entity if not collision is detected

This is working great!
However, one thing that I really like about the original Mario bros is that tiles have some kind of "rounded" feel to them. I think this helps make the map feel more organic, see how Mario moves left when jumping on a corner in the original SNES game:

I thought of using a circle collider for mario instead of an AABB.
This would make Mario "fall" off the tiles if you step too close to the edges. But perhaps someone knows a better approach. I've been thinking about collision detection for longer than I'd like to admit.
I'd love to know if someone has a clean aproach to accomplish what the GIF shows.

sentences:
Some theory questions about classic endless arcade games I had read in the book "A theory of fun for game design" that once the player realizes that he cannot overpower the computer in anyway (or) the AI is unbeatable (badly designed/coded) he will leave the game and not try to beat it. But looking at new age games like "Jetpack Joyride" I think this rule is not true for everyone anymore. Not sure if this is a deliberate choice or just bad design.

I want to know if there exists any history about how the old classic ATARI / Arcade machines games were implemented/tested. Best example would be Pac-man/Asteroids etc. I am hoping that those game makers didn't just increment the speed of the enemies blindly with the level number. They must have tested it enough to ensure that the game can actually beaten up to very high levels and might have tweaked the required parameters to ensure it in their code.

Are there articles/tutorials about designing endless arcade games? I have been searching a lot but couldn't find any.

sentences:
How to scale openGL textures by a ratio based on height/width (or alternative)? I have been able to successfully allow my UI to extend over edges of my game on higher resolutions by using the Android Guide and by implementing this code on the GL10 object:

gl.glTranslatef(GTEngine.get_SCREEN_RATIO(), 0f, 0f);

Where the first parameter is the ratio calculated by dividing the width by the height.

My confusion arises in the ability to use :

gl.glScalef(n,n, 1f);

... to scale the image by using the same screen ratio in order to account for the "growth" or "shrinkage" that comes with different resolutions. Does anyone have a solution for this n variable? I cannot seem to make up some mathematically solution that works, and am worried that I may be forced to build a case by case logic (>.>)

sentences:
Tilemap Collision w/ different height levels and directions I've been programming a final fantasy 6 clone in C# using Monogame and Monogame Extended, and have met on a few interesting challenges regarding tilemap collision.

The game seems to have different height levels on tilemaps, such as in the picture below where the bridge is on one height level and the ground on another. I'm using Tiled for my maps and have the bridge on it's own layer, and the ground on another. However, when it comes to collision, you shouldn't be able to for example walk up on the bridge and end up on the ground, which leads to the problem of collision detection. Collision for the ground level should be different than on another height level like the bridge, but I'm not sure what a good solution to handle that could be.

Since I'm using TiledMap from Monogame Extended, I can't really modify the Tile class to hold collision data. My initial idea was to have an extra object or tile layer for each height level to specify collision/solids for each height level, but I found that it wasn't very intuitive and that it was a little messy. Optimally I would only need one tile layer per height level, but I'm at a loss for any ideas on how to handle collision in a scalable and intuitive way, so I was wondering if anyone here had any ideas?

Another interesting problem is regarding tile collisions and directions. For example, when standing in front of the fence in the picture below, you should not be able to walk up and behind the fence. But, if you are standing one tile above the fence, you should be able to walk down and behind it, but once you are behind it you should not be able to walk down again and end up in front of it.

I think the solution to that problem is to define collisions on each edge of the tile, so that the bottom edge of the tile is marked as solid, while the other edges aren't. The main issue with that is that I have no idea how to implement something like that with Tiled. It also presents the problem of rendering, since the tile would need to be rendered below the player if the player stands in front of it, and above the player if the player stands behind it. I think using a Z-index would solve it, but again, I haven't found a way to implement that using Tiled. Soo, I was wondering if anyone has any ideas or pointers on how to use Tiled w/ Monogame + Monogame Extended to implement those things?

sentences:
Poker AI's designed for casual play DISCLAIMER: So I asked this on StackOverflow and was told it was not a good question for the community but was suggested to check here. If this question sucks or just doesn't belong here either, feel free to let me know. It seems a fair question to me, but I know it's important to maintain high standards on these sites.

So I just put the finishing touches on a poker game in JavaFX. Part of the functionality in this program is a single player mode, where you can play hands against the computer. To be transparent, this is a university project, so I'm not aiming for perfection. More, just an ai that behaves semi-intelligently for game variation and minor challenge for casuals.

So to be clear, I am aware of general poker strategy, and have found numerous articles/research papers/links on more in-depth poker AI's designed to compete against competitive players. I guess as an analogy, there's the Easy mode bots in League of Legends, then there's the deep learning AI that beat a DOTA pro in laning.

I'm definitely aiming for the former here. While I currently have a basic algorithm that works as:

if(gamestate = flush, straight, 3-pair, full-house, face card pairs)
{
     raise 1/4 pot;
}
else if(gamestate = pair, potential flush or straight, etc)
{
     check/call;
}
else
{
    fold;
}

So I already have functionality that can detect current board/hand states, but I do not have any functionality that can estimate chances at winning the hand, compare with opponent's possible hands, etc. Since the game only needs to be for casual play, the more advance algorithm's seem like massively overkill.

I guess my wishful thinking hope is that something exists similar to min-max in tic tac toe, although poker is obviously more complex. But something that can make some kind of rough approximation of hand value, that wouldn't require thousand's of if statements to cover every possible situation.

So if anyone knows of any algorithms that would be used in, for example, a poker phone game or such, I'd really appreciate some help. To reiterate, if this question is too vague, I'm happy to provide any other information about my existing research, program design, or anything in this vein.

sentences:
Powerup Best practices In a turn based game each player has a set of properties, e.g attack, defence, speed and these can all be used to work out who should go first and how much damage should be dealt. That all works fine, but the problem I'm having is with edge cases where a player receives a power-up for one turn that lets them move first. How should I handle this? Should I increase the speed value and then somehow remember to reduce it next turn or should I implement some sort of object which holds modifiers that is checked every turn?

I'd also need to be able to scale this to different things like temporary poison etc.

Basically I'm very confused and help would be appreciated!

sentences:
How do I make NPC pathfinding look believable? Is there an "academic" way to have NPC walking randomly on a map, but having a believable comportment ?

The obvious scenario is a armed guard who is walking around a basement to secure it. It's quite easy to set up a "believable" path.

What I'm looking for is a way to simulation a crowd in a small town, in fact. How can I make their move look like they aren't goalless robots.

sentences: How do I handle moving platforms in a platform game? I don't want to use box2d or anything, I just want simple moving platforms (up-down, left-right, diagonal and circular paths). My question is to handle the update order / control hierarchy so that the player stays fixed to the platform solidly, without bouncing or wobbling?

sentences:
Adding a short delay between bullets I'm having some trouble simulating bullets in my 2D shooter. I want similar mechanics to Megaman, where the user can hold down the shoot button and a continues stream of bullets are fired but with a slight delay. Currently, when the user fires a bullet in my game a get an almost laser like effect. Below is a screen shot of some bullets being fired while running and jumping.

In my update method I have the following:

if(gc.getInput().isKeyDown(Input.KEY_SPACE) ){
    bullets.add(new Bullet(player.getPos().getX() + 30,player.getPos().getY() +  17));
}

Then I simply iterate through the array list increasing its x value on each update.

Moreover, pressing the shoot button (Space bar) creates multiple bullets instead of just creating one even though I am adding only one new bullet to my array list. What would be the best way to solve this problem?

sentences:
How to remove white background from an image using LibGdx? I am fairly new to game development.

I am developing an application(Aquarium) for windows which requires me to animate(move) fishes around the screen and user will be able to add new fishes drawn on paper and scanned into the application, I did some research and decided to use LibGDX so when user scans the image coming to the system has White background which needs to be removed I needed to know how to remove that make it transparent in LibGDX.

sentences:
Unity raycasting not always detecting component I am trying to determine what object I am clicking with the help of a raycast, however it doesn't always work
In update I call:
if (Input.GetMouseButtonDown(0))
{
    selectedObject = null;
    selectedUnits = new List<Unit>();
    Select(Input.mousePosition);
    startPos = Input.mousePosition;
}

which calls:
void Select(Vector2 screenPos)
{
    Ray ray = cam.ScreenPointToRay(screenPos);
    RaycastHit hit;
    //Debug.Log("1");
    if (Physics.Raycast(ray, out hit, 100))
    {
        OnClicked(hit.transform.tag);
        //Debug.Log("2");
        if (hit.transform.GetComponent<Unit>())
        {
            //Debug.Log("3");
            if (!selectedUnits.Contains(hit.transform.GetComponent<Unit>()))
            {
                //Debug.Log("4");
                selectedUnits.Add(hit.transform.GetComponent<Unit>());
            }
        }

        if (hit.transform.GetComponent<Building>())
        {
            if (hit.transform.GetComponent<Building>() != selectedObject)
            {
                selectedObject = hit.transform.gameObject;
            }
        }
    }
}

Detecting a "building" always works and is fine, but clicking on a "unit" works anywhere between 0 and 5 times per play session before it returns nothing anymore like the object doesn't exist. I have tried to find where it gets stuck and it gets stuck after the 2nd debug (debug 1 and 2 print but 3 and 4 do not).
This is the Unit in the inspector

and this is it in the hierarchy

When drawing the ray here you can see it hits the cube 3 times before it just passes right through the 4th time.

it seems like after each hit the ray penetrates the collider more and more

But how and why can it only hit it a couple of times before it passes through. After a certain amount of clicks with or without moving my mouse it just doesn't hit it anymore even though in the inspector nothing changes and there are no scripts that alter the box collider.
I hope someone knows what's going wrong, thanks!

sentences:
Why does the X Y Z translations now rotate along with my static meshes? So I was making a map for UT3, using the Unreal 3 Editor provided, and all was going well.

However I was doing some work with InterpActors and Vehicle Spawners, when I must have hit a key by mistake (or other wise somehow changed something) by mistake.

Now the X Y Z translations that are used to move objects around in the editor will rotate along with the object (Ive put images down below to help show what I mean)

This is very annoying because it also changes the direction the arrow keys move a rotated object, in the example below, the Down arrow key will now move the object to the right.

How can I fix this?

(Note both images are taken from the same viewpoint)

Before Rotation:

After Rotation:

P.S. If someone could please provide me with the correct / better name for the X Y Z "things" it would be much appreciated, thanks!

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:
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: 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:
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:
2D game big background images for maps Update: this question is general, not specific to Sprite Kit or a single language/platform.

I'm toying with Sprite Kit with an idea to make a 2D side-scroller. Now the backgrounds for the maps are going to be hand-drawn and surely bigger than retina display, so the maps could span more than 1 screen in both axis.

I imagine loading such a huge image could mean trouble and I don't plan to use tiling. I'm not sure how Sprite Kit splits images bigger than max texture size, if it does. I could split the images myself and use more sprites for each part of the background.

What is the usual way to handle this?

sentences:
Creating blur with an alpha channel, incorrect inclusion of black I'm trying to do a blur on a texture with an alpha channel. Using a typical approach (two-pass, gaussian weighting) I end up with a very dark blur. The reason is because the blurring does not properly account for the alpha channel. It happily blurs in the invisible part of the image, whcih happens to be black, and thus results in a very dark blur.

Is there a technique to blur that properly accounts for the alpha channel?

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:
How do I attach the Visual Studio Code debugger to Godot At 3.0 Godot now supports C# and encourages the use of Visual Studio Code to edit this code.

It is not clear how to attach VS Code so that we an apply breakpoints and debug a project at runtime.

I am running:

A recent build of Godot from master (b49ca94 with mono for 64-bit windows)
Visual Studio Code 1.21.0 with these extenstions

C# 1.14
Mono Debug 0.15.8

Mono 5.10.0

sentences: Gamepad support for OSX What is the most common method for providing gamepad support in an OS X game? I've been using an IOHIDLIB wrapper named DDHIDLib https://github.com/Daij-Djan/DDHidLib and it seems to be working but I find it odd that there isn't something more recent.

sentences:
Is there a term of art for the collection of non-gameplay screens or pages Is there a term of art for the collection of non-gameplay screens or pages in a game. I am thinking of screens such as:

title screen
options menu (key bindings, volume, graphics quality)
credits screen
hi-score table (maybe extradiegetic?)
help page
etc

These are all 'meta-screens', in that they help the player manage the gameplay experience, but are outside the gameplay space.

The term I am looking for should  not include screens for extradiegetic elements, such as inventory management, character dialog boxes, hint screens etc. as these are all related to, or control gameplay state.

sentences:
Skyrim:Papyrus Possible Conflict Error [18+?] I am working with a friend of mine to create a mod that relies on a mod called Devious devices, which would allow BDSM be utilized in Skyrim's combat by allowing the assailants to have special weapons which, when power attacking, allow for the player to be slowly bound with different pre-selected devices which inhibit the player until they are completely bound and helpless. We are still stuck on phase one of getting the code itself to fire off before we work more fully on the aesthetics, but the .xml files does not work for some reason and we need help. We believe the code compiles correctly, but when the script is called on

        Armor toremove = akTarget.GetWornForm(0x00000001) as Armor
        akTarget.UnequipItem(toremove)
    EndIf

is the current block that has been singled out as possibly causing the issue as it has not fired correctly. The main goal here is to have a function which unequips the item the target is currently wearing then replace it with another item provided. Right now we are working on the force unequip part.

I am happy to give more information and we are using the mod Devious Devices with all prerequisite mods installed and utilized for the testing environment. Please help us help you help us find a way to have a kinkier skyrim

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:
Quit from Unity to native iOS app I'm working on iOS application which is going to include a few unity games.
And I investigate an opportunity to exit from the Unity game to the native iOS app with games list.
I know that the Unity provides methods Application.Quit() and Application.Unload()

I haven't try but I'm not sure that Application.Unload() is correct ways to exit from unity to the native iOS app.

sentences:
How can I get the borderSize/s of a plane? public Texture2D gridImage;
public GameObject floor;

    private int borderSize;

    private void Start()
    {

        GenerateGrid();
    }

    void GenerateGrid()
    {
        Color gridColor = Color.cyan;
        Color borderColor = Color.black;
        Collider floorCollider = floor.GetComponent<Collider>();
        MeshRenderer floorRenderer = floor.GetComponent<MeshRenderer>();
        floorRenderer.material.mainTexture = gridImage;
        floorRenderer.material.mainTextureScale = new Vector2(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        floorRenderer.material.mainTextureOffset = new Vector2(.5f, .5f);

        Vector3 foorSize = new Vector3(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        for (int x = 0; x < gridImage.width; x++)
        {
            for (int y = 0; y < gridImage.height; y++)
            {
                if (x < borderSize || x > gridImage.width - borderSize || y < borderSize || y > gridImage.height - borderSize)
                {
                    gridImage.SetPixel(x, y, new Color(borderColor.r, borderColor.g, borderColor.b, 50));
                }
                else gridImage.SetPixel(x, y, new Color(gridColor.r, gridColor.g, gridColor.b, 50));
            }
            gridImage.Apply();
        }
    }

In the end I want to create something like this on a 3D Plane UI :

sentences:
Ideas for 2D Water Simulation I am looking for any input on simulating water in 2D, against a rather large (call it) blocked/not blocked array (viewed from the side). I have come up with the following ideas:

Cell Automata

Do a massively parralel simulation on the CPU, using cell automata. With rules as simple as:

If there is a cell open to the bottom move to it.
Check the left and right cells, choose a random one out of the two and move to it.

Pros

Simple to implement.
Meaningful/deterministic in a multiplayer system.

Cons

Probably really slow.
Not convincing.

Fluid Dynamics on the GPU

Perform a rough approximation of fluid dynamics on the GPU against a texture like the following:

+------+-----+-----+-------+
|R     |G    |B    |A      |
+------+-----+-----+-------+
|vX    |vY   |NULL |Density|
+------+-----+-----+-------+

Pros

Probably really fast.
Could be quite convincing.
A further pixel shader could render it directly.

Cons

Difficult to implement.
Difficult to tweak.
I can't allocate a single texture the size of my level.

I could overlap the grid areas, but this would add further complexity.

Particles

Use particles to simulate the water. During rendering using additive blending and then apply a multiplication function to the alpha channel to give the water crisp edges.

Pros

Will probably look nice.
Easy to implement.
Easy to render.
Meaningful in a multiplayer system, although would require quite a bit of bandwidth to transfer.

Cons

Inter-particle effects will probably be slow (neighborhood lookup).
Could lead to water 'leaking' through solid spaces (because the solid space is small, e.g. 1px).
Could lead to strange holes in the water depending on the particle size.
Both of the above could be mitigated by allowing particles to drift closer together than their real size, however would cause problems with the inter-particle and particle/landscape performance.

Any further ideas?

Note: This is an approximation, I am not looking for physically correct water here - just something that 'is good enough' (bonus points for quick and dirty). The game is multiplayer, so unfortunately the whole level needs to be simulated continuously.

sentences:
How to find the right direction to plug a sword into a rig's hand after projecting it? I've downloaded BVH animations and projected it following a book. I can now see a 3D moving rig and it looks alright. The problem is, now I want to plug a sword on the hand of the rig, but I don't know which direction it should face. That is because each vertex has a rotation and an offset, so I can calculate their positions, but there is no information available about their normals. How is this done?

Pseudocode of the position finding procedure for illustration

calculate_position(bone)
     local = bone.rotation_x * bone.rotation_y * bone.rotation_z # matrices
     local[3] = bone.offset_x
     local[7] = bone.offset_y
     local[11] = bone.offset_z
     global = local * bone.parent.global
     return [global[3], global[7], global[11]]

sentences:
Simpler alternative to AngelScript I want to give players the ability to create and share bullet patterns for a shoot'em up.

The pattern scripts should have all the common programming stuff like loops, if/else, variables, and so on.

But in the end, I just want them to call a "spawn bullet at X, Y with Z angle and A speed" in the C++ game.

To spawn a circle of bullets, the user should only have to write a script with a for loop that goes from 0 to 360 and calls the spawn bullet function on every iteration.

I tried integrating AngelScript, but I am getting nowhere - it looks way to complex for a simple task like this one.

Is there an easy to integrate library that can solve my problem? Thanks.

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:
How do you partition a level and create screen transitions out of these partitions? The levels in Castlevania games, you walk forward and then come to a point on the level where the screen stops scrolling but is not a deadend and there's no door either. They just wanted to transition to the next room for some reason (like a hallway transitioning to another room).

I want to create something like this in Unity, using 2.5d (3d characters constrained in 2d plane); question is, do I separate each transition to a scene? But that seems kinda wasteful (I don't know, maybe). Or just one scene and develop the level as a whole and do some camera programming for the transition making sure everything lines up?

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:
Unexpectedly fast rotation after refactoring OpenGL code to add more abstraction I've been working on an OpenGL program that simply renders a square that rotates in 3D space. The square also has a texture applied to both sides. Here you can see an example screenshot of the program running:

I used very little abstraction in that project and most of the code was in main.cpp (apart from the shader loading and usage).

After finishing this project, I wanted to improve it as much as I could with my current knowledge. I started abstracting away functionality. The final result was a very clean main.cpp file with multiple classes (Mesh, Shader, Resource Manager and Window classes).

Apart from the texture, everything should functionally be the same, but I experienced the following after using the rotate function; left is the abstracted version of the first project, right is the first project:

The square in the new project rotates at a much higher speed than in the previous project. The implementation is the same, as in, the degrees that the square should rotate around the y-axis are the same in both projects - the time the program has been running, which is gotten through GLFW's glfwGetTime().

I checked nearly everything. The .lib files are linked the same way between the projects. There are no differences between the vertex data. Both projects are running in DEBUG mode.

The only difference I could think of is the texture not being applied in the second project, but I recall that the textureless version of the first project was still running with the same speed as it is currently. But rendering a 64x64 texture on a square shouldn't be that expensive to run.

NOTE: I'm using GLM for the matrices and for the rotation transformation.

Does abstracting away all of OpenGL's initializing and buffer code improve performance by that much?

I'm using GLFW for window and context creation, and thus using (float)glfwGetTime() for the angle of rotation along the y-axis.

The second project basically moves over all functionality into categorized classes. So everything to do with meshes was moved to a Mesh class, loading of GLSL shaders and textures was moved over to a ResourceManager class etc. So all functionality should be the same.

sentences:
How should I deal with different enemy types? I'm making simple space shooter game for Android in Unity. I want to have different types of enemies (different weapon, stats, movement schemes) and I'm not sure how to do it. I'm quite new to objective programming and I don't really know what classes should I create. I guess I could just make a prefab for every enemy since there won't be many types, but that is not what I'm looking for. I have some ideas:

First of all I'd write an BaseEnemy class and enemy type subclasses that inherit from it.

My first idea is to create those without MonoBehaviour. Then I'd have to make an EnemyScript with MonoBehaviour that I'd add to enemy game object. It'd have a specific subclass object inside, which will set every variable. BaseEnemy would just have undeclared variables and in subclass I'd set particular values. But I'm not sure how to deal with different movement schemes then. I wouldn't be able to put move() function in subclass since it wouldn't have MonoBehaviour, so I'd have to find another way. I might put in EnemyScript every possible scheme and then use correct one depending on some type value, but it doesn't seem like a proper way, does it?

The second idea is to just make a MonoBehaviour BaseEnemy class. Then while creating enemy game object I'd just add correct subclass script (aaand... I'm not sure how to do it :/ )

Could you tell me which one is a better way? Maybe neither of those?

sentences:
orbit object around another object I am building 3D solar system containing (sun > earth > moon).
I have difficult to add the part which the moon rotate around earth.
I separated between "moon" and other stars.
The problem is that the center of earth is not const like the sun.
I know that earth is in starsList[1] so I thought to translate the moon to this place but got weird result..
Someone have an idea how to do this?

mat4.identity(mvMatrix);
mat4.translate(mvMatrix, [0, 0, z]);

for (i = 0; i < starsList.length; i++) {
    mvPushMatrix();

    if (starsList[i].name == "moon"){
        /////////
        mat4.rotate(mvMatrix, degToRad(starsList[i].angle), [0, 1, 0]);
        mat4.translate(mvMatrix, starsList[1].initPlace);
        mat4.rotate(mvMatrix, degToRad(starsList[i].angle), [0, 1, 0]);
        ////////
   }
    else{
        mat4.rotate(mvMatrix, degToRad(starsList[i].angle), [0, 1, 0]);
        mat4.translate(mvMatrix, starsList[i].initPlace);
        mat4.rotate(mvMatrix, degToRad(starsList[i].angle), [0, 1, 0]);
    }
    mvPopMatrix();
}

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:
Moving an Object along a Curve while Rotating it I woud like to move an object along a curve. At particular points on the curve, I wish the object to change speed and rotate itself along its axis.

Imagine an airplane flying to a destination. It has its path it must follow, plus, it adjusts its speed and orientation all the way (heading, pith, bank).

Could I kindly ask for a startup information on the following:

What kind of curves to use to smoothly interpolate an object
What formulas to use for reliable interpolation, where I could control the speed of moving oject, and the transition between curve knots would be seamless
What information should be exported from a 3D authoring application
Should I use quaternions slerp() for this?

If you know about a book that covers this topic efficiently, that would hlep the most. Thank you.

sentences:
System.Net.Http.dll and Unity 2018.2.1, 2.2, 2.3 are conflicting, assembly reference keeps being deleted in VS 2017, any suggestions? I'm looking for some suggestions on how to fix a strange bug i've been getting with System.net.http.dll.

For the record, builds work fine as i have the mcs.rsp file in the /Assets/ folder with "-r:System.Net.Http.dll" inside. The problem lies with Visual Studio and it's relation to Unity. I can add the reference to the dll by selecting "Analyzers" then hitting "Project" and Adding the dll found in:

C:\Program Files\Unity\Hub\Editor\2018.2.2f1\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\System.Net.Http.dll

But VS changes the reference instantly to:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Net.Http.dll

Then after a short amount of time, the reference i made just gets automatically deleted.

I've tried clearing the VS Cache inside of AppData/Local/ as well as clearing everything but the Asset Folder in my unity project (including obj, library, .CSPROJ, .sln files etc.)
But to no success.

Im using .NET 4.x in the project and it builds fine, its just that the VS reference keeps being deleted. so when it comes to "Attaching to Unity" i can't execute until i re-assign the "temporary" assembly reference.

I've tried updating VS, Reinstalling it as well as unity 2018.2.1 and Unity2018.2.2 to no success.

I'm all ears.

UPDATE: Problem has been fixed in 2018.3

sentences:
vec4 for vec3 multiplication while calculating the specular value I'm following this tutorial to calculate the specular color of a vertex.

I use OpenGL 2.1 with GLSL version 120.

This is the formula that I apply:

  spec= (R*eye)^s * Ls * Lm

With:

  L= direction vector light-vertex;
  N= vector normal;
  eye= direction vector vertex-eye;
  R= -2N * (L*N) + L;

Now the problem is that following this way I need to multiply a vec3 for a vec4.

This is what I tried to do:

vec4 L= normalize(gl_LightSource[0].position - gl_Position);
vec3 N= normalize (gl_NormalMatrix * gl_Normal);
vec4 eye= normalize(-gl_Position);
vec4 R= -2.0*N*(L*N)+L;  // Syntax error: N is a vec3
vec4 spec= (R*eye)* gl_LightSource[0].specular;

I wouldn't get a vec3 result when calculating the specular value, this value I would be ignoring the alpha value. How do I go around this?

sentences:
DX9 How to Apply HLSL Shader with StretchRect Using DirectX 9,I'm trying to run a HLSL pixel shader on video frame data while copying it from one texture buffer to another texture buffer without displaying it. StretchRect at the end is what copies the data from pOffsceenSurface to pTextureSurface, which should pass through the pixel shader. The video data does get passed over and I can read it back, but the shader isn't being applied.

What do I need to do to process the texture through the shader? And does register(S0) get automatically filled, or how do I set the source? The code I have allows configuring register(C0), register(C1), etc. through m_pPixelConstantTable, but not the S registers. Some shaders take S0 and S1 so it needs to be configured somehow.

Here's the code

HRESULT D3D9RenderImpl::SetPixelShader(LPCSTR pPixelShaderName, LPCSTR entryPoint, LPCSTR shaderModel, LPSTR* ppError)
{
    CComPtr<ID3DXBuffer> code;
    CComPtr<ID3DXBuffer> errMsg;

    HR(D3DXCompileShaderFromFile(pPixelShaderName, NULL, NULL, entryPoint, shaderModel, 0, &code, &errMsg, &m_pPixelConstantTable));
    return m_pDevice->CreatePixelShader((DWORD*)code->GetBufferPointer(), &m_pPixelShader);
}

HRESULT D3D9RenderImpl::CreateScene(void)
{
    HR(m_pDevice->Clear(D3DADAPTER_DEFAULT, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0));
    HR(m_pDevice->BeginScene());
    HR(m_pDevice->SetFVF(D3DFVF_CUSTOMVERTEX));
    // when I debug, m_pPixelShader does get set properly)
    HR(m_pDevice->SetPixelShader(m_pPixelShader));
    HR(m_pDevice->SetTexture(0, m_pTexture));
    HR(m_pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2));
    return m_pDevice->EndScene();
}

HRESULT D3D9RenderImpl::Present(void)
{
    HR(m_pDevice->ColorFill(m_pTextureSurface, NULL, D3DCOLOR_ARGB(0xFF, 0, 0, 0)));
    return(m_pDevice->StretchRect(m_pOffsceenSurface, NULL, m_pTextureSurface, NULL, D3DTEXF_LINEAR));
    // This line doesn't seem necessary
    // return m_pDevice->Present(NULL, NULL, NULL, NULL);
}

What's missing?

EDIT: Here's what I'm rendering to

HRESULT D3D9RenderImpl::CreateRenderTarget()
{
    // HR(m_pDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, m_displayMode.Format, D3DPOOL_DEFAULT, &m_pTexture, NULL));
    HR(m_pDevice->CreateTexture(m_videoWidth, m_videoHeight, 1, D3DUSAGE_RENDERTARGET, m_format, D3DPOOL_DEFAULT, &m_pTexture, NULL));
    HR(m_pTexture->GetSurfaceLevel(0, &m_pTextureSurface));
    HR(m_pDevice->CreateVertexBuffer(sizeof(VERTEX) * 4, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &m_pVertexBuffer, NULL));

    VERTEX vertexArray[] =
    {
        { D3DXVECTOR3(0, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(0, 0) },  // top left
        { D3DXVECTOR3(m_videoWidth, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(1, 0) },  // top right
        { D3DXVECTOR3(m_videoWidth, m_videoHeight, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(1, 1) },  // bottom right
        { D3DXVECTOR3(0, m_videoHeight, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(0, 1) },  // bottom left
    };

    VERTEX *vertices;
    HR(m_pVertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD));

    memcpy(vertices, vertexArray, sizeof(vertexArray));

    HR(m_pVertexBuffer->Unlock());

    return m_pDevice->SetRenderTarget(0, m_pTextureSurface);
}

sentences:
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:
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:
(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:
Interpreting curves in Unity 3d I know that the I can allow the user to draw curves in game by line tracer.

if I want to interpret it, I could use handwritten text recognizer.

But what if I had to interpret a curve, where the user draws a symbol that has no literal meaning, only an in-game meaning, and interpret the meaning of the symbol as I define it?

Can I define my own way of interpreting the symbols?

sentences:
Scaling textures with nearest neighbour without having to use seperate sprite batches I'm interested in being to scale textures up via nearest neighbour. I can do this via a SpriteBatch.Draw() overload however this means that any other sprites drawn within that batch will also have the scaling.

What happens if I have 50 objects I want to to scale, and another 50 objects I don't want to be drawn using nearest neighbour. Assuming they alternate depths, that's 100 calls to to spriteBatch.End() in order to get depth drawn correctly. Now also let's say each object has it's own texture.

One way is to you use Texture2D.SetData() to manually scale up the textures but this could get messy, very quickly.

Any tips?

sentences:
2D indicator for Rotation in 3D space This is the view from my spaceship. It can move around in 3d space and turn up, down, left and right.

The planet Earth on the top right is selected.
Now I want to create the red arrow to always point to the direction of Earth even if my ship is facing away from it.

this is my code so far

//These are euler angles
Vector3 wantedheading = SelectedObject.transform.position - Statics.Player.transform.position;
Vector3 curentheading = Statics.Player.transform.localRotation.eulerAngles;

Quaternion qwanted = Quaternion.Euler(wantedheading);
Quaternion qcurent = Quaternion.Euler(curentheading);
Quaternion qMove = Quaternion.FromToRotation(curentheading, wantedheading);

but now I have a 3d rotation... what do I do to make it into a 2d rotation always pointing to the shortest direction to the planet?

sentences:
Bullet btGImpactCollisionAlgorithm I have a question about Bullet and in particular GImpact.

When, the collisiontestpair(a, b) is called where GImpact pair check algo will be called on the
btGImpactMeshShape, does it do a AABB tree vs. AABB tree to get to the leaf level, worstcase O(NN) OR is it O(NN) triangle wise collision check.

Thank you.

sentences:
How do I create and animate simple polygons directly from code in Unity? I'm a beginner with Unity, but I know how to code.  I'm open to tutorials, of course.

Ideally, I would like to code spacial vertices and connect them into a simple polygon. The polygon would then be animated by changing the vertices over time.

sentences: How can I make an movieclip move in a circular path with GTween? How can I make an movieclip move in a circular path with GTween? it's straightforward to have something move with various easing effects in a line or a curve, but I would need a complete circular path.

sentences:
SlimDX 11: Setting Multiple Render Targets I'm using SlimDX 11 in my managed Direct3D application. I would like to implement deferred shading. I'm having trouble when I try to set a depth stencil surface and multiple render targets at the same time. Here is my code:

// depth stencil view
DepthStencilView dsv = GetD3D11DepthStencilView();

// array of 3 render target views
RenderTargetView[] rtv = GetPositionDiffuseEmissiveRenderTargetViewArray();

// device context
DeviceContext context = GetD3D11DeviceContext();

context.OutputMerger.SetTargets(dsv, rtv);

EDIT:
// create depth stencil state
context.OutputMerger.DepthStencilState = DepthStencilState.FromDescription(GetDevice(), new DepthStencilStateDescription()
            {
                IsDepthEnabled = true,
                DepthComparison = Comparison.Less,
                DepthWriteMask = DepthWriteMask.All,
                IsStencilEnabled = false,
                //StencilReadMask = 0xff,
                //StencilWriteMask = 0xff,
                //BackFace = new DepthStencilOperationDescription()
                //{
                //    Comparison = Comparison.Always,
                //    DepthFailOperation = StencilOperation.IncrementAndClamp,
                //    FailOperation = StencilOperation.DecrementAndClamp,
                //    PassOperation = StencilOperation.Keep
                //},
                //FrontFace = new DepthStencilOperationDescription()
                //{
                //    Comparison = Comparison.Always,
                //    PassOperation = StencilOperation.Keep,
                //    DepthFailOperation = StencilOperation.IncrementAndClamp,
                //    FailOperation = StencilOperation.Keep
                //}
            });

// clear depth stencil
context.ClearDepthStencilView(dsv, DepthStencilClearFlags.Depth, 1.0f, 0);
// draw as usual
...

When I set the depth stencil and render targets all at one time then nothing is rendered to the screen. When I set only the render targets everything renders normally...Why might this occur?

sentences:
Should actors in a game be responsible for drawing themselves? I am very new to game development, but not to programming.

I am (again) playing around with a Pong type game using JavaScript's canvas element.

I have created a Paddle object which has the following properties...

width
height
x
y
colour

I also have a Pong object which has properties such as...

width
height
backgroundColour
draw().

The draw() method currently is resetting the canvas and that is where a question came up.

Should the Paddle object have a draw() method responsible for its drawing, or should the draw() of the Pong object be responsible for drawing its actors (I assume that is the correct term, please correct me if I'm incorrect).

I figured that it would be advantagous for the Paddle to draw itself, as I instantiate two objects, Player and Enemy. If it were not in the Pong's draw(), I'd need to write similar code twice.

What is the best practice here?

Thanks.

sentences:
How to implement angled surface? I'm trying to implement 2D platformer game inspired by N game. But the problem is I have no idea how to implement something like this:

 and

I have two ideas of how this could be implemented, but I don't know if they are somewhere near truth:

Pick two nearby pixels of the surface, draw a line between them and then rotate player so his height was perpendicular to that line.
Check if the bottom-left pixel is touching surface and bottom right is not, rotate player so bottom-right pixel would touch the surface too.

sentences:
Orthographic viewport zooming I'm a bit new in opengl so please bear with me. I have a viewport window like this

I have implemented zoom in/out features using the arrow keys. The problem is it zooms in and out with the whole image. Can anyone point me in the right direction as to how I can make the GUI on the sides stay in place while making my viewport (the white rectangle) zoom in and out?

Thank you!

sentences: Meshes crashed memory from CharacterCustomization example I am trying the CharacterCustomization example from Unity3D which contains two scenes: Dressing room and VirtualWorld, run the VirtualWorld on iPhone, it could run but at last it will crashed, Instruments and profiler, I found the meshes are always increased and run out of memory. Anybody could help? thanks.Environment: Unity 3.4.0, Xcode 4.0.2, iOS SDK 4.3

sentences:
SpriteBatch.Begin() causes everyting else to be drawn incorrectly I just added this:

_spriteBatch.Begin();
_spriteBatch.End();

to my app and was greatly confused by the fact that this causes pretty much everything else (all of my 3D objects, that is) to be drawn incorrectly. After the code above has executed, no Z-buffering seems to take place, but instead objects are just drawn in the exace same order as I send them to the scene - with the last object drawn being fully visible even while it is located behing other objects. It also screwes up the sampler state for my textures (which I can fix by setting a new SamplerState for the device).

What is going on and how do I fix it?

sentences:
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:
Shader optimization - Cg/HLSL pseudo and via multiplication HLSL/Cg do not allow texture fetching inside conditional blocks. To get around this I am first checking a variable and performing some computations, afterwards I set a float flag to 0.0 or 1.0, depending on the computations. I'd like to trigger a texture fetch only if the flag is 1.0 or not null. I kind of hoped this would do the trick:

float4 TU0_atlas_colour=pseudoBool*tex2Dlod(TU0_texture, float4(tileCoord, 0, mipLevel));

I want to know if pseudoBool is 0, will the texture fetch function still be called and produce overhead? I was hoping to prevent it from getting executed via this trick that usually works in plain C/C++.

sentences:
How can I add an impulse to specific rigid bodies at rest? Scenario

Rocks falling down a rocky slope, with a flat surface at the bottom.
When they land on the surface, the rocks move slightly before coming to a rest.

GLESDebugDraw shows the bright orange outline turning to a slightly darker orange once a rock comes to a rest, until the rock is agitated by another falling rock.

Question: I would like to add an impulse to the rock once it reaches the rest state. How would I implement that?

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: Prevent feet from moving for a Unity character from a Mixamo animation So my question isn't about root motion, but rather just keeping the feet in place on the ground for a Mixamo animation... I tried to just delete the feet and toes in avatar configure, but nope... I am wondering if there is some sort of simple way to have an animation affect all but the feet?

sentences:
Is it better to preserve scenes in memory or recreate them every time I need them? I am using Cocos Builder to create scenes using sceneWithNodeGraphFromFile:owner:. Now I have doubts about whether it's better, on iOS, to save some memory or CPU cycles. In other words I have two options:

First, I could do lazy initialization of scenes without removing them from memory, like this:

- (CCScene*) myScene
{
    if(!_myScene)
        _myScene= [CCBReader sceneWithNodeGraphFromFile: @"MyFile.ccbi"];
    return _myScene;
}

Then I always call self.myScene and I possibly set _myScene to nil if the app receives a memory warning. I never remove a scene from the director, I just push without cleaning.

Or, I could initialize a new scene every time. I'd call sceneWithNodeGraphFromFile:owner: every time that I need to push a scene, popping and cleaning it from the director and creating it again if I need it.

Which should I prefer and why?

sentences:
p2.js physics engine behavior on Heightfield I am writing a small game consisting of a 'ragdoll' character riding a skateboard.

I have created a 'skateboard park' with some ramps and a jump.

I am using a 'heightfield' object as the ground.  What I notice is that the behavior of the wheels rolling up and down slopes on one side are entirely different that slopes on the other side.. even though the slopes are symmetrical.

Does anyone know why it behaves like this?

Here is a codepen to illustrate the problem. http://codepen.io/smatthews1999/pen/uGmaE

and here is an image to explain clearly what the issue is.

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:
MSG::time is later than timeGetTime After noticing some timing descrepencies with events in my code, I boiled the problem all the way down to my Windows Message Loop.

Basically, unless I'm doing something strange, I'm experiencing this behaviour:-

MSG message;

while (PeekMessage(&message, _applicationWindow.Handle, 0, 0, PM_REMOVE))
{
    int timestamp = timeGetTime();
    bool strange = message.time > timestamp; //strange == true!!!

    TranslateMessage(&message);
    DispatchMessage(&message);
}

The only rational conclusion I can draw is that MSG::time uses a different timing mechanism then timeGetTime() and therefore is free to produce differing results. Is this the case or am i missing something fundamental?

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: Godot: does parse_json accept multiple JSON objects? If I had a JSON file that had multiple objects, can the method read through without some form of exception?

sentences:
Architecture of networked game engine So after working on my game engine for 2 years, I've decided to step into the networking environment. I just don't know if it's a good idea to rewrite the engine, or how much work it will take (but still want to try it). I'm little bit confused by some approaches, so that's why I'm here.

In short I have an architecture like this:
There is a main object, that controls the whole engine world (physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".

I already started with ENet, created a small console chatting app - but packets were just strings.  But I'm not sure if I understand the concept of game networking, so here is my idea:

There is a server and clients. Server is controlling everything. Client sends messages.

So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses A, packet is sent to a server containing this information. Server will process it, moves the entity.

Am I right?

So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?

Thanks in advance.

Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?

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:
Relation between TFLOPS and Threads in a GPU? What's the relation between Teraflops and Threads in a GPU like GTX Titan X has 7 TFOPS of Compute Performance but how many threads it has ? And Like Xbox and PS4 have 1.32 and 1.84 TFLOPS of compute performance but how many threads they have? Like what’s the relation between teraflops and threads?

If they are different concepts. Can you please explain both of them?

sentences:
Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background.

public class ThundrialMenu extends GuiScreen {

    @Override
    public void initGui() {

    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        Random rnd = new Random();
        int background = rnd.nextInt(3)+1;
        String backgroundLocation = "/assets/thundrial/gui/Background"+background+".png";
        this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId());
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void updateScreen() {
        super.updateScreen();
    }
}

This is the folder where the pictures are located:

Why does Minecraft not find those pictures?

sentences:
The best way to pass data between clients in a room I am developing a backgammon game in Unity and tried to use Photon. But I could not find a step by step help for it and I also know that photon in real-time and it syncs data over 10 times per second. but I need to sync data after each moves.

Would you please show me the best way to do that.

sentences:
How does my program know which variables to link to the shader? I am using DirectX and C++. I never understood how my VertexDeclaration knew what variables were the UV map and which were linked to the position. I have in my shader Position : POSITION and Texture : TEXCOORD1

In my variables for vertex format I have int X, Y, Z, U, V.

In my declaration I have

    D3DVERTEXELEMENT9 Decl[] =
    {
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_POSITION,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT2,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            0
        },
      D3DDECL_END()
   };

My FVF is D3DFVF_XYZ | D3DFVF_TEX1

How does it know to link X, Y, Z with position? and U, V with the first texcoord? What would the variables for the second texcoord be? Is there some pattern?

sentences:
Shadows shimmer when camera moves I've implemented shadow maps in my simple block engine as an exercise. I'm using one directional light and using the view volume to create the shadow matrices. I'm experiencing some problems with the shadows shimmering when the camera moves and I'd like to know if it's an issue with my implementation or just an issue  with basic/naive shadow mapping itself.

Here's a video:

http://www.youtube.com/watch?v=vyprATt5BBg&feature=youtu.be

Here's the code I use to create the shadow matrices. The commented out code is my original attempt to perfectly fit the view frustum. You can also see my attempt to try clamping movement to texels in the shadow map which didn't seem to make any difference. Then I tried using a bounding sphere instead, also to no apparent effect.

    public void CreateViewProjectionTransformsToFit(Camera camera, out Matrix viewTransform, out Matrix projectionTransform, out Vector3 position)
    {
        BoundingSphere cameraViewFrustumBoundingSphere = BoundingSphere.CreateFromFrustum(camera.ViewFrustum);

        float lightNearPlaneDistance = 1.0f;

        Vector3 lookAt = cameraViewFrustumBoundingSphere.Center;

        float distanceFromLookAt = cameraViewFrustumBoundingSphere.Radius + lightNearPlaneDistance;
        Vector3 directionFromLookAt = -Direction * distanceFromLookAt;
        position = lookAt + directionFromLookAt;
        viewTransform = Matrix.CreateLookAt(position, lookAt, Vector3.Up);

        float lightFarPlaneDistance = distanceFromLookAt + cameraViewFrustumBoundingSphere.Radius;

        float diameter = cameraViewFrustumBoundingSphere.Radius * 2.0f;

        Matrix.CreateOrthographic(diameter, diameter, lightNearPlaneDistance, lightFarPlaneDistance, out projectionTransform);

        //Vector3 cameraViewFrustumCentroid = camera.ViewFrustum.GetCentroid();

        //position = cameraViewFrustumCentroid - (Direction * (camera.FarPlaneDistance - camera.NearPlaneDistance));
        //viewTransform = Matrix.CreateLookAt(position, cameraViewFrustumCentroid, Up);

        //Vector3[] cameraViewFrustumCornersWS = camera.ViewFrustum.GetCorners();
        //Vector3[] cameraViewFrustumCornersLS = new Vector3[8];
        //Vector3.Transform(cameraViewFrustumCornersWS, ref viewTransform, cameraViewFrustumCornersLS);

        //Vector3 min = cameraViewFrustumCornersLS[0];
        //Vector3 max = cameraViewFrustumCornersLS[0];
        //for (int i = 1; i < 8; i++)
        //{
        //    min = Vector3.Min(min, cameraViewFrustumCornersLS[i]);
        //    max = Vector3.Max(max, cameraViewFrustumCornersLS[i]);
        //}

        //// Clamp to nearest texel
        //float texelSize = 1.0f / Renderer.ShadowMapSize;
        //min.X -= min.X % texelSize;
        //min.Y -= min.Y % texelSize;
        //min.Z -= min.Z % texelSize;
        //max.X -= max.X % texelSize;
        //max.Y -= max.Y % texelSize;
        //max.Z -= max.Z % texelSize;

        //// We just use an orthographic projection matrix. The sun is so far away that it's rays are essentially parallel.
        //Matrix.CreateOrthographicOffCenter(min.X, max.X, min.Y, max.Y, -max.Z, -min.Z, out projectionTransform);
    }

And here's the relevant part of the shader:

if (CastShadows)
{
    float4 positionLightCS = mul(float4(position, 1.0f), LightViewProj);

    float2 texCoord = clipSpaceToScreen(positionLightCS) + 0.5f / ShadowMapSize;

    float shadowMapDepth = tex2D(ShadowMapSampler, texCoord).r;

    float distanceToLight = length(LightPosition - position);

    float bias = 0.2f;

    if (shadowMapDepth < (distanceToLight - bias))
    {
        return float4(0.0f, 0.0f, 0.0f, 0.0f);
    }
}

The shimmer is slightly better if I drastically reduce the view volume but I think that's mostly just because the texels become smaller and it's harder to notice them flickering back and forth.

I'd appreciate any insight, I'd very much like to understand what's going on before I try other techniques.

sentences:
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 to import texture from Maya to unity? I am trying to export a model from Maya with animation but when I import into unity I am getting the model but the texture is not there. From the internet I found that while importing the model I need to enable media that also does not work for me.Is there any way that I can import Material texture in fbx file

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:
Spawning a customized sprite with text I'm making a game where I have circles filed with words or pictures drop from the top of the screen to the bottom. they should spawn right above and then drop.
I just started using unity a couple days ago and I managed to do this with a simple sprite, but I couldn't fill it with the info I wanted and from searching online it seems like it can't be done.
So I decided to try with buttons instead, since those can be given text and images(I think) but i'm not sure how to do so.
with the circles I passed an object of them to the script and then used
newCircle = Instantiate(Circle, temp, Quaternion.identity);
but with buttons everything seems to work weird because there's also the need for the canvas and the units are different so I'm not sure how to do it

sentences:
Create and use a Button class on AS3.0 I am currently working on a game and it is all going well.
On the shop screen there are several buttons that affect the player's stats for when the player restarts the game.

The button's names (with a text on the left), however, are rather cryptic and it's hard to figure out what they do unless you test or something.

So the solution I came up with, is to create an InfoBox with an InfoText inside so that when the cursor is over the button it appears with the description, cost and etc.

This I managed to do too however, the way I was about to do it would mean that I had to create 3 event listeners per button (CLICK, ROLL_OVER, ROLL_OUT) and, obviously, 3 functions connected to each event listener.

Now, I don't mind much about having 1 event listener per button, for the click, but since the other events are just to make a box appear and disappear as well as display some text, I thought it was way too much of a mess of code.

What I tried to do: I created a new class called InfoBoxButton, and this is the class' code:
    package  {

import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.events.MouseEvent;

public class InfoBoxButton extends SimpleButton
{
    public var description:String;
    public var infoBox:InfoBox;

    public function InfoBoxButton(description)
    {
        this.addEventListener( MouseEvent.ROLL_OVER, displayInfoText, false, 0, true);
        this.addEventListener( MouseEvent.ROLL_OUT, hideInfoText, false, 0, true);
    }

    private function displayInfoText()
    {
        infoBox.infoText.text = description;
        infoBox.visible = true;
    }

    private function hideInfoText()
    {
        infoBox.infoText.text = "";
        infoBox.visible = false;
    }
}

}

But now I don't have an idea how to associate it with the button, I have tried this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

The SoonButton is a button I made on the shopscreen, SoonButton is it's instance name, but I can't think of a way of associating one button to the other... I have been fiddling with the code for like 3 hours yesterday and no luck... can anyone give me some pointers on how I should go about doing it?

--EDIT--

I tried to trace the SoonButton after it is created like this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

and I got an error saying:
    1120: Access of undefined property SoonButton.

if I separeted the first line a bit to:
    public var SoonButton:InfoBoxButton;
    SoonButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

I would get the same error but two times, for each SoonButton... so clearly it must be the InfoBoxButton that isn't being created... what am I missing?

sentences:
Getting Target position at the time of shooting I have a bullet that has to hit a constantly moving enemy.

So, in BulletScript, I have declared a Transform

public Transform enemy;               //and assigned enemy object to it that is continuously moving and changing its position

Now, when I try to use enemy.position in bullet script so as to hit it, enemy.positiongives the position at which the enemy started and not the position at which it was when bulletprefab was shot.

How can I get the updated position of enemy object every time bulletprefab is instantiated.

sentences:
Algorithm/ Logic of identifying a circle in Go game I'm trying to create a 2 players Go-like game. Unfortunately I can't get the capturing system to act correctly. At the moment the system is half done, however I cannot think of a perfect way for it to recognize a circle correctly. This is the logic that I'm planning at the moment (let say it's currently White's turn):

1.Using the newest placed piece as the starting point, run a flood fill (Up, Down, Left, Right) code to find all the affected nodes/Black piece, and place them in a "suspects list".

2.Using the suspects list, find any White piece that is near them (Up, Down, Left, Right, UpLeft, UpRight, DownLeft, DownRight). Adds those pieces into a "circle candidate list".

3.Run through the circle candidate list and remove any piece that doesn't connect to at least 2 other candidates. Keep doing this until all candidate are connected to at least 2 other candidates or the number of candidates are less than 4 (which won't be possible to make a circle).

4.Using a recursive method checks whether we can make a circle using all the candidates. The last piece must be connected to the first one.

5.If a circle is identified, get all the nodes that are between the candidates, first checks from top-to-down then left-to-right. Records all the nodes that were identified in both checks as dead zones. Kill any Black piece inside the dead zone and any Black piece that is place inside there after this will automatically die.

Here's where the problem is, I noticed that 3 pieces that are next to each other will still be connected to 2 other piece. Which means the system will still see them as a legitimate candidate even if they aren't part of a circle. And secondly the way I use to check if there is a circle can easily fail if there are more than necessary pieces to make the circle since it could turn the wrong way and then unable to get back to the starting point.

I've been struggling with this capturing process for a week now, and tested a number of different ways. All of it will have a problem in certain scenario which resulted in a bug (either they're not capturing piece that should be captured, or capturing piece that should not be captured). So any help are greatly appreciated. Thank you.

sentences:
PHP city-sim castle layout I am currently contemplating the layout system for my php based game but i've run into a couple of worries. So my idea is a 9X9 grid where the center 3X3 are inner castle. The inner castle will be 6X6 if you enter it(click on it). and with the option to expand the inner castle converting one of the 9X9 tiles to a 4X4 inner castle tile.
So here is my question: What is the best way to tackle this type of layout?
my original idea was a 18X18 grid and saving it in the db as (idCastle, Y, X) where X is a string of 18 numbers long telling me if the tile is an inner/outer tile or a inner/outer building.
but i am not really fond of this idea and would like to hear some other ideas on how to tackle this.
Thanks in Advance,

Gert

sentences:
2D Camera transformation sidescroller i am currently trying to dive into 2D programming with DirectX, especially bulding a tile based sidescroller. I have worked with some chapters from a book (Advanced 2D Game Development) but always tried to create something on my own (to get the most out of it - because you never will learn anything if you are not doing it yourself).
But now i am kinda stuck with the camera work in 2D.
I do realize that there different matrices to tranform the objects to world space, then the world space to view space and then to projection (camera) space. Do i really need all of those for a 2D game?

I have a camera class (out of the book) and was trying to use it to "roam" around with the camera (i am currently drawing a grid, with D3DXLine - bigger than the screen - and i would like to float over it with my camera):

Camera::Camera()
{
    p_position = D3DXVECTOR3(0.0f, 0.0f, 10.0f);
    p_upDir = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

    float aspectRatio = (float)g_engine->getWindowWidth() / (float)g_engine->getWindowHeight();

    this->setPerspective(3.14159f / 4, aspectRatio, 1.0f, 2000.0f);
}

Camera::~Camera() { }

void Camera::setPerspective(float fov, float aspectRatio, float nearPlane, float farPlane)
{
    this->setFOV(fov);
    this->setAspectRatio(aspectRatio);
    this->setNearPlane(nearPlane);
    this->setFarPlane(farPlane);
}

void Camera::setPosition(float x, float y, float z)
{
    this->p_position.x = x;
    this->p_position.y = y;
    this->p_position.z = z;
}

void Camera::Update()
{
    D3DXMatrixPerspectiveFovLH(&this->p_matrixProj, this->getFOV(), this->getAspectRatio(), this->getNearPlane(), this->getFarPlane());
    g_engine->getDevice()->SetTransform(D3DTS_PROJECTION, &this->p_matrixProj);

    D3DXMatrixLookAtLH(&this->p_matrixView, &this->p_position, &this->p_target, &this->p_upDir);
    g_engine->getDevice()->SetTransform(D3DTS_VIEW, &this->p_matrixView);
}

I am calling the Update() in every game_update()

Now i am wondering why there is no SetTransform(D3DTS_WORLD, ...) according to the camera movement. Is it just missing and i would have to implement it by myself, or do i need to set it elsewhere? I am kinda lost of how the "normal" set up would be to implement such a thing, and maybe a camera following the player (i guess i would have to the the World Transform according to the player position, am i right)?

Maybe someone can give me some clearance, or just a little tutorial

EDIT: Forgot to mention that it is not working right. I am currently Drawing two things: one Sprite with the D3DXSprite and the grid the D3DXLine.

EDIT2: Here is how i transform my sprites and set the world Matrix. It is still not working though :(. Any ideas?

void Sprite::transform()
    {
        D3DXMATRIX mat;
        D3DXVECTOR2 scale((float)this->_scaling, (float)this->_scaling);
        D3DXVECTOR2 center((float)(this->_width*this->_scaling)/2, (float)(this->_height*this->_scaling)/2);
        D3DXVECTOR2 trans((float)this->getX(), (float)this->getY());
        D3DXMatrixTransformation2D(&mat, NULL, 0, &scale, &center, (float)this->_rotation, &trans);
        g_engine->getSpriteHandler()->SetTransform(&mat);
    }

If you need any more code, please let me know!
Thanks a lot!

sentences:
How to randomly place rectangle inside a larger bounding rectangle without intersecting other rectangles inside Let us consider the case: there is an overall bounding rectangle (call this Rb) which contains a number of rectangles within it (call this set SRo). Now I would like to randomly position a new rectangle with known bounds (call this Rn) within the bounds of Rb without intersecting any of the rectangles in the set SRo

My current approach is rather brute force:

Generate random x-y coordinates for new rectangle
Check Rb contains Rn if it is placed at intended coordinates
Check Rn does not intersect any of rectangles inside set SRo

Anyone got any better idea?

sentences:
Tiled2Unity not accepting a .txm file I'm trying to import a map from Tiled to Unity. I have seen on several video tutorials (all of them on Windows) that they used Tiled2Unity in order to import such files. However, when I download Tiled2Unity, it does not accept .tmx files. It says that it wants .xml. Fair enough--I export it from Tiled as an .xml, and then it can't read the file.

Has anyone else had this problem? Anyone know how to deal with it?

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:
Drawing large 2D sidescroller level terrain I'm a relatively good programmer but now that it comes to add some basic levels to my 2D game I'm kinda stuck.

What I want to do: An acceptable, large (8000 * 1000 pixels) "green hills" test level for my game.

What is the best way for me to do this?

It doesn't have to look great, it just shouldn't look like it was made in MS paint with the line and paint bucket tool.

Basically it should just mud with grass on top of it, shaped in some form of hills.

But how should I draw it, I can't just take out the pencil tool and start drawing it pixel per pixel, can I?

sentences:
how to move character move on a circular surface in only one direction? Making a 2d game:

I want to move character on circular surface only in one direction?

Script attached to child object is:

    public GameObject ball;
    float speed=2f;

    // Start is called before the first frame update
    void Start()
    {
        GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        Left();
    }

    void Left()
    {
        if(Input.GetKey(KeyCode.LeftArrow))
        {
            ball.GetComponent<Rigidbody2D>().AddForce(Vector3.forward * speed);
            //transform.Rotate(Vector2.left);
        }
    }

Note:
character will move on a circular surface in only one direction...

Image reference:

sentences:
Determine inventory item position shape Not a great title but couldnt think of a shorter way to describe it.

I am trying to think of the best way to determine the shape of items placed in the players inventory. I guess the best examples to explain would be something like the Horadric Cube in Diablo 2 or I suppose also, the Workbench in Minecraft. There are others, I just can't remember them.

Currently the best way I can think of involves multiplying the cell numbers each item is in. This way I can look at the product of that multiplication and know from a short list of values, what shape the items are in.

Example

My inventory is ordered like so:

1 | 2 | 3
4 | 5 | 6
7 | 8 | 9

I would also have various arrays of preset values like:

FourSquares - 40, 180, ..., ...
VLines - 28, 80, ...
HLines - 6, 120, ...
Backslash - 45
Forwardslash - 105

etc, etc

So, say the user places items in 1, 2, 4 and 5 - That would give 40 and I could loop through each shape array and determine that it matched a value in the FourSquares array and go from there.

Does this seem like the best way to do it? Is there maybe a way that I wouldnt have to loop through the arrays? Would this be possible with bitwise operations maybe?

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:
Occupation groups for a country simulation game I'm trying to create citizen occupation groups or job classes for a country-management game I'm developing. I want it to be inclusionary but also very basic.

I did some research but all job lists I got contains more than 20 job types like farming, mining, education, law but It's too many for my game's setting and It still doesn't include every workforce. I need wider spectrum of jobs but I'm having trouble to categorize them, like labour, public service etc...

Any help is appreciated.

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:
Canvas animation drops to 30fps every 3-4 seconds Ok! I solved the problem.

Chapter One - Multiple Canvases

I started to make pong utilizing requestAnimationFrame and I noticed that the ball was stuttering and slowing down every 3-4 seconds.  So I implemented a crude FPS function to write the current fps to the screen and realized that the slow down was accompanied by an fps drop to 30fps. I thought it had something to do with my collision detection function, but it was not the case.

MarkR noticed that I had two canvases drawing and updating the player/ball separately, he suggested that I combine the two canvases into one. This produced better performance and now I could only see the slow-down/stuttering every 15~ seconds.  The problem was, the stuttering was still happening.

Chapter Two - Vsync, Chrome Developer Tools

In comes Dreta!  Dreta said that the fps was dropping to 30fps because canvas is trying to Vsync.  I had no idea what he was talking about, so I asked Mr. Google and found a really good explanation of how Vsync/double-buffering/triple-buffering works. It's a medium read, but it it definitely worth checking out if you want to learn more about how your graphics card/monitor works.

He also told me that I can look at the fps of the game in Chrome by using the Developer Tool(which can be accessed by right-clicking -> inspect element -> Timeline tab and clicking on the black circle at the bottom-- the circle will turn red when recording).  You can also look at the memory usage and I noticed that it was periodically shooting up to 4mbs of memory used.  Dreta suggested it was a memory leak--

Chapter Three - Memory Leaks

To locate a memory leak, use the following process: Found at microsoft site (http://msdn.microsoft.com/en-us/library/ms859415.aspx)
Find the memory leak – Detect the presence of a memory leak in the system, given a particular reproducible sequence. You should be able to identify a specific process, but demonstrating an overall increase in committed system memory can qualify a memory leak as well.

Isolate the memory leak – Determine the exact location in the source code where the un–freed allocation occurs. This can be a lengthy and tedious process, requiring specific tools, trial–and–error, and teamwork with the original author of the code.

Fix the memory leak – After the first two steps are completed, this is easy. Fixing the memory leak usually involves adding some code to free the memory in the questionable code path.

Dreta suggested that I use heap profiling to find memory leaks. I personally have not read up on it yet, but here's a link to chrome's explanation of heap profiling developers.google.com/chrome-developer-tools/docs/heap-profiling.

He said:

  Each time you update the player, you're creating a function. You probably want to change the Player class from:

this.update = function() {
$("#c").mousemove(function(event) {
  tempY = event.pageY;
});
this.y = tempY;
}

which creates a function every 16ms I update the player

  to:

var that = this;

$("#c").mousemove(function(event) {
  that.y = event.pageY;
});

This helped optimize the game further.

Chapter Four - I'm stupid, yeah... Chrome Tabs + Memory

I remembered that there was an issue with chrome with multiple tabs open, and I decided to quit out of and restart chrome anew. Behold! Constant 60fps and 1-2.5 mb memory usage(where it was 2-4mb memory usage before).

Moral of the story... close down all tabs and restart chrome before determining the problem, and use heap profiling to locate memory leaks.

Thank you everyone for your help!
I really do appreciate it.

Here's the code on github. Please let me know if you find more stupid mistakes or you have general tips on working with canvas/programming.

Feel free to email me yangsunwoo@gmail.com

sentences:
Interpolating rotated objects I've finally got interpolation working to 'smooth' out movement, however it doesn't seem to work for objects that are rotating (around their own center) - when I try to do this, the objects in question 'wobble'.

Note: I'm not talking about interpolating the actual rotation but rather the movement of a rotated object

So, let's say I have an object moving from left to right.  Using the code below (with interpolation), it moves nice and smoothly.  However, after rotating the object (let's say by 45 degrees, but this could be any angle), it's no longer moving smoothly, it still moves along it's path (left to right in this case) but it's no longer smooth.

Main Game Loop

@Override
public void onDrawFrame(GL10 gl) {

    //Grab time
    newTime = System.currentTimeMillis()*0.001;
    frameTime = newTime - currentTime;
    if ( frameTime > (dt*25))
        frameTime = (dt*25);

    currentTime = newTime;

    accumulator += frameTime;

    //Save game-state and update logic
    while (accumulator >= dt){
        saveGameState();  //Back up positions before updating them
        updateLogic(); //Update logic
        t += dt;
        accumulator -= dt;
    }

    //Get the amount to interpolate by
    interpolation = (float) (accumulator / dt);

    //Interpolate positions and render
    interpolate();
    render(interpolation);
}

Rotation Code

public void rotate(float x, float y, float angle){

    //Rotate the quad
    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
}

Edit

OK so it appears this is the problem:

During logic update, sprite is moved and rotates it around it's center (using it's new/current X and Y to calculate it's center).
Get's to render()
Render method interpolates position creating new 'throwaway' coordinates at which object should be drawn
Render method draws sprite at it's 'render' x and y coordinates
Logic update moves and rotate around it actual x and y - not it's 'rendering x and y
and so on

So as you can see, it's being rotated, not around the coordinates that it's been drawn at but at it's actual coordinates.  I can't rotate it around it's render coordinates, because the rotation is done within the logic update, not during the render call, therefore, it would be rotating it around it 'old' render position, not the next one and I won't know the new render coordinates until the next render call which means.........

That the only way I can do this, is to actually translate / rotate the sprite within the render routine and not the logic routine.

I've tried this and it works, but not sure I'm happy about piling more 'logic' into my render routine.

Is this an 'acceptable' model?  How else can I achieve rotation while keeping the object nicely interpolated?!

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:
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 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:
Binding Lua Function to Perform tasks using std::async I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would really like to cut this time down.
My question is how can I bind this to call loadMesh with std::async? Because I think that might help speed up the process.
Mesh *Loader::loadMesh(const std::string &path)
{
    std::shared_ptr<Mesh> mesh = Mesh::load(path);

    m_meshes.push_back(mesh);

    return m_meshes.back().get();
}

.
.
.

//this is the binding
    luabind::module(m_world->getLua()->get())
    [
        luabind::class_<Loader>("world")
            .def("load_mesh", &Loader::loadMesh)
    ]

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: LibGDX , Scale button with animation when it is pressed I am developing game using LibGDX . I want to create beautiful menu and to scale buttons when they are pressed but not in this way , when it is pressed scale it 1.5f , I want to scale it with animation . I am using imagebuttons .

sentences:
Navigate multiple Units on a grid through a tight space with different directions I just started learning about pathfinding algorithms.
Assume we have this scenario:

Blue and Green can move only on those tiles. They can also talk to each other.
Blue wants to go through the tunnel and green wants to go too, however both need to pass each other somehow. In case of a "basic" A* pathfinding algorithm they will both get stuck in the tunnel.

To prevent this issue i had some Ideas:
- Blue can tell green that he should move back first (give blue priority) when they both step next to each other (problems arise when there are more than 2)
- A better algorithm, that calculates this like an automatic traffic regulator (one will wait till the other frees the path) --> seems complicated

Now I am wondering if there are more efficient methods, how its done in general, if you have better ideas, if you can point me to some algorithms or some papers that adress this issue.

sentences:
Scripted Motion Paths (?) (XNA) Ok, so the title isn't the greatest because this is a lot more general.
Say I want to have the player be able to hit A and have their ship model roll to the right, and shift to the right of the screen, while the camera stays centered. Would I do that through programming (ie. set waypoints for the model and keep the camera focus still) or do it through animation ( so the ship model actually rolls and moves right, and just play those frames)(I actually don't know how to do this kind of 3D animation yet, haven't looked into it. Adding it to my To Do List)

This is a really vague question I know, I'll try and answer any questions.

Thanks,
Peter

sentences:
Are there legality issues using a company's name in a game? I'm working on an RPG of sorts where the character has a "day job" that determines how much money they make each time the day cycles and other things like that.

Are there any legality issues with using the names of companies like "Barnes & Noble" or even "Apple"?

sentences:
fire multiple events in InputListener I have two Actors on my stage in libgdx and and both have a InputListener. I override the touchDown method and it works fine. My Problem is that when I press my Actor Z and a second later Actor Y only Actor Z fires a touchDown event.

How do I solve this problem?
Or how did you solve the problem when you have some input actors/sprites on your screen and you wanted that the player can jump and move to the right at the same time?

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:
Camera Transition between 2 position / rotation, and follow a 3rd target I have setup a transition of camera between 2 transform, here the result in video:
https://youtu.be/rcwQ6KuEfMw

I have the information of the 2 transform:
- position (vector3)
- rotation (Quaternion)

And I do a Lerp, from Position1 to Position 2, and from Rotation1 to Rotation2:

Vector3 finalPosition = Vector3.Lerp(previousPosition, nextPosition, evaluateValueLerp);
Quaternion finalRotation = Quaternion.Slerp(previousRotation, nextRotation, evaluateValueLerp);

Now the problem is, as you can see in the video: the player target (the car) is lost durring the transition, I would like to keep it always in the view.

How can I manage to do it ?

Thanks you !

sentences:
How to get NPC to Find and Follow Path to other NPC? Problem:

I am using Skyrim Creation Kit to create a very simple mod. I want the mod to make one NPC follow another NPC. My first problem is that I am not really 100% sure where to start. The second problem is which functions I should use. I have been reading the documentation at www.creationkit.com. In other words:

LOOP: {
  // move Bob to Mike's current position with speed of 0.5
  (npc_Bob.moveToPosition( npc_Mike.getPos(), 0.5 )
} // end loop

My Attempt:

I tried making a quest but to no avail. So then I made 2 custom actors (member and leader) and I put this script in member:

Scriptname NpcFollowNpc extends ObjectReference
//***put a loop once you get this part working
// moves member to leader with speed of 0.5
member.PathToReference(leader, 0.5)

but it didn't compile. I don't really know if this is the right way to implement what I want. I know how to code and make algorithms and a bunch of that computer science stuff, but I don't know how to move the actor member to the location of actor leader in Skyrim and loop it while the actor leader is alive.

Any ideas how I could go about doing this? thanks for any help/feedback!

sentences: Why is the for loop more efficient than the for each loop in Unity? During a Unity talk about performance, the guy told us to avoid for each loop to increase performance and use the normal for loop instead. What's the difference between for and for each in implementation point of view? What makes for each inefficient?

sentences:
Spawn skateboard under player I would like to know whys in which one can spawn skateboard under player like we see in subway surfers.

My best two guesses are,
1.Spawnning skateboard and then making it child of player.
2.Changing current child prefab of player with skateboard attached prefab.

With first approach ,its get complicated to know exact character's leg position.

What you think is the best way? if you know any other good way then please mention .

Thanks in advance

sentences:
Errors when loading Assimp meshes I am experiencing some oddities when loading meshes in Assimp. Some models render perfectly, while others are complete jumbles of triangles.

Some Example Images:

Teapot Correct -
Teapot Actual

Flower Correct -
Flower Actual

OBJ download links:

Teapot.obj -
Flower.obj

I've searched far and wide, and I cant seem to pin down the cause of this. I have noticed while debugging that the value of ai_mesh->mNumVertices differs from what Assimp Viewer or Blender display. ai_mesh->mNumVertices is smaller in the Teapot example by 156 vertices, and larger in the Flower example by 20 vertices. I've considered that Assimp post-processing may be causing the difference here. However, I'm using the EXACT same post-processing flags used in Assimp Viewer, copied directly from the source code. Here is my Mesh Loader:

mesh::mesh(aiMesh *ai_mesh, model* parent_model) : mesh()
{
    name_ = ai_mesh->mName.length != 0 ? ai_mesh->mName.C_Str() : "";

    // Get Vertices
    if (ai_mesh->mNumVertices > 0)
    {
        for (int ii = 0; ii < ai_mesh->mNumVertices; ii++)
        {
            aiVector3D ai = ai_mesh->mVertices[ii];
            glm::vec3 vec = glm::vec3(ai.x, ai.y, ai.z);
            vertices_.push_back(vec);
        }
    }

    // Get Normals
    if (ai_mesh->HasNormals())
    {
        for (int ii = 0; ii < ai_mesh->mNumVertices; ii++)
        {
            aiVector3D ai = ai_mesh->mNormals[ii];
            glm::vec3 vec = glm::vec3(ai.x, ai.y, ai.z);
            normals_.push_back(vec);
        };
    }

    // Get mesh indexes
    for (int t = 0; t < ai_mesh->mNumFaces; t++)
    {
        aiFace* face = &ai_mesh->mFaces[t];
        if (face->mNumIndices != 3)
        {
            std::cout << "[??] Mesh face with not exactly 3 indices, ignoring this primitive.\n";
            continue;
        }

        indices_.push_back(face->mIndices[0]);
        indices_.push_back(face->mIndices[1]);
        indices_.push_back(face->mIndices[2]);
    }
    material_ = parent_model->getMaterial(ai_mesh->mMaterialIndex);
}

And render function, just in case.

void mesh::render()
{
    material_->bind();

    glVertexPointer(3, GL_FLOAT, 0, &vertices_[0]);
    glNormalPointer(GL_FLOAT, 0, &normals_[0]);

    glDrawElements(GL_TRIANGLES, indices_.size(), GL_UNSIGNED_BYTE, &indices_[0]);
}

Thanks ahead.

sentences:
JOGL Hardware Shadow Mapping Transparent Shadow Texture I'm using hardware shadow mapping on JOGL based on the demo(HardwareShadowMapping) supplied by the distribution. After generating the shadow texture from lights point of view, I apply it to my scene with no problems.

What I'm looking for is soft shadows instead of pitch black shadows. Is there any way that I can change the alpha values while applying the shadow/depth texture? Btw I'm not an expert on OpenGL especially about custom shaders and I don't want to spend more time on understanding and developing custom shaders instead of the game.

Here's a screenshot of the application in case you come up with another solution to what I'm trying to achieve. The game is actually a hack&slash RTS hybrid.Here's the pseudo code of the gl event listener attached to shadow pbuffer.

  gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
  gl.glPolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
  gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
  //render shadow casting geometry
  gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
  gl.glBindTexture(GL.GL_TEXTURE_2D, lightViewTextureID);
  gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
  //I sense here a way of updating alpha values of this texture

sentences:
How to animate an arc from the middle in both directions I have been able to make an arc that animates from one end to another using the following coroutine:

 IEnumerator AnimateArc(float duration)
{
    float waitDur = duration / pts;

    for (int i = 0; i <= pts; i++)
    {

        float x = center.x + radius * Mathf.Cos(ang * Mathf.Deg2Rad);
        float y = center.y + radius * Mathf.Sin(ang * Mathf.Deg2Rad);
        arcLineRend.positionCount = i + 1;

        arcLineRend.SetPosition(i, new Vector2(x, y));

        ang += (float)totalAngle / pts;

        yield return new WaitForSeconds(waitDur);

    }
}

How can I animate this arc from the middle in both directions

at a constant speed
with an ease (animates slightly faster in the middle and slows down towards the end)

sentences:
Algorithm for creating adjacent triangles I have a system where you can click once to place a node in a scene. When you place 3 nodes, it forms a triangle. When you place any future nodes, it creates a new triangle by joining that node to the 2 nearest existing nodes.

This works fine most of the time but is flawed when used near triangles with very acute angles, because one of the 2 nearest nodes is often not one that should be used.

For example, see the image below. The magenta triangle is the first one placed. If I then click at the position marked X, what I get is a new triangle where the blue overlay is. What I want is a new triangle where the green overlay is. (ie. symmetrical to the magenta one, in this example. Clarification: The green and magenta triangles don't overlap - the green one extends under the blue one to the left-most node)

How can I determine which 2 existing vertices to use when creating new triangles so that triangles are not superimposed like this?

EDIT: Searching for the nearest edge gives better results, but not perfect ones. Consider this situation:

The 'nearest edge' test is ambiguous, and can return AB or AC (as the nearest point to X for both is at A). The desired result would be AC, to form the ACX triangle with no edges overlapping. How could I ensure this result? (I'd rather not have to perform individual edge overlap tests as a tie-breaker if possible as I'm concerned that the nearest edge test won't necessarily spot the 2 are exactly equidistant, given floating point precision issues.)

sentences:
Unity: scaling and animations In my Unity project I have a script that programmatically changes the scaling of an object during the game.

Recently I wanted to add a spawning animation clip to my object, which modifies the object's scaling (but only during a short delay). So I added an animation controller to the object, containing the spawning animation clip.

I can now successfully run the spawning animation but the in-game programmatic scaling changes don't work anymore, even when my animation is not running.

Any idea?

sentences:
Unity Change Sceneview to camera view On selecting camera, I get the camera preview.

In Unity, while editing the scene, I wish to switch in such a perspective view that is exactly visible by the main camera.

Is there a short cut to change the view?

sentences:
Different implementation use case of component based approach Inspired by this question I made a small demo for an enemy that has a HP component. Basically there is a main enemy script and a HP script that considers you died on collision and lets the enemy script know on different ways. I could think of three different ways how to let the main script know that you died and included a basic implementation of each. The focus is more on how to let the main script know that you died.
Broadcast
public class EnemyBroadcast: MonoBehaviour
{
    void HandleDeath()
    {
        Debug.Log("Died via broadcast");
    }
}

public class HPBroadcast: MonoBehaviour
{
    private void OnCollisionEnter2D(Collision2D other)
    {
        BroadcastMessage("HandleDeath");
    }
}

Pro: This seems to be the shortest code.
Con: IDE can't see the call and you need to know the broadcastevent
Interface
public interface IDeathHandler
{
    void HandleDeath();
}

public class EnemyInterface: MonoBehaviour, IDeathHandler
{
    public void HandleDeath()
    {
        Debug.Log("Death via Interface");
    }
}

public class HPInterface: MonoBehaviour
{
    private void OnCollisionEnter2D(Collision2D other)
    {
        GetComponent<IDeathHandler>().HandleDeath();
    }
}

Pro: Not possible to forget to implement methods
Con: Possible overhead of methods, reusibility
Delegate
public class EnemyDelegate: MonoBehaviour
{
    void Start()
    {
        GetComponent<HPDelegate>().handleDeathDelegate = HandleDeath;
    }
    void HandleDeath()
    {
        Debug.Log("Died via delegate");
    }
}

public class HPDelegate: MonoBehaviour
{
    public delegate void voidDelegate();
    public voidDelegate handleDeathDelegate;
    private void OnCollisionEnter2D(Collision2D other)
    {
        handleDeathDelegate();
    }
}

Pro: Outside objects are able to observe changes/ events
Con: more complicated to setup/ longer code
Now the question is, what other ways are there in a component based approach, are there more pro/ con for each approach and when is which kind of implementation prefered over the others?

sentences:
Tangible benefits to speed-coding your personal game projects I noticed a few programmers setting time-sensitive challenges for themselves, usually in the area of "write game of type X in Y amount of time" or "write X number of games giving only Y time for each". What are the tangible benefits for setting your workflow in this manner to speed-code for a while? It feels like you have to trade off efficient code to get something done quick. And I suppose adding a final layer of polish isn't a big priority in these challenges, so it's okay to use programmer.

I've made some simple 2D scrolling shooters and puzzle games a few years ago and out of stupidity I deleted most of my code. So now I'm curious about using the speed-coding approach to get a couple simple things done again, and get myself more into game logic.

sentences:
NavmeshAgent not to turn back Imagine the blue part of this picture is streets and navmesh.
the red object is a car with navmeshAgent.
the green circles are the colliders set as triggered and they are the destination of the car.
when the game starts the car will choose one of them and go to that , after reach that it will choose another one randomly so it means the car will go through all of this forever.
now the problem is sometimes when car reach's one them and choose another since it will choose the closer path to next destination sometimes it will have to turn back which its not realistic and doesn't make sense.

as you can see in this example when reach that point since the middle one is closer from where the car is triggered it will turn back and the red arrow is wrong path ,  instead it should go through the green arrow and that's the correct path.
how can i do something to not to turn back instead find another way?

sentences:
Implementing AI to hide behind obstacles I am developing an AI simulation of predator and prey. I would like to simulate the AI hiding behind obstacles, if it is being chased. But I am still trying to figure out the best way to implement this.

I was thinking along the lines of checking on which side of the obstacle the predator is on and trying to go on the opposite side. Maybe using the A* path finding algorithm to ensure that it gets there using the shortest path.

Now the main reason I am writing is in case somebody is able to point me in the right direction of implementing this (maybe somebody has done this before) or have any other good ideas how to implement it. I have never done anything like this before in terms of programming AI or making any game.

All the obstacles are either horizontal or vertical squares/rectangles.

Additional Info: The map is based on x,y positions with each agent moving at a set velocity.So the map is not entirely tile based, also for that reason I am unsure if A* would actually work in this situation for me.

Here is an image of the situation:

Please also note that the red circle is the predator while the green circle is the prey being chased by the predator.

sentences: How do you transition to playing in XNA? I have two classes in my game, a Main Menu and the main playing screen. How can I swap through classes? E.g I click on "New Game" in the menu class and it changes it too the Game class.  A transition animation explanation would be nice.

sentences:
SharpDx: using maximized RenderForm I'm trying to learn DirectX via SharpDX, very new to this. What I want to do is be able to draw 2D shapes for a game I'm trying to make. So I started with the demo "MiniRect" that came with SharpDX. Since I want my game to be full-screen, I changed the RenderForm to be maximized (using WindowState) and set the FromBorderStyle to None.

I noticed that even if the form is set to maximized, it's size is always 800 by 600. In my renderloop, if I specify the location for the rectangle has 400 by 300, it is drawn in the middle of the screen. If I try to set the location via mouse-click (using the RenderForm's MouseClick event, there is always an offset present between where the mouse was clicked and where the drawing shows up.
My system DPI is set to the standard (96) so there shouldn't be any scaling. But it looks like there is a scaling factor of about 2.4

If it's not the DPI settings, does anyone have any idea what this be related to? The problem doesnt happen if the RenderForm is not maximized.
Is there another way to be drawing full-screen using SharpDX?

Thanks

sentences:
Unity Performance: How many Materials per Object? I have learned that a Mesh with 4 Materials each 1024x1024 in Size is somewhat slower than a Mesh with 1 Material 2048x2048 in Size? In my usual workflow I tend to seperate different Materials into different Materials so an Object tends to have around 2-8 Materials. I have created more than a hundred Assets like this.

Is the performance dramatically affected by this? Is it acceptable to upload such Objects to sites like turbosquid or sell them on Unity Asset Store or will the buyer behead me after noticing?

Window Textures need to be transparent, Metal / Wood / Concrete need different smoothness settings. As far as I know Unity doesn't support Gloss maps.

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:
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:
Execute function every X points In my game, the score can go up quite rapidly and by varying amounts, depending on the action taken.

For instance, at the start of the game, one could climb from 1 - 50 one by one, or they could rocket past 50 by getting a score of 10, 25, and 40.

My question is: How do I call a function every time they pass a factor of 50 (50, 100, 150, 200, etc.)?

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:
Does the protagonist's age matter in a 3rd person shooter? There have been very young characters in modern games that wield weapons including firearms before. Two good examples include Ellie from The Last of Us, and Clementine from The Walking Dead. Whilst I don't support the idea of having gun wielding children as characters, I do understand the context of use in the above two examples and the points being made.

I am designing the concepts of a 3rd person action game. The protagonist is a modern male adolescent (about 13 years old) and their age is important because the game's design is centred around the idea of growth and having the protagonist learn and achieve milestones through the game's progression. Being an action game there is combat and weapons including firearms. What I would like to know is, is there particular considerations I need to take with the issue of having firearms and a very young protagonist? At the moment the gameplay progression has the protagonist starting of as completely unarmed, having to initially rely solely on hand to hand combat and other stealth and platformer based skills to progress and learn new abilities. I would like to make more weapons and eventually firearms available to the protagonist, but have their use be completely up to the player and not a necessity for game progression. Most importantly I would like to make sure that the finished game does not come across as promoting the underage use of guns.

So is the protagonist age an important consideration in this type of game genre, or not? For example would I need to make sure I include a tutorial scene where the protagonist is taught how to fire a gun by an adult?

sentences: Does marking a GameObject as static actually improve performance? I'm currently working on a small game that will include somewhat large levels. Each level will have a somewhat large amount of GameObjects lying around as props. I was told by a friend of mine that marking the GameObjects that the map is comprised of as static will improve performance. However, I am aware that this can greatly increase the amount of space the built game takes up on the disk. Does the performance boost gained from marking GameObjects as static outweigh the cost of increased build size? Is there even a performance increase at all?

sentences:
Shader inputs in a general purpose engine I'm not familiar with SDKs like Unity or UDK that much, so i can't check this offhand. Do general purpose engines allow users to create custom uniform variables? The way i see it, and the way i have implemented it in an engine i'm writing to learn 3D, is that there is a "set" of uniforms provided by the engine and if you want to write a custom shader then you utilize uniforms you need to create a wanted effect.

Now, the thing is, first of all i'm not an artist, second of all, i didn't have a chance to create complex scenes yet. So my question is, is it common practice to define variables that the engine provides and only allow the user to work with what they're given?

Allowing users to add custom programs and use them where they want is not hard, but i have issues imagining how you'd go about doing the same for uniforms.

sentences:
SetIKHintPosition and SetIKHintPositionWeight seems to have no impact I have recently been exploring Unity's inverse kinematics, to further polish the interaction between our rigged avatars and props.

I have made a sample project, using PuppetMaster's basic humanoid for the model, rig, and idle animation, but without Final IK; meaning this is Unity's inverse kinematics.  Inside our OnAnimatorIK method, we set the right elbow's SetIKHintPosition and SetIKHintPositionWeight like we did with the hand IK:

animator.SetIKHintPosition(avatarIKHint, hintPosition);
animator.SetIKHintPositionWeight(avatarIKHint, hintBlendValue);

animator.SetIKPosition(sourceIKGoal, targetPosition);
animator.SetIKPositionWeight(sourceIKGoal, blendValue);

You can see the left and right hand correctly move to where we set it.  However, it seems like the right elbow is ignoring the hint position entirely.  You can see the white debug line connecting the elbow to the hint position in the picture above.

It seems like the elbow ONLY bends if it absolutely must for the hand to reach the target position, regardless of where the hint is set, and the weight value given.

I have fiddled with this on and off for days and still haven't found a solution.  Others have asked the same question here and on other sites, but no one has posted an answer.

sentences:
How to use GameManager to get GameOver() from another script? I'm trying to make a gameover-text show when the player is leaving the plane-area. In GameManager.cs I've written:

public void GameOver()
{
    gameOverText.gameObject.SetActive(true);
}

And in PlayerController.cs I've used the following code:

private GameManager gameManager;

and:

void Update()
{
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");

    playerRb.AddForce(Vector3.right * speed * horizontalInput);
    playerRb.AddForce(Vector3.forward * speed * verticalInput);

    if (transform.position.y < -4)
    {
        gameManager.GameOver();
    }
}

But this doesn't really work, and the console is giving me this message:

  Assets/Scripts/PlayerController.cs(8,25): warning CS0649: Field 'PlayerController.gameManager' is never assigned to, and will always have its default value null

I've already used the OnTriggerEnter (for powerups) and OnCollisionEnter (for enemies). How can I get the GameOver-text to show when the player leaves the "Plane"?

sentences:
Implementing a scrollable Panel in XNA/MonoGame I am trying to create a scrolling Panel for my game. The code I've shown below works but there is a problem.

I read Andrew's answer here and decided to implement the scrolling effect by using a Translation Matrix. However my Controls (Buttons, ComboBoxes, etc.) have a fixed Rectangle on the screen (the Rectangle I'm using to check if the cursor is over the Control). As I found out the Matrix translation will only move the texture of the Control and not the Rectangle.

The Problem:

So if I scroll down and click where the button was initially in the panel, it will trigger the Click event even though the button texture is "outside" the scissorRectangle.

What I considered:

I thought I should disable interaction with Controls outside of the scissorRectangle, but what about controls that are still partially visible?
If Matrix Translation won't work I thought about iterating over the Panel's _controls List and sending the offset to each individual Control (ugh), where it will adjust its Rectangle position. :/

I've got the following code for my Panel:

// ...
private RasterizerState _rasterizerState = new RasterizerState() { ScissorTestEnable = true };
private Vector2 _scrollOffset = Vector2.Zero;
private Matrix _matrix = Matrix.Identity;
// ...

In Update():

_matrix = Matrix.CreateTranslation(new Vector3(_scrollOffset, 0));
if (Enabled && BorderBox.Intersects(inputManager.MouseRect))
{
    if (inputManager.ScrolledDown())
    {
        if (_combinedRowHeight - (ContentBox.Height -_scrollOffset.Y) > -_combinedTextHeight)
        {
            _scrollOffset.Y -= 14;
        }
    }
    else if (inputManager.ScrolledUp())
    {
        if (_scrollOffset.Y < 0)
        {
            _scrollOffset.Y += 14;
        }
    }
}

And then in Draw():

// Save the previous RasterizerState
RasterizerState oldState = spriteBatch.GraphicsDevice.RasterizerState;
// Save the initial scissor rectangle
Rectangle currentScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;

spriteBatch.End();

spriteBatch.Begin();
// Draw Panel
spriteBatch.End();

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, rasterizerState: _rasterizerState, transformMatrix: _matrix);

spriteBatch.GraphicsDevice.ScissorRectangle = ContentBox;

if (_drawControls)
{
    for (int i = 0; i < _rows.Count; i++)
    {
        _rows[i].Draw(spriteBatch);
    }
}

spriteBatch.End();

// Restore the scissor rectangle
spriteBatch.GraphicsDevice.ScissorRectangle = currentScissorRect;

// Restore the RasterizerState
spriteBatch.Begin(rasterizerState: oldState);

So is there no other way? Should I just send the offset to Controls and modify their position? Can't the matrix approach be used for interactable Controls?

sentences:
Which optional features would you recommend for a raytracer? I'm developing a basic triangle mesh raytracer on a short deadline.
This means I can't implement every feature I come across, so I'm looking for some feedback about which features you think are most important, taking into consideration the performance of the feature and how much punch it packs.

I'm especially looking for optimization techniques that allow for a faster rendering and simple techniques that make a big impact on the final scene quality.
Is there any chance of making it fast enough to run in realtime?

Here are some example of features I've read about:

Anti-aliasing
Bounding box
Sky box

sentences:
Polling vs event driven input I'm developing a game using polling for the input method. However, now that I'm delving deeper into the game menus and other UI components, I'm finding that I'd probably like to have event driven input. Perhaps even having both, using event driven for the UI and polling for the "world" input. I'm curious on what the best way to go is.

I'm defining polling as: each update loop I check what keys are press, where the mouse is, buttons pressed, then run through them and do actions based on the info collected.

I'm defining event driven as: interrupt based events, when an event happens and interrupt is triggered and a code block is run based on the event.

Do you think it's best to go all event driven, all polling, or is a combination of both acceptable? If you have pros and cons for either please list them. Thanks.

EDIT

The game is Java/OpenGL based, so will be released to Windows/Mac/Linux. The possibility of extending that to mobile devices is low. The game is RTS style, 3rd person 3D.

EDIT 2

I'm still not totally happy with the way I've implemented this, but what I'm moving toward is catching events in my UI and if they're not handled by any of my UI components, I pass the event on to the "World" for picking/selection. Something like:

@Override
private boolean handleEvent(Event event) {
    if(hud.handleEvent(event)) {
        return true;
    }
    return WORLD.handleEvent(event);
}

This way I don't get clicks leaking through the UI to select objects behind buttons and what not.

Currently my camera controls are still based on polling, and that seems to be working for now, but I may update that later on.

I appreciate all the answers, sorry I could only pick one!

sentences:
Character Controller and Reverse Gravity So I have a Game object with Rigid Body, a Character controller and my Movement script. On a specific condition I am reversing gravity. The problem is that the velocity.Y when the gravity is reversed, keeps increasing to the infinity. If I try to reset it like in the first if statement (which works for normal gravity) the object keeps bouncing from the ground. Gravity scale is either 1 or -1 in order to reverse gravity and movement.
This is the code:
 void Update()
    {

        _isGrounded = Physics.CheckSphere(groundCheck.position, 0.4f, whatIsGround);
        Move();
    }

void Move(){
//Reseting States for new cycle , unless the object is falling
        if ((_isGrounded && velocity.y < 0))
        {
            velocity.y = -2f;
            _isRunning = false;
            _isJumping = false;
            _isFalling = false;
        }else if (velocity.y < 0 && !_isGrounded)
        {
            _isFalling = true;
        }
        //Moving on X axis
        float x = Input.GetAxis(KeyInputMove);
        if (x != 0)
        {
            _isRunning = true;
        }
        moveDirection = gravityScale*_transform.right * x;
        _controller.Move(moveDirection * moveSpeed * Time.deltaTime);

        //Perfoming jump
        if (Input.GetButtonDown(KeyInputJump) && _isGrounded)
        {
            velocity.y = (float) Math.Sqrt(1 * -2f * globalGravity);
            _isJumping = true;
        }

        velocity.y += gravityScale * globalGravity * Time.deltaTime;
        _controller.Move(velocity * Time.deltaTime);
//Updating animation states
        _animator.SetBool("Grounded",_isGrounded);//^This is the idle state
        _animator.SetBool("Running",_isRunning);
        _animator.SetBool("Jumping",_isJumping);
        _animator.SetBool("Falling",_isFalling);

    }

    private void OnTriggerExit(Collider other)
    {
       //Reverse Gravity and Model Rotation
        if (other.gameObject.tag == "Portal")
        {
            _transform.Rotate(0,0,gravityScale*180);
            gravityScale *= -1;
        }
    }

sentences:
Storing non-binary, but non-mergable files in Git LFS Is it acceptable to store files that aren’t binary and diffs between versions are not important in Git LFS? Examples of these files include:

.obj
.stl
.mtl
large .csv data dumps
etc

I know that I can, but would there be any advantages to storing them in LFS instead of the regular repo? I've done a bit of googling but couldn't find any information on the subject.

sentences:
How do I save a procedurally-generated map as binary level-data in C++? For example, I'd like to do something as simple as a generating an array matrix using Conway's Game of Life and then filling each cell with particular data to be saved to a binary file.

Additionally, how do I load the binary level-data?  :)

sentences:
How to prepare a game for localization? Many projects don't think about localization until the game is done. Then localization is done as a hack, and it's obvious that it was added on later. Some specific areas of concern:

Text strings (obviously)
Audio clips such as music and/or narratives
Text rendered on textures (e.g. a label on a crate)
Text rendered in frames in pre-rendered movies
Fonts/Character sets for different languages
Etc.

What are some good ways to prepare for these challenges in the initial development stages, so you can make it easier without incurring too much cost up front?

sentences:
In a ES system, how one would implement/ deal with Modifiers? Given the normal entity-component-system architecture, lets say we a component that give the entity Strength. Now on the game flow I want to give +4 strength do to the wielded weapon.
What would be the best way to do this, considering that.

BaseValue => 10; Weapon => +4; Weaken Spell -2 (Temporary); CurrentFinalValue => 12

I could have many modifiers, positive or negative;
I would like to know for a given entity attribute "Strength", what are the modifiers sum;
I could add or remove modifiers and they should not remove from the base "Strength";

I could add as a component (StrengthModifierComponent) and apply the change to the StrengthComponent, then to be able to calculate the CurrentFinalValue, I would have to discover every component that affects "Strength" somehow and sum it with BaseValue. This might be easier if I have complete control of the system, but if I am building the system for general purpose this would have to be dynamic and there for complicated, making it possibly "slow".

I cannot put in the entity since the entity is usually just an identifier (int,Guid,SomeUniqueName).

I could make a ModifiableComponent which accept a list of Modifiers and would allow an easier interaction when making all the calculus. But wouldn't this break the ES architecture?

Thanks you.

sentences: How to load in meshes efficiently into DirectX11 I wanted to know if there was a standard and efficient method to load meshes from a file into DirectX11.  Currently, I'm loading .obj's by parsing them in and storing their information into a vertex buffer. This appears to be extremely slow especially when I have meshes with many vertices like the Stanford Dragon or other standard objects like the Mitsuba or Buddha.

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:
C# OpenTK - Getting world coordinates of points that are altered by matrices I have written a skeletal animation system for a game I am working on. To draw lines that represent a skeleton, I use the GL matrix, and multiply it by each bone a long the body. For example before drawing the left hand, GL.multMatrix has been called for the lower back, upper back, left shoulder, left upper arm and left lower arm.

Currently I am now trying to deal with hitboxes. After this series of matrix transformations have been made, I am drawing a box with the local coordinates of -2,-2,-2 to 2,2,2. This works fine, the animated skeleton has a box around the hand.

However I've reached the stage of actually needing to use the hitbox, to check if it collides with another hitbox. I've worked out the algorithms I shall use for checking if there is a collision, but I first need to change those coordinates from their local to the hand coordinates, into coordinates I can use against other things in the world.

For example the left hand hitbox has the same local coordinates as the right hand hitbox, but how could I change that all back to global coordinates so I can get their proper world coordinates?

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:
"RENDER WARNING: there is no texture bound to the unit 0" When not Rendering Texture I have a webgl program that sometimes renders textures, but mostly renders triangles or lines. When I am not rendering a texture, webgl gives the warning, "RENDER WARNING: there is no texture bound to the unit 0". Here is some code from my rendering loop:

if (thing.hasOwnProperty('texCoords')) {
    gl.uniform1i(shaderProgram.useTexture, true);
    gl.bindBuffer(gl.ARRAY_BUFFER, thing.texCoords);
    gl.activeTexture(gl.TEXTURE0);
    gl.bindTexture(gl.TEXTURE_2D, thing.texture);
    gl.uniform1i(shaderProgram.tex_uniform, 0);
    gl.enableVertexAttribArray(shaderProgram.vertexPositionTex);
    gl.vertexAttribPointer(shaderProgram.vertexPositionTex, 2, gl.FLOAT, false, 0, 0);
} else {
    gl.uniform1i(shaderProgram.useTexture, false);
    gl.disableVertexAttribArray(shaderProgram.vertexPositionTex);
}

If a thing doesn't render a texture, there is code to set a flag in my shaders not to consult the sampler2d for texture values and instead just draw polygons.

I suppose "there is no texture bound to the unit 0" is correct: there isn't a texture bound since the last call to drawArrays, but why would that issue a warning when I don't try to access TEXTURE0?

sentences:
Creating a card dangling affect using 2d sprites I'm working on a 2d card game for iOS and using Cocos2d. When a player picks up a card and drags it I would like to make it appear that the card is lifted off the table and dangling just below their finger. So when they move their figure the card is slightly delayed an looks like its being dragged in a fluid animation. When the player stops moving the card sort of bounces or sways for a second.

I've been trying to find someplace that does this but I can't come up with anything so I'm wondering is it even possible in a 2d environment? How would I go about doing this, answers can be abstract, i.e. not cocos2d.

Thanks,

sentences:
How do I achieve supersampling / anti-aliasing in pixel shaders? I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect:

But I noticed there is aliasing in my resulting image (the above image is a sample from the linked website).

What can I do to prevent this? I couldn't find any article that explains how to solve this. I read some techniques like rendering in a higher resolution and then downsizing the image, but I need to solve this in a pixel shader capacity.

sentences:
Unity2D Best way to determine degrees between two colliding entities? I'm trying to determine the collision-direction between two objects. I'll be using this for various things such as creating blood-entities in a specific direction proportional to where the other entity is hitting an entity. What's the best/most efficient way to do this? I've been doing this but it seems unstable/not to be working.

Assuming both entities are center-pivoted, I use trigonometry to find the angle like; atan(b/a).
For some reason the output angle seems to be pretty random.

Here's the method I made:

protected void checkCollisionDirection(Collision2D target)
    {
        Vector3 positionDifference = target.gameObject.transform.position - gameObject.transform.position;
        int quadrant = 0;
        float x = positionDifference.x;
        float y = positionDifference.y;
        float degrees = Mathf.Atan (y / x) * Mathf.Rad2Deg;

        if (positionDifference.x > 0 && positionDifference.y > 0)
        {
            quadrant = 1;
        }
        else if (positionDifference.x < 0 && positionDifference.y > 0)
        {
            quadrant = 2;
            degrees += 180;
        }
        else if (positionDifference.x < 0 && positionDifference.y < 0)
        {
            quadrant = 3;
            degrees += 180;
        }
        else if (positionDifference.x > 0 && positionDifference.y < 0)
        {
            quadrant = 4;
            degrees += 360;
        }
        hitDirectionDegrees = degrees;
    }

I'm open to any suggestions that can find an angle between two entities.

sentences:
3D Physics in Marmalade SDK I am trying to make an 3d  game in Marmalade. I am completely new to Marmalade.

How to add 3d physics, gravity, dynamic object, sensors, colliders in Marmalade.

I was going through the API and did not find anything. Can you guys let me know how to accomplish these things

sentences:
Would this 2D Lighting and Shadows implementation work? I'm writing a top-down 2D tile-based game and I'm trying to decide on how to implement lighting and shadows. The game will have a large number of light sources, some static and some moving around the game world. However each light will only have a radius of a few tiles so I don't expect a large number of lights to affect the same pixel. Also, ideally, I'd like to be using normal-mapped sprites combined with the direction of lighting to give some depth to the lighting in the game.

My current plan is to render the whole screen to an off-screen buffer without lighting applied (diffuse) and at the same time rendering the UV normal maps to a similar offscreen buffer, much like in this excellent post from Wholehog Games.

At the same time, I plan to calculate and store the geometry of areas that are to be lit by each light as a triangle-fan mesh, similar to this truly excellent post on 2D shadows by Amit Patel (Red Blob Games).

Given this set of light geometry and the diffuse and normal maps to work from, I believe I should then be able to draw the final scene to the screen, first just as the diffuse drawn with low ambient lighting, then blended with each light source using its geometry of which areas to affect and shaded using UV/bump mapping for that light source. This will end up rendering the light's geometry for each visible light to only the area it affects.

Does this seem like a valid approach to 2D lighting that's going to be performant enough with a lot of lights on screen? As a relatively inexperienced graphics programmer, I don't want to set off down this route without at least sanity-checking it with the community :)

Although I'm trying to keep this question platform-agnostic, I'm using Java/LibGDX/OpenGL on modern desktops only (so I'm not accounting for less powerful tablets and mobiles).

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:
Use heightmaps or direct vertex manipulation for runtime terrain editing in UE4? I am creating a terrain editor and creator for in our game, in which we should be able to create hills and dales, create different shapes(forms) in the terrain etc. I came up with 2 approaches on achieving what we want,

1. modify 2d heightmaps by darkening / lightening colours; update terrain vertices based thereon.

2.  Create a plane and modify the vertices of the plane to shape what we want.

So my question is, which way would be faster/better for a ingame terrain editor? And why would you recommend that?

Or, if you know of a better way, I would love to hear.

Thanks

sentences:
How to create a turn-based system with an unknown number of enemies? 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.

I want to create a turn-based system for my 2D Top/Down Roguelike. After the generation of the dungeon, there will be x enemies spawned based on chosen difficulty and chosen quest.

How should each turn look like?
Player for example is an Orc, so he gets 7 movement (meaning he can move 7 tiles).
In his turn he can move for example 3 tiles, then attack, 2 tiles, use a potion and then uses his last 2 tiles of movement. And then he presses "End Turn" and then the enemies go through their turns (based on which type of creature they are). The player can skip his turn completely, attack and don't move or only move. But he always needs to press the "End Turn" button.

What I would do, to solve this issue:
I would create a boolean for every single enemy and the player, then turn them true or false. And whenever boolean is true, that person can do his turn. But to check this, I would need to put it in the "Update" method. So on every frame there would be x+1 checks (all enemies plus player), who can move or not.

A second idea would be to put the player and the enemy in an array, sort by speed variable (so who goes first, and who goes last) and then I would have my turn order without any boolean. But this still leaves the question, how I would prevent the player of moving or doing stuff while it is not his turn.

I don't think any of them would be a good idea. Since I use now Unity, I hope there is a better option for this. And just a heads up, English isn't my first language, but I hope you can understand me. I will happily answer any question.

sentences:
Client Server Multiplayer Project I have reviewed the relevant WinForms/XNA samples here and here.

However, my requirements are slightly different.

Given the following:

I am developing a multiplayer (Client - Server) game
There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game/engine
The instances will share common code from this engine project (core Game Engine functionality)
I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form
Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client/server instances to inject the relevant network management class as required - similar to the approach here

What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa?

Thank you for any advice you can spare.

Edit - a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" / full / traditional DI!

// Create the server
using (var game = new ExampleGame(new ServerNetworkManager()))
{
    game.Run();
}

// Create the client
using (var game = new ExampleGame(new ClientNetworkManager()))
{
    game.Run();
}

sentences:
Issue with Mapping Textures to Models in Blender I've been trying to texture a model using Blender, but when I draw on the UV Editor it doesn't show up on the model, and I can't draw on the model itself. I've tried saving the image and the 3D View is set to Texture. Everything seems to be in order and I've followed several tutorials, but none of them seem to work with the version I'm using (2.64-- update was necessary for import plugin) and I'm absolutely stumped.

How can I draw textures to the model? If not within Blender itself, how do I export/import the textures?

EDIT: Vertex Paint works, though it is insufficient for my purposes. In addition, moving to the rendered view produces a solid-color model with none of the applied textures.

sentences:
Render cylinder tube along 3D Path I'm working on a roller coaster game, and I have computed a function that represents the path of the track in the 3D space. Since the track will be tubular and will be dynamically generated(as opposed to a very large obj file), I was wondering if there was any elegant way to render something like this.

Something like this is what I'm aiming for

PS: I'm currently working in SceneKit on iOS/OSX

sentences:
How can i make fade in/out of the alpha color of a material from black to none black? This is script is attached to a black plane.
I have a plane and i added to it a material and the plane is in black.
When running the game the alpha color of the plane material is changing slowly.

The script is working it's getting slowly from dark black to none black.
But i want to make some changes:

It's not my script i took it from the youtube and did some changes the first one converted from js to c# second added the fade bool variable.

First of all i don't see any meaning setting the variable timer to 10 at the top. Any ideas what is the point ?
Second is how can i check when the alpha color value is high enough to do some stuff:

Enabled true the fpc again. Once it's not black again the fpc is still enabled false.
If i want when the alpha color value reached it's max to make automatic fade back to black Now i'm using manual fade bool variable but i wonder how to do it automatic fade in/out.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public float timer = 10.0f;
    public FirstPersonController fpc;
    public bool fade = true;

// Use this for initialization
void Start()
{
    Color tempcolor = GetComponent<Renderer>().material.color;
    tempcolor.a = 1f;
    GetComponent<Renderer>().material.color = tempcolor;

    fpc.enabled = false;
}

// Update is called once per frame
void Update()
{
    timer = Time.deltaTime;

    if (timer >= 0)
    {
        Color tempcolor = GetComponent<Renderer>().material.color;
        if (fade == true)
        {
            tempcolor.a -= 0.1f * Time.deltaTime;
        }
        else
        {
            tempcolor.a += 0.1f * Time.deltaTime;
        }
        GetComponent<Renderer>().material.color = tempcolor;
    }
}

}

sentences:
Pick which directional light shades which object Suppose you have two directional lights pointing at one sphere from different angles. You would expect the sphere to cast two shadows, but it turns out that this isn't the default behavior. The first light in the scene is the only one that casts a shadow. I want all my yellow spheres to take shadows from light A, but I want all my blue spheres to take shadows from light B instead of A. Is there a way to do this?

(It seems there's a fullforwardshadows pragma that could make the spheres cast both shadows. I'll try to figure that out if need be, but I really only need one shadow per sphere.)

sentences:
Input and output of a server side game using web sockets I am having a look at redeveloping an old flash based top-down zombie shooter game I made in highschool so that it supports multiplayer using socket.io. My experience over the last 5 years has been mostly writing server-side code, so writing the game logic itself on the server isn't a huge concern. The places I am having trouble with due to my very limited experience with sockets specifically is:

What the most appropriate input and output should be to and from the server in a game context.
How much data is appropriate to send.

Off the top of my head, I imagine the process would look something like:

The server runs the game (using NodeJS).
Clients that connect send their input to the server (key presses, clicks, etc).
Those inputs are queued against the client ID on the server and interpreted to move their character or whatever it does.
The server sends back the updated position of the client as well as everything else around the client in the "world".

The last point is where I have the most doubts. Assuming a reasonable collection of objects in the world, I am not confident that sending through the position of everything every ~30ms to every client would be sustainable (though I really don't know what is sustainable with web sockets). Then again, maybe it actually is perfectly fine to do this.

Obviously I can limit the amount of objects by only sending ones who have actually been updated (so static objects would never come through, etc) but I am not sure whether that is necessary at all or whether that is something extremely crucial. I also don't see this working if we implemented something like everyone being able to fire 100s of projectiles (or some other massive collection of constantly updating objects).

Are there any general guidelines or common knowledge around how much data you would expect to see come through a web socket and how frequently? Am I way off the mark or would this work okay for a moderate amount of clients?

I realize this all sounds very broad so to try tighten it up a bit I am specifically interested in how much data is realistic to send through web sockets and how frequently. Any auxiliary information based on the above is a great addition.

sentences:
How to automatically test a game's mechanics without duplicating work? I've heard and read enough programmers firmly advocating automatic tests. According to many, tests are themselves part of a code's functionality, untested code is broken and/or legacy by definition, long-term manual testing is more time-consuming and provides far weaker guarantees against failures than automatic testing... etc.

I'm trying to hobbystically develop a turn-based Pokemon-like game. While talking to a far more experienced developer I said that when I add a new attack I run my game, go into 1v1 combat, use this move and see if it does what its supposed to do. His answer was: Why won't you instead write a test that goes into a 1v1 combat, uses this move and checks if it does what it's supposed to do? Doing what you're doing manually may be faster than writing tests if you do it once, twice, thrice. But after 10 times? One hundred times?

I'm thinking about what he said. I'm thinking and I still don't feel convinced. About any other kind of project, perhaps. But a game?

Assume I'm adding lifesteal to a monster's attack. Problem is I'll have to anyway boot my game and play it! To see if it feels right, if it plays right, if not for anything else.

Tests on the other hand add maintenance cost: for example, once I (for balancement reasons) change the lifesteal coefficient, I'll have to reflect that change in tests. (Or I won't have to reflect this change in tests if I copy&paste the formula, parametrized by attack strength, lifesteal coefficient, etc, but doesn't this defeat the purpose of testing?)

Automatic tests are supposed to replace manual tests; but given I have to manually play my game anyway, isn't this duplication of work?

Or is my thinking wrong? What am I missing?

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:
Optimize field of vision algorithm in a grid tiled map I am trying to implement Field of View algorithm in my game and I followed the great tutorial here : sight-and-light and here is what I got so far :

As you can see it works fine for me :)

And then I try to use this algorithm in a tiled map. It also works fine but just a little bit slow so I am now trying to find a way to optimize the algorithm.

Some information might help to optimize :

The tiled map is Orthogonal
All the tiles have the same size 32 * 32 and are square
Tiles marked 0 means empty marked as 1 means a obstacle
I have used Connected Component Labelling algorithm for a preprocess :

All the obstacles have been merged into several regions
I know all the vertices position in each regions

Something like this :

Say I have 9 connected regions ( 9 polygons ) and 40 vertices in total.

Based on the algorithm in the above link, there will be :

ray-cast : 40 * 3   ( 3 ray-cast per vertices in angle +- 0.00001)
edges : 40
edge * ray-cast intersection test : 40 * 40 * 3 == 4800

I think there should be a way to reduce the ray cast count and the edges count that I need to do the intersection calculation in a above situation but just could not figure out a good solution.

Any suggestion will be appreciated, thanks :)

sentences:
How can I resize a game object using single drag handle? Really need your help. I'm trying to create a custom controller for my app to allow users to resize and rotate game objects using a single drag object.
I was able to create the code to create the visuals and to rotate it but I'm stuck on how to resize the game object. To position the drag handle at the start, I'm getting the bounds of the target object and taking the bounds.extents.magnitude to determine the y position.
So I was hoping the behavior would be such that when you drag the handle closer to the center of the target object it shrinks the bounds.extents.magnitude based on the new handle position and then becomes bigger if you go further away from the center of the target object.

Here is where I am now:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CircleMaker : MonoBehaviour
{
    public float lineWidth = .1f;
    private int segments=360;
    private LineRenderer line;
    private float radius;
    private Renderer boundsSource;
    private Bounds bounds;
    public GameObject dragHandle;
    public GameObject target;
    private int pointCount;
    private Vector3[] points;
    public int angle = 0;
    public float zPosition = -8.0f;
    public bool isDraggingHandle = false;

    void Start()
    {
        line = GetComponent<LineRenderer>();
        boundsSource = target.GetComponent<Renderer>();
        bounds = boundsSource.bounds;
        line.useWorldSpace = true;
        line.startWidth = lineWidth;
        line.endWidth = lineWidth;
        line.positionCount = segments + 1;
        line.receiveShadows = false;
        line.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

        pointCount = segments + 1;
        points = new Vector3[pointCount];

        float r = bounds.extents.magnitude;
        float d2r = Mathf.Deg2Rad * (target.transform.localEulerAngles.x * 360f / segments);
        dragHandle.transform.position = new Vector3(Mathf.Sin(d2r) * r, Mathf.Cos(d2r) * r, zPosition) + target.transform.position;

        DrawCircle();

    }

    void Update()
    {
        if (isDraggingHandle)
        {
            //rotate object based on drag handle location
            Vector3 direction = target.transform.position - dragHandle.transform.position;
            int sign = (direction.x >= 0) ? 1 : -1;
            float offset = (sign >= 0) ? 0 : 360;
            float angle = Vector2.Angle(Vector2.down, direction)*sign+offset;
            target.transform.rotation = Quaternion.Euler(0, 0, angle);

        }

        if (target.GetComponent<DragAndDrop>().isDragging == true)
        {
            dragHandle.transform.parent = target.transform;
        }
        else
        {
            dragHandle.transform.parent = null;
        }

        DrawCircle();
    }

    //draw circle around target gameobject based on bounds.extents
    void DrawCircle()
    {
        radius = bounds.extents.magnitude*target.transform.localScale.x;
        for (int i = 0; i < pointCount; i++)
        {
            float rad = Mathf.Deg2Rad * (i * 360f / segments);
            points[i] = new Vector3(Mathf.Sin(rad) * radius, Mathf.Cos(rad) * radius, zPosition) + target.transform.position;
        }

        line.SetPositions(points);
    }
}

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:
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:
Unity - Toolbox pattern is not safe When I create a toolbox such is in this tutorial. How do I defend against breaking the pattern with multiple instances like this:

gameObject.AddComponent<Toolbox>();
gameObject.AddComponent<Toolbox>();

I when calling Toolbox.Instance I get following message:

[Singleton] Something went really wrong  - there should never be more than 1 singleton! Reopening the scene might fix it.

Is there a way to defend against it ?

sentences:
Rotate an object around a point in Ogre3D Possible Duplicate:
  How can I rotate about an arbitrary point in 3D (instead of the origin)?

I am new to 3D programming and I have been using Ogre3D lately to get a grasp of it.

What I am trying to do is the following:

I want to make an entity rotate around a point (probably the parent SceneNode) in a circular way only in the X and Z axis.

I have tried using yaw/pitch/roll and rotate but no luck, and I can't find any good tutorials/how-tos online.

sentences:
How much is 2D geometry used in 3D? I'm studying 2D geometry with eventual goal to study 3D geometry for building games - very much looking forward to 3D!!
Looking up on how to calculate hypotenuse of a right triangle in 3D I read that the the same 2D Pythagorean theorem can also be used in 3D right triangle to calculate the hypotenuse.
So now I'm curious on how much of the 2D geometry I'm learning right now will be reusable when I get to 3D?
By "how much" I mean

Do devs throw away their 2D knowledge in 3D and use a whole new sets of formulas/theorems?
Or almost all or at least 90% of 2D knowledge is reused in 3D?

sentences:
HDR and Alpha Blending I've been reading a lot about HDR techniques and came across Alpha Blending compatibility. Searched even more and found this snippet from the Ogre Forums:

  With source alpha blending, it sometimes looks ok provided the range differences aren't too high, but most other blend modes fail completely, particularly add. You really have to do your own separate composition in another fragment shader targetting a second texture and pulling the 'background' values in so you can do accurate blending, rather than render the transparent effects into the same original surface.

Why is alpha blending an issue when it comes to rendering HDR (values above 1.0) in 16FP FrameBuffers?

sentences: Storing game resources in the *.dat file format to reduce file size How can I store sprites(png) or audio files(wav) in the *.dat file format?

sentences:
I need a professional icon for my Android/iPhone game: how should I proceed? I need a great looking icon for my mobile game.

I have a few questions regarding the process of hiring a graphic designer to do it:

Which is (are) the best website to publish the Request For Proposal ?
Is it common practice to ask for a couple of logo/icon drafts so that I can pick the one I prefer ?
When does the client usually pays the designer (at order, final delivery time?)

Any feedback or advice will be appreciated.

sentences: How to create/edit a weapon in ut2004's unrealed? I've searched a lot, but almost all of the ut2k4 Unrealed tutorial websites/blogs have disappeared. How do I create or edit a weapon in Unrealed?

sentences:
C++ SFML: Keypressed Event not registering half the time? I have a very simple event handeling system at the moment.

void LevelScreen::PollInput()
{
    sf::Event event;

    while (pWindow->pollEvent(event))
    {
        if (event.type == sf::Event::KeyPressed)
        {
            int x = 0;
            int y = 0;

            if (event.key.code == sf::Keyboard::Left)
            {
                x = -1;
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                x = 1;
            }
            else if (event.key.code == sf::Keyboard::Up)
            {
                y = -1;
            }
            else if (event.key.code == sf::Keyboard::Down)
            {
                y = 1;
            }

            pCursor->Move(x, y);
        }
    }
}

The system gets updated every single cycle, yet many keypresses are not even registered eventhough there is no lag. Mouse movement is always registered, but when I press, for example, Down alot it fails to register from 30% to 50% of the time. Same counts for the mouse button, if I hold it down I can see that it registers it for 6 times in a row, then stops for about 5 seconds, continues, etc.

Putting it in the main loop doesn't change anything. I cannot find any reason for this input lag.

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:
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:
Simple way to detect collision between two bitmaps on android surface view I'm looking for a standard way to detect collision between two bitmaps inside a surface view. I tried the intersect method with two rectangles, but it doesn't log.

practiseA = new Rect(500, 500, 500, 500);
practiseB = new Rect(500, 500, 500, 500);

public void isIntersecting() {
    Log.d("yeah", "hello");
    if (practiseA.intersect(practiseB)) {
        Log.d("collision", "yes");
    }
}

So can someone tell me what I'm doing wrong or give me a different method?

I saw this complicated algorithm but didn't understand what to feed it:

sqrt( ( ax - bx ) ^ 2 + ( ay - by) ^ 2) <= aR + bR

What's aR and bR?

sentences:
Object pooling in Multiplayer Game. Physics not synchronizing well I implemented object pooling for my multiplayer project. Following Unity Manual I used custom spawn handler for shooting bullets. Bullets game object has rigidbody so selected Sync Rigibody 3D in Network Transfrom. My pool size is 5.

While shooting when all 5 projectile is shooted then they have to have to come back to initial position one by one that is the concept of pooling.

When projectile moving back they just instantly go back to initial position on host but on client their position are lerping and can easily be seen that we are reusing projectile.

How will I fix this ?
I've added GIF for better understanding

Code For SpawnManager where I'am using Custom SpawnHandler

public class SpawnManager : MonoBehaviour {

public int m_ObjectPoolSize = 10;
public GameObject m_Prefab;
public GameObject[] m_Pool;

private Queue<GameObject> objectPool;
public NetworkHash128 assetId { get; set; }

public delegate GameObject SpawnDelegate(Vector3 position, NetworkHash128 assetId);
public delegate void UnSpawnDelegate(GameObject spawned);

void Start()
{
    assetId = m_Prefab.GetComponent<NetworkIdentity>().assetId;

    objectPool = new Queue<GameObject>();
    for (int i = 0; i < m_ObjectPoolSize; ++i)
    {
        GameObject obj = (GameObject)Instantiate(m_Prefab, Vector3.zero, Quaternion.identity);
        obj.SetActive(false);
        objectPool.Enqueue(obj);
    }

    ClientScene.RegisterSpawnHandler(assetId, SpawnObject, UnSpawnObject);
}

public GameObject GetFromPool(Vector3 position)
{
    GameObject obj = objectPool.Dequeue();
    obj.transform.position = position;
    obj.SetActive(true);
    objectPool.Enqueue(obj);

    return obj;
}

public GameObject SpawnObject(Vector3 position, NetworkHash128 assetId)
{
    return GetFromPool(position);
}
// Not calling this function yet
public void UnSpawnObject(GameObject spawned)
{
    Debug.Log("Re-pooling GameObject " + spawned.name);
    spawned.SetActive(false);
}

}

And this is the code where I am calling these function.

public class PlayerTest : NetworkBehaviour {

SpawnManager spawnManager;

private void Start()
{
    spawnManager = GameObject.Find("Spawn Manager").GetComponent<SpawnManager>();
}

private void Update() {

    if (!isLocalPlayer) return;

    if(Input.GetKeyDown(KeyCode.Space)) {

        CmdFire();
    }
}

[Command]
void CmdFire() {

    // Set up prefab on server
    var prefab = spawnManager.GetFromPool(transform.position + transform.forward);
    prefab.GetComponent<Rigidbody>().velocity = transform.forward * 4;

    // spawn prefab on client and server
    NetworkServer.Spawn(prefab, spawnManager.assetId);
}

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:
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:
Game loops using Hard realtime systems vs Soft realtime systems I have read the article here about realtime systems and am looking for examples specific to game loops.

Am I correct in saying:

Hard realtime systems will lag and slow down gameplay causing slow motion if processing of AI, collision detection, or user input is delayed past the rendering deadline set by the realtime system. Example, must render every 1/30 sec but processing caused delay to 1/20 sec.

Soft realtime systems will render at 30 FPS regardless of the other subsystems processing but if there is a delay in AI, collision detection, or user inputs, the game will be presented in stop motion instead of slow motion every 1/30 sec.

sentences:
How can I determine which direction a 2D collision is occurring from? The problem is as follows:

Think 2D Zelda (Links Awakening, A Link to the Past) style movement where you can run into walls from any of the four cardinal directions, or basically up, down, left, and right. The difference between my movement and these games is I want to allow for diagonal movement as well. When the player collides with a wall on the left, for example, if he is pushing left and up I want him to stop moving left but continue moving up. The problem I am having is my code currently detects the collision as both an upwards and a left collision so the player simply stops. What is the approach I should take to remedy this?

        bool canCollideLeft = false;
        bool canCollideRight = false;
        bool canCollideUp = false;
        bool canCollideDown = false;

        if (HeroRect.Left > OldHeroRect.Left)
        {
            canCollideLeft = false;
            canCollideRight = true;
        }

        if (HeroRect.Left < OldHeroRect.Left)
        {
            canCollideLeft = true;
            canCollideRight = false;
        }

        if (HeroRect.Bottom > OldHeroRect.Bottom)
        {
            canCollideUp = false;
            canCollideDown = true;
        }

        if (HeroRect.Bottom < OldHeroRect.Bottom)
        {
            canCollideUp = true;
            canCollideDown = false;
        }

        foreach (RectangleItemProperties rectangle in CollisionRectangles)
        {
            Rectangle CollisionRect = new Rectangle((int)rectangle.Position.X, (int)rectangle.Position.Y, (int)Math.Abs(rectangle.Width), (int)Math.Abs(rectangle.Height));

            if (HeroRect.Intersects(CollisionRect))
            {
                if (canCollideDown && HeroRect.Bottom >= CollisionRect.Top && HeroRect.Bottom <= CollisionRect.Bottom)
                {
                    hero.position.Y = OldHeroRect.Location.Y;
                }

                if (canCollideUp && HeroRect.Top >= CollisionRect.Top && HeroRect.Top <= CollisionRect.Bottom)
                {
                    hero.position.Y = OldHeroRect.Location.Y;
                }

                if (canCollideLeft && HeroRect.Left <= CollisionRect.Right && HeroRect.Left >= CollisionRect.Left)
                {
                    hero.position.X = OldHeroRect.Location.X ; ;
                }

                if (canCollideRight && HeroRect.Right >= CollisionRect.Left && HeroRect.Right <= CollisionRect.Right )
                {
                    hero.position.X = OldHeroRect.Location.X;
                }
            }
        }

In summary the code compares the old position with the new position to see which direction we have moved and checks for a potential collision there. So if we move up and to the left, canCollideLeft and canCollideUp will be true. I am pretty sure this is where my problem lies and I need to better check which direction I am colliding from.

Any thoughts or insight?

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:
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:
How to begin serious game development (in C++) I would like to start developing games. I have tried before Game Maker 8, which was a very easy way to start creating games, if you were new in game development. Then, I tried Unity 3D, which was a much more serious and complete tool to create computer-games, and required some experience. And now, I would like to start creating games, and don't use any special environment or developer, but just code (in C++ preferably). So, here is my question: from where should I begin, if I would like to start programming games? Thanks in advance.

Note: I work in ubuntu 10.04, I can also use windows 7, but I prefer ubuntu.

sentences:
How to move sprite as if not rotated when rotated 90 degrees? We're making a Tetris like game and need help rotating shapes.

Moving the shape works when there is no rotation.

However, after rotation, snapping the shape to the grid fails because the vector between the shape's current position and destination is affected by the amount of rotation (e.g., rotated 90 degrees).

As a simple example, let's assume a shape consists of one square and currently sits at (8, 0).

If the user rotates the shape 90 degrees (ignore that this functionally does nothing since the shape is only one square) then wants to move the shape to (1,0), what should the vector be? And how do you generalize the vector math?

We're using Swift 3 for an iOS game.

    if isShapePosValid(shape: curShape) {
        let firstTile = curShape.getLowestTile()
        let nearestBoardTile = getNearestBoardTile(shapeTile: firstTile)!
        let newTilePos = firstTile.parent!.convert(nearestBoardTile.position, from: nearestBoardTile.parent!)
        let moveVector = CGVector(point: newTilePos - firstTile.position)
        let move = SKAction.move(by: moveVector, duration: 0.1)
        curShape.run(move) {
            self.printShapeToBoard(shape: curShape)
        }
    }

fileprivate func rotateShape(shape: BoardShapeSprite) {
    let rotate = SKAction.rotate(byAngle: CGFloat(Double.pi/2), duration: 0.1)
    shape.run(rotate)
}

fileprivate func printShapeToBoard(shape: ShapeSprite) {
    let tiles = shape.getTiles().filter{ $0.value != .Empty }

    for t in tiles {
        let boardTile = getNearestBoardTile(shapeTile: t)
        boardTile?.setValue(value: .Taken)
    }
}

sentences:
Are there definitive, unambiguous terms for hexagon tile orientations? I have been working on a tile map editor and plan to support two orientations for hexagons. I have seen various terms used, but these all seem ambiguous to me.

Horizontal, Vertical (ambiguous: does this mean they line up horizontally, or stack horizontally?)
Flat, Pointed (ambiguous: Are they flat on the sides or top and bottom?)

I would like to find unambiguous terms for the following two orientations for hexagons -- ideally, these would be definitive and succinct (I could refer to these as "Flat on Top" and "Pointed on Top" but would prefer something more technical and authoritative).

Edit: I was holding out for something more technical, but it's hard to argue with Amit. For me, "pointed" sounds more formal than "pointy," so I am going to use the following (a decision reinforced by DMGregory's answer): Flat-top and Pointed-Top.

sentences:
How can you detect object/s using raycast from mouse cursor? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraRaycast : MonoBehaviour
{
    public Camera cam;

    void Start()
    {

    }

    void Update()
    {
        Ray ray = cam.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, 1000))
            if (hit.transform.tag == "Interactable")
            {
                print("I'm looking at " + hit.transform.name);
            }
            else
                print("I'm looking at nothing!");
    }
}

This is working fine but this send raycast hit from the camera. I want to send the raycast from the mouse cursor so if the mouse cursor is moving over object it will detect it. Just instead the camera the mouse cursor.

sentences:
XNA 2D - How can I draw a sprite over another? I'm working on a simple 2D game that is similar to the classic Invader arcade. What I want to know is:

How can I draw a new sprite over the player sprite upon colliding with an enemy/a bullet?
Better yet, how can I hide the player so that the hit animation can be shown?

I got the collision detection up and running except for the hit animation. It's being drawn behind the player current position which is awkward.

sentences:
Connecting to external computer with lidgren I'm new to networking and thought i'd muck around a bit with lidgren before i start implementing it in my games, so i made a little client/server chat program that works fine on localhost and lan. I can connect other computers on my subnet and chat, but when it comes to connecting a friends computer not connected on my home network it becomes a bit tricky. I set up UPnP and port forwarding on the server application and i connect the client directly using my external IP address, but the problem seems to come from connecting my client with my external IP address as they never actually connect.

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
        Network.client = new NetClient(Network.config);
        Network.client.Start();
        Network.outMsg = Network.client.CreateMessage();
        Network.outMsg.Write("password");
        Network.client.Connect("121.217.195.105", 14242, Network.outMsg); //doesnt work
        //Network.client.Connect("192.168.0.14", 14242, Network.outMsg); works
        //Network.client.DiscoverLocalPeers(14242); works

This is the client initialisation

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.Port = 14242;
        Network.config.EnableUPnP = true;
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
        Network.config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
        Network.server = new NetServer(Network.config);
        Network.server.Start();
        Network.server.UPnP.ForwardPort(14242, "SKG Chat bb");

and this is the server initialisation

This following code should display a message to the server if it even receives the clients connection attempt but when run, no connection attempts are received.

 case NetIncomingMessageType.ConnectionApproval: //wan
                    string message = incMsg.ReadString();
                    outMsg = server.CreateMessage();
                    outMsg.Write("You've been received");
                    server.SendUnconnectedMessage(outMsg, incMsg.SenderEndPoint);
                    if (message == "password")
                    {
                        incMsg.SenderConnection.Approve();
                        finalMsg = "New Connection";
                        readDiag = true;
                    }
                    else
                    {
                        incMsg.SenderConnection.Deny();
                        finalMsg = "Connection denied";
                        readDiag = true;
                    }
                    break;

I honestly am lost when it comes to networking and have no clue why it isnt connecting. Any help would be greatly appreciated.

sentences:
How to lerp all members of array in Unity 5? I've an array of gameobjects called cards and I have this code to run when clicking a button

public void mover()
{
  for (int x = 0; x < cards.Lengh; x++)
  {
    cards[x].transform.position = Vector3.Lerp(
      cards[x].transform.position,
      new Vector3( Random.Range(2.5f, 15.5f), 1.5f, Random.Range(-5.2f, -13.5f)),
      CardMoveSpeed * Time.deltaTime);
  }
}

But when I click on the button it moves instantly.

How can I move all of them smoothly (by using lerp)?

I read about using co-routines but I don't fully understand how to implement it in this situation.

sentences:
Normal Matrix in plain English I'm into shader language with Webgl and GLSL.
I've seen some tutorial about normal matrix and I don't really understand it.
I mean, I think I'm ok with the math such as:

modelViewMatrix = mat4.multiply(camera.view, modelMatrix);
inverseModelViewMatrix = mat4.invert(this.modelViewMatrix);
normalMatrix = mat3.fromMat4(inverseModelViewMatrix);
normalMatrix = mat3.transpose(this.normalMatrix);

But why do I need it? Where can I find a case where I can see the difference between using it and not using it? Ot when do I don't need it?

sentences:
Update dependent values of Serializable C# classes on Inspector I have some data types' properties that depend on the input given into other attributes, but I haven't found in the Unity's API an elegant way to update them automagically on the Inspector.

As an example, let's say I have a struct that has a divider value. Since I want to save division computations, I also have on the class a multiplicative inverse value that depends on the divider's, so I'd rather multiply instead of dividing.

Example Code Snippet:

[Serializable]
public struct SomeNumbers
{
    [SerializeField] private float divider;
    private float multiplicativeInverse;

    /// When the divider is set, the multiplicative inverse is also set.
    public float Divider
    {
        get { return divider; }
        set
        {
            divider = value;
            multiplicativeInverse = (1f / divider);
        }
    }

    public float MultiplicativeInverse
    {
        get { return multiplicativeInverse; }
        private set { multiplicativeInverse = value; }
    }

    /// Constructor.
    public SomeNumbers(float divider) : this()
    {
        Divider = divider;
    }
}

public class ExampleScript : MonoBehaviour
{
    public float value;
    public SomeNumbers numbers;

    void Update()
    {
        float result = (value * numbers.MultiplicativeInverse); /// Instead of (value / numbers.divider)...
        Debug.Log("Result: " + result.ToString());
    }
}

What I'd like, is that each time I change the divider's field, the value under the hood (this case the multiplicative inverse) also gets changed, as if I used the Divider's setter. Since the idea is to have an independent data type, the approach of using OnValidate on a class that contains this struct would not be applicable, since that would be a hard case.

I could also set the Divider's setter on each class at Start/Awake do that for me, but that would be prone to be forgotten. I know about Property Drawers
, but I am not sure if that would be the right approach.

I hope the question was clear enough, if not make me know so I correct it. Thanks in advance.

sentences:
Height Map vs 3D Model Mesh I'm currently working on a 3D PC game (written in C++ and DirectX 9.0) and I'm trying to find the best way to store level data in the memory.

The game's action takes place under the ground, so there's always a ceiling above the player. The ground is rather bumpy and there are things like stalagmites present at all times. Levels are small-ish in size and mostly look like corridors. Here are the options that I've managed to find so far:

Two height maps stored on the hard drive as either a bitmap or binary/text file. One height map for the ceiling (top), one for the ground.

OR

A single 3D mesh in some 3D model format (say, .fbx, .x, .obj whatever).

How should I approach level data storage? What would my best option be, performance-wise speaking? I'm also having some trouble when it comes to texturing a level loaded via a height map; using a 3D model makes texturing a breeze.

Thanks!

sentences:
Pathfinding in a 2D "sidescrolling" strategy game I've been thinking up a real-time strategy game that plays on a platformer type of map. The collidable portion of these maps will be made up of square tiles. I've done A* pathfinding in top down tile based games before, but I'm unsure how to lay out my tile map in such a way that allows for easy pathfinding. I've thought up some examples, but I'm not sure if it's the right way to go about it, so I thought I'd throw it out here and see if someone who knows what they're doing can give me some tips.

The first solution I thought of was to use a 2D array storing all of the tiles and empty space, similar to what I would most definitely do in a top down tile based strategy game. The 2D grid would be invisible in the background but really store whether each grid section is empty, or has a tile on it. like this:

In this example I'm unsure as to how I would pathfind up hills, or in that specific example, determine that a wall is too high to cross. Lets say that dude can jump over 1 tile high blocks, but 2 tiles is too much. How would I effectively determine that through a pathfinding algorithm?

The other example I was thinking of was to place pathfinding nodes on top of traversible terrain, like this:

Each node might be able to give directions or commands on how to get to the next (Like the need to jump to cross a gap, or it's faster to go under rather than over, etc). Now I would want to do this logically through code, and not manually place them at design time.

This might be a better solution, but something I'm thinking of in this game is to have destructable terrain. Say an explosion happens and leaves a big hole like this:

Suddenly those nodes I placed earlier won't work. I'd need to remake them on the fly. In this case the 2D grid sounds like the better option since I can just flip the value of that tile from full to empty.

So hopefully those 2 examples made sense, and I'd like some opinions on which might be the best option, or even if there's some other solution I didn't think about I would be glad to hear it! I'm using Unity if that helps.

I just want to get this design choice out of the way early, as it would be a pain to have to tear it apart later.

Thanks!

sentences:
Moving sprites based on Delta time - consistent movement across all devices with different resolutions This is the formula I am currently using to move my sprites across the screen:

Examples below only deal with X coordinates to keeps things as short as possible.

Initial variable declarations:

float frames_per_second = 30;         //Set this to target frames per second, 30 for this example.
float dt = 1/frames_per_second;       //Delta
float spriteXGrid;                    //Sprite's position on a grid (grid can be any explicit value, I use something simple like 800 x 600)
float spriteXScreen;                  //Sprite's actual final position in screen coordinates
float spriteXTime=5;                  //Time variable.  This is in seconds and is the amount of time the sprite should take to traverse the screen
float spriteXVel=1/spriteXTime;       //Velocity value used in conjunction with time value to calculate new position

To set my sprite's initial position I simply do this:

spriteXGrid = (pos/800);           //Where pos is the position on the grid (0-800) and 800 is the grid size that I chose to work with.
spriteXScreen=spriteXGrid*width;  //To convert to actual screen coordinates - where width is the actual width of the device currently running on.

Then to move my sprite, I do this:

spriteXGrid = spriteXGrid + (spriteXVel * dt);  //Update sprite's position on the grid
spriteXScreen=spriteXGrid*width;                //And convert to screen coordinates (again, width is the screen width of the current device)

Then I just use the spriteXScreen variable to plot the sprite, something like:

sprite.drawSprite(spriteXScreen,0);            //this is from a custom class I wrote that takes in sprite's x and y coordinate and draws it there.

My question is, is there an easier way I can do this?!  It's a nightmare to manage when it comes to collision detection etc.... because, you have 2 different coordinates, the 'screen' one (which I would describe as 'superficial'), and the 'grid' one which is needed for all the good stuff, and is a nightmare to actually work out and work with.

is there anyway I can just do something like:

spriteXScreen+='some value'

Which would allow my sprite to move across the screen in the same amount of time on all devices?

(I mean I can't just say move it by 1 pixel, because if I move 400 pixels in say 5 seconds on a 400 pixel wide screen, the sprite will have passed the whole screen in those 5 seconds, but on an 800 pixel wide screen it would have only passed halfway in the same amount of time).

The whole business of have a 'grid' coordinate and having to convert it to a 'screen' coordinate is extremely irritating and I'm wondering if I'm doing this all wrong....?

Suggestions and solutions would be very welcome

sentences:
How to include compiled GameMonkey script in final game release instead of script source? I use GameMonkey to script the game play and use the script from my C\C++ host game.
I've got it working the script with my engine.
But I have a question. In these engines like Torque, Unreal, Unity, etc. when you finally build the game, all the scripts are also compiled and you don't need to ship all the script source.

How do I do that?
Right now my engine needs GameMonkey source script to process the game logic.

Thanks

sentences:
If condition true, but code is not executed in Unity I have a script which triggers a movement when a rotation is completed. The script casts the Euler angle of a transform to an int. If it is true, the condition is executed. For some weird reason, the code in the if condition does not execute, even if the condition is true. I have confirmed the condition is true through both my compiler and the debug log.

Here is my code:

if(rotationInitiate)
{
    transform.eulerAngles = Vector3.Slerp(transform.eulerAngles,
        new Vector3(0, 0, angleOfRotation), Time.deltaTime * speedOfRotation);

    Debug.Log(transform.eulerAngles.z);

    if((int)transform.eulerAngles.z == 180)
    {
        Debug.Log("Hurray we have successfully executed the if statement");

        // More rotation stuff
    }
}

As you can see by my log, the angle returns an exact value of 180, but does not enter the if statement to perform the second log output:

Why might my if statement not be executing?

sentences:
Custom key binding/mapping Currently I am starting to develop my first serious game. Before the games are all training, and learning how to do things in a good way. Unfortunatly, I've missed a big part in my preparation: Key binding.

Currently I am trying to figure out how I can bind keys to action for each scene in my game.
For example:
If the user presses the JumpButton during the GameScene, the avatar should jump, but pressing the same key in a MenuScene, the currently selected menuitem should be activated.

Which key the JumpButton is, should the user be able to set. But the behaviour should be always the same.

Here is my first, and I think very naviive idea:

I am having a HashMap with HashMap where Key is the key on the Keyboard and ACTION is just an enumValue.
When I am in the scene, and a button is pressed, I will take that button, and ask the HashMap which action is bind to the button. using a switch I can now determine what to do.
In my mind there is a little gap.. I have ONE action per Button, maybe named: ACTION_PLAYER_JUMP as an enumValue, and when I am in a GameScene this is okay, but in a MenuScene this ACTION_PLAYER_JUMP is not a very nice name... I do not want to have all bindings two times, just for better names.

Can someone tell me how to fix this, or a better system? I am sure there is a much better system for handling those bindings.

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:
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:
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:
GameMaker Android project crashes on IAP I'm trying to implement a simple IAP in my GameMaker project for Android.
The "store" is a simple room with a button, with this code linked to the "Left mouse button released" event:

if iap_status() == iap_status_available
{
    var product = "donation";
    if ds_map_find_value(global.purchaseMap, product) == 0
    {
        iap_acquire(product, "");
    }
}
else
{
   show_message_async("Store is not available.");
}

and another object with this code linked to the "IAP" event:

var val = ds_map_find_value(iap_data, "type");

switch (val)
{
    case iap_ev_purchase:
        var map = ds_map_create();
        var purchase_id = ds_map_find_value(iap_data, "index");
        iap_purchase_details(purchase_id, map);
        if ds_map_find_value(map, "status") == iap_purchased
        {
            var product_id = ds_map_find_value(map, "product");
            ds_map_replace(global.purchaseMap, product_id, 1);
            switch(product_id)
            {
                case "donation":
                    iap_consume(product_id);
                break;
            }
        }
        ds_map_destroy(map);
    break;

    case iap_ev_consume:
        var product_id = ds_map_find_value(iap_data, "product");
        if ds_map_find_value(iap_data, "consumed")
        {
            ds_map_replace(global.purchaseMap, product_id, 0);

        }
    break;
}

ds_map_secure_save(global.purchaseMap, "iap_data.json");

The IAP is correctly called when the button is pressed, but when the transaction is completed, the game crashes and then crashes at every launch. If I cancel the transaction it doesn't crashes, so I was suspecting the case iap_ev_consume: part to be at fault.

I followed this tutorial: https://help.yoyogames.com/hc/en-us/articles/216755198-In-App-Purchases-Example

Why does my game crashes when an IAP is performed?

sentences:
Why does my game look different on my mobile device than in the editor? I am new to Unreal Engine. My game in mobile looks totally different than in Unreal Engine editor.
In Editor:
In Mobile:
Is this a symptom of something obvious? How can I make it so that what I'll see in the editor will be the same thing that I'll see on my mobile device?

sentences:
Applicability of Business Architectures in XNA 4 I've done a lot of C# programming and the architecture we use of late is a MVC => PresentationService => Domain Service And/OR DataService => Repository with a UnitOfWork and a messaging bus.  In web applications this gives a pretty clean and flexible design that's extensible but is also stateless.

I've been working on a 2D starter project in XNA and I find these layers are still useful until I get to the interface and start trying to deal with knowing the states of everything, keeping the sprites and bounding rectangles and detecting clicks and drags.

What patterns should I be looking at that maybe I just wasn't exposed to doing enterprise architecture but are clearly needed in a game.

Which concepts might I need to let go of when doing a game because they are not applicable.

sentences:
How to make an enemy projectile head to the player's position with constant speed How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do with vectors but I don't really have an idea how to do it. My current implementation of the speed is getting the difference of the x and y positions so what happens is that the projectile will be slower the nearer the player is to the enemy. I set the projectile's speed using the code below:

projectile.moveSpeedX = Math.abs(position.x - targetPlayer.position.x);
projectile.moveSpeedY = Math.abs(position.y - targetPlayer.position.y);

Below is the contents of the update(float delta) method of the projectile:

if(xdirection == LEFT) {
    position.x -= moveSpeedX * delta;
}
else if(xdirection == RIGHT) {
    position.x += moveSpeedX * delta;
}

if(ydirection == UP){
    position.y -= moveSpeedY * delta;
}
else if(ydirection == DOWN) {
    position.y += moveSpeedY * delta;
}

The movement will slow down when the player is near the enemy since the distance between them is small. The speed is the problem although this already makes the projectile head to the player's position.

sentences:
Problem picking up a value, Delegate I'm having trouble passing values that are inside an int function to an onclick delegate.

this script causes the object to move in vector3 (-1 to the left and 1 to the right), these two values are inside the (int value), but I am trying to pass them to a delegate, but when inserting it it is adding different values than being in the script

video of the problem

private int index, index2 = 0;
[SerializeField]
private Vector3[] Myposic1, Myposic2;
[SerializeField]
private Button left, right;//here I change the positions of Myposic1, Myposic2
[SerializeField]
private float time;
public int slide = 0;//index between Myposic1, Myposic2.

void Update() {
    call();
}

public void previous()
{
    slide--;
    call();
}

    public void next()
{
    slide++;
    call();
}

void call()
{
    if (slide <= 0)
    {
        slide = 0;
    }

    if (slide >= 1)
    {
        slide = 1;
    }

    if (slide == 0)
    {
        left.onClick.AddListener(delegate { player(-1); });
        right.onClick.AddListener(delegate { player(1); });
        this.transform.position = Vector3.Lerp (this.transform.position, Myposic1[index], Time.deltaTime*time);
        if (index == Myposic1.Length - 1)
            right.interactable = false;
        else
            right.interactable = true;

        if (index == 0)
            left.interactable = false;
        else
            left.interactable = true;
        Debug.Log("1");
    }

    if (slide == 1)
    {
        left.onClick.AddListener(delegate { player2(-1); });
        right.onClick.AddListener(delegate { player2(1); });
        this.transform.position = Vector3.Lerp (this.transform.position, Myposic2 [index2], Time.deltaTime*time);
        if (index2 == Myposic2.Length - 1)
            right.interactable = false;
        else
            right.interactable = true;

        if (index2 == 0)
            left.interactable = false;
        else
            left.interactable = true;
        Debug.Log("2");
    }
}

public void player(int valor) {
    index = index + valor;
}

public void player2(int valor2) {
    index2 = index2 + valor2;
}

sentences:
Full-motion transparentized video clips This is sort of a question following onto a previous question I wrote specifically targeting XNA. Understanding that it's an involved enough process that I'd want to manage memory myself, I'm now approaching from C++. But the language isn't directly relevant to the process...

For the game Ghost Trick: Phantom Detective, the developers found that the DS' 3D renderer wasn't fast enough to render the game's characters with the depth they wanted. So, since the whole game takes place from a side viewpoint, they pre-rendered the characters' many lengthy, acted-out animations, so the whole game is technically 2D. This wasn't the first time such a thing was done, but being a "drama", they tended to have longer and smoother animations than say, a top-down shooter.

What I'm targeting is something similar, but on the desktop; my game would basically consist of several static, basic sprites serving as backgrounds, and then characters that are rendered through FMV, with an Alpha color component (likely a 24fps video made through greenscreening, then converted to whatever suits the engine best). What may make my thinking different from Ghost Trick is that on a Desktop, the character sizes would be much bigger. Currently, I'm trying to think through what people may have tried for this approach previously.

The thick-skulled straightforward approach would be to convert the video files into PNG spritesheets, in some kind of format that crops down to just a box that is non-transparent in all X and Y lines. If this is all in graphics memory at once, it would kind of add up though. If RGBA is 32 bits, an 1152x800 character's 4-second idle animation at 24fps would be 345 MB, if my math is right. One could of course save more memory by reducing character detail (ie, scaling a smaller video up) or by having a lower framerate.
A hybrid approach of that might involve keeping the frames compressed in-memory, and only keeping about 5 to 10 uncompressed at a time. I feel kind of worried that this would keep the game going through a lot of CPU/GPU work while not very much is happening, though.
Since only one of these characters is going to be onscreen at a time, my primary thought was to simply treat it as a video, and find a way to play it using the FFMPEG/LibAV libraries. It's obvious the FFMPEG developers don't have issues like keeping a 2-hour movie's frames in graphics memory, so it would certainly use better memory-management techniques. But, part of what makes this difficult for me is that I'm a simplistic Visual Studio developer who's had a lot of difficulty getting those libraries working; even being able to compile the example files after finding a pre-compiled Windows DLL. I'd also have to modify their standard operation so that videos can loop themselves, or switch video file on a dime.

Since this is an area I'm mostly figuring out for myself and I haven't found many resources on the topic, I was curious if anyone else had input in which I miss something obvious, or what they feel would be the most logical approach.

If it matters, I'm planning to try this project in either SDL or SFML. I'm a pretty experienced programmer who's just been avoiding C++ a bit longer than I should have, so I'm trying to dive back in for more practice with this project.

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:
Benefits of implementing systems like classes instead of just functions In an Entity System I am making, there is a central class called World, which stores all component instances. It's a dictionary-of-arrays, and entity ids are indexes for the arrays.

To access a component of an entity with id = 3 you would do this: world.storage["ComponentType"][3].

So, each loop of the game, these arrays would be fed to their respected systems (  movement(world.storage["Position"], world.storage["Velocity"]) ).

Now, I don't see why systems couldn't be implemented just as functions, as I showed. What optimizations can be made by using classes with data and methods (caching)?

Also, these systems would need to iterate over all the entities that exist, doesn't this make entity frameworks much slower than regular inheritance based engines? Why do some people "register" systems to the World class?

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:
Gathering Stats from a StarCraft 2 game One of the maps I've played, nicknamed SotiS (DoTA in SC2) has the ability to maintain stats, which are sent back to their own server.

Does anybody know how this is done?

sentences:
How to draw circular sectors on polar grid only within bounding rectangle I'm attempting to optimize a game map by only drawing circular & annular sectors within the current viewable rectangle bounds.

The solution should cover both cases in the example graphic (Figs 1 & 2). I have a version of Figure 1 working which converts the rectangle vertices to polar coordinates and calculates start/end angles and inner & outer radii to draw within, however this does not work when the rect overlaps the centre of the circle (Fig 2).

Drawing is currently being done with JavaScript & SVG, so an example using those would be ideal (or just the maths portion in JS). Also, each of the 'wedges' in the grid should be drawn separately, as they each need to be referenced as discrete objects by the engine.

sentences:
2D Sidescroller Gravity Ive looked up implementing gravity on several sites. Subtract a constant gravity (9.8 * DeltaTime) from the velocity each frame. My problem is, when implementing it as they say, when walking off a ledge the player will float off, not vertically, just accelerates too slowly as he falls.

World->Gravity = -9.8 * PixelsToMeters;   // PixelsToMeters = 32
CurrentAcceleration = Vector2(0.0f, World->Gravity);
CurrentVelocity = (CurrentAcceleration * DeltaTime) + PrevVelocity;
Vector2 halfATSq = currentAcceleration * 0.5f * Square(DeltaTime);
Vector2 vt = CurrentVelocity * DeltaTime;
CurrentDelta = halfATSq + vt;
CurrentPosition += CurrentDelta;

Now the thing is, with the 1/2at^2 + vt + p calculation, the character does fall about 20 meters in 2 seconds, (I think those are the numbers I used, that was a couple hours ago), so it seems the calculations are right. Ive played quite a few side scrollers and none of them have this floating feel.

So, I tried calculating the gravity based on a TimeInAir variable that multiplies the World->Gravity on the third line, instead of DeltaTime.

CurrentVelocity = Vector2(currentAcceleration.X * DeltaTime, currentAcceleration.Y * TimeInAir) + PrevVelocity;

He no longer floats, he falls as expected. Even jumping looks better. However, now he falls 20 meters in 1 second. Ill deal with this, it is only a game and not reality.

Question is, why is it that this works instead of the original code? Or do I have an error somewhere? Because I have to rework the physics code to get it to look right for everything, instead of just using the basic equations. Is it because its all calculated in pixels? Im wondering if I need to add a full gravity to the velocity on the first frame instead of gravity * DeltaTime? This works for falling off a ledge, but not for jumping.

Im testing these questions as I think of them in my code, and still not getting it. These ideas dont seem to work. Thanks for looking and whatever help or ideas you can give!

sentences:
How to handle slopes/bridges in a 2d grid turn based strategy game I was wondering about the following:

In a 2D turn-based strategy game (using some grid(i.e. tiles, isometric hexagons) as movement), what techniques do they use to determine where a character moves next, especially how this works when stuff is happening that as far as I can see cannot be so easily implemented using a two-dimensional grid, such as slopes/different heights of movement and also things like bridges that characters might both walk over or under, depending on how they approach it.

sentences:
How to run a long task without freezing my game? I have a component that is in charge of generating a level at runtime, and this is an operation that takes quite some time. As a consequence, I experience a hang when this operation is executed (when the scene is loaded).

This problem can be summarized to the fact that SceneManager.LoadSceneAsync in fact is not async at all in its second phase, when it initializes all the objects.

There are three approaches I have searched for and thought about:

Slicing the operation as explained on this video:

This is non-trivial, I would have to rewrite chunks of code for the sake of avoiding a few seconds hiccup at scene load. Furthermore, the person explaining in the video says that they changed Unity source code which I don't have access to.

Running the operation in a background thread:

This is definitely interesting, it would require minimal changes. The only problem is that at some point I have to create Unity objects (GameObject, Mesh etc) and this is not possible when outside Unity thread.

I was thinking more or less of this code to be run on the background thread:

class Builder
{
    public void Build()
    {
        // 1. do something long

        // 2. create Unity object with result from #1
        // something like that
        // await RunInUnitySynchronizationContext(() => new GameObject(...))

        // 3. do extra stuff on the result of #2
    }
}

The thing is I have no idea at all on how that second step should be written, if possible at all.

Use a non-animated Loading screen and wait for it to finish:

This is the simplest and effectively does away with the problem by 'just' hiding it.

Question:

What's an effective approach to solve this problem?

sentences:
How to Access a Field of an Unknown Class if the Field Exists It's a very poorly worded question because I'm not exactly sure how to put it into words that are of appropriate number for a title. Read on for a better explanation. (Using Unity API, C#)

Basically, I have an AI class in a spaceship game. I can assign the AI a target GameObject, and the AI will look in the direction of and chase after it's target. I would like to make the AI be able to strafe in circles around the target. Since the AI always faces its target, I can simply TransformDirection(Vector2.left/right) and it will orbit the target nicely, but if the target is moving it always breaks orbit.

To combat this, I want to add the target's velocity to the strafe velocity of the AI. However, I have different classes for the player's ship and the AI ships whom also might be targeted by another AI. All of my ship classes have a field for the ship's velocity, but since they are different classes, I thought I may access the velocity field by doing a GetComponent() and passing some sort of predicate => T has a Vector2 field named "velocity". Is there some way to achieve this?

sentences:
Ray-Triangle Intersection Detection using Barycentric Coordinates I am attempting to convert the algorithm from http://www.cbloom.com/3d/techdocs/fast_ray_tri.txt to java code, but my solution does not function correctly.

The only intentional change I made was for the second point, my method accepts a unit vector instead of the other end of the line segment.

For now, all collision calculations are done in this one method (nothing is pre-calculated).

Any suggestions as to what I may have done wrong?

//collision with barycentric coordinates
boolean checkCollision(Vector3f rayStart, Vector3f rayDirection){

    Vector3f normal=new Vector3f().cross(new Vector3f(point1).sub(point0), new Vector3f(point2).sub(point0)).normalize();

    planeOffset=-normal.dot(point0);

    Vector3f
    edge1 = new Vector3f(point1).sub(point0),
    edge2 = new Vector3f(point2).sub(point1),
    edgePerp1 = new Vector3f().cross(normal, edge1),
    edgePerp2 = new Vector3f().cross(normal, edge2);

    float edgePlaneDist1 = edgePerp1.dot(point0),
                edgePlaneDist2 = edgePerp2.dot(point1);

    {
        float distance1=edgePerp1.dot(point2)-edgePlaneDist1;
        float distance2=edgePerp2.dot(point0)-edgePlaneDist2;

        edgePlaneDist1/=distance1;
        edgePlaneDist2/=distance2;

        edgePerp1.scale(1/distance1);
        edgePerp2.scale(1/distance2);
    }

    //point-plane distance
    float dFm=normal.dot(rayStart)-planeOffset;

    Vector3f rayEnd=new Vector3f(rayStart).add(new Vector3f(rayDirection).scale(30));

    float dTo=normal.dot(rayEnd)-planeOffset;

    float denom=dTo-dFm;

    Vector3f temp=new Vector3f(rayStart).scale(dTo).add(rayEnd.scale(dFm));

    float uTimesDenom = edgePerp1.dot(temp) - edgePlaneDist1 * denom;

    if ( uTimesDenom < 0 || uTimesDenom > denom )
    {
        // off triangle
        return false;
    }

    float vTimesDenom = edgePerp2.dot(temp) - edgePlaneDist2 * denom;

    if ( vTimesDenom < 0 || (uTimesDenom+vTimesDenom) > denom )
    {
        // off triangle
        return false;
    }

    return true;

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:
How to create art assets for a 3d avatar editor I am currently prototyping an idea for an iPhone game. I'd like to create an avatar editor inside the game so that the player can create a 3d avatar face and modify certain features (using slider controls), such as nose shape, eye color, mouth size, etc. This has been done in several games, but what I'm looking to do would be fairly cartoon-ish/caricature-ish, similar to the Mii editor on the Nintendo Wii (http://www.myavatareditor.com/). I'd also like the final result to have the ability to use some canned animations, such as simple speech animations, smiling, frowning, etc.

I am not an artist, so I would be unable to create these assets, but what kind of effort is required for an artist to create the 3d models necessary for this type of game? Also what mechanism would be required to tweak the face's characteristics? Would you use bones or morph targets? How would the final result be animated? Would facial animation use bones or morph targets?

I've seen several tools that do this sort of thing too, such as FacialStudio. Are there any facial generation tools out there you'd recommend for generating some base content for this game, or should I just hire an artist to do this type of work.

Thanks!

sentences:
How would one create a "start button" on a website similar to some Korean games? Some games have buttons that would actually let you click them and you'd log right into the game.  How does the web browser get permission to do this without plugins? Perhaps the client  registers a custom protocol URL?

They used to be popular a few years back - I can't remember any implementations off the top of my head. On desktop browsers, if your game client was installed clicking 'Play' on the home page would boot up the game begin it with you already signed in. It was popular with arcade games so you could browse the sessions on the web and then simply hit 'Start'. You didn't need any browser plugins.

sentences:
OpenGL - Bind Buffer Arrays question So this is probably a simple question:

But how come sometimes I see it like this:

GLuint vbuffer;
glGenBuffers(1, &vbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vbuffer);

but when done in multiples:

GLuint VBOs[2]
glGenBuffers(2, VBOs);
glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);

Im curious why glGenBuffers has a & in the first one, and not in the second case. Is it because arrays are always passed by reference? and is vbuffer a POINTER to something or just a simple data structure (GLint in this case).

sentences:
solid color to sprite (javascript game) Hi I recently created a javascript game, in this game, math random is used to pick a random shape.
The shapes are in strings, and the associated numbers within the string are then used to show a color.
Is there any way to replace the simple hex colors with an image?
For example:
else if (shape === "H"){
    return [[8,8,8],
            [8,8,8],
            [8,8,8]];

The "8" ties into the following string to get the #F10B38 color.
const color = [null,"#FF2D00","#FF9300","#51FF00","#00FF93","#0087FF","#4E49A7","#9649A7","#F10B38"];

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: MySQL - Storing Character Inventory What is the best way of storing the character's inventory (consisting of each item having a value for type and quantity). The only methods I can think of is to use the "text" type of field then parse the value from that whenever the inventory is loaded. Is there a better method or data structure?

sentences:
how to use .getTransform to get the current coordinates of translated/rotating object I’m stuck trying to figure out how to use .getTransform to determine what pointA (x1,y1) and pointB (x2,y2) of each of my lines would be after translate and rotate. I've found other answers but they don't seem to target exactly what I need nor do I fully understand the matrix that gets returned.
From the snippet provided you can see that my lines always return their original values. I know there's a formula for this, or a way to use the matrix, I just don't know it or how I would implement it.
What I need is the start and end points of every line. The plan will be to rotate (animated spinning) them to any angle and have those coordinates get used for ray casting. I've previously done this from a center point out or one direction to another but not with so many lines using the rotate method.
I have tried the same thing with boxes and just can't seem to grasp how I can get the rotated coordinates.
Here's the snippet

let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d")
canvas.width = 200;
canvas.height = 180;

class Rays {
  constructor(x1, y1, x2, y2) {
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
  }
  draw() {
    ctx.save();
    ctx.translate(canvas.width/2,canvas.height/2);
    ctx.rotate(45 * (Math.PI/180))
    ctx.beginPath();
    ctx.strokeStyle = 'black';
    ctx.moveTo(this.x1, this.y1)
    ctx.lineTo(this.x2, this.y2)
    ctx.stroke();
    ctx.closePath();
    ctx.restore();
  }
}

let rays = [];
function createRays() {
  //due to translate i have to push some lines in the negative and some positive  this causes an overlap of one line in the center.
  for (let i=0; i < 26; i++) {
    let x1 =  i < 13 ? -10 * i : i * 10 - canvas.width/2 - 20;
    let y1 =  -canvas.height;
    let x2 =  i < 13 ? -10 * i : i * 10 - canvas.width/2 - 20;
    let y2 =  canvas.height;
    rays.push(new Rays(x1, y1, x2, y2));
  }
}
//enter angle here
createRays();

let count = 0; //just used to stop it from constantly console logging rays.x1

function drawRays() {
  for (let i=0;i<rays.length; i++) {
    rays[i].draw();
    count < 1 ? console.log(rays[i].x1) : false;
  }
  count++
}
drawRays();

console.log(ctx.getTransform())

function animate() {
    ctx.clearRect(0, 0, canvas.width, canvas.height)
    ctx.fillStyle = "lightgrey";
    ctx.fillRect(0,0,canvas.width,canvas.height)
    drawRays();
    requestAnimationFrame(animate)
}
animate()
<canvas id="canvas"></canvas>

sentences: How do I add freeglut to a Visual Studio project? I am working on making a game for Windows in c++. I have previously made games for Ubuntu using freeglut, and I found freeglut for windows, but when I added it to the Configuration Properties\VC++ Directories\Library Directories tab in visual studio, visual studio complains about 'undefined reference' whenever I use a freeglut method. Does anyone have a solution?

sentences:
Compare responsibility among copy-left license I have checked out many source about the free and open source licenses (Wikipedia), but what I really want to know what is our responsibility when we use the open source that has these licenses.
For example:

Zlib:
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required. (from Irrlicht's readme.txt file)

LGPL:
dynamically linking to it from a closed source app is allowed, but also means any changes made to soft (which has LGPL) itself do need to be made available publicly. (source: from a comment)

GPL: The license for libmad is GPL, which means that in order to use it your application must also be GPL (source: from SDL Mixer README.txt file)

Please make a quick compare like that so I can understand fully about my responsibly when I use an open source software for my project.

PS:
In this question, I like to limit the comparison to the most popular copy-left licenses:

Apache License
BSD License
GNU General Public License
GNU Lesser General Public License
MIT license
zlib/libpng license

sentences:
FBX models into Directx 11 I've just ported over and updated a bunch of FBX model loading code I had that worked with Direct X 10 to try and make it work with Direct X 11. Since that time, the FBX SDK I was using has been updated.

In my old program I linked to the following lib:

fbxsdk-2012.2-mdd.lib

Now, clearly I can't link to this as I don't have 2012.2 on my system. So, my thinking would be simply changing 2012.2 to 2014.1, but this didn't work and lead to the following error:

error LNK1104: cannot open file 'fbxsdk-2014.1-mdd.lib'

So I tried to some googleing to see what the updated version of fbxsdk-2012.2-mdd.lib is. But I can't find anything. I tried taking out linking ot the 2014.1 lib but I get the following errors:

  Error 36  error LNK2019: unresolved external symbol "void __cdecl fbxsdk_2014_1::FbxAssert(char const *,char const *,unsigned int,char const *)" (?FbxAssert@fbxsdk_2014_1@@YAXPBD0I0@Z) referenced in function "public: int & __thiscall fbxsdk_2014_1::FbxArray::operatorconst " (??A?$FbxArray@H@fbxsdk_2014_1@@QBEAAHH@Z)

So, looking in the FBX sample directory I opened up the ViewScene sample to see what it lib it linked to and I see that it wanted the following:

libfbxsdk-md.lib

So I did the same. But, my program claims it cannot open the file. And I'm at a loss as to what to do next.

Has anyone successfully managed to load FBX models into a Directx 11 application using 2014.1? If so, what do I need to do to get the correct lib linked?

sentences:
Is it possible to crop a render texture in unity? Basically what I want to do is, take the source render texture from OnRenderImage and crop it (continuously). I've already achieved this by using ReadPixels to a texture however this has a negative impact in my FPS. Is there any other way that is less expensive?

Here's an example of what I want to do:

sentences:
How to push an object? I would like to "push" an object using a raycast.
With the following code, the problem is that depending of player rotation, i don't push the object but i pull it.

What am i wrong ?

Vector3 fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast (RayCastSpawnOut.transform.position, fwd, out hit, 5)) {
                if (hit.transform.tag == "MyObjectTag") {
                    GameObject myobj = hit.transform.gameObject;
                    Rigidbody myobj_rb = myobj.GetComponent<Rigidbody> ();
                    Vector3 dir = transform.position - myobj_rb.transform.position;
                    dir.Normalize(); //Normalize to get the correct direction
                    myobj_rb.AddRelativeForce (dir * 0.5f, ForceMode.Impulse);
                }
            }

sentences:
Naming conventions for external resources? While we develop games, then we have utilize several external resources, for example

Image
Sound
Animation
Sprite Sheet

Is there any good naming convention regarding these external resources?

sentences:
Multiplayer tile based movement collisions cause client prediction to fail I am developing a tile-based online multiplayer game, but I am stuck. Players can move across the grid in the four cardinal directions, as can enemies, but two players/enemies cannot occupy the same tile at the same time. Positions of all players/enemies are synced for all clients.

My current implementation of movement: Clients send a 'request to move' to the server whenever they are stationary on a tile.

I have implemented client prediction. When a button is pressed to move, the client shows their character immediately moving in that direction, as opposed to waiting for confirmation from the server, preventing lag between player input and visible results.

The issue arises when the player attempts to move to a position that will soon be occupied. For example, the player presses up when an enemy is very close to entering the tile above the player (though they can't currently know that the enemy will choose that tile next). Locally this is confirmed and the upwards animation begins, but by the time the request to move up arrives at the server, the tile is no longer free, and the player is not moved up on the server.

This creates a situation where the player's local position is out of sync with that of the server. My current solution to this is snapping the local player back to the server's position when this happens, but this looks awful. It seems to be happening a lot, making the game nearly unplayable.

Is there a way around this?
Any help would be very much appreciated, thanks.

Some other notes: I send updates from the server 10 times a second, which consist of every object's position (and other stuff). When a movement event is processed, the object's position is updated immediately, even though an animation follows.

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:
Upper & Lower angular limits on Y and Z axes My Task:
I'm trying to replicate this project. I'm using unity as my physics engine.
Currently I'm still learning how to work with the different joints unity has to offer. The type of movement I'm looking for is where a body is connected to only one other body and its relative movement can be limited based on angles on different axes.

My Problem: I'm using Configurable joints for my movement restrictions. The Low Angular X Limit and High Angular X Limit does exactly what I'm looking for since it can have a different uppper and lower rotation limit. Looking at the documentation, it seems that this can only be done on the X axis. The Y and Z axes only have a Angular Y Limit or Angular Z Limit which set the upper as the opposite of the lower limit.

My Question: Is it possible for the Y and Z axes to have the same lower-upper limit system that the X axis has? Is the use of configurable joint good for this task?

Thanks in advance :)

sentences:
How does one avoid the "staircase effect" in pixel art motion? I am rendering sprites at exact pixel coordinates to avoid the blurring effect caused by antialiasing (the sprites are pixel-art and would look awful if filtered). However, since the movement of the objects involves variable velocity, gravity, and physical interactions, the trajectory is computed with subpixel precision.

At large enough screenspace velocities (vΔt larger than 2 or 3 pixels) this works very well. However, when velocity is small, a noticeable staircase effect can appear, especially along diagonal lines. This is no longer a problem at very slow screenspace velocities (v << 1 pixel per second) so I am only looking for a solution for intermediate velocity values.

On the left is the plotted trajectory for a large velocity, obtained by simple rounding of the object coordinates. In the middle you can see what happens when velocity becomes smaller, and the staircase effect I am talking about. On the right, the locus of the trajectory I would like to get.

I am interested in algorithm ideas to filter the trajectory in order to minimise the aliasing, while retaining the original behaviour at large and small velocities. I have access to Δt, instant position and velocity, as well as an arbitrary number of previous values, but since it is a realtime simulation, I do not know about future values (though if necessary, an estimation could be extrapolated under certain assumptions). Note that because of the physics simulation, sudden direction changes can also happen.

sentences:
Names for specific regions on earth for global RTS I am developing a global real-time strategy game that uses Google Maps to represent the earth. I am cutting up the globe into 32 squares with each square exactly 45 degrees latitude and longitude. The squares are also aligned to the grid starting from 0,0.

I would like to give each square a nice name that meets the following criteria (in order of priority):

Every square name must be unique
Best representation of the land and water contained in the square. Any name is acceptable (country, continent, significant geology, significant body of water) but it must be the most prominent thing in that square
A combination of names is acceptable if there are 2 or more prominent / recognisable elements in the square
As short as possible so it can be easy to remember / type
Exacting precision is not important - this is a game, so the names should be major things in those squares that most lay people on earth would immediately recognise or at least be familiar with
If possible, the least offensive / non-contested / most globally accepted name of the main region in the square

I have come up with the following, but I would like to know if there is a system already out there that better meets my needs (note that I've accidentally swapped my lat/lngs - sorry!). Alternatively, if anyone has much more knowledge of geology/geography than I do, please suggest a better naming convention and names as some of the names are too long and many contain more country names than I'm happy with (I'd prefer neutral region names):

Here is a map of the world with the 45 degree grid squares shown to help you to visualise the problem:

Edit: Influenced by Phillip's answer, I have revised the approach using continents and oceans to be as neutral as possible:

The only grid squares I'm not 100% sure about are "Middle East" (is this still PC, or is there a better term - Arabia perhaps?), and the Antarctic territories (but since no-one lives there permanently and most countries seem to dispute Antarctic ownership anyway, I think I'm less concerned about this one). Please let me know if this approach is now as appropriate and neutral as possible.

Edit: Further updated based on Theraot's comments:

Notes:

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:
How can I simulate light using mask images on the iPad? Possible Duplicate:
  Can I achieve a torchlight effect (lighter area around a light source) in a 2D game?

I want to have a picture as a background, say this:

Then I would like to apply a mask, just a circle with blurred edges, so it looks like this:

The idea is to simulate something emitting. Is this a good way of simulating light or should I use another method? And if so how? And I'm not really sure how to apply this method.

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

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

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

sentences:
Multi Threading In Update Loop Okay so I am working on a game engine and this was my previous game loop:

Game::Run()
{
    While(!m_GameDone)
        Client.Update();
        LocalServer.Update();
}

but what I want to do is:

Game:Run()
{
    ClientThread = new CThread(...);
    ServerThread = new CThread(...);
    ClientThread.StartTask(Client::Run);
    ServerThread.StartTask(LocalServer::Run);
    CThreadSystem.WaitForTasksToFinish();
    return;
}

And then Client::Run and Server::Run would be:

Client::Run()
{
    while(!m_Gamedone)
    {
        this.Update();
        this.Render();
    }
}
Server::Run()
{
    while(!m_Gamedone)
        this.Update
}

So my two big questions are.. Is this a good idea? and How do I make a thread execute a function from a class instance?
The threading system I am using right now is WinAPI and XTL (not STL).

UPDATE:

Okay, everyone wants to tell me about locks and data sync.
The client and server threads DO NOT SHARE ANY COMMON DATA/OBJECTS.
The client and server threads have their own serialized update loops and don't use any common classes or structures. I just wanted to know how to start a thread with a function in class instance scope.

sentences:
Steering behavior using nodes I've started rewriting some of my code (npcs, navigation and such) and I need some help with my new navigation system.

Basically the way it works is: the game generates a random dungeon. For example:

With the black representing walls. After the map generates, it goes through the map and finds all the outward corners and places a node on them. The end result is something like this:

When it finishes that, it goes through the nodes and connects the nodes that have a clear line of sight to each other. Like this:

So it works like this: enemies use the nodes to navigate their way around the map. When they want to do things like wander, they choose a random node (one they can see) and go to it. Every node has a list of the nodes it's connected to, so from there they choose another node and head towards that one. The enemies keep a list of the previous three node locations, so they don't wander in circles (if there's only one node connected to the current node, they head back.)

The whole thing is based on line of sight, basically. However, there are some limitations, namely: movement. Creatures in my game have tile based movement and can only move in cardinal directions. I also need enemies to try to avoid each other and change direction based on stimuli (such as a change in "bravery" level, causing them to rush the player, retreat or stand their ground.)

Given all that, how can I calculate the ai's next move?

Edit: To be more clear: I want to know how I can have the ai calculate the direction it will move in next. So I need to know what kind of formula the ai needs to determine which tile is the best to get it to it's destination. Something that takes into account the target, other enemies (if there are any) and the bravery level of the ai (which will change player interactions and make them group with other enemies when their bravery is low and they're alone.)

Edit 2: Okay, let me change the question and add some information. My game is turn based, so I need to make steering behaviors work in a system where it can only move once per update (one tile length) and can only move up, down, left and right. I'm not sure how to do this, can you help me?

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:
Any way to interface methods in objects? Say I have object A, which has children B, C and D.

In OOP I would have A be an interface containing method action(), then I would have B, C and D implement A and, in their class definition, I would define the method in each of them in extremely different ways (as intended).

Is there a way to do something similar in GML? So far I can only think of making a script with an chain of if statements for every kind of action based on object_is_ancestor() which feels messy and unorganized to say the least.

Thank you for the help.

sentences:
How to draw texture with unlit effect on surface base texture I am writing a shader to my Unity game and I want to have effect this type of effect:

Base texture, for example, skin of character is a texture that will use shadows, lighting.
Second texture, unlit, it will not be using shadows, it will be moving and changing alpha intensity.
Second texture will be drawn after base texture.

Only unlit or surface shader looks bad, I think I must connect those two shaders, to make nice looking effect.

I wrote something this and I am stuck:

Shader "My/SurfaceUnlitBlend"
{
    Properties
    {
        _MainTex("Base", 2D) = "white" {}
        _MainColor("Main Texture Color", Color) = (1,1,1,1)
        _SecTex("Second Texture", 2D) = "white" {}
        _SecColor("Second Texture Color", Color) = (1,1,1,1)
        _SecTexAnimHSpeed("Second Texture Animation Horizontal Speed", Float) = 0
        _SecTexAnimVSpeed("Second Texture Animation Vertical Speed", Float) = 0
        _BlendValueModifier("Blend Value Modifier", Range(0.5, 2.0)) = 1
        _Glossiness("Smoothness", Range(0,1)) = 0.5
        _Metallic("Metallic", Range(0,1)) = 0.0
    }

    SubShader
    {
        Tags{ "RenderType" = "Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Standard fullforwardshadows
        #pragma target 3.0

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_SecTex;
        };

        sampler2D _MainTex;
        sampler2D _SecTex;

        fixed4 _MainColor;
        fixed4 _SecColor;

        fixed _SecTexAnimHSpeed;
        fixed _SecTexAnimVSpeed;

        fixed _BlendValueModifier;
        half _Glossiness;
        half _Metallic;

        UNITY_INSTANCING_CBUFFER_START(Props)
        UNITY_INSTANCING_CBUFFER_END

        void surf(Input IN, inout SurfaceOutputStandard o)
        {
            // Albedo comes from a texture tinted by color
            fixed2 moveVector = fixed2(_SecTexAnimHSpeed, _SecTexAnimVSpeed);
            moveVector *= _Time[1];

            //set blend modifier according to time
            float blendLevel = (cos(_Time[1]) + 1.5) * _BlendValueModifier;

            //set colors
            fixed4 col1 = tex2D(_MainTex, IN.uv_MainTex) * _MainColor / 2;
            fixed4 col2 = tex2D(_SecTex, (IN.uv_SecTex + moveVector) / 15) * _SecColor * blendLevel;

            //blend colors
            fixed4 result = col1 + col2;
            o.Albedo = result;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Because I don't know what to do, to have unlit effect in second texture.

sentences:
Which isometric angles can be mirrored (and otherwise transformed) for optimization? I am working on a basic isometric game, and am struggling to find the correct mirrors.

Mirror can be any form of transform.

I have managed to get SE out of SW, by scaling the sprite on X axis by -1. Same applies for NE angle.

Something is bugging me, that I should be able to also mirror N to S, but I cannot manage to pull this one off.

Am I just too sleepy and trying to do the impossible, or a basic -1 scale on Y axis is not enough?

What are the common used mirror table for optimizing 8 angle (N, NE, E, SE, S, SW, W, NW) isometric sprites?

sentences:
2D character tips over sideways after collision with platform This is what happens when my player character jumps and collides with a platform from the side. The player character tilts over or ends up upside-down or sometimes on its back.

How can I prevent this?

sentences:
Multiple collisions within a single frame cycle? So say you want to simulate several objects in two dimensions, just bouncing around in a finite space. Using AABB and sweep tests, it shouldn't be that complicated to calculate single collisions between objects. But if you want to have an object bounce off another surface in the same frame (one collision), how do you account for any additional collisions after that first one? This might not make much sense, so I put a little graphic together to explain what I mean.

So say all this is happening in one frame cycle. The gray box moves up and bounces off the wall on the top; that's easy enough. That orange box is the problem, though. How do I calculate that collision as well (where the two translucent boxes are)? OR, if the frame rate is high enough, does it even matter? Thanks!

sentences:
Simplifying Object Factory I'm making a game for Android using Libgdx with Android Studio in Java. In my game, I have a class called ObjectFactory which has a method createGameObject(int objectType) which receives an integer from ObjectIds (a static class that hold a final static numbers for every object type: PLAYER = 0, BULLET = 1, ENEMY = 2 and etc...).

This method has a switch condition and 'till now I have reached 69 types of objects. The method gets the id, looks for it using the switch, creating that object and returns it. At the beginning it was comfortable using this way, but now it's really annoying looking for stuff over there because the switch statement is huge. This is an example of a case:

        case Rules.GameObjectIds.EXPLOSION:
            Explosion explosion = Pools.obtain(Explosion.class);
            explosion.init(getTextureAtlas(explosion, AssetsPaths.Gfx.Sheets.Misc.Explosion.DATA_FILE), AssetsPaths.Gfx.Sheets.ImagesNames.BIG_EXP, x, y, AssetsPaths.Configs.ParticleEffects.EXPLOSION);
            explosion.setDistanceInteraction(Rules.Misc.Explosion.BLAST_RADIUS);
            gameObject = explosion;
            listName = Rules.System.GameObjectTypes.EXPLOSIONS;
            createEffect(AssetsPaths.Configs.ParticleEffects.BLAST_RING, gameObject);
            createLight(explosion);
            break;

I'm thinking about a way to simplify the Object Factory, any suggestions?
Thanks in advance

sentences:
Bounding Box Collision Glitching Problem (Pygame) So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, I've made a simplified example of the problem. (It's worth noticing that I don't have rotating sprites on my game or anything like that. After showing the code, I'll explain better).

Here's the whole code:

from pygame import *

DONE = False
screen = display.set_mode((1024,768))
class Thing():
    def __init__(self,x,y,w,h,s,c):
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.s = s
        self.sur = Surface((64,48))
        draw.rect(self.sur,c,(self.x,self.y,w,h),1)
        self.sur.fill(c)
    def draw(self):
        screen.blit(self.sur,(self.x,self.y))
    def move(self,x):
        if key.get_pressed()[K_w] or key.get_pressed()[K_UP]:
            if x == 1:
                self.y -= self.s
            else:
                self.y += self.s
        if key.get_pressed()[K_s] or key.get_pressed()[K_DOWN]:
            if x == 1:
                self.y += self.s
            else:
                self.y -= self.s
        if key.get_pressed()[K_a] or key.get_pressed()[K_LEFT]:
            if x == 1:
                self.x -= self.s
            else:
                self.x += self.s
        if key.get_pressed()[K_d] or key.get_pressed()[K_RIGHT]:
            if x == 1:
                self.x += self.s
            else:
                self.x -= self.s
    def warp(self):
        if self.y < -48:
             self.y = 768
        if self.y > 768 + 48:
             self.y = 0
        if self.x < -64:
             self.x = 1024 + 64
        if self.x > 1024 + 64:
             self.x = -64
r1 = Thing(0,0,64,48,1,(0,255,0))
r2 = Thing(6*64,6*48,64,48,1,(255,0,0))
while not DONE:
    screen.fill((0,0,0))
    r2.draw()
    r1.draw()
    # If not intersecting, then moves, else, it moves in the opposite direction.
    if not ((((r1.x + r1.w) > (r2.x - r1.s)) and (r1.x < ((r2.x + r2.w) + r1.s))) and (((r1.y + r1.h) > (r2.y - r1.s)) and (r1.y < ((r2.y + r2.h) + r1.s)))):
        r1.move(1)
    else:
        r1.move(0)
    r1.warp()
    if key.get_pressed()[K_ESCAPE]:
        DONE = True
    for ev in event.get():
        if ev.type == QUIT:
            DONE = True
    display.update()
quit()

The problem:

In my actual game, the grid is fixed and each tile has 64 by 48 pixels. I know how to deal with collision perfectly if I moved by that size. Nevertheless, obviously, the player moves really fast.

In the example, the collision is detected pretty well (Just as I see in many examples throughout the internet). The problem is that if I put the player to move WHEN IS NOT intersecting, then, when it touches the obstacle, it does not move anymore. Giving that problem, I began switching the directions, but then, when it touches and I press the opposite key, it "glitches through". My actual game has many walls, and the player will touch them many times, and I can't afford letting the player go through them.

The code-problem illustrated:

When the player goes towards the wall (Fine).

When the player goes towards the wall and press the opposite direction. (It glitches through).

Here is the logic I've designed before implementing it:

I don't know any other method, and I really just want to have walls fixed in a grid, but move by 1 or 2 or 3 pixels (Slowly) and have perfect collision without glitching-possibilities. What do you suggest?

sentences:
How can I rotate an object based on another's offset to it? I have a 3D model of a turret that con rotate around the Y-axis. This turret has a cannon that is significantly off the center of the object. I want the cannon, not the turret, to aim at a specified target. I can only rotate the turret, however, and thus I don't know what equation I need to apply in order to accomplish by objective.

The following image illustrates my problem:

If I have the turret "LookAt()" the target, a laser originating from the cannon will completely miss said target.

If this were a completely top-down scenario, and the cannon were exactly parallel to the turret, then my logic tells me that the fake target should be located at a position that's equal to the actual target plus an offset that's equal to that between the turret and the cannon. However, in my actual scenario, my camera is angled 60º, and the cannon has a slight rotation.

The following image illustrates the scenario:

I'm not sure exactly why, but if I apply that same offset, it only seems to work while aiming at certain distances from the turret.

Is my logic flawed? Am I missing something fundamental here?

Final Edit: the solution provided by @JohnHamilton latest update solves this problem with perfect precision. I have now removed the code and images that I used to illustrate my incorrect implementations.

sentences:
AddForce not moving imported model in Unity I've got a Unity project with an imported .fbx model I'm attempting to add movement to.

As a test, I've added a sphere primitive with a sphere collider, a rigid body, and the following script:

public class ball_test : MonoBehaviour {

  private Rigidbody rb;

  void Start ()
    {
    rb = GetComponent<Rigidbody> ();
    }

  void FixedUpdate ()
    {
    Vector3 movement = new Vector3 (1f, 0.0f, 1f);

    rb.AddForce (movement);
    }
  }

This is partly copied from the Roll A Ball tutorial, and this works fine.  The ball slowly rolls with no problem.

I've imported a custom model, added a box collider, a rigid body, and assigned to it the same script.  It doesn't move.

Here's how they're set up:

sentences:
How can I switch between starting a coroutine vs running the routine all at once? I'm generating a level, and I have an optional delay to show the steps level generation one by one.

If my generationDelay boolean is true, I want to use StartCoroutine to spread the generation out over time. If it's false, I want to call the same method but without StartCoroutine.

The problem is that the method is type IEnumerator.

I can make two methods one type of IEnumerator and one not. But I wonder if there is a way to use one method.

In the first script top i did:

public bool generationDelay = false;

Then in a method:

private void BeginGame()
    {
        mazeInstance = Instantiate(mazePrefab) as Maze;

        if (generationDelay == true)
        {
            StartCoroutine(mazeInstance.Generate(generationDelay));
        }
        else
        {
            mazeInstance.Generate(generationDelay);
        }
    }

Then the other script where the method Generate is:
In the top:

public float generationStepDelay = 0.01f;

Then the method Generate:

public IEnumerator Generate (bool generationDelay) {

        if (generationDelay == true)
            WaitForSeconds delay = new WaitForSeconds(generationStepDelay);
        cells = new MazeCell[size.x, size.z];
        List<MazeCell> activeCells = new List<MazeCell>();
        DoFirstGenerationStep(activeCells);
        while (activeCells.Count > 0) {
            yield return delay;
            DoNextGenerationStep(activeCells);
        }
    }

I'm getting an error on the line:

WaitForSeconds delay = new WaitForSeconds(generationStepDelay);

  "Embedded statement cannot be a declaration or labeled statement"

And an error on the line:

yield return delay;

  "The name 'delay' does not exist in the current context"

The reason I want to use a bool variable is that when i'm using StartCoroutine it's kind of slow, even if I change the value of generationStepDelay to 0 it's kind of slow. And if I'm not using StartCoroutine and not using the Generate method as IEnumerator it will work fast.

So i wonder what should I do and how?

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:
DirectX11 how to use textures and samplers in slots in shaders I have a system to render many objects, but I don’t know how to render more tan one object with same shader, let me explain:

I have a sphere and a cylinder, but both objects can be rendered by different shaders, example:
Shader1: Shader to render object using 1 texture
Shader2: Shader to render object using 2 textures

Both objects need to coexist in space, so if I want to render sphere with shader 1 and I use:
shader1 resources:

context_->PSSetShaderResources(0, 1, &texture);
context_->PSSetSamplers(0, 1, &sampler);
…

shader2 resources:

context_->PSSetShaderResources(1, 1, &texture);
context_->PSSetSamplers(1, 1, &sampler);
context_->PSSetShaderResources(2, 1, &texture);
context_->PSSetSamplers(2, 1, &sampler);
…

in Shader1 the resources are references like this:

Texture2D colorTexture: register(t0);
SamplerState sampler: register(s0);

And in Shader2 the resources are references like this:

Texture2D colorTexture: register(t1);
SamplerState sampler: register(s1);
Texture2D colorTexture: register(t2);
SamplerState sampler: register(s2);

But what if I need to use shader1 resource’s in shader2???? How to manage those resources or do I need to replicate shader2 with shader1 registers?? this is the simplest example, this is part of a very much complex system with many many shaders and many textures, but I don’t know in what slot will be setted the resources, this can be absolutely generic, example, slot 5 will be used for texture 1 of shader2… It is possible to render many objects with minimal change of shaders, but the resources could be updated at any time..
I’m using directX11.

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:
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: Unity - Outline each pixel on a texture So I have a 16x16 sprite. I would like to make each pixel on the sprite to have a border/outline so you can distinguish each pixel from another, like shown in the picture below (ignore the colored boxes). How would I do so? Please note, I will be coloring those pixels, so those borders should be gone when colored

sentences:
How to properly handle errors in a D3D11 framework? I'm writing a D3D11 framework and I'm trying to clean it up a little, and I'm unsure how to handle errors and return codes in my classes/code.

What is the "best" and cleanest way to implement error handling ?

Should I just use the HRESULT and other D3D types as return values for errors and such, or should I create my own types, or should I go with native c/c++ types ?

sentences:
Why are my 3ds Max .fbx exports huge? I've made an animation in 3ds Max and want to export it to .fbx and import it into Unity. I've done this once without problems. But this time, my .max file is 2,8MB and my .fbx file came out a huge 630MB!

There's nothing wrong with my model: I exported it from a Blender model (to .fbx) and imported it to 3ds max (converted it to an editable poly) to do my rigging and animation. As soon as I import some .bip animations, I get these huge files.

Is there a safe way to get smaller file sizes? I don't mind redoing the rigging if I can solve this.

sentences: Inclusive vs Exclusive voxel bounding box Let's say I have a few voxel at (1,1,1) and (2,2,2), I would like to know if would be better to consider that the smallest box that contains both voxels is either (1,1,1) to (2,2,2) or (1,1,1) to (3,3,3). That is to say is it more correct to make the box contains the lower point of the voxels or the voxels as cubes inside the box?

sentences:
Adding delay between damage I have a bunch of enemies chasing my main-character, and if they intersect I want them to damage him and that's all good. The problem is that right now they damage him as long as they stand around him, every frame! and since it gets called every frame my character's HP reaches 0 almost instantly.

I've tried adding delay and I've tried a timertask, but can't get it to work.

This is the code I use to check for intersection:

private void checkCollision(Canvas canvas) {
    synchronized (getHolder()) {
        Rect h1 = happy.getBounds();
        for (int i = 0; i < enemies.size(); i++) {
            for (int j = 0; j < bullets.size(); j++) {
                Rect b1 = bullets.get(j).getBounds();
                Rect e1 = enemies.get(i).getBounds();
                if (b1.intersect(e1)) {
                    enemies.get(i).damageHP(5);
                    bullets.remove(j);
                }
                if(e1.intersect(h1)){
                    happy.damageHP(5);
                // this is the statement that needs some sort of delay, I want them to damage him every 2 seconds they intersect him.
                }

                if(enemies.get(i).getHP() <= 0){
                    enemies.get(i).death(canvas, enemies);
                    score.incScore(5);
                    break;
                }
                if(happy.getHP() <= 0){
                    score.incScore(-50);
                    //end-screen
                }
            }
        }
    }
}

If anyone knows the logic to do this please do tell.

sentences:
Unity won't Instantiate() outside of Start(), even though code is the same I am trying to add a gameobject to my game using a socket connection. I have a SocketHandler class, which simply connects to my NodeJS socket server, which can also call a method on another class, which will add a new gameobject to the game. Here is how it basically works:

void Start () {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = "Volkswagen";
}

This works fine and it adds the gameobject to the game upon starting. However, if I do something like this in my SocketHandler, it doesn't work:

var addCar = new AddCar();
socketio.On("addCar", (data) => {
    string str = data.ToString();
    Car data2 = JsonConvert.DeserializeObject<Car>(str);
    addCar.AddNewCar(data2);
});

and then inside my AddCar class, I have the AddNewCar() method:

public void AddNewCar(Car input) {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = input.name;
}

it does not work. If I do a Debug.Log(input.name) inside the AddNewCar() method, it does log the name the server sends. It should do the exact same thing, but the AddNewCar() doesn't get added to the game. It simply does nothing.

What could be wrong?

sentences:
Rotate billboard towards camera I'm trying to create a particle system in OpenGL, and as such I need to use billboards.

I need these billboards to face the camera at all times.

The tutorials I've been following only rotated the billboard on 1 axis, such as billboards being used as grass or plants, but I need a method of rotating the quad to always face the camera, even when looking down on it.

The Original Scene:

Desired Scene:

While searching for an answer, I only really found the technique of turning the mat3 component of the camera's view/model matrix back to an identity matrix. This isn't quite what I need, as the point's location in space never change then.

Incorrect Scene:

How can I calculate a new rotation matrix that will successfully rotate a quad always towards the camera, or modify an existing matrix?

In the geometry shader I have access to the camera's position, the perspective matrix, and the view/model matrix.

I didn't include any shader code because it is really trivial; I create vertices that are an offset of the desired point's position based on the desired size. So if the quad should be 50 x 50, the vertex is the position offset by 25 on X and Y, multiplied by the Camera's Perspective x View matrix.

Solution:

mat4 VP = pMatrix * vMatrix;
vec3 CameraRight = vec3(vMatrix[0][0], vMatrix[1][0], vMatrix[2][0]);
vec3 CameraUp = vec3(vMatrix[0][1], vMatrix[1][1], vMatrix[2][1]);

vec3 Pos = gl_in[0].gl_Position.xyz;  // The desired point for the billboard

vec4 v1 = VP * vec4(Pos + CameraRight * 0.5 * Size + CameraUp * -0.5 * Size, 1.0);
vec4 v2 = VP * vec4(Pos + CameraRight * 0.5 * Size + CameraUp * 0.5 * Size, 1.0);
vec4 v3 = VP * vec4(Pos + CameraRight * -0.5 * Size + CameraUp * -0.5 * Size, 1.0);
vec4 v4 = VP * vec4(Pos + CameraRight * -0.5 * Size + CameraUp * 0.5 * Size, 1.0);

sentences:
Spawning objects inside rectangle JS I'm making a JS game "Monopoly", where I spawning players in random position inside a rectangle. I need a formula that spawns circles INSIDE a rectangle, without being outside.

Here what I have tried:

randomPosition(left, top, width, height, id) {
    // var x = left + Math.random() * (width-2*this.#playerRadius) + this.#playerRadius;
    // var y = top + Math.random() * (height-2*this.#playerRadius) + this.#playerRadius;
    var x = Math.max(Math.min((left + Math.random() * (width-2*this.#playerRadius) + this.#playerRadius), left+width), left+this.#playerRadius*2);
    var y = Math.max(Math.min((top + Math.random() * (height-2*this.#playerRadius) + this.#playerRadius), top+height), top+this.#playerRadius*2);

    var that = this;
    while(true) {
      var hit = 0;
      for (var i = 0; i < that.playersElements.length; i++) {
          var circle = that.playersElements[i];
          var dx = x - circle.x;
          var dy = y - circle.y;
          var rr = this.#playerRadius + this.#playerRadius;
          if (dx * dx + dy * dy < rr * rr) {
              hit++;
          }
      }
      // new circle doesn't overlap any other, so break
      if (hit == 0 || hit > 200) {
        break;
      } else {
        var x = Math.min((left + Math.random() * (width-2*this.#playerRadius) + this.#playerRadius), left+width)
        var y = Math.min((top + Math.random() * (height-2*this.#playerRadius) + this.#playerRadius), top+height);
      }
    }
    this.playersElements[id] = {
      x:x,
      y:y,
      r:this.#playerRadius,
      id:id
    }
    return [y, x];
  }

sentences:
change animations when touch sprites In the following function I want to change the animation when I touch on the button.
But the game crash and exit. What's wrong with this code ?

 bool GameScene::onTouchBegan(cocos2d::Touch *touch ,cocos2d::Event *event)
{
    Point touchPoint = Director::sharedDirector()->convertToGL(touch->getStartLocationInView());
    touchPoint = blueButton->convertToNodeSpace(touchPoint);

    Rect *blueBottomRect = new Rect(blueButton->getOffsetPosition().x
        , blueButton->getOffsetPosition().y
        , blueButton->getTextureRect().size.width
        , blueButton->getTextureRect().size.height);
    if (blueBottomRect->containsPoint(touchPoint))
    {
        CCLOG("Blue Touched!!!!!!!!!!!!!!!!!!");

        auto blueBody = Sprite::create("body1.png");
        blueBody->setPosition(Point(visibleSize.width / 2 , +220));

        Vector<SpriteFrame*> animFrames;

        animFrames.reserve(7);
        animFrames.pushBack(SpriteFrame::create("body1.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body2.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body3.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body4.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body5.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body6.png", Rect(0, 0, 99, 153)));
        animFrames.pushBack(SpriteFrame::create("body7.png", Rect(0, 0, 99, 153)));

        Animation* animation = Animation::createWithSpriteFrames(animFrames, 0.09f);
        Animate* animate = Animate::create(animation);

        blueBody->runAction(RepeatForever::create(animate));
        this->addChild(blueBody,100);
        redBody->removeFromParentAndCleanup(true);

    }

    Point touchPoint2 = Director::sharedDirector()->convertToGL(touch->getStartLocationInView());
    touchPoint2 = redButton->convertToNodeSpace(touchPoint2);

    Rect *redBottomRect = new Rect(redButton->getOffsetPosition().x
        , redButton->getOffsetPosition().y
        , redButton->getTextureRect().size.width
        , redButton->getTextureRect().size.height);
    if (redBottomRect->containsPoint(touchPoint2))
    {
        CCLOG("Red Touched!!!!!!!!!!!!!!!!!!");

        auto redBody = Sprite::create("RedBody/bodyRed1.png");
        redBody->setPosition(Point(visibleSize.width / 2 , +220));

        Vector<SpriteFrame*> animFrames2;

        animFrames2.reserve(7);
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed1.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed2.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed3.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed4.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed5.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed6.png", Rect(0, 0, 99, 153)));
        animFrames2.pushBack(SpriteFrame::create("RedBody/bodyRed7.png", Rect(0, 0, 99, 153)));

        Animation* animation2 = Animation::createWithSpriteFrames(animFrames2, 0.09f);
        Animate* animate2 = Animate::create(animation2);

        redBody->runAction(RepeatForever::create(animate2));
        this->addChild(redBody,100);
        blueBody->removeFromParentAndCleanup(true);

    }

    return true;
}

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:
Where is ID3D10EffectShaderResourceVariable::SetResourceArray in SlimDX? I don't know if I'm just not looking in the right place, but I can't find ID3D10EffectShaderResourceVariable::SetResourceArray anywhere in SlimDX.

Anyone have any idea how I should be calling this?

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: Can you access Kinect motion sensing from XNA? As of 2010 with the release of XNA 4.0, if I buy an Xbox 360 with Kinect will I be able to access its motion sensing data with the XNA game I'm developing? Or is this only restricted to C++ developers with a devkit?

sentences:
When do you have inflation and when deflation in a virtual economy In a virtual economy, you can calculate all the income and all the costs (money that sinks) from every user in the game. You can calculate the percentage of the new money on the system or the money that has been lost from the system by the income and the costs.

I believe that having a small positive percentage is not inflation, but from the other side, crucial for the economy. However, I was wondering if there are any rough limits of this percentage that could lead to an inflation or deflation for negative percentage.

For example, if you have every week a result of 1-2%, will not be a serious problem. But if you have 30% or -30%, obviously you will.

Have you found from your experience or from any research limits that could ring a bell?

sentences:
In unity game appears dark exporting to ios what happened? Everything appeared darker when I exported my game to iOS.  I only updated my Unity to 4.6.3 .
Any idea why?

sentences:
Unity: Loading screen without a coroutine (is it possible?) I need to accomplish something specific but I'm not sure how to do it exactly:

My game has 2 scenes:

The main menu that has a couple of buttons...
... and the game scene that displays a different mesh (which is imported from a folder on the HDD at runtime) depending on which button you pressed and that also lets you walk around.

My approach for this:
Clicking on a button makes a script A call a static class B (used for sharing data between scripts), which then in turn creates an instance of another class C, which inherits from ScriptableObject and takes care of the whole "import and display the mesh" part.

Importing a mesh takes a while, so I'd like to display some kind of loading screen (a panel that overlays everything else in the 2nd scene) and this is where I'm stuck.

Importing a mesh accesses the Unity API, so I can't do it in an extra thread (or Task, which would be perfect) but I also can't use a coroutine because class C derives from ScriptableObject, not MonoBehaviour (which I can't use because I can't create a new instance then).

Another problem is that the game is stuck on the main scene with the button pressed and doesn't display the second scene until the mesh is loaded, so even if I set the loading panel active (loadingPanel.setActive(true)) before I start importing the mesh, it doesn't display it until after the model's already imported.

What can I do here? There's no need to display a loading screen while switching scenes, so I'm guessing that there's no point to load the second scene asynchronously, is there?

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:
Unity error "must have a body because it is not marked abstract, extern, or partial" I'm trying to setup a system where I pickup an object drop it into a zone, and then the object is destroyed.

So far I have:

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

public class TriggerZone2 : MonoBehaviour {
    public Text MyText;
    private int score;
    public bool CompareTag(string Player);

    // Use this for initialization
    void Start () {
        MyText.text = "";
    }

    // Update is called once per frame
    void Update () {
        MyText.text = "$" + score;
    }

    void OnTriggerEnter(Collider coll) {
        score = score + 1;

        if (other.CompareTag ("Player")) {
            Destroy (other.gameObject);
        }
    }
}

Everything works up until I try to destroy the game object. The console keeps saying

  Assets/Scripts/TriggerZone2.cs(11,21): error CS0501: `TriggerZone2.CompareTag(string)' must have a body because it is not marked abstract, extern, or partial.

I've looked up quite a few threads, but I'm still not sure what it wants me to do with it. How do I fix this?

sentences:
Unity Profiling - Mesh.Bake PhysX CollisionData Doubling CPU cycles I have a mob that, when it dies, spawns smaller versions of itself.  When this happens there's a huge resource spike.  The profiler narrowed it down to baking the meshes of the new objects.  I have a couple of smaller questions related to this, but the crux of the issue is that it looks like the baking is occurring twice (doubling CPU usage) as shown below in both Instantiate and Transform.SetParent.  I'd normally say it's redundant, but in every way it looks like it's happening twice and take over one full second total.  Why would this happen twice on the same set of object (there are a variable number of spawned mobs, so the actual numbers can vary)?

As an aside, can this be backed in the prefab somehow to avoid this?

sentences:
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:
My runtime mesh is not being created where it's vertices are located, need help I'm trying to create a quad at runtime and I'm encountering an issue where the mesh does not show up in the scene where it's vertices where set. In the following picture you can see the ship, and to the far right the mesh.

The 4 white dots around the ship where drawn after the mesh was made using the 4 vertices of the mesh.

My Code:

//Handles the method calls for the mesh creation
private void BoundingMeshCreation()
{
    Quaternion currentRotation = ResetPosition(new Quaternion(0, 0, 0, 0));
    BoundingPointsType boundingPoints = DetermineBounds();
    Mesh boundingMesh = CreateBoundingMesh(boundingPoints);
    AssignMesh(boundingMesh);
    ResetPosition(currentRotation);
}

//Creates the mesh filter and assigns the mesh
private void AssignMesh(Mesh boundingMesh)
{
    MeshFilter newMeshFilter = gameObject.AddComponent<MeshFilter>();
    newMeshFilter.mesh = boundingMesh;

    VectorLine testPoint = new VectorPoints("testPoint", boundingMesh.vertices, null, 5);
    testPoint.Draw3D();
}

//Creates a bounding mesh for the unit
private Mesh CreateBoundingMesh(BoundingPointsType boundingPoints)
{

    Mesh boundingMesh = new Mesh();
    boundingMesh.name = "Bounding Quad";

    Vector3[] vertices = new Vector3[4]
    {
        boundingPoints.LowerLeftPoint,
        boundingPoints.LowerRightPoint,
        boundingPoints.UpperRightPoint,
        boundingPoints.UpperLeftPoint
    };

    int[] triangles = new int[6]
    {
        0,
        2,
        1,

        0,
        3,
        2
    };

    boundingMesh.vertices = vertices;
    boundingMesh.triangles = triangles;

    return boundingMesh;
}

//Resets the units rotation to the specific quaternion and returns the quaterion from before the reset. Bit of a hack for now to make sure that the original box is the proper size.
private Quaternion ResetPosition(Quaternion toResetTo)
{
    Quaternion currentRotation = transformV.rotation;
    transformV.rotation = toResetTo;
    return currentRotation;
}

//Determines and returns the bounding box points
private BoundingPointsType DetermineBounds()
{
    Vector3 maxBounds = childSprite.GetComponent<Renderer>().bounds.max;
    Vector3 minBounds = childSprite.GetComponent<Renderer>().bounds.min;

    BoundingPointsType boundingPoints = new BoundingPointsType(new Vector3(maxBounds.x, 1, maxBounds.z),
                                                               new Vector3(minBounds.x, 1, maxBounds.z),
                                                               new Vector3(maxBounds.x, 1, minBounds.z),
                                                               new Vector3(minBounds.x, 1, minBounds.z));
    return boundingPoints;
}

I've even tried manually setting the vertices like the following:

    Vector3 UpRight = transformV.position;
    Vector3 UpLeft = transformV.position;
    Vector3 LowRight = transformV.position;
    Vector3 LowLeft = transformV.position;

    UpRight.z += 1;
    UpRight.x += 1;

    UpLeft.z += 1;
    UpLeft.x -= 1;

    LowRight.z -= 1;
    LowRight.x += 1;

    LowLeft.z -= 1;
    LowLeft.x -= 1;

    Vector3[] vertices = new Vector3[4]
    {
        LowLeft,
        LowRight,
        UpRight,
        UpLeft
        //boundingPoints.LowerLeftPoint,
        //boundingPoints.LowerRightPoint,
        //boundingPoints.UpperRightPoint,
        //boundingPoints.UpperLeftPoint
    };

I'm at a loss, and have no idea what I'm doing wrong. My dynamic meshes seem to work perfectly fine for everything else in the game.

Thanks.

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 multiple AI surround a player I am working on a top-down RPG game and I have come across a problem. I am working on an AI system to allow the enemy AI to surround the player. I've been trying to keep my implementation really simple, however, I've been running into problems.

Here is what it currently looks like:

X represents the player and Y represents the friendly AI. There are 42 waypoints in total that the enemy can potentially occupy.

However, if any of the waypoints of the player object encounters an obstacle, or if another friendly AI is too close, it will disable those waypoints:

This poses a big problem because I do not have all 42 waypoints. From the looks of it, I might need something more dynamic in my case.

Are there any alternative ways to allow a large number of AI to surround the player or its allies?

sentences:
How would I setup the Environment Variables for BulletPhysics? I am using Bullet Physics v2.78. And Im trying to build this library to be used for ogrebullet. The main problem is that Im getting errors trying to find the Bullet Directory.

Im wondering if maybe my environment variables are setup wrong.

I am using Windows Vista 32 bit, and here are my Environment variables:

BULLET_ROOT: C:\BulletPhys

BULLET_INCLUDE_DIR: C:\BulletPhys\src

as other information I am trying to build these libraries in cMake. Bullet physics builds perfectly, but ogrebullet cant find the libraries needed to configure(Dynamics, Collision, LinearMath, etc.)

So my question is: How would I setup the environment variables so ogrebullet can find them?

If any other information is needed i will provide upon request.

Thanks

-Molma

sentences:
Free Look Camera Like Arma 2 while pressing ALT I'm trying to create a simple script that give me the possibility to rotate the camera while pressing a key. So, in a pseudo-code way, how I can intercept the Input event and limit the player's movements to hold the character direction?
I should tweak the MouseLook script? Or completely create a new one?

sentences: Is a programmer liable for copyright infringement in other people's mods to his games? If a programmer (P) releases a game, and a modder (M) releases a game modification which includes copyrighted content, can P be held liable for the copyright infringement in the mod?

sentences:
Physics Body editor loader collision detect In my game I use the Physics Body Editor to add custom shapes to my bodies. In my show() method I use the follownig code to create my Jetski Body:

BodyDef jetskiDef = new BodyDef();
    jetskiDef.position.set(new Vector2(2, WATER_HEIGHT));
    jetskiDef.type = BodyDef.BodyType.DynamicBody;

    jetskiFixture = new FixtureDef();
    jetskiFixture.density = 0.25f;
    jetskiFixture.friction = 0.5f;
    jetskiFixture.restitution = 0.5f;
    jetskiFixture.isSensor = false;

    jetski = world.createBody(jetskiDef);
    jetski.setUserData(jetskiTexture);

Using bodyEditorLoader.attachFixture(jetski, "jetski", jetskiFixture, 1, JETSKI_BOX_WIDTH, JETSKI_BOX_HEIGHT); I add the custom shape to the fixture.

I try to render the jetskiTexture in my render() method like this:

for (Body body : worldBodies) {
        if (body.getUserData() instanceof Sprite) {
            Sprite sprite = (Sprite) body.getUserData();

            Vector2 position = body.getPosition();

            sprite.setPosition(position.x, position.y);
            sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
        }

In my beginContact() method I check if one of the fixtures is the fixture from a dynamic body and if the other one is a sensor, in order to add them to my BuoyancyController for the buoyancy effect.

public void beginContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    if (fixtureA.isSensor()
            && fixtureB.getBody().getType() == BodyDef.BodyType.DynamicBody) {
        buoyancyController.addFixture(fixtureB);
    } else if (fixtureB.isSensor()
            && fixtureA.getBody().getType() == BodyDef.BodyType.DynamicBody) {
        buoyancyController.addFixture(fixtureA);
    }
    }

If I now start my game I can see the custom shape but there is no jetskiTexture and it also doesnt float, like it is supposed to.
I tried changing the beginContact() method but it didn't work either.

public void beginContact(Contact contact) {
    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();
    String userDataA = contact.getFixtureA().getUserData().toString();
    String userDataB = contact.getFixtureB().getUserData().toString();

    if (fixtureA.isSensor()
            && userDataB == jetskiTexture) {
        buoyancyController.addFixture(fixtureB);
    } else if (fixtureB.isSensor()
            && userDataA == jetskiTexture) {
        buoyancyController.addFixture(fixtureA);
    }
    }

sentences: Tile Maps in Java JFrame Game I am making a 2D Java game with Java's own drawing library. I was wondering how I would make a tile map display on the screen. I would prefer to use a GUI application to make the maps. I'm looking for orthogonal projection: a top down view.

sentences:
Low fps on Arm Mali GPU I was trying to google and understand my problem in two weeks but i am defeated, so i am asking for help.

The main problem is that my custom unlit frag shader after certain amount of time on devices with mali gpu starts to drop fps - i see it via fps counter in the cpu section. I dont know why in that section and not in render section, but with out this fps counter i can still feel the drop of fps.

So on Samsung S4, Samsung sm-t 380, xiaomi redmi note 5, samsung tab s2 is all ok, the drop was only on samsung s6 - to solve the problem i just half the resolution by Screen.SetResolution function.

I was thinking that drawing the full screen sprite on such a high res device is the point. Then i can test app on samsung sm-t580 - and the drop was there - this device has low resolution than S6.

I assume that the problem in arm mali gpu - or i am sure in my hands.

So again, i am rendering full-screen with draw-mode = tile(countinuous) sprite with 3 textures, just changing theirs uvs in vert func and apply in fragment. This makes distorting effect. The shader show that i have 10 maths and 4 textures, yes 3 textures but i am making 4 sampling.

The textures are 256x256 with repeat mode. I was trying diferrent textures compressions, dxt5, etc1-2, alpha8, R5 - no effect.

I was trying to different precisions half and float in different parts in shader - no effect.

I was thinking in alpha, so i took textures without alpha and not getting it from tex2D. Even the size of textures is doesnt matter, even if they 64x64.

The dance with ZTest, ZWrite, Blend, Queue RenderType, other params - no effect.

My guess was that maybe on mali uv : TEXCOORD0 must be only float2, not float3 or float4 - no effect.

I am applying _Time.y and replace it with float from script - no effect.

Only reducing amount of tex2d in shader - is working. Why?

What i`m doing wrong?

sentences:
How can I check for key releases between keyReleased callbacks? Slick2D's Input class has a isKeyPressed() method that returns a boolean value according to whether the specified key has been pressed.  I want to check if a key has been released in the same fashion.

I looked into adding a KeyListener to the input object, and overriding the keyReleased() method.  However, because I am currently handling input in the update() method of my BasicGame, this would fracture my code by handling input in two different places, which I'd like to avoid.

sentences:
Rotate a UI Image exactly 360 degrees over the course of 1 second? I have a UI Image that I want the user to click and have it rotate 360 degrees once on the z axis.  I can get it to rotate through a coroutine but I'm having trouble making it stop once it is started.

public void getInputClick()  // OnClick method for UI object
{
    foreach (Transform child in EventSystem.current.currentSelectedGameObject.GetComponentsInChildren<Transform>())
    {
        if (child.gameObject.name == "Lock")  //Making sure this is an object that should rotate becasue it has a child named "Lock"
        {
            if (rotating == false) //enable coRoutine if not already rotating
            {
                runRotationRoutine = true;
            }
            break;
        }
    }

}

void Update()
{
    if (runRotationRoutine == true)  //Listening for coRoutine execution directive during update.
    {
        StartCoroutine(rotationRoutine());
    }
}

IEnumerator rotationRoutine()
{
    runRotationRoutine = false;  // make sure update doesnt try to run the coroutine more than once!
    rotating = true;  // bool signifying that rotation is currently happening.

    while(rotating == true)
    {
        imageObject.transform.Rotate(rotationVector);
        yield return null;

        //  This works but rotates forever because the coroutine is never terminated.

        //  How do I make this stop after the object has rotated 360 degrees????

        //  Something like (when current rotation == starting rotation --->  set rotation = false
        // But how would I determine this?
    }

}

It needs to be a coroutine because there are a lot of other things executing simultaneously.  I feel like it should be pretty simple to just tell it to only rotate around once, what am I missing here?

sentences:
Get fragment from mouse position I have a painting app for texture artists that I am working on. I am able to paint to a flat canvas that updates the texture of a 3d object in an object viewer. Now I want to be able to paint directly to the 3d model.

One way I can think of is to get the uv coordinate from the mouse position, and use that as the position to paint onto my 2d canvas, which updates the 3d models texture.

Oh and only one object at a time is active, so that should make things a little simpler.

Is this the right approach? If it is then how should I start. Or is there a simpler/better way of painting directly to a 3d model? How does zbrush do it?

sentences:
Slick2D - Cannot instantiate the type Image I am getting this strange error and I cannot for the life of me figure out why:

    Cannot instantiate the type Image

CODE:

import java.awt.Image;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

public class MainMenuState extends BasicGameState {

    int stateID = -1;

    Image background = null;
    Image startGameOption = null;
    Image exitOption = null;

    float startGameScale = 1;
    float exitScale = 1;
    MainMenuState( int stateID )
    {
       this.stateID = stateID;
    }

    public int getID() {
        return stateID;
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        try {

        background = new Image("data/menu.jpg");

        Image menuOptions = new Image("data/menuoptions.png");

        startGameOption = menuOptions.getSubImage(0, 0, 377, 71);

        exitOption = menuOptions.getSubImage(0, 71, 377, 71);

        }catch (SlickException e) {
            System.err.print(e);
        }
    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {

    }

}

Why do I get this error? I've googled endlessly and nobody else has it, this worked fine in my other game. Any ideas?

sentences:
What light attenuation function does UDK use? I'm a big fan of the light attenuation in UDK. Traditionally I've always used the constant-linear-quadratic falloff function to control how "soft" the falloff is, which gives three values to play with. In UDK you can get similar results, but you only need to tweak one value: FalloffExponent.

I'm interested in what the actual mathematical function here is. The UDK lighting reference describes it as follows:

  FalloffExponent: This allows you to modify the falloff of a light. The default falloff is 2. The smaller the number, the sharper the falloff and the more the brightness is maintained until the radius is reached.

Does anyone know what it's doing behind the scenes?

sentences:
How to organize messages queue in a fast-paced multiplayer game I'm trying to develop a fast-paced multiplayer game. I decided to build my own protocol over UDP and now I'm stuck with the following question.

The idea of the protocol is very basic and it's similar to many others:

Client does NOT do any game logic except of some predictions (like smooth walking). It just sends 'ping', 'connect', 'disconnect' and 'keypressed' / 'keyreleased' actions to the server.
On contrary, the server does game logic based on the users inputs and sends diffs to each client every 30 ms

As I already mentioned, the client sends 'ping' messages (to notify server that we're still alive when there's no other messages in some period of time) as well as 'keypressed' / 'keyreleased' stuff.

I thought that the 'ping' messages can be unrelirable -- the client sends them at steady intervals anyway, so if one was lost, nothing bad will happen.

However, such messages like 'keypressed' and 'keyreleased' should be reliable. By this I mean that the client should resend them in case of any failure and they should appear on the server in the same order they were sent (otherwise 'keyreleased' message could arrive before 'keypressed' resulting in the incorrect game behavior).

So, the questions is -- how is it usually handled? I mean, what is the right way to implement such logic on the server? Should I queue all incoming reliable messages in some container and wait until messages with smaller sequence IDs also arrive? If so, what should I do with unrelirable messages then? Because I definitely shouldn't wait before 'ping' message arrived (and there's a chance that it won't arrive at all). Should I use a distinct sequence numbers for unrelirable messages or should I make 'ping' messages reliable as well?

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:
XNA: Instancing Cubes, Each Side Different Texture I am trying to make thousands of instanced cubes, each with a unique texture on each side.

Am I going to have to split each cube into 6 instanced faces, or can I unwrap it in such a way the the texture atlas coordinates will come out right?

My idea is have each cube unwrapped into a 2 tile by 3 tile area as such:

Top     Bottom
Front   Back
Left    Right

Will the unwrap make it into the DrawInstancedPrimitives call?

Next, some cubes will have different textures than others. I was thinking about handling it with an atlas. One 2x3 texture in one slot, and another texture in another, forming a multi-texture image.

Am I on the right track here?

sentences:
Collision detection with moving objects I searched a lot about this problem. I found many answers here in Stack Exchange but none of them really answers when positions for objects get updated.

For a game with fixed size map and that has all the time:

200+ moving objects with different sizes (bullets, players, NPCs, etc.)
100+ static objects with different sizes (obstacles, health packs, etc.)

I am looking for an efficient way to do collision detection. Here is the pseudo code:

in each game loop (15 ms):
   collect movement commands and apply force on objects of those commands
   loop with very small physics time steps (0.1 ms):
      for object in movingObjects:
         get objects that might collide with current object   // --> 1
         check if any collision occurs
      for object in movingObjects:
         update position of object (based on command collected) // --> 2

So:

I get the objects that might collide with given object. It is done using a data structure like quadtree or spatial hashing grid (or something else that makes more sense).
Object's position is updated. Now, how do I inform the data structure that this object's position is updated? I don't want to remove and insert. That is not efficient at all.

I feel like quad tree and spatial hash implementations all over the internet are avoiding this problem.

I would also appreciate if you tell me my pseudo code above is problematic. I have the feeling this uses too much CPU.

sentences:
How do I perform interpolation between noise values sampled at a lower resolution? I'm doing some experimentation with terrain generating using a method similar to that described in this blog post by Markus Persson, where I use 3D simplex noise as a "density" value. Like him, sampling every single position in a chunk was simply too much of a performance drain, so I sample at a lower resolution. This works perfectly fine if I just use the noise values sampled at a lower resolution as densities, but this obviously leads to very "chunky" terrain, like this:

The relevant code used to generate the noise values and the voxels that make up the above terrain looks like this:

// Initialize the width, height and depth of the noise values map, and initialize
// the noise value map itself.
int noiseValuesMapWidth = (this.ChunkWidth / this.HorizontalNoiseResolutionDivisor) + 2;
int noiseValuesMapHeight = (this.ChunkHeight / this.VerticalNoiseResolutionDivisor) + 2;
int noiseValuesMapDepth = (this.ChunkDepth / this.HorizontalNoiseResolutionDivisor) + 2;
float[,,] noiseValuesMap = new float[noiseValuesMapWidth, noiseValuesMapHeight, noiseValuesMapDepth];

// Fill the noise values map with noise values.
for(int x = 0; x < noiseValuesMapWidth; x++)
{
    for(int y = 0; y < noiseValuesMapHeight; y++)
    {
        for(int z = 0; z < noiseValuesMapDepth; z++)
        {
            float xSeed = Mathf.Abs((x * this.HorizontalNoiseResolutionDivisor) + this.transform.position.x + seed);
            float ySeed = Mathf.Abs((y * this.VerticalNoiseResolutionDivisor) + this.transform.position.y + seed);
            float zSeed = Mathf.Abs((z * this.HorizontalNoiseResolutionDivisor) + this.transform.position.z + seed);

            noiseValuesMap[x, y, z] = Noise.Generate(
                xSeed * this.NoiseScaleX, ySeed * this.NoiseScaleY, zSeed * this.NoiseScaleZ
            ) - NoiseFalloff(
                this.FalloffACoefficient,
                this.FalloffBCoefficient,
                this.FalloffCCoefficient,
                (float)(y * this.VerticalNoiseResolutionDivisor) / (float)this.ChunkHeight
            );
        }
    }
}

// Generate the chunk's terrain itself by iterating over every voxel position
// and generating simplex noise values at a lower resolution.
for(int x = 0; x < this.ChunkWidth; x++)
{
    for(int y = 0; y < this.ChunkHeight; y++)
    {
        for(int z = 0; z < this.ChunkDepth; z++)
        {
            int noiseValuesMapX = (x / this.HorizontalNoiseResolutionDivisor) + 1;
            int noiseValuesMapY = (y / this.VerticalNoiseResolutionDivisor) + 1;
            int noiseValuesMapZ = (z / this.HorizontalNoiseResolutionDivisor) + 1;

            if(noiseValuesMap[noiseValuesMapX, noiseValuesMapY, noiseValuesMapZ] >= 0.0f)
            {
                this.SetVoxel(new Stone(), x, y, z);
            }
        }
    }
}

Obviously, the solution to the "chunky" terrain is to interpolate between each of the sampled noise values, but I have no idea how to perform that interpolation. How is it done?

sentences:
Non-integer speed values - is there a cleaner way to do this? Often I will want to use a speed value such as 2.5 for moving my character in a pixel-based game. Collision detection will generally be more difficult if I do that, though. So I end up doing something like this:

moveX(2);
if (ticks % 2 == 0) { // or if (moveTime % 2 == 0)
    moveX(1);
}

I cringe on the inside every time I have to write that, is there a cleaner way to move a character with non-integer speed values or will I remain stuck doing this forever?

sentences:
What is the maximum width of a Facebook game page? I read it was going to be changed to 520px, but I keep seeing pages that are new that are the older 760px width. Is it safe to build at the wider width still or should we be building at 520px?

Anyone know if you can still design for 760px width? If not, what's the new width?

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:
Online leaderboards for iPhone games I'd like to add an online leaderboard to my iPhone game.  Upon discovering the time and effort required to create a Game Center account I started considering other options.

What do you use for online leaderboards?  Why?

I'm open to a variety of options including App Engine, using EC2, Open Feint, PlusPlus etc.

-- I'd like to make this a community wiki but I don't see the option.

sentences:
Will I have copyright issues making a mobile game based on an anime? I have been wanting to create a mobile game based on some of my favorite anime.

I want to know if using character images and names from those anime (even after giving full copyright credits and disclaimer) infringes any copyrights?

Would this come under "fair use" in the DMCA (I mean there are already so many not-so-legal sites using this "fair use" to continue running).

What are the possible things I can do for making this game? I have seen many online browser games based on anime which use images and elements from that anime, while I have also seen many games advertise themselves based on a anime but just use diffrent names for characters of that anime (sometimes modifying the character images, too).

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:
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:
Get water flow direction vector from water normal vector Im stuck developing an important detail of my game water: Making it flow downwards!
Considering a typical 3D world in wich water tends to go towards gravity g=(0,-1,0) , and having the normal of the water surface n=(x,y,z), how can I calculate, based on that, the water flow direction vector?
As an example, consider this badly-done graph (In 2D, though)

Update: I'm considering a very simplified water surface (Just a plane: No ripples, no waves, no pressure, etc.). If any of those needed to be applied, the answer would depend on more factors than just the normal.

sentences:
How can I control ads frequency? This question was already asked a while ago, and I wanted to check the present situation:

Can I control ads frequency from the dashboard? (e.g. frequency
capping in Admob)
Can I control ads frequency through Unity IAP API?
If not, does that mean that I need to implement all that "frequency
control" functionality manually?

sentences:
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:
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:
Pong tutorial / Unity Logic question I've been following this Pong tutorial, which is great: https://noobtuts.com/unity/2d-pong-game. The C#, unity components etc I understand. But what I am having trouble with is understanding the logic of how it reverses the direction of the ball depending on where it hits.

I know that what it is doing is condensing a new Y value to -1, 0, 1, via the hitFactor function, which returns that value and then sets that to the new Y (so going up or down) based on the relative ball position to the paddle, divided by the height/size of the paddle. But that's the bit I don't really truly understand, how does that work and why? I have been using Debug.log to send all the different parts of it to try and understand, as well as visually looking in Unity and trying to figure it out from there via the inspector, but I'm just having a mental block. To me I can vaguely see how this code is finding a relative position and then dividing by the height of the paddle to somehow condense it to this range but I'm really just stuck on it in my head.(the hitfactor function itself is basically where I am stuck)

Here's the function:

float hitFactor(Vector2 ballPos, Vector2 racketPos,
            float racketHeight) {
// ascii art:
// ||  1 <- at the top of the racket
// ||
// ||  0 <- at the middle of the racket
// ||
// || -1 <- at the bottom of the racket
return (ballPos.y - racketPos.y) / racketHeight;
}

And in context with the collision:

if (col.gameObject.name == "RacketLeft") {
    // Calculate hit Factor
    float y = hitFactor(transform.position,
                        col.transform.position,
                        col.collider.bounds.size.y);

    // Calculate direction, make length=1 via .normalized
    Vector2 dir = new Vector2(1, y).normalized;

    // Set Velocity with dir * speed
    GetComponent<Rigidbody2D>().velocity = dir * speed;

I'm sure this is a very basic thing, but I am struggling with this type of thing. I am on Khan academy, starting from very basic stuff and working my way up, so no doubt maybe when I get to vectors I might understand this more, but I'd like to try and really get my head around this particular issue.

Sorry for the very basic question, I have been dabbling in C# and Unity for a while, but I have realised my weakness is really in the basic core logic of some things....I am a composer by day but I really enjoy trying to get back into this side of my brain, I guess it's super dusty in there hahaha.

Thanks so much in advance for any help, I truly appreciate it.

sentences:
How would I make my position interpolation stop once the destination is reached? I would like to implement tile-based grid movement and I've heard that linear interpolation comes handy in the implementation process. I've tried to use it but I'm not sure how to make it stop once the target position is reached. I can't find a way to check that on the interpolation. Here's the code I'm using:

function movePlayer(deltaTime) {
    if buttonUp then
       velocity.add(0, speed);
    if buttonRight then
       velocity.add(speed, 0);
    if buttonSouth then
       velocity.sub(0, speed);
    if buttonLeft then
       velocity.sub(speed, 0);

    velocity.scl(deltaTime);

    if (targetPosition.isZero()) {
        targetPosition.add(getNextPosition());
    }

    position.lerp(targetPosition, speed * deltaTime);

    float distance = position.dst(targetPosition);
    if (allowMovement && distance < 0.1f) {
        position = targetPosition;
        allowMovement = false;
        targetPosition.set(0, 0);
    }
}

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:
Ball collisions 'sticking' together I have a program which simulates many bouncing balls. The balls can bounce off each other and off the sides of the container.

The problem I am having is that sometimes when two balls collide, they get stuck together, overlapping very slightly. They will not come apart on their own, but may disperse if another ball knocks into them.

Here is my collision detection and resolution code:

public void handleCollisions(){
        double xDist, yDist, distanceBetween;
        for(int i = 0; i < balls.size(); i++){
            Ball A = balls.get(i);
            for(int j = i+1; j < balls.size(); j++){
                Ball B = balls.get(j);
                xDist = Math.abs(A.getCenterX() - B.getCenterX());
                yDist = Math.abs(A.getCenterY() - B.getCenterY());
                distanceBetween = Math.sqrt(xDist*xDist + yDist*yDist);
                if(distanceBetween <= (A.radius + B.radius)){
                        double dx = A.getCenterX() - B.getCenterX();
                        double dy = A.getCenterY() - B.getCenterY();
                        double collisionAngle =  Math.atan2(dy, dx);
                        double magnitudeA =  Math.sqrt(A.xVel*A.xVel + A.yVel*A.yVel);
                        double magnitudeB =  Math.sqrt(B.xVel*B.xVel + B.yVel*B.yVel);
                        double directionA =  Math.atan2(A.yVel, A.xVel);
                        double directionB =  Math.atan2(B.yVel, B.xVel);
                        double xVelOnCollisionAxisA = magnitudeA*Math.cos(directionA - collisionAngle);
                        double yVelOnCollisionAxisA = magnitudeA*Math.sin(directionA - collisionAngle);
                        double xVelOnCollisionAxisB = magnitudeB*Math.cos(directionB - collisionAngle);
                        double yVelOnCollisionAxisB = magnitudeB*Math.sin(directionB - collisionAngle);
                        double postCollisionXVelA = ((A.mass - B.mass)*xVelOnCollisionAxisA + (B.mass*2)*xVelOnCollisionAxisB) /(A.mass + B.mass);
                        double postCollisionXVelB = ((A.mass*2) * xVelOnCollisionAxisA + (B.mass - A.mass)*xVelOnCollisionAxisB)/ (A.mass + B.mass);
                        A.xVel =  (Math.cos(collisionAngle)*postCollisionXVelA + Math.cos(collisionAngle+Math.PI/2)*yVelOnCollisionAxisA);
                        A.yVel =  (Math.sin(collisionAngle)*postCollisionXVelA + Math.sin(collisionAngle+Math.PI/2)*yVelOnCollisionAxisA);
                        B.xVel =  (Math.cos(collisionAngle)*postCollisionXVelB + Math.cos(collisionAngle+Math.PI/2)*yVelOnCollisionAxisB);
                        B.yVel =  (Math.sin(collisionAngle)*postCollisionXVelB + Math.sin(collisionAngle+Math.PI/2)*yVelOnCollisionAxisB);
                }
                }
            }
        }

So essentially, the method iterates through all possible combinations of two balls. If the distance between them is less than the sum of their radii then a collision is detected and the velocities of each ball are changed.

The next method to run will update the positions of the balls, before the above method is called again.

It appears that my problem occurs when a collision is detected, but on the next pass of the function, the ball is still seen as being inside the other ball and receives a collision whilst trying to get out.

I have tried adding this code when a collision is detected. I expected this to solve the problem by moving the balls to their last position before the collision, but the problem persists

                        A.posX -= A.xVel;
                        A.posY -= A.yVel;
                        B.posX -= B.xVel;
                        B.posY -= B.yVel;

Actually for multiple balls, I'm not sure the above snippet is a good idea anyway.

sentences: Capture High Resolution Screen Shot for Unity Game I'm working on a mobile game. We need some HD screen shot to use in our press kit. I'd like to know, how do we capture HD screen shot of games inside unity's editor. Resolution must support printing quality of banners that we would use to showcase our game in local game expo.

sentences:
Checking for alignment on an axis Suppose I have an array of 5 objects, each time the touches the screen I generate a new array and save the previous objects in another array.

Is there a way to check if the object align perfectly on only axis with a reasonable error margin and detect objects wrongfully aligned?

I could do it using mathematics but I want to see if I could take advantage of overlaps in Libgdx or a similar method.

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:
Textures selectively not applying in Unity On certain imported objects (fbx) in Unity, upon applying a material, only the base colour of the material is applied, with none of the tiled texture showing. This isn't universal; on a test model only some submeshes didn't show the texture, while some did. I have tried every combination of import/calculate normals/tangents to no avail.

FYI I'm not exactly experienced with the software or gamedev in general; this is to make a small static scene with 3-4 objects max. One model tested was created in 3DSMax, the other in Blender. I've had this happen on every export from Blender, but only some submeshes from the 3DSMax model (internet sourced to test the problem)

sentences:
Using Unity's `transform.translate()` to translate relative to an object but only using two axis I'm using transform.translate() to move an object around the world space, relative to the camera that is following it. The camera has an angle of 23 degrees on the X axis.

The problem is that when I move forward the object tries to go into the ground and when going backward the object starts jumping because of the angle of the camera. What I want to do is freeze the Y axis of the object However if I did this the object would no longer be able to jump.

The other solution to this would be to write a method which rests the object to the ground when not jumping but them if the object was jumping and going backwards it would go flying backwards again.

How do I solve this issue?

sentences:
Libgdx: touchup fired even when figure not on texture I've implemented a touchup listener for an actor in stage. Now what happens is that when user touch downs the sprite and releases finger, its all good. The problem is when user touch downs the finger, and drag it somewhere else (possibly to cancel the touch) and releases, it still fires the touch up event as if nothing ever happened. How do I stop that? Here's my code:

voiceToggle.addListener(new InputListener() {
    @Override
    public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println("touched");
        return true;
    }

    @Override
    public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println(event); // still fires even if not on original touchdown element
    }
});

sentences: differences between opengl 3 and opengl 4 I'm just getting started with game programming and I want to start learning opengl. I found a very great tutorial from scratch to get started with opengl 3 and I'm wondering if there is a big difference between openGL 3 and openGl 4. Or I should ask, does openGL 4 make openGL 3 obsolete, or I can start with openGL 3 and then I can move to openGL 4?

sentences:
Changes to one Unity trail renderer causes all of them to flicker I'm using Unity. So I have a prefab, and this prefab has a trail renderer component attached to it.

However, for some of the game objects I want to stop the trailer renderer at certain points in time. But doing so seems to make all of the trail renderers blink; flash off and on. I've tried changing time, disabling the component, and using Clear() while hiding the trail renderer behind the background before needing to be used. All of these makes all trail renderers flicker on the frame the change happens.

I believe providing the code won't be helpful, it's just if(x) disable-action, if(y) enable_action. What can I do?

sentences: Distorted edges in model rendering xna The edges of my model are not rendered smooth in xna. See here. What can i do for this, as when designer renders the same model in maya, edges are smooth. And is it possible to render models in xna which provide same results as Vray pugin renders in maya or max.

sentences:
How to organize level blocks in an Infinite runner I'm working on an Infinite Runner game. I have created many level blocks(sections) with different obstacles and pick-ups for the player. They are positioned and placed manually, in such a way, to give the player a challenge. I thought that making every block a prefab and placing every obstacle and coin as a child of that prefab is going to be easier for me..because the player is going to run and these block prefabs are going to be randomly spawned in front of him and then destroyed after the player gets past them. It worked well.

Then I wanted to make a change on my coins. So naturally I took the coin prefab, made the changes, and applied them hoping that the change is going to take effect on all my blocks... Well..it didn't. Then I found out that nested prefabs don't work in Unity, so now I have to reorganize everything again?

How do I create organized level blocks, and then make them randomly spawn in front of the player? Is there any other option besides prefabs? Don't tell me I have to use a script for every block?

Think about Banana Kong, Temple Run, Subway Surfers. The levels seem random, but it's an organized randomness with certain portions of the level repeating themselves. That's what I'm trying to do, and I don't know how to organize it...

sentences:
Handling accelerate in different devices I am adding tilt controls to my game. The sensor values I get are different in different android devices which results in random behavior.

Anyone knows how can I tackle this situation?

I tried normalizing acceleration but it is still the same.

sentences:
What causes aliasing? I always hear about aliasing and anti-aliasing and I know what it looks like but what I don't understand is what causes it. Is it a physical phenomenon? Or a numerical one?

If it helps to explain, I have some programming knowledge, but not in video games or graphics.

sentences:
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 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:
Updating object's property on Start is visible for a second when game loads I have a world selection scene in which I have GameObjects representing worlds. The GameObjects have default properties when the scene is loaded. For example: the world name text is red and each world has a "locked" status. This initial state can be seen in the following screenshot:

On the Start() method I'm dynamically updating the properties on each GameObject based on values I'm reading from a save file. If a world is unlocked the name text is set to white. If a world is currently selected the name text is set to green. Here's what that looks like at run time:

The problem is that when the scene is loaded from another scene(e.g. by clicking a navigation button) the initial state of the GameObjects can be seen for a second and then they change to the proper values as dictated by the save file. How can I prevent this from happening? I was under the impression that anything that happens in the Start() method takes place before GameObjects are rendered.

Here's some slimmed down code of what my code looks like:

    var worldIcons = FindObjectsOfType<WorldIcon>().OrderBy(x => x.WorldNumber).ToList();
    var saveFile = GameSaveManager.GetSaveFile();

    if (saveFile == null)
    {
        Debug.LogError("Could not find save file while loading worlds");
        return;
    }

    foreach (var worldIcon in worldIcons)
    {
        var savedWorld = saveFile.Worlds.SingleOrDefault(x => x.Number == worldIcon.WorldNumber);

        if (savedWorld == null)
        {
            //add world to save file
            GameSaveManager.CreateWorld(worldIcon.Controller);

            //unlock first world by default
            if (saveFile.Worlds.Count == 0 && worldIcon.WorldNumber == 1)
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
        }
        else
        {
            worldIcon.DisplayName = savedWorld.Name;
            worldIcon.WorldNumber = savedWorld.Number;

            var button = worldIcon.GetComponent<Button>();

            if (savedWorld.Unlocked)
            {
                button.interactable = true;
                button.targetGraphic.color = Color.white;
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
            }
            else
                worldIcon.Unlocked = LevelMapController.LockedStatus.Locked.ToString();
        }
    }

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:
Best practices in managing character states While in development of a character, I feel like I'm digging myself deeper into a hole every time I add more functionality to him, creating more bugs and it seems like my code is tripping over itself all over the place.

What are the best practices when managing character states for a character that has a large selection of abilities and actions that they can perform, without their abilities interrupting each other and creating a mess overall?

sentences:
What is the best way to implement dialogs in an xna game? I want to implement some startup dialogs, for selecting game parameters, etc. The obvious (and I suppose naive) choice is to just use windows forms (I'm not really planning on porting this game to anything other than windows). But implementing this seems to be a real pain, i.e. can't use ShowDialog, and if I use Show() I have the question of how to return the result to the main loop.

I was wondering if there's an established way to implement dialogs (radio buttons, combo boxes, text boxes, etc) in XNA (maybe some libraries) or is it just a case of reinventing the wheel each time?

Just looking for some general advice on this issue before I spend too much time thrashing around trying different things.

sentences:
Image looks GOOD on the editor but BAD (blurry) on the HTML5 export I have a red bar that looks good inside Unity editor, but when I export the build it looks very strange.
Any idea on how to fix this?

The image on the left is the one with the strange/bad looking red bar...

sentences:
When drawing text, numbers appear as D1 or NumPad1 rather than just numbers Been writing a class for a main menu, there's a play button and when pressed it goes to a window that asks for coordinates, sadly when writing with the keys and using the numbers the output is either D1, D2, D3... and so on, or NumPad1, NumPad2... and such. What I want is for the output to be just the number itself rather than the key name.

    private string Coordinates = string.Empty;
    private SpriteFont font;

    private Keys[] lastPressedKeys = new Keys[5];
    public void GetKeys()
    {
        KeyboardState kbState = Keyboard.GetState();

        Keys[] pressedKeys = kbState.GetPressedKeys();

        foreach (Keys key in lastPressedKeys)
        {
            if (!pressedKeys.Contains(key))
            {
                //key is no longer pressed
                OnKeyUp(key);
            }

        }
        foreach (Keys key in pressedKeys)
        {
            if (!lastPressedKeys.Contains(key))
            {
                OnKeyDown(key);
            }
        }
        lastPressedKeys = pressedKeys;
    }
    public void OnKeyUp(Keys key)
    {

    }

    public void OnKeyDown(Keys key)
    {
        KeyboardState kbState = Keyboard.GetState();

        if (key == Keys.Back && Coordinates.Length > 0)
        {
            Coordinates = Coordinates.Remove(Coordinates.Length - 1);
        }
        else
        {

            Coordinates += key.ToString();

        }

    }

Here's the whole class
https://pastebin.com/ZJqXx0zc

is there something wrong with using ToString? Or should I be using something different for numbers?

sentences:
3D camera - window resolution relation I'm having a bit of an issue when it comes to 3D- and 2D camera(s), in relation to a game's window resolution.
I want to let the player choose from different window resolutions, either from a menu or by just resizing the window by dragging the window border, and can't get the scaling of the graphics to work properly.
In games I've played, I can go into the options menu, choose a screen resolution and then the window resize itself and the graphic's, menu buttons etc just scales up to the correct sizes.

At the moment, I've tried two different window resolutions; 800x600 and 1280x720 (don't mind
the different aspect ratios).

800x600

1280x720

As you can see, more of the game world can be seen (more stone tiles can be seen, if that makes sense) in the window with a resolution of 1280x720 and I want my 3D/2D game(s) to be resolution independent and that the same amount of the game world to be seen, independent of what window resolution the player chooses to use.

My camera class consist of:

Camera matrix - used to translate and rotate my camera
View matrix - the inverse of the camera matrix
Perspective matrix - see code below
View projection matrix - view matrix * perspective matrix
Fov - 45.0f
Aspect ratio - camera width / camera height

Note: row-major matrices

Perspective matrix:

const float Tangent     = 1.0f / tanf(DEGREES_TO_RADIANS(Fov * 0.5f));
const float NearToFar   = FarClip - NearClip;

PerspectiveMatrix(Identity);

PerspectiveMatrix[0]    = -Tangent / AspectRatio;
PerspectiveMatrix[5]    =  Tangent;
PerspectiveMatrix[10]   =  FarClip / NearToFar;
PerspectiveMatrix[11]   =  1.0f;
PerspectiveMatrix[14]   = (-NearClip * FarClip) / NearToFar;
PerspectiveMatrix[15]   =  0.0f;

At each update, I'm also setting the viewport by calling glViewport(0, 0, CameraWidth, CameraHeight).
This might change in the future if I decide to make two cameras in a game, for a splitscreen game for example.

How can I solve the window resolution independence issue?

I have though about creating a framebuffer the size I want, attach it to a quad and then render the quad the size of the window, which will scale up/down the framebuffer if the window is bigger/smaller than the framebuffer's original size, but if it's an easier way of doing it, I would gladly use that instead.

sentences:
What are the steps in creating app icon for ios? I have completed developing my game (iOS) and now preparing it to submit to the appstore. However, i have some confusion regarding app icon.

1>In Unity build->player settings, there are various sizes mentioned. Largest size is 180x180 px. But i read somewhere apple requires 512x512 px icon.

2>Is the build-->player settings the only place where i provide app icons or are there more steps involved in xcode? If there are, please provide link to some documentation.

Thanks.

sentences:
Camera Rotation (for mouse look) with LookAt does not work as expected (Local/Global) My code for rotating my 3D fps camera isn't working as expected.
I expect that the X-axis does rotate with the Y-axis, but it ain't so.

I made some pictures to explain it better, I think its doing global rotation instead of local rotation.
But I searched in the internet and used code for local rotation and it was still the same result.

Image

Normal Position
Rotated on Y-Axis
Rotated on X-Axis (how it is)
Rotated on X-Axis (how it should be)

And this is my rotating code:
X-Axis

float sx = sinf(x);
float cx = cosf(x);

up.y = up.y*cx - up.z*sx;
up.z = up.y*sx + up.z*cx;

center.y = center.y*cx - center.z*sx;
center.z = center.y*sx + center.z*cx;

Y-Axis

Math::Vector3f f = Normalise(center - eye);

float sy = sinf(y);
float cy = cosf(y);

center.z = eye.z + f.z*cy - f.x*sy;
center.x = eye.x + f.z*sy + f.x*cy;

It doesn't matter with which order I rotate, still the same.

sentences:
When should I use a fixed or variable time step? Should a game loop be based on fixed or variable time steps?  Is one always superior, or does the right choice vary by game?

Variable time step

Physics updates are passed a "time elapsed since last update" argument and are hence framerate-dependent.  This may mean doing calculations as position += distancePerSecond * timeElapsed.

Pros: smooth, easier to to code

Cons: non-deterministic, unpredictable at very small or large steps

deWiTTERS example:

while( game_is_running ) {
    prev_frame_tick = curr_frame_tick;
    curr_frame_tick = GetTickCount();
    update( curr_frame_tick - prev_frame_tick );
    render();
}

Fixed time step

Updates might not even accept a "time elapsed", as they assume each update is for a fixed time period.  Calculations may be done as position += distancePerUpdate.  The example includes an interpolation during render.

Pros: predictable, deterministic (easier to network sync?), clearer calculation code

Cons: not synced to monitor v-sync (causes jittery graphics unless you interpolate), limited max frame rate (unless you interpolate), hard to work within frameworks that assume variable time steps (like Pyglet or Flixel)

deWiTTERS example:

while( game_is_running ) {
    while( GetTickCount() > next_game_tick ) {
        update();
        next_game_tick += SKIP_TICKS;
    }
    interpolation = float( GetTickCount() + SKIP_TICKS - next_game_tick )
                    / float( SKIP_TICKS );
    render( interpolation );
}

Some resources

Gaffer on games: Fix your timestep!
deWitter's game loop article
Quake 3's FPS affects jump physics—allegedly a reason Doom 3 is frame-locked to 60fps?
Flixel requires a variable timestep (I think this is determined by Flash) whereas Flashpunk allows both types.
Box2D's manual § Simulating the World of Box2D suggests it uses constant time steps.

sentences:
Tilting a platform on its axis? I'm wondering how I can tilt a platform on it's center/axis.

For example, if the player steps on the left of the center, it should tilt to that side like in this picture.

Can a platform like this still be an array of tiles? or does it have to be solid.
Are there any good libraries (javascript) to handle this kind of transformation and the calculations required?

Could someone provide example code for what this might look like?
Thank you.

sentences:
Comparing a saved movement with other movement with Kinect I need to develop an application where a user (physiotherapist) will perform a movement in front of the Kinect, I'll write the data for the movement in the database and then the patient will try to imitate this motion. The system will calculate the similarity between the movement recorded and executed.

My first idea is to store the position of the recorded points and then compare them in the execution time to the patient's movement. I know that this approach is too simple, however, because I imagine that in people of different sizes the skeleton is recognized differently, so the comparison is not reliable.

My question is about the best way to compare a saved motion with a movement executed (on the fly).

sentences:
How to spin a 2D quad in place using only matrices? In short, I have a textured 2D quad (a sprite).  I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices.

If I do the following to a transform with scale in it already, the object spins, but also follows a circular path around the origin.   As a test, if I first undo the scale, then this works fine (the object spins in place).  But I'm not normally keeping scale, orientation and translation separate and then computing the matrix every frame in this case.  I'm mutating the matrix all the time.  So this isn't workable.  Can this be done without first undoing the scale?

self is the current transformation matrix (4x4)
pivot is the "center" of the quad's AABB (recomputed immediately before this)
eulerAngles is a vec3 containing {0.0, 0.0, z-angle}

/* translate to the origin */
translate(self, -pivot);

/* rotate */
rotate(self, eulerAngles);

/* go back */
translate(self, pivot);

(I'm using OpenGL, but that probably doesn't matter much here)

There are other related articles, but I didn't get to a solution.  I'm linking for reference:

Combining rotation,scaling around a pivot with translation into a matrix
How can I rotate about an arbitrary point in 3D (instead of the origin)?

sentences:
Unity Deactivating Keyboard Input Interpolation I'm working on a game in Unity, and it is a little jarring to use with keyboard controls. I'm using the built in Input Manager, where I have a set of axes mapped to the left and right keys. When the player is using the keyboard instead of a joystick, I'd like it to simply be -1 when hitting left, 1 when hitting right, and 0 otherwise, but this isn't the case. I've found that for the first few frames of the button being held, Unity automatically builds up to the value-- for example, if I'm holding right, the value wouldn't go straight from 0 to 1, but rather from 0, to 0.25, to 0.5 and so on, continuously up to 1. Can I deactivate this? If so, how?
Thanks in advance.

sentences:
get back unity default interface i installed unity recently .and interface of unity looks like that  [see the image] in all tutorials i see on the internet.

but this is my one(I'm not in the game tab I'm in the scene tab)it's look like brown and i don't like it.i want default interface the interface in first pic which is black .how can i get black interface back ?

sentences:
Creating a letterbox screen for Android devices I want that the screen looks the same on every Android device without distorting the sprites.

One player should not see more of the map than another player just because they have a bigger screen or different resolution on their device.

I use (1334, 750) as my virtual resolution and only landscape mode is supported. But at the moment, you can see more of the map on top and on the bottom if you have a device with different aspect ratio.

How would I create a letterbox on top and on the bottom so that the visible game window keeps the same aspect ratio and portion of the game world visible on every device?

Do I need to modify my 2D camera when I create a letterbox screen?

At the moment it looks like this:

But it should look like this so that everyone can see the same map on the screen:

 public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Camera camera;
        Vector2 vp, gameWorldSize = new Vector2(1334, 750);
        float ScaleX, ScaleY, Scale;
        Vector2 Newcameraposition;
        Texture2D Background;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = true;
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
        }

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

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Background = Content.Load<Texture2D>("background");
            vp = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            ScaleX = vp.X / gameWorldSize.X;
            ScaleY = vp.Y / gameWorldSize.Y;
            Scale = Math.Min(ScaleX, ScaleY);
            camera = new Camera(new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2), Scale, vp);
        }

        protected override void Update(GameTime gameTime)
        {
            Newcameraposition = new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2);
            camera.Update(gameTime, Newcameraposition, Scale, vp);

            base.Update(gameTime);
        }

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

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.GetMatrix());
            spriteBatch.Draw(Background, new Rectangle((int)gameWorldSize.X / 2, (int)gameWorldSize.Y / 2, Background.Width, Background.Height), null, Color.White, 0, new Vector2(Background.Width / 2, Background.Height / 2), SpriteEffects.None, 0.0f);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }

My 2D camera:

 public class Camera
    {
        public Vector2 PlayerPosition;
        private Vector2 Viewport;
        private float Scale;

        public Camera(Vector2 playerposition, float scale, Vector2 viewport)
        {
            PlayerPosition = playerposition;
            Scale = scale;
            Viewport = viewport;
        }

        public void Update(GameTime gameTime, Vector2 playerposition, float scale, Vector2 viewport)
        {
            PlayerPosition = playerposition;
            Scale = scale;
            Viewport = viewport;
        }

        public Matrix GetMatrix()
        {
            return Matrix.CreateTranslation(new Vector3(-PlayerPosition.X, -PlayerPosition.Y, 0))
         * Matrix.CreateScale(Scale, Scale, 1)
         * Matrix.CreateTranslation(Viewport.X / 2, Viewport.Y / 2, 0);
        }
    }

sentences:
How should I design game object dependencies between windowing, input and behavior systems? This is my first time attempting to create a game engine. I came across a theoretical problem and would like to solve it before implementation. Right now I have a WindowSystem, which opens the window, sets the GL_CONTEXT, etc. I would like it to be responsible for all things window. Then I have another system that manages input called InputSystem. Then I have a BehaviorSystem for game object behavior.

The problem:
Consider a game object representing a menu where it has options to change the resolution/other graphics settings. How can I link these three systems with minimal coupling so that a Behavior script can close the window? Normally systems interact through components, but there's no component for the window. From what I've read systems shouldn't know about each other. I haven't a clue how I could go about such a scenario.

sentences:
Is it useful to distinguish between two different kinds of events? i have thought about this for a long time and i think i just going in circles. I need someone to tell me if im just simply overthinking it.

So, first of all im coming from a 'classical' ECS approach: You got entities that are basically just Ids, Components to these IDs in different colors (PosComponent, 2dGraphicComponent, etc.) and your systems working on those components. Im still working on an game engine, so none of these components are fix.

Now i have an event manager that accepts events. Currently these events are like MouseButtonClicked, KeyPressed, WindowResized etc. These are events, certain systems have to react to these events immediately and can't wait to be resolved in the next game loop. So the polling for these events is at the beginning of the loop. Since the event manager does not know, that system handles this event, every system needs to be called in order, until one system handles the event and gives a positiv feedback. So for example if you click on the gui, you don't want to shoot a bullet.

Then there are events, that always have some context attached to it. Like an event onCollision, where a sound should be played and the player takes damage. In this case this event would need to be handled by two different systems and in context of the collided object. Bumping spikes might actually kill you, while colliding with an enemy may just hurt you. And of course the sounds are different.
Additionally, you may have events that are delayed to trigger. Faraway sounds like gunshots only move with the speed of sound, so delay it in regards to the distance. Or Buffs and Debuffs that run out. So these events should have a connection to a component or entity (id) and some sort of time to dispatch.

These two event types seem so distinct that i can't even think of realizing both as one class, or at least not the all the assumptions i made.

Maybe this is a stupid question, but should i create two different event types and thus eventManager? In my internet searches i have not found anything about this problem, but maybe my Google Fu is a bit rusted.

sentences:
Why does this transparent shader cause objects' z-sorting to be backwards? I am making a Klondike Solitaire game, with the intent of later expanding it to encompass other solitaire games and allow deck customization. As part of this, the playing card meshes I am creating programatically are mostly opaque, but require non-alphatest transparency in order to draw the pips (rank/suit icons) correctly.

The problem is this:

The z-sorting of the cards is the exact opposite of what it's supposed to be. I know that transparency is the problem because the z-sorting works properly when it's disabled (the #pragma alpha:fade in the shader is removed):

...which obviously breaks how the cards' material is being rendered.

This is the shader I have:

Shader "Custom/Card" {
    Properties {
        _CardAtlasTex ("Card Atlas", 2D) = "white" {} // card atlas texture
        _ColorUVZone ("Colour UV Zone", Vector) = (0,0,0,0) // texture zone inside which the pips are, and so the suit colour should be used
    }
    SubShader {
        Tags { "RenderType"="Opaque" "Queue"="Geometry" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert vertex:vert alpha:fade

        sampler2D _CardAtlasTex;
        float4 _ColorUVZone;

        struct Input {
            float2 uv_CardAtlasTex;
            float3 vertexColor;
        };

        void vert (inout appdata_full v, out Input o) { // http://answers.unity3d.com/questions/923726/unity-5-standard-shader-support-for-vertex-colors.html
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.vertexColor = v.color;
        }

        void surf (Input IN, inout SurfaceOutput o) {
            half4 card = tex2D (_CardAtlasTex, IN.uv_CardAtlasTex);
            o.Albedo = card;
            o.Alpha = 1; // make it opaque to start with

            // if this is a pip, colourize it
            if (IN.uv_CardAtlasTex.x >= _ColorUVZone.x && IN.uv_CardAtlasTex.y >= _ColorUVZone.y && IN.uv_CardAtlasTex.x <= _ColorUVZone.z && IN.uv_CardAtlasTex.y <= _ColorUVZone.w) {
                o.Albedo *= IN.vertexColor; // colourized
                o.Alpha = card.a; // transparented
            }
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Things I have tried:

Changing the subshader's RenderType to things like Transparent or TransparentCutout, or removing it entirely. No effect.
Changing the subshader's Queue to things like Transparent or AlphaTest, or removing it entirely. No effect.
Adding a ZWrite On (just before the LOD 200). Does nothing because the generated code forces ZWrite Off due to having #pragma alpha:fade (as far as I can tell), and putting the line after the pragma in hopes of re-overwriting it is a syntax error.

From #3, I'm guessing that if I can somehow force ZWrite On despite the alpha:fade, it should work as expected. But chances are there's something else I'm missing that could work.

Other notes:

The problem is very consistent: the back-most cards are always drawn front-most, no matter what the shuffle is or whether the lower cards are ahead or behind.
There is no alternative to using full transparency; pips can be any colour against any background. (The face card designs don't use transparency.)
All cards use the same material, which uses a single texture atlas.

sentences:
How can I resize my Blender models when importing to Unity? I made a 3D model in Blender, but when put it in my Unity project and add an FPS-camera the camera is bigger then my model. I used the measurements of Blender (that one cube is 1 meter in Unity).

How can I fix this?

sentences:
Box2dWeb: setting velocity of bodies using events I would like to move a kinematic box by pressing the down arrow. As is noted by the console logs, the keydown actually does change the box's velocity... but for reasons beyond my grasp it still doesn't move.

Note that if you place the SetLinearVelocity() call in a spot where it runs immediately, the box will move, but if it is in a setTimeout, or as in my example, called from an event, the box stays frozen despite its y velocity property changing to 1.

I created the simplest example I could to show my problem.

Note: I am using the latest release of Box2dWeb

//std variables
     var   b2Vec2 = Box2D.Common.Math.b2Vec2
        ,   b2BodyDef = Box2D.Dynamics.b2BodyDef
        ,   b2Body = Box2D.Dynamics.b2Body
        ,   b2FixtureDef = Box2D.Dynamics.b2FixtureDef
        ,   b2Fixture = Box2D.Dynamics.b2Fixture
        ,   b2World = Box2D.Dynamics.b2World
        ,   b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape
        ,   b2DebugDraw = Box2D.Dynamics.b2DebugDraw;

//create world and gravity
     var world = new b2World(
           new b2Vec2(0, 10)
        ,  true
     );

//fixture defs
     var fixDef = new b2FixtureDef;
     fixDef.density = 1.0;
     fixDef.friction = 0.5;
     fixDef.restitution = .2;

//body defs
     var bodyDef = new b2BodyDef;
     fixDef.shape = new b2PolygonShape;
     fixDef.shape.SetAsBox(2,2);
     bodyDef.type = b2Body.b2_kinematicBody;
     bodyDef.position.x = 3;
     bodyDef.position.y = 0;

//body and fixture creation
     var body1 = world.CreateBody(bodyDef);
     body1.CreateFixture(fixDef);

//"Before" console log
     console.log("Claimed velocity before down is pressed: " + body1.GetLinearVelocity().y);

//Listener and keycode switch for intended velocity change
     window.addEventListener("keydown", onKeyDown, false);
     function onKeyDown(e) {
        switch(e.keyCode) {
            case 40://down
                body1.SetLinearVelocity(new b2Vec2(0,1));
                console.log("Claimed velocity after down is pressed: " + body1.GetLinearVelocity().y);
        }
     }

//debug drawing
     var debugDraw = new b2DebugDraw();
        debugDraw.SetSprite(document.getElementById("canvas").getContext("2d"));
        debugDraw.SetDrawScale(30.0);
        debugDraw.SetFillAlpha(0.5);
        debugDraw.SetLineThickness(1.0);
        debugDraw.SetFlags(b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
        world.SetDebugDraw(debugDraw);

     window.setInterval(update, 1000 / 60);

//loop
     function update() {
        world.Step(1 / 60, 10, 10);
        world.DrawDebugData();
        world.ClearForces();
     }

sentences:
Collision detection in multiplayer games This a followup to my previous question: How to implement physics and AoE spells in an MMO game?.

There, we concluded that all physics have to be done on the server, and that I should use cylinders for calculations.

Now, how can I check for collision detection on a ground-to-player basis on the server? It's fairly easy if the ground is a flat space, I just check if the player's z coordinate is lower than some value and voila, but, what if the map/ground itself is a model? How do I know where hills are on the server-side? How do I know when object collisions happen?

I'm using node.js and socket.io.

sentences:
What units is Box2d-AndEngine's velocity measured in? I'm developing a game on AndEngine (with Box2d) and on iOS Sprite Kit simultaneously. I want the game's physics to be identical on both platforms. Sprite Kit uses Box2d internally for physics simulation and I'm using Box2d-AndEngine to use it in AndEngine.

In Sprite Kit, I use physicsBody.velocity.
In AndEngine's Box2d, I use body.SetLinearVelocity(x,y).

In Sprite Kit, a physics body's velocity vector is measured in meters per second.

What is the corresponding unit of SetLinearVelocity in Box2d-AndEngine?

sentences:
Shader Graph, add color outline to 2D Sprite I'm having trouble creating a shader in Unity Shader Graph (2D) that fills the image from the bottom to the top and adds a color outline along the visible part of the sprite.

I can fill the image and that seems to be working. I can't however add the color outline. I figured it has something to do with using the inverse alpha of an image, but since i'm pretty new to shaders in general I find it hard to implement it.

This is what i currently have:

As you can see I have the substract node there for the inverse alpha. I'm pretty stuck as to where to go next. I cannot seeme to find a relevant tutorial online. I tried implementing a Fresnel effect, but that seems to only apply to 3D images (i had tried to replace the Master with a PBR master and attaching the fresnel, but it had no effect).

What would be the correct approach from here to add the color outline to the sprite, taking in account the vertical fill?

sentences:
Vertically mirroring the screen in LibGDX I'm developing a game in which the screen layout is different for right and lefty players, so i'll put a button in it to mirror the screen vertically.

For displaying textures and fonts, i use a single scene2D stage with actors and labels. The stage's viewport type is FitViewport.

How can i swap between the right and left layouts?
Is there something already done to do it on the viewport-side?

Is it only a matter of switching coordinates from bottom-left to bottom-right?
I can do that on the viewport camera, but what about all the textures? How can i change an actor's coordinate system?

Thank you all

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:
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:
Not placing tiles correctly on a grid I recently created a map editor, and i came across a problem: I can't position some tiles on some grid blocks, but if i go farther from Y-axis near 0, i can place blocks correctly.

This is the video: Test_001

Map.cpp - createBlock func

void Map::createBlock(sf::Vector2f position, std::string name) {
        double gridPositionX = floor(position.x / grid) * grid;
        double gridPositionY = floor(position.y / grid) * grid;

        double ceiledGridPositionX = ceil(gridPositionX);
        double ceiledGridPositionY = ceil(gridPositionY);

        int mapPositionArrayX = ceiledGridPositionX / grid;
        int mapPositionArrayY = ceiledGridPositionY / grid;

        sf::Vector2f gridPosition( ceiledGridPositionX, ceiledGridPositionY );

        if (!isPositionOccupiedByBlock(mapPositionArrayX, mapPositionArrayY)) {
            Block block = blockTypes[ findBlockNameVector(name) ];
            block.setPosition(gridPosition);

            worldBlocks.push_back(block);
            wMap[ mapPositionArrayX ][ mapPositionArrayY ] = block.getID();
        }
    }

bool Map::isPositionOccupiedByBlock(int mapX, int mapY) {
    return (wMap[mapX][mapY] != 0) ? true : false;
}

sentences:
Voxel blocks world physic I'm making a game like Minecraft. I have a world made of blocks and I'm trying to implement a basic physic system that applies gravity and checks entities colliding with the blocks of the world.

I tried using Bresenham's algorithm, on player move, to get all blocks between, and then get the first solid and set the player on colliding position. That works well if the player is a point, but if it's a complex AABB and the block too, it becomes difficult.

Is there a simple way to make physic in a voxel world like Minecraft?

sentences: Is it possible to look up a texel from a texture in GLES2 GLSL framgent shader without using sampler? Is there some way I can directly access texture memory from fragment shader in GLES2 GLSL? I don't need the sampler to be involved since I am just using it as a look-up table.

sentences:
LibGDX Bomberman bomb arraylist iterator error Here is the code of bomb:

private int x, y;
private Texture bTexture;
private boolean bomb_explode;

private Timer timer;
private TimerTask task;
private int timeLeft = 0;

private TileMap map;
public static List<Bomb> bombs = new ArrayList<Bomb>();

public Bomb(TileMap map, int x, int y) {
    this.map = map;
    this.x = x;
    this.y = y;
    bTexture = new Texture("bomb.png");
    bomb_explode = false;
    bombs.add(this);
    createTimer();
}

public void render(SpriteBatch batch, float delta) {
    batch.draw(bTexture, x * Settings.SCALED_TILE_SIZE, y * Settings.SCALED_TILE_SIZE,
        Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
    if(timeLeft > 1f) {
        bomb_explode = true;
    }
    if(bomb_explode) {
        for(int i = 0; i <= 1; i++) {
            if(x + i <= map.getWidth()) {
                batch.draw(new Texture("flame.png"),
                    ((x + i) * Settings.SCALED_TILE_SIZE), y * Settings.SCALED_TILE_SIZE,
                     Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
            }
            if(y + i <= map.getHeight()) {
                batch.draw(new Texture("flame.png"), x * Settings.SCALED_TILE_SIZE,
                   ((y + i) * Settings.SCALED_TILE_SIZE), Settings.SCALED_TILE_SIZE,
                   Settings.SCALED_TILE_SIZE);
            }
            if(x - i >= 0) {
                batch.draw(new Texture("flame.png"),
                    ((x - i) * Settings.SCALED_TILE_SIZE), y * Settings.SCALED_TILE_SIZE,
                    Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
            }
            if(y - i >= 0) {
                batch.draw(new Texture("flame.png"), x * Settings.SCALED_TILE_SIZE,
                ((y - i) * Settings.SCALED_TILE_SIZE), Settings.SCALED_TILE_SIZE,
                Settings.SCALED_TILE_SIZE);
            }
        }
    }

}

public void Boom() {
    bomb_explode = false;
    for(int i = 0; i <= 1; i++) {
        if(map.getTile(x, y).getPlayer() != null) {
            map.getTile(x, y).getPlayer().Die();
        }

        if(x + i <= map.getWidth() && map.getTile(x+i, y).getPlayer() != null) {
            map.getTile(x+i, y).getPlayer().Die();
        }

        if(x - i >= 0 && map.getTile(x-i, y).getPlayer() != null) {
            map.getTile(x-i, y).getPlayer().Die();
        }

        if(y + i <= map.getHeight() && map.getTile(x, y+i).getPlayer() != null) {
            map.getTile(x, y+i).getPlayer().Die();
        }

        if(y - i >= 0 && map.getTile(x, y-i).getPlayer() != null) {
            map.getTile(x, y-i).getPlayer().Die();
        }
    }
    bombs.remove(this);
}

public void createTimer() {
    timeLeft = 0;
    task = new TimerTask() {

        @Override
        public void run() {
            ++timeLeft;
            if(timeLeft > 3) {
                bomb_explode = true;
                Boom();
                clearTimer();
            }
        }
    };

    timer = new Timer();
    timer.schedule(task, 1, 500);
}

public void clearTimer() {
    timer.cancel();
    timer.purge();
    timer = null;
}

In the screen class, I'm rendering the bomb like this :

for(Bomb b : Bomb.bombs) {
    b.render(batch, delta);
}

Here is the error I'm getting:

  Exception in thread "LWJGL Application" java.util.ConcurrentModificationException
  at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
  at java.util.ArrayList$Itr.next(Unknown Source)
  at bomberman.screens.GameScreen.render(GameScreen.java:41)
  at com.badlogic.gdx.Game.render(Game.java:46)
  at bomberman.game.GameObject.render(GameObject.java:23)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

How can I fix it?

sentences:
Parenting a child object to parent in Unity I am making an 3d Tennis game in Unity 5.0. I have made 3d model of the Tennis player in Makehuman and have successfully imported it to Blender and Unity.

I want to add an tennis racket in the hand on my Makehuman model. So what should the strategy be?

Should I add the tennis racket to the Makehuman character in Blender as the child of the Makehuman model and then animating it or is there a simple way to do that in Unity in the game.

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

How would I go about doing this?

sentences: Relative angle in degrees between 2 lines Could anybody help to solve this? Relative angle between 2 rays(lines) which starts from same point. They could point anywhere 360 clockwise, but angle should be always relative (just inside angle).

sentences:
2D Collision at corners using C# - without xna or unity I'm trying to make collision for a 2D game, the player (car) has to collide with the walls of the track when it hits them. I looked into pixel color detection, and X,Y -based collision (But since its a race track, which isn't square, I don't think this will be the best solution. Correct me if I'm wrong).

I understand the concept of collision for straight lines or squares, but i have no idea how to make a perfect collision in the corners of the track. example race track.

I've been searching the web a lot for tutorials and documents on this subject, but failed to find any real examples that don't use XNA or Unity. I need to find a solution that doesn't include using any kind of game engine.

Any links / documents / code snippets, or even pseudo code snippets would really help me a lot.

An example would be: Per Pixel Collision , the thing about this link is that it uses xna, which i can not use.

sentences:
Purchasing a TV show adaptation rights, how does it work? Basically, I was thinking about a game based on a TV show, just for fun, and ended up thinking "well, it's not like it can be made anyway". Or can it?

In the present situation, developing a game by myself/ourselves on my/our free time, and then using crowdfunding to purchase the rights is not that crazy, if the show is really popular... and the rights not too expensive.

Purchasing the rights of the whole show is obiously a sh!tload of money, but what about adaptation rights? What is the range of price it can be? Is it a percentage of the full rights? Does it depend on the kind of adaptation (novel vs. toy vs. game)?

ps: if it can help answer, I was thinking about a MLPFIM retro RPG. Please don't laugh at me.

sentences:
Pairing algorithm for the Elo rating system Imagine a 1 on 1 (not teams) competition between AI bots, like the Google AI Challenge.  The various bots are assigned an ELO rating based on the outcome of the various versus matches.  The reason I specify AI bots as they can compete 24/7 without regard for player fatigue, geolocation, etc.

Given limited server resources only so many bouts can be run per day.  I'm looking for a heuristic (or an optimal algorithm) to choose which two bots should compete next.

All the past competitions have been tracked.  By this I mean that the algorithm has more to work with than just the ELO ratings.

The use cases I'm partitularly interested in:

The competition has been pairing randomly for while and now I want to make intelligent pairing decision.
The Elo rating have stabilized and a bot is updated.
The Elo ratings have stabilized and new bot is introduced to the competition.

Update:
I need to clarify.  I'm not looking for an algorithm that will provide fair matches.  I'm looking for an algorithm that will find matches most likely to update the Elo ratings of the bots to their "true" ratings with the least number of matches.

sentences:
OpenGL web game: C++ with Java vs pure Java? I'm going to write browser online game, not MMO, but something like a lot of Flash game. But with OpenGL rendering, because Flash is using CPU for rendering.

What are advantages of pure Java or c++ with Java that only create window.

My requirements are:

good performance - low overhead when calling OpenGL functions
short code( if possible ) - so, Java is fully object oriented language, which can require usage of object for each called OpenGL function
basic portability - Linux, Mac, Windows - multiple builds for each platform aren't problem
little communication with server for saves, top score,... not multiplayer - may be slow
game should be downloadable

sentences:
In Unity, how can I cause something to happen on a specific frame of an animation? I have a GameObject "enemy" with an Animator and several states, like "idle", "walk", and "attack".

I want to activate the "hitbox" when an animation "attack" starts. The problems is that the sword does not fall down immediately: it takes about 2 frames.

Is there a way to know what frame of the animation is currently being run?

sentences:
How to play more than one background song in XNA? The current tutorial I am using to play background songs only allows me to play one song throughout the entire game.

Link to tutorial --> http://rbwhitaker.wikidot.com/playing-background-music

I want to have multiple songs where after one song is finished playing another random song will be selected and played.

How would I do that?

Also I would not liked to get involved in XACT.

sentences:
approach for the system that record player actions and imitate it I am trying to implement some kind of system, that would allow AI to imitate player's action at certain points in similar cases. Case example

Player (hp: 10, mp: 5) used skill [BasicAttack] when in battle

When I set for a bot parameters like hp: 10, mp: 5 and state attack it should use BasicAttack skill because in same case player used that action. (I'd like to have ability to define similar cases like when hp: 11, mp: 6 then bot use BasicAttack too because it is similar to hp: 10, mp: 5 case but whatever)

The question is that what are the basic approaches for such cases? Leaving aside snapshotting of player's state, how can such system be implemented?

So far I have two ideas.
My ideas are

1. order player parameters by priority and states and create tree where every node would be
corresponding parameter value. For example node with name [hp] and value [10] will have a
child note [mp] with value [5] thus I can create required paths to actions

2. I have event log with recorded player events. It keeps its record ordered. I iterate over
it and using pattern matching I compare player parameters and retrieve corresponding player
action

The first approach seems much faster though.

But I'd like to know if there already exist approaches for such systems, in order not to reinvent the wheel as I used to do. Are any?

sentences:
Interfaces 101: Making it Pretty I've made a few games which I've actually released into the wild. There's one particular issue I run into over and over, and that's the issue of the interface/theme of the game.

How can you make non-arbitrary, consistent decisions about the look-and-feel and interface of your game?

For example, in version one of my Silverlight chemistry-based game, I made a (bad?) decision to go witha  natural, landscape-style look-and-feel, which resulted in this UI:

Then in a later iteration, I got smarter and went with a more "machiney," grungy look-and-feel, which resulted in this (final UI):

I will definitely say that my taste in UI improved through iteration. But it was a result of a lot of initially arbitrary decisions followed by a lot of tweaking.

Is there a better way to figure out how to theme your game?

To give a parallel in writing, when you're writing a fantasy/sci-fi novel, there are a lot of elements you need to describe. While you can arbitrarily invent objects/creatures/places/etc., you get a much more consistent world when you sit down for a few minutes and design the area, region, planet, or universe. Everything then fits together nicely, and you can ask yourself "how would this work in this universe?

Edit: It seems like I didn't explain this well. Let me simplify the question in the extreme: when I need to lay out a title screen (with background, fonts, skinned buttons) how do I decide how they should look? Green or blue? Grunge or not? Rounded or flat? Serif or sans-serif?

Take that question and explode it into your game as a whole. How do you figure out how things should look? What process do you use to make them consistent and non-arbitrary?

Look at the screenshots again. I could have stuck to grass/sky/rocks, but metal seemed more fitting to the idea of chemical reactions and atoms.

sentences:
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:
Quaternions, Axis Angles and Rotation Matrices. Which of these should I use for FP Camera? After 2 weeks of reading many math formulas and such I know what is a Quaternion, an Axis Angles and Matrices. I have made my own math libary (Java) to use on my game (LWJGL). But I'm really confused about all this.

I want to have a 3D first person camera. The move (translation) is working fine but the rotation isnt working like I need. I need a camera to rotate arround world Axis and not about its own axis. But even using Quaternions, this doesnt work and no matter how much I read about Euler Angles, everybody says to me dont touch on it!

This is a little piece of code that i'm using to make the rotation:

    Quaternion qPitch = Quaternion.createFromAxis(cameraRotate.x, 1.0f, 0.0f, 0.0f);
    Quaternion qYaw = Quaternion.createFromAxis(cameraRotate.y, 0.0f, 1.0f, 0.0f);

    this.multiplicate(qPitch.toMatrix4f().toArray());
    this.multiplicate(qYaw.toMatrix4f().toArray());

Where this is a Matrix4f view matrix and cameraRotate is a Vector3f that just handle the angles to rotate obtained from mouse move. So I think I'm doing everything right:

Translate the view Matrix
Rotate the Move Matrix

So, after reading all this, I just want to know: To obtain a correct first person camera rotate, I must need to use Quaternios to make the rotations, but how to rotate around world axis?

EDIT:

OK, i'm following @Sean Middleditch solution and this should be good, but I think i've missed something...here is the code:

public Matrix4f getView() {
    if (!viewChanged) return viewMatrix;
    if (position == null) position = Vector3f.createEmpty();
    if (rotation == null) rotation = Vector3f.createEmpty();

    viewMatrix = Matrix4f.createIdentity();
    viewMatrix.rotate(rotation);

    Vector4f forward = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 0, -1, 0));
    Vector4f up = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 1, 0, 0));
    Vector4f right = Vector3f.cross(forward.toVector3f(), up.toVector3f()).toVector4f();

    viewMatrix = new Matrix4f(new float[]{
            right.x,                                        up.x,                                       -forward.x,                                     0,
            right.y,                                        up.y,                                       -forward.y,                                     0,
            right.z,                                        up.z,                                       -forward.z,                                     0,
            -Vector4f.dot(right, position.toVector4f()),    -Vector4f.dot(up, position.toVector4f()),   -Vector4f.dot(forward, position.toVector4f()),  1
    });

    setViewChanged(false);
    return viewMatrix;
}

Everything seems to be right, but the "Camera" is rotating now over the origin axis...and I think the problem is because I didnt understand the following:

  construct a regular rotation matrix, and then multiply the standard
  camera vectors by that matrix

Thanks for reading it.

Best regards,

Afonso Lage

sentences: How can I change the splash screen for a standalone game in Unity3D? I want to change the normal Unity splash screen to be customized for my game and every time I change the splash image in the player setting it does not appear. So how can I do that please?

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:
Only send moves for P2P 2 player LAN game? I am making a 2D network game. The concept is simple, a player have to shoot the other player to win. I'd like to improve this game ( add a map, items, monsters, w/e ), but later.

This is my first network programming experience. I have little theorical knowledges about packets, sockets, client/server side, what is dangerous to do client sided, but I've never really used them.

Goals set :

This is a 2 players LAN game, no more no less.
No server. Player 1 starts the game waiting for player 2...
... which leads the game open for reverse engineering or packet editing, but w/e, for this kind of game I prefer simplicity over security.

Pretty basic. For a first network game that will never be shared, I take off problems and will see later.

This is where I am : each player is a square that can move in four directions. The approach :

TCP Packets.
Each movement ( each frame a key is pressed to be accurate ), a packet is sent to the other player with his position.
Packets are received each frames before drawing and updating game elements, in the same thread, with a non-blocking receive() function.

And that's it.

My questions :

Is sending a packet for each moves overkill? Will I have problems with this later?
What kind of problem can I meet? mono-thread + non blocking function will be a problem later, assuming the goals I've set?

sentences:
Is it possible to access vertex values of an object created using display lists? I wanted to learn to develop games so started with tetris. I encountered a problem right in the beginning. My game is 20% ready. There are five types of shapes viz YELL, BOX, LINE, TEE, YEL which are shapes of different kinds. I created five display lists like this

#define YELL 1
#define BOX 2
#define LINE 3
#define TEE 4
#define YEL 5
int bs=20;
void defineshapes()
{
glNewList(YELL,GL_COMPILE);
    glPushMatrix();
    glTranslated(-bs,0,0);
    glColor3fv(color[color1]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color2]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color3]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(-2*bs,-bs,0);
    glColor3fv(color[color4]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glPopMatrix();
glEndList();
glNewList(BOX,GL_COMPILE);
    glPushMatrix();
      .....

and randomly picking one like this

srand(time(NULL));
color1=rand()%6;
color2=rand()%6;
color3=rand()%6;
color4=rand()%6;
defineshapes();
randshape=rand()%5+1;

and drawing in display function like this

void display()
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    glTranslated(x2,y2,0);
    glCallList(randshape);
    glPopMatrix();
    glFlush();
}

I expected problem in the beginning itself when i used the display lists because i had to access the vertex values(x,y) of the shapes to check if they might overlap with another block below before moving them down. Is there a way of knowing the vertex values of objects drawn using display lists.

I encountered the same problem once before when i needed to create a tyre of a car. I wanted the tyre to be painted with colors so created a mesh by rotating a circle again using display lists. Then i needed to know the values of the intersection points of longitudes and latitudes which i didnt know how to get so i abandoned that task.

A YELL looks like this

What is the easiest method of getting around this problem. I am sure OpenGL has a way of getting this done but i am new to it.

sentences:
How do I prevent a KActor from changing the orientation of its Z-Axis? So I have an object that inherits from KActor that I would like to behave as a dynamic physics object, but I want its Z-Axis to remain upright, but very stiffly. I've tried the bStayUpright that triggers the "Stay Upright Spring". The problem is, it's a spring, and the object in question oscillates into position when I want it to remain oriented properly without wobbling.

In the image above, the yellow block has fallen onto the gray box, and it is currently pivoting about the contact point as it tries to right itself.

Should I be tweaking the StayUprightMaxTorque and StayUprightTorqueFactor parameters, or should I be using a Constraint of some sort?

sentences:
Audio slider doesn't change value For some reason, my slider and audio resets back to 0 when I stop and play the game after I changed the value. Here is the code, I can't spot anything wrong with it:

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

public class MainAudio : MonoBehaviour {

public Slider slider;

void Awake()
{
    PlayerPrefs.Save ();
    GetComponent<AudioSource> ().volume = PlayerPrefs.GetFloat ("CurVol");
    if (slider)
    slider.value = GetComponent<AudioSource> ().volume;
}
public void VolumeControl(float volumeControl)
{
    GetComponent<AudioSource> ().volume = volumeControl;
    PlayerPrefs.SetFloat ("CurVol", GetComponent<AudioSource> ().volume);
    PlayerPrefs.Save ();
}
}

sentences:
Correctly done level scaling? A lot of role playing games have a system where npcs scale with the player level and become stronger, on the surface it might seem genial but in most games either it doesn't change anything or it makes low levels enemies ridiculously hard to beat or sometimes impossible, like in oblivion.

I came up with the idea of making nps not scale with the level of the player but scale with stats.

For example a level 1 wolf has a base attack that deals 5% of the players maximum HP as damage with each hit, but is mitigated by defense. Therefore the attack will remain consistent in strength even when the player is max level but can be blocked by sacrificing damage to build  a lot of denfese or by becoming better at parrying attacks.

Is there any other mechanism I can implement to make the npcs stronger through all the levels without making them ridiculously invincible or giving them one hit mechanics that instantly kill the player?

sentences:
Looking at the mouse position in a top down Unity game? I'm trying to make a simple top down game where the player looks at wherever the mouse is pointed.  The player is only going to rotate on the Y axis.

Here's what I have so far but I can't seem to get it working.

private void RotateToMouse()
{
    //Veriables
    Vector3 ScreenMouse;
    Vector3 ShipPos;

    //Get Mouse Point ON screen
    ScreenMouse.x  = Input.mousePosition.x;
    ScreenMouse.y  = Input.mousePosition.y;
    ScreenMouse.z  = 1;

    //Get Mouse Point In World
    WorldMouse = Camera.main.ScreenToWorldPoint(ScreenMouse);
    //Get Ship Position
    ShipPos = transform.position;

    //Get Angle Of Mouse From Ship Position
    Angle = Mathf.Atan2(ShipPos.z - WorldMouse.z,ShipPos.x - WorldMouse.x) * 180 / Mathf.PI;

    transform.localEulerAngles = new Vector3(0,Angle,0);
}

sentences: What is the point in using API such as Open GL or DirectX when there are game engines? I was wondering why  today programmers place so much emphasis on API like DirectX, and even OpenGl. As far as I know, you'd need thousands of lines of code to make a simple 3D game using one of the aforementioned. But with game engines like Unity, the process is simplified and you can pretty much drag around shapes to create the graphics in lieu of programming it. So what I wanted to know: why is knowing APIs DirectX more preferable than being knowledgeable in Unity, other than the fact that with an API you can code it to be portable on other systems. To me it's like choosing Assembly over a high level language like C. Sure, with assembly I'll really understand what's happening at machine level, but it's take a lot longer to write programs using it and it would be a lot harder to debug.

sentences: Unity Bowling ball physics I am working on Bowling Ball game for android. And I want the Bowling Ball to feel like a Bowling ball in the real world. I've already tweaked the Rigidbody values and PhysicsMaterial but it's giving me that result. So, how do I make Bowling ball like real BowlingBall in Unity?

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:
2D bouncing ball simulation - angular velocity How does angular velocity of a ball affects it's speed after a bounce? I'm trying to simulate 2D bouncing ball physics. I've found a nice solution how to calculate ball's velocity after a bounce:

mVelocity.x *= 1 + mi * (e - 1);
mVelocity.y *= -e;

where mVelocity.x is a component of ball's velocity parallel to the "surface" of a bounce, mi is coefficient of friction, e<=1 representsthe energy loss during the impact.

It's looks quite realistic, however I'd like to calculate angular velocity as well - and I assume it's also affecting how the ball actually bounces. I tried to achieve it using matrix found on wolfram site - http://demonstrations.wolfram.com/BouncingASuperball/ (it's in the bottom of the page), but its implementation doesn't look realistic at all, ball is acting very wierdly. How can I calculate it?

sentences: How can I prevent the knob from resizing when I use the Slider? I am using the Unity Slider component.  I have a custom background and custom knob.  But whenever I move the slider, my knob's size becomes distorted.  It is 100x100 pixels, and when I set it to its native size, it does so.  But I soon as I move the slider, it cuts its height in half.  How can I prevent this from happening?

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:
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:
Selection of a mesh with arbitrary region Considering example:

I have a mesh(es) on the OpenGL screen and would like to select a part of it (say for delete purpose). There is a clear way to do the selction via Ray Tracing, or via Selection provided by OpenGL itself.

But, for my users, considering that meshes can get wired surfaces, I need to implement a selection via a Arbitrary closed region, so all triangles that appears present inside that region has to be selected.

To be more clear, here is screen shot:

I want all triangles inside black polygon to be selected, identified, whatever in some way.

How can I achieve that ?

sentences:
How does Blizzard manage to support Mac OS and Windows in their games? I've always thought that using Direct X for Windows was the most powerful, easy and modern method to create games with modern graphics, nowadays. Knowing that it's only Windows, I thinks it's pretty difficult to make something similar on other platforms; Mac OS, to be exact. However, Blizzard somehow managed to deliver Starcraft 2 for Mac OS, and Diablo 3 will be available for Mac, too.

So what I'm interested in is information about:

what technologies are they using for their game engines?
are they using one engine for both games (Starcraft 2 and Diablo 3), or do they develop custom engines for each game?
what are they paying, in terms of time and money, for Mac OS support?

sentences:
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 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:
Daz3D for creating game assets Are the Daz products viable for 2D/3D game asset creation or are they geared more towards creating art?  I am thinking of the products: Daz Studio 3D, Bryce and Carrara.

If you have used any of these products for 2D or 3D asset creation please provide input on any export issues you have encountered.

sentences:
C++ Frogger game - Logs on Water bounding boxes? I am making a Frogger game in C++ using SFML but have come across a problem.
I have a block of water and log rectangles moving over it (All sprites) and would like the Frog sprite to do something when it hits the water, however with bounding boxes, even in the frog sprite moves onto a log it still passes the water bounding box and carries out the code for that. Is there any way to have the conditions so it intersects the water but only does something when it's not in collision with the log's?

Thank you.

sentences:
I would need an idea on how to animate a player in a board game that is top-down and 2D? I'm planing a 2D board game and I cannot figure out how to make the animation of the player from tile to tile. Note that tiles are not in a grid, they are flexible (x, y) points in the map.

The ways I found until now:

Just move the player from (xi, yi) to (xf, yf) with nothing special
An helicopter comes from an edge an transport the player (a circle) to the next tile
A little man walking by making it in a wrong perspective (side)

Do you have any better ideas, thanks alot?

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:
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 manage shaders? I've done some shader programming some time ago but only simple stuff. I'm especially interested in how do you manage shaders? Do you just write one of each kind, or do you need more of them? If so, how exactly do you split and managed them?

Also I've recently read that all the transformation matrix operations I used in OpenGL(glPushMatrix, etc) are now deprecated and you need to manage your own matrices.Is that something you do in a vertex shader and how would I go about doing it correctly?

Suggestions for books about this topic will be highly appreciated.

Thank you.

sentences:
How to encrypt Save Files without using a key? Say I made a simple program that takes a file .dat that is encrypted in Binary Format, then I decrypt it into a byte array and then everything is rewritten again into the file decrypted.

For Example:

I've made a binary encryption algorithm. => 0100100001100101001000000110100001100101011000...

But this is very very easy to decrypt...

Is there any way, that, if it's possible does not need any sort of key, to encrypt my save progress?

sentences:
Tags changing automatically on iOS build! First let me tell you that game runs fine in the editor. I check for hitting an enemy via a tag comparison and as I said it works correctly in the editor but when I deploy to my iPad and attach remotely with with MonoDevelop, I can see that the same object I'm checking against in Editor and had "Enemy" tag now has another tag, "Door".

Even before character doing anything, their tag is changed to "Door".

It's actually in the main menu and before running much code so I'm fairy certain it's not my code.

I'm sure there is nowhere in the code that I'm changing the tags.

And my specs: Unity is 5.6.1, Xcode is 8.3.3 and my iPad iOS is 10.3.2 and my macOS (OS X) is 10.12.5
(Tried with both Append and Replace builds)

Thanks

sentences:
What's a good 2D game engine or framework to work on right now? Basically, I'm looking for a good, 2D game engine to build a platformer/contra-like shooter on to bolster (and when I say bolster, I really mean start) my portfolio.

I use the words "right now" in the title because I've read through some questions, and I don't really want to use anything like Java's game API for mobile phones from 2003. (Also, XNA is out of the question as I'm already working on a larger scale project in it.)

I'm fairly competent in Java, and have a basic understanding of other languages like C# and Python, but I'm totally unopposed to learning a new language while learning the engine (within reason).

The engine doesn't have to be super powerful, just free and simple enough that someone of my skill level (3rd year CS major) can get a nice horizontal slice out without too many bumps along the way.

sentences:
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:
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:
Mapping noise to sphere surface I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea was to create a Perlin like "3D Noise Field" and sample density where each of the spheres vertices fall (as a height-map value). this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;

    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = sphere.verts[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

edit:

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" look I was aiming for. Any suggestions on how can I change the "noise field" so my surface is more planet like? or how else can i achieve this?

sentences:
How to deal with weapon power-creep in an RPG? Power creep is a process that sometimes occurs in games where new content slowly outstrips the power of previous alternatives. This leads to players abandoning previous options in favour of the latest and more powerful alternatives, resulting in an inevitable increase in power throughout the game.

I am developing a private RPG that has approximately 10 players. Although the scale of the game is very small, it is falling victim to power-creep. Four players have reached the current "end-game" weapon and armor set and are running out of things to accomplish in terms of collecting the most powerful items.

I have a lot of great ideas planned, but many of them involve releasing weapons that are not stronger than the current strongest. The negative of this is that the players who have already achieved something greater don't look forward to the content update, and tend to come online less often. I don't want to release a weapon that is stronger, because this releases a lot of new issues with balancing in other areas of the game.

I have a couple of ideas that could slow this issue:

Although the new weapons may hit less damage, they may perform different effects that benefit the player in different ways
Reduce the damage of all weapons, so the slot for the previously-strongest weapon opens up for a new weapon.

How do I slow/stop power-creep of weapons and armors? (This question is not about finding ways to keep players online longer).

sentences:
How to make a script work when clicked only on the given prefab? I am very new to unity but not to C#.

I am working in Unity 2D

I made this prefab called LongLane. Its basically a collection of sprites of road, put together into a Gameobject. Now I wanted objects to spawn on the road when I ONLY click on the road, I can spawn the object on the road but they spawn regardless of where I click. I have written some code but they aren't clear and readable.

So how do I make a script work only when clicked on that specific prefab

sentences:
Is a SQLite Database Suitable to Store the Building Blocks for Dynamic Content? I am trying to make my own game for fun, it is basically a 2d side scrolling shooter, with dynamically generated enemies, levels, loot, and some other things. Currently I have dozens of XML files that define pretty much everything when it comes to the content, along with some constraints to keep things sane. Often times certain things like Weapons or Monsters are composed of several randomized sub components, that get picked out of a pool, according to factors such as rarity, the player level, and the game level.

Currently the way I have it setup, is where during initialization the game creates several factory classes (stuff like WeaponFactory and EnemyFactory), these parse the XML and store the XML's data in a more manageable format. Creation is simply done by invoking a create method, and passing the required parameters (i.e. player level, monster level, etc), these parameters are taken into consideration for what should be generated.

Anyways I was wondering if it would be a better idea to use a SQLite database to store all this information? I have looked around, and it seems to be a mixed response. Does anyone have any sort of insight into this? I am using C++ and OpenGL currently.

EDIT

I probably should have been more clear, I was more or less asking is it actually a usable way of doing this kind of stuff. My main concerns lie in the fact of choking the Database with requests. Reality is this game will never see the light, and has technically been done as of a few weeks ago, however I decided to go back retool the engine to use Box2D Physics. This is more a learning process, than anything.

sentences:
2d coordinates vs x/y screen positioning I have a 2d top-down view tile map game, that generates random color tiles (water colors) as you move the character. I've been positioning elements on screen using the x/y coords (finding a way to generate new tiles as the player moves was no picnic, but I did it).

My problem is that I want to establish an actual map-level coordinate system, so the player knows where they are. I'd prefer to just count a first "spawn" area as 0,0 and then count from there.

How should I handle doing that? The problem with x/y is that it's relative to the window frame. I have code that detects when the character reaches the edge of the window, and it "freezes" the player, and moves the map instead.

Whatever system I use, I'll need to be able to add code that can check for other nearby entities.

sentences:
How to make a wait timer? I am making a mining styled game and am looking to make variables that effect how fast you are able to mine the block. This is the idea I have currently got but it does not wait for the timer to complete before mining, has anyone got a better way to do this?

        if (MinePlayerCollision() && newState.IsKeyDown(Keys.D))
        {
            MiningElapsed = (float) gameTime.TotalGameTime.Seconds;

            if (MiningEff <= MiningElapsed)
            {
                BlockMined = true;
                MineReset = false;

                MiningElapsed = 0;
            }
        }

sentences:
How can I set the remaining distance of the nav agent? I have an issue with the nav agent in my game. That I am using the remaining distance to determine the next state of the AI.

When the navagent is first given a destination it uses the previous distance until it is next updated.

So my plan is to find the memory of the remaining distance and alter it when I set the destination. Is that possible or is there a better way?

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:
How do I render only part of a texture to a point sprite in OpenGL ES for Android? Using the libgdx framework, I've figured out how to render a texture to a point sprite. The problem is, it renders the entire texture to the point sprite, where I only want a small part of it (since it's an isometric tile image).

Here's a snippet from some demo code I wrote...

create()
{
    renderer = new ImmediateModeRenderer();

    tiles = Gdx.graphics.newTexture(
        Gdx.files.internal("data/tiles2.png"),
        TextureFilter.MipMap,
        TextureFilter.Linear,
        TextureWrap.ClampToEdge,
        TextureWrap.ClampToEdge);

    Gdx.gl.glClearColor(0.6f, 0.7f, 0.9f, 1);

    Gdx.gl.glEnable(GL10.GL_TEXTURE_2D);
    Gdx.gl.glEnable(GL11.GL_POINT_SPRITE_OES);

    Gdx.gl11.glTexEnvi(
        GL11.GL_POINT_SPRITE_OES,
        GL11.GL_COORD_REPLACE_OES,
        GL11.GL_TRUE);

    Gdx.gl10.glPointSize(s);

    tiles.bind();
}

render()
{
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    renderer.begin(GL10.GL_POINTS);

    // render 3 point sprites at various 3d points
    renderer.vertex(-.1f, 0, -.1f);
    renderer.vertex(0, 0, 0);
    renderer.vertex(.1f, 0, .1f);

    // ... more vertices here if needed (one for each sprite) ...

    renderer.end();
}

sentences:
Unity: UNetWeaver warning: SyncVar set from within property function. This will not set dirty flags. How to? I was trying out the new Unity networking and I added the SyncVar attribute to one of my variables to be synced. I also have a property to get/set the variable and update the visuals when set. I set the "hook" variable in the SyncVar so the property is used and visuals are updated properly (or that was the idea, since it gives an error :P)

[SyncVar(hook = "set_Tapped")]
private bool _tapped;
public bool Tapped
{
    get { return _tapped; }
    set { _tapped = value; UpdateRotation(); }
}

Now however I get an error in the console:

UNetWeaver warning: SyncVar [_tapped] set from within property function [System.Void Card::set_Tapped(System.Boolean)]. This will not set dirty flags.

How should this be handled? I could just make a set method myself (not using properties), but is there a better/nicer way?

Thanks!

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:
In Eclipse using libgdx, what does "project description file is missing" mean? In a sudden case of nostalgia, I switched my eclipse workplace from my working libgdx projects to an older one. After looking through my old stuff I had some problems switching it back, since I didn't import it right. After I got that working, I cant run my libgdx desktop projects anymore. It says it couldn't load the Spritesheet anymore: After googling a little, I was told to make sure the Android asset folder is linked to the desktop project, which it is.

I then noticed that one of the project folders is closed (I've got Project-android,Project-core,Project-desktop and just Project) The folder project was closed and when trying to open it, it gave me the following error:

  The project description file (.project) for 'Projekt Stella' is missing. This file contains important information about the project. The project will not function properly until this file is restored.

The thing is I made sure that this file is still in the folder which it is... so now I have no idea how to get this working. Any ideas?

Edit: The project works fine in Android studio. Its just not working in Eclipse.

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:
Determine wheter an octree node needs to be continue For collision detection (moving vs. non-moving) in my current project, I decided to implement an octree approach after the preselection.

The only collision detection I'm currently using is a AABB-vs.-AABB collsion detection. Now, if this detection returns true for two objects (n, m), I want to subdivide the AABB into eight smaller axis-aligned boxes, and so on. (Octree)

Implementing the subdivision itself is now problem for me, but I'm stuck at the following:
How can I determine whether a node needs to be divided further, or whether further subnodes are unnecessary?

Since I got objects of various complexity (a model with ca. 1500 vertices vs. a cube with 8), I can't simply check for the amount of vertices inside an octant.

What ways are there to determine whether a subdivision is necessard? Or am I even using a wrong approach any something else might work better?

Edit: I now think that an octree might be the wrong approach. What would be the best way to check for a more exact collision detection after an AABB collision detection returns true?

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:
Rotating an object with quaternion I have a question in regards to using quaternions for the rotation of my graphics object.

I have a Transform class which has the following constructor with default parameters:

Transform(const glm::vec3& pos = glm::vec3(0.0), const glm::quat& rot = glm::quat(1.0, 0.0, 0.0, 0.0),
    const glm::vec3& scale = glm::vec3(1.0))
{
    m_pos = pos;
    m_rot = rot;
    m_scale = scale;
}

In my Transform class calculate the MVP as follows:

glm::mat4 Transform::GetModelMatrix() const
{
    glm::mat4 translate = glm::translate(glm::mat4(1.0), m_pos);
    glm::mat4 rotate = glm::mat4_cast(m_rot);
    glm::mat4 scale = glm::scale(glm::mat4(1.0), m_scale);

    return translate * rotate * scale;
}

The issue I'm facing is that when I use const glm::quat& rot = glm::quat(1.0, 0.0, 0.0, 0.0) my object appears normal on screen. The following image shows it:

However if I try to use for example const glm::quat& rot = glm::quat(glm::radians(90.0f), 0.0, 1.0, 0.0) (rotating on y axis by 90 degrees) my object appears as if it has been scaled. The following image shows it:

I can't figure out what is causing it to become like this when I try to rotate it. Am I missing something important?

If it's of any relevance, the following is how I calculate my view matrix:

glm::mat4 Camera::GetView() const
{
    glm::mat4 view = glm::lookAt(m_pos, m_pos + m_forward, m_up);

    return view;
}

sentences: How to get smooth transition within slick? When a player clicks start, my app immediately switches to the first level. My question is how do I incorporate a smooth transition within Slick?

sentences:
Unity-Error within Tree Editor I've been making a tree in with the Tree Editor in Unity, and for a realistic effect, I need to make all the leaves face a general direction, the problem is that most of them don't face that direction and are upside down or sideways.

So you further understand, i'll add some images.

I'd like all the leaves to face in this direction.

(Image 1) In here you can see that some leaves are upside down or sideways and i'd like to make all the leaves face the same way.

(Image 2) In here you can see the leaf is facing up and this is the way I would like all the leafs to face.

Any help is appreciated, thank you.

sentences:
Why am I getting these artifacts when rendering polygons with OpenGL and SDL from far distance? I'm working in a toy BSP (quake3 version) renderer. I started creating the context and handling the input with GLFW but then I switched over SDL. The performance change was amazing with SDL leading with 100+ fps.

But when rendering some surfaces from far now I'm getting some strange and ugly artifacts in the borders or junctions. The only thing that I changed from GLFW to SDL was the initialization (code bellow) and the input handling but the OpenGL Draw calls are the same.

Why am I getting these artifacts when rendering polygons with OpenGL and SDL from far distance?

This only happens with some surfaces (mostly the ones without textures, only vertex colors) but there are some tiny surfaces (pendants or flags) that also have the same problem. Also, not all the borders of the same faces have the problem.

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
    cout << "Failed to init SDL Video" << endl;
};

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS,   SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);

_window = SDL_CreateWindow("BSP Test", 0, 0, width, height,
                            SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);

if (_window == nullptr) {
    SDL_Quit();
    return false;
}

SDL_GLContext ctx = SDL_GL_CreateContext(_window);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glGetIntegerv(GL_MAX_PATCH_VERTICES, &ee);
cout << "Max patch vertices : " << ee << endl;

glPatchParameteri(GL_PATCH_VERTICES, 9);

cout << "GL ERROR LOAD  :" << glGetError() << endl;

glClearColor(0.0f, 0.0f, 0.01f, 1.0f);

glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LINE_SMOOTH);

SDL_GL_SetSwapInterval(0);

matrices.proj = glm::perspective(glm::radians(100.0f), (float) width / (float) height, 1.0f, 4000.0f);

camera.position = glm::vec3{-41.415211f, 320.293121f, -537.225281f};

return true;

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:
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:
Can someone explain to me the difference between 2 XNA methods? I was recently trying to make a boucing ball off the environment walls. I apparently had everything correct, except for one thing, that I corrected stupidly, which made my code work, but I don't understand why.

So I had set the value of a 2d vector's X and Y inside protected override void Update(GameTime gameTime); this vector was what I would add to the object's X and Y so it could move according to whatever logic.

But it didn't work, the fix to this problem was to apparently declare the vector's values inside protected override void LoadContent().

So can anyone explain to me, what is the difference between declaring your variables/constants inside these two methods? And why?

EDIT : Wrong Sourcecode :

  protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        // Loaded content
}
 protected override void Update(GameTime gameTime)
    {

        // Allows the game to exit
        if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape))
            this.Exit();

         //Code logic

            movement.X = 5;
            movement.Y = 5;
            birdbox3.X += (int)movement.X; //this variable was declared outside of any local field as a rectangle

            if (birdbox3.X <= 0)
            {

                movement.X = -movement.X;
            }
            else if (birdbox3.Y <=0)
            { movement.Y = - movement.X;
            }
            base.Update(gameTime);
        }

So when I would run this code, the birdbox3 would just stop when the if statement is fulfilled. The correct version would be to cut the

            movement.X = 5;
            movement.Y = 5;

and paste it into LoadContent() instead. The problem is I do not know why.

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:
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 it possible for Minecraft to use time-dependent in-game progression rather than current tick-dependent? I see the problem of the current tick-dependent approach to propel the in-game progression. The drawback of this tick-dependent approach is that if a computer running the game is not powerful enough, or there is so many entity to be ticked, the TPS will drop and overall in-game progress will be slowed down, which will negatively impact the in-game experience and immersion.
If the game used time-dependent approach instead, behavior and progression of any entity in a world will be based only on time, which increments regardless of how fast the computer is.
Imagine of projectile motion. The position of a projectile can be readily calculated by the simple formula which is a function of time, without the need of "repeatedly ticking" the object to the new position.
Also this can apply to any redstone circuits, which has exact operation time for each component. Given a serial connection of redstone repeaters, which, for some given time, can be finded out that which repeater is activated.
I wonder that this approach can be apply to Minecraft (or other video games)?

sentences:
Trying to make sprite float up and down Using LibGDX + Box2D and my understanding of the answer posted from this question: Here

I apply the following impulse:

// modify sprite's Box2d Body object
int a = 8; // amplitude
int f = 1; // frequency
int p = 1; // phase
float value = (float) ( a * Math.sin( 2 * Math.PI *f * TimeUtils.millis() + p ) );
body.applyLinearImpulse( 0, value, body.getPosition().x, body.getPosition().y, false );

// render it
sprite.setPosition( body.getPosition().x, body.getPosition().y );
sprite.draw( spriteBatch );

But this just causes my sprite to go straight up and offscreen rather than doing a wave. What part of the algorithm am I doing wrong?

sentences:
Constrain parent node transform to child bounds If I have some node rendering tree set up, where a node basically has a draw method to render things, and a transform, represented as a 3x3 matrix, with scale and translation.

Now, I would like to constrain the scale and translation of that node (constrain the transform basically) to the bounds of the child. So if the child is a 300x400 image, I want the root to only scale large enough to see the whole image, not more. So does the translation, that it does not go beyond the image bounds. How can I achieve that? Which sorcery of mathematics must I read about to learn this? Affine transforms or what?

sentences:
How does MMO flash games works? I want to know how does MMO flash games work, for example: Dofus and Club Penguin.

I want to know if by ony using Adobe Flash and ActionScript you can do MMO games, or if there is other way to work with ActionScript and Flash beyond Adobe Flash.

sentences:
What is next to interpolate camera position with smooth speed changes? I am working on a path camera to be used in demo playback. (3d game) The spline math used is catmull rom. I am on my second attempt to get constant position speed :( (someone else is doing rotation). The path cam keyframes are position@time.

I have a step now when the path is recalculated, it also generates the arc distance/time lookup table which I have normalized. I have the duration of each segment(k through k+1)as well as each segments linear velocity calculated from that data.

I am not very good at reading anything except basic equations. I could use an explanation or psuedo code of what is needed next in order to get the camera to smoothly accelerate or decelerate depending on the velocity of the next segment. Right now it's instant changes and no good. I tried googling for hours and was going in circles.

sentences:
Help with timebased scoring algorithm Im trying to devise an appropriate scoring system for my game.  The game in essense has a finite number of tasks to complete (say 20) and the quicker you complete these task, the more points you get.  I had devised a basic way of doing this using bands of time multiplied by a score for that band multiplied by the number of tasks solved within that time band i.e.

(Time Band) = (Points)
1-5 sec  =    15,
5-10 secs =   10,
10-20 secs    =    5,
20-30 secs   =     3,
40 secs onwards     =     1,

So for example if I did 3 tasks in the 1-5sec band i'd get 15*3=45points, if i found 10  in the 20-30sec band i'd get 3*10=30 points.

Im sure there is a more mathematical way of doing this using powers of some kind but I just can't think how and hoping someone has already done something smilar..

Many thanks in advance

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:
Abstracting Game Logic from Game Engine I've seen that the Quake 3 Engines uses QVMs and DLLs for the gamelogic. Unity uses some kind of Component-Entity system.

My question is basicly:
What's a good way to keep the engine seperated from the game logic itself, without having such things as "QVMs" or Component Systems.

The problem is, all my  current approaches on creating an "seperation" of the logic leads me in having kinda unflexible code or code that has to deal more with the engine than the logic itself.

I know this can be seen as too broad, but this problem is bothering me for a week yet and I can't seem to find a way to fix this.

EDIT, see first comment:
To be honest I tried only 3 approaches.

My approache number one was for example to programm an "App Class" creating and handling events:

class DXApp
{
private:
  HWND ... // All that windows stuff
public:
  virtual void Render();
  virtual void Update( float fTime );
};

On top of that I created little abstraction layers ( abstract Buffers then Model classes based on them ) which ended in the code dealing more with the engine than the logic itself. E.g. I am asking the window for User Input, which makes use the explicit object(-methods ).

My second approach was to create an GameState based logic with ManagerClasses which are calling my methods. This made my game logic yet again pretty dependent of the engine.

My third approach however, was to use an scripting engine. This made my end up in mapping many classes to Python classes ( the engine was calling the scripts! ). The code wasn't clean at all.
On top of that, the more function calls I used the slower the game worked. But the code was rather independent and had not to deal with any engine specific tasks.

I think this problem is  more of a architectural matter.

I hope I could explain good what bothered me, if not please post below in the comments.

sentences: Does Unity let you code in Java? I am fairly new to Unity3D experience , but I have a very good knowledge of Java and Android development. I am really confused that if Java is at all needed for developing android applications? I read somewhere in Unity documentation that adding behaviour to objects in Unity requires use of scripts, and that unity only supports C# , .Net , and Boo scripts. Is there no use of Java at all?

sentences:
I have a question about 3D game models and copyright I am making a game that is like a combination of minecraft and unturned. It is like minecraft as it is very block based. It is like unturned because it has vehicles and other unturned functionalities. This is what the player model would probably look like:

The player model is very similar to minecraft's Steve. It does however have some major differences that make it unique. For instance the eyes are not stationary and can actually look around. The mouth has two sets of teeth which act as the jaw line and lips that represent the mouth. Both the teeth and the lips can be animated for a "Talking" animation. The eyes also have eyelids which can close and open with proper animating skill. The player model can also be customized in game, as the hair style, beard style, eye color, skin color, hair and beard color, can be changed during game play. Unlike minecraft's character, It is not restricted to just helmet, chest plate, leggings and boots for armor. This model can change its shirt, pants, helmet, hat, pants, leg armor, armor boots, chest plate, backpack (If he equips one), gloves, shoulder pads, elbow pads, and any other piece of armor and clothing that can be used in game.

My problem is, even with the major differences in the model, will it still be too similar to Steve? Or is this model too different to have me sued for copyright/IP infringement?

Thanks for any input.

I just started working on the model again, This time the player can hold things and also wears shoes:

sentences:
What factors affect the size of ammo limits? In virtually all shooting games that use ammo, there is also a maximum ammo limit, which often varies between different ammo types. One obvious advantage of using ammo limits is to control the scarcity of ammo, so that players cannot excessively hoard it and drastically affect the game's difficulty.

What factors affect the size of ammo limits? An obvious factor would be the rate of consumption; if an ammo type is used by rapid fire weapons, the limit for this ammo type should be higher. But it should be obvious that there are many other factors, since some types of ammo quickly run out and others never seem to. As a designer, what factors should guide my decision for ammo limits, and when/why would I deliberately constrain or expand an ammo type's limit?

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:
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:
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:
Mathematics for Game Development Book For someone with some background in maths, what is a good book about:

The core mathematics for game development
How these techniques are applied to common problems in game development

In particular, I am going to finish my degree in Physics & Computer Science this summer, and afterwards will start an MSc. in Games Development. So I am looking for an informative read over the summer.

I know that there are a lot of books about this out there. However, I am particularly looking for a book that does not waste 300 pages on re-explaining what Trigonometry, Vectors or Matrices are...

Is there any book that is written for people like me with some background in maths? Something that explains the less-obvious techniques and how to apply them to solving problems in game development? Topics could include for example 3D Maths, Collision Detection / Physics, AI.

sentences:
OpenGL noob: Using VBO to draw a colored triangle I tried using straight vertex arrays to draw a triangle with different colors for each vertex and it works fine, but when I use VBO it won't work, so I'm doing something wrong.

// point 1
side_1.push_back(-2.0f); //x1
side_1.push_back(-2.0f); //y1
side_1.push_back(0.0f); //z1

// side color
side_color_1.push_back(0.8f); //r1
side_color_1.push_back(0.0f); //g1
side_color_1.push_back(1.0f); //b1

// point 2
side_1.push_back(2.0f); //x2
side_1.push_back(-2.0f); //y2
side_1.push_back(0.0f); //z2

...etc

// init code
////////////
glGenBuffers(2, &m_vertexBuffer[0]); //Generate a buffer for the vertices

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_1.size(),
                 &side_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_color_1.size(),
                 &side_color_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

// render code
////////////
glEnableClientState(GL_VERTEX_ARRAY);   // enable vertex array
glEnableClientState(GL_COLOR_ARRAY);    // enable color array

// bind the buffer to the VBO
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]);

glVertexPointer(3, GL_FLOAT, 0, 0);
glColorPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(sizeof(GLfloat) * side_1.size()));

glDrawArrays(GL_TRIANGLES, 0, 3);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

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:
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:
Breaking up List into sublists by multiple values I'm trying to break up a C# List<InventoryItem> into multiple lists based on two different values: InventoryItem.name and InventoryItem.isStackable.

I want the list to be broken up into multiple lists for the purpose of populating my UI with the data - while keeping non-stackable items in their own list (one item per item slot in UI terms.)

If this is the input:

{
   InventoryItem - name:apple,  stackable:true
   InventoryItem - name:apple,  stackable:true
   InventoryItem - name:carrot, stackable:true
   InventoryItem - name:knife,  stackable:false
   InventoryItem - name:knife,  stackable:false
 }

I should get this output:

{
   InventoryItem - name:apple, stackable:true
   InventoryItem - name:apple, stackable:true
 }
 {
   InventoryItem - name:carrot, stackable:true
 }
 {
   InventoryItem - name:knife, stackable:false
 }
 {
   InventoryItem - name:knife, stackable:false
 }

I'm successfully separating by name alone (see below), but I'm not sure how to take isStackable into account. I'm also using LINQ which I'd prefer to avoid if possible.

var itemsByType     = new List<List<InventoryItem>>();
var inventoryByItem = inventory.GroupBy(x => x.name);
foreach(var v in inventoryByItem)
{
    var itemList = v.ToList();
    itemsByType.Add(itemList);
}

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:
"StrictMode policy violation" warning occurring in my game after upload When I upload my game to my Android device, I get the following warning:

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredConstructorInternal(Native Method)
    at java.lang.Class.getConstructor0(Class.java:2325)
    at java.lang.Class.getDeclaredConstructor(Class.java:2166)
    at bitter.jnibridge.JNIBridge$a.<init>(Unknown Source:25)
    at bitter.jnibridge.JNIBridge.newInterfaceProxy(Unknown Source:8)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:193)
    at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)

What causes this, and how can I resolve it?

sentences:
How to Make a Ladder Climbing Script I'm inexperienced and I'm trying to understand the mechanism for using a ladder with my character or climbing over small walls.
To move I use a Rigidbody, not Kinematic, but with AddForce. I tried to create an object to simulate a ladder to climb on. To get my character into contact with the ladder I inserted a Collider trigger on the ladder and called the OnTriggerStay function.
After working a bit, I used a bool such that  my character can go up or down the ladder when he's close enough, but I don't understand some things.

First of all, is the script better to put on the character or create one on the ladder?
The second thing is once you get to the top how do I insert a function correctly and make my character complete the climb, making it arrive above the object where the staircase is located?
Do I have to get to the top, destroy the game object and respawn at a point just above the ladder? What is the best way to do this?

Here's my code:
private Rigidbody rb;
public bool ladderClimb = false;
void Start()
    {
     rb = GetComponent<Rigidbody>();
    }

 void Update()
    {
     if(ladderClimb){
directionRot = new Vector3(0, 0, 0);  //direction of rotation
movement = new Vector3(0, Input.GetAxisRaw("Vertical"), 0).normalized; //object movement
  rb.useGravity = false;}
   else rb.useGravity = true;
}

    void OnTriggerStay(Collider collider){
     if(collider.gameObject.tag == "ladder"){
     if(Input.GetKeyUp(KeyCode.E)) ladderClimb = !ladderClimb;}}

void OnTriggerExit(Collider collider){
   if(collider.gameObject.tag == "ladder") ladderClimb = false;}

sentences:
Got unexpected results from perlin noise. Wondering what it is doing? I was just messing around with perlin noise and got this.  Wondering if anyone knows what it is or has seen it before.

Here is the code(LUA with love2d engine):

function love.load()
    love.window.setMode( 1920, 1080, {fullscreen=false})
    --Assuming you called the module perlin.lua
    newperlin = require("perlin2")
    --newperlin is a function that generates Perlin noise objects:

    myperlin = newperlin()
    --333 is seed
    myperlin = newperlin(333)
    mapHeight = 400
    mapWidth = 400

    --then, to create noise:
    scale = 0.007
    map = {}
    for x = 0, mapWidth - 1 do
        map[x] = {}
        for y = 0, mapHeight - 1 do
            map[x][y] = 0
            map[x][y] = --[[map[x][y] + --]](myperlin:noise(x * scale, y
              * scale) + 1) / 2.0 * 255.0
            --The following lines change it from a cloud to a weird image
            smin=0; smax=255
            map[x][y] =  math.floor(( map[x][y] - (-0.5) ) * 255 / ( 0.5
              - (-0.5) ) + 0)
        end
    end
end
function love.draw()
    for x = 0, mapWidth - 1 do
        for y = 0, mapHeight - 1 do
        love.graphics.setColor(map[x][y], map[x][y], map[x][y], 255)
        love.graphics.point(x,y)
        end
    end
end

function love.update()

end

function love.keyreleased(key)
    if key == "escape" then
        love.event.quit()
    end
end

and here is perlin.lua:

sentences:
Implementing Customizable Input I am trying to brainstorm how to create customizable input.  Any help would be greatly appreciated, but here's my best guess so far.

I could create a custom 'Input' class, with Methods to call for each input.  Like public bool IsRight()", "public bool IsJump()", etc.  Then I could call these methods from any other class.

However, I cannot figure how I would assign these different methods to different keys such that:

public bool IsRight(){
    if (keyboardState.IsKeyDown(Keys.Right)){
        return true;
        }
    return false;
}

works, but I could change the input from 'Right' to 'D', or so on.

sentences:
How unity works on Web How Unity can work on Web if the code is written in C#? I understand that you can compile the C# code to a shared library and use it in Java (for Android) in ObjectiveC (for iOS) to enable Unity on multiple platforms, but you cant use shared library on JS. Does Unity do language to language translation from C# to JS to enable Unity on Web?

As I understand now starting from Unity 5.0 it even doesn't use Unity Web Player.

sentences:
Problem with Moving object with touch and make camera to follow the object I watched a tutorial about  Unity Mobile From Scratch: Moving a 3D Object with Touch in Perspective on YouTube but when I added a camera follow script to follow that 3D object the object keeps moving even I clicked or dragged the ball once. Does anyone know why this is happening?

This is the code of moving the ball with mouse or touch from the tutorial

if (Input.GetMouseButtonDown(0))
    {
        Ray mouseRay = RayGenerator();
        RaycastHit hit;

        if (Physics.Raycast(mouseRay.origin, mouseRay.direction, out hit))
        {
            if (hit.transform.gameObject.tag == "BowlingBall")
            {
                obj = hit.transform.gameObject;
                objPlane = new Plane(Camera.main.transform.forward * -1, obj.transform.position);

                Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
                float rayDistance;
                objPlane.Raycast(mRay, out rayDistance);
                ballTouchOffset = obj.transform.position - mRay.GetPoint(rayDistance);
            }

        }
    } else if (Input.GetMouseButton(0) && obj)
    {
        cameraFollow.enabled = false;
        isDragging = true;
        Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        Ray mouseRay = RayGenerator();
        Debug.DrawRay(mouseRay.origin, mouseRay.direction, Color.red);

        float rayDistance;

        if (objPlane.Raycast(mRay, out rayDistance))
        {
            obj.transform.position = Vector3.Lerp(transform.position, new Vector3(mRay.GetPoint(rayDistance).x + ballTouchOffset.x, obj.transform.position.y, obj.transform.position.z), sideForce * Time.deltaTime);
        }

    } else if (Input.GetMouseButtonUp(0) && obj)
    {
        obj = null;
        isDragging = false;
        cameraFollow.enabled = true;
    }
}

And this is the camera script to follow that ball

public Transform bowlingBall;
public Vector3 offset;
public float cameraSlideSpeed = 5f;

void LateUpdate()
{
    transform.position = Vector3.Lerp(transform.position, bowlingBall.position + offset, cameraSlideSpeed * Time.deltaTime);
}

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:
video card architecture Can anyone point me to some information on what a modern video card architecture looks like? I'm particularly interested in understanding how my rendering engine will be executed by the GPU.

Ideally, I'd get two answers: one related to today's monster video cards and one related to today's mobile GPU's.

-- edit follows

Thanks for the input so far. Considering the proprietary and changing nature of video card hardware, it seems there's not the ideal answer that I was looking for. So I'll clarify and ask a couple very specific questions. (I guess I was hoping to get a resource similar to http://www.realityprime.com/articles/scenegraphs-past-present-and-future which would generally provide me with lots of information on hardware that might be relevant to me.)

First off, I'm quite familiar with the OpenGL pipeline. A google-images search for my question title, "video card architecture," reveals diagrams of various video cards which naturally seem to match the graphics pipeline. While this makes sense, and is helpful, it leaves out some details. I'll try to get at a couple specifics.

1) What happens when a texture change (glBindTexture(), or new sampler specified) is issued? Obviously, the command is queued and later processed by the video card, but is the texture loaded immediately into cache, or not until something attempts to sample that texture? I would expect the latter, partly because the texture may not entirely fit into such caches to begin with. How big are these caches, anyway?

2) Older video cards had hardware dedicated specifically for a given type of shader. Newer video cards reuse the same hardware for all types of shaders. Are these "stream processors" typically shared with other computations throughout the pipeline, such as culling?

3) It seems that progress related to video card hardware has largely been lead by innovation in software. Are there any interesting cases where the opposite is true? I still hope that there might be some resource that gives a detailed history of video card design, similar to the scenegraphs article linked above.

4) Mobile GPU was an ambiguous term. I'm hoping that eBusiness assumed I meant mobile as in laptop when he called me ignorant -- I was rather referring to the GPUs embedded in modern cell phones and tablets.

sentences:
Creating offline multiplayer Android games with Unity Is it possible to create offline multiplayer Android games with Unity (played over bluetooth/ wi-fi)?
If so, then I would like to create a 2 player game prototype, containing a single room (empty cube) with 2 cubes (3rd person controllers) - each controlled by one player. The cubes can be moved about as their owners (players) wish. Any movement made by any of the 2 players can be seen in realtime in the other player's display.
How do I achieve this?

P.S. I know some basics of Unity. I have already created a small hack & slash game in Unity (PC-standalone). I am new to Unity Android, though.

sentences:
Button Press Detection not working while detecting collision I am trying to make a sign that brings up a panel when you press Enter while the player is over the sign. The code I have written is:

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

public class SignScript : MonoBehaviour
{
    public GameObject Panel;

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            UnityEngine.Debug.Log("Triggered1");
            if (Input.GetAxis("Submit") == 1)
            {
                UnityEngine.Debug.Log("Triggered2");
                if (Panel == false)
                {
                    Panel.SetActive(true);
                    UnityEngine.Debug.Log("Triggered3");
                }
            }
        }
    }
}

I added code that prints "Triggered1", "Triggered2", and "Triggered3" to the Debug Log when you reach certain parts of the code. When the player is over the sign and is pressing Enter, it should print "Triggered2". For some reason, it is not doing this. Does anyone know why?

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:
Why does an emulator use more RAM than the original system? Why does an emulator use more RAM than the original system? What are emulators doing that requires so much more power?

For example, when using the PSP emulator PPSSPP I'm experiencing lag on a modern PC with gigabytes of RAM, even though the PSP runs with only 32MB of RAM.

When developing my own console emulator, should I not expect it to use a similar amount of RAM / CPU cycles / other resources as the original system has to offer? Or is there extra overhead that makes emulating much more demanding than what the original hardware's specs would suggest?

sentences:
Get an exponential number between two numbers Bit of a math question here...

lets say I want to supply a number (any number) and I want the result to be clamped between 0 and 1.

For instance, see the following graph.

Is there a way that when a number larger than 1 is supplied, that it returns a number that is still within those bounds (0 - 1), but still resulting in a number larger than any smaller supplied numbers that came before it (for instance, a supplied 2 would be a slightly larger number than a supplied 1.5)?

Thanks for your help!

sentences:
Rendering order in an Entity System Say I use a basic ES approach, and also inside Systems I hold lists of all entities that Systems are required to process.

How do I maintain this list of entities in desired rendering order, i.e. for a dumb 2D RenderingSystem?

I saw this discussion, and what they suggest is to do something like Z ordering - what I would probably do is just to store a "layer" int in DrawableComponent and then, inside RenderingSystem, just sort entities by mentioned "layer" whenever the entity list for RenderingSystem changes.

They also say we could just delete and recreate the entity whenever we want it on the top, but it seems too inflexible to me.

How is this problem usually solved?

sentences:
Text tool for designing gameplay elements I'm still in the design phase of my game and I'm realizing that there are too many elements to keep track of and it just looks like a mess in the plain text that I created it in. My notes are basically going to translate to the classes and subclasses that'll make up the objects within my game, but I'd like to find a tool that will make it simpler to keep track of. Here's an example of the structure of my notes:

NPCs:
    - Humans:
        - Human A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Human B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    - Elves:
        - Elf A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Elf B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    [...]
World:
    - Continent A: overall description
        - City A: city description
            - Building A: description
            [...]
        [...]
    [...]
Items:
    - Melee: overall description
        - Melee Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]
    - Ranged: overall description
        - Ranged Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]

And so on...

Even this simple list is starting to look messy, and once you have pages of classes and multiple subclasses for each class along with lengthy descriptions, it gets really jarring when you view it.

What I would really like is a way to expand and collapse these elements so I can either view the big picture or go down to details, and maybe be able to set some groups a different color or make them bold, etc. for better viewing and categorization. It's basically a class diagram but with more game-world-related descriptions rather than function/method descriptions. I'm currently using Sublime for this, so either a plugin or a different tool that accomplishes this would really help. Thanks!

sentences:
Create acceleration with direction I want to move my object with an acceleration in the proper direction.  For example if I have these values:

friction = 0.3;
direction = 180;
speed = 5;

For making it clear, I need a formula to create a linear acceleration.

sentences:
CryEngine with Visual Studio 2015 I receive an error in Visual Studio when I open CESharpFramework from my project folder. I had assumed I could use Visual Studio 2015; but the error tells me I need an older version of Visual Studio to open the MonoLauncher solution within CESharpFramework.

Is this a known issue and what should I do?

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:
My grid based collision detection is slow Something about my implementation of a basic 2x4 grid for collision detection is slow - so slow in fact, that it's actually faster to simply check every bullet from every enemy to see if the BoundingSphere intersects with that of my ship. It becomes noticeably slow when I have approximately 1000 bullets on the screen (36 enemies shooting 3 bullets every .5 seconds). By commenting it out bit by bit, I've determined that the code used to add them to the grid is what's slowest.

Here's how I add them to the grid:

for (int i = 0; i < enemy[x].gun.NumBullets; i++)
{
   if (enemy[x].gun.bulletList[i].isActive)
   {
      enemy[x].gun.bulletList[i].Update(timeDelta);

      int bulletPosition = 0;
      if (enemy[x].gun.bulletList[i].position.Y < 0)
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450);
      }
      else
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450) + 4;
      }

      GridItem bulletItem = new GridItem();
      bulletItem.index = i;
      bulletItem.type = 5;
      bulletItem.parentIndex = x;

      if (bulletPosition > -1 && bulletPosition < 8)
      {
         if (!grid[bulletPosition].Contains(bulletItem))
         {
            for (int j = 0; j < grid.Length; j++)
            {
               grid[j].Remove(bulletItem);
            }
            grid[bulletPosition].Add(bulletItem);
         }
      }

    }
}

And here's how I check if it collides with the ship:

if (ship.isActive && !ship.invincible)
{
   BoundingSphere shipSphere = new BoundingSphere(
    ship.Position, ship.Model.Meshes[0].BoundingSphere.Radius * 9.0f);
   for (int i = 0; i < grid.Length; i++)
   {
   if (grid[i].Contains(shipItem))
   {
      for (int j = 0; j < grid[i].Count; j++)
      {
         //Other collision types omitted
         else if (grid[i][j].type == 5)
         {
            if (enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive)
            {
               BoundingSphere bulletSphere = new BoundingSphere(enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].position,
               enemy[grid[i][j].parentIndex].gun.bulletModel.Meshes[0].BoundingSphere.Radius);
               if (shipSphere.Intersects(bulletSphere))
               {
                   ship.health -= enemy[grid[i][j].parentIndex].gun.damage;
                   enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive = false;
                   grid[i].RemoveAt(j);

                   break; //no need to check other bullets

                }
             }
             else
             {
                grid[i].RemoveAt(j);
             }
          }

What am I doing wrong here? I thought a grid implementation would be faster than checking each one.

sentences:
What should I watch out for in a 3d artist's portfolio? I'm looking to hire a freelancer to help with 3d modeling. I've thought up a few qualifiers so far:

Is their topology okay for animation?
Have they demonstrated the technical capabilities necessary for my project? (Have they baked normals, AO maps, etc.)
Have they shown an ability to execute from conceptual drawings?

Are there any massively important things I should watch out for that I haven't included?

Any red flags I should be aware of, like making sure the work isn't plagiarized?

Note

I'm specifically talking about reviewing portfolio content, before interviewing them. I'm looking for things I can say yes or no to, or that I might want to question them on further in an interview.

sentences: Which is better, one big level model or multiple smaller level models? I am writing a game in XNA 4 and I want to have something like a corridor. Do you think that is better to use one big and solid model, or to use multiple small parts (window, stairs, door...)?

sentences:
Calculating the bouncing ball bounce height while on platforms I tried to calculate the bounce height for the bouncing ball however it ends up shaking against the moving platform after it finishes bouncing. grav_val in this case is 0.1872 to prevent it to shake from normal surfaces after it finishes bouncing as a temporary fix.
yspeed = -max(0,(rounding(abs((yspeed + platform) / 2) - (grav_val) , 0.1)) + platform);

What the rounding function does is just rounds by a factor of whatever the second argument's number is.
return (input / factor) * factor

Finally, platform is the vertical speed of the platform that moves up, so let's hypothetically say it's in the speed of two for example:
platform = 2;

So, basically I want it to fully diminish until it hits to zero regardless of yspeed adding itself because it does right now due to gravity and the platforms. Rewrites or new methods would be appreciated.

sentences:
Unity URP - Batching GPU instanced objects with same material/mesh not working I have 100 units (exact same prefab) on screen. The material is a URP Lit using a texture with GPU instancing enabled. Why is it not batching? Am I missing something?

I also noticed it requires 3-4 batches per model, why is this?

See screenshots for stats and info.

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:
2d tile map render rotation math? I am working on a personal project and am trying to make a 2d tile map render that needs to handle rotation.

I am using raylib to handle the drawing stuff onto the screen and am using this function to draw a tile:

void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint);

How do I calculate the new coordinates of the tiles after the rotation and the individual rotation of each tile if I want to rotate the tile map?

I also need to figure how to do mouse click detection for tiles when they are rotated with their new coordinates and how to do ‘collision detection with cursor’ with rotated squares/tiles.

And due to the way the project is set up I cannot rotate the camera.

Extra info/diagram:

sentences:
Best game loop architecture So I understand how a game loop works (listenInputs/updateData/redrawInterface) but what I'm struggling with is how am I supposed to equalize rendering? I initially thought I had to make the thread sleep for 16.67 ms (in order to get a 60fps output on the screen) but if a user has a low quality hardware it will slow the game down instead of the traditionnal "frame skip", so I figured out this solution was not valid.
So what I thought was the way to go was (in pseudo-java but langage doesn't really matter):

long start = System.currentTimeMillis();
while(...){
    int tick = Math.round((System.currentTimeMillis() - start) / (1000.0 / 60));
    listenInputs();
    updateData();
    redrawInterface();
}

So now anything graphical such as displaying a looping animation can easily be done by printing the specific image of the whole animation for instance.
Am I right? Or is there a better solution or a way to make this one run better?
But with this technique I will have to re-synchronize it every x ticks otherwise it will shift because 1000.0 / 60 is still not an exact value.

sentences:
How can I save state from script in a multithreaded engine? We are building a multithreaded game engine and we've encountered some problems as described below.

The engine have 3 threads in total: script, render, and audio. Each frame, we update these 3 threads simultaneously. As these threads updating themselves, they produce some tasks and put them into a public storage area. As all the threads finish their update, each thread go and copy the tasks for themselves one by one. After all the threads finish their task copying, we make the threads process those tasks and update these threads simultaneously as described before. So this is the general idea of the task schedule part of our engine.

Ok, well, all the task schedule part work well, but here's the problem:

For the simplest, I'll take Camera as an example:

local oldPos = camera:getPosition()  -- ( 0, 0, 0 )
camera:setPosition( 1, 1, 1 )        -- Won't work now, cuz the render thread will process the task at the beginning of the next frame
local newPos = camera:getPosition()  -- Still ( 0, 0, 0 )

So that's the problem: If you intend to change a property of an object in another thread, you have to wait until that thread process this property-changing message. As a result, what you get from the object is still the information in the last frame.

So, is there a way to solve this problem? Or are we build the task schedule part in a wrong way? Thanks for your answers :)

sentences:
How can I increase the hit range of a node? How can I set the radius or the hit range of a node initialized with a texture? Of course I can do that with increasing the size of it, but actually I want to do this without resizing the picture itself. This node is moving around the screen with a small speed. This is my code:

func addMonster() {

let monster = SKSpriteNode(imageNamed: "MosquitoDrawed")

monster.name = predatorNodeName

monster.zPosition = 1

// monster.physicsBody = SKPhysicsBody(circleOfRadius: 50.0)

monster.position = CGPoint(x: random(-10.0,max: -30.0), y: random(10.0, max:130.0))

addChild(monster)

let actualDuration = 7.0

let actionMoveTo = SKAction.moveTo(CGPoint(x: random(500, max:800),y: random(1, max:800) ), duration: NSTimeInterval(actualDuration))

monster.runAction(actionMoveTo,withKey: "move")

}

sentences:
How to programmatically change sprite sheet sub-sprite name I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point in time.

Let's say I have a sprite sheet that has already been split up into individual sprites inside of Unity.

I am attempting to change the sub-sprite names programmatically.

I tried using

AssetDatabase.RenameAsset (...)

on the sprite sheet asset, which only changes the sprite sheet name and not sub-sprites.

I then thought to obtain a sub-sprite and attempt to change its name using the below code.

            if (AssetDatabase.IsSubAsset (subSprite))
            {
                AssetDatabase.RenameAsset (AssetDatabase.GetAssetPath (subSprite), "newSprite" + i.ToString ());
            }

However, this too only changes the sprite sheet name.

I'm not sure where else I can take this to achieve my desired outcome, apart from programmatically copying the original sprite sheet and using that to create a copy. But even then, I still am unable to alter the sub-sprite names.

I also tried changing subSprite.name, but this just changes the internal name and not the asset name.

Any ideas?

sentences: Does level streaming in games load directly from the HDD? I wondered if the level streaming loads directly from the HDD. My first thought was if that would not be to slow, or if the chunks are just loaded into RAM and asynchronously processed if appropriate or something I didn't thought of yet.

sentences:
How can I interpolate between two frames of a sprite-based 2D animation? For example, I'm looking to animate at 60 frames per second, but clearly my artist isn't going to hand-author 60 frames of art for every second of an animation clip and even if he could, it would only work properly in locked-timestep.

So given two successive frames in a sprite-based animation, I want to smoothly "interpolate" or "morph" between them at runtime to produce a smoother, and higher frame rate animation based on where the update time for the current frame lies between the two frames.

Another way to look at it would be to say that my animation is authored such that the frames occur at regular intervals, much less frequent then 60 FPS. Say I'm 30% between when frame N should appear and when frame N+1 should appear. I want to render an image that looks like it's a 30% the way through a smooth transition from the frame N image and the frame N+1 image.

This paper seems promising, but am interested in other potential solutions I could look at for implementing this. Please do not recommend a tool as a solution.

sentences:
How can I get GetMouseButtonDown two positions on two clicks? private void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector3 pos1 = Input.mousePosition;
            }
        }

Like two points. I click once and the click one on another position so I will have two positions and now I will be able to draw a line between them. I want to get and store two positions.

sentences:
Need a good quality bitmap rotation algorithm for Android I am creating a kaleidoscopic effect on an android tablet. I am using the code below to rotate a slice of an image, but as you can see in the image when rotating a bitmap 60 degrees it distorts it quite a lot (red rectangles) – it is smudging the image! I have set dither and anti-alias flags but it does not help much. I think it is just not a very sophisticated bitmap rotation algorithm.

canvas.save();
canvas.rotate(angle, screenW/2, screenH/2);
canvas.drawBitmap(picSlice, screenW/2, screenH/2, pOutput);
canvas.restore();

So I wonder if you can help me find a better way to rotate a bitmap. It does not have to be fast, because I intend to use a high quality rotation only when I want to save the screen to the SD card - I would redraw the screen in memory before saving.

Do you know any comprehensible or replicable algorithm for bitmap rotation that I could programme or use as a library? Or any other suggestion?

EDIT: The answers below made me think if Android OS had bilinear or bicubic interpolation option and after some search I found that it does have its own version of it called FilterBitmap. After applying it to my paint

pOutput.setFilterBitmap(true);

I get much better result

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:
Steer a flock towards a target? Like in pikmin? Can a flock be steered towards a target ?

I've seen that flocking behavior has the alignement behavior, but can it be directed and steered toward a goal ?

http://www.youtube.com/watch?feature=player_detailpage&v=BKJyv4uqsWI#t=305

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:
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:
Gluing Model and View Data Together But Separating Concerns I've built a couple of 2D games that are roughly MVC; that is, the main game data and logic are separated into the model (and possibly controllers), and I have a bunch of screens/states that just pull stuff from the model class and draw that on screen.

This is not a complete separation, because things like size, collision detection, etc. tend to be view concerns and not model concerns.

In any case, I have a difficult time "gluing" together models and views. Is there a good way to do this, while still preserving the separation of concerns?

Let's say I'm working with a Sprite class to represent an image, and I have a Player class representing my player (X, Y, number of lives, running/walking, etc.). How do I associate them together?

For example, Player can be a subclass of Sprite, or can contain an instance of Sprite (or vice-versa), or I can have a third class (PlayerModelView) that contains an instance of both Player and Sprite, or something else entirely.

(I've tried the latter approach, but it usually ends with a lot of type conversions and the model checking with the view about collisions.)

sentences:
OpenGL / Assimp oddity or error? A friend and I are working on developing a game engine in C++. He doesn't live anywhere near me, so we use Dropbox to sync our files. I opened his project to test his code, and I kept getting errors saying that the program could not start with an error that stated "This application could not start. 0xc015002." I used a dependency walker to find that ILUT.dll was causing some issues. I have done just about everything suggested on most forums to make ILUT work, and I have not had any success. I've re-downloaded it, put the DLL just about everywhere I could, and I still had issues. We then tried to compile it without Assimp, and the program compiled without errors. This was not the end of our problems though. I made a class to create a primitive cube using OpenGL. When I tested it out, there was no cube on the screen. I had my friend test the program out, and to our surprise, there was a perfectly rendered cube on his screen. So I'm honestly not sure where things could possibly be going wrong. Any help at all would be greatly appreciated. Thank you for taking the time to read this long question. I'll be happy to provide anyone with necessary info needed to help with this question!

My OpenGL version is 4.2. He has an nVidia graphics card, and I have an AMD Radeon graphics card. We are using Visual Studios 2012 as our IDE.

sentences:
Correct the rotation of a car gun? This script for drive a car by arrows. I added a gun above it to aim at target. My issue here is the rotating of my gun effected by my drive when I turn left or right. How to stop the rotation of my gun to be effected by car turns ?

using UnityEngine;
using System.Collections;

public class RearWheelDrive : MonoBehaviour {

private WheelCollider[] wheels;

public float maxAngle = 30;
public float maxTorque = 300;
public GameObject wheelShape;

public Transform target;
public Transform gun_car;

// here we find all the WheelColliders down in the hierarchy
public void Start() {

    wheels = GetComponentsInChildren<WheelCollider>();

    for (int i = 0; i < wheels.Length; ++i)
    {
        var wheel = wheels [i];

        // create wheel shapes only when needed
        if (wheelShape != null)
        {
            var ws = GameObject.Instantiate (wheelShape);
            ws.transform.parent = wheel.transform;
        }
    }
}

public void Update()    {

    // Gun rotation
    Vector3 dir = target.position - gun_car.transform.position;
    Quaternion lookr = Quaternion.LookRotation(dir);
    Vector3 rotationy = Quaternion.Lerp(gun_car.localRotation,lookr, Time.deltaTime * 7).eulerAngles;
    gun_car.localRotation = Quaternion.Euler (0f,rotationy.y,0f);

   //    Drive
    float angle = maxAngle * Input.GetAxis("Horizontal");
    float torque = maxTorque * Input.GetAxis("Vertical");

    foreach (WheelCollider wheel in wheels)
    {
        // a simple car where front wheels steer while rear ones drive
        if (wheel.transform.localPosition.z > 0)
            wheel.steerAngle = angle;

        if (wheel.transform.localPosition.z < 0)
            wheel.motorTorque = torque;

        // update visual wheels if any
        if (wheelShape)
        {
            Quaternion q;
            Vector3 p;
            wheel.GetWorldPose (out p, out q);

            // assume that the only child of the wheelcollider is the wheel shape
            Transform shapeTransform = wheel.transform.GetChild (0);
            shapeTransform.position = p;
            shapeTransform.rotation = q;
        }

    }
}

}

sentences:
How to create fallout intensity on a generated mesh in Unity? So I was able to generate a circle mesh in Unity to basically see the other characters when they are inside of it, and hide the characters when they are outside of it, and partially hide and show the character if they are partially in or outside of it. Below is an image of what I was able to generate, but the thing is, the edges are very sharp and I would like to have some Fallout Intensity on the mesh. Just like with Lights in Unity, where they have a fallout intensity at the edge of the lights.
Image of Generated Mesh

As you can see, the edges of the mesh are very sharp and thats not the kind of effect am after, I would like to add some fallout to that, and adjust it.
Here is The Code That Generates The Mesh
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class FieldOfView : MonoBehaviour {

    public float fieldOfView = 360f;
    public int numberEdges = 360;
    public float initalAngle = 0;
    public float visionDistance = 8f;
    public LayerMask layerMask;

    private Mesh mesh;
    private Vector3 origin;

    private void Start()
    {
        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        origin = Vector3.zero;
    }

    private void LateUpdate()
    {
        GenerateUpdateMesh();
    }

    private void GenerateUpdateMesh()
    {
        float actualAngle = initalAngle;
        float incrementAngle = fieldOfView / numberEdges;

        Vector3[] vertices = new Vector3[numberEdges + 1];
        int[] triangles = new int[numberEdges * 3];

        vertices[0] = origin;

        int verticeIndex = 1;
        int triangleIndex = 0;

        for (int i = 0; i < numberEdges; i++)
        {
            Vector3 actualVertices;
            RaycastHit2D raycastHit2D = Physics2D.Raycast(origin, GetVectorFromAngle(actualAngle), visionDistance, layerMask);
            if (raycastHit2D.collider == null)
            {
                // No hit
                actualVertices = origin + GetVectorFromAngle(actualAngle) * visionDistance;
            }
            else
            {
                // Hit object
                actualVertices = raycastHit2D.point;
            }

            vertices[verticeIndex] = actualVertices;

            if (i > 0)
            {
                triangles[triangleIndex + 0] = 0;
                triangles[triangleIndex + 1] = verticeIndex - 1;
                triangles[triangleIndex + 2] = verticeIndex;

                triangleIndex += 3;
            }

            verticeIndex++;
            actualAngle -= incrementAngle;
        }

        // We form the last triangle
        triangles[triangleIndex + 0] = 0;
        triangles[triangleIndex + 1] = verticeIndex - 1;
        triangles[triangleIndex + 2] = 1;

        mesh.vertices = vertices;
        mesh.triangles = triangles;
    }

    Vector3 GetVectorFromAngle(float angle)
    {
        float angleRad = angle * (Mathf.PI / 180f);
        return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad));
    }

    public void SetOrigin(Vector3 newOrigin)
    {
        origin = newOrigin;
    }
}

What do I do here to add some Fallout Intensity? All the help is really appreciated. And Thank you in advance.

sentences:
Unity - How to match camera bounds to width While stretching camera bounds, changing width adds black offset while changing height stretches image.
How can I achieve opposite behavior and match the bounds to the width instead of height ?

sentences:
How can I make my movement continuous? I'm making a game with simple movement code. I don't want the movement to be too complex since it's going to be a small game once it's done.

Right now the character moves 10 units at a time, then stops, then 10 units, then stops, and this looks jerky.

I'd like the character to move continuously, without stopping in between. I tried lowering the playerSpeed to make it less jerky, but then the character moved too slowly and players got bored. Instead I want the character to move a little every frame, not a big jump with delays in between.

Here's what I've tried so far:

playerSpeed = 10;

document.addEventListener('keydown', function(e){
 if(e.key === 'w' && playerY >= 5){
  playerY-= playerSpeed;
  ctx.clearRect(0, 0, outerWidth, outerHeight);
  drawProtagonistFacingUp();
}
 if(e.key == 'd' && playerX < outerWidth - 50){
  playerX+= playerSpeed;
  ctx.clearRect(0,0,outerWidth, outerHeight);
  drawProtagonistFacingRight();
}

if(e.key == 's' && playerY < outerHeight - 100){
 playerY+= playerSpeed;
 ctx.clearRect(0,0,outerWidth, outerHeight);
 drawProtagonistFacingDown();
}

if(e.key == 'a' && playerX > 5){
  playerX-= playerSpeed;
 ctx.clearRect(0, 0,outerWidth, outerHeight);
 drawProtagonistFacingLeft();
}
});

sentences:
Finding which side one point is from another point I have a simple question I think, if point a is to the right of another point I a dirx to be 1, otherwise -1. Likewise for a diry var, if it's above the other point I want it to be -1 otherwise 1. This is what I've worked out so far:

dirx = (abs(disx+1)/(disx+1))*-1;
diry = (abs(disy+1)/(disy+1))*-1;

The disx and disy are the distance from each other on x and y. I have a +1 to keep from having a division by 0 error, lastly I'm *-1 it all so that it'll match the coordinate system of the game screen where something higher has a lesser value than something lower.

My problem is that I'm still getting a division by 0 error with this code, I'm not sure why as I even added +1 to make sure it wasn't possible???

sentences:
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:
How do I render an animation where some frames appear twice? I am animating a sprite. The sprite has 7 different frames, but the animation is 10 frames long. This is because 3 of the original frames appear twice in the animation:

3 -> 4 -> 5 -> 6 -> 4 -> 3 -> 2 -> 1 -> 0 -> 2

Frames 2, 3 and 4 appear twice. This avoids having to store duplicate frames in the spritesheet.

How can I render the animation in this sequence with repeated frames?

sentences:
Limit the boundary of Touch a game that I currently working on is in a way that player should actually draw a rainbow on the screen by tap and drag gesture in order to make a hills for the car.

but the issue that i currently facing on is if the player wants to pause the game by touching the right most button on the screen above, the game will stop but the hill that he was drawn will remove. I actually not have any idea how can i put exception for that button on the screen because everytime i calculate the whole pixels on the screen for drawing hills.
do you have any idea how can i solve this issue ?

btw, this is my code if it's required : http://pastebin.com/VnLAQbzW

sentences: Reason for white lines in tile-based game My game is tile-based. I am getting this lines between two tiles. They don't look nice. How can i resolve this issue?

sentences:
How to control multiple characters simultaneously in Unreal Engine 4? How do I make two or more characters response to a single user input, in this case a mouse click?

Ideally, I'd like something similar to Baldur's Gate style party control. The only example of multiple character party control I have seen implemented is the BioWare style system.

sentences:
XNA Windows Phone 7 Sprite movement I'm working on a Windows phone game and I'm having difficulty with the sprite movement. What I want to do is make the sprite gradually move to the position that is touched on screen, when there is only one quick touch and release. At the minute all I can do is either make the sprite jump instantly to the touch location or move along to the touch location when the touch is held down.

Code for jumping to touch location:

TouchCollection touchCollection = TouchPanel.GetState();
    foreach (TouchLocation tl in touchCollection)
    {
        if ((tl.State == TouchLocationState.Pressed)
             || (tl.State == TouchLocationState.Moved))
        {
            Vector2 newPos = new Vector2(tl.Position.X,tl.Position.Y);

                if (position != newPos)
                {
                    while (position.X < newPos.X)
                    {
                        position.X += (float)theGameTime.ElapsedGameTime.Milliseconds / 10.0f * spriteDirectionRight;
                    }
                }
        }
    }

Code to gradually move along while touch is held:

TouchCollection touchCollection = TouchPanel.GetState();
    foreach (TouchLocation tl in touchCollection)
    {
        if ((tl.State == TouchLocationState.Pressed)
             || (tl.State == TouchLocationState.Moved))
        {
            Vector2 newPos = new Vector2(tl.Position.X,tl.Position.Y);

                if (position != newPos)
                {

                        position.X += (float)theGameTime.ElapsedGameTime.Milliseconds / 10.0f * spriteDirectionRight;

                }
        }
     }

These are in the Update() method of the Sprite class.

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:
Doesn't multiple inheritance solve all problems that entity systems do? The question is pretty self explaining: doesn't multiple inheritance solve all the problems that entity systems also solve?

I just remembered a term called "multiple inheritance", and that seems to solve a lot of bloating problems that classical inheritance imposed.

sentences:
Multiplayer game, design of server  client communication I'm thinking about programming a multiplayer game.
For communication, I will use a Server <-> Client design like the following:

  Client <-> Server <-> Client

The Game will be a kind of Tower Defense. Where two players can fight each other by sending soldiers to the enemy to destroy their base or build towers to defend.

To keep the games in sync, each action must be sent to the other player.

e.g. Player 1 set a tower on position x, y so Player 2 must know about this tower (It would be pretty unfair if the enemy has invisible towers)

To sync the two games I can think of two methods:

First method:
The client(Player 1) set a tower to position x, y and send a message to server: "I have placed a tower on position x, y". The server sends this message forward to the other client(Player 2)

//client 1
buildTowerOnPosition(x, y);
sendToServer(BuildTowerMessage(x, y))

//server
receiveMessageFromClient(BuildTowerMessage(x, y))
sendFurtherToOtherClient(BuildTowerMessage(x, y))

//client 2
receiveMessageFromServer(BuildTowerMessage(x, y))
buildEnemyTowerOnPosition(x, y)

By this method:
The server doesn't need to know the current game status and serves only as a bridge between the clients

Second Method:
The client(Player 1) send a message to server: "I will build a tower on position x, y" the server build a tower to position x, y and send the changes(New tower on position x, y) to the clients

//client 1
sendToServer(BuildTowerMessage(x, y))

//server
receiveMessageFromClient(BuildTowerMessage(x, y))
buildTowerOnPosition(x, y)
sendFurtherToBothClients(BuildTowerMessage(x, y))

//both clients
receiveMessageFromServer(BuildTowerMessage(x, y))
buildTowerOnPosition(x, y)

By this method:
The server needs to know the current game status

My thoughts are:

By the first Method
The server only needs to forward the message and the main calculation is on the client side which relieves the server.

By the second Method:
The server can control the actions of the clients. For example: When both players set a tower on the same position at the same time, the first tower will be set and the second cannot be built anymore.
In the first Method the second tower will overbuild the first or in the worst case, both clients have different towers.

Now to my question:
Which method should I use for my game?
Is there more pro and contra by the methods?
Are there other methods?
Are there kinds of games where I should prefer another method than in my game?

Thank you for your advice

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:
How to get time since frame start in Unity for loading purposes I am building a big world (1000+ game objects). It takes 2s on the device. I am doing it in the background (the world is hidden until fully loaded). I have figured out that I can maintain the FPS of the active scene by switching to coroutines and making yield return null;.

The main issue is when to fire yield return null;. If I do it too often, then it will slow down the loading. If I do it too rarely, it will reduce FPS on low-end devices.

My idea is simple to detect how much milliseconds have passed since the start of the frame and fire yield return null; just after I have spent for example 12ms (to leave some time to render everything else and maintain something near 60FPS).

However, I can not find an efficient way of getting the time since frame start? Unity should have something as the async loading of assets seems to consume just right time to maintain stable FPS.

sentences:
Changing a sprite and adding a new background layer I followed a tutorial to make a Flappy Bird clone. At the end he gives you a premade game so everything works correctly, from jumping to going through pipes, etc.

I want to change the aesthetics though with sprites I made myself. I don't want to change any gameplay, just the sprites. This is easy for the bird, I just selected the asset I wanted and it changed in the scene and game. Easy.

Now, I want to add a building background layer to the back to go along with clouds, stars, and other background elements, and use the parallaxer to make them move. This doesn't work, however. It doesn't show up in the scene or the game when pressing play.

Next I want to make the pipes use a different sprite. So I changed the pipe sprite in the Unity menu to what I wanted, but when I hit play, it's still just pipes.

This is the tutorial project in question and it's free to DL and use, so I shouldn't be having this issue with changing its sprites. Can anyone please talk me through how to get these elements working?

Here is a screenshot of how I've tried making my changes:

sentences:
Best practice for implementing overall / weekly / daily highscores? So I'm setting up social leaderboards and I want there to be daily weekly overall high scores. The way the scoring works is each score is tied to a user after the user logs in so the scores need to always be linked to a user. I'm using the Parse BaaS with Unity C# and I've gotten overall highscores working by adding a highScore field to the ParseUser model. From the research that I've done so far based on google play services and game center has led me to the following solution.

Have 3 fields for the ParseUser model: overallScore, dailyScore, weeklyScore. Reset dailyScore and weeklyScore when appropriate

Is this an appropriate solution for what I'm trying to implement? Is there a more efficient or scalable way to do it?

sentences:
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:
Term for "Massively Multiscale world browsing"? There is a type of multi-scale world browsing that has appeared in games in the last few years and I would be interested to know if there is a specific term that this browsing is known as and more importantly, if there are already specific patterns or techniques for implementing it.

I am referring to games like:

Universe Sandbox
EVE online
Startrek Armada
Heat Signature

The common characteristic of these games is that they allow you to zoom across an incredible range of scale from "item" all the way out to "galaxy" without (apparent) loss of synchronisation between what is happening at each scale. So, it looks like the world "advances" across all of these different scales simultaneously. Also, it is likely that each browsing level is a different visualisation type which is then blended seamlessly by matching the camera viewpoints and "cutting" from one level to the next but that might just be my perception.

What I am specifically interested to know would be:

If this technique has a name already (?)
If there is a ready made component (or pattern) that sorts out the architecture for achieving this kind of browsing (?)
If the "world" is really simulated at all levels (?)

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:
Eliminate 0.25 unit 'force fields' around Bullet Physics soft bodies When I create soft body assemblies in Bullet Physics they will fall under gravity and then float about 0.25 units above a ground plane rigid body, and other rigid bodies all appear to push and interact with them from that same distance (all the rigid bodies correctly interact with each other only when they appear to touch).

Does one of the many soft body parameters cause this?

I can run more experiments to see if this effect is confined to nodes or shared by links/faces/tetras.

The soft body demo is worth another look- perhaps it has the same problem but all objects are so much larger than what I'm working with that it isn't obvious- I was hoping to do 1 unit = 1 meter but then have cm scale objects.

The code is here https://github.com/lucasw/simple_sim_ros/blob/master/bullet_server/src/soft_body.cpp and elsewhere in that same repository.

Update

The soft body demo does appear to be floating just like my own project, the picture above shows a gap between the bottom of the ellipsoid and the ground.

sentences:
How to port a game from IPad to Iphone I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d.
Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it.

I was thinking to just create a new target on my project, remove all the current resources from the Build Phases and create a new Resources folder with all the assets of the game scaled to the new resolution.

Of course this approach would take a lot of work, specially from the designer, since there are a lot of images on the game, 30 levels with 3 layers of parallax, and over 100  animations between all the elements, plus the SVG levels that map physics world (we are using level SVG parser).

I would also have to check all the touch functions and the sprites with a hard coded position (mostly Hud and the Menu). I did tried to use the win Size for this, but I'm pretty sure there are sprites with fixed positions.

I know that checking the Menu and Hud position should not take much time, but I'm worried about the time it could take to scale all the images, and specially the SVG files that map the physics of the game.

I would like to know if I'm in the right path regarding the porting of the game or if there if someone have though of a better easy solution.

I tried modifying the gluLookAt eye z parameter, but this didn't work really well. I haven't work with OpenGL since college around 3 years ago, and I don't remember very well   the math behind the low level pipeline of it. Anyway, I don't think that modifying the Cocos2d rendering steps could work for my problem.

sentences:
How can I tell if a Gameobject is currently touching another Gameobject with a specific tag? I've seen similar questions to this here on Stack Exchange — Game Development, but none of the answers to them have helped my problem. I am working in Unity 2019.2.18f1 with Visual Studios 2019 Community.

What I want to know how to tell when one Gameobject (the player) is currently touching another game object with a tag name of "Block". When the player collides with a "block" I want it to set: jumpPossible = true; But when it leaves the block (by jumping or falling off) jumpPossible = false;

What I currently have in my PlayerController script (the important stuff anyways):

private void OnCollisionEnter(Collision collision) {
    if (collision.gameObject.CompareTag("Block")) {
        jumpPossible = true;
    }
}

private void OnCollisionExit(Collision collision) {
    if (collision.gameObject.CompareTag("Block")) {
        jumpPossible = false;
    }
}

The problem I am having is when the player is currently on a block and then touches another block. When it leaves the one of the blocks, it will set: jumpPossible = false; and so you can't jump.

What I want for this script to do is whenever the player is touching any Gameobject with a tag of "Block" it should allow it to jump.

sentences:
How to move a b2Body explosively to a new Location I am building an Game based on Box2d with the following basic structure:

The Box2d World itself does not have any Gravity and is filled with some bodies (sheres and simple polygons) of more or less the same size. The user can select on of them and if he clicks on the free space, the selected body should be moved onto the "point of click".

The movement should be explosive, what the use of b2Body.ApplyImpulse suggests, but also stop quickly when the point is reached.

This leads me to two problems:

Which method should i use: ApplyImpulse or ApplyForce? How could I calculate the right vector of the impulse, if you would use this method?

How could I correct the body's way if it collides with another?

Greetings Philipp

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:
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:
Why is this 8 puzzle unsolvable? I am developing a 8 puzzle game. I went through the rules in this (see Detecting Unsolvable Puzzles) link, which tell you how to detect if an initial state is unsolvable. It says that if the number of inversions is odd, then the goal state cannot be reached and if even the goal state can be reached.

An inversion is defined as follows:

  Given a board, an inversion is any pair of blocks i and j where i < j
  but i appears after j when considering the board in row-major order
  (row 0, followed by row 1, and so forth).

There is a 8-puzzle solver (applet) here. Choose 8-puzzle from the options.

1,0,3,2,4,5,6,7,8

and

7,0,2,8,5,3,6,4,1

As you can see both of them contain an even number of inversions. Still the program says that the puzzle is unsolvable. So is the Princeton link wrong?

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:
Foreach/list loop problem I am having a problem with a foreach loop. When my AOE ability hits an enemy it creates a CircleCollider2D and puts all the enemies on a list, which then the loop goes through and adds damage to their scripts.

private void OnTriggerEnter2D(Collider2D other)
{
    if(other.tag == "Enemy")
    {
        targets.Add(other);

        foreach (Collider2D enemy in targets)
        {
            EnemyHealth hp = enemy.GetComponentInChildren<EnemyHealth>();

            hp.TakeDamage(abilityConfig.baseDamage);

            print(enemy.name + " takes " + abilityConfig.baseDamage + "damage!");
        }
    }
}

But as you can see from the picture below the loop goes 3 times over one enemy, 2 times over the second one and once over the third.

As these enemies are the same type they all have the same EnemyHealth script.
If anyone would point me in the right direction I would greatly appreciate it.

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:
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:
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:
Does == cause branching in GLSL? Trying to figure out exactly what causes branching and what doesn't in GLSL.

I'm doing this a lot in my shader:

float(a==b)

I use it to simulate if statements, without conditional branching... but is it effective? I don't have if statements anywhere in my program now, nor do I have any loops.

EDIT:
To clarify, I do stuff like this in my code:

float isTint = float((renderflags & GK_TINT) > uint(0)); // 1 if true, 0 if false
    float isNotTint = 1-isTint;//swaps with the other value
    float isDarken = float((renderflags & GK_DARKEN) > uint(0));
    float isNotDarken = 1-isDarken;
    float isAverage = float((renderflags & GK_AVERAGE) > uint(0));
    float isNotAverage = 1-isAverage;
    //it is none of those if:
    //* More than one of them is true
    //* All of them are false
    float isNoneofThose = isTint * isDarken * isAverage + isNotTint * isAverage * isDarken + isTint * isNotAverage * isDarken + isTint * isAverage * isNotDarken + isNotTint * isNotAverage * isNotDarken;
    float isNotNoneofThose = 1-isNoneofThose;

    //Calc finalcolor;
    finalcolor = (primary_color + secondary_color) * isTint * isNotNoneofThose + (primary_color - secondary_color) * isDarken * isNotNoneofThose + vec3((primary_color.x + secondary_color.x)/2.0,(primary_color.y + secondary_color.y)/2.0,(primary_color.z + secondary_color.z)/2.0) * isAverage * isNotNoneofThose + primary_color * isNoneofThose;

EDIT: I know why I don't want branching. I know what branching is. I'm glad you're teaching the children about branching but I would like to know myself about boolean operators (and bitwise ops but I'm pretty sure those are fine)

sentences:
What image sizes should I use for a mobile cross-platfom game? I'm new to mobile development. I use Monogame.

What device screen resolutions should I consider to target all Android, iOS and Windows Phone devices?

Assuming we have three screen sizes, should I be using different images for each target resolution?

sentences: How to move towards a point in 2D, stopping at obstacles I want to do a 2D game, where you can mouse click anywhere on the map and the player will go there. If there is obstacle in the way, the player will go as close as possible to where you clicked without going into the non-walkable area. What would be the optimal way to accomplish this?

sentences:
how can I rotate a tetrahedron's vertices so that it's pointing straight up? I am trying to render an Equilateral triangle in 3D, and I came across this answer:
https://math.stackexchange.com/a/562895/15497
So based off of that, I made my vertex points:
(1, 1, 1),
(1, -1, -1),
(-1, -1, 1),
(-1, 1, -1),

This looks great when I draw lines across these points, however the triangle is not pointing straight up as I would like it to.  I am trying to understand how to calculate the right amount to rotate the X, and Z axis so that it is pointing upwards?

I messed around with rotating the X by PI / 5 and Z by -PI / 5 and got something close:

But that is not right...

sentences:
Working with tiledata of different sizes I recently bought an asset for my game, basically a tilesheet, with seperate pngs as well, but where as previously I've created tilemaps out of identically sized tiles these are all in varying sizes but scaled to fit in with say 128 x 128 tiles or 256 x 256 tiles.

so one of the main blocks might be 128 x 128 but some other elements of them may be slightly oddly sized such as  173 x 214, this obviously wont tile well as it is, so I was wondering how I should approach this? do i need a tile editor that can support layers with different dimensioned tiles? or do i need to find some way of chopping, padding and aligning these images into the same 128x128 tiles?

thanks

sentences:
In an iOS OpenGL ES 2 game, is it better to use a few large texture atlas or many small textures? I'm working on new game, this time moving to more 3d objects and open gl es 2.  Previous (successful) game was open gl es 1 and mostly 2d.  For es 2 I'm developing my own 3d engine.

My 3d artist delivers .obj's each with a texture map for base and one for bump (normal).  I already have a way to import them all into a single vbo.  But combining the textures is a more challenging problem.

In the es 1 game I did a couple of large texture atlases and could have them all loaded at once.  But since all my geometry was just boxes it was easy to shift them around (small number of vertex) to fit.  I stacked gfx like tetris pieces to fit everything in.  For this though it's a bigger pain to combine textures as there are many many more vertices and they're already mapped to these individual textures.

I have several ideas for ways to approach the problem:

Keep the separate but manage the loading and releasing of texture images better, so that when a level is loaded it loads just the images needed for the objects needed for the level.  If I did this how many images can the ios implementation handle?  How would performance suffer on older devices like the iPhone 4?
Combine multiple textures into atlases and cram image parts together however necessary to fit.  Then load the obj's into my 3d app and basically manually remap everything to the combined texture.  It's a pain and basically what I'm paying the 3d artist to do.
Combine multiple textures into atlases but by putting 4, 8, 16, etc smaller ones into each larger one.. DON'T cram them together but uniformly shrink each one.  Then the remapping can be mathematical instead of a manual remapping.  (This would leave possibly a lot of un-used space in some of the sub-textures)

Pre-calculate the math beforehand in the importing process.
Modify my shader to shrink and offset the textcoord on the fly by an amount provided as a uniform.

Also.. is it better to combine the base texture and normal texture into one or have 2?  Combining them would mean having the shader do math to move the textcoord over for the normal map.

sentences:
After creating DirectX11 Device, enumerating the DXGI Adapters seems to produce invalid results EDIT: This is part of an upgrade from DirectX10 to DX11.

When I create a DirectX 11 device with D3D11CreateDevice(), it chooses a video adapter for me. I access this object like so:

// removed HRESULT checks for brevity- normally I print errors on failed hr

IDXGIDevice1*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter = NULL;
pDXGIDevice->GetAdapter( &pAdapter );

// save pAdapter

However, later, when I enumerate the adapters, this adapter is not on the list:

IDXGIDevice*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter;
hr = pDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&pAdapter);

// so far so good: pAdapter matches my current adapter I saved from above

IDXGIFactory* pFactory;
pAdapter->GetParent(__uuidof(IDXGIFactory), (void **)&pFactory);

UINT i = 0;
while( SUCCEEDED( hr ) && hr != DXGI_ERROR_NOT_FOUND )
{
    IDXGIAdapter* padapter;
    hr = pFactory->EnumAdapters1( i, &padapter );

    // none of these padapters matches the current adapter!!
    i++;
}

After this section, I have a list of the enumerated adapters. My current adapter is not in the list! Instead there is a DIFFERENT adapter with the same name as my current one.

Most importantly (this is the part I actually need) if I call D3D11CreateDevice() with this enumerated (different) adapter specified, I get E_INVALIDARG.

What am I doing wrong to generate these alternative, invalid adapters?

sentences:
Determining how loud an AudioClip is I have some code that uses GetSpectrumData from an AudioSource playing a song to create a level layout for the player to play. I want to add a functionality where the players can upload their own songs and play the levels created with the data from these songs. Unfortunately, when comparing different audio files, I encountered this:

As you can see, the amplitude differs drastically from clip to clip, subsequently creating levels that are trivial to complete or almost impossible. I want to find a way to determine this "loudness" so I can tone it down or amplify it with a multiplier after getting the data from the song. Also, is there a way to extract this data without playing the song?

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:
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:
OpenGL Poor FPS when models outside view I have been testing my game to see how well it renders a few hundred complex models onscreen at once point but even when all the models are outside my viewpoint, i still get poor fps.

I have face culling enabled to get rid of back facing triangles, but I'm not sure how to stop processing triangles behind or outside my viewpoint.

sentences:
Storing, loading and editing a level I'm trying to find useful information on creating game levels in a reasonably efficient way.
Additionally, information in setting up a fairly painless way to edit this information would be handy (the closest I've come is some monstrosity in Flash; I would place the parts onto the stage, and run a script reading all the platforms, triggers and what have you, into an XML document).

Google hasn't been to terribly helpful in finding what I need (probably what terms I'm using as I'm not sure exactly how I would refer to this). I'm hoping there may be someone here who knows of a good solid article on handling the data for a level.

I've made a few attempts in previous projects (the latest being in Flash using XML), and I often run into issues with performance (in my case, I narrowed it down to having to many objects loaded, and started culling what was outside my view, was still slow though...).

To clarify a bit. I'm not afraid of investing time in developing tools. I don't have a specific game I am making this for so much as I am wanting to learn about the theory behind a level editor and the files it would generate to be used as a level. I'm looking to understand what goes on in a program and thus far have been un-successful in finding anything to help educate me on what makes such a system tick.

I am particularly interested in knowing how to make one that's 'good' rather than 'works'. I've already gotten something working in XML on my own, however it was poorly structured and excessively slow for relatively small levels. I am sure there are better ways to organize the information for loading and using on the screen, its more a matter of me being unsure what to use. I've heard talk of using binary space trees, quad or oct trees, however I haven't found much related to using them in a tool. (Most of what I have found is academic and more or less to abstract to make use of outside of theory)

sentences:
How to create in game menu attached to unit I'm creating a game similar to Banner Saga, except my game will be in 3D, with a camera that can move around and zoom in and out. What I want is for a menu to appear after the user clicks on a unit. This menu must always be visible and facing the camera.

The menu that has the foot and sword symbols is what I want.

How can I get a similar result in 3D? The new Unity UI canvas isn't really suitable, since the camera will move around, and the menu must stay next to the unit. The menu elements can't be covered up by things in front of it, like other units. Thanks

sentences:
Entity Component System: where do I put containers? I'm pretty new when it comes to the whole Entity Component System structure and I got some questions I just can't wrap my head around.

I know that for example collisions, you'd have a CollisionComponent and a CollisionSystem for handeling collisions. But what if I'd like to use a quadtree for collisions? Where do I put that quadtree? What do I store in that quadtree? Both the PositionComponent and CollisionComponent?

A quadtree is just an example, it could be any abstract container really. If somebody who has more experience with ECS could give me a primer on this, I'd be very grateful.

sentences: Where can I find the sprite base grid? There's been many times where I've seen people use this tile grid. It's the one with the base pink background with deep purple bands around each section. Is this available online or will I have to make it myself?

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:
How to optimize primitives in SecondLife/Opensim? SecondLife/Opensim uses Primitives to construct models. How it works in details is explained here.

Now I have many triangles which link together. Is there any way to make them into one prim, thus reducing the number of prims?

sentences:
How to create custom inspector to display generic Stack class I have a member that I would like to expose:

[Serializable]
private sealed class InputGameObjectStack: Stack<GameObject> {
    public InputGameObjectStack(): base(_InputGameObjectStackSize) {
    }
}

Inside the MonoBehaviour, I have:

[SerializeField]
private InputGameObjectStack _inputGameObjectStack;

Inside the editor script, I'm able to fetch the property from the MonoBehaviour object (as SerializedProperty), but there is nothing usable that allows me to traverse through the elements.

Is there any way of showing the constents of the stack in the inspector as immutable (no functionality to push/pop)?

sentences:
How can I remove inventory items in a Bukkit plugin? I am making a Bukkit plugin that takes the player to a "FunZone" and allows them to do just about anything. I don't want data transferred between the two worlds. So far I have got most everything stopped. Here's the problem code:

            Integer normInvSize = player.getInventory().getSize();
            Integer i = 0;
            for (i=0; i<normInvSize; i++) {
                ItemStack item = player.getInventory().getItem(i);
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".amount", item.getAmount());
                Short durab = item.getDurability();
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".durabillity", durab.intValue());
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".type", item.getTypeId());
                player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));
            }

I have everything set up how I want it but I get stray items following me between the worlds. The line

player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));

does not remove all of the inventory. I want some code that will remove all inventory items (I've handled armor already). I already have a way to restore the inventory later, but my code currently won't remove everything. For example I can end up transfering some stone tools from the "FunZone" to the normal world, which I don't want.

sentences:
OpenGL ES 2.0: Calculated Cube Vertex Normals Verification Could I kindly ask to confirm, that the calculated normals are correct, please? I have calculated them on my own, but my testcube is still strangely lighted within OpenGLES 2.0.

The vertices were exported from 3D authoring application.
The vertex normals were calculated using matrix cross product.
The vertex and fragment shaders I were exact copies from the book, so there should not be a bug.

The output in OpenGL looks like the sphere is lighted from its bottom. Moreover, it looks, like the box is visible from inside, as the top part is always transparent. Any idea, where can be a problem?

Added:

The vertex normals are calculated based on triangulated quad-polygons. The triangulation is performed internally, by the 3d application. Vertices/ indices are generated by calling API calls of that application.

#begin 8 vertices
vs 24
v -25.000000 -25.000000 -25.000000
v 25.000000 -25.000000 -25.000000
v -25.000000 25.000000 -25.000000
v 25.000000 25.000000 -25.000000
v -25.000000 -25.000000 25.000000
v 25.000000 -25.000000 25.000000
v -25.000000 25.000000 25.000000
v 25.000000 25.000000 25.000000
#end 8 vertices

#begin 12 faces
fs 36
f 0 2 3
f 0 3 1
f 0 1 5
f 0 5 4
f 0 4 6
f 0 6 2
f 1 3 7
f 1 7 5
f 2 6 7
f 2 7 3
f 4 5 7
f 4 7 6
#end 12 faces

#begin 8 calculated normals
ns 24
n -0.577350 -0.577350 -0.577350
n 0.816497 -0.408248 -0.408248
n -0.408248 0.816497 -0.408248
n 0.408248 0.408248 -0.816497
n -0.408248 -0.408248 0.816497
n 0.408248 -0.816497 0.408248
n -0.816497 0.408248 0.408248
n 0.577350 0.577350 0.577350
#end 8 calculated normals

I use OpenGL ES 2.0, but that should not be relevant at this moment.

Update:

I can confirm now, that the calculated vertex normals are correct, and can therefore be used by others, to verify correctness of their triangulated cube vertex normals calculations.

However, I still have a problem that all the vertices, which are in positive z axis, are not rendered. Not sure if they are culled, but I have pretty large frustum. Vertices in the -z axis are kept, so the rendered mesh looks like cut in half, as it is position in 0 z-axis.

This lines below show that I should not concsicously setup small render area:

mProjection = glm::perspective (45.0f, (float)WINDOW_WIDTH / (float)WINDOW_HEIGHT, 1130.0f, -1130.0f);

mViewTransformation = glm::lookAt(glm::vec3(vIntCamera.x, vIntCamera.y, 1130.0f), glm::vec3(vIntCamera.x, vIntCamera.y, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));

Any ideas, please, what else should I check?

Solved:

Eye position of the camera (in glm::lookAt() function) should be above the top of the perspective frustum, defined by glm::perspective().

Thanks for your support guys, especially with the upper part of my question.

sentences:
How can I set up a pixel-perfect camera using OpenGL and orthographic projection? I am creating a 2D game using OpenGL and orthographic projection. For sprites, I use textured quads (actually two triangles).

I want the pixel art textures for the sprites to be displayed in a multiple of the original size to avoid blurry textures.

How can I set up a pixel-perfect camera using OpenGL and orthographic projection?
After doing so, how do I size the qauds?

sentences: Using real football player photo in a trivia quiz game, is it legal? I don't know whether this question was already been asked before, but my team is currently developing a trivia quiz game about football (soccer not NFL). And we want to put player's images or club emblems as part of the questions and answers. My question is, is it legal? Or should we just put text without the images? Please your help is much needed. Thank you.

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:
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:
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:
Best Algorithm for attacking in the Risk Game I apologize in advance for my English.I'll try to explain my problem.
I am working on new version of the Risk game. I want to change the attacking algorithm to make it more similar to real life war. The sides which have more armies must have the advantage over the weaker side.

These are the original board game's rules below from Wikipedia:

  Example of matching up attacking (red) and defending (white) dice; in this case the attacker has won the battle. When it's a player's turn to attack, he or she can only attack territories that are adjacent or connected by a sea-lane to his or her own territory. A battle's outcome is decided by rolling dice. The attacking player attacks with one, two, or three armies, rolling a corresponding one, two or three dice. At least one army must remain behind in the attacking territory not involved in the attack, as a territory may never be left unoccupied. Before the attacker rolls, the defender must choose to resist the attack with either one or two armies (using at most the number of armies currently occupying the defended territory[4]) by rolling one or two die. Each player's highest die are compared, as are their second-highest die (if both players roll more than one). In each comparison, the highest number wins. The defender wins in the event of a tie. With each dice comparison, the loser removes one army from his territory from the game board. Any extra dice are disregarded and do not affect the results.

I think these rules are not very good for real life situations because we know from history that large number of armies have an advantage over the weaker side. I have to create the right balance between the two sides during the war.

Currently I am using the following algorithm

army1 = random.Next(1, 20 + (numberOfSolidersArmy1 / 5));
army2 = random.Next(1, 20 + (numberOfSolidersArmy2 / 5));

Then I am comparing army1 and army2 and decrease the number of soldiers by one of the smaller number's side.

What are your suggestions for a better algorithm?

sentences:
How write pixel by pixel with a fast way Allegro 5.01 I'm currently trying to do a black and white filter for my game in c++ with Allegro 5.01, I'm doing like this.

void    GameEngine::blackAndWhite()
{
    ALLEGRO_BITMAP *buffer  = al_get_backbuffer(this->windows);
    ALLEGRO_LOCKED_REGION *region = al_lock_bitmap(buffer, ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_READWRITE);
    unsigned char *ptr = static_cast<unsigned char *>(region->data);

    for (int x = 0; x != 640; ++x) {
        for (int y = 0; y != 480; ++y) {
        unsigned char   red;
        unsigned char   green;
        unsigned char   blue;

        this->getpixel(ptr, x, y, region->pitch, &red, &green, &blue);
        unsigned char result = (red + green + blue) / 3;
        this->putpixel(ptr, x, y, region->pitch, al_map_rgb(result, result, result));
        }
    }
    al_unlock_bitmap(buffer);
}

And putpixel and getpixel is like this.

void        GameEngine::putpixel(unsigned char *ptr, int x, int y, int offset_y,  ALLEGRO_COLOR color) {
    unsigned char   red;
    unsigned char   green;
    unsigned char   blue;
    unsigned char   alpha;

    ptr += (y * offset_y) + (x * 4);
    al_unmap_rgba(color, &red, &green, &blue, &alpha);
    *ptr++ = red;
    *ptr++ = green;
    *ptr++ = blue;
    *ptr = alpha;
}

void        GameEngine::getpixel(unsigned char *ptr, int x, int y, int offset_y,
unsigned char *red, unsigned char *green, unsigned char *blue)
{
    ptr += (y * offset_y) + (x * 4);
    *red = *ptr++;
    *green = *ptr++;
    *blue = *ptr++;
}

It's working, but it's really slow, I'm thinking it's slow because this operation is do by the CPU and not the GPU.

Is there a way for reduce the time of the operation with allegro or not ?

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:
How do I select my platform and move them in a specific place in gameplay? I saw this game called TaniNani and I was amazed by the concept of the game and I would like to try to replicate it!

My goal is to let the player hover on the available grid (somehow like hovering on an inventory) and when the player finds its desire the player will select the platform and when it is selected it could move in a specific location inside the box only! How do I code this using C# in Unity2D?

The example I want to achieve!

MEANING OF THE COLORS

Red -- The platform

Light Blue -- Where the platform can be moved either from left/up/right

Purple -- The platform can be switched by another platform

sentences:
Pause on scrolling backgrounds I have a typical parallax backgrounds. They are scrolling by

public float Speed=0f;

void Update ()
{
    renderer.material.mainTextureOffset = new Vector2 (Time.time*Speed,0);
}

I have a character. OnKeyDown he starts to move: Speed of background sets to 0.4f for example. OnKeyUp a character stops by setting the speed of background 0f.
The problem is: when backgrounds stop to scroll, they return to its start position. They must just to pause the position. How to do?

sentences: Font library for XNA Is there a free type library kind of implementation available for XNA? I wish to use it on WP7, so it should be a managed code. I know can alternatively use spritefont, but I wish to know if other implementations exist for complex requirements.

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:
Dealing with AI in a simple strategy game Hi I am currently working on a small real-time strategy game.

The game consists in discovering and exploring planets to get knowledge and resource points. Every Unit of Time (UoT) in the game those points are adjusted based on a various factors. Basically the more planets you have explored the more points are generated, yet the more planets you get the greater the expenses per UoT, so it is a balance. There are a variety of planet types, some which allow to discover planets in a greater area, but produce little points, whilst others produce a lot of points. The longer the players lasts before running out of resource points and the more planets they explore the higher their score is.

I kind of got a decent game at the moment, but I wanted to add an AI to have other explorers competing against the player. I don't really know how to handle it.

So far my thoughts are to add weights to various parameters (like the number of points provided by each planet, the cost in points to explore it, the fact that it has been already explored, etc...). Those weights would be adjusted based on a variety of conditions, say if the player resource points drop below x then the weight attributed to the number of resource points provided would be greater than that of knowledge points.

I was wondering if anyone had any thoughts on this, is it likely that I'm going to get myself tangled in all of it if I do it this way.

Also one important thing to note is that the game space is randomly generated, i.e every time a UoT passes or an explorer explores a planet there is a chance that 2 new planets are being randomly generated. Which means I can't really use methods which are based on calculating a few turns ahead to make the best decision.

Finally, the game is relatively peaceful, I don't have a combat system, and the only risk of exploring a planet already explored by another explorer would be that, if that explorer is nearby, he might just re-explore it as soon as you have left meaning you have spent valuable resource points for no benefits, since all the point generation will go to the most recent explorer.

sentences:
How Can I Improve This Card-Game AI? Let me get this out there before anything else: this is a learning exercise for me. I am not a game developer by trade or hobby (at least, not seriously) and am purely delving into some AI- and 3D-related topics to broaden my horizons a bit.

As part of the learning experience, I thought I'd have a go at developing a basic card game AI.  I selected Pit as the card game I was going to attempt to emulate (specifically, the 'bull and bear' variation of the game as mentioned in the link above).  Unfortunately, the rule-set that I'm used to playing with (an older version of the game) isn't described.  The basics of it are:

The number of commodities played with is equal to the number of players.
The bull and bear cards are included.
All but two players receive 8 cards, two receive 9 cards.
A player can win the round with 7 + bull, 8, or 8 + bull (receiving double points).
The bear is a penalty card.
You can trade up to a maximum of 4 cards at a time.  They must all be of the same type, but can optionally include the bull or bear (so, you could trade A, A, A, Bull - but not A, B, A, Bull).

For those who have played the card game, it will probably have been as obvious to you as it was to me that given the nature of the game, gameplay would seem to resemble a greedy algorithm.  With this in mind, I thought it might simplify my AI experience somewhat.

So, here's what I've come up with for a basic AI player to play Pit... and I'd really just like any form of suggestion (from improvements to reading materials) relating to it.

Here it is in something vaguely pseudo-code-ish ;)

While AI does not hold 7 similar + bull, 8 similar, or 8 similar + bull, do:
    1. Establish 'target' hand, by seeing which card AI holds the most of.
    2. Prepare to trade next-most-numerous card type in a trade (max. held, or 4, whichever is fewer)
    3. If holding the bear, add to (if trading <=3 cards) or replace in (if trading 4 cards) hand.
    4. Offer cards for trade.
    5. If cards are accepted for trade within X turns, continue (clearing 'failed card types').
        Otherwise:
            a. If only one card remains in the trade, go to #6.
                Otherwise:
                    i. Remove one non-penalty card from the trade.
                    ii. Return to #5.
    6. Add card type to temporary list of failed card types.
    7. Repeat from #2 (excluding 'failed card types').

I'm aware this is likely to be a sub-optimal way of solving the problem, but that's why I'm posting this question.  Are there any AI- or algorithm-related concepts that I've missed and should be incorporating to make a better AI?  Additionally, what are the flaws with my AI at present (I'm well aware it's probably far from complete)?

Thanks in advance!

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:
Events aren't working (Allegro5) I've been using allegro for some time, and the timer event worked in all my previous projects, but I don't know what happened this time, I want to move a piece as long as the game is going, but it isn't moving at all, so the timer event isn't working, why is that? I've made sure all event sources are registered. Here is the code that reproduces the problem:-

int firstStuffXPos = 100;
int firstStuffYPos = 100;
ALLEGRO_EVENT_QUEUE *eventqueue;
ALLEGRO_DISPLAY *display;
ALLEGRO_TIMER *timer;
int width = 800;
int height = 600;
int FPS = 60;
 bool donePlaying = false;

class MyClass{
public:
int getXPos()
{
    return x;
}
int getYPos()
{
    return y;
}
int x;
int y;
 MyClass(int x, int y){
    this->x = x;
    this->y = y;
    stuffone;
}
ALLEGRO_BITMAP *stuffone;
};
MyClass stuff1[] = {
{ firstStuffXPos, firstStuffYPos},
};
void initialize(){
    al_init();
    if (!al_init()){
        std::cout << "Failed to initialize allegro5." << std::endl;
    }
    al_init_image_addon();
    if (!al_init_image_addon()){
        std::cout << "Failed to initialize image." << std::endl;
    }
    display = al_create_display(width, height);
    if (!display){
        std::cout << "Failed to create display." << std::endl;
    }
    al_install_keyboard();
    if (!al_install_keyboard()){
        std::cout << "Failed to install keyboard." << std::endl;
    }
    al_init_primitives_addon();

    eventqueue = al_create_event_queue();
    timer = al_create_timer(1.0 / FPS);

    al_register_event_source(eventqueue, al_get_display_event_source(display));
    al_register_event_source(eventqueue, al_get_keyboard_event_source());
    al_register_event_source(eventqueue, al_get_timer_event_source(timer));

    }
int main(){
initialize();
for (int nostuff = 0; nostuff < 1; nostuff++){
    stuff1[nostuff].stuffone = al_load_bitmap("blueblock.png");
}
    while (!donePlaying){
        al_clear_to_color(al_map_rgb(0, 0, 0));
        ALLEGRO_EVENT ev;
        al_wait_for_event(eventqueue, &ev);
        al_start_timer(timer);
        if (ev.type == ALLEGRO_EVENT_TIMER){
            firstStuffXPos += 5;
            firstStuffYPos += 5;
        }
        for (int i = 0; i < 1; i++){
            al_draw_bitmap(stuff1[i].stuffone, stuff1[i].getXPos(), stuff1[i].getYPos(), 0);
        }
        al_flip_display();
    }

    al_flip_display();
}

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:
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:
How many people are needed for making a good (MMO)RPG? 1) RPG?
2) MMORPG?

I'm talking more about good content here.

Update: Because it is said here that volume of information is low in my question, and because there was too much to say, I created an extension question

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:
How to get one KinematicBody2D to push another? I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd like my player to push it without losing velocity.

My block is in a group called moveables, has no script, and has no other forces acting on it.

After I calculate the velocity of my player in _physics_process(), I have the following code.

# update position and handle collision

var collision = move_and_collide(vel * delta)
if collision:
    var collider = collision.collider
    var normal = collision.normal
    var remainder = collision.remainder
    var collision_angle = rad2deg(acos(normal.dot(Vector2(0,-1))))

    # floors
    if collision_angle == 0:

        # reset y vel so it doesn't keep accumulating
        vel.y = 0

        var horizontal_movement = Vector2(remainder.x, 0)
        move_and_collide(horizontal_movement)

    # moveables
    elif collision_angle == 90:
        if collider in get_tree().get_nodes_in_group("moveables"):
                collider.move_and_collide(remainder) # move block by remainder
                move_and_collide(remainder) # move player by remainder

This code does allow the player to push the block, but only slowly. I can't figure out why. Ideally, the player would push the block without losing any velocity.

Even if I directly update only the horizontal position of my block, it still moves slower than expected, and my player sprite is blurred, presumably because of collision corrections.

        if collider in get_tree().get_nodes_in_group("moveables"):
            collider.global_position.x += remainder.x
            move_and_collide(remainder)

The problem seems to be that when I move the player by the remainder, the player is still colliding with the block, even though I move the block itself in the previous line. This is confirmed by analyzing the collision object move_and_collide(remainder).

What's wrong and how can I achieve the desired movement?

I asked a variant of this question on a Godot forum, but am also asking it here for increased visibility.

sentences:
What are the best practices when colaborating with an audio engineer? I am talking with various audio engineers and each has pretty much their own rates and way of colaborating. Since I am pretty foreign to their world and work process, I want to have a healthy relationship, and a fair money/work exchange.

Thus I want to inquire on the copyright use of the music. Naturally, the first would be the right to use all the sountracks in the game, for trailers, promotional material, conventions.

Secondary, I am thinking explicit permission for streamers and youtubers & the like to use the music for their edited videos and as background music while playing or streaming, as long as they give credit and link to the website or game page.

Thirdly, the right to sell the music, as an addon, on the game page.

Different sound engineers expressed explicit fobidding the second and/or third bulletpoint, and I am sure there is a fourth and fith, sixth...etc. that I am missing. So my question is a bit more complex.

I am open to suggestions on improving my question, perhaps I failed to get the message through.

sentences:
How does real-time raytracing draw reflections of off-screen geometry? I know what raytracing is, but I'm a bit curious how games are able to reflect off-screen geometry using raytracing in real-time.

I tried looking up the technical details but most of the articles are "what it is"

sentences:
How do make a box collider align with a line renderer continuously? I am having the issue of aligning my BoxCollider2D with my linerenderer.

I am trying to have a laser shoot using:
Physics2D.Linecast(startingPoint.transform.position, maxEndPoint.transform.position);

This works fine and the line is always shooting in the right direction and angle when I rotate the object. But, when I am drawing a box collider, the box doesn't align at the correct position.

Firstly, the boxcollider is attached as a child component of the line renderer.

I am using this code to get the size of the collider, which seems to work fine.

float lineLength = Vector3.Distance(lazer.GetPosition(1), lazer.GetPosition(0));

This code is for aligning the collider with the line renderer. I know I am supposed to get the midpoint, because that's how you control the location of the box collider, but I need to know the math to always make it align.

    lazerCollider.offset = new Vector3(0, ourHitPos.y - startingPoint.transform.position.y, 0) / 2;
    lazerCollider.size = new Vector3(lazerWidth, lineLength, 0);

I know right now I am only using the Y coordinate... I just need to know the math to make this work.

sentences:
How should I move 2D objects in OpenGL ES 2? I am a bit confused about what I need to move a basic square. Should I use a translation matrix or just change the object vertices? Which one is better?

I use a simple vertex shader, gl_Position = myPMVMatrix * a_vertex, along with a VBO.

sentences:
How can I use height patches to generate terrain such as what was used to create Abzu? Last year's GDC was pretty inspirational for me and Matt's talk about GiantSquid's landscape creating workflow was the best of all. If you haven't seen it I highly recommend you to check it out.

I'm a Unity dev and I'm aware of the fact that Abzu was done with UE and the tools they used in this landscape creation and customizing was custom built.

Although I'd eventually like to create similar tools for terrain generation via mashing height patches and enabling different surfaces blending, terrain stamps, and such, the first thing I should ask should be about the level terrain bit.

How can I use height patches to generate a terrain (like sand) and then blending them together with something else without extra sculpting (like rock protruding from the sand surface)?

sentences:
What are the security implications of this method of tracking countdowns? Consider a multiplayer (client/server) game where you initiate the construction of some building. Let's assume construction will complete after 60 minutes.

My plan for dealing with this information is as follows, but I'm not sure if it is secure:

Client initiates construction of building (60 mins)
Server accepts request (resource requirements are met)
Server stores the building task for that player and a completion time-stamp (now + 60 mins)
Client begins a countdown (60 mins)
If client re-connects, the completion time-stamp is retrieved from the server and the remaining time is calculated by the client
When the client counter hits 0, it asks the server for an update
While retrieving the data to send for an update, the server notices that the time-stamp has expired and makes the necessary updates
Server response includes newly constructed building

I thinkit is secure since the completion time and resource calculations are all on the server side; however, is there a security problem that I haven't foreseen?

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:
LibGDX - Level management on a level-based game I'm new to LibGDX and android development in general and am trying to do a puzzle game. Being a level-based game, i'm trying to make it so in every level a certain number of blocks (just rectangular sprites) appear in a certain position / rotation, like in the image linked below:

https://i.gyazo.com/52e6c71e1f05ab4529e0fec9d4f80bd7.png

I've doodled some levels already but i'm really not sure about how to make the blocks's rearrangement over the levels.
How exactly should one manage this? As the position of the blocks won't be random i was thinking about reading from files the information from every level (x, y, rotation, colors, etc. for every block) but to do that i would have to manually organize every level's blocks properties information (to then save), and, considering it would have atleast 100+ levels, it would take too long... Other than that, i could have them as plain assets but having an asset for every single level doesnt't look like an efficient solution either. Do you have any tips, please?

sentences:
Using QuadTree for Procedural Generation so I've been trying to start a new project that focuses on procedural room generation similar to what is seen in Binding of Isaac.

I plan to have the code use a QuadTree to help determine where rooms should be placed. Each node in the quad tree represents any of the possible 4 directions the next room can be placed.

The problem is this. I'm not sure where to start when trying to implement the QTree and haven't found good resources on the topic. Most implementations of QuadTrees in a procedural generation context use them for partitioning spaces and placing rooms within the partitioned spaces. Not sure if that's what I want to achieve. I'm also unsure of weather I should be going in this direction or if there's a more optimal solution?

sentences:
add random force and direction to rigidbodies every x seconds i need to add a windForce to multiple rigidbodies, with random direction and random force every x lapse of time. I'm using InvokeRepeating to update the windDirection so that the rigidbodies can be pushed in a different direction every x seconds.
Here's the code:
void windRotate()
{
    windDirection.y = Random.Range(0, 360);
    transform.Rotate(windDirection * smooth);

    if (objectsInWind.Count > 0)
    {
        foreach (Rigidbody rigid in objectsInWind)
        {
            rigid.AddForce(windDirection * 10);
        }

    }
}

This way the rigidbodies don't receive any force. I guess the system does not recognize the Vector3 Update of windDirection, so I need to recalculate it, bit I was not able.
On the other hand if I use this:
rigid.AddForce(Vector3.Up* 10);

the rigidbodies moves but in one direction only, and it's not updated on the next windDirection change.
I tried playing with the various Vector3 values (up, right etc..) and different force methods (AddRelativeForce) but nothing changed.
By using Debug.Log(windDirection); i know that windDirection is updating correctly ever 3 seconds, so it should also be updated in my methods when i apply the force, but id does not work.
Any suggestion?
Thanks

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:
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:
Using box2d DrawDebugData with multi layer scene? In my Game, a Scene is composed by several layers. Each layer has different camera transformations.

This way I can have a layer at z=3 (GUI), z=2 (Monsters), z=1 (scrolling background), and this 3 layers compose my whole Scene.

My render loop looks something like:

renderLayer()

   applyTransformations()

   renderVisibleEntities()

   renderChildLayers()

end

If I call DrawDebugData() in the render loop, the whole b2world debug data will be rendered once for each layer in my scene, this generates a mess, because the "debug boxes" get duplicated, some of them get the camera transformations applied and some of them don't, etc.

What I would like to do, would be to make DrawDebugData to draw only certain debug boxes. In that way, I could call something like

b2world->DrawDebugDataForLayer(int layer_id)

and call that on each layer like :

renderLayer()

   applyTransformations()

   renderVisibleEntities()

   //Only render my corresponding layer debug data
   b2world->DrawDebugDataForLayer(layer_id)

   renderChildLayers()

end

Is there a way to subclass b2World so I could add this functionality ( specific to my game ) ?

If not, what would be the best way to achieve this (Cocos2d uses a similar scene graph approach and box2d, but I'm not sure if debugDraw works in Cocos2d... )

Thanks

sentences:
PNG image as a level map for 2d game I've been using a tilemap editor for making levels, but I was wondering if there was a way to use PNG images as the level map, as maps created in tiled editor are graphically uninteresting.

Background: I've recently started 2d game development and have learned basics i.e collision, game loop etc. I am developing game in JavaScript for Windows 8, but c#/c++ would work for me also.

sentences:
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:
How can I make a custom editor that creates/deletes game object clones around a given point I have been manually creating and deleting clones of my game objects that I arrange in a circle around a given point. Each of the objects is rotated making each object the same angle apart from the others as seen in the image below.

My objects range from 2 to 10. Doing this manually is very cumbersome, especially when changes have to made. How can I create a unity custom editor that allows me to specify a number of game object clones I want to create around a specified anchor point? Additionally, adjusting the number of clones should dynamically create/delete clones and reposition/rerotate them.

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:
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:
Develop bots for CS:GO I'm working on a project where we would like to create a more "intelligent" bot in CS:GO (as a training-bot that you can play against in offline mode). We're currently in the start-up process and there's some initial questions. Would be greatly helpful if anyone can help out with some answers!

After some research there seems to be difficulties developing bots for CS:GO as a third-party-bot developer. Is it only VALVE that develops bots for CS:GO or is it possible for a developer to create a bot in CS:GO? Is anyone here comfortable with developing bots for games such as CS:GO? If so, it would be awesome to get some more in-depth answers about our project.

sentences:
Improve mouse movement in first person game In my current FPS game, I have the mouse setup in a way, that it always forces the position of the mouse to be centered at the screen. This gets the job done, but also gets very annoying, since the mouse is "fixed" at the center of the screen.

Here is what I am doing:

get mouse current position
find offset from center of the screen
set mouse current position to center of the screen
apply difference to m_pTransformation (transformation matrix of the player)

Is there a better way to deal with this ?

sentences:
How to prepare a sprite for a game? For example, I created my character drawing on Paint.NET using the Pencil tool and now it's a sprite like asset.

If I want him to move do I need to create many different poses for him and render them according a timer? Or do I need to have each pose side by side in a single image, then render the rectangle I need, thus loading the picture only once?

Thanks.

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:
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: How do i implement a hit box system in a fighting game? In a fighting game a move that you execute is basically just a series of hit boxes that are enabled and disabled at certain times. I want to know how do you create this hit box system. I have no idea as to how to make a flexible system where I can enable and disable a hit box on any frame of a move and also adding additional frame data. All I can think of is having a list that is the size of the amount of frames of the move, and add all of the enables, disables, and frame data as one list item. The problem with that is that a list item can only be one object so I have to somehow make all my frame data and hit box enables & disables into one object. If I can have as many hit boxes in a move as I want then this list item object needs to have a list as well, which I don't think is a good way of doing it. So I just want to know all of the good ways of implementing a hit box system in a fighting game.

sentences:
Why don't I have some settings in GameMaker? I recently bought GameMaker for Mac, however upon watching a few GameMaker videos I've realized that I don't have all options available.

For example, in "Sound Properties" in other videos people have the option to change the volume and the pan, whereas I don't.

Does anyone know why this is happening?

sentences:
Issue with rotating particle effects with DrawUserPrimitves I am creating a voxel-like game in XNA/Monogame. I am trying to create particle effect of which I create by making a list that is populated every frame. My issue is here: I am using a WorldMatrix to help rotate the particles, but I don't see how I can rotate them with a translating because each particle is different. Here is an example:

partEffect.CurrentTechnique = partEffect.Techniques[0];
        partEffect.Parameters["View"].SetValue(camera.viewMatrix);
        partEffect.Parameters["Projection"].SetValue(camera.projectionMatrix);
        Vector3 rotAxis = new Vector3(1,0,0);
        Vector3 rotAxis1 = new Vector3(0, 1, 0);

        rotAxis.Normalize();
        Matrix worldMatrix = Matrix.CreateTranslation(-20.0f / 3.0f, -10.0f / 3.0f, 0);// *Matrix.CreateFromAxisAngle(rotAxis1, camera.HORIZONTAL) * Matrix.CreateFromAxisAngle(rotAxis, camera.VERTICAL);// *Matrix.CreateFromAxisAngle(rotAxis1, camera.HORIZONTAL);//RotateToFace(vertices[0].Position, camera.Position, new Vector3(0, 1, 0));//Matrix.CreateBillboard(vertices[0].Position, camera.Position, new Vector3(0, 1, 0), new Vector3(0,0,0));//Matrix.CreateFromAxisAngle(rotAxis, angle);//Matrix.CreateTranslation(-20.0f / 3.0f, -10.0f / 3.0f, 0) * Matrix.CreateFromAxisAngle(rotAxis, angle);
        partEffect.Parameters["World"].SetValue(worldMatrix);

The next code that I call after that is the actual draw code, but my problem is here: How do I modify that translation when it seems to be static while each particle is different? Here is my draw effect:

foreach (EffectPass pass in partEffect.CurrentTechnique.Passes)
{
pass.Apply();
     GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
}

So as you can see, the Matrix.CreateTranslation is called before I run my actual draw code. I just don't see how I can modify that translation so it works for every particle instead of just the translation for the single particle. Any insight would be greatly appreciated.

sentences:
How can I load another form containing a new level when my player reaches the current level's exit? I am coding a very basic side-scrolling game in C#, using Windows Forms.

I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded immediately. How can I do this?

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:
How to convert coordinates into local object coordinates in libgdx? How to convert click coordinates (Gdx.input.getX (), Gdx.input.getY ()) to local object coordinates?
The screenToLocalCoordinates method does not work and does not convert coordinates.
current-some button
Vector2 mouseScreenPosition = new Vector2(Gdx.input.getX(), Gdx.input.getY());
 Vector2 mouseLocalPosition =current.screenToLocalCoordinates(mouseScreenPosition);

sentences:
Rotating a vector by a quaternion I am trying to rotate a direction vector (0,0,1,0) by a rotation quaternion in DirectX.

From what understanding, to rotate the vector you must do

NewVector = rotQuaternion * Vector * inverse(rotQuaternion)

In directX11, I am testing out the algorithm above using an identity quaternion.

XMVECTOR qIdentity = XMQuaternionIdentity();
XMVECTOR inverse = XMQuaternionInverse(qIdentity);
XMVECTOR test = qIdentity * XMVectorSet(0.0f,0.0f,1.0f,0.0f) * inverse;

My new test vector should just be (0,0,1,0), however it is completely zeroed out, and I am not exactly sure why or if I multiplied it correctly.

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:
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:
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:
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: No RenderWindow class in SFML? In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no RenderWindow in sf::  . I  copy-pasted the code but it still does not works. What could possibly be the  reason behind this ?

sentences:
Partial mesh culling by checking against the AABB-tree of objects vertices instead of only the AABB of the whole objects First thing: this is more of a conceptual question than an implementation oriented one, but still tips about implementation will be very much welcome if you happen to have any (athough I have some experience programming different parts of games, graphics are certainly my weak spot - as you will see).

So, I have an application in which all high-poly objects have their vertices grouped in an object-specific AABB-tree to speed up the narrow-phase of collision detection. Now, it occurred to me the following. Since that structure is already in place, would it be possible to use it for culling parts of objects instead of the usual all-or-nothing approach of the frustum and occlusion culling techniques?

The idea for that is simple in concept. Instead of testing for visibility only using the whole objects' AABB, I would do that first but in the positive cases I would proceed to visibility checks of the sub-AABBs containing that object's vertices. Once identified the sub-AABBs that are visible, only the triangles that are contained in these sub-AABBs would be sent to the GPU for rendering.

Therefore, in a more systematized way, my three related questions are:

1) is such an approach even possible in what regards the way GPU gets and processes the mesh geometry information pulled from CPU?

2) given that in such scenario the CPU would have to break the meshes somehow and pass to the GPU only the vertices that were identified as being in the visible parts of the visible objects, wouldn't that pose additional load on the processing time such that the cost would overcome the gains?

3) most importantly, passing to the GPU only some triangles of a mesh could cause graphically distorted results when shader and texture are rendered for that partially-only rendered object?

I searched quite a bit for academic references on this subject but came almost empty. I would gladly welcome reading suggestions of any sort.

sentences: Export selected region of Unity tilemap to c# array? I have a small region of the map selected with the "Select an area of the grid" tool from the tile palette.  I'd like to be able to copy-and-paste this area for usage elsewhere in a programmatic way.  Since the location this region will be placed is determined via scripts, it's not sufficient to just directly copy and place these tiles down elsewhere - I think they need to take the form of a c# array so I can read through that and then use it elsewhere when the time comes.  How can I achieve this?

sentences:
Questions regarding using (CC BY-NC-ND 3.0) and (CC BY-NC 4.0) music for a completely free game (not Freemium) I am in the process of developing a small video game for a game-jam on itch.io.
The game-jam requires the developer to first make a github repository, upload all the source code and material (including music, sound effects and artwork) there and provide a link to your game-jam entry on itch.io.
I want to use some music that I found on freemusicarchive.org.
Some of the tracks on the website have (CC BY) licence while majority of them are either CC BY-NC-ND 3.0 or 4.0 (meaning to say that majority of the music tracks are NOT allowed for commercial purposes).
So my question is this:
I do not intend to make any money from my entry and I will make my entry completely free to access it. There will be no freemium or pay-to-unlock-features kind of thing with my game. It will be 100% free. You can go to the URL of my game, which will be hosted on itch.io (zipped HTML) and then anyone can play it.
Can I use music that have non-commercial licences in them (e.g CC BY-NC-ND etc.) for my completely free to play game?
Thanks!

sentences:
Using SQL for a Realtime Multiplayer Game Server's Working Data (Fast Enough?) The game I'm working on currently has a Client in Flash AS3, and a Server in C# (multithreaded).

Currently I use mySQL to handle logins (Raw access: no middleman for accessing the database) which seems to be extremely quick.

My question is would using a mySQL database be quick enough for a fairly simple real time game?

My game functions in a similar way to Diablo2, League of Legends, or even Starcraft:

User logs in
User is taken to lobby
From lobby user may view active games
User's group into 2-8 for games which exist on the server in it's own thread

Now, the game has been designed in such a way to minimize server calculations, while still providing zero trust to clients.  Is it possible to use SQL in a way to store and manipulate all game data, for each game? ie:

Users 1 through 8 all create 50 units
Each user commands all of their units to move to a location on the map
Units attack each other
etc.

Is SQL fast enough to handle this kind of data traffic?  Or would it be better to store it all in memory?  Or is there some alternative (such as paging) I haven't considered?

sentences:
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:
Examples of wall avoidance algorithm dealing with rectangles instead of lines? I have a tile based engine and in the middle of translating out the example wall avoidance alogrithm in the book AI programming by example.  I was wondering if the method below can be modified so that it takes a rectangle instead of vector C and D and still produce the same output ?

/-------------------- LineIntersection2D-------------------------
//
//  Given 2 lines in 2D space AB, CD this returns true if an
//  intersection occurs and sets dist to the distance the intersection
//  occurs along AB. Also sets the 2d vector point to the point of
//  intersection
//-----------------------------------------------------------------
inline bool LineIntersection2D(Vector2D   A,
                               Vector2D   B,
                               Vector2D   C,
                               Vector2D   D,
                               double&     dist,
                               Vector2D&  point)
{

  double rTop = (A.y-C.y)*(D.x-C.x)-(A.x-C.x)*(D.y-C.y);
    double rBot = (B.x-A.x)*(D.y-C.y)-(B.y-A.y)*(D.x-C.x);

    double sTop = (A.y-C.y)*(B.x-A.x)-(A.x-C.x)*(B.y-A.y);
    double sBot = (B.x-A.x)*(D.y-C.y)-(B.y-A.y)*(D.x-C.x);

    if ( (rBot == 0) || (sBot == 0))
    {
        //lines are parallel
        return false;
    }

    double r = rTop/rBot;
    double s = sTop/sBot;

    if( (r > 0) && (r < 1) && (s > 0) && (s < 1) )
  {
    dist = Vec2DDistance(A,B) * r;

    point = A + r * (B - A);

    return true;
  }

    else
  {
        dist = 0;

    return false;
  }
}

sentences:
how to rotate enemy to face player? Okay so i havebeen rotating my enemy to face the player using

float targetrotation = Math.Atan2(playerpos-enemypos);
enemy.rotation = targetrotation; (<this line of code i want to change)

This simple method has worked fine so far for getting the enemy to look at the player's position. However i decided to add some extra code to get the enemy to gradually rotate towards the player using this method:

if(enemy.rotation < targetrotation)
{
   enemy.rotation++;
}

if(enemy.rotation > targetrotation)
{
   enemy.rotation--;
}

Now the problem i am having is that when the player moves for example from 360 degree target to 1 degree then the enemy rotates the long way round to move to the 1 degree instead of simply adding 1 degree. Any help on how to correct this problem would be welcomed. I have a picture below:

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:
OBJ Model not being rendered properly in OpenGL ES 2 android app I have an Android OpenGL ES 2 app that loads an .OBJ model using Assimp and renders the same.

The vertices data is stored in a object declared like this :

class CGameObject
{
public:
struct _Mesh {
    std::string Name;               // Name of Mesh

    std::vector<float> vertices;    // vertices of Mesh

    GLuint m_vbo;
    // TODO: Add TEXTURE and MATERIAL support
};
...
}

Set various Matrices :

cameraX = 3.0f; cameraY = 3.0f; cameraZ = 5.0f;

// Camera/View matrix
View = glm::lookAt(
    glm::vec3(cameraX, cameraY, cameraZ),     // Camera position
    glm::vec3(0, 0, 0),     // Pointing at
    glm::vec3(0, 1, 0)      // Angle
 );

aspect = (float) width / height;

// Projection Matrix
Projection = glm::perspective(45.0f, aspect, 0.1f, 10000.0f);

glm::mat4 Model = glm::translate(mat4(1.0), glm::vec3(0.0f, 0.0f, 0.0f));
MVP = Projection * View * Model;

Rendering function :

void GLEngine::DrawFrame() {
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

glUseProgram(programObject);
// Draw of VBO ---BEGIN
for (GameObjects::iterator i = gObjects.begin(); i != gObjects.end(); ++i)
{
    CGameObject* pObj = *i;
    /////////////////
    for (int x = 0; x < pObj->Meshes.size(); x++)
    {
        glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
        // bind VBO you want to draw
        glBindBuffer(GL_ARRAY_BUFFER, pObj->Meshes[x]->m_vbo);

        glEnableVertexAttribArray(gvPositionHandle);
        glVertexAttribPointer(gvPositionHandle, 3, GL_FLOAT, GL_FALSE, 0, 0);

        if (x == 0){
            glVertexAttrib3f(gvColorHandle, 0.0f, 0.0f, 1.0f);
            UcheckGLError("glVertexAttrib3f");

            }
        else {
            glVertexAttrib3f(gvColorHandle, 0.0f, 1.0f, 0.0f);
            UcheckGLError("glVertexAttrib3f");

            }

        //glEnableVertexAttribArray(gvColorHandle); // My app crashes if I uncomment this line . .. any reasons why ?
        //UcheckGLError("glEnableVertexAttribArray");

        glDrawArrays(GL_TRIANGLES, 0, pObj->Meshes[x]->vertices.size());
        // unbind VBO
        glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
    /////////////////
}
// Draw of VBO ---END
// unbind program
glUseProgram(0);
}

source for shaders -

vertex shader :

attribute vec3 in_Position;

uniform mat4 MVP;

attribute vec3 in_Color;
varying vec4 fColor;

void main(void) {
    vec4 v = vec4(in_Position, 1.0);
    gl_Position = MVP * v;
    fColor = vec4(in_Color, 1.0);

}

Fragment shader :

varying vec4 fColor;

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

But the results is not what I expect.
Expected :

What I get :

Loading of the Assimp model is provided in this question : https://gamedev.stackexchange.com/questions/85808/problem-rendering-simple-obj-model-using-assimp-in-android-app

sentences: How do I create a circular progress bar in Unity3D 5? I am new to programming and Unity3D. I want to show a circular progress bar starting invisible and growing in 3 seconds to a circular line when reloading is done. How can I do that?

sentences:
Change Text - Inside A button, inside a Canvas, inside a GameObject: Access all the texts inside of hierchy? //....
Gameobject tile;
int count = 1f;
float posX = 0;
float posY = 0;
....//

GameObject blueTile = (GameObject)Instantiate(Resources.Load("block_blue"));
tile = (GameObject)Instantiate(blueTile, transform);

for loop {
   ...
   ...
   tile.GetComponent().GetComponentInChildren().text = count.ToString();
   tile.transform.position = new Vector2((float)posX, (float)posY);
   count++;
}

As you can see by the image.
My line of thinking goes like this; I used to create Flash/AS3 Applications and Games. I have used a number of API's and they usually have a lot in common. Unity, however, is very different and I may have not grasped the key concepts.

I want to access my PreFab, named in Assets/Resources (the root path)

"block_blue"

All I wan to do is set up a row and columns of a box with a number inside of it.

Before you go and ask, why the complicated mix of Objects? Well, Adobe had MovieClip and use of layers and also use of a timeline. Unity doesn't seem to have this in setting up a Scene (the Stage in Flash).

So, I set up a block that looks like this (right of main image 66):
It's a Canvas, to hold a Button, the button has a text. To move the Canvas, I put the Canvas inside a GameObject. This, to me, is like a MovieClip in Flash API.

**GameObject > ButtonLight, Button > TextBlack, Text**

I need to access TextBlack and also Text. Pretty easy right? I've been at this for 4 days, many many hours.

EDIT: It seems that it is working, somewhat.

Looking at the reference photo and the Hierarchy reference, it looks like the blackText behind the blueText is changing as expected. But I cannot access the top BlueText. The Blue Text is also a child of type Text, but it's a second (layer?) copy of the text inside of the Button. So, it's getting the first Child Text, but how to access the second Text?

sentences:
Character rotation according to camera causes rapid flipping when game starts When I load my scene, my character rotates +90 and -90 on the X axis very fast about 4 or 5 times, and then he stops at -90 on X axis (lays back down).

When I move the character, the rotations are just the way I want them, but I need to fix that weird bug at the beginning of the game.

Here's my character's movement logic. It's based on the rotation of the camera, which is a child of my character object.

void Update() {
    Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    transform.position += (camF * vec.y + camR * vec.x) * Time.deltaTime * MoveSpeed;

    Vector3 deltaPosition = transform.position - prevPosition;

    if (deltaPosition != Vector3.zero)
    {
        transform.forward = deltaPosition;
    }

    prevPosition = transform.position;
}

sentences:
Unity: Interactive menu with sprites changing with buttons I have a menu where the player gets to choose which team and kit he will use to play. However I don't really know how to change the sprite each time the left or right arrows are pressed. I already have the sprites for each team, league and kit the only thing I am missing is the way to arrange it via script.
Thanks.

sentences:
Gravity not being applied to character, using character controller So I just copy and pasted the unity example class to use with my character controller.

public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
private Vector3 moveDirection = Vector3.zero;
void Update() {
    CharacterController controller = GetComponent<CharacterController>();
    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);
}

The code seems to work okay if I comment out the isGrounded check statement (which means that gravity isn't being applied). So what could be the reason that the gravity is not being applied to my character controller?

sentences:
C++ unmanaged inside winform First: I am using C# and C++ on windows 7.

I have created a basic rendering engine in c++ with directx 10. It works good as a stand alone application. But, when I sending the Form.Handle of a WinForm I want to render inside to the engine it crashes during D3D10CreateDeviceAndSwapChain with the following error:

HRESULT: 0x887a0001 (2289696769)
Name: DXGI_ERROR_INVALID_CALL

I get the handle from the winform during loading of the form.

unsafe {
  void *ptr=m_view.Handle.ToPointer();
  uint v = (uint)ptr;
  lhandle = v.ToString();
};

sentences:
Rotation around arbitrary vector (using quaternions?) I currently have a camera which orbits a specific target object, always looking at it.
The user can drag the mouse to move the camera left/right/up/down and the camera will move over the surface of a sphere of fixed radius (note, I clamp the vertical angle to ± 89°).
Currently it looks something like this...
// Store position of camera for future reference
private Vector2 rotation = new Vector2(120, 25);

// Was intended to be the vector from planet to target. Only works with `up`
private rotationalPole = Vector3.up;

if (isDragging) {
    rotation += new Vector2(
        Input.GetAxis("Mouse X") * xSpeed * radius * 0.02f,
        -Input.GetAxis("Mouse Y") * ySpeed * 0.02f);

}

//target is the GameObject to center on...

var pos = target.transform.position;

camObj.transform.position = pos + (Vector3.back * actualRadius);
camObj.transform.LookAt(pos, rotationalPole);
camObj.transform.RotateAround(pos, Vector3.right, rotation.y);
camObj.transform.RotateAround(pos, rotationalPole, rotation.x);

This works fine when up is in the y direction.
Now, however, instead of an object on the ground, the target is something in orbit around a planet (currently on an equatorial orbit but hopefully on an arbitrary one in future).
I want the camera to behave the same as before, but with up being the vector from the center of the planet through the target. Nominally forward will be the direction of orbit (but since the user can spin through 360 "horizontally", that's less important).
Currently it looks like this...

Basically, I'd like to rotate the image above counter-clockwise by 90° (which I believe I can do by playing with the camera transform's up and right vectors) but also that my arbitrary rotation honors the new orientation.
Some research shows that I need to use quaternions but while my mental model for basic trig is fine, I can't picture how to use quaternions correctly in this situation.
Following on from @Jon's answer below...
I've now got the following.
var planetToTarget = (target.transform.position - planet.transform.position).normalized;
// "Reset" the camera before I do any transforms
this.transform.position = target.transform.position - tgtMovement * actualRadius;
this.transform.up = Vector3.up;
this.transform.LookAt(target.transform.position);

var camToTarget = (transform.position - target.transform.position).normalized;
Debug.Log(string.Format("targetMotion = {0}, planetToTarget: {1}, camToTarget: {2}", tgtMovement, planetToTarget, camToTarget));

// Line that's not working...
this.transform.Rotate(camToTarget, -90);

// To be added in when the above is working...
//this.transform.Rotate(Vector3.Cross(camToTarget, planetToTarget), rotation.y);
//this.transform.Rotate(planetToTarget, rotation.x);
//this.transform.up = planetToTarget;

The uncommented code (excluding the last line) keeps the camera behind the target, looking forward...
Initially, I get :

targetMotion = (0.0, 0.0, -1.0), planetToTarget: (-1.0, 0.0, 0.0), camToTarget: (0.0, 0.0, 1.0)

Which generates:

However, as the target moves around the planet, it changes to:

targetMotion = (0.4, 0.0, -0.9), planetToTarget: (-0.9, 0.0, -0.4), camToTarget: (-0.4, 0.0, 0.9)

By which point, the camera is slewing to the side...

So I'm clearly still missing something. I don't appear to be rotating around camToTarget correctly?

sentences:
List to hold copies of a prefab for later deletion I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player.

When they are instantiated, I want to add them to a list so that when there are too many obstacles loaded in the game, it will remove them from the list and then delete them from the game.

I'm having trouble adding them to the list, because using obstacleList.Add(Obstacles.name); doesn't work.

Here's my code:

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

public class Generate : MonoBehaviour{

    //player position
    public Transform Player;

    // The prefab for an obstacle
    public GameObject Obstacle;

    // Holds float distance from 0 for each obstacle that is instantiated
    private float nextObstacle = 30;

    // is supposed to hold the names of all active instances of the obstacle prefab
    List<string> obstacleList = new List<string>(10);

    void FixedUpdate()
    {
        //Checks to see if the player is colser than 30 units to the most recently spawned obstacle
        if (nextObstacle - Player.position.x < 30)
        {
            //Generates a new obstacle
            GenerateObstacle();
        }
    }

    void GenerateObstacle()
    {
        // Randomly assignes a number for horizontal and vertical Transform
        int randH = Random.Range(5, 20);
        int randV = Random.Range(1, 3);

        //Instantiates an obstacle using those random values
        Instantiate(Obstacle, new Vector3(nextObstacle + randH, randV, 0), Quaternion.identity);

        //Makes that obstacle the new distance so a new obstacle can be spawned
        nextObstacle += randH;

        // Is supposed to add the name of the obstacle that was Instantiated to a list
        obstacleList.Add(Obstacle.name);

        //checks when list has more than 10 items in it
        if (obstacleList.Count > 10)
        {
            DeleteObstacles();
            // Removes the first item from the list
            obstacleList.RemoveAt(0);
        }
    }
    void DeleteObstacles()
    {
        // Supposed to destroy the copied prefab
        Destroy(Obstacle);
    }
}

sentences:
Change material emission for a second then go back to default I'm looking for a way to change the emission of a material for a second then get it back to where is was by default

Here's what I have for now

float emission_lvl = 5.0F;
float emission_lvl_start = 0.5F;

public Update(){
    mat.SetFloat("_Emission",emission_lvl);
    Invoke ("SetEmissionBack", 1.0f);
}

public void SetEmissionBack(){
    mat.SetFloat("_Emission",emission_lvl_start);
}

sentences:
How to simulate acceleration and then deceleration? Currently I am only using deceleration.

Here is how I do it

I need to cover Vector(x,y) unit distance to reach B from A.

I simply do -

rendering loop->

position = A + Vector(x,y).scale(factor);
Vector(x,y) = Vector(x,y) - Vector(x,y).scale(factor);

...factor = 10 for example
So if I have to cover 100 units, I cover 10 then 9 then 8.1 and so on in every frame.

How do I simulate acceleration then deceleration here?

sentences:
Can't move character at all in unity basic platformer guide so, I followed below tutorial.

https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/creating-a-basic-platformer-game

Going well until 18:50 (video time in tutorial), when the tutor compiles and able to move and jump the character. And then, when I try it, mine was not moving or jumping at all.

So, how to move the character?

I've also tried some solutions on the video's youtube comments, but nothing works.

P.S. I'm not new to C# at all, but new to Unity development. I'm using Unity 5.

Thanks.

Update :
Here are the props screenshots and Controller c# code :

Cube

Hero

SimplePlatformController

using UnityEngine;
using System.Collections;

public class SimplePlatformController : MonoBehaviour {

[HideInInspector] public bool facingRight = true;
[HideInInspector] public bool jump = false;

public float moveForce = 365f;
public float maxSpeed = 5f;
public float jumpForce = 1000f;
public Transform groundCheck;

private bool grounded = false;
private Animator anim;
private Rigidbody2D rb2d;

// Use this for initialization
void Awake ()
{
    anim = GetComponent<Animator> ();
    rb2d = GetComponent<Rigidbody2D> ();
}

// Update is called once per frame
void Update ()
{
    grounded = Physics2D.Linecast(
        transform.position,
        groundCheck.position,
        1 << LayerMask.NameToLayer("Ground"));

    if (Input.GetButtonDown ("Jump") && grounded)
    {
        jump = true;
    }

}

void fixedUpdate()
{
    float h = Input.GetAxis ("Horizontal");

    anim.SetFloat ("Speed", Mathf.Abs (h));

    if (h * rb2d.velocity.x < maxSpeed)
        rb2d.AddForce (Vector2.right * h * moveForce);

    if (Mathf.Abs (rb2d.velocity.x) > maxSpeed)
        rb2d.velocity = new Vector2 (
            Mathf.Sign (rb2d.velocity.x) * maxSpeed,
            rb2d.velocity.y);

    if ((h > 0 && facingRight) || (h < 0 && !facingRight))
        Flip ();

    if (jump)
    {
        anim.SetTrigger ("Jump");
        rb2d.AddForce (new Vector2 (0f, jumpForce));
        jump = false;
    }
}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

}

sentences:
In XNA, what symbols are available for conditionally-compiling platform-specific code? In XNA, what defines are set to allow me to determine if my code is running on a PC with Windows, Xbox, or Windows Phone?

Right now I am assuming it is these three:

WINDOWS_PHONE
WINDOWS
XBOX360

Are these correct? Are there any additional symbols?

sentences:
Bejewelled Next Best jewel selection Is there a game design technique I can use so that I completely remove 'No more moves left' situations. ie. the game should contain no impossible scenarios.

As far as I've guess It all depends on what jewel and where you give the user after a jewel group of 3 or 4 dissolves.

Is it possible ? An always infinitely solvable Bejewelled game?

sentences:
How to show a float with no decimals I want to show the current health and stamina of the player using GUI.Label. All is working fine however it shows the values with decimals to the millionth (example: http://gfycat.com/SkeletalSinfulKouprey). How would I go about showing only the whole number?

My code:

 var cur_stamina : float;
    var cur_health : float;

    var staminaRegenRate : float = 5;
    var healthRegenRate : float = 1;

    //regen
    if(cur_stamina < max_stamina){
        cur_stamina += staminaRegenRate * Time.deltaTime;
    }
    if(cur_health < max_health){
        cur_health += healthRegenRate * Time.deltaTime;
    }

    function OnGUI(){
        GUI.Label(Rect(1,1,100,20), "Health: " +cur_health);
        GUI.Label(Rect(1,15,1000,20), "Stamina: " +cur_stamina);
        GUI.Label(Rect(1,30,100,20), "Ammo: " +cur_ammo);
    }

sentences:
Project transfer, will re-importing all my models damage my project at all? Recently I had to transfer my Unity game project to another computer and downloaded the same version of Unity I was using for my 3D project and checked that all the files and folders were in the same place and everything.

When I start up the game though my models have vanished and in the hierarchy it just says missing prefab instead of telling me what it was, like it used to if I'd move a model to another folder or something like that.

It shows all my files there and I was about to reimport them all but I got a warning that said:

"Rebuilding assets is only if your project has been corrupted due to an internal Unity bug. It can take several hours to complete, depending on the size of your project.

Please submit a bug report detailing the steps leading up to here."

I am sure that re-importing all my models will fix this but I want to ask if this will have any negative effects on my project or possibly damage anything?

This game is extremely important to me and I've been working on it for the past 3 years(being self taught which is why it's taken so long and I'm still learning)

Thank you guys in advanced! :D

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:
How far back should I move my camera to fit a given GameObject in frame? In Unity with C#, I want to calculate the minimum distance that my perspective camera has to be from a given GameObject (a procedurally generated mesh), so that the object is fully framed by the camera and leaving the least space possible around it in the screen. In other words, fully framed means that there is no part of the object outside the view area.

To make things easier, my camera does not need to rotate or move - it's fully static, with the exception of one axis to zoom in or out in order to frame the target object. So, in fact, we could summarize my problem as a zoom problem (not using FOV to zoom) where I need to frame a procedurally generated mesh whose size varies considerably.

Would anyone be kind enough to point me in the right direction with code snippets, suggestions, etc?

sentences:
Movement & Physics in an entity-component system I'm currently playing around with entity-components systems and got started on the movement/collision/physics parts and would like to have some pointers!

It's a basic 2D sidescrolling game, with the goal being something in the style of Terraria. My first goal was to have a character that could run left/right & jump on blocks/tiles and when clicking tiles they'd disappear.

At the moment, each tile/block on the screen is an entity with a Transform(Position) component, a "Renderable component and a Collision component (boundaries)

My player has a Player component(tagging class), a Transform, Renderable, and Physics (velocity, acceleration, mass) and Collision component.

Currently a bit stuck on how to fit in the physics and movement. I read the threads I could find about it here on Stack but left with some questions:

What would be a good approach to let my character move? Should I have a player system that updates the Player's position or velocity? Or should I let it set a state & let another system update the movements of entities based on their velocities and their current state? Leaving the option open that I could move a character by clicking somewhere?
If I were to add gravity, should these affect your acceleration/velocity? I have problems with figuring out how to implement acceleration & which systems could/should be responsible for that..

And unrelated to the questions above, when I was starting on the collision I ran into the issue that it would try to check every single tile against the player & since on a large resolution already 1000ish entities fill the screen it quickly sent performance down the drain. I implemented a quad tree to select the entities only around the player, which seems to work. (Based on http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/ but made it from scratch in Python).

But since it takes the current window size as dimensions once the player would move off screen,  the entities wouldn't add correctly anymore. Should I let the Quad Tree grow/shrink in certain directions? (If anyone has experience with using this?)

Thanks in advance!

sentences:
Applying MVC in Game Development Suppose one is working on a game which has more than one component of code where the data, view, and logic is disjoint from the workings of another component of code (i.e. all games have a main menu and the game itself, with their looks, logic, and data being independent). How best should one lay an application out?

I see at least two options:

Top-level code creates model, view, and controller objects which then each have fields of each area of the application. For example, the model object may have a menuData field and a gameData field. Each of the view and controller would also have something similar. Additionally, the main controller would have access to the main view and main model.
Top-level code creates an object for each area of the code (i.e. menu and game), and then each of these has their own model, view, and controller.

Are either of these the best way to go about this? Is there a more common approach than MVC?

sentences:
How can I prevent movement from analog joystick "bounce"? I'm working on a top-down game where the player can move up/down/left/right. The sprite changes to the corresponding direction, and I have an internal value that tracks the direction the player is facing.

The actual movement is handled just by doing rigidbody2D.MovePosition(player.position + movement * speed * Time.deltaTime); and it's working fine. Direction is determined by looking at the absolute values of all 4 axis values and seeing which one is greatest.

The problem I'm having is when using an analog joystick on a controller. So, if you suddenly let go of the stick, it has a little "bounce" where it goes past the center, and into the opposite direction.

I uploaded a slow-motion video of the joystick being released, to show this "bounce."

See GIF here

I added some logging to the input, and here are some numbers:

The joystick bounce always ends up being somewhere between < 0.1 to up to 0.5, for maybe 1 frame in time.

What can I do to mitigate the effects of this bounce? It's causing my player to suddenly look in the opposite direction if they suddenly stop moving.

I've had these ideas for solutions, but I'd love some advice:

Increase deadzone to be over 0.5 - This seems like an easy fix, but that feels like it's too big of a deadzone.
Ignore input if the difference between last frame and current frame is greater than a specific value (maybe 0.5?)
Average out input over the last few frames and then move? Seems like it could be buggy though (and feel laggy)

sentences:
Steam hammer.exe Load custom textures for other players? I sometimes make maps with custom textures, models, materials, sounds, etc. and I showed one of my map creations to my friend, and the custom textures were pink-and-black. It was intended to be a 'display-case' map with custom sprays & sounds upon clicking a button, but he just saw black and pink textures. Is there a way to make it built-in to the map and have it auto-download? I had the textures in its own folder, like "cars/materials/texture1.vtf"; it wasn't in the actual materials folder of my steam, it was just in its own folder. If I place the textures in the Steam materials/models/etc folder, will it automatically download it for other users?

ON SINGLEPLAYER/LAN, BUT KNOWLEDGE FOR MULTIPLAYER WILL BE NICE FOR FUTURE REFERENCE

sentences:
Tile Collision - subtracting a minor value to the box size I'm having a certain problem when doing collision checks on bounding boxes that have their edges aligned with upper or right tiles. It shouldn't count as an intersection but I don't know a good solution for this.

Let's say the player is centered with some tile with that has no collision and the 8 surrounding tiles do have collision. The problem that happens here is that my collision check function will still report a collision because the upper and right edges of the square are in touch with the other tiles. The lower and left are too, but they won't collide:

I check the collision using the center and size, x and y, for the box.

bool isColliding( float centerX, float centerY, float sizeX, float sizeY );

So in this image, the player would be centered at ( 1.5, 1.5 ), relatively to tiles, and his size would be 1 tile x and y. That makes him centered in tile ( 1, 1 ). And when we do the math his left and lower limits are 1, so his limits are within tile ( 1, 1 ), but his upper and right limits are 2 so it reports an intersection with those tiles (the darker ones in the picture).

This happens because I calculate half sizes:

float halfSizeX = sizeX / 2.0f;

And the left limit would be

int leftLimit = centerX - halfSizeX;

In this case the player is not supposed to be intersecting any tile, so my quick fix was to subtract a very small value to the half size like this:

float halfSizeX = sizeX / 2.0f - 0.001f;

So the right limit will be 1.999f or so, and won't actually be 2. And this will work as this is only done in the collision checking, not in correcting the position, and all amounts of movement are bigger than 0.001 tiles which would be the biggest concern.

But I don't really like this solution, it looks kind of dirty.. My questions is, is there any good alternative to subtracting this value out of the blue?

EDIT:

As asked below in the comments I'm posting the code:

bool Map::isColliding( float centerX, float centerY, float sizeX, float sizeY )
{
    float halfSizeX = sizeX / 2.0f - 0.001f;
    float halfSizeY = sizeY / 2.0f - 0.001f;

    int fromX = (int)max( centerX - halfSizeX , 0.0f );
    int toX = (int)min( centerX + halfSizeX, (float)getNumTilesX() );

    int fromY = (int)max( centerY - halfSizeY , 0.0f );
    int toY = (int)min( centerY + halfSizeY, (float)getNumTilesY() );

    for ( int x = fromX; x <= toX; ++x ) {
        for ( int y = fromY; y <= toY; ++y ) {
            if ( getTile( x, y )->hasCollision() ) {
                return true;
            }
        }
    }

    return false;
}

sentences:
XNA Tile Location from Screen Location Possible Duplicate:
  XNA Tile from Screen Location

I have a tile based game that is in a semi-isometric view created by a transformation. The tiles are created by a Texture2d rendered on a 3d surface.

My map Image: http://balancedcms.com/Capture.PNG

I am using the following code for my transformation:

View = Matrix.CreateLookAt(new Vector3(0, -1.1f, 1.6f), new Vector3(0, 0, 0), new Vector3(0, 53, 0));
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi - 2.4f, 4.0f / 3.0f, 1, 500);

quadEffect = new BasicEffect(device);

quadEffect.World = Matrix.Identity;
quadEffect.View = View;
quadEffect.Projection = Projection;
quadEffect.TextureEnabled = true;

quad = new Quad(new Vector3(0, 0, 0), Vector3.Backward, Vector3.Up, 3, 3);

My problem comes along when I attempt to get the current tile that I am hovering the mouse over. I have a mouse X and Y however I can't seem to figure out how to transform these screen coordinates into a tile X and Y. The tiles are 128px by 128px; however, after the camera transformation they are smaller on the top and larger on the bottom(to create the isometric view)

I've tried transforming the mouse X and Y with the same projection matrix. However, this didn't work. I think it is due to the view matrix not being taken into account... sample below:

Vector3.Transform(new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0), Projection);

This image may provide more information... is also shows the hours I've put into figuring this out: http://balancedcms.com/1111.png

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:
Unity 5.3 C#: How to disable multiple game objects with one collision? I'm making a top down perspective game with a gunner automatically moves on a pre-set path, and you shoot and destroy targets to remove barriers. The idea is that you control the bullet's direction after firing and it can pass through laser gates, but the gunner cannot. There are several targets and barriers.

What I want: If the bullet hits the local target, the local target and local barrier are destroyed.

I tried making each target and barrier as children of empty game objects, and I attempted to destroy the empty parent to solve this problem. Please advise.

(Showing only relevant code)

using UnityEngine;
using System.Collections;

public class MagicBulletScript : MonoBehaviour {

    public Transform magicBulletTransform;

    void Start () {
        magicBulletTransform = transform;
    }

    void OnTriggerEnter (Collider other){
        var progressParent = this.transform.parent.gameObject;

        if (other.gameObject.CompareTag("Obstacle")){
            Destroy (this.gameObject);
        }

        if (other.gameObject.CompareTag("Target")){
            Destroy (progressParent.gameObject);
            Destroy (other.gameObject);
        }
    }
}

sentences: When to use AI prediction in a Fighting Game I am making a fighting game AI that can predict the player's next move using a N gram predictor. Once I have the prediction, when do I use it ? Do I wait till player makes a move and then use the prediction ? What about distance from the player ? How do I make the use of my prediction look realistic ?

sentences:
How can I determine the extreme color values in a texture? I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) and (1,1,1) expressed in RGB format. For a color gradient from red to green I should get the values (1,0,0) and (0,1,0).

Now obviously I could do this on the CPU by iterating over all the pixels/texels of the texture and keeping track of the color values found to be most apart from each other, but this is probably relatively slow, so I am looking for a way to do this using the GPU/shaders.

Is this possible using shaders? I am not experienced with GPGPU, so a solution in HLSL/GLSL would be preferred. Or maybe there is a fast algorithm I could use on the CPU?

sentences:
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:
What is the correct multiplication order for a 2D matrix? I'm currently trying to create a camera and entity/model matrix for my 2D game similar to that of Unity3D.
I've already tried to find answers to this question on stackoverflow/gamedev but i couldn't find an answer that explains how to center the camera and image.

Goal:

Have a camera matrix wich is centered at the position of the camera.
Have a entity matrix wich draws everything centered

Current implementation:

camera: matrix = Matrix.translation(Screen.width * 0.5, Screen.height * 0.5) *
                 Matrix.rotation(camera.rotation_radians) *
                 Matrix.scale(camera.scale.x, camera.scale.y) *
                 Matrix.translation(camera.x, camera.y);

entity: matrix = Matrix.rotation(entity.rotation_radians) *
                 Matrix.scale(entity.scale.x, entity.scale.y) *
                 Matrix.translation(entity.x, entity.y);

image component draw function:
                 setMatrix(camera.matrix * entity.matrix);
                 drawImage(x=0, y=0, image) // position is already included in the entity matrix

Results:

Image rotates around the upper-left corner of the screen not around it's center
Image is not centered. The image's origin is at its upper-left corner.
The camera matrix seems to be correct.

Questions:

What is the correct multiplication order for the entity/model matrix?
Can i use a single matrix for all components of a entity or do i need to calculate in the width/height of the image/text/animation component.

sentences:
Frustum culling based on MVP matrix? Tutorials on the internet usually say to extract plane data from MVP (model view projection) matrix (or VP?) and then test the bouding volume against each of the frustum planes. I've thought of a different approach:

calculate model's bounding sphere (center + radius)
define point A = center, B = center + float3(radius, 0, 0) - some point on the sphere
multiply A and B by MVP matrix to get point coords in clip(?) space
calculate radius in clip space (distance from A to B)
check if sphere is in the frustum, sth like: A.x - radius < 1 && A.x + radius > -1

Would this work (it would be only an approximation but should be good enough)? In (5) what values should I test against? -1 and 1? Because I'm not sure if I'm not mixing up spaces.

sentences:
What good books are there on level design? I am trying to learn a bit of level design. The type of game I am most interested is 2D puzzle games similar to Cut The Rope for iPad. However, literature on general level-design for different genres would be very welcomed.

A internet quick search brings.

http://www.amazon.com/Art-Game-Design-book-lenses/dp/0123694965/ref=pd_sim_b_5

http://www.amazon.com/Game-Level-Design-Development/dp/1584503696

Anyone can recommend those or any other resources? books, recorded conferences, examples, tutorials, slides..

sentences:
What different ways are there to model restitution in a physics engine? In my physics engine I give a body a value for restitution between 0 and 1. When two bodies collide there seems to be different views on how the restitution of the collision should be calculated. To me the most intuitive seems to be to take the average of the two but some seem to take only the largest one.

Are there other ways to do it? Also, could the closing velocity or some other parameter come into effect?

sentences:
Changing Palette for Day/Light Mode using GIMP Suppose I've a picture, which want to achieve day/light mode by changing 8bpp color palette.

If I want the pixel index of my picture is always fixed for both day mode and night mode. For example, the 1st pixel index is 100. Which I can look up index 100 in day mode palette and night mode palette. How can I use GIMP to do so? My goal is to not update my pixel index of my picture.

Also, as you see in two palette, they are not one one mapping. That is index 1 of the day mode palette and index 1 of the night mode palette may not used in the same pixel of the picture, how can I tackle this problem?

Actually, my use case is as follow
I want to use one 8bpp picture to achieve day/night mode by update only the color palette (without updating the pixel index). The advantage is I only have to prepare 2 256 byte palette rather than saving 2 big pictures in my limited data ram.

Thanks a lot

sentences:
Mathf.Round returning wrong values I want to check if the Y position is changing or not for the player and the enemy. If it has changed in the frame I want it to return true and if it didn't I want it to return false. I round because the enemy's position alternates between 0.8 and 0.800001 .

I tried to do Mathf.Round(transform.position * 100)/100 and I compare is to the enemyOldPosition which I assigned using enemyOldPosition = Mathf.Round(transform.position * 100)/100, but it says it's not equal.

I tried to check Debug.Log(enemyOldPosition - Mathf.Round(transform.position * 100)/100) and it returned 1.192093E-08.

void Update()
{
     if(Mathf.Round(player.transform.position.y*100)/100 == oldPosition)
     {
         isChangingY = false;
         oldPosition = Mathf.Round(player.transform.position.y*100)/100;
     }
     else
     {
         Debug.Log(oldPosition - Mathf.Round(player.transform.position.y*100)/100);
         isChangingY = true;
         oldPosition = Mathf.Round(player.transform.position.y*100)/100;
     }

     if(Mathf.Round(transform.position.y*100)/100 == enemyOldPosition)
     {
         enemyIsChangingY = false;
         enemyOldPosition = Mathf.Round(transform.position.y*100)/100;
     }
     else
     {
         Debug.Log(enemyOldPosition - Mathf.Round(transform.position.y*100)/100);
         enemyIsChangingY = true;
         enemyOldPosition = Mathf.Round(transform.position.y*100)/100;
     }

 }

This script is placed my on enemy, and they both have rigidbodies

sentences:
Save File sharing over Mobile Networks I'm looking to have people share game content, save files, or characters on a mobile game platform.  That means they need to be able to upload and download from their phone, other iOS device, or computer.

What's the best way to do this?

Does Apple have a history of allowing games to download 'content' (incl. graphics) that hasn't been approved?

Are there any apps that do this, that I can try out?

Thanks,

[EDIT]

The files I want to share will be simple *.plist files, probably in binary format.

sentences:
Snap-to-Grid building palcement So I have created plane in which my buildings are going to be placed on and I was wondering how to add grids to it and make my building snap to it, just like in clash of clans.

Thanks!

sentences:
Using multiple pygame_gui managers I would like to structure my gui into different panels.
so to help keep my code managable i thought it might be a good idea to have a main panel. with its own manager and then a secondary panel with its own manager that gets drawn ontop of the main panel.
Ideally I would have a main screen with a couple of buttons on the left. In the centre of the main screen I can show different panels. (Think of a website with a navbar on the side)
This would make it easier to work on the individual panels and also allow me to place buttons on the panels relative to the panels they will appear on as opposed to having to place them relative to the main panel.
My problem now is that I can't seem to get the events from any of the secondary managers into pygame's event queue.
Is this at all possible?
Do I need to show my not-working code?

sentences:
Why do I get a blank material in Unreal Engine 4? When I'm adding a material to a box in UE4, the material loses its textures.
I want to add this material

To this

After I'm trying to drag & drop the material into the scene above (like in UDK) the material loses its textures and does not apply:

When opening the material in Material-builder, the same thing happens: the material loses its textures and I've got these two errors on "Stats":

[SM5] (Node TextureSampleParameter2D) Param2d> Requires Texutre2D
[SM5] (Node TextureSample) TextureSample> Missing input texture

I've searched and found a thread where they say I need to save the material again to get things right. When I click the save button, I have this error:

The current material has compilation errors, so it will not render correctly in feature level SM5.

NOTE: Using DepthFade node + Lerp and changing the blend to translucent didn't resolved my issue.
Any idea?

sentences:
Download Progress bar from Firebase Storage Im trying to make a progress bar based on downloaded images from Firebase storage, now firebase does provide a snipper which works per image
// Create local filesystem URL
string localUrl = "file:///local/images/island.jpg";

// Start downloading a file
Task task = reference.GetFileAsync(localFile,
    new StorageProgress<DownloadState>(state => {
        // called periodically during the download
        Debug.Log(String.Format(
            "Progress: {0} of {1} bytes transferred.",
            state.BytesTransferred,
            state.TotalByteCount
        ));
    }), CancellationToken.None);

task.ContinueWithOnMainThread(resultTask => {
    if (!resultTask.IsFaulted && !resultTask.IsCanceled) {
        Debug.Log("Download finished.");
    }
});

but i would like to make that appear on a UI text based on the percentage of the Bytes downloaded like starting from 0 to 100%.Now i have come to this function so far which does work in the sense of downloading from storage and i do get the percentage in the console but im not sure how to convert that to a percentage to show on UI.
        if (CheckConnectivity) //if the device is connected to the internet, initiate download.
        {
           // Debug.Log("Initiating download of: " + platform + _file);
            if (!File.Exists(localPath))
            {
            Task task = storageRef.GetFileAsync(localPath,
            new StorageProgress<DownloadState>(state => {
                    // called periodically during the download
                    Debug.Log(String.Format(
                "Progress: {0} of {1} bytes transferred.",
                state.BytesTransferred,
                state.TotalByteCount
            ));
            }), CancellationToken.None);

                await storageRef.Child(_child).Child(_file).GetFileAsync(localPath).ContinueWithOnMainThread(files =>
                {
                    if (!files.IsFaulted && !files.IsCanceled) //if download is successful.
                    {
                        Debug.Log("file saved as " + localPath);

                    }
                    else //otherwise report error.
                    {
                        Debug.Log(files.Exception.ToString());
                    }
                });
            }
            else
            {
                Debug.Log("files Exist");
            }

        }
        else //otherwise don't bother.
        {
            Debug.Log("Cannot Download file due to lack of connectivity!");
        }
    }

in which case my debug is this
Progress: 1731 of 52804 bytes transferred.

Which i would like to say 0 % and counting up to 100!
Thanks!

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:
HLSL's Tex2D for GLSL? I am trying to port a HLSL shader to GLSL. I'm just not quite sure how to convert this line:

  outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-4.0 * pxSz.x * blurSize,0)).a * 0.05;

It's mostly the Tex2D I'm having trouble with. In GLSL, it seems to work differently.

I'm porting a horizontal blur

 texture al_tex;
   sampler2D s = sampler_state {
      texture = <al_tex>;
   };

   int tWidth;
   int tHeight;
   float blurSize = 5.0;
   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
      float2 pxSz = float2(1.0 / tWidth,1.0 / tHeight);
      float4 outC = 0;
      float outA = 0;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-4.0 * pxSz.x * blurSize,0)).a * 0.05;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-3.0 * pxSz.x * blurSize,0)).a * 0.09;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-2.0 * pxSz.x * blurSize,0)).a * 0.12;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-pxSz.x * blurSize,0)).a * 0.15;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,0)).a * 0.16;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(pxSz.x * blurSize,0)).a * 0.15;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(2.0 * pxSz.x * blurSize,0)).a * 0.12;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(3.0 * pxSz.x * blurSize,0)).a * 0.09;
      outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(4.0 * pxSz.x * blurSize,0)).a * 0.05;

     outC.a = outA;

      return outC;
   }

Thanks

sentences:
How to create two objects from one vertices array with translate? I have an object and I can render it but I want to use its vertices twice but I don't know how to.

this is my code reading object from txt:

fin.open("piyon.txt");
fin >> vertexCountpiyon;
verticespiyon = new SimpleVertex[vertexCountpiyon];

for(int i=0; i<vertexCountpiyon; i++)
{
    fin >> verticespiyon[i].Pos.x >> verticespiyon[i].Pos.y >> verticespiyon[i].Pos.z;
    fin >> verticespiyon[i].Tex.x >> verticespiyon[i].Tex.y;
    fin >> verticespiyon[i].Normal.x >> verticespiyon[i].Normal.y >> verticespiyon[i].Normal.z;
}
fin.close();

bd.ByteWidth = sizeof( SimpleVertex ) * vertexCountpiyon;
ZeroMemory( &InitData, sizeof(InitData) );
InitData.pSysMem = verticespiyon;
hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &g_pVertexBuffer_piyon );
if( FAILED( hr ) )     return hr;

and my render code:

  g_pImmediateContext->IASetVertexBuffers( 0, 1, &g_pVertexBuffer_piyon, &stride, &offset );
    cBuffer.vMeshColor = XMFLOAT4( 1.0f, 1.0f, 1.0f, 1.0f );
    XMMATRIX mTranslateBeyazPiyon = XMMatrixTranslation( -17.5F, 0, -12.5F );
    cBuffer.mWorld = XMMatrixTranspose( mTranslateBeyazPiyon );
    g_World_Piyon = mTranslateBeyazPiyon;
    g_pImmediateContext->UpdateSubresource( g_pConstantBuffer, 0, NULL, &cBuffer, 0, 0 );
    g_pImmediateContext->VSSetShader( g_pVertexShader, NULL, 0 );
    g_pImmediateContext->VSSetConstantBuffers( 2, 1, &g_pConstantBuffer );
    g_pImmediateContext->PSSetShader( g_pPixelShader, NULL, 0 );
    g_pImmediateContext->PSSetConstantBuffers( 2, 1, &g_pConstantBuffer );
    g_pImmediateContext->Draw( 7050, 0 );

sentences:
Question about "Entity System" design I am developing a top down 'thing' in SFML and C++ and was wondering about how best to handle so called Entities in my game.

An entity, for example is defined by me as an object in-game, such as a door to a house, that can be interacted with, can be animated, can act on user input, can be affected by physics etc.

I was thinking of handling this system by a series of classes and subclasses.

For example, the base class of Entity would contain the methods Render, Update, HandleInput and such as these are the most basic methods that all entities will contain. Variables of the main class could include isVisible, isPhysical, drawDepth and so on.

A new class for MapObject would use inheritance to take the methods from Entity and may also add other methods and variables such as tileTexture, tileHeight and tileWidth.

Abstracting(?) from that again could be the DoorTile class which would handle the item specific level of input handling and interaction.

Is this a valid way to handle objects in-game? Are there and glaring errors?(Bear in mind I've been awake for many many hours :p)

Sorry if this is somewhat long-winded, I wanted to be specific as to how my proposed system would work.

sentences: Roofs not appearing in Unity My buildings are fine until I import them to Unity. None of the formats I've come across( FBX, DAE, 3DS Max, Blender Files, any of the Autocad formats, OBJ, PRJ, WRL etc.), have roofs when importing the buildings as one cohesive file into Unity. In Sketchup, Blender etc. they all appear fine. Does anyone have suggestions?

sentences:
Problem with Quaternions and Unity's Euler Angle Convention So I want to rotate an UI-Element according to my magneticHeading, I just want to apply the magnetic heading to the z rotation in EulerAngles. So I tried to do so, which brought me to some weird rotations, then I tried this :

transform.rotation = Quaternion.Euler(transform.rotation.z, transform.rotation.x, transform.rotation.y);

Which also lead to some weird rotation, but I don't understand why, since in my understanding this should actually do nothing to the rotation...

This:

transform.rotation = transform.rotation;

is working again, like I expected it and does nothing to the rotation.

Can someone explain me why the Quaternion.Euler stuff is not working and how I can fix my problem?

Solution :

    transform.Rotate(0, 0, -temp.z);
    transform.Rotate(0,0,Input.compass.magneticHeading);
    temp = transform.rotation.eulerAngles;

So I'm reseting the Rotation first and then set the z value to the magneticHeading, the reset with Quaternion.identity did not work for me, so I just subtracted the last value.

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:
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:
Walkin on terrain - Opengl i wanna walk to terrain...
first i created the terrain

void desenha_terreno(float px, float pz){

for (int z = 0; z < iwidth-1; z++)
{
    glBegin(GL_TRIANGLE_STRIP);

    for (int x = 0; x < iheight-1; x++)
    {
        // for each vertex, we calculate the grayscale shade color,
        // we set the texture coordinate, and we draw the vertex.
        /*
           the vertices are drawn in this order:

           0  ---> 1
                  /
                /
             |/
           2  ---> 3
        */

        // draw vertex 0
        glColor3f(terreno[x][z][1]/255.0f, terreno[x][z][1]/255.0f, terreno[x][z][1]/255.0f);
        glTexCoord2f(0.0f, 0.0f);
        glVertex3f(terreno[x][z][0], terreno[x][z][1], terreno[x][z][2]);

        // draw vertex 1
        glTexCoord2f(1.0f, 0.0f);
        glColor3f(terreno[x+1][z][1]/255.0f, terreno[x+1][z][1]/255.0f, terreno[x+1][z][1]/255.0f);
        glVertex3f(terreno[x+1][z][0], terreno[x+1][z][1], terreno[x+1][z][2]);

        // draw vertex 2
        glTexCoord2f(0.0f, 1.0f);
        glColor3f(terreno[x][z+1][1]/255.0f, terreno[x][z+1][1]/255.0f, terreno[x][z+1][1]/255.0f);
        glVertex3f(terreno[x][z+1][0], terreno[x][z+1][1], terreno[x][z+1][2]);

        // draw vertex 3
        glColor3f(terreno[x+1][z+1][1]/255.0f, terreno[x+1][z+1][1]/255.0f, terreno[x+1][z+1][1]/255.0f);
        glTexCoord2f(1.0f, 1.0f);
        glVertex3f(terreno[x+1][z+1][0], terreno[x+1][z+1][1], terreno[x+1][z+1][2]);

    }
    glEnd();
}
}

I can move the camera with the functions:

void keyboard (unsigned char key, int x, int y) {
if (key=='w')
{
    float xrotrad, yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);
    xpos += float(sin(yrotrad))*5;
    zpos -= float(cos(yrotrad))*5;
    ypos -= float(sin(xrotrad))*5;

}

if (key=='s')
{
    float xrotrad, yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);
    xpos -= float(sin(yrotrad))*5;
    zpos += float(cos(yrotrad))*5;
    ypos += float(sin(xrotrad))*5;
}

if (key=='d')
{
    float yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xpos += float(cos(yrotrad))*5;
    zpos += float(sin(yrotrad))*5;
}

if (key=='a')
{
    float yrotrad;
    yrotrad = (yrot / 180 * 3.141592654f);
    xpos -= float(cos(yrotrad))*5;
    zpos -= float(sin(yrotrad))*5;
}

if (key=='q')
{
    yrot += (float) -0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='e')
{
    yrot += (float) 0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='r')
{
    xrot += (float) -0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key=='f')
{
    xrot += (float) 0.5*5;    //set the xrot to yrot with the addition of the difference in the x position
}

if (key==27)
{
    exit(0);
}

glutPostRedisplay();
`

and, i change the position with the values of x,y,z positions

    // clear screen and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

//glTranslatef(0.0f, 0.0f, -cRadius);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(yrot,0.0,1.0,0.0);  //rotate our camera on the    y-axis (up and down)

glTranslated(-xpos,-ypos,-zpos); //translate the screen to the position of our camera

// set the camera position
//gluLookAt(cameraX, cameraY, cameraZ, lookX, lookY, lookZ, 0.0, 1.0, 0.0);

// set the current texture to the land texture
//glBindTexture(GL_TEXTURE_2D, land);

    desenha_terreno(xpos,ypos);
    glEnable(GL_BLEND);

// enable read-only depth buffer
glDepthMask(GL_FALSE);

// set the blend function to what we use for transparency
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

// set back to normal depth buffer mode (writable)
glDepthMask(GL_TRUE);

// disable blending
glDisable(GL_BLEND);

    glFlush();

    glutSwapBuffers();

    angle++; //increase the angle
   }

well... i need to walk to the terrain, above the terrain, help me please!

sentences:
Do Octrees, Kd-Trees, BSP only make sense for static geometry? I'm still implementing my scene graph (see this question). Now, I wonder if a spatial representation such as a Kd-Tree or Octree to do View Frustum Culling (VFC) only makes sense with static geometry. The reason for my doubt is that usually dynamic geometry is a small part of the scene, while static geometry can be very large, and dynamic geometry forces to handle updates in the spatial representation at each frame.

Your opinions?

Tunnuz

sentences: Efficiently representing a dynamic transform hierarchy I'm looking for a way to represent a dynamic transform hierarchy (i.e. one where nodes can be inserted and removed arbitrarily) that's a bit more efficient than using a standard tree of pointers . I saw the answers to this question ( Efficient structure for representing a transform hierarchy ), but as far as I can determine the tree-as-array approach only works for static hierarchies or dynamic ones where nodes have a fixed number of children (both deal-breakers for me). I'm probably wrong about that but could anyone point out how? If I'm not wrong are there other alternatives that work for dynamic hierarchies?

sentences:
How to store ever-expanding maps with top-bottom, left-right hierarchy? I'm writing a game that will largely take place on only a screen-worth of hexagons, but which will require map to expand in every direction. Also the way I want to display those hexagons requires that I have to be able to iterate over them in order from top to bottom, left to right.

I have already written coordinate system, which can represent coords as 2d (axial) or 3d (cube). The system regards (0, 0) as the center hex, so it means I need to store negative coords as well.

What I don't have is data structure that fufills my needs.

I'm thinking about writing a data structure myself, which will consist of 4 two-dimensional vectors (each for one quadrant of the map in regards to positive/negative) that would be able to get hexes in order I want, but this solution (using 4 vectors) seems unintuitive and long to write.

So is there a simpler, possibly already implemented, way?

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:
How do I render into a sub-region of a texture atlas with XNA / HLSL? Is it possible to render into a texture atlas?

I've been wondering how to reduce the number of textures required for shadow-mapping, and came across a blog post here about rendering up to sixteen shadow maps into one texture-atlas.

According to the blog post mentioned above, these are the steps required:

1. The first step is writing to the texture; bind it to the framebuffer and set the viewport to render into the texture sub-region.

2. When accessing the sub-region, scale/bias the texture coordinates as follows: scale = region size / texture size, bias = region offset / texture size.

I understand this, but I'm not sure how to alter the viewport specifically to allow me to render into a certain square of the texture. I've found plenty of information about reading from it (up-sampling and down-sampling) but I don't know how I'd manipulate the viewport specifically to render into a small square region of the screen, and how I'd do this with a texture smaller than the back-buffer.

I'm using XNA and HLSL at the moment because it's simpler than SharpDX, and there's no point in messing around with that until I've got the theory working 100%.

Thanks for your help.

sentences: Is an iOS development license with Unity free? I'm coding in Unity Personal and I'm going to try to put my game onto the App Store (through the Unity --> XCode --> App Store process). In the past, Unity has charged money to get a iOS license for this. The price was $400 I believe. I've certain articles that say that it has changed, and some that say it still costs money. So, I'm not sure which one is true. Is creating and publishing a commercial game with Unity Personal now free? (meaning that there is no license required). If there is a price, how much is it, and is it a one-time fee or per month/year/game published etc. Thanks! Also, can I legally make money with this game using the Unity Personal?

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 do the Geometry Wars gravity well effect I'm not talking about the background grid here, I'm talking about the swirly particles going around the Gravity Wells! I've always liked the effect and decided it'd be a fun experiment to replicate it, I know GW uses Hooke's law all over the place, but I don't think the Particle-to-Well effect is done using springs, it looks like a distance-squared function.

Here is a video demonstrating the effect: http://www.youtube.com/watch?v=YgJe0YI18Fg

I can implement a spring or gravity effect on some particles just fine, that's easy. But I can't seem to get the effect to look similar to GWs effect. When I watch the effect in game it seems that the particles are emitted in bunches from the Well itself, they spiral outward around the center of the well, and eventually get flung outward, fall back towards the well, and repeat.

How would I make the particles spiral outward when spawned? How would I keep the particle bunches together when near the Well but spread away from each other when they're flung outward? How would I keep the particles so strongly attached to the Well?

EDIT:
http://www.youtube.com/watch?v=1eEPl8kOXN8 <- Video
https://dl.dropbox.com/u/49283213/gw.gif <- GIF of the particle path

I disabled the randomization within GW to make the particle effect easier to see, here's a minute video where you can see a blue-green drain sending out it's bunch of particles. The red particles are from the explosions that normally appear all over the place. Some observations I made from the video:

The particles are emitted from the center (or near center) of the drain
All particles are being forced into a clockwise motion around the center so some sort of tangential motion is being applied, you can easily see this when the red explosion particles get close to the drain.

sentences:
cocos2dx - Custom Fragment Shader and CCRenderTexture I have a CCRenderTexture that is filled with a sprite when the scene is loaded, as follows,

canvas = CCRenderTexture::create(this->getContentSize().width, this->getContentSize().height);
canvas->setPosition(data->position);
canvas->beginWithClear(0.0, 0.0, 0.0, 0);
this->visit();
canvas->end();

The above code is written within a class, which derives from CCSprite (Hence this).

Then, in another function applyShader(), I create a sprite named splat, from the texture of CCRenderTexture *canvas. Thus splat will contain the whole texture of canvas.

Now I apply a custom fragment shader to the splat by calling the function splat->renderShader(), which will modify some small portion of the whole  texture.

Then I draw the modified texture back to the CCRenderTexture *canvas.

Hence, applyShader() will
 * take a texture from CCRenderTexture,
 * create a sprite based on it,
 * apply a fragment shader to it
 * and draw the modified texture back to CCRenderTexture.

This applyShader() will be called repetitively and its code is as follows:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->renderShader();
art->canvas->begin();
splat->visit();
art->canvas->end();

My shader code is (nothing fancy)

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform sampler2D u_colorRampTexture;
uniform float params[5];

void main() {
    gl_FragColor = texture2D(u_texture, v_texCoord);
    return;
}

So, with the above code I expect the original sprite this to get rendered over and over again without any visual changes. But on each call to applyShader(), the texture is getting stretched a little and the stretched image is getting rendered. After some 10 calls, the image gets so distorted.

Can someone please tell me where I am going wrong?

Thanks :-)

PS: All code shown here is partial, not complete code.

Edit: Adding Screens

Update:
The problem has nothing to do with shaders it seems. It happens even when I dont call renderShader(). The actual lines of code is:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->setPosition( ccp( art->getContentSize().width * 0.5, art->getContentSize().height * 0.5 ) );
splat->setFlipY(true);
art->canvas->begin();
splat->visit();
art->canvas->end();

sentences:
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:
Do shader compilers typically know not to look up unused texture channels? I have a texture that's from the color attachment of an FBO in OpenGL ES 2.0, so I have limited control over the number of channels in the image.

Suppose I only need the color from the R channel of this texture. If I immediately swizzle out the R in the fragment shader like this:

float brightness = texture2D(u_texture, v_texCoord).r;

can I expect the GPU to know not to bother looking up G, B, and A?

I figure this is something that might vary from device to device, depending on the optimizations of the shader compiler, but to me this looks like a very obvious and easy optimization.

I'd like to know if I can be reasonably confident that almost all GPUs will make the optimization. This shader is a multiple-texture shader, and I'd hate to get surprised by some percentage of devices running it much slower than what I've tested on. If I cannot, then I may want to take pains to use a different method of generating my image so I can ensure a texture with fewer channels.

sentences: How can I improve or replace my programmer art? Say I'm a programmer who has done his own sprites or 3d models which would fall into programmer-ish kind of art. What steps can I take in order to improve or replace my own art?

sentences:
Lua as a stand-alone for game programming like Python? I've used Python before with PyGame to make games, but PyGame doesn't seem to be so popular anymore, and there arent that many good resources for it. I hear lots of buzz about Lua as a fast scripting language to be used inside of projects made in other languages.

I work much faster and enjoy the higher-level programming that is Python, so that naturally leads me to Lua, which seems to be getting a lot of attention recently. I know it's been around for a while but I think WoW add-on creation made it more popular..

Can Lua make games on its own as a stand-alone language with any 2D or 3D libraries, or is that not really the Lua domain?

I won't bother asking about 3D in Python here, I'll make a new question for that. Thanks!

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:
Rotated Sprites collision detection I am trying to implement checkCollision function in my game, I used AABB method but the problem is that my sprites are rotated so it's not really precise. I could finely describe my Sprites with rotated ellipses. Is there any more precise way of detecting the collision if I have the following attributes of entities:

entity.x
entity.y
entity.width
entity.height
entity.angle

Here is what I have coded so far (x and y are in the middle of my sprite):

this.checkCollision = function(entity1, entity2) {
  return (entity1.x - (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 < entity2.x + (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.x + (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 > entity2.x - (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.y - (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 < entity2.y + (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2 &&
   (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 + entity1.y > entity2.y - (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2)
}

PS: my cousin told me to do it with three circles (which creates a shape very similar to the ellipse) but I do not really know how to do it.

sentences: How do I store level-data in Android? I'm building a game where enemies come in waves. I want to create a file where I can define data about the waves (# of enemies, spawn times, speeds, etc.). I come from a background in iOS and would normally use something like a plist. What would be the best way to do something like this in Java and Android?

sentences:
What are some typical server/vps/colo hosting costs for deployed MMOs? From my estimates the MMO I'm designing can support 500000 concurrently connected non-idle users (and still be able to you know, do stuff) for about $1700/month in total hosting costs (includes bandwidth). No system admin is needed as the infrastructure auto-scales. Each additional 40000 users costs another $136/month. I've spent several months designing this backend and I'm curious how much other such systems cost.

I should note that this does NOT include the cost of any assets used by the client game. Assume it's an iPhone game with bundled assets.

Thanks!

sentences:
Asset Bundle hashes appear inconsistent The flow I see people discussing using is the following

In your build asset bundles step, grab the hash of each bundle
Store that on your server somewhere
Fetch those hashes at runtime
Use the Caching.IsVersionCached with that hash to detect if you already have a bundle
If not download the bundle and cache it
success

If this is how you are supposed to do it, why does the main mainfest(example Android.manifest) which can be loaded into a class AssetBundleManifest, have a function to get the hashes for you: unity doc
I was able to just use that technique up until now, but I have hit a problem where it failed to detect a hash change properly and that function is not giving me back the same hash that I see in one of my other bundles .manifest file
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: a44a4d42247721b8bd6f32531f73f9e3
TypeTreeHash:
serializedVersion: 2
Hash: ea5a42e0fd8ea905efa7aa926a3b8944
I am under the impression that the first value above is what would should match what you had stored on your server.

sentences:
Depth Peeling implementation problem: How to render the next layer? (OpenGL) I try to implement order-independet transparency sticking to the pseudo code in the linked paper (page 4). I can't figure out how they are able to do this in OpenGL.

I am rendering the scene two times in two different framebuffers and then want to blend the two. The first rendering uses the normal depth test GL_LESS. So I receive the nearest fragments in the first framebuffer.

I want to render the second nearest fragments in the second framebuffer. In the pseudo code they use the depth test GL_GREATER for this. But this would result in having the "farest" fragments in the second framebuffer, right?

So how can I render the "second nearest" pixels to a framebuffer? Which depth test would be right and how to apply it in OpenGL?

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:
LibGDX drawing map using tiles without space I am making a board game. To draw the map on the board I use different tiles.
On some screen the map looks good but on some other screens there is a space between the tiles.
How can I do so there won't be any space between the tiles?

I am designing my game with the size 480x800. To fit other screens I stretch it.

My tiles looks like this:

I draw the map using a for loop to draw the tile in different (x,y) position on screen.

Here is what I mean with space between tiles:
Screen with 240x400

Screen with 360x600, here there is no spacing between tiles.

I use camera and the screen to draw I don't use stage. I have also tried to use Viewport but I get the same results.

  cam = new OrthographicCamera();cam.setToOrtho(true, gameWidth, gameHeight);
  batcher = new SpriteBatch();
  batcher.setProjectionMatrix(cam.combined);
  shapeRenderer = new ShapeRenderer();
  shapeRenderer.setProjectionMatrix(cam.combined);

How can I do to solve the problem?

sentences:
Collision detection circle-segment-segment I've already implemented collision detection in my game loosely following this tutorial, which works great, but I realized there's one major flaw.
The player and the enemies are circles, while the obstacles can be either segments or polygons or circles.
Now, let's say I have segment A from point (100, 100) to point (300, 100) and segment B from point (100, 200) to point (300, 100), which means they form an acute angle, and player has it center in point (100, 125), with a radius of 25.
If player starts moving right, it will eventually collide against segment B. My method checkCollisions() will return a vector, but if I apply that vector on player, it will be moved up and left, and will overlap segment A.
If I call checkCollisions() a second time, player will be pushed down and collide again with segment B, so recursive invocations aren't a solution. Any ideas?

Here's a picture to explain:
 The g->n vector direction is along the bisector of the two little vectors, but how do I find the length?

sentences:
How does one organize AI interactions with Local and Remote Players? Scenario: In a first-person multiplayer game, an AI monster grabs a player. (This would be first-person player on the client's local machine, and a third-person remote player on the master and other client machines)

I'm trying to weigh the merits of different implementations of how these interactions could be organised.

In this scenario, I can think of a couple different ways of implementing but I'm not sure what assumptions they might make which could result in a problem down the line:

The Monster could, in its grab function, have a test IsFirstPerson and then perform the FirstPerson specific or ThirdPerson specific grab mechanics, or
The Monster could talk to an IGrabbable interface on the Player (remote or local), which would return whether it is FirstPerson or ThirdPerson and then perform the specific grab mechanics, or
The Monster could talk to an IGrabbable interface on the Player (remote or local), which would return/dictate the full details of how the Monster should grab.

(And for clarity - differences in implementation of FirstPerson or ThirdPerson would be where the hands are or headlook - in first person it would look directly into the camera, but in third person it'd look at where the eyes are; differing struggle animations, etc)

sentences:
Transparency in XNA-4 primitives I'm using XNA 4 with Visual Studio 2010. I'm trying to create a simple 3D world with walls and doors in which the user to free to roam around.

A wall is just a rectangle which is currently being rendered with four vertices using triangle strips. But to create a door, I'd have to split it into three rectangles as shown in the figure.

Four quadrilaterals if I want to have the following door-style

It will become more complex to have multiple doors on the same wall or if I have windows.

Is there any shorter way to handle this? I am looking for something that will just make the wall transparent wherever I want.

I found a solution but facing a problem here

sentences:
Is correct to calculate values in percentage, using the total number of iterations? Trying to clarify the problem.

Imagine a factory that produce soccer balls; if you produce 1 ball, it will take a certain amount of game cycles. For sake of simplicity, let's say it could take between 5 and 15 cycles (depending from various conditions, like number of workers, quality of workers and so on). Once you make a certain amount of soccer balls, the process is considered done.

Now, I want to display a value in percentage for costs, and a value of defective balls made. with "cost", I am trying to display how much did I spent (materials, workers wage and so on), at the moment. The number in currency is self esplicative, but I believe a percentage value could help to know if you are using too many workers, or burning too many resources, resulting in a waste of money.

To calculate the percentage of defective is relatively simple, since every X amount of time, when I refresh, I can check the balls produced against the defective ones, and the result should be

Total produced * 100 / defective = percentage of defective.

But for the costs, things are different; so I was planning to use the number of cycles to calculate percentage for costs:

cycles * 100 / current costs = percentage of costs

Would this be considered correct? Since the number of cycles for a whole batch of balls may vary slightly, this may represent that when there are less cycles, it means that you spent less money, henche the percentage will be smaller.

sentences:
Online Browser Game Resource Incrementing Production Problem I am working on a browser game where there are citys and their resource productions.
Each player has their own production rate for each resource.Lets say stone as example.
I have production rate,capacity and timestamp(when production started for that resource) for stone in  db.I am pulling production rate from db and updating production value on client(incrementing it) but not in db since updating db value each second is not a good idea.So each time user refreshes page or does some action releated to  stone,server checks timestamp and production rate and calculates what should be the value of stone in that time,i mean real value and updates client.

"stone" : {
        "capacity" : 10,
        "count" : 0,
        "timestamp" : 1531470433, // when production started.
        "rate" : 20, //stone production in a minute
}

This calculates users current stone value and updates db.

var allStoneProduction= Math.floor((currentTime - stoneDbTime) * stoneProductionRate /60)

The problem is with capacity.Players are able to increase capacity of each resource.

I can detect when stone capacity going to be full in server since i know production rate and production start time.Then i am making stonecount equal to capacity.

This code checks if storage is full.If its not it sets value of stone production.

var storageFullTime = stoneDbTime+(stoneCapacity/stoneProductionRate)*60

if(currentTime < storageFullTime || currentTime == storageFullTime){
console.log("storage is full!")

Resources.update({ownerId:userid},{$set:{"stone.count":stoneCapacity}})

}else{
Resources.update({ownerId:userid},{$set:{"stone.count":allStoneProduction}})
}

As you see allStoneProduction is actually always going up without checking capacity since its only based on rate and start timestamp.This is ok if there is no max capacity.

If stone count reaches its capacity i stop incrementing on client side by checking stonecount,stonecapacity.(10/10) lets say.

If i change capacity from 10 to 20 on db,client gets new capacity value and starts to increment it 11,12,13... until capacity 20.

But server cant follow up this.Should i also write timestamp of when capacity changed ? I couldnt really write the correct if else logic for this.

So how do i compute this capacity change in server side ? allStoneProduction value doesnt care about reaching max capacity and increasing capacity.So if change capacity and refresh page,i get a wrong stone count.(since in server logic production never stops)

sentences:
Performance issue in a simple game loop I have a problem with a simple game loop. As my rendering and iteration functions together take 10 ms, the time between update and swapBuffers measuers around 140 ms. What is causing this. Is there a straightforward way to fix this.

Could it be related to the fact that each rect() (in a for loop) calls glDrawElements() and it somehow ques the whole process.

void game::startup()
{
    startup();
    glfwSwapInterval(1);
}

void game::render(double currentTime)
{
    static const GLfloat green[] = { 0.0f, 0.25f, 0.0f, 1.0f };
    static const GLfloat one = 1.0f;

    glClearBufferfv(GL_COLOR, 0, green);
    glClearBufferfv(GL_DEPTH, 0, &one);

    auto t1 = std::chrono::high_resolution_clock::now();

    for (size_t y = 0; y < game_board.getWorldHeight(); ++y) {
        for (size_t x = 0; x < golf_board.getWorldWidth(); ++x) {
            rect(x * cell_size, y * cell_size, cell_size, cell_size, game_board.get_state(y * game_board.getWorldWidth() + x));
        }
    }

    auto t2 = std::chrono::high_resolution_clock::now();
    game_board.iterate(1);
    auto t3 = std::chrono::high_resolution_clock::now();

    float rendertime = std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count() / 1000.0f;
    float generatetime = std::chrono::duration_cast<std::chrono::microseconds>(t3 - t2).count() / 1000.0f;

    std::chrono::milliseconds ms_perframe(1000 / 60);  // About 60 fps
    auto cur_time = std::chrono::high_resolution_clock::now();
    float sleep_time = std::chrono::duration_cast<std::chrono::microseconds>(t1 + ms_perframe - t2).count() / 1000.0f;

    std::this_thread::sleep_for(t1 + ms_perframe - t3);

    cout << "render time (ms)" << rendertime <<"\n"
         << "generate time (ms)" <<generatetime << "\n"
         << "sleeping time (ms)" << sleep_time << "\n";
}

Output (board size: 256 x 128 = 32768 rectangles drawn per frame):

render time (ms) 8.1
generate time (ms) 1.3
sleeping time (ms) 6.6
SWAP TIME (ms) 146

application run function rendering part:

startup();

do
{
    render(glfwGetTime());

    auto t1 = std::chrono::high_resolution_clock::now();
    glfwSwapBuffers(window);
    auto t2 = std::chrono::high_resolution_clock::now();
    float  swap_time =
    std::chrono::duration_cast<std::chrono::microseconds>(t2-t1).count() / 1000.0f;
    std::cout << "SWAP TIME (ms)" << swap_time << "\n";

    glfwPollEvents();

    running &= (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_RELEASE);
    running &= (glfwWindowShouldClose(window) != GL_TRUE);

} while (running);

shutdown();

glfwDestroyWindow(window);
glfwTerminate();

rectangle draw function:

rect(int x, int y, int w, int h, int state) {
// input is top left corner of rectangle, width and height of rectange
and the state of unit

GLfloat fstate = (float)state * 0.5f;
GLfloat vertices[] = {
    x,  y,      fstate,         // Top-left
    x + w,  y,  fstate,         // Top-right
    x + w,  y + h,   fstate,    // Bottom-right
    x, y + h,    fstate          // Bottom-left
};

glBufferSubData(GL_ARRAY_BUFFER,0, sizeof(vertices),vertices);
glUseProgram(shaderProgram);

glUniformMatrix4fv(mvp_location, 1, GL_FALSE, mvp);

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
}

sentences:
using Playerprefs on Android Mobile Platform I have a question about playerprefs on my android mobile game not initializing properly. I have already pre-set my playerprefs data on a variable with a value of 3. In my play mode on unity the value is showing 3 through the textmesh that I have it scripted on. But when I install and test it on my android mobile device it is 0. can someone help how to properly initialize my playerprefs data to the right value on android platform?

 public static Game GM;
 int maxAntiBody;
 public TextMeshProUGUI antibodyTexMesh;

void Start () {
    if (GM == null)
    {
        GM = this;
    }
 maxAntiBody = PlayerPrefs.GetInt("MaxAntiBody");
 antibodyTexMesh.text = maxAntibody.toString();
}

void Update () {
debugging();
}

//I use this method for setting or resetting my desired value for the playerprefs data I'm working with. In this case I choose 3 as a value.
void debugging() {
    if (Input.GetKeyDown(KeyCode.M))
    {

        PlayerPrefs.SetInt("MaxAntiBody", plus++);
        Debug.Log("max anti body value is : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
    else if (Input.GetKeyDown(KeyCode.R))
    {
        plus = 0;
        PlayerPrefs.SetInt("MaxAntiBody", plus);
        Debug.Log("max anti body is now reseted to : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
}

sentences:
Stretching limited graphic assets in a loot based game I’m creating a game with a fairly simple gameplay. The battle will be similar to rock, paper, scissors but with stat components where your choice combined with your stats determines the winner.  It has  limited graphics however it’s weapon based so you weapon will be shown. Therefore I think it’s be more fun to focus a lot on loot and upgrading the visual of the weapons and other properties of your character that you’re using in battle.

The problem is I have a fairly limited budget to start so I’m trying to determine the best way to stretch my graphic assets and number of weapon yet still make the game interesting.

The options I’ve considered so far:

1) At the end of every game you get a new random weapon/weapon skin. This is the most fun but also would require the most skins as you’ll run through them really quick.

2) When you win you win a random weapon skin, you then have to combine them in some way like 3 tier 1 skins equals 1 tier 2 skin, and 3 tier 2 skins equals 1 tier 3 skin. This is a nice middle balance.

3) You only win stat increases, you must pay for new skins if you want to upgrade your cosmetics. This is the least fun way as your “loot” isn’t very appealing, but I would only need a few assets in the store to start.

I’m hoping by asking this I can find quality and creative ways to approach this issue that I wouldn’t have otherwise thought of. I know there is no “best” so hopefully this question isn’t off topic but Intruly need help here.

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:
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:
DirectX depth/order render issue I have what appears to be a depth or order rendering problem which I have never seen happen before. My terrain and water are rendered with my displacement shader, and at the moment all other models are rendered with my standard shader, and I am using deferred rendering.
Now, as you can see in the images, I have a sphere that is half cut off, as though d3d thinks that the water is somehow in front of the sphere, which it is not. If I move down to water level, you can see the whole sphere.
If I render the same sphere with my displacement shader, there is no problem at all. If I go into my displacement shader class, and cut out the hull and domain shader stages, then the terrain and water start to do the weird z buffer issue that the sphere is having.
Is there something conceptual anyone can think of without me having to post hundreds of lines of code? However, happy to post code if needed.

Thank you

UPDATE:
I've narrowed it down to the domain shader - the line that physically changes the output triangles' position. When I comment out this line, it solves the problem, although then I have no tessellation. Do I need to do some kind of manual depth writing after changes the position?

Domain Shader:

cbuffer cbDomainInfo
{
    float3 g_vEyePosition;
    float _padding;
};

struct PatchTess
{
    float flEdges[ 3 ] : SV_TessFactor;
    float flInside : SV_InsideTessFactor;
};

struct DomainInput
{
    float4 vPosition    : POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

struct DomainOutput
{
    float4 vPosition    : SV_POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

Texture2D g_texDispMap;
SamplerState g_samSampler;

[ domain( "tri" ) ]
DomainOutput DS( PatchTess input, float3 uvwCoord : SV_DomainLocation, const OutputPatch<DomainInput, 3> patch )
{
    DomainOutput output;

    output.vPosition = uvwCoord.x * patch[ 0 ].vPosition + uvwCoord.y * patch[ 1 ].vPosition + uvwCoord.z * patch[ 2 ].vPosition;
    output.vNormal = uvwCoord.x * patch[ 0 ].vNormal + uvwCoord.y * patch[ 1 ].vNormal + uvwCoord.z * patch[ 2 ].vNormal;
    output.vTexcoord = uvwCoord.x * patch[ 0 ].vTexcoord + uvwCoord.y * patch[ 1 ].vTexcoord + uvwCoord.z * patch[ 2 ].vTexcoord;
    output.vViewVec = uvwCoord.x * patch[ 0 ].vViewVec + uvwCoord.y * patch[ 1 ].vViewVec + uvwCoord.z * patch[ 2 ].vViewVec;
    output.flAlpha = uvwCoord.x * patch[ 0 ].flAlpha + uvwCoord.y * patch[ 1 ].flAlpha + uvwCoord.z * patch[ 2 ].flAlpha;

    output.vNormal = normalize( output.vNormal );

    float flMipInterval = 20.f;
    float flMipLevel = clamp( ( distance( output.vPosition, float4( g_vEyePosition, 1.f ) - flMipInterval ) ) / flMipInterval, 0.f, 6.f );

    float flHeightMap = g_texDispMap.SampleLevel( g_samSampler, output.vTexcoord, flMipLevel ).r;

    //TODO: Pass in height scale via cbuffer
    //This next line causes the problem:
    output.vPosition += float4( ( 20.f *( flHeightMap - 1.f ) ) * output.vNormal, 1.f );

    return output;
}

sentences:
Making a 2D gun spin from recoil when it shoots I am trying to clone the game "Flip the Gun" as an exercise.
Here is the behaviour I have so far.
And here is the code I am using:
if (Input.GetKeyDown(KeyCode.Space))
{
    rigidbody2D.AddForceAtPosition(
                transform.position-recoilPoint.transform.position * recoilForce,
                recoilPoint.position,
                ForceMode2D.Impulse
    );
}

As you can see in the video, the gun is moving too fast and rotating too fast. It seems out of control. I am not sure if the way of adding force to the gun is correct or not.
Thank DMGregory for editing the question for me. I am new to this family so that helped a lot. :)

sentences:
How do I detect collisions between a point and a sloped line? The character in my game constantly falls due to gravity, so i have to detect the collision between the bottom point of the character and the tile slope line on the same x coordinate.

The character must stop just on the slope floor. for that i also need to define where is the slope by storing x, y of both ends of the slope.

In the image bellow, you see a 32x32 tile map, origin of each image is top left.

playerPointX = 420;
leftSlopeX = 13*tileSize;
leftSlopeY = 11*tileSize;
rightSlopeX = leftSlopeX+tileSize;
rightSlopeY = leftSlopeY+tileSize;

so regarding the awnser i should write this ?

float run = playerPointX - leftSlopeX;
float rise = 1 * run;
float collisionHeight = leftSlopeY + rise;

and how i can detect the collision against collisionHeight ?

if (playerX<collisionHeight) // collision detected

or

if (playerY>collisionHeight) // collision detected

Finally when the collision will be detected should i use y=mx+b for playerY displacement ?

sentences: Is it possible to have a GUI in world space in Unity3D game? I'm trying to make a tank shooter game for learning purpose and I want to have it viewed in first person, is there a way to make it so that the GUI seems projected onto the interior of the tank chamber so that I can look around without the GUI following the camera along with having the perspective change effects (i.e. the edge of the GUI further away from the camera appears smaller than the edge closer to the center of the camera)?

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:
How do I make objects move along a path? I'm trying to get something like the below image. As you can see, there's a highway and inside of it, there'll be some objects moving (millisecond). I guess the street behavior is like a pipeline. When the highway loads an object, it appears at the beginning and it'll be moving through the highway until it arrives in the other extreme of the highway.

My main problem is, how can I move several objects only inside of the highway?

sentences:
C# Integer limits for Scriptable Objects I am experimenting with Scriptable Objects in Unity. In the following example how can I limit the range of accepted values?

public class AScriptableObject : ScriptableObject
{
   public uint damage;
}

Since it's a uint the lowest value is 0 but how can I limit the max value to 500 for example? Can I use if statements?

sentences:
Not able to change Rigidbody 2d gravity scale I have been trying to change the gravity scale of my Rigidbody2d when I click on it. By default it is by 0 and when I click on it, it should change to 1, so that it falls down. I have a square with a boxcollider2d and a Rigidbody2d and a square with just a box collider.

public bool gravity = false;
public bool m_isRunning = false;
public SpriteRenderer m_spriteRenderer;
private Rigidbody2D rb;

private void Update()
{
    if (gravity)
    {
        rb.gravityScale *= -1;
    }
}

private void Start()
{
    m_spriteRenderer = this.GetComponent<SpriteRenderer>();
    rb = GetComponent<Rigidbody2D>();
}

private IEnumerator Changecolor()
{
    yield return new WaitForSeconds(1);
    int random = Random.Range(1, 4);

    if (random == 1)
    {
        m_spriteRenderer.color = Color.blue;
    }
    else if (random == 2)
    {
        m_spriteRenderer.color = Color.red;
    }
    else if (random == 3)
    {
        m_spriteRenderer.color = Color.green;
    }
    else
    {
        m_spriteRenderer.color = Color.yellow;
    }

    this.StartCoroutine("Changecolor", 3f);
}

private void OnMouseDown()
{
    gravity = true;
    m_isRunning = !m_isRunning;

    if (m_isRunning)
    {
        StartCoroutine("Changecolor", 3f);
    }
    else
    {
        StopCoroutine("Changecolor");
    }
}

sentences:
How can I implement pre-rendered 2D sprites that can face any direction? I've been Googling how games like Clash of Clans render their troops, and it appears they are pre-rendering 3D models to 2D sprite sheets before runtime, and rendering those 2d images at runtime. However, troops in Clash of Clans can face any direction.

In my similar game, if I were to create an image for every orientation (0-360 degrees) for every troop type (there are 18 types) at each frame in their animation, they would have to produce a massive amount of images. I can't imagine this is what other developers are doing, so how can I actually accomplish this?

sentences:
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 I coordinate a camera with the eyes of a model? I am currently working on an FPS in XNA and I wanted to know how I would position the camera at the eyes of the model and whenever the model rotated or moved it's head (where the eyes are), the camera would move along with it. Also, whenever the player moves the camera (with their mouse) the model would turn it's head and eventually it's body.

I believe this would reduce the need for constant transformations and the planning of cutscenes by having an animation play and the camera follow that animation. It would also cut the need for transforming the model constantly when I add a future multiplayer.

I'm also open to any other ideas, so please, leave a comment letting me know what you think would be good and efficient.

sentences:
Setting SteamVR Camera Target Eye before SteamVR installed in Unity I'm writing a plugin that can be used in both VR and non-VR projects. I have a Camera that is used to display UI containing some game info on a secondary monitor. My problem is that when the end-user adds my plugin and then imports steam vr, this UI camera's Target Eye is set to "Both" by default.

I can't have any SteamVR code in my plugin. But I can't adjust Target eye property of the camera without it. I just want it so that the camera doesn't change when a user imports SteamVR. I want it to always render to the main display (target eye = none)

So just to clarify,

I have my plugin, written in a non-vr project with a standard Unity camera. There is no Target Eye setting for this standard camera.
User wants to use it in VR project, imports plugin into SteamVR Project
Camera used to render UI gets automatically converted (wrongly) into SteamVR camera
Defaults to Target Eye = Both
Need it to be Target Eye = None

At the moment to avoid users submitting countless bug reports, I have to provide warnings in like 6 places telling users to dig way into my built-in prefabs to adjust this setting manually if they use SteamVR. It's not easy for new Unity users, and I want to make adoption as easy as possible.

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:
Is there a way to create multi-resolution graphics for game with createjs? I'm on a advanced development for a game made with createjs framework. However it's time to export it to some platforms. The graphics are made for the iPad 3 resolution.

I would like to export them to devices with less processing power, like iPhone 4 or low end Androids. But hi-definition assets drains the little processor of them.

Resizing all the files is not a solution. There must be some "scale factor" on image loader or another mechanism to get images in correct sizes.

If my game canvas has virtual 1000px wide, and my asset has 1000px wide, the canvas will be filled by the asset. If I resize it to half size, it will be 500px wide, and the canvas will be just half filled. There should be a scale factor that should get the displayObject (not the asset) and set its sizeX and sizeY to double size to fill the screen again. I can be done manually for every one, but I'm looking for a better solution.

sentences:
Is clipping done before or after projection? Is clipping applied after projection or before?

How can it be applied after projection when a vertex is behind the camera and projected therefore mirrored?

At this time I clip the triangle before projection.
For this I create _ a plane which represents the screen and check whether the sides of a triangle intersect with the plane (Basically a ray plane intersection test).

If true then I calculate the intersection point between side and plane and project this new point instead of the vertex behind the plane.
This works though but I just wanted to know whether this is a wrong or right method to do it.

sentences:
MonoGame SharpDX Error 'The Parameter is Incorrect' when using graphics.DrawUserPrimitives Below is a small section of code that is meant to draw a multicolored triangle to the middle of the screen in a MonoGame game. This uses the basic function DrawUserPrimitives to draw the triangle. This works fine in XNA, but the moment i try to use it in a MonoGame DX game (Which compiles using SharpDX) it will crash with the following 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.

Below is the code that is causing the error.

private void SetUpVertices() {
        vertices = new VertexPositionColor[3];

        vertices[0].Position = new Vector3(-0.5f, -0.5f, 0f);
        vertices[0].Color = Color.Red;
        vertices[1].Position = new Vector3(0, 0.5f, 0f);
        vertices[1].Color = Color.Green;
        vertices[2].Position = new Vector3(0.5f, -0.5f, 0f);
        vertices[2].Color = Color.Yellow;
    }

    public void Draw(GameTime gameTime) {
        gDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
    }

Has anyone ever come across simillar errors using the DirectX version on MonoGame and SharpDX when dealing with primatives? And do you know of a way I can fix this issue?

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:
Unity 2018.4.25f1 Errors - error CS0118 & error CS0234 I am getting 2 errors in my c# script.

Assets\scripts\playerMovement.cs(8,5): error CS0118: 'PlayerControls' is a namespace but is used like a type
Assets\scripts\playerMovement.cs(4,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

playerMovement.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class playerMovement : MonoBehaviour
{
    PlayerControls controls;
    Vector2 move;
    void Awake()
    {
        controls = new PlayerControls();

        controls.Gameplay.move.performed += ctx => move = ctx.ReadValue<Vector2>();
        controls.Gameplay.move.canceled += ctx => move = Vector2.zero;
    }
    void Update()
    {
        Vector2 m = new Vector2(move.x, move.y) * Time.deltaTime;
        transform.Translate(m, Space.World);
    }
}

I am using the new Input System 0.2.1 in unity 2018.4.25f.
The PlayerControls script is auto-generated from an Actions Input object, and it is in the main root "Assets".

sentences:
Unity associated game object is null when running I am just starting with Unity.
I have two UI Text game objects, Atext and Btext. I have associated them by drag-dropping with my PlayerController script public variables, say public Text atext and public Text btext.
Before running, the Unity editor correctly shows that Atext and Btext are correctly associated with the public variables.
When running with debug, I get a null reference exception with btext and even the Unity Editor shows the association as None (Text). After stopping, the association turns to Btext as it is supposed to be. The script is very simple and I don't set btext to null at any point.

When I create a new UI Text object by duplicating Atext, it works correctly after associating it with some new variable.
When I create a new UI Text object by Create-> UI -> Text, it doesnt work

Might be a stupid question but what am I forgetting?

Edit:
Here is the problem again with code:

Before running with debug, the editor shows

PlayerController2 (Script)
Script: PlayerController2
Speed: 7
Countboxref: Countbox(Text)
Winboxref: Winbox (Text)
Brokenboxref: Text (Text)

where Countbox, Winbox, and Text are Canvas/UI/Text objects which I have drag dropped into place. Winbox object has been created by duplicating it from Countbox, Text has been created by Create -> UI -> Text.

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

public class PlayerController2 : MonoBehaviour {

public float speed;
public Text Countboxref;
public Text Winboxref;
public Text Brokenboxref;
private Rigidbody rb;
private int boxit;

void Start ()
{
    Countboxref.text = "count";
    Winboxref.text = "winner";
    Brokenboxref.text = "broken";
}

When the program breaks on line Brokenboxref.text = "broken”, the editor shows

Brokenboxref: None (Text)

and when the execution is stopped completely, it again returns to

Brokenboxref: Text (Text)

Note 1: In this project, every Text object created with Create->UI->Text is broken. A new Text object works only when I select Countbox or Winbox and duplicate it. Thus it is not possible that the object would be explicitly destroyed in the code. I can create as many Text objects as I wish by copying (all don't work) and as many Text objects as I wish by duplicating (all will work).

Note 2: when I create a new project from scratch, of course everything works as expected. I assume the project is somehow corrupted.

Edit 2: No prefabs or such. Just the basic roll a ball tutorial. But this was my son's project so I am not sure what he has done when following the tutorial.

Note 3: The problem went away when I deleted the Library folder and forced Unity to rebuild it. Don't know yet if I caused any other problems by doing that. I saw that somewhere as a suggestion for corrupted projects. I don't know if there is a proper way to refresh.

Also, this project was originally started with Unity 4.6 and upgraded to 5.02

sentences:
Creating an illusion of stress and danger I'm currently experimenting with an adventure game setting where at some point the game is quite calm and the player has to solve puzzles and at some point there are enemies or environmental traps.

I don't want to have any surprising danger events coming out of nowhere that would scare the player, so I would like to build up the players' tension before a section of the game starts which will contain multiple "player-killing" obstacles (may they be enemies, or the ground falling apart..).

My sound artist made some really good music and sound effects to slowly build up the tension, but game elements during this phase are missing. It's like the player is running from a puzzle-zone to danger-zone through a boring plain section.

Beside sound, what are some generic ways to build up the players' tension? Can i aid with special Visuals, or do i have to improve the story or possibly invent some pre-danger-zone easy obstacles?

sentences:
Ordering a List doesn´t work. - InvalidOperationException: Operation is not valid due to the current state of the object I have this method. It´s for ordering actors and only displaying the ones which are in direct line of sight with the player.

public Actor OrderActorListByDistance(List<Actor> list, Vector2 pos)
{
    return list.FindAll(d => Physics2D.Linecast(d.transform.position, pos, LayerMask.GetMask("Default")).collider == null).OrderBy(i => Vector2.Distance(pos, i.transform.position)).First();
}

But that Method throws that error
InvalidOperationException: Operation is not valid due to the current state of the object

I already made a lot of google research but I couldn´t find any solution.
I would appreciate any suggestion or help. Thanks in advance

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:
How to paint regions of a map with visually different colors I'm learning some concepts of procedural content generation. Now I'm generating a map with regions and each region has a diferent colors generated in a pseudo-random way.

My problem right now is that most of times (more probably when more regions exists), some regions has colors that are visually similar.

I want to control that adjacent colors are visually different, but still with some random component. What make colors different?

sentences:
Ball bouncing infinitely and constantly Alright, so I've got hold of some simple physics mechanics, and am currently trying to implement bouncing. Based on the first answer of this question, I've developed the following algorithm:

    Vector2 velocity;

    float gravity;
    float elasticity;

    Hitbox dummy;

    // ---

    void bounce() {
        dummy.MoveY(velocity.Y);
        velocity.Y += gravity;

        if (dummy.ThereWasContact.South) velocity.Y *= -elasticity;
    }

Gravity can be any value, and Elasticity is always between 0.0f and 1.0f. Velocity.Y's initial value can also be anything.

Weight factors aside, which would determine a minimal rebound force for the object to be able to leave the ground again and (probably) aren't related to the problem, this is apparently fallacious.

What happens here is somewhat like this:

If I drop an object from a height of 128 units, for example, 0u marking ground height, with a gravity of 1u and elasticity of 0.9, the object would bounce once, reach a maximum height of ~126u from the rebound, and from then on keep alternating on maximum heights between this and ~122u.

This example is based on one of my own experiments, in which I drop an object from a height of 64 pixels and there is a floor at 192 pixels. The maximum height will keep going from ~66 pixels to ~70.

What am I missing? Does weight after all do more than I think? If I need to explain something better or details appear to be missing, let me know.

sentences:
Low Res Atlas Texture vs. Many different materials without textures So I have recently started to look into optimizing a medium complex 3D scene, more specifically i am looking to improve the performance i get from a fairly realistic bus. I am currently using the Unity3D standard shader. There are a lot of different objects within the scene, most of which are repeated and instanced. While many individual objects require only limited color variance often enough just a solid color and no texture at all.

I have read a lot about batching and atlasing but can't quite find an answer on the trade-off of using textures when no textures are required. I understand that reusing the same material allows for batching and can greatly reduce the amount of draw-calls, however how does this compare to the complexity of texture mapping if this could be avoided entirely? Is it still good practice to atlas solid colors on very low resolution atlas-textures and thus combine materials together? How does it look if i intend to use metallic and smoothness maps as well? Does it all come down to scene complexity and a number game or is there a straight answer?

I have the same uncertainty when it comes to objects which are made up of an arbitrary single digit number of solid colors; given supporting geometry, is it better to assign different materials with solid colors to regions of the object or create low-resolution textures?

In general; what is the point at which atlasing becomes the worse choice?

Thanks in advance!

sentences:
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:
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:
Custom Update Function -OR- Multiple TimeScales I'm trying to create some interesting variations on timescales in my game.  In essence, I'd like at least two, probably three or four separate timescales.

The player - the player timescale is likely to be the game/scene timescale always.
Mobs - mob timescales can be altered (slower primarily, but also faster possibly) depending on cast spells or other effects in the
game.
Environment - like mobs, the environment may be slowed or sped up depending on some game effects that occur.  This would control things
like traps, torches, etc.

I'm thinking about things such as a Slow Time spell that might slow most mobs, but maybe not others (bool flag), something like a time elemental or something of that nature.  I'd also like to possibly slow environmental time so the player may have a single-use item that would allow them to move easily navigate traps (but not have guaranteed success if they still don't see the pattern or such).

Having controller scripts that are added to all objects that listen for calls to change a multiplier on Time.deltaTime could be an option, but it's clunky, would have to be in all of the scripts, would have to be accounted for in many areas (movement, combat, possibly related effects), and is just not an ideal option.

Inversely, the same effect (a lich for example casting slow on a player) could require opposing things.  If I had global settings that contained a multiplier for player/mob/object that were impacted by an effect, I could still always use a multiplier with Time.deltaTime, but I still think it would be clunky.

Has anyone done this?  Are there any good ideas?  I've searched a bit, but didn't find anything terribly useful.

I've considered custom Update() classes, though I'm not entirely sure how to implement them.  Maybe extend the FixedUpdate() class that's built in to take other things into account?  I know that Time.timeScale is inherently for the current scene, but could I make instances of Time that are used by different scripts FixedUpdate()?  Am I overthinking this?  I feel like this shouldn't be quite so difficult.

sentences:
StateMachineBehaviour.OnStateExit is called before StateMachineBehaviour.OnStateEntered is called When I start my game I get null-references in my OnStateExit of objects that are initialized in the OnStateEntered. After this it goes smooth, so it only occurs at startup before any conditions for statechanges are met.

How come? My understanding is that OnStateExit is always preceded by OnStateEntered.

My StateBehaviour

public class DuckStateBehaviour : BaseStateBehaviour {

    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        mMovement.BeginDuck();
    }

    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (mMovement != null) mMovement.EndDuck();
        base.OnStateExit(animator, stateInfo, layerIndex);
    }
}

public class BaseStateBehaviour : StateMachineBehaviour {

    protected Transform mTransform = null;
    protected Rigidbody2D mRigidBody = null;
    protected IMovement mMovement = null;

    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        mTransform = animator.gameObject.GetComponent<Transform>();
        mRigidBody = animator.gameObject.GetComponent<Rigidbody2D>();
        mMovement = animator.gameObject.GetComponent<IMovement>();

        Debug.Assert(mTransform != null);
        Debug.Assert(mRigidBody != null);
        Debug.Assert(mMovement != null);
    }

}

sentences:
Unity UV map, tint / change color of texture I have an array of vertices with texture coordinates for a UV map in Unity:

newUV.Add(new Vector2 (0, 1)); // FACE 1
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

newUV.Add(new Vector2 (0, 1)); // FACE 2
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

mesh.uv = newUV.ToArray();

It textures my mesh just fine.

How could I go around tinting FACE 1 to a darker color? Let's say the texture is just plain green and I wanted to texture only on FACE 1 to be a darker shade of green.

sentences:
D3D11CreateDevice leads to syntax error I'm following the book Introduction to 3D Game Programming with DirectX 11 by Frank Luna (link) and I'm trying to make the empty project in Chapter 4 (don't worry, I don't expect you to read the book)

I'm getting to the point in code where I need to create the Direct3D device context. My code looks at this so far:

#include <Windows.h>
#include <D3D11.h>
#include <D3Dcompiler.h>

UINT createDeviceFlags = 0;

#ifdef DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D_FEATURE_LEVEL featureLevel;
ID3D11Device* md3dDevice;
ID3D11DeviceContext* md3dImmediateContext;
HRESULT hr = D3D11CreateDevice(0, D3D_DRIVER_TYPE_HARDWARE, 0, createDeviceFlags, 0, 0, D3D11_SDK_VERSION, &md3dDevice, &featureLevel, &md3dImmediateContext);

if (FAILED(hr)) {
    MessageBox(0, L"D3D11CreateDevice Failed", 0, 0);
}

// I added this as the entrypoint for the program - copied directly from microsoft's website
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}

The problem is that I'm getting some errors that make no sense at all. Take a look (by the way, I'm using Visual Studio Community 2015):

Code    Description                                              File       Line
C2059   syntax error: 'if'                                       main.cpp   16
C2143   syntax error: missing ';' before '{'                     main.cpp   16
C2447   '{': missing function header (old-style formal list?)    main.cpp   16

Any help would be greatly appreciated!

sentences: setting the position in different resolution I have a normal game window which is 640*480, and everything is fine, but when I try to maximize the window, the objects translate to different positions on the screen, for example If I have a circle which is drawn at the center in the normal window, when I try to maximize it, it shifts away from the center of the screen. How do I adjust it so it draws at the center in both normal window and maximized window ?

sentences:
Unity - Duck volume of audio source inside a boxed area I'm trying to lower the volume of an outside ambient wind sound while the player is inside a building or room. Is there any way in Unity to do this without scripting? Or would I have to script this to check whether the player is in a certain collider to duck (or lowpass filter) the sound?

The room is seamlessly in the scene's outside environment.

Any ideas on this?

sentences:
Pygame - Increase and decrease the image size I'm creating a 2D game where the player shoots cannon balls.. To give the impression of movement, i want the cannon ball to increase size untill half of the path, and then decrease untill it reach the target (just like rampart game cannon balls).

right now im doing this in every draw, but the call doesnt increases

self.CannonImg = pygame.transform.smoothscale(self.CannonImg, (10 + int(auxDistance / 10), 10 + int(auxDistance / 10)))

http://i.gyazo.com/d88a0ef419bd1014eaa180144fa876bf.png

This is how the images shows up.

But it doesnt scales smoothly, and the image is cut on the edges (with time, it starts to look a little bit transparent).

Is there any easy way to do it?

Also, i'm using images as the following. Though i've been reading, and found some people using sprites. What should I do?

self.CannonImg = pygame.image.load('Imagens/CannonBall.png')
self.surface.blit(self.CannonImg, self.Position)

Thanks!

sentences:
How to add (not blend) non-looped animation clip to looped animation with Mecanim? I have a GameObject with Animator and looped animation clip.
This animation changes X coordinate from 0 to 10 and back.

I need to add another animation to the first one that increases GameObject's scale and changes its color to red simultaneously.

After scale and color change GameObject keeps these parameters and continues to move according to the first animation clip.

The only way I managed to work it around is writing a custom script with couroutine:

IEnumerator Animate()
{
    float scaleDelta = 0.2f;
    float colorDelta = 0.02f;
    for (int i = 0; i < 50; i++)
    {
        spriteRenderer.color = new Color(
            spriteRenderer.color.r,
            spriteRenderer.color.g - colorDelta,
            spriteRenderer.color.b - colorDelta);

        transform.localScale = new Vector3(
            transform.localScale.x + scaleDelta,
            transform.localScale.y + scaleDelta,
            transform.localScale.z);

        yield return new WaitForSeconds(0.02f);
    }
}

This works for linear interpolation, but requires to write additional code and write even more code for non-linear transformations.

How can I achieve the same result with Mecanim?

Sample project link: https://drive.google.com/file/d/0B8QGeF3SuAgTU0JWNGd2RnpUU00/view?usp=sharing

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:
Game Asset Storage: Archive vs Individual files As I am in the process of creating a 3D c++ game and I was wondering what would be more beneficial when dealing with game assets with regards to storage. I have seen some games have a single asset file compressed with everything in it and other with lots of little compressed files.

If I had lots of individual files I would not need to load a large file at once and use up memory but the code would have to go about file seeking when the level loads to find all the correct files needed.

There is no file seeking needed when dealing with one large file, but again, what about all the assets not currently needed that would get loaded with the one file?

I could also have an asset file for each level, but then how do I deal with shared assets

This has been bothering me for a while so tell me what other advantages and disadvantages are there to either way of doing things.

sentences:
Blender to Unreal Material workflow....? I'm new to game development and the Unreal Engine and I have a general question.

I model my objects in Blender and import them into Unreal Engine.  My question is, is it better to create and apply your materials and textures within Blender and then import them?  Or is it better to save that work for Unreal?

Also does it matter which rendering engine I use in Blender?  I use Cycles by default.

sentences:
write to depth buffer while using multiple render targets Presently my engine is set up to use deferred shading. My pixel shader output struct is as follows:

struct GBuffer
{
float4 Depth : DEPTH0;      //depth render target
float4 Normal : COLOR0;     //normal render target
float4 Diffuse : COLOR1;    //diffuse render target
float4 Specular : COLOR2;   //specular render target
};

This works fine for flat surfaces, but I'm trying to implement relief mapping which requires me to manually write to the depth buffer to get correct silhouettes. MSDN suggests doing what I'm already doing to output to my depth render target - however, this has no impact on z culling. I think it might be because XNA uses a different depth buffer for every RenderTarget2D. How can I address these depth buffers from the pixel shader?

sentences:
On button click wait I have a button I got from google material design asset pack which has a ripple animation when pressed. I'm using the button's click option in the inspector that calls a method that switches scenes. But when I tap the button it switches the scene immediately and feels unnatural since the animation hasn't finished the button ripples animation.

I tried using co-routines. Made the button call a method in which I call a IEnumerator method (since the button can't directly call a co-routine) and then switch the scene. But that doesn't work since it starts the co-routine and switches the scene, the co-routine never pauses the code and never finishes (probably because I loaded a new scene and the object that carries the script isn't transferred).

Code example:

The method that gets called when I tap a button:

 public void OnButtonTap()
 {
     StartCoroutine(Wait(0.2f));
     SceneManager.LoadScene("OnePlayerGameIntro");
 }

The wait coroutine:

 public IEnumerator Wait(float seconds)
 {
     yield return new WaitForSeconds(seconds);
 }

sentences:
Slick2D Graphics Misaligned I'm working through a game in Slick2D and am now focusing on a lot of the graphical end. It's going pretty well other than a couple of issues with alignment. An image illustrating both of these issues here:

Firstly, the background. I have 2 Entity objects containing coordinates, velocity, and an image for the background. Both contain the same image (1600x600). For the first, x=0 and for the second, x=1600. They both move to the left at a speed of 1 pixel per frame. No matter if I make the offset smaller (like 1580), I am still left with a gap showing the background colour. I've put the two images together in photoshop and they blend together, so it's not an issue with the image. Here is some relevant code:

//in init block
Entity bg1 = new Entity("background",1600,600);
        bg1.setXVelocity(BACKGROUND_VELOCITY);
        Entity bg2 = new Entity("background",1600,600); //a second one is needed for endless background
        bg2.setXVelocity(BACKGROUND_VELOCITY);
        bg2.setX(1600);
        backgroundList = new ArrayList<Entity>();
        backgroundList.add(bg1);
        backgroundList.add(bg2);
...
//in update loop, running every frame
for (Entity bg : backgroundList){
    bg.update();
    if (bg.getX() < -1*bg.getSpriteWidth()){
        bg.setX(1600);
    }
}

In other words, what I expect my code to do is have both images move left one pixel each until the left image reaches -1600 (-1*bg.getSpriteWidth()), at which point the right image will be at 0, and with a width of 1600 the first image would be moved to 1600. This is, at least, how I expect my code to work. bg.update() calls a method which adjusts the position based on the velocity given, so it will move x backward by 1 each time for both backgrounds.

Secondly, the misaligned walls. As you can see in the image, the walls on the right are perfectly aligned. They move left together at the same velocity in the same way as above. For some reason, however, as the walls pass the mid-way mark (where the fish is), the upper wall's velocity slows for a slight second which misaligns it with the lower wall (though the velocity returns after and they stay that constant distance apart). I actually have found the code causing this (when commented out it stops), but I cannot see why it would do such a thing. The values still remain correct, but the graphical output is distorted.

for (int i = 0; i < wallList.size(); i++) {
    Wall wall = wallList.get(i);
    wall.update();
    if (wall.getX() < -1 * wall.getImageWidth()) {
        wallList.remove(i);
    }
}
...
if (wallList.get(wallList.size() - 1).getX() < WIDTH - DISTANCE_BETWEEN_WALLS) {
    createWalls();
}

...
private void createWalls() {
    Wall w1 = new Wall();
    Wall w2 = new Wall();
    int yPos = rand.nextInt(400) + 50 - w1.getImageHeight();
    w1.setLocation(WIDTH, yPos);
    w1.setXVelocity(WALL_VELOCITY);
    w1.setVisible(true);
    w2.setLocation(WIDTH, yPos + 11 * player.getImageHeight() / 3 + w2.getImageHeight());
    w2.setXVelocity(WALL_VELOCITY);
    w2.setVisible(true);
    wallList.add(w1);
    wallList.add(w2);
}

It's the wallList.remove(i); line that is causing this offset to happen. When I remove the line, the walls stay aligned as intended. Any ideas? Are these just imperfections of Slick2D? Perhaps there is a better way for me to do these things?

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:
Practical balance of "chance" video game mechanics I've been a small games developer and designer for years, and I've recently begun working on more serious design documents for bigger projects.

A common theme I'm running in to is imbalance when it comes to "chance" RPG mechanics.
Critical Strike Chance. Chance to Hit/Dodge/Miss/Parry/Block so on.
The biggest problem in modern RPG games is factoring in Haste (Attack Speed), since it compounds so aggresivly with the other base mechanics.
Obviously, the more times a player attacks, indirectly increases their "rate" of critical strikes, or hits. This creates an immense imbalance, and most of the solutions come in the form of capping haste or utilizing diminishing returns or to killing the big stat increases.

As a designer and player, I don't feel this is a healthy way to deal with the issue. It's not a "fun" solution. Recently, gamers seen Blizzard's answer to this Haste issue in Diablo3, by halfing the stat increases on most all items.

Here is a practical example:

50% chance to critically strike, with 1 attack per second = on average 0.5 critical strike per second.
50% chance to critically strike, with 2 attacks per second = on average 1 critical strike per second.

The second situation is by far favorable, rather than increasing your Critical Strike Chance alone, since not only will you see more larger numbers (or hits in terms of a miss chance mechanic) per unit of DPS, you'll also be hitting more and games with Proc Chance mechanics also benefits.
More Complex games balance such things with Internal Cooldowns and Weighing the stats against each other, but often times Haste still comes out on top as being the supremely powerful stat.

Is it practical to instead use a Rate to decide weather or not something happens vs stat weights, capping and cooldowns?
My simplified example is:
Critical Strike RATE = Crit Chance / Attacks Per Second

The result is basically a simple stat weight system. Mechanics such a proc chances still benefit from Haste, however it may be easier to change the damage output of attacks and abilities to reflect the balance.
This keeps enjoyable haste mechanics in the game, which are fun to play. It also creates more depth for slower attack builds, rather than just an ability or proc benefiting from slow weapons.

Is this a near-sighted solution? Are there working examples of games currently on the market that don't cap or punish "haste" character builds?

sentences:
Implementing Dead Reckoning in a Winsock server I'm having a little difficulty understanding how I implement Dead Reckoning in my Server-Client Winsock game.

I've been looking on the internet for a decent explanation that explains exactly:

When a message should be sent from the server to the client
How the client should act if it doesn't receive update messages, does it keep using the predicted position as the current position in order to calculate the new predicted position?

Should note I am using Linear Dead Reckoning using the following formula:

path vector = oldPosition - oldestPosition
delta time = oldTime - oldestTime
delta velocity = path vector / delta time
new delta time = current time / oldest time
new prediction = oldPosition + new delta time * delta velocity

Hope this is the correct one! :)

Should also note the connection type is UDP and that the game is played only on the server. The server sents update messages to the client.

Can anyone help please?

Thanks

sentences: What is the revenue split between me and Google in the Play store? I want to sell an app on the Google Chrome store for $0.50. How much of this will I pocket after Google's cut?

sentences:
Rotate model to face direction it's traveling in 3d with scenekit and swift - Boids implementation I am implementing a boids simulation using Swift and Scenekit. Implementing the simulation itself has been fairly straight forward however I have been unable to make my models faces the direction they are flying (at least all the time and correctly) To see the full project, you can get it here (https://github.com/kingreza/Swift-Boids)

Here is a link to a video that shows the behavior I'm getting right now:
https://www.youtube.com/watch?v=9k07wxod3yI

Here is what I am doing to rotate the models to face the direction they are going:

func rotateShipToFaceForward(ship: Ship, positionToBe: SCNVector3)
  {
    var source = (ship.node.position - ship.velocity).normalized();

    // positionToBe is ship.node.position + ship.velocity which is assigned to ship.position at the end of this call
    var destination = (positionToBe - ship.node.position).normalized();

    var dot = source.dot(destination)

    var rotAngle = GLKMathDegreesToRadians(acos(dot));
    var rotAxis = source.cross(destination);

    rotAxis.normalize();

    var q = GLKQuaternionMakeWithAngleAndAxis(Float(rotAngle), Float(rotAxis.x), Float(rotAxis.y), Float(rotAxis.z))

    ship.node.rotation = SCNVector4(x: CGFloat(q.x), y: CGFloat(q.y), z: CGFloat(q.z), w: CGFloat(q.w))

}

sentences:
Problem to match font size to the screen resolution in libgdx I'm having problems to show text on my game at same size on different screens, and I did a simple test.

This test consists to show a text fitting at the screen, I want the text has the same size independently from the screen and from DPI.

I've found this and this answer that I think should solve my problem but don't. In desktop the size is ok, but in my phone is too big.

This is the result on my Nexus 4: (768x1280, 2.0 density)

And this is the result on my MacBook: (480x800, 0.6875 density)

I'm using the Open Sans Condensed (link to google fonts)

As you can see on desktop looks good, but on the phone is so big.

Here the code of my test:

public class TextTest extends ApplicationAdapter
{
    private static final String TAG = TextTest.class.getName();
    private static final String TEXT = "Tap the screen to start";

    private OrthographicCamera camera;
    private Viewport viewport;

    private SpriteBatch batch;
    private BitmapFont font;

    @Override
    public void create ()
    {
        Gdx.app.log(TAG, "Screen size: "+Gdx.graphics.getWidth()+"x"+Gdx.graphics.getHeight());
        Gdx.app.log(TAG, "Density: "+Gdx.graphics.getDensity());

        camera = new OrthographicCamera();
        viewport = new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), camera);
        batch = new SpriteBatch();

        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/OpenSans-CondLight.ttf"));
        font = createFont(generator, 64);
        generator.dispose();
    }

    private BitmapFont createFont(FreeTypeFontGenerator generator, float dp)
    {
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();

        int fontSize = (int)(dp * Gdx.graphics.getDensity());
        parameter.size = fontSize;

        Gdx.app.log(TAG, "Font size: "+fontSize+"px");

        return generator.generateFont(parameter);
    }

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

        int w = -(int)(font.getBounds(TEXT).width / 2);

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        font.setColor(Color.BLACK);
        font.draw(batch, TEXT, w, 0);
        batch.end();
    }

    @Override
    public void resize(int width, int height)
    {
        viewport.update(width, height);
    }

    @Override
    public void dispose()
    {
        font.dispose();
        batch.dispose();
    }
}

I'm trying to find a neat way to fix this.
What I'm doing wrong? is the camera? the viewport?

UPDATE:

What I want is to keep the same margins in proportion, independently of the screen size or resolution. This image illustrates what I mean.

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 use 3D models in video games? (Copyright related) There are many gray areas in using 3D models online that may be free, creative commons with specific terms, or public domain. I notice many 3D models being sold by artists that are exact replicas of known vehicles (eg. BMW,Honda,etc.(with emblem)). I would think in this situation there will be some sort of infringement  especially if someone bought that model and used it in their video game, no matter if it was marked as royalty free. I would appreciate if someone with experience could assist in clarifying some of the following areas. Please note, this is the information I have inferred based of personal research, may not be factual, please correct me if I am wrong.

Commercial Use: Of course never sell someone's 3D model, but what part of that is considered theirs; if they made a model of an RC car, are the wheels legal to use, the chassis, engine especially if the creative textures(or meshes) are removed and all that is the mere form of the object. (Eg. if I 3D model a nail/screw; that is not considered copyright protected because it is a 'common'/'useful' object)

Free Usage: If your product is free, my assumption is that game devs could use a 3D model as long as they change textures, colors, etc. But form of the object is all for grabs.

Commercial Use & Free Use: If the product/game you are using is free, but you have advertisements bringing you revenue that may be on the side of a website or phone app and pop up every now and again; does this make it acceptable?

Thank you ahead of time!

sentences:
How should I implement hit detection netcode for AI enemies in a co-op first-person-shooter? I'm working on a FPS/sandbox game that has multiplayer but no PvP. Since the game has no PvP, I'm trying to make the networking code favor the player as much as possible.

For example, I allow the game-clients to decide whether a shot hit/missed an enemy, rather than having the game-server verify. I also allow the game-clients to decide where they are on the map -- with no verification from the server.

This opens the doors for cheaters, but in a PvE game I don't care so much.

However, I don't know how to design the enemy AI. If a player is lagging, the server doesn't know that player's real location, so how could I ensure that the player actually saw himself get attacked by an enemy (for example, a Zombie) before the server registered a hit on the player?

sentences:
Orthographic Projection Issue I have a problem with my Ortho Matrix. The engine uses the perspective projection fine but for some reason the Ortho matrix is messed up. (See screenshots below).

Can anyone understand what is happening here?

At the min I am taking the Projection matrix * Transform (Translate, rotate, scale) and passing to the Vertex shader to multiply the Vertices by it.

VIDEO Shows the same scene, rotating on the Y axis.
http://youtu.be/2feiZAIM9Y0

 void Matrix4f::InitOrthoProjTransform(float left, float right, float top, float bottom, float zNear, float zFar)
{
    m[0][0] = 2 / (right - left);
    m[0][1] = 0;
    m[0][2] = 0;
    m[0][3] = 0;

    m[1][0] = 0;
    m[1][1] = 2 / (top - bottom);
    m[1][2] = 0;
    m[1][3] = 0;

    m[2][0] = 0;
    m[2][1] = 0;
    m[2][2] = -1 / (zFar - zNear);
    m[2][3] = 0;

    m[3][0] = -(right + left) / (right - left);
    m[3][1] = -(top + bottom) / (top - bottom);
    m[3][2] = -zNear / (zFar - zNear);
    m[3][3] = 1;
}

This is what happens with Ortho Matrix:

This is the Perspective Matrix:

sentences:
Severe color banding while applying SSAO I'm trying to implement SSAO together with deferred shading. The deferred shading works just fine, and so does calculating the AO as seen in the first image below. However, taking AO into consideration when combining the light with gbuffer data produces color banding as seen in the second figure.

The third image shows a result after messing around, ending up multiplying the final color by 3, increasing the overall light intensity. The light banding is somewhat alleviated, and further increasing the light intensity reduces banding even more. This is of course not a solution but perhaps a step in the right direction.

Nevertheless it got me thinking. For the resulting texture I'm using an RGBA8_UNORM format, which gives me 256 distinct values for the various channels, right? I store the AO in a single 8 bit channel texture. The only light affecting the mesh is ambient light, and the color of the mesh is a single shade of green. Doesn't this mean that the already low bits of the render target have to store even more shades when AO is applied? This makes sense considering that increasing the precision of the AO map doesn't fix the problem, but not so much when simply increasing the intensity of the final color reduces the banding. How is this generally handled when using deferred shading? I should note that attenuating the final color with the normalized horizontal pixel value in [0,1] produces similar banding, which is perfectly vertical instead.

Can it be something that has to do with gamma correction (I don't explicitly do it myself)? Is that something one must do when using deferred shading?

Edit:

It turned out that DXUT made the back buffer SRGB (meaning that it handles gamma correction), but gamma was never corrected at the beginning, resulting in incorrect gamma handling. Correcting gamma while sampling textures resulted in clearer, but darker colors. Increasing ambient light to compensate for the darkness resulted in less banding while still having dimmer surroundings. Another bonus is that the colors don't look as washed-out as before.

It's not completely perfect however, but maybe HDR rendering can take care of that (big maybe, I don't much about it at all). Also, colors of the mesh are constant, which probably contributes. I believe having high-frequency textures makes the little banding that's left less apparent.

sentences:
JNI multidimensional array as return value I have some C++ code that I wrote to generate voxel terrain and would like to access it in JAVA. you pass it three integers; the seed and the coordinates of the chunk that it is generating (represented as int x and int y). It returns to you a 3D array of integers representing the value of each block in that chunk. In java I have:

private native static int [ ][ ][ ] genTerrain ( int seed , int x , int y );

And in the generated header I have:

#ifndef _Included_co_lambdas_koc_server_Terrain
#define _Included_co_lambdas_koc_server_Terrain
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     co_lambdas_koc_server_Terrain
 * Method:    genTerrain
 * Signature: (III)[[[I
 */
JNIEXPORT jobjectArray JNICALL Java_co_lambdas_koc_server_Terrain_genTerrain
  (JNIEnv *, jclass, jint, jint, jint);

#ifdef __cplusplus
}
#endif
#endif

And for the Class file I have tried:

JNIEXPORT jobjectArray JNICALL
Java_co_lambdas_koc_server_Terrain_genTerrain ( JNIEnv * env , jclass , jint seed , jint xCord , jint yCord )
{
    jclass intClass = env->FindClass("[I");

    jintArray x = env->NewIntArray ( 32 ) ;
    jintArray y = env->NewIntArray ( 32 ) ;
    jintArray z = env->NewIntArray ( 512 ) ;

    jobjectArray terrain = env->NewObjectArray(3, intClass, NULL);
    env->SetObjectArrayElement(terrain, 0, x);
    env->SetObjectArrayElement(terrain, 1, y);
    env->SetObjectArrayElement(terrain, 2, z);

    return ( terrain ) ;
}

Of-course this may be completely invalid as I have found little JNI documentation and haven't been able to understand much of what I have read. Could anyone show me how to generate a 3D JAVA int array (jint[][][]) in C++ through JNI?

sentences:
Where to put rigidbody on a car model ? I have a GameObject car like this:

MyCar

Body with mesh collider
Wheel Left  with wheel collider
Wheel Right with wheel collider
...   and so on

Where I have to put rigidbody ?

Thanks

sentences:
Unable to get accurate y position on terrain to spawn object all I am trying to spawn some crabbies and can't seem to get an accurate y height to spawn.
I have a terrain created with GAIA Pro 2 and have tried a few things to get an accurate y value. When trying to get the y from the terrain data I keep getting a 0 for example :
        //newCrabStartPos.y = mainIslandTerrain.terrainData.GetHeight((int) rayPosition.x, (int) rayPosition.z); //getYPositionFromRay(rayPosition) + 2.5f;

Here is my current implimintation :
   IEnumerator SpawnCrab()
{
    while(spawnedCrabbies <= waveCount)
    {
        GameObject instance = Instantiate(Resources.Load("Whakin_Crab", typeof(GameObject))) as GameObject;
        instance.transform.position = SetStartPosition();

        spawnedCrabbies += 1;
        yield return new WaitForSeconds(spawnRate);
    }
}

Vector3 SetStartPosition()
{

    float minDistanceAwayFromGoal = 10f;
    float maxDistanceAwayFromGoal = 50f;

    float xpos = Random.Range(-1f, 1f) <= 0 ? Random.Range(-minDistanceAwayFromGoal, -maxDistanceAwayFromGoal) : Random.Range(minDistanceAwayFromGoal, maxDistanceAwayFromGoal);
    float zpos =  Random.Range(-1f, 1f) <= 0 ? Random.Range(-minDistanceAwayFromGoal, -maxDistanceAwayFromGoal) : Random.Range(minDistanceAwayFromGoal, maxDistanceAwayFromGoal);
    Vector3 newpos = new Vector3(xpos, 0, zpos);

    Vector3 rayPosition = new Vector3(xpos, 100, zpos);
    Vector3 newCrabStartPos = new Vector3(newpos.x, 15, newpos.z);

    newCrabStartPos = newCrabStartPos + goal.transform.position;
    newCrabStartPos.y = getTerrainDistanceFromRay(rayPosition); // mainIslandTerrain.terrainData.GetHeight((int) xpos, (int) zpos); //getYPositionFromRay(rayPosition) + 2.5f;

    return newCrabStartPos;
}

float getTerrainDistanceFromRay(Vector3 drawFromPosition)
{
    RaycastHit hit = new RaycastHit();

    if (Physics.Raycast(drawFromPosition, Vector3.down, out hit, 100))
    {

        return (100 - hit.distance); // collider.gameObject.transform.position.y;
    }

    return 0;
}

sentences:
Z rotation matrix inverting object I'm currently creating a 3d game where I need to rotate shapes. To do se, I created a rotation matrix for each axis, X, Y and Z. X and Y are giving me expected results, but not Z who kind of "inverts the shape". I need it to rotate like it would rotate a 2d shape.

Here is the Z matrix :

zRotation.matrix[0][0] = cosf(rotationAngles.z);
zRotation.matrix[1][0] = -sinf(rotationAngles.z);
zRotation.matrix[0][1] = sinf(rotationAngles.z);
zRotation.matrix[1][1] = cosf(rotationAngles.z);
zRotation.matrix[2][2] = 1;

Here is what it looks like : https://imgur.com/a/3YR4Nlc

PS : The game have an isometric perspective.

EDIT : Here is how I do matrix * vector

vec3 operator *(vec3 operand){
    //multiply vector by matrix

    vec3 result = vec3((operand.x * matrix[0][0]) + (operand.x * matrix[1][0]) + (operand.x * matrix[2][0]) + (operand.x * matrix[3][0]), (operand.y * matrix[0][1]) + (operand.y * matrix[1][1]) + (operand.y * matrix[2][1]) + (operand.y * matrix[3][1]), (operand.z * matrix[0][2]) + (operand.z * matrix[1][2]) + (operand.z * matrix[2][2]) + (operand.z * matrix[3][2]));
    return result;
}

(Fourth element is always 0)

sentences:
Are browser games still profitable? Back in middle school I would play games like bowman, kitten cannon, sniper assassin, etc. On sites like addictinggames.com, or crazymonkeygames.com.

I know these games would have ads run on them, which I assume was profitable for the developer. Especially titles like those that probably have 8 figure play-stats across the internet.

I was wondering if anyone has any experience with this market, and could provide some insight as to how it is doing now, and what is used to make these games: Is it financially worth developing a browser game? Do I have to use flash to be accepted on these sites?

Back then they were all flash games, but there has been a large uprising of javascript game engines since then (which I am much more familiar with.) But I'm not sure if that's something these sites would accept.

sentences: What is a texture atlas? I've heard about this concept, but what is it?

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:
SceneGraph in Entity Component System, Transformations I'm recently learning entity component systems, and started implementing it into my test engine, however I'm having an issue integrating this with scene-graph, which I'm trying for the first time.

All my entities have a TransformComponent which transforms the entity in the scene, with it's position, rotation and scale. This is how I'm doing this:

transform.reset();

Entity entity = this.entity;

while (entity != null)
{
    if (!lockScale) transform.scale(entity.scale);
    if (!lockRotation) transform.rotate(Vector3.AXIS_Z, entity.rotation);
    if (!lockPosition) transform.translate(entity.position);

    entity = entity.parent;
}

The TransformComponent is present for all the entities, and hence it cannot be removed from the entity, I restrict it.

Now I have another component, called as CollisionComponent which contains the polygon, and a callback when a collision occurs, along with a collision tag. It updates the polygon position upon update:

polygon.setPosition(entity.position);
polygon.setRotation(entity.rotation);
polygon.setScale(entity.scale);

This is working for all the entities that are in the scene root, they are displayed at their correct positions, and also the collisions are working. The issue starts with the entity's children if they are present.

I have attached a child entity with position set to (0, 50) whose coordinate system is local to the parent entity system. But here, the graphics work correctly, on rotating the parent, the children rotate too due to the transform matrix, but the polygon stays at the local position.

The solution that I'm thinking now is to make the entity positions in global coordinate system, even if they are in the children of an entity, and have the transform change correctly even when the parent moves.

How can I do that?

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:
Build displays black screen with static Something really odd happens when I'm trying to load a scene.

It is supposed to look like this (it also has to show the next scene after loading):

What is going on?

sentences:
How do I handle game lag due to background apps I'm developing a game using libgdx and have noticed on several occasions that other background apps running can cause lag in my game - especially when those apps are being updated in the background. I'm talking serious lag like from 50-60 fps down to under 10 fps while the other app installs.

How should I handle this very noticeable lag?

Thanks!

sentences:
mouseButton.y and mouseButton.x is -858993460 for every event except MouseButtonPressed Using SFML, every event type will produce a large negative value for x and y of -858993460.

if (menuEvent.type == sf::Event::GainedFocus
    || menuEvent.type == sf::Event::LostFocus
    || menuEvent.type == sf::Event::KeyPressed
    || menuEvent.type == sf::Event::KeyReleased
    || menuEvent.type == sf::Event::MouseEntered
    || menuEvent.type == sf::Event::MouseMoved
    || menuEvent.type == sf::Event::MouseButtonReleased
    || menuEvent.type == sf::Event::MouseButtonPressed) {

    return HandleFindExit(menuEvent.mouseButton.x, menuEvent.mouseButton.y);
    // Except for when menuEvent.type is MouseButtonReleased
    // or MouseButtonPressed x and y will be -858993460
}

I am wondering if this is an intended result or am I attempting to use these events incorrectly?

It seems to me there is a use case for knowing the position of the mouse cursor on MouseMoved, for example so you can have a button change to a different sprite as if you are hovering over it.

sentences:
rotating 3D object around the center I have object moving from A to B on x-axis and there is no translation of object apart from it. Now, while moving, i want to rotate it around y-axis and the motion should change accordingly, i mean if i rotate it right when moving from -x to +x axis, it should move towards near plane. I have variable in gltranslatef which is modified in the loop after that i have glscalef to scale whole object which is made of hierarchical structure. Now i tried following code to achieve the expected result but its not working properly

   glTranslatef(move, 0, 0);

// If I comment these 3 lines, it does not affect the output
     glTranslatef(-move, 0, 0);
glRotatef(rotate,0,1,0);
glTranslatef(move, 0, 0);

glScalef(0.2, 0.2, 1.0);

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:
accelerated curved bounce I'm trying to make a simple pong clone and want the ball to curve when the racket was moving on hit.
To test out curves I removed all the rackets and just have a ball bouncing around in a rectangle, curving in the positive Y direction.

I tried simulating gravity on the Y axis, but the outcome is weird.
The bigger the rectangle, the faster the velocity gets over time.
In a small rectangle, I lose velocity and the ball slows down.

I do the following:
On each tick I check if I should do a curve, if so, then I increase the curve force and add it to the Y velocity (curves only appear on Y)

if (this->DoCurve)
{
    //check if we don't exceed the maximum curve force
    if (this->CurveForce < this->CurveMaxForce)
        this->CurveForce += this->CurveIncrease*delta;

    //add curve force to Y
    this->Velocity += FVector(0.f, this->CurveForce, 0.f) * delta;
}
//move object to new location
SetLocation(this->CurrentLocation + this->Velocity * delta);

When I hit a wall, I want the curve to stop until I hit the next wall.

//if we are already curving, stop it and reset
if (this->DoCurve)
{
    //subtract the force we added to make it move normal again
    this->Velocity -= FVector(0.f, this->CurveForce, 0.f);
    this->CurveForce = 0;
}

this->DoCurve = !this->DoCurve;

//reflect
FVector ReflectedVelocity = (-2 * FVector::DotProduct(this->Velocity, Hit.Normal) * Hit.Normal + this->Velocity);
//ignore Z axis
ReflectedVelocity.Z = 0.f;

//ReflectedVelocity.Normalize(); // this makes the ball stuck in a wall
this->Velocity = ReflectedVelocity;

Basically I have no idea what I'm doing.

What I want:
When the ball hits a racket and it is moving I want the ball to move in a curve fast first, then slow down, like the racket gave it a boost.

My approach is very flawed, what would be the correct way?

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:
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:
How to display image in second layer in Cocos2d I am very new at Cocos2d and is testing to displaying an image over the "Hello World" text on a second layer and need help to get it work. I guess it is some basic stuff here and appreciate any tips etc. with this.

I know that if i put the display-code (myLayer1) in the "init" it work or do the call [self goHere] from the "init" in myLayer1 it works but i want to call the "goHere" directly.

I have the following code:

HelloWorld.m:

#import "HelloWorldLayer.h"
#import "myLayer1.h"

// HelloWorldLayer implementation
@implementation HelloWorldLayer

+(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];

// 'layer' is an autorelease object.
HelloWorldLayer *layer = [HelloWorldLayer node];
myLayer1 *layer1 = [myLayer1 node];

// add layer as a child to scene
[scene addChild: layer];
[scene addChild: layer1];

// return the scene
return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];

    myLayer1 *a1 = [myLayer1 new];
    [a1 goHere];
    [myLayer1 release];

}
return self;
}

myLayer1.m:

#import "myLayer1.h"

@implementation myLayer1

-(void)goHere {

NSLog(@">>>>goHere<<<<");

CGSize size = [[CCDirector sharedDirector] winSize];

CCSprite *vv = [CCSprite spriteWithFile:@"hand.png"];
vv.position =  ccp( size.width /2 , size.height/2 );
[self addChild:vv z:3];
}

-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

}

return self;
}

@end

sentences:
Why does unity obj import flip my x coordinate? When I import my wavefront obj model into unity and then draw lines over it with the same coordinates in the obj file, the x coordinate is negated.

I don't see any option in the importer that might be doing that.  And I'm using the same localToWorldMatrix and the same coordinate data in the .obj file.  Hmmm

GL.PushMatrix();
GL.MultMatrix(transform.localToWorldMatrix);

CreateMaterial();
lineMaterial.SetPass(0);

GL.Color(new Color(0, 1, 0));
GL.Begin(GL.LINES);

GL.Vertex(p1);
GL.Vertex(p2);

GL.Vertex(p2);
GL.Vertex(p3);

//...

GL.End();
GL.PopMatrix();

sentences:
Video game entity storage and structures I finally have all the working input/output of a game engine.

However, I'd like to be able to put an amount of about 2000 shots being simulated in a region, total. I have done other games where all the data was stored in a linear array and iterated every turn, and referenced by index number.
This method seems to be fast enough, grants random access instantaneously and I'd say it "just works". However, inserting a new element requires searching for an empty space, and iterating over the "inactive" shots.

Considering the amount of max shots, what would be the best approach to this? Am I thinking too much about this, perhaps, and the array is a good enough system?

The engine works in C99. Shots will be destroyed when out of "practical" range and collisions will be done around the player rather than the entire working map. The game is real-time action style so updating needs to be quick, and shots might need to be accessed by position, which is another weakness of the array approach (unless I add that information to "slices" of the main map, I guess).

To summarize. What would be the best data structure in terms of insertion speed, allowing random access and iterating without gaps? A name, if it exists,  would be enough.

sentences:
How to avoid gimbal lock I am trying to write code with rotates an object.

I implemented it as:

Rotation about X-axis is given by the amount of change in y coordinates of a mouse and
Rotation about Y-axis is given by the amount of change in x coordinates of a mouse.

This method is simple and work fine until on the the axis coincides with Z-axis, in short a gimble lock occurs.

How can I utilize the rotation arount Z-axis to avoid gimbal lock.

sentences:
How should I add level-specific gameplay code to a level? What are best practices to add gameplay, to specific level? I have some event types, and my game logic now looks like. OnEnterSensor is virtual and is different for each level(01,02 ...). Game type platformer and what about other types of games and their logic description.

    virtual bool OnEnterSensor( Entity* sensor, EventArgs* args )
    {
      if (str_equal(sensor->Name(), "button_sensor"))
      {
        door_closed = false;//door_closed internal level variable
      }
      else if (str_equal(sensor->Name(), "door_sensor")) ........ and so on.
    }

Is it good practice to use such kind of code. I'm not sure about this long IF construction when level logic is complex then it becomes large, and hard to read.
Will be glad to hear any recommendations (maybe some in-level events) and other methods to describe level gameplay.

sentences:
How do I draw 2D textures with Direct3D 11.1? I'm running into trouble trying to figure out the best way to draw textures to the screen using Directx 11.1 (for Metro apps).

In XNA, I used SpriteBatch. Is there something partially comperable?

In the Win8 SDK examples, they used WIC and Bitmap, although it suggests that that is not the best way to draw 2D graphics with the best performance.

sentences:
Games Dev Work Experience for Teenager I have a teenage son that wants to work in games development and design when he is older. We've been to several conferences that explain the importance of experience when looking for a job. Also being a IT developer myself that often interviews new hires, I know how critical experience is. So we've been looking to try and find him some work at Games Dev companies in London for several weeks over the Summer holidays but haven't got anywhere.

My son is very smart and is expected to get 8+ GCSEs of a high grade (7+ or A/Bs in old marks), he plans go on to get A levels and then study Computer Science at University. He has some programming experience in Python. All he wants is some work experience, if he ends up just running errands and making coffee that would be fine as long as he also gets involved in some way with the games development process. He also doesn't really expect to get paid (although that would be a bonus).

I've approached several companies with details and a CV but haven't had a single response back from them. This seems strange to me as apart from a little of their time these companies don't seem to have anything to lose here.

So my question is, is there something stopping games companies hiring teens in this kind of situation? Any other pertinent advice would be welcome.

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:
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:
Instantly snap into specific directions? In my 2d setup, I want the player to constantly move in a specific direction at a set speed. It's similar to "Snake" in that you can only move in four directions and you can't stop your movement.

Right now, the way I do this is by having a char variable "direction", which can either be u, d, l, r (take a guess what those stand for). Based on those letters, I use GetComponent().MovePosition and increase/decrease the position on the x or y axis.

Is there a better way to do this? I would prefer if I could just enter the degree (0, 90, 180, 270) to make the player move in the right direction. I tried AddForce but I couldn't get it to work.

Side note: it's important for me that I can set the direction without player input, as there are some objects that force the player into a different direction.

Edit: As the tag would suggest, I'm looking for a Unity specific answer, as I'm not sure which function would best suit my needs.

sentences:
2D collision resolution: works on each axis individually, but not with both combined My collision detection method is solid and detects box to box collision every time. Then comes the resolve part which I'm struggling with quite a bit. It works perfectly when I'm manipulating the x-axis and y-axis of the player (tile) but only happens to work when I move on any given axis individually. If I try to move on both axis then the whole thing breaks down and starts acting weird.

I'm trying to implement gravity. And so I keep a constant down force on my player tile. This is when I realized that when I'm applying force on both axis (because gravity is constantly applying force on the y-axis) and moving the player tile right or left on the same time my collision resolve method breaks down.

My collision is working great while moving along each axis individually. Here's the result:

How can I approach collision resolution in order to avoid this type of result?

I'm currently predicting the position the player will be at, then I'm checking every single collideable tile at that position. If I detect a collision, I move the player back along the axis the collision was detected in.

This is my current code with collisions working well on a single axis at a time:

void Tile_Player::Move(double delta, G3::Tile_Map *map)
{
    int xvel = (this->xDirection * (G3::TILE_STEP * (delta/1000)));
    int yvel = (this->yDirection * (G3::TILE_STEP * (delta/1000)));

    G3::xy_pos predictedPos;
    predictedPos.x = this->tile_location.x; predictedPos.y = this->tile_location.y;

    predictedPos.x += xvel;
    predictedPos.y += yvel;

    bool collision_status = false;

    for (int i=0; i< map->GetTotalTileCount(); i++)
    {
        G3::Tile *tempTile = map->GetTileAt(i);
        if (this != tempTile)
        {
            bool coll_bool;
            coll_bool =  this->CheckCollision(predictedPos, tempTile->GetTilePos());
            if (coll_bool)
            {
                //check collision on the left
                if (this->xDirection == -1)
                {
                    predictedPos.x = tempTile->GetTilePos().x+G3::TILE_SIZE+0.1;
                }
                //check collision on the right
                if (this->xDirection == 1)
                {
                    predictedPos.x = tempTile->GetTilePos().x-G3::TILE_SIZE-0.1;
                }
                //check collision on bottom(ground)
                if (this->yDirection == -1)
                {
                    predictedPos.y = tempTile->GetTilePos().y+G3::TILE_SIZE+0.1;
                }
                //check collision on top
                if (this->yDirection == 1)
                {
                    predictedPos.y = tempTile->GetTilePos().y-G3::TILE_SIZE-0.1;
                }

            }
        }
    }

    this->tile_location.x = predictedPos.x;
    this->tile_location.y = predictedPos.y;

    this->xDirection = 0;
    this->yDirection = 0;
}

sentences:
How to automatically destroy a gameobject after a method or block of code In Unity I frequently find myself doing this in C#:

GameObject myObject = new GameObject();
try{
// do something with that object
}
finally{
   Destroy(myObject);
}

A good example is creating a temporary pivot point for another object.  I create the object, parent whatever object I want to rotate, do the rotation, then destroy the object.  It's in a finally block so in case anything goes wrong it still destroys the object.

Does Unity have any elegant way to do this?  Writing this all the time is tedious, and it's easy to forget the Destroy method at the end.

sentences:
Detecting tile with height in isometric game I'm trying to create an isometric tile-based game (for iPhone) and I'm having trouble with height in tiles.

What I currently do (without heights) is apply some mathematic transformations to my 2D-matrix (which represent the tiles) so that I know where in the screen (x,y) should I place the isometric tile. Then, when the user clicks somewhere in the screen, I take that values and pass them through a function (kind of f^-1) to get which tile it belongs to.

This works perfectly. My problem is: imagine that I want some tiles to have a different height from others. In order to draw the tile itself its pretty simple, since the z-coordinate has no transformation in the isometric approach used in games (z'=z). BUT what if I want to calculate the tile coordinate (defined by X-tile and Y-tile) from the touch coordinates (x,y)? Any guess?

sentences:
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:
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: How to make a scrolling background I'm making a Shooter game like "1943" and "Jamestown". I am Using Visual Basic 2010. I was wondering how I would make the  background scroll up to simulate moving forward. I would also like it to scroll slightly to the left and right when the player reaches the sides of the screen. Finally, how would I make this efficient? I was thinking about using a animated GIF or making a looping BitMap. Please could someone help me out?

sentences:
Creating a 2D texture array for depth view Following my question here, I decided to create an 2D texture array for all of my depth screen texture so that I can use them for shadows for all my lights.

I'm having an issue setting it up, I'm getting an E_INVALIDARG when I try to create it.

This code is what I use to create the 2D array Texture

D3D11_TEXTURE2D_DESC sTexDesc;
sTexDesc.Width = this->Width;  // 1024
sTexDesc.Height = this->Height;// 1024
sTexDesc.MipLevels = 0;
sTexDesc.ArraySize = arraySize; // The value is 25 here
sTexDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
sTexDesc.SampleDesc.Count = 1;
sTexDesc.SampleDesc.Quality = 0;
sTexDesc.Usage = D3D11_USAGE_DEFAULT;
sTexDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
sTexDesc.CPUAccessFlags = 0;
sTexDesc.MiscFlags = 0;

HRESULT hr = pd3dDevice->CreateTexture2D(&sTexDesc, NULL, &(this->shadowTexture));
if(FAILED(hr))
    throw std::exception("Failed at creating texture array for shadows");

This is the code that I use to create the depth view

D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
ZeroMemory(&dsvDesc, sizeof(dsvDesc));
dsvDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
dsvDesc.Texture2DArray.ArraySize = arraySize; // The value is 25 here
dsvDesc.Texture2DArray.FirstArraySlice = index;
HRESULT hr = pd3dDevice->CreateDepthStencilView(shadowTexture, &dsvDesc, &pDepthMapDSV);
if(FAILED(hr)){ throw std::exception("Error creating 2d texture for shadow"); }

CreateDepthStencilView will return OK for the first texture but it  crashes for the second.

What have I done wrong here?

sentences:
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:
Can I use SpriteBatch when drawing sprites on a rotating 3D plane I'd like to have my plane of sprites rotate similarly as in this game (YouTube Video). So basically, everything is drawn in 2D, but the 2D plane is then "rotated in 3D" (or camera is rotated). When rotated, sprites further away should look like they are further away.

Question:

Can I use SpriteBatch with this? IIRC SpriteBatch uses Orthographic view matrix, so probably not? If I can, how? If not, how would you suggest I draw the sprites?

PS. I am really bad at explaining problems so feel free to ask any questions.

sentences:
What are the advantages and challenges of using Haxe over ActionScript 3? I read this, and I also see that using FlashDevelop you can make an Adobe Air project with Haxe and compile to exe.

I begun to wonder from a game making perspective:

Are there any additional advantages in performance when using Haxe instead of AS3 for games development (for the web)?

sentences:
Euler adjustments between two quaternions I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to get there?

In this example, x=right, y=up, z=forward

I've tried getting the delta between the two quaternions and unwrapping that into Eulers and moving the x, y, z the amount of the unwraped Vector3f, but that does not seem to give the correct values. Current implementation in pseudo code:

var dQuat = Quaternion.Inverse(prevRotation) * target.rotation;
dChange = dQuat.eulerAngles;

This approach gives me only positive changes. If I rotate forward on x, I get positive lower numbers and if I rotate backwards on x, I get larger positive numbers.

I'm looking for, in order to get to q2 from q1, rotate n degrees along your x, y, z...

Thanks in advance for any help!

sentences:
How to organize data transfer between the client and the game server? I have a game like minecraft, I can run, set and delete blocks. The world consists of a limited set of chunks. I want to write a server for it with the help of a library called boost asio. I need help with the following: how to properly transfer customers data chunks along with data from other characters. Example of a situation: a player enters a server, on which we assume there are already a couple of players. It needs to transfer information about chunks (just a three-dimensional array containing the type of the block) because he came in and did not know anything about the server world and of course the data of other players (their nickname, position, gaze direction). Do I need to integrate it all into one structure? Like this:

struct Data {
 std::string name;
 glm::vec3 position;
 glm::vec2 eye_dir;
 bool updateChunk;
 glm::vec3 chunkNumber;
 uint chunk[16*16*16];
}

That is, the client sends the numbers of the chunks that it needs to update and when the server sends it a packet, then it looks: if you send chunkUpdate = true, then it takes an array and puts the data into the client. Is this approach correct at all? And another question: communication between such packages between the client and the server is strictly a game of “throw the ball to each other in turn”?

P.S. I apologize in advance if there is not enough information or I have explained the essence incomprehensibly, I will be glad if you ask a clarifying question in this case.

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:
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: 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:
Cannot create EAttachmentRule variable in a Blueprint struct I'm trying to add a EAttachmentRule variable in a struct but the enum doesn't appear in the list of available types

I managed to create a variable in a BP by dragging the pin from an AttachActorToComponent node and promoting it to a variable. But I can't do the same thing to create a variable in a struct

sentences:
Help understanding the order of vector subtraction I always struggle with intuitively figuring out the order of subtraction in multiple situations for example

The difference between the current mouse coordinates and the last frame's coordinates

The direction an object is to the camera position

etc.

I know that A - B = A + (-B) ..my problem is figuring out which one is A and which one is B ..and those were just simple examples

Is there any hard and fast rules for this? Or is it supposed to be intuitive and obvious (which is what I'm afraid of)?

I have similar problems with figuring out which order to take the cross-product of two vectors too, depending on the scenario

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:
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:
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:
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:
Unreal Engine - How can I add blur effect at my Camera in iOS I have requirement to add blur effect at my camera in specific point , it work just fine in pc but when I deploy in my phone it remove the effect

According to documentation

  To turn off Depth of Field, set "Scale" to zero, this is suggested as
  default to improve performance.

  Mobile Depth of Field is currently not compatible with PC. There is no
  way to currently visualize on the desktop version what the mobile
  settings will look like except using an unsupported "-FeatureLevelES2"
  launch flag when starting the editor, or using the "Mobile Preview"
  option from the "Play" button drop down menu.

But when I run in my mobile this effect disappear

any one know the reason

here is my Camera setting

sentences:
How do I prevent floating and jittering when on the ground and using spherical gravity? TL;DR: My ship floats and jitters when it lands on a sphere.

To elaborate on the title:
I'm experimenting with a 3D space game. I have created a sphere, which in turn has a larger sphere overlapping it, within which, gravity will take place. However, once my player's ship (currently using an arrowhead) lands on the planet, it doesn't actually make contact with the surface of the sphere, and then the ship begins to rotate erratically and jitter. Code below.

private void OnTriggerStay(Collider other)
{
    if (other.CompareTag("SoI"))
    {
    inSoI = true;
    }
}

This trigger checks to see if the ship is in the larger overlapping sphere. I have another identical block for OnTriggerExit which sets inSoI to false. I also have a OnCollisionEnter which sets another variable, landed to true, and a OnCollisionExit which sets it to false.

private void FixedUpdate()
{
    if (inSoI && !landed)
        {
            gravityVector = (planet.transform.position - transform.position);
            rb.AddForce(gravityVector.normalized * planetrb.mass * rb.mass / gravityVector.sqrMagnitude);
        }
}

Simply, if in the larger sphere, then accelerate towards the planet. I tried disabling gravity if in contact with the sphere. It removed a lot of the jitter, however it still floats, and it still rotates side to side. The sphere by the way, is the standard Unity sphere, scaled 10000x in every axis.
I don't need code (though it would help), any solution is fine, even if it means abandoning the project.

sentences:
How do Nethack frontends work? I have been trying to learn about GUI frontends for Nethack, but I have been unable to determine how do they get the game information (map, inventory, player info, enemy locations, etc) from Nethack? As in, is there some API that allows these frontends to query these information? If so, how are they used?
I have looked up everywhere but unable to find any documentation that describes how to do so.

sentences:
Shader - Directional Lights Depth Is there a way to retrieve the deph from directional lights ? I can access the _ShadowMapTexture but this is not the depth.

I found how to access the shadow map of, I think, every light type by using the defines such as SHADOW_ATTENUATION(a) or directly the _ShadowMapTexture, everything is located in the built-in shaders.

But I am wondering how could I access the depth of those lighting type. I found a way to access it for the spot light this way : _ShadowCoord.z which gives the depth scaled with _ShadowCoord.w, which could be considered to the far plane, but am I right ?

How could I do the same for the other light types such as directional or point lights ? For the moment I am stuck with directional lights, any clues ?

Because if I try to access the depth for a directional light by using _ShadowCoord.z it seems that it's more related to the depth view and not the light. Here I am, totally stuck with this directional lights.

sentences:
Is a game like Subway Surfers suited for 2D or 3D? I imaginated a mobile game and now I'm getting doubts as to whether its possible for my idea to be developed in 2D. Here's a crude illustration of the game scene:

It's pretty much like Subway Surfers. The game objective is simply a kid going along the street and buying particular fruits/vegetables. Can the sprites be changed in perspective?

As a side note, there's a reason for my particular love towards 2D. That's because:

I don't want to employ someone for 3D designing, I can manage 2D myself.
I want to finish developing this game quickly.

sentences:
Bodies going through the walls of a box I have a game where the user controls a box to collect falling balls. However, very often the balls will just fall through the walls of the box and be flung away. What could be causing the balls to do that?

Here is a video of the issue.

Here's how I'm creating the box and the balls:

//BOX CODE

private Body pbox() {

    pbdef = new BodyDef();
    PolygonShape shape=new PolygonShape();
    pbdef.type=BodyType.StaticBody;
    pbdef.position.set(Gdx.graphics.getWidth()/2,100);
    Body body1=world.createBody(pbdef);
    FixtureDef fdef = new FixtureDef();
    shape.setAsBox(30, 5);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    //
    shape.setAsBox(5, 20,new Vector2(-25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    fdef = new FixtureDef();
    //
    shape.setAsBox(5, 20,new Vector2(25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    body1.setGravityScale(-3);
    body1.setBullet(true);
    return body1;

}
//BALLS CODE

private void spawner() {

    bbdef= new BodyDef();
    FixtureDef fdef = new FixtureDef();
    CircleShape circle = new CircleShape();
    bbdef.type=BodyType.DynamicBody;
    bbdef.position.set(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight());
    bbody = world.createBody(bbdef);
    circle.setRadius(5);
    fdef.shape=circle;
    fdef.density=0;
    fdef.friction=0;
    bbody.createFixture(fdef).setUserData("ball");
    bbody.setBullet(true);

}

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:
How much detail should I provide in reference material to potential contract composers? I'm not very good with music, so when the time comes I'll need help from a composer for my game. I'm unsure of how to actually work with one.

Despite my lack of musical understanding, I know what I like. I might listen to some music and think "Hey, this kind of music would be awesome to have in the epic chase scene near the end of the game, where our heroes just barely manage to escape!"

When I go to hire a composer to make music for my game, how much detail and reference music should I provide? Should I provide lots of long descriptions of what I'm after, lots of links to music that I think fits the theme? Or should I just let the composer play the silent game and work it out themselves?

sentences:
Other procedural material generators for Unity? In the new version of Unity 3.4, unity announced that they would now support procedural materials (which is awesome, by the way). While I was researching it, I found this in the manual:

  Allegorithmic's Substance Designer can be used to create Procedural Materials, but there are other applications (3D modeling apps, for example) that incorporate the Substance technology and work just as well with Unity.

I don't have Allegorithmic's substance designer and don't plan on buying it soon. What other applications or 3D modeling apps can make procedural materials that work in Unity?

Edit: I found that Allegorithmic has a program called Player. But it is on Windows only. I'm on mac.

sentences:
How to set the hair_mesh to follow the animation? How to set the hair mesh to follow the animation?
I am trying this.
.cpp
Hair = CreateDefaultSubobject<USkeletalMeshComponent>("Hair");
    Hair->SetupAttachment(GetMesh());
    Hair->AttachToComponent(MyCharacter::GetMesh(), FAttachmentTransformRules::KeepWorldTransform, TEXT("head"));

.h
UPROPERTY(EditAnywhere, Category = "Components")
    class USkeletalMeshComponent* Hair;

I have attached the hair mesh to the Head socket but the hair mesh is not following the animation.
The hair mesh is called Hair_Mesh and has been attached in the editor while the Hair skeletal mesh component is already sets to UPROPERTY(EditAnywhere, Category = "Components")

sentences:
How to display a text in the impact point position In my 3d game, i would like to display a text 'near' the impact point of a bullet.
I think i'm having problems setting properly text position.
This is my code.
The script is attached to an object Canvas.
position is the Vector3 impact position.

GameObject obj = new GameObject ();
Text _text = obj.AddComponent<Text> ();

_text.transform.position = position;
_text.text = message;
_text.fontSize = startSize;
_text.color = color;

I'm pretty sure i've to convert from a world space to a 'user interface' space.
Thanks

sentences:
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:
How can I prevent a buggy old version of my game from posting scores to the Gamecenter Leaderboards? I found that an older version of my game has a bug that causes some crazy scores to be posted to the leaderboard. I can delete these scores by editing the acceptable range in iTunesConnect and my latest patch fixes the scores from being submitted again, but that doesn't stop users who haven't updated from posting these bad scores.

Is there a solution? Is there a way to require a minimum app version for gamecenter achievements? Is there a way to delete that leaderboard and simply make a new one for the next version?

The only solution I can think of is to limit the acceptable score range to keep most of the bad scores out, but this could potentially kill a really good legitimate score and still let in lots of bad ones.

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:
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 to create 2D textures from footage? I am new to game development but I heard, that already in the 80s with Prince of Persia, indie developers where capable to create textures from footage. I am developing a game and so far I get an illustrator to draw things I need.

I'd like to explore the opportunity of taking some video footage of complex movements and create some basic textures from it (as I guess Jordan Mechner did), so to then "feed" them to a more digital artist to draw "over" them in order to make them cartoonish and coherent with the style of the pre-existing in the game.

Anyone of you could also explore the answer for mobile game development? Any crazy mobile developer that did so already for a 2D game? :)

sentences:
Time reverse mechanism in games I am wondering about how time manipulation mechanisms in games are typically designed. I am particularly interested in time reversing (sort of like in the latest SSX or Prince of Persia).

The game is a 2D top down shooter.

The mechanism I am trying to design/implement has the following requirements:

1) Actions of entities apart from the player character are completely deterministic.

The action an entity takes is based on the frames progressed since level start and/or the    position of the player on the screen
Entities are spawned at set time during the level.

2) Time reverse works by reversing back in realtime.

Player actions are also reversed, it replays in reverse what the player performed. Player has no control during reverse time.
There is no limit on the time spent reversing, we can reverse all the way to the beginning of the level if wanted.

As an example:

Frames 0-50:
Player moves foward 20 units over this time
Enemy 1 spawns at frame 20
Enemy 1 moves left 10 units during frame 30-40
Player shoots bullet at frame 45
Bullet travels 5 foward (45-50) and kills Enemy 1 at frame 50

Reversing this would play back in realtime:
Player moves backwards 20 units during this time
Enemy 1 revives at frame 50
Bullet reappears at frame 50
Bullet moves backwards 5 and disappears (50-45)
Enemy moves left 10 (40-30)
Enemy removed at frame 20.

Just looking at movement I had some ideas about how to achieve this, I thought of having a interface that changed behavior for when time was advancing or reversing. Instead of doing something like this:

void update()
{
    movement += new Vector(0,5);
}

I would do something like this:

public interface movement()
{
    public void move(Vector v, Entity e);
}

public class advance() implements movement
{
    public void move(Vector v, Entity e)
    {
            e.location += v;
    }
}

public class reverse() implements movement
{
    public void move(Vector v, Entity e)
    {
        e.location -= v;
    }
}

public void update()
{
    moveLogic.move(new vector(5,0));
}

However I realised this would not be optimal performance wise and would quickly become complicated for more advance actions (such as smooth movement along curved paths e.t.c.).

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 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:
Trouble With Quaternions and orbital camera: UPDATED:
I have been trying to implement a Orbital Camera of sorts in a engine I am currently doing in Unity3D, the issue being I can't seem to do the correct rotation no matter what.

This is what it is needed:

Rotate on Y and X axis via the mouse, but the Y and X axis are not Vector.up or Vector.right
they are given by the current Slope of  the Target I am orbiting around.

I don't get how I can make it idependent of the character rotation, but at the same time dependent

This sorta works, but some loops have issues,  check the video below for a taste of whats wrong

var forward = Vector3.forward; //Vector3.Cross(ViewTarget.transform.up, transform.right);
        //Apply the rotation
        var rot = Quaternion.AngleAxis(CurrentHorizontalLook, ViewTarget.transform.up);
        var rot2 = Quaternion.AngleAxis(CurrentVerticalLook, transform.right) ;
        Debug.DrawRay(ViewTarget.transform.position, Vector3.right * 5, Color.yellow, 0, false);
        Debug.DrawRay(ViewTarget.transform.position, ViewTarget.transform.up * 5, Color.blue, 0, false);
        var offset = forward * 5;
        transform.rotation =  rot * rot2;
        transform.position = ViewTarget.transform.position + EyeHeight + transform.rotation*-offset;
        transform.LookAt(ViewTarget.transform.position, ViewTarget.transform.up);

EDIT : Maybe this image will help.

Black is the Up Vector, Red is the rotation on X Axis, Green is rotation on Y Axis.
The trick here is it being idependent of the right and forward of the Target object , only the Up vector used to align the camera.

Edit: I have "something" that is somewhat related to what I want, but still missing one thing.

I got the camera to rotate correctly on the target Y axis, but it doesn't align to the ground plane at all.

Convention :
Y = UP
Z =  Forward
X = Right

var rot = Quaternion.AngleAxis(CurrentHorizontalLook, ViewTarget.transform.up);
        transform.rotation = rot ;
        var rot2 = Quaternion.AngleAxis(CurrentVerticalLook, transform.right) ;

  transform.rotation =  rot * rot2;

    var offset = forward * 5;

This is what I have , the issue now being that if the character is on a 90 degree wall the camera should be moving around the character on the same plane as the wall, but in my case it looks in a top down manner. If instead of WorldForward I used TargetForward it moves in the correct plane, but then when the character changes direction  the camera shifts too.

I think a better explanation of what I want is this : I want the camera to rotate on the X,Z Plane of the character, and I want to be able to tilt it up or down in the Y,Z Plane.
If you check the video I posted when Sonic goes in loop I want the camera to do sorta the same thing.

Youtube Showing current Camera issue

sentences:
Realistically, how long would it take for 1 person to create a 2D isometric RPG? Something I have been looking into for a while is developing my own PC game. I'm very into CRPGs like Fallout 1 and 2, UnderRail, Wasteland 2, etc. I have long desired to create my own game like this, with an emphasis on plot.

While I don't have any experience in development, I use several (mostly proprietary) programming languages in my job, and have a natural aptitude for learning syntax etc. I have taken a few tutorials in Unity and Godot but generally I prefer to feel my way through software myself (tutorials rarely give you enough 'why and how') or reverse engineer an existing product.

I plan for the game to be quite minimal on the asset front, at least to begin with. I've done some basic 3d modelling and mapping (a long time ago, in Source engine - I built my school!)

My question is, if I decide to dedicate the time to this, how long does it generally take for one person to create a game like UnderRail or Darklands? I'd like to know if it's a doable project or a laughable pipe dream for an inexperienced one-man enthusiast!

sentences:
Process of writing to the depth texture In openGL, let's say I output one single point from the vertex shader with this value

gl_Position = vec4(2.0,3.0,5.0,7.0);

what exact math operations happen to "z" after leaving the vertex shader?
what will be the end value of that depth texel?

sentences:
Take a screenshot from camera problem I use script below to take a screenshot from camera. It's working fine. However, when I take a screenshot again (pressing k multiple times), its old image is not clear from the memory and it keep drawing over same image over and over again. If object is moving while taking screenshot multiple times, image I will get all frame combine into one image with every frame in the same image. What should I do to fix this problem?

using UnityEngine;
using System.Collections;

public class HiResScreenShots : MonoBehaviour {
    public int resWidth = 2550;
    public int resHeight = 3300;

    private bool takeHiResShot = true;

    public static string ScreenShotName(int width, int height) {
        return string.Format("{0}/screenshots/screen_{1}x{2}_{3}.png",
                             Application.dataPath,
                             width, height,
                             System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
    }

    public void TakeHiResShot() {
        takeHiResShot = true;
    }

    void LateUpdate() {
        takeHiResShot |= Input.GetKeyDown("k");
        if (takeHiResShot) {
            RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
            camera.targetTexture = rt;
            Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.ARGB32, false);
            camera.Render();
            RenderTexture.active = rt;
            screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
            camera.targetTexture = null;
            RenderTexture.active = null; // JC: added to avoid errors
            Destroy(rt);
            byte[] bytes = screenShot.EncodeToPNG();
            string filename = ScreenShotName(resWidth, resHeight);
            System.IO.File.WriteAllBytes(filename, bytes);
            Debug.Log(string.Format("Took screenshot to: {0}", filename));
            takeHiResShot = false;
            Debug.Log("Capture!!");
        }
    }
}

sentences:
Are mobile devices a viable platform/market for "User-Generated Content"-based games? I intend to do a lot of research into this, but I know this community has a knack for delivering hard-to-find gems of knowledge, so I figured I'd ask here first.

 Preamble (My Situation)

I'm currently looking into the viability of becoming an independent games developer by selling games for the mobile platforms (iOS and WP7 in particular). However, as I currently work full-time, all development has to be done in my own time (weekends, after-work, early mornings). Thus, I need to be careful with how I spend my time (I also have a social life to maintain). Basically, if I can release something that makes enough money, relative to my time investment into it, to be able to support myself with, I'll seriously consider taking the plunge.

The Question

One of the ideas I've had is for a game in a similar vein to Little Big Planet or Kodu, where the focus is on user-generated content, with the game itself providing a set of tools, samples and access to a 'market' for user-content.

What I envision is a simple set of drag and drop tools for placing content in levels, customising template assets, etc, and node-based editors for behaviour and logic (Think along the lines of Kismet, for those of you familiar with the Unreal Engine).

As a programmer, I've looked into this enough to know it is possible from a technical standpoint. However, what I need to know is if it is viable in terms of userbase. Is there a market for user-generated content games on the various mobile platforms?

Just to clarify, I'm not asking how to do it, I'm asking if it's worthwhile to do it.

EDIT
To reword the question and make it more answerable (given the lack of existing examples), what are relevant design considerations typically associated with the psychology of the mobile gamer that would influence the success of a game based on user-generated content?

EDIT 2
Microsoft have just released an app for WP7 called TouchDevelop that allows users to write executable scripts using a simplified tile-based interface. It's been downloaded a lot and garnered positive reviews. So, that's as strong of an indicator of community interest as I figure I'm ever going to get.

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:
Using unity Rigidbody 2D gravity, how to add to velocity? I am creating a top-down game, and have an object I want to create a small bouncy illusion for. Since I dont have anything to collide with I'll have to do it with Scripts.

Without Unity I would probably do something like:

function fall ()
{
    this.vertical_speed = this.vertical_speed + GRAVITY;
    if (this.vertical_speed > TERMINAL_VELOCITY)
    {
        this.vertical_speed = TERMINAL_VELOCITY;
    }
    this.vertical_position = this.vertical_position - this.vertical_speed;
}

However in Unity we have the Rigidbody 2D, so I want to somehow use that for this.

if I set rigidBody.velocity = new Vector2(1, 0) * speed * delta;, it gets a constant speed, and ignores gravity. How can I add gravity?

i.e: I want to create a curve like:

sentences:
How to find 1/3 and 2/3 of the distance between two given points? I know how to find the middle of two given points:

var midpoint = (pointA + pointB)/2;

where pointA and pointB are Vector2

I thought that

var thirdBtnPoints = (pointA + pointB)/3;
var twoThirdBtnPoints = 2*(pointA + pointB)/3;

should give me 1/3 and 2/3 between the two points but it doesn't. I guess this might be more of a math question though, but how can I find 1/3 and 2/3 of the distance between two given points?

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:
How do I create an installer for my XNA demo? I have a demo coded in XNA3.1 using VS2008. I'd really love to be able to send this to anyone with a PC and let them install and run it without requiring them to have VS installed or the .Net framework etc.

I thought it would be the publish option but I'm a little confused by it. Can anyone shed some light on the matter?

Thank you in advance.

sentences:
optimal pixel-read back strategy I need to render certain scenes and read the whole image back in main memory for further processing which is not suitable for rewriting into shaders of CUDA, and saving to disk. I've search for this and it seems that most video cards will accelerate the rendering but the read-back will be very slow. After a bit of research i only found this card mentioning "Hardware-Accelerated Pixel Read-Back"

The other approach would do software rendering and the read-back problem doesn't exist, but then the rendering performance will be bad.

Likely, i will have to implement both in order to be able to find the optimal trade-off, but my question is about what other alternative can i have hardware-wise; i understand Quadro is for modelling and designer market segment, which is precisely the client target of this application, Does this means that i'm not likely to find better pixel read-back performance in other video card lines? i.e: Tesla or Fermi, which don't even have video outputs btw

sentences:
Box2d topdown racing game - killing "residual" forces I'm making top-down race game in GM:S with Box2D, the car is controled in unusual way: player sets direction and engine's speed, and the car uses them: turns to the desired direction and reaches speed. But the question is about the "residual" speed after the turn. Here is what I mean:

I make rotation by applying torque and move with applying force. I don't have tyres, it's just one plain object.
So how can I get rid of this momentum? I'm working in GM:S, but I'd like to hear any solution, I can adapt it easily.

Movement code:

var ad = angle_difference(phy_rotation, desiredDir);
physics_apply_torque((angleTorque) * -sign(ad)); // rotate the car

dx = lengthdir_x(spd, -phy_rotation);
dy = lengthdir_y(spd, -phy_rotation);

physics_apply_force(phy_position_x, phy_position_y, dx, dy);  // move the car

sentences:
Pong collision detection I am making Pong... again. Anyway, the collision detection. In the past, I had gotten it working, but it used a bunch of globals, and other nasty things. This time, I am trying it where I have a Paddle, Ball, and CollisionManager class. Basically, the the paddle and ball have move functions, which moves as they would normally, including potentially invalid places.Then, the CollisionManager's sole function would check for and resolve and collisions. I hope to keep this structure.

That works fine for ball->top/bottom collisions, and in keeping the paddles in bounds. However, the ball->paddle collision, or its inverse, I am having trouble with it. This is because there are three situations that can happen, which I have badly illustrated in Paint:

The ball can hit the paddle as normal, it can hit the top or bottom of the paddles, and finally, the paddle can move into the ball. My question is, how to handle all these cases correctly. Note that this would be, more or less, how to determine when each case happens - how they are handled is not part of my question.

I had thought of a potential solution - essentially retracing, pixel by pixel, the steps of the ball, untill it no longer collides with a paddle. Then, determine the case and do things. However, this seems a bit buggy, with corner cases and such, and additionally, failed in determining when the paddle runs into the ball.

Any ideas how to do this correctly?

sentences:
Direction from the camera to the light source I'm currently writing a game using OpenGL and GLSL. For the shader I need the direction from the current camera to the light source. The lightsource is given by lightSource.position as a uniform as well as the ModelviewMatrix (mat4).

The task is

  TODO: compute the vectors from the current vertex towards the camera and towards the light source

I need to fill two varyings with those information, but I'm not sure how to compute them.
In addition I've the following information:

#version 330
layout(location = 0) in vec3 vertex;
layout(location = 1) in vec3 vertex_normal;

sentences:
What variables change the number of lightmaps I need to know what changes the lightmap size.

For example what changes the lightmap from being 2*1024*1024 to 4*1024*1024 - having larger textures or having larger quads (having more models) or having more lights or does it depends on something else?

sentences:
How can I avoid updating my Unity projects when I have two versions installed? I currently have two versions of Unity on my Windows computer. I would like to not update my projects to avoid compatibility issues like I had in the past.

Installation in another folder goes just fine, but when I try to open Unity, it says that another Project is already opened and that if I want to continue I must update it. If I close this window, Unity aborts as well.

Is there a way to avoid this behaviour?

sentences:
Optimizing Texture Text Rendering? I have an implementation currently that stores each letter as it's own separate texture, usually only a couple pixels in width and height. So this has some problems as i am unable to do a batch render, i can only batch render the same characters. I am stuck with this format, all i can do is try and process it into something better at runtime. I was thinking of creating a single larger texture from all the little ones instead.

What algorithm can i use to sort the small images into a larger one?

How big can this texture get without losing pixel precision with single floating point precision UV mapping (texture width/height normalization into percent 0.0 to 1.0)?

sentences:
Saving Information in Byte[] sorry for the unhelpful title. I'm trying to understand how to convert information to bytes so that I can save it using Google's Saved Games feature that comes with Play Services, as explained here.

https://codelabs.developers.google.com/codelabs/playservices_unity/index.html?index=..%2F..%2Findex#9

I've mostly copy-pasted the code but it's not really working out for me.

However, my initial question is about bytes. So it looks like Google stores game information in bytes[] . The example only shows a single int being converted to byte and then being saved. What if I wanted to save multiple integers in Google's Saved Game services? I'm not exactly sure what this byte array is in the first place and how everything can be converted to bytes. If anybody has any good resources or examples, it would be much appreciated! Thank you

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:
Using enemy, player and gun position can player shoot enemy? I was asked this question in an interview last week and I've been thinking about it but I'm unsure how to solve it.
You are on a spaceship and want to shoot the enemy space ship. You have the enemy position, your position, your gun position, the radius of the enemy and the radius of your gun. Assume the normal is facing forward.
So basically the function is like canHit(Vector3 enemyPosition, Vector3 playerPosition, Vector3 gunPosition, float enemyRadius, float bulletRadius)
I figured I would have to subtract the vectors and get the dot product to check if the enemy was in front of the player. Then I thought maybe I should cross the enemy and the gun to see if they intersect and if they don't check if the radius of the bullet plus the gun position is would reach the enemy. I know this is incorrect, so I'm curious how to go about solving this problem.

sentences:
OpenGL behaviour depending on the graphics card? This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc...

I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly.

I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

Edit #1: The graphics cards are NVIDIA Quadro GX7300 (in which my code works OK) and NVIDIA GeForce GTX 560 Ti (in which the results changes / fails)

Edit #2 I have commented out a lot of my code, and apparently the strange behaviour has nothing to do with texture handling. A simple chessboard-like floor looks differents. The diagonal white lines did not appear using the old NVIDIA Quadro GX7300. Any guess what OpenGL related thing could be causing this?

Figure 1

Edit #3 I have now fixed the issue commented on the previous edit, regarding the weird unwanted diagonal thin whit lines. As I commented below, I had to remove the glEnable(GL_POLYGON_SMOOTH);, which was affecting the NVIDIA GeForce GTX 560 for whatever reason (probably due to reasons explained by mh01 in his answer.

However, I am still facing a "texture blending" problem when using the NVIDIA GeForce GTX 560. I have a 3D model that is being textured using a shader that blends 8 different images to compute the right texture, depending on where the camera is at that particular moment. The resulting texture is then a combination of different images, and ideally they were blended nicely, using a set of blending weights computed each time the camera moves. The blending weights are still well computed, but the resulting texture is wrong. I am guessing that the GL_BLEND function is somehow behaving different, but I have checked it in both graphics cards and it is actually the same one. I have no idea what else can be involved in getting this wrong result:

As you can imagine, the black line is where two original textures are being blended in order to get a seamless texture. If I use the exact some code and a NVIDIA Quadro GX730, the shader works as expected. However, when I use the NVIDIA GeForce GTX 560, the texture blending goes wrong. Any guess?

This is the GLSL shader I am using.

sentences:
C# - Separating Overlapping Rectangles I'm trying to separate an arbitrary number of randomly sized rectangles, while still keeping them snapped to the grid, and somewhat packed together nicely.  The goal is to start with something like this...

And end with something like this..

I've managed to get initial generation of random rectangles drawn in, that's the easy part;
I've also done some reading up on separation algorithms but I can never seem to get things just right.  They always spread out a bit (slowly, meaning lots of iterations) then just jitter around with massive gaps between them.

My (simple) separation function can be seen here, but it's very possible I'm doing something terribly wrong, or going about it all wrong!
Here's also the current code in action (click/anykey to run the separation function)

Is there perhaps a better way to achieve this desired result, or something?
Any help or suggestions would be great!

sentences:
Sorting array of points in clockwise order Is there such an algorithm to sort an array of 2D points in clockwise order?
I'm specifically dealing with right triangle in my case so only 3 points.

However I'm interested in knowing if such an algorithm exist, if not what is a simple way to return the 3 points of my triangle in clockwise order?

Edit: I am trying to compute the points clockwise relative to the centroid of the polygon, which  is convex.

Update:
This is the implementation I ended up using based on the chosen answer, it's not performance critical and only happens once in a while so it works out.

ArrayList<PVector> pointList = new ArrayList<PVector>();
pointList.add(A);
pointList.add(B);
pointList.add(C);
Collections.sort( pointList, new TriangleVectorComparator(origin) );

return pointList;

// Comparator
package triangleeditor;

import java.util.Comparator;

import processing.core.PVector;

public class TriangleVectorComparator implements Comparator<PVector>  {
    private PVector M;
    public TriangleVectorComparator(PVector origin) {
        M = origin;
    }

    public int compare(PVector o1, PVector o2) {
        double angle1 = Math.atan2(o1.y - M.y, o1.x - M.x);
        double angle2 = Math.atan2(o2.y - M.y, o2.x - M.x);

        //For counter-clockwise, just reverse the signs of the return values
        if(angle1 < angle2) return 1;
        else if (angle2 < angle1) return -1;
        return 0;
    }

}

sentences: How do games like Minecraft generate entire worlds from a seed number? I want to generate a completely unique world with biomes (like what Minecraft and similar games do). I don't understand how they generate these entire worlds from a single "seed" number. Can someone provide a basic overview of the technique?

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:
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:
Unity3D and Texture2D. GetPixel returns wrong values I'm trying to use Texture2D set and get colors, but I encountered a strange behavior.
Here's the code to reproduce it:

Texture2D tex = new Texture2D(2,2, TextureFormat.RGBA32 ,false);

Color col = new Color(1.0f,0.5f,1.0f,0.5f); //col values: 1.00, 0.500, 1.00, 0.500
tex.setPixel(0,0,col);
Color colDebug = tex.getPixel(0,0);  //col values: 1.00, 0.502, 1.00, 0.502

The Color retrieved with getPixel is different from the Color set before.
I initially thought about float approximation, but when inspectin col the value stored are correct, so can't be that reason.

It sounds weird even a sampling error because the getValue returns a value really similar that not seems to be interpolated with anything else.
Anyway I tried even to add these lines after building the texture but nothing change:

this.tex.filterMode = FilterMode.Point;
this.tex.wrapMode = TextureWrapMode.Clamp;
this.tex.anisoLevel = 1;

What's my mistake? What am I missing?

In addition to that. I'm using tex to store Rect coordinates returned from atlas generation, in order to be able of retriving the correct uv coordinate of an atlas inside a shader. Is this a right way to go?

sentences:
How can I make a 32-bit render target with a 16-bit alpha channel in Direct3D? I want to create a render target that is 32-bit, with 16 bits each for alpha and luminance. The closest surface formats I can find in the DirectX SDK are:

D3DFMT_A8L8    // 16-bit, 8 bits each for alpha and luminance.
D3DFMT_G16R16F // 32-bit float, 16 bits for red and 16 bits for green.

But I don't think either of these will work, since D3DFMT_A8L8 doesn't have the precision and D3DFMT_G16R16F doesn't have an alpha channel (I need a separate blend state for alpha).

How can I create a render target that allows a separate blend state for luminance and alpha, with 16-bit precision on each channel, that doesn't exceed 32-bits per pixel?

sentences:
Which Type of Collision Detection should I use? So over the past week I've been scratching my head over SAT (Separating Axis Theorem). I know how it works, but can't seem to get the C# code right. There's always one face or edge that's letting my player through an obstacle.

So I wanted to know if maybe I'm taking the hard way around, and I don't need SAT for what I want to achieve.

My Game Involves:
- 3D Cubes which will sometimes be on an angle (not a multiple of 90)
 - Not too many cubes (so I don't need my Collision Detection to be too inexpensive) - OBB collisions

So what is the best option for me collision-wise? If SAT is my go to option, what would it look like in C#?

EDIT

My Sat code:

var n1 = (bb1.BCK_TOP_LFTCorner - bb1.BCK_BTM_LFTCorner).Normalized();
var n2 = (bb1.BCK_BTM_LFTCorner - bb1.BCK_BTM_RGTCorner).Normalized();
var n3 = (bb1.FRT_BTM_LFTCorner - bb1.BCK_BTM_LFTCorner).Normalized();
var n4 = (bb2.BCK_TOP_LFTCorner - bb2.BCK_BTM_LFTCorner).Normalized();
var n5 = (bb2.BCK_BTM_LFTCorner - bb2.BCK_BTM_RGTCorner).Normalized();
var n6 = (bb2.FRT_BTM_LFTCorner - bb2.BCK_BTM_LFTCorner).Normalized();
var norms = new List<Vector3>() {
     new Vector3(-n1.X, n1.Y,n1.Z),
     new Vector3(n2.X, -n2.Y,n2.Z),
     new Vector3(n3.X, n3.Y,-n3.Z),
     new Vector3(-n4.X, n4.Y,n4.Z),
     new Vector3(n5.X, -n5.Y,n5.Z),
     new Vector3(n6.X, n6.Y,-n6.Z),
};
norms = bb2.Normals;
float max1 = 0;
float min1 = 0;
float max2 = 0;
float min2 = 0;
for (int a = 0; a < norms.Count; ++a)
{
    //Global.Min/Global.Max are simply Math.Min/Math.Max for an array of parameters
    max1 = Global.Max(Vector3.Dot(bb1.Corners[0], norms[a]),
            Vector3.Dot(bb1.Corners[1], norms[a]),
            Vector3.Dot(bb1.Corners[2], norms[a]),
            Vector3.Dot(bb1.Corners[3], norms[a]),
            Vector3.Dot(bb1.Corners[4], norms[a]),
            Vector3.Dot(bb1.Corners[5], norms[a]));
        min1 = Global.Min(Vector3.Dot(bb1.Corners[0], norms[a]),
            Vector3.Dot(bb1.Corners[1], norms[a]),
            Vector3.Dot(bb1.Corners[2], norms[a]),
            Vector3.Dot(bb1.Corners[3], norms[a]),
            Vector3.Dot(bb1.Corners[4], norms[a]),
            Vector3.Dot(bb1.Corners[5], norms[a]));
        max2 = Global.Max(Vector3.Dot(bb2.Corners[0], norms[a]),
            Vector3.Dot(bb2.Corners[1], norms[a]),
            Vector3.Dot(bb2.Corners[2], norms[a]),
            Vector3.Dot(bb2.Corners[3], norms[a]),
            Vector3.Dot(bb2.Corners[4], norms[a]),
            Vector3.Dot(bb2.Corners[5], norms[a]));
        min2 = Global.Min(Vector3.Dot(bb2.Corners[0], norms[a]),
            Vector3.Dot(bb2.Corners[1], norms[a]),
            Vector3.Dot(bb2.Corners[2], norms[a]),
            Vector3.Dot(bb2.Corners[3], norms[a]),
            Vector3.Dot(bb2.Corners[4], norms[a]),
            Vector3.Dot(bb2.Corners[5], norms[a]));

    }
if (max1 < min2)
    return Vector3.Zero;
    // Get nearest face normal to player so that we can add it to player's velocity.
    var rl = new List<Vector3>() {bb2.Front,
        bb2.Back,
        bb2.Top,
        bb2.Bottom,
        bb2.Left,
        bb2.Right };
    var r = rl.IndexOf(rl.OrderBy(c => c.Distance(bb1.Center)).First());
    var returnval = bb2.Normals[r];
    return returnval;

sentences:
10 weapon types, 2 proficiencies, rock-paper-scissors relationship? I want to make a game where there's a total of 10 general weapon types. I want any given character to be able to be proficient with 2 of the weapon types. Looking at the fact that 10 is an even number, a perfect rock-paper-scissors relationship wouldn't be possible. "C(10,2)=45" however is an odd number, which should be workable into a rock-paper-scissors system.

Since the final number of total weapon pairings is an odd number, I reckon there should be an intuitive and systemically organized way to get a rock-paper-scissors relationship to exist where each weapon pairing is at an advantage against 22 of the other pairings while being at a disadvantage against the remaining 22 pairings. Assuming the 10 weapon types that a character can be proficient with 2 of are labeled A through to J, how should I organize it?

P.S.: A smaller example that runs into the same situation would be "C(6,2)=15"; weapons labeled A through F; if that's more convenient for explanation purposes. Please let me know if this question belongs under different tags or even over on the Mathematics section of SE instead of here; I wasn't sure where to put this question.

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:
How can I provide attribute extensibility in a component-based entity system? This question and its answers move against utilizing an entity component system where the component itself is just a generic class with an dynamic container for the attributes/properties  of the component.

Some definitions for this thread:

Entity = ID + collection of components
Component = Container (std::map<attribute_name, attribute_value>) of attributes/properties, such as health, age, name, gender, etc.

I understand and am aware of the drawbacks (no compile-time type safety, added overhead of looking up values from the container). Nonetheless, I currently am working on/with such a system, with the following argument, which I would now like to put to the test: data-driven design.

If all the attributes of the component are in a dynamic container, it is very easy (in fact possible at all) to add new ones later on, outside of the source code. So you can easily script new attributes later on. And dumping/saving the state of the component is a piece of cake.

Compared to the proposal in the above mentioned thread, I also have an own class for each component, to implement some basic behavior and helper methods directly in them (but those also need to look up their values from the container).

Example:

My component base class has a map for all the attributes/property:

typedef std::map<std::string, PropertyBase*> PropertyMap;

So an actual component looks something like the following. In the constructor I populate the attributes I want the component to have, by adding them to the map. Later I can read and update them if needed, but always with a performance penalty, since I first have to find them in the std::map.

class Person : public ClonableComponent<Person>
{
public:
    Person(ComponentFactory* const pFactory, ComponentType type, ComponentID id, GameEntity* const pEntity)
    : ClonableComponent(pFactory, type, id, pEntity)
{
    // General
    addProperty(new Property<int>("age", PROP_INT, 0));
    addProperty(new Property<String>("gender", PROP_STRING, "unknown"));
    addProperty(new Property<String>("currentLocation", PROP_STRING, "unknown"));

    // Feelings
    addProperty(new Property<bool>("isTired", PROP_BOOL, false));
    addProperty(new Property<bool>("isHungry", PROP_BOOL, false));
    addProperty(new Property<bool>("isThursty", PROP_BOOL, false));
}

void enterLocation(GameEntity* pLocGE)
{
    if(pLocGE->hasComponent(COMP_TYPE_LOCATION))
    {
        updateProperty("currentLocation", pLocGE->getName());
        updateProperty("casinoEnteredDateTime", (int)std::time(0));
    }
}

void leaveLocation()
{
    updateProperty("currentLocation", std::string("unknown"));
}
};

However, that thread made me think, and I am now doubtful that my approach will work well in the long run (maintenance, scaling and performance wise) and I am therefore considering moving to an directly typed approach with no look-up overhead. At the same time I don't want to loose that data-driven extendability.

I thought of a hybrid approach: Keep all known variables as actual language variables but also add a container (std::map) for scripted/data-driven variables. Therefore I'd know that my internal access is very fast and only the later added scripted extension would have the slow look-up and the other mentioned penalties.

Question:
What do you use / would propose as an approach for a data-driven ECS in terms of attribute storage/handling? How do you keep it extendable? Would you recommend such a hybrid approach (real variables internally, container for new, external definitions)?

sentences:
Running state in Behavior Trees What happens, in a behavior tree, when a priority node chooses another branch over a running branch?

Small example:

Priority 1: Fight
    Sequence:
        -Enemy near?
        -Fight!
Priority 2: Move
    Sequence:
        -Is there a hole?
        -Jump!
    Run 5m!

Now in the first iteration there is no enemy, but a hole, so the action Jump! gets executed. It's a rather lengthy animation so it returns running.

For what should happen in the next iteration I found kind of contradictory statements. According to this answer the priority node always begins at the first priority disregarding if another priority is running. In this article however while the examples follow the same scheme, the explanation also mentions that it's possible to lock the tree in the Running state until it's finished.

If the tree is locked in the Running behavior, the character can't react until he walked all the way to his walking target, so this can't be the right interpretation.

If always the first priority gets checked again, the character can react to enemies while he's running (he stops and fights) - that's the desired behavior. If however he's in the air jumping, he can not just stop and fight, he has to land first, so this time I can't choose priority Fight over Move!

How should I handle those cases? Am I even approaching it the right way?

sentences:
glGenBuffers fails with 0x0, win7, glew I try to run a simple renderer on my win7 machine but it dies at the first glGenBuffers call.
The computer has an Intel HD3000 card, with the latest driver (OpenGL 3.0 support).
I use glew 1.10 (self compiled with mingw).
The linker command is:

g++ -LC:\Program Files\Microsoft SDKs\Windows\v7.1\Lib -Lc:\opt\glew-1.10.0\lib -LC:\opt\SDL-1.2.15\lib\x86 -o pysicsdemo.exe src\main.o src\Box.o -lOpenGL32 -lglu32 -lSDLmain -lSDL -lglew32.dll

And the result is 0x0. Most probably glew can't load the extension, but why?

sentences:
RGB to xyY color space conversion and luminance The luminance calculated by following GLSL functions (fragment shaders - tonemap) has different value:

float GetLuminance (vec3 rgb)
{
     return (0.2126 * rgb.x) + (0.7152 * rgb.y) + (0.0722 * rgb.z);
}

vec3 RGB2xyY (vec3 rgb)
{
     const mat3 RGB2XYZ = mat3(0.4124, 0.3576, 0.1805,
                               0.2126, 0.7152, 0.0722,
                               0.0193, 0.1192, 0.9505);
    vec3 XYZ = RGB2XYZ * rgb;

    return vec3(XYZ.x / (XYZ.x + XYZ.y + XYZ.z),
                XYZ.y / (XYZ.x + XYZ.y + XYZ.z),
                XYZ.y);
}

I used a glm library to calculate an example result. For glm::vec3(2.0f, 3.0f, 8.0f) GetLuminance returns 3.1484. RGB2xyY returns glm::vec3 which z component is equal 3.8144. What is wrong ?

sentences:
Money in different platforms So first of all, let me start off by saying that I am not in this to make money as of right now. I'm a novice - however I would like (in the frture) to be able to earn some extra cash on the side with my games.

I have several ideas for what my first game could be and then I started considering the platform on which my game should run.

So I started thinking

iOS & Android mobile devices already have a built-in store that everyone uses. This means that even if my game doesn't get a lot of attention (and doesn't reach the highest position on the market) everyone would still be able to find my game on the same platform.

How is this possible with games made for web or even desktop?

Are the chances of making money of web and desktop as big as on the mobile market?

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:
How can I easily assign an array in the inspector? If you make a public array class member in Unity, you can individually assign objects to the array in the inspector menu. It looks like this:

However, this is cumbersome if you you want to assign the same array to many objects. It's easy to do this programatically, but I'd rather not hard-define the array in code - it makes moving/renaming the objects harder.

If I want to pass the same array to multiple game objects, how can I do it more efficiently than dragging each individual element into the inspector?

sentences:
How do I debug Azure Spatial Anchors with Unity on an Android device? I've been building an AR app that's already been a pain to debug, because instant preview refuses to work over wifi and usb debugging causes the phone camera to not display on the phone itself. Now I'm at the point where I can integrate Azure Spatial Anchors and I cannot seem to be able to be able to play in the editor. I receive the message:

DllNotFoundException: azurespatialanchorsndk
Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession..ctor () (at Assets/AzureSpatialAnchorsPlugin/Plugins/Common/AzureSpatialAnchorsBridge.cs:6864)
SpatialAnchors.GetCloudManager () (at Assets/Scripts/SpatialAnchors.cs:60)
tester.Start () (at Assets/tester.cs:18)

sentences:
Missing Reference exception when accessing a GameObject in Unity I have been making a C# script that attacks the player in Unity. However, with the following code I got the following error message:

  "The object of type 'GameObject' has been destroyed but you are still trying to access it.

Here is my code:

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

public class attackPlayer : MonoBehaviour {

    GameObject Enemy;
    GameObject Player;

    void Start ()
    {
        Enemy =  GameObject.FindWithTag ("Enemy");
        Player = GameObject.FindWithTag ("Player");
    }

    void Update ()
    {
        var heading = Enemy.transform.position.x - Player.transform.position.x;
        if (heading > 0.0f && heading < 5.0f)
        {
            Explode ();
        }
    }

    void Explode()
    {
        var exp = GetComponent <ParticleSystem>();
        exp.Play ();

        Destroy (gameObject,exp.main.duration);
        Destroy(Player);
    }

    void OnCollisionEnter2D (Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            Explode ();
        }
    }
}

sentences:
Unity: OnCollisionEnter not called I created a sphere object, added a rigidbody component (no kinematics) and attached a script to it like this:

function Update () {
}

function OnCollisionEnter(collision : Collision) {
    Debug.Log("OnCollisionEnter");
}

I then created a cube under the ball, added a box collider component with no trigger of course.

Then, when I run the game, the ball falls down onto the cube, but nothing happens. The OnCollisionEnter function isn't called.

What should I do?

sentences:
What will happen with PlayerPrefs data after updating the app? I'm using PlayerPrefs (Unity3D, on Android).

If a user updates my application via the Google Play store, what happens to the data I've stored in PlayerPrefs?

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:
XNA 4.0 - Car game dashboard lights I'm making a car game and doing the dashboard part. I'm trying to do the dashboard lights, i've did this changing the dashboard texture, overwriting the texture with the light image over it, example:

Texture2D dashboardTexture;
Texture2D parkingBrakeLightTexture;
Model carModel;

//when the light needs to turn on:

PutTextureOverDashboardTexture(parkingBrakeLightTexture);

//on Draw method I change the texture of dashboard mesh:

effect.Texture = dashboardTexture;
effect...

This is alright, but the lights will suffer influence from the external light if I EnableDefaultLighting() in the effect, then the dashboard lights will almost don't appear depending on what direction the car is, and of course that should not happen.
So how can I make the lights of dashboard appear? I need to use another alternative? Or can I still utilize this method?

sentences:
Confusion about Rotation matrices from Euler Angles I am trying to learn more about Euler Angles so as to help myself in understanding how I can control my camera better in the game.

I came across the following formula that converts Euler Angles to rotation matrices:

In the equation, I could see that the first matrix from the left is the rotation matrix about x-axis, the second is about y-axis and the third is about z-axis.

From my understanding about ordinary matrix transformations, the later transformation is always applied to the right hand side. And if I'm right about this, then the above equation should have a rotation order starting from rotating about z-axis, y-axis, then finally x-axis.

But, from the symbols  it seems that the rotation order start rotating about x-axis, then y-axis, then finally z-axis. What should the actual order of the rotation be?

Also, I am confuse about if the input vector, in this case, would be a row vector on the left, or a column vector on the right?

sentences:
How can i make all the scene dark/night and spot a light on specific place/area in the scene? I want to light the area of the 5 spheres. All the rest to be dark.
What i have in the Hierarchy is Directional Light.
I'm not sure if i need other lights objects and what to do to make it dark/night environment and how to spot a light on the specific area.

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:
Xna menu navigation with controller I have a menu that you can navigate with the keyboard, but I also want it so you can navigate it with the controller thumb sticks. But my problem is that if you push down or up on the thumb sticks it will just fly through the menu. To fix problem if it was a keyboard you would just do: prevKeyState.IsKeyUp(Keys.Down).
So I was wondering if there anything like this for the controller thumb sticks?

I'm not sure if I'm doing something wrong but it still flies through the menu.

 private enum GamePadStates
    {
        None,
        GoingDown,
        GoingUp
    }

    GamePadStates CurrentGamePad, PreviousGamePad = GamePadStates.None;
     public void Update(GameTime gameTime)
    {
        keyState = Keyboard.GetState();
        gamePadState = GamePad.GetState(PlayerIndex.One);
        PreviousGamePad = CurrentGamePad;

        if (gamePadState.ThumbSticks.Left.Y > 0.1)
            CurrentGamePad = GamePadStates.GoingUp;
        else if (gamePadState.ThumbSticks.Left.Y < -0.1)
            CurrentGamePad = GamePadStates.GoingDown;
        else
            CurrentGamePad = GamePadStates.None;

        if (keyState.IsKeyDown(Keys.Down) && prevKeyState.IsKeyUp(Keys.Down) ||
             CurrentGamePad == GamePadStates.GoingDown && PreviousGamePad != GamePadStates.GoingUp)
        {
            if (selected < (buttonList.Count - 1))
            {
                selected++;
            }
        }

        if (keyState.IsKeyDown(Keys.Up) && prevKeyState.IsKeyUp(Keys.Up) ||
            CurrentGamePad == GamePadStates.GoingUp && PreviousGamePad != GamePadStates.GoingDown)
        {
            if (selected > 0)
            {
                selected--;
            }
        }

sentences:
Fast, accurate 2d collision I'm working on a 2d topdown shooter, and now need to go beyond my basic rectangle bounding box collision system.

I have large levels with many different sprites, all of which are different shapes and sizes. The textures for the sprites are all square png files with transparent backgrounds, so I also need a way to only have a collision when the player walks into the coloured part of the texture, and not the transparent background.

I plan to handle collision as follows:

Check if any sprites are in range of the player
Do a rect bounding box collision test
Do an accurate collision (Where I need help)

I don't mind advanced techniques, as I want to get this right with all my requirements in mind, but I'm not sure how to approach this. What techniques or even libraries to try. I know that I will probably need to create and store some kind of shape that accurately represents each sprite minus the transparent background.

I've read that per pixel is slow, so given my large levels and number of objects I
don't think that would be suitable. I've also looked at Box2d, but haven't been able to find much documentation, or any examples of how to get it up and running with SFML.

sentences:
Click to move - get NavMesh layer I'm using NavMesh, and NavMeshAgent for my character movement and Pathfinding.

I made a testing NavMesh with 2 area layers:

0 = Walkable
3 = Water.

In have a  click to move script, and i need to get the ID of the NavMesh Area where the player clicked. I tried to get the ID of the layer where the player clicked, using NavMeshHit.mask but is always resulting 0, even if I click where the NavMesh area ID is 3.

From Unity documentation:

  Mask specifying NavMesh area at point of hit.

Script:

RaycastHit hit;
NavMeshHit nHit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if(Physics.Raycast(ray, out hit)){
    bool hasHit = NavMesh.Raycast (this.transform.position, ray.direction, out nHit, NavMesh.AllAreas);
    if (hasHit) {
        Debug.Log ("Area ID: " + nHit.mask);
        targetPosition = hit.point;
    }
}

sentences:
Unity NavMesh Step Issue I have a scene in my game that takes place in a subway. I created a NavMesh so I can easily have the enemies chase the player. There seems to be a problem though as them enemies sometimes have a problem crossing the track. When looking at the NavMesh it appears that some parts of the track stick out above the NavMesh and I believe this is the reason the enemies sometimes have problems crossing the track. I have tried changing the step height up and down but that doesn't seem to change anything. What can I do to make the NavMesh cover the track in all spots so enemies can cross the track anywhere? Or is there maybe something else causing the enemies to not be able to cross the track in some spots?

EDIT

The rails and the ground are the same object and it is set as Navigation Static. Do they need to be 2 different objects for this to work?

sentences:
Creating the nodes for path finding during run time - more like path making and more I'm making my 1st game. I'm using javascript as I currently want to learn to make games without needing to learn another language but this is more of a general game dev question.

It's a 2d turn-based tile/grid game. You can check it here http://www.patinterotest.tk/
it creates a movable area when you hover a player and it implements the A* algorithm for moving the player.

The Problem: I want to make the 'dynamic movable area creation' already implement a limited number of steps for a player.

The Questions:

What is a good way to do this?
Is there another algorithm to use for this?
The A* algorithm needs a start and destination, with what I want to do I don't have a destination
Or should I just limit the iteration of the A* algorithm to the steps variable?

sentences:
Can't figure out projection transform I'm trying to fugure out all the spaces transformations, and currently have some inconsistency I can't understand. I'm working on a 2D game (so we assuming Z is always 0 for now), on a device with 960x544 resolution. So, as far as I understand my World Space is left-top (0, 0) to right-bottom (959, 543), with Y axis inverted (going down). Let w = 960, h = 544. To transform it to Eye Space we need to move (0, 0) to center of the screen, so it would be simple translation, viewT:

1, 0, 0, -w/2
0, 1, 0, -h/2
0, 0, 1, 0
0, 0, 0, 1

Next step is Clip Space. I want all world space to be rendered so it's just scaling. But we also need to invert Y axis and that's the part I'm unsure of. My assumption would be that we just add minus sign for the Y scale, and thus projT:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
0, 0, 0, 1

Then viewProjT = projT * viewT would give me:

2/w, 0, 0, -1
0, -2/h, 0, 1
0, 0, 1, 0
0, 0, 0, 1

But in samples I have, "reference" matrix is:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
-1, 1, 0, 1

i.e. it's my viewProjT, but transposed. And that's the part I don't understand. Can someone clarify why I need to transpose matrix to get correct matrix? Is this somehow related to inverting Y axis?

Note: I'm using this, as a basis for my calculations.
And image to illustrate my World and Clip spaces:

sentences:
How many update and draw calls can a windows phone suppport I'm making a Windows Phone game (XNA 4.0) which requires a lot of activity on the screen. It's working well for now. But what I am concerned about is that it uses a lot of sprites and many of them as 'lists' so that I can make multiple copies of the sprite, and this causes a lot of Update() calls which have 'for' loops and collision testing method calls also. This also increases the number of Draw() calls.
As the game progresses, I am going to need to add more sprites and update calls.

Can that cause problems in Windows Phone? (Currently I have no device to test it on).

My game has 18 sprites for now and most of them requires multiple copies to be drawn on screen.

Is there a more efficient way to achieve this?

sentences:
Why can't I duck reverb in the mix bus? i'm surprised there is so little documentation on this issue. But i'm trying to duck the audio on all the mix buses in Unity so that you can clearly hear the VO of the game.

Now it works great except that I have some reverb zones in the game and any sound that plays in these reverb zones, the actual reverb itself is NOT DUCKED.

So the VO is accompanied with a huge wall of wishy washy muddy noise.

Anyone deal with this before? How can we deal with this?

sentences:
Flowfield density conversion I'm trying to implement flowfield navigation, as described in http://grail.cs.washington.edu/projects/crowd-flows/
but I can't understand how the Density Function in Figure 4 of the paper is supposed to handle unit radius.

Has anyone ever implemented that and can provide more information?

This is the part in question:

Their algorithm seems to be using only 4 cells, pointing to the lower left of the unit, so is this some kind of kernel that needs to be applied multiple times?

Thanks.

sentences:
Unity Physics.Raycast give false positive while using layer mask I'm very new to Unity so please excuse my question if this sounds very basic to you.

I'm following various tutorials and I have a small question regarding Physics.Raycast:

if (Input.GetButton("Fire1")) {
        // check ground hit first
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, LayerMask.GetMask("Ground"))) {
            Debug.Log("[PlayerMotion]: Hit" + hit.collider.name + " " + hit.point);
            agent.SetDestination(hit.point);
        }
}

Here, even tough I expressively set the layer mask to "Ground", I still get a hit with the Player game object itself (the ground hit is working fine). I thought ok maybe I put the "Ground" layer as well on the player by mistake but I checked several times and it's not the case.

I'm attaching a gif so you can see what's the issue exactly

There's an easy by checking the collider.name but I still find it odd that the Raycast gives me a false positive with the player hit. Any idea what's going on ?

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:
Is there an accepted architecture for these classes? I am coding a game in python and so far so good, but I feel like my classes are not very modular. This is a simplification of what I've done:

class Game:
def __init__(self):
    self.characters = []
    self.walls = []
    self.background = None
    self.canvas = None
    self.keyInputs = None

def update(self, inputs):
    self.keyInputs = inputs
    for character in self.characters:
        if character.died:
            self.characters.remove(character)
        else:
            character.update()

def draw(self):
    self.background.draw()
    for wall in self.walls:
        wall.draw()
    for character in self.characters:
        character.draw()

class Character:
    def __init__(self):
        self.horizontalPosition = 0
        self.verticalPosition = 0
        self.game = None
        self.died = False
        self.sprite = None
        ...

    def draw(self):
        self.game.canvas.draw(self.sprite, self.horizontalPosition, self.verticalPosition)

    def interactWith(self, character):
        ...

    def detectCollition(self, wall):
        ...

    def handleInputs(self):
        inputs = self.game.keyInputs
        ...

    def update(self):
        self.handleInputs()
        for character in self.game.characters:
            if character != self:
                self.interactWith(character)
        for wall in self.game.walls:
            self.detectCollition(wall)

This way Characters and Walls need to have a variable for which Game they are in, and a Game needs to have a variable for each Character or Wall that is in it.

Is there a better way to define these classes? Are there design patterns for this?

sentences:
How should I check if object is null or not? using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

    // Start is called before the first frame update
    void Start()
    {
        string imagesFolder = Path.Combine(Application.dataPath + "/Saved Screenshots");
        if (!Directory.Exists(imagesFolder))
        {
            Directory.CreateDirectory(imagesFolder);
        }

        imagesToLoad = Directory.GetFiles(imagesFolder, "*.png");

        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        if (imagesToLoad.Length > 0 && slots != null)
        {
            for (int i = 0; i < imagesToLoad.Length; i++)
            {
                var go = Instantiate(saveSlotPrefab);
                go.transform.SetParent(slots);

                Texture2D thisTexture = new Texture2D(100, 100);
                string fileName = imagesToLoad[i];
                go.GetComponent<RawImageInfo>().FolderAndFileName = fileName;
                byte[] bytes = File.ReadAllBytes(fileName);
                thisTexture.LoadImage(bytes);
                thisTexture.name = fileName;
                go.GetComponent<RawImage>().texture = thisTexture;
            }
        }
    }

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

    }
}

I'm checking in this line if slots is not null :
if (imagesToLoad.Length > 0 && slots != null)

The problem is that I'm getting exception null already on the line before :
slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

The reason is that the object with the tag "Slots Content" is disabled when the game start and I want it to be disabled when the game start but I also don't want to get this null exception. Then how should I make the null checking ?
I tried also :
if (GameObject.FindGameObjectWithTag("Slots Content").transform != null)
            slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        if (imagesToLoad.Length > 0 && slots != null)

But still getting the exception null on the check :
if (GameObject.FindGameObjectWithTag("Slots Content").transform != null)

sentences:
Unity - soft blur effect for dark void edges I'm a former Flash dev working in Unity (or in 3D for that matter) for the first time.

For the game I'm working on, I've designed an interior room like so:

To represent void/space outside the bounds of the current room, there's just black.
In order to hide the back faces of the exterior facing walls, I've created a snug fitting mesh cutout which sits just below the lip of the wall.
If I moved the camera below the surface, you would clearly see that.

I'm quite new to Unity, and have very little experience with shaders.

Anyway, I figured this would be a good place to try for creating my first shader, but I'll need some help.

I'd like to blur/soften the edges where the wall lip meets the void, like so:

The only way I could achieve this effect would be by hacky means, like by using a gradient texture (#00000000 -> #FF000000) UVed around the edges of the wall lips, but I suspect there is a more elegant solution by rendering the black surface with a shader.

Currently, even with a basic understanding of fragment shaders and the rendering process, I would have no idea where to start if I tried to write my own. When I read shader script I can only stare in wonder at the sheer etherealness of it. I just don't know how to craft a solution in such basic terms, but I'd love to learn.

I understand the answer is probably as simple as 'use a gaussian blur', but i would appreciate some more input to steer me on the right path, and maybe some examples to help me understand.

sentences:
Horizontal lines between vertices do not render Good day,

I am using LibGDX to try to render a mesh for a hexagon board. I can render the triangles, which is great, but I am having an issue rendering all of the line segments for the mesh and I can't figure out why.

Pictures

Here is an image of what it renders with the primitive type set to GL_TRIANGLES. The colours are just to help me troubleshoot/identify which triangles are where.

.

Here is an image of what it renders with the primitive type set to GL_LINES. Whether there is 1 triangle being rendered or 1 million, the horizontal lines do not get rendered.

.

Code

How I create the mesh:

mesh = new Mesh(true, MAX_VERTS, 0,
                new VertexAttribute(Usage.Position, POSITION_COMPONENTS, "a_position"),
                new VertexAttribute(Usage.ColorUnpacked, COLOR_COMPONENTS, "a_color"));

mesh.setVertices(verts);

renderable = new Renderable();
renderable.mesh = mesh;
renderable.primitiveType = GL20.GL_TRIANGLES;
renderable.meshPartSize = mesh.getNumVertices();
renderable.meshPartOffset = 0;

When I switch the renderable.primitiveType to GL20.GL_LINES I get the 2nd picture from above.

I've tried to set the renderable.meshPartSize a couple of different ways:

renderable.primitiveType = GL20.GL_LINES;

renderable.meshPartSize = mesh.getNumVertices(); // Doesn't work
renderable.meshPartSize = MAX_VERTS * 2;         // Doesn't work

Here is how I make a triangle:

void drawTriangle(float x, float y, float z, float width, float height, Color color) {
    // Counter-clockwise winding

    // Vertex 1: Top Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 2: Bottom Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z + height;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 3: Top Right
    verts[idx++] = x + width;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;
}

Any help would be appreciated.

Thanks.

sentences:
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:
XNA 4.0, FBX and Texture Loading Failures I've been going through several tutorials on how to use XNA and understand a lot thus far.  I've got a screen, I've got 2D sprites working, got a shader system operational, so far so good.  Now I've hit a wall.

I'm attempting to load a 3D model (FBX Format) I've exported from 3DS.  My issue, is the texture system.  First, I'm trying to avoid embedding the textures directly into the FBX as I'll be reusing a lot of the textures for different things, no need to load multiple copies of the same texture.  I know my texture, even though not embedded, is making it to my XNA classes because I can see it inside the FBX (when saved as ASCII) and get a compiler error if I attempt to move the texture out of its original location.  I can also see it compiling the image during a rebuild.

However, if I attempt to render the object, no texture.  Loading code:

protected override void LoadContent()
{
    objModel = LoadModel("Models/OriginModel");
}

objModel is defined as a Model higher up in the cs file.

My display code:

foreach (ModelMesh mesh in objModel.Meshes)
{
    foreach (Effect currentEffect in mesh.Effects)
    {
        currentEffect.CurrentTechnique = currentEffect.Techniques["TextureNormalMap"];
        currentEffect.Parameters["World"].SetValue(objTransforms[mesh.ParentBone.Index] * worldMatrix);
        currentEffect.Parameters["View"].SetValue(viewMatrix);
        currentEffect.Parameters["Projection"].SetValue(projectionMatrix);
    }
}

I've stripped out the matrix transforms and such as they're not causing the issue.  TextureNormalMap is my shader I've written that displays a texture with a normal map.  This generates a black model.  If I however add...

metalTex = Content.Load<Texture2D>("Textures/brushedmetaltexture");

and

currentEffect.Parameters["ColorMap"].SetValue(metalTex);

where needed, I get the texture to display.  This is of course, the problem.  I have to include the texture in my Content system, causing the image to be compiled twice (which generates a warning..compiled once from the FBX, compiled once from Content).  More importantly, I would have to hand-texture all the models again inside the XNA system in order to get them to display, which is what I'm trying to avoid.  I've already textured them once in 3DS, do I really need to specify, inside XNA during object load, all the textures again?

So, any ideas on what I'm doing wrong here?  What magical step am I skipping?  Am I supposed to, somehow, figure out what the texture name is from the FBX file itself and get a pointer to the extracted image to feed into my Texture2D?  Is there a different object I should use that includes the texture from the FBX?  Do I need to bite the bullet and just go with embedding (which still doesn't work with the above code btw)?

I've been going off of tutorials as I mentioned, but this step seems to be missing, or am I just being daft?  I apologize if this seems trivial, but I just can't solve it.  Is there some step in the object loading process I'm missing?

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:
Why is there a white border around my app icon? EDIT:  This is because Unity did not support Android's adaptive icons.  As of Unity 2018, it is supported natively.

For Unity 2018+, see this question.
For Unity 2017-, see Jimmy's answer.

I am developing an Android app in Unity.  I have two versions of the app on my phone, both with identical icons. The white border is only on the newer version of the app. I am using a Google Pixel.

Why is this there, and how do I get rid of it?

Is this tied to my phone or my app? If it is tied to my phone, why is it on one icon, but not the other (they are same icon)? I don't want other users to have this pointless border around the app, as my icon already has a border.

sentences:
GLSL Fragment shader lighting lambert term Just a simple question:
Should I or should i not normalize the SurfaceToLight vector to calculate the lambert term on a GLSL lighting shader?

I mean, here:

vec3 CalculateLights ( void )
{
vec3 OverallResult = (AmbientLight.Color * AmbientLight.Intensity * Material.Ambient.xyz );
vec3 SurfaceToCamera = WorldFragPosition - CameraPositionWorld;

// Apply point lights
for ( int LightIndex = 0; LightIndex < PointLightCount; ++LightIndex )
    {
    vec3 LightResult = vec3 ( 0, 0, 0 );
vec3 SurfaceToLight = PointLights[LightIndex].Position - WorldFragPosition;

float Distance = length ( SurfaceToLight );
if ( Distance > PointLights[LightIndex].Cutoff )
    continue;

// Calculate normalized vectors and Lambert term
vec3 NormalizedFragVertexNormalWorld = normalize( fragVertexNormalWorld );
vec3 NormalizedSurfaceToLight = normalize( SurfaceToLight );
//  float LambertTerm = max( dot( NormalizedSurfaceToLight, NormalizedFragVertexNormalWorld ), 0 ); // Should I use normalized here?
float LambertTerm = max( dot( SurfaceToLight, fragVertexNormalWorld ), 0 ); // Should I use normalized here?

// Compute the diffuse term.
vec3 DiffuseResult = LambertTerm * PointLights[LightIndex].Intensity * PointLights[LightIndex].Color * Material.Diffuse.xyz;
LightResult += DiffuseResult;

// Compute specular
//  float SpecularCoefficient = 0.0;
//  if ( LambertTerm > 0.0 )
//      SpecularCoefficient = pow ( max ( 0.0, dot ( SurfaceToCamera, reflect(-SurfaceToLight, NormalizedFragVertexNormalWorld))), Material.Shininess);
//  vec3 SpecularResult = SpecularCoefficient * Material.Specular.xyz * PointLights[LightIndex].Color;
//  LightResult += SpecularResult;

// Compute attenuation
float Attenuation = PointLights[LightIndex].ConstantAttenuation + PointLights[LightIndex].LinearAttenuation * Distance + PointLights[LightIndex].ExponentialAttenuation * pow ( Distance, 2 );

//  float Attenuation = 1.0 / (1.0 + PointLights[LightIndex].ConstantAttenuation * pow(Distance, 2));
LightResult /= Attenuation;
OverallResult += LightResult;
    }

return OverallResult;
}

As you can see, i've been trying out some different formulas on this shader. Specular still does not work.
Here is the normalized and non-normalized versions of the image

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:
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:
How to refer to a object that has just been hit by a ray cast? I would like to use RigidbodyConstraints.FreezeRotation;in order to freeze the rotation of an object that is picked up. The problem is I don't know how to refer (or call) the currently selected object. The script in it's currents state is below...

public class PhysGun : MonoBehaviour
{
    private GameObject Player;

    void Start ()
    {
       Player = GameObject.Find("Player");
    }

    // Update is called once per frame
    void Update ()
    {
        Vector3 fwd = transform.forward; // Equivalent to the code you had.

        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit, 10f))
        {
            hit.transform.SetParent(Player.transform);
            Debug.Log("We hit: " + hit.transform.name);
            hit.transform. = RigidbodyConstraints.FreezeRotation;
        }

    }

}

So, how do I call (or refer to) the object that is hit by the ray cast exactly?

sentences:
Unity2D: Vector3.Lerp - smooth movement I have a script that randomly chooses a position to move a game object every 5 seconds, however instead of moving my object smoothly, my script make my object jumps, which is not desirable! How would I make my object move to position smoothly! Thank you!

public float timer;
public float speed;

public int newtarget;

public float xPos;
public Vector3 desiredPos;

void Start() {
}

void Update () {
    timer += Time.deltaTime;
    if (timer >= newtarget) {
        newTarget ();
        timer = 0;
    }
}

void newTarget() {
    xPos = Random.Range(-4.5f, 4.5f);
    desiredPos = new Vector3(xPos, transform.position.y, transform.position.z);

    transform.position = Vector3.Lerp (transform.position, desiredPos, Time.deltaTime * speed);
        if (Vector3.Distance(transform.position, desiredPos) <= 0.01f)
        {
            xPos = Random.Range(-4.5f, 4.5f);
            desiredPos = new Vector3(xPos, transform.position.y, transform.position.z);
        }
}

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: How to access Maya Bonus Tools 2012 in Maya 2014 I have been trying to use the paint geometry tool for Maya 2014 but it isnt showing up. I downloaded Bonus Tools 2012 and installed it. Where can I find this tool in Maya 2014?

sentences:
Voxel Lighting in Unity3D I'm working on a Voxel project in Unity3D for fun and learning. I've been reading up on how this is done and have implemented a simple Voxel map in my project. My question is about the lighting. I've read several articles on how Minecraft implemented lighting. It doesn't seem too complicated but I'm wondering if it's necessary in Unity (and also I'm unsure how I would actually implement that in Unity)

So far I'm just using Point Lights on blocks that should emit light. Is Unity's Point Light efficient enough on a Voxel map if there are many light sources? So far on my scene it works OK with several lights on it. Adding many lights slows down the game as expected but since my computer is not a gaming beast I don't know if it's because Unity's Point Light is not optimized for this type of map or if it's just due to my low end computer. (To give you a point of comparison, I run Minecraft with a lot of lag but Eldritch with absolutely no lag, if you're familiar with both those games)

I would like some thoughts from more experienced users on this subject. If you had to develop a Voxel game in Unity, that may include 100 torches and 100 cubes of glowing lava, would you just use the Point Lights?

If the answer is no, is playing with the RGB values of the block textures the way to go?

sentences:
How to connect a 3D head to a body? I am new to Unity, game-making, etc.

I have downloaded the trial version of Avatar Maker and a similar Unity plugin called Didimo Editor, with the hope of using their features to make game characters that look like real people, using photographs. They both do more or less what I want.

However, both tools output only heads, and do not connect them to 3D bodies. Avatar Maker has another plugin that allows for this, but it is only for male bodies and most of its features are not to my liking.

So my question is: how can I put these heads on working 3D bodies?

The trailer for Didimo Editor seems to confirm that it can, at least, and Avatar Maker is able to export its heads to OBJ, FBX and Prefab, so I'm assuming maybe there is a way to do that too.

sentences:
How do I render a word in the middle of the screen using FreeType and OpenGL? I'm following this tutorial series on making a simple 2D clone of the classic Breakout game, but its author doesn't mention how to render a whole word or sentence in the middle of the screen. He simply uses hard-coded X and Y coordinates that obviously work for his screen, but not for mine (hence why the mere suggestion of using hard-coded values for something like this makes my skin crawl).

For more details on how he accomplishes the task, see this page of the aforementioned tutorial.

My version of his game has two major differences:

I am rendering the GLFW window in fullscreen mode instead of a 800x600 window.
I suspect that even if I were to use a 800x600 window, things still wouldn't look consistent across every device. As such I have made many changes to hard-coded values across the entire code base.

I'm a perfectionist so even though no-one else will probably ever run my game, I'm trying to eliminate the possibility of different results on different resolutions. But to do that has turned out to be a massive undertaking!

Here is the code that I'm having particular trouble with:

void TextRenderer::RenderText(string text, GLfloat x, GLfloat y, GLfloat scale, vec3 color) {
    // Activate corresponding render state
    shader.Use();
    shader.SetVector3f("textColor", color);

    glActiveTexture(GL_TEXTURE0);
    glBindVertexArray(vao);

    // Iterate through all characters
    for (auto c = text.begin(); c != text.end(); c++) {
        auto ch = characters[*c];

        auto xPos = x + ch.bearing.x * scale;
        auto yPos = y + (characters['H'].bearing.
            y - ch.bearing.y) * scale;
        auto w = ch.size.x * scale;
        auto h = ch.size.y * scale;

        // Update VBO for each character
        GLfloat vertices[6][4] = {
            { xPos,     yPos + h, 0.0, 1.0 },
            { xPos + w, yPos,     1.0, 0.0 },
            { xPos,     yPos,     0.0, 0.0 },

            { xPos,     yPos + h, 0.0, 1.0 },
            { xPos + w, yPos + h, 1.0, 1.0 },
            { xPos + w, yPos,     1.0, 0.0 }
        };

        // Render glyph texture over quad
        glBindTexture(GL_TEXTURE_2D, ch.textureID);

        // Update content of VBO memory
        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glBufferSubData(GL_ARRAY_BUFFER, 0,
            sizeof(vertices), vertices);
        glBindBuffer(GL_ARRAY_BUFFER, 0);

        // Render quad and advance cursors for next glyph
        glDrawArrays(GL_TRIANGLES, 0, 6);
        // Bitshift by 6 to get value in pixels (1/64th times 2^6 = 64)
        x += (ch.advance >> 6) * scale;
    }

    glBindVertexArray(0);
    glBindTexture(GL_TEXTURE_2D, 0);
}

I have tried adding a bool centreX and bool centreY param to the function, as well as another for loop before the main one like this:

if (centreX || centreY) {
    auto textWidth = 0.0f;
    auto textHeight = 0.0f;

    for (auto c = text.begin(); c != text.end(); c++) {
        auto ch = characters[*c];

        if (centreX) {
            textWidth += (ch.bearing.x * scale) + (ch.size.
                x * scale) + ((ch.advance >> 6) * scale);
        }

        if (centreY) {
            textHeight += (y + (characters['H'].bearing.y -
                ch.bearing.y) * scale) + (ch.size.y * scale);
        }
    }

    if (centreX) {
        auto lastCh = text.end() - 1;
        textWidth -= (characters[*lastCh].advance >> 6) * scale;
    }
}

But for the sentence, font and font size used I'm getting a textWidth value of 1952 while a screenshot of the rendered text is 1143 px wide :S

Where has my math or understanding of the original code gone wrong? My display is a high DPI one and I have my Windows scaling settings at 200%; could either of those things be the culprit?

MTIA!

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:
AS3 random events using a timer I'm making a game for an assignment at university.
The game I am making requires random household appliances around a house to "turn on" at random times.
The player must run around the house turning this off.

I am confident with the rest of the code for the game, but the random turning on is what I'm not sure on.

I am thinking the solution would be to use an array with all my appliances pushed into into, then create a timer event.
From this a random time would be picked from the timer, and then a random appliance would be picked from the array. The appliance on animation would then be displayed until the player clicked on it to turn it off.

Only problem is i'm not sure how to start this.

Also worth mentioning, I am only able to use flashdevelop and AS3 for this project, so no Adobe Flash.

Thanks in advance,

Job4aCowboy

sentences:
1D vs 2D vs 3D texture performance I'm working on a 3D game with large blocky untextured, but individually colored, voxels (similar to CubeWorld). For rendering, right now I naively convert online all visible faces ahead of time to triangles with the color information stored in the vertex attributes. The screenshot below is an example of what I'm currently doing. There's a lot of room to improve here and I want to switch to a system that uses fewer vertices and stores color information in a texture.

What I'd like to do is combine adjacent triangles with the same normals and simplify the mesh so I'm left with a fraction of the vertices. My big hangup is color information. It's easy to add UVs, but the correct choice for texturing isn't obvious. I'm trying to figure out the relative performance of these options:

Use a 1D texture. This is compact but I'm concerned that large 1D textures won't play nicely with texture mapping units optimized for 2D textures.
Use a 2D texture. Simple, but it'll end up with gaps.
Use a 3D texture with the full set of voxels.

Does anyone have insight as to the relative performance of these options? No mipmapping or other filtering is needed here, so all three options should be viable.

For reference I'm making this in C++ using OpenGL on Windows. My target GPU architectures are GTX 780 Ti and higher or AMD equivalent.

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:
Collision and changing the scene. C# I'm running into a problem where I want to create some code that such that if an object (Cube) is destroyed, it to changes to another scene.

Here is my code:

public class Move : MonoBehaviour {

    void playerWalk()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

        transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }

    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.name == "Cube")
            Destroy(col.gameObject);
    }

    void Update ()
    {
        playerWalk();
        if (Input.GetKeyDown(KeyCode.B))
            print("hello");
    }
}

What do do I need to do?

sentences:
Breakout... Getting the ball reflection X angle when htitting paddle / bricks Im currently creating a breakout clone for my first ever C# / XNA game. Currently Ive had little trouble creating the paddle object, ball object, and all the bricks. The issue im currently having is getting the ball to bounce off of the paddle and bricks correctly based off of where the ball touches the object. This is my forumala thus far:

if (paddleLocation.Intersects(ballLocation))
{
    position.Y = paddleLocation.Y - texture.Height;
    motion.Y *= -1;

    // determine X
    motion.X = 1 - 2 * (ballLocation.X - paddleLocation.X) / (paddleLocation.Width / 2);
}

The problem is, the ball goes the opposite direction then its supposed to. When the ball hits the left side of the paddle, instead of bouncing back to the left, it bounces right, and vise versa. Does anyone know what the math equation is to fix this?

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 can I render "two-sided" clouds like in Minecraft? The clouds in Minecraft are semi-transparent and are rendered on both sides.  If you fly into the cloud you can see inside of the cloud.
If I render clouds the inside faces would be visible on the outside.
How can I prevent that?
Z-Ordering the faces and render near to far with depth test on?
There must be a better, easier way.
Could the accum or stencil buffers be used somehow?

UPDATE : I think the crucial point everyone is forgetting is that these clouds and semi-transparent and "blended" into the scene as each face is rendered.  If two faces are rendered on top of each other the "white" texture will double up which is undesired.  The faces also seem to have slight lighting variations which would rule out using a stencil.

UPDATE2: Just another note.  Each cloud is 12x12x4 blocks (roughly).  Larger clouds are just a group of the base clouds stuck together.

Here's showing clouds from above. They are translucent and the chunks below can be seen.

And here's the view from inside them.

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:
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:
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:
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:
Best way to keep track of game objects I'm not exactly sure how I should ask this question, and so the title may be misleading - I am not asking if I should use a list or a stack or a vector or a queue - but how I should go about keeping track of said storage object.

For example, let's say I have some object that would represent the game itself, and the game used state objects to tell what state it was in(IE, playing, paused, titlescreen, gameover screen, etc etc):

class Game
{
    //Constructors and what not
    private:
    stack<States*> states;
};

And then each state would keep track of the objects that it contained.

class States
{
    //Constructors and whatnot
    private:
    list<Mob*> listOfMobs;
    list<Bullet*> listOfBullets;
};

Now, what if I have a Mob spawn new Mobs, or have a Mob fire a bullet? I definitely don't want to pass the State itself down to all Mobs - I'd have dozens(or more) of copies of the State wandering around, which does not seem very wise. In the same sense, passing down the list of Mobs or bullets does not seem like the best idea either.
So, how should I handle this? I don't want to use global variables, and in the same way I wouldn't like to use a singleton pattern to keep track of it all - but I don't see very many other options. I might just be stuck thinking inside the proverbial box, though. How does everyone else handle tracking the objects in their game?

sentences:
Efficient structure for representing a transform hierarchy Can anyone suggest a memory efficient way to represent a tree of matrices, for example in a hierarchy model?

I'm particularly keen to preserve data locality, and I suspect a structure-of-arrays (matrices & indices to matrices) type approach might be suitable.

As well as many chained matrix computations, this structure will probably be copied around in memory a fair bit, so having contiguous storage would be a big bonus.

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: 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:
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:
Change 3D Render Resolution in Godot I'm making a Mario-Like platformer in Godot, and am going for a N64 style, and I want to lower the resolution of the render, while still having the window being resizable, like in Blender. Is there any way to do this?
Thanks in advance!

sentences:
Method of terrain in a 3d RPG I am working on a RPG using the JMonkey engine. While I was conceptualizing the map, I realized I would have a problem with the terrain.

My problem is this: I want to have a click to move interface, and have the player move in increments of 1 world unit (wu). This is actually rather reminiscent of a tile based engine, but in 3d. While making the world map, do I need to make an object made of the world geometries, and load the one object, or would it be better to build a map out of the necessary tiles, using a file to tell the engine how to build the map (similar to 2d tile games)?

I might also add, the game isn't going to use heavy collision detection or real time physics, which is why I thought a tile based "pass-abilty" system might work.

Would loading that many objects for a tile be too much as far as memory goes? What if I make a single object, constructed of tiles by a definition file, and just make the player move in 1 wu increments, giving the illusion of "tile-based"?

I'm assuming that a combination of any of these might work, it's just that I don't have any prior experience making a system like this and would like some opinions on the most efficient method of doing what I'm trying to do.

sentences:
How to make an infinite map I was wondering if someone could explain to me how to implement a seemingly dynamic infinite map like the one at http://wordsquared.com/

My main issue is really generating new tiles in any direction when the user drag the board.

I'm also trying to figure out how to handle the coordinate system, and actually what/how to store the map in a database.

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:
Self colliding cloth physics I've previously simulated cloth using Verlet integration but couldn't successfully get the cloth to collide with itself in an efficient way. The reason being is because I used a brute force algorithm to if check all the cloth points collided with each other.

My question is how could I efficiently check for collision between the cloth points? I thought of using some sort of tree structure but it doesn't really make sense in my head given that a lot of tree structures largely depend on spatial position or don't actually suit the cloth because they're better suited to static geometry(BSP).

Additional Info: The cloth is logically just a 2D array of points tied together by a constraint. The cloth is affected by wind and gravity and is also anchored in space at the two upper corner

sentences:
How do I work around the "You are missing the recommended JDK" error? After switching to 2019.4 LTS I got this error (using Windows 10)

You are missing the recommended JDK. Install the recommended version using Unity Hub.

I installed the JDK using Unity Hub many times now, still the same error.
Tho I don't think it's getting installed.
As you can see below, the "OpenJDK" checkbox remains blue no matter how many I try to install it.

When I tried downloading and installing the JDK (JDK 1.8.0_181) myself I get this error instead:

You are missing the recommended JDK, versions other than 1.8.0 are not officially supported.

sentences:
libgdx - Texture not appearing sometimes When I run the App the Ball moves sometimes downwards, but sometimes its not moving. I dont change anything on script.

What I want is the ball should come from top outside of the screen, but when its visible in screen it should get an random xSpeed.

To test it I added first the bomb in the middle of the screen. But as I said the Ball is not showing sometimes. I run the game on my samsung galaxy s6 edge and the ball is there. Then when I run again it's not there.

That's how I coded.

private static final int SPRITE_SIZE = 32; // It has 32px width and height
private static final int SPRITE_COUNT = 4; // there are 4 sprites
private static final float MAX_SPEED = 1f; // maxspeed
private static final float MIN_SPEED = 0.25f; // min speed

private Vector2 position;
private Animation anim;
private Random random;

private float speedX, speedY;

public Bomb() {
    random = new Random();
    int rand = random.nextInt(2);

    TextureRegion tmp = new TextureRegion(Asset.sprites, SPRITE_SIZE * SPRITE_COUNT, rand * SPRITE_SIZE);
    anim = new Animation(tmp, SPRITE_COUNT, 0.75f);

    position = new Vector2((MainGame.WIDTH/2) - (SPRITE_SIZE/2), MainGame.HEIGHT);
    speedX = 0;
    speedY = -MAX_SPEED;
}

public void update(float dt) {
    anim.update(dt);
    if(speedX == 0) {
        if(position.y + SPRITE_SIZE < MainGame.HEIGHT) {
            speedX = random.nextFloat() * (MAX_SPEED - MIN_SPEED) + MIN_SPEED;
    }
    position.add(speedX, speedY);
}

public void render(SpriteBatch sb) {
    sb.begin();
    sb.draw(anim.getFrame(), position.x, position.y);
    sb.end();
}

EDIT: Maybe here's a problem?

Asset.java

public class Asset {
    public static Texture sprites;

    public static void init() {
        sprites = new Texture(Gdx.files.internal("sprite.png"));
    }

    public static void dispose() {
        sprites.dispose();
    }
}

Animation.java

public class Animation {
    private Array<TextureRegion> frames;
    private float maxFrameTime;
    private float currentFrameTime;
    private int frameCount;
    private int frame;

    public Animation(TextureRegion region, int frameCount, float cycleTime) {
        frames = new Array<TextureRegion>();
        int frameWidth = region.getRegionWidth() / frameCount;
        for(int i = 0; i < frameCount; i++) {
            frames.add(new TextureRegion(region, i * frameWidth, 0, frameWidth, region.getRegionHeight()));
        }
        this.frameCount = frameCount;
        maxFrameTime = cycleTime / frameCount;
        frame = 0;
    }

    public void update(float dt) {
        currentFrameTime += dt;
        if(currentFrameTime > maxFrameTime) {
            frame++;
            currentFrameTime = 0;
        }
        if(frame >= frameCount) {
            frame = 0;
        }
    }

    public TextureRegion getFrame() {
        return frames.get(frame);
    }

    public void dispose() {
        for (int i = 0; i < frames.size; i++) {
            frames.get(i).getTexture().dispose();
        }
    }
}

sentences:
Why do I get an error about being unable to change rasterizer states in this code? I'm trying to toggle between wireframe and full mode while drawing a 3d model. So far I have this

 rs = new RasterizerState();

In my update method:

  if (state.IsKeyDown(Keys.V))
        {
            rs.FillMode = FillMode.WireFrame;
        }

        if (state.IsKeyDown(Keys.C))
        {
            rs.FillMode = FillMode.Solid;
        }

and in my draw method:

  GraphicsDevice.RasterizerState = rs;

But I get the error:

 Cannot change read-only RasterizerState. State objects become read-only the first time they are bound to a GraphicsDevice. To change property values, create a new RasterizerState instance.

What am I doing wrong here?

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:
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: Cocos2D: TileMap performance question I´ve got a question regarding TileMaps. Each level in my game is going to be determined by the length of the tile map. I would like to create a map that will be about 5 mins (in length) long. I want to add depth to my map so I will be making individual layers to create that depth illusion via ParallaxNode. Each independent layer is going to be scrolling automatically at different speeds however the ground layer is going to be scrolling the fastest thus increasing its length being a map that long and the ground layer being longer. Will that bring performance in my game to it's knees?

sentences:
Optimizing file-size of a sprite-sheet for a 2D game I have a question regarding the method of creating a sprite-sheet so that it will not consume to much disk space and still preserve graphics quality.

I was researching about this topic and found that my sprite-sheets should have sizes that are a power of two. So valid sizes would be 512x512, 1024x1024, 2048x2048 etc.

Then I created two sprite sheets (one is 1024x1024 and the other is 2048x2048), they are exported as 16bit but they still use too much disk-space. How can I optimize my sprite-sheet to use the least amount of disk-space possible?

This is one of my sprites:

sentences:
SDL window crashes when mouse goes below a certain point I added code to check the rgb values of my surface, and whenever i call the function it seems to work fine! the only problem is that whenever the mouse goes under y = 400 the entire window crashes... Right now the program outputs the rgb color of the pixel on the screen, and when it goes below 400 one or all of the pixel values are 0, and then the program crashes. I have no ideas why this is happening. Any help is appreciated! Heres the github repo! https://github.com/jcsq6/SDLGame not much has been done except a couple classes to make my life easier in SDL :)

int* texture::getPixel(int x, int y){
    static int Color[4];
    SDL_PixelFormat *fmt;
    Uint32 temp, pixel;
    Uint32 *pixels = (Uint32 *)Surface->pixels;
    Uint8 red, green, blue, alpha;

    fmt = Surface->format;
    SDL_LockSurface(Surface);
    pixel = pixels[(y * Surface->w) + x];
    SDL_UnlockSurface(Surface);

    temp = pixel & fmt->Rmask;
    temp = temp >> fmt->Rshift;
    temp = temp << fmt->Rloss;
    red = (Uint8)temp;

    temp = pixel & fmt->Gmask;
    temp = temp >> fmt->Gshift;
    temp = temp << fmt->Gloss;
    green = (Uint8)temp;

    temp = pixel & fmt->Bmask;
    temp = temp >> fmt->Bshift;
    temp = temp << fmt->Bloss;
    blue = (Uint8)temp;

    temp = pixel & fmt->Amask;
    temp = temp >> fmt->Ashift;
    temp = temp << fmt->Aloss;
    alpha = (Uint8)temp;

    Color[0] = red;
    Color[1] = green;
    Color[2] = blue;
    Color[3] = alpha;

    return Color;

}

it's worth noting that when I call this function, the input y and x values are the mouse's position.

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:
Delay for seconds when key is held down? Hello I am very new to Unity and am trying to make a shooting game in which when the space key is pressed down the gun charges then shoots. I want it to wait for 0.3 seconds before the gun fires off because I want an effect to happen with a particle system(I confused animation with effect in the first post). Also the problem the script has is that the bullet would not fire at all when the space is pressed. Here is the scripts I wrote:

 void Start()
 {
     StartCoroutine("Shoot",0.3f);
 }

 IEnumerator Shoot()
 {
     yield return new WaitForSeconds (0.3f);
     Bam ();
 }

 void Bam()
 {
     transform.Translate (0, 0, 12);
 }

 void Update ()
 {
     if (Input.GetKey (KeyCode.Space))
         Shoot();
 }

sentences: How do I calculate the z-coordinate for a perspective-camera in 2D? I'm new to LibGDX and trying to use DecalBatch with PerspectiveCamera, simply to have Z-coordinate for my sprites, as SpriteBatch does not offer that. However, I don't know how to calculate the Z-coordinate for the PerspectiveCamera for "pixel-perfect 2D-projection". How do I do that?

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:
Creating a curved mesh on inside of sphere based on texture image coordinates In Blender, I have created a sphere with a panoramic texture on the inside.  I have also manually created a plane mesh (curved to match the size of the sphere) that sits on the inside wall where I can draw a different texture.

This is great, but I really want to reduce the manual labor, and do some of this work in a script -- like having a variable for the panoramic image, and coordinates of the area in the photograph that I want to replace with a new mesh.

The hardest part of doing this is going to be creating a curved mesh in code that can sit on the inside wall of a sphere.

Can anyone point me in the right direction?

sentences:
Why not draw a custom font with lines and/or polygons? Reasons/advantages I see:

More flexible procedural animation.
Completely custom font.
Performance (no texturing or high-poly)?
No assets (unless data-driven).
Multi-resolution compared to sprite fonts / sprites.

Downsides I see:

Effort and time to define every character.
Effort and time to implement the general code.
Future localization pain.

Example: https://youtu.be/Tz7L-92Bo-M?t=2m13s

Is this unreasonable and why?
Will I get a rendering performance win compared to sprite fonts on common multi-core mobile devices?

sentences:
How can I improve my collision detection's performance? I'm new to programming and want to speed up the collision detection in my C++ 2D platformer game engine.

Currently, only the player's collision detection works: Every frame, the player's update function iterates through every level tile (which is pretty many) and checks if the player hitbox collides with it.

I may be way off on this, but this seems like a really chunky way of doing it. Is this bad practice? If the level gets large enough, is iterating through this list going to take forever like it seems it should?

My second question builds off of that: If I start adding for example enemies into the engine and give them a similar method for collision detection, can I expect performance drops? I'd like some insight from more experienced people on a better way of setting this up. I would just imagine that having ~20 enemies on the screen all iterating through all possible objects for collision with a list could get slow fast.

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:
Most efficient way to draw large number of the same objects, but with different transforms I'd like to draw a large number (multiple thousands) of simple meshes (each maybe... a maximum of 50 triangles, but even that is a very large upper bound), all of which are exactly the same.

As a simple brute force way, right now I'm just doing thousands of draw calls, where I just change the transformation matrices that the shaders need and then draw the same objects again.

Of course this is hideously slow, since (I'm guessing) there are too many draw calls for the driver and my PC to handle efficiently.

What can I do to make it faster?

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: Keep gravity velocity the same all the time I have 2D rigidbodies that fall to the ground, however they speed up while falling. Also, when they freeze in the air and then unfreeze, the velocity is set to 0 and they gradually start speeding up again. How can I keep the velocity constant at all times, until they hit the ground?

sentences:
TitleSafeRegion isn't available on XNA 4? I'm following the book Microsoft XNA Game Studio Creators Guide v2. and there is a snippet in the book that is used to return a Rectangle that represents the safe area you can draw without the fear of 'drawing' outside the screen.

Except in my IDE Visual Studio 2010, that method doesn't show up in intellisense and in fact doesn't show up anywhere.

Here is the snippet:

private void UpdateAsteroid(GameTime gameTime)
{
    // time between frames
    float timeLapse = (float)gameTime.ElapsedGameTime.Milliseconds;
    if (move == true)
    { // asteroid centered at the middle of the image
        Rectangle safeArea = TitleSafeRegion(rockWidth/2, rockHeight/2);

      // asteroid right edge exceeds right window edge
    if (rockPosition.X > safeArea.Right){
        rockPosition.X = safeArea.Right; // move it back
        rockSpeed *= -1.0f; // reverse direction
    }
// asteroid left edge precedes the left window edge
else if (rockPosition.X - rockCenter.X < 0){
rockPosition.X = rockCenter.X; // move it back
rockSpeed *= -1.0f; // reverse direction
}
// asteroid within window bounds so update rockPosition
else
rockPosition.X += rockSpeed * timeLapse;
// Scale radians by time between frames so rotation is uniform
// rate on all systems. Cap between 0 & 2PI for full rotation.
const float SCALE = 50.0f;
rockRotation += rockRotationSpeed * timeLapse/SCALE;
rockRotation = rockRotation % (MathHelper.Pi * 2.0f);
}
}

sentences:
How to handle sounds muting in settings? I have a easy and specific question.

Let's say that in my game I use singleton for playing/pausing/changing volume of specific sounds (SimpleAudioEngine in cocos2d-x).

What is the best way to handle mute button, which is displayed in the upper corner of the screen? Should I just volume everything down and do not care about checking the state of this setting before playing any kind of sound?

1) This is called when an object is destroyed

if (!UserDefault::getInstance()->getBoolForKey(MUTED, false))
{
    SimpleAudioEngine::getInstance()->playEffect("shouting.ogg", /* other arguments */)
}

I think that not playing a sound at all is bad practise (if muted is on - like in the above example), because when the user changes this setting while eg. his hero is getting shot, nothing will be played - even if it supposed to take 5 seconds and the option was changed after 2,5 seconds.

But if I only volume everything down - then the rest of the shout will be heard.

sentences: Is there any way to detect cpu/battery temperature on Android 7.0+ platform in Unity? I tried WeTest but it's not working because my test device is Android 8.1. Also, I tried Emmagee however it's just working on Android 6.0 and below. Is there any other thing?

sentences:
Pygame Particle Emitter Problems so I've been trying to create a basic particle system in pygame which I can later expand upon but I've run into a spot of bother creating the particle emitter. Obviously what's supposed to happen is it's supposed to create a new particle every frame (or a set of particles) but instead it just alters the particle that's created first time round. I understand why this is happening, as far as the game is concerned, every frame I add the same object to the particle list so when I call the update function it calculates the positional and velocity sums multiple times, what I'm having trouble with is fixing it. How would I go about making a new particle every time?

My existing classes for this are as follows:

class Particle():
    def __init__(self, pos, vel, accel, image):
        self.pos = pos
        self.vel = vel
        self.accel = accel
        self.life = 255
        self.lifecount = 1
        self.image = image

    def update(self):
        self.vel.add(self.accel)
        self.pos.add(self.vel)
        self.life -= self.lifecount

    def is_dead(self):
        if self.life <= 0:
            return True
        else:
            return False

class Emitter():
    def __init__(self, pos):
        self.pos = PVector(pos[0], pos[1])
        self.particles = []
        self.part_list = [Particle(self.pos, PVector(0,2), PVector(0,0), pygame.image.load("resources/particles/fireball.png"))]

    def update(self):
        self.particles.extend(self.part_list)
        for p in self.particles[:]:
            p.update()
            if p.is_dead():
                self.particles.remove(p)

    def draw(self, surface):
        for p in self.particles:
            x = p.pos.x
            y = p.pos.y
            temp = pygame.Surface((p.image.get_width(), p.image.get_height())).convert()
            temp.blit(surface, (-x, -y))
            temp.blit(p.image, (0, 0))
            temp.set_alpha(p.life)
            surface.blit(temp, (x, y))

The positions, velocities and accelerations are all part of a vector class with vector math functions.

sentences:
Make variables public, or make functions to get/set variables? Dumb question but I want my game to be secure as possible. Right now I have classes interfacing with each other in order to save/load player information. Right now I have all the variables in my classes as public, and saving / loading the saved variables into them. But I don't think that's as secure.

Code:

public class PlayerRP : MonoBehaviour {

public string charName;
public string charRace;
public string charClass;
public string charClassSpec;
public string charBackground;
public string charGender;

}

public class CharacterManager : MonoBehaviour {
public void SaveCharacter() {
    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Create(Application.persistentDataPath + slotFile);

    CharacterSaveFile data = new CharacterSaveFile();

    // Character RP
    data.charName = playerRP.charName;
    data.charRace = playerRP.charRace;
    data.charClass = playerRP.charClass;
    data.charGender = playerRP.charGender;

    bf.Serialize(file, data);
    file.Close();

    LoadCharacter();
}
}

Would it be safer (or more efficient) to instead make methods in the playerRP class to get/set the variables separately, rather than have them as public?

sentences:
Why do people put a gif animation into a single bitmap? Possible Duplicate:
  2D graphics - why use spritesheets?

Something like this file from here:

I haven't write game with animated gif before.... So I wonder why.
When I unpack some game, I see them in this kind of format as well.

Why they are not divide them into individual bitmap?  When they are using it, do they IMPORT them into individual bitmap? or just use display them using offset?

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: DPad style movement for AI without using A* What is the easiest way to implement DPad style movement (No diagonal) for AI without using and A* algorithm? I thought about having the enemy catch up to the player in the Y axis first then the X axis (or vice versa) but then it would be too easy to evade the enemy. If it matters I'm doing this in Objective-C using Cocos2d. Any input would be appreciated.

sentences:
Shooting Projectiles I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this article (Scroll down to the ’Shooting Projectiles’ section): https://www.raywenderlich.com/95835/cocos2d-x-tutorial-beginners

Point projPos = shooter->getPosition();
projectile->setPosition(projPos);
projectile->setVisible(true);

Vec2 offset = target->getPosition() - projPos;
offset.normalize();

auto shootAmt = offset * 1000;
auto projEndPt = shootAmt + projPos;

// Approach 1.
auto moveAct = MoveBy::create(10.0f, shootAmt);

// Approach 2.
auto moveAct = MoveTo::create(10.0f, projEndPt);

projectile->runAction(moveAct);

It works most of the time, however the projectiles speed varies, it seems based on the distance between the player and shooter. At medium distances the speed is fine, at shorter distances the speed is too slow and at longer distances the speed is too fast. The time being fixed (10.0f) over a variable distances seems to be the cause. I have tried both approaches as commented in the code, moving by move amount (Approach 1) and move to point (Approach 2) and both seem to give the same result.

sentences:
How to Construct a Perspective Projection With 4 Vanishing Points Is it possible to construct a projection matrix which will create a perspective with four (or more) vanishing points?

This question have an OpenGL tag, but general insights are welcomed as well.

sentences:
Spherical / Relative Gravity I'm working on an Ogre3D + Bullet project that involves planets in a solar system. For all intents and purposes, I'm looking to give each planet it's own gravity sphere.

So far, all I've found are ways to change the "general" gravity Vector3 for the entire scene, but that's it.

While I'd hope to add air friction and other physics later on, for now I just want "prioritized" gravity, like in this video.

You'll note that the floor in the video has gravity, but when he jumps near the sphere, he is attracted to it sphere instead. That's exactly what I'm going for.

The video is very low quality and doesn't explain how any of it is working, besides the fact that it uses Ogre3D and Bullet.

The planets themselves are on pre-generated paths around the Sun - I'm not looking to apply "real" physics to the solar system itself; just for the planets themselves and eventually "generated gravity" for ships in space.

sentences:
Move a 2D square on y-axis on Android GLES2 I am trying to create a simple game for Android. To start, I am trying to make the square move down the y-axis, but the way I am doing it, it doesn't move the square at all and I can't find any tutorials for GLES20.

The onDrawFrame function in the render class updates the user's position based on acceleration due to gravity, gets the transform matrix from the user class which is used to move the square down, then the program draws it.

All that happens is that the square is drawn; no motion happens:

public void onDrawFrame(GL10 gl)
{
    user.update(0.0, phy.AccelerationDewToGravity);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Re draws black background

    GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, user.SquareVB);//triangleVB);
    GLES20.glEnableVertexAttribArray(maPositionHandle);
    GLES20.glUniformMatrix4fv(maPositionHandle, 1, false, user.getTransformMatrix(), 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

}

The update function in the player class is

public void update(double vh, double vv)
{
    Vh += vh; // Increase horrzontal Velosity
    Vv += vv; // Increase vertical velosity

    //Matrix.translateM(mMMatrix, 0, (int)Vh, (int)Vv, 0);
    Matrix.translateM(mMMatrix, 0, mMMatrix, 0, (float)Vh, (float)Vv, 0);
}

sentences:
How can I measure the velocity of a drag gesture? I want to measure the velocity of a drag(FreeDrag, VerticalDrag, HorizontalDrag) gesture on my Windows Phone. For example, if the measured velocity of a drag is 40 km/h, the player will shoot a bullet in the dragging direction that flies with 40 km/h.

How can I measure the velocity of a drag gesture on my Windows Phone?

Update:
I don't know how to measure the time. Is it possible to do it without touchCollection or should I use touchCollection to determine the StartTime and the EndTime?

I'm not sure if I need the touchCollection block. In addition, I'm not sure if I can use two different types, TimeSpan for StartTime and DateTime for EndTime.

What is the best way to measure the time?

TimeSpan StartTime;
DateTime EndTime;
TouchPanel.EnabledGestures = GestureType.FreeDrag;
protected override void Update(GameTime gameTime)
{
 TouchCollection touchCollection = TouchPanel.GetState();
 foreach (TouchLocation tl in touchCollection)
 {
   GestureSample gs = TouchPanel.ReadGesture();
    if ((tl.State == TouchLocationState.Pressed))
    {
     StartTime = gs.Timestamp;
     }
    if ((tl.State == TouchLocationState.Released))
    {
     EndTime = DateTime.Now;
     }
  }

    while (TouchPanel.IsGestureAvailable)
    {
    GestureSample gs = TouchPanel.ReadGesture();
       switch (gs.GestureType)
        {
          case GestureType.FreeDrag:
               StartTime = gs.Timestamp;
           break;
         }
     }
        base.Update(gameTime);
 }

sentences:
Trying to trigger dialogue when the space bar is clicked, and two objects are colliding I'm getting a NullReferenceException on OnTriggerStay. I've been going crazy trying to figure out why. I have tried to cut this down to only the relevent information. I got this code through a tutorial: https://www.youtube.com/watch?time_continue=48&v=_nRzoTzeyxU (just for credits).

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

[RequireComponent(typeof(Rigidbody))]
public class MainCharacter : MonoBehaviour {
    public int limbs;

    public float speed;
    public Vector3 jump;
    public float jumpForce;
    Rigidbody2D rb;
    public float fire_start_time = Time.time;
    Animator animator;
    public DialogueManager dialogueManager;

    // Checking if we are grounded
    public bool isGrounded;
    public LayerMask groundLayers;

    private SpriteRenderer myRenderer;

    public Sprite[] LimbSprites;

    void Start()
    {
        dialogueManager = gameObject.GetComponent<DialogueManager>();
    }

    public void OnTriggerStay2D(Collider2D collision)
    {
        if (Input.GetKey(KeyCode.Space))
        {
            Dialogue dialogue = collision.GetComponent<Dialogue>();
            dialogueManager.StartDialogue(dialogue);

        }
    }

}

Here is my dialogue manager:

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

public class DialogueManager : MonoBehaviour {

    public Text nameText;
    public Text dialogueText;

    public Animator animator;

    private Queue<string> sentences;

    // Use this for initialization
    void Start () {
        sentences = new Queue<string>();
    }

    public void StartDialogue (Dialogue dialogue) {

        animator.SetBool("IsOpen", true);

        nameText.text = dialogue.name;
        sentences.Clear();

        foreach (string sentence in dialogue.sentences) {
            sentences.Enqueue(sentence);
        }

        DisplayNextSentence();
    }

    public void DisplayNextSentence() {
        if (sentences.Count == 0) {
            EndDialogue();
            return;
        }

        string sentence = sentences.Dequeue();
        dialogueText.text = sentence;
    }

    void EndDialogue() {
        animator.SetBool("IsOpen", false);
    }
}

Here is DialogueTrigger

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

public class DialogueTrigger : MonoBehaviour {

    public Dialogue dialogue;

    public void TriggerDialogue () {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);

    }
}

Here is Dialogue

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

[System.Serializable]
public class Dialogue : MonoBehaviour {

    public string name;

    [TextArea(3, 10)]
    public string[] sentences;

}

sentences:
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:
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:
Comparison of two 2d top down player movement scripts in Unity I have been following along two different tutorials on making an 2d RPG and comparing the two movement scripts that seem to do the same thing but in different ways. Which is a better way when comparing these scripts?

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    private Animator anim;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update () {
        if(Input.GetAxisRaw ("Horizontal") > 0.5f || Input.GetAxisRaw ("Horizontal") < -0.5f){
            transform.Translate(new Vector3(Input.GetAxisRaw ("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
        }

        if(Input.GetAxisRaw ("Vertical") > 0.5f || Input.GetAxisRaw ("Vertical") < -0.5f){
            transform.Translate(new Vector3(0f, Input.GetAxisRaw ("Vertical") * moveSpeed * Time.deltaTime, 0f));
        }

        anim.SetFloat ("MoveX", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat ("MoveY", Input.GetAxisRaw("Vertical"));
    }
}

Script 2:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    Rigidbody2D rbody;
    Animator anim;

    // Use this for initialization
    void Start () {
        rbody = GetComponent<Rigidbody2D> ();
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate () {
        Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (movement_vector != Vector2.zero) {
            anim.SetBool ("Iswalking", true);
            anim.SetFloat ("Input_x", movement_vector.x);
            anim.SetFloat ("Input_y", movement_vector.y);
        } else {
            anim.SetBool ("Iswalking", false);
        }

        rbody.MovePosition (rbody.position + movement_vector * Time.deltaTime);
    }
}

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:
Networking Board Game Design Pattern I am currently working on a board game in Java with libgdx. It is supposed to be a multiplayer game, that you can play across multiple computers and for the sake of simplicity, I use kryonet.

Even though I assume my friends are no cheaters, I want all the game logic to happen on the server. This is for learning purposes, so I get to know a clean approach of anti-cheating.

However, I have been looking for design approaches for days now and really can't get my head around how I am supposed to handle actions, their verifications and distributions. You can think of the game as turn-based and similar to Monopoly, it especially has some sort of randomness (drawing event-cards).

At first, I came across FSM and thought it would be a perfect approach, because I could easily let a state process the input and send a corresponding package to the server, who does the validation and broadcasts it to the other clients, who then.. Yeah, what do they do with it? Simply updating the model (as of "Player 1 is not at tile 8) doesn't make too much sense, because I would then not have any actions, such as walking, state transitions, etc. (the game is running in an update method, with a delta parameter, so you usually step your game forwards here).

The second approach I came across was an "action" approach, that strongly discouraged the use of a FSM, because they would easily get too big and too complicated to understand later on. Every Action would have an "isvalid()" function, so the server could check the model for the action to be legal and then broadcast it to the clients to "take action" (pun intended). Here again, I feel the need of a FSM on the server side, so I can validate, whether an action would be legal or not.

Do you think it is fine to mix two approaches? Is there an major point in my understanding of the approaches, that is entirely wrong and leads me to some misconception?

Thanks in advance and have a good weekend!

sentences:
SharpDX: Render to bitmap using Direct2D 1.1 I have a command line application that I am currently using SharpDX (Direct2D 1.0) to render to PNG files. This is a window-less application.

It's currently creating a SharpDX.WIC.WicBitmap, a WicRenderTarget, then rendering to that. I then save the WicBitmap to the PNG file.

For various reasons, I need to migrate to Direct2D 1.1 to take advantage of some of the effects available in 1.1.

I'm trying to get a SharpDX.Direct2D1.Bitmap that I can save as PNG.

I cannot use FromWicBitmap because that copies the bitmap, it does not share it.

I see CreateSharedBitmap in the Direct2D1 API that takes a IWICBitmapLock. However, I do not see this implemented as a constructor of SharpDX.Direct2D.Bitmap.

This is what I'm trying to do:

// Bunch of setup
var d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice);

var d2dDeviceContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice,
    SharpDX.Direct2D1.DeviceContextOptions.None);

using (var wicFactory = new SharpDX.WIC.ImagingFactory())
{
  using (SharpDX.WIC.Bitmap wicBitmap =
    new SharpDX.WIC.Bitmap(wicFactory, 500, 500,
      SharpDX.WIC.PixelFormat.Format32bppPBGRA,
      SharpDX.WIC.BitmapCreateCacheOption.CacheOnDemand))
    {
    var wicLock = wicBitmap.Lock(SharpDX.WIC.BitmapLockFlags.Write);

    var props = new SharpDX.Direct2D1.BitmapProperties1();
    props.BitmapOptions = SharpDX.Direct2D1.BitmapOptions.Target;

    var bitmap = new SharpDX.Direct2D1.Bitmap1(d2dDeviceContext, wicLock, props); // This is not available

    d2dDeviceContext.Target = bitmap;

    // Do the drawing
    // Save the PNG
  }
}

Is there a way to do what I'm trying to accomplish?

sentences: Who makes the art assets for mobile games? I know how to develop apps for Android but never tried developing games, and I want to start soon. For developing games we need sounds and high quality images (say a background, characters, logos, etc.), so how to create these? For this should we have a separate team? Or a developer can create these using any tools?

sentences:
Player moving up, is he jumping or climbing? In a 2D physics-based platformer game that has ladders in it, how do you determine whether the player moving up is caused by a jump or him climbing a ladder, such that you know what animation to play?

And in general, obviously the direction vector is not enought to determine the animation to play: how do you also determine the cause of the movement (so you know the correct sprite to use)?

sentences: 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:
Implementing priority structure into a behavior tree, to react to player actions My goal is to have a behavior tree that can run alone (autonomously) but also react to input from the player.
I'm making an AI for a hack and slash game where the AI will fight you, chase you, etc. and play defensive based on certain stats (health etc), but I want to add an additional layer; events from player. Say the player attacks, I want a random chance maybe 5-10% to trigger a dodge or step-back from the AI.
Currently I have its own selector running, but that is not sufficient, as it just has same priority or triggers on the same level as the other selectors / sequences in the tree. So how do I go about implementing a priority into the tree?
I want to have dodge, which should be labelled as maybe priority 1 if the event triggers, else it should just go about its usual business.

sentences:
How to get rid of an image upon collision detection in SDL? I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars he can collect and get points.

I have set up my point system so now when he hits a good star, he should get a point. However, when he hits a star, he actually gets lots of points, as long as he is touching the star, which I don't want. I think that what's happening is because the stars are moving and he rubs up against the stars; each pixel he moves counts as a new collision so he gets a point per collision. Ideally, he should only get one point per star.

So I have two problems: 1) I need to figure out how to make it so that he can only get one point when he hits a star. 2) Since he is supposed to be 'collecting' the stars, I want to make the star disappear when he collects it.

So it's similar to most of these types of games, whereby, the player collects something, it disappears and they get a point.

EDIT:

This is struct I've made:

typedef struct {
    int x, y, w, h, baseX, baseY, mode;
    float phase;
} Goodstar;

I've then referenced it in another struct like so:

Goodstar goodStars[GOOD_STARS];
SDL_Texture *goodStar;

[GOOD_STARS] is equal to 100.

And then here's my collision detection code:

// Check for collision with good stars
for (int i = 0; i < GOOD_STARS; i++) {
    if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
        if (!game->man.isDead) {
            game->man.points++;
        }
        break;
    }
}

So right now it only checks for a collision and then adds a point.

EDIT 2:

This is the code you suggested and it works:

for (int i = 0; i < GOOD_STARS; i++) {
    if (!game->goodStars[i].awarded) {
        if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
            if (!game->man.isDead) {
                game->man.points++;
                game->goodStars[i].awarded = 1;
            }
            break;
        }
    }
}

And this is my initialisation code:

  // Initialise stars
  for (int i = 0; i < GOOD_STARS; i++) {
    game->goodStars[i].baseX = 320 + random() % 38400;
    game->goodStars[i].baseY = random() % 480;
    game->goodStars[i].mode = random() % 2;
    game->goodStars[i].phase = 2 * 3.14 * (random() % 360) / 360.0f;
        game->goodStars[i].awarded = 0;
  }

sentences:
giving to object velocity to the direction it facing (unity) I making 2d game on unity5 .I want to give to an object starting velocity to the direction it is facing(looking).(I put it in the "start" method)
how can i do it?

sentences:
Colliders along the edge of the sprite I am trying to make a collider along the edges of my sprite, something like what an outline shader does. I tried adding a polygon collider 2D as you can see below but it doesn’t take the shape of the sprite. Any help is appreciated

https://imgur.com/a/LVsmNli

sentences:
Why do all my matrices end up with the same values in this code? My programme reads a binary file. For that I made a Dictionary<int, float[]> where int is order number (ID) and float[] is an array of important values.
Here's my code how I read the binary file to my dictionary:

        inv_bind_mats = new Dictionary<int, float[]>();
        float[] Farr = new float[16];

        string path2 = Application.StartupPath + "\\skeletons\\" + skeletonName + ".bone_inv_trans_mats";
        using (BinaryReader inv_trans_mats = new BinaryReader(File.Open(path2, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.ASCII))
        {
            inv_trans_mats.BaseStream.Seek(4, SeekOrigin.Begin);
            bonesCount = inv_trans_mats.ReadUInt32();
            for (int i = 0; i < bonesCount; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    if (j < 12)
                    {
                        Farr[j] = inv_trans_mats.ReadSingle();
                    }
                    else if (j >= 12)
                    {
                        Farr[j] = 0.0f;
                    }
                }
                inv_bind_mats.Add(i, Farr);
            }
        }

It doesn't matter which ID I choose all float[] values are same for each.
This binary file is an inverse matrix of skeleton bones.
Each bone has 12 float values when I need to get 16 so I just add 4 more '0' values to what I get from file.

But the problem is all float values from inv_bind_mats[i][0-16] to inv_bind_mats[i][0-16] are equal.

How I want it to work: each bone has it's own matrix (float array) instead of one matrix for all bones.

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:
matrix to transform unit cube to space defined by 8 arbitrary points I asked a question relating to similar to this already, but I think this is a clearer objective of what Im trying to achieve.. or whether its possible at all!

Im trying to find a transformation (matrix ideally) which would transform the 8 points of a 3d unit cube to 8 arbitrary points in space.

The 8 target points have no known structure.

e.g:

My gut feeling is that a matrix is unable to provide this xform since the cube faces vertices can be concave.. but are there any other methods of transformation?
Thanks!

sentences:
Why the Vector3.Dot value is -12 when running the game? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System;

public class InteractableItem : MonoBehaviour
{
    public string currentMode;

    private Transform player;
    private InteractableMode currentInteractableMode;
    private string currentDesription;
    private float originDistance;

    private void Awake()
    {
        player = GameObject.Find("Player").transform;

        originDistance = transform.GetComponent<InteractableItem>().distance;
    }

    public enum InteractableMode
    {
        Description,
        Action,
        ActionWithoutThrow
    };

    public enum ViewMode
    {
        FrontView,
        AllView
    };

    public ViewMode viewMode = ViewMode.AllView;

    public InteractableMode interactableMode = InteractableMode.Description;
    public float distance;

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

    public bool IsAnyAction()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow || interactableMode == InteractableMode.Action;
    }

    public bool IsActionWithoutThrow()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow;
    }

    private void Start()
    {
        currentMode = GetComponent<InteractableItem>().interactableMode.ToString();
        currentInteractableMode = GetComponent<InteractableItem>().interactableMode;
        currentDesription = GetComponent<InteractableItem>().description;

    }

    private void Update()
    {
        var heading = transform.position - player.transform.position;
        var dot = Vector3.Dot(heading, -transform.forward);

        if(viewMode == ViewMode.FrontView
            && dot < 1)
        {
            transform.GetComponent<InteractableItem>().distance = 0;
        }

        if (viewMode == ViewMode.FrontView
            && dot > 1)
        {
            transform.GetComponent<InteractableItem>().distance = originDistance;
        }
    }
}

The script is attached to some objects and one of them the ViewMode is set to FrontView and then when running the game first time the dot value is -12 and then it's getting inside and going the line :
if(viewMode == ViewMode.FrontView
    && dot < 1)
{
    transform.GetComponent<InteractableItem>().distance = 0;
}

but it should not set the distance to 0.  only if I'm getting close enough to the item then it should see the item from the front and then only if I'm moving the player behind the item the dot should be minus and set the distance to 0 but for some reason the dot is minus 12 when running the game so it's setting the distance to 0 right away.

sentences:
Unity5 - Create navmesh for a random generated environment I am following this tutorial to create a game with random generated mazes:

http://catlikecoding.com/unity/tutorials/maze/

I want to add some monsters to roam around the newly created maze. How can I create navmesh for this kind of random generated environment?

sentences:
Has Java 3D changed much since 2005? I'm thinking of picking up the book called "Killer Game Programming" by Andrew Davidson, but its pretty old, now. I know Java, and I've been messing with jMonkeyEngine for a few days, but I'm curious to see if I would benefit from the 3D chapters of this book.

The book was published was in 2005. Has Java changed to the point where this book would now be obsolete, assuming it was up to date at time of publication?

sentences:
Console spam when opening editor: Assertion failed on expression: 'txn.Exists(guid)' I have just opened up a new project in Unity 2019.3.04b - and in the console I got an error message repeating a lot of times:

In addition, when unfocus and focus Unity, it spits out one more pair of errors (the same errors like in this image).
Anyone knows what it is and how to fix it?

sentences:
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:
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 access the players XBOX account from your Windows 10 game app? We want to release a game that was previously an Android game for Windows 10 (Store / Desktop). Could you tell me how we can access the players XBOX account, see his friends and compare their scores? We also want to display their profile pictures. Sadly we don't even have an idea how the API we're looking for is called. We're confused by these "universal app" things. I saw something similar in the Minecraft app for Windows 10. Our Engine is the latest version of Unity, by the way. If informations are missing, please let me know.

All I have to know is where to find the API and it's name. A link to tutorials could be useful :)

Thanks!

sentences:
Using Quaternions: What can I do with them? (without the maths) I am a Game Developer and did not study Mathematics. So I only want to use Quaternions as a tool. And to be able to work with 3D rotation, it's necessary to use Quaternions (Or Matrixes, but let's stay at Quaternions here in this Question). I think it's important for many developers to use them. That's why I want to share my knowledge and hopefully fill the holes I have. Now....

So as far as I understood:

A Quaternion can describe 2 things:

The current orientation of a 3d Object.
The rotation transformation a Object could do. (rotationChange)

You can do with a Quaternion:

Multiplications:

Quaternion endOrientation = Quaternion rotationChange * Quaternion currentOrientation;

So for example: My 3D Object is turned 90° to left - and my rotation I multiply is a rotation 180° to right, in the end my 3D Object 90° is turned to right.
Quaternion rotationChange = Quaternion endRotation * Quaternion.Inverse(startRotation);

With this you get a rotationChange, which can be applied to another Orientation.
Vector3 endPostion =  Quaternion rotationChange * Vector3 currentPosition;

So for example: My 3D Object is on Position (0,0,0) and my rotation I multiply is a rotation 180° to right, my endposition is something like (0,-50,0) . Inside that Quaternion there is a Axis - and a rotation around that axis. You turn your point around that axis Y Degrees.
Vector3 rotatedOffsetVector = Quaternion rotationChange * Vector3 currentOffsetVector  ;

For example: My start direction is showing UP - (0,1,0), and my rotation I multiply is a rotation 180° to right, my end direction is showing down. (0,-1,0)

Blending (Lerp and Slerp):

Quaternion currentOrientation = Quaternion.Slerp(startOrientation, endOrientation , interpolator)

if the interpolator is 1 : currentOrientation = endOrientation

if the interpolator is 0 : currentOrientation = startOrientation

Slerp interpolates more precise, Lerp interpolates more performant.

My Question(s):

Is everything I explained until now correct?

Is that "all"  you can do with Quaternions?
(obv. not)

What else can you do with them?

What are the Dot product and the Cross product between 2 Quaternions good for?

Edit:

Updated Question with some answers

sentences:
How do I persist the states of distant objects? How would one manage the state of static living things like trees in a large sandbox world? Trees in Minecraft, for example: They grow even when the player is far away.

One way is to save them with a timestamp as they go "out of range" and stop updating them in the usual way. Then re-instate them with a sensible state by running an update with a delta time of the time elapsed since that saved time.

I'm planning a new prototype but this has me a bit stumped.

sentences:
How can I handle inventory in an object-oriented way? I'm trying to think of the best way to handle player inventory following an object oriented approach.

For example, sword and axe are two different classes, both inheriting from weapon. Weapon and potion are also different classes both inheriting from item.

Ideally, the inventory would be implemented as a container of items, but that can't be done for several reasons. So it has to be a container of item (smart) pointers. Since I don't want to liter my code with calls to new and delete, I'll wrap it in an ItemWrapper class which news/deletes on ctor/dtor.

So the code will look something like this

class Sword;
class ItemWrapper;

//Prepare the long sword.
const Sword longSword(...params...);

//Declare the inv
vector<ItemWrapper> inv;

 //Add it to inventory
inv.push_back(longSword);  //compiles if ItemWraper(const Sword&) is defined.

This approach was the best I could come up with in terms of code clarity and ease of writing. The problem is that ItemWrapper will need one constructor for each leaf class that inherits from Item (which is a lot).

This is my first attempt at this, so I'd like to know: am I going the right way? or if there's a better way of doing it (perhaps one that avoids so many constructors)?

sentences:
Problem animating in Unity/Orthello 2D. Can't move gameObject I have a enemy npc that moves left and right in a corridor.
It's animated with 2 sprites using Orthello 2D Framework.

If I untick the animation's play on start and looping, the npc moves correctly.
If I turn it on, the npc tries to move but is pulled back to his starting position again and again because of the animation loop.
If I turn looping off during runtime, the npc moves correctly again.

What did I do wrong?

Here's the npc code if needed.

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour
{
    private Vector2 movement;
    public float moveSpeed = 200;
    public bool started = true;
    public bool blockedRight = false;
    public bool blockedLeft = false;
    public GameObject BorderL;
    public GameObject BorderR;

    void Update ()
    {
        if (gameObject.transform.position.x < BorderL.transform.position.x)
        {
            started = false;
            blockedRight = false;
            blockedLeft = true;
        }
        if (gameObject.transform.position.x > BorderR.transform.position.x)
        {
            started = false;
            blockedLeft = false;
            blockedRight = true;
        }

        if(started)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedRight && !started && blockedLeft)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedLeft && !started && blockedRight)
        {
            movement = new Vector2(-1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
    }
}

sentences:
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:
Maximum tile and texture size for tiled maps I'm currently making a game using libGDX and Tiled.

Everything was running fine until I changed the tile size from 96x96 to 300x300. Most layers are still displayed correctly but the tiles of a single layer are just black. I guess that there may be a problem with the large tiles (as there are some tiles together in one tileset bitmap the texure is 2100x2100 large). Are there any upper limits for tiles and/or tilesets regarding the bitmap and texture size?

GL_MAX_TEXTURE_SIZE returns 3379 on this machine.

sentences:
clip space, normalized device coordinate space and window space in OpenGL I am learning OpenGL. Clip space, normalized device coordinate space and window space are confusing. I searched but still don't understand them clearly.
So, the question is- what are differences between them and how are they converted from one to another? And what coordinate do the built-in OpenGL functions (e.g.: glBufferData) take as input?

sentences:
OpenGL glVertexAttribFormat vs glVertexAttribPointer I am attempting to change my code from using glVertexAttribPointer to glVertexAttribFormat as I have heard it;s more efficiend since it reduces binding calls overhead.

I have 2 versions of the code, one working one not.

The code looks like:

glGenBuffers(1, &tvbo1);
glBindBuffer(GL_ARRAY_BUFFER, tvbo1);
glObjectLabel(GL_BUFFER, tvbo1, 21, "\"Mesh Vertex Buffer\"");
glBufferData(GL_ARRAY_BUFFER, sizeof(vec3)*triangle.size(), triangle.data(), GL_STATIC_DRAW);

glGenBuffers(1, &tvbo2);
glBindBuffer(GL_ARRAY_BUFFER, tvbo2);
glObjectLabel(GL_BUFFER, tvbo2, 22, "\"Mesh Normals Buffer\"");
glBufferData(GL_ARRAY_BUFFER, sizeof(vec3)*ns.size(), ns.data(), GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
//glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribFormat(0, 3, GL_FLOAT, GL_FALSE, 0); //comment
glVertexAttribBinding(0,0); //comment

glEnableVertexAttribArray(1);
//glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribFormat(1, 3, GL_FLOAT, GL_FALSE, 0); //comment
glVertexAttribBinding(1,1); //comment

GLuint ptrs[] = {tvbo1, tvbo2};
GLintptr offsets[] = {0,0};
int strides[] = {0,0};
glBindVertexBuffers(0, 2, ptrs, offsets, strides); //comment

So whenever you see a //comment. That's to denote that in the other version that line is commented out.

The version that does work uses:

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

The version that does not work uses:

glVertexAttribFormat(0, 3, GL_FLOAT, GL_FALSE, 0); //comment
glVertexAttribBinding(0,0); //comment

glBindVertexBuffers(0, 2, ptrs, offsets, strides); //comment

The difference between working and not working is having a purple triangle vs having a black screen.

It seems that the error comes from the line

glBindVertexBuffers(0, 2, ptrs, offsets, strides); //comment

As having that line present results in a black screen regardless of the rest of the code.

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: Can I give a player money for completing my game? As it says in the title, can I give a player that completes my game (which might be hard to complete) money?

sentences:
How to: create a 3rd person view, multiple layer 3d world Imagine a game world like in Dungeon Keeper or Sim City with an (possibly rotatable) 3rd person view, where the game world can be accessed in all dimensions (in discrete steps). For example digging into the ground and accessing a whole new layer, but with the possibility of visible connections between the layers, like an underground dome that exposes a cross-section of several z-layers.

I imagine such a world rather hard to visualize so that it stays as easy and intuitive for the player to navigate as a game world limited to 2 dimensions or from first person. Problems I could see include obstructed areas, differentiating between z-levels, placing stuff in the wrong place, navigating back and forth between places of player interest, clicking the wrong stuff because of perspective issues.

I would be willing to go to great lengths to make navigation in such a world as non-hassling as possible, and I would rather abandon the concept instead of making a frustrating interface.

Do you know any solutions to this problem, maybe even examples where it has been solved in an actual game, or at least in a concept?

(Also, I propose the "perspective" tag, can't add it yet)

sentences:
How to make score counter independent of framerate I have a score counter, but I've noticed that the lower the framerate is, the slower it counts. How can I make it so it ignores the framerate?

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

public class Score : MonoBehaviour {
    private Text scoreText;
    private static int score;
    private static int finalScore;
    private static bool count;
    public static int scoreMultiplier;

    private void Start() {
        scoreText = GetComponent<Text>();
        count = false;
        scoreMultiplier = 1;
    }

    public static void StartCounting() {
        count = true;
    }

    public static void StopCounting() {
        count = false;
    }

    public static void Reset() {
        count = false;
        score = 0;
    }

    public static IEnumerator MultiplyBy(int scoreMultiplier) {
        Score.scoreMultiplier = scoreMultiplier;
        yield return new WaitForSeconds(6f);
        Score.scoreMultiplier = 1;
    }

    private void Update() {
        if (count) {
            score += scoreMultiplier;
        }

        // Slice the score so the number doesn't get too big
        finalScore = score / 4;

        scoreText.text = finalScore.ToString("00000");
    }
}

Edit: Fixed by adding Time.deltaTime and putting it in FixedUpdate instead of Update

private void FixedUpdate() {
    if (count) {
        score += scorePerSecond * Time.deltaTime * scoreMultiplier;
    }

    finalScore = Convert.ToInt32(score);
    scoreText.text = finalScore.ToString("000000");
}

sentences:
Make Build and Run faster Is there a way to build an apk faster? (by disabling some shader compilation, for example Hidden/Post FX/Uber Shader takes most of the build time)

p.s. Yes I know about Unity Remote and use it - this time I need exactly Build and Run.

sentences:
How can I implement triple buffering using Direct3D 9? I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE:
The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

When using the back buffer at index 1 the frame rate falls to 30fps while using vsync. This produces artifacts and Horizontal Shearing. Using the back buffer at index 0 seems to be correct. When using this buffer the application presents a frame at the refresh rate of the monitor. Therefore in order to correctly implement triple buffering using Direct3D 9 you should draw to the back buffer at index 0.

sentences:
How do I randomly spawn objects in 2D game? How do I randomly spawn few different sprites on screen so they're not overlapping or half visible on render. The sprites should immediately start shrinking until they disappear.

I've tried to demonstrate what I have so far using JS, however it's overlapping and not shrinking:

http://jsfiddle.net/SamuraiFox/CVX7D/

Specific to Unity, I've made these sprites prefabs and have put them into the scene from where script would spawn them into game.

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:
Licensing (or similar) for my fan-game? For the past 8 years, I've been working on a Pokémon fan-game. It's been awesome, well-received by players, and I'm very proud of the community we've built. But, as with all things "fan-game", there's always that looming grey cloud of "will a C&D arrive tomorrow?"

Now, I've taken some steps to ensure we're as respectful as possible towards Nintendo's property:

We stay as true as possible to the source material. While we have added our own variants and original characters ("Fakemon"), we've made great efforts to keep them consistent.
We make it clear that we are a fan-game, not affiliated with Nintendo, and that it is entirely unofficial. I also include a link to a shareholder Q&A (Q14) where Satoru Iwata confirmed that they are not interested in treating people like myself as criminals.
Our game concept is original. It's not a clone of any existing game, and I like to think it fills a nice little hole for fans of the series.
I (briefly) met C-level people from Game Freak and Nintendo, including Junichi Masuda and Tsunekazu Ishihara, and given them "business cards" for our game. However, it wasn't a formal meeting, rather they were signing autographs at the Pokémon World Championships, so for all I know I was probably just some fan and they didn't pay much attention to the card (they've got enough to do already, right?)

But, all that being said, we're still unofficial, using intellectual property that doesn't belong to us.

My friend and I quit our jobs to work on this game full-time. If we do get shut down, we're going to have to seriously struggle to put our lives back together. So for now, the game has mostly been kept "under the radar", with basically zero marketing and only word-of-mouth of players to keep it populated.

The biggest thing here is that I want to give back to Nintendo. Thanks to them, and to my project, I've made incredible progress as a developer, designer and just as a person in general.

As mentioned earlier, my biggest fear is that one day they'll shut us down. And we'd have no choice but to do so. But it's been 8 years now...

So I'm trying to figure out what options I have, if any. I think what I want to do is to reach out and ask about some kind of licensing, but I don't want to draw too much attention. I don't want to lift my head over the parapet only to have it blasted off, you know? I'm not looking for Pokémon GO levels of attention, or even Magikarp Jump. (Our single server would melt either way - I'm working on it!) Just some way of having actual "permission" to do what I'm doing.

I expect the answer will probably be along the lines of "IANAL, get one", but what kind of lawyer would be best? And any insights or advice besides that would be helpful too.

sentences:
class diagrams / design for an adventure game (rooms, objects, inventory)? Any links to existing design (e.g. class diagrams, database ER diagrams) for a basic adventure game - i.e. that has the aspects of:

rooms/locations (which you move between)
objects which you collect / use (which may have behaviours)
inventory (i.e. items which you carry)
rules (e.g. if you to want to open Door X, then you need Key Y)

sentences:
Gaussian blur spritesheet/texture atlas without clipping edges I'm trying to apply a Gaussian blur to a shadow to soften them a bit. I can apply the blur fine, but the problem is that I end up with this:

Instead of this:

Which isn't great. The image is part of a spritesheet with a single pixel gutter around each frame.

I don't want to have to go back and add gutters big enough to accommodate the blur to every single frame of every spritesheet. Additionally because of the way the sprites have to be sorted I can't render all the shadows to a render target and then blur the entire target. I can achieve the effect I want with a sprite as a single image instead of as a spritesheet. I do that by creating the triangles 20% bigger than they need to be and then sampling the texture outside the bounds when the UV addressing is set to clamp. That doesn't work with a spritesheet though because then it just starts sampling the frames on either side of the current frame.

Is there a way to achieve what I want with a shader or other trickery? I really don't want to have to alter every spritesheet.

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:
Adding lighting to custom vertex shader in Unity What's the simplest way to add shadow functionality based on the modified vertices, nothing I've found online seems to work
 Shader "Unlit/HyperUnlit"
 {
     Properties
     {
         _MainTex ("Texture", 2D) = "white" {}
         _Color("Color", Color) = (1,1,1,1)
     }
     SubShader
     {
         Tags { "RenderType"="Opaque" }
         LOD 100

         Pass
         {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag

             #include "UnityCG.cginc"
             #include "Complex.cginc"

             struct appdata
             {
                 float4 vertex : POSITION;
                 float2 uv : TEXCOORD0;
             };

             struct v2f
             {
                 float2 uv : TEXCOORD0;
                 UNITY_FOG_COORDS(1)
                 float4 vertex : SV_POSITION;
             };

             sampler2D _MainTex;
             float4 _MainTex_ST;
             fixed4 _Color;

             //Params
             float Tscale;
             float3 Tpos;
             float klein;
             float Rscale;

             //Mobius Transformation (a,b,c,d)
             float2 a;
             float2 b;
             float2 c;
             float2 d;

             v2f vert (appdata v)
             {
                 v2f o;
                 //Reduce to float3
                 float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)).xyz;

                 //2. Apply linear transformations
                 worldPos *= Tscale;
                 worldPos += Tpos;

                 //3. Apply mobius transformation
                 worldPos = MobiusXZ(a,b,c,d, worldPos);

                 //4. Klein?
                 if (klein==1)
                 {
                     worldPos = PoincareToKlein(worldPos);
                 }

                 //5. Scale to disk radius
                 worldPos *= Rscale;

                 //Convert back to ? space
                 o.vertex = mul(UNITY_MATRIX_VP, float4(worldPos, 1));

                 //transform position to clip space
                 //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) * _Color;
                 return col;
             }
             ENDCG
         }
         UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
     }
 }

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

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

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

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

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: What exactly is the difference between Unreal Development Kit and Uunreal Engine 4? I want to start learning game development and I would obviously come across this tool. So every where I went people mentioned Unreal Engine 4 to be a viable choice, I've tried a bit of Unity and now I want to try Unreal. Only issue I came across UDK and UE4, I downloaded UDK which turns out to be different from tutorials and I can't seem to find any info on that and besides I could only run the software once because after the first time it starts a game, I re-installed UDK I still get the issue, but anyways that's a different topic, what I want to know is whether UDK and UE4 are different and if they are, where do i get UE4, becauuse when I down UE4 (from - https://www.unrealengine.com/dashboard), it downloads a game launcher and no development tool. In case they are same, why is my version of UDK different fr

sentences:
Sorting armor sprites over body sprites in 3D I'd like to use sprites for my characters in a 3D game world, but I'm having issues getting them to cooperate.

I want to have my characters to have outfit/appearance customization options, and so to me the solution is to sprite my characters as individual pieces (torso, head, upper arm, forearm, hand, etc) and then animate those pieces within unity. The armor and other customization objects would then be parented to a body part, rendering over top of the body and moving along with it. Such a design would allow me to essentially drag-n-drop different armor pieces without any extra work required to make them fit, so long as the sprites themselves line up correctly.

However, when looking at the character from an odd angle, the sprite ordering goes out the window. I understand this is due to z-sorting, and to try to combat this, i tried editing the sort order so that armor always appears on top of the body. The problem with this is that the armor of characters in the background would then render over the body of characters in the foreground.

Does anyone have a solution that could work for my situation?

sentences:
Is it bad practice to use the entire map image as a tilemap? I made a map in photoshop which I want to use as a map in my game. The question is should I try to cut it up to pieces, or is it bad (performance wise) if I use  the way I made it. The picture itself is really specific without any repeatable part so I'm not sure if I can cut it up to smaller parts.

I'm kinda new to game developement, so pls forgive me if I asked something stupid here.

sentences: How can I come up with a simple diminishing return equation? There are formulas out there for a diminishing return equation; however, those usually involve exponential. What other ways are there for coming up with such an equation? Take, for example, the following test case -- One farm produces 10 food, for every 10 farms produced, the production rate drops by 5%.

sentences:
Changing color for each element in linerenderer not working I want to change color for each line (element) just like in color switch. But my code is not working. What I wanted is that the right line should turn blue then the down line should turn color red. What is wrong with my code?

void Start()
{
    lineGeneratorPrefab = new GameObject();
    DrawLine();
}

private void DrawLine()
{
    GameObject myLine = new GameObject();
    myLine.transform.position = start;
    myLine.AddComponent<LineRenderer>();
    LineRenderer lr = myLine.GetComponent<LineRenderer>();

    lr.positionCount = 4;

    lr.SetPosition(0, new Vector3(-2, 0, 0));
    lr.SetPosition(1, new Vector3(2, 0, 0));
    lr.SetPosition(2, new Vector3(2, -2, 0));
    lr.SetPosition(3, new Vector3(-2, -2, 0));
    lr.materials[2].color = Color.blue;
    lr.materials[3].color = Color.red;
}

sentences:
Spherical procedural terrain shader based on slope I've created a spherical terrain object out of 6 sphere projected (normalised) planes, each plane has been heightmapped post to being normalised.

I'm looking to create a CG shader which will firstly calculate the slope of the heightmapped terrain, I understand this will need to look at the normals to calculate this can anyone elaborate on this for me? The next problem is that I want to do the slope calculations based upon the terrain "flat" rather than normalised.

Would it be best to either reverse the normalisation of the vertices during the slope calculations, or pre calculate and store the vertices slope data (on the flat plane) during the mesh generation?

This is an example of what I want to achieve with the shader:

Any suggestions would be brilliant.

Thanks, C.

Update in response to opatut answer:

I've output the current slope data based of how I "think" was suggested and these were the results:

I think my issue is that as each plane begins to curve that curve is includes as a slope which is the obvious thing to happen. I want to "flatten" out each of the 6 planes again for the slope calculations.

sentences:
Game Server Mechanic Hey guys :) Im currently developing a little rpg duengon crawler.
I really want to implement a local and an online multiplayer function, i know how servers are working and how to make them using sockets or kryonet.

But heres my question, i want that when someone, starts a local server in my game, that it starts an runnable jar file which includes the server, is that recommend or just stupid ? Should the server be included in the game or outside in an extra file ? What should i obverse ? :)

sentences:
Cannot open a package from the Unity Asset Store website Yesterday I found an asset on the Unity Asset Store website, clicked the button "Open in Unity", and it was opened in Unity.

Today, when I did the same thing, I got the error message below:

I opened the Defaults Apps page in Windows 10 Settings. But what do I do from here?

sentences: computer language like arduino language for visualization or game development Is there a language similar to Arduino language (c++ language with fewer functions) for software visualization?

sentences:
How to create a custom set of coordinates based on two points in Unity? As the title says, I am having problems finding a way to create a new set of local coordinates based on two points. Here is an example:

Consider that the two gameObjects are not one parent of another, therefore I cannot use something like transform.localPosition, furthermore I tried using transform.TransformPoint(), however the latter works only if if I want to create it with respect to a single point.
I think it is a silly question, yet I am not finding a way to solve it, so any help is greatly appreciated!

sentences:
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:
Place tile values over 'chunk' boundries My game has a 'chunk' engine similar to Minecraft's but in 2 dimensions.
Each chunk is a square of 32 by 32 tiles.

What I want to do is generate a defined shape across multiple chunks without breaking the shape.

This is made difficult by the fact that chunks are generated one chunk at a time in unknown intervals of time, so I cannot place a structure after the amount of chunks it needs to fit in are generated, as the player might move into the area before that time.

Another problem is that I cannot simply tile the shape uniformly because the shape needs to be exactly one tile above the surface, which is a heightmap generated using simplex noise, so it is not flat.

Is there any way I can generate this structure from one point of origin placed at random intervals over a heightmap that is known?

Example of what I want:

Grey Lines - chunk bounds

White Tiles - structure generation

Blue Tiles - known 1D heightmap

How can this be done?

sentences:
Collision detection - Smooth wall sliding, no bounce effect I'm working on a basic collision detection system that provides point - OBB collision detection. I have around 200 cubes in my environment and I check (for now) each of them in turn and see if it collides. If it does I return the colliding face's normal, save the old player position and do some trigonometry to return a new player position for my wall sliding.

edit
I'll define my meaning of wall sliding: If a player walks in a vertical slope and has a slight horizontal rotation to the left or the right and keeps walking forward in the wall the player should slide a little to the right/left while continually walking towards the wall till he left the wall. Thus, sliding along the wall.

Everything works fine and with multiple objects as well but I still have one problem I can't seem to figure out: smooth wall sliding. In my current implementation sliding along the walls make my player bounce like a mad man (especially noticable with gravity on and moving forward).

I have a velocity/direction vector, a normal vector from the collided plane and an old and new player position. First I negate the normal vector and get my new velocity vector by substracting the inverted normal from my direction vector (which is the vector to slide along the wall) and I add this vector to my new Player position and recalculate the direction vector (in case I have multiple collisions).

I know I am missing some step but I can't seem to figure it out.

Here is my code for the collision detection (run every frame):

Vector direction;
Vector newPos(camera.GetOriginX(), camera.GetOriginY(), camera.GetOriginZ());
direction = newPos - oldPos; // Direction vector
// Check for collision with new position
for(int i = 0; i < NUM_OBJECTS; i++)
{
    Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z);
    if(normal != Vector::NullVector())
    {
        // Get inverse normal (direction STRAIGHT INTO wall)
        Vector invNormal = normal.Negative();
        Vector wallDir = direction - invNormal; // We know INTO wall, and DIRECTION to wall. Substract these and you got slide WALL direction
        newPos = oldPos + wallDir;
        direction = newPos - oldPos;
    }
}

Any help would be greatly appreciated!

FIX
I eventually got things up and running how they should thanks to Krazy, I'll post the updated code listing in case someone else comes upon this problem!

for(int i = 0; i < NUM_OBJECTS; i++)
{
    Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z);
    if(normal != Vector::NullVector())
    {
        Vector invNormal = normal.Negative();
        invNormal = invNormal * (direction * normal).Length(); // Change normal to direction's length and normal's axis
        Vector wallDir = direction - invNormal;
        newPos = oldPos + wallDir;
        direction = newPos - oldPos;
    }
}

sentences:
Overlapping sibling problem in AABB tree I'm trying to make a real-time GPU (CUDA) ray tracer, and for now I'm tracing single rays, but I've ran into a problem: the BVH. This [PDF]paper has been my inspiration for the theoretical part, and as you can see, the BVH is composed of Axis Aligned Bounding Boxes, however, the stackless rope-based algorithm for the ray-AABB intersection does not take into account overlapping siblings, which occur quite a lot with the AABB creation algorithm I've read about in multiple places on the Internet, which is averaging the centroid of each triangle in the current triangle list and deciding in which child to place each triangle based on the projection of the average on the axis parallel to the longest edge of the parent box.

The use of AABBs in the paper indicates that there indeed exists a method to efficiently (in terms of speed) make AABB trees without overlapping siblings. Unfortunately, I can't find such a method.

Would someone please describe a fast method for creating an AABB tree without overlapping children? I'd also appreciate it if they'd post pseudocode too.

Thank you.

sentences:
Predicted ability edge case issue I am in the process of creating an ability system with client prediction akin to Unreal Engine 4's Gameplay Ability System.
I found an edge case where the client's tags that are applied from effects become out of sync with the server.
The prediction method I use is the same as detailed here.
Here is a scenario that illustrates this:
The player has 2 abilities, an ability to unsheathe their weapon, and an ability to sheathe their weapon. Each ability requires a specific tag to activate. For the unsheathe ability, it is the "Sheathed" tag. For the sheathe ability, it is the "Unsheathed" tag.
There also exist two effects that apply these tags. The UnsheatheEffect applies the "Unsheathed" tag and the SheatheEffect applies the "Sheathed" tag.
The unsheathe ability lasts for 1 second and at the end applies the UnsheatheEffect and removes the SheatheEffect. The sheathe ability does the same thing but applies the SheatheEffect and removes the UnsheatheEffect.
In this scenario, the player has a static ping of 1 second.
0 seconds: The client activates unsheathe ability. Tags {"Sheathed"}
1 second: The server activates unsheathe ability.
1 second: The client finishes unsheathe ability. Tags {"Unsheathed"}
1 second: The client proceeds to activate sheathe ability. Tags {"Unsheathed"}
2 seconds: The server finishes unsheathe ability and starts the sheathe ability.
2 seconds: The client finishes the sheathe ability. Tags {"Sheathed"}
2 seconds: The client activates the unsheathe ability. Tags {"Sheathed"}
3 seconds: The client reconciles with what happened on the server as a result of the unsheathe ability. Tags {"Unsheathed", "Sheathed"}.
The issue is that the client has already gone through the process of removing tags after abilities, but they are soon added back because of the reconciliation with the server. I am really not sure what to do about this, because the client should be in sync with the server, but it ends up just messing up the whole system.

sentences:
NullReferenceException being thrown when I try to add a component to a dictionary I have the following section of code from a MonoBehaviour class in a voxel engine that I'm currently working on right now:

public void CreateChunk(Position chunkPosition)
{
    GameObject newChunk = (GameObject)Instantiate(
        this.ChunkPrefab,
        new Vector3(chunkPosition.X, chunkPosition.Y, chunkPosition.Z),
        Quaternion.identity
    );

    Debug.Log("New Chunk", newChunk);

    Chunk newChunkComponent = newChunk.GetComponent<Chunk>();
    newChunkComponent.ChunkPosition = chunkPosition;
    newChunkComponent.ParentTerrainManager = this;

    this._ChunksInMemory.Add(chunkPosition, newChunkComponent);

    for(int x = 0; x < Chunk.GlobalChunkSize; x++)
    {
        for(int y = 0; y < Chunk.GlobalChunkSize; y++)
        {
            for(int z = 0; z < Chunk.GlobalChunkSize; z++)
            {
                newChunkComponent.CreateBlock(new Position(x, y, z), new Stone());
            }
        }
    }
}

The Chunk class is also a MonoBehaviour class as well. I'm trying to instantiate a chunk prefab and then get the Chunk component from the instantiated prefab. Unfortunately I get the following NullReferenceException:

NullReferenceException: Object reference not set to an instance of an object
Voxel.Engine.TerrainManager.CreateChunk (Position chunkPosition) (at Assets/Source/Engine/TerrainManager.cs:99)
Voxel.Engine.TerrainManager.Start () (at Assets/Source/Engine/TerrainManager.cs:132)

This is line 99:

this._ChunksInMemory.Add(chunkPosition, newChunkComponent);

The field this._ChunksInMemory is simply a Dictionary<Position, Chunk> containing all the currently loaded chunks.

I have done the following things so far:

I have confirmed that the TerrainManager MonoBehaviour class (the one that contains the above section of code) does in fact have a chunk prefab assigned:

I have confirmed that there is in fact a copy of the chunk prefab by looking at the hierarchy and calling Debug.Log("Chunk created", newChunk).

I have confirmed that the copy of the chunk prefab has a Chunk component attached to it:

At this point, I am clueless as to why my code isn't working. Just from looking at the code, it should work fine, but it doesn't. Does anyone know why this is happening?

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:
Edge Detection on Screen I have a edge collision problem with a simple game that i am developing. Its about throwing a coin across the screen. I am using the code below to detect edge collisions so i can make the coin bounce from the edges of the screen.

Everything works as i want except one case. When the coin hits left edge and goes to right edge the system doesnt detect the collision. The rest cases are working perfectly, like hitting the right edge first and then the left edge.

Can someone suggest a solution for it?

public void onMove(float dx, float dy) {
 coinX += dx;
 coinY += dy;

  if (coinX > rightBorder) {
    coinX = ((rightBorder - coinX) / 3) + rightBorder;
  }
  if (coinX < leftBorder) {
    coinX = -(coinX) / 3;
  }
  if (coinY > bottomBorder) {
    coinY = ((bottomBorder - coinY) / 3) + bottomBorder;
  }

  invalidate();
}

sentences:
XNA: Draw Bounding Box around Sprite I'm just starting with XNA and I wanted to draw Debug Lines around my Texture/Sprite to help me.

Is there an easy way to do it with SpriteBatch?
I haven't used the GraphicsDevice yet to draw....

Thanks!

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:
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:
Are hidden stats a good idea? I'm thinking of and RPG, FPS or a turn based game (does not really matter), where the player does not know his character(s) exact stats. Of course they exist as random variables of normal distribution inside the game engine. So no visible HP bar, Level, ATK or DEF. You can only determine it's status by it's signs of life (good mood, fatigued, dying, dead, etc...). With regard to casting spells, when your mana is running low, your chance of failing to cast a spell increases (so there is no "zero" point when you need to find the next gas station for refill). To measure your skill you can battle with monsters which has always have fixed (but yet unknown) stats.

The stats would improve as you use them, but each character would have a random talent set so some skills can be improved easier than others.

So my question for the game devs and gamers, is making the true self of your character a mystery a good idea?

UPDATE:

From the answers it seems it depends on heavily the genre of the game.

For RPGs, I thought finding out what's good for your character is fun.  From the responses, it seems it's not so fun because the players usually have an established play style and will try force it from their character for all costs.

The actual game idea I dreamed about is manager like game somewhat similar to the Pokemon game series. The main character has several champions and wanders around the virtual world and battles with others in an arena in a HOMM like fashion. And those champions would have the hidden stats. I didn't mentioned this in the original question because I don't wanted to bias the answers around this particular game concept.

For the feedback to the player (in both cases): There would be ratings similar to the elo ratings that a chess player has. One for the melee hitting, melee blocking, ranged hitting, ranged blocking abilities, and one for the magic abilities.
Hitting the opponent with a sword will increase the melee hitting rating, if the enemy blocks the hit melee hitting decreases. If the opponent hit us with a sword, our melee blocking rating decrease, for successful block it increases, same for the ranged attacks. For the magic skill it's a bit tricky. High magic ability means: easier to cast spells successfully, harder to be affected by cursing spells, and easier to be affected by enchanting spells.

The standard abilities like hit points, toughness, strength, magic power, are estimated from the performance of the champion. These determine the actual damage dealt on successful hit. There would be "standard champions" that has a fixed and known stats, and the other champions' stats can be measured against them to bootstrap the system.

So if the player tries out all aspects of his champions he can find out the skillset his champions have, if the player don't like the skillset he can trade his champions to get the ones with skillset he likes.

UPDATE 2:

So to get straight to point: Would it be fun if I center my game around the concept of getting to know your characters/champions, instead of serving all stats readily to the player?

It would be similar to the football players. The coach will need to see how their players perform in various positions to assign them to position that's the best for them. So he will need to try each one as a goalkeeper, defender or forward. After several matches it will be clear which position is good for them.

sentences:
How to attach an UI button to a prefab and follow it in Unity2D My plan is creating a button above my prefab (a tree) and whenever my character is detected, the button will appear and allow me to click on it to active a dialog. I just want my trees are randomly spawned and stay still so it's not "follow" actually but I would like to know in that case too.

I did some researches but most of them were about Text and HP/MP things, which weren't used by UI system.

One more thing, I kinda new to code so it would be fantastic if I got a full code (Button follow only).

Thanks in advanced.

sentences:
Stacking items, c# XNA: When item reaches maximum stack, new items added are also maximum stack haven't used this site before so I'm sorry if I format my post badly.

I am trying to build a stackable inventory for my game in c# XNA and the problem I've encountered is when an item in my inventory reaches the maximum stackable count (10) and creates a second instance of the item in the second slot of my inventory the second instance retains the count value of the first item.

So 10 items in my inventory have a value of 10 in the first slot, but 11 items will have a value of 10 in slot 1 and 10 in slot 2

4 pictures illustrating my problem: http://imgur.com/a/KZ5EL

class Backpack
{
         // 25 Inventory Slots
    public int itemMax = 25;
    public List<Items> ItemList = new List<Items>();
    int end = 1;

         //Funtction to add new items
    public void Add(Items newItem)
    {

        if (ItemList.Count <= itemMax)
        {

               //this if statement makes a list item add if the list.count is zero
            if (ItemList.Count < end)
            {
                ItemList.Add(newItem);
            }

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

                if (ItemList[x].nameID == newItem.nameID)
                {
                        //Checks for stackable item and less than 10 counts of item
                    if (ItemList[x].isStackable && ItemList[x].Count < 10)
                    {

                        ItemList[x].Count += 1;
                        break;
                    }
                    else
                    {
                        ItemList.Add(newItem);

                        end += 1;
                        break;
                    }
                }
                else
                {
                    ItemList.Add(newItem);
                    end += 1;
                }
            }

EDIT for floAr - I access the function like this:

        Items i;
        i = new Items();

        i.nameID = 1;
        i.Name = "Hog Meat";
        i.Item = ItemClass.Useable;
        i.Description = "Regenerates 30% hunger.";
        i.isStackable = true;
        i.Image = Content.Load<Texture2D>("hogmeat");
        i.sRect = new Rectangle(0, 0, 16, 16);

       backpack.Add(i);

sentences:
How to set the Y position of Camera to another object's y position, but only once, not continuously? Essentially, I want to set the camera's Y position to another GameObject's Y position, but I only want to do this one. If you do

cam.transform.position = new Vector3(0, thing.transform.position.y, 0),

it will continuously update to that object's y. Even if I store the Y float in a variable and set the camera's y to that it still continuously updates. It is only supposed to happen once.

sentences:
Circular movement - eliminating speed ups near Y = 0 I have a basic algorithm to rotate an enemy around a 200 unit radius circle with center 0. This is how I'm achieving that:

if (position.Y <= 0 && position.X > -200)
{
   position.X -= 2;
   position.Y = 0 - (float)Math.Sqrt((200 * 200) - (position.X * position.X));
}
else
{
   position.X += 2;
   position.Y = (float)Math.Sqrt((200 * 200) - (position.X * position.X));
}

It does work, and I've ensured that at no point does either X or Y equal NaN. However, when Y approaches 0, it seems to go significantly faster. This surprises me, because the Y values are locked to the X, which is being incremented by a steady amount. What can I do to smooth the speed?

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:
Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear.

The easiest solution I've found is to force-send gear on equipment, but it will use bandwidth even when two players are far away.

This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice/known strategy that suits my situation?

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:
Scaling a single scalar using OrthographicCamera I'm trying to convert a length (well, a radius) from world coordinates to screen coordinates using an OrthographicCamera. However, the only method I've figured out so far is to do a projection, with some basic vector math before/after, but this seems...expensive.

Here's what I have so far (apologies, written in Kotlin):

val cam: OrthographicCamera = ...
val behavior: SteeringBehavior<Vector2> = ...

// calculating the center of the circle
val coords = Vector3()
val wander = behavior as Wander<Vector2> // defined elsewhere above
coords.set(wander.wanderCenter, 0F)
cam.project(coords) // coords now has wanderCenter in screen coordinates

// now, the part I'm interested in, calculating the radius
val radiusCoords = Vector3(wander.wanderCenter, 0F).add(wander.wanderRadius, 0F, 0F)
cam.project(radiusCoords)
radiusCoords.sub(coords)
val radius = radiusCoords.x // this is the value I want

The first half of the code snippet is fine, and provided for context. But the second half...I'm basically taking a scalar and plugging it through a Vector3 and a series of Complicated Matrix Math to convert it to another larger scalar. Is there an easier way to do what I'm doing? I've looked around a bit -- like at OrthographicCamera's combined.getScaleX() field, but it doesn't seem to have the value I need.

sentences:
What is a good way to load more than a million images for a collectible card game? I'm using C# with MonoGame and I'm wondering what would be an efficient way to load more than a million card images for a collectible card game. More cards would be continuously added in future updates and what not. I'm sure there are some genius ways to go about this which are both elegant and efficient. I'm hoping to obtain some insight on how others would solve this problem.

Added more details:

The cards will all be on a client side application the user downloads. The server will make sure the players are not cheating. I'm trying to figure out what are efficient ways to manage a large amount of card images on the client side regarding the loading and unloading of the cards.

I understand the cards should loaded and shown only when necessary. However, there are points in the game where the user can look through their entire collection. I was thinking with a scrollbar or something along those lines. They can filter their cards based on certain properties of the cards. In this scenario, how would I manage the loading/unloading of the cards in real time to make it seamless and efficient.

Thank you for any help!

sentences:
How should I collect user behavior data in an MMO? In an MMO, and I'm trying to collect data about user behaviors for the purpose of tweaking the game rules to achieve maximum user satisfaction.

Clearly one way to do it is to hand-roll specific things into an application, much like one might use Console.WriteLine() to view the contents of a variable, or the StopWatch() class to see how long something takes to execute.  But you can use a profiler in lieu of StopWatch, and you can use a debugger in lieu of WriteLine.

How should I collect my data? Are there generalized techniques for instrumenting an application to observe user behavior, or some form of code instrumentation technique?

Also, I'm only interested in collection techniques; you can assume that I already know how to transmit, store and analyze said data.

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:
Speed up loading of png files (used for textures) in Android OpenGL Game My game has a few texture atlases that need to be loaded (in my XHDPI folder they total 3.49MB) and on a top-end device they don't take that long to load, however on a low-end device they seem to take an age.

An example would be my old Samsung Galaxy Ace which uses the MDPI folder for it's resources (total: 1.51MB), this takes 16 seconds, which I personally consider far too long.

Originally, I had a separate atlas for each sprite, so I merged the majority of my atlases into one big atlas after reading that it may speed things up.

Unfortunately, it hasn't really made any difference to the load-speed.

This is how I'm loading my png files:

atlas = BitmapFactory.decodeResource(view.getResources(), R.drawable.atlasimage);

As the default load format is ARG_B8888, I though I'd attempt to load them in RGB565 as this is supposed to be quicker to load and render as well as take up less memory.

So I tried this:

BMFOptions = new BitmapFactory.Options();
BMFOptions.inDither=false;
BMFOptions.inPreferredConfig = Bitmap.Config.RGB_565;

atlas = BitmapFactory.decodeResource(view.getResources(), R.drawable.atlasimage, BMF Options);

Unfortunately, although this does reduce the quality of the image, it doesn't reduce the load time and yields no noticible performance increase.  Also, (and this may be expected), it doesn't reduce the memory footprint of my app.

So my question is how can I optimise this so that my png's are loaded quicker (rendering speed increase not being as important at the moment as load-speed).

sentences:
Can I store D3D9 textures so that they don't consume process memory and also don't require "lost device" handling? I have an OpenGL application that uses a lot of texture memory.  While the texture is stored in the system memory, that texture memory is not part of my application process memory.

When this application is ported to D3D and the textures are uploaded to the D3DPOOL_MANAGED pool, the process memory increases proportional to the texture memory and the application crashes due to running out of memory (while in OpenGL, even though the overall system memory utilization has greatly increased, the process memory is still low)

I don't want to have to switch to D3DPOOL_DEFAULT, since the I would have to reload all textures when the device is reset. Is there a workable solution to get my D3D9 application to put the system texture memory somewhere else beside my process, similar to OpenGL?

EDIT: So I just learned about IDirect3DDevice9Ex.  Turns out using this interface instead of IDirect3DDevice9 make DirectX work exactly like opengl in terms of texture memory (system memory goes up proportional to my texture usage, but not the process memory).  So this is an option for me.  However I would still like to know if there are any options since IDirect3DDevice9Ex doesn't work on XP.

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:
Using a shader messes up my alpha in XNA I'm making a 2D game that ends up being too dark on some laptops, so I figured I'd use a shader so people could brighten it up if need be.  Unfortunately, once I got it in there nothing would fade in or out, they'd just pop in and out.

Here's my FX file

float intensity;

sampler TextureSampler : register(s0);

float4 Glow(float2 texCoord:TEXCOORD0):COLOR0
{
    float4 Color;
    Color = tex2D(TextureSampler, texCoord.xy);
    Color.rgb *= intensity;
    return Color;
}

technique Technique1
{
    pass Glow
    {
        PixelShader=compile ps_2_0 Glow();
    }
}

Even after commenting out the Color.rgb *= intensity; line it still removes all fading effects.

I'm using the sprite batch to draw, and I begin and end it a few times because I use different BlendStates

brightnessShader.Parameters["intensity"].SetValue(brightness);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));
...
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, brightnessShader, Matrix.CreateScale(scale));
....
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));
...
spriteBatch.End();

I'm using XNA 4.0.

sentences:
Unity 5 - Error with code to make pitch changes based on distance I really need help.  It's 2:00 AM here and my brain is half dead so I can't, for the life of me, find out what's wrong with this code anymore.  It's supposed to find the distance between the game object to which it's attached (the target), and another game object (the player). Then, depending on the that distance, it should change the pitch of an AudioSource inside a child (in the player). However, the pitch only changes when I'm practically over the gameobject. So, for about 9/10 of the way, nothing changes in the pitch, but when I'm right there the pitch suddenly changes (but not to maximum value of Clamp function).

What's going on? I want the pitch to, at first, stay at 0. But soon after you walk some steps in the right direction, the pitch must change gradually (and in a evenly manner), as (player) gets closer to (target). =|

ps.: The script is inside a instantiated prefab, that's why I used FindGameObjectWithTag and FindChild. Also, I'm using Unity 5.

<!-- language: lang-cs -->

[four blanks]using System.Windows.Controls;
[more indented code]

using UnityEngine;
using System.Collections;

 public class ProximitySensor : MonoBehaviour {
     public GameObject player;
     private Transform playerTrans;
     private Transform targetTrans;
     public Transform beepTrans;
     public AudioSource beepSound;
     private float distanceCurrent;

     void Start () {

         targetTrans = transform;
         player = GameObject.FindGameObjectWithTag("Player");
         playerTrans = player.transform;
         beepTrans = playerTrans.FindChild ("beepController");
         beepSound = beepTrans.GetComponent<AudioSource>();

     }

     void Update () {

         distanceCurrent = Vector3.Distance (playerTrans.position, targetTrans.position);
         beepSound.pitch = Mathf.Clamp ((1 / distanceCurrent), 0.1f, 3.0f);

     }
 }

sentences:
Hotplugging Joysticks And Gamepads On OSX I've tested the cross platform joystick support features on GLFW, SDL2 and SFML.  SDL2 appears to be the most complete, but it can't detect when joysticks have been unplugged on OSX.  To me, this is a fundamental feature.

Joystick detection support appears to be much weaker on the Mac than in Windows. What can I do to overcome this?

sentences:
How do I simulate the Doppler effect in a game? I am trying to simulate the Doppler effect in a game (a car racing game). I am not using a specific sound library that simulates the effect; I only have a callback function where I mix the data.
I already figured out how to change frequency of a sample in the mixer function.
What I don't know is how much the frequency should change, depending on player and emitter position and velocity.
Here is what I have in the game:
//player
vec3 p.pos;
vec3 p.vel;

//emitter
vec3 e.pos;
vec3 e.vel;

According to Wikipedia, the relation between emitted frequency and observed frequency is given by:
 float f = (c + vr) / (c + vs) * fo

where c is a constant, the velocity of waves in the medium (typically a big number), and vs and vr are source and receiver velocities relative to medium.
So I guess:
float vr = p.vel.length; //player speed
float vs = e.vel.length; //emitter speed

However, I think this is wrong. It won't produce any change in frequency (for example) if vr = 0 (player doesn't move) and the emitter has constant speed, then vr and vs won't change (while they should).
Maybe should I calculate the velocity of the player relatively to the velocity of the emitter, like this?:
relative_speed = distance(p.pos + p.vel, e.pos + e.vel) -
distance(p.pos, e.pos);

Then how should vr and vs be found?

Wikipedia gives another formula to simulate the effect of a vehicle when that vehicle passes by the observer:
 vr = vs * cos(theta);

 //theta is angle between observer and emitter
 //theta = atan2(e.pos.y-p.pos.y, e.pos.x-p.pos.x);?

However, this formula supposes that the receiver doesn't move, which is not the case here. If the player and the emitter move at same speed (or with a small difference), there should be no Doppler effect. This function is also specific to one case, I suppose the final formula should be the same no mater the situation.

EDIT: I'm trying to find a correct formula, using SkimFlux's post:
vr,r = vr.vel * cos(shortest_angle_between ( vr.vel , vs.pos - vr.pos));
vs,r = vs.vel * cos(shortest_angle_between ( vs.vel , vr.pos - vs.pos));

//is there a easier/faster way to find them out?
//note: vr.vel and vs.vel are vectors, the green and red arrows in SkimFlux's picture.

EDIT 2:
For those interested, here is final formula:
vec2 dist = vs.pos - vr.pos;

vr,r = dotproduct(vr.vel, dist) / length(dist)
vs,r = dotproduct(vs.vel, dist) / length(dist)

It uses vector projection:

Then vr,s and vs,r should be injected into the first Wikipedia formula:

I tested it and it works successfully, providing great results.

sentences:
How to avoid "Blob-Systems" in an entity component system? Currently I am facing the following problem:

I am trying to write a pong clone by using an entity component system (ECS). I wrote the "framework" all by myself. So there is a class which manages the entities with all the components. Then there are the component classes themselves. And last there are my systems which just get all the entities which have components which the system needs.

So for example my movement system looks for all entities which have a position component and a movement component. The position component just holds the position and the movement component holds the speed.

But the actual problem is my collision system. This class is like a logical blob. I have so much special cases in this class.

For example: My paddles can collide with the borders. If this happens their speed is set to zero. My ball can as well collide with the borders. But in this case its speed is just mirrored at the normal of the border so it is reflected. To do this I gave the ball an extra physics component which just tells: "Hey, this thing does not stop, it reflects." So actually, the physics component has no real data. It is an empty class which is just there to tell the system if an object reflects or stops.

Then there comes this: I want to render some particles when the ball collides with the paddles or the borders. So I think the ball has to get another component which tells the collision system to create particle on collision.
Then I want to have power ups which can collide with the paddles but not with the borders. If that happens the power-ups have to disappear. So I would need much more cases and components (to tell the system that some entities can only collide with certain others, bot not with all even if some others are actually able to collide, furthermore the collision system had to apply the power-ups to the paddles, etc., etc., etc.).

I see that the entity component system is a good thing because it is flexible and you do not have problems with inheritance. But I am totally stuck currently.

Am I thinking too complicated? How should I cope with this problem?

Sure, I have to create systems which are actually responsible for "post-collision", so the collision system only tells "Yes, we have a collision in the last frame" and then there is a bunch of "post-collision" systems which all require different (combinations of) components and then change the components. For example there would be a movement post-collision system which stops things which have to stop when collision happens. Then a physics post-collision-system which reflects things, etc.

But this does not seem to be a proper solution to me either, because for example:

My movement post-collision system would need entities which have a position component, a movement component and collision component. Then it would set the speed of the entity to zero.
The physics post-collision system would need entities which have a position component, a movement component, a collision component and a physics component. Then it would reflect the speed vector.

The problem is obvious: Movement post-collision needs entities which are a subset of the entities in physics post-collision system. So two post-collision systems would operate on the same data, the effect being: Although an entity has a physics component, it speed would be zero after a collision.

How are these problems solved in general in an entity component system? Are those problems even usual or am I doing something wrong? If yes, what and how should it be done instead?

sentences:
Moving several rectangles by dragging a single one in Monogame I am trying to make a simple card game in which the hand of cards is displayed on a row to the player on screen, and by dragging a single card, all others should move accordingly, with the same speed as the mouse on the X axis only. This is my current code:

public void HandleInput(GameTime gameTime)
{
    _previousMouseState = _currentMouseState;
    _currentMouseState = Mouse.GetState();

    if (_currentMouseState.LeftButton == ButtonState.Released)
    {
        _dragged = false;
    }

    _mouseDown = _currentMouseState.LeftButton == ButtonState.Pressed
        && _previousMouseState.LeftButton == ButtonState.Released;
}

public void Update(GameTime gameTime)
{
    foreach (Card card in _players[0].Cards)
    {
        if (_mouseDown)
        {
            if (card.Area.Contains(_currentMouseState.Position))
            {
                _dragged = true;
            }

            if (_dragged)
            {
                int movementDelta = _previousMouseState.X - _currentMouseState.X;
                Debug.WriteLine("previousX: " + _previousMouseState.X
                    + " currentX: " + _currentMouseState.X);

                _players[0].Cards.Select(c =>
                {
                    Rectangle area = c.Area;
                    area.Offset(movementDelta, 0);
                    c.Area = area;
                    return c;
                }).ToList();
            }
        }
        card.Update(gameTime);
    }
}

HandleInput runs before Update on the game loop. I have implemented a screen manager, but I don't think that is the issue, here. The thing with this code is that the mouse previous X, most of the time, is exactly equal to the current X, and movement is erratic at best (meaning that 90% of the time nothing happens, and the other 10% all cards move on a huge, uncontrollable leap). I have also tried using gameTime in the calculations for the movement delta, but that doesn't work, either. I'm not sure in what other way could I could tackle this (dabbled a bit on using Vector2, but unsuccessfully). I'm kind of noobish to Monogame, but I understand that polling is preferred to event handling here.

sentences:
Is Updating Sprite/Entity Movement Using Framerate Necessary? Apologies if this is a dumb question I'm still new to this, but I'm trying to understand if calculations of sprite movements/hitboxes/etc. is necessary or is generally better than just using fixed values to calculate movement or events (i.e movement += velocity/framerate vs. movement += velocity/constant).

The main reason I ask is that while following tutorials for basic movements they use the frame rate to determine how to move the sprites, but I haven't seen a full explanation as to why things are done that way. While I was using these tutorials, things seemed to work well, but after I moved past them I've run into odd issues. I'm not sure if that was just because the games in the tutorials were very simple, like pong and breakout, and I just didn't notice these problems.

For example, I made a very simple demo where I take a sprite and have it bounce off the edges of the screen. When it reaches the edge the velocity reverses and it goes in the opposite direction. While the numbers show as correctly calculated, visually it's wrong, either rebounding early or beyond the edges of the screen. However, when I replace frame rate with a constant number it works perfectly. Even when I replace the frame rate with a random value of particular range (say 45-60) it works well. It seems to me on the occasion that the frame rate dips below 30, it throws off everything and doesn't recover.

I've heard about limiting frame rate and that makes sense in a capping the top way, but is limiting it below also something that is done? If so, it doesn't seem too different from just putting in a constant and I wonder what benefits using frame rate even has at that point.

tl;dr: I guess what I'm asking is what are the pros and cons of using frame rate to determine how things move/interact vs using constant values and will it create problems down the line if I try to forgo frame rate completely?

sentences:
How to create a hover effect on image I am trying to make it so that when a user hovers over an image on my JPanel, the image turns into a different image. I have 2 classes, one for the JPanel and the other is for the gameplay (snake game). How do I implement the mouseListener to make it so that the image changes on hover?

snake.java (main):

public class snake {

    public static int mouseX;
    public static int mouseY;

    public static void main(String[] args) {

        // JFrame
        JFrame obj = new JFrame("Snake");
        gameplay Gameplay = new gameplay();
        obj.setBounds(10, 10, 905, 700);
        obj.setBackground(Color.DARK_GRAY);
        obj.setResizable(false);
        obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        obj.add(Gameplay);
        obj.setVisible(true);

        obj.addMouseMotionListener(new MouseAdapter() {
            @Override
            public void mouseMoved(MouseEvent e) {
                mouseX = e.getX();
                mouseY = e.getY();
            }
        });

    }
}

Image I want to change:

    settingsImage = new ImageIcon(getClass().getResource("/assets/settings.png"));
    settingsImage.paintIcon(this, g, 700, 23);

If you need to see any of my other code please tell me!

sentences:
Destroying copy of DontDestroyOnLoad GameObject? I have a Main Menu with level selecter up to 5 different scenes on one Map.
I also have a MenuManager which doesn't get destroyed between the scenes to gather the bool information of level finished or not.
When I start the game and change for example level 1 and move back to the Main Menu again the MenuManager gets copied. I tried this at first:

  public static GameObject _menuInstance;

void Awake()
{
    if (_menuInstance == null)
    {
        _menuInstance = this.gameObject;
    }
    else
        Destroy(gameObject);
}

My problem with that is that the copied GameObject that get's destroyed is the wrong one.

This is the copy that gets created after I switched the scenes and back to Main Menu.

This is the original MenuManager that should be the _menuInstance Object and the other one should be destroyed.

How can I not delete the original one and delete the one without the references?

I come up with something but I am not sure if this is the right way to do this.

    //I changed the code in the Awake() function to
    void Awake()
{
    if (_menuInstance == null)
    {
        _menuInstance = this.gameObject;
    }
}
//I checked one of the missing references to be null and then destroy the fake copy.
Update()
{
   if(_startTheGame == null)
     Destroy(gameObject);
}

sentences:
How do multiplayer servers handle receiving, handling, and sending packets? I want to make a fighter jet simulator game.
The server (authoritative) and client communicate over udp.
The server sends out updates about the gamestate at a fixed rate. Think of plane positions, speeds, rotation, basically anything to do with physics.
On demand, the server sends out packets for spawning bullets and applying damage. So this is not at a fixed tickrate. This is done to sidestep the problem of superbullets and syncing fire rates with tick rates entirely. This class of packets also include chat messages.
How do I go about implementing this? I am using c/c++, programming raw sockets. I am running into the issue where the recvfrom function is blocking. I can set it to non-blocking using fnctl, yes, but that spams error messages because sometimes there are no packets waiting to be handled (I could handle it but egh, inelegant). Ideally I would like to prevent multithreading, but given that there seems to be no native event-driven or interrupt-driven way of receiving packets it seems I need to do that.
How do other game servers, like quake arena, set up their threads?
My idea:

Main thread calculates game state, sends out packets at a fixed rate
1 child thread for listening for new packets (recvfrom loop)

If the incoming packet is a "i am shooting" packet, it performs checks, and broadcasts to every client that a bullet has spawned. It adds the bullet to the world, and the main thread will calculate the continued trajectory in the next or current tickcycle, using the time difference and initial spawn data.
if the incoming packet is a chat message, perform checks and just broadcast it across clients.
if the incoming packet is any other kind of packet, put it in a queue for the main thread to handle (the queue is mutexxed)

Is this how I should make the child and main communicate?

sentences:
Persistent variable for all list members inside a loop called every frame I'm trying to add a sort of manager to handle all objects in a list and increase a float value that each individual member of the list has given a condition every single frame. I'm having some trouble wrapping my head around the actual code I need though.

So say I've got an OverlapCircleAll or trigger checking for tagged objects in a certain radius. These objects are then added to a List (foo).

Then, I go through foo with a for loop and declare a float value x for each object.

What I need is for each object's x to increase when the object is also on another list, bar.

So something like this:

for (int i = 0; i < foo.Count; i++)
{
     float x;
     //or float x = 0;?

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }
}

The problem is, I can't figure out how to make the value of x persist each loop. This function is called in Update() so the idea is that the longer an object is in both foo and bar, the higher its value of x is. I don't know how to save the value of x for the next loop though. Ideally something like:

for (int i = 0; i < foo.Count; i++)
{
     float x;

     if (lastX != null)
     {
          x = lastX;
     }
     else
     {
          x = 0;
     }

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }

     float lastX = x;
}

But I don't know a) how to save lastX for each object in the list and b) set x to lastX (because for each loop it creates a lastX).

I thought about storing each x in an array of floats and calling the corresponding array[i] to foo[i] to get x, but if I remove something from the list then the array will become desynchronised with the list and all the x values will get muddled up.

What is the correct way to go about this?

sentences:
SDL (or OpenGL), HTML5, Gecko and vector movies I'm writing a platform game which uses SDL for the main graphics code. There is a chance that I may be using OpenGL for the rendering at a later stage, so answers could relate to either.

I'm needing a good method to include vector animations (such as a starting video) within the game.

Being a platform game, I would prefer to limit the dependents and size of the data. This rules out using Theora as the resulting vector animations would be needlessly lossy and overly large compared to the rest of the content. Flash sounds like an OK option, however it is finicky to embed (or even use) on non-windows platforms, and requires significant amounts of dependencies.

My idea is to use HTML5 animations, rendered by Gecko (the embeddable Firefox rendering engine) or WebKit (the Chrome rendering engine) in SDL, or rendered to an OpenGL surface in SDL. Quite simply - is this feasable? Are there any other examples as to how I should embed it? Is there a better (read: smaller and simpler) solution?

sentences:
How to make a 2D Soft-body physics engine? The definition of rigid body in Box2d is

  A chunk of matter that is so strong
  that the distance between any two bits
  of matter on the chunk is completely
  constant.

And this is exactly what i don't want as i would like to make 2D (maybe 3D eventually), elastic, deformable, breakable, and even sticky bodies.

What I'm hoping to get out of this community are resources that teach me the math behind how objects bend, break and interact. I don't care about the molecular or chemical properties of these objects, and often this is all I find when I try to search for how to calculate what a piece of wood, metal, rubber, goo, liquid, organic material, etc. might look like after a force is applied to it.

Also, I'm a very visual person, so diagrams and such are EXTREMELY HELPFUL for me.

sentences:
Is a Masters degree in computer science beneficial over a Bachelors in the game industry? Suppose a student (who is seeking to become a video game developer) is studying Computer Science at a state-level university, and is about to complete his or her bachelors degree.

Would the student stand a better chance to get hired as a game developer later if they proceeded to obtain their masters degree in Computer Science, or if they tried to instead obtain an internship or entry-level development position at a local software developer (not game development, but still software development)?

sentences:
Correct utilisation of gameloop (Android) When using a gameloop like (much simplified)............

updateLogic();
render();

How does one perform 'single' operations?  I mean, things like triggering sounds (which will only be played once), displaying a 'Get ready' graphic at the start of the game etc...

Currently I'm simply using 'flags' so maybe something like: (Pseudo code)

if(gameNotStarted==true)
display getReady;

This does work, but I end of up with a ton of condition checks in my game Loop.

Being that I can't just stop the game loop (I can't right?) every time I want to perform a single operation, is what I'm doing the correct way or is there something that I'm missing?

Another example might be when a player completes a level.  I want to stay within my class/activity (I.E., the game as a whole is contained within one activity), then I move onto a small 'cut scene' which simply displays 'Well done' and plays a little piece of music, before returning to the next level of the game.

How would one handle that situation, again remembering that I'm not starting a new activity for each level (if I did, I could see that being a nightmare to manage).

sentences:
Getting Started With Web-based Games....Can I Reasonably Target Flash And Silverlight And HTML5? I come from a .NET background and I've done a few simple things in Silverlight.  I'd love to adopt that and make my site and games Silverlight only; but I hear it has a fairly low install base.

I know Flash has a much higher install base.

I also know that everyone seems to say that HTML5 is the way things should be heading; but there is still a bit of a bumpy road ahead.

Short of maintaining three code-bases; are there any cool tools that would allow me to write once and end up with three versions of the same game?  I'm guessing the answer is 'No' but from a theoretical standpoint, I can't think of any reason why it wouldn't be possible.

sentences:
Getting a sphere to roll down a .FBX object Unity3D/C# I'm working on a little ramp and ball game in Unity, I modeled the ramp outside Unity and exported it to a .FBX file, then I imported the ramp in to Unity. I set up the ball and ramp, both have Rigidbodies, Ramp is set to isKinematic = true, yet when I play the game the ball just falls right through the ramp and hits the floor below it fine. So it's something wrong with the ramp.

Am I doing something wrong? Are .FBX files unable to apply physics?

Thanks,

Tim.

sentences:
Path finding algorithms? I posted this question on stack overflow first, but I guess no one is very interested in video games there...

What are some path finding algorithms used in games of all types? (Of all types where characters move, anyway) Is Dijkstra's used a whole lot? I would think not, as it doesn't actually trace out the steps to take to get somewhere, right? If I'm understanding it right, it only determines which object is the closest. I'm not really looking to code anything; just doing some research, though if you paste pseudocode or something, that would be fine (I can understand Java and C++). I'm basically looking for a quick overview of path finding in general.

I know A* is like THE algorithm to use in 2D games. That's great and all, but what about 2D games that are not grid-based? Things like Age of Empires, or Link's Awakening. There aren't distinct square spaces to navigate to, so what do they do?

What do 3D games do? I've read this thingy http://www.ai-blog.net/archives/000152.html, which I hear is a great authority on the subject, but it doesn't really explain HOW, once the meshes are set, the path finding is done. IF A* is what they use, then how is something like that done in a 3D environment? And how exactly do the splines work for rounding corners?

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:
Graphics bug after build in Unity 3d i made a terrain on unity. I haven't write scripts yet. But i am getting really big render difference between standalone version and editor verison. Please help me, have nice day.

In Editor:

After build (standalone version):

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:
Adjusting the rate of movement of different objects on the same timer I have a series of objects moving along the straight lines. I want to implement slight changes of velocity of each of the object. Constraint is existing model of animation. I am new to this, and not sure if it is the best way to accommodate varying speeds, but what do I know?

It is a Java application that repaints the panel every time the timer expires. Timer is set via swing.Timer object that is set by timer delay constant. Every time the game is stepped objects’ coordinates advanced by an increment constant. Most of the objects are of the same class.

Is there fairly easy way to refactor existing system to allow changing velocity for an individual object? Is there some obvious common solution I am not aware about?

Idea I am having right now is to set timer delay fairly small, and only move objects every so many cycles of animation so that the apparent speed can be adjusted by varying how often they get moved. But that seems fairly involved, and I do not think it is the most elegant solution in terms of performance what with repainting the whole frame every 3-5 milliseconds.

Can it be done by advancing the objects so many (varying) times during the certain interval (let’s say 35ms for something like 28fps), and use repaint() method to redraw just individual object? Do I need to mess with pausing animation for smoothness at higher redraw rates? Is it common practise to check for collision at larger step interval, but draw animation a lot more frequently?

sentences:
Is there a way to control the ordering and grouping of ShaderLab Blend command? I'm writing a shader in Unity that responds to 3 lights: 1 directional and 2 point lights. The point lights are processed in the ForwardAdd pass (once per light). I need the ForwardAdd pass to blend with the ForwardBase pass multiplicatively (Blend Zero SrcColor). But I also need the lights in the ForwardAdd pass to stay additively blended.

Since I can only set the Blend once per pass and the ForwardAdd pass gets run once for light, I can only end up with everything blended multiplicatively.

So my question is: is there a way to keep the lights in ForwardAdd pass additively blended? In other words, is there some way to control the ordering/grouping of the Blend command?

If not, is there any other way to achieve my desired effect? The goal I'm going after is to have point lights (that are pixel lights) to mask out all other lights (directional, vertex, and SH lights).

Thanks in advance!

sentences:
Grid/cell based light system I am working on a top-down, 2d cell-based RPG game. I would like to implement a cell based lighting system, something like this and this.

I basically have several light sources and light deteriorates on every cell in every direction. Something like the below (numbers represent the level of light in each cell):

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

So basically I insert a source of light of "strength" x at a given spot. I then set the surrounding cells' light strength to x-1 and so on until I reach zero (or a set global minimum value). I am looking for an efficient algorithm to implement and generate such a lightning grid based on my light sources and any tips regarding such implementation.

I am currently not looking into field of view algorithms, just an efficient way of generating the above. Any help will be much appreciated.

EDIT: Just to clarify, this should handle movement of light sources (e.g. player walking with a torch).

EDIT2: Ok, I've solved my problem myself based on the simple distance suggestion by Jari (thus I'll accept his answer although I'm still looking for a more efficient way of generating such array). If anyone's interested here is a demo of what I came up with (multiple light sources with alpha compositing)

sentences:
Unity - Easier way to resize group of buttons to the same size I have a canvas with buttons, with a script attached to each button. This script creates an array for buttons and resizes every button to the same size as the longest one in that array (the button with the longest line of text in it). Everything works, but I was wondering: is there is an easier, more automatic way for this instead of having to drag every button in every array in the Inspector tab?

Any ideas would be greatly appreciated

UnityPackage: https://transfer.sh/6BCDG/buttonwidth.unitypackage

public Image[] otherbutton;

void Start () {

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

        if (otherbutton[i].rectTransform.sizeDelta.x > gameObject.GetComponent<Image>().rectTransform.sizeDelta.x)
        {
            gameObject.GetComponent<ContentSizeFitter> ().enabled = false;

            gameObject.GetComponent<Image>().rectTransform.sizeDelta = new Vector2( otherbutton[i].rectTransform.sizeDelta.x, otherbutton[i].rectTransform.sizeDelta.y);

        }
    }
}

sentences:
Clamping always returns 0 I have a class with three fields:

StartingAngleOnRotationPlane is 180
MinimumRotatedAngleX is 0
MaximumRotatedAngleX is 140

Here is the offending code:

public virtual float ClampRotatedDegreesWithinAllowedRange()
{
    float rotatedAngle = this.transform.GetRotatedAngleOnXPlane();
    Debug.Log("Rotated " + rotatedAngle);

    float clampedRotatedAngle =
        Mathf.Clamp(
            AngleNormaliser.BetweenNegativeAndPositive180(this.StartingAngleOnRotationPlane + rotatedAngle),
            this.MinimumRotatedAngleX,
            this.MaximumRotatedAngleX);

    return clampedRotatedAngle;
}

Here is the debug window:

As you can see, when the breakpoint was hit, rotatedAngle was -178.9446.

To calculate clampedRotatedAngle, rotatedAngle is added to StartingAngleOnRotationPlane, supplied to a method called AngleNormaliser.BetweenNegativeAndPositive180(float input), and then clamped between MinimumRotatedAngleX (0) and MaximumRotatedAngleX (140).

Here is the code for AngleNormaliser.BetweenNegativeAndPositive180(float input):

public static float BetweenNegativeAndPositive180(float angleBetween0And360)
{
    while (angleBetween0And360 > 180)
    {
        angleBetween0And360 -= 360;
    }

    while (angleBetween0And360 < -180)
    {
        angleBetween0And360 += 360;
    }

    return angleBetween0And360;
}

Here is the debug window when AngleNormaliser.BetweenNegativeAndPositive180(float input) was invoked:

By the time the return statement was hit, the result 1.055389 should be returned and assigned to the variable clampedRotatedAngle, since 1.055389 is within the clamping range (0 - 140).

However, that was not the case:

As you can see, clampedRotatedAngle was still zero.

In fact, clampedRotatedAngle is always zero, regardless of what I feed into the Mathf.Clamp function:

How can I fix this?

sentences:
What were the typical price range for a development kit? A lot of these things are usually behind NDAs and tricky to gauge. Is there any information and ranges on how much these thing costs?

For example, the PS1 had the "Net Yaroze", which according to Wikipedia was: "For about $750 USD, the Net Yaroze (DTL-H300x) package would contain a special black-colored debugging PlayStation unit with documentation, software, and no regional lockout."

So, what were the prices of some game development kits?

P.S: This might make a good community wiki

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:
How do you get the best rendering performance in a 2D Java Game? I have seen a lot of tutorials, and they develop games with 2 different ways:

The first one is using a virtual image (BufferedImage) and filling it's pixels. And displaying virtual picture.

private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
private int[] colors = new int[6 * 6 * 6];

Second one is using lots of real images. And displaying they.

SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));

    //PLAYER SPRITES PROVIDED BY: AddFact
    player = sheet.crop(width * 4, 0, width, height);

    dirt = sheet.crop(width, 0, width, height);
    grass = sheet.crop(width * 2, 0, width, height);
    stone = sheet.crop(width * 3, 0, width, height);
    tree = sheet.crop(0, 0, width, height);

First Question: Which one has the best performance ?

Second Question: How should we load maps? With images or with text files ? Which one is good to chose ?

Sorry for my english. I hope I can explain to you :) Thanks for helping, have a nice day ^^

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

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

The setup is as follows:

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

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

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

Nothing surprising here.

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

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

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

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

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

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

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

sentences:
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:
What makes puzzle games addictive? I'm currently developing a puzzle game for Android that is sort of along the lines of Alchemy.

I was wondering what makes games like Alchemy or Bejeweled so addicting?  How do I keep players interested in the game to want to play it over and over?  Is it the scores?  Level advancement?  The challenges?  What should I be doing to try and keep a player engaged with a puzzle game since they are often quite repetitive?

sentences:
Rotate the player in a certain way that makes it look like he is sliding I'm trying to make my first game in Unity: a 3d platformer inspired by the classic Crash Bandicoot games.
I've managed to make most of the movement with the character control script below. However, I don't know how I can do a slide/crouch.
What I want to do is to rotate and move the player down closer to the ground and give him some more speed that decreases over time until he reaches a normal waking state.

I thought about making the player rotate on a specific axis but when he turns the axis doesn't change so now I'm kind of lost in what to do.
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public CharacterController controller;

    public float speed = 10f;

    //turnning smoothness

    public float turnSmoothTime = 0.1f;
    float turnSmoothVelocity;

    //jump controls

    public float jumpHeight = 3f;
    public float gravity = -29.43f;
    Vector3 velocity;
    bool isGrounded;

    //gravity check
    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;

    // Update is called once per frame
    void Update()
    {
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

        if(isGrounded && velocity.y < 0)
        {
            velocity.y = -1f;
        }

       //player movement on both axis

        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");

        Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);

        if (Input.GetKeyDown("space") && isGrounded)
        {
            velocity.y += Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        if (direction.magnitude >= 0.1f)
        {
            //player turning depending on where moving

            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            controller.Move(direction * speed * Time.deltaTime);

        }

    }
}

sentences:
Is it reasonable to ask for all rights for music when hiring a musician? I've made a game and now I need to add real sounds and music to it. For the first time I've decided to hire a musician to make music for my games. Before I used to buy sound packs and licenses for tracks.

The negotiations didn't go well as the price was too high for me and the artist didn't like the idea of selling me the music and wanted to only license it to me.

I'd like to know if I've made a mistake or if I've been unreasonable.

Just to be specific, we're talking about 6 tracks, 90 seconds long each. The music is chip-tune done by one musician (that's important since I understand that hiring an orchestra would cost more than hiring just one person).

What I wanted was to get the tracks with all the rights, other than the authors rights - putting their name in the credits.

I've been told that nobody does this and the musician always keeps the rights to later sell OST etc. And if I want all the rights, one track would cost me $500. And even just getting a one-title license would cost me $200.

I have no idea if that's a standard market price, it seems high for me.

Is the price reasonable?
Is it unreasonable for me to ask for music with all the rights?

sentences:
How to add some organization to my PSD Imported image with bones generated by the Skin Editor I have an Image in PSB format imported using the PSD Imported and I have generated bones using the Sprite Editor > Skinning Editor, all good.
The problem is that when I try to add some organization to the object in my inspector I can not do it without breaking the Prefab. We can just Unpack the prefab but then I can not modify the bones anymore using the Skinning Editor. I am trap here.
How can I add some organization to the generated Prefab?

sentences:
How can I animate/draw a line renderer over a given period of time I have created a line renderer using the code below:

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

    }
}

How can I write a coroutine that will animate/draw the line over specific duration, say 2 seconds?

sentences: How can I render a model on top of another model regardless of their relative Z positions? I was wondering if there's any way to render models over other 3D models regardless of their relative positions? Kind of like how it works in 2D graphics, you set a render order and it renders them based on that instead of taking the depth and figuring out which is in front of which.

sentences:
Matcap and BRDF Shading I just would like to know what's the difference between the Matcap shaders used in ZBrush for example and the Bidirectional Radiance Distribution Function shader.

Are there two techniques the same ? Is Matcap done using BRDF or are they different ?

sentences:
How to disable Y-axis movement in the Bullet physics engine I want to create an object than only moves along the the X and Z axes, while keeping the Y-axis disabled (it's like movement in 2D, and the object wont fall down).

I'm currently using a 6 dof constraint to restrict movement in the Y-axis, but it's not working:

btRigidBody* zeroBody = new btRigidBody(0, NULL, NULL); // Create the body that we attach things to
btRigidBody* robot = mCarChassis->getBulletRigidBody();

btGeneric6DofConstraint* constrict = new btGeneric6DofConstraint(*robot, *zeroBody, btTransform::getIdentity(), btTransform::getIdentity(), false);

constrict->setLinearLowerLimit( btVector3( 1, 1, 1));
constrict->setLinearUpperLimit( btVector3(-1, 1,-1));

constrict->setAngularLowerLimit( btVector3( 1,  1,  1) );
constrict->setAngularUpperLimit( btVector3(-1, -1, -1) );

mBulletWorld->getBulletDynamicsWorld()->addConstraint(constrict);

Thanks!

sentences:
Solutions for maintaining importers and exporters when chaning file formats After having a very short discussion with Delix on youtube (see link below) on custom data storage formats, I started thinking. What are some useful ways of maintaining importers / exporters when you change your file format during the development of your game?

The most obvious solution would be to write different functions for file formats like exporterV1(), importerV1(), exporterV2(), importerV2(), etc. Then call the correct function based on some sort of header in your file. Like using the first byte(s) to store the version of the file format. However, this seems incredibly inefficient. Especially since you'll have to writer converter functions to translate between the file formats. I.e. v1tov2converter().

Usually when writing this kind of thing, a voice in the back of my head screams "there must be a better way of doing this", but I'm drawing a blank so far.

Naughty Dog seems to use scheme for describing both the data and how it should be read. However, my knowledge of scheme is non-existent so I have no clue how that would work. This would however, solve my problem, as the data would describe itself see reference.

What are, in your opinion, some of the clever ways you know of, to solve this issue?

Edits

[EDIT 1]: As a response to a question asked by @DMGregory: I'm mostly talking about changes during development of the game(engine). Changing file formats in production seems like a can of worms I would not like to open. Especially if your dealing with importer / exporters of safe game data.

sentences: Interactive ways to answer a yes or no question in a VR game? Currently, I am creating a VR game with a simple AI that at certain points ask for yes or no answers. Considering the player is free to walk around, I need a sort of spawn in and out kind of solution. I would really like this to be interactive and engaging. So far, I'm thinking to animate a "terminal" from the floor with a green and a red button on it and the user simple pushes down on one with their hand. I don't really want to use a 2D UI or a controller button press for this. Are there any other potential ways to handle this situation while keeping the interactivity there?

sentences:
Why do my Box2D collisions fail when I have multiple fixtures on one body? I'm creating my first libgdx / Box2D game where a player moves around using a mouseJoint.

My player has two fixtures, "main" and "question".

For some reason when I have these two fixtures, my player is no longer responsive to collisions or touch detection (i.e. I can't drag the player around). If I remove the "question" fixture, everything works.

Why is this? How can I fix it?

This is how I create the Player:

// create body
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.DynamicBody;
bodyDef.position.set(x, y);
bodyDef.fixedRotation = true;
body = world.createBody(bodyDef);

// player main body fixture
PolygonShape polygonShape = new PolygonShape();
polygonShape.setAsBox(bodyWidth / 2, bodyHeight / 2); // setAsBox takes half width, half height as params
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = polygonShape;
fixtureDef.restitution = 0.3f; // Bounciness - Keep value between 0 and 1.
fixtureDef.density = 3; // Mass p/sqm - Keep value between 0 and 100
fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1
bodyFixture = body.createFixture(fixtureDef);
bodyFixture.setUserData("player");

// player question fixture
polygonShape = new PolygonShape();
polygonShape.setAsBox(questionWidth / 2, questionHeight / 2, new Vector2(0,0), 0); // setAsBox takes half width, half height as params
fixtureDef.shape = polygonShape;
fixtureDef.restitution = 0.3f; // Bounciness - Keep value between 0 and 1.
fixtureDef.density = 3; // Mass p/sqm - Keep value between 0 and 100
fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1
fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1
fixtureDef.isSensor = true;
questionFixture = body.createFixture(fixtureDef);
questionFixture.setUserData("question");

I assume I'm doing something silly here—I'm still very much a noob when it comes to libgdx / Box2D.

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: Is it possible to have two trigger zones around the same GameObject in unity? I have created a trigger zone to make sure that only only gameobject passes through it at a time. The moment the gameobject1 entered the trigger zone, it is given a particular tag but I am not how to stop other gameobjects from entering the zone. Is it possible to have two trigger colliders attached to a same object like an outer and inner trigger such that only one gameobject is allowed to pass through the inner one while all other gameobjects wait at the outer one.

sentences:
What architecture should I use to support extensions in my game? What is the proper architecture for the game, that support extension modules, written in other languages?

I mean I have a simple game - written in Groovy (basically Java), heavily relying on Game object pattern (resources, configurations, part of game logic), which have a couple classes with certain logic.

I want to provide an ability to override that logic, using external modules written in another language (ideally I want to support any language). Also I want to have an ability to add additional logic.

What is the proper architecture for that?

sentences:
How can I load .obj files in the Soya3D engine? I recently found Soya3D, and I want to import .obj files, but it seems to only accept .data files.  How can I import .obj files into Soya3D?

Importing a .obj file named "house" produces this error:

  Traceback (most recent call last):
   File "introduction.py", line 7, in
    model = soya.Model.get("house")
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 259, in get
    return klass._alls.get(filename) or klass._alls.setdefault(filename, klass.load(filename))
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 268, in load
    dirname  = klass._get_directory_for_loading_and_check_export(filename)
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 194, in _get_directory_for_loading_and_check_export
    dirname = klass._get_directory_for_loading(filename, ext)
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 171, in _get_directory_for_loading
    raise ValueError("Cannot find a %s named %s!" % (klass, filename))
  ValueError: Cannot find a  named house!
  * Soya3D * Quit...

sentences: Is there a successor to RenderMonkey? I'm starting with GLSL shader programming and have been looking into RenderMonkey. Sadly, AMD no longer supports it. Why? Is there a successor to it?

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: How to get a turret to shoot at player in a shmup I'm developing a basic vertical shoot em up on the DS and am trying to get stationary turrets to shoot at the player in a shoot em up. Early on I simply had them shooting in fixed 8 directions N, S, E W, NE, NW, SE, SW, depending on the player's relative position, but I want something more specific. My attempts have been awkward at best, and my aiming algorithm is not very crude and often the turrets miss by a mile. I am looking for a simple algorithm that plots a basic straight line trajectory towards the player's xy position. Nothing fancy like predictive aiming. Does anybody know of an algorithm or an article that covers such an algorithm?

sentences:
Workflow with Flash Pro CS6 and FlashDevelop: Using fla and swc to store assets I am using this tutorial:

http://www.flashdevelop.org/wikidocs/index.php?title=AS3:FlexAndFlashCS3Workflow

In the past older versions of Flash Pro I was able to complete these steps:

right-click on the symbol in the Library panel, select "Linkage..." dialog,
check "Export for ActionScript" and fill in the symbol name (ie. MySymbol_design or assets.MySymbol_design),
do not change the base class (ie. flash.display.MovieClip).

Right now, I am stuck at that part. Any hints?

What I wish to do is:

Use fla for the artist to store assets.
Publish to swc
Extract the assets in FlashDevelop by creating an instance of their class.

... How is this done in CS6?

To clear things up, this is what I see when I right click a Flash symbol:

sentences:
Architecture for Versioned Save Data We're working on an iOS game that we plan on having several content updates for.

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

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

sentences:
Unity Singleton accross multiple scenes I have a game where my code is designed to be on a single scene so I've implemented a singleton like that:

public class MonoSingleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static bool _applicationIsQuitting;
private static readonly object Locker = new object ();
protected static T Instance;

public static T GetInstance {
    get {
        if (_applicationIsQuitting) {
            return null;
        }

        lock (Locker) {
            if (Instance == null) {
                Instance = (T)FindObjectOfType (typeof(T));

                if (FindObjectsOfType (typeof(T)).Length > 1) {
                    Debug.LogWarning ("More than one Singleton of type : " + typeof(T));
                    return Instance;
                }

                if (Instance == null) {
                    var singleton = new GameObject ();
                    Instance = singleton.AddComponent<T> ();
                    singleton.name = "(MonoSingleton) " + typeof(T);

                    DontDestroyOnLoad (singleton);

                    Debug.Log ("An instance of : " + typeof(T) + " is needed in the scene, so " + singleton +
                    " was create with DontDestroyOnLoad");

                    return Instance;
                }
                Debug.Log ("Using instance already created : " + Instance.gameObject.name);
                return Instance;
            }
            return Instance;
        }
    }
}

public void OnDestroy ()
{
    _applicationIsQuitting = true;
}

#region virtual methods

public virtual void Awake ()
{
        Debug.Log ("Awake".ColorMe (Color.green) + " instance of : " + typeof(T));
}
#endregion
}

But now with my game growing, I want to split it into mulitple scenes (easier to do now with Unity 5.3).

I mainly use singleton to manage UI. And for this i've a UI GameObject containing my script for current scenes. So on GameObject Awake it create a reference to my Scrit that i can call with script.GetInstance.

My problem is when i refresh a scene or i use a ui component that is already used in previous loaded scene my GetInstance return null. Is there any way to refresh instance reference in virtual Awake method ?

EDIT:

Obviously OnDestroy() set _applicationIsQuitting to true, so GetInstance return null. I've try to set it to false on Awake() but it doesn't change anything so I do that :

public static T SetInstance {
    set {
        Debug.Log (Prefix + ("Updating instance of : " + typeof(T)).ColorMe (Color.yellow));
        _applicationIsQuitting = false;
        Instance = value;
    }
}

and on each class when I awake i do the following :

public override void Awake ()
{
    base.Awake ();
    myScript.SetInstance = this;
}

I prefer to have separated getter and setter to provide myself mode readability.

sentences:
What's the name for the random animations played when character isn't doing anything else? In many games, the main characters or enemies usually do some random stuff when idle other than just standing there breathing. For example, they may take a nap or eat some food.

These add nothing to gameplay, but help develop some personality for the characters. I can't find a word to describe them; do these animations have a standard name in the industry?

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:
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:
Season system Implementation system in unity So I am planning on implementing a seasons system for a 2D top-down game. Each season will have a characteristic terrain feature e.g. summers will have patches of grass spread out .. which I wanna reproduce by green bloat spread around on a 2D plane or quad...  These features will need to generate dynamically for every season. The implementation will be simplistic nonetheless... using green bloats for grass patches, blue bloats for waterholes.. Can you guys give me like pointers to solve this problem?

Some Reference images:-

Notice how the backdrop/background changes for each season
Green Patches denotes grass
Light blue denotes unfrozen water, dark blue denotes frozen water
These bloats are to be generated dynamically, with some conditions like frozen water and unfrozen water need to spawn next to each other

Summer Season #### Monsoon Season #### Winter Season ##

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:
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:
Positioning a sprite in XNA: Use ClientBounds or BackBuffer? I'm reading a book called "Learning XNA 4.0" written by Aaron Reed. Throughout most of the chapters, whenever he calculates the position of a sprite to use in his call to SpriteBatch.Draw, he uses Window.ClientBounds.Width and Window.ClientBounds.Height. But then all of a sudden, on page 108, he uses PresentationParameters.BackBufferWidth and PresentationParameters.BackBufferHeight instead.

I think I understand what the Back Buffer and the Client Bounds are and the difference between those two (or perhaps not?). But I'm mighty confused about when I should use one or the other when it comes to positioning sprites. The author uses for the most part Client Bounds both for checking whenever a moving sprite is of the screen and to find a spawn point for new sprites. However, he seems to make two exceptions from this pattern in his book. The first time is when he wants some animated sprites to "move in" and cross the screen from one side to another (page 108 as mentioned). The second and last time is when he positions a texture to work as a button in the lower right corner of a Windows Phone 7 screen (page 379).

Anyone got an idea?

I shall provide some context if it is of any help. Here's how he usually calls SpriteBatch.Draw (code example from where he positions a sprite in the middle of the screen [page 35]):

spriteBatch.Draw(texture,
   new Vector2(
   (Window.ClientBounds.Width / 2) - (texture.Width / 2),
   (Window.ClientBounds.Height / 2) - (texture.Height / 2)),
   null,
   Color.White,
   0,
   Vector2.Zero,
   1,
   SpriteEffects.None,
   0);

And here is the first case of four possible in a switch statement that will set the position of soon to be spawned moving sprites, this position will later be used in the SpriteBatch.Draw call (page 108):

// Randomly choose which side of the screen to place enemy,
// then randomly create a position along that side of the screen
// and randomly choose a speed for the enemy
switch (((Game1)Game).rnd.Next(4))
{
   case 0: // LEFT to RIGHT
      position = new Vector2(
         -frameSize.X, ((Game1)Game).rnd.Next(0,
         Game.GraphicsDevice.PresentationParameters.BackBufferHeight
         - frameSize.Y));

      speed = new Vector2(((Game1)Game).rnd.Next(
         enemyMinSpeed,
         enemyMaxSpeed), 0);
   break;

sentences:
Understanding Entity Component System I'm new in game development and I'm struggling to implement Entity Component System (ECS) properly, I have no idea whether I'm doing it right or completely wrong.

Basically, I try to implement ECS pattern with SceneGraph system, so here my current understanding:

  Entity is nothing but a components bag, it has no logic but it may (or may not?) contain essential information to differentiate from the other Entity or grouping them as well, such as ID, Name, Tags, etc.
  Component is a data container but contains no logic how to process the data but may contains function to manipulate the data, for example a Transform component may contains Inverse() function.
  System is the implementation holder, it process Entity based on its Component. The System may define a "requirement". The Entity is processed if it match the requirement, for example SpriteRendererSystem only process Entity that contains SpriteRenderer and Transform component.

Currently, I have no idea if it's correct or completely mess. Therefore, I try to implement ECS along with SceneGraph as stated before, here my SceneGraph implementation:

  Node is an object in the Scene, basically, everything that need to added into the Scene must implement this. The Node can add another Node instances as its child as well as parent. Currently, my Entity implement Node, meaning that all Entity can be added into Scene
  Scene is the top most level of Node, it represent a root of Node and there can be only one active Scene at a time. The Scene basically implements Node and it has Update() and Render() functions, this functions is called by SceneDirector
  SceneDirector is basically inherit game window, it manage the active Scene, passing Render() and Update() method to the active scene as well as updating the Input states to the Scene.

Now, I combine both pattern as follows:

  The Scene has a list of System as well as list of Node. Depending the System, the System may called on Render() function if the System is Renderable, otherwise it will called on Update() function
  Upon Render() / Update() function, the Scene will loop the entire Entity, it also loop the entire registered System. The System will check the Entity whether the requirement is match, if the requirement is fulfilled, the Entity will be processed by the System

Now my questions:

Can Component hold the logic? or it should not and stay as a bag of data?
Is it correct implement Node on Entity?
Is it correct to let every instances of Scene has their own System? or should I make it globally by storing the list of System in SceneDirector?
Is there any more efficient way to process the Entity rather than loop the Entities and the Systems completely?
Is my understanding correct about the ECS? Am I on the right track? or completely wrong?

Thanks in advance

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:
Detecting if an object is following a path I am attempting to take GPS data and track it on a map and see if it follows a given path. I have the path as a set of points and the GPS data streams in as a similar set of points. I am attempting to track the progression of the current position across the path and I am wondering if there are any well known algorithms for this. I have come up with my own that works ok but it is a complex enough problem that I would like to minimize the amount of re-inventing of the wheel that I do.

What approach or algorithm would you recommend taking for this problem?

sentences:
Why are my texture coordinates always (0,0) in this shader? What I'm trying to do is add my depth buffers values to my scene, ie. I'm trying to make objects closer to the camera darker and objects further away lighter. Which should be easy: just render the depth buffer to a texture, and then render the scene, multiplying each pixels colour by the colour value at the same coordinates in my depth-buffer texture...

Yet I don't know how to use coordinates for textures.

Or more like it's just failing. What's happening is that the vertex shader is only using the (0,0) coordinate of my texture, so the entire scene changes colour depending on what's there.

What I'm doing is this (the critical stuff from my render function):

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthTextureId);   //Binds the texture
box.render();    //Sets the viewing matrix and renders a test VBO

I guess that's the right way to bind a texture? Anyhoo, here's the vertex shader's important stuff:

out vec4 ShadowCoord;

void main() {
    gl_Position = PMatrix * (VMatrix * MMatrix) * gl_Vertex;  //Projection view and model matrices
    ShadowCoord = gl_MultiTexCoord0;    //something I kept seeing in examples, was hoping it would work.
}

It seems gl_MultiTexCoord0 is the problem? Maybe?

The frag shader sets the colour using this function:

vec4(texture2D(ShadowMap, ShadowCoord.st).x * vec3(Color), 1.0);

Where the ShadowMap is the sampler2D for the texture, and Color is the vertex's color...

So what am I missing? How come the coordinates are not changing from 0,0?

sentences:
How to make my multiplayer Air Hockey better? I've made simple multiplayer web game but don't like how it works. Here's a video example (captured at 85 avg ping) showing what I have.
What I used:

Super naive client prediction - called so because there is no reconciliation - most of the time players' strikers can't be moved by anything except players themselves

Interpolation (it's turned off on the attached video because at the current state of the game in combination with prediction it made things look worse. Without prediction input lag is unacceptably big)

I've read some valve wiki articles, Gambetta's articles and some other not so popular sources, which helped to understand general ideas, but I still lack understanding on how to combine various techniques of minimizing delays for players and some implementation details. So here are the questions:

What is the best way to sync time on client and server and when to start clocks? I should measure average ping and then what? Server sends notifications to clients 'start clocking in X ms' based on ping? Should they even start clocking at the same time?

How to improve user experience for my game? I guess I should probably use extrapolation for puck

Is interpolation even needed with 60 tickrate for anything with 60 or lower hz screens? I'm not aiming at e-sports level experience and would rather make it feel nicer for 60 hz phone screens

sentences:
Are all conditions in an if statement checked? If I have an if statement like this:

bool conditionOne = true;
bool conditionTwo = false;
bool conditionThree = false;

if(conditionOne || conditionTwo || conditionThree)
{
    //do something
}

Will conditionTwo and conditionThree actually be checked even though conditionOne is already true, and thus has met the requirements of the if statement to run the code inside it? It would be pointless to check if conditionTwo and conditionThree are true because either way the code inside the if statement would be run.

I'm thinking this would be useful to know if I have some really long and quite expensive checks to do.

sentences:
How could I get composite rigid body into unity I am developing a game, in unity, that has accurate destruction physics and from my understanding unity uses plain old rigid body physics. I was wondering if there was a way to bring composite rigid body physics into unity through a plug in or library or some other way?

Thanks, nova

edit: So composite rigid body physics is almost exact like normal rigid body physics. But the main difference is that in composite rigid body physics all of the assets will not be considered physics based objects until an outside force hits them. For example a building and all of that parts it is made out of will not be processed as physics based objects until say a rocket hits it.     This method of composite rigid body physics uses much less memory because it is only processing what is being affect and not everything else.

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 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 can I render extremely large models? I'm trying to build a game in Unity similar to the game Kerbal Space Program where there are large celestial bodies that the player can orbit. I'm running into a few problems though. My first issue is that the larger I make a sphere, the slower the game gets. Secondly, whenever the sphere exceeds a certain size, the rendering engine cuts off part of the planet, which means I can only see half the model. How can I do this at the size that KSP has?

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 rotate model 180º with XNA I got a model, and a camera pointing at this model, I think my camera position is the problem.
Its showing the front of the model, but I want it to show its back like in third person.
My camera code is:

Vector3 thirdPersonReference = new Vector3(0, 100, -100);
public Camera(Vector3 landscapePosition, Player _player)
    {
        this.player = _player;
        rotationMatrix = Matrix.CreateRotationY(this.player.Rotation);
        Vector3 transformedReference = Vector3.Transform(thirdPersonReference, rotationMatrix);
        this.position = transformedReference + this.player.Position;
        viewMatrix = Matrix.CreateLookAt(this.position, this.player.Position, new Vector3(0.0f, 1.0f, 0.0f));
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, this.player.AspectRatio,
            1.0f, 1000.0f);
        terrainMatrix = Matrix.CreateTranslation(landscapePosition);
    }

What is that Im doing wrong???

sentences:
shooting bullets without players being able to cheat I'm working on a multiplayer game and for bullets that players shoot I was wondering what is the right way to do it:

when a player press a key It send the key code to server and:
a. server starts moving the bullet and sends the bullet location to clients
b. server tells the clients to generate a bullet and move it in angle x, with speed of x for duration of x

well the second way makes more sense but I'm worried about players being able to cheat in the second way. So How should I do this without players being able to cheat?

sentences:
How to sell Android game if selling through Market is not available in your country Android Market doesn’t allow developers from my country to sell app. From what I understand the only chance to make some profit is to place ads in my application.

Does ads make a decent profit or is there some other way to earn money are there any other payments system available for Android to bypass Google’s limitations?

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:
FBX animation works in 3DSMax but not with Assimp I have an FBX file that represent a plane with an animation of the gear opening. In my editor 3DSMax or in the Unity editor, the file and animation seem good, but when I use Open 3D Model(the official viewer of Assimp) or when I call the FBX file simply in an application, to see what the file will look like with the use of Assimp, I got some issues.

The object seems normal at the beginning, but when I try to launch the animation, all my animated elements are going crazy.

Here's what it looks like :

Here's my FBX FILE

Do you have experience something similar ? Does it come from my file or a parameter in Assimp ?

I am beginning to think that there is a problem with how Assimp handles pivot points, looks like objects are rotating using a different pivot point in Unity/open3mod.

sentences:
Why can't I see how many installs my game has on its Google Play page? I made an Android game, and I uploaded and published it to Google Play. Then, I installed it on my phone.

Why can't I see the install count, on its Google Play page?

sentences:
scaling problem with some resolutions So I made a scaling system for different resolutions, and I got very weird results.

I have an old "scaling" system where you can choose which scaleSize you want (for testing with the old 800 x 450 resolution) and you can choose between 1 and 2. I made a new scaling system after this that makes a scale with a matrix.

(old scaling system with scaleSize is just for making the textures/collision boxes bigger/smaller, not resolution dependent)

int currentWidth;
int currentHeight;
int preferredWidth;
int preferredHeight;
float scaleWidth;
float scaleHeight;

public Matrix scale;
GameWindow Window;
ContentManager Content;
GraphicsDeviceManager Graphics;
GraphicsDevice GraphicsDevice;

public ScreenSize(GraphicsDevice graphicsDevice, GraphicsDeviceManager graphics, ContentManager content, GameWindow window)
{
    Window = window;
    Content = content;
    Graphics = graphics;
    GraphicsDevice = graphicsDevice;
    LoadContent();
}

public void LoadContent()
{
    Graphics.PreferredBackBufferWidth = 1920;
    Graphics.PreferredBackBufferHeight = 1080;

    currentWidth = GraphicsDevice.Viewport.Width;
    currentHeight = GraphicsDevice.Viewport.Height;

    preferredWidth = 800;
    preferredHeight = 450;

    scaleWidth = currentWidth / preferredWidth;
    scaleHeight = currentHeight / preferredHeight;

    scale = Matrix.CreateScale(scaleWidth, scaleHeight, 1.0f);

    this.Graphics.IsFullScreen = false;

    Graphics.ApplyChanges();
}

I add the scale to my spriteBatch.Begin() and the textures are scaled. It works fine when the scaleSize is 2 but not when the scaleSize is 1.

The ScaleSize scales the collision box and the textures (not with the resolution, but just when you need (for example) a texture that's 2x bigger, then you use the scaleSize of 2. See an example below.

public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, Color color, float scaleSize)
{
    spriteBatch.Draw(textureImage, position, new Rectangle(
    (currentFrame.X * frameSize.X),
    (currentFrame.Y * frameSize.Y),
    frameSize.X, frameSize.Y),
    color, 0, Vector2.Zero, scaleSize, SpriteEffects.None, depth);
}

But the problem is that, when I use the scaleSize of 1, then the pixels in-game are not the same size (for resolutions that are not the default resolution (800 x 450)). But they are when scaleSize is 2. In my first code block I use the resolution 1920 x 1080. When the scaleSize is 2, then it looks good. When the scaleSize is 1, then it looks bad (in fullscreen it looks good for some reason).

example: (left is good, right is wrong)

I ask this question because I want the textures in-game smaller. (scaleSize = 1)

EDIT: scaleSize 2 doesn't look good on some resolutions (like 1440 x 900). Do I need another preferredWidth and preferredHeight?

example:

summary: Everything looks/works fine with scaleSize 2, but doesn't with 1.
-> edit: scaling doesn't work well.

sentences:
Are there any OpenGL ES 2.0 examples for JOGL? I've scoured the internet for the last few hours looking for an example of how to run even the most basic OpenGL ES 2 example using JOGL but "by Jupiter!" it has been a total fail.

I tried converting the android example from the OpenGL ES 2.0 Programming Guide examples (and at the same time looking at the WebGL example -- which worked fine) yet without any success.

Are there any examples out there?

If anyone else wants some extra help regarding this question see this thread on the official Jogamp forum.

sentences:
What are some good resources for creating a game engine in XNA? I'm currently a student game programmer working on an indie project. We have a team of eleven people (five programmers, four artists, and two audio designers) aboard, all working hard to help design this game. We've been meeting for months now and so far we have a pretty buffed out Game Design Document as well as much audio/visual concept art. Our programmers are itching to progress on our own end.

Each person in our programming team is well versed in C++, but is very familiar with C#. We have enough experience and skill that we're confident that we will be successful with our game, and we're looking to build our own game engine in XNA as it seems like it would be worth our time and effort in the end.

The game itself will be a 2D beat 'em up style game to be released over xbox live and the PC. It's play style will be similar to that of Castle Crashers or Scott Pilgrim vs The World. We want to design the game engine to allow us to better implement our assets into the game as well as to simplify the creation of design elements/mechanics.

Currently between our programmers, we have books such as "XNA 4.0" and "Game Coding Complete, Third Edition," but we'd still like more information on both XNA and (especially) building a game engine from scratch. What are any other good books, websites, or resources we could use to further map out and program our game engine?

sentences: Grid Based AI Pathfinding I'm creating a top-down RPG and I have the movement system set up for the player character - it is alike to Pokemon in the movement sense in that it looks smooth but it is aligned to a grid. Since I have the player sorted I was trying to figure out how to use this movement principle for the Enemy AI's Pathfinding but I haven't figured out how to do it; I was wondering if anyone has a possible solution to this.

sentences:
Is it bad practice to for the server to request data for a client from another client? I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and then that packet is sent to everyone else in the room so that a rectangle is drawn on their screen.

So far everything works perfectly and there's also a stack on each client of all the commands thus far for infinite undo and redo. However, there server does not contain this stack because all it has to do is forward commands to clients in the room.

Everything is working perfectly so far and everyone can see everyone else drawing in real time but I'd like to implement a feature where if someone joins a room late they can see the current whiteboard. That is, the entire command stack would have to be sent to someone. However, this data isn't stored on the server, but each client has their own (identical copy).

Would it be bad for when someone joined to have the server ask one of the clients (which? round-robin?) to send his command stack to the server and have the server forward it to the client? My concerns are the delay and teh amount of data being sent in one go (congestion).

What do you all think? Are there any other options?

sentences:
Shadow mapping. I don't understand what to do after creating the depth texture I'm taking an intro to computer graphics course, so this is something we haven't touched on.

I am reading this tutorial http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/ but I cant figure out what to do after creating the depth texture. The depth texture is from the lights point of view (directional light). I sent the depth texture to my post process shader where I want to apply the shadows.
The depth texture:

From what I understand from the article, I also need the position texture from the light's point of view.

The position texture:

And then the article determines if the current pixel is visible from the lights point of view like this:

float visibility = 1.0;
//ShadowCoord is the position of the vertex as seen from the light
if ( texture2D( shadowMap, ShadowCoord.xy ).z  <  ShadowCoord.z){
   visibility = 0.5;
}

Here is what I end up with:

Im not sure, but I believe my position texture is wrong?

Edit:
Here is how I create the position relative to the light texture in my shader:

positionSunPOV = (biasMatrix * sunMVP * vPosition).xyz;
// biasMatrix is the matrix that changes the coords from [-1,1] to [0,1]
// sunMVP is the model view projection matrix for the sun than I passed in
// vPosition is the position of the vertex

Here is how I create sunMVP:

SunDir = vec3(0,30,-30);
sunProjectionMatrix = ortho(left, right, bottom, ytop, nearO, farO);
sunViewMatrix = lookAt(SunDir, vec3(0,0,0), up);
sunModelMatrix = mat4(1.0);
//sunMV = mult(sunViewMatrix,sunModelMatrix);
sunMVP = mult( sunProjectionMatrix, mult(sunViewMatrix,sunModelMatrix) );

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:
Referencing Tilemap inside Grid Prefab I have a prefab of a grid which contains 3 different tilemaps:

Main, Foreground, & Background

I want to reference the tilemaps inside a script of the prefab but can't figure out how to do that... I just need to edit the tiles in the tilemaps located inside the prefab.

sentences:
Why would an online MMO throttle actions per day? I started playing Die2Nite and was surprised that it has such a strict limit on the number of actions per day. After a while, I figured it was just part of the charm.

I also started playing Magic Duel and it has a similar mechanic that limits the amount of actions per day.

Is there a game design principle behind a decision to limit actions per day in an MMO?

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:
How do you set the movement speed of a sprite? I'm using Slick 2D/Java to play around with graphics. Getting an image to move is easy:

Input input = gc.getInput();

        if(input.isKeyDown(sprite.up)){
            sprite.y--;
        }else if (input.isKeyDown(sprite.down)){
            sprite.y++;
        }else if (input.isKeyDown(sprite.left)){
            sprite.x--;
        }else if (input.isKeyDown(sprite.right)){
            sprite.x++;
        }

However, this is called on every update, so if you hold up, the sprite moves to the edge of the screen in a few hundred milliseconds. Since coordinates are integers, I can't add less than 1 to slow the sprite down. I'm assuming I must have to implement a timer of some sort or something. Any advice?

sentences:
How to remove floating terrain when generated with 3D Perlin Noise? I'm currently using 3D Perlin Noise to generate random terrain in combination with Marching Cubes.

My issue seems to lie in scaling the noise function to get reasonable heights in my terrain. If only one octave is used, all points in relation to the noise are obviously interpolated which results in fairly smooth data. However, to get overhangs/caves/jagged terrain, I have to use multiple octaves with varying amplitudes and/or scale the resulting values to my 'max' height I want of the map.

I might be missing something, but by using marching cubes with 3D perlin noise, I regularly get floating bits of terrain.

Any ideas on how I could correct this or if there's other noise functions I might use to get results like I'm describing? I'm wanting hills/valleys/mountains/lakes/etc. No need for floating bits segregated from the rest of the map. I believe this is a similar issue to what Minecraft has when it has terrain that just floats around in the sky occasionally upon generation.

Thanks for any assistance,
Mythics

sentences:
why does my objects only spawn once or really slowly? public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;
void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        randX = Random.Range(-5.6f, 5.6f);
        randY = 5.57f;
        SpawnPosition = new Vector2(randX, randY);
        Instantiate(fallingRockPrefab, SpawnPosition, Quaternion.identity);

    }

}

I set the "spawnsMinMax" over at the inspector in Unity as high as I can like (25 or 30 etc) but it still spawns once or like 1 or 2 per second. Even I set the number as low it can go, it still spawn in the same way. How do I fix this?

sentences:
Opengl Compute Shaders support? I have a question about compute shaders.

My GPU is an AMD mobility Radeon 6490 which as the AMD website says supports OpenGL 4.1. However, when I check for my compatibility version via 'glGetString(GL_VERSION)' I get 4.3.12618 Compatibility Profile Context 13.250.18.0.
Does that mean I should be able to use compute shaders as they are introduced in OpenGL 4.3?

If I try to create a compute shader in my program GLenum type GL_COMPUTE_SHADER is unknown but I'm not sure if newest headers are included.

My GPU also supports the 'GL_ARB_compute_shader' extension.

So is there a special way to enable this extension or should I try to somehow include newer headers? Or will I not be able to use compute shaders at all (I don't want to use OpenCL)?

Thanks for answer.

sentences:
Unity question on OnTriggerStay() function I'm currently working on a soccer game.I have a script for the ball that whenever the ball collides as trigger with the goal line,the ball will return to the middle point.But seems like the ball doesn't Lerp() back,afterward I tried to check if Unity counts it as collide or not with Debug.Log("Goal"); but nothing is logged to the console.Please help me with that.Here is the first code:

public var smooth : float;

private var newPosition : Vector3;

function Awake ()
{
    newPosition = transform.position;
}

function OnTriggerStay (ball : Collider)
{
    var positionA : Vector3 = new Vector3(0, 0.3, 0);

    newPosition = positionA;

    transform.position = Vector3.Lerp(transform.position, newPosition, smooth * Time.deltaTime);
}

Here is the second code (after changing to Debug.Log()):

function OnTriggerStay (ball : Collider)
{
    Debug.Log("Goal");
}

sentences:
Drawing pixels with SDL2 advice, is it fine to draw them one by one on the CPU? I want to make a raycaster and I figured out how to open a window and draw pixels to it with SDL2, but the way I am doing it now just doesn't seem very efficient, I figured out how to do it from briefly reading the documentation.
For every pixel in the window, I am going through them one by one, setting the render color with SDL_SetRenderDrawColor(), then drawing the pixel with SDL_RenderDrawPoint() based on an array. It's surprisingly fast doing this but is there some way I can send like a pixel buffer to the GPU or something?
I see there is a SDL_RenderDrawPoints (plural version) function but it only takes positions, meaning all the pixels drawn with it would be the same color? I'm looking for a similar function but either it also takes the color data too or it is just a buffer of color data and its index determines its position. Rendering a bunch of pixels that are all the same color doesn't seem very useful to me.
I later tested it by fading between colors and with window sizes of more than 600 x 400 the performance is horrible with my method, with 1200 x 800 it is like 5fps.

sentences:
Developing an Asteroids successor: which languages/tools/frameworks? Currently I'm planning to run the Asteroids successor on the Java Virtual Machine, while writing the code in Scala (because that's the language I'm fluent in).

I have looked at different options, like using one of the various OpenGL bindings or using Java2D.

Having looked at some frameworks it seems that they either are targeted at 3D development or jump-and-run style games.

Are there any useful frameworks or should I try to combine libraries from different origins and roll my own "framework"?

Are other frameworks/tools like Flash/Flex vastly superior, so that learning a new language/platform would only be a minor drawback compared to huge benefits?

sentences:
characterController reference issue I am trying to move my character to point that taken from mouse position.

here is my code:

private Vector3 hittedPoint=Vector3.zero;

 if (Input.GetMouseButtonDown (0)) {
             Ray ray = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
             RaycastHit hit;

         if (Physics.Raycast(ray, out hit)) {
             //get object
             GameObject hittedObject=hit.transform.gameObject;

             if(hittedObject==GameObject.FindGameObjectsWithTag("Ground")[0]){

                 hittedPoint= new Vector3(hit.point.x,transform.position.y,hit.point.z);
                 //hittedPoint = transform.TransformDirection (hittedPoint);

             }
         }
     }

             if (hittedPoint != Vector3.zero) {
                 float delta = (transform.position - hittedPoint).magnitude;
                 if (delta > 5) {
             controller.Move (hittedPoint*Time.deltaTime);
             Debug.Log (transform.position);
                 } else {
                     hittedPoint = Vector3.zero;
                     }
             }

The problem is that my object moves according to its first position at the scence. For example if I move character towards right then towards forward; at second movement it goes diagonal. It is like it makes its movements according the first position of it in scence.

The second problem is; i couldn't find efficient method for stopping movement when character reaches the point. If I decrease delta; character skips the point and if I increase it, character stops to early.

sentences:
How do I implement a "sliding out of / into" effect on a settings menu similar to that in Angry Birds? I'm trying to implement a settings menu component similar to that in Angry Birds - a button control that makes an options menu slide out of it and back into it when clicked on.

I use scene2d.ui to build the UI components: a Button in a Table to implement the button control, a Table to implement the options menu, and a Stack to lay these out one on top of the other and at this moment I have the following behavior:

When the user hits the button control for the first time, then the alpha of the table component is set to 1;
When the user hits the button control the second time, then the alpha of the table component is set to 0;
And so on.

Any ideas how I can get the sliding out of and into effect on user clicks with libgdx? Similar to what Angry Birds provides.

Maybe using the TweenEngine, actions, interpolations, combinations of these?

Thanks in advance.

sentences:
How should I do 3D games through Java on a mac? I have been self-teaching myself Java on the mac mostly because the language is cross-platform. Recently, I have been only able to develop 2D games using the Graphics2D class.
Now, I want to learn how to make 3D games in Java. I used to model and animate stuff in 3D, so my knowledge of 3-Dimensional stuff is okay.

I have spent the last 3 hours using google to look up ways of making 3D games in java. Apparently the best one to use is OpenGL, so i looked up a tutorial on it and i cannot find a tutorial that shows how to (if there is a way) install JOGL on the Mac platform.

Should i continue to use Java?

How can i make 3D games using Java?

What is the best way to make 3D games on a mac?

sentences:
Where do the buffer values come from when rendering? In the textbook I am reading, it talks about fragment tests that are performed when rendering.

All of these tests involve comparing the current fragment x value (x can be alpha, color, etc.) with a corresponding buffer value, and doing something in case the test passes. The test is usually a comparison between those two values (for example, >=, <=, etc.).

What I cannot understand is where do these buffer values come from in the first place?

Are these previous values? If so, what do the current values have to do with previously calculated values?

I don't even know what to search in google for this topic. Sorry if it is a total starter question. I am currently reading about rendering for the first time

sentences:
Multiplayer platformer I'm considering building a multiplayer game having a central server handling the game and keep clients updated. I was checking various examples of ".io" games styles of implementation and seems pretty straight forward that the logic is on server and clients are mostly dummy.

Now the question that I have is .. how dummy should be the client? Where do you draw the line?

To give more context, I was thinking of building a platformer with 2 players on it, a few obstacles on the way etc.

What is clear for me is:

any input the characters receive needs to be sent to the server and updated the other client.
any map event logic will stay on the server and update clients when happening

What is not clear for me is:

where do you place basic physics? like keeping the character on the map
how about a simple movement like Jumping? should it be like a state sent to the server?
what about the whole map? should the server know the entire map?
what if I want to destroy one tile of the map?

I would appreciate your point of view or if you know some examples / links where I can find more info about these things.

Cheers!

sentences: pre-load new scene in unity async but don't show it I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.

sentences:
Is A* efficient even when the obstacles are moving? I'm just starting to learn about path-finding and have been looking into the A* algorithm and my main concern is that it all of the examples I have seen show static obstacles that it computes around.

If I have moving obstacles, say other characters for example, moving around as well that the character must find their way around, I'm assuming I'll have to run the algorithm each frame, but I'm worried that will become rather expensive for the hardware to process each frame for each moving actor.

So is A* still efficient enough to use whenever the obstacles are moving too, or is there another method of path-finding that handles moving obstacles more eloquently?

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:
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: Drawing many separate lines using mouse OpenGL(GLFW/glad) So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and decided to start drawing a different line at P2 as shown in the figure, but my two points P1 and P2 joined together, how to fix it? Need to clear the array after drawing at the point P1, actually it doesn't help if I use glClearColor and glClear(GL_COLOR_BUFFER_BIT).. Is there any other way?

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:
Is a 10 meg 2048x2048 bitmap too big a size texture to use in an OpenGL game? This is a speed question, I have a texture, which is 2048 per 2048, the texture is designed to run in big resolutions (1920x1080 for example).

The problem is, that the texture have a size of 10MB in bitmap, is too heavy, I don't know if that's a good size for load it in gl and use it in a game...

Is there any problem to use a 10MB texture in an OpenGL Game?

sentences:
How do i make player input object spawning data driven? I'm using component based design and am at the stage or re-factoring simple player input to be data driven.

Currently i have a PlayerControlComponent, which an entity has if it should be player controlled. Currently only a single entity has this.

I have an InputSystem that acts on entities with PlayerControlComponent, PhysicalComponent and MoveableComponent components.

Below is the code that actually does the entity creation:

if (_InputActionManager.IsAction(_ActionFireBullet))
{
    if (WorldManager.CanDoAction(playerControlComponent.CreateBulletActionId))
    {
        // Create a bullet and fire it
        using (var entityTemplate = WorldManager.GetEntityTemplate(@"EntityTemplates\Bullet"))
        {
            var bulletPhysicalComponent = entityTemplate.Item.GetComponentOfType<PhysicalComponent>();
            var bulletMoveableComponent = entityTemplate.Item.GetComponentOfType<MoveableComponent>();

            bulletPhysicalComponent.Position = physicalComponent.Position + physicalComponent.Direction * physicalComponent.Radius;
            bulletPhysicalComponent.Direction = physicalComponent.Direction;
            bulletMoveableComponent.Velocity = moveableComponent.Velocity + physicalComponent.Direction * 200;
        }

        WorldManager.MarkActionDone(playerControlComponent.CreateBulletActionId);
    }
}

I want to get to the stage where I can have an XML file that indicates some how that a given entity will create a new entity based on a given template and set initial values such as position, direction and velocity in the above example.

I want to avoid having to change code and maybe add systems and components for each type of thing I want to spawn.

For example, currently if I wanted to add the ability for an enemy to spawn a missile I'd need to define my missle entity template (fine), create a new component to mark the entity as being able to fire a missle, then create a system that uses that component (want to avoid), then create a system with code similar to the above (want to avoid).

As another example, say I want to change the speed of the bullet, currently I do that in code, but I want to be able to do that in a data-driven way.

How can I create and manage a way of creating an entity based on an event occuring, with properties based on the entity that created it? i.e. Player presses Fire, bullet spawned at ship location, moving away from ship.

sentences:
How do I design my RPG-like class system in a more modular way? I'm building a mod for Terraria that will add classes and their corresponding abilities to the game. You're a warrior? Push your ability key and you'll use your berserk ability.

I'm trying to make my player code as simple as possible. I'd like to set the player's in-game "class" by doing something like this at the top of the player class so the rest of the methods in it can access it later:

//Set class
WarriorClass playerClass == new WarriorClass(playerReference, level)

Herein lies the first issue. I get an error at playerReference that says:

Error   CS0236  A field initializer cannot reference the non-static field, method, or property 'ModPlayer.playerReference'  MyMod

Ok, so I looked that up and set the initialization in the WarriorClass instead:

public Player playerReference = new Player();

And I have this now in my player code:

//Set class
     WarriorClass playerClass = new WarriorClass(level);

Here's the beauty of it. In the gamepad input method within my player code all I ever have to do is:

    //On key presses
    public override void ProcessTriggers(TriggersSet triggersSet)
    {
        if (MyMod.ability1Key.JustPressed)
        {
             playerClass.UseAbility(MyMod.ability1Key);
        }

Now that the ability1 key was pressed, let the WarriorClass handle what to do:

    public void UseAbility(ModHotKey key)
    {
            //Ability 1
            if (key.JustPressed == MyMod.ability1Key)
            {
                //Start berserking
                if (player.HasBuff(ModContent.BuffType<BerserkBuff>()) == false )
                {
                    //Lose 10% of your life
                    lifeLost = player.statLifeMax2 / 10;
                    player.statLife = player.statLife - (int)lifeLost;

                    //Berserk and add damage over in the Buff code
                    player.AddBuff(ModContent.BuffType<BerserkBuff>(), 600, false);
                }

This is all great!!! I can add any amount of classes I want and this player code never changes. Except If I want to add if/then logic to select a class in say, Update() then it breaks the following reference in my gamepad input code:

playerClass.UseAbility(MyMod.ability1Key);

Of course it won't have a reference unless I hard code it at the top of the player file, but I don't know what class a player will be until they pick one.

Am I doing this fundamentally in a bad way or am I missing something else in terms of OO programming? I don't want to have to initialize every class for the character at the top of the file like this:

WarriorClass warriorClass = new WarriorClass(level);
ArcherClass archerClass = new ArcherClass(level);
...

... just to do this in the gamepad input method:

if (classChoice == "Warrior")
{
     warriorClass.UseAbility(MyMod.ability1Key);
}
else if (classChoice == "Archer")
{
     archerClass.UseAbility(MyMod.ability1Key);
}

sentences:
Draw character silhouette when not visible I have a mesh representing my character. I want to give it a partially transparent greyish silhouette when other objects are blocking it from view of the camera.

I'm using Ogre3D, and GLSL as a shading language, but this is a pretty technology/language agnostic question.

sentences:
(XNA) What's a Good Database Program for a Turn-Based RPG? I'll begin by saying that I feel my level of expertise matters here, and so I have about a year worth of experience as a programmer in the C# language and most of the .NET framework as a whole, but have scarcely worked with databases at all throughout my career so far. Can't exactly say why. Either way, I'm a bit of a beginner, although SQL/LINQ I am capable of working with once I have this question resolved. Moving on...

At home, I am developing a single-player (so only one person needs to access it) turn-based RPG in XNA. I have a lot of the logic done and the time has come for me to begin building a database for it.

THE REQUIREMENTS: There will be both dynamically written data not included with the program (such as the location in the world at which a player saved his game, that he may load in the same place) and read data that needs to be capable of being distributed easily with the program (such as a table containing stats of every monster).

THE DESIRED BUT OPTIONAL PERKS: Beyond these absolute requirements, ease of use is a second priority I want to focus on. My amatuer nature doesn't want me digging around on ground I am too unfamiliar with.

MY ATTEMPTS AT RESEARCH: I understand Access to be a simple-to-use (though oft frowned upon) choice that could work based on needing only one user to access the database at a time. SQL Server could also work, but I understand it to be more difficult to use based on my needs. And in both cases, I am not sure if there are complications associated with the distrubution of pre-loaded data with the programs. In this case, I think I should use an XML file to hold the data I want the game to come with, but I am not sure. Amidst all of this, I have also considered creating the .dbml right there in Visual Studio because it seems the simplest, but same issue: I don't know the limitations of capability and distribution.

I have tried to outline what I know and what I need to accomplish, as well as some of the options I have attempted to research, but ultimately, my knowledge has holes in it I can't find the answers to and I can't form a conclusive answer. Thus, I ask you kind people, based on the above, what is my best option for how to start building my game's database?

sentences:
How to compute acceleration by using Kinect device joint positions I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

sentences:
Unity Gameobject turned grayed I accidently pressed some key combination which turned all the gameobjects in Unity engine gray and now I cannot restore them to the original form. Any suggestions?
Below is the link of what I am talking about: https://ibb.co/izAVRo

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:
Keystone Correction using 3D-Points of Kinect With XNA, I am displaying a simple rectangle which is projected onto the floor. The projector can be placed at an arbitrary position. Obviously, the projected rectangle gets distorted according to the projectors position and angle. A Kinect scans the floor looking for the four corners.
Now my goal is to transform the original rectangle such that the projection is no longer distorted by basically pre-warping the rectangle.

My first approach was to do everything in 2D: First compute a perspective transformation (using OpenCV's warpPerspective()) from the scanned points to the internal rectangle's points und apply the inverse to the rectangle. This seemed to work but was too slow as it couldn't be rendered on the GPU.

The second approach was to do everything in 3D in order to use XNA's rendering features. First, I would display a plane, scan its corners with Kinect and map the received 3D-Points to the original plane. Theoretically, I could apply the inverse of the perspective transformation to the plane, as I did in the 2D-approach. However, since XNA works with a view and projection matrix, I can't just call a function such as warpPerspective() and get the desired result. I would need to compute the new parameters for the camera's view and projection matrix.

Question: Is it possible to compute these parameters and split them into two matrices (view and projection)? If not, is there another approach I could use?

sentences:
Partially colorizing a sprite in XNA I'm looking for a clean way of making sprites that look like the following glowing circle, except in any arbitrary colour.

Originally we thought we could start with a gray-scale version of the above image (shown below) and then use the tint parameter in spriteBatch.Draw to change the colour of the glow.

The problem is that because spriteBatch.Draw uses multiplicative blending to blend the tint and the colour the white parts don't stay white, they become the colour of the tint. The next image shows (approximately) what this looks like.

The other solution we thought of is to have two separate sprites, a white interior and a grayscale glow, and then we apply the tint to the glow and draw that on top of the white interior. This produces the desired effect (to a degree) but is annoying on our part since it requires is to double all the sprites we want to draw this way.

Is there any other cleaner solution that produces the desired effect for an arbitrary colour?

sentences:
How do components and systems relate to each other in an entity component system? I'm trying to learn and understand the ECS (Entity Component System) so that I can create a game using this design pattern but I've got a lot of things that I still don't understand.

Lets say I've got a PositionComponent and a MovementSystem or PhysicsSystem. The PhysicsSystem will heavily rely on the PositionComponent since in order to calculate, for example a rigid body motion, it needs the x and y positions (in a 2D game) wich is contained by the PositionComponent.

What is the relationship between Components and Systems? How does the    MovementSystem get the x and y values from the PositionComponent?

sentences:
Adding a delay into the middle of a function in Unity In the spot //wait 1.5 seconds what would I say to make it wait 1.5 seconds then complete the code after?
Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OnclickHeal : MonoBehaviour
{
    public PlayerHealth playerHealth;
    public PlayerMovement playerMovement;
    public Inventory Inventory;

    public Button healButton;

    void Start()
    {
        Button btn = healButton.GetComponent<Button>();
        btn.onClick.AddListener(TaskOnClick);
    }

    void TaskOnClick()
    {
        playerMovement.moveSpeed = 3;
        //wait 1.5 seconds
        playerMovement.moveSpeed = 4;
        playerHealth.currentHealth = 100;
    }
}

Also, the line public Button healButton; throws an error:

error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)

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:
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:
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:
What is the difference between Djikstra and flow fields? I understand flow field pathfinding (as illustrated in recent Gas Powered Games titles) consists of 1) computing a vector field covering the map for a given destination, 2) deriving unit directions from their position on that field, and 3) recomputing it at each frame to take dynamic obstacles into account.

I was wondering if the very same steps could be used, but by computing the vector field simply with Dijkstra. After all, if you apply Dijkstra in reverse (from the destination), and continue until you've covered the whole map, you end up with a vector field giving the best direction for each unit trying to get to that destination. If you recompute it each frame, don't you end up with the same behavior and efficiency as flow field, only without the math I don't understand?

sentences:
Recommended way to handle sprite assets for different screen densities (Android) I am currently working on a 2D game for Android. All of the images that I render were created as SVG's and then exported to PNG's which I have placed in my assets directory. These images are also all sprites that I render using a sprite batcher.

My question is around using different versions of the sprites for devices with different densities. I know that when developing a traditional android app you could place separate directories for separate density levels inside of res and then place the correctly sized versions of the images in question in these sub-directories of res.

What is a good approach when dealing with sprite images in the asset directory? Should I just have one copy of the sprites at a really high density / resolution that I use for everything and I just render them on a coordinate system that is independent of screen size or should I resize the image based on screen density before I process it to create all my texture regions? Or is there another solution entirely?

Currently I have one high resolution set of sprites that I use for everything, it just seems wasteful and inefficient for the lower density devices.

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:
How can I simulate a randomly-generated universe? Possible Duplicate:
  How to generate a universe?

Were would I start looking if I wanted to develop an engine to simulate space at random. Things like black holes, galaxies at distance and moving stars, asteroids and so on?

I would like to know if anyone has some good tips for this, or if there is some information online?

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:
Forward rendering and separation of shaders logic I'm currently playing with writing a rendering engine and implementing a forward rendering pipeline.

I have few doubts on how things should be implemented regarding the render passes as-well as the rendering of multiple lights.

So I'm wondering what is the better approach here:

Uber shader that is generated dynamically to adjust for the number of lights that currently affect the active scene.
This have the nice benefits of only one render pass for the lighting shader so much less binding occurs which is a plus.
have separate lighting shader for each type of light and have a render pass for each mesh with each type of light, combining in the end the result of (possibly 2 render target that we ping-pong between) with additive blending. This have the nice benefits of separation and more modular and maintainable shader code, but in the other hand the're more render passes and more binding going on and not to mention the ping-pong of additive blending between the render targets.
Other Ideas that I didn't heard/thought about and would love to hear

Ofcourse there's always room for optimization of both techniques such as ocllusion test, test which point/spot light affect which mesh (relevant to the second technique).

So I'm wondering what is the take on it of modern rendering/game engine and maybe I didn't list what their approach is and would love to hear about it.

Also if you side for one technique or another would like to have your thoughts on the pros and cons.

Thanks in advance!

sentences:
How can I achieve a pseudo-3D camera effect like this? I am trying to achieve a pseudo-3D camera effect similar to this:

I have gotten the following results using a 3D camera and billboards:

I am now running into the following problems:

In the first billboard example, the size discrepancy between when the sprites are at the "front" and "back" is too great. I need to have them be more similar to the above.
The bottom y-coordinate of the sprites never seem to change in my example, but they do (slightly) in the example that I want.
I need to be able to control how close to the right and left edge of the screen the sprites go to.

In the first billboard example I setup my camera like so:

// (float fovxDegrees, float aspect, float znear, float zfar)
this.simpleCamera.Perspective(75f, 1.5f, 0.01f, 400);

// (Vector3 eye, Vector3 target, Vector3 up)
this.simpleCamera.LookAt(new Vector3(0, 5f, 10f), Vector3.Zero, Vector3.Up);

My sprites are positioned at the following locations:

new Vector3(-4f, 1f, 0f);
new Vector3(-4f, 1f, 1f);

Full CSharp code: http://pastebin.com/9G0FDNLs

Billboard HLSL: http://pastebin.com/uB8e3gXU

If you want the grid: http://pastebin.com/R5UCBNWt

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:
Scene dark when perspective camera is far from scenery I can't find anything about this subject in the docs or forums to know if this is normal behavior: There seems to be a direct correlation between how close to the scenery my camera gets and how brightly lit the scene is. My camera is able to move up to 200 units from Vector3.zero. Here are two shots of the same piece of scenery - one close up, one far away:

The camera is set to perspective, using deferred rendering.

Things I've tried:

Turning off post processing
Using auto expose in post processing
Changing to orthographic (removes the issue, scene is uniformly bright at any distance)
Changing the FOV
Changing global lighting to use color rather than skybox
Putting some lights at altitude

This may be normal behavior & I just havent noticed before. Can anyone confirm? Is there some way to prevent this happening? I don't want to use an orthographic camera but I do want the scene to be evenly bright at any distance from the camera.

sentences:
detect collision between two circles and sliding them on each other I'm trying to detect collision between two circles like this:

var circle1 = {radius: 20, x: 5, y: 5}; //moving
var circle2 = {radius: 12, x: 10, y: 5}; //not moving

var dx = circle1.x - circle2.x;
var dy = circle1.y - circle2.y;
var distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected

}else{
    circle1.x += 1 * Math.cos(circle1.angle);
    circle1.y += 1 * Math.sin(circle1.angle);
}

Now when collision is detected I want to slide the circle1 from on the circle2 (circle1 is moving) like this:

--circle1---------------------------------circle2-------------------------

I could do this by updating the angle of circle1 and Moving it toward the new angle when collision is detected.

Now My question is that how can I detect whether to update/increase the angle or update/decrease the angle based on which part of circle2 circle1 is colliding with ??

I would appreciate any help

sentences:
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:
SFML function does all the job with setting up timestep? Usually i set up timestep something like this:

timestep=1.0f/60.0f;
if(time>=timestep)
{
update;
time-=timestep;
}

But SFML has the next function: window.setFramerateLimit(). Does it do the same thing i described above?

sentences: How do I make a launcher for multiple executables? I'm trying to make a launcher for a game I like that compiles the vanilla version and the mods into one launcher. I want to make it so I can choose between the versions, maybe with a rudimentary GUI. The original versions of the game are in Java, but I'm converting them to .EXE with Launch4j, and that's working fine.

sentences:
Geometry instancing in OpenGL ES 2.0 I am planning to do geometry instancing in OpenGL ES 2.0
Basically I plan to render the same geometry(a chair) maybe 1000 times in my scene.

What is the best way to do this in OpenGL ES 2.0?

I am considering passing model view mat4 as an attribute. Since attributes are per vertex data do I need to pass this same mat4, three times for each vertex of the same triangle(since modelview remains constant across vertices of the triangle).

That would amount to a lot of extra data sent to the GPU( 2 extra vertices*16 floats*(Number of triangles) amount of extra data).

Or should I be sending the mat4 only once per triangle?But how is that possible using attributes since attributes are defined as "per vertex" data?

What is the best and efficient way to do instancing in OpenGL ES 2.0?

sentences:
How to protect source code when game is developed in HTML5/Javascript Possible Duplicate:
  How do you prevent your JavaScript / HTML5 web game from being copied or altered?

If a game client is developed in Javascript, the source code can be found in browser. It's dangerous, because it's easy to hack the game, and patent can't be protected.

Are there any good ways to avoid this, e.g Javascript can be compiled to binary file then browser load and run the compiled javascript?

sentences: 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:
How to draw a string to the screen by fading in one letter at a time? I'm making a text adventure-style game with MonoGame. I have created a TextBox class which prints text onto the screen one letter at a time (like it's being typed). It does this by storing received text in a buffer string, and using Update() to periodically push letters into the output string, which is then drawn to the screen (I've written a function for wrapping, so I've had no problem there).

However, this method has some significant limitations - inability to change the font or colour of individual lines, for example - but there is something specific I am trying to achieve: I want each new letter to fade gradually onto the screen instead of just appearing instantly. So far, I've had no luck finding a way to do this.

At the moment, I've been attempting to remake the TextBox class to print each character with its own draw call, allowing me to change a letter's colour - and therefore alpha - individually. However, I've ran into a problem. I am using spriteFont.MeasureString() to allow me to draw the letters in the correct positions relative to each other, but it hasn't been giving me the values I need. Letters are drawn too close together, as it seems to be measuring the actual pixel width of the glyph, rather than the space they would take up if the string was printed all at once.

So, my question is: is there a way around this particular problem with MeasureString, or is there another solution entirely to make each letter fade in individually?

sentences:
Rotating a gameobject in the Inspector doesn't change direction When I add a Cube to a scene, the blue axis (=forward) of the cube points into a certain direction.

When I now change the Y rotation of the cube to 90 in the inspector, the blue arrow doesn't rotate.

I would have expected it to rotate with the rotation that I have defined for the cube.

What is happening here?

To explain more in detail why this is bothering / confusing me:

I want to rebuild the RE4 inventory (which is actual 3D). The items in this inventory can be moved within the "grid":

To do that I have created a suitcase and then I added a gun to it:

As one can see, I have assigned the facing direction properly: The blue axis (=forward) points into the direction of the gun.

Now I wanted to rotate the gun in such a way that it is shown like in the original RE4 inventory.

To do that, I apply a rotation of Y = -90.

The gun looks correctly now:

However, the blue axis now faces the wrong direction in my opinion. Why does it not rotate along with the rotation of the gameobject?

This really confuses me because now when I want to move the gun left or right, I have to change its X position value instead of changing the Z position value.

This just seems wrong to me.

Can somebody tell me what I'm missing here?

Thank you.

sentences:
c - Starting an user defined function after the current one ends The game I am creating displays a menu before starting, the user may select to start the game, or do some stuff. When the user selects an option, I need to call another function which actually does the selected option (start the game, configuration, etc...), the problem is that since I called that function from the menu function all the variables from the menu stay in memory. So I want to finish the menu function and remove all of its contents from memory and then start the function corresponding to the option selected, if the user goes back to the menu then load everything again and unload it when its finished. The problem is I there is no way (that I'm aware of) to tell the menu function which function to call after it finishes.

I though about starting the function corresponding to the option selected in another thread while the menu function finishes (what could possibly go wrong...) like this:

int menu()
{
    Load_menu_stuff_to_memory();

    int quit = 1;
    while(quit)
    {
        if(option_a_selected)
        {
            //the new function will be started in a new thread while the menu one finishes
            quit = 0;
            start_option_a_in_new_thread();
        }else if(option_b_selected)
        {
            //the new function will be started in a new thread while the menu one finishes
            quit = 0;
            start_option_b_in_new_thread();
        }
    }

    Deallocate_menu_stuff();
}

But I'm not sure if the new thread will end when the menu function does or be left like in the limbo or something.

Also I'm not sure if when the menu function ends the program will reach end of main (not to be confused with menu)

So: will my method work?

if not:

how can I call a random function but only after the caller function has finished?

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:
Change center point and size with the help of the Matrix in Unity Let us suppose I have an array of Vector3, it contains vertices.
Now I want to scale the vertices and/or change the center point of the texture (move texture relatively).

I have a Vector3 which is a new center point and I have a Vector3 which is vector for scaling along x, y and z.

How can I construct a needed matrix in Unity?

I am very new to all this, so, please, in case of any misunderstanding ask me about it.

Here is what I was able to find on my own. The problem with it, though, is that I can not infer what I need from it. I need a little bit more peculiar thing.

sentences:
scale rotating boundingbox I want to use basic rectangular collision detection.  I have a rotating sprite and a method that calculates the bounding box every time in the Update() method.  I simply check for intersection between all the lines of the box with all the lines of the other sprite's boxes.

Here is what I have for calculating the corners of the rotating bounding box:

double baseAngle = Math.Atan(this.Height / this.Width);
double len = Math.Sqrt(this.Height * this.Height / 4 + this.Width * this.Width / 4);

Vector2 tr = new Vector2(
  (float)(Math.Sin(baseAngle + this.Rotation) * len) + this.Position.X,
  (float)(Math.Cos(baseAngle + this.Rotation) * len) + this.Position.Y);
Vector2 tl = new Vector2(
  (float)(Math.Sin(Math.PI - baseAngle + this.Rotation) * len) + this.Position.X,
  (float)(Math.Cos(Math.PI - baseAngle + this.Rotation) * len) + this.Position.Y);
Vector2 bl = new Vector2(
  (float)(Math.Sin(Math.PI + baseAngle + this.Rotation) * len) + this.Position.X,
  (float)(Math.Cos(Math.PI + baseAngle + this.Rotation) * len) + this.Position.Y);
Vector2 br = new Vector2(
  (float)(Math.Sin(2 * Math.PI - baseAngle + this.Rotation) * len) + this.Position.X,
  (float)(Math.Cos(2 * Math.PI - baseAngle + this.Rotation) * len) + this.Position.Y);`

My box is square shaped, and my texture of that rotating sprite is Rectangular.  How can I scale the bounding box so it will be closer to the texture's size?

sentences:
Enemy sprite moving to a specific way depending on how it spawns So I have a code where the sprite spawn outside the window and I want it to move on a specific straight line depending on where it spawn say if the sprite spawn at the top it goes at the bottom and vise versa if the sprite then spawn to the left it will go right and vise versa.
Game1.cs code:

 public class Game1 : Game
 {
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Player player;
    List<Enemy> enemies = new List<Enemy>();

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

    protected override void Initialize()
    {

        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        //player
        Texture2D playertexture = Content.Load<Texture2D>("Player");
        player = new Player(new Vector2(350, 175), playertexture);

        //enemy
        Texture2D enemytexture = Content.Load<Texture2D>("Enemy");
        Random random = new Random();
        var width = GraphicsDevice.Viewport.Width;
        var height = GraphicsDevice.Viewport.Height;

        for (int i = 0; i < 20; i++)
        {

            enemies.Add(new Enemy(new Vector2(random.Next(width, width + 100), random.Next(0, height)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0 - 100, 0), random.Next(0, height)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0, width), random.Next(-100, 0)), enemytexture));
            enemies.Add(new Enemy(new Vector2(random.Next(0, width), random.Next(height, height + 100)), enemytexture));
        }

    }

    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();
        foreach (Enemy enemy in enemies)
        {
            enemy.Update(gameTime);
        }
        player.Update(gameTime);

        base.Update(gameTime);
    }

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

        spriteBatch.Begin();
        foreach (Enemy enemy in enemies)
        {
            enemy.Draw(spriteBatch);
        }
        player.Draw(spriteBatch);

        spriteBatch.End();

        base.Draw(gameTime);
    }
}

Enemy.cs

class Enemy
{
    Texture2D enemytexture;
    Vector2 enemyposition;

    public Enemy(Vector2 enemyposition, Texture2D enemytexture)
    {
        this.enemyposition = enemyposition;
        this.enemytexture = enemytexture;

    }

    public void Update(GameTime gametime)
    {
        enemyposition.X++;
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(enemytexture, enemyposition, Color.White);
    }
}

I wonder if I can do this in a way?

enemies.Add(new Enemy(new Vector2(random.Next(width, width + 100), random.Next(0, height)), enemytexture, enemyposition.X++));

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:
Augmented reality on Mobile platform - iOS Is there a way that we can control the iOS device camera to an extent what colors it sees, what shapes it sees ? etc

I'm speaking about the ability to read information before the image is captured.

Consider my question as: Possibility of making an augmented reality game on iOS phones.

I dont find relevant help for my query in internet/iOS developer site. Hence posting here.

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:
Implementing a "tech tree" Writing for android, but this is an abstract question for any OO language.  Is there a "best-practice" for implementing a TechTree?

Here is an example:

    Vegetation  ->v     Strawberries        ->      BioDome
    Livestock   ->      Biomass

In this example, both Vegetation and Livestock are required for Biomass, but only Vegetation is required for Strawberries.

I have brainstormed a handful of implementations, but I'm not very confident with any of them.  I will probably be loading the techs from XML, if that matters.

Is there a "best-practice"for implementing tech trees?

sentences:
MissingComponentException: There is no 'TextMesh' attached to the "Can" game object, but a script is trying to access it When I run my program I keep getting: MissingComponentException: There is no 'TextMesh' attached to the "Can" game object, but a script is trying to access it.Even though I have attached it as you can see:

In the script I am trying to edit the text of the Text Mesh like this¨:

private int count;
public TextMesh countText;

// Use this for initialization
void Start () {

    count = 0;
    counterText = gameObject.GetComponent<TextMesh>();
    counterText.text = "Count: " + count.ToString();

}

What I want is to count the cans that have been shot, so what I do next is:

  void OnCollisionEnter(Collider other)
{
    if (other.gameObject.CompareTag("Can"))
    {
        other.gameObject.SetActive(false);
        count = count + 1;
        counterText.text = "Count: " + count.ToString();
    }
}

sentences:
Does `yield return false;` have special meaning in Unity3d C# scripts? In Unity, we have some special things for coroutines that are additional to normal C#.

for example, we can use

yield return WaitForSeconds(5.f);

to have a coroutine wait 5 seconds before continuing.

What do yield return false; and yield return true; do?

sentences:
2D Enemy AI reacting to sound I'm currently working on a 2D top-down survival game and I'm trying to figure out a good method for enemies to detect player sounds. For instance - if the player fires his gun it should play a sound (already implemented) and then enemies near the player should 'hear' the sound and react to it.

The obvious solution is to simply check a radius around the sound origin for enemies and flag them as having heard the sound. The issue here is that I have many buildings and walls and other objects that would normally interfere with sound. If I simply do a radius check then enemies will hear the player through walls and bulkheads.

The next obvious solution is to use raycasting. I cast a ray to every enemy within a radius of the origin of the sound and if the ray hasn't hit anything then the enemy can hear the sound. This method works, but I'm looking for something more natural.

What I'm hoping for is a method of having sound rays penetrate walls and lose intensity depending on the object. I'm using Farseer Physics and am currently working towards this implementation but there's one catch that I haven't figured out. If an enemy is around a corner then the ray will pass through the wall and lower intensity even though the enemy SHOULD be able to hear the sound loud and clear. I know this has to do with sounds bouncing off of other walls and echoing but I have no idea how to implement that without raycasting like crazy.

My question then becomes: Does anyone have a semi-realistic method of producing a sound in a 2D world, and having enemies react to it through, and around walls?

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:
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:
How to randomly spawn a Rect on x position (android studio)? I want to draw a rect with a 50x50 size, however I want it to appear randomly on the x position. Where should i set the x position?

This is how i set my rectangle.

rectangle.set(50, 50, 100, 100);

I've done several changes on this setting the but I can't figure it out.

sentences:
Unused constant buffers in shaders If you define a constant buffer in a shader, for example

cbuffer test : register(c2)
{
    float4x4 data;
}

But never actually use the data in the shader, does that incur any runtime cost at all?
It's convenient for me to do this but not at the cost of slowing runtime performance at all. When I time it I don't see any difference...

sentences:
Trying to find a function to calculate attribute changes in a game I'm coding a game where after every year depending on results the attributes of characters change. The game is a movie business simulator and here is a example of the ugly code I have in place now:

        if (movie.Reviews.Avg > 8.5f)
        {
            movie.Producer.Reputation += 6f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 7.5f)
        {
            movie.Producer.Reputation += 5f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 6.5f)
        {
            movie.Producer.Reputation += 4f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 5)
        {
            movie.Producer.Reputation += 1f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 4.5)
        {
            return;
        }
        else if (movie.Reviews.Avg > 4)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 6f;
            return;
        }
        else if (movie.Reviews.Avg > 3)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 5f;
            return;
        }
        else if (movie.Reviews.Avg > 2)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 4f;
            return;
        }
        else
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 3f;
            return;
        }

Few problems I have with this code:
1. Reputations balloon. Good AI producers make good choices so their movies get good reviews and their reputation goes even higher.
2. Because reputations keep growing the absolute changes in attributes get smaller and moving up in ranks gets way too slow and hard.

What I am looking from the function:
1. Range is 0-10.
2. At the top of the range growth is slow even with great reviews, but if your movie gets bad reviews the decline is sharp. And the opposite for the bottom of the range.

sentences:
D3DXVec3Project returns odd values I would have thought that if the object is on-screen that this function should return screen coordinates. When used in conjunction with the directX draw text function, it works fine. Textual overlays track the 3D objects perfectly, however consider the following code:

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);//for thought bubble

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / SCREEN_WIDTH) * 2.0f - 1.0f,
    (0.0f / SCREEN_HEIGHT) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / SCREEN_WIDTH) * 2.0f - 1.0f,
    (xyCoords.y / SCREEN_HEIGHT) * 2.0f - 1.0f);

lineRenderer.Draw2DLine(origin, headPos, D3DXCOLOR(1, 0, 0, 1), D3DXCOLOR(1, 1, 0, 1));

origin has a value of -1, -1 which is fine (texture coords for the screen go from -1 to 1 in each axis) but headPos has the value of -1.#IND000 in both the x and y. I think this may be because D3DXVec3Project is returning MASSIVE numbers, although I could be wrong.

Who knows what's going on under the hood of DrawText_A in the following code, but it clearly compensates for whatevers not working with the above code.

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);

    rct.left   = xyCoords.x;
    rct.right  = xyCoords.x;
    rct.top    = xyCoords.y;
    rct.bottom = xyCoords.y;

    m_font->DrawTextA(NULL, stateStream.str().c_str(), -1, &rct, DT_LEFT|DT_NOCLIP ,   D3DXCOLOR(1,0,0,1));

This all works perfectly. Where am I going wrong with the first bit of code?

EDIT - the code below gives me the following values (also listed below)

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / 1280.0f) * 2.0f - 1.0f,
    (0.0f / 720.0f) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / 1280.0f) * 2.0f - 1.0f,
    (xyCoords.y / 720.0f) * 2.0f - 1.0f);

for origin I get (-1, 1.2) and for headPos I get (0, 1.401e-043#DEN). FYI HeadPosition() will return a vector3 that has a 0 z component and x and y values from about 2 to roughly 33.

Now how on earth can me with a calculator be better than the computer? what am I missing?

0.0f / 720.0f) * 2.0f - 1.0f should clearly = -1, not 1.2! what is going on?

0 / anything = 0, 0 * 2 = 0, 0 - 1 = -1!!!

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:
How can I ensure free graphics are suitable for use in a game? We want to program a small minigame where we need a lot of icons for all kind of things (like in "Alchemy"). We looked through some free vector graphics pages, like http://www.freepik.com/, but they all state some vague instructions where and where-not to use the images.

For example this site writes

For both personal and commercial projects and to modify it.

but on the other hand:

Include FreePik Contents in an online or offline database or file.

Which sounds contradictionary, you need to store it in a file to modify it.

How can we get sure, that images that we use from such sites are really free to use on attribution and we don't get any problems later?

How should the licences look like, so we can be sure to get no problems later,if we use free icons from there?

sentences:
2D Platformer: add ability to jump on top of other character I want to add ability to jump onto a head of other character/player, but still be able to go through them horizontally.
There is one useful tutorial about one-way platforms, but that approach doesn't allow player to go through a platform from a side.

I tried to add sensor to foot and head of characters and enable contact in  preSolve method, but it doesn't look to work very well (sometimes bodies are thrown out from each other with additional impulse).

Do you have any ideas? Also it would be nice to not change sources of box2d as it was done in tutorial as I'm using it from LibGDX.

sentences:
How to make a game people can mod? In C++, how can one make it's game load content developped by other people?

For instance in Java you can look for jar files and load specific class from it.

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:
How many rendering passes is "normal"? I've been implementing John Chapman's method for SSAO (an excellent tutorial by the way), and I've completed it all minus the final part: blurring it. I believe this is what the entire process should be like:

First pass: render normals and depth to textures. (plus diffuse/specular albedo and such)
Second pass: render scene without ambient occlusion to texture, render ambient occlusion to another texture.
Third pass: blur the AO texture, multiply with scene texture for end result.

Then, if I wanted to implement bloom and depth of field, would I need yet another pass (or two)? Do modern games really go through a ton of rendering passes to add effects, or is there something obvious I'm missing? Some way to drop the number of passes needed?

sentences:
Moving texture OpenGL ES 2.0 I am trying to implement a sprite of 8 columns and 8 rows in OpenGL ES 2.0
I made appear the first imagen but I cant figure out how to translate the Texture matrix in OpenGL ES 2.0 , the equivalent of the code in OpenGL 1.0 that I am looking is

        gl.glMatrixMode(GL10.GL_TEXTURE);
        gl.glLoadIdentity();
        gl.glPushMatrix();
        gl.glTranslatef(0.0f, 0.2f, 0f);
        gl.glPopMatrix();

This are the matrix that I am using atm

/**
 * Store the model matrix. This matrix is used to move models from object space (where each model can be thought
 * of being located at the center of the universe) to world space.
 */
private float[] mModelMatrix = new float[16];

/**
 * Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space;
 * it positions things relative to our eye.
 */
private float[] mViewMatrix = new float[16];

/** Store the projection matrix. This is used to project the scene onto a 2D viewport. */
private float[] mProjectionMatrix = new float[16];

/** Allocate storage for the final combined matrix. This will be passed into the shader program. */
private float[] mMVPMatrix = new float[16];

/**
 * Stores a copy of the model matrix specifically for the light position.
 */
private float[] mLightModelMatrix = new float[16];

sentences:
Alternatives to multiple sprite batches for achieving 2D particle system depth In my 2D XNA game, I render all my sprites with a single sprite batch using SpriteSortMode.BackToFront and BlendState.AlphaBlend.

I'm adding a particle system based on the App Hub particles sample. Since this uses
SpriteSortMode.Deferred and BlendState.Additive, I will need to have two SpriteBatch.Begin / SpriteBatch.End pairs: one for 'regular' sprites, and one for particles.

In my top-down shooter, If I want to have explosions appear under planes, but above the ground, then I believe I will have to have three Begin/End pairs, first to draw everything under the explosions, then to draw the explosions, then to draw everything above the explosions. If I want to have particle effects at multiple different depths, then I'm going to need even more Begin/Endpairs.

This is all easy to code, but I'm wondering if there is an alternative way to handle this?

sentences:
Limit rotation to certain angles for transform.rotate I'm working on a small project to learn Blender and Unity, and one issue I recently came across is that while I can have the turret of my tank rotate on the z-axis based on mouse movements, I can't for the life of me figure out how to lock it to certain angles.

My current approach was to use Mathf.Clamp to limit the range of values that I could pass to the rotate function, but that doesn't seem to have done anything at all, even though when outputting the value Clamp produces, I can tell it doesn't go over my specification.

The code I have:

enum RotationAxes {MouseX, MouseY, MouseXandY};
var axes : RotationAxes;
private var MouseX = RotationAxes.MouseX;
var sensitivityX : float = 15F;
var minimumZ : float= -35;
var maximumZ : float = 35;
function Update ()
{

    if (axes == MouseX)
    {
        //yRotation += Input.GetAxis("Mouse X");
        //transform.eulerAngles = Vector3(0, 0, yRotation);
        transform.Rotate(0, 0, Mathf.Clamp (Input.GetAxis("Mouse X")*sensitivityX, -30, 30));

    }

}

function Start ()
{

}

sentences:
ways to make a physics engine Hey so i've been looking into real time physics engines, which led me to the crazyLaggoa multiphysics engine by thiaga costa, and brought up the question of:

What are some possible ways, ideas that have or have not already been done to make a real time physics engine? How about non-real time?

I know the Lagoa engine uses meshes and a crapload of particles... and then there's the rigid body way of going about things.....
Also i'm only at 2d level in creating games right now so any 2d physics ideas would be great too!

sentences:
How to change a Maya scene file's selected viewport renderer from the file itself (text edit)? So I have been running Viewport 2.0 in my 2012 version of Maya for a couple weeks with no problem. Day before yesterday it started crashing on load with a random MSVC dll pointer error. It's common, but a work around doesn't exist. Anyone know how to modify my .ma scene file contents so that none of my viewports are running Viewport 2.0?

I can import my stuff to another scene, but it's not fun.

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:
Lowering Unity launcher graphic quality settings reduces mouse x turn speed, does quality affect time? Lowering Unity App quality settings reduces mouse x turn speed, how to fix this?

I am not sure why this happens my only thought was time.timedelta is affected by the graphics quality setting in unity launcher.

when rotating a cube with input mouse x, the cube rotates at normal speed on high quality graphic settings, but lowering the graphic settings it begins to slow down.
Inevitably at lowest it barely rotates.

using UnityEngine;

public class This : MonoBehaviour
{
    private float mouseTurn;
    private float turnSpeed = 64f;

    void Update()
    {
        mouseTurn = Input.GetAxis("Mouse X");
        transform.Rotate(0, mouseTurn * turnSpeed * Time.deltaTime, 0);
    }
}

sentences: Do retail games use "inversion of control" and "dependency injection"? Many of the more diligent software developers I know are moving to inversion of control and dependency injection to handle references to objects. Coming from a Flash games perspective I don't know all the ins and outs of AAA studios, so: are these used in the retail game world?

sentences:
Is there a name for turn based combat that uses a speed attribute like ATBs but doesn't involve waiting? I've seen this in a number of games now - for me, I think the first (and one of the better examples) was Blue Dragon - where characters take turns in an order determined by their speed attribute such that a fast character will not only go first, but also take turns more often than a slow character.  This is much like an ATB (Active Time battle) (with Wait=true) BUT the turns still take place immediately after one another (as opposed to each character having a time-bar that runs down in real time).  And in the example of Blue Dragon, a number of tokens appear in a queue to indicate probable turn order (this would fluctuate if a character used a quicker or slower than normal action).

Is there a name for this turn-based-with-time-simulation-combat in games?

Edit: The closest I've come to a satisfactory term for this is a Combatant Cooldown System (https://tvtropes.org/pmwiki/pmwiki.php/Main/CombatantCooldownSystem) with a Visual Initiative Queue (https://tvtropes.org/pmwiki/pmwiki.php/Main/VisualInitiativeQueue)  I like these but both came from TV Tropes and don't appear to be (commonly) in use elsewhere...

sentences:
Networking/Packet Design When using a Client-Server model, it's necessary for those two parts to communicate data back and forth. There is one specific area that I've been thinking about and unsure about. That being putting certain information in a main update packet, that is sent every n milliseconds, or send it once when it happens. An example would be a turn-based strategy game. When one player's turn ends, and the next player's turn starts, you could send one packet to notify the clients of the change, or every n milliseconds, tell the client whose turn it is and it can determine when it changes. These are the pros I see to these approaches:

Inside Update Packet:

Harder to become desynced if packets are lost, whereas if sent as an
individual packet and the client fails to receive it, could create
big desync issues.

Individual Packet:

Sends less data between the server and client since it only sends it
once, instead of every n milliseconds.

I'm fairly new to game design, so I'm not sure if there is a general consensus about the proper way to do this. There may also be another solution that I haven't thought of. Any input would be great.

sentences:
Set Sampler states: Linear, Bilinear, Trilinear Filtering/Interpolation How do you set each of these sampler states in the hlsl

Linear filtering
Bilinear filtering
Trilinear filtering

sentences:
Optimizing data structure for my text adventure? In my text adventure I'm making, I store the story data in a hashtable (I'm using unity's javascript/unity script since I'm more comfortable with the syntax than C#).

The problem is, the way I structure the hashtable means that it gets incredibly bloated very quickly (I've used the same structure in all of my text adventures across multiple languages. It quickly grows to nearly 1k lines long) which makes it hard to edit in the future (especially if I need to go back to edit certain parts later on)

Here's the hashtable as it's currently structured:

public static var story = {
    "0":
    {
        "text":"",
        "choices":
        {
            "response1":
            {
                "text":"",
                "nextPart":"1"
            },
            "response2":
            {
                "text":"",
                "nextPart":"2"
            },
            "response3":
            {
                "text":"",
                "nextPart":"3"
            }

       }
    },
    "1":
    {
        "text":"",
        "lastPart":"0"
    },
    "2":
    {
        "text":"",
        "lastPart":"0"
    }
};

If anyone could help me optimize the structure of the hashtable that'll make it so it's more easier for me to edit it in the future, that would be great

Quick information for parts that may not be self-explanatory:

"lastPart" indicates to the hashtable parser that the player has died
and the number refers to the part where they chose the
response/choice.
"nextPart" refers to the part of the story the response leads to.

sentences:
FPS using mouse to move rather than keys Hi I am developing a First person game but would like to use the mouse to move on a click to move as opposed to the keys. I also need to disable Y movement and restrict the x movement to 180. What ever values I enter into the input manager, it seems to be ignoring them as I still have both x and y when I run the game.

I dabbled with the standard unity FPS but is seems very jagged on movement and from what I can see being a new user, their doesn't seem to be a way to restrict y movement. Can someone help with this or suggest a good tutorial on this type of movement. Thanks

sentences:
how to add different class items to the same list C# XNA I am trying to make a modular ship system, where parts can be added or removed to the ship entity.

I am using a class I made called ModuleManager and it has a list of ShipModules. this works fine for very basic block building ships, but I want to add a ThrusterModule that has thrust capabilities, and possible a GunMountModule for obvious reasons.

the problem is that I cannot do this.

List<ShipModules> modules = new List<ShipModules>();
ThrusterModule engine = new ThrusterModule();
modules.Add(engine);

I know that I cannot do this because they are different types.

Question: How can I add all these modules to the module manager? because I don't want to have to deal with having several different type modules that need several different variables to hold them

I have an idea of what to do, but I want to know if it would be the best route, I have heard of Class Composition. would that be beneficial for what I have explained? thanks.

sentences:
How to export slick2d game into a jar with the res and native folder I am a beginner in Slick2D.

I use jarspliceJarSplice to output Slick2D game.

But, but it is export all thingexports everything into one jar.

I want to export one jar with the res andand native folder ....

Soso I can easily modify the game resources in the design process.

Thanks for any help.

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:
Rendering multiple objects in OpenGL I am using advanced OpenDL methods (VBO, VBA, ...) to render over screen. Currently I abstracted vbo, vba, index buffer, texture, and shader to a class called 'Object2D'.

I tried to render two objects on screen. I saw that when the same shader is applied to both objects it works fine; but if the two objects are rendered with two different shader script, only the one rendered last is visible to screen.

Here is Object2D::render():

void Render()
{
    if(check_status())
    {
        sh.bind(); //shader
        vb.Bind(); //vertex buffer
        ib.Bind(); //index buffer
        tex.bind(); //texture buffer
        glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,NULL);
    }
    else{}
    //sh.unbind();
}

And here is the drawing function (assume the two 2D objects are obj and box):

void display()
{
    glClear(GL_COLOR_BUFFER_BIT); //refresh/..
    box.sh.setUniformMat4x4("m_projection",GL_FALSE,1,&m_PROJ[0][0]);
    box.Render();
    obj.sh.setUniformMat4x4("projection_matrix",GL_FALSE,1,&m_PROJ[0][0]);
    obj.sh.setUniformMat4x4("view_matrix",GL_FALSE,1,&view_transform[0][0]);
    obj.Render();
    glFlush();
}

And this is the shader binded to box:

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
uniform mat4 m_projection;
void main(void)
{
    gl_Position=m_projection*positions;
}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;

void main(void)
{
    color=vec4(1.0,0.4,0.3,1.0);
}

and this shader is binded to obj:

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
layout(location=0) in vec2 texture_coodrinate;
out vec4 p;
out vec2 TexCoord;
uniform mat4 projection_matrix;
uniform mat4 view_matrix;

void main(void)
{
    gl_Position=projection_matrix*view_matrix*positions; //modelvi
    p=projection_matrix*view_matrix*positions;;
    TexCoord=texture_coodrinate;
}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;
in vec4 p;
in vec2 TexCoord;
uniform vec4 U_color;
uniform sampler2D tex_;

void main(void)
{
    ;
    U_color;
    color=texture(tex_,TexCoord);
}

My problems are:

Two of the objects aren't being rendered if until and unless both the shaders are same
Unbinding the shader result in no rendering?

sentences:
How big my sprites should be in Unity? I'm making a 2D retro-style pixel game and I'd like to know how big my sprites should be.
I'm not talking about the size of my image files (which I decided to use a 32x32-based artstyle), but the actual size of them once they are in Unity.
Should I keep a 1:1 scale and import all of my usually 32x32 sprites into Unity? Is there a special scale up or down process I need to do before or after import them?
I'm saying this because when I'm working with HUD elements, they are drastically really big compared to my tiny sprites, so I'm worried if this could affect implementing something like RigidBody or collisions,  and I should indeed scale up my sprites, or if this is normal and I'm being paranoic.
I'll append an image showing my concern.
BTW, the game looks so far as I wanted to, and it's working well, but right now it's more like a proto, so I'd like to resolve this doubt before continuing. Also, I test this usually in a 1920x1080 resolution, so maybe that's why the HUD looks so big.
Thanks!

sentences:
Help with understanding "transform.root.GetComponent" in Unity I'm reading through a tutorial for making an RTS in Unity, and in certain scripts it wants you to make a Player field and then OnStart(){ transform.root.GetComponent}. I am not quite getting what that does or what purpose it serves.

Player.cs is added as a component to the game object "Player". Player.cs is the following:

public class Player : MonoBehaviour {

public string username { get; set; }
public bool human { get; set; }
}

Then on another script which is also attached to the Player (gameobject) as a component:

protected Player player;

protected void Start ()
{
    player = transform.root.GetComponent<Player>();
}

This is instructed: http://stormtek.geek.nz/rts_tutorial/part2.php right under "Camera Input". There is a description there, but I am confused by it since it does not allow you to actually interact with the game object Player, but the instance of the Player script.

I'm sorry if this was poorly worded, I can't think of a better way to ask this question. I am completely confused as to why it asks you to do this and what it actually does. I'm also very confused about how to reference instances of a class that are attached to a game object, and if the snippet in question assists with that (I can remove the snippet and things seem to work fine).

Edit: I have looked at the unity documentation on game objects, transform, root, getcomponents and other related methods.

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:
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 avoid instantiating multiple instances of a RigidBody? I could use a little help.

I've a state machine for an NPC that does a melee attack. The problem I'm running into is that the current code instantiates multiple instances when I only need one per cycle.

I could use some ideas.

This is the chunk of code I'm working with:

public void ChaseToAttack()
{
    _navMeshAgent.speed = 3.5f;//slow down the navAgent

    float playerDistance = Vector3.Distance(chaseTarget.position, transform.position);
    //stop navMeshAgent to begin attack sequence
    if (playerDistance <= stopAtDistance)
    {
        /// ensure enemy is always looking at player
        enemyToTarget = ((chaseTarget.position + offset) - eyes.transform.position);
        if(Physics.Raycast(eyes.position, enemyToTarget, out _hit, sightRange) && _hit.collider.CompareTag("Player"))
        {
            _navMeshAgent.Stop();
            currentState = _attackState;
            //StartCoroutine(FistTimer());
            PunchCycle();
        }
        /// ensure the enemy isn't hitting air & will always look for the player
        else
        {
            transform.Rotate(chaseTarget.position, searchTurnSpeed * Time.deltaTime, 0);
        }
        /// end look & atttack player block
    }
}

void PunchCycle()
{
    StartCoroutine(AttackCycle());
}

void PunchClone()
{
    clone = Instantiate(pfbPunch, transform.position, transform.rotation) as Rigidbody;
    clone.transform.Translate(0,1f,0);
    clone.velocity = transform.TransformDirection(0.0f,0.0f,0.125f * punchDistance);
}

IEnumerator AttackCycle()
{
    //move animation here
    AnimPunch();
    PunchClone();
    yield return new WaitForSeconds(4f);//fistTimer
    BeAlert();

}

Thanks in advance...

EDIT:

Changed the code so it would only instantiate once- but now, it will only instantiate only once even though it's still in the attack sequence.

    public void ChaseToAttack()
{
    _navMeshAgent.speed = 3.5f;//slow down the navAgent

    float playerDistance = Vector3.Distance(chaseTarget.position, transform.position);
    //stop navMeshAgent to begin attack sequence
    if (playerDistance <= stopAtDistance)
    {
        /// ensure enemy is always looking at player
        enemyToTarget = ((chaseTarget.position + offset) - eyes.transform.position);
        if(Physics.Raycast(eyes.position, enemyToTarget, out _hit, sightRange) && _hit.collider.CompareTag("Player"))
        {
            _navMeshAgent.Stop();
            currentState = _attackState;
            StartCoroutine(AttackCycle());
        }
        /// ensure the enemy isn't hitting air & will always look for the player
        else
        {
            transform.Rotate(chaseTarget.position, searchTurnSpeed * Time.deltaTime, 0);
        }
        /// end look & atttack player block
    }
}
void PunchClone()
{
    if(!didClone)
    {
        clone = Instantiate(pfbPunch, transform.position, transform.rotation) as Rigidbody;
        clone.transform.Translate(0,1f,0);
        clone.velocity = transform.TransformDirection(0.0f,0.0f,0.125f * punchDistance);
    }
    didClone = true;
}
IEnumerator AttackCycle()
{
    //move animation here
    AnimPunch();
    yield return new WaitForSeconds(0.75f);//fistTimer
    PunchClone();
}

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:
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:
Detect if mouse do multiple circle rotation around a XY point would anyone know a method or algorithm (js) to calculate and detect if a mouse is moving by a circle around a target?
Example if a rotate mouse *4 time around a specific XY point, i would like to re-center my camera (in my context i need algoritme for a camera engine)

I search i little bit on the web, but no found good formula to perform this.

Maybe a will need a special api ?

thank.

sentences:
How to create opacity mask from colored bitmap? For the image (bitmap) below,

if I do:

Create a spite with the image in unreal engine.

Create a opacity mask on the spite.

Use this image, choose a specific color, such as blue, make its corresponding region the only opacity region on the mask.

My question is about the implementation of part 2 and part 3 in Unreal engine, they are quite confusing.

If anyone know how to implement it in unity, it would also be helpful.

Thanks a lot.

sentences:
Efficient existing rating system for multiplayer? I would like to add a rating for online version of a board game. In this game there are many game rooms each normally having 3-4 people.

So I expect that player's rating adjustments (RA) should depends on

Rating of opponents in the game room
Number of players in game room and final place of a player
Person gets rating increase if he plays more games and more frequently
If a person leaves a game room (disconnect) before the game ends he should get punished with a high rating decrease

I have found two related questions in here

Developing an ELO like point system for a multiplayer gaming site

Simplest most effective way to rank and measure player skill in a multi-player environment?

Please, let me know what would be the most appropriate existing rating model to refer.

sentences:
Animation is too fast I have an animation of a bullet but it seems to be going much faster than i was expecting.

I currently set it to 0.5 pixels per second yet it seems to be moving way over hundreads of pixels per second.

Not quite sure where my logic is going wrong:

This is inside my gameLoop which im using to calculate it:

var deltaTime = (new Date().getTime() - started) / 1000; // divide to get seconds
var position = deltaTime * bulletVelocity; //bulletVelocity is 0.5

var vectorX = destinationX - startX;
var vectorY = destinationY - startY;
var distance = Math.sqrt(vectorX * vectorX + vectorY * vectorY);

var x = startX + (vectorX * position);
var y = startY + (vectorY * position);

if (x < destinationX && y < destinationY) {
    ctx2.drawImage(pulse, x, y); //draw the sprite on canvas
}

Have i got my logic wrong here i cannot work out why its moving so fast.

sentences:
Projected Light Cookie Has Its Texture Edges Instead of Spotlight Circular Edges The projected light of Unity Spotlight on a flat surface is almost a circle:

But when I add this light cookie:

It renders the following projection:

I expect the projected image takes the spotlight's edges.

Unity version: 2017.4.11f1

light source settings:

Light cookie settings:

Please note that I've already added black padding to the light cookie.

sentences:
create a simple tilemap programatically i am working on a tile roguelike
i got some of the basics working using this tutorial
http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d

but i want to be able to create a map programatically instead of using the tiled editor

just add a NSArray of sprites/tiles to my CCLayer derived class or something, or should i make use of the CCTMXTiledMap class?

can anyone gimme some hints about how to do this? or know of a tutorial or sample code somewhere?

thanks a lot

sentences:
Linking nodes algoritm for Visual Design I'm developing an editor for my game, and now it's time to make a visual scripting system to let designer modify behaviours.

This video shows what i have done and the problem

to resolve the link between nodes I'm using an A* path finding,
when a path is set, I add a penalization bonus to each cell of the path, to avoid using the same cells for other path.

I would like that the lines do not intersect unnecesarily.

is there any algoritm or idea that allows me to do this better?

sentences: Merging InputProcessor and GestureDetector I'm planning to make a simple soccerball app. When I attempt to drag the ball, I use the touchDragged() from InputProcessor to move the ball left or right. Next, while holding before releasing, I use the fling() from the GestureDetector to set the power. However, when I'm trying to set the input processor of both the implementing InputProcessor and the GestureDetector, it didn't work.  Moreover, whenever the last time you set the input processor and that would be either the two of them. Why?

sentences:
Creating/Displaying Image at Specific Size in Unity with C# I'm trying to draw an image background for Dialogue in a RPG I'm working on and having issues with preventing the image from taking up the whole screen.  The goal is to create an object (if it needs to be created), and otherwise show it, via code.

At the moment, it draws the image successfully, but it takes up the full screen every time.

Here's the code:

        GameObject canvasObject = GameObject.Find(DialogueObject);  //DialogueObject is a const string ID

        if (canvasObject == null)
        {
            canvasObject = new GameObject()
            {
                name = DialogueObject
            };

            var canvas = canvasObject.AddComponent<Canvas>();
            var background = canvas.gameObject.AddComponent<Image>();

            canvas.renderMode = RenderMode.ScreenSpaceOverlay;

            canvas.transform.parent = canvasObject.transform;
            background.transform.parent = canvas.transform;

            background.rectTransform.anchorMin = new Vector2(0f, 0f);
            background.rectTransform.anchorMax = new Vector2(1f, .5f);

            if (background.sprite == null)
            {
                background.type = Image.Type.Sliced;
                background.fillCenter = true;
                background.sprite = Resources.Load<Sprite>(DialogueBackgroundResource); //DialogueBackgroundResource is a const string
                background.color = new Color(1, 1, 1, 0.5f);
                background.rectTransform.sizeDelta = new Vector2(40, 40);
            }
        }

        canvasObject.gameObject.SetActive(true);

The above is literally all of my code.  I've tried setting the sizeDelta, per a number of queries on the web, and even though it changes, the image is always full screen.  Is there something else I am missing?  My understanding is that the anchors are telling it to basically only take up the spot in the bottom half of the screen.

Any help is appreciated!

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:
Moving models with a matrix Currently I have a playerWorld matrix which holds the position of my player, just a simple sphere. When I press a key to move the model, it does some crazy thing and flies off the screen really fast, and not even in the direction I want it to go.

    if (kbs.IsKeyDown(Keys.W))
        {
            playerWorld += Matrix.CreateTranslation(playerWorld.Forward * elapsed);
        }

Why is this happening? elapsed  is a float variable:

    float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

Here is the draw code, maybe it's being drawn wrong?

    public void Render(ThirdPersonCam cam)
    {
        foreach (ModelMesh mesh in playerModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.View = cam.view;
                effect.Projection = cam.proj;
                effect.World = playerTransforms[mesh.ParentBone.Index] * playerWorld;
            }
            mesh.Draw();
        }
    }

sentences:
Apk file installes two instances of a Unity game I created an apk in Unity (4.6) and when I install that apk on the device it creates 2 instances of the game (2 icons are visible in the screen). Both icons start the same game, and when I uninstall the game it removes both icons.

In previous builds this didn't happen, so I'm assuming that the changes I made to the Android Manifest have something to do with it. I included the Game Analytics SDK and it caused some problems when I tried to build the game for Android (with the message that the incompatible manifests can't be merged). So I commented out the part of the manifest that was causing the problem and now I have the problem with multiple instances of the game. I did some research and found that this happens when there are multiple activities in the manifest that are marked as LAUNCHER - this is not the case in my app, only one activity has that property. Also, as far as I can see, there is only one AndroidManifest.xml file in the Unity project (only one appears when I type it in the search).

This is the part of the manifest that I needed to change:

 <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<!--<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
  <meta-data android:name="android.app.lib_name" android:value="unity" />
  <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>-->

If the commented out part is included, Unity throws the "incompatible manifest merge" error in the building process:

Error: [Temp\StagingArea\AndroidManifest-main.xml:4, [MyGame]Temp\StagingArea\android-libraries\unityads\AndroidManifest.xml:19] Trying to merge incompatible /manifest/application/activity[@name=com.unity3d.player.UnityPlayerNativeActivity] element:

UnityEditor.HostView:OnGUI()

Did anyone have any similar problems and how did you fix it?

Thanks

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:
What projection is this? Could someone tell me what this projection is called?

It's as if you are looking at an object from directly above it and then smear it up and left equally. Only the one dimension seems to be true scale while the other two are skewed.

I'm not finding many games that uses this style, but some of the Ultima Series seemed to or at least something similar:

sentences:
Multiplayer turn based Android/iOS We're developing a mobile endless runner game, on Unity3d where you can challenge your Facebook friends. The only interaction between the players is the challenge - one player challenges the other, then each player plays when he wants, and after both players finish (when their character dies), their scores are compared to determine the winner.
What system would you recommend that would allow us to implement this functionality, considering scalability, cost and ease of use?
Thanks in advance!

sentences:
Changing animator via scriping I am using the following code, my intention is whenever the 2 objects meet the animator boolean changes and when leave change back to its original setting. But it doesnt seem to work.

  public GameObject ThePlayer;
public float TargetDistance;
public float EnemyHealth;
public float AllowedRange = 10;
public GameObject TheEnemy;
public float EnemySpeed;
public Animator animator;
public int AttackTrigger;
public RaycastHit Shot;
public static bool hasAttacked = false;
private bool gapTest = true;

void Start()
{

    animator = GetComponent<Animator>();
    hasAttacked = false;
}

void OnCollisionEnter(Collision col)
{

    if (col.gameObject.name == "FPSController")
    {
        Debug.Log("hit");
        animator.SetBool("Moving", false);
        animator.SetBool("Attack1Trigger", true);
        hasAttacked = true;
    }

}

void OnTriggerExit(Collider col)
{
    if (col.gameObject.name == "FPSController")
    {
        Debug.Log("left");
        animator.SetBool("Moving", true);
        animator.SetBool("Attack1Trigger", false);
        hasAttacked = true;
    }
}

Any tips on why this does not work?

This is hitting the debug.log in the console, but it is not hitting the animator changes or the boolean change

sentences:
How to correctly draw a line in Unity I'm working on a game which requires me to draw a few lines from a single point that is more formally said

Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates named as xi,yi. Given the LineRenderer capabilities inside Unity3D I was unable to draw more than one line from a particular point with it since it renders only polylines.

I'm currently using the Debug.DrawLine() method which successfully renders the line. I have tried using GL.Begin() as it is shown in the Unity example but I cannot see my lines being drawn.

My question is : are there any other methods for doing this? If not, can you tell me how can I show the line that is being drawn with Debug.DrawLine() inside play mode? I've saw that I could use Gizmos.DrawLine() but I didn't quite understand it's usage.

sentences:
Why is the character not walking right when creating new animator controller for the character? I created a new controller called it SoldierController and dragged it to the character Controller under Animator component in the Inspector.

Also unchecked Apply Root Motion

Then attached a new script to the third person character called the script Soldier.

Then I set the Animator controller and I added two new States to it:
Walk and Idle. HumanoidIdle and HumanoidWalk.

Then I did that the default start state will be Idle. Set StateMachine Default State.

Then I did a Transition from Walk to Idle. This way when I press on "W" it starts walking a bit. Then it keep moving the character but without the walking animation.

If I delete this transition and make transition from the Idle to Walk then when I press on "W" it will walk but then if I leave "W" key it's idling.

Then after 2-3 seconds the character will walk on place I mean it will animate walking without moving and I'm not pressing anything it's starting automatic when idling.

The character had another animator controller but I created a new one and using only the new one.

The script:

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

public class Soldier : MonoBehaviour
{
    private bool _isWalking = false;
    private Animator anim;

    // Use this for initialization
    void Start ()
    {
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update ()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;

        transform.Rotate(0, x, 0);

        if (Input.GetKey("w"))
        {
            if (!_isWalking)
            {
                _isWalking = true;
                anim.Play("Walk");
            }
            var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;
            transform.Translate(0, 0, z); // Only move when "w" is pressed.
        }
        else
        {
            if (_isWalking)
            {
                anim.Play("Idle");
            }
            _isWalking = false;
        }
    }
}

sentences:
Alert Dialog Box font color in AndEngine I am developing an app using AndEngine and I am using my own custom theme to use white background theme. My styles.xml file looks like this:

<resources>

<color name="white_opaque">#FFFFFF</color>
<color name="pitch_black">#000000</color>

<style name="AppTheme" parent="android:Theme.Light">
  <item name="android:background">@color/white_opaque</item>
  <item name="android:windowBackground">@color/white_opaque</item>
  <item name="android:colorBackground">@color/white_opaque</item>

</style>
</resources>

Everything is working fine except in the dialog box the font color is white and it looks like this:

How can I change the font color to black for the text?

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:
Smooth circular collisions with edges/collision boxes [C# + XNA] So, me and a friend are working on our top-down perspective 2D game, and have come to work on perfecting our collisions. In its current state our player sprite is colliding with walls, but is experiencing a "sticking" to the collided surface. This is mainly because our collisions only consist of "if colliding on X axsis, stop X movement":

if (boxR.Intersects(playerCircle)) {
    if (playerCircle.center.X <= boxR.X + boxR.Width || playerCircle.center.X >= boxR.X)
        stopX = true;
    if (playerCircle.center.Y <= boxR.Y + boxR.Height || playerCircle.center.Y >= boxR.Y)
        stopY = true;
}

What we are intending is smoothed collisions, so that if we hold down the S key (for down), and the player's collision circle hits the corner of a collision rectangle, then the sprite's brute force of moving down pushes itself to the side to continue without further collision. Example below; the solid line is the input vector, while the dotted line is the adjusted vector because of the collisions with the corner.

Is there a seemingly simple adjustment to be made? Or will we need to incorporate some sort of physics library to get around this? If so, then what would you suggest?

sentences:
Geometry shader worldviewprojection I'm writing a simple geometry shader to create 3D "primitives" in place of a single point. I am performing all of the world-view-projection conversions within the geometry shader after creating the triangle strips to form the 3D primitive. Unfortunately, it seems to be creating the triangles in projection space, and giving me incorrect results. The following pictures demonstrate this problem. Any advice on how to work around this problem?

As can be seen here, the second top face seems to be rendered as if it was pulled off the top and splayed out.

Here is the geometry shader I am using, and a set of coordinates I use to generate these faces

static float3 cube_coords[8] =
{

float3(1, -1, 1),
float3(-1, -1, 1),
float3(1, 1, 1),
float3(-1, 1, 1),

float3(1, 1, 1),
float3(-1, 1, 1),
float3(1, 1, -1),
float3(-1, 1, -1),

};

[maxvertexcount(8)]
void GSMain(point GSInput input[1], inout TriangleStream< GSOutput > output)
{
GSOutput p;

for(unsigned int j = 0; j < 2; j++)
{
    for(unsigned int i = 0; i < 4; i++)
    {
        p.Pos = input[0].Pos;
        p.Pos += float4(cube_coords[i + (4*j)],1.0);
        p.Pos = mul(p.Pos, worldViewProjection);
        p.Color = input[0].Color;
        p.Light = input[0].Light;
        p.Norm = normals[j];
        output.Append(p);
    }
    output.RestartStrip();
}
}

sentences:
How do I reverse the playback of an animation (instead of restarting it)? I have created a sprite sheet of which consists of six frames of a character whose legs move each frame. Now I have written code so that the animation is running successfully from frame one to frame six, however I am trying to reverse this so then instead of looping back to frame one after the last frame, the animation moves backwards from frame six to frame one and then repeats in a continuous loop.

I handle the animation currently like this:

void SpriteGame::Update(int tickTotal, int tickDelta)
{
    if ( tickTotal >= this->playerLastFrameChange + 4)
    {
        //Four ticks have elapsed since the last frame change
        this->playerFrame = this->playerFrame + 1;
        this->playerLastFrameChange = tickTotal;  //We've just changed the frame

        if (this->playerFrame >= this->playerSheetLength)
        {
            this->playerFrame = playerLastFrameChange + 4;
        }

        //Frame has changed so change the source rectangle
        this->playerSourceRect->left = this->playerFrame * 64;
        this->playerSourceRect->top = 0;
        this->playerSourceRect->right = (this->playerFrame + 1) * 64;
        this->playerSourceRect->bottom = 64;
    }
}

How can I accomplish this using Direct3D 11?

sentences:
How to make an oscillation move on opengl qt I'm trying to make a character make an oscillation move. That is, the character will start by rotating to a certain angle, say 60 degrees, and then slowly come back to an upright position then rotate to the opposite direction for an angle less than 60, say 55, and do it all again until the rotation angle reaches zero and the character stops. Currently I'm trying to achieve this by declaring global variables and checking them with if blocks and changing their value by 1 degrees in those blocks so that each time the timer calls paintgl it decreases the angle by 1 degree and draws the object thus making it look like it's slowly rotating. I'm having trouble with stopping the character. This is the part of my code that handles it;

glRotatef(j,0,1,0);
glRotatef(k,0,1,0);

if(flag)
{
j = j + 2;
 if (j == 0)
 {
   k = 60;
   flag = !flag;

}
}

if(!flag)
{

k = k - 2;
if(k == 0)
{
    j = -60;
    flag = !flag;
}
}

gluCylinder(player, 1,1,8,100,100);
Here the cylinder is my character and the if blocks are increasing/decreasing the global variables j and k. j is initialized to -60 and k is initialized to 60.

what i want to do is to make the character lean to the ground for an angle by the click of a mouse and when the mouse is released, the character will slowly go upright and lean on to the other direction, then slowly go upright again and lean on to the first direction and so on.

How can I make this thing work and how can I stop it. Thanks in advance.

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 patterns and how to use them? (Othello/Chess...) I'm currently trying to make a Othello-playing program. My biggest concern at the moment is the evaluation function of game positions. Currently my evaluation function is quite primitive...move counting, looking for corner plays etc.

I tried to implement the evaluation functions of IAGO(1981) and BILL(1986).

I tried to read a bunch of papers, Michael Buro's stuff especially, but I failed horribly. It seems as I miss some fundamental knowledge. I neither get to understand how patterns work nor how to create them.

As far as I understand they are used to rate constellations of rows, columns, edges, 3x3 corners etc.

I'd highly appreciate if someone could provide me the following information:

What data structure has a pattern?
Given a certain game position how would I make use of this pattern to evaluate the situation?

I think if I get answers to those questions, I'll probably be able to understand the following aswell, but I'll mention them anyway.

How are patterns created? I saw that an approach is to assign static values to different squares of the game board, dependant of their current properties(color, stability). But then there is some iterative algorithm called.
So are patterns created on the fly e.g. while searching a tree? Or computed before and used like a mask?

I hope this question isn't too broad, but I got the impression that creation and use of patterns is some obvious common knowledge, that everyone does almost the same way, like use of alphabeta.

sentences:
NPC Dialogue directing the player I recently gave a build of my game to some people and asked for any thoughts.  One of the ones I keep getting is, 'I didn't know where to go first, but I guessed.'

The problem is, I'm still getting this after having revised NPC text to be clearer and more helpful to the player. The build in question is here, if you're curious to see what exactly I'm up to.

How can I make sure my NPC dialog is effective at guiding players to the next objective?

sentences:
Unity OnCollision2D not working I'm new to Unity and C# (though I'm experienced in python) and I am trying to make a pong clone, I've spent ages googling and trying to fix this issue but for some reason my OnCollisionEnter2D won't work

My paddle hit method:

public void PaddleHit(Collision2D col)
{

    float y = WhereBallHitPaddle(transform.position,
        col.transform.position,
        col.collider.bounds.size.y);

    Vector2 dir = new Vector2();

    //determing direction to left or right depending on the paddle

    if (col.gameObject.name == "Player1")
    {
        dir = new Vector2(1, y).normalized;
    }
    if (col.gameObject.name == "Player2")
    {
        dir = new Vector2(-1, y).normalized;
    }

    rb.velocity = dir * speed;

    //play ball paddle collision sound
    SoundManager.Instance.PlayOneShot
        (SoundManager.Instance.ballpaddle);

}

When I run the game the ball moves, then when it comes into contact with a paddle it just stops moving, and if it comes into contact with a wall it bounces off, but at no point does it trigger the OnCollisionEnter2D. (I think my codes indents aren't showing properly here but it is all indented correctly, there are no compile errors or anything).

sentences:
Controlling noise density I'm trying to fake terrain blending by using an opacity mask on my road mesh to reveal the grass underneath. I'm currently multiplying some Perlin noise by a Rectangle node displaying my texture at 80% width which is giving me the following:

Obviously this doesn't look great for reasons that should be apparent. The blotches are unnaturally spaced and they abruptly end with a sharp line at the end of the texture. What I would like to do is generate noise that looks more along the lines of this:

Is there a way to apply some sort of gradient to my noise to achieve this? I know I can just use the texture itself but I would like to be able to adjust properties like the extent of the noise during runtime.

sentences:
Slick2D: Changing an Image's colour to Color.white I am working on a game where we would like the enemies to flash white when hit by a bullet. Ideally, we would like to use the same mechanism to render an Image in any colour. Our Images are all png files with transparent backgrounds and these transparent areas must exist in the coloured version of the Image.

Testing shows that Image.draw(x, y, filter) does not change the appearance of the image when given Color.white

Testing has also shown that Graphics.drawImage(Image, x, y, color) has no affect when color is set to Color.white

Is there a way to change an Image to white using existing Slick2D functionality? Failing that, is there an easy way to use LWJGL to perform the colouring that can be easily incorporated into a Slick2D project?

NB Answers that allow an Image to be rendered in an arbitrary colour will be preferred over answers that are specific to Color.white

sentences: Is there a design flaw when an entity's state doesn't fully utilize enter(), execute() and exit()? I'm following Mat Buckland's Programming Game AI by Example, and I find that I don't always have use for enter(), execute() and exit() on an entity's state. For example, in an RPG, a weapon may have an equipped state, and I may use enter() and exit() for that state to add or subtract to a player's ability modifier, but there isn't really a need for execute(). Is this a design flaw in my engine, or a shortcoming of this approach?

sentences:
How to manipulate 2d image as different objects Hello Im very new to this so I don't even know what this process is called exactly.
Im posting image of flappy bird here in which it consist all the objects day, night, birds, font etc Here :

So how to use them in 2D game? this is just example i have used. How to manipulate different objects at different coordinates ? Thanks.

sentences:
Reasons to not use Root Motion Engine: Unity

3D tool: Blender

Since the start of my game dev endeavour, I can't seem to decide on the type of animation system I want to use.

Can someone please give me reasons why you would NOT use root motion and maybe a real world example, because currently I see no reason to not use root motion.
I understand the loss of control when using root motion, but from my understanding, the amount of control is "enough".

Treadmill motion(stationary animations) seems like it wont look good enough because you have to perfectly match your move speed to animations. I just need either a resource or proper answer on the specifics about why you would use one over the other or a blend(treadmill for walking, root for jumping etc).

Appreciate any help provided.

sentences:
How to use Cocos2dJS to connect to a Socket.IO server? How can I connect to a nodejs socket.io server from a cocos2djs game? I've google all the way to no avail. I tried this but it does not work:

socket = io.connect('http://192.168.254.102:7714');
if ( socket === undefined ) {
    cc.log("Could not connect to socket.io");
} else {
    socket.on('connect', function() {
        socket.emit('join', {username: 'Android Application'})
    });
}

I read in the docs that there's a module called SocketIO for doing that, but there's not enough info on how to use it. Thanks in advance.

sentences:
Tetris - Rotations using Linear Algebra (Rotation Matrices) I'm making Tetris in Java and am at the point of rotations... Originally I was hardcoding each rotation:

if (direction.equals("right")) {
            if (shape.equals("Bar")) {
                if (rotationsCounter == 0) {
                    currXs[0] += 1;
                    currYs[0] += -1;

                    currXs[1] += 0;
                    currYs[1] += 0;

                    currXs[2] += -1;
                    currYs[2] += 1;

                    currXs[3] += -2;
                    currYs[3] += 2;

                    rightRotate1 = new int[] {currXs[0], currYs[0], currXs[1], currYs[1], currXs[2], currYs[2], currXs[3], currYs[3]};
                }
                if (rotationsCounter == 1) {
                     etc...

Then, I have this to set the correct coordinates based on what the rotated counter is

   if (direction == "right") {
            if (shape == "Bar") {
                if (rotationsCounter == 0) {
                    pieceRotations = rightRotate1;
                }
                if (rotationsCounter == 1) {
                    pieceRotations = rightRotate2;
                }
                if (rotationsCounter == 2) {
                    pieceRotations = rightRotate3;
                }
                if (rotationsCounter == 3) {
                    pieceRotations = rightRotate0;
                }
            }
        }
        if (direction == "left") {
            if (shape == "Bar") {
                if (rotationsCounter == 0) {
                    pieceRotations = leftRotate3;
                }
                if (rotationsCounter == 3) {
                    pieceRotations = leftRotate2;
                }
                if (rotationsCounter == 2) {
                    pieceRotations = leftRotate1;
                }
                if (rotationsCounter == 1) {
                    pieceRotations = leftRotate0;
                }
            }
        }
        return pieceRotations;

But found that was a very tedious way to go...

People suggested I use rotation matrices in Linear Algebra.

So I tried rotating 1 coordinate in a Tetris piece just to see if I was doing it correctly... the point (1, 1) seems to rotate just fine...

So then I thought that the way to rotate the whole block was to get all the coordinates of each tile in a Piece (4 tiles, 16 coordinates), and rotate each one... but I was wrong.

So my questions is...

In the first picture, I choose (1, 1) as my rotation axis... How do I move the rest of the coordinates in relation to that point?

Thanks!

sentences:
How do I combine multiple squares into one Tetris block? I am learning Phaser by making a simple game—Tetris. I'm having difficulties:

Can I use simple rectangles as tetrominoes or they should be sprites? I don't know how make the figure's block from simple rectangles and apply physics to it.
How I can join 4 separate squares into one tetromino?

sentences:
Using an unregistered company name If I want to release an App with a Company Name do I have to have that registered before I can use it?

I have checked and the name is not taken, so is it fine to just use a made up company name?

As a side note, I have made this game just as a hobby project, not looking to make any money from it.

sentences:
Unity virtual joystick - jarring movement I'm creating an infinite flyer game in which you control the plane using a mobile joystick. There are two controls one to rotate the plane and the other to move the plane. While rotating the plane there is a lot of jarring if I use Time.deltatime. There is no jarring when I don't use Time.deltatime. This is the line of code that use Time.deltatime - transform.rotation = _initialRotation * Quaternion.Euler(_pitchTime.deltaTime,-_yawTime.deltaTime, 0).
Here is the code in the Move script:
public class Move : MonoBehaviour
{
public Joystick joystick;
public Joystick joystick1;
float rotateVertical;
float rotateHorizontal;

public float sensitivity;
Quaternion _initialRotation;
float _pitch, _yaw;

float moveHorizontal;
float moveVertical;

void Start()
{
    _initialRotation = transform.rotation;
}
void Update()
{
    _pitch = _pitch + joystick.Vertical * sensitivity;
    _yaw = _yaw - joystick.Horizontal * sensitivity;

    transform.rotation = _initialRotation * Quaternion.Euler(_pitch*Time.deltaTime,-_yaw*Time.deltaTime, 0) ;

    transform.Translate(moveHorizontal * Time.deltaTime, moveVertical * Time.deltaTime, 0);
 }
}

There is also a camerafollow script attached.
[SerializeField] Transform target;
public Vector3 defaultDist = new Vector3(0f, 0, 7.5f);
[SerializeField] float distDamp = .1f;
public Vector3 velocity = Vector3.one;

Transform myT;

void Awake()
{
    myT = transform;
}

void LateUpdate()
{
    SmoothFollow();
}

void SmoothFollow()
{
    Vector3 toPos = target.position + (target.rotation * defaultDist);
    Vector3 curPos = Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp);
    myT.position = curPos ;
    myT.LookAt(target, target.up);
}

sentences: What are some free online game design courses? I have an MComp in Computer Science. I would like to specialize in game programming. What online free video game design courses are there? I as thinking something similar to coursera.org

sentences:
Parallax background in with depth in Phaser 3 I'm working on a 2D space shooter type of game in typescript using Phaser 3 and am trying to get a parallax background with different depths going. But I'm having trouble getting the math right.

You can see my work in progress here: https://www.youtube.com/watch?v=Pea9yVbTD64

As stated in the video everything works if the players x and y are positive, but breaks when they are negative, and I can't figure out what I am doing wrong. Any help would be greatly appreciated. Or perhaps there is a better way to accomplish this?

What I'm doing is randomly generating out a bunch of the Sprites, storing them in an Array, and then updating their position with this code.

_Nebulas: is an Array<NebulaParticle>.
p.distance: is a number between 1 and 5 to signify how far away the sprite is and is used to make them move slower when they are
furher away.
_Width and _Height are both arbitrary numbers to signify how big the area is that the parallax should cover, in the video they are
both set to 80.
OriginalOffsetX/Y is the original random position the Sprite was given.

(this line is here because the below code formatting wont work otherwise.)

public update(delta: number, playerx: number, playery: number) {
    console.log(playerx + ", " + playery );
    for (let i = 0; i < this._Nebulas.length; i++) {
        let p = this._Nebulas[i];
        p._Sprite.x = (playerx + (this._Width / 2)) - (((playerx / p.distance) + p.OriginalOffsetX) % this._Width);
        p._Sprite.y = (playery + (this._Width / 2)) - (((playery / p.distance) + p.OriginalOffsetY) % this._Height);
    }
}

class NebulaParticle {
    public _Sprite: Phaser.GameObjects.Sprite;
    public OriginalOffsetX: number;
    public OriginalOffsetY: number;
    public distance: number;
}

sentences:
Can I output a text file on build with build details in it? We have an issue with organizing our builds. They get copied around and moved so much that it's hard to keep track of what is the newest.

I would like to output a simple text file to the build root (same level as exe) that contains info like the build date and time, platform, etc.

Is this possible from within Unity?  Right now we have no automated build process (CI/CD).

edit: I found onPreprocessBuild() but unfortunately one of our main projects still uses Unity 5.3.6f1, so this will not work. Is there an alternative?

sentences:
How to design a leaderboard where lower is better? In a classic high score leaderboard, the player with the highest score is leading, followed by people with slightly lower scores. In short, higher is better.

But in a game I am working on, the player has to reach the objective by completing various puzzles. The fewer puzzles he needs to solve before reaching his objective, the better. This is somewhat similar to fewest moves possible.

So basically, the leaderboard would be reversed, the player with the lowest score puzzles needed would lead the board, followed by players who needed slightly more puzzles to reach the goal.

How would I design/build the leaderboard so players understand the principle of lower is better?

Edit: One more important detail: The leaderboard will not be global, but local for one user, so he can track his own progress/improvement. So the design should be clear even if there are no entries yet.

sentences:
What technologies are used to develop games for tablets and iPhones? What technologies are used to develop games for tablets and iPhones?
Would Flash be commonly used?
Is HTML5 capable of animation and interactivity, or would a game file simply be placed within HTML5 code?
Is Flash and HTML5, and then wrapping the game for different phone/tablet operating systems a common combination?

sentences:
sprite animation individual framerate When animating sprites I am taking the delta difference between frames and locking the rendering frame rate of the sprite animation to the delta time.

float delay = 1000.0f / FPS;
float now = SDL_GetTicks();
if(now - sprite->last_update > delay) {
    render sprite frame
}

This is causing flickering because the background is being drawn faster than the sprite. (my guess) If I draw as fast as the frame rate the flickering goes away. If I slow down the background rendering then the background flickers. By slow down I mean set the FPS to 30.  I want to be able to slow down the animation for a single sprite.
 I need a better way to lock the frame rate for individual sprites.  I can slow the entire frame rate down by delaying in the game loop but I want to be able to slow down a single sprite.  Is this possible?

sentences:
Unreal: Y-Axis boundary on a Camera Bounding Box I was wondering if I could get some help with modifying a Blueprint I'm currently using for a project in Unreal Engine.

I am currently attempting to make a side-scrolling platformer game and I'm using a camera bounding box Blueprint to restrict where the camera can move when tracking the player's movement, based on the following series of tutorials on YouTube by JvtheWanderer: How to make a Metroidvania/ 2D Camera Blueprint System on #UE.

The camera bounding box works as intended, in that it prevents the camera from moving beyond the limitations of the camera box placed within the scene, but I want to go even further than that and establish a limitation within the camera bounding box that not only limits the camera's movement but also prevents the player from moving on the Y-axis beyond the box's boundaries.

Pretty much every platformer from Super Mario to Sonic the Hedgehog to Castlevania, have such boundary limitations, usually at the very start of the level and also frequently at the end.  The limitation on the Y-axis boundary is also frequently used to lock the player into a particular area for forced enemy encounters, mini-boss fights as well as proper boss battles, a limitation that lasts until the player has vanquished the threat.

I wish to implement similar boundaries on the camera bounding boxes within my project to restrict where the player can go without having to place walls everywhere to keep the player from wandering beyond the level's limits.  Using walls to restrict the player's movement is fine for indoor areas, but it ends up looking distractedly out of place in outdoor areas if used in excess.

I've included screenshots below of the Construction Script & Event Graph from the SideScrollerCamera Blueprint I'm using. I would also include the Viewport and the Level Blueprint as well, except that the time being, I am unable post more than two links.

Construction Script:

Event Script:

Any help with this matter would be greatly appreciated.

sentences:
How do I run functional tests against my Unity3D game? Context

I am continuing some legacy code for a game in Unity3d, and I want to write some functional tests meant for regression, to ensure I don't break things when implementing new things or when refactoring.

I already know there is the 'Unit Test Tools' suite for Unity3d available as an asset. I have used it as a unit-test suite, so I test my models (classes).

Example of what kind of test I am thinking about

For "functional test" I mean things like this:

Run the program
When in the menu scene, assert there is a button that says "start"
Click it
Then assert a new scene is loaded
Assert pixel XXX is red
Click in coordinate XXX
Assert now that the pixel changed to green
etc.

Questions

Q1: How do I write and run functional tests for my game? Is this also typically done in the UnityTestTools (UTT)?

Q2: If UTT is more for Unit-Testing, then is there a separate suite for functional testing? Which one?

Notes:

I'm targetting Android, and running Unity5.3.1f1

sentences:
Displaying a Scratch Project (.SB2) file within a Delphi EXE FIle I would like to Display a Scratch Project (.SB2) file within my Delphi EXE file. I would like to know if it is possible to display and build the Scratch Project into your Delphi Project.

I wish to make a small game in Scratch and then use the game within my Delphi Application without the need of the Scratch 2 IDE. Perhaps a 3rd party delphi tool or component or something that can help me achieve this would also be very nice. So basically I want to host the Scratch game within my Delphi app.

Is this possible? How can this be done? (I am using Delphi 10.3.2 Rio and Scratch 2 Offline Editor)

sentences:
Immovable object impact physics I am trying to do some physics calculations from scratch, and as a result am creating a small bouncing ball example. However, I have some issues getting correct results from my impact physics when the ball bounces on the floor. I have attempted to follow the simple guide on Gamasutra (as referenced by my lecturer) that does impact physics between two balls. This is elastic collisions meaning the energy should be preserved (the ball should keep bouncing). I can cheat but I do want the proper physics calculations of the impact working as I need to use this for more complicated things later.

My current problem is that the ball bounces to a much higher position than it's starting point. I.e the ball starts at a specific position, with a velocity of 0,0,0 and is being effected by gravity. When it hits the floor however, the velocity calculated is much too high, so it bounces much higher (out of the screen) than the point at where it was dropped. It should, I believe, bounce back to the starting position. Here's a small gif showing what's happening.

Here's my current code. Could anyone point me in the right direction? Thanks!

// create sphere radius 3, color red
my_sphere = new Sphere(3, Vector(0.0,0.0,1.0) );
// set position
my_sphere->setDisplacement( Vector(0,50,0) );
// add gravity acceleration
my_sphere->addAcc( Vector(0.0, -9.82, 0.0) );

Physics foce calculation

// changes the objects velocity and position according to acceleration and time
void PhysicsObject::forceStep(float dt) {

    this->vel = this->vel + this->acc*dt;

    Vector s = this->vel*dt  + ( this->acc * (1/2.0f)  * pow(dt,2) );
    this->displacement = this->displacement + s;
}

Impact physics:

if ( my_sphere->floor_collision() ) {
        // floor properties
        Vector floor_vel = Vector(1,1,1);
        Vector floor_pos = Vector(0,0,0);
        // the floor is immovable e.g. mass=infinite
        float floor_mass = std::numeric_limits<float>::max();
        // Ball properties
        Vector ball_vel = my_sphere->getVel();
        Vector ball_pos = my_sphere->getDisplacement();
        float ball_mass = 1;
        Vector n = ball_pos - floor_pos;
        n = n.normalize();

        float a1 = ball_vel.dotProduct(n);
        float a2 = floor_vel.dotProduct(n);

        float optimizedP = (2.0 * (a1 - a2)) / (ball_mass + floor_mass);

        Vector new_ball_vel = v1-n*optimizedP * floor_mass;

        my_sphere->setVel( new_ball_vel );
}

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:
Character Animation Architecture Can anyone explain the general architecture typically used for 3D character animation?

Are movements like walking and falling scripted against the skelton, and simply executed on input?  If so, is the scripting typically actual script or hard code?

What are common pitfalls or flaws in character animation engines?

sentences:
How to generate random points on the surface of a quadrilateral Alright, I'm sure there has to be a simple way to do this but it eludes me at the moment.

I want to be able to generate random points on the surface of a quadrilateral in 3D space. (Defined simply as four points) What is the best way to go about doing this?

If the quad is a rectangle, this is trivial to do with random interpolation between points. However, this won't work for me since my quads aren't guaranteed to have rectangular properties.

sentences:
Applying texture to a 3D object I am trying to draw a 3D cube on the screen, using MonoGame.  The cube was created in Blender and exported as an fbx file.  The following is what the cube looks like in VS when opened in the editor:

And this is what it looks like when displayed on screen:

From the research that I've done so far, I believe that I need to apply a texture.  I couldn't see any way to do this in Blender, or in the Content Pipeline Tool, and so I tried the following when drawing the effect:

effect.Texture = _texture;
effect.TextureEnabled = true;

When I run this, I get a runtime error:

  An error occurred while preparing to draw. This is probably because
  the current vertex declaration does not include all the elements
  required by the current vertex shader. The current vertex declaration
  includes these elements: SV_Position0, NORMAL0, COLOR0.

Clearly I'm missing a key part of this puzzle; please can somebody point me in the right direction.

sentences: Use Ashley with Scene2d in libGDX? I want to use Ashley but I also want to use actions and listeners with Scene2d. I read that it is not a good idea, but why? Ican create a system with stage.act(); and stage.draw(); in the update method or is it a bad idea? Thanks.

sentences:
How do i get the drawing to loop automatically with out need for user input scrolling? #include <iostream>
#include <time.h>
#include <iomanip>
#include <SDL.h>
#include <stdlib.h>
#include <string.h>
#include "screen.h"
#include "Stars.h"
#include "Allstars.h"

int main(int argc, char* argv[]) {

    //seeding random number generator

    srand(time(NULL));

    //------------------------------------------------------------------------------
    /***CREATING SDL WINDOW***/
    /***CREATING RENDERER & TEXTURE***/
    /***CREATING A BUFFER***/

    Screen screen1;
    screen1.init();

    //-----------------------------------------------------------------------------
    /***GAME LOOP***/

    /*UPDATING buffer with texture information*/

    Allstars allstars1;

    while (true) {
        int num=0;
        screen1.screenClear();
        allstars1.updateStarPosition();

        // Allstars class to retrieve  m_pstars from the Allstars class into the main function.

        const Stars * const pStars = allstars1.getStars();

        for (int i = 0; i < allstars1.NSTARS; i++) {
            Stars star = pStars[i];

            // here is where i tried to loop each star back to the bottom of the screen  when they reached the top of the screen.

            if(num>3 && star.m_y_star<-0.97 && star.m_y_star>-1){

                    star.m_y_star=0.99;
                    star.m_x_star= star.m_x_star;

                }

//each star is given a random location by giving co-ordinates: m_x_star & m_y_star a random value using a function in Stars.h
// You can't get negative co-ordinates on the screen so we map from [-1,1] to [0 to SCREEN_WIDTH and 0 to SCREEN_HEIGHT]

            int x = (star.m_x_star + 1) * ((Screen::SCREEN_WIDTH) / 2);
            int y = (star.m_y_star + 1) * ((Screen::SCREEN_HEIGHT) / 2);
            screen1.setPixel(x, y, 128, 0, 255);
        }

        /*UPDATED USED TO UPDATE TEXTURE and RENDERER and PRESENT DRAWING ON SCREEN*/
        screen1.update();

        /* Check for messages and events
         */

        //Quitting SDL through clicking 'x' button event
        if (screen1.processEvents() == false) {
            break;

        }
        num++;
    }
    //-----------------------------------------------------------------------------
    /***FREEING MEMORY & QUITTING SDL***/
    screen1.close();
    return 0;
}
//------------------------------END OF MAIN----------------------------------------

I tried to get use a for loop to change the vertical position of the star once it draws close to the top of the window but that doesn't seem to influence the program. Stars (purple dots) seem to drift off the screen and don't appear from the bottom of the screen again. No errors occur and i have incorporated checks to prevent the stars being plotted off of the screen. Can someone help me make these purple dots loop infinitely without the need for scrolling.

sentences:
Does Big O really matter? In academia worst case Big O is taught over everything else.  Compared to space complexity, normal case analysis, simplicity over complexity, etc.

In particular to game programming and industry, what really matters most and why?

References would be very helpful.

sentences:
Algorithm for finding edge vertex points on a tilemap I have a 2d tilemap array contains 1 or 0. 0 corresponds empty tile, 1 corresponds solid tile. If tile is 1 I draw a texture.
I have to find edge vertices and coordinates that 1's grouped.
I couldn't find a way to implement this algorithm. Is there a algorithm or approach I could use?
Red dots are the vertices I want their coordinates.

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: Automated LAN Matchmaking I'm looking to build an automated LAN matchmaking system for games and wondering if/how it would differ from the online applications (like FaceIt, ESEA) that serve a similar function. Ideally, a user would first select the game they wanted to play (PUBG, LoL, etc) then be paired up with others on the LAN who are playing the same game. Is that possible?

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:
Trying to get events to work for drag and drop So I’m playing around with drag and drop with Nifty and I have the drag working. I don’t have a drop set up yet as I’m just trying to get the dragging working at the moment.

For the purposes of my game the default drag and drop behavior of moving the draggable to another spot wont work. I’m working on a tower defense kind of game and when the player goes to drag a turret from the inventory into the game, I still need a copy of it to stay in the starting point. So I am trying to use the DraggableDragStartedEvent to determine when the drag starts and make a copy of the dropable to place in the UI so the player can still add more of that turret if they want to. Or is there another way of changing the default behavior so when the player drags they see the item under the mouse/finger but still leaves a copy at the starting point so it can be repeated from the same location?

Here is what I have and it doesn’t seem to be working:

The Nifty book for 1.3.2 (I just now realize JME uses 1.4.2 so this may no longer work and the docs on the github are not as in depth as this book) says to add a methid to your screen controller with the annotation @NiftyEventSubscriber(id=“elementId”) and it must have a String for the first parameter to pass in the id and the second must have an event of the type you want to listen to and its just supposed to work. But its not. I see “bind” in the log and I see “start screen” in the log but when I drag the draggable nothing gets logged. The dragging is working so I know it should be calling this event.

controller(new ScreenController() {
    @Override
    public void bind(Nifty nifty, Screen screen) {
        System.out.println("bind");
    }

    @Override
    public void onStartScreen() {
        System.out.println("start screen");
    }

    @Override
    public void onEndScreen() {
        System.out.println("end screen");
    }

    @NiftyEventSubscriber(id="layout")
    public void onClick(String id, DraggableDragStartedEvent event) {
        System.out.println("drag started");
    }
});

And my draggable:

control(new DraggableBuilder("chest") {{
    id("layout");
    childLayoutCenter();
    width("101px");
    height("171px");
    panel(new PanelBuilder() {{
        childLayoutCenter();
        text(new TextBuilder(){{
            text("My Cool Game");
            font("Interface/Fonts/Default.fnt");
            alignCenter();
            valignCenter();
            color(Color.WHITE);
            height("5%");
            width("15%");
        }});
    }});
}});

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:
Assertion b2Assert(m_bodyCount > 0) showing an error I have the following code for deleting a Box2D body:

void b2World::DestroyBody(b2Body* b)
{
    b2Assert(m_bodyCount > 0);
    b2Assert(IsLocked() == false);
    if (IsLocked())
    {
        return;
    }

    // Delete the attached joints.
    b2JointEdge* je = b->m_jointList;
    while (je)
    {
        b2JointEdge* je0 = je;
        je = je->next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(je0->joint);
        }

        DestroyJoint(je0->joint);

        b->m_jointList = je;
    }
    b->m_jointList = NULL;

    // Delete the attached contacts.
    b2ContactEdge* ce = b->m_contactList;
    while (ce)
    {
        b2ContactEdge* ce0 = ce;
        ce = ce->next;
        m_contactManager.Destroy(ce0->contact);
    }
    b->m_contactList = NULL;

    // Delete the attached fixtures. This destroys broad-phase proxies.
    b2Fixture* f = b->m_fixtureList;
    while (f)
    {
        b2Fixture* f0 = f;
        f = f->m_next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(f0);
        }

        f0->DestroyProxies(&m_contactManager.m_broadPhase);
        f0->Destroy(&m_blockAllocator);
        f0->~b2Fixture();
        m_blockAllocator.Free(f0, sizeof(b2Fixture));

        b->m_fixtureList = f;
        b->m_fixtureCount -= 1;
    }
    b->m_fixtureList = NULL;
    b->m_fixtureCount = 0;

    // Remove world body list.
    if (b->m_prev)
    {
        b->m_prev->m_next = b->m_next;
    }

    if (b->m_next)
    {
        b->m_next->m_prev = b->m_prev;
    }

    if (b == m_bodyList)
    {
        m_bodyList = b->m_next;
    }

    --m_bodyCount;
    b->~b2Body();
    m_blockAllocator.Free(b, sizeof(b2Body));
}

When I close the game I get an exception, and the debugger points to the first line :

b2Assert(m_bodyCount>0);

What exactly does this mean?

sentences:
Should response be tied to request in a multiplayer game? I wonder if server responses on client operation requests should be tied by some operation id?

Tied would be when:

1.Client app sends request to server to e.g. buy item X, and sets operation id as ID.

2.Server responds with operation id and true or false.
This would mean that operation with that id was successful or not.

Untied example:

1.Client app sends request to server to e.g. buy item X

2.Server responds with just an updated data of item X, where new item owner would be mentioned.
This way client can check if owner name is equal to it's own name and if true, assume that item was bought successfully. Same response data could be sent to other clients, to let them know that item X was bought by someone.

Which approach is better?

IMHO untied is better and simpler in implementation, but it feels like there can be so many edge cases which I don't see right now.

sentences:
How can I deal with actor translations and other "noise" in third-party motion capture data? I'm working on a game, and I've run into a problem with motion capture data. My team is using 3DS Max 2011 and trying to put free motion capture files on our models.

The problem we're having is it has become extremely hard to find motion capture data that stays in place. We've found some great motion captures of things like walking and jumping but the actors themselves move within the data, so when we attach these animations to our models and bring them into XNA, the models walk forward even when they should technically be standing still (and then there's also the problem of them resetting at the end of the animation).

How can we clean up, at runtime or asset-processing time, the animation in these motion capture files?

sentences: 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:
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:
MarteEngine Tile Collision I need to add collision to my tile map using MarteEngine. MarteEngine is built of of slick2D. Here's my tile generation code:
Code:

public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException
   {
      for (int x = 0; x < 16; x++) {
         for (int y = 0; y < 16; y++) {
            map[x][y] = AIR;
               air.draw(x * GameWorld.tilesize, y * GameWorld.tilesize);
         }
      }

   for (int x = 0; x < 16; x++) {
         for (int y = 7; y < 8; y++) {
               map[x][y] = GRASS;
               grass.draw(x * tilesize, y * tilesize);
         }
      }

   for (int x = 0; x < 16; x++) {
         for (int y = 8; y < 10; y++) {
            map[x][y] = DIRT;
               dirt.draw(x * tilesize, y * tilesize);
         }
      }

   for (int x = 0; x < 16; x++) {
         for (int y = 10; y < 16; y++) {
            map[x][y] = STONE;
               stone.draw(x * tilesize, y * tilesize);
         }
      }
      super.render(gc, game, g);

   }

And one of my tile classes (they're all the same, the image names are just different):
Code:

package MarteEngine;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import it.randomtower.engine.entity.Entity;

public class Grass extends Entity {

   public static Image grass = null;

   public Grass(float x, float y) throws SlickException {
      super(x, y);

       grass = new Image("res/grass.png");

       setHitBox(0, 0, 50, 50);

       addType(SOLID);
   }

}

I tried to do it like this:
Code:

for (int x = 0; x < 16; x++) {
         for (int y = 7; y < 8; y++) {
               map[x][y] = GRASS;
               Grass.grass.draw(x * tilesize, y * tilesize);
         }
      }

But it gave me a NullPointerException. No idea why, everything looks initialized right? I would be very grateful for some help!

sentences:
Is there a term for lore about a game world's population (cultures, economic state, etc.)? The lore of a game, the ethnicity of its population, cultures, economic state or anything which illustrates the population of a game.

Are all these things part of the lore? Or are they called the story of the game?

sentences: Is there a way to easily make 3d models and textures for people with no prior experience? I want to make a game, but I need assets. I am wondering if I should make them by myself even though I never made any textures or 3d models before. Are there technologies that allow you to easily make them? What would you recommend me to do?

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:
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:
Box2D platformer: Why does horizontal movement stop jumping? I'm writing my sBox2D game character's movement code, but my implementation of jumping is failing:

When I press the Jump key, the character jumps OK. However, when I press jump and another key (like the left arrow key) at the same time, it kind of blocks the jump from happening.

I'm using applyForceToCenter and setLinearVelocity to move the character.

What could the problem be?

Here's how I've bound keys trigger movement:

// press W key (aka Up key or BTNup)
if (RHInput.isDown(RHInput.BTNup)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.applyForceToCenter(0, 100, true );
        System.out.println("Toni jumps");
    }
}

// press A key (aka Left key or BTNleft)
if (RHInput.isDown(RHInput.BTNleft)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.setLinearVelocity(-5, 0);
        System.out.println("Toni walks left");
    }
    else {
        toniBody.setLinearVelocity(-1, 0);
    }
}

sentences:
3D Unity characters without Maya I have been writing 2D iOS games for a while and I'm looking into getting into 3D. I want to know if Maya is required for making 3D sprites or if you can easily make your 3D sprites using just Unity 3D.

They won't be detailed, just about the size / shape and detail level of Crossy Road sprites

sentences:
How to synchronize moving hazards? I am trying to implement a saw blade hazard in my platformer. The saw blade simply moves from point A to point B, and back, at constant velocity. (Let's assume all saw blades move at the same velocity.)

I currently achieve this using my engine's built-in tweening functionality, which allows me to specify a start position, end position, and duration of the tween.

I start the object at position A, tween to position B, then tween it back to A.

This works well enough, but it limits what I can do with level design. There is no way for me to start the saw blades at intermediate points, which means I can't really design interesting patterns with them, for example, getting them to pass some intermediate point at the same time in their cycles.

Ideally, I'd like to be able to set the terminal points, duration of a cycle, as well as the initial configuration of the saw blades. This would allow me to start them at a pattern I want to repeat, and simply let them run.

So, my question is: How can I set up my moving hazards so that I can easily achieve and experiment with different patterns and synchronizations?

I work in Godot 3.0, but I don't think that matters. I am looking for general advice about how to set up moving hazards so that they can be synced in reliable yet highly customizable ways.

sentences:
Swift: Saving Video to Library PHPhotoLibrary.shared().performChanges({
            PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL as URL)
        }) { success, error in
            if !success {
                print("Error saving video: \(String(describing: error))")
            }
        }

Results in:
Error saving video: Optional(Error Domain=PHPhotosErrorDomain Code=-1 "(null)")
I found this similar problem solution on github for images and I think objC(?):

the code below will cause error on iOS 13 devices when import uri is
https://xxxxx.png assetRequest = [PHAssetChangeRequest
creationRequestForAssetFromImageAtFileURL:inputURI];
this way works well
NSData *data = [NSData dataWithContentsOfURL:inputURI];
UIImage *image = [UIImage imageWithData:data];
assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];

https://github.com/react-native-community/react-native-cameraroll/issues/159
So I am thinking I might need to find a wrapper class for video? I'm finding if very difficult to find good resources for working with swift.

sentences:
Character Model crashes game (Unity VR) I am creating a VR game. Currently, I'm testing it on an Android device.

Now I when I run the application it runs smoothly and without any issue.

However when I add the following model:

And attempt to look at it the game crashes.

The model you see doesn't have any scripts on him only a transform component and an animator.

Has anyone tried something similar? or have an idea what the issue might be?
Update i have also tried this following scene

So i tried to isolate the character completely from my original scene. So i made this:

Again if i have the character in the scene it crashes. if i remove the character it runs perfectly fine.

Another update:

If i remove the animator component from the model it works fine?

sentences:
How can I determine the card possibilities for a game of Scopa? In the game of Scopa, at the player's turn, there could be anywhere from 0 to 39 cards on the table (although 10+ is an extreme). I'm trying to figure out the best way to figure out possibilities for the player to pick up cards off the table. Also, in Scopa, you can only pickup cards off the table if there's 1+ cards on the table that add to equal the value of the card in your hand.

Currently, I've got something close to:

for (Card card : cardsOnTable) {
    for (Card card2 : cardsOnTable) {
        if (card2 != card) {
           if (card.getValue() + card2.getValue() == cardInHandValue) {
              //Add to list of possibilities.
           }
        }
    }
}

But that only works out while checking the table for possibilities of two cards. The problem is that there could be possibilities of 3, 4, etc. cards, and that detecting how many cards it needs to check (how many nested loops) doesn't seem possible. What method could I go about using to check for card possibilities?

sentences:
Dynamically load images inside jar I'm using Slick2d for a game, and while it runs fine in Eclipse, i'm trying to figure out how to make it work when exported to a runnable .jar. I have it set up to where I load every image located in the res/ directory. Here's the code

/**
 * Loads all .png images located in source folders.
 * @throws SlickException
 */
public static void init() throws SlickException {

    loadedImages = new HashMap<>();
    try
    {
        URI uri = new URI(ResourceLoader.getResource("res").toString());
        File[] files = new File(uri).listFiles(new FilenameFilter(){
            @Override
            public boolean accept(File dir, String name)
            {
                if(name.endsWith(".png"))
                    return true;
                return false;
            }

        });

        System.out.println("Naming filenames now.");

        for(File f:files)
        {
            System.out.println(f.getName());
            FileInputStream fis = new FileInputStream(f);
            Image image = new Image(fis, f.getName(), false);
            loadedImages.put(f.getName(), image);
        }
    } catch (URISyntaxException | FileNotFoundException e)
    {
        System.err.println("UNABLE TO LOAD IMAGES FROM RES FOLDER!");
        e.printStackTrace();
    }

    font = new AngelCodeFont("res/bitmapfont.fnt",Art.get("bitmapfont.png"));

}

Now the obvious problem is the line URI uri = new URI(ResourceLoader.getResource("res").toString()); If I pack the res folder into the .jar there will not be a res folder on the filesystem. How can I iterate through all the images in the compiled .jar itself, or what is a better system to automatically load all images?

sentences:
Marmalade SDK views navigation concepts I want to develop a simple multi-Activity Android game using Marmalade SDK.
I looked at the SDK samples and found that most of them are a single view (Android Activity) apps.

The Navigation model in Android is a stack-like model where views are pushed and popped.

I can't find whether Marmalade has a similar model or it uses a different approach.

would you please explain this to me and provide tutorials and samples to navigation in Marmalade if possible ?

Thanks

sentences: How can I implement a global high score ladder? Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?

sentences:
How can I write my scoring system and add a score multiplier? I am new to the scripting world and I am currently trying to add a score multiplier to the game code I am working on.

Right now the score is set to increase as the player runs across the level however I want to set it up so that the players gains X amount of score for every Y amount of distance traveled. I also want to add a multiplier for when they come into contact with certain objects X amount of time. Any help would be greatly appreciated.

sentences:
How to link my weapons with their corresponding ammo supply in the Unity Inspector? In my game I would like to implement a universal ammo and weapon system that would be usable for any kind of weapon. So I declared an ammo class:

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

[System.Serializable]
public class Ammo {

     public int MaxAmmo;
     public int CurrentAmmo;

     public Ammo(int maxAmmo)
     {
         MaxAmmo = maxAmmo;
     }

     public void MaxOutType()
     {
         CurrentAmmo = MaxAmmo;
     }

     public void GetAmmo(int amount)
     {
         CurrentAmmo += amount;
     }

     public void UseAmmo(int numOf)
     {
         CurrentAmmo -= numOf;
     }
 }

Then I created a script to hold different Ammo types:

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

public class AmmoSystem : MonoBehaviour
{
    [SerializeField]
    public Ammo Basic = new Ammo(200);
    public Ammo Rockets = new Ammo(50);
    public Ammo AirRockets = new Ammo(75);
    public Ammo Cells = new Ammo(150);
 }

To organize my project I decided to make two weapon scripts: one for nonphysical(Raycast) projectiles called RaycastingWeapon and an another for physical ones(like a rocket launcher) called PhysicalProjectileWeapon

My plan was to create unique weapons using these two scripts from the inspector.

These would use different kinds of ammo but would share the same script with different properties. The essential aspect here is that I would like to be able to select an ammo type from the inspector using a dropdown menu for example.

Is it possible somehow or are there a better way of doing that?

sentences:
Loading encounters and collisions questions within 2D I had three basic questions regarding the creation of a 2D sandbox/openworld game much like Terreria.

Only looking for a general overview/opinion, nothing too detailed. Any links to literature that would help answer the questions below would also be helpful.

First off - Keeping track of the map using regions/chunks, lets say 512 x 512 chunks. Is it recommended to pre-load the surrounding chunks of the 'chunk in focus', so if the character enters either one there is no load time? ~Or do you simply load smaller slices of the chunk next door, in the direction of movement?

Secondly. Do I need to add a collision box to every tile that is preloaded so any NPCs that are off screen but 'next-door' can interact with the environment? Or is this going to be massively CPU intensive ? (512 x 512 x 9 tiles alone)

Third and last question. Off screen RANDOMDLY GENERATED NPCs/monsters I assume dont load and render as they enter the viewable area on the active chunk but are loaded and activated sometime before they are seen. What are the general strategies use to handle this?

For Reference: Using c# with Unity, no third party frameworks/plugins.

Many thanks
John

sentences:
In Monogame, why does Rectangle.Offset not work? I have the following code in a default Monogame Game project:

protected override void Update(GameTime gameTime)
{
    if (Keyboard.GetState().IsKeyDown(Keys.Left))
    {
        paddle.Box.Offset(-10, 0);
        Debug.WriteLine(paddle.Box);
    }
    if (Keyboard.GetState().IsKeyDown(Keys.Right))
    {
        paddle.Box.Offset(10, 0);
        Debug.WriteLine(paddle.Box);
    }
    base.Update(gameTime);
}

paddle.Box is a normal XNA Rectangle.

The problem is that the location of paddle.Box does not change after calling any of the Offset() overloads, as debugging confirms. If I just assign a new Rectangle, it works, but Offset (and Inflate(), FWIW) seems to be broken.

What am I doing wrong?

sentences:
Unity - Issue applying Render Texture to object imported from Blender I'm new to Unity and am trying to create a sort of CRT computer monitor/terminal with text. To draw the text, I set up a Text Mesh Pro with its own camera, which renders to a Render Texture.

I then designed a simple computer monitor model in Blender split into two objects: one for the glass part of the screen, and another for the 'rest' of the monitor exterior case.
I saved a copy of the .blend file into the Assets folder and imported this into Unity.

My blender model: (two separate objects, with the separate "screen" piece moved out of the screen)

When I try to apply the Render Texture onto the screen object, the texture is rotated 90 degrees anti-clockwise and is too zoomed in:

I can't seem to rotate the texture so that it is the right way up to read the text, and only some of the text is visible.
I have tried rotating the object 90 deg. clockwise in Blender and "applying" the transform so unity then thinks the object is oriented correctly. this still caused the texture to be rotated.

I also tried exporting as an .obj file, with "Up" set to "Y-Up", but this didn't work.
I then tried applying the Render Texture to a material, which I then applied to the screen object which didn't work either.
If I apply the texture to a standard cube in Unity, it works fine and is rotated and scaled correctly to fit the cube.

How can I get the blender object oriented correctly so that the Render Texture applies in the correct orientation and scales so the whole of the Render Texture fits and is not zoomed in?

I'm using Unity 2019.3 and Blender 2.82.

sentences:
Websocket Scalability w/ Player Skills About 8 months ago, I asked this question, and received a lot of valuable information from the community.

I have switched to nodejs, since then, and am finishing up my game. I am deeply concerned about networking issues pertaining to the usage of WebSocket data being sent through my current architecture; especially since my game uses an authoritarian server, and doesn't utilize peer to peer.

My game is a Diablo 2 inspired action RPG. As we know, for action RPGs, players utilize a lot of skills, and if games are instanced based, all players in the game need to be notified.

I am worried about scalability. Here is an example:

Shooting a fireball has a 0.5 second cool-down. This is how the data is sent:

Client [Skill id, Skill rotation] -> Server
Server [Checks cooldown, notify's players skill is being used]
Client [If fireball hits monster, send attack signal] -> Server
Server [Checks cooldown, player's range to mob, calculates damage, etc & spits out damage numbers to all players]

All this happens in less than 1 second. The WebSocket server is not even sending out the Monster AI update packets to do damage to the player, nor the monster's fireballs. So now, basically double the amount of data is being sent through the WebSocket and to all player's in a game. It gets worse; imagine if 20 players are online attacking monsters. My nodejs server will be on fire.

This method is not even 100% cheat proof, as I'm waiting for the fireball to hit the monster on the client-side to send the attack signal, instead of doing all that on the server. The problem is, I would have to be running a physics engine on the server, which would bog down nodejs's event loop even more. I'm using the P2 Physics engine from Phaser, and not simple AABB; otherwise, I could just check for collisions server-side.

To close, when a player moves around the map, the server notifys everyone else in the same game. The same goes for when a player drops an item, or when loot is generated from a monster. I just feel like I'm clogging my WebSocket server up, and am doing something wrong with all this data being sent across the pipe.

So with all this said,

Am I worrying too much about the amount of data being sent across
WebSockets?
Is this data being sent normal for a games that utilizes an authoritarian server?
Would a Redis Pub Sub system be an ideal solution to my problems?

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:
Why are my sprite outlines partially rendering in the wrong place? I've been trying to draw an outline around a sprite using the code from this answer.

Details

My sprite is called Ship2Sprite.

This is how I create the rectangle:

 rectangle = New Rectangle(backgroundPos.X + NPCAI.enemyPosistion.X,
                           backgroundPos.Y + NPCAI.enemyPosistion.Y,
                           Ship2Sprite.Width, Ship2Sprite.Height)

This is how it looks without any rectangle drawn:

If I use this line of code

hudSpriteBatch.Draw(t, rectangle, New Rectangle(0, 0, 0, 0), Color.Red,
                    NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

the following is the result in game

hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, 2, rectangle.Height), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Right, rectangle.Top, 2, rectangle.Width), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

However, when trying to use the code from the linked answer, this is the result:

The first and third lines produce the correct lines, however the other 2 are in the correct orientation but not the correct position

Am I missing something somewhere?

EDIT

Based on Blau's answer, I have updated my code to this:

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice)

    Dim spriteBatch1 As New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 2
    Dim y = rectangle.Y + h / 2
    Dim transform As Matrix = Matrix.CreateRotationZ(NPCAI.enemyAngle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 2
    y = -h / 2

    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

However the rectangle is rendering in the wrong position, which is slightly ahead of the sprite. Like this

EDIT 2, with the following code

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice, ByVal angle As Single)

    Dim spriteBatch1 = New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 128
    Dim y = rectangle.Y + h / 128

    Dim transform As Matrix = Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 128
    y = -h / 128
    ' spriteBatch1.Draw(t, rectangle, Color.Red)
    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

sentences:
Text rendering techniques for games I'm researching text rendering techniques for 3D applications, and I'm having a hard time finding information on the topic. Do you know of any other methods of text rendering that are actually used in current games or have a historical significance?

So far I have:

Using prerendered bitmaps of glyphs / strings as textures,
converting the glyph vectors to triangle meshes and rendering it as such,
signed distance fields (popularized by Valve's paper),
GLyphy.

I haven't managed to find anything else though.

Does anyone know what large engines, such as Source, Unreal, Unity, etc. use?

Sources would also be greatly appreciated.

Thanks.

sentences:
What's the purpose to divide constant buffer into groups? In hlsl, we always see this

cbuffer cbPerFrame
{
    float2 gRasterSize;
    float4x4 gView;
    int gVoxelDim;
    float3 gVoxelSize;
};

cbuffer cbPerObject
{
    float gObjectID;
    float4x4 gWorld;
};

I know that the group cbPerFrame is to update variables every frame.
The other group cbPerObject is to update variables per object per frame, for example 2 times per frame in this case.
But how can hlsl know that?  cbPerFrame and cbPerObject are just names but not semantics.
When we define different groups, does hlsl really know how many times this group should update every frame?

sentences:
Why does my Unity animator state "finish" before the visible motion does? Example:

The TopAppearing motion -  boost the alpha of the sprite from 0 to 1 for total of 2 seconds:

After TopAppearing state has been finished:

The TopAppearing's transition settings:

Question:

Why is the Top's sprite alpha 235 after the TopAppearing animatior state has been finished?

sentences:
How can I create and animate 2D skeletons for HTML5 Javascript games? I'm trying to make a 2D fighting game in HTML5(somewhat like street fighter). So basically there are two players, one AI and one Human. The players need to have animations for the body movements. Also, there needs to be some collision detection system. I'm using createjs for coding but to design models/objects/animations, I need some other software.

So I'm looking for a software that can:

easily make custom animation of 2d objects. The objects
structure(skeleton etc.) will be same once defined but need to be
defined once.
Can export the animations and models in a js readable
    format(preferably json)

Collision detection can be done easily after
the exported format is loaded in a game engine.

For point 1, I'm looking for some generic skeleton based animation. Sprite-sheet based animations will be difficult for collision detection.

sentences:
LNK2019 unresolved external symbol __imp_ glDrawArrays@12 referenced in function _main I try this code from tutorial for learn Modern OpenGL in Visual Studio 2015:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

With GLUT (from other tutorial), it workink fine (other project with glew32.lib and freeglut.lib).
With GLEW Project after add glew32.lib and glfw3.lib, lesson 2 has problem in: glDrawArrays(GL_TRIANGLES, 0, 3);

It return linking error in compiling:
LNK2019 unresolved external symbol __imp_ glDrawArrays@12 referenced in function _main

This code:

// Include standard headers
#include <stdio.h>
#include <stdlib.h>

// Include GLEW. Always include it before gl.h and glfw.h, since it's a bit magic.
#include <GL/glew.h>

// Include GLFW
#include <GL/glfw3.h>

// Include GLM
#include <glm/glm.hpp>
using namespace glm;

int main()
{
    // Initialise GLFW
    if (!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW\n");
        return -1;
    }

    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

    // Open a window and create its OpenGL context
    GLFWwindow* window; // (In the accompanying source code, this variable is global)

    window = glfwCreateWindow(1024, 768, "Tutorial 01", NULL, NULL);

    if (window == NULL) {
        fprintf(stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n");
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window); // Initialize GLEW
    glewExperimental = true; // Needed in core profile

    if (glewInit() != GLEW_OK) {
        fprintf(stderr, "Failed to initialize GLEW\n");
        return -1;
    }

    // Ensure we can capture the escape key being pressed below
    glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID);
    glBindVertexArray(VertexArrayID);

    static const GLfloat g_vertex_buffer_data[] = {
        -1.0f, -1.0f, 0.0f,
        1.0f, -1.0f, 0.0f,
        0.0f,  1.0f, 0.0f,
    };

    GLuint vertexbuffer;
    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

    do {
        // 1rst attribute buffer : vertices
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
        glVertexAttribPointer(
            0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            3,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
            );

        // Draw the triangle !
        glDrawArrays(GL_TRIANGLES, 0, 3); // 3 indices starting at 0 -> 1 triangle

        glDisableVertexAttribArray(0);

        // Swap buffers
        glfwSwapBuffers(window);
        glfwPollEvents();

        // Check if the ESC key was pressed or the window was closed
    } while (glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS && glfwWindowShouldClose(window) == 0);
    return 0;
}

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:
Dynamic body in Box2D with fixed position I need to fix the dynamic body position so that it would not rotate and would not move even if there are other forces, collisions and so on. Let me first explain why I need this.

I have a dynamic body which is the game character. There are non-moving objects that the game character should land on and get some energy as long the character is in contact with those bodies. As these bodies are non-moving it would be natural to make them Static or Kinematic. But in my case I cannot do that, as far as there is another Kinematic body with which all the game items should be collided and on EndCollision event those items should be removed. But in Box2D static and kinematic bodies don't collided with each other. So I have to make my game item on which the character should land Dynamic but still should be sure that it will not move. How should I do this?

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:
OpenGL NDC initial values I have a set of vertex locations to create a plane:

this->Vertices = {
    // position         // color          // texture
    -0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
     0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
     0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
    -0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f
};

Everything is fine, but I can't grasp how I should input these values at the very beginning. I used to give exact locations for vertices in DirectX in pixel unit, but here in OpenGL I should give vertex locations in normalized coordinates.

If I wanted to create a plane say 200px by 200px how should I deal with that when I set vertex data. I know I can transform my plane with coordinate matrices through model space and view space and etc. I just don't know what I should be giving for the initial vertex location values.

sentences:
How to sync new object (weapons/bullet) in a multiplayer photon game ? I'm using Photon to develop a multiplayer game.
I would like to know the best way to synchronize "weapons" bullets object between network players.
Thanks

sentences:
In what size should i design sprites for unity iOS? I am developing a 2D platform game in unity.I have conceptualised the game and have to design the art assets/sprites, but the problem is at what resolution or size do i design them?

If I target the sprites size to iPad pro (as its has got highest resolution of all iOS device), can the older iPhone 4S handle it?

What are the best methods of designing art assets for multiple resolution(with best performance on older devices)?

sentences:
Purple screen when using vertex shaders Alright, so I've tried everything I can think of. I've put in over 10 hours into this crap, but nothing seems to work (tried multiple online tutorials as well). Always purple screen.

Here is the simple .fx code:

float4x4 matrixTransform;

struct VShader
{
    float2 Coords : TEXCOORD0;
    float4 Position : POSITION;
};
struct PShader
{
    float2 Coords : TEXCOORD0;
};

VShader VertexShaderFunction(VShader input)
{
    VShader output;

    output.Position = mul(input.Position, matrixTransform);
    output.Coords = input.Coords;

    return output;
}

float4 PixelShaderFunction(PShader input) : COLOR0
{

    return tex2D(textureSampler, input.Coords);
}

technique Technique1
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertexShaderFunction();
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}

Here is how I'm assigning MatrixTransform:

Matrix Projection = Matrix.CreateOrthographic(GameSettings.VectorResolution.X, GameSettings.VectorResolution.Y, -1, 1);

Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);
Projection = halfPixelOffset * Projection;

x.Parameters["matrixTransform"].SetValue(camera.Projection);

Note: the above code works just fine when the vertex shader is disabled. Everything displays like normal.

I'd appreciate it if someone could point out what I'm doing wrong.

Thanks.

EDIT:

I'm currently using multiple shaders in my code that do not use a vertex shader (pixel shaders). I am also making use of render targets. This leads me to believe there is something wrong with the vertex shader code, not the render targets.

EDIT 2:

public Matrix World { get; protected set; }
public Matrix Projection { get; protected set; }
public Matrix View(Vector2 parallax)
{
    return Matrix.CreateTranslation(new Vector3(-Position * parallax, 0.0f)) *
        Matrix.CreateTranslation(new Vector3(-Origin, 0.0f)) *
        Matrix.CreateRotationZ(Rotation) *
        Matrix.CreateScale(Zoom, Zoom, 1) *
        Matrix.CreateTranslation(new Vector3(Origin, 0.0f));
}

public void ReloadMatrices()
{
    World = Matrix.Invert(View(Vector2.One));
    Projection = Matrix.CreateOrthographic(GameSettings.VectorResolution.X, GameSettings.VectorResolution.Y, -1, 1);
    Matrix halfPixelOffset = Matrix.CreateTranslation(-0f, -0f, 0);
    Projection *= halfPixelOffset;
}

Zoom is 1f, Rotation always remains unchanged, and Origin is center of screen.

sentences:
What is the best way to code grinding for a skate game in Unity? I am making a inline skate game, what could be the best method to code the grinding system, there are many various and complex stuff to use but what could be used to set it up simple and not that complex? I made some research, I come up with Catmull Splines or Bezier curves but that seems very complex, my Idea is getting something simple to build up on that and improve it. Maybe use a simple waypoint system that the player follows along while jump on a trail or something. Any ideas or suggestions? Because you cant find any tutorials on grinding system in YouTube or somewhere.

Thanks.

sentences:
Can DirectX9 be used without HWND handle? I found an excellent code here that does almost everything I need: running an HLSL shader on memory texture to process video frames into another texture buffer without displaying it.
http://www.codeproject.com/Articles/207642/Video-Shadering-with-Direct-D?msg=5092502#xx5092502xx

My question is: can DirectX9 be used to work purely with in-memory data without display and without specifying a HWND handle? What needs to change in the code if not giving it a HWND?

The code I'm writing is a DLL that has no graphical interface.

sentences:
Direction vector to quaternion I have a unit vector (direction) which represent a rotation around Y axis,

and would like to turn this into a quaternion to represent the same rotation.

I use GLM library, but interested any library agnostic solution.

Should I pack the direction vector to a matrix then convert to quaternion? Is there a better way?

UPDATE:
As I said the matrix solution works already, but there must be a shorter way, as i don't need all dimension only one (around Y):

glm::quat q = glm::conjugate(glm::toQuat(
    glm::lookAt(glm::vec3(from.getX(), from.getY(), from.getZ()),
                glm::vec3(from.getX(), from.getY(), from.getZ()) + direction,
                glm::vec3(0, 1, 0)
    )
));

sentences:
Choosing Language on Mobile Game Currently I'm trying to localize a mobile game into popular language.

Apart from technical stuff (like how to store string and including supporting fonts),
I'm a bit confused about designing two things: choosing first language when they play game for the first time and changing between them

Currently, I already have several options about choosing first language:

Language is chosen programatically based on user's default
language/font
Ask user on first time run to choose which language thay want
Just set default language to english

About changing language, is it necessary to give user the option to change language? (assuming that my localization team is really good without any flaw when localizing this mobile game)

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:
Implementing navigatable achievement menu in javascript I am in the process of learning javascript for game design, and wanted to make a separate achievement page that the user can navigate to that will allow them to check their achievements on various games. (at the moment I am not concerned with implementing localstorage/cookies etc, I just want to work on the page for now)

So the requirements of my base idea is as follows:

Able to drag around the viewport/page to view all the achievement categories as they will likely not all be in view on smaller screens
Able to click on a category to open a small box containing all achievements belonging to that game/category
Able to mouse over all achievements in the boxes to get text descriptions of what they are
OPTIONAL: have lines connecting each box on the "overworld" to show users where nearby boxes are if they are off screen

At first, I thought I would need canvas to be able to do this. I learned a bit about it and got decently far until I realized that canvas has a lot of restrictions like not being able to do mouseover events unless manually implementing each one. Here is the current progress I was at in doing a test-run of learning canvas, but it's not very far:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

function resize()
    {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
        ctx.setTransform(1, 0, 0, 1, 0, 0);
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        ctx.translate(panning.offset.x, panning.offset.y);
        draw();
    }
    window.addEventListener("resize", resize);

var global = {
    scale   : 1,
    offset  : {
        x : 0,
        y : 0,
    },
};
var panning = {
    start : {
        x : null,
        y : null,
    },
    offset : {
        x : 0,
        y : 0,
    },
};
var canvasCenterWidth = (canvas.width / 2);
var canvasCenterHeight = (canvas.height / 2);

function draw() {
    ctx.beginPath();
    ctx.rect(canvasCenterWidth, canvasCenterHeight, 100, 100);
    ctx.fillStyle = 'blue';
    ctx.fill();

    ctx.beginPath();
    ctx.arc(350, 250, 50, 0, 2 * Math.PI, false);
    ctx.fillStyle = 'red';
    ctx.fill();
}

draw();

canvas.addEventListener("mousedown", startPan);

function pan() {
    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.translate(panning.offset.x, panning.offset.y);
    draw();
}

function startPan(e) {
    window.addEventListener("mousemove", trackMouse);
    window.addEventListener("mousemove", pan);
    window.addEventListener("mouseup", endPan);
    panning.start.x = e.clientX;
    panning.start.y = e.clientY;
}

function endPan(e) {
    window.removeEventListener("mousemove", trackMouse);
    window.removeEventListener("mousemove", pan);
    window.removeEventListener("mouseup", endPan);
    panning.start.x = null;
    panning.start.y = null;
    global.offset.x = panning.offset.x;
    global.offset.y = panning.offset.y;
}

function trackMouse(e) {
    var offsetX  = e.clientX - panning.start.x;
    var offsetY  = e.clientY - panning.start.y;
    panning.offset.x = global.offset.x + offsetX;
    panning.offset.y = global.offset.y + offsetY;
}
body{
  overflow: hidden;
}
canvas {
  top: 0;
  left: 0;
  position: absolute; }
<canvas id="canvas"></canvas>

So I guess my question is now: what is the best way to implement this? Is it feasable to do it with canvas, or should I just scrap that and try to figure out something with div movement? Should I be concerned with performance issues and should that affect how I implement it?

sentences:
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:
Dynamic Music Composition in FMOD I would like to dynamically "build" a song in my game by adding/removing instrument layers. This is normally possible exporting each instrument layer as a separate track, but this method is not so efficient for memory (it's like having multiple songs). I've started to use FMOD recently, so I would like to know if there is a method to save a song with multiple instrument tracks, for example, in an internal format, so that I can manipulate which instrument is going to play by code.

EDIT:
An example from my game: I have a character that can transform to different forms. Imagine that the player has an aggressive melee form: I want that the main theme changes accordingly with the current player form. In my example, when the player is in the melee form, I want to add an electric guitar. If I change to a "bird" form, it would be nice to have a marimba instead of the guitar. Note that the rest of the main theme remain exactly the same. I know that I can export different songs, each one tailored for each player form, but I was wondering if it is possible to do something "better".
When you save a song as a project file, you have more information than the actual music. Take FMOD Designer, for example:

Here we have all the information about layers, instruments etc. so that is possible to mute an instrument, for example. What I want to achieve is to make one song, containing all the instruments(guitar,marimba in the example), so that I can mute/un-mute them by code. Is there a way to have such a format loaded by FMOD c++ API?

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:
Can I make a multiplayer Android Game using Android Studio? I want to create a multiplayer android game, where the clients connect together via a web server.

My question is: Is it possible to make this kind of games using Android Studio with other libraries like LibGDX and Java sockets?

sentences:
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:
Texture filtering: Is the minification or the magnification filter used when rendering at the exact texture size? Suppose you have a texture where the minification filter is linear, but the magnification filter is nearest-neighbor (point filtering). If the texture is rendered at exactly 1:1 pixels, but at a non-whole-number pixel position, it is being neither minified or magnified.

Is there a convention for whether the min or mag filter will be used? What is the justification?

sentences:
How does Application.genuine work? In Unity, does anyone know exactly what is behind the scenes of Application.genuine?

More specifically, I would like to understand its exact process so I can understand:

If I can use it safely without "false negatives".
If it considers text (or other) assets stored in a Resources folder (e.g. my level config files).

Just for context, I want to say that my target platform is iOS.

sentences:
Unity - Bool doesn't change to false anymore I got into a Unity-Tutorial and halfway-through I face this weird problem. I used this code so that my player may attack if he pressed a leftShift. When the player attacks, the animation starts playing in a loop - he never stops attacking and debugging show that attack is never false after the first "leftShift"-Input.

I removed the loops from the animator etc. - but that doesn't seem to be the problem because "attack" never get's to false anyways. I tried different approaches. If I set "attack = false" immediately after attacking, he doesn't attack at all.

Sorry for asking such a beginner question but I can't seem to find my error.

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

public class Player : MonoBehaviour
{
private Rigidbody2D myRigidbody;

[SerializeField]
private float movementSpeed;

private bool facingRight = true;

private Animator myAnimator;

private bool attack = false;

// Start is called before the first frame update
void Start()
{
    myRigidbody = GetComponent<Rigidbody2D>();
    myAnimator = GetComponent<Animator>();
}

void Update()
{
    HandleInput();
    Debug.Log(attack);

}

// Update is called once per frame

void FixedUpdate()
{
    float horizontal = Input.GetAxis("Horizontal");
    HandleMovement(horizontal);
    Flip(horizontal);
    HandleAttacks();
    ResetValues();

}

private void HandleMovement(float horizontal)
{
    if (!this.myAnimator.GetCurrentAnimatorStateInfo(0).IsTag("Attack"))
    {

        myRigidbody.velocity = new Vector2(horizontal * movementSpeed, myRigidbody.velocity.y);
        myAnimator.SetFloat("speed", Mathf.Abs(horizontal));
    }
}

private void HandleAttacks()
{
    if (attack)
    {
        myAnimator.SetTrigger("attack");

    }
}

private void HandleInput()
{
    if (Input.GetKeyDown(KeyCode.LeftShift))
    {
        attack = true;

    }
    attack = false;
}

private void Flip(float horizontal)
{
    if(horizontal > 0 && !facingRight || horizontal < 0 && facingRight)
    {
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }
}

private void ResetValues()
{
    attack = false;
}
}

sentences:
How to display sprites on a 2D canvas, using Unity 5 and C# I want to show a mini-map on the screen, but I don't have any idea to how to paint something in a panel on a canvas by code. The mini-map would look like this prototype I made some time ago, in Visual Studio.

I've tried instantiating a prefab image, but couldn't get it to work. I have two problems.

Firstly, I have 25 Image objects created in the scene, and 25 in the PlayerController script, but I can't get it to change the sprite. I am currently declaring them as follows:

public Image minimap0, minimap1, minimap2, minimap3, minimap4, minimap5,
        minimap6, minimap7, minimap8, minimap9, minimap10, minimap11,
        minimap12, minimap13, minimap14, minimap15, minimap16, minimap17,
        minimap18, minimap19, minimap20, minimap21, minimap22, minimap23,
        minimap24;

Lastly, I don't know how to change all 25 object sprites with a for loop, similar to the code that follows:

public void DrawMiniMap() {
    // mapXCord = miniMapPanel.transform.position.y;
    // mapXCord = 0;
    // mapYCord = 0;

    mapY = playerYPost - 2;
    int contadorArray = 0;
    Vector2 position = new Vector2 (mapXcord, mapYCord);

    for(int i = 0; i < 5; i++) {
        mapX = playerXPos - 2;
        string actualMiniMap = "minimap" + contadorArray;

        // mapXCord = miniMapPanel.transform.position.x;

        for(int j = 0; j < 5; j++) {
            position = new Vector2 (mapXCord, mapYCord);

            if (MapCreator.mapa [mapX, mapY] == 0) {
            } else if (MapCreator.mapa [mapX, mapY] == 1) {
            } else if (mapX == playerXPos && mapY == playerYPos) {
                if (playerOrientation == 'n') {
                } else if (playerOrientation == 'e') {
                } else if (playerOrientation == 's') {
                } else if (playerOrientation == 'w') {
                }
            }
            // mapXCord += 15;
            contadorArray += 1;
        }
        // mapYCord += 15;
    }
}

The map is stored in an array for checking positions.

sentences:
C# XNA Rectangle.Contains returns false? I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the position of the spritefont. Then I created 2 Rectangles (and took the values of the Vector2s) and 2 Colors that will be given a value if the mouse is/isn't currently hovering the drawn string. My mainMenu.cs class contains these variables:

Vector2 playGameButtonPos = new Vector2(303, 300);
Vector2 exitGameButtonPos = new Vector2(303, 350);
List<string> m_ButtonList = new List<string>();
Rectangle m_ButtonArea0 = new Rectangle(303, 300, 50, 30);
Rectangle m_ButtonArea1 = new Rectangle(303, 350, 50,30);
Color optionsColor0;
Color optionsColor1;

mainMenu.LoadContent(ContentManager Content):

Game1.g_MainMenuFont = Content.Load<SpriteFont>(".\\mainMenu\\mainMenuFontTex");

mainMenu.cs's constructor:

m_ButtonList.Add("Play Game");
m_ButtonList.Add("Exit Game");

mainMenu.Draw(SpriteBatch spriteBatch):

var m_MousePosition = new Point(Game1.g_MouseState.X, Game1.g_MouseState.Y);
if (m_ButtonArea0.Contains(m_MousePosition))
{
    optionsColor0 = Color.Yellow;
}
else
{
    optionsColor0 = Color.CornflowerBlue;
}
if (m_ButtonArea1.Contains(m_MousePosition))
{
    optionsColor1 = Color.Yellow;
}
else
{
    optionsColor1 = Color.Red;
}
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[0], playGameButtonPos, optionsColor0);
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[1], exitGameButtonPos, optionsColor1);

Game1:

public static MouseState g_MouseState = Mouse.GetState();
public static SpriteFont g_MainMenuFont;
mainMenu m_MainMenu;

Game1's Initialize() method:

m_MainMenu = new mainMenu();

Game1's LoadContent() and Draw() methods:

m_MainMenu.LoadContent(Content);

m_MainMenu.Draw(spriteBatch);

But when I hover with my mouse on the position where the Rectangle should be, nothing happens.

sentences:
How to reduce server traffic for 100+ multiplayers game? I'm working on fast-paced multiplayer game which has 100+ players in single session.

To sync entire game state to each player, server should send massive data if I did not any compression:

24(transform per object) * 100(total objects) * 100(total players) * 30(server update frequency) = 7.2MB/s !

This is completly unacceptable size. So I investigated someting technique for recuding packet size (like https://gafferongames.com/post/introduction_to_networked_physics/)

Maybe I can reduce data size of (transform per object), by using quantization, Y-axis only rotation and so on.

Also, there is chance to reduce (total objects) for specific player (ex, send only near or visible object for that player).

Reduced packet size example is (worst-case):

16(transform per object) * 30(visible objects per player) * 100(total players) * 30(server update frequency) = 1.44 MB/s !

I think this is still large for server! Is there any technique for more optimizing packet size?

Another question, if I sending large-block of state packet, should I split entire payload into small UDP packets for avoiding fragmentation? (application-level packet fragmentation and assembling is efficient?)

Thanks.

sentences:
Instantiate two objects at random non-overlapping positions I'm making an endless runner game.

I have the script that make coins and walls appear at the same time in front of the player.

The problem is that sometimes the coin and wall appear in the same place/position.

How can I ensure that coins and walls do not appear in the same place/position?

public class Instantiate : MonoBehaviour
{
public float betweenSpawn = 1.05f;
public float angle;
public Vector3 spawnValues; //Range of appearing
public GameObject coinPrefab;
public GameObject wallPrefab;

public Transform coinInstantiate;
public Transform wallInstantiate;

void Start()
{
    InvokeRepeating("Spawn", 0f, betweenSpawn);
}

void Spawn()
{
    Vector3 coinPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));
    Vector3 wallPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));

    Instantiate(coinPrefab, coinPosition + coinInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
    Instantiate(wallPrefab, wallPosition + wallInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
}

}

sentences:
Rotation 2d top-down view in 3d game I have a game in top-down view, with little ants who can walk up/down, left/right and diagonal (and all direction with Joystick).

My little player can move, but I can't rotate it properly...
See what i mean in the youtube video of 7 seconds i made:
https://www.youtube.com/watch?v=1mGMPhJ-u4s&feature=youtu.be

See the code:

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

public class Move : MonoBehaviour
{
public float lookSpeed = 10;
private Vector3 curLoc;
private Vector3 prevLoc;

void Update()
{
    InputListen();
    transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(transform.position - prevLoc), Time.fixedDeltaTime * lookSpeed);
}

private void InputListen()
{
    prevLoc = curLoc;
    curLoc = transform.position;

    if (Input.GetKey(KeyCode.S))
        curLoc.y -= 1 * Time.fixedDeltaTime;
    if (Input.GetKey(KeyCode.Z))
        curLoc.y += 1 * Time.fixedDeltaTime;
    if (Input.GetKey(KeyCode.D))
        curLoc.x += 1 * Time.fixedDeltaTime;
    if (Input.GetKey(KeyCode.Q))
        curLoc.x -= 1 * Time.fixedDeltaTime;

    transform.position = curLoc;

}

}

I have tried a LOT of ways, but nothing worked...
I have also an animator with a stylesheet (ants walking):

thanks !

EDIT: i try another aproch for moving:

transform.Translate(Input.GetAxis("Horizontal") * speed * Time.deltaTime, Input.GetAxis("Vertical") * speed * Time.deltaTime, 0);

and for rotating:

transform.up = gameObject.GetComponent<Rigidbody>().velocity;

It move well.. but it doen't rotate when i move... BUT when i collide with another object, my player get some velocity, and then rotate correctly without touching any input, see in the video:
https://www.youtube.com/watch?v=AS3agqJbVtI&feature=youtu.be

sentences: What are the best alternatives to Unity Asset Store for publishing game assets? I'm not sure if this is the right place to ask this so go easy on down-voting

sentences:
What are the advantages and disadvantages of overlap testing and intersection testing? I have been looking for the advantages and disadvantages of both overlap testing and intersection testing, but I was only able to find a few disadvantages; overlap testing may fail for objects moving very fast, and intersection testing makes assumptions that may lead to wrong predictions, such as a constant speed and zero accelerations.

What are the advantages and disadvantages of overlap testing and intersection testing?

sentences:
Graphic/Animation tools and workflow for iPhone/iOS game development I've got some experience producing Flash games, and for all Flash's faults I find the designer/developer workflow pretty decent.

I can set up a template FLA with placeholder movieclips and code to that independently of a designer/animator doing their thing. When it comes time for integration, I can either compile their animations into my project by using a SWC or by loading SWF's at runtime.

I've had a quick look, but I can't see any tools that offer a similar workflow for iOS game development. Could anyone producing iOS games shed any light on how they're handling designer/animator/developer workflow?

sentences:
Shifting the camera and setting a new scene when using Box2D My jsFiddle:

// START -- MOVE CAMERA
var p = new b2Vec2();
p = (ball.body.GetWorldCenter().x) * physics.scale;
pos.push(p);
var length = pos.length;

var s = (pos[length - 1] - pos[length - 2]); //in pixels

if ((halfwidth < (dw - p)) && (p > halfwidth)) {
    ctx.translate(-s, 0);
}

I followed this tutorial, but the ball rendering is acting weird and slow.

I can't figure out how this example did it. He used 3 variables (stage,x, y) that are undefined in the code he wrote. Also check out how the camera moves with the player in this ImpactJS demo. I'd like to have that.

How can I do this?

sentences:
Why game loop should be running on a separate thread? I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread.

When OS sends a user event (touch, mouse move, etc.) it will be handled within the main thread. Then you would have to forward this event into a game loop thread where this event usually is placed into a queue. The OS may think that event was processed instantly, but user will still have to wait until event is actually processed.

In this case there is an inevitable latency before the event gets processed.

It is exactly the same latency when event is processed in the main thread, but in this case OS can detect the latency.

Is it this latency that separate thread game loop is trying to avoid, or is there anything else?

sentences:
Text Based Tutorials for Unity3d I hope this is the right place to ask this. I'm very new to Unity but not to programming. I also have some basic game programming experience.

I'm searching for text based versions of the videos from unity3d.com/learn/tutorials. These tutorials are very good, but I end up forwarding videos a lot to get key screenshots and code snippets.

Is there any text / pdf / html / .doc / .rtf (i'm very open) version or similar resource to learn unity? Again, those tutorials are amazing and I'd hope to find something of similar quality, but I know that if I have to skim through tens of hours of video I'll end up frustrated. I get that the long hard way is probably the most robust one for deeper understanding, but I was hoping to hack a quick project.

EDIT :

If this can make it a relevant question, then I am currently looking at the "Roll a Ball Tutorial". Really, any other text tutorial would be very welcome

sentences:
Collectiion was modified(monogame) I did use this...and when i changed Screens it gave me this error : Collection was modified; enumeration operation may not execute.

foreach(var screen in ScreenList)

Inside Base Screen

  public void HideScreen()
    {
        Enabled = true;
        Visible = true;
        alpha = 0;
        fade = Fade.Out;

    }

    public void Show()
    {
        Enabled = true;
        alpha = 1;
        fade = Fade.Out;
    }

And in Screen manager

 public static void ChangeScreen(BaseScreen CurrentScreen, BaseScreen TargetedScreen)
    {
        TargetedScreen.HideScreen();
        AddScreen(CurrentScreen);
        RemoveScreen(TargetedScreen);
        CurrentScreen.Show();
    }

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: 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:
Math behind XNA's spriteBatch.draw() color parameter? I'm trying to make a shader that changes the color of a sprite the way the XNA spriteBatch.draw() color parameter changes color. I don't know exactly what it is called (the closest word I can think of is 'tinting' but that's not right I don't think) and it's kind of hard to explain the way it looks.

Say you set the parameter to 'Red' -- white pixels in the original texture would  become completely red, while black pixels would remain black. Grey pixels would look dark red, blue pixels might look purple, green pixels might look brownish.

If you set the parameter to 'Black' the texture would become completely black.

Does anyone know the math behind this, or what this technique is called? It's probably very simple and I'm just not seeing it.

Thanks!

sentences:
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:
Integrating SQLite to Cocos2d-x at Xcode I have downloaded SQLite C/C++ interface to work with Cocos2d-x. Created a database by Firefox SQLite plugin. Then tried the following code

    // sqlite implementation
    sqlite3 *db;

    if(sqlite3_open("testdb.sqlite",&db) == SQLITE_OK){
        NSLog(@"Opened db Successfully");
    } else {
        NSLog(@"Failed to open");
    }

Output is # Failed to open

How to solve the issue?

sentences: File caching on the PC Is it a good move to disable windows' file-caching capabilities (via I/O completion ports) for resource loading in a game environment? Most games will do their own resource management and caching anyways, so the OS will probably cache it a second time. Of course, you don't get the caching across the process' lifetime, but that's usually not a big downside. On the other hand, it probably makes file loading times more predictable - so you can actually give accurate load-time predictions.

sentences:
How do I sample a cubic shadow map in DirectX 11? I've implemented a cubic shadow map for dealing with omni-directional light sources in my scene. By defualt it produces hard shadows

Obviously a shadow map with higher resolution (currently using 512x512) would produce a finer edge but that would also result in larger memory footprint for the application.

I'm currently using a very simple approach to sample the cubic shadow map using the TextureCube::SampleCmp method

float depthBias = 0.002f;
float shadowFactor = omniShadowMap.SampleCmp( omniShadowSampler, -lightVec, lightVecLength / pointLight.positionAndRadius.w - depthBias );

if( shadowFactor == 0.0f )
    shadowFactor = 0.5f;

return float4( ( finalDiffuse + finalSpecular.xyz  ) * shadowFactor , 1.0f );

The SamplerComparisonState is configuered like this

D3D11_SAMPLER_DESC samplerDesc;

samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.MipLODBias = 0;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
samplerDesc.BorderColor[0] = 0.0f;
samplerDesc.BorderColor[1] = 0.0f;
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
samplerDesc.MinLOD = 0.0f;
samplerDesc.MaxLOD = 0.0f;

One approach would be to use Percentage-Closer Filtering but I don't know how to access the texels in a TextureCube.

Any suggestions? Thank you!

sentences:
How can I use a char array to store image data? I am learning the physics engine Chipmunk. In the source code, the example demo "LogoSmash" uses char array to store image_data, but I don't understand how to do that, it's amazing!

Here is the LogoSmash code in question:

static const unsigned char image_bitmap[] = {
  15, -16, 0, 0, ...
}

Will someone explain how this works and how I could do this?

sentences:
Pickup another book or submerge into XNA Completely read Head First C#.

Should I read something else or get personal with XNA from here on? Got links?

Edit: Hobby. Interested in 2D and 2.5D gamedev for personal fun, nothing serious. Multiplayer(in 2D/2.5D games) is also a very interesting topic for me. Basically not sure where to go now from here.

sentences:
Game Rooms Server Architecture - ENet CSharp My team and I are working on an upcoming online fighting game using ENet-CSharp (A C# ENet implementation created by nxrighthere), and we're currently designing the architecture of the server. We would be very glad to hear your suggestions concerning a couple of issues we have been struggling with.
Our current plan is to host a dedicated server for the game, which will handle the logic and game loop of each game instance, and the MonoGame clients will simply deliver the user's commands to the server, and present the updated game state received from it. However, we are not sure how to correctly use ENet with our division of independent game rooms.
Let's say, I have 100 concurrent users connected to the server, and 10 independent game rooms, consisting of 10 players each. At first, we thought that we should have a single ENet Host which will handle all of them, and a single independent ENet thread that will simply receive packets from all ends, alerting the corresponding game room to handle it within its game logic. However, it seems a bit unsafe to have one I/O thread shared by multiple different and parallel instances of the game, so our plan is as such:

For each game room (10 players for that matter), a unique ENet Host will be created, and 2 independent threads will run - one for the game loop, and one for the ENet event polling.
The ENet thread will call the Service method with a small timeout, expecting to poll one "Receive" event at each iteration, and will queue the commands received from the players.
The game loop, at the start of each iteration, will dequeue the commands that have been collected since the last iteration, apply them within the game logic, and so on.

Would you guys say this is a good solution to go by?
A question that rose with that:
Correct me if I'm wrong, but as far as I understand, the send rate of the outcoming packets corresponds to the rate of calls to either the "Service" or the "Flush" methods. How can I ensure that at the end of each game loop, the new game state will be broadcasted immediately to the clients? Calling the "Flush" method at the end of each iteration seems logically appropriate, but unsafe at the same time (since it will be called outside the ENet dedicated thread).
Any piece of advice would be more than welcome. Thanks in advance!

sentences:
Understanding use of dot product in speed boost pad I am trying to understand the dot product. I have found a website that gives you intuition about this topic and one of the examples involves a speed boost pad:

Imagine the red vector is your speed (x and y direction), and the blue vector is the orientation of the boost pad (x and y direction). Larger numbers are more power.
How much boost will you get? For the analogy, imagine the pad multiplies your speed:

If you come in going 0, you'll get nothing [if you are just dropped onto the pad, there's no boost]

If you cross the pad perpendicularly, you'll get 0 [just like the banana obliteration, it will give you 0x boost in the perpendicular direction]

But, if we have some overlap, our x-speed will get an x-boost, and our y-speed gets a y-boost:
\$\text{Total} = speed_x \cdot boost_x + speed_y \cdot boost_y\$
Neat, eh? Another way to see it: your incoming speed is \$\|a\|\$, and the max boost is \$\|b\|\$. The percentage of boost you actually get (based on how you're lined up) is \$\cos(θ)\$
, for a total of \$\|a\| \|b\|\cos(θ)\$.

Let's say we have an object moving with a speed v of <3,3> at an angle of 45 degrees and a boost pad p of <10,0>. I am looking to see the increase of vector v when it hits the pad.
I have calculated the dot product obtaining a value of 30. My questions are:

how does this value modify the speed vector?

And what does this value actually represent? The new total length of v? Does it modify only the x coordinate of v?

And how do I add it over the initial vector? What would be the new speed vector after the interaction with the boost pad?

If we are to normalize the vectors and calculate the dot product, we get a value of around 0.70(cos 45). How is this value to be used on the current speed vector v<3,3>? And what does this percentage represent?

Also, I imagine that the new value for the vector would be just for the frame where it hits the pad, thus to make use of the boost a timer should be added before the speed comes back to normal.

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

sentences:
Is there an algorithm to detect the "mainland" on a 2D map? On this map, the "mainland" is all the land that can be connected to the center of the map in the four cardinal directions (north, south, east, west -- not diagonally).

I would like to detect the mainland and fill the holes in it. I thought of three things:

Search in every non-water (dark cells) cell if can be connected to the center of the map using a path finding algorithm. Too expensive! But this could work for the islands.
The mainland is filled with a bucket of green paint. Each hole is surrounded by paint... now what? If i check every water point inside the mainland for adjacency i'll delete some peninsulas and other geographical features displayed on the shoreline.
Some kind of edge detection to figure out the mainland. Keep whatever is inside, fill it if it's water, remove what's outside. Complex?

Perhaps some game experienced developer can help me out with this, possibly giving me the name of some known algorithm or technique?

sentences:
What type of loop code on game engines? Recently I worked on a game on Spritekit Engine. My question is not about spritekit, but generaly about game engines.
When I write a loop code and run it (eg while i< 100000) my CPU usage goes to 100%, but when I run the test game there is no changes specially on CPU usage ,why is this so?
(We know game engines runs in a loop that includes logic and graphic commands )

sentences:
How can I make a tendril flame like aura visual effect? I am a bit new to UE4 and I'm trying to get a tendril flame like aura like the picture below.

Does anyone know how I would go about this?

Should I use post processing or particles?

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:
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:
Iterating through all animator layers in Unity Mecanim I'm aware of how SetAnimatorLayerWeight works, I'm looking for a way to iterate through all layers of my controller at runtime.

I've four layers and expect more, and need to update them at once, in essence, what I'm trying to do is something like this.

To clarify: The code below is boilerplate of what I'm trying to do.

    void SetCurrentWeaponLayerWeight(int index)
    {
        _animator.SetLayerWeight(index, 1);

        foreach(AnimatorLayer l in Animator.Layers)
        {
            if (l.index != index)
                _animator.SetLayerWeight(l.index, 0);
        }
    }

sentences:
cocos2dx: RunningScene != Scene You just Replace I have this code for cocos2d-x 3.x:

void MainMenu::StartGame(cocos2d::Ref* pSender)
{
    auto director = Director::getInstance();
    auto newScene = Scene::create();
    director->replaceScene(newScene); //run
    Scene *maybeNewScene = director->getRunningScene();
    CCASSERT ( maybeNewScene == newScene , "...") ;          //Assert Fail

    auto hudLayer= HUD::create();
    hudLayer->setPosition(Vec2::ZERO);
    scene->addChild(hudLayer, Z_NORMAL);
}

But When I get runnign scene by director->getRunningScene(), It gives me the scene which was running before calling director->replaceScene(). (the scene which is going to be destructed soon)

When I checked replaceScene() function, This function places newScene in some varibale called _nextScene but not assigned it to _runningScene .

Question:  How can I access newScene, just some lines further? ( for example in HUD::init())

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: 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:
Linear Gradient with angle forumla EDIT: Ok so the question here is how to you generate a linear gradient along a vector.

Here is the function i'm looking for:

function CreateGradient(x,y, x1,y1,x2,y2) {
    // x and y are the point in our image we are looking to create the  color for in grayscale
    // x1,y1,x2,y2 is the vector in which the linear gradient should run
    // Can be in any language
}

What I have so far (that doesn't work):

var width = 2.0;
var offset = 0;

var convX = ((x / RES) * width - width/2) - offset;
var convY = ((y / RES) * width - width/2) - offset;

var angle = Math.atan(y1-y2, x1-x2);

var rx = Math.cos(angle);
var ry = Math.sin(angle);

var here = convX * rx + convY * ry;
var start = x1 * rx + y1 * ry;
var end = x2 * rx + y2 * ry;

var lerpValue = (start - here) / (start - end);

var val = lerp(0,255,clamp(lerpValue,0.0,1.0));

RES is the total resolution of the picture. val in the value (0-255) which represents the R G and B values of the pixel

Final Edit: I have it now thanks code for the future:

var x1 = 0;
var y1 = 0;
var x2 = 255;
var y2 = 255;

var dx = x2-x1;
var dy = y2-y1;

var rx = x-x1;
var ry = y-y1;

var t = ((rx*dx) +(ry*dy)) / ((dx*dx) + (dy*dy));

return lerp(0,255,t);

sentences:
Air AS3 Desktop - Detecting wrong screen resolution and coordinate offset I have an issue with developing an Air desktop app using FlashDevelop in ActionScript 3.0

I'm pretty much new to all this, but I think I made all I should and am wondering if this could be some bug outside my code.

My screen and desktop composition is as follows:

1x Surface pro 3 with Multitouch 2160x1440 screen on the left (Identified as Screen 1)
1x Dell P2314T Multitouch with 1920x1080 screen in the middle (Identified as Screen 2)
1x Dell P2314T Multitouch with 1920x1080 screen on the right (Identified as Screen 3)

When I run Air app with fullscreen mode with

stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;

I get it on the Surface's screen on fullscreen, it being the windows Main display. If I trace the stage.nativeWindow.width and stage.nativeWindow.height I get the correct resolution.

Now since I wanted the app to run on the 23" screen, I set Screen 2 to be the Main display in windows. Now AIR app is ran on the screen 2 by default, thus reporting the stage width and height being 1920 and 1080. However, the child sprites I have on stage with coordinate x = 0 are outside my screen area! They are not visible on the screen on the left, but simply hidden like they're outside of the stage. If I put first child x offset to 120 (half of the difference between 1920 and 2160 screen widths), it's positioned approx on the left edge.

To see better what's going on, I went to screen resolution manager and disabled the internal Surface's screen completely ("Don't show desktop on this screen", thus leaving me with 2x 1920x1080 screens only.

If I run the code now, the stage.nativeWindow.width and height are reporting resolution of 2160x1440 - that's screen 1, which is disabled and has no image on it at all.
The Sprite x offset issue remains the same, being 120 in minus.

The code is completely clear, having stage with single sprite and quad drawn.

public class Main extends Sprite
    {

        static public var instance:Main;

        public function Main()
        {
            instance = this;
            Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
            stage.displayState = StageDisplayState.FULL_SCREEN;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.nativeWindow.alwaysInFront = true;

            trace( String(stage.nativeWindow.x) + ' y: ' +
            String(stage.nativeWindow.y) + ' size h: ' +
            String(stage.nativeWindow.height) + ' w: ' +
            String(stage.nativeWindow.width) );
            init()
        }

        private function init():void
        {
            frame = new Sprite
            frame.x = 120;
            frame.y = 450;
            addChild(frame);
            trace('frame x: ' + frame.x);

        }

    }

What could possibly cause such error? Could someone confirm whether this error is reproducible?

Thanks!

Edit 1:

Ok, seems like the failed offset was fixed adding the stage align property in main:

stage.align = StageAlign.TOP_LEFT

I'm still interested to know why the runtime default align happens using scree 1 instead of main's resolution, and therefore fails to be correct though!

The magic about wrong resolution still stays the same, and can't be reproduced using two different screens (AOC 1920x1080 and Dell 1920x1200) in same composition, using same settings. Weird...

sentences:
How do I render 2D top-down tiled, directed water flow? I'm working on a top-down tile-based fairly graphical 2D game inspired by Dwarf Fortress. I'm at the point of implementing a river in the game world, which covers a number of tiles, and I've calculated the flow direction for each tile, as shown below by the red line in each tile.

For reference of the graphical style, here's how my game looks currently:

What I need is some technique to animate water flowing in each of the river tiles, so that the flow blends into the surrounding tiles so that tile edges are not apparent.

The closest example I have found to what I am after is described at http://www.rug.nl/society-business/centre-for-information-technology/research/hpcv/publications/watershader/ but I'm not quite at the point of being able to understand what's going on in it? I have enough of an understanding of shader programming to have implemented my own dynamic lighting but I can't quite get my head around the approach taken in the linked article.

Could someone explain how the above effect is achieved or suggest another approach to get the result I want? I think part of the above solution is overlapping the tiles (though I'm not sure in which combinations) and rotating the normal map used for the distortion (again no idea on specifics) and past that I'm a bit lost, thanks for any help!

sentences:
Forcing early-z with raytracing I'm working on a GLSL raytracer, and I need to be able to edit gl_FragDepth in the FS.  However, doing so disables early-z culling.  The scene is rendered front-to-back and the FS can only push points further away, so the results of the z-test shouldn't affect the final render, even with a long pipeline.

Is there anyway to force early-z culling to run, or otherwise get around the "no fragdepth" restriction?  I suppose I could do a z-test in the FS, but I'd rather let the hardware take care of it if possible.

sentences:
Multiplayer tile based movement synchronization I have to synchronize the movement of multiple players over the Internet, and I'm trying to figure out the safest way to do that.

The game is tile based, you can only move in 4 directions, and every move moves the sprite 32px (over time of course). Now, if I would simply send this move action to the server, which would broadcast it to all players, while the walk key is kept being pressed down, to keep walking, I have to take this next command, send it to the server, and to all clients, in time, or the movement won't be smooth anymore. I saw this in other games, and it can get ugly pretty quick, even without lag. So I'm wondering if this is even a viable option. This seems like a very good method for single player though, since it's easy, straight forward (, just take the next movement action in time and add it to a list), and you can easily add mouse movement (clicking on some tile), to add a path to a queue, that's walked along.

The other thing that came to my mind was sending the information that someone started moving in some direction, and again once he stopped or changed the direction, together with the position, so that the sprite will appear at the correct position, or rather so that the position can be fixed if it's wrong. This should (hopefully) only make problems if someone really is lagging, in which case it's to be expected. For this to work out I'd need some kind of queue though, where incoming direction changes and stuff are saved, so the sprite knows where to go, after the current movement to the next tile is finished. This could actually work, but kinda sounds overcomplicated. Although it might be the only way to do this, without risk of stuttering. If a stop or direction change is received on the client side it's saved in a queue and the char keeps moving to the specified coordinates, before stopping or changing direction. If the new command comes in too late there'll be stuttering as well of course...

I'm having a hard time deciding for a method, and I couldn't really find any examples for this yet. My main problem is keeping the tile movement smooth, which is why other topics regarding synchronization of pixel based movement aren't helping too much.

What is the "standard" way to do this?

sentences:
AI system recommendations for a Hive mind system Im currently starting to work on a game project where a player will be faced against an enemy which has a hive mind. I was wondering if anyone could recommend an A.I system which I could use as at the moment I am thinking about using Finite State Machines(FSM) and I think that if I use FSM's that it will get messy.

Just to clear up what will be part of the "Hive Mind" if anyone was wondering will be:

Hive Leader
Soldiers
Workers

Under each of these categories there will be roughly 2-3 different sub-categories which will have to have slightly modified FSM's dependent on their abilities.

Thanks for any response

sentences:
Implementing a modal dialog from scratch with C++ Right now I'm implementing my modal dialogs in windows with a separate message loop after popping up the dialog.

This straightforward an approach won't work with other systems that don't have message loops.

Obviously if I'd designed from scratch assuming one message loop I wouldn't have this problem.

In Unity3D (C#) I believe I could use a coroutine for this.

Aside from manually unrolling the code after the message loop so I can put it into a separate state or lambda to be called on close of the dialog, does anyone have any brilliant ideas on ways to make the code work with only one message loop?

I've tried googling but nothing obvious comes up.

EDIT:
I know how to write modal dialogs from scratch, the question is whether there's a simpler way to update older code to remove the message loops.

Let me see if I can write a better example of the pseudcode. This is the best I've come up with.

//DoAlert has a while doAlert is up processmessage loop in it
int i = doAlert("title", "Choice1", Choice2", "Choice3")
switch (i) {
  Case 1 : do something;
}

do something else and return to the routine that called you which does something else before returning, etc.

would become

auto alert = doAlert("title", "Choice1", Choice2", "Choice3");
alert.addChoice(1, [](){ do something; });
alert.addChoice(2, [](){ do something; });
alert.addPostProcess([](){});
... return from routine
alert.addPostProcess([](){});
... when finally at message pump...
alert.process();

...

Clumsy but at least it's simple to read and understand.

If I were writing from scratch, I would not have written it this way for new code.

I'd rather not decipher all these in order to get rid of the multiple message loops. The only way seems to be to trace what happens when the message loop exits, and put that into a lambda or possibly put the whole mess into a state machine. The lambda seems to be the simplest but it still means tracing through all of them and creating a stack of onexit routines from doAlert.

Thanks,
Ralph

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: Recommended Polling Rate I'm using the XInput API to support gamepads. As XInput is not event-driven, but requires polling, my question is, what is the recommended polling rate (ms) for gamepads or specific, the XBOX 360 controller?

sentences:
Loading images using their bytes in Unity If you import an image into the Unity inspector, the image will be encoded in Unity's own format. Usually the resulting image is much bigger than the original (from 100kb to 1MB). Of course, you can do stuff like compress and change the texture max size to reduce the image's size, but at the end it will almost always be bigger.

I noticed that you can create a Texture2D if you got the necessary bytes. As an experiment, I took my 100kb image and imported it to Unity as a .bytes file. Then I read the bytes and created my Texture2D:

    Texture2D texture = new Texture2D(100, 100);
    texture.LoadImage(myTextAsset.bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,350, 288));

And it works. And it is smaller (100kb).

So my question is: what's the difference between Unity's builtin way of handling images and my way of loading them using their bytes? Because I'm saving tons of memory with this method. I imagine that it is a bit slower. But if that's the only difference, I can live with that.

sentences:
pivot of a 3d model outside its mesh after importing into Unity3d as you can see, the pivot is outside my mesh. I want to use the pivot for rotating around, for that I need to set the pivot to the real "rotating point". I know that there's the SetPivot script, but it only works with pivots inside meshes.
This mesh is part of an object which contains several meshes, I created it with Wings3d. The problem appears with .obj  and .3ds as file extension.

1.How can I fix this?
2.Is there a possibility to define a second pivot which can be used in scripts to "rotate around"(maybe a vector3 which can be set in "Designer")?

sentences:
Square Based or free movement What are the pros and cons of using a 'square' or 'space' based character movement mechanic vs using a free movement mechanic?

Square/Space - Movement on a ridged grid using 'squares', 'hexagons' and 'triangles'
Free - Character can move to any valid position on the game board

Some examples of 'Square'

Final Fantasy Tactics
Zoids Assault

Some examples of 'Free'

Star Craft
Age of Empires
Baldur's Gate

I am designing a game that is a Tactical RPG my current idea is to use a square grid with a standard character size of 3x3 or 5x5 so that the maps tiles are more granular.

sentences:
Does Direct3D 11 enable Z-clipping/discard by default? I'm rendering simple 2D figures in DirectX 11.1 and I cannot get Z-values to be rendered; all pixels with Z != 0 get discarded. I'm doing proper world transform as far as I know. X/Y translations work. Rotation over Z works.

Do I need to setup a depth/stencil buffer to avoid DirectX to discard all primitives with Z coordinates?

Thanks, I'll supply any additional information ,code or screens if required.

EDIT:

I've fixed D3D11_VIEWPORT minDepth and MaxDepth members to 0.0/1.0 (I was clearing both to zero). Now pixels with 1.0 < z < 0.0 are discarded.

EDIT 2:

My platform is Windows Runtime App (Win8.1 / WinPhone 8.1).

EDIT 3:
Example screenshots.

Rotated triangle over the Y-axis (pixels with Z>1 discarded)

Triangle Vertex at (x=-0.5,y=-0.5) with z=2. Clipped and hidden.

sentences:
How do I make a Minecraft recipe that costs XP? I want to program a Minecraft client-mod or server-plugin that adds a recipe for making a Bottle o' Enchanting with the following ingredients:

1 glass bottle + 1 lvl of experience → 1 Bottle o' Enchanting

One possible implementation that I have thought of is to execute the command /xp -1L player, but I am unsure how to invoke that command from my Java code. Is there a better way?

How would you go about adding an experience-requiring recipe to Minecraft?

sentences:
Voxel engine artifacts There are white little dots between blocks at random places, mainly at very near blocks. They disappear when I move the mouse and change the view direction.

I use Vertex Arrays with glVertexAttributePointer to send the data directly to the shader. The shader only adds some fake light based on the face direction and draws the pixels.

What could be the reason for the small white artifacts?

Chunk render code:

public void renderChunk() {
    glPushMatrix();

    glTranslatef(pos.x*world.chunkSize.x, 0.0f, pos.z*world.chunkSize.z);

    glBindBuffer(GL_ARRAY_BUFFER, vao_id);

    glVertexAttribPointer(world.game.positionAtt, 3, GL_FLOAT, false, 32, 0);
    glVertexAttribPointer(world.game.normalAtt, 3, GL_FLOAT, false, 32, 12);
    glVertexAttribPointer(world.game.texCoordAtt, 2, GL_FLOAT, false, 32, 24);

    glDrawArrays(GL_TRIANGLES, 0, arraySize / 8);

    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glPopMatrix();
}

Vertex Shader:

attribute vec3 in_position;
attribute vec3 in_normal;
attribute vec3 in_texcoord;
varying vec2 texture_coordinate;
varying vec3 normal;

void main()
{
    gl_Position = gl_ModelViewProjectionMatrix * vec4(in_position, 1.0);
    normal = in_normal;
    texture_coordinate = in_texcoord;
}

Fragment Shader:

varying vec2 texture_coordinate;
varying vec3 normal;
uniform sampler2D texture;

void main()
{
    float add;

    if (normal.x == 1.0 || normal.z == 1.0) {
        add = 0.65;
    } else if (normal.y != 1.0) {
        add = 0.8;
    } else {
     add = 1.0;
     }
         gl_FragColor = texture2D(texture, texture_coordinate) * add;
     }

Enlarge the image by click it to notice the artifacts.

sentences:
Is there a way to keep the mesh collider when updating objects in Unity? I have a 3D object as an imported asset in Unity which i want to make updates to in Maya.
The asset get's updated automatically in Unity when i save the object in Maya - but not in the project hierarchy where i have placed it in the scene.

Is there a way to keep the object with it's mesh collider when the model is updated without having to re-create it in the hierarchy for every iteration?

sentences:
Switching character and keeping animations in Unity default third person controller This is probably a ridiculous question, but I am doing a school project in Unity and am trying to create a basic game. For movement I want to use third person controller and since this is very basic I wanted to keep the default 3d model of character as well (Ethan). But since it is so colorless I had a friend of mine to color it up and then export it back to unity.
The problem is that it's a different model now and animations don't work anymore so I want to know how to correctly switch them to keep default animations? The models are the same otherwise so animations should be possible to apply.
Since nothing I tried so far didn't help I really hope someone can give me some instructions.. :) Thanks

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:
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:
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:
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:
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:
ScreenToWorldPoint problems in otherwise awesome Unity demo I am using this neat Unity demo I found on Stack Overflow, which demonstrates texture masking via RenderTexture:

Can you erase a texture in real time in Unity

But the mapping from mouse position to world space is wrong. This is the script that does the mapping:

using UnityEngine;
using System.Collections;

public class MaskCamera : MonoBehaviour
{
    public Material EraserMaterial;
    private bool firstFrame;
    private Vector2? newHolePosition;

    private void CutHole(Vector2 imageSize, Vector2 imageLocalPosition)
    {
        Rect textureRect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
        Rect positionRect = new Rect(
            (imageLocalPosition.x - 0.5f * EraserMaterial.mainTexture.width) / imageSize.x,
            (imageLocalPosition.y - 0.5f * EraserMaterial.mainTexture.height) / imageSize.y,
            EraserMaterial.mainTexture.width / imageSize.x,
            EraserMaterial.mainTexture.height / imageSize.y
        );
        GL.PushMatrix();
        GL.LoadOrtho();
        for (int i = 0; i < EraserMaterial.passCount; i++)
        {
            EraserMaterial.SetPass(i);
            GL.Begin(GL.QUADS);
            GL.Color(Color.white);
            GL.TexCoord2(textureRect.xMin, textureRect.yMax);
            GL.Vertex3(positionRect.xMin, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMax);
            GL.Vertex3(positionRect.xMax, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMin);
            GL.Vertex3(positionRect.xMax, positionRect.yMin, 0.0f);
            GL.TexCoord2(textureRect.xMin, textureRect.yMin);
            GL.Vertex3(positionRect.xMin, positionRect.yMin, 0.0f);
            GL.End();
        }
        GL.PopMatrix();
    }

    public void Start()
    {
        firstFrame = true;
    }

    public void Update()
    {
        newHolePosition = null;
        if (Input.GetMouseButton(0))
        {
            Vector2 v = camera.ScreenToWorldPoint(Input.mousePosition);
            Rect worldRect = new Rect(-8.0f, -6.0f, 16.0f, 12.0f);
            if (worldRect.Contains(v))
                newHolePosition = new Vector2(1600 * (v.x - worldRect.xMin) / worldRect.width, 1200 * (v.y - worldRect.yMin) / worldRect.height);
        }
    }

    public void OnPostRender()
    {
        if (firstFrame)
        {
            firstFrame = false;
            GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
        }
        if (newHolePosition != null)
            CutHole(new Vector2(1600.0f, 1200.0f), newHolePosition.Value);
    }
}

I fixed line 49 and 50 like so:

Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(Input.mousePosition);
Rect worldRect = new Rect(0.0f, 0.0f, 16.0f, 12.0f);

So the script compiles and the worldRect is in the right place now. Through debugging I found that the world coordinates returned on line 49 are off. I also tried setting the z value of mousePosition to 10, even though the cameras are orthographic, like so:

Vector3 mousePos = Input.mousePosition;
mousePos.z = 10;
Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(mousePos);

The mapping from the mouse to worldspace is still wrong though. Mouse coordinates within a small rectangle near the center are mapping to the full width and height of the image in world space.

sentences:
Speed limit for Newtonian spaceships? I am working on a game based around Newtonian physics. Therefore there is no drag and therefore a ship will keep accelerating indefinitely if there is no counter-force acting on it. This is being built within Unreal Engine and it is entirely based on physics thrusters (i.e. "Add Force at Location").

For gameplay purposes I'd like to implement a "speed limit". Consider a simple seek steering behaviour. Ship A is pursuing Ship B. Ship A reaches the "speed limit" at time t0. Ship B changes direction at time t1.

If I calculate the new direction at t1, and then "cap" the speed at time t1 + 1 frame, Ship A will continue on its original direction, because accelerating towards another direction would make its total linear velocity greater than the speed limit.

If instead of calculating the "global" instantaneous velocity I only calculate the projection of the velocity vector along its forward axis, then it works.

However, there are some fringe cases. For example if the new direction is almost orthogonal to the velocity vector, then that means that its projection on the forward axis will be very small in magnitude. The ship will thus reach speeds well above the limit, only to have a "hard brake" when the velocity projection reaches the limit on its forward axis.

Which other methods could I use to limit speed? I thought about removing a software-based limit altogether and just make sure that the ship is braking whenever it is close to the limit. While more realistic, I'm afraid it might look less interesting.

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:
Passing multiple colors to a pixel shader in DirectX I have a pixel shader that sets the output color based on the interaction of an input texture, sort of like:

if (case1)
{
    output.Color = float4(0, 0, 0, 0);
}
else if (case2)
{
    output.Color = float4(0.5f, 0, 0, 1);
}
...

There can be up to four cases, meaning that the output color will be one of four different input colors, but 90% of the time only one or two colors will be used.

An additional detail that may be important is that the shader has a constant buffer with a few values that can change up to per-frame. These values, and the colors, are selected out of a dictionary that is roughly like:

StyleID: 1
Color1: 0, 0, 0, 0
Color2: 0.5, 0, 0, 1
...two other colors...
Width: 0.8
...other properties...

There are around a thousand different styles to select from. My question is: what's the best way of passing these values to the shader, and why? There are two designs that occur to me offhand.

On the CPU side, the current style is looked up in the dictionary. It assigns the various properties to members of the cbuffer, including however many colors associated with that style (1 to 4). The shader uses these values.
During initialization, the the entire style dictionary is built in to a separate, large constant buffer, something like:

.

cbuffer Styles
{
    float4 Color1[n];
    float4 Color2[n];
    float1 Width[n];
}

Where n is the number of different styles. Then the CPU just pushes the style ID to a different buffer variable (or perhaps to the unused color semantic), and the shader resolves the colors and properties to used based on this.

I'm using shader model 4.0 level 9_3.

sentences:
moving object while being snapped to another one lwjgl hi now I want to move an object(cube) while being snapped to the surface of  another one (sphere) with the same surface of the cube how can i achieve this in lwjgl
here is a diagram. to describe my point
thanks in advance ☺

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:
How do you generate tileable Perlin noise? Related:

Simple noise generation
Understanding Perlin Noise

I'd like to generate tileable Perlin noise.  I'm working from Paul Bourke's PerlinNoise*() functions, which are like this:

// alpha is the "division factor" (how much to damp subsequent octaves with (usually 2))
// beta is the factor that multiplies your "jump" into the noise (usually 2)
// n is the number of "octaves" to add in
double PerlinNoise2D(double x,double y,double alpha,double beta,int n)
{
   int i;
   double val,sum = 0;
   double p[2],scale = 1;

   p[0] = x;
   p[1] = y;
   for (i=0;i<n;i++) {
      val = noise2(p);
      sum += val / scale;
      scale *= alpha;
      p[0] *= beta;
      p[1] *= beta;
   }
   return(sum);
}

Using code like:

real val = PerlinNoise2D( x,y, 2, 2, 12 ) ; // test

return val*val*skyColor + 2*val*(1-val)*gray + (1-val)*(1-val)*cloudColor ;

Gives sky like

Which isn't tileable.

The pixel values are 0->256 (width and height), and pixel (0,0) uses (x,y)=(0,0) and pixel (256,256) uses (x,y)=(1,1)

How can I make it tileable?

sentences:
Should I refer to browser-based games as HTML5 games or Javascript games? First of all, I know that there are alternatives to both HTML5 and Javascript, but I worded the question so generally ("browser-based") because if I had said "HTML5" or "Javascript" games that would already imply an answer to the question.

When writing wiki posts or discussing, I usually call these games "HTML5/Javascript" games. They are written in Javascript, using the new HTML5 technology. What is the proper way to call them: HTML5 or Javascript games? I see that most people opt for HTML5, why?

sentences:
glsl directional light specular seems to be relative to origin not camera I've been using the LearnOpenGL tutorials to calculate directional light. The diffuse works perfectly fine but the specular seems only work properly when the camera is near the origin and the specular is applied the same to all objects.

When I look at the second to last object i expect the specular to be the same as the object around the origin but instead it seems reacts to the origin and not the camera.

My guess is it's something to do with converting something to model space instead of camera space but as i'm new to glsl i'm lost as to where to look first.

Vertex shader:

#version 330 core

layout (location = 0) in vec3 vertexPosition;
layout (location = 1) in vec2 vertexUV;
layout (location = 2) in vec3 vertexNormal;

out vec3 VectorWorldPosition;
out vec2 UV;
out vec3 Normal_cameraspace;

uniform mat4 MVP;
uniform mat4 V;
uniform mat4 M;

void main()
{
    gl_Position = MVP * vec4(vertexPosition, 1.0f);

    VectorWorldPosition = (M * vec4(vertexPosition, 1.0f)).xyz;

    Normal_cameraspace = vertexNormal;//(M*V* vec4(vertexNormal, 1.0f)).xyz;

    UV = vertexUV;
}

Fragment Shader:

#version 330 core

in vec3 vertexWorldPosition;
in vec2 UV;
in vec3 Normal_cameraspace;

out vec4 color;

struct DirectionalLight{
    vec3 position;
    vec3 ambient;
    vec3 diffuse;
    vec3 specular;
};

struct Material{
    sampler2D diffuse;
    sampler2D specular;
    float shininess;
};

uniform DirectionalLight dirLight;
uniform Material material;

uniform vec3 viewPos;

vec3 CalcDirectionalLight(DirectionalLight light, vec3 normal, vec3 viewDir);

void main()
{
    vec3 output = vec3(0.0f);

    vec3 norm = normalize(Normal_cameraspace);

    vec3 viewDir = normalize(viewPos - vertexWorldPosition);

    output += CalcDirectionalLight(dirLight, norm, viewDir);

    color = vec4(output, 1.0f);
}

vec3 CalcDirectionalLight(DirectionalLight light, vec3 normal, vec3 viewDir)
{
    vec3 lightDirection = normalize(light.position);

    float diff = clamp(dot(normal, lightDirection), 0.0, 1.0);

    vec3 reflectDir = reflect(-lightDirection, normal);

    float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);

    vec3 ambient = light.ambient * vec3(texture(material.diffuse, UV));
    vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, UV));
    vec3 specular = light.specular * spec * vec3(texture(material.specular, UV));

    return (ambient + diffuse + specular);
}

I'm using light position here when the tutorial asks to use direction. My thinking is that relative to the origin, position will be equal to direction. This works fine for diffuse so it should it work for specular.

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:
Use texture array for spritesheets? To save texture bind there is the technique to use a sprite sheet which combines several sprites into one texture. Now if I have more sprites than which will fit into one sprite sheet (limited by GL_MAX_TEXTURE_SIZE), can I just use a texture array with multiple sprite sheets and still use only one texture bind?
Is the limiting factor for the amount of sprites the gpu memory?

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: Converting DDS textures to TGA I have a model which has textures in DDS format, but my game takes textures in TGA format.  How can I convert the textures from DDS to TGA?

sentences:
Transparency behaviour on PowerVR I'm doing some graphics optimizing tests, especially on PowerVR transparency. Now I made a scene where there are two groups of simple objects. One group has the shape in geometry using diffuse shader and the other with quads using transparency shader. The camera looks through a plane towards a group.

The test was about the "lateness" of PowerVR's Z-tests. And whether or not use better geometry instead of transparencies for e.g leaves or flowers.

The results were not wholly what I expected. The transparency group benefitted from changing the plane from transparent to diffuse by increasing the FPS by 20(expected).

But why is the group without the plane infront so much faster than when the plane is in front?(Not expected) FPS was 38, screenshotting lowered it.

Tests on the geometry group were opposite of what I had learnt in the past few days. There was only 2FPS difference between transparent and diffuse planes. (Not expected). Shouldn't the transparent plane infront cause the whole scene to render as the Z-test is at the bottom of the pipeline?

sentences:
Events Driven Library XNA C# Language: C# w/ XNA Framework

Relevant and hopefully helpful background info:

I am making a library using the XNA framework for games I make with XNA. The Library has a folder(Namespace) dedication to the GUI. The GUI Controls inherit a base class hooked with the appropriate Interfaces. After a control is made, the programmer can hook the control with a "Frame" or "Module" that will tell the controls when to update and draw with an event. To make a "Frame" or "Module", you would inherit a class with the details coded in. (Kind of how win forms does it.) My reason for doing this is to simplify the process of creating menus with intractable controls. The only way I could think of for making the events for all the controls to function without being class specific would be to typecast a control to an object and typecast it back. (As I have read, this can be terribly inefficient.)

Problem:

Unfortunately, after I have implemented interfaces into the base classes and changed

public delegate void ClickedHandler(BaseControl cntrl);

to

public delegate void ClickedHandler(Object cntrl, EventArgs e);

my game has decreased in performance. This performance could be how I am firing the events, as what happens is the one menu will start fine, but then slowly but surely will freeze up. Every other frame works just fine, I just think it has something to do with the events and... that is why I am asking about them.

Question:

Is there a better more industry way of dealing with GUI Libraries other than using and implementing Events?

Goal:

To create a reusable feature rich XNA Control Library implementing performance enhancing standards and so on.

sentences: What are the technical reasons that make it difficult for a game to be maximized in windowed mode? I am curious as to why most games do not have a mode in which you can easily move your cursor outside the game window to another monitor for example? World of Warcraft maximized window does this really well. Does anyone have any insight on why this would be difficult and/or not worth it for most games to implement?

sentences:
Unpacking Sprite Sheet Into 2D Texture Array I am using WebGL 2. A tag for it does not exist but it should.

I have a 10x10 sprite sheet of squares that are 16x16 pixels in size (all in one PNG image).

I'd like to create a 2D texture array out of them, where each 16x16 square gets its own, unique Z/depth value.

let texture = gl.createTexture();
let image = new Image();

image.onload = function() {
    gl.bindTexture(gl.TEXTURE_2D_ARRAY, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);

    gl.texStorage3D(gl.TEXTURE_2D_ARRAY, 5, gl.RGBA, 16, 16, NUM_IMAGES);

    // Now what?
    // gl.texSubImage3D doesn't let me copy in a section of the src image
}

image.src = "https://source_url.fake/image.png";

I know that gl.texSubImage3D exists but it only accepts an entire image as a source?

glTexSubImage3D: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexSubImage3D.xml

sentences:
Level editing using a 2D map for a 3D game We're trying to make a level editor for a 3D game that involves walking around outdoor environments. In many ways a heightmap satisfies the game's needs, but it also falls short in several ways, so we're considering various enhancements to the heightmap concept, but it's proving difficult to find a simple solution to this problem.

For a start, a heightmap has great difficulty with sharp edges. As long as everything is smooth a heightmap looks wonderful, but it becomes jagged around vertical cliffs, along the edges of roads, and anywhere the resolution of the heightmap becomes relevant. The obvious solution to these issues is to add a layer of vector drawing on top of the heightmap, so we can preciously define the curves of vertical cliffs and roads, and use this to insert specialized polygons into the terrain's mesh. A vertical cliff can even be a simple gap in the terrain mesh that can be filled by another mesh which allows us to render the cliff face however we like, bypassing the limitations that heighmaps usually have.

Another issue with heightmaps is the difficulty of drawing smooth slopes by hand. For the purposes of the game, terrain should either by a gentle slope or a vertical cliff, so there is no ambiguity over whether the player can traverse through it. We could scan the heightmap to detect overly steep slopes and show an error message, but what we really want to do is give the user drawing tools that will only draw acceptable slopes. But how can this be done?

Perhaps the traditional raster heightmap is causing more problems than it is solving, so an entirely different kind of heightmap is called for. Perhaps instead of adding a vector drawing layer, the whole heightmap was done as a vector image and represented as a set of polygons with each polygon having a certain elevation. This way we get smooth curves automatically, and creating meshes for vertical cliffs and flat land is trivial, but representing slopes in the editor and rendering them becomes a challenge.

We've considered a blending tool that would draw polygons on a second layer, and wherever these blend-polygons appear the underlying terrain polygons would smoothly merge together. Polygons that have shared edges would from a slope perpendicular to those edges at an angle that makes the slope walkable. Unfortunately working out the geometry of the resulting mesh is difficult, and it means that cliffs are the default for every change in elevation.

Since it seems more natural for the user to draw lines to block the player's passage rather than drawing the places where the player can traverse, another approach is to have the user draw the cliff lines in another layer just as with the raster heightmap, but now those cliff lines would act to stop the terrain from smoothing itself into pure rolling hills. Imagine each polygon of the heightmap as a pillar of sand with vertical sides, and when a mesh is formed from the map the sand flows out of its pillars, forming smooth slopes in every direction except where it encounters a cliff line and is forced to flow around. Everywhere except the cliffs need to be a gentle enough slope to walk up, so when there is a gap in a cliff the sand needs to flow through and spread out on the other side. We have some ideas about how this might be done, but it's still a major challenge to implement.

Finally, we could just use a grid with sloped blocks to represent slopes. Editing would be easy, generating the mesh would be easy, all the problems would be solved, but being confined to a grid would surely sacrifice the freedom we'd hoped to have. We don't want to be constrained to being axis aligned unless no other solution is practical.

Ultimately the question is: are there practical ways to implement any of the approaches we're considering, or are we coming at this from entirely the wrong direction?

sentences:
How to make a single action run for two objects in GAME MAKER? Think of a traffic light that only turns green or red.

If it is green, the next car passing through the detection point (pink square) will be directed to the green path and will cause the traffic light to turn red.

This way the next car that passes, will be directed to the red path, also making the green light, and so on.

Let's assume that two cars are in the same place and at the same speed and thus collide with the pink square at the same time. How can we make both directions to the same path be green or red and so that the light of the traffic light changes only once?

Considering "obj_BolaAzul" as "obj_blueCar", "obj_BolaRoxa" as "obj_purpleCar" and "obj_Cannon" as "obj_trafficLight".

The codes are basically:

obj_traficLight collision with obj_blueCar

if greenLight==true{
  obj_blueCar.move_towards_point(x+1,y,manSpeed); //go to right
  testGreen=true;
}

if redLight==true{
  obj_blueCar.move_towards_point(x-1,y,manSpeed); //go to left
  testRed=true;
}

if testGreen==true{
  greenLight=false;
  redLight=true
}

if testRed==false{
  redLight=false;
  greenLight=true
}

There are more things besides in code, but it has no relation to the problem.

I'm sorry again for the translation errors, I'm still not speaking English.

sentences:
XNA + Windows Forms: How make them work together without making the trick of the custom GraphicsDeviceControl? What I've found is a solution where you have to code a custom GraphicsDeviceControl to put inside the form (the well known tutorial from the APPHub), but that's not what I'm searching for.

I would like to say that before start to write my question here, I "googled" a lot and I saw some questions here, but I couldn't find what I'm looking for.

I would like to have the Draw/Update loops completly managed by XNAFrameWork (with XNA project and so), and not by a custom component.

I hope you understand what I asked.

Thanks in advance.

Edit

What's the most important thing for me and wasn't shown in the tutorial of APPHub is: where I have to put the input handling? That's one the problems that wasn't covered by the tutorial.

sentences:
Platforms for sharing content and expertise Are there any platforms / sites where people can share expertise in game development and where you can share (either payed or free) digital content (like images, sounds, animations but also frameworks or libraries) to be used in games?
I'd also like the possibility to contact users and request specific pieces of content.

I'd like to start out as an indie developer and have programming skills but I lack the experience and time to create ingame artwork and sound.
Is there any site where I could locate other people (artists mostly) who would want to work on a game for free?

I know I can get most technical questions answered on this site and I have some contacts but I'm affraid this won't be enough.

sentences:
how to calculate initial Y velocity required to reach target? I am trying to calculate the y velocity necessary for my player character to jump up and reach a y position within 1 second.

Given that my game engine is at 60fps, I am doing:

velY = (targetY - playerY) / 60

..  However, I need to account for gravity which is being applied to the character on every update, so I am doing:

velY = ((targetY - playerY) / 60) - (gravity * 60)

This results in the player character always jumping significantly higher than expect.

UPDATE

Attempting to try the Equations of Motion approach, I am setting a timestamp when the player character should begin moving to the target position...  So then in my update loop, I am calling a function with currentTime - timestamp.

update: function(paceFactor) {
    // paceFactor in this game engine is how many nominal 60FPS game “ticks” have elapsed. So if the game is running at 30FPS, then paceFactor will be 2.0, if it's 60FPS, then 1.0 will be passed in.

  this.timer += paceFactor * (1 / 60);

  if (this.setVelocityAt) {
    this.setVelocityFor(this.timer - this.setVelocityAt, this.targetPoint);
  }

  this.position.x += this.vel.x * this.speed * paceFactor;
  this.position.y += this.vel.y * this.speed * paceFactor;
  this.position.y += (gravity * (paceFactor * paceFactor) * 0.5);
  this.vel.y += gravity * paceFactor;
},

setVelocityFor: function(time, target) {
  if (time > 1) {
    time = 1;
    this.setVelocityAt = undefined;
  }
  this.character.vel.x = (target.x - this.character.position.x) / time;
  this.character.vel.y = (target.y + (0.5 * GRAVITY * time * time) - this.character.position.y) / time;
},

Then later the position and gravity is applied to the character as described in the previous update.

However, the velocity being set is a huge number which is... wrong.

sentences:
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:
Separating Axis Theorem and rotated objects Quick question which hopefully won't require thralling through my code.

I have a working implementation of SAT for 3D collision detection but I'm having some problems with dealing with rotated objects. So what I have done, is every frame I rotate every point in both objects by their rotation quaternions. This feels excessive, especially if I am going to be translating/scaling/rotating every vertex in every object on every frame for the collision detection.

I would hope there's a way of implementing my SAT implementation to work with rotated normals only, and not need the rotated projections to compensate, but that doesn't seem to be working.

Could anyone provide me with a brief explanation with how SAT should be expected to handle rotations? Can we rotate certain points, or perhaps get some sort of post-projection rotation value to skew our projections like we can with translations?

Thanks

sentences:
How to make a sprite blink with Libgdx? I want to make a sprite blinking like this:

float alpha = .0f;

public void draw(SpriteBatch batch, float delta){
    alpha += delta;
    sprite.draw(batch, (float)Math.sin(alpha));
}

Well, it is blinking, but in a very irregular way. It should go from transparent to non-transparent to transparent and so on.
But with that code it is more like non-transparent to transparent - then it almost instantly skips back to non-transparent and goes back to non-transparent.

How can I optimize this?

sentences:
Swift - How do I detect the exact point at which two "SKPhysicsBody(edgeFromPoint:" type physics bodies intersect in sprite kit I have two physics bodies attached to two separate sprite nodes using Sprit Kit.  One is a vertical line and one is a horizontal line:

//sprite with horizontal physics body
spriteMatrix[i][j].physicsBody = SKPhysicsBody(edgeFromPoint: CGPointMake(0, tileSegmentHeight), toPoint: CGPointMake(tileSegmentWidth, tileSegmentHeight))
spriteMatrix[i][j].physicsBody!.categoryBitMask = self.surfaceCatagory
spriteMatrix[i][j].physicsBody!.contactTestBitMask = heroCatagory

//sprite with vertical physics body
self.hero.physicsBody = SKPhysicsBody(edgeFromPoint: CGPointMake(self.hero.frame.width / 2, self.hero.frame.height / 2), toPoint: CGPointMake(self.hero.frame.width / 2, -20))
self.hero.physicsBody!.categoryBitMask = heroCatagory
self.hero.physicsBody!.contactTestBitMask = surfaceCatagory

What I'm want to do is test if they are intersecting on every frame, and if they are, return the x and y position of where they are intersecting.  Is this even possible?

sentences:
Reynold's Steering Behaviors So I read Reynold's 1999 paper, [Steering Behaviors For Autonomous Characters][1], and I presume something went over my head, because it doesn't seem to make any sense to me.

steering_force = truncate (steering_direction, max_force)
acceleration = steering_force / mass
velocity = truncate (velocity + acceleration, max_speed)
position = position + velocity

Not sure how this makes any sense. Unless there's a constant time step of 1s, this integration (a forward Euler, which is bad in it's own right), doesn't make much sense to me.

The behaviors themselves don't seem to make much sense either:

Seek:

desired_velocity = normalize (position - target) * max_speed
steering = desired_velocity - velocity

The desired_velocity is in the wrong direction? Should be (target - position)? It also doesn't return a force - it returns a difference of velocities. It doesn't scale at all with mass.

Arrival

target_offset = target - position
distance = length (target_offset)
ramped_speed = max_speed * (distance / slowing_distance)
clipped_speed = minimum (ramped_speed, max_speed)
desired_velocity = (clipped_speed / distance) * target_offset
steering = desired_velocity - velocity

This just doesn't make any sense to me. This will flat out not work. Sure, you'll eventually get a vector pointing away from the target, but depending on the vehicle's mass, may not be able to stop it in time. It's also dependent on an arbitrary slowing radius not tied to the objects max thrust, max speed, or mass. Like Seek, it also doesn't actually return a force.

I stopped reading after that. Clearly there is something I am missing here..

sentences:
Why doesn't pyglet window respond? I use the following code in the python command line interpreter, but the window doesn't respond.

import pyglet
window = pyglet.window.Window()

A white window with python icon into left-upper corner appears but then it basically hangs. Windows task manager shows that this window is not responding. However the Python command prompt works well. No errors or warning messages get displayed.

sentences:
What is the best way to import autocad models into unity? I just got someone to create a 3d environment for my game in autocad 2015. I exported that environment and imported it into unity but that doesn't work well as I am unable to see my environment in the scene view correctly.

Any suggestions on how to do it better? I am not good with 3d modeling and I ever used autocad models in unity before. Any kind of help is highly appreciated. :)

sentences: Can I add rigging bones to a model imported from Blender inside Unity? I created a model in Blender but recently I stumbled upon a video claiming that you can add rigging to a model in Unity. So instead of rigging in Blender, is it possible to do it in Unity?

sentences:
Skill vs. Luck, the ratio and its measurement Gamer buddies, is there a term to describe the level of variance in a game, in comparison to luck. The card game war would have 0 skill and 1.0 luck because the player cannot affect the game. I can't think of something that has 1.0 skill. At first I thought Spelling Bee, but the words chosen for each contestant is randomly chosen suggesting some luck involved... What ratios do different games have, and how can those ratios be accurately measured? What metrics could be used to accurately measure such a ratio? I'd also like to hear of any 1.0 skill games if anyone can think of one.

To reiterate the question clearly:  does there exist such a measurement and if so what is it? Furthermore is there a term for the target of this measurement, so we can have a discussion using a noun.

EDIT: the term luck is used to describe the level of effect that chance, i.e. random events, have in affecting who the winner is. I appreciate everyone's responses.

sentences:
unable to use two gestures simultaneously I have a class implementing gesture listener in libgdx. I want to use longpress gesture in one half of the screen and fling gesture in other part of the screen simultaneously.

public class FlingHandler implements GestureDetector.GestureListener{

GameWorld world;
Bmw bmw;
private float  w,h,xunit, yunit;
private float spd = 1;
private float xtouch = 0, ytouch = 0;
private float xVel = 0, yVel = 0;
private int p = 0;

public FlingHandler(GameWorld world) {
    this.world = world;
    w = SS.WIDTH;
    h = SS.HEIGHT;
    xunit = SS.x;
    yunit = SS.y;
    bmw = world.getBmw();

}
public void update(float delta){
    updateLongpress(delta);
}

public void updateLongpress(float delta){

    if(longPress(xtouch,ytouch)==true && world.getBmw().isDead()==false) {
        if(spd <1600 && Gdx.input.isTouched()){
            spd += 0.9f*delta;
            Gdx.app.log("speed ","increasing"+spd);
        }
    }

    else if(longPress(xtouch,ytouch)==false && world.getBmw().isDead()==false){

            if(spd > 1 ){
                spd -= 8f*delta;
                Gdx.app.log("speed ","decreasing"+spd);
            }
    }
    else{

    }
}

@Override
public boolean fling(float velocityX, float velocityY, int button) {
    xVel = velocityX;
    yVel = velocityY;
    xtouch=Gdx.input.getX();
    ytouch=Gdx.input.getY();
    p = button;

    if(xtouch > SS.WIDTH/2 && world.getBmw().isDead()==false) {
        if (Math.abs(xVel) > Math.abs(yVel)) {
            if (xVel > 0) {
                if (world.getBmw().getPosition().x < 8 * xunit) {
                    world.getBmw().getPosition().x += 4 * xunit;
                }
            } else if (xVel < 0) {

                if (world.getBmw().getPosition().x > 7 * xunit) {
                    world.getBmw().getPosition().x -= 4 * xunit;
                }

            } else {}

        }
        return true;
    }
    else
    return false;
}

@Override
public boolean longPress(float x, float y) {
    xtouch = Gdx.input.getX();
    ytouch = Gdx.input.getY();

    if(xtouch < SS.WIDTH/2 && world.getBmw().isDead()==false){
        return true;
    }
    else if (xtouch > SS.WIDTH/2){
        return false;
    }
    else
    return false;
}

sentences:
Marketing PC/Android 2d Physics Game I've been working on a game for couple years now, its fairly original, has definite potential within an indie market, and appeal for the masses also.

I want to deploy on Android and PC, green-light it on steam and looking into Kickstarter. I'm also going to set up a website where it can be played, have a dedicated server to link 'matches' and post demos on sites like mofunzone and armorgames.

I've used Jbox2d, and am also curious about the licencing with this engine and can't seem to find documentation on that.

I'm almost done the 'demo' and my question is, how should I market it?

I was thinking I'd make the game free on android, charge something like $10 on steam, and charge say 1$ month to play online (for the pc version)

If anyone has any good links, research or advice from personal experience, it would be greatly appreciated.

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:
Can Bullet Physics (or another 3d physics engine) use callbacks in my engine to check static geometry? I'm wondering if it's possible to use or hack Bullet 3d Physics (or another free 3D physics engine) so that I don't need to "import" my static geometry into Bullet - instead I want to do it the other way, so Bullet uses some sort of callback system to check geometry properties of my mesh/polygons.

Sort of like that Bullet would expect a method in my static geometry classes "checkRayIntersection" or similar, and I take care of the details and optimizations myself. The meshes are immovable, so the only thing that I expect Bullet to care about is intersections and their normals, but I might be missing something..

EDIT: as an example, consider a 10 million polygon terrain mesh which is changing all the time. You probably don't want to keep parallel data structures in the render-engine and in the physics engine for this. You don't want to use an approximation for the physics either.

Bullet uses something called MotionStates to solve this problem for its output - I was hoping there was a similar design pattern for passing geometry input.

sentences:
How can I make smoother upwards/downwards controls in pygame? This is a loop I use to interpret key events in a python game.

# Event Loop
for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()
    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_a:
            my_speed = -10;
        if event.key == pygame.K_d:
            my_speed = 10;
    if event.type == pygame.KEYUP:
        if event.key == pygame.K_a:
            my_speed = 0;
        if event.key == pygame.K_d:
            my_speed = 0;

The 'A' key represents up, while the 'D' key represents down. I use this loop within a larger drawing loop, that moves the sprite using this:

Paddle1.rect.y += my_speed;

I'm just making a simple pong game (as my first real code/non-gamemaker game) but there's a problem between moving upwards <=> downwards. Essentially, if I hold a button upwards (or downwards), and then press downwards (or upwards), now holding both buttons, the direction will change, which is a good thing. But if I then release the upward button, then the sprite will stop. It won't continue in the direction of my second input.

This kind of key pressing is actually common with WASD users, when changing directions quickly. Few people remember to let go of the first button before pressing the second. But my program doesn't accommodate the habit.

I think I understand the reason, which is that when I let go of my first key, the KEYUP event still triggers, setting the speed to 0. I need to make sure that if a key is released, it only sets the speed to 0 if another key isn't being pressed. But the interpreter will only go through one event at a time, I think, so I can't check if a key has been pressed if it's only interpreting the commands for a released key.

This is my dilemma. I want set the key controls so that a player doesn't have to press one button at a time to move upwards <=> downwards, making it smoother. How can I do that?

sentences:
How can I deal with vertex precision errors between terrain chunks? I am using OpenGL to render the following scene, using vertex data from one of the map files of a popular MMORPG. The data is chunked and the pictured scene is made up of 256 (16x16) chunks.

However between the chunks I am seeing what I believe to be glitches due to the float precision. Yet I am not doing any large translations and rendering very close to the origin, should I be seeing this problem? The glitches very noticeable as you fly over the scene with it flickering different points along the chunk edges.

I was wondering if I was overlooking something simple or there are tricks other games use to mask this problem. I guess the source data could be the reason for this problem but I am not aware of it happening in the original game.

View screenshots in a new window to see the issue.

sentences:
Texturing Custom Meshes/Terrain? Here's the scenario:

I procedurally generate terrain on the fly, creating an isosurface which is an overlay on top of a scalar field of data points. These underlying data points are basically voxel data, and I use the Marching Cubes algorithm to interpolate vertices, which are used to create the triangles for the meshes.

What I end up with is a contiguous terrain, which is split into chunks, with each chunk split into "blocks". Each block's outline, when looking from directly above, is a square, made up of up to 5 triangles.

The underlying mesh data (vertices, indices, texture coords, normals), are calculated for each "block", and then a mesh is built for each "chunk" (collection of blocks' data). Texture coords are determined for each triangle, and as such, you can see separate texture mappings for each triangle when looking at the textured mesh.

At a minimum, I would like to figure out how to apply the textures to each block as a whole, i.e.- stretch it over all the triangles in a block.

Better yet, I would like to implement something like texture-splatting on arbitrary regions of the terrain, spanning accross chunk and block boundaries, so that I can arbitrarily paint different textures where every I want them.

Ideally, I would like to do the splatting I mentioned procedurally, so that aspects of the terrain, (altitude, proximity), will determine what texture is used in what location.

Can someone clue me in to what is involved in achieving this?
I am using Ardor3D (Java) for mesh creation/texturing/etc...

sentences:
How do you apply relativistic physics to a 4x strategy game? I had the big idea of trying to create a hard science fiction 4X strategy game (with the obvious space setting), which is supposed to simulate a realistic way of creating interstellar societies while simulating real life physics as well.

The problem is: how do I apply Einstein's relativistic equations into the game? I will make a separate series of questions for other issues, such as applying Keplerian planetary movement and Newtonian combat physics.

Do note: the game is being made in C++ and in Unity. Be warned: I am trying to simulate special relativity, not general relativity quite yet. That I can try in a different game.

sentences:
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 load textures at other times than startup in XNA using vb.net? I've encountered a problem with my game project lately. When I load more than a certain number of textures (around 1000) at startup I recieve an error regarding memory, because I have to use 32-bit in XNA. I am self-taught and so have only basic knowledge of the "correct" ways to program a game. The project itself is getting very big and although I try to compress images together etc, I will have to use more than 1000 textures throughout the project.

My question is this: How can I load textures at other points of time than at startup in XNA, using vb.net? (I'm not using classes at all that I'm aware of, so I hope to stay away from that if possible)

sentences:
What's the "right way" to open a websocket connection inside WebGL? The official Unity documentation says that, to run websockets in the WebGL player, you should use this plugin on the Asset Store.  Unfortunately, following that link leads to a notice that this asset has been deprecated and is no longer available, with no explanation as to why or what should be done to replace it.

With that unavailable, how should I implement WebGL websockets in my game?

sentences:
Godot: error(10) expected '(' after Identifier When trying to write up a new shader for a material, I've been trying to create a variable to use to alter speed and test animation. Now, the below outputs fine until I try to assign a value to number.

shader_type canvas_item;

uniform float time_factor = 1.0;
uniform vec2 amplitude = vec2(10.0,5.0);
uniform sampler2D frame1;
uniform sampler2D frame2;
uniform sampler2D frame3;
uniform float speed = 1.0;

float number = 1.9;

void vertex(){
    VERTEX.x += sin(TIME * time_factor + VERTEX.x + VERTEX.y) * amplitude.x;
    VERTEX.y += cos(TIME * time_factor + VERTEX.y + VERTEX.x) * amplitude.y;
   }

I had seen tutorials demonstrating that this would have worked fine in previous versions.

sentences:
Vertices in index buffer not rendered I'm beginning with the 3D rendering in Monogame and i'm facing not a real issue because i already find a way to bypass it but more of a question.
I'm rendering a simple cube with 8 vertices like that:

_vertices[0] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Red);
_vertices[1] = new VertexPositionColor(new Vector3(-1, -1, -1), Color.Red);
_vertices[2] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Red);
_vertices[3] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Red);
_vertices[4] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Green);
_vertices[5] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Green);
_vertices[6] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Green);
_vertices[7] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Green);

But i'm also using an index buffer to draw each triangle for each faces and this is where my issue is. When i'm doing the following:

_indices = new int[] // 6 faces, each containing 2 triangles of 3 vertices
{
           0, 1, 2, 0, 2, 3, // front
           3, 2, 6, 3, 6, 7,
           4, 0, 3, 4, 3, 7,
           1, 5, 6, 1, 6, 2,
           4, 5, 1, 4, 1, 0,
           4, 7, 6, 4, 6, 5 // back
};

The render is perfect and every edge is rendered as you can see on this gif:

https://imgur.com/h7Kn4uH

But when i changed the order inside the index buffer of the back part, like the following:

_indices = new int[] // 6 faces, each containing 2 triangles of 3 vertices
{
           0, 1, 2, 0, 2, 3, // front
           3, 2, 6, 3, 6, 7,
           4, 0, 3, 4, 3, 7,
           1, 5, 6, 1, 6, 2,
           4, 5, 1, 4, 1, 0,
           4, 6, 7, 4, 5, 6 // back, update is here
};

The only thing that was updated is the order of the last column and the result is the following:

https://imgur.com/aCR3QXc

Why does the render is not done on the second case when the only change made is the order of two vertices ?
I know that I can do a rasterize state to render each side of a triangle but one solution is working without it, so i'd like to avoid using it.

Thanks!

sentences:
How to rotate two textures at once in Libgdx, while keeping their relative positions the same? I am trying to develop a game with cards, where the user can swipe left or right to tilt the cards like this. The red & white cross should stay in the same position on the yellow card as they tilt together, but you can see in the images below that their positions shift relative to one another:

I started this game with the yellow card with purple edges, and I tried to rotate it once the user swipe left or right using this code:

void renderCard(SpriteBatch sb , TextureRegion cardShape)
{
    sb.draw(cardShape, x, y, originX, originY, cardWidth, cardHeight, 1, 1, rotationAngle);
}

Once the user swipes, I modify the rotation angle in the method above.

Now, I want to add another texture region over this one, and I want to rotate it too once the user swipes.

Here is the code for that:

void renderCross(SpriteBatch sb,TextureRegion crossShape)
{
    sb.draw(crossShape, x+130.0f, y+130.0f, originX+130.0f, originY+130.0f, 200, 200, 1, 1, rotationAngle);
}

When there was no swipe performed, anything was okay, all the above are drawn. perfectly drawn.

But when I swipe left or right, there are some offsets added, as you can see in the images above.

So the question is, how do I keep the the same relative positions between these two textures, like the game started?

sentences:
How i can do colisions with irregular hitboxes? I'm developing my new platform engine and i don't know how to program collisions with slopes - I'm using hitboxes.
For the collisions of rectangles i use this:

if (player.rec(Position, level.scale).Intersects(t.rec(level.scale)))

but this doesn't work for sloped collisions or triangular hitboxes.
How can I do this?

sentences:
2D Sprites vs UI Image Scripts in Unity I am doing a 2D casual puzzle where the user can drag and drop some pieces into a board. The pieces are 2 or 3 or 4 tiles. Each tile may have text over the sprite.

Target platform: Mobiles and tablets.

I wonder if the right approach is to use 2D sprites or to use UI images for displaying the board, the tiles and the pieces on it.

On one side, doing all the game based on UI elements seem weird.
On the other side, if I do it based on sprites, how do I attach texts on the sprite?

Which approach should I pick?

sentences:
Quadtree having ownership of entities, worth it? Typically, you would have a list of entities stored somewhere, and you'd use quadtree when you need some collision testing between entities for example, by inserting all of the entities and generating a quadtree, and getting the nearest ones that you need for the tests.

But I was wondering, beyond collision testing, the quadtree could be even more helpful if you didn't have a list, but the entities were directly owned by the cells of the quadtree.

For example, when you need to erase an entity, or find a particular entity, you would have to iterate through your entire list. If the quadtree owned the entities, I could pass the position of my entity and it would only seek through entities that are in the same cell.

Instead of iterating through thousands of entities, it would test 'position contains rectangle' a dozens of time, and iterate through the few entities inside the quadtree cell.

Would this even optimize time, and would it be worth it ?

sentences:
Detecting position within a circle I need to detect the position of a knob on a touchpad. I need to detect if it is in particular areas and if so, which one. The sections, of course, being the colored parts.

I know that the black center circle ends at 0.8f and -0.8f for both the X and Y axis.

The information I can get is the percent X and percent Y which is 0 to 1 from center or 0 to -1 from center the other way.

How would I go about doing this?

sentences: Is there a difference in the time taken to load one texture instead of many? Is there a difference in the loading time of 16 256*256 textures versus a single 1024*1024 texture? Specifically for level loading time?

sentences:
Camera wont stay behind model after pitch, then rotation I have a camera position behind a model. Currently, if I push the left thumbstick making my model move forward, backward, or strafe, the camera stays with the model. If I push the right thumbstick left or right, the model rotates in those directions fine along with the camera rotating while maintaining its position relatively behind the model.

But when I pitch the model up or down, then rotate the model afterwards, the camera moves slightly rotates in a clock-like fashion behind the model. If I do a few rotations of the model and try to pitch the camera, the camera will eventually be looking at the side, then eventually the front of the model while also rotating in a clock-like fashion.

My question is, how do I keep the camera to pitch up and down behind the model no matter how much the model has rotated? Here is what I got:

// Rotates model and pitches camera on its own axis
    public void modelRotMovement(GamePadState pController)
    {
        // Rotates Camera with model
        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(angularSpeed);
        AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);

        // Pitches Camera around model
        Pitch = pController.ThumbSticks.Right.Y * MathHelper.ToRadians(angularSpeed);
    }

    // Orbit (yaw) Camera around with model (only seeing back of model)
    public void cameraYaw(Vector3 axisYaw, float yaw)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisYaw, yaw)) + ModelLoad.camTarget;
    }
    // Raise camera above or below model's shoulders
    public void cameraPitch(Vector3 axisPitch, float pitch)
    {
        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axisPitch, pitch)) + ModelLoad.camTarget;
    }

    // Call in update method
    public void updateCamera()
    {
        cameraYaw(Vector3.Up, Yaw);
        cameraPitch(Vector3.Right, Pitch);
    }

NOTE: I tried to use addPitch just like addRotation but it didn't work...

UPDATE
I understand the problem Im having fully. While Im facing world-North or world-South, the camera pitches around the model like normal. But lets say I'm facing world-East. The camera will still point to the model regardless of the rotation, but when I pitch the camera, it will rise and fall in a clock-like fashion around the back of the model. So the camera itself is still pitching as to world's North and South. Not the model's North and South.

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:
C# Script file is not showing in Onclick Event in Unity 5.0.4f1? I uploaded the levelLoader file to the gameobject. Still, when I drag the script file onClick Event, the no function is null. Why? Can anybody help me?

C# code:

using UnityEngine;
using System.Collections;

public class LevelLoader : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame

    public void LoadLevel(int a)
    {

        Application.LoadLevel(a);
    }

    public void Quit()
    {

        Application.Quit();
    }
}

Correct me where I am wrong. I am following this racing car game tutorial. At 7:58 he added this event.
Please help me!!!

sentences:
bug in webgl phong shader: lighting rotates with object I'm working on a simple phong shader in webgl, and I think I'm getting close but something is still wrong. Dead give away: if I have a billboard and have it roll (so it spins like a wheel), the part of the billboard that is lit up spins with it :(.  This confuses me, because it seems like a problem with the model matrix, but the transform makes all the positions & rotations correct, and lighting math is done entirely in world-coordinates , just the lighting wrong.  Ditto with the view matrix, I can move around and look freely and everything is located in its proper place, just lit wrong.

Here are my shaders (minus the definitions for space, and with the lighting in the model matrix moved into GPU for clarity)  {if you prefer reading in github: https://github.com/nickgeorge/quantum/blob/master/index.html#L41}

<script id="fragment-shader" type="x-shader/x-fragment">
  void main(void) {
    vec3 lightWeighting;
    if (!uUseLighting) {
      lightWeighting = vec3(1.0, 1.0, 1.0);
    } else {
      vec3 lightDirection = normalize(vLightPosition.xyz - vPosition.xyz);

      float directionalLightWeighting = max(0.0, dot(
          normalize(vTransformedNormal),
          lightDirection));
      lightWeighting = uAmbientColor + uPointLightingColor * directionalLightWeighting;
    }

    vec4 fragmentColor;
    if (uUseTexture) {
      fragmentColor = texture2D(uSampler,
          vec2(vTextureCoord.s, vTextureCoord.t));
    } else {
      fragmentColor = uColor;
    }
    gl_FragColor = vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);
  }
</script>

<script id="vertex-shader" type="x-shader/x-vertex">
  void main(void) {
    vPosition = uModelMatrix * vec4(aVertexPosition, 1.0);

    // TODO: Move back to CPU
    vLightPosition = uModelMatrix * vec4(uPointLightingLocation, 1.0);

    gl_Position = uPerspectiveMatrix * uViewMatrix * vPosition;
    vTextureCoord = aTextureCoord;
    vTransformedNormal = normalize(uNormalMatrix * aVertexNormal);
  }
</script>

Thanks a lot, and let me know if there's anything else useful to add.

sentences:
jquery ondrag map load only what has not been viewed When a person mouse down, moves the mouse, and mouses up the system gets the different in the mouse down coord and the mouse up coords and loads in the new map items. However, the problem is it loads them every time so I want a way to track what has been loaded without too much work on checking or storing checks.

Most promising. Came up with while typing this. Section the screen into 250x250 sectors and check if that sector has been loaded.
Keep track of each corner of the screen and see if there is an area of those that have not loaded.
Keep a record of the corners of the screen. When mouse up coords are greater then load the different. Problem is if they are at coord 10,000 then it will load from -10k to 10k positive and that is a lot of items to load.
Check every item on the page to see if it is loaded. If I do this I might as well reload the whole page.

If anyone has some suggestions; feel free to pass them on.

sentences:
Unity - reconstruct position from depth I am using Unity and I want to reconstruct position from depth and frustum corners in pixel shader.

I am doing this:

In my App, I calculate view-space corners of the far frustum plane and pass them to shader. (this is correct, I render spheres in world coordinates at corners and they are there).

In Full screen Vertex shader:
Select corner based on corner index calculated from texcoord. This is also correct, I have rendered colors.
This is passed to Pixel Shader as "ray"

In Pixel shader:

float3 normal;
float depth;
DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture, i.uv), depth, normal);
depth =  Linear01Depth (depth);
position = depth * ray;

Reconstructed position is incorrect. The result I got for cube, that covers whole viewport is this:

But in reality, I should have this:

(or similar image with white, blue, pink for different handness)

My output is somehow "blured" around the middle. Why ?

sentences:
How to build bullet (hit) damage detection in Augmented Reality to a real life person acting as an opponent? I am building an Android AR game using ARcore 1.18 in Unity 2019.4.5f1 (LTS). Now I want to create something like bullet damage detection just like it is built in a normal Unity 3D game.
Of course, the biggest problem is how can I even detect the real person's hitbox like it is done in a normal game? I need to somehow be able to attach the bullet damage script to the body of the real-life person in real-time.
Has anyone tried this before? How can we achieve this? I understand if I might not get a spoonfed tutorial but some help towards what should I be doing to achieve this will be greatly appreciated.
I see some other FPS Augmented Reality games which either uses Laser Tag (Father.io) or Barcodes to scan the opponents. These are definitely some great ideas to create an FPS game experience but still, if possible, I want to try it with just the mobile camera without any external support. I am ready to bear some accuracy loss :)

sentences:
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:
How do I handle window resizing in SlimDX? I'm considering the use of SlimDX in a managed Windows Forms Application. Available with DirectX is DXUT. I use DXUT to handle events such as window resizing and 'lost devices.'

How well does SlimDX account for these occurrences? If I were to use SlimDX, how would I account for the functionality of DXUT in managed code?

sentences:
How do I load chunks of data from an assest manager during a loading screen? I'm developing an Android game.  Basically I want to pre-load all graphics/sounds when the app is first loaded.  But I also would like to show a progress bar as this is happening.  Here is a snippet of Java/Android code to display a progress bar while doing some work:

public class LoadingScreen extends Activity {

private static int progress = 0;
private ProgressBar progressBar;
private int progressStatus = 0;
private Handler handler = new Handler();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.loadingscreen);

    progressBar = (ProgressBar) findViewById(R.id.progress);

    //---do some work in background thread---
    new Thread(new Runnable()
    {
        public void run()
        {
            while (progressStatus < 100)
            {
                progressStatus = doSomeWork();

                //---Update the progress bar---
                handler.post(new Runnable()
                {
                    public void run() {
                        progressBar.setProgress(progressStatus);
                    }
                });

            }
            //---hides the progress bar---
            handler.post(new Runnable()
            {
                public void run() {
                    progressBar.setVisibility(8);
                }
            });
        }

        private int doSomeWork()
        {
            try
            {
                //---simulate doing some work---
                Thread.sleep(50);
            } catch (InterruptedException e)
            {

            }
            return ++progress;
        }

    }).start();

}

My question is: how do I design my Asset Manager to load "chunks" of data (bitmaps and sounds/music) in the doSomeWork() function?  Would it be some sort of stack that I keep popping off the next asset to load?  How do I determine how much of the progress bar I should increment after loading a "chunk" of data?

Is there a better way to approach this or is this the correct way?

sentences:
Is it possible in Unity to Flip a 2D Sprite Without Flipping the Object it is Assigned to? I 'built' (followed a tutorial) on a collision detection system, and when I flip the object to go left and right the collision messes up. So I have three options; find a way to modify the collision detection, have sprites for all animations for left and right or to flip the sprite but no the object.

if anyone has used RaycastHit2D, and has figured out a way to do it correctly, that would also be great.

sentences: What are good solutions for serialization in C++? I'm curious what solutions game developers have come up with for serializing the different types of data that they deal with for their games. Do you guys use some monolithic GameObject hierarchy that houses a serialization interface for derived types, use sort of custom RTTI-based solution, perform explicit stream serialization for certain classes, or use some of the open source solutions (boost::serialization, s11n, etc).

sentences:
OpenGL Regarding Frame/Buffer Caching I have been trying to get myself refreshed on OpenGL ES. Whilst doing so, I had the following question in mind:

Does OpenGL have any "caching" mechanism?

For example:

Let's say we draw a stationary triangle with only 3 vertices on the screen; if there will be no transformation applied to the primitive, will OpenGL ES still go through the vertex and fragment shader, drawing the primitive anew every single frame?

Or, does it have any "caching" mechanism, which is smart enough to know that since there is no transformation, a "caching" buffer will display the primitive on the screen bypassing calculations within vertex and fragment shaders so that unnecessary calculations could be reduced/avoided in hopes to enhance frame rate and performance?

Thank you.

sentences:
Wrong Second position of LineRenderer I'm drawing some kind of bullet trace effect with LineRenderer in my 2D Game Project with Unity. At some position, setting position of LineRender result weird:

In the above screenshot, you can see two types of lines are exists. Pure red lines are result of Debug.DrawRay which is only renders in Scene view, not actual game play, and another lines which has yellow to red gradient are actual line renders I want to draw.

I used exactly same code for rendering both two, Debug.DrawRay() and LineRenderer.SetPosition(), but as you can see only DrawRay works as I expected and LineRenderers are cutted and pointing wrong direction.

Here's the code I'm trying:

void Fire() {
    Vector3 shootDirection = m_ShootPoint.right;

    RaycastHit2D hit = Physics2D.Raycast(m_ShootPoint.position, shootDirection, m_Range);
    Debug.DrawRay(m_ShootPoint.position, shootDirection.normalized * m_Range, Color.red, 20);

    // On Hit, set end position where it hits
    if (hit) {
        CreateBulletTrace(m_ShootPoint.position, hit.point);
    }
    // Otherwise, render straight until it's range
    else {
        CreateBulletTrace(m_ShootPoint.position, shootDirection.normalized * m_Range);
    }
}

void CreateBulletTrace(Vector3 startPos, Vector3 endPos) {
    GameObject bulletTraceObj = Instantiate(m_BulletTraceLineRendererPrefab);
    LineRenderer bulletTraceLineRenderer = bulletTraceObj.GetComponent<LineRenderer>();
    bulletTraceLineRenderer.useWorldSpace = true;

    bulletTraceLineRenderer.SetPosition(0, startPos);
    bulletTraceLineRenderer.SetPosition(1, endPos);

    // Destroy(bulletTraceObj, 0.1f);
}

Note that LineRenderer checked use world space to true. What am I missing?

Using Unity 2019.1.0f2.

sentences:
Unity3d: "random" transform position values on editor Run into some strange behavior on editor position values.

https://youtu.be/DUBpbOUkbfo

As you can see we have two cube object with colliders on both and rigidbody on parent.
After start play mode parent object editor values sets to some random numbers while transform.localPosition and transform.position is still (0,0,0).

This somehow related to parent-child physics hierarchy but can't understand how.

sentences:
How to move octree data correctly from parent to child? This is my first question, so apologies if it is a repeat, I have had a look at the other questions and I still can't seem to find an answer to this.

So I am making a recursive octree in OpenGL. So far I have everything that I think should make up the octree correctly. If I draw all of the partitions (nodes) first (as in, through the constructor of the octree), the octree displays fully and correctly (with a depth level of 3).

However, I am wanting to add partitions only when I need them, I have cubes moving around inside the big root node and they bounce around inside and never leave. The problem I am having is trying to make the partitions appear if the maximum threshold of the nodes' items are exceed. Currently, it only works for the bottom left front node.

Here is where I think the problem is occuring, and also, where I am trying to dynamically add in partitions:

// Inserts data from the main function into here for checks.
void Node::Insert(Data* all_data)
{
    // If there are children.
    if (!nodes_.empty())
    {
        // Check to see if the data collides with the child node.
        Node* child_node = GetChild(all_data);

        // If the data does collide.
        if (child_node != NULL)
        {
            // Recurvisely call the insert function on data and the child node.
            child_node->Insert(all_data);
        }

    // If the amount of data exceeds the limit of the node.
    if (data_.size() >= MAX_ITEMS_)
    {
        // If we have not gone too deep into the octree already.
        if (depth_level_ < MAX_DEPTH_LEVEL)
        {
            // Split the current parent octant up into smaller child octants.
            Partition();

            // THE PROBLEM IS HERE.
            // THIS FOR LOOP DOES NOTHING.
            // Passing in the data from the parent node.
            // Iterate through all of the data in the parent node.
            for (auto node_data = data_.begin(); node_data != data_.end(); node_data++)
            {
                // See if any of the data collides with the NEW child node.
                Node* child_node = GetChild((*node_data));

                // If the data does collide with the NEW child node.
                if (child_node != NULL)
                {
                    // ACTUAL PROBLEM HERE.
                    // Push the data from the parent node into the child node respectively.
                    child_node->data_.push_back((*node_data));
                }
            }

            // Empty the data vector for the parent/this.
            data_.clear();
        }
    }

    // If there are no child nodes.
    // Push the data into the parent/this data vector.
    data_.push_back(all_data);
}

This is all inside of my "Insert(Data* data)" function, this function is called every frame on all of the cubes (data) bouncing around inside. Can anyone see what I am doing wrong? Or point me in the direction of some good material for insertion please? From testing, all I can tell is that the iterator shown above seemingly does nothing to the application.

Thanks.

EDIT: I am using Visual Studio 2013 with C++11.

sentences:
How do you build a matchmaking service for an iOS turn-based board game? I want to build a board game that matches players with similar skill levels against each other.

Take for example a chess iOS app. Log in, and the game pairs you up against someone with a similar elo rating.

But there's a network infrastructure they're using. I haven't been able to find a suggestion for what kind of network architecture I should use.

I've tried Google and searching on YouTube for how to build a multiplayer solution, and I haven't been able to find anything specific.

The closest thing I have is to just use the built-in GameKit features Apple offers.

Otherwise I have to use some things called REST, SOAP, Amazon AWS, or Unity's UNET multiplayer matchmaking service. And that's all fine, but I haven't been able to find any specific directions on how to use those services.

What I'm trying to say: There doesn't seem to be a stock, default solution for multiplayer matchmaking in 2018.

What should I use? What can I use? Should I just stick to the basic Game Center functionality?

Should I explore other services or take a few months to build a custom-solution?

What's the most efficient route towards building a multiplayer server for a simple board game between two players?

sentences: Creating paralax background in Unity3D I am trying to create some parallax background in Unity in 2D mode by tweaking offset of the background material and using tiling. I used this tutorial https://www.youtube.com/watch?v=nGw_UBJQPDY as a reference, but my material doesn't tile like one in the tutorial. Any tips for creating infinite background with tiling and tweaking offset? What am I doing wrong?

sentences:
Should the engine for an eventual web-based game start as a web-service? I've recently decided to start writing an engine for a card game. I'm not a big "cards" player, but a friend introduced me to the game (it's a spin on the game Danish), and I fell in love.

I want to develop the game in 3 segments:

The basic engine, handles cards/decks/gamestate, etc.
A user interface (in the form of a mobile/desktop web app.)
An artificial intelligence with various strategies/difficulties, etc.

These are very distinct projects, in my mind... and I'm struggling with seeing how they'll all fit together in the long run.
At first, I don't even want to be able to "play" the game using the engine. The engine will primarily be tested by its unit tests. Play testing won't start until a client exists. So there's something of a client-server relationship here.

The engine is a very large piece of the puzzle. What I'd like to know is: how would you go about developing the "public API" for this engine?

I was thinking the engine could be a very basic web service, that returns its state via queries to a RESTful API, but I'm worried that developing the engine itself as a web app may lead to poor programming decisions. (For instance, if I chose an MVC micro-framework, well, this API wouldn't really have views... it's just returning serialized objects via JSON, or something to that effect. Is it bad to use MVC for a service like this? )

My other idea was that the engine would just be a console app, and I would later write a bridge of some kind to pipe data between it and the web-app. (The bridge could really be anything. I mean, the web server and the game engine could both idle in an IRC server and share their state in channels.)

What approach would you take (develop as a web service, or develop as a standalone app and bridge it later), and why?

Thanks,
Robbie.

EDIT: So I guess this belongs in Game Development. To clarify, I'm going to write a card game engine. I'm trying to figure out the best way to expose the engine's API so it can be integrated in the future with a web client, and an AI client.

I didn't even have an account here, so howdy :)

sentences:
My trigger does not detect my player My trigger does not detect my player.
My Trigger.cs file:
using UnityEngine;

public class Trigger : MonoBehaviour {

public Camera camera1;
public Camera camera2;
public GameObject panel;

 void OnTriggerEnter(Collider other)
{
    camera1.enabled = false;
    camera2.enabled = true;
    panel.SetActive(true);
    Debug.Log ("Entered-");
}

 void OnTriggerExit(Collider other)
{
    camera2.enabled = false;
    camera1.enabled = true;
    panel.SetActive(false);

}
private void Update()
{
    if(Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))
    {
        panel.SetActive(false);

    }
            }

}

Where I can start troubleshooting te issue?

Object on which the trigger script is sitting on.

 The solution:
-- I created two colliders, and assigned one as a collider, the other (bigger) is a trigger.  -- I also had problems with the small triggers in the scene. The triggers were to small to be detected by my main player, althought
they detected my "sphere" player object

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:
How can I load and store JSON data in UE Blueprints? For a college project that spans a few months, I'm working on a text adventure game in Unreal. I would like to state up-front that even if I wanted to use code, I can't. For some reason my college computers don't have Visual Studio or any other IDE UE supports.

I've made multiple text adventures before (in Flash and Unity) using custom frameworks that get and parse JSON data for the game.

I have no idea how I can accomplish a similar task (loading and parsing JSON data) using UE4's Blueprints. Can anyone help me come up with some sort of way I could go about doing this?

sentences:
How to navigate through google Map in unity I am working on loading the google map and navigating through the map.

I have loaded the google map which shows the current location in unity.

Now I need to show the direction from Place A to Place B.How Can I implement this in unity

sentences:
If I design a game that has both guns and melee weapons, how do I make them equally viable? I have a plan to make a 2D action platformer game, and I've started prototyping a bit in Godot 2D. My intention was to make the character fight with both guns and melee weapons, with gunplay like the Metal Slug series and melee mechanics akin to what's found in Dead Cells.

The gun would be bound to the right mouse button [as a secondary attack] and the melee to the left mouse button [as a primary attack], though I do plan on making it so that the player can switch their primary attack type.

The gun used and the melee weapon would be different per character - one would have a high caliber revolver and a greatsword, while another would have a high RoF assault rifle and a knife, for example.

The basics, I get (right now I use a free game art sprite set, and I can use the frame number in the animation to fire a bullet or enable the melee attack hitbox).

It's the balancing issues that got me stumped.

I want to make both ranged and melee combat viable, or as close to equally viable. Though, with the existence of guns, I'm not sure anyone would want to use the characters' melee weapons.

I know it's possible to make guns and melee weapons fulfill different functions, like guns only able to attack one target at a time (except shotguns) with varying fire rates, while most melee weapons are able to attack faster than guns but with a much shorter range, or able to attack multiple targets at once within its hitbox but much slower than guns.

For example, make the melee weapon have a large hitbox and able to apply some non-elemental Damage over Time but with low damage itself [and, when charged, able to pull an enemy in front of the character], and the gun a quad-barreled shotgun that delivers massive damage at close range but with long cooldown.

Would that be a viable option to make both melee and guns equally viable, and are there other ways to do it?

sentences:
How do I make a slot car game? I new to game development with Unity and my first project is a slot car racer. For a realistic slot car-like-driving experience, I first build a track with a channel in the track and a pin on the car. This kind of works, but it does not look like a slot car, its more like a car with a pin and sometimes the physics just go crazy and kick me out of the channel.

I next tried making a spline with a simple game object following the track. I attached my car to my "follower" with a fixed joint. This didn't work so well: My car was tumbling and pulled sideway but I never archived that my car gets pulled down the track.

How should I be approaching this? I'd like the car to accelerate and decelerate quickly, with that acceleration and deceleration controllable by the user.

sentences:
Precision problem when doing collision detection? I've got this problem, and I don't know what may be the cause of it.

I finished reading this article on sphere-triangle collision.

My character (the sphere) stops before it reaches the triangle, and then over like 2 seconds it slowly reaches the "expected" spot where I really want it to stop.

Thing is, I tried switching my whole algorithm from floats to doubles, and they problem stays. So I'm not really sure if that's a number precision problem, although after many debugging I think that there could be a problem with the precision of the next calculation: (t0 and t1)

Real signedDistToTrianglePlane = trianglePlane.signedDistanceTo(colPackage->basePoint);

Real normalDotVelocity = glm::dot(trianglePlane.normal(),colPackage->velocity);

t0 = ((Real)-1.0 - signedDistToTrianglePlane) / normalDotVelocity;
t1 = ((Real)1.0 - signedDistToTrianglePlane) / normalDotVelocity;

Could the dot product function be a trap for precise calculations? (signedDistanceTo() uses glm::dot as well)

Here's my collision detection & response algorithms.

One last thing to note is that on page 47 in the article, the author uses a verySmallDistance number where he only updates some variables if distanceToCollision is bigger than it. I don't understand these lines.

I've been struggling with this issue for a week now. Any help or idea on the subject will be highly appreciated!

sentences:
Method subscribed to an event is called twice for every time the event is raised I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this:
-An InventoryObject is defined as having a "Container" List of ItemObjects (simple scriptable objects, they just have a little information on the object as its sprite, its name, and whether or not it is stackable) and some methods to properly add or remove items (taking item stacking into account) from that list. https://pastebin.com/t4P3aGmi
-A PlayerInventory is a script that will be carried by the player's character. It contains a method for adding items collided with to its assigned InventoryObject instance. It also contains an OnItemPickedUp event that takes its InventoryObject instance as a parameter and passes it to listeners like UpdateDisplay. OnItemPickedUp is raised whenever a collision with a compatible item happens. https://pastebin.com/RsV7XYPp
-An UpdateDisplay script that listens to the OnItemPickedUp event and subscribes the
ProcessInventoryToSingleString(InventoryObject _inventory) method, that subsequently calls several methods to transform the contents of the InventoryObject's Container list into a single, formatted string. https://pastebin.com/N0nsvcWH
-The items are represented by giving a GameObject with a collider2D, aSpriteRenderer and script that contains the particular ItemObject's data and sets its SpriteRenderer's sprite to the ItemObject's.
The problem I'm having is that the method subscribed to the event is being called more than once for each time the event is raised. as shown by the debug logs. Sometimes it's called twice, sometimes even four. This results in my UI display showing more items than there are.
https://files.catbox.moe/afa467.mp4
https://files.catbox.moe/6oxh9b.mp4
Here are pictures of the console debug logs:

I appreciate any help.
EDIT: These errors also appear. I'd like to believe that they're unrelated.

sentences:
How does the Unity3D entity system work? I saw the Java Artemis Entity Component System and thought of the entity system in Unity3D.

In Artemis for example you can only add one component type to each entity and the logic is not in the component.

In Unity3D it's completely different.
Can someone explain me how the entity system in unity 3d works?

I mean, is Unity3D a real entity system, or is it something else?

sentences:
How can we validate subjective inputs from a client? Let's propose for a minute where we have a game using something like the Virtuix Omni. You track feet movement. You track the speed at which they run. Now, let's suppose we want to translate this into game movement and velocity relative to the speed the player is moving. Now, suppose the game is multiplayer. How can a server validate that the input is reasonable?
Most architectures described often tell us to validate the input - but in this case we truly want the player to tell us how fast they're running.

How can I we ensure sane values and not some hacked "always turbo" device?

sentences: What affects the size of APK files? The size of the .apk file built by Unity is larger than I expected. Is it image resolution, number of scenes, or something else?

sentences:
Can you use the RangeAttribute to limit the size of an array? I recently found out about the RangeAttribute and how you could use it to limit the values of your parameter when entering them in in the inspector window. However, I needed to use an array for randomly selecting Prefabs so they can spawn randomly at any given time. The problem is Unity lets me have an array size of zero, but I also want to limit the number of possible prefabs. I was wondering if there is a way to use RangedAttribute to limit the size of an array, and if not is there a different way to achieve this? I have extensive experience in Java and C# but recently started in Unity, so I don't know if I'm asking the right questions, so any guidance right now would be greatly appreciated. Thanks.

P.S. I would be able to attach the script to give an example if needed.

sentences:
Rain effect using DirectX 9 capabilities Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and do not require a heavy programming load (e.g. not more than two hard weeks of programming for one single person)?

It would be nice if the answer could also contain a pro/con phrase for the proposed idea (e.g. postprocessing rain shader vs. a particle based effect).

sentences:
Filling Closed Shapes Game Engine : Unity 5.1
Developing on Windows 7

Hello,

I am using Vectrosity to draw some some shapes on screen run time. I also need to fill these shapes and none of them are really trivial shapes. So after doing some research I figured the best way would be to do it by creating a run-time mesh. Now this almost works for me but has a big issue.

This is my process.

1) I have defined my complex shapes as a set of 2D vertices that I extracted from Illustrator. These vertices I feed to the Vectrosity's Catmul spline function to create my shapes.

2) I then project these vertices in the real space using ScreenToWorldPoint to get 3D vertices.

3) I then pass these vertices to a program that Triangulates these points to a mesh (I use the classic Triangulate script on wiki)

4) I then clean up a little and align

Now all this works well if the camera is not rotated and the forward vector of the camera is orthogonal to the XY plane. The moment I rotate the camera the alignment of the mesh and the vector lines is completely gone.

Here is the image of the vectorline and mesh when the camera is not rotated

And here is the image when the camera is rotated

Here is the function that projects the point into 3D space

 void DrawPolygon () {

     Vector2[] tempVerts = new Vector2[allLinePoints.Count];

     for(int i=0; i<allLinePoints.Count; i++) {

         Vector3 projectedPoint = Camera.main.ScreenToWorldPoint(new Vector3(allLinePoints[i].x, allLinePoints[i].y, 10.0f));
         tempVerts[i] = new Vector2(projectedPoint.x, projectedPoint.y);

     }

     polyTarget.SendMessage("Create", tempVerts);
 }

This message is sent to a generic Triangulation script. Here it is

using UnityEngine;
using System.Collections;
using System.Linq;

 public class CreatePolygon : MonoBehaviour {

 public Material meshMaterial;

 public void Create (Vector2[] verts) {

     Triangulator tr = new Triangulator (verts);
     int[] indices = tr.Triangulate ();

     // Create the Vector3 vertices
     Vector3[] vertices = new Vector3[verts.Length];
     for (int i=0; i<vertices.Length; i++) {
         vertices[i] = new Vector3(verts[i].x, verts[i].y, 0);
     }

     // Create the mesh
     Mesh msh = new Mesh();
     msh.vertices = vertices;
     msh.triangles = indices;

     msh.RecalculateNormals();
     msh.RecalculateBounds();

     // Set up game object with mesh;
     gameObject.AddComponent(typeof(MeshRenderer));
     MeshFilter filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
     filter.mesh = msh;

     GetComponent<Renderer> ().material = meshMaterial;
     StartCoroutine (FlipNormal ());
 }

 public void ResetMesh (Vector2[] verts) {

     Triangulator tr = new Triangulator (verts);
     int[] indices = tr.Triangulate ();

     // Create the Vector3 vertices
     Vector3[] vertices = new Vector3[verts.Length];
     for (int i=0; i<vertices.Length; i++) {
         vertices[i] = new Vector3(verts[i].x, verts[i].y, 0);
     }

     // Create the mesh
     Mesh msh = new Mesh();
     msh.vertices = vertices;
     msh.triangles = indices;

     msh.RecalculateNormals();
     msh.RecalculateBounds();

     // Set up game object with mesh;
     MeshFilter filter = GetComponent<MeshFilter> ();
     filter.mesh = msh;

     GetComponent<Renderer> ().material = meshMaterial;
     StartCoroutine (FlipNormal ());
 }

 IEnumerator FlipNormal() {

     yield return new WaitForSeconds (0.1f);
     Mesh mesh = (GetComponent<MeshFilter> () as MeshFilter).mesh;
     mesh.uv = mesh.uv.Select(o => new Vector2(1 - o.x, o.y)).ToArray();
     mesh.triangles = mesh.triangles.Reverse().ToArray();

 }
}

Now this seems to be an obvious problem to have but I am just not being able to crack it. I have a feeling the solution is some mathematics that is completely escaping me right now. Can someone please help and point me to the right direction. I need to be able to align the mesh to the outline even when the camera is rotated.

sentences:
How to remove an object from a std::vector So I have a vector of bullets that show up on the screen and I do not want these bullets to live forever. I want them to "die as soon as they go off screen or collide with an enemy. How can I make sure they are removed from the array and no longer take up memory.

code:

std::vector<Bullet> bulletArray;

for(int i=0; i<bulletArray.size(); i++)
{
    bulletArray[i].MoveBullet();
    bulletArray[i].Draw();
    if(bulletArray[i].PosY<0)
    {
        //Delete object forever
    }
}

sentences:
Why is the equation \$S = ut + \frac 1 2 a t^2\$ not used directly to calculate final position of an object? Most articles I've read on physics integration in games say to do it like this:

first we calculate velocity after a certain elapsed time dt like this: velocity.x += acceleration.x * dt
then we calculate position as: x += velocity.x * dt

But this will definitely give an inaccurate result.

Therefore, what is the reason to not use the equation of motion \$S = ut + \frac 1 2 a t^2\$ to calculate an accurate displacement and add it to the position?

sentences:
Alternative to System.Drawing for breaking an image into separate tiles in Unity As far as I can tell, System.Drawing namespace is not available in unity. I there an alternative library to load and manipulate or generate images on the fly?

Example: Imagine you want to make a jigsaw puzzle game and want to load and chop random images to use as textures or such.

EDIT: specifically I want to crop images and draw patches from one image onto another image. Or overlay images with grids.
Ultimately all the resulting images need to end up as textures on game objects. If need be, I can use texture.EncodeToPNG to save a copy for other purposes or for as a cached result.

EDIT AGAIN: Let's stick to a concrete example.
Player selects a photo from their iPhone library. It is chopped into pieces and appears on 9 cubes. the player need to arrange the cubes in the correct way to recreate the original image.

sentences:
Correct way to "randomly" generate flowing terrain I'm creating a simple top down RTS game.  I plan on it "randomly" generating maps on the fly when I need to.  I plan on it all working in 'passes':

Fill the terrain in with all grass
Go back and add some random spurts of gravel
Round out the gravel
Draw Mountain Landscape on second layer
Round out mountains
etc. etc.

Now, take a look at this picture below:

I hand created this using my map editor but I plan on this basically being the result after hopefully pass/step 3.

How should I go about deciding when and were to place my gravel so that it is at least irregularly shaped and sporadic enough to look natural?

Thanks if you can!  Any and all help is appreciated!

As a side note:

Each pass is basically me iterating through all of my tiles (The map is divided into 40x40 tiles) similar to this:

for (int x = 0; x <= GRIDMAX - 1; x++) {
    for (int y = 0; y <= GRIDMAX - 1; y++) {
        //Terrain(x, y, 0) = SomethingHere;
    }
}

sentences:
Accessing vertex Input in surf directly without vert's out parameter In Tessellation Shader I can get the vertex Input in vertex shader as follows:

   o.worldPos = v.vertex.xyz;

But how do I get the worldPos directly without filling the out parameter in the vert function. Asking this because the shader is a DX11 Tessellation one and out parameter in vert function is not available at all.

basically I want Initialize my Input shader and pass It to surface shader In vertex shader.I can do It but It's different In Tessellation shader so I need to Accessing vertex position in surf directly without vert's out parameter.

Shader "Tessellation Sample" {
        Properties {
            _EdgeLength ("Edge length", Range(2,50)) = 15
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _DispTex ("Disp Texture", 2D) = "gray" {}
            _NormalMap ("Normalmap", 2D) = "bump" {}
            _Displacement ("Displacement", Range(0, 1.0)) = 0.3
            _Color ("Color", color) = (1,1,1,0)
            _SpecColor ("Spec color", color) = (0.5,0.5,0.5,0.5)
        }
        SubShader {
            Tags { "RenderType"="Opaque" }
            LOD 300

            CGPROGRAM
            #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap
            #pragma target 4.6
            #include "Tessellation.cginc"

            float _EdgeLength;

            float4 tessEdge (appdata_full v0, appdata_full v1, appdata_full v2)
            {
                return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
            }

            float _Displacement;

            struct Input {
                float4 position  : POSITION;
                float3 worldPos  : TEXCOORD2;   // Used to calculate the texture UVs and world view vector
                float4 proj0     : TEXCOORD3;   // Used for depth and reflection textures
                float4 proj1     : TEXCOORD4;   // Used for the refraction texture
            };

            void disp (inout appdata_full v, out Input o){
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.worldPos = v.vertex.xyz;
            o.position = UnityObjectToClipPos(v.vertex);
            o.proj0 = ComputeScreenPos(o.position);
            COMPUTE_EYEDEPTH(o.proj0.z);

            o.proj1 = o.proj0;
            #if UNITY_UV_STARTS_AT_TOP
            o.proj1.y = (o.position.w - o.position.y) * 0.5;
            #endif
            }

            sampler2D _MainTex;
            sampler2D _NormalMap;
            fixed4 _Color;

            void surf (Input IN, inout SurfaceOutput o) {
                o.Albedo = float3(0,0,0);
            }
            ENDCG
        }
        FallBack "Diffuse"
    }

but I have error:

Shader error in 'Tessellation Sample': 'disp': no matching 1 parameter function at line 173 (on d3d11)

sentences:
Equal 3D icon size visualization in Unity I have some Icons (Sprite rendered in 3d world) whose icons are equal size (scale 1). Now I am trying to implement a solution that icons visually show at same size.  If you see the icon at distance then it looks very small when you near the icon then it look bigger. So I want to visualize them equally.
For this reason, first I got the near scale value which is .5 (suitable) and far scale maybe around 1.5. Now, here is my code but it producing very large scale value.
 void Update()
    {
        foreach (var item in iconsObjects)
        {

            float size = Vector3.Distance(activeCamera.position, item.transform.position);
            if (size < 2000)//for optimization purpsose only conside near object under 2000m distance
            {
                float finalSize = Mathf.Clamp(size, 0.5f, 2f);
                item.localScale = new Vector3(finalSize, finalSize, finalSize);
            }

        }
    }

I thought Mahtf.Clamp will work within the context but it is not suitable here as it is applying scale 2 to the near objects where it should be around .5.

sentences:
Increasing resources overtime for a browser-based game I've been interested in developing a browser game ala OGame or Ikariam etc. Basically, a menu is displayed with your resources and, overtime, they increase depending on how advanced are you in the game.

Now then, the "resources" information for all players is stored in a MySQL database.

I've considered two methods to keep track of a player's resources:

Update database every second

Every second, something like

UPDATE `Players` SET `Gold` = `Gold` + `GoldProduction`

This is one option. However, performing a query every second for a potentially large table of players is not exactly appealing - but I might be underestimating my server. Am I?

Calculate it when needed

Since you get gold every second, technically the amount of gold any player has should be

(currentTime - creationTime) * goldProduction

What if the player spends gold? Well, gold spending should affect a variable goldModifications:

goldModifications + ((currentTime - creationTime) * goldProduction)

So if you spend 100 gold, goldModifications would be -100.

But wait. Players can upgrade their gold production. Hence, goldProduction isn't constant and this formula is flawed...

... Maybe when you upgrade your gold production, goldModifications will be modified by your current amount of gold (so if you had 1500, we would do goldModifications += 1500), then creationTime will be overwritten to the current time.

So I have two methods. One is incredibly simple (just update the database), but I am unsure if it is too much overhead or not. The other is very complex as there could be any number of factors affecting gold production, but certainly requires less processing power.

What should I do? What do those popular games actually do?

sentences: Is there a way to customize the Game-view Editor GUI? I need to add a simple slider like scale slider in Game-view to change the timescale because I usually test my games by changing timescale.

sentences:
Rotations and angular velocity I'm new to 3D-game programming and I'm having some trouble making objects rotate the way I want them to. I just read Glenn Fiedler's tutorials on game physics, awesome stuff by the way! (http://gafferongames.com/game-physics/physics-in-3d/)

Now, I'm trying to make a simple space sim. If you imagine a spaceship that is not yet rotated in any way (up = Vector3.Up etc..). If I apply some yaw-input (which would increase the angular velocity) I'd then expect the ship to rotate around the up-vector of the ship (which is also the world y-axis at the moment). That works fine. If I would then roll the ship a little bit, I'd expect the ship to roll around its forward axis, but it should also continue to spin around the world y-axis.

At the moment with my implementation instead of keeping it's momentum around the y-axis, it continues to spin around its local up-vector - which is obviously wrong.

I think I understand why this happens with my current implementation, I'm just not sure how to fix it.

This is what I have at the moment, with some minor simplifications (runs every update):

Vector3 addedRotation = new Vector3(pitchInput, yawInput, rollInput);
addedRotation = Vector3.Transform(addedRotation, rotation);
rotationVelocity += addedRotation;

rotation.Normalize();

Quaternion w = new Quaternion(rotationVelocity, 0);
rotation += Quaternion.Multiply(w * rotation, 0.5f);

I'd be very happy if someone could point me in the right direction here. If anything needs clarification, please tell me and I'll try explain it better.

Thanks for taking the time!

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:
3D XNA Tracking Camera I'm trying to implement a camera that tracks a 3D model in my game. I've taken a look at this MSDN article on creating a 3rd person camera, as well as experimenting on my own; but I don't get the correct result.

My camera follows behind my model correctly, until I rotate the model about the y-axis. In this case, the camera seems to fly off to one side or the other.

What I want, is when the model is rotated to the left the camera will remain behind it; so as too mimic the view that can been seen in the left image (minus the fact that the rest of the world will display the rotation). I have tried looking around for tracking camera implementations, but to no avail.

Here is the code I use to calculate the position and look-at vectors of the camera:

// Calculate the offset vector
Vector3 offset = new Vector3(0.0f, this.DistanceAboveTarget, -this.DistanceBehindTarget);

// Transform the offset by the target's rotation
float targetRotation = mTarget.Rotation.Y;
Matrix rotationMatrix = Matrix.CreateRotationY(targetRotation);

Vector3 transformedOffset = Vector3.Transform(offset, rotationMatrix);

// Calculate the new position and look at vectors
Vector3 targetPosition = mTarget.Position;
mLookAt = targetPosition;

mPosition = targetPosition + transformedOffset;

EDIT

All other matrices are calculate elsewhere in my code and are correct, so far as I understand. Full code samples can be found in the below links:

TrackingCamera
GameModel
SandboxGame

sentences:
How can I simulate physics on my curved LED strip? I have a LED strip with 300 LEDs that I can control one by one:

https://github.com/cipold/pyledstrip

You can think of them as Adafruit NeoPixels:

https://www.adafruit.com/category/168

I have code to detect the physical positions of all LEDs using a camera and generate an x/y heightmap:

https://github.com/cipold/pyledstrip-detector

There is some experimental code to make use of the heightmap and let pixels race along the strip like on a rollercoaster:

https://github.com/Pixe1/pyledstrip-particles
Video: http://mnagel.net/oneshot/2018-03-02/particle.mp4/975a194be7cc6fc8/particle.mp4

The "physics engine" within that code is very ad-hoc, however. I want to rewrite it into something that more explicitly encodes the physical laws of classical/Newtonian mechanics.

I can easily simulate particles with mass, position, velocity (acceleration/gravity/forces). With multiple particles and gravity between them, I would end up with some kind of solar system. Or with constant overall gravity, one particle would fall down in a straight line, accelerating all the time.

What I really want is "global gravity" but restrict the particles to move along the path dictated by the LED strip/heightmap of waypoints (one degree of freedom along that path). How can I adequately model this restriction with formulas that are still reasonably physically accurate?

sentences:
Unity3D: Multiple OnTriggerEnters are called before the first one could finish and destroy the object I'm working on a projectile which explodes when it reaches a destructible object and damages its voxels. (The projectile is a trigger)

But the problem is that I use raycasting in OnTriggerEnter which makes it slow to finish. Which lets multiple OnTriggerEnter to be called before it could be finally destroyed.

I fixed it by having a flag which lets only one call to be executed. But it feels a bit hacky, so I decided to ask you, maybe you have some better solutions.

void OnTriggerEnter(Collider collider)
{
    if (!hit && LayerMask.LayerToName(collider.gameObject.layer) == "Destructible")
    {
        hit = true;
        DoImpact();
        Destroy(gameObject);
    }
}

void DoImpact()
{
    //Do ~1 SphereCast
    RaycastHit[] hits = Physics.SphereCastAll(transform.position, ExplosionRange, transform.forward, 0.0001f, 1 << LayerMask.NameToLayer("Destructible"));
    //Iterate through voxels
    foreach(var hit in hits)
    {
        //the parent object which manages its voxels
        var destructible = FindDestructibleParent(hit.transform);
        //Make some damage to that voxel based on the projectile, the voxel, and some "whole container/parent object properties"
        destructible.TakeDamage(this, hit.transform.gameObject);
    }
}

sentences:
Moving a body in a specific direction using XNA with Farseer Physics I have a custom polygon attached to a body, which looks like this:

What I am trying to accomplish is getting the body to move according to wherever the tip of the body is. So far this is what I've tried:

        if (ks.IsKeyDown(Keys.Up))
        {
            body.ApplyForce(new Vector2(0, -20),body.GetLocalPoint(new Vector2(0,0)));

        }
        if (ks.IsKeyDown(Keys.Left))
        {
            body.ApplyTorque(-500);
        }
        if (ks.IsKeyDown(Keys.Right))
        {
            body.ApplyTorque(500);
        }

The body rotates fine - but when I try making the body accelerate according to the tip of the body - assuming I have specified the tip correctly(I am pretty sure I haven't), it just spins around, as if I have applied Torque to it. Can anyone point me in the right direction of how to fix this problem?

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: How to get a reflex edge on a non-convex mesh I am trying to implement a convex decomposition and I need to find the convex vertex on a mesh. Is there a algorithm that I can use to find the convex vertex on a mesh.

sentences: GLFW window becomes unresponsive when asking for input! I am trying to write a simple C++ game using OpenGL. In my render loop i ask for text based input from the user but this causes the GLFW window to become unresponsive. I suspect that this happens because the window does not like it when the main thread is paused from std::cin so it behaves weirdly. If i remove the input prompt the window behaves perfectly. Can someone confirm if this is the case and what workarounds are there to fix it?

sentences:
Finding break in voxel grid (3D array) I am working at dynamic voxel engine in Unity (something like Space Engineers) where player can create object from voxels, push them, damage and split in to other object.

I store all data in 3D array, 1 mean voxel, 0 mean empty node.

So I looking for solution to break object (array). For example when I remove enough voxels object should split in to two.

00000000            00000    0000
01110110   ====>    01110    0110
01110110            01110    0110
00000000            00000    0000

In 2D example it should split like that.

I try to use BFS search but it not fast enough ;(. It works fine for small grids like 5x5x5, when I creat 5x5x50 grid it works few seconds before break arrays.

My algorithm:
1) First find empty node
2) When you find empty node start BFS from that node, collect all not empty nodes, when you cant find not empty node finish.

If break exist it will collect only one part of array so it find break, if there is no break it will return whole array.

The problem is speed of it ;/ How to make it faster?

sentences:
How to change the Android NDK jni calls dynamically? Some people are using NativeActivity for working with Android projects exclusively in C++, but this also carries some disadvantages, so I, like many others, decided that I'd use instead a Java glue code; just a single Java file wrapping all things I need from C++, where pretty much everything runs.

With this said, as far as I know, using this Java code forces me to implement the native function calls in Java, where the Java calls a function that is actually called within the C++ part of the project, with the JNI.

In C++, the native function being called has a prototype like this:

JNIEXPORT void Java_com_package_name_nativeTouchDown( JNIEnv*  env, jobject thiz, jfloat x, jfloat y );

My problem is that I started working with scripts exclusively and would like to find a way to not having to recompile the C++ code anymore. So when I want to make a new project, I just copy-paste my C++ compiled code and change the scripts and be allowed to change the package name of the app without any recompilation.

Is this possible somehow? At the point I am at, I simply have to recompile my C++ to conform to a new package name (the one in the format com.company.game). Can't I make C++ fully abstracted from this package name or change it dynamically?

sentences:
Calculating a child object's Position, Rotation and Scale values? I am making my own game editor, but have encountered the following problem:

I have two objects, A and B.

A's initial values:

Position: (3,3,3), Rotation: (45,10,0), Scale(1,2,2.5)

B's initial values:

Position: (1,1,1), Rotation: (10,34,18), Scale(1.5,2,1)

If I now make B a child of A, I need to re-calculate the B's Position, Rotation and Scale relative to A such that it maintains its current position, rotation and scale in world coordinates. So B's position would now be (-2, -2, -2) since now A is its center and (-2, -2, -2) will keep B in the same position.

I think I got the Position and scale figured out, but not rotation.

So I opened Unity and ran the same example and I noticed that when making a child object, the child object did not move at all. but had its Position, Rotation and Scale values changed relative to the parent.

For example:

Unity (Parent Object "A"):

Position: (0,0,0)
Rotation: (45,10,0)
Scale: (1,1,1)

Unity (Child Object "B"):

Position: (0,0,0)
Rotation: (0,0,0)
Scale: (1,1,1)

When B becomes a child of A, it's rotation values become:

X: -44.13605
Y: -14.00195
Z: 9.851074

If I plug the same rotation values into the B object in my editor, the object does not move at all.

How did Unity arrive at those rotation values for the child? What are the calculations?

If you can put all the equations for the Position, Rotation or Scale then I can double check I am doing it correctly but the Rotation is what I really need.

sentences:
rendering rolling hills I want to render very pretty smooth undulating hills.  There are objects snuggled between these hills, so I can't really use naive bump-mapping.

I am currently rendering using a very detailed mesh that I generate myself.  Its a lot of very small triangles.

Are there other approaches?  What is the current viability of displacement mapping, for example?

I would like to run on mainstream hardware, including integrated graphics, and possibly even one day across to tablets and such.

sentences:
Using points to unlock next scene in Unity Below is my code and I'm a beginning game designer trying to make my first game for art school teehee! :)

I'm not sure how to unlock the next level with a scene I've already made called Rust_Room

Any ideas? :o
I also attached the error codes I'm getting!

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

public class Example
{
    HUD hud;
    int points;

    const int ScorePrefix = "Score:";
    int score;

    public void LoadLevel()
    {
        if ("Score==45")
        // load the nextlevel
        SceneManager.LoadScene(SceneManager.GetSceneByName(Rust_Room)().buildIndex + 1);

    }
}

sentences:
How to simulate car drivetrain (in Unity)? One of my hobby projects involves cars. Up until now I had a quick and dirty "one class" implementation of engine+gearbox+wheels, but I thought that this is ugly, and I want to go a bit more realistic. Sadly I couldn't find much on Google (either wrong search terms or there really isn't anything that is what I want). It seems like

Setup in scene: Four wheelcolliders attached to a big boxcollider.

Things that I want in the system:

Separate classes for engine, clutch, gearbox, differential and wheels (and whatever else does stuff with torque). Throttlecontrol with revlimiter (works!), steering (works too!), brakes (not yet made, but also not very complex and will likely work).

First thing I tried:

Mainly this rotates around how I tell the engine that the wheels are actually using or giving (engine braking) power to the system. so first I created all the classes each with their own updatemethod (not called directly by mainloop, but from a fixedupdate of a controllerclass). updatemethod of engine calculates engine torque from throttle, torque curve (animation curve) and engine friction. This is then used to speed up the virtual crankshaft which has its own inertia. But before speeding up the shaft, I decided to put some feedback torques on the engine torque, so if the wheels can't keep up, the engine can't speed up, or even slows down. Such a feedback torque is added for example by the gearbox, which in turn also has feedback forces from the differential and with that the wheels. The wheels calculate the torque needed to spin up to the speed of the shaft coming out of the gearbox and then it propagates all back to the engine over a few updates.

Problem was, the torque feedback didn't really do engine braking, but catapulted it to several million RPM in a split second. Dividing the feedback torque by 1000 did work, but then the car didn't move at all. So this is fail number 1.

Fail number 2:

Okay screw this, I thought, and tidied up all the stuff. This doesn't use several updatemethod anymore, but recursive updating. Basically I call update on the engine, which in turn then calculates what torque it has available. With that it tells the transmission that it has t torques at r RPMs. The gearbox changes the values according to the current gear and then again puts the values into the differential. The differential SHOULD split the torque between its outputs. To do this I calculate how much torque the output (in this case wheels) would need to speed up to r RPMs. I do this for each output and make a list of it for each output. I also save the sum of these values. With this I can get a value of 0...1 for each output, that determines how much torque each output gets in its updatemethod. Its basically an intelligent differential that gives the output which needs more torque, more torque. I guess modeling a real differential would involve some more complex stuff. Now the torque is at the wheels and gets put into the motorTorque property of the wheelcollider. Up until here it works. If I throttle up and then let go of it the wheels start turning backwards. It's basically another feedbackloop just like with the first try. So also fail

And fail 3:

Instead of returning the torque that's left, I tried backpropagating the RPMs to the engine instead. So I apply torque, and get RPMs back. But again everything tries to move the car in the opposite direction that I want it to go.

Here is where I'm out of ideas. I want a relatively realistic drivetrain, that is modular and can do enginebraking. A bought asset will most probably not solve my problem, and I also want to understand how it works, and not just use it.

Does anybody have experience with how to properly model a drivetrain?

If I forgot to mention something, please ask.

sentences: Create a 2d circular maze How can I create a 2d procedurally generated circular maze like the following picture:

sentences:
Converting array to shape drawn: Pygame screen=pygame.display.set_mode((500, 700))
Shape=['.....',
       '..O..',
       '.OOO.',
       '.....',
       '.....']
ShapeProperites={'x': 250,
                 'y': 50,
                 'Color':Red}

How can I convert this array in Pygame to a shape drawn on a screen with the properties from the dictionary? The list is meant to represent a tetromino. The 0's should be drawn as squares on the screen.

sentences: HTML5 realtime MMO games, should I do server side physics update or client side? I am using socket.io and HTML 5 canvas to build a MMO game as a practice. I finished the client side first and currently I am working on server side. Apparently the position/physics update is on client side for now. But I am facing the decision of moving the position update logic and physics update to the server or leaving them on the client side. If I put the update on the server side I will pass the mousemove/keystrokes to the server. But if I update positions only on clients side I will pass the positinos/directions/speed to the server. Which approach is better in my case?

sentences: Best (Most Popular?) Image Format For Texturing Okay, so I am using C++ with OpenGL, and I am going to create a loader to load in textures for my 3D game. (But the textures are 2D). I want the option of transparency, even if I decide not to use it. I need decent quality, although it doesn't have to be top notch. What do you guys suggest for format (PNG, TGA, etc.). Also, maybe make it something that is easy to create a loader for (I'm not going to use an already created one.). And also, if you have any links/tips to help out with the loader, that would be appreciated.

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:
How can I load a level using a sound file? [JAVA] I'm trying to load a level from a music file (mp3, midi, etc, I'm not picky) for a rhythm-based game. I must be searching in all the wrong places because I can't seem to find any help on this topic.

(I am using Eclipse Luna, AndEngine, Android SDK Tools 20.0.5 and ADT 23.0.4)

My plan was to stream the music file at run-time and create objects when certain pitches, etc are reached, but I have no idea how to do this in Java? Are there any libraries, etc I should be using or is this just not possible?

sentences:
Why is my player not giving a knock back when it stays at the right side of the enemy? So, I have this problem I am facing, for some reason my player does not get a knockback when it stays at the right side of the enemy but when it stays at the left side it gives a knockback. What's the problem?

PLAYER MOVEMENT

void Movement()
    {

        //THIS IS FOR WALKING
        if (isControlesEnabled)
        {
            moveInput = Input.GetAxisRaw("Horizontal") * runSpeed;
            myBody.velocity = new Vector2(moveInput, myBody.velocity.y);
        }

PLAYER KNOCKBACK

private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Enemy"))
        {
            health -= 0;

            if (health <= 0)
            {
                gameObject.SetActive(false);
            }
            else
            {
                ContactPoint2D contactPoint = collision.GetContact(0);
                Vector2 playerPosition = transform.position;
                Vector2 dir = contactPoint.point - playerPosition;

                dir = -dir.normalized;

                myBody.velocity = new Vector2(0, 0);
                myBody.inertia = 0;

                isControlesEnabled = false;
                Invoke("EnablePlayerControles", controlesDisablePeriod);

                myBody.AddForce(dir * knockBackForce, knockBackForceMode);
            }
        }
    }

    private void EnablePlayerControles()
    {
       isControlesEnabled = true;
    }

sentences:
ECS multiple materials per mesh (sub-mesh) In my toy engine I currently have a MeshComponent and a MaterialComponent.
psuedo:
struct MeshComponent
{
    Ptr<Mesh> Mesh;
};

struct MaterialComponent
{
    Ptr<Texture> DiffuseTexture;
    Ptr<Texture> NormalsTexture;
};

This is fine, for when a single mesh uses a single material.
pseudo:
Entity entity = CreateEntity();
AddComponentToEntity(entity, meshComponent);
AddComponentToEntity(entity, materialComponent);

But now I want to consider the concept of "sub-meshes" (regions of a mesh that are rendered with a different material, but each sub-mesh shares the parent vertex list). I don't want my Mesh class to know anything about materials, and vice-versa.
What good approaches are there for "joining" multiple MaterialComponent to a single MeshComponent?
I've considered having an entity for each sub-mesh, but that seems brittle (not to mention overkill, as I'm only interested in MaterialComponents).
pseudo:
struct MeshComponent
{
    Ptr<Mesh> Mesh;
    std::vector<Entity> SubMeshEntities; // Would need to ensure the indices match those of the sub-meshes
};

What other approaches are there?

sentences:
Why would one have "waves" in each stage of a tower defense game? For example, in Plants vs Zombies, the zombies come in waves.  If I recall, there's always at least two waves. The first and easier wave and then when you get 90% through the stage there's a "final wave" which is shorter, harder, and has a bunch of zombies all come at once.

My question is, why would a game decide to announce when you change from one wave to the next?  They could have just let the level progress from start to finish without this if they wanted to.

Does this make the game more fun for some reason?  Where can I learn more about this technique (eg: does it have a name)?

sentences:
Diversified Game Object List Recently I started creating a game in java to hone my rusty java (I work primarily with cpp) and because I thought it to be a neat idea. To better illustrate the problem, let me explain a part of the game. The details aside, the game is in essence a dungeon builder and the problem pertains to the blocks you place down to create the maze adventurers have to travel through. Each block is a corridor and on each wall/floor/ceiling of a block you can place objects such as traps etc. However, while finishing up the game engine I realized I still lacked a list for blocks/objects that are special. Blocks or items that need a special animation (some extend spikes, some shoot fire, some contain a chest with inventory, etc). They're hard to bring together in one class and as we all know they can't be together in one list with different classes unless we want code-bloating. So my question is, what is the most efficient way to make collection of diversified game objects and how do other games do it?

Presently I have the following methods thought out.

I reduce all objects to instances of one class. They all fit in one list. However, to induce special methods I need a long list of methods that each do something else. Frankly, this method is inefficient, unpleasant and unpractical to work with.
I reduce all object to instances of one class. They all fit in one list. However, they each have an ID of a special action. If the need arises the ID gets compared with another list that's much shorter in length and uses generics or reflection to store the different effect. If it needs a special action it simply activates the effect (such as fire plume) on the given vector. The problem with this is that it does not allow for direct manipulation of the object such as a block that moves out to squash adventurers. Or if it could, it would be messy code, unnecessary throughput of code etc. I'd rather avoid it.
I make a list of the base class/interface and add the different child classes to it. Each child class can thus have a different implementation. However, to access it, I need to know to use reflection and for that I need to know the initial class, which, in many cases, I don't since I want a dynamic system. The result is that I need to store the child class name in the 'block' parent class and then when the need arises, use that name to reflect the new class. Once again, it is inefficient and far too slow.
I create a list of the block class and access it every time a generic block needs to be checked. However, if a creature/person walks over a tile it checks if the child class name in the block class is empty. If not, convert it to that class and execute the special function. This seems the best option as it gives the least code-bloating, is the most efficient, etc. However, it still needs to reflect and convert every time a creature goes onto a special block.
I create an event driven list in which each block instance has his own special event that links to a certain animation. This is very tedious, very inefficient and because it is so detached it is once again difficult to animate the basic block.
I use generics. Sadly, this causes far too much code-bloating and the accessing of the classes themselves gets difficult and messy.
I create a huge switch method and each block instance has a number. The number corresponds with the correct animation in the switch it needs to execute. I don't think I need to say why I don't want to do this.

And there are a few more, but each of them is still as inefficient as the next. Furthermore, every time I look around this site or another people say "use a base interface/class in a list" however they never say what the most efficient way is to get the class out of the list again. Am I missing something obvious? How should I tackle this?

sentences:
XNA realistic water: How to clip along a mesh instead of a plane I hope you can help me with the following problem:

I'm developing a 3d game (in XNA) with an ocean. I want it to look semi-realistic.
So far, I'm rendering 4 things:

The ocean floor (terrain) on the view matrix (refraction)
The terrain above water on the mirrored view matrix (reflection)
The terrain above water on the view matrix (actual terrain)
The water, which is simply a plane, using the refraction and reflection rendertargets, the fresnel term, and a normal map to give the impression of small waves.

Instead of a flat plane, I want to render the water on a mesh, to get some actual waves going. This is where I've been stuck for a while now. It's quite simple to clip the terrain along that plane, but is it possible to clip a mesh along another mesh? Or am I going about this the wrong way?

sentences:
How to make Scriptable Objects derive from other Gameobejcts? I encountered a problem where I want to make a Scriptable Object that derives from another class, but C# does not support multiple inheritance. Further, I do not think it would not make sense to make interfaces for this example. There is a lot of duplicate code within methods that only an abstract class could contain implementations of.

Basically, I want an abstract class that models "anything that can take a turn." I call it a TurnTakeable. But I also want the TurnTakeable to be split into friend and foe derived types, as the two are slightly different. Yet they mostly have the same behavior.

Is there a workaround, or do I have to make an interface? :(

sentences:
Why doesn't MoveBy work in this example? I'd like to run an action on a sprite using the MoveBy action. After lots of attempts, I can't achieve the goal... I have issues with the MoveBy in 2 different projects, so maybe I'm missing something in the setup... But I can't figure what!

The instruction is like this:

this.platform1Sprite.runAction(cc.MoveBy.create(1, cc.p(200, 0)));

I don't get any error, simply it doesn't work. platform1Sprite is a Sprite. But even with a LabelTTF it doesn't work:

var MoveToAction = cc.MoveTo.create(2.5, cc.p(size.width / 2, size.height / 2));
this.creditLabel.runAction(MoveToAction);

For this last snippet, you can view my complete code here: http://pastebin.com/fGbW4LLH.

The code I linked is somehow similar to the helloHTML5World official example, line 112 has the runAction method applied to a LabelTTF. The official example works, mine doesn't... I can't understand what's the difference!

sentences:
Performance issues with different types of uniform buffer I've tested different buffer layouts, because I'm confused about some performance issues. That are my test buffer (OpenGL 4.1, GLSL 410, GT 750M, MacBook Pro):

Test #1: Using fixed struct buffer with unused variables inside

struct SPerFrameUniformBufferVS
{
    vec4 m_UnusedButPlaned1;
    vec4 m_SometimesInUse2;
    vec4 m_UnusedButPlaned3;
    vec4 m_Used4;
    mat4 m_Used5;
    mat4 m_Used6;
};

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    SPerFrameUniformBufferVS m_PerFrameUniformBufferVS;
};

Test #2: Same buffer without unused variables

struct SPerFrameUniformBufferVS
{
    vec4 m_Used4;
    mat4 m_Used5;
    mat4 m_Used6;
};

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    SPerFrameUniformBufferVS m_PerFrameUniformBufferVS;
};

Test #3: Using fixed buffer with unused variables inside

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    vec4 m_UnusedButPlaned1VS;
    vec4 m_SometimesInUse2VS;
    vec4 m_UnusedButPlaned3VS;
    vec4 m_Used4VS;
    mat4 m_Used5VS;
    mat4 m_Used6VS;
};

Test #4: Same buffer without unused variables

layout(row_major, std140) uniform UPerFrameUniformBufferVS
{
    vec4 m_Used4VS;
    mat4 m_Used5VS;
    mat4 m_Used6VS;
};

In my case i've the following performance results:

Test #1: 40 FPS
Test #2: 55 FPS
Test #3: 46 FPS
Test #4: >60 FPS

My application do 1558 draw and 2341 glGetUniformBlockIndex calls. glGetUniformBlockIndex seems to be the bottle neck, because it is much higher in Test #1 and Test #3.

sentences:
How to read a custom map format I am trying to create a custom map format for my own little 2D RPG, so my question is rather how do I manage reading and creating a custom map format properly and flexible. First off, I am writing my code in Java. The idea was to have a class called 'TileMap'. This class defines a 2-dimensional integer - array where all my entities are stored ( I'm using an entity-system to realize my game ). I also want to save and parse some information about the size of the map before the actual reading process happens. The map file should look much like this:

#This is a test map
width=4
height=3
layercount=1
tilesize=32

[1;0;0;0]
[23;1;0;0]
[5;0;1;0]

where layercount is the number of layers the z-dimension offers. and tilesize is the size of every tile in pixels. Entities are defined in between the brackets. The pattern goes: [entity_id;x_pos;y_pos;z_pos]. I already wrote the code to parse a file like this but its not very flexible because you just have to put one tiny whitespace in front of the square brackets and the map can't load up.
I just need some few helpful tips to do this in a flexible way. Can anybody help me out?

sentences:
How do I find the face of an object? I'm working on a build mode but the thing of it is the player is able to deform meshes. Part of my build system includes having "snap" points thus I need to be able to find the face and recenter the snap point on deformed meshes.

So, how do I find the face of an object and the center of said face? Also how would I find the center?

To clarify: The end goal is to keep the snap point positioned properly with the face that has been deformed/manipulated.

sentences:
Tips on how to notify a user of new features in your game I have noticed a problem when releasing new features for a game that I wrote for Android and published on Google Play Store. Because my game is "stage-based"  - and not a game like Hay Day, for example, where users will just go into the game every day since it can't really be finished - my users are not aware of new features that I release for the game.

For example, if I publish a new version of my game and it contains a couple new stages, most of their devices will just auto-update the game and they don't even notice this and think to check out what's new. So this is why an approach like popping open a dialog that showcases the new feature(s) when they open the game for the first time after the update was done is not really sufficient.

I am looking for some tips on an approach that will draw my users back into the game and then they could read more detail about new features on such a dialog. I was thinking of something like a notification that tells them to check out the new features after an update is done but I am not sure if this is a good idea. Any suggestions to help me solve this problem would be awesome.

sentences: Do I need to use a game engine to make a simple game function on other platforms? I'm a complete beginner really enjoying learning how to code (currently in Python) and my first games will be very simple, mostly text based, but I'd like them to run on friends' phones and computers on various platforms, including windows, linux, mac and android. Is this easy to do without using a game engine, or should I use, say, Unity? If I use Unity will I still be learning to program in code, or is it silly to use a game engine for a game that is simple, like a 'choose your own adventure' game or, later, an ascii roguelike? Thanks.

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:
how can you build with libTcod on OsX? I've had problems building on libtcod on OsX but i'm not the only one (see http://doryen.eptalys.net/forum/index.php?topic=621.0) but the beautiful RL Brogue uses Tcod and even builds on a Mac (https://sites.google.com/site/broguegame/).

anyone else get to developing on OsX with libtcod?  hopefully with Make, not XCode tho...

sentences:
Is there a game not using meshes for models? Traditionally, models consist of lots of vertices connected by triangles. That forces the use of a high amount of vertices for detailed  organic shapes or makes models kind of blocky. Even though polygon models can be smoothed by subdivision algorithms, this slow, not that exact or still needs a lot of vertices.

Instead, models could be represented by 3 dimensional splines, bezier patches, nurbs or something similar. This way, we would gain perfectly detailed models instead of blocky one with much less vertices. I am not an expert but I assume that a spline could be even rendered faster than its polygon representation. To make the such mathematically perfect shapes more detailed, we could use displacement mapping.

The only big challenge I can see is projecting those splines in the correct perspective. We can simply multiply all vertices with a projection matrix since they are not connected by straight lines. Instead the parameters of a curve must be modified to fit another perspective. I am not sure if there are mathematical straight forward ways to do this.

Are there games using the latter approach?

sentences:
Find a partner to build a game with Possible Duplicate:
  How do I find artists to work on my game?

I have started working on a spacesim game but my art is terrible...

Is there a website where I could find people who might be interested in collaborating on a game with me?

sentences:
How to transform Capsule Component in UE4? The collision of the character with the environment only works correctly (in the eyes) when I use the original skeletal mesh.

I tested it in the most varied sizes and it worked perfectly.

It turns out that when I import any 3D object (FBX of Blender), it does not work properly (though the UE4 says that in the import it makes several adjustments).

I realized that the problem is because of the capsule component, which is responsible for detecting the character's collision with the environment. So at first I would like to know how to increase its size and make modifications.

Links that I researched and that helped me in some way:

https://answers.unrealengine.com/questions/853084/is-it-possible-to-transform-the-capsule-component.html

https://answers.unrealengine.com/questions/200546/change-the-capsule-component.html

https://answers.unrealengine.com/questions/465122/how-to-change-character-capsule-component-location.html

sentences:
LibGDX - Getting Tile Map Layers Problem While following a tutorial with LibGDX, I am working with tile maps.

This is the method that I'm using:

tilemap.getLayers().get("Collision Layer");

or

tilemap.getLayers().get(1); //1 is the second layer, the collision layer

The problem is, is that when I try to get a certain layer from the tile map, it return a null pointer error like so:

  Exception in thread "LWJGL Application" java.lang.NullPointerException at com.mytut.game.Player.Init(Player.java:25)
      at com.mytut.game.MyTutGame.create(MyTutGame.java:70)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:147)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)

I have tried various ways of getting the layer but none of them seem to work.

Here's an image of my tile map in the Tiled map editor:

sentences:
Server and client showing different spawned object - How do I unify them? I have overridden OnServerAddPlayer and put some custom logic in place to set the rendered prefabs color. Something like this:

    var playerCount = NetworkServer.connections.Count;

    if(playerCount == 1)
    {
        player.GetComponentInChildren<Renderer>().material.color = Color.green;
    }

When I test the code with two application instances, the server host shows the expect result (first character is green, second is red) but the client instance shows both characters as red (the default).

Is my logic for setting the colour incorrect? or do I need to do something special to ensure that the my clients will see the colour I have set for the characters on the server?

sentences:
What is a good method for collision detection, where I check a collision, instead of all collisions The collision system for my game currently works fine; it lets me test a collision with an entity or specified rectangle, but that's not enough. I use to use Game Maker, and it had collision events that were simple. What I want to do is not check collision with everything, but check for a collision with everything.

Using the former method would probably be really expensive, checking all other objects, per object, per frame. What is a good method for collision detection, where if I am colliding with something, I get it's class, and can decide what to do with it?

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:
Instantiate works fine in Editor and does not work after building game Here is the situation, In my project everything works fine. After I build the game for windows, the prefab does not instantiate. I don't know which part I missed.
This is how I load the prefab from Resources folder
private void Awake()
{
    areaButtonPrefab = Resources.Load<GameObject>("Prefabs/AreaButton1");
}

And this is how I instantiate prefab for each data in a List
public void SetAreaToUI()
{
    foreach (var j in areaList)
    {
        cloneItem = Instantiate(areaButtonPrefab, originalRect.position, new Quaternion(0, 0, 0, 0), rect);
        TMP_Text text = cloneItem.GetComponentInChildren<TMP_Text>();
        AreaButtonData buttData = cloneItem.GetComponent<AreaButtonData>();
        buttData.area = j;
        text.text = j.areaName;
        cloneItem.SetActive(true);
        cloneItems.Add(cloneItem);
     }
}

sentences:
Why 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:
How to make difficulty progression in my endless-runner game? I want to further develop this game I created for a game jam. Currently spiders chase squirrels with the same speed. Tree branches are randomly generated. Even if you perfectly time your jumps the spiders will eventually catch you. Squirrels are able to pick up randomly generated acorns to throw at the spiders knocking them back.

I want to implement some kind of difficulty progression. Any ideas are appreciated. My main idea is to accelerate the spiders, but the squirrels can't jump any quicker because of physics. They are propelled by one of two jump strengths, and gravity.

The question is: Would it be a good idea to increase the jump high and/or gravity accordingly to the speed of the spiders? (allowing the player to continue to evade the spiders)

Please take into consideration that other obstacles will be added; for example a bat attacking the squirrel from a hole in the tree trunk.

sentences:
How to search through large numbers of discrete objects that interact with each other, like Minecraft blocks? Imagine you had a world like Minecraft, but wanted to bake in some sort of physics (okay, I was playing minetest actually).

For example, blocks under too much pressure might break, limiting how many blocks can be stacked on top of one another.  I see one approach to this:

Systematically check each block.  See if there is a block on top of that, a block on top of that, ect.  Then, determine the pressure on the block that you just started with.  Do this for each and every block.

I also imagine you could somehow check each block, then have it modify the properties of the blocks around it.  If all force was from top to bottom,  you could just start at the top.  But if you want to have a "net force" (so unsupported blocks accelerate) I have no idea how this could be implemented. For instance, three blocks are floating in mid air.

How can I solve this class of problem?

sentences: Can I release Kinect based games? I've been reading up some hacks on Kinect development to work around the fact that there is no official SDK from Microsoft. Even if we do manage to create a game, can we distribute it through the XBox marketplace? Or will it cause any issues?

sentences:
Camera view/projection issue I made a simple OpenGL program but I can figure out why the camera is not working, here it's a little fragment of the Camera class:

public Matrix4f getView() { // initializes the view matrix
    return new Matrix4f().lookAt(
            new Vector3f(0f, 0f, 1f), // camera position at 0,0,1
            new Vector3f(0f, 0f, 0f), // camera target at 0,0,0
            new Vector3f(0f, 1f, 0f)); // up axis set to "worldUp" (0,1,0)
}

public Matrix4f getProjection() {
    return new Matrix4f().perspective(
            (float) Math.toRadians(fieldOfView), // the fov has a value between 0f and 180f, by default I set it to 90°
            viewportAspectRatio, // the aspect ratio is equal to 1024 / 960 (screen height / screen width)... even if I've not understood what is it...
            0.1f, 1000f); // I've not really understood what near and far planes are...
}

public Matrix4f getMatrix() { // with this function I obtain the final camera matrix
    return getView().mul(getProjection());
}

And it's how I handle the camera Matrix in GLSL, created using camera.getMatrix():

gl_Position = camera * model * vec4(position, 1.0);

Without the camera all is fine: here's the program running using gl_Position = model * vec4(position, 1.0);:

(Yeah, it's a cube)

But using the camera in the way I showed you before, increasing the FOV, I get this:

Could anyone look at my code and tell me where I'm wrong? I would be really happy... D:

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:
How do I make games that interact with desktop windows? I want to know how games like desktop pet games like Sheep work, so I can make my own:

In this game, the creatures are being rendered directly to the desktop or over top other windows. How do they accomplish this task? How are they getting the window information? Do they take and process screenshots?

sentences:
LibGDX: creating actor conformed by other actors I am making my custom actor class, made up by 3 actors(oneProgressBar, one Label and one TextButton), because I will be using this many times, so it's not a good idea to create 3 of that actors when I can create one that can contain them. So I am making my class:

public class MyActor extends Actor {
ProgressBar bar;
Label nameLabel;
TextButton button;
public MyActor(String name, Skin skin, float progress){
    nameLabel = new Label(name, skin);
    button = new TextButton("Buy", skin);
    bar = new ProgressBar(0f,5f,progress,false,skin);
}

@Override
public void act(float delta) {
    super.act(delta);
    bar.setBounds(getX(), getTop()-getHeight() / 3f, getWidth(), getHeight() / 3f);
    nameLabel.setBounds(getX(), getY()+getHeight() / 3f, getWidth(), getHeight() / 3f);
    button.setBounds(getX(), getY(), getWidth(), getHeight() / 3f);
}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    bar.draw(batch, parentAlpha);
    nameLabel.draw(batch, parentAlpha);
    button.draw(batch,parentAlpha);
}

}

So in my game, I add my actor to the Stage using a table:

Table table = new Table();
table.debug();
MyActor actor = new MyActor("whatever",mySkin,1f);
table.add(actor).size(myWidth,myHeight);

The actor is drawn in the correct place(I know because of the debug lines), but the 3 actor are drawn in the 0,0 coordinates, what am I doing wrong? do I need to override another method?

sentences:
Camera horizontal shift I want stretch my game on two monitors. I use Unity 5.3. This version support the multi-display. But, one camera = one monitor.
So, have two perspective cameras (at the same position).  I search a "camera horizontal shift" option for create stretch effect. I don't find this option. Is-there a trick ? A solution ?

sentences:
Problems Animating Texture in OpenGL I'm trying to animate a texture to scroll a static screen for a television, however I'm having some issues.

Just translating within the texture matrix animates all textures in the scene which is obviously a problem. However when trying to push and pop the matrix the texture matrix seems to keep getting reset. So rather than a scrolling texture, the texture just stays at the same translation.

Here's the code snippet.

glMatrixMode(GL_TEXTURE);

glPushMatrix();

glTranslatef(0, 0.03 * dt, 0);

glBindTexture(GL_TEXTURE_2D, staticTexture);

RepeatTexture();

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 0.205, 0.461);
glTexCoord2f(0, 1);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 1.204, 0.461);
glTexCoord2f(1, 1);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 1.204, 0.461);
glTexCoord2f(1, 0);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 0.205, 0.461);
glEnd();

glPopMatrix();

glMatrixMode(GL_MODELVIEW);

sentences:
Confusion with Libgdx UI I've started with Libgdx and am currently stumbling about trying to understand how to set up the interface.  I have generated the base projects in Eclipse ( < proj-name >,< proj-name >-android, < proj-name >-desktop, < proj-name >-html), and can get the program to display a simple background, play a looping sound file, and draw a tank.  I have been having some problems implementing the UI though.

I want to make a collapsible interface bar at the bottom of the screen that would contain buttons for movement, and selecting weapons.  I'm confused since there appears to be several ways of doing this and the documentation (or tutorials explaining it) tend to be obsolete.  How would one go about this?  Use a stage for the bar and actors for the widgets?  I'm a little lost on this.

sentences:
How to implement a stack of game states in C++ I'm new to C++ and as a college proyect I'm building a 2D platformer with some classmates, I recently read that it's a good idea to have a stack of gamestates instead of a single global variable with the game state (which is what I have now) but I'm not sure how to do it.

Currently this is my implementation:

class GameState
{
    public:
        virtual ~GameState(){};
        virtual void handle_events() = 0;
        virtual void logic() = 0;
        virtual void render() = 0;
};

class Menu : public GameState
{
    public:
        Menu();
        ~Menu();
        void handle_events();
        void logic();
        void render();
};

Then I have a global variable of type GameState:

GameState *currentState = NULL;

And in my Main I define the currentState and call it's methods:

int main(){
    currentState = new Menu();
    currentState.handle_events();
}

How can I implement a stack or something similar to go from that to something like this:

int main(){
    statesStack.push(new Menu());
    statesStack.getTop().handle_events();
}

sentences:
Hash Distance & Angle To Produce Unique Value I have many vertices drawn on my Unity3d C# application window (thousands). I am attempting to come up with a fast way to detect which vertex has been clicked.

My idea is to use a sorted list. The list will be ordered by a vector/vertices distance to (0,0,0):

List <KeyValuePair<double, GameObject>> vectorMap = new List <KeyValuePair<double, GameObject>>();

I use a binary search to order, search and add to the list.

Add/Insertion Method:

public void recordElementVertices(Element ele) {
    // Element is a Sub-Class of GameObject

    foreach (Vector3d v in ele.WorldVertices) {
        double distFromZero = Vector3d.Distance(Vector3d.zero, v);

        int index = -1;
        if (Algorithms.LowerBounds(vertexDistanceList, distFromZero, out index, DEF_PRECISION) != Algorithms.SearchResult.FOUND_TARGET)
            vertexDistanceList.Insert(index, new KeyValuePair<double, List<GameObject>>(distFromZero, new List<GameObject>()));

        vertexDistanceList[index].Value.Add (ele.gameObject);
    }
}

Hit Test (Search) Method:

public List<GameObject> hits(Vector3d mousePos) {

    int     index           = -1;
    double  distFromZero    = Vector3d.Distance(Vector3d.zero, mousePos);

    // Binary search will search for an exact hit or find the closest vertex to the mouse pos
    if (Algorithms.BinarySearch(vertexDistanceList, distFromZero, out index, DEF_PRECISION) == Algorithms.SearchResult.FAIL || index < 0)
        return null;

    return vertexDistanceList[index].Value; // return all game objects that occupies that vector position
}

This all works nicely and is fast but there is a major flaw. The algorithm doesn't take into account the vertices angle from (0,0,0). So 2 points that are the exact same distance from (0,0,0) but have different angles will be considered the same vertex when they are not.

For example; these 2 points lie 5 metres from (0,0,0) but have different angles. My algorithm will consider these 2 points as occupying the same place in space when they are in a completely different position.

Do you have any suggestions how I can hash a distance and angle to produce a unique result that describes that point in space? Some simple like doing Distance ^ Angle could produce a unique result but they would also produce huge numbers. A restriction is that my list sorting algorithm requires that two points close to each other should produce a hash that is similar in order to find points close to the mouse position. Hope that makes sense.

I've heard about Locatily Sensitve Hashing but it looks like implementing this algorithm would be very tricky.

Any advice would be greatly appreciated.

sentences: How does one first draft a linear visual novel plot? I’m making a linear visual novel with partial interactivity that allows the player to influence small portions of the story, but I just want to know how one goes about drafting something like that. The interactivity feature allows you to build a relationship with some characters, this is what can change different parts of the story. Thing is that I have several other characters whose growth I would like to cover, but don’t know how.

sentences:
Identify a selected prefab rather than all of them I am trying to play a particle effect when an enemy is killed but it seems to play on a randomly selected one rather than the one that was hit. However the enemy that was hit still disappears and still add points to the score.

At the moment I have three scripts to carry this out (All have been shortened so I'm only showing the relevant code):

One which is attached to boxes that are thrown at enemies that detects if they have collided with an enemy prefab.

void OnCollisionEnter (Collision theCollision) {

        if (canProjectileKill == true) {
            // If the projectile hits any game object with the tag "Enemy" or "EnemyContainer".
            if (theCollision.gameObject.tag == "Enemy") {
                GameObject.Find("EnemyExplosion").GetComponent<enemyDeath>().ProjectileHasHitEnemy();
                // Destroy the projectile itself.
                Destroy (gameObject);
                // Destroy the game object that the projectile has collided with (E.g. the enemy).
                Destroy (theCollision.gameObject);
                GameObject.Find("Manager").GetComponent<projectileSpawner>().deleteProjectile();
            }
        }
    }

Another that is attached to the enemy prefabs which detects if they have been hit by a box.

void OnCollisionEnter (Collision theCollision) {
        if(theCollision.gameObject.tag == "Projectile") {
            GameObject.Find("EnemyExplosion").GetComponent<enemyDeath>().EnemyHasBeenHit();
        }
    }

I then run an if statement asking if both the box has hit the enemy prefab AND if the enemy prefab has been hit by the box in an attempt to identify a single prefab rather than all of them. However this still doesn't work.

    public bool HasProjectileHitEnemy;
    public bool HasEnemyBeenHitByProjectile;

    void Start () {
        gameObject.particleSystem.Stop();
        HasProjectileHitEnemy = false;
        HasEnemyBeenHitByProjectile = false;
    }

    public void ProjectileHasHitEnemy () {
        // From projectile.
        HasProjectileHitEnemy = true;
    }

    public void EnemyHasBeenHit () {
        // From enemy.
        HasEnemyBeenHitByProjectile = true;
        PlayParticleSystem();
    }

    public void PlayParticleSystem () {
        if (HasEnemyBeenHitByProjectile == true && HasProjectileHitEnemy == true) {
            gameObject.particleSystem.Play();
            HasProjectileHitEnemy = false;
            HasEnemyBeenHitByProjectile = false;
        }
    }
}

I am aware this is a long question but I have been stuck on this for over a week, so any help would be much appreciated. Thank you :)

sentences:
Where can I find a opengl pixel shader example for smooth SpotLight? I am using Ardor3D, and find the spotlight is quite bumpy. Anybody has a good pixel shader can smooth the edges of the spot light?

thanks,

sentences:
A more sophisticated ball-paddle collision algorithm for Breakout? I have a simple breakout game I'm working on. The collision code is solid; things bounce as they should and don't pass through things or do other funkiness, but the reflection is a bit simplistic. As a result, it's easy to get into a state where the ball gets stuck in a loop such that the last blocks cannot be hit without dying to break the loop.

Currently, the paddle collision code reflects the Y speed, and mirrors the X speed depending on what side of the paddle it hits:

        // Check for paddle collisions
        if ((m_ball.rect()).intersects(m_paddle.rect())) {
            double ballCenter = m_ball.rect().getX() + (m_ball.rect().getWidth()/2);
            double paddleCenter = m_paddle.rect().getX() + (m_paddle.rect().getWidth()/2);

            m_ball.setSpeedY(m_ball.speedY() * -1);

            if (ballCenter > paddleCenter) {
                m_ball.setSpeedX(Math.abs(m_ball.speedX()));
            } else {
                m_ball.setSpeedX(-Math.abs(m_ball.speedX()));
            }
        }

Is there any way I could make the algorithm more "interesting", and tighten up the control so the ball doesn't keep get stuck bouncing in the same square?

sentences: How do I import multiple animations into the same file in Unity? I have hit a major stump in my development: applying transitioning animations to the same model. I have learned how to do a single animation with keyframes, but have no clue on what to do with more than one. I tried importing different animations seperately and applying them to the same model, but it didn't work. How can I get past this stumbling block?

sentences:
Rotating a sprite with Pyglet without changing its X and Y I have code which rotates a sprite:

@window.event
def on_key_press(symbol, modifiers):
    print('Rotating')

    global player_sprite

    player_sprite.rotation += 1

    if player_sprite.rotation == 360:
        player_sprite.rotation = 0

However, this rotates the sprite in a manner I don't want: it changes its x and y position. I want it to remain in the same place -- it's a tank, and is not supposed to move when it turns. If, for instance, I do

player_sprite.rotation = 180

it not only faces the opposite direction, but is now far away from its original x and y coordinate.

How would I allow the sprite to rotate without changing its x and y?

Here's a link to my full code.

sentences:
Godot: Better Method to setting focus for buttons My problem
I am trying to set focus for a group of buttons with a keyboard or controller. Whereby if the user pushes up or down, a particular button will receive focus.
I already know that this can be achieved with arrays. I just want to know if there is anything better out there or even something default that can be set.
Edit:
I have found out that It is indeed automatic. I still do need to set focus for a button at _ready().

sentences:
How to generate Bayer matrix of arbitrary size? In ordered dithering Bayer matrix is used.

How is that matrix generated? What algorithm can be used to generate matrix of arbitrary size?

sentences:
How to make a map (game world) based on a real world place or city? As a disclaimer before my real question, I have little experience in game development, only basic Unity knowledge.

I noticed a lot of games are based on real world places and cities, for example GTA 5 on Los Angeles and Watch Dogs. What is the process of making such a virtual version of a real world place or city? Or at least, what is a good starting point?

I imagine you could get some sort of map data or satellite images and import this in a tool, from which you can start modelling the buildings etc. But if this is the case I don't know how to do that.

sentences: How to calculate players engagement? What metrics could be used to know what certain people think about the game and how much they liked it?  I would prefer parameters that don't need players to rate by themselves. Would hours of playing in a single seat be a good parameter about how much players wanted to spend time on game?

sentences:
Extend distance for rendering grass and tree objects on terrain I am trying to make an adventure game with a big landscape (made the terrain with terrain tools) with 3D models of grass (that I placed using terrain tools) but it only shows the grass/trees that are within a small area. Here is a pic of what I am talking about:

I would not want to totally remove this because otherwise the framerate will go too low. I just want to make the circle bigger.
thanks (:

sentences:
Improving Position Sync Bandwidth Usage in a Multiplayer Game This is the class i use to sync position between clients in a multiplayer top-down 2D shooter game:

    [System.Serializable]
    public class MovementUpdateClass
    {
        public int MessageTime {get; set;}

        public Vector2Serializer PosXY = new Vector2Serializer();
        public Vector2Serializer VelXY = new Vector2Serializer();
        public float RotZ {get; set;}

        public MovementUpdateClass(int messageTime, Vector2 posXY, Vector2 velXY, float rotZ)
        {
            MessageTime = messageTime;
            PosXY.V2 = posXY;
            VelXY.V2 = velXY;
            RotZ = rotZ;
        }
    }

Any advices about how to improve & optimize it so it spends less bandwidth for both sender and receivers?

Thanks.

sentences:
How can I "amplify" current motion ? I've two objects A and B. A impact B causing B movement.

I want programmatically "amplify" B movement mantaining B resulting direction.

I've try adding a script like this

void OnCollisionEnter(Collision col) {
    // Controllo se è un tag
    if (_forceAlreadyApplied==false) {

        _rb.AddForce (_forcePower * transform.forward, ForceType);
        _forceAlreadyApplied = true;

    }
}

The problem is that transform.forward obviously change B direction.

Maybe this is a wrong approach.

My question is: how to "amplify" current speed ?

Thanks

sentences:
Can I run old projects after updating Unity? Today I decided to upgrade unity from 5.0.0 to 5.5.0.

But before updating it, I wanted to know: Can I run/build my projects made in Unity 5.0.0 in Unity 5.5.0?

sentences:
Why is the framerate (fps) capped at 60? ISSUE

I recently moved a project from my laptop to my desktop(machine info below). On my laptop the exact same code displays the fps(and ms/f) correctly. On my desktop it does not. What I mean by this is on the laptop it will display 300 fps(for example) where on my desktop it will show only up to 60. If I add 100 objects to the game on the laptop I'll see my frame rate drop accordingly; the same test on the desktop results in no change and the frames stay at 60. It takes a lot(~300) entities before I'll see a frame drop on the desktop, then it will descend. It seems as though its "theoretical" frames would be 400 or 500 but will never actually get to that and only do 60 until there's too much to handle at 60. This 60 frame cap is coming from no where.

I'm not doing any frame limiting myself.

It seems like something external is limiting my loop iterations on the desktop, but for the last couple days I've been scratching my head trying to figure out how to debug this.

SETUPS

Desktop:

Visual Studio Express 2012
Windows 7 Ultimate 64-bit

Laptop:

Visual Studio Express 2010
Windows 7 Ultimate 64-bit

The libraries(allegro, box2d) are the same versions on both setups.

CODE

Main Loop:

while(!abort) {
    frameTime = al_get_time();
    if (frameTime - lastTime >= 1.0) {
        lastFps = fps/(frameTime - lastTime);
        lastTime = frameTime;
        avgMspf = cumMspf/fps;
        cumMspf = 0.0;
        fps = 0;
    }

    /** DRAWING/UPDATE CODE **/

    fps++;
    cumMspf += al_get_time() - frameTime;
}

  Note: There is no blocking code in the loop at any point.

Where I'm at

My understanding of al_get_time() is that it can return different resolutions depending on the system. However the resolution is never worse than seconds, and the double is represented as [seconds].[finer-resolution] and seeing as I'm only checking for a whole second al_get_time() shouldn't be responsible.

My project settings and compiler options are the same. And I promise its the same code on both machines.

My googling really didn't help me much, and although technically it's not that big of a deal. I'd really like to figure this out or perhaps have it explained, whichever comes first. Even just an idea of how to go about figuring out possible causes, because I'm out of ideas.

Any help at all is greatly appreciated.

EDIT:

Thanks All. For any others that find this to disable vSync(windows only) in opengl:

First get "wglext.h". It's all over the web.

Then you can use a tool like GLee or just write your own quick extensions manager like:

bool WGLExtensionSupported(const char *extension_name) {
PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglGetExtensionsStringEXT = NULL;

_wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) wglGetProcAddress("wglGetExtensionsStringEXT");

if (strstr(_wglGetExtensionsStringEXT(), extension_name) == NULL) {
    return false;
}

return true;
}

and then create and setup your function pointers:

PFNWGLSWAPINTERVALEXTPROC       wglSwapIntervalEXT = NULL;
PFNWGLGETSWAPINTERVALEXTPROC    wglGetSwapIntervalEXT = NULL;

if (WGLExtensionSupported("WGL_EXT_swap_control"))
{
    // Extension is supported, init pointers.
    wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT");

    // this is another function from WGL_EXT_swap_control extension
    wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC) wglGetProcAddress("wglGetSwapIntervalEXT");
}

Then just call wglSwapIntervalEXT(0) to disable vSync and 1 to enable vSync. I found the reason this is windows only is that openGl actually doesn't deal with anything other than rendering it leaves the rest up to the OS and Hardware.

Thanks everyone saved me a lot of time!

sentences:
Amount of Data Calculated in a Game So... I am theorizing the development of a 2d living persistent fullsized world with simulated ecossystem, etc..., and many, many objects, but how can I handle the giant amount of data that will be calculated per instance.
I mean, as the ecossystem is simulated and alive, animals would roam, plants would grow the climate would change etc... I already planned on how to implement the simulated ecossystem, but I wanted them to happen all at once, not in separated instances like World of Warcraft's dungeons or different maps. Just one entire and fullsized chunck with all the things happening on it.

Is it possible, even for an extreme low graphical game? I know of games that do something like it. Eg.: Dwarf Fortress, but what I am aiming for is way bigger than that.

EDIT:
For the "AI", I was planning on do behavioral intelligent organization or BIO, something I am planning and theorizating. It would be like a giant The Sims, every object(animal, plant, etc...) would have it's needs, characteristics, possibilities and impossibilities, they need to eat so they interact with the enviroment and with other objects on their own with modified version of A* lead by his senses(vision, audition, ect...). I know it is complicated and not polished, its because I am still studying everything and I'm more like a amateur programmer.

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:
Swift Spritekit: Create realistic driving sprite How would I go by creating a realistic driving experience?

I'm using iOS Swift 3 with SpriteKit using the functions applyForce to accelerate when I click the gas button and when braking I add friction to the physicsBody, also I can't seem to turn right, no idea on how to do it.

Right now for turning I'm splitting the screen using the left and right to turn but I'm using applyForce but its very bad because it turns when the car is stopped and in a very unrealistic way.

When I apply force its only to go up so if I do create a turning mechanism and I do a uturn the car will still go up.

Also side note: Multitouch doesn't work?

Any help? Thanks

override func didMove(to view: SKView) {

    // Multi Touch
    self.view?.isMultipleTouchEnabled = true

    car.carNode.position = CGPoint(x: 0, y: 0)
    car.carNode.physicsBody = SKPhysicsBody(rectangleOf: car.carNode.size)
    car.carNode.physicsBody?.affectedByGravity = false
    car.carNode.physicsBody?.angularDamping = 0.1
    car.carNode.physicsBody?.linearDamping = 0.1
    car.carNode.physicsBody?.friction = 0.1
    car.carNode.physicsBody?.mass = 1

    self.addChild(car.carNode)

    // HUD Display
    gas.gasButton.position = CGPoint(x: 300, y: -500)
    self.addChild(gas.gasButton)

    brake.brakeButton.position = CGPoint(x: 150, y: -500)
    self.addChild(brake.brakeButton)

}

override func update(_ currentTime: TimeInterval) {

if touching {

    car.carNode.physicsBody?.applyForce(CGVector(dx: 0, dy: 180))
  }
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

for touch in touches {
    let location = touch.location(in: self)

    if location.x < self.frame.size.width / 2 {

        // Left side of the screen
        car.carNode.physicsBody?.applyForce(CGVector(dx: -100, dy: 0))

    } else {

        // Right side of the screen
        car.carNode.physicsBody?.applyForce(CGVector(dx: 100, dy: 0))
    }

    // Gas Button
    if (gas.gasButton.contains(location)) {

        touching = true
    }
        // Brake Button
    else if (brake.brakeButton.contains(location)) {

        car.carNode.physicsBody?.friction = 1
    }

  }
}

sentences:
How can I implement a "fast-forward" feature in my game? How can I implement the fast forward feature for my tower defense game like in http://fieldrunners.com/ and other TD games?

I am using Unity 3D. Would there be something to manage fewer frames per second or some kind of manually set fast movement of enemies and tower firing speed, et cetera?

sentences:
Why is the pixel so popular as the metric unit of a game? I keep seeing everywhere people using pixels for resolving collisions, angles, distances. I wonder if using the pixel as the metric unit for a game is a good solution, first because you're tying your game logic with implementation, in this case squares in your monitor, second handling more elaborated effects like zoom, rotation becomes more difficult, etc. Isn't adopting integer numbers as your smallest metric unit more flexible and letting the renderer do the pixel operations?

Why the pixel unit is so much popular than integer units?
Which are the benefits and drawbacks for each strategy?

sentences:
Collision works except for when coming from right side I am trying to make a bomberman clone. I'm having problems with the collision on the walls that is not on the sides of the map (see image). When I come from the right (going left), the red square (player) goes through the wall but when I come from other sides (up, left, down) the collision works well and the player does not go through. The collision on the side walls works well also even when I come from the right and going left.

I am using Tiled and LibGDX and here is the code:

private void checkCollision(float delta) {
    //player.getVelocity().scl(delta);
    Vector2 position = player.getPosition();

    // just to see if it overlaps because this is the location of the
    // rectangle when getTiles is called when player moves left as shown in the image
    Rectangle rect = new Rectangle(128, 128, 64, 64);
    if(player.getRectangle().overlaps(rect)) {
        System.err.println("overlap");
    }

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE - 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left"); // this doesn't show
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    //player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

sentences:
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:
License for a casino game with virtual money (chips) Do I need a specific license for operating a casino game (lets say poker Hold'em or video slots) that players are supposed to play with virtual money (chips) only? I am speaking about games like Zynga poker, Poker Deluxe, Slotomania and the hundreds other similar games on iTunes or Google Play. Players start with a certain amount of chips and if they run out they can rebuy a bundle of coins to keep playing. The users may not exchange those collected virtual funds (chips) for products or services, or cash out for real money, but just keep on playing for a fun.

Do I need any license for operating such a game?

sentences:
Orthogonal projection and world transform I'm reading about projection matrix. Needs of perspective projection is obvious, but I'm not sure about orthogonal projection. Because orthogonal projection effect looks possible with only world transform.

What is main purpose of orthogonal project which make it different with world transform?

sentences:
How to properly commission professional artwork Possible Duplicate:
  How do I find artists to work on my game?

I am trying to commission an artist to do professional work for my game Fimbulvetr.  A sample of the current state of the game can be found here:

http://www.youtube.com/watch?v=uN90R-yCy14

Of course, my intention here is neither to advertise the game itself here, nor to make said request for an artist to this community, as neither of those would be appropriate questions.  Viewing my work-in-progress, however, may help understand the circumstances.

The issue is that my project is significantly larger-scoped than it seems most Indie Artists are used to.  Containing large amounts of elements from Fighting Games, the project is designed to possess no less than 8 fully-animated fighting game characters, with several hundred frames of animation each.

The game currently uses much filler art, all created by myself personally.  Not only are they low-quality stick-figures, meant only to visually articulate the motions and designs and not to be permanent, but they also take a huge portion of my time away from programming, of which I am also the sole group member.

I have attempted no less than 4 times so far to find an artist who would be willing to take up the job, but each time it has ended the same: they do a small amount of work, and then give up.  While personal, specific reasons are always involved, I suspect similar psychology behind the reasoning.  It could be simply a matter of bad luck, or perhaps not.

Is there a particularly tried-and-true method of finding someone to do such work?  I would like to be as professional as possible in this endeavor.  I am offering significant payment for the services, attempting to manage reasonable schedules, and doing everything else I can think of to make this as professional, efficient, motivating, and successful as possible.

sentences:
Easiest way to make a 3D overworld Using something like Blender, would it be easier and more time and space efficient to create 'tiles', and use some kind of software like Tiled to use these tiles in the various maps, or would it be faster to just create the entire maps in Blender?

I ask because the first approach sounds better, in that it takes less space, time and effort, but the second approach seems to be used everywhere. Right now my game uses tiles, but it's very hard to add any kind of elevation. So should I ditch tiles for building the entire scene in Blender or not?

(sorry if my question doesn't fit the format!)

sentences:
I know that my super simple multiplayer setup is probably not a good idea, but why? I'm making a simple little MOBA just for fun. I was making everything single-player then I realized "oh crap I should probably add multiplayer, huh."

I've never done anything with networking before, so learning how to integrate Lidgren into my game was fun and awesome. The thing is, I pretty much know the way I'm doing things is wrong, because it's not robust enough for mainstream games to use, as far as I know, but what's wrong with it?

What I'm doing is, basically, whenever a player does an action, it sends a message to the server saying "hey, I just did this thing." The server and the client are both running the same simulation. The server then sends a message to all other clients telling them that that guy did that thing.

For the most part, except in a few cases, when a player does a thing, the client assumes it's cool and goes ahead with it on its own. So when you right-click somewhere to move there, that player's client just starts moving his guy there, and then sends a message to the server telling it about it.

So basically:

Player 1 casts a spell to make him move 100% faster for six seconds
Player 1's local client adds that buff to his Unit object
Player 1's client sends a message to the server saying "hey I just cast this spell"
The server makes sure he really did have enough mana to cast that spell, and if so, adds that buff to the server's copy of that Unit object
The server sends a message to all other clients saying "hey this guy just cast this spell"
Every other client receives the message and goes "ah okay cool," and adds that buff to their local Unit object for that player

I've been skimming through stuff to see how big games do multiplayer, and it's kind of confusing for someone who's just starting to dabble in this stuff, but it looks like the Source engine sends a packet containing all of the changes to everything in the world every tick? Again, totally new to this stuff, but can you really push that much data that frequently?

Sorry if this is a bit rambly, but basically, I was wondering why my simpler system isn't the right way to go, because if it was, other games would use it, right?

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:
Can I detect collision on specific collider? I'm a beginner with Unity and I'm developing my very first 2D game. My game character needs to have an automatic right/left movement but I'm struggling with the colliders on the walls (I made a tilemap object and set a collision for each wall on it). I need my character to detect the collision on the Right wall and turn to the left but I just can't find a way to name (I don't even know if you can do this) and detect a specific collider/collision so I can make an if statement on the player script.

How can I detect a specific collision/collider and refer this on my player script?

Here is the code I'm using for it (it isn't working):

void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.collider.gameObject.name == "Right Facing Wall")
    {
        runForwards = false;
    }
    else if (collision.collider.gameObject.name == "Left Facing Wall")
    {
        runForwards = true;
    }
}

sentences:
Per-Frame Function Calls versus Event Driven Messaging in Game Design The traditional game design, as I know it, uses polymorphism and virtual functions to update game objects states. In other words, the same set of virtual functions are called in regular(ex: per-frame) intervals on every object in the game.

Recently, I discovered, that there is another - event driven messaging system available to update states of game objects. Here, the objects usually are not updated on per-frame basis. Instead, a highly efficient event messaging system is built, and game objects get updated only after receiving valid event message.

Event Driven Game Architecture is well described in: Game Coding Complete by Mike McShaffry .

Could I kindly ask for help with the following questions:

What are the advantages and disadvantages of the both approaches?
Where is one better over the other?
Is Event driven game design universal and better in all areas? Is it therefore recommended for usage even in mombile platforms?
Which one is more efficient and which is more difficult to develop?

To clarify, my question is not about removing polymorphism completely from a game design. I simply wish to understand the difference and benefit from using event driven messaging vs regular(per-frame) calls to virtual functions to update game state.

Example:
This question caused a bit of controversy here, so let me offer you example:
According to MVC, the game engine is divided into three main parts:

Application Layer (Hardware and OS communication)
Game Logic
Game View

In a racing game, the Game View is responsible for rendering the screen as quickly as possible, at least 30fps. Game View listens for player's input too. Now this happens:

Player presses fuel pedal to 80%
GameView constructs a message "Car 2 Fuel Pedal Pressed to 80%" and sends it to Game Logic.
Game Logic gets the message, evaluates, calculates new car's position and behavior and creates the following messages for GameView: "Draw Car 2 Fuel Pedal Pressed 80%", "Car 2 Sound Acceleration", "Car 2 Coordinates X, Y" ...
GameView receives the messages and processes them accordingly

sentences:
How to improve this random number generation in my context? In my game there is a word at top of the screen, letters are raining down from top and the user has to touch the letters to complete the word.

Currently I am generating letters randomly (actually random numbers and numbers are the index for the array of letters. e.g: 0=a, 1=b) but the problem is that it takes too much time to get all the required letters to complete the word.

What I want is that the random numbers that I am generating should generate required letters more often so player don't have to spend all day to complete one word.

I have tried following methods:

Detect all the letters in the word (word is always 6 letters long), generate the array of indexes of length 6, assign each index of the array to random number from letter-2 to letter+2 and in the end pick randomly one index from the array to show.
Have a selector variable whose value is in the range [0..2], generated randomly, if selector == 0 then detect letters which make the word and randomly pick one letter, else randomly get any alphabet from a-z.

Both of these methods have not provide me with any help. I will be very happy if you can help me.

Thanks for reading this, I hope you understood the question and I am waiting for the response.

sentences: Prevent Multiplayer Cheating I am almost complete developing a small indie-style multiplayer game. While I intend to allow people to cheat in single-player, this is obviously not acceptable in multi-player. Does anyone know of any ways to help stop the average Joe from using something like Cheat-Engine to modify parts of the game? I currently plan to have the client upload a MD5 hash of each setting file the game uses (stored as an XML) to the game server for verification every few seconds, but is there anything I can do to stop things like memory-editors, etc?

sentences:
How to address raycast failures due to tiny holes in a mesh? Problem:

I have a racing circuit that is made out of tiles, each of which is made out of 2 triangles. I need to know over which tile my craft is hovering on; but since there are tiny holes between some of the tiles, casting a ray fails sometimes.

Note: fixing the mesh from within a 3D modeler is not an option.

Question:

Is there a robust method for approaching this problem ?

sentences:
determine collision angle on a rotating body update: new diagram and updated description

I have a contact listener set up to try and determine the side that a collision happened at relative to the a bodies rotation. One way to solve this is to find the value of the yellow angle between the red and blue vectors drawn above. The angle can be found by taking the arc cosine of the dot product of the two vectors (Evan pointed this out). One of my points of confusion is the difference in domain of the atan2 function html canvas coordinates and the Box2d rotation information. I know I have to account for this somehow... SS below

questions:

Does Box2D provide these angles more directly in the collision information?
Am I even on the right track? If so, any hints?

I have the following javascript so far:

Ship.prototype.onCollide = function (other_ent,cx,cy) {

  var pos = this.body.GetPosition();

  //collision position relative to body
  var d_cx = pos.x - cx;
  var d_cy = pos.y - cy;

  //length of initial vector
  var len = Math.sqrt(Math.pow(pos.x -cx,2) + Math.pow(pos.y-cy,2));

  //body angle - can over rotate hence mod 2*Pi
  var ang = this.body.GetAngle() % (Math.PI * 2);

  //vector representing body's angle - same magnitude as the first
  var b_vx = len * Math.cos(ang);
  var b_vy = len * Math.sin(ang);

  //dot product of the two vectors
  var dot_prod = d_cx * b_vx + d_cy * b_vy;

  //new calculation of difference in angle - NOT WORKING!
  var d_ang = Math.acos(dot_prod);

  var side;
  if (Math.abs(d_ang) < Math.PI/2 )
    side = "front";
  else
    side = "back";

  console.log("length",len);
  console.log("pos:",pos.x,pos.y);
  console.log("offs:",d_cx,d_cy);
  console.log("body vec",b_vx,b_vy);
  console.log("body angle:",ang);
  console.log("dot product",dot_prod);
  console.log("result:",d_ang);
  console.log("side",side);
  console.log("------------------------");

}

sentences:
What's the best way to make multiple objects of the same thing? I am coding in C#.  Due to limitations of the environment I will be working in, I cannot use any framework like the XNA Framework; only what is provided by default on Windows.

I want to create multiple ledges in a platform game.  This is what I currently have in the object class:

class Object
{
    Bitmap _image;
    Usables.Collisions collideType;

    public Object(string image, bool collideX, bool collideY)
    {
        //sets image for picturebox BG
        _image = new Bitmap(Usables.baseDir + image);
        // Collision also set here
    }

    public Bitmap Image
    {
        get { return _image; }
    }
}

and I am assigning it to a pictureBox this way in the form:

public void initGame()
    {
        pb_ledge1.Image = World.Ledge.Image;
    }

And the World class is like this:

class World
{
    static Object Ledge1 = new Object("test.png", true, true);

    static public Object Ledge
    {
        get { return Ledge1; }
    }
}

Obviously in a finished product the World class would not be set like that.  The images for the different ledge types would be set dynamically.

But my main concern is if I had 8 blocks going across the screen, I would have 8 pictureBoxes, and I would assume professional game developers do not manually assign each 8 boxes individually.  Is there a way around this?

sentences: How can i apply texture to cylinders created using Ogre Procedural Geometry Library? I am using Procedural::CatmullRomSpline3 to create cylinders between 3 control points, now instead of solid cylinders i need to create dashed/ dotted cylinders so is there a direct way to do so or alternatively i have to make desired textures and add them to cylinders, how can i achieve this?

sentences:
What is UVIndex and how do I use it on OpenGL? I am a noob in OpenGL ES 2.0 (for WebGL) and I'm trying to draw a simple model I've made with a 3D tool and exported to .fbx format. I've been able to draw some models that only have: A vertex buffer, a index buffer for the vertices, a normal buffer and a texture coordinate buffer, but this model now has a "UVIndex" and I'm not sure where am I supposed to put this UVIndex. My code looks like this:

GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.VertexBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["vPosition"],3,GL.FLOAT, false, 0, 0);
GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.NormalBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["vNormal"], 3, GL.FLOAT, false, 0, 0);
GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.TexCoordBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["TexCoord"], 2, GL.FLOAT, false, 0, 0);

GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, this.Model.House.IndexBuffer);

GL.bindTexture(GL.TEXTURE_2D, this.Texture.HTex1);
GL.activeTexture(GL.TEXTURE0);

GL.drawElements(GL.TRIANGLES, this.Model.House.IndexBuffer.Length, GL.UNSIGNED_SHORT, 0);

But my model renders totally incorrect and I think it has to do with the fact that I am ignoring this "UVIndex" in the .fbx file, since I've never drawn any model that uses this UVIndex I really have no clue on what to do with it.

This is the json file containing the model's data: http://pastebin.com/raw.php?i=G294TVmz

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:
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:
How to calculate random new position base on original position on map I am making a 2D game with HTML5 Canvas. The game has several shapes and I want them to move all over the map randomly.

  However, if I just give them a constant angle to follow, they will
  all end up in a corner after a certain amount of time.
  Also, I am building this game with client-server so I don't want to
  send a lot of data. For example, I don't want to constantly update
  the angle on the server side and send it to the client.

That's why I want to generate a random position base on the shape's position on the big map.

For example, it's angle of movement will be tangent of it's (x,y). (It obviously won't work because it will get stuck on the sides of the map).

So what's a good way of generating the new coordinates base on it's current one?

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:
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:
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:
What happenes if you leave out buffers for the inputassembler that the vertex shader expects? I'm working through my first attempt at a "graphics engine" (I use the term loosely as I'm not aiming for much more than something that will display a few meshes).  I want to leave my classes as extensible as possible and am currently working on my mesh class.

I want my mesh class to be able to have optional UVs and optional normals, although I generally expect to use these.  As I'm new to Direct3d I'm curious if I still have to define matching "zeroed" buffers for the missing normals and UV data if the vertex shader and input assembler is otherwise expecting this data?  Should I have my mesh class assemble the missing data zeroed out and declare empty buffers or does Direct3d know to pass null arguments for missing data?

EDIT: I guess zeroed normals wouldn't work as any shader expecting normals would produce bad/bizarre results, but the question regarding texture coords still stands.

sentences:
How 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:
Android problem with onTouchEvent I'm making some sort of clone for FlappyBird, but with some adjustments.

I want to change from the FlappyBird's mechaninc of jumping to make the bird raise as long as the player is long-pressing the screen.
I've tried to change this:

@Override
    public boolean onTouchEvent(MotionEvent event) {
        int action = event.getAction();
        if(action==MotionEvent.ACTION_DOWN){
            valo=-30;
            gameSate =true;
        }
        return true;//to have indication when we done
    }

To:

@Override
    public boolean onTouchEvent(MotionEvent event) {
        int action = event.getAction();
        while(action==MotionEvent.ACTION_DOWN){
            spaceY-=3; //y axis location for the bird
            gameSate =true;
        }
        return true;//to have indication when we done
    }

Which didn't work at all, when I changed the onTouchEvent from the if statement to the while loop, the bird was frozen. With the if statement, pressing only make it bounce once, no matter if the screen is being pressed or not

Is there a way to keep the Y axis change smooth while doing it only when action==MotionEvent.ACTION_DOWN

sentences:
How to compress Unity apk output? I made a game with Unity but the size of .apk file got so large, it is about 70mb...
Is there some way that I can compress my apk file?

sentences:
How to get rid of half pixel artifacts? I've been having a bit of trouble using OpenGL to make 2D games. I am using a traditional ortho perspective with just some sprites being rendered and moved around.

It all works perfectly but there is a little graphical artifact that I would like to get rid of. As the sprites move, their edges jitter a little bit; I assume this happens as the position of the sprite goes from a half-pixel coordinate to a nicely rounded up coordinate, and then back again, causing the artifact to intermittently show up.

I also had the exact same problem with text rendering (textured quads technique), when it was sitting at half-pixel coordinates, where it would get blurry and ugly, while at strict integer positions it would show immaculate.

I could force my sprites to integer positions before rendering, which would probably fix the artifact, but at the same time ruin the movement smoothness.

So, does anyone know what is the state of the art solution for this problem? How to handle sprite positioning without artifacts?

sentences:
How to prevent intepolated texture in fragment shader (Unity CG) Think about minecraft - all the textures in minecraft have a very nice crisp pixelated look.  Well, I'm trying to write a shader that will do this but it appears "sampler2d" returns some sort of interpolation between pixels of the underlying texture.  I'm pretty new to shader writing and I'm not even sure if it can be done - but I'm hoping to get a nice crisp blow up of small textures rather than a blurry one like this:

If anyone knows a way to make a shader crisp rather than interpolated like this (using Unity), I'd be thrilled to know as this hitch is pretty detrimental to what I'm trying to accomplish...

Here's the subshader as it is right now (it's skipping all the light calculations and just outputting the sampler as I'm just trying to resolve the blurry texture sampling):

SubShader
{
    Pass
    {
        Tags { "LightMode" = "ForwardBase" }
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        //user
        uniform float _BlendVal;
        uniform sampler2D _DiffuseTex;
        uniform sampler2D _NMTex;
        uniform sampler2D _PixelMap;
        uniform float4 _DiffuseTex_SV;
        uniform float4 _SpecColor;
        uniform float _SpecIntensity;
        uniform float4 _RimColor;
        uniform float _RimIntensity;
        uniform float _RimCoefficient;

        //unity
        uniform float4 _LightColor0;

        struct vI
        {
            float4 pos : POSITION;
            float3 norm : NORMAL;
            float4 uv : TEXCOORD0;
        };

        struct vO
        {
            float4 pos : SV_POSITION;
            float4 uv : TEXCOORD0;
            float3 worldPos : TEXCOORD1;
            float3 normDir : TEXCOORD2;
        };

        vO vert(vI i)
        {
            vO o;

            o.uv = i.uv;
            o.worldPos = mul(_Object2World, i.pos).xyz;
            o.normDir = normalize(mul( float4(i.norm, 0.0), _World2Object).xyz);
            o.pos = mul(UNITY_MATRIX_MVP, i.pos);

            return o;
        }

        float4 frag(vO i) : COLOR
        {
            float3 lightDir;
            float3 viewDir = normalize( i.worldPos - _WorldSpaceCameraPos.xyz);
            float atten;
            float3 normDir = normalize(i.normDir);
            float4 RimLight;
            float4 DiffuseLight;
            float4 SpecularLight;
            float2 UVCoord = i.uv.xy;

            float4 test = tex2D(_PixelMap, UVCoord);

            //float4 Clrx0 = lerp(

            //Directional Light
            if(_WorldSpaceLightPos0.w == 0)
            {
                lightDir = normalize(_WorldSpaceLightPos0.xyz);
                atten = dot(lightDir, normDir);
            }
            //point light
            else
            {
                float3 dist = i.worldPos.xyz - _WorldSpaceLightPos0.xyz;
                lightDir = normalize(dist);
                atten = (1/length(dist))*(dot(lightDir, normDir));
            }

            DiffuseLight = atten * _LightColor0;
            SpecularLight = atten * _LightColor0 * _SpecColor * _SpecIntensity * pow(max(0.0,dot(reflect(lightDir, normDir), viewDir)), 1)*(1-tex2D(_DiffuseTex, i.uv.xy).w);
            RimLight = atten * _LightColor0 * _RimColor * _RimCoefficient* pow((1-saturate(dot(-viewDir, normDir))),_RimIntensity)*saturate(dot(lightDir, normDir));

            float4 totalLight = DiffuseLight + SpecularLight + RimLight;

            float4 fin = float4(UVCoord.xy,0,0);

            return test; ///Fin * totalLight;
        }

        ENDCG

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:
Dynamic body implementation I am writing a 2D game where one of the characters has some very particular requirements. This character is a body with no particular shape (similar to a fluid, but not so much), it has to be able to grow and shrink (as in actually growing, not just scaling), and it has to have collision detection (even if it's basic). Because of this requirements, it obviously can't be based on a sprite, so direct rendering of the shape should be the logical thing to do.

I assume this is no easy task, but I just couldn't find a good physics engine that covers these requirements (or at least no tutorial on how to do it; I particularly searched for Box2D tutorials).

Is there a way of doing this with Box2D, SDL, or any other physics or game engine out there?

If not, what's a good place to start? I am really clueless as far as soft-body physics are concerned.

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:
Control Camera with gyroscope and place a gameobject always in front of it Actually I have came here after searching from past 5-6 hours. Actually I am making a small game in which I have a camera and a gameobject. The Game Object is place in the center of the scene at 0,0,0 . My scene doesn't include anything but a skybox. I wanted to move my camera with gyro input, I got that working.
My problem is that I want my object which is at 0,0,0 is to face camera always. The camera is controlled by gyro so the object should always remain infront of the camera. I have taken a script from wiki.unity3d and it seems to be somewhat working. Actually I want an offset for the transform.lookAt or if it's not possible I'll require some solution for it.

public class CameraFacing : MonoBehaviour
{
    public Camera m_Camera;

    void Update()
    {
        transform.LookAt((transform.position) + m_Camera.transform.rotation * Vector3.forward,
                m_Camera.transform.rotation * Vector3.up);
    }
}

Actually I have tried 3rd person and FPS shooter camera and Camera Follow script as well besides knowing it doesn't fit my need. As In most cases we want the camera to follow object. But in this case my input is through gyro of mobile device and I want the center object to always remain in front of camera.

Here is the code for gyroscope. I have made the object which I want to always stay infront of camera as suggested by comment but the camera rotate with gyro but not the object that is child of it, which is pretty strange.

private float initialYAngle = 0f;
private float appliedGyroYAngle = 0f;
private float calibrationYAngle = 0f;
void Start()
{
    Input.gyro.enabled = true;
    Application.targetFrameRate = 60;
    initialYAngle = transform.eulerAngles.y;
}

void Update()
{
    ApplyGyroRotation();
    ApplyCalibration();
}

public void CalibrateYAngle()
{
    calibrationYAngle = appliedGyroYAngle - initialYAngle; // Offsets the y angle in case it wasn't 0 at edit time.
}

void ApplyGyroRotation()
{
    transform.rotation = Input.gyro.attitude;
    transform.Rotate(0f, 0f, 180f, Space.Self); // Swap "handedness" of quaternion from gyro.
    transform.Rotate(90f, 180f, 0f, Space.World); // Rotate to make sense as a camera pointing out the back of your device.
    appliedGyroYAngle = transform.eulerAngles.y; // Save the angle around y axis for use in calibration.
}

void ApplyCalibration()
{
    transform.Rotate(0f, -calibrationYAngle, 0f, Space.World); // Rotates y angle back however much it deviated when calibrationYAngle was saved.
}

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:
Find out reason for automatic break Soon after I press the Play button, the Unity break button automatically gets activated: Unity gets into Pause mode:

I have attached the Unity debugger to my C# code, but Visual Studio doesn't break.

How could I find out the reason why Unity goes into Break mode?

Thank you!

Edit: Per request, here is the button before pressing Play:

And here is what the console looks like after the error occured:

sentences:
Unity (UNET) Pass custom data when creating and joining a match in multiplayer I've written some simple stuff to make a lobby for matchmaking. Now I want to pass some extra info besides the match name to the lobby. Something like Player's avatar and a number of players connected and what not.
Thereto, I also want to pass information to the game from the players.
For example, two players connect to a match and the character pick starts. For this I want to have the player's info regarding the characters they've picked and the character's weapons info (e.g. customized weapons info). I store all that in a json file and load from it to a class object. Is it ok to add these classes to, say, the player connection prefab that holds Network Identity or is it done somehow differently?

Can someone maybe help me with that in the context of Unity 2018 (i.e. give some advice or referrences to some relevant information)?

Appreciate all the help and thanks in advance.

sentences:
How to launch Libgdx cross-platform (Android, HTML, Desktop) multiplayer client with socket? So i'm struggling with making my cross-platform client side to work, specifically on HTML part.
I have java server that is responsible for all the controls and events, and I control it via netty-socketio. Client is Libgdx, and desktop version works flawlessly when using io.socket.client.IO class and Gson for json serialization. The implementation of game is clunky, but everything works and multiple clients can join, move and play.

Everything went south when i tried to launch html client. Nothing seems to be working and i have ran out of ideas of what to do. This is the errors i get

[ERROR] Line 4: The import org.json cannot be resolved
[ERROR] Line 5: The import org.json cannot be resolved
[ERROR] Line 11: JSONObject cannot be resolved to a type
[ERROR] Line 12: JSONException cannot be resolved to a type

together with

[ERROR] Line 15: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
[ERROR] Line 17: No source code is available for type com.google.gson.Gson; did you forget to inherit a required module?
[ERROR] Line 20: No source code is available for type com.google.gson.GsonBuilder; did you forget to inherit a required module?
[ERROR] Line 45: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
[ERROR] Line 47: No source code is available for type java.net.URISyntaxException; did you forget to inherit a required module?

Quick googling says, that i cannot use io.socket.client and gson in GWT.
So i'm here, trying to find some guidance, because everything I run into seems to be old and outdated. I hope someone can help me:

Is it possible to run single libgdx code for all platforms and communicate with server via socket (or anything at this point)
What libraries/repositories should I use to achieve this.
How exactly do i configure my html part to work correctly (I failed to find a single decent tutorial when using libgdx socket with html)

sentences:
Get project's gravity value in Godot I need to get access project's gravity value which set in Project Settings -> Physics -> 3D -> Gravity, however I couldn't find any related information about this.

How do I get project's gravity value in GDScript? In Unity, it can be done by simply Physics.gravity, but in Godot, couldn't find similar.

Using Godot 3.1.1

sentences:
C++ Additive Blending Algorithm 2d Game I was wondering if anyone could shed any light on whats going wrong with my additive blending here, I think I'm nearly there, currently my outcome is black squares. I have tried using both the formula's on this website here https://love2d.org/wiki/BlendMode_Formulas to try and get my desired outcome and it doesn't seem to be working.

This is the equation I have in my notes and what I have found online.
Final.Red = Bitmap.Red + Viewport.Red
Similar for green and blue, RGB range is [0-1] or [0-255]

The colors I am using are 255 RGBA format.

void SpritePlotterForm::DrawSpriteAdd( int X, int Y, Bitmap^ SrcBitmap )
{

    int FinalViewPortRed;
    int FinalViewPortGreen;
    int FinalViewPortBlue;
    int FinalViewPortAlpha;
    for (int x = 0; x < SrcBitmap->Width; x++)
    {
        for (int y = 0; y < SrcBitmap->Height; y++)
        {
          if (SrcBitmap->GetPixel(x, y).A >= 0)
          {
                // resets to avoid corruptionj of image
                FinalViewPortRed = (SrcBitmap->GetPixel(x, y).R + GetViewportPixel(x+ X, y + Y).R)/255;
                FinalViewPortGreen = (SrcBitmap->GetPixel(x, y).G + GetViewportPixel(x + X, y + Y).G) / 255;
                FinalViewPortBlue = (SrcBitmap->GetPixel(x, y).B + GetViewportPixel(x + X, y + Y).B) / 255;
                Color ResultColour = Color::FromArgb(FinalViewPortRed, FinalViewPortGreen, FinalViewPortBlue);
                SetViewportPixel(X + x, Y + y, ResultColour);

          }
       }
    }

}

I think the error is to do with how I am handling my alpha values, but I have tried multiple algorithms and either, end up darkening the image, creating a whole black square, or a whole transparent square, or worst is it gets an out of bounds issue.

Image to be blended

the result  I get from this algorithm (run twice, those are two seperate flames there)

Desired outcome

sentences:
If I want to become a professional game developer, is learning Win32 API a must? If I want to become a game developer, is learning Win32 API a must?

Does X-BOX or PS based game developers need to know Win32 API?

Is it possible for a professional game developer to develop games by only scripting game engines and not using Win32 API?

sentences:
Randomly generated story I'm developing a game at the moment and I had an idea where the game's story line would randomly generate as the player progressed and their actions would affect the story.

Would this be a bad idea in terms of gameplay or would a storyline that has multiple endings be the best idea?

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:
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: Unlock cursor through script I am using unity's default FPS controller script. My game switches scenes, and when it does I can't move the mouse. I know that this is because of unity's m_mouselook's lock cursor is on. What I don't know how to do is turn that boolean to false through a different script.

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:
Ensuring a Recursive method completes in one update tick? OK so I have a method that calls itself as this was the only way I could think to get the behaviour I needed. Its a tetris clone i am making and this method is for checking for full lines across X axis.

    void CheckForFullLine(int starting_Y)
{
    for (int y = starting_Y; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (!frozenCells[x, y].isFilled)
            {
                CheckForFullLine(starting_Y + 1);
                return;
            }

            if (x == CELL_COUNT_X - 1)
            {
                tetrisLinesThisTick++;
                Debug.Log("lines this tick: " + tetrisLinesThisTick + "on tick: " + tick);
                ClearLine(y);
            }
        }
    }
}

but when i test the game, most of the time (more than 9/10 times) when you get multiple lines, the debug log says we only got 1 line in that 'tick'.

Here is the update method where at the top I set tetrisLinesPerTick to 0 at the start of each frame.

    private void Update()
{
    tick++;
    // reset the tetris-lines this tick value:
    tetrisLinesThisTick = 0;

    ClearScreen();
    CheckForFullLine(0);
    HandleMovementAndBlockCreation();
    DrawFallingPiece();
    DrawFrozenBricks();
}

For example if I get 2 lines in one go, I get the debug log saying '...linesPerTick 1' twice in quick succession.

Strangely , occasionaly  I do get the 2 or even 3 lines and it says the correct amount, but this is rare and i don't know how i  reproduce that yet.

Another very strange thing (the relevant code might not be here for this part..) ...quite rarely one of the frozen blocks will turn grey after falling, then I can still 'use' it in game to make more lines, but it doesnt disappear like the others, then make a couple more lines using this grey block and it disappears as normal :S  (well just in case you feel like helping me with this part, he is more code :P):

    void ClearLine(int line)
{
    // TODO: Add score

    // remove complete line
    for (int x = 0; x < frozenCells.GetLength(0); x++)
    {
        frozenCells[x, line].isFilled = false;
    }

    //shift all lines down        // todo: figure out if its a multi-line tetris to give better scores...
    for (int y = line; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (frozenCells[x, y].isFilled)
            {
                if (y > 0)
                {
                    frozenCells[x, y].isFilled = false;
                    frozenCells[x, y - 1].isFilled = true;
                }
            }
        }
    }

}

For some reason, I feel it may be the recursive method i made  and the fact that 'linesPerTick' value is getting set back to zero prior to the other lines being removed (in the same move), is what is causing my problem but i could be completely wrong about it!

The whole project is just one .cs file and a block texture i made in GIMP, I could paste the whole script here if you want to try it please let me know. Cheers for any help!

sentences:
Replacement for glMatrixMode() in OpenGL 4? In OpenGL version 3.x the function glMatrixMode() specifies which matrix is the current matrix, i.e., which matrix stack is currently the target of all matrix operations based on the parameter, the choices being GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE.

glMatrixMode() had been deprecated in OpenGL version 4.x.

I have tried to find the equivalent way of performing the same effect in 4.x without success.

I suspect there has been a change in philosophy in OpenGL 4 which I am overlooking.

How is the glMatrixMode() equivalent performed in OpenGL version 4.x?

sentences:
Vertical vs horizontal hex grids, pros and cons With hex grids, you can choose to arrange the tiles with the pointy sides up, so that you can move along the west-east axis, or you can arrange them with an edge up, so that you can move along the north-south axis.

Horizontal or pointy-side-up hex grid:

Vertical or flat-side-up hex grid:

According to this page, the vertical alignment is "by far the most popular" in pen-and-paper RPGs, but it doesn't explain why. This blog post also mentions both varieties, but again gives no reason to use one or the other.

And if you look at some PC games using hexes, it seems both have their adherents:

Horizontal: Heroes of Might and Magic series (except V), Civilization V...
Vertical: Panzer General and many similar wargames, Battle for Wesnoth...

But what are the main reasons for choosing a vertical or a horizontal layout of hex grids?

I'm looking for objective advantages and disadvantages in terms of data structures, graphics, gameplay, etc, not personal preferences. Or is it really inconsequential which orientation you choose?

sentences:
Creating Customization System in Unity I'm making a game with customization system for both characters and weapons and I don't know exactly what's the best way of doing the customizations themselves.
I'm thinking of creating separate prefabs for every item that can't be dismantaled.

For example, I'd make a prefab of a character (naked-ish) and place empty game objects as containers for clothes and equipment on the character pref. When a player'd change helmet or something else, I'd replace the old helmet pref with a new one saving the data to an XML or Json file. Then I'd pass this Json or XML to a level and a script on the level will assemble this character with all its stuff taking the info from the XML or Json file.

So, the question is: is that a good approach or is there a better or common way to do this taking into account that pretty much the same should work in multiplayer but with data passed via connection? If so, what are the security measures to take in multiplayer?

sentences:
Best way to create a 2D right-triangle grid I would like to create a 2D right triangle grid for a game I am working on. Currently I am creating creating a 2D square grid, and each square contains 2 triangles.

I am wondering, is there a way to create and manage a right-triangle grid without having to contain 2 triangles in each square?

sentences:
Unity equivalent of glDepthMask or alternative I'm trying to achieve the following setup:

2 cubes. In the image attached they are the green and pink cube. They are both rendered culling their front faces, so that they are visible if a camera stands inside of them.
The 2 cubes intersect, as show in the image.
The pink cube has an opening (door, window, portal, whathaveyou) thru which a camea facing in the direction of the opening, can see the green cube.
Here is the interesting part: if the camera is not looking thru the opening however, I want the green cube face on the right side of the image to not be visible.

The culling is easy: just say Cull Front in a surface shader.
The part that I'm not sure how to pull of in Unity is the last point.

The way I would solve this in OpenGL, in a forward rendering pipeline, would be by turning on depth testing glEnable(GL_DEPTH_TEST) and, when rendering  the green box, I'd disable depth writing to the z buffer but keep testing on. i.e. glDepthMask(GL_FALSE) then render the cube and then re-enable writes to the z buffer. Essentially treating the green cube as if it were a skybox.

But I have not found anywhere in the ShaderLab documentation an equivalent of glDepthMask. there is ZWrite and ZTest but these just are equivalent to glEnable(GL_DEPTH_TEST) and glDepthFunc, not to the mask.

Any thoughts?

Alternatively, I was thinking of using clipping planes . In GL this would be using gl_ClipDistance in the shaders. I would render the green cube with a clipping distance equal to the intersection point of both cubes - 1, so it chops off that face. And the render the other cube without the clipping plane. But this would require updating the shader each time the clipping plane (intersection between the cubes) changes.

UPDATE:

I actually think that ShaderLab's ZWrite <On|Off> is the equivalent of glDepthMask. The issue is that I don't seem to be able to control rendering the green cube after Unity's skybox. If I were, the approach I'd take would be:

Unity renders it's skybox.
I render my green cube with ZWrite Off. This implies z testing takes place against the fragments of the cube, but the buffer won't be updated with the z values of the cube after this pass.
Render the rest of the geometry as usual.

Since step 2 did not write to the z buffer, the geometry should cover everything as it normally does with respect to the engine's skybox. This means it would cover the green cube too. But, if the geometry (pink cube) had any openings, the pink cube would not write  to the z-buffer since there is nothing there. The buffer in those areas should be 1 (the default for infinitely away).

I tried the above, which just meant creating a new surface shader with ZWrite Off and a tag "Queue" = "Background+1", hoping it would mean "render after the skybox". But while it does prevent the green cube rendering on top of the pink cube, it also makes Unity's skybox render on top of the green cube. So not sure how to tell it to render after the skybox.

sentences:
OpenGL Applications Bring computer to halt Whenever I run any application that utilizes the OpenGL interface, my entire computer comes to a halt, but it doesn't do this when it utilizes the DirectX interface. I run both Linux (Ubuntu 15.10) and Windows 10 so this isn't exactly caused by the operating system. I'm running the latest drivers from NVidia and both OS's are completely up to date. This is happening on a Dell Precision M6300 laptop (Core 2 Dou 2.5ghz, NVidia Quadro FX 1600M, 4gb ram) and although it's a bit old it should be completely capable of rendering a blank OpenGL window using GLFW, however it slows down my entire computer (every application starts freezing to where it becomes unusable until the application is closed). This happens in games like Left4Dead, Half-life 2, etc., but also in my own OpenGL programs. The same programs and games do not have the same effect on my desktop (although much better hardware, a blank OpenGL window shouldn't matter). Any help would be greatly appreciated, thank you. Also; my apologies if I left out any vital information or made a confusing question. Just ask me to clarify or add something and I shall.

; Added the code for the blank OpenGL window in question

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
using namespace glm;

int main(int argc, char* argv[]) {
if ( !glfwInit() ) {
    fprintf(stderr, "Failed to initialize GLFW\n");
    return -1;
}

glfwWindowHint(GLFW_SAMPLES, 4); // 4x AA
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // GL 3.3
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

GLFWwindow* window;
window = glfwCreateWindow(1024, 768, "OpenGL Tutorial", NULL, NULL);
if (window == NULL) {
    fprintf(stderr, "Failed to create OpenGL Window.");
    return -1;
}
glfwMakeContextCurrent(window);
glewExperimental=true;
if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initiate the glew context!");
    return -1;
}

glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

do {

    glfwSwapBuffers(window);
    glfwPollEvents();
} while (glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
    glfwWindowShouldClose(window) == 0);
}

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:
Unable to get Box2dlights to cast shadows I'm trying to use box2dlights to add lighting to my game and I have everything working except I am unable to have shadows cast with my box2d bodies.  I also have collision working using category/maskBits with my various objects and I'm trying to apply the same strategy to box2dlight filters.  You can see how the light just passed through the body.

EDIT:  I think I may have discovered why the lights are not colliding with my box2d bodies.  When I define the body shapes using "real world" scale pixel coordinates, the lights cast shadows properly, but I lose collision since the bodies are defined at pixel scale as opposed to the box2d scale I have defined.  Does anyone know why the box2dlights are using real world scale?

Here is my RayHandler Setup

RayHandler.useDiffuseLight(false);
rayHandler = new RayHandler(world);
rayHandler.setAmbientLight(.5f, .5f, .2f, 1f);
rayHandler.setBlurNum(1);
rayHandler.setShadows(true);

I have a PointLight that is positioned in the center of the screen.

PointLight pl = new PointLight(game.rayHandler, 128);
pl.setDistance(1000);
pl.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
pl.setColor(Color.WHITE);
pl.setSoftnessLength(0);
Filter filter = new Filter();
filter.categoryBits = B2DVars.CATEGORY_LIGHT; // Value listed below
filter.maskBits = B2DVars.MASK_LIGHT;         // Value listed below
pl.setContactFilter(filter);

Also, my body is defined as

body = world.createBody(squareBodyDef);
PolygonShape squareShape = new PolygonShape();
squareShape.setAsBox(b2dWidth / 2, b2dWidth / 2, new Vector2(squareBodyDef.position.x * WORLD_TO_BOX, squareBodyDef.position.y * WORLD_TO_BOX), 0f);
body.setUserData(this);

FixtureDef fdef = new FixtureDef();
fdef.shape = squareShape;
fdef.density = 10.0f;
fdef.friction =  0.1f;
fdef.restitution = 1.15f;
fdef.filter.categoryBits = CATEGORY_SQUARE_OBJECTIVE; // Value listed below
fdef.filter.maskBits = MASK_SQUARE; // Value listed below

body.createFixture(fdef).setUserData(this);
squareShape.dispose();

Finally, my box2d filtering constants

public static final short CATEGORY_BALL = 1;
public static final short CATEGORY_LINE = 2;
public static final short CATEGORY_WALL = 4;
public static final short CATEGORY_SQUARE_OBJECTIVE = 8;
public static final short CATEGORY_TRIANGLE_OBJECTIVE = 16;
public static final short CATEGORY_LIGHT = 32;

public static final short LIGHT_GROUP = 1;

public static final short MASK_BALL =
                CATEGORY_LINE |
                CATEGORY_WALL |
                CATEGORY_SQUARE_OBJECTIVE |
                CATEGORY_TRIANGLE_OBJECTIVE;

public static final short MASK_LIGHT =
                CATEGORY_LINE |
                CATEGORY_SQUARE_OBJECTIVE |
                CATEGORY_TRIANGLE_OBJECTIVE |
                CATEGORY_WALL;

public static final short MASK_SQUARE =
                CATEGORY_BALL |
                CATEGORY_LIGHT;

public static final short MASK_WALL = -1

I've been going non-stop for about 3 days trying to solve this problem to no avail.  Any help is appreciated!

sentences:
Why does my game loop speed vary on different platforms with the same hardware? I've got a serious issue with my game loop. This loop varies in time with the platform and with the same hardware. This is a list of FPS achieved:

  -  Windows       ======= 140 to 150
  -  Linux         ======= 120 to 125
  -  Windows(WINE) ======= 125 to 135

And since my game loop is fixed timestep, the speed of the game is
not stable. Here's my game loop.

public final void run() {
    // Initialize the resources
    Map.initMap();
    initResources();
    // Start the timer
    GTimer.startTimer();
    GTimer.refresh();
    long elapsedTime = 0;
    // The game loop
    while (running) {
        // Update the game
        update(elapsedTime);
        if (state == GameState.GAME_PLAYING) {
            Map.updateObjects(elapsedTime);
        }
        // Show or hide the cursor
        if (Global.HIDE_CURSOR) {
            setCursor(GInput.INVISIBLE_CURSOR);
        } else {
            setCursor(Cursor.getDefaultCursor());
        }
        // Repaint the game and sync
        repaint();
        elapsedTime = GTimer.sync();
        Toolkit.getDefaultToolkit().sync();
    }
}

The timer package

How could I improve it?

sentences:
Unity right mouse drag turn How would I use my right mouse button to turn a player character in unity, while only turning in the direction and speed of the drag?

Not sure if I'm meant to post this here or stackoverflow.

EDIT: game is 3D

EDIT2: Hold right click and drag to turn the camera

Edit3: Got this code

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

public class Control : MonoBehaviour {

public int speed;
public Transform tf;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButton(1))
    {
        tf.eulerAngles = new Vector3 (0, Input.GetAxis("Mouse X") * speed, 0);
    }
}
}

^ Code works, but after moving the mouse in the specified direction the character jumps back to its original position and kinda does this glitchy turn while moving the mouse (keeps jumping back to original position)

^ nevermind, I think that I figured it out

sentences:
Health zone heals player but I have a problem Hello I am creating a special health zone that gives the player health and my current scripts health is going up super fast and I want it to go up by 2 hp per second. How would I do this?
Here is the health zone script.
{
    public PlayerHealth playerHealth;
    public float healthGain = 2f;

    void OnTriggerStay2D(Collider2D other)
    {
        if (playerHealth.currentHealth < playerHealth.maxHealth)
        {
            playerHealth.currentHealth += (int)healthGain;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }

        if (playerHealth.currentHealth >= playerHealth.maxHealth)
        {
            playerHealth.currentHealth = playerHealth.maxHealth;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }
    }
}

sentences:
Lag compensation in rocket game context I have read a lot of papers recently to understand the lag compensation concept recently. They were all about the same context: shooter game where bullets move in infinite velocity.

The most important thing is checking what was in the crosshair when the client created the fire command. If another player was there at that time, then s/he's damaged. That is done by checking the world state at that time by finding a snapshot and executing commands until the fire command.

How about firing a rocket? That is slow (not to mention other differences: ignition time and area damage). That means, I cannot only check what was on the crosshair of the client at the command creation time.

If I go back and check the world state at that time (with same method above), it wouldn't be enough. I would still need to do the simulation for the next snapshots until the most recent one (server's present).

That would mean, if I have a time step of 15ms (tick rate = 66) and I want to discard a command if it is older than 1.5 seconds, I need to keep the most recent 100 (1500/15) snapshots of the world. And every time a delayed command comes, I have to re-simulate the world from that command's timestamp to present - including reprocessing the commands with timestamps after that one.

This sounds too much work on the CPU to me. Is this the same in the first scenario (infinite speed bullet)?

What about lag compensation for movement commands? Would that be different?

Or did I misunderstand something / many things?

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:
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: Opinions on using AE and/or Flash for 2D animation? I am each day making the art in illustrator more complete and now comes the time where I decide to invest in an animation program/route. I hear at times for people to use Toon Boom but the problem is I don't see a ton of tutorials and it seems like it's more for hand drawn animation. So, I'd use AE for example to draw out 15 or so frames for my robot rolling animation, adjusting the lines in different areas and then use a script to export that to a spritesheet I suppose. The main thing I want to avoid is the stiff puppet animation I see in many flash animations. So, do you guys have any thoughts on starting on either of these two programs for 2D animation or tips in general in relation to this process?

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:
Inverting the Z coordinate of the light vector I noticed that in some vertex shaders they invert the Z coordinate of the light vector, i.e.

// Compute denormalized light vector in world space
float3 vLightWS = g_LightPosition.xyz - vPositionWS.xyz;
// Need to invert Z for correct lighting
vLightWS.z = -vLightWS.z;

Shouldn't be that the light vector starts at the light's position and ends at the vertex position, but in order to use it in the diffuse lighting calculation it is reverted to start at the vertex position and end at the light's position as float3 vLightWS = g_LightPosition.xyz - vPostionWS.xyz suggests?

In this case what is the meaning of the Z coordinate inversion?

sentences:
LibGDX Box2D, how to play an animation once, then set the state back So, I've got some animations in LibGDX that I want to get running. Currently, the walking animations work perfectly, but attacking doesn't. I want the attack animation to play once, then set the State back to WALKING.

I've been experimenting with attacking upward (that's why the code's different), and all it does is flash and go back to walking. The other three directions show only the last frame of the animations, and holds it there. Does anyone know how to get this to work? I've looked at the similar questions, but none of them are helping.

There's a lot of code in this method, so I apologize in advance:

private TextureRegion getFrame(float dt) {
        TextureRegion region = null;
        if (currentState == State.WALKING) {
            switch (currentDir) {
                case UP:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkUp.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkUp.getKeyFrame(stateTimer, true);
                    }
                    break;
                case RIGHT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkRight.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkRight.getKeyFrame(stateTimer, true);
                    }
                    break;
                case LEFT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkLeft.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkLeft.getKeyFrame(stateTimer, true);
                    }
                    break;
                case DOWN:
                default:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkDown.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkDown.getKeyFrame(stateTimer, true);
                    }
                    break;
            }
        } else if (currentState == State.ATTACKING) {
            switch (currentDir) {
                case UP:
                    region = heroAtkUp.getKeyFrame(stateTimer, true);
                    if (heroAtkUp.isAnimationFinished(stateTimer)) {
                        currentState = State.WALKING;
                    }
                    break;
                case LEFT:
                    region = heroAtkLeft.getKeyFrame(stateTimer);
                    break;
                case RIGHT:
                    region = heroAtkRight.getKeyFrame(stateTimer);
                    break;
                case DOWN:
                    region = heroAtkDown.getKeyFrame(stateTimer);
                    break;
                default:
                    region = heroWalkDown.getKeyFrame(stateTimer); //should never happen
                    break;
            }
        }

        stateTimer = currentDir == previousDir ? stateTimer + dt : 0;
        previousState = currentState;
        previousDir = currentDir;
        return region;
    }

sentences:
Collison detection trouble. (c++ SDL2) I have a small trouble with my collsion detection system, ill show it on images.
im checking the detection by using that logic with example when moving to the right:

obj.x+obj.w+obj.mov > block.x
obj.x+obj.w+obj.mov < block.x+block.w
and
(
    obj.y <= block.y
    obj.y+obj.h >= block.y
    or
    obj.y <= block.y+block.h
    obj.y+obj.h >= block.y+block.h
)

when object size and block size are equal, the problem appears

the 3 blocks are detected

1 = is the trouble maker

2 = isnt making much problem, since its on same axis

3 =  is working

the 1 block is detected since its within Y + H area of the block (

it happens when the object is sticked with 0 pixel distance.

im using motion based on min(mov,dist) [dist is Y distance between object and block] function and when it tries to move to the right, it gets moved like that

because min(mov,dist) will become negative when getting distance to object 1 instead of 3, making it buggy

im asking if its possible to prevent block 1 (block 2 optionaly) when that situation happens. (or atleast change the logic)

sentences:
Octrees and Vertex Buffer Objects As many others I want to code a game with a voxel based terrain. The data is represented by voxels which are rendered using triangles. I head of two different approaches and want to combine them.

First, I could once divide the space in chunks of a fixed size like many games do. What I could do now is to generate a polygon shape for each chunk and store that in a vertex buffer object (vbo). Each time a voxel changes, the polygon and vbo of its chunk is recreated. Additionally it is easy to dynamically load and reload parts of the terrain.

Another approach would be to use octrees and divide the space in eight cubes which are divided again and again. So I could efficiently render the terrain because I don't have to go deeper in a solid cube and can draw that as a single one (with a repeated texture).

What I like to use for my game is an octree datastructure. But I can't imagine how to use vbos with that. How is that done, or is this impossible?

sentences:
LWJGL Wait for key press in a single method Currently I am implementing the possibility in my game to change the keyboard configuration.
Therefor, I have a menu in which is a button for each action the player can do. If the player clicks on one of these buttons, the game should wait until the player hits a key on the keyboard.

But this is my problem. I have no idea how to wait for a keypress.
I tried to do something like:

while(!Keyboard.next()){}
// Now there should be events. Just get the key of the last event.

But it did not work and ended with an infinite loop.
The problem is, it has to work in a single method, as it is the onClick method of the button.

Does somebody know a way to handle this problem correctly?
And how is this done usually? (I have seen such functionality in some games)

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: 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:
Oscillating Sprite Movement in XNA I'm working on a 2d game and am looking to make a sprite move horizontally across the screen in XNA while oscillating vertically (basically I want the movement to look like a sin wave). Currently for movement I'm using two vectors, one for speed and one for direction. My update function for sprites just contains this:

Position += direction * speed * (float)t.ElapsedGameTime.TotalSeconds;

How could I utilize this setup to create the desired movement? I'm assuming I'd call Math.Sin or Math.Cos, but I'm unsure of where to start to make this sort of thing happened. My attempt looked like this:

    public override void Update(GameTime t)
    {
        double msElapsed = t.TotalGameTime.Milliseconds;
        mDirection.Y = (float)Math.Sin(msElapsed);
        if (mDirection.Y >= 0)
            mSpeed.Y = moveSpeed;
        else
            mSpeed.Y = -moveSpeed;
        base.Update(t, mSpeed, mDirection);
    }

moveSpeed is just some constant positive integer. With this, the sprite simply just continuously moves downward until it's off screen. Can anyone give me some info on what I'm doing wrong here? I've never tried something like this so if I'm doing things completely wrong, let me know!

sentences:
Programming and drawing to deal with different screen sizes and resolutions I started making an XNA game years ago and picked it up recently.

I'm looking later to convert it to use Monogame so that it can be deployed on various mobile devices and OS, though I have a sinking feeling that a lot of the sprites and code will be broken by the changing screen sizes when I move outside of the emulator.

The game is currently hard coded to to 800x480 and the level placements and sprite sizes were all done to fit that at the time.

So question:

What do I need to ensure this works and displays properly on a variety of screens and devices?

sentences:
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:
Which version of Quake 2 source code do I need to compile to work with version 3.20 map packs? I'm a big fan of Quake 2 game. Recently I've decided to spend some of my free time for digging into the Quake 2 src code. There are 2 versions of the full game code 3.19 and 3.21 (including the game exe as well as the game dll).
As regards to the Q2 Mission Packs the src files for both The Reckoning and Ground Zero are rather of verions 3.20 as the filename suggests (xatrixsrc320.exe and roguesrc320.exe)
My question is WHICH version of the game exec do I have to compile to use with the mission pack dlls? Is it better to use the 3.21 exe together with 3.20 of the xatrix & rogue dlls, or maybe the older 3.19 would be more appropriate?

sentences:
Why the rotation using the Coroutine is rotating but the object is in slant ? and how to rotate it with Coroutine non stop? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spin : MonoBehaviour
{
    public Vector3 targetRotation;
    public float duration;
    public bool spinInUpdate = false;

    // Start is called before the first frame update
    void Start()
    {
        if (spinInUpdate == false)
        {
            StartCoroutine(LerpFunction(Quaternion.Euler(targetRotation), duration));
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (spinInUpdate == true)
        {
            transform.Rotate(new Vector3(0, 1, 0));
        }
    }

    IEnumerator LerpFunction(Quaternion endValue, float duration)
    {
        float time = 0;
        Quaternion startValue = transform.rotation;

        while (time < duration)
        {
            transform.rotation = Quaternion.Lerp(startValue, endValue, time / duration);
            time += Time.deltaTime;
            yield return null;
        }
        transform.rotation = endValue;
    }
}

slant I mean this is how it's rotating with the Coroutine the small cube that rotate is in slant :

When using the Update way it's rotating fine and this is how it should rotating also with the Coroutine for example on the X only :

The small cube when rotating either in update or in the Coroutine  should not be slant. but it's slant in the Coroutine.
And how can I add a speed factor to the Update to control the rotation in the Update in case using the Update ?
About controlling the speed in the Update I just added a global float variable and in the Update :
transform.Rotate(new Vector3(0, Time.deltaTime * rotationSpeed, 0));

and it's working for the speed.

sentences:
Player with Character Controller and children colliders won't collide properly I have a player that consists on a root object with the Character Controller attached and some children with its components. Those have box colliders attached.

When moving the player I want to be able to collide with other objects using the box colliders, but it won't, instead it will only collide with the Character Controller.

As you can see in the image, the red object didn't stop when the collider crashed with the framed cube, but it did when it did with the Character Controller.

There is any way to use the player colliders instead of the Character Controller for collision detection?

sentences:
Libgdx: Using an AssetManager in every Screen or use a single AssetManager in Game class I have a HexGame class extending Game and various Screens that receive the game object in their constructor. I was thinking of having one AssetManager in the game class and using it to load the necessary assets in each screen's constructor and unload them in the screen's dispose method.
The alternative would be to use a new AssetManager in every screen. What would be best practice?

sentences:
How not to break licence laws? I have an idea for a game. Also I have almost everything worked out considering coding.

What interests me the most is how can I know if that game can be published.

As it would be for iOS and android, these markets are of the geratest interest for me.

I found on apples store something similair to what I would make and it's published by some big game developer. How can I be sure I am not breaking any laws when publishing the game? Can I make a game like board game 'Risk'?

I don't have any knowledge considering licencing. This game would be avaliable for free, with an option to donate, so money isn't my objective (but it won't hurt) [:

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:
SpriteBatch, trying to reduce draw calls This my main draw call:

       Matrix Camera_transformation = player_camera_.GetTransformation();

        // Background - AlphaBlend
        spritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera_transformation);
        background_.Draw(spritebatch);
        spritebatch.End();

        // Particles (of a player power, I want them behind him!) - Additive
        spritebatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, Camera_transformation);
        player_.DrawParticles(spritebatch);
        spritebatch.End();

        // Player - Alpha Blend
        spritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera_transformation);
        player_.Draw(spritebatch);
        spritebatch.End();

        // Hub/Ui - Not to be influenced by the camera, but always on top
        spriteBatch.Begin();
        UI.Draw(spritebatch)
        spriteBatch.End();

Is there a way to reduce the number of calls here?
If my particle system didn't need an additive drawing, I would have merged the first three calls, but I can't. Is there something I am missing about spritebatch ordering?

sentences:
Triangle accuracy picking for animated models in XNA I can do picking with triangle-accuracy for non-animated models, but I also have animated models in my game. How do I do picking on animated models?

I use code based on this project for animation.

My first idea for doing it is:

Calculate ray
For each model
    If model bounding sphere collides with ray
         For each meshPart
              Make animation transformation
              Calculate transformed triangles in meshPart
         Test collisions of ray with resulting triangles

Have you ever considered how to make something like this?

sentences:
Do Apple and Google ask for a share if custom payment is done in a free app? I have a multiplatform game (web/iOS/Android) in the making. In the free version the core game is still fully playable but people who choose to pay will get more social features (and no ads, of course).

I was thinking that rather than having a free and a paid version for all the platforms I may release the apps just for free and if the users want more, they have to register and pay a one-time fee (through a payment gateway or PayPal). The extra content would then be available in all the clients they have access to. Theoretically, this means a better value for the players and less maintenance and headache for me (obviously I have to handle all the payment troubles myself).

Does it fit into the business model of Apple/Google? Or will they still claim their share of the registration fee?

sentences:
Reducing mobile build size This is my second time making and game and I want to make sure that I fit under 50 mbs. So far my plan is to fit all the games artwork into two 2048x2048 sprite sheets. I tested a empty unity3d project and when the apk was made it was 19 035 KB of size. Where does this overhead come from and how can I reduce it?

This is not a duplicate question of this one. I'm asking why building a completely empty project results in a apk with a size of 19 MB. Does this mean that I have limit my assets to 30 MB so that the complete app will be less than 50 or is there a way to strip some of those initial 19 MB.

sentences:
Unity - strange performance impact with moving objects I'm trying to find the solution for 46 hours now and I'd be really happy if someone knows it!

I'm using a DOTween library for moving the objects. I also use LeanTween, cause I heard it's faster but none of these work for me in this case. I've used tweening libraries alot, but never faced an issue like this.

The bug appeared in my project, so to check it I created a blank one. An empty scene, with a camera and one cube with scale[10,2,10].

Now, I've added a simple script:

    Sequence sequence = DOTween.Sequence();

    sequence.Insert(0f, transform.DOMove(transform.position + new Vector3(10f,0f,0f),1f)).SetEase(Ease.Linear);
    sequence.Insert(1f, transform.DOMove(homePosition,1f)).SetEase(Ease.Linear);
    sequence.SetDelay(1f);
    sequence.SetLoops(-1);

The script moves the cube continously by 10 units to the right, and back (both in 1 second).

There's a noticable jitter.

This jitter is strange, cause it does not happen contantly. It choses a time and just freezes the cube in place for a really tiny amount of time which is noticable - when you see a smoothly moving object and it freezes for a moment.

As you can see, there's a linear interpolation, but I've tried with many (it's even better visible with other interplation types).

Now. The profiler is not the case, cause I've tested it on the empty project with one object on the scene.

Things I've already tried:

Turning off occlusion culling
Turning off everything I could
All the combinations of quality settings
LeanTween instead of DoTween

The one thing I came up with is the profiler's WaitForTargetFramerate.
By definition, when WFTF is huge it means that the app is doing well, cause it finished it's work and waits for the next frame. In my opinion in this case it's the reason of the bug.

I have a screenshot of the profiler window (with one cube, one directional light and this script attached to a cube):

Now, I'm not 100% sure, but I think that this jitter may happen on these V-Sync drops on the screen.

Everything is tested on the PC. On Android there's the same thing (a noticable jitter), but I didn't run the profiler.

If someone has any idea what may be the cause of this - I'd be grateful. I'll put a bounty here as soon as I can, cause I'm really tired! :)

@ DMGregory

This is before the 'jump' on the GPU chart:

and that's on the 'jump':

There's no RigidBody or Collider, but on my main project there are box colliders on these floors. I've also tried adding RB with the Interpolation checked. No difference.

@ Josh Hamilton

Even if this is a normal behavior, that the frame completed faster - there are games on Google Play and AppleStore without any glitches like this. In my main project (where I discovered the issue) the biggest problem is that this lag is happening when I move the camera to follow the player smoothly and the freeze it noticable like anywhere else. Like the entire enviroment was freezing for 1-3 frames.

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: Turning around an enemy when hitting a wall or after x time I have an enemy that is supposed to go in one direction and after hitting the wall or if a certain amount of time passes, it should turn around and go back. After hitting another wall, it should turn around again and keep doing this in a loop.

sentences:
How can I create explosions like in Zelda: Breath of the Wild? The explosions in BotW look spectacular. Here's a video of them in slow motion: https://www.youtube.com/watch?v=bZtaNoUOSDQ

It looks like it's not all billboards, but also some volumetric geometry - it's hard to see all the details.

Ideally, an answer would be API agnostic, but I am using OpenGL with a homemade renderer, if that helps.

Which techniques are combined to create such a fantastic effect?

sentences:
How to implement in-game purchase? I am currently developing an indie game using XNA/C#. I would like to give players the opportunity to try a free (but somewhat limited) demo version of the game. Nevertheless, the player should be able to purchase the full version of the game from within the demo version (after short download) immediately unlocking the full version.

The tricky part is that I would like to permanently remember this purchase as I would like to give players how purchased the game the opportunity to download additional content etc. for free later. Nevertheless, the user should be able to switch computers or reinstall the game without loosing that "purchased"-flag. One (maybe) possible way would be to give each user a serial number that can be checked once at gamestart. Is there a library etc. to support this or is there maybe another best-practice for these kinds of things.

I guess the well-known payment processors as BMC-Micro and Fastspring do not support this, do they.

PS: I would like to keep the game DRM-free.

sentences:
Huge level size after build APK in Unity I made maps used bunch of small objects which are mostly scenary, like part of road, buildings, obstacles. They are all lightmap static, batching static, occludee static.

However after build APK, "levels" takes most spaces:

Uncompressed usage by category:
Textures      23.4 mb    5.3%
Meshes        24.9 mb    5.6%
Animations    4.5 mb     1.0%
Sounds        1.9 mb     0.4%
Shaders       1.8 mb     0.4%
Other Assets  4.8 mb     1.1%
Levels        287.1 mb   65.0%
Scripts       2.1 mb     0.5%
Included DLLs 3.9 mb     0.9%
File headers  389.1 kb   0.1%
Complete size 442.0 mb   100.0%

As you can see, it's 287.1mb, it's too big. Actual APK size is almost 100mb. Funny thing is that in my game, I don't use lightmap. I have 9 different maps, all of them don't have light map, only has baked navigation mesh and occlusion data.

I don't think that occlusion data and navigation mesh takes that much, because I can see that occlusion data is less than 1MB even in the biggest map.

Does it matter that using lots of small objects to create level without lightmapping takes much spaces?

Also I combined those scenary objects together with MeshBaker, which is Unity Asset that combine meshes and materials/textures. After build, there's a little size reduction only in "Levels" part, however overall game performance getting worse and total apk size is not changed.

So, why I have those huge "levels" size, and how do I reduce it? Is there something that I missed?

And which situtation is proper to combine multiple meshes into single? In stats result, average batches are 40 in my game. Should I combine those bunch of small objects as big single object?

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: 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:
Add navigation obstacles during runtime lags Please watch this short video. http://screencast.com/t/vw2a5FdOOT It shows the problem.

It's using the build in Unity navigation and followed the guide to build the demo in the video.

Everytime I add a new obstacle than all agends pauses (hiccups) for a short time. I think this is because they have to recalculate a new path. How to make this recalculation in a background thread? I want to make a mace tower defense.

Thank you for reading an watching!

sentences:
Technique for multiple shadow casting lights in 2D I'm trying to create shadows in a 2D game in such a way that I can have an arbitrary number of lights in a scene, all of which can cast shadows. To do this I think I have to generate a mesh for each light that models where the light can come (e.g. where there is no shadow).

In this tutorial: http://youtu.be/4BtjcH-iLR0?t=4m40s (at 4 minutes 40 seconds) Chris Molini does exactly what I want describing it as 'a polygon clipping pass' for each edge that intersects with the light. However I don't understand what kind of polygon clipping he is refering to here. I have tried to mimick his technique on my own but without success. (I get lost in corner cases and radial+distance ordering around the light).

Here's a screenshot from the video. The square is the light's mesh (basically an AABB containing the light's sphere of influence). Which is gradually adjusted for each edge that intersects with the light's mesh.

sentences:
AI Agent realistic leap to a player in a MMO In the last month I have been struggling with an issue, movement synchronization of a leap of an AI agent in a MMO. I know some theory and basic movement was not a problem with interpolation and stuff, the difficult part is implementing a leap move.

My current setup has a server and multiple clients connecting to it. The movement of the AI agent and its behaviour is computed on the server, the AI client receives position updates and interpolates between the current position and the position received from the server.

When the server decides that an AI has to attack, it sends an attack command to clients and, to make the thing more realistic, the clients stops their agents as soon as they receive the message and start an attack animation.

The important part now: during this attack animation, the agent quickly (0.6 s approx) translates (the translation is not in the animation) toward the targeted player. The client of that player then sends the landing position to the server which does some validation and hit checks and then resumes its behaviour computation sending new attack commands or position updates to clients.

This creates a very pleasing effect on the client of the player being attacked but may cause weird translations (due to the error in the position of the agents and the players) on other clients.

I tried predicting the "landing position" on the server but it's always somehow too wrong as it depends a lot on the target direction from the agent, and small changes in both the agent position and target position often lead to big errors.

Having a good look and feel of the leap on the client is imperative.

My questions are:

is there a better way to handle this in my case?
is there a good practice to follow in this that I am completely disregarding?

sentences:
Multiple textures on a mesh created in blender and imported in xna I created a cube in blender which has multiple images applied to its faces. I am trying to import the model into xna and get the same results as shown when rendering the model in blender. I go through every mesh (for the cube its only one) and through every part but only the first image used in blender is displayed in every face. The code I am using to fetch the texture looks like that:

foreach (ModelMesh m in model.Meshes)
{
   foreach (Effect e in m.Effects)
   {
      foreach (var part in m.MeshParts)
      {
         e.CurrentTechnique = e.Techniques["Lambert"];
         e.Parameters["view"].SetValue(camera.viewMatrix);
         e.Parameters["projection"].SetValue(camera.projectionMatrix);
         e.Parameters["colorMap"].SetValue(modelTextures[part.GetHashCode()]);

      }
   }
   m.Draw();
}

Am I missing something?

EDIT:

Here is the code for getting the texture from the blender and use it in the XNA:

foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    BasicEffect basicEffect = part.Effect as BasicEffect;

                    if (basicEffect != null)
                        modelTextures[part.GetHashCode()] = basicEffect.Texture;

                    part.Effect = material.effect;

                }
            }

sentences:
Make Minecraft Main Menu Camera movement I intend to make exactly like this. I highly suggest you watch just 5 seconds of the video because it already explains what I intend to do. I've been trying cosine and sine on vector3s but I can't seem to make it work since I usually get these results:

This however is my intended result:

This is my current code:
public class CameraWave : MonoBehaviour
{
    [SerializeField] float speed = 1f;
    // how deep and how wide the sine waves should be
    [SerializeField] float depthXY = 2f;
    // radius of the circle
    [SerializeField] float radiusZ = 10f;
    // makes the waves on the y axis and translates it
    [SerializeField] Transform targetLookAt;
    // parent of target look at so we can move it in the z direction
    [SerializeField] Transform lookAtContainer;
    // set angle to middle
    float angle = 0.35f;
    Vector3 cameraOffset;

    void Start() { cameraOffset = targetLookAt.position; }

    void Update()
    {
        // adjust angle
        angle += Time.deltaTime * speed;
        angle %= 360;

        // make cos-sine wave
        float x = Mathf.Cos(angle) * depthXY;
        float y = Mathf.Sin(angle) * depthXY;
        // set to look at
        Vector3 position = new Vector3(x,y);
        targetLookAt.localPosition = position;

        // update container to make it go in circles
        lookAtContainer.position = MakeCircleZ(angle) + cameraOffset;
    }

    Vector3 MakeCircleZ(float angle){
        Vector3 v = Vector3.zero;
        v.x = (radiusZ * Mathf.Cos(angle));
        v.z = (radiusZ * Mathf.Sin(angle));
        return v;
    }
}

My hierarchy setup:

any help is appreciated

sentences:
Input.GetAxisRaw not returning zero after releasing the key In my WebGL Project here is the way for camera navigation (Movement/Rotation) on Update event:

void UpdateMovement()
    {

        bool accelerate = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
        moveDirection   =
            new
            Vector3(
                Input.GetAxisRaw("Horizontal") * moveSpeed,
            0,
            Input.GetAxisRaw("Vertical") * moveSpeed);
        //moveDirection = new Vector3(Input.GetAxis("Horizontal") * moveSpeed, 0, Input.GetAxis("Vertical") * moveSpeed);
        moveDirection   = transform.TransformDirection(moveDirection);

        if (Input.GetButton("Up"))
        {
            moveDirection.y += moveSpeed;
        }
        else if (Input.GetButton("Down"))
        {
            moveDirection.y -= moveSpeed;
        }

        if (Input.GetAxisRaw("Mouse ScrollWheel") > 0)
        {
            moveDirection.y = moveDirection.y + scrollSpeed;
        }
        else if (Input.GetAxisRaw("Mouse ScrollWheel") < 0)
        {
            moveDirection.y = moveDirection.y - scrollSpeed;
        }

       moveDirection *= (accelerate ? speed : moveSpeed);
        controller.Move(moveDirection * Time.deltaTime);

    }
    void UpdateRotation()
    {
        if (!Input.GetMouseButton(1))
            return;

        rotationX += Input.GetAxis("Mouse X") * lookSpeed;
        rotationY += Input.GetAxis("Mouse Y") * lookSpeed;
        rotationY = Mathf.Clamp(rotationY, -90, 90);
        rotationZ = Input.GetAxis("Mouse ScrollWheel");

        transform.localRotation = Quaternion.AngleAxis(rotationZ, Vector3.forward);
        transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up);
        transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);
    }

All working fine but the problem on WebGL canvas when I rotate the camera using mouse and comes out of the bound of WebGl canvas meanwhile, I also continuously press horizontal or vertical key, then release input key doesn't work. Remember I logged the key[Input.GetAxisRaw("Horizontal"),Input.GetAxisRaw("Vertical")] input and found that it is not reset to zero on release.

 Debug.Log("Hr GetAxisRaw : " + Input.GetAxisRaw("Horizontal"));
 Debug.Log("Vertical : "     + Input.GetAxisRaw("Vertical"));

Normally when I don't use camera rotation using mouse and during this time, when i release the horizontal/vertical key, it works fine.

sentences:
XNA Texture mapping on model I have a cube as my model and want to map a texture on every side of the cube. I have been searching for a while and most answers suggest using 3D max or using VertexPositionTextures.

I am not allowed to use any moddeling program, I have to use XNA, so that is not an option.
For VertexPositionTextures you have to provide a Vector3 and a vector2 containing the position and the some area of your texture. But then, why would I use a model if I provide the position myself? Do I get this wrong maybe?

I tried to add the texture to my effect with effect.texure = ... but I can't specify what to map. It just puts the texture on my model.

So how can I map a texture to my model and specify what and where to map?

sentences:
FOSS games using original assets, is it legal? Can I make a game that uses the assets of another game on the users' computer, without legal issues? For example, I make a game that requires the user have game X installed, and I use the assets of game X in my game. The assets of game X would not be distributed with my game.

I realize it will be hard for companies to check, but can you use the assets for other purposes than originally intended (playing the original game)?

As a more concrete example, is playing a game like OpenXcom really legal, when you own the original game?

sentences:
Mirror problems after building game in unity Hi I am facing a weird problem in unity when I build a particular scene.

Here is the screenshot of how the mirror looks when I play the game from inside the unity editor:

And here is how it looks once I build this scene and then play it:

The quality settings at Edit->Project Settings->Quality are these:

And the player settings at File->Build Settings->Player Settings are these:

So how do I fix this? What do I need to change or is there any other entity?

sentences:
Mixamo: can animations ("without skin") be re-used on any Mixamo rigged model? I've discovered Mixamo very recently. I plan to use its auto-rigging capability on all my unrigged characters.

The download option can either include the skin or just obtain the animation.

My understanding is that an animation is "simply" applying a composite timeline where each bone is modified separately.

Am I right to believe that downloading an animation from Mixamo makes it compatible with every Mixam-rigged character? Or am I to download the same animations for each variation in my skeletons (arm length, hip width, neck size, etc.) ?

Quick heads up: Mixamo

Mixamo is an auto-rigging tool. For instance, this Blender character will be imported as a .zip (containing my .obj and .mtl)

You are just expected to place the following colored circles on your humanoid:

After the auto-rigging completes, you can either download your static, rigged character (as an .fbx) or animate it using one of the many free animations. After applying an animation (one at a time), you can either download the character (mesh) plus its anim or simply the bare skeletal animation.

Thanks!

sentences:
How do I avoid fetching duplicate tetromino shapes from a Shape array in Unity/C#? I'm working in C# in Unity on a tetrominoes game. I have seven basic shapes (I, J, L, O, S, T, Z) but each of the four component squares on each shape is labelled with an identifier unique to the shape set. So the shapes include, e.g., an S-1,2,3,4, S-5,6,7,8, S-9,10,11,12, J-13,14,15,16, J-17,18,19,20, Z-21,22,23,24....

Currently, in my Spawner class, I have the following to fetch a shape randomly from the shape array, m_shapeSet1:

public class Spawner : MonoBehaviour {

public Shape[] m_shapeSet1;

Shape GetRandomShape()
{
    int i = Random.Range(0, m_shapeSet1.Length);
    if(m_shapeSet1[i])
    {
        return m_shapeSet1[i];
    }
    else
    {
        return null;
    }
}

I thought it would be simple to use m_shapeSet1.RemoveAt(i) before the final closing brace after each fetch to avoid fetching, and later spawning (there is another function to spawn shapes), a duplicate shape. BUT, Visual Studio responds with: (1) the RemoveAt request is unreachable and (2) Shape[] has no definition for RemoveAt and no extension for it.

(I'll have to add a Do While or another control to this as I cannot retrieve a shape from the empty array I hope to create once I'm able to get only a unique shape.)

Anyway, how do I get a shape without duplication?

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:
Adding text to gameobject I'm trying to create a falling word game like z-type (code here). I have created 3 game objects and I want the words to be added as text to these game objects something like a health bar is added to enemies etc. This is the word spawner script that spawns the word on screen.

public GameObject wordPrefab;
public Transform wordCanvas;

public WordDisplay SpawnWord()
{
    Vector3 randomPosition = new Vector3(Random.Range(-2.0f, 2.0f), 7.0f, 0);
    GameObject wordObj = Instantiate(wordPrefab,randomPosition, Quaternion.identity, wordCanvas);
    WordDisplay wordDisplay = wordObj.GetComponent<WordDisplay>();
    return wordDisplay;
}

Right now the words are spawned at a random x position and y position of 7.0. Instead of this how can I assign the words to the gameobjects that I have created.

Edit

I have created a spawner that spawns 3 enemies at the top of the screen and they start falling down to the bottom. Here is the script attached to the enemy game objects:

public float fallSpeed = 1.0f;
public GameObject wordPrefab;
private Transform parent;

public WordDisplay SpawnWord()
{
    Vector3 randomPosition = new Vector3(Random.Range(-2.0f, 2.0f), 7.0f, 0);
    GameObject wordObj = Instantiate(wordPrefab, randomPosition, Quaternion.identity, parent);
    WordDisplay wordDisplay = wordObj.GetComponent<WordDisplay>();
    return wordDisplay;
}

// Update is called once per frame
void Update () {
    transform.Translate(0, -fallSpeed * Time.deltaTime, 0);
}

I have also removed the SpawnWord() method from the wordspawner script. However the words don't spawn along with the enemy gameobjects. There is one more script called the WordTimer. Not sure where to add this code. This is from the original code that's on github.

public WordManager wordManager;
public float delay = 1.5f;
private float nextWord = 0f;

void Update()
{
    if (Time.time >= nextWord)
    {
        wordManager.AddWord();
        nextWord = Time.time + delay;
        delay *= 0.95f;
    }
}

sentences:
How to share some elements of array with different players on Photon in the same Room? Unity3d I want to assign cards to different players in the room. I've a Class "Cards" that contains an array of 52 cards like this: "2_of_spades","3_of_spades"....... and so on. All i want is to assign random indexes or values to different players on the basis of which I'll instantiate Cards Sprites. How can I do that?
I've heard that there are RPC calls but how do I manage to make a "Middle Man" script that would deal with different players?

sentences:
How to move an object up and down like a wave? I am trying to move my object up and down using cos and sin, but I have problem understanding how does the sin and cos work, so I can make my object move up and down like a wave frequently

Init Time starts from value of 16.00  it keeps on increment up to 17.065

initTime += msec * 0.001;
float x  =  cos(initTime* 2.46) * 2075;
float y  =  sin (initTime* 2.888) * 200;

My object goes down and up, then goes back to its initial position, then goes up and down once again, I want it to be like a wave

sentences:
How do I reduce the size of my symbols.zip? I am making an Android app in Unity.  Google recommends using a symbols.zip, which Unity auto-generates.  However, the symbols.zip that Unity is generating for my app is over 1 GB, and the max size that Google will accept is 300 MB.
How can I reduce the size of my symbols.zip?

sentences: How can I detect and compensate for system related lag? The best example I can think of is Doom 3. It seemed to me that if there was any kind if lag the game would pause and then resume without "fast forwarding" to catch up. I'm trying to figure out a good practice to use for lag detection in JavaScript.

sentences:
LibGDX camera position shifted on movement I'm programming a game with LibGDX and Box2D and I want my camera to follow my player. But as I zoom in (because Box2Ds metric system, using camera.zoom = x) the camera is shifted when the player moves (the camera follows the player):

Shifted View

Normal View

That only happens when the player moves, so there can't be a problem with the coordinates. My Question is how to remove this shifting as the player moves.

Here's some of my code:

Render Loop (excerpt):

@Override
public void render(float delta) {
    //set the camera position to player's position
    cam.position.set(player_body.getWorldCenter().x, player_body.getWorldCenter().y, 0);
    cam.update();

    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    world.clearForces();

    handleInput();

    Gdx.gl.glClearColor(.05f, .05f, .05f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(cam.combined);

    debugRenderer.render(world, cam.combined);

}

Make the player move:

if (Gdx.input.isKeyPressed(Keys.W)) {
    player_body.setLinearVelocity(transX, transY);
    player.setMoving(true);
}

sentences:
How to put the “camera” inside a cube in OpenGL I'm really new to OpenGL and can't seem to figure out how to put the "camera" inside the cube I've created so that I can move in an FPS-like style.  I tried to use gluLookAt and gluPerspective but I'm clearly missing some steps. What should I do before gluLookAt? Here's the code written so far:

    int rotate_Y; //used to rotate the cube about the Y-axis
    int rotate_X; //used to rotate the cube about the X-axis

//the display function draws the scene and redraws it
void display(){

    //clear the screen and the z-buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity(); //resets the transformations

    glRotatef(rotate_X, 1.0, 0.0, 0.0);
    glRotatef(rotate_Y, 0.0, 1.0, 0.0);

    //Front Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.0, 1.0, 0.0);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    //Back Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 0.0);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glEnd();

    //Right Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 1.0);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    //Left Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.7, 0.7, 0.0);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glEnd();

    //Upper Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.7, 0.7, 0.3);
    glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(-0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, -0.5f);
    glVertex3f(0.5f, 0.5f, 0.5f);
    glEnd();

    //Bottom Face of the cube - vertex definition
    glBegin(GL_POLYGON);
    glColor3f(0.2, 0.2, 0.8);
    glVertex3f(-0.5f, -0.5f, -0.5f);
    glVertex3f(-0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, 0.5f);
    glVertex3f(0.5f, -0.5f, -0.5f);
    glEnd();

    glFlush();
    glutSwapBuffers(); //send image to the screen
}

int main(int argc, char*argv[]){

    //initialize GLUT
    glutInit(&argc, argv);

    //request double buffering, RGB colors window and a z-buffer
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

    //create a window
    glutInitWindowSize(600, 600);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Space");

    //enable depth
    glEnable(GL_DEPTH_TEST);

    //callback functions
    glutDisplayFunc(display); //display - redraws the scene
    glutSpecialFunc(specialKeys); //special - allows interaction with specialkeys

    //pass control to GLUT for events
    glutMainLoop();

    return 0; //this line is never reached
}

Feel free to ask more about what I'm trying to achieve if I wasn't clear enough. Thanks for your help.

sentences:
Why does my MonoGame mesh throw an unhandled exception when trying to draw? I am using the '3D Models' chapter of Learning XNA 4.0 to further understand 3D implementation in XNA, but I am running into an unhandled exception, when I try to draw each mesh.
Here is my basic Draw() function. It determines the amount of mesh transforms inside my model, and proceeds to draw each one, using a default BasicEffect.
public virtual void Draw(Camera camera)
{
    Matrix[] transforms = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.Projection = camera.projectionMatrix;
            effect.View = camera.viewMatrix;
            effect.World = GetWorld() * mesh.ParentBone.Transform;
        }

        mesh.Draw();
    }
}

When I attempt to run, I get stopped at mesh.Draw();, with the error

An unhandled exception of type 'System.InvalidOperationException' occurred in MonoGame.Framework.dll
Additional information: An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, TEXCOORD0, COLOR0.

The model was provided by our lecturer. I have confirmed that the model shouldn't have any problems drawing. I have also found a similar issue to the one I am having, on the MonoGame forums, however the user reported having a current vertex declaration that includes "SVPOSITION0, TEXCOORD0, COLOR0", and the solution appeared to be changing "SVPOSITION0" to "SV_Position0".
While I am unsure how to directly change the vertex declaration, it appears I should already have the correct vertex declaration.
Why won't my mesh draw?
If I remove the effect.EnableDefaultLighting() line, it works, no problem. However, I then do not have light, and everything comes up as black. If I replace my ground.x model with the spaceship.x model supplied by Microsoft, it works with lighting. I presume my issue is with my model, however, I can not access spaceship.x to read in plain english, as I can with my ground.x.
Ground.x
xof 0303txt 0032
template Vector
{
    <3d82ab5e-62da-11cf-ab39-0020af71e433>
    FLOAT x;
    FLOAT y;
    FLOAT z;
}

template MeshFace
{
    <3d82ab5f-62da-11cf-ab39-0020af71e433>
    DWORD nFaceVertexIndices;
    array DWORD faceVertexIndices[nFaceVertexIndices];
}

template Mesh
{
    <3d82ab44-62da-11cf-ab39-0020af71e433>
    DWORD nVertices;
    array Vector vertices[nVertices];
    DWORD nFaces;
    array MeshFace faces[nFaces];
    [...]
}

template Coords2d
{
    <f6f23f44-7686-11cf-8f52-0040333594a3>
    FLOAT u;
    FLOAT v;
}

template MeshTextureCoords
{
    <f6f23f40-7686-11cf-8f52-0040333594a3>
    DWORD nTextureCoords;
    array Coords2d;
    textureCoords[nTextureCoords];
}

Mesh
{
     4;
     65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;65536.00000;,
     65536.00000;0.000000;65536.00000;;
     2;
     3;0,1,2;,
     3;0,2,3;;

    MeshTextureCoords
    {
         4;
         0.000000;0.000000;,
         0.000000;1024.000000;,
         1024.000000;1024.000000;,
         1024.000000;0.000000;;
    }

    MeshMaterialList
    {
        1;
        2;
        0,
        0;

        Material
        {
            0.800000;0.800000;0.800000;1.000000;;
            0.000000;
            0.000000;0.000000;0.000000;;
            0.000000;0.000000;0.000000;;

            TextureFilename{"sanddf.png";}
        }
    }
}

sentences: 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:
Level Design: Char Traveling to and from a Site I'm developing a 2d platformer game where your character can travel to and from sites as he pleases. To travel to and from these sites the character must travel along a path between his current location and his destination (see illustration below).

And of course the idea is that you can travel through the level backwards if you wish to return to Site One. But as you probably realize, doing this may provoke some serious problems, and will put limitations on the level design (no cliffs or long drops because then your character wouldn't be able to overcome them on the way back). I've come up with multiple ways to overcome this (such as designing two levels for the same path etc), but I was wondering if anyone else has any creative work-arounds for this problem. Any help and advice is appreciated.

sentences: 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:
Scrolling and Parallax scrolling in 2D game I'm developing a 2D side-scrolling game.I have a scrollable bitmap for background with size 2400x480.How can i scroll this bitmap?I have searched for algorithms but i can't find any solution.

I know that i can do it with following code:

for(int i=0;i<100;i++)
draw(bitmap,2400*i,480);

So it will scroll bitmap for 240000 pixels.

But i don't want to draw images which stays out of screen(with size 800x480).

How can i render scrolling tile?How can i give velocity to it?(For parallax scrolling after normal scrolling)

sentences:
Events vs Pinging: How should I structure my HUD-updating code? I'm starting to develop a 2D fighting game using C++ and SMFL. I'm relying (at least sort of) on a Entity Design Pattern.

I'm struggling to see how my code should update and manage a heads-up-display (HUD).

I think there are two main possibilities:

The HUD object has references to the players. It periodically updates itself by querying them.
The different systems (input, physics, ...) update the HUD anytime by sending it new information.

The first seems costly because the information might not have changed as often as the HUD queries for it. The second one seems less automatic because the systems NEEDS to specifically call to update the HUD (plus the HUD needs to provide various methods).

What should I do?

sentences:
Android - Using opengles through java vs c++ Ive been reteaching myself opengl so I can make a game on android. However Ive been struggling with how to build objects and scenes in opengl using c/c++ and passing them through the jni to the virtual machine where android can use them. Can some one point me towards some tutorials that actually show the use of natively built objects being created and passed through to the jni. Im fine using c++ or java I just dont have much experience using the jni.  Ive built some sample projects where I pass primitives like floats and perform operations on them on the native side and then passed them back but I cant figure out how to create a scene in opengl in c++ and then pass it to java.  Ive been looking at writing everything using java but Im not sure if the java bindings make for some performance loss.

Any help would be much appreciated

sentences:
Accelerometer based games smoothness Take Doodle Jump and other games that rely on the accelerometer. The movement of the character is very smooth and I have no idea how they implemented it. I've seen a number of SO/GameDev/forum questions, but the discussion ends abruptly when someone recommends a high/low pass filter. I've tried that (unless I'm missing something) and the results are nowhere near smooth.

All I'm trying to do is move a character on the x axis. This is the code I have and it's very "choppy". It's actually the code you can see on the official Android tutorials.

float alpha = 0.9f; //tried many values from 0.1f to 0.99f. chopiness still there

@Override
public void onSensorChanged(SensorEvent event) {
    if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
        if(init) {
            gravity[0] = event.values[0];
            gravity[1] = event.values[1];
            gravity[2] = event.values[2];

            init = false;
        } else {
            gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
            gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
            gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
        }

        // Remove the gravity contribution with the high-pass filter.
        linear_acceleration[0] = event.values[0] - gravity[0];
        linear_acceleration[1] = event.values[1] - gravity[1];
        linear_acceleration[2] = event.values[2] - gravity[2];

        character.setX(character.getX() - linear_acceleration[0]);

    }

I also tried multiplying linear_acceleration[0] with a sensitivity, where 0 < sensitivity < 1 but the choppiness still doesn't go away. What is the next step from here to achieve a smooth movement like in Doodle Jump?

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:
2D mouse coordinates from 3d object projection Not entirely certain of the nomenclature here -- basically, after placing a model in world coordinates and setting up a 3D camera to look at it the model has been projected onto the screen in a 2D fashion.

What I'd like to do is determine if the mouse is inside the projected view of the model.

Is there a way to "unproject" in the XNA framework?  Or what is this process called as, so that I can better search for it?

sentences:
Libgdx 2d floor Animation I'm building Runner Game.
 Ground Class.

public class Ground extends Actor {

private Texture texture;
private ArrayList<Vector2> groundLocations;
private float speed;
private float cameraLeft, cameraRight;
private int textureWidth;

public Ground() {
    this.cameraRight = Const.GAME_WIDTH + Const.GAME_MARGIN;
    this.cameraLeft = 0 - Const.GAME_MARGIN;
    texture = new Texture(Gdx.files.internal("ui/ground.png"));
    groundLocations = new ArrayList<Vector2>();
    init();
}

public void setSpeed(float speed) {
    this.speed = speed;
}

private void init() {

    textureWidth = texture.getWidth();
    float currentPosition = cameraLeft;
    while (currentPosition < cameraRight) {

        Vector2 newLocation = new Vector2(currentPosition, 0);
        groundLocations.add(newLocation);
        currentPosition += textureWidth;
    }

}

public int getFloorHeight() {
    return texture.getHeight();
}

@Override
public void act(float delta) {
    super.act(delta);
    int size = groundLocations.size();

    for (int i = 0; i < size; i++) {
        Vector2 location = groundLocations.get(i);
        location.x -= delta * speed;
        if (location.x < cameraLeft) {

            location.x = findMax().x + textureWidth;
        }
    }

}

private Vector2 findMax() {
    return Collections.max(groundLocations, new Vector2Comparator());
}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    for (Vector2 location : groundLocations) {
        batch.draw(texture, location.x, location.y);
    }
}

public void dispose() {
    if (texture != null)
        texture.dispose();
}

}

Ground Texture is 128x128
GAME_WIDTH = 1024f
GAME_MARGIN = 250f
speed = changes.

While the ground is moving according to Speed and FPS. (Speed * delta)
Problem is : There are always Gaps between ground Textures. after certain Movement
function findMax finds the texture with the biggest X
any help would be Appreciated.

Solution:

  for (int i = 0; i < size; i++) {
        Vector2 location = groundLocations.get(i);
        if (location.x < cameraLeft) {
            location.x = findMax().x + textureWidth;
        }
        location.x -= delta * speed;
    }

sentences:
How to create a believable swimming fish animated Sprite in 2d? I want to create a fishing game in which fish needs to be swam across in the ocean. I put static fish which just progresses across ocean but it does not look very realistic and interesting to attract users to play.

I have used minimal graphics style to design graphics for the game and want to put some animation, like, moving tails and fins which I can achieve by making multiple images. But I also want to put some big fishes like sharks and only animating fins and tails will not be enough for them. As player will die without touching body due to margin left for tails or fins animation, or consider an eel.

I can use the snake technology for eels but for fishes where only tails move, is there any other way I can use? Or consider the Jumping Fish game by Ketchapp.

Could anyone suggest me proper ways to achieve such animations?

sentences:
Make Render Texture distorted/blurry? I have created a function that clicks images in real time and these images are copied to render texture that is created. I am looking for a way to blur/distort/half-fade-out the render textures. Is there a way to achieve this?

 Graphics.Blit(Texture2D, renderTexture);

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:
Can't figure out why my mouse picking code doesn't work I am trying to create code to check for intersections between bounding spheres and the mouse. I get a mouse ray but it doesnt seem to point in the direction you think it should Attached is a screenshot and code. If anyone can help I would appreciate it as this is driving me crazy.

    auto state = m_mouse->GetState();

    float mouseX = state.x;
    float mouseY = state.y;
    float m_screenWidth = m_deviceResources->GetScreenViewport().Width;
    float m_screenHeight = m_deviceResources->GetScreenViewport().Height;

    // Normalized device coordinates
    float x = (2.0f * mouseX) / m_screenWidth - 1.0f;
    float y = 1.0f - (2.0f * mouseY) / m_screenHeight;

    DirectX::XMMATRIX viewMatrix = DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&cameraComponentHandle->view));
    DirectX::XMMATRIX projectionMatrix = DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&cameraComponentHandle->projection));
    DirectX::XMMATRIX inverseviewproj = DirectX::XMMatrixInverse(nullptr, viewMatrix * projectionMatrix);

    DirectX::SimpleMath::Vector3 origin = DirectX::SimpleMath::Vector3(x, y, 0);
    DirectX::SimpleMath::Vector3 farPoint = DirectX::SimpleMath::Vector3(x, y, 1);

    DirectX::SimpleMath::Vector3 rayorigin = DirectX::XMVector3TransformCoord(origin, inverseviewproj);
    DirectX::SimpleMath::Vector3 rayend = DirectX::XMVector3TransformCoord(farPoint, inverseviewproj);
    DirectX::SimpleMath::Vector3 raydirection = (rayend - rayorigin);
    raydirection.Normalize();

    rayComponentHandle->position = rayorigin;
    rayComponentHandle->direction = raydirection;

sentences:
Pygame for python 3.5? I just got Python 3.5 from...
LINK: https://www.python.org/downloads/windows/

previously i had Python 3.4 and the Pygame version 1.9.2a0. It worked perfectly. However, my the new Python 3.5 isn't compatible with that version of Pygame that i had gotten for the 3.4. I Found the latest Pygame file at...
LINK: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

I downloaded the Pygame file, however, it is a .whl format file. What am i supposed to do?

I have tried looking it up all day yesterday. So far all i've figured out is something about pip and wheel and doing some commands like 'pip install' etc. etc. but i am completely lost. I never knew about pip or any of that before.

I am not even sure if there is a version of Pygame that works with Python 3.5, but i did try to find out by looking it up but i never found such information. All i want is to get Python 3.5 up and running with Pygame and for it to work just as fine as it used to when i had Python 3.4. If Pygame is yet to be compatible with Python 3.5 thats fine, i'll just reinstall python 3.4 and the according pygame file for it.

sentences:
Recreating Doodle Jump in Canvas - Platforms spawning out of reach I have started to recreate Doodle Jump in HTML using Canvas. Here's my current progress. As you can see, if you play it for a few seconds, some platforms will be out of the player's reach. I don't know why is this happening. Here's the code which is responsible for the re-spawning of platforms.

//Movement of player affected by gravity
if(player.y > (height / 2) - (player.height / 2)) {
    player.y += player.vy;
    player.vy += gravity;
}
else {
    for(var i = 0; i < platforms.length; i++) {
        var p = platforms[i];

        if(player.vy < 0) {
            p.y -= player.vy;
            player.vy += 0.08;
        }

        if(p.y > height) {
            position = 0;
            var h = p.y;
            platforms[i] = new Platform();
        }

        if(player.vy >= 0) {
            player.y += player.vy;
            player.vy += gravity;
        }
    }
}

Also, here's the platform class.

//Platform class
function Platform(y) {
    this.image = new Image();
    this.image.src = platformImg;

    this.width = 105;
    this.height = 25;

    this.x = Math.random() * (width - this.width);
    this.y = y || position;

    position += height / platformCount;

    //Function to draw it
    this.draw = function() {
        try {
            ctx.drawImage(this.image, this.x, this.y, this.width, this.height);
        } catch(e) {}
    };
}

You can also see the whole code on the link I provided. Also, when a platform goes out of the view port, the jump animation becomes quirky. I am still trying to find out what's causing this but can't find any solution.

sentences: Rotation based on movement How can i calculate angle based on movement in C# XNA when i'm moving object with accelerometer? If object is moving up, sprite would rotate in corresponding direction. Should i use two vector coordinates(old, new) to calculate angle using Atan2?

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:
How to build only specified assets into assetbundle in unity I have searched through the few results pertaining to this particular question, but haven't found any results that work. A simple rundown of what i am looking for is to be able to make a single asset bundle of specified assets in order to be able to make an automated process for what the mod system i am making for the project i am working on.

there are two ways I can think of that would be able to do this;

build specified resources and assets into an assetbundle
build everything in a specified folder into an asset bundle

all of what i have been able to find regarding this either wouldn't allow me to make the automated process i need or builds the all of the assetbundles and they have to be defined manually before hand.

Any resources or suggestions to this issue would be greatly appreciated.

sentences:
Nested input in an event-driven system I am using an event-based input handling system with events and delegates. An example:

InputHander.AddEvent(Keys.LeftArrow, player.MoveLeft); //Very simplified code

However, I started wondering about how to deal with 'nested' input. For example in Half-Life 2 (or any Source game, really), you can pick up items with E. When you've picked up an item, you cannot fire with Left Mouse, but instead you throw the object. You can still jump with Space.

(I am saying nested input is where you press a certain key, and the actions you can do change. Not a menu.)

The three cases are:

Being able to do the same action as before (like jumping)
Not being able to do the same action (like firing)
Doing a different action entirely (like in NetHack, where pressing the open door key means you do not move, but select a direction to open the door in)

My original idea was to just change it after the input had been received:

Register input 'A' to function 'Activate Secret Cloak Mode'

In 'Secret Cloak Mode' function:
Unregister input 'Fire'
Unregister input 'Sprint'
...
Register input 'Uncloak'
...

This suffers from large amounts of coupling, repetitive code, and other bad design signs.

I guess the other option is to maintain some kind of input state system - perhaps another delegate on the register function to refactor out those numerous register/deregister into a cleaner place (with some kind of stack on the input system) or maybe arrays of what to keep and what not to.

I'm sure someone here must've encountered this problem. How have you solved it?

tl;dr How can I deal with specific input received after another specific input in an event system?

sentences: Does Amazon Lumberyard support AR yet? I would like some help regarding whether Amazon Lumberyard supports augmented reality (AR) or not. It clearly mentions VR is supported but nothing about AR support. It looks as if we just have to attach an AR plugin on engines like unreal, unity, etc. So will it work here?

sentences:
Unity 3d Forge Networking: Transfer object ownership I have a simple chess game setup to play around with the Forge Networking asset.  I am having an issue where only the server is able to click and drag pieces around the board.  If a client attempts to move a piece, it gets snapped back to its original position.

I assume this issue is because the server is the actual owner of the NetworkedMonoBehaviour components on my chess pieces.  Is it possible to transfer ownership of a NetworkedMonoBehaviour in code?  It seems that all of the owner properties have protected set methods so I am unable to access any of them.

sentences:
directX rotation of a 3d cube inconsistent i'm trying to develope a simple 3d cube in directX that can be rotated in any direction by dragging the mouse.

It works in the following way: i drag the mouse to the right or left, and the cube rotates along the Y axis accordingly. The same goes if i drag the mouse up or down (in this case the rotation is along the X axis).

The problem occurs if i rotate my cube 180 degree on X-axis. After this, every rotation along the Y-axis is in the opposite direction, so that if i try to move it towards positive Y-axis it moves in negative Y-axis.

I understand it has something to do with the way i do the transformations, but i can't fix the problem on my own.

D3DXMatrixRotationY(&MatRotY, rotation.y);
D3DXMatrixRotationX(&MatRotX, rotation.x);
D3DXMatrixTranslation(&MatTran, position.x, position.y, position.z);

D3DXMatrixMultiply(&MatRotXY, &MatRotY, &MatRotX);
D3DXMatrixMultiply(&MatRotXY, &MatRotXY, &MatTran);
D3DXMatrixMultiply(&worldMatrix, &worldMatrix, &MatRotXY);

PS: i know i shouldnt be using D3DX at all, but i'd like to solve this problem before having to switch to a different library.

thanks

sentences:
Replacing client side vertex arrays with glBufferData I need to replace client side vertex arrays in order to upgrade to a new version of OpenGL but I'm not sure what the best way to buffer data is now.

What I have is a 2D sprite engine which is using batching to push as many vertices to the GPU (using fixed pipeline functions glVertexPointer etc...) but frequently the batch is only a single quad. Because of how sorting works the buffer needs to be updated every frame (or more).

I need to use glBufferData/glVertexAttribPointer now so what is the best way to handle this case? I can allocate the buffer for glBufferData large enough to hold the maximum size of a batch (which is more than maybe 5000 vertices) so should I just push the old vertex array to glBufferData every frame or use another method? Maybe calling glVertexPointer/glBufferData has the same costs associated with them to copy memory to the GPU so I don't need to worry about it but I'd like to know since I'm still pretty new to OpenGL.

CONCLUSION:

In my simple tests I found calling glBufferData every frame with all vertices (OpenGL 4.1) actually slightly faster than client side vertex arrays (OpenGL 2.1).

Thanks.

sentences:
Including slick2d or slick-util in maven build? I'm converting a project to lwjgl and trying to use slick-util as well. There's no slick-util maven repo anywhere (nor slick2d itself anymore). I've included local dependancies before using

    <dependency>
        <groupId>org.newdawn</groupId>
        <artifactId>slick</artifactId>
        <version>237</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/slick-util.jar</systemPath>
    </dependency>

The maven package process runs without issue, but when I try to run the jar, it errors out with a ClassNotFoundException. There's no mention of slick-util in the manifest and I can't find out how to make my game load that jar properly.

Side question: how do I ensure when I distribute my applications, the game properly installs these libraries?

sentences:
Water wave simulation I'm having a strange behavior simulating water waves. It works perfectly with directional waves, but point waves don't work like expected. If i do not normalize the directional vector(WoldPosition - waveCenter), it works like this:

Which would be nice if i would want to display 10 point waves, but i just added one point wave(the center one). And if i do normalize the directional vector, it looks like this:

Which is not even close of what a point wave should look like.

Do you have any idea of what could be the problem?

This is the formula used to calculate the heights of the waves:

amplitude * sin(dot(direction,vec2(x,z))*w + deltaTime*phase);

Vertex shader:

#version 330

layout (location = 0) in vec3 Position;
layout (location = 1) in vec2 TexCoord;
layout (location = 2) in vec3 Normal;

uniform mat4 gWVP;
uniform mat4 gWorld;
uniform float gMatSpecularIntensity;
uniform float gSpecularPower;
uniform vec3 eyePoint;
uniform float deltaTime;

out vec2 TexCoord0;
out vec3 Normal0;
out vec3 WorldPos0;
out vec2 Specular0;
out vec4 wvp;
out float relativeFactor;

const float w = 1.2f;
const float amplitude = 0.1f;
const float phase = 2.2f;

vec3  wavePosition = vec3(20,0,20);

float CalculateHeight(float x, float z, vec2 direction)
{
    return amplitude * sin(dot(direction,vec2(x,z))*w + deltaTime*phase);
}

vec3 CalculeNormal(float x, float z, vec2 direction)
{
    float heightR = CalculateHeight(x-1,z,direction);
    float heightL = CalculateHeight(x+1,z,direction);
    float heightU = CalculateHeight(x,z+1,direction);
    float heightD = CalculateHeight(x,z-1,direction);
    return normalize(vec3((heightR - heightL),1, (heightU - heightD)));
}

void main()
{
    wvp            = gWVP * vec4(Position, 1.0);
    gl_Position    = wvp;
    TexCoord0      = TexCoord;
    WorldPos0      = (gWorld * vec4(Position, 1.0)).xyz;

    vec2 direction = (wavePosition-WorldPos0).xz;

    gl_Position.y  += CalculateHeight(WorldPos0.x,WorldPos0.z,direction);
    Specular0      = vec2(gSpecularPower,gMatSpecularIntensity);
    relativeFactor = dot(normalize(eyePoint - WorldPos0),vec3(0,1,0));

    Normal0        = CalculeNormal(WorldPos0.x,WorldPos0.z,direction);
    relativeFactor = clamp(relativeFactor, 0.0, 1.0);
}

Variables:

direction: Vector which defines the direction of the wave. It is
perpendicular to the wave front.
x: Position x in world coordinates.
z: Position z in world coordinates.
amplitude: The amplitude of the wave
phase: The phase of the wave
deltaTime: The total time passed in ms.
gWVP: Camera perspective matrix * Camera view matrix * Water transformation matrix (position matrix * rotation matrix(no rotation) * scale matrix)
gWorld: Water transformation matrix (position matrix * rotation matrix(no rotation) * scale matrix)

The fragment shader and the other variables do not influence in the displayed wave, it just combine the reflextion + refraction image + apply the fresnel efect.

For more info about the wave function: http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html

sentences:
Can I rely on a Navmesh for X/Z movement and manually place my agent on the Y axis? I'm generating my terrain mesh around the player (along with collision mesh and Navmesh). It's tile based, when the player moved enough I generate necessary tiles render meshes, then collision meshes and then I generate a whole new navmesh surface data (in the background) to swap with the current one. The setup is a sand desert with no obstacles and no slope too steep to climb, basically you can go everywhere.

Computing render and collision mesh is rather fast, but navmesh takes about 30s. I could not tweak values to make it faster without noticeable quality loss. I'm trying to find a workaround before going too deep this way (I might add simple obstacle later).
I tried using one navmesh surface per tile (instead of a single global one) but then I have to link them and that seem complicated and very noticeable.

I'm wondering if I could juste generate a navmesh according to an hidden plane underneath my terrain, and then simply reposition the agents along the world Y axis each frame ? Are there obvious issues that will arise or should that be fine ?

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 game engines generate single executable games? I was taking a look at Cryengine's and Unreal's code and when built both engines generates lots of dlls. Inside Cryengine's System code I could see that it calls LoadLibrary to load the dlls and Initialize the modules.

Ex:. LoadLibrary("CryPhysics.dll")

But when you see Cryengine's or Unreal's deployed games they have only a single big .exe and no first-party dlls. In Crysis 3 Bin32 directory there is only Crysis3.exe and some third-party dlls, there is no CryPhysics.dll for example.

How do they achieve that? How can the LoadLibrary work without those dlls?

PS:. There is no #if wrapping the LoadLibrary to differentiate Debug from Release mode

sentences:
Should independent game developers outsource? Simple question: What are the pros and cons, as well as overall opinions, of outsourcing work as an independent game developer? (For example: paying an artist to draw characters, or a composer to write music, etc.)

In particular I'm interested in the case where the developer (be it an individual or a team) can still complete their game to an acceptable standard without hiring somebody. (For example: maybe they're "ok" artists, or can use music from a free library.)

(Ideally I'm looking for answers from people with experience in this area.)

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:
Compute "up" and "right" from a direction I have a camera class that is missing some functionality.

I need to give it the ability to, given a direction, or a point to look at, will rotate the camera left/right and up/down to look at this point or along this direction, without causing gimbal lock.

lets, say I move the camera to (10,10,10).

I want the camera to point at (0,0,0).

By normalizing the vector , I find that the direction I want to look along is (-0.577,-0.577,-0.577). We'll call this "Forward".

What I want to be able to do, is compute the local "Up" and "Right" vectors which are perpendicular to Forward.

How do I do this?

sentences:
OpenGL ES 2.0 - How to batch draw particles that have unique translations, rotations, scales, and alphas? I've combined all of my vertex data for many particles into a single array.  How would I batch draw all of those particles in a manner that preserves their unique translations?

Any code examples would be greatly appreciated.

sentences: 3d Dynamic liquid wobble inside a container in Unity3d How can I implement dynamic liquid wobble inside a bottle in Unity3D as seen in here? (Yellow liquid inside the spray can at 3:10)

sentences:
Multiple updates for Unity animation per one method call I'm trying to do some simulation where I move objects procedurally in a loop within one method call. So instead of using Update(), method I do for example:

void Simulate(float deltaTime)
{
   // real logic look a lot different, this is just an example
   for(int i = 0; i < 1000; ++i)
   {
      transform.position += direction * speed * deltaTime;
   }
   .....
}

The reason I'm doing this is because I want consistent 'framerate' by passing that deltaTime parameter; Which is for example 0.01f;
And each step of that loop I'm taking snapshots on multiple cameras with calling Render() method on them before taking a picture. The movement works fine and I see it on snapshots, but some objects has an animation which should also be updated procedurally.

I've tried to do

animator.speed = 0;

and then in the same loop, to test it

for (int i = 1; i < 1000; ++i)
{
   ...
   animator.Play("WalkFWD", 0, i/1000f); //for example
}

But animation does not change over that loop. It only works with that Play method when I either make this Simulation() method a coroutine and pass one frame (yield return null), or if I use in Update().
So, my question: is it possible to procedurally update/redraw animation after normalized time of that animation is set. (without waiting for another frame)

sentences:
What is the most secure way to archive a GKScore to be re-submitted later? I'm looking for the safest way to archive and store a GKScore that needs to be re-submitted to Game Center (say, because the user didn't have a network connection at the time the score was earned).  I would like to archive the GKScore instance in case the app is terminated before it can be successfully re-submitted to Game Center.

My worry is that if it's archived to an instance of NSData and saved in a .plist, it would be easy to manipulate.  Perhaps this worry is unjustified?

NOTE: I posted a similar question on Stack Overflow only to realize that it's better asked here.

sentences: Friction on a rolling ball How long will a ball, say a billiard ball, stop rolling on a flat surface for a given coefficient of friction? What is the formula for the ball's decreasing velocity?

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:
Sweep collision between two moving spheres? Say I have a scenario like this:

Here I got two spheres (sphere A and B) that moves from on spot to another during a frame.
How can I predict where these two collide if they collide at all? In between these frames?

I tried to look it up and found this page, but I didn't understand much of it. Could someone try to explain this to me? I'm coding this in C# with XNA and I've been stuck with this issue for a very long time now

sentences:
Should I develop the game first or get NDA? So I have been working on my game for a while now. And I now I have other people contributing to the project. I fear that someone will tell their friends and/or family then my 'great' idea is lost.

So my question is should I wait and get a NDA ( Non Disclosure Agreement) or some other form of legal document that tells everyone one the project or who has ever worked on the project to be quite until its release?

sentences:
Avoid useless copies of buffers The other day I was looking at a opensource engine, basically it was uploading the image from a file to a RAM buffer adding some decoding while streaming (I assume this is done "in-cache" so I can't count the decoding as an extra copy), then the buffer was feeded to glTexImage2D.

According to GL specifications, glTexImage2D is free to keep a in-RAM copy of the image and wait for the best moment to upload it to the GPU.

So basically we have

From disk to RAM
From RAM to RAM
From RAM to GPU

Thos are basically 4-5 BUS runs x Textures Size in megabytes  bandwith payload

3 copies of the same data.

Isn't there anyway to reduce the copies to

From disk to RAM
from RAM to GPU

Or even

From disk to GPU

?

(Assuming hard-disk already have data in the correct memory layout and hence no decoding is necessary).

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

sentences:
Early Z culling - Ogre For Ogre experienced people, but also experts in the field:
Early Z culling is sometimes quite desirable, and that's what I tried to do in Ogre by using a two pass material. The first one is writing to the Z Buffer, but not to the frame buffer. This is how it looks like:

 pass EarlyZ
    {
        texture_unit TU0
        {
            //ambient diffuse texture
            texture $TU0_TEXTURE
            tex_coord_set 0
            filtering trilinear
        }
        //cull_software none
        //cull_hardware none
        lighting off
        colour_write off
        shading flat
        //scene_blend alpha_blend
        alpha_rejection  greater_equal 200
        depth_bias  -5 -5 // ugly hack - without it, objects tend to flicker
    }

The biggest problem I get is with alpha objects and shadows. For example, now I can't get  tree impostors to cast correct shadows instead of blocks. Although they are rendered correctly, the PSSM isn't working correctly, so the shadows tend to look like stencil shadows. Any ideas on how to fix it? As many people said: is it possible to perform early Z culling and still have transparent objects in the scene? If yes, some hints to do it in Ogre? Here are some screenshots:

sentences:
Unity 2d circle collider not stopping after collision with box collider 2d I'm using unity circle collider 2d and rigid body 2d but when it hits the box it doesn't stop there but instead just pass through and fall. Can someone help?

Circle Collider and rigid body 2d setting

Box Collider Settings

Game output

As you can see in game output my circle instead of stopping at collision it is getting passed by box. I want the circle to fall in square rather than free fall.

sentences: Java Anti-Cheat Framework? Are there any anti-cheating frameworks for Java games in order to make it a bit harder to cheat? (eg. something that protects from things like Cheat-Engine) Obviously if the cheater were to develop his own tools this wouldn't help much, but I'm looking to protect the game from the average cheating 13 yr. old child.

sentences:
2D Collision in Canvas - Balls Overlapping When Velocity is High I am doing a simple experiment in canvas using Javascript in which some balls will be thrown on the screen with some initial velocity and then they will bounce on colliding with each other or with the walls.

I managed to do the collision with walls perfectly but now the problem is with the collision with other balls. I am using the following code for it:

//Check collision between two bodies
function collides(b1, b2) {
    //Find the distance between their mid-points
    var dx = b1.x - b2.x,
        dy = b1.y - b2.y,
        dist = Math.round(Math.sqrt(dx*dx + dy*dy));

    //Check if it is a collision
    if(dist <= (b1.r + b2.r)) {
        //Calculate the angles
        var angle = Math.atan2(dy, dx),
            sin = Math.sin(angle),
            cos = Math.cos(angle);

        //Calculate the old velocity components
        var v1x = b1.vx * cos,
            v2x = b2.vx * cos,
            v1y = b1.vy * sin,
            v2y = b2.vy * sin;

        //Calculate the new velocity components
        var vel1x = ((b1.m - b2.m) / (b1.m + b2.m)) * v1x + (2 * b2.m / (b1.m + b2.m)) * v2x,
            vel2x = (2 * b1.m / (b1.m + b2.m)) * v1x + ((b2.m - b1.m) / (b2.m + b1.m)) * v2x,
            vel1y = v1y,
            vel2y = v2y;

        //Set the new velocities
        b1.vx = vel1x;
        b2.vx = vel2x;
        b1.vy = vel1y;
        b2.vy = vel2y;
    }
}

You can see the experiment here. The problem is, some balls overlap each other and stick together while some of them rebound perfectly. I don't know what is causing this issue. Here's my balls object if that matters:

function Ball() {
    //Random Positions
    this.x = 50 + Math.random() * W;
    this.y = 50 + Math.random() * H;

    //Random radii
    this.r = 15 + Math.random() * 30;
    this.m = this.r;

    //Random velocity components
    this.vx = 1 + Math.random() * 4;
    this.vy = 1 + Math.random() * 4;

    //Random shade of grey color
    this.c = Math.round(Math.random() * 200);

    this.draw = function() {
        ctx.beginPath();
        ctx.fillStyle = "rgb(" + this.c + ", " + this.c + ", " + this.c + ")";
        ctx.arc(this.x, this.y, this.r, 0, Math.PI*2, false);
        ctx.fill();
        ctx.closePath();
    }
}

sentences:
Is there a simpler way to create a borderless window with XNA 4.0? When looking into making my XNA game's window border-less, I found no properties or methods under Game.Window that would provide this, but I did find a window handle to the form.

I was able to accomplish what I wanted by doing this:

IntPtr hWnd = this.Window.Handle;
var control = System.Windows.Forms.Control.FromHandle( hWnd );
var form = control.FindForm();
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

I don't know why but this feels like a dirty hack.  Is there a built-in way to do this in XNA that I'm missing?

sentences:
Position and rotate a 2D point array into a 3D world I have a set of 2D points (defining a flat 2D 'connect the dots' shape).
I want to calculate the 3D positions for these 2D points at a specific 3D position and rotation.

For example, say I have five 2D points forming the shape of a 2D hexagon. I want to place this hexagon shape at a specific location in my 3D world, at a specific rotation. I need to calculate new 3D coordinates for each of the 2D points.

If it matters, the 2D points will center around (0,0).

What magic formula do I need to do to accomplish this translation?
Is there a built in method (in Unity) to do this?

Each point will be perpendicular to the rotation angle/direction, so will I need to calculate the cross product?  Then somehow use this to remap each 2D point?

I should have paid more attention to this in school, all those years ago (I can't even remember if I actually learned this before!).

Any help will be appreciated. Thanks.

Here's some basic code to illustrate:

Vector3 position;     // Where in 3D to place the 2D shape
Quaternion rotation;  // What 3D rotation to apply to the 2D shape.  Should be a Vector3?
Vector2[] shapeIn;    // List of 2D points defining shape
Vector3[] shapeOut;   // List of updated 3D points at its new position and rotation

shapeOut = new Vector3[shapeIn.Length];

for (int p=0; p<shapeIn.Length; p++) {
    shapeOut[p] = MagicFormula(shapeIn[p]);
}

sentences: Canvas Element Not Render In Proper Position I don't know what's going wrong. The Text and Slider must be on the red square area. Anyone can help to determine this bug ? Thanks

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

How to sample in 3D?

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

I will appreciate any help on this.

sentences: Converting from tile to pixel precision I was curious as to how you would go about converting from pixel to tile precision on a tile map. For example, let's say my map is comprised of 8x6 tiles, each of which are 50x50 pixels in size. If I could only get the current coordinates of my mouse in pixels, how would I go about finding which tile those pixels are contained in programmatically?

sentences:
How to check for mesh overlap? I'm creating a level editor in Unity. I need to detect when an object is intersecting another as I don't want to allow the user to place an object when it is colliding with something else.

In the below diagam, there is a corner road piece and a tree. The dashed red line represents the mesh bounds of the road and the blue dashed line represents the mesh bounds of the tree.

My current approach is to use Physics.OverlapBox with mesh.bounds. In the diagram, visually, it is clear that the tree does not overlap the road. However, the bounds do overlap, therefore I cannot place the tree there.

Whats the best way to check if they are actually colliding in an efficient way? The level editor could potentially have thousands of objects.

EDIT:
I have since tried using Physics.ComputePenetration. Primitive-primitive checks work ok, primitive-mesh collider checks work ok, but mesh collider-mesh collider checks fail. From what I understand a concave mesh collider cannot interact with another concave mesh collider. Is there a workaround for this or must I momentarily make it convex before checking overlap? I just don't want to lose the accuracy of the concave collider.

sentences:
How can I set up a 3D camera for a top-down game like Enter the Gungeon? DodgeRollGames, the developers of Enter the Gungeon, tweeted that the game was in fact made in 3D

They tried to explain how they set their camera in this reddit post.
Basically what they said was :

so the walls are tilted 45 degrees toward the camera, and the floors are tilted 45 degrees away from the camera, meaning that each should experience sqrt(2) distortion because of the additional length along the z-axis. However, the vertical (y-axis) floor length shouldn't be perceptually changed.
The camera is not tilted at all.
Camera: 0 degree tilt.
Walls: +45 degrees tilt.
Floor: -45 degrees tilt.

My question is : What do they mean by "However, the vertical (y-axis) floor length shouldn't be perceptually changed". If I tilt the walls and floors by 45 degrees and -45 degrees as said, the sqrt(2) distorted walls (the walls have Z depth and are perpendicular to the ground) line up nicely, but the ground gets distorted (obviously). So I distort the ground tiles by sqrt(2) but this essentially stretches the ground by 40% so every vertical movement now has to be increased by 40%.
Can somebody explain what's going on? Any help would be highly appreciated.

sentences:
GLSL shader algorithm to render a sprite map with a single draw call (on a single sprite mesh) I'm trying to render a tile map world on a single sprite mesh (instead of one sprite per tile.) This significantly reduces the array vertex bus labor for extremely large worlds:

In order to do this, you pass two textures to the shader: the sprite sheet itself, and a texture containing tile IDs.

Sprite map (I know some tiles repeat but ignore that, this could be any spritesheet):

Below: Entire tile world represented by a 128 x 128 texture map, where each RGB value holds actual Tile ID for that location on the map. There are more efficient ways to represent the actual tile ID. Here, for the sake of simplicity, it is stored in the R component.

Putting it all together:

The right-most square is the screen output. On the image I just repeat texture... but what should actually happen is a tile world rendered from tiles on the sprite sheet.

I wrote the shader that is supposed to do this, but I'm stuck. I can render the sprite sheet itself, and even scale it on the sprite mesh, but I can't seem to get the tile IDs render at the proper location, matching the tile world data.

I do think I am really close and there are just a couple of modification needed to the shader -- so what am I doing wrong?

The following shader is what I have so far:

tilemap.vs

#version 330 core

layout (location = 0) in vec3 position;
layout (location = 1) in vec3 color;
layout (location = 2) in vec2 texCoord;

out vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

uniform mat4 Model;
uniform mat4 View;
uniform mat4 Projection;

void main()
{
    gl_Position = Projection * View * Model * vec4(position, 1.0);

    TexCoord = texCoord;
}

tilemap.frag

#version 330 core

in vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

void main() {

    // size of the tile world (128 by 128 tiles on one sprite)
    float cols = 128.0f;
    float rows = 128.0f;

    float tilesPerSide = 8.0f;

    // figure out which tile we´re in from the 3D coordinates
    vec2 tile = vec2(floor(TexCoord.x)/cols, floor(TexCoord.y)/rows);

    // get tile´s texture ID from tile ID texture map
    float tex = texture2D(ourTilemapDataTexture, tile).r;

    vec2 UV = vec2(tex + fract(TexCoord.x), fract(TexCoord.y));

    color = texture2D(ourTexture, UV);

    if (color.a == 0) // remove transparent areas
        discard;
}

PS: I looked at every tutorial I could find on Google, and tried to re-implement it in my shader to no effect. This is as far as I got so far.

Can anyone point out what I'm doing wrong?

Update #1 -- I was able to get position sampling to work.

I painted a bit on the world map:

It's not perfect but definitely a step forward:

Adjustments made to the fragment shader:

float cols = 128.0f;
float rows = 128.0f;

float tex = texture2D(ourTilemapDataTexture, TexCoord).r;
float tey = texture2D(ourTilemapDataTexture, TexCoord).g;

vec2 UV = vec2( (TexCoord.x * (cols) / (tex * 32.0f)),
                (TexCoord.y * (rows) / (tey * 32.0f)) );

color = texture2D(ourTexture, UV);

Sure it's not 100% correct but at least map indexing works now :)

sentences:
What is the package-lock.json file for in Unity? My project contains this file:
Packages/packages-lock.json
And I'm curious about what it's for. It has a bunch of json about my packages in it, but it's not clear to me what goes in the lock file vrs the normal packages file.

sentences:
Methods for generating a map I'm looking to create a simple, "randomly" generated map for a small game.

The game consists of a top-down view of a world, with land-mass and ocean areas.  Think of a simple outline map of the world for example.

The closest thing I can think of that I've seen before was the level-generator for the old SimCity games, or the Civ series, where you can set a preference for single continent versus many islands, etc.

What sort of algorithm would be suitable?  The map will need to be moderately zoomable, so I can have a "whole world" view, and also a more zoomed-in local view, but I think I'll sort that out later.

Initially I don't need any concept of heights, just two areas - land and sea, although I might extend it later.

sentences:
I am looking for a simple tutorial for sprite animation in android Possible Duplicate:
  What's the best way to create animations when doing Android development?

I saw a couple of them on the internet but they are beyond my level of understanding ...I need to start with basics in a simpler way if possible...can anyone guide me to some good online resources for this

sentences:
Sub-systems in game engines So here's the problem- I'm writing my own engine library, and it works fine with stuff like menus and the actual game screen. The thing is, I can't really figure out how to integrate something like an intro or dialogue preceding certain levels into this system.
Let's look at another example- say I have a game-specific engine which gets a Level object and runs it. Engine would have its own collision and physics system, all hard coded. Now, what if at some point in a level, I want the player to enter a mini-game with different rules? How do I morph the Engine class to support these sub-systems without having to deal with their code all the time (as in: if(regular game) ... else if(mini game) ...)?

And what if I want an intro animation at the start of a level, and I want the player to be able to assume control of his character once the animation ends, do I implement the animation into the Engine class itself? Or maybe I need to run another class, CutScene, and when it ends, it calls Engine and starts the level? What if I want to add a dialogue system, where at the start of each level there's a short dialogue and the player can't control his character, and once it ends, he can? Would I then run the dialogue code inside the Engine code?

Maybe these sub-systems should all be scripted? I don't know anything about scripting, is it necessary for this kind of situation?
Any help would be appreciated.

sentences: Monogame minimum hardware requirements? What are the minimum hardware / driver requirements for running a Monogame 3.x game, on each of the various Operating Systems?

sentences:
Game Maker picking the wrong network adapter for broadcast In my game I need to get the local network IP of the computer that is running the game, and for that purpose I have the following code:

// Create event
randomize();
var random_port = irandom_range(49152,65535);
host = network_create_server(network_socket_udp, random_port, 5);

if ( host < 0 ) {
    show_message("Failed to create a broadcast server");
    game_end();
} else {
    var tsock = network_create_socket(network_socket_udp);
    var tbuff = buffer_create(32, buffer_fixed, 1);
    buffer_fill(tbuff, 0, buffer_bool, 0, 32);
    network_send_broadcast(tsock, random_port, tbuff, buffer_get_size(tbuff));
    network_destroy(tsock);
    buffer_delete(tbuff);
}

/// Async network event
global.game_ip = string(async_load[? "ip"]);
instance_destroy();

I've manually set up my local network IP to be 192.168.1.150, but when I run the code above, I get the IP 169.254.51.115.

Because I wasn't expecting such IP, I ran the ipconfig/all command (on Windows) and I got the following output (I've translated the output because my computer is in another language, and I've deleted the information that isn't relevant to this):

Ethernet adapter:

   Specific dns for this connection. . : Home
   Description . . . . . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   [...]
   IPv4 address. . . . . . . . . . . . . . : **192.168.1.150(Preferred)**
   Subnet Mask . . . . . . . . . . . . : 255.255.255.0
   Default gateway . . . . . : 192.168.1.1
   DHCP server . . . . . . . . . . . . . . : 192.168.1.1
   DNS Servers. . . . . . . . . . . . . . : fe80::1%13
                                       1.1.1.1
                                       1.0.0.1

Ethernet Npcap Loopback Adapter:

   Specific dns for this connection. . :
   Description . . . . . . . . . . . . . . . : Npcap Loopback Adapter
   IPv4 automatic configuration address: **169.254.51.115(Preferred)**
   Subnet mask . . . . . . . . . . . . : 255.255.0.0
   Default gateway . . . . . :
   DNS Servers. . . . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1

So, from my understanding point of view, Game Maker is getting the Ethernet Npcap Loopback Adapter instead of the regular ethernet adapter.

I could delete the Npcap Loopback adapter, but what if a user has wifi and ethernet connection?

Is there a way for Game Maker to choose one or another adapter?

In case the previous answer is no, is there a workaround for this  to avoid getting the Npcap loopback adatper?

sentences:
How can I achieve UnrealEd's per-face texturing in Blender 2.6? Using UnrealEd I can create geometry and assign a material to each face of that geometry. Each face can have its own UV settings. How can I achieve the same functionality using Blender?

I've seen the "Texture Face" option mentioned but that seems to be gone in Blender 2.59+?

sentences:
How to detect a swipe and make the player GO rotate towards the end of the touch Android Unity I am making a game where the user can swipe on the screen and the player gameobject will turn towards the end of the swipe.

I am using the following to detect the end of the swipe:

        if (touch.phase == TouchPhase.Ended)
        {
            swipeEndPos = touch.position;
            swipeDistance = (swipeEndPos - swipeStartPos).magnitude;
            if (swipeDistance > minSwipeDistance)
            {
                Vector3 swipeEndPoint = mainCamera.ScreenToWorldPoint (swipeEndPos);

                player.Turn (swipeEndPos);
            }
        }

And the following to make the player turn towards the end position:

     public void Turn(Vector3 direction)
     {
       transform.Rotate (new Vector3(0,direction.y,0), Space.Self);
     }

Can someone please explain what I am doing wrong?

Thank you.

sentences:
How can I create a shader that will reproduce this lighting effect on terrain? Notice the way in which the major light source in each image reflects off the ground, as a function of the distance between the light source and the viewer (?).

Is this a (bumped) specular map? The effect is seen all over in World of Warcraft; I specifically remember it on the snow in Dun Morogh, and on the shores of Darrowmere lake. Looking directly toward the sun is required. The effect is also commonly on the surface of water in RL and in CG. Specifically, I want to build the effect where the reflection is more intense on the ground surface closer to the light source, and falls off as it approaches the viewer.

sentences:
How do RPGs balance linear damage formulas? I'm developing a damage formula for an RPG. I've checked many popular titles formulas for reference (Final Fantasy, Chrono Trigger, Golden Sun and Castlevania) and most seem to use linear functions.

My issue is that for linear functions, the % in which damage increases when leveling up goes down in every level. For example, when you go from Lvl 2 to Lvl 3 and damage increments 50%, however when you go from Lvl 50 to Lvl 51, an attack only does 0.5% more damage to the same enemy.

This coupled with the fact that XP to level up goes up exponentially in these titles doesn't make sense to me. So while I'm tempted to forgo this type of function for my game, I feel there's something I must be missing since many of my favorite games use them. Moreover I have played these titles and I never noticed this.

Eg:
Golden Sun damage calculation is a simple: Damage = Attack - Defense. Pokemon's damage formula below is a bit more complex but absolute damage growth also decreases on each level.

Am I right to think in these games damage increases at a lower percentage on each level?

How do they balance the game so that levels are still important later on the game?

sentences:
Must know legal issues when releasing a game? Alright, some day in the far future I would love to independently release my own game.

My question is, what is the minimum amount of familiarity I need with copyright law, software patents, and other forms of intellectual property in order to protect myself and property while not accidentally infringing upon another company's property?

sentences:
Software rendering 3d triangles in the proper order I'm implementing a basic 3d rendering engine in software (for education purposes, please don't mention to use an API). When I project a triangle from 3d to 2d coordinates, I draw the triangle. However, it's in a random order and so whatever gets drawn last draws on top of all other triangles (which might be in front of triangles it shouldn't be in front of)...

Intuitively, seems I need to draw the triangles in the correct order. So I can calculate all their distances to the camera and sort by that. The objects furthest away get drawn last. Is this the proper way to render triangles? If I'm sorting all the objects, this is n*log(n) now. Is this the most efficient way to do this?

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:
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:
2D animation example in pyglet (python) looping through 2 images/sprites every x seconds Suppose you have two images: step1.png and step2.png .

Can anyone show me a very simple example in pyglet how to loop through those 2 images say every 0.5 seconds?

The character doesn't have to move, just a simple black screen with a fixed region wherein the two images continually change every 0.5 secs.

I know how to make a character move, shoot projectiles etc. but I just can't figure out how to control the looping speed of the images.

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 do I implement 2D shadows cast between layers? How could I implement 2d shadows that are cast by objects in a different layer?

NOT like the dynamic lighting in the well known tutorial from Catalin Zima :

But like the shadows of the pipes in this video:

And like the shadow of the platform and the character in this video:

I would like to use the same kind of lighting in a scene with many layers and a lot of lights with different colors.

I could imagine doing this by drawing a black copy of the layer over the layers behind that layer, and adjusting it according to holes in the layers on which the shadow is cast. But I hope there is a less expensive, pixel-shader based approach for this.

sentences: How do I make an endless road in Unity? Basically I created 2 quads side by side and I added a road texture. I used transform.translate so that the road moves, but I am trying to make the road endless by making the 2 quads reposition themselves in front of the current quads repeatedly so that when I add a player the road is endless. Any way I could do this?

sentences:
How to rotate a whole Bezier Curve around a given point I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I rotate the whole bezier curve (which may contain multiple cubic Bézier segments) around a point?

Please note that the rotation point could be any point including the one of the curves anchor points or control points.

sentences:
Converting world space coordinate to screen space coordinate and getting incorrect range of values I'm attempting to convert from world space coordinates to screen space coordinates.

I have the following code to transform my object position

Vector3 screenSpacePoint = Vector3.Transform(object.WorldPosition, camera.ViewProjectionMatrix);

The value does not appear to be in screen space coordinates and is not limited to a [-1, 1] range.

What step have I missed out in the conversion process?

EDIT:

Projection Matrix

Perspective(game.GraphicsDevice.Viewport.AspectRatio, nearClipPlaneZ, farClipPlaneZ);

    private void Perspective(float aspect_Ratio, float z_NearClipPlane, float z_FarClipPlane)
    {
        nearClipPlaneZ = z_NearClipPlane;
        farClipPlaneZ = z_FarClipPlane;

        float yZoom = 1f / (float)Math.Tan(fov * 0.5f);
        float xZoom = yZoom / aspect_Ratio;

        matrix_Projection.M11 = xZoom;
        matrix_Projection.M12 = 0f;
        matrix_Projection.M13 = 0f;
        matrix_Projection.M14 = 0f;

        matrix_Projection.M21 = 0f;
        matrix_Projection.M22 = yZoom;
        matrix_Projection.M23 = 0f;
        matrix_Projection.M24 = 0f;

        matrix_Projection.M31 = 0f;
        matrix_Projection.M32 = 0f;
        matrix_Projection.M33 = z_FarClipPlane / (nearClipPlaneZ - farClipPlaneZ);
        matrix_Projection.M34 = -1f;

        matrix_Projection.M41 = 0f;
        matrix_Projection.M42 = 0f;
        matrix_Projection.M43 = (nearClipPlaneZ * farClipPlaneZ) / (nearClipPlaneZ - farClipPlaneZ);
        matrix_Projection.M44 = 0f;
    }

View Matrix

        // Make our view matrix
        Matrix.CreateFromQuaternion(ref orientation, out matrix_View);

        matrix_View.M41 = -Vector3.Dot(Right, position);
        matrix_View.M42 = -Vector3.Dot(Up, position);
        matrix_View.M43 = Vector3.Dot(Forward, position);
        matrix_View.M44 = 1f;

        // Create the combined view-projection matrix
        Matrix.Multiply(ref matrix_View, ref matrix_Projection, out matrix_ViewProj);

        // Update the bounding frustum
        boundingFrustum.SetMatrix(matrix_ViewProj);

sentences:
Generating a UV map for a procedural mesh I have created a procedural low poly rock mesh and now I would like to apply textures on it.

I have the 3D-coordinates of every vertex of the mesh but that's about it. How would I automatically generate a UV map for this mesh, since this list of vertices will change every time I generate a rock? How do I get all these faces correctly mapped in a (1,1) square?

I am working in Unity3D if that helps.

Thanks,

Alex

EDIT: Preserving the face shapes/sizes is priority! I don't want distortion at all. The texture will be generally just the same color with some darker/lighter spots so every edge could be used as a seam. Faces can overlap! I just want all the faces in one 2D box (1,1), with the correct dimensions.

EDIT 2:

I have this code:

    Vector3[] verts = mesh.vertices;

Vector2[] uvs = new Vector2[verts.Length];

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

    uvs[i] = new Vector2(Mathf.Abs(verts[i].x), Mathf.Abs(verts[i].z));

}

Which gives me the following UV map:
[![enter image description here][2]][2]

EDIT 3:

  float scaleFactor = 0.5f;

int[] tris = mesh.triangles;

Vector3[] verts = mesh.vertices;
Vector2[] uvs = new Vector2[verts.Length];

// Iterate over each face (here assuming triangles)
for(int index = 0; index < tris.Length; index += 3)
{
    // Get the three vertices bounding this triangle.
    Vector3 v1 = verts[tris[index]];
    Vector3 v2 = verts[tris[index + 1]];
    Vector3 v3 = verts[tris[index + 2]];

    // Compute a vector perpendicular to the face.
    Vector3 normal = Vector3.Cross(v3 - v1, v2 - v1);

        Debug.Log("surface " + index/3 + " : " + (normal*0.5f).magnitude);

    // Form a rotation that points the z+ axis in this perpendicular direction.
    // Multiplying by the inverse will flatten the triangle into an xy plane.
    Quaternion rotation = Quaternion.Inverse(Quaternion.LookRotation(normal));

    // Assign the uvs, applying a scale factor to control the texture tiling.
    uvs[tris[index]]     = (Vector2)(rotation * v1) * scaleFactor;
    uvs[tris[index + 1]] = (Vector2)(rotation * v2) * scaleFactor;
    uvs[tris[index + 2]] = (Vector2)(rotation * v3) * scaleFactor;
}

The red triangle on the left and the dark blue one on the right should be the same shape/size:

EDIT 4:

Mesh mesh = new Mesh();
mesh.name = "RockMesh";
List<int> Triangles = new List<int>();

var vertices = Vertices.Select(x => new Vertex(x)).ToList();

var result = MIConvexHull.ConvexHull.Create(vertices);
mesh.vertices = result.Points.Select(x => x.ToVec()).ToArray();
var xxx = result.Points.ToList();

foreach(var face in result.Faces)
{
    Triangles.Add(xxx.IndexOf(face.Vertices[0]));
    Triangles.Add(xxx.IndexOf(face.Vertices[1]));
    Triangles.Add(xxx.IndexOf(face.Vertices[2]));
}

mesh.triangles = Triangles.ToArray();

EDIT 5:

I had to move the code a bit but it finally works now! Like you guys predicted, the seems are not optimal, but I'm happy how it is now. Thanks!

sentences:
Swift - Why does my SKShapeNode pass through an object, pausing briefly beforehand? The code below when run on a device that’s flat on the table shows a red circle (the 'ball') and a line.

When I gently tip the device the circle moves towards the line. When it reaches the line, it stops which is the expected and desired behaviour.

BUT if I keep tipping, the circle moves through the line. I’ve been trying for 2 days to work out why grrr I just want the circle to hit the line and not go through it.

Any ideas? Anything to do with the line being an 'edge'?

Cheers,
Andy

import SpriteKit
import CoreMotion

class GameScene: SKScene, SKPhysicsContactDelegate {
    var ball : SKShapeNode!
    var line : SKShapeNode!
    var motionManager = CMMotionManager()
    var destX : CGFloat!
    var destY : CGFloat!
    let ballRadius = CGFloat(20.0)

override func didMoveToView(view: SKView) {
    backgroundColor = SKColor.whiteColor()
    physicsWorld.gravity = CGVector(dx: 0, dy: 0)
    physicsWorld.contactDelegate = self

    ball = SKShapeNode(circleOfRadius: ballRadius)
    ball.fillColor = UIColor.redColor()

    ball.position = CGPoint(x: frame.size.width/4, y: frame.size.height / 2)
    destX = frame.size.width/4
    destY = frame.size.height / 2
    ball.physicsBody = SKPhysicsBody(circleOfRadius: ballRadius)
    addChild(ball)

    line = SKShapeNode()
    var lineStart = CGPoint(x: frame.size.width/2, y: 0)
    var lineEnd = CGPoint(x: frame.size.width/2, y: frame.size.height)
    var linePoints = [lineStart, lineEnd]
    var linePos : CGMutablePathRef = CGPathCreateMutable()
    CGPathAddLines(linePos, nil, linePoints, 2)
    line.path = linePos
    line.strokeColor = UIColor.blackColor()
    line.physicsBody = SKPhysicsBody(edgeFromPoint: lineStart, toPoint: lineEnd)
    addChild(line)
}

override func update(currentTime: NSTimeInterval) {
    moveBall()
}

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
    NSOperationQueue.currentQueue(), withHandler: {
        data, error in
        var currentX = self.ball.position.x
        var currentY = self.ball.position.y
        self.destY = currentY - CGFloat(data.acceleration.x * 100)
        self.destX = currentX + CGFloat(data.acceleration.y * 100)
        }
    )
    ball.position = CGPoint(x: destX, y: destY)
    }
}

import UIKit
import SpriteKit

class GameViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    let skView = self.view as! SKView
    let scene = GameScene(size: CGSizeMake(
    skView.bounds.size.width, skView.bounds.size.height))
    skView.showsFPS = true
    skView.showsNodeCount = true
    skView.ignoresSiblingOrder = true
    scene.scaleMode = .AspectFill
    skView.presentScene(scene)
}

override func prefersStatusBarHidden() -> Bool {
    return true
}
}

EDIT: many thanks to Attackfarm :)

I changed the moveBall() function as follows:

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
        NSOperationQueue.currentQueue(), withHandler: {
            data, error in
                self.ball.physicsBody!.applyForce(CGVector(dx: -data.acceleration.x*100,
                        dy: data.acceleration.y*100))
        }
    )

which in this proof of concept demonstrates what I needed. Thanks again!

sentences:
Check which Player got highest Number from Dice I am doing a Ludo Game and currently i need to check which Player got the Highest Number from the Dice and the player which has the highest number goes on the starting position. Currently i created this method to check which player got the highest number then the player which has the highest numbers runs the method MovePlayer()

public void FirstTurn(){
    player1Steps = GameObject.Find("Player1").GetComponent<LevelManager>().randomNumberSteps;
    player2Steps = GameObject.Find("Player2").GetComponent<LevelManager>().randomNumberSteps;

    if(NetworkManager.MyGamePlayerId == "Player1" && player2Played == true)
    {
        MovePlayer();
    } else if(NetworkManager.MyGamePlayerId == "Player2" && player1Played == true)
    {
        if(player2Steps > player1Steps)
        {
            MovePlayer();
        }
    }
}

I am using the Photon Cloud Service since this is a multiplayer Game
Thanks

sentences:
Why do my sprites jitter when moving diagonally? I am working on an low resolution, isometric, pixel game in which several objects move from tile to tile. I do this with this simple interpolation:

let percent = elapsedTime / SPEED

vec.x = start.x + ( (dest.x - start.x) * percent )
vec.y = start.y + ( (dest.y - start.y) * percent )

This seems to work fine except when moving diagonally. It starts to jiggle pretty heavy. Is there a way to smooth this out?

I am using a 32x16 tile size.

edit: added video for better understanding: (video deleted)

edit: for anyone interested. I've solved it using this:

let
percent = elapsedTime / SPEED,
num = Math.round( (dest.x - start.x) * percent )

vec.x = start.x + num
vec.y = start.y + Math.floor(num / 2)

This works only for diagonal movement with 1:2 ratio tiles. I also added some stuff to make it work for all 4 diagonal directions.

sentences:
How do I get players to say "no" when they are afraid of missing out on sidequests or XP? In my RPG, I have a companion NPC who is overconfident in his abilities and lacks self-control. I wanted to create a few situations where the player needs to reign them in and tell them "no". One such situation basically boiled down to this:

Companion: Hey boss, I want to do this really stupid thing that will almost certainly make things harder for us down the road and possibly jeopardize our goal. Is that okay?
Player Choices:

Yes, go ahead!
No, don't do that!

My hypothesis was that the vast majority of playtesters would choose "No". To my surprise, the vast majority chose "Yes"! And then when the consequences played out and indeed made things worse, playtesters wanted to reload from an earlier save point and pick the other option (choosing "Yes" wasn't game-ending, but it did mean that a perfect outcome wasn't achievable).
When I asked the playtesters why they chose yes, they made it clear that they understood that saying yes was undesirable and saying no was desirable. They also weren't seeking a challenge or anything. Instead, the most common thing I heard was:

I was afraid that if I said "No", then I'd miss out on a sidequest or XP.

One of them even said that in other RPGs he played, the only way to get a 100% playthrough was to say yes at every opportunity, and so they assumed that was the case for mine.
I don't want players to assume that saying "yes" is always the right answer, and for now, I'd like to keep the situation of having to tell the NPC "no" every once in a while. But I don't know how to overcome these player expectations and their fear of missing out of content, especially without just flat out saying "this isn't like other games, you won't miss out if you say 'no'".
So how do I get players to say "no" when they are afraid of missing out on sidequests or XP?

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:
Dual marching squares/cubes - divide or do not divide a node? In the marching squares/cubes algorithm, how is it decided if a node in the quadtree/octree will be divided further (into 2^dimension nodes)?

I read about this heuristic that uses a trilinear interpolation to decide if an octree needs to be divided further for not.

It is not clear what the line represents and against what it's tested.

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:
Rotate 2D Isometric World Games like RollerCoaster Tycoon allow you to rotate the view at 90 degree intervals. I'm wondering how I could apply this to a game I'm making. I'm using MonoGame... but I'm wondering more if anyone could explain the theory behind the transformation rather than something language specific.

This video is exactly what I want to accomplish: http://youtu.be/qitkgiP13gw?t=15s

Basically all my tiles are in a 2D grid, and I just convert each X and Y to isometric for drawing. I'm assuming the transformation might be straight forward since it's a matter displaying the tiles with the right transformation.

Any help is greatly appreciated!

sentences:
LibGDX: Scene2D Stage wont react on multiplexer input I've got an inputMultiplexer. I want to register about two or three "systems" as processors. The classes which implementing InputProcessor get registerd by me like inputMultiplexer.addProcessor(this);. This works fine.

Unfortunately the stage which got registered very similarly

stage = new Stage();
inputMultiplexer.addProcessor(stage);

won't work. This means it won't act on any kind of user input. The strange thing is that if I don't add the other systems as processors - so the stage is the only one - it works very fine. Right now the stage gets registered as the second processor. I don't know if this could be the problem.

Do you have any idea what the problem here is?

sentences:
Parameter 'Blend' doesnt exist I want to animate my character, but i got this error: Parameter 'Blend' doesnt exist.

if i use 1d Blend Type it works fine no bug nothing.

But if i change the Blend type

in the animation panel working fine the animation but if i run the game i get this error: Parameter 'Blend' doesnt exist and my character is freeze in one position what can cause this problem ?

parameters

sentences:
Issue With setting Mesh.triangles in Unity Script I have been having an issue in making floating islands. For this i have created an array filled with the position data for both the top and bottom half of the island. Everything works fine when i only have the top half of the triangles implimented, but when i add the bottom half of the triangles become triangles that are shifted to the top half of the island.

To be more precise, the traingle index data seems to change while writing it to mesh.triangles.

This happens after mesh.triangles = triangles in the following code

    mesh.Clear();

    transform.position = new Vector3(-width/2,0 * scale,-height/2 * scale);

    positionsAll = new Vector3[2 * width * height];

    setupHeightMap();
    int[] triangles = getTriangles();

    mesh.vertices = positionsAll;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();

An example watch can be seen here, witth the first four showing the change in index, and the final four showing how the point is the same point but on the above surface.

    triangles[0]    30785   System.Int32
    triangles[4]    96322   System.Int32
    mesh.triangles[0]   30785   System.Int32
    mesh.triangles[4]   30786   System.Int32
    mesh.vertices[triangles[0]] "(65.0, 0.0, 120.0)"    UnityEngine.Vector3
    mesh.vertices[triangles[4]] "(66.0, -0.2, 120.0)"   UnityEngine.Vector3
    mesh.vertices[mesh.triangles[0]]    "(65.0, 0.0, 120.0)"    UnityEngine.Vector3
    mesh.vertices[mesh.triangles[4]]    "(66.0, 0.2, 120.0)"    UnityEngine.Vector3

This watch data was generated in an instance where all triangles that had positive values were not instanciated, but the same problem hapens if all Triangles are instanciated.

If anyone can tell me why this happens and/or how i can fix this problem that would be extremly helpful. thank you!

sentences:
How to open two Animator views in Unity? How can I open two Animator views in Unity editor?

What I tried so far is to lock an Animator view and go to Window=>Animator.

That did not help.

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:
Why my raycast sometimes not working? As you see in picture, i cast rays to (vector3.right * direction) from center of boxCollider's bounds.
It can detect the wall mostly, but sometimes it can't detect the wall and pass through it.
the layer of wall is 'obstacle' and ray only detect that layerMask.
why this happend?

            moveAmount.x = input.x * speed;
            moveAmount.z = input.z * speed;

            directionX = Mathf.Sign(moveAmount.x);
            rayLength = Mathf.Abs(moveAmount.x) + .015f;

            if (Physics.Raycast(rayOrigin, Vector3.right * directionX, out raycastHit, rayLength, collisionMask))
            {
                Debug.Log("Hit");
            }

sentences:
How can i check when Lerp has finished? private bool hitted = false;
private Vector3 hitPosition;

private void Test()
    {
        RaycastHit hit;

        if (Physics.Raycast(start.position, Vector3.left, out hit, 1.5f)
             || Physics.Raycast(start.position, Vector3.right, out hit, 1.5f)
             || Physics.Raycast(start.position, Vector3.forward, out hit, 1.5f))
        {
            if (hit.transform.tag == "Test")
            {
                hitted = true;
                hitPosition = hit.transform.localPosition;
            }
        }
    }

    private void Update()
    {
        if (hitted == true)
        {
            player.localRotation = Quaternion.Lerp(player.localRotation, Quaternion.LookRotation(hitPosition), 1 * Time.deltaTime);
        }
    }

What i want to detect is when the player finished rotating and then set back hitted to false.

sentences:
Displaying 2 textures on the same surface? I'm messing around with XNA in a very simple Minecraft-esque world I'm making and I'm wondering how I can do the "breaking the block" visuals in XNA.

If you're unfamiliar with the game, you begin interacting with the cube and based one what tool you're using, the block will take X amount of time to break. There's about 10 different stages of cracking that the cube will display before the cube breaks. I'm curious about how to display those 10 stages of cracking on top of the original skin of the block.

I know the game works using a Sprite sheet to color the blocks. This sprite sheet does not include every possible design at every possible stage of breaking the block, each stage is a different sprite with some transparency.

In short, how can I quickly and efficiently overlay a texture on a surface that already has a texture?

Do I have to combine them? If so, how?

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:
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:
Formula for range based attenuation I am trying to implement a simple shader for point lights, but I am struggling with the attenuation function. I know that normally you would use three coefficients (constant, linear, and quadratic), however in my framework point lights only have position, intensity (color) and range.

Is there any formula that only requires the light's range to work?

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:
Collision detection via adjacent tiles - sprite too big I have managed to create a collision detection system for my tile-based jump'n'run game (written in C++/SFML), where I check on each update what values the surrounding tiles of the player contain and then I let the player move accordingly (i. e. move left when there is an obstacle on the right side).

This works fine when the player sprite is not too big: Given a tile size of 5x5 pixels, my solution worked quite fine with a spritesize of 3x4 and 5x5 pixels.

My problem is that I actually need the player to be quite gigantic (34x70 pixels given the same tilesize). When I try this, there seems to be an invisible, notably smaller boundingbox where the player collides with obstacles, the player also seems to shake strongly. Here some images to explain what I mean:

Works:
Doesn't work:
Another example of non-functioning:   (the player isn't falling, he stays there in the corner)

My code for getting the surrounding tiles looks like this (I removed some parts to make it better readable):

std::vector<std::map<std::string, int> > Game::getSurroundingTiles(sf::Vector2f position)
{
    // converting the pixel coordinates to tilemap coordinates
    sf::Vector2u pPos(static_cast<int>(position.x/tileSize.x), static_cast<int>(position.y/tileSize.y));
    std::vector<std::map<std::string, int> > surroundingTiles;

    for(int i = 0; i < 9; ++i)
    {
        // calculating the relative position of the surrounding tile(s)
        int c = i % 3;
        int r = static_cast<int>(i/3);
        // we subtract 1 to place the player in the middle of the 3x3 grid
        sf::Vector2u tilePos(pPos.x + (c - 1), pPos.y + (r - 1));

        // this tells us what kind of block this tile is
        int tGid = levelMap[tilePos.y][tilePos.x];

        // converts the coords from tile to world coords
        sf::Vector2u tileRect(tilePos.x*5, tilePos.y*5);

        // storing all the information
        std::map<std::string, int> tileDict;
        tileDict.insert(std::make_pair("gid", tGid));
        tileDict.insert(std::make_pair("x", tileRect.x));
        tileDict.insert(std::make_pair("y", tileRect.y));

        // adding the stored information to our vector
        surroundingTiles.push_back(tileDict);
    }

    // I organise the map so that it is arranged like the following:
    /*
     * 4 | 1 | 5
     * --  -- --
     * 2 | / | 3
     * --  -- --
     * 6 | 0 | 7
     *
     */
    return surroundingTiles;
}

I then check in a loop through the surrounding tiles, if there is a 1 as gid (indicates obstacle) and then check for intersections with that adjacent tile.

The problem I just can't overcome is that I think that I need to store the values of all the adjacent tiles and then check for them. How? And may there be a better solution?
Any help is appreciated.

P.S.: My implementation derives from this blog entry, I mostly just translated it from Objective-C/Cocos2d.

sentences:
Unity3D mesh showing only black triangles My mesh in the unity editor won't show the correct texture. Instead I get to see loads of black triangles. Anyone know what's wrong?

thanks :)

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:
Making NavMeshAgent to look the direction it was moving when it stops I'm currently using NavMeshAgent as my player character controlled by keyboard or gamepad input.
Also, I'm flipping my character instead of turning via controlling localScale as below.

        private void FixHeadRotation()
        {
            float dir = (myAgent.velocity.normalized.x > 0) ? 1 : -1;
            transform.localScale = new Vector3(1, 1, dir);
        }

However, since I'm relying on the velocity I'm getting the direction(flip) right when moving, but not when I'm not moving(x should be -1 but 1 since no velocity).

I've noticed the NavMeshAgent has built-in function displaying an arrow gizmo over the agent's head. Perhaps I could use that(don't know how atm)?
or any other suggestions to this?

sentences:
Add Atten property in Unity Shaderlab In Unity Shaderlab shader, Is there any way to apply _Atten value?
Using surface shader, and vertex/fragment shader I can do it easily.
But, I didn't find any reference to do that in Shaderlab syntax.

Shader "Diffuse" {
    Properties {
        _Atten ("Light Attenuation Power", Float) = 1.0 // <= how to apply?
        _Color ("Main Color", Color)            = (1,1,1,1)
        _MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
    }
    SubShader {
        Pass {
            SetTexture[_MainTex]
            {
                  constantColor [_Color]
                combine texture * constant, texture * constant
            }
        }
    }
}

this makes syntax error.

constantColor [_Atten * _Color]

sentences:
Draw Primitives with Unity 2D I would like to be able to draw primitives in unity 2d to define my game objects. I have tried the following example:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Material mat;
    private Vector3 startVertex;
    private Vector3 mousePos;
    void Update() {
        mousePos = Input.mousePosition;
        if (Input.GetKeyDown(KeyCode.Space))
            startVertex = new Vector3(mousePos.x / Screen.width, mousePos.y / Screen.height, 0);

    }
    void OnPostRender() {
        if (!mat) {
            Debug.LogError("Please Assign a material on the inspector");
            return;
        }
        GL.PushMatrix();
        mat.SetPass(0);
        GL.LoadOrtho();
        GL.Begin(GL.LINES);
        GL.Color(Color.red);
        GL.Vertex(startVertex);
        GL.Vertex(new Vector3(mousePos.x / Screen.width, mousePos.y / Screen.height, 0));
        GL.End();
        GL.PopMatrix();
    }
    void Example() {
        startVertex = new Vector3(0, 0, 0);
    }
}

However I cannot find information on setting the Materical element of a game object anywhere. I am trying to create a simple 2d game using GL to draw the sprites instead of textures. My questions are:

What is the material object reference used for and is this required for unity 2d games?
Is using GL the easiest way to draw primitives in unity?

sentences:
OpenGL ES high-quality 2D scaling Let's say I'm making a 2D game and I want to implement a zoom in/out feature. Normally this is as simple as modifying the projection matrix to get more or less of the world to show. However, this results in quite blurry resizing, and I suspect the culprit is the GL_LINEAR parameter you supply to glTexParameteri as explained here.

I've done my fair share of video resizing and I know much better algorithms exist such as bicubic filtering, lanczos, spline, etc, however the only one OpenGL offers is (tri?)linear. What would be the best way of improving 2d scaling? I suppose this would involve shaders but I'm not familiar with the approach. Any reference to working code would be a nice plus.

sentences:
LWJGL texture bleeding fix won't work I tried a lot of things to fix texture bleeding, but nothing works. I don't want to add a transparent border around my textures, because I already got too many and it would take too much time and I can't do it with code because I'm loading textures with slick. My textures are seperate textures and they seem to wrap on the other side (texture bleeding).

Here are the textures that are "bleeding":

The head, body, arm and leg are seperate textures.

Here's the code I'm using to draw a texture:

public static void drawTextureN(Texture texture, Vector2f position, Vector2f translation, Vector2f origin,Vector2f scale,float rotation, Color color, FlipState flipState)
    {
        texture.setTextureFilter(GL11.GL_NEAREST);

        color.bind();
        texture.bind();

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

        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.glTranslatef((int)position.x, (int)position.y, 0);
        GL11.glTranslatef(-(int)translation.x, -(int)translation.y, 0);
        GL11.glRotated(rotation, 0f, 0f, 1f);

        GL11.glScalef(scale.x, scale.y, 1);

        GL11.glTranslatef(-(int)origin.x, -(int)origin.y, 0);

        float pixelCorrection = 0f;

        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0,0);
        GL11.glVertex2f(0,0);
        GL11.glTexCoord2f(1,0);
        GL11.glVertex2f(texture.getTextureWidth(),0);
        GL11.glTexCoord2f(1,1);
        GL11.glVertex2f(texture.getTextureWidth(),texture.getTextureHeight());
        GL11.glTexCoord2f(0,1);
        GL11.glVertex2f(0,texture.getTextureHeight());

        GL11.glEnd();

        GL11.glLoadIdentity();
    }

I tried a half pixel correction but it didn't make any sense because GL12.GL_CLAMP_TO_EDGE. I set pixelCorrection to 0, but it still wont work.

sentences:
Looking for an Open Source Game Engine with Crowd Simulation I am looking for a game engine for my school project on computer graphics. There are specific requirements that I do not want to implement by myself, since they are irrelevant for the grade, but relevant for the final result.

So reusing other one's code is a good thing here and I am looking for an engine that supports the following features, or that has plugins/3rd party projects available that can do it for me. I have already been looking for it for 2 days, but maybe some of you might just know the right fit for me.

Requirements:

Open Source / Free [so people can always view back my code without any licensing.]
3D
OO [I'm not so good at C++. Preferred are: Java, C#]
Crowd Simulation [I need walking people in my scene. This could be a 3rd party lib. Probably best with nav meshes.]
Render to Texture [I need panels with moving images on it. Unity3d fails here.]
Multi-project [I cannot adjust the installation folder on my school computer. UDK and CryEngine fail here.]
Networking
Cross Platform (at least for Linux)

Engines that fail my requirements:

CryEngine 3
UDK
Unity3d
OpenSceneGraph: not a real engine. I need more interactive components.
XNA: not cross platform.

Update
I found a nice crowd simulation lib after a long long search: http://gamma.cs.unc.edu/RVO2/ So that is not a big issue anymore

Update 2
Apparently, my mentor wants it to be cross platform. Which is an ouch for XNA.

sentences:
directional lightning I have managed to get a point light working, but I am facing problem with directional lightning.

    Fragment shader
 uniform vec4 lightColour ;
 uniform vec3 lightPos ;
 uniform float lightRadius ;

in Vertex {
vec3 colour ;
vec2 texCoord ;
vec3 normal ;
vec3 tangent ;
vec3 binormal ;
vec3 worldPos ;
} IN ;

  void main ( void ) {
  vec4 diffuse = texture ( diffuseTex , IN . texCoord );
  mat3 TBN = mat3 ( IN . tangent , IN . binormal , IN . normal );
  vec3 normal = normalize ( TBN * ( texture ( bumpTex , IN . texCoord ). rgb * 2.0 - 1.0));
  vec3 incident = normalize ( lightPos - IN . worldPos );
  float lambert = max (0.0 , dot ( incident , normal ));
  float dist = length ( lightPos - IN . worldPos );
  float atten = 1.0 - clamp ( dist / lightRadius , 0.0 , 1.0);
  vec3 viewDir = normalize ( cameraPos - IN . worldPos )
  vec3 halfDir = normalize ( incident + viewDir );

  vec3 viewDir = normalize ( cameraPos - IN . worldPos );
  vec3 halfDir = normalize ( incident + viewDir );
  float rFactor = max (0.0 , dot ( halfDir , normal ));
  float sFactor = pow ( rFactor , 33.0 );
  vec3 colour = ( diffuse . rgb * lightColour . rgb );
  colour += ( lightColour . rgb * sFactor ) * 0.33;
  gl_FragColor = vec4 ( colour * atten * lambert , diffuse . a );
  gl_FragColor . rgb += ( diffuse . rgb * lightColour . rgb ) * 0.1;

As far as I know, directional lightning do not have a radius or a position, just direction.
How should I calculate directional lightning?

sentences:
Leaderboard setup for Android I am totally new for this setup. I am trying to implement google Leaderboard. I followed the step by step process showed in "This Link". i opened windows -> Google play games -> setup -> Android setup. In Android setup i named the class name and copy and paste the xml code from play store account

This Picture Shows this

then i  clicked setup button. i got two popup boxes, Shows below,

in console i got messages

Note: All my software's are updated version only. first i used jdk 64bit. now i uninstalled 64bit and i installed jdk 32 bit. still i got the same problem

Anybody Please help.

Edit 2:
   using This video now i fixed the error JAVA_HOME not set.

then in unity i tried to do the same. Now it displays another message shown below

sentences:
Vertex Shader Fundamental Workings I understand that water ripples (e.g. stone thrown into a pond) are often handled with vertex shaders.  My first question is: are the ripples nothing more than an algorithm that is the function of time?

If yes, it means that the size and diameter of ripples is not "additive."  It means water vertices do not statefully "remember" their previous "disturbance" positions and accumulate more translation info.  Rather it means that, as a function of time, the position of "disturbed" water vertices are freshly computed each frame per unit time.

If no, it means that indeed the vertices accumulate disturbance / translation information - the vertices are stateful.

I hope the answer is "yes," because that actually makes sense to me.  If the answer is no, the I feel it creates tremendous burden on the CPU/GPU to keep track of all the state-per-vertice.  If the answer is "neither," do tell. :)

My second question is, assuming a "yes" above, how does such a "water disturbance shader algorithm" account for continuous interaction with irregular shapes?  For example, please look at the video 40 second mark showing a car crashing through water.  It is not so clear how the vertex shader knows how to make a rectangular disturbance shape (the shape of the car).  Perhaps, over-simplifying, the vertex shader takes both time and a vector to generate the ripples, where the vector is the speed/direction of a car (and the shader code always makes a car-shaped rectangle no matter what).

Is this the right high-level understanding of how this water trick works?

sentences:
Absorbtion 2d image effect I want to create a specyfic 2d image effect. It consists in modifying a sprite so it looks like it is being zoomed to a point or "absorbed" by that point. I'm not really sure what is the technical name of this effect so I cannot explain it correctly.

Here you can see a video of what I'm talking about, it is the effect when the character absorbs the three glyphs.

http://www.youtube.com/watch?v=PIo-GddsMcU&t=4m45s

What is the name of this effect?
How can I implement it with XNA for 2D textures/sprites?

sentences:
Unity Hybrid ECS with "old way" Is it possible to use Hybrid ECS with some components and the standard MonoBehaviour with all your old code?

I want to know because I already have some game mechanics build with the "old" way and I want to build the new ones using hybrid

sentences:
How can I stop transform.position from being modified when adding a child object? I suspect there is a well-known and easy to explain reason for the behavior I'm seeing, but I am having difficulty explaining it (and likely not able to Google for the answer).

When adding a child GameObject to a translated parent, the child's localPosition is modified so that the child's position stays the same after  the parent's transformation is applied. Is there a way to not have this be the case?

In the following example, I create a parent object and move it to (1,1,1), and then attach the child. I would like the child's position to be (1,1,1), that is (0,0,0) relative to the parent. However, the child's position is modified to be (-1,-1,-1) so that it is (0,0,0) relative to the world.

Here is a repro:

// Create parent.
GameObject parent = new GameObject();
parent.name = "Parent GameObject";
parent.transform.parent = foregroundObject.transform;

// Move the parent.
parent.transform.Translate(1, 1, 1);

// Add a child under the parent GameObject.
GameObject child = (GameObject) GameObject.Instantiate(guildiePrefab);
child.name = "Child GameObject";

child.transform.parent = parent.transform;

// PROBLEM: localPosition is set so that the "global" position is (0,0,0).
// How can I add the child object and have its position be (1,1,1)?
this.Assert(child.transform.localPosition.ToString() == "(-1.0, -1.0, -1.0)");
this.Assert(child.transform.position.ToString() == "(0.0, 0.0, 0.0)");

Is there a different way I should be adding child as a child of parent? Or, should I always zero-out the position of parent before adding a child? If that is the case, any reason why I need to do this? What is the rational for this design choice?

sentences:
Trying to Rotate terrain I'm new to OpenGL and don't really know how to rotate a terrain. For my graphics class, I have a project I need to do that is making a tire using OpenGL and work that we done in class (my framework is one of the labs that we did that introduced us to heightmaps and terrains).

I have this tire tread terrain (see picture) that I made and how I'm going to make the tire is by making lots of these tire terrains and rotate them to make the tire shape. I'm sure there is better ways to accomplish this but my professor recommended I do this. So I was wondering how I can rotate it.

The code below is my code for the terrain that is shown in the picture.
Thank you in advance for the help!

void TerrainScene()
{
    glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
    glLoadIdentity();
    //gluLookAt(0,g.moveup,g.movedown,  0,0,0,  0,1,0);
    //gluLookAt(g.movedown-50,8,g.moveup,  g.movedown-50,-2,g.moveup-40,  0,1,0);
    gluLookAt(g.movedown-50,70,g.moveup,  g.movedown-50,-2,g.moveup-40,  0,1,0);
    glLightfv(GL_LIGHT0, GL_POSITION, g.lightPosition);
    glColor3f(1.0f, 1.0f, 0.0f);
    glBegin(GL_TRIANGLES);
    glNormal3f(1.0f, 1.0f, 0.0f);
    float x = -25.0;
    float z = -25.0;
    float inc = 0.2;
    glColor3f(0.8f, 0.8f, 0.8f);
    for (int i = 0; i < 256; i++)
    {
        for (int j = 0; j < 256; j++)
        {
            float scale = 5.0;
            int tmp1 = (int)*(img[0].data + (i*img[0].width*3 + j*3));
            int tmp2 = (int)*(img[0].data + ((i+1)*img[0].width*3 + j*3));
            int tmp3 = (int)*(img[0].data + (i*img[0].width*3 + (j+1)*3));
            int tmp4 = (int)*(img[0].data + ((i+1)*img[0].width*3 + (j+1)*3));

            float e1 = -10.0 + ((float)tmp1 / 255.0) * scale;
            float e2 = -10.0 + ((float)tmp2 / 255.0) * scale;
            float e3 = -10.0 + ((float)tmp3 / 255.0) * scale;
            float e4 = -10.0 + ((float)tmp4 / 255.0) * scale;

            unsigned char rgb[3];
            getTerrainColor(i,j,1,rgb);
            glColor3ubv(rgb);
            Vec v1, v2, v3, norm;
            vecMake(x,      e2, z+inc, v1);
            vecMake(x+inc,  e4, z+inc, v2);
            vecMake(x,      e1, z,     v3);
            getTriangleNormal(v1,v2,v3,norm);
            glNormal3fv(norm);
            glVertex3f(x,     e2, z+inc);
            glVertex3f(x+inc, e4, z+inc);
            glVertex3f(x,     e1, z);
            vecMake(x+inc,  e4, z+inc, v1);
            vecMake(x+inc,  e3, z,     v2);
            vecMake(x,      e1, z,     v3);
            getTriangleNormal(v1,v2,v3,norm);
            glNormal3fv(norm);

            glVertex3f(x+inc, e4, z+inc);
            glVertex3f(x+inc, e3, z);
            glVertex3f(x,     e1, z);
            x += inc;
        }
        x = -25.0f;
        z += inc;
    }
    glEnd();
}

sentences:
OpenGL glTexImage3D not working? I'm trying to use arrax textures with opengl 3.3 since this the target version for my application. So I have to use the glTexImage3D() method instead of glTexStorage3D(). The problem is, if I use glTexImage3D() instead of glTexStorage3D() the screen is always black. The other way round, everything works. Here is how I create the array texture:

public ArrayTexture(int width, int height) {
    this.width = width;
    this.height = height;
    this.arrayTextureHandle = GL11.glGenTextures();
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        //Works perfect
        GL42.glTexStorage3D(GL30.GL_TEXTURE_2D_ARRAY, 1, GL11.GL_RGBA8, width, height, 10);
        //Doesn't work with these parameters
        //GL12.glTexImage3D(GL30.GL_TEXTURE_2D_ARRAY, 0, GL11.GL_RGBA8, width, height, 10, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);

    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
}

public void addTexture(ScrollingSprite... sprites) {
    if(zLayerCounter + sprites.length <= MAX_LAYERS) {
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        Arrays.asList(sprites).forEach(sprite -> {
            sprite.getTexture().getTextureData().prepare();
            GL12.glTexSubImage3D(GL30.GL_TEXTURE_2D_ARRAY,
                0,                      //Mipmap number
                0, 0, zLayerCounter++, //xoffset, yoffset, zoffset
                width, height, 1,          //width, height, depth
                GL11.GL_RGBA,                 //format
                GL11.GL_UNSIGNED_BYTE,       //type
                sprite.getTexture().getTextureData().consumePixmap().getPixels()); //pointer to data

            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_S, sprite.getTextureWrapS());
            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_T, sprite.getTextureWrapT());
        });

        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
    } else {
        throw new IllegalArgumentException("Maximum number of textures reached!");
    }
}

sentences:
Unity5 build won't run on android 2.3.3 I made a game using one of the Unity tutorials on their site and now would like to run on my phone (LG P500). But when I try to run it on the device, it says:

  Failure to initialize: Your hardware does not support this application, sorry!

What can I do in this case?

sentences:
Algorithm for game difficulty/pacing curve generation in single player RPG I'm looking at this article about pacing in entertainment and games. It suggests that all good entertainment roughly follows a pacing/engagement curve like Star Wars(below).

I'm interested in how I can procedurally generate random-looking curve that would conform to the Star Wars engagement intensity pattern (linear increase and oscillating peaks-valleys). The simplest implementation I can think of is a rectified sine wave and a sloped line, but that would be very predictable. I have an algorithm for perlin noise already in the game and am interested if I can leverage perlin noise algorithm to procedurally generate a varying sequence of peaks and valleys on an increasing slope.

Here's my attempt so far:

Once I have an algorithm, I can reference it to get engagement difficulty in relation to game turn or progress through some level.

I will add my thoughts to this question in hopes that someone can correct or point out flaws in my approach below:

I get the basic XP system in place (previous level *1000 to advance to next level)
Decide on the level cap (lets say 20 levels)
Plot available equipment tiers vs 20 levels (regular at lvl 1, magical at lvl 10, epic at lvl 20)
Using the peak-valley graph decide how many fights are in each peak-valley cycle (5 to reach lvl 2, 12 to reach lvl 20).
estimate number of turns per fight, let's say 5 turns per fight
calculate xp needed and turns needed to reach to each new level
Plot turn number and hypothetical xp the party has at each level.

Now for each peak I have a number of turns and the amount of XP that the curve should have between two valleys.

Using whatever formula the curve follows at that peak (let's assume a bell curve), I can get the xp value of monsters I have to spawn during that turn. These monsters have their equipment adjusted according to the equipment vs tier/turn number that was calculated above.

Now I need to adjust monster XP and test it at different levels. A simple sanity check: a party of 6 players must kill:

750 xp of monsters in first fight in 5 turns, that is 30 actions.
1500 in second fight
1800 in third fight
1350 in fourth
555 in fifth

sentences:
Unity - Rotating X on camera changes result of ScreenPointToRay completely I am using ScreenPointToRay to draw a Line along my Mouse drag. My code for getting my mouse position looks like so:

public static RaycastHit RaycastScreenPoint(Vector2 mousePosition, LayerMask mask, Camera cam)
{
    var ray = cam.ScreenPointToRay(mousePosition);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit, float.PositiveInfinity, mask))
    {
        Debug.DrawRay(hit.point, Vector3.up, Color.red, 2);
        return hit;
    }
    else
    {
        throw new System.Exception("Mouse raycast did not hit anything");
    }
}

With my perspective camera at 65, 0, 0, this works great. However, if I change the rotation of my camera to 90, 0, 0, the line is drawn outside the camera view, why is this?

I want this line to be drawn the same no matter the camera rotation.

My code for drawing line:

private void Update()
{
    if (Input.GetMouseButtonDown(1))
    {
        lr.positionCount = 2;
        startPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, movementMask, cam).point;
        lr.SetPosition(0, startPos);
    }

    else if (Input.GetMouseButton(1))
    {
        endPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, movementMask, cam).point;
        lr.SetPosition(1, endPos);
    }

    else if (Input.GetMouseButtonUp(1))
    {
        endPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, movementMask, cam).point;
        lr.SetPosition(1, endPos);
    }
}

This image is with the camera rotation at 64, 0, 0. As you can see, the Line is drawn inside the camera view as intended, and follows my mouse:

This image is with the camera rotation at 90, 0, 0. I am dragging my mouse in the middle of the game view, and yet for some reason, the line is ending up outside the camera:

sentences: Head bone not found when importing .blend to Unity I have created a model, rigged it(using rigify), and created several actions(animation clips) for it Blender.  Everything seems to be fine.  However, when I import the .blend to Unity I get a console warning that "Required human bone 'Head' not found".  I know that there is a bone called "head" in my .blend.  The animations work, except the head rotation does appear to not be deforming.  Has anyone experienced this? Is this just a naming convention thing.  Should I try to rename my "head" bone to "Head"?  I just don't know the inner workings of the the import process well enough to know what to do.

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:
If I release code under GPLv3, can I specify what parts of users' code can be released under a new license? I have a few questions about what users of my engine could copyright in their own project. The way the engine would work would be that it would be a standalone program in Java that would load all of the scripts/assets/data from a folder that the game takes place in. The code could be written in Python or compiled to Java.

Onto my questions, the code that they write would access some parts of my engine through Jython, and so I assume those would have to be released under the GPL. But what about the rest of the game other than the code? Like could they copyright their own art?

I guess what I really want is that modifications of the code of the engine must be released under the GPL, but projects created using my engine can be released under any copyright, as long as they obey they distribute the engine itself under the GPL.

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:
How should I implement card effects in a card game? I've been trying to program a video game adaptation of the popular trading card game "Magic: The Gathering". If you've played MTG before, you'll know most cards have an effect, which is activated at a certain time, usually when it's played. But I'm unsure how to implement effects into my game.

I'm thinking of creating a method that assigns a card its effect when it's played based on the card's name, but that doesn't really work when a card's effect isn't supposed to be activated when it's played, like in the case of Deathrattle cards, or when it's a continuous effect. I've thought of creating a thread for each effect which activates it whenever needed, but... that's a LOT of unique threads. I haven't found any similar java programs anywhere, so I wanna ask here. How do you think card effects should be handled?

sentences:
How to create custom methods for sprite groups in pygame? I want to use sprite groups in my game using pygame and the default draw isn't enough. I have tried some tutorials but I failed.

So, being more specific: I want to create custom methods for sprite groups in pygame such as .handle_event (this method can exist at all sprites or not).

sentences:
Why is the root of the character rig the pelvis? When creating character rigs for video games we always set the root of the rig and all the kinematic chains to the pelvis of the character. Is their a specific reason that we do that or is it by convention?

What is the reasoning behind this?

sentences:
Basic C# Script in Unity3D for firing a bullet (not working) working on a 2D top-down view game. Im trying to get my player to fire a bullet when spacebar is pressed. I added a component to my player (a bullet sprite) and placed it under his gun (so you can't see it). I added a debug message "Shoot" to make sure that whenever I hit spacebar it gets registered - however, the bullet never shoots. I get the message

UnassignedReferenceException: The variable bulletPrefab of ShootBullet has not been assigned

Here is my script:

public class ShootBullet : MonoBehaviour {
    public Rigidbody bulletPrefab;
    float attackSpeed = 2f;
    float cooldown;

    void Update () {
        if(Time.time >= cooldown) {
            if(Input.GetKeyDown (KeyCode.Space)) {
                Fire();
                Debug.Log ("Shoot");
            }
        }
    }

    // Fire a bullet
    void Fire() {
        Rigidbody bPrefab = Instantiate(bulletPrefab, transform.position, Quaternion.identity) as Rigidbody;
        bPrefab.AddForce (Vector3.up * 100f);
        cooldown = Time.time + attackSpeed;
    }
}

Any ideas?

sentences:
Folding selected Parent Game Object in the hierarchy I am folding selected parent gameObject with this editor script. It all works well but it also folds other expanded gameObjects which should not happen. For example under two different parents, if I collapse one parent gameObject, even the other parent gameObject gets collapsed. How do I not let this happen?
The problem is at:
rootGameObjects.AddRange (SceneManager.GetSceneAt (i).GetRootGameObjects ());

It takes the root gameObject in a scene but not the selected gameObject in the hierarchy.
Here's the rest of the code:
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;

public static class CollapseTools {
    private static int wait = 0;
    private static int undoIndex;

    public static void CollapseGameObjects () {
        EditorApplication.update -= CollapseGameObjects;
        CollapseGameObjects (new MenuCommand (null));
    }

    [MenuItem ("GameObject/Collapse GameObjects", priority = 40)]
    private static void CollapseGameObjects (MenuCommand command) {
        // This happens when this button is clicked via hierarchy's right click context menu
        // and is called once for each object in the selection. We don't want that, we want
        // the function to be called only once
        if (command.context) {
            EditorApplication.update -= CollapseGameObjects;
            EditorApplication.update += CollapseGameObjects;

            return;
        }

        List<GameObject> rootGameObjects = new List<GameObject> ();
#if UNITY_2018_3_OR_NEWER
        // Check if a prefab stage is currently open
        var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage ();
        if (prefabStage != null && prefabStage.stageHandle.IsValid ())
            rootGameObjects.Add (prefabStage.prefabContentsRoot);
        else
#endif
        {
            int sceneCount = SceneManager.sceneCount;
            for (int i = 0; i < sceneCount; i++)
                rootGameObjects.AddRange (SceneManager.GetSceneAt (i).GetRootGameObjects ());
        }

        if (rootGameObjects.Count > 0) {
            Undo.IncrementCurrentGroup ();
            Selection.objects = Selection.objects;
            undoIndex = Undo.GetCurrentGroup ();

            Selection.objects = rootGameObjects.ToArray ();

            EditorApplication.update -= CollapseHelper;
            EditorApplication.update += CollapseHelper;
        }
    }

    private static void CollapseHelper () {
        if (wait < 1) // Increase the number if script doesn't always work
            wait++;
        else {
            EditorApplication.update -= CollapseHelper;
            wait = 0;

            EditorWindow focusedWindow = EditorWindow.focusedWindow;
            if (focusedWindow != null)
                focusedWindow.SendEvent (new Event { keyCode = KeyCode.LeftArrow, type = EventType.KeyDown, alt = true });

            Undo.RevertAllDownToGroup (undoIndex);
        }
    }
}

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:
Level/Map file creation and processing with OpenGL How do levels/maps work in the game development world? Counter strike, which is a popular FPS that uses OpenGL as it's graphics library, has it's levels/maps created as *.bsp files. How do you create files like this, and use OpenGL to load them?

Thanks!

sentences:
Is there any less expensive way to achieve this lighting effect? I'm creating a game that is similar to Tibia on its projection:

But I want it, under the hoods, to be 3D, and extremely dynamic - meshes generated on the fly, statues exploding and turning into smoke monsters, things like that. For that, I've created a renderer that isn't geometry based, but atom based - it takes a compact buffer of positions and colors and renders it to screen. It works extremely well and is quite fast. There is only one problem, lighting. To achieve realistic lighting, I must, for each atom on the screen, emit a ray that traces a volume, sampling among the way. If it hits something before the light, that space isn't lit. This is the end result:

I love that effect, but, on my machine with a low-end GPU, it can stand millions of atoms, but only 2 lights max. That is not enough, I'd need 16 lights at least. Each light requires dozens of samplings for each atom on scene, it is prohibitively expensive. Without global lighting, the ambient becomes flat and boring.

Is there any creative way to achieve the same effect, albeit less expensive?

sentences:
Why isn't my image's transparency honoured in the Unity sprite? I'm following through Jesse Freeman's Lynda course Unity 5 2D Essential Training. The exercise files contain sprites with transparency. Here's a screenshot of one such sprite on the trainers screen (sorry it's so small):

But here's how it looks in my scene in Unity 5.5.0F3:

I think that the sprite's alpha properties are set correctly, I have Alpha Source set to "Input Texture Alpha" and Alpha Is Transparency is checked:

When I open the PNG in PhotoShop the transparency is correctly set:

Why is the transparent area rendered as opaque in my sprite?

sentences:
What does ddx (hlsl) actually do? I'm a bit confused.  The official documentation (http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588(v=vs.85).aspx) says that ddx(input) is the partial derivative of the input with respect to the "screen-space x-coordinate."

My calculus is fine, but how can it tell what the input is coming from?  If I passed it a function, fine, I can imagine what it would do, but the derivative of a number is always zero...?

Is it just a scaling?  Like, this would get scaled to one tenth of its size at this distance, so it returns one tenth?  But then it doesn't need an input...

Can someone give a quick explanation of what's actually happening?

sentences:
How to create data driven effects/abilities for collectable card game I'm trying to create cards for a ccg/tcg that are completely "data-driven" from an xml/json/external file. I've read multiple articles on this issue already, even here on stack exchange, but i can't figure out how to actually code this. I have a simple example:

My two cards have the following abilities

1) "Increase the value of all adjacent red cards by 1"

2) "Increase the value of this card by the amount of all adjacent red cards"

In my code i have the following functions (pseudo) that i need to accomplish these effects:

Increase(targetCards, byValue) // increases a card's value by another value
FindCards(filter=adjacent) // returns all adjacent cards
FilterCardsBy(filter=isRed) // returns only red cards
Count(targetCards) // counts the number of cards

To create effect 1 i would use the functions like this:

Increase(FilterCards(FindCards(adjacent), isRed), 1);

and to create effect 2 i would use:

Increase(this, Count(FilterCards(FindCards(adjacent), isRed)));

So here's the problem:
I have no clue how i can describe these functions in my external file and also i have no clue how i actually tell my functions to work in this combination to achieve the desired effects.
Maybe i'm misunderstanding the concept here but as far as i understood and described here i can create some pseudo script/code in my external file that then my code can interpret and execute on. But i feel i somehow missing the middle part where i write code to interpret these commands i'm defining in the external file.

Anyone with experience here that can give me some super simple starter ideas on how to takle this. Especially the part where i can combine several functions into one.

sentences:
How can I change some tree's radius and length in C# script in Unity3D? So, I have this little tree stem. It only has its initial node.
All I would like to do is make it grow in length and radius in Update(). How can I do that?

sentences:
How do I run a headless Unity server in a Windows Docker (without GPU)? I am trying to run a headless Unity server on a Windows Docker.
On Linux, there is Xvfb, but I don't know how I could get similar results on Windows.
How would I do that?

sentences:
GL_DEPTH_COMPONENT vs GL_DEPTH_COMPONENT32 I googled like crazy and checked the OpenGL documentations but I couldn't find out how the precision of a depth buffer created using GL_DEPTH_COMPONENT is chosen.

As far as I know the precision is implementation dependent. But how will the precision be chosen? Will it always use the highest precision possible or rather the fastest one? Or is no general answer possible?

Shoud I always go with GL_DEPTH_COMPONENT32 instead?

sentences:
2D multiple circle collision response I'm trying to implement simple 2D circle collision system. There are circles with different radiuses and velocities (the larger the circle the slower it is). Contrary to all the questions on the Stack, the circles do not bounce at all.

There is no problem with collision response for two circles that overlap. There are two approaches that I thought of:

Pushing the circles apart with displacements dependent on the ratio of circles' radiuses.
Pushing the smaller circle away so it doesn't collide with the bigger circle anymore.

However, neither of these approaches works for multiple circle collisions. Let's consider an easy example:

Three circles are moving towards the same point but with different velocities:

In the next frame they overlap like this:

Then with either of the two approaches the smallest circle gets pushed away from the
biggest one:

And then the right-most circle would push the smallest circle to the right making an infinite collision loop.

Of course, the more circles, the more complicated the collision resolving would be.
Additionally, I'm going to add static walls thus making collision system even more complex.

What algorithm can I use to make multiple collisions work?
I guess that the desired effect would look like this:

sentences:
Other methods to save data than PlayerPrefs? I've been saving data using the playerPrefs option in Unity till now.
Is there any better/secure way of saving data for developing mobile games.
Somes sites have mentioned encryption of data - how do I approach that?

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:
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:
How does heavily constrained delaunay triangulation work? In short: I'm trying to find an algorithm for performing a Delaunay triangulation of a heavily constrained polygon (for the purpose of pathfinding), with the understanding that most of the resulting triangles will be illegal (non-Delaunay) due to the constraints. Making the effort should still help reduce generation of long/thin triangles where possible.
I'm trying to understand how constrained Delaunay triangulation works, within the context of game maps where the available ground surface for navigation and pathing is defined by a polygon on a flat 2D plane. The polygon needs to be triangulated for use in pathfinding, such that moving from point A to point B passes through as few polygons as possible (so polygons need to be as large as possible).
I first looked into regular Delaunay triangulation, and there are multiple methods available, but they all assume a point cloud where the goal is to create ideal triangles without constraints.
Then I looked into constrained Delaunay triangulation, but there is very little available I could find beyond academic papers, and many of those simply perform a regular Delaunay triangulation, then cut triangles that intersect constraints and re-triangulate around them. This seems backwards and inefficient to me when literally ALL of the triangles I want to end up with will be constrained.
I saw a GDC video, where the Starcraft 2 devs talked about using constrained Delaunay triangulation, and you can kind of see it when you look at the pathing mesh in the Starcraft 2 editor (see below). However, very few of the generated triangles are legal, due to the number of constraints in the map layout. Still, I am assuming the Delaunay algorithm influenced the selection of points to triangulate, in order to get the best triangle coverage.
However, I can't find any further info on how this might work. How does one start with constraints, points connected by fixed lines, and then "fill in" the remaining lines to generate triangles that are a best-effort attempt to not be overly stretched or narrow?
Edit: Screenshot example from Starcraft 2 editor:

sentences:
GLSL Shader - Change Hue/Saturation/Brightness I'm trying to change the hue of an image using a GLSL fragment shader. I want to achieve something similar to Photoshop's Hue/Saturation Adjustment layer.

In the following image you can see what I've got so far. I want to change the hue of the green square so it looks like the red square on the right, but with this shader I get a half red half pink square (the square in the middle).

What I'm doing in the fragment shader is converting the texture's color to HSV, then I add the HSV color that I get from the vertex shader to it and I convert the color back to RGB.
What am I doing wrong?

Fragment shader:

precision mediump float;
varying vec2 vTextureCoord;
varying vec3 vHSV;
uniform sampler2D sTexture;

vec3 convertRGBtoHSV(vec3 rgbColor) {
    float r = rgbColor[0];
    float g = rgbColor[1];
    float b = rgbColor[2];
    float colorMax = max(max(r,g), b);
    float colorMin = min(min(r,g), b);
    float delta = colorMax - colorMin;
    float h = 0.0;
    float s = 0.0;
    float v = colorMax;
    vec3 hsv = vec3(0.0);
    if (colorMax != 0.0) {
      s = (colorMax - colorMin ) / colorMax;
    }
    if (delta != 0.0) {
        if (r == colorMax) {
            h = (g - b) / delta;
        } else if (g == colorMax) {
            h = 2.0 + (b - r) / delta;
        } else {
            h = 4.0 + (r - g) / delta;
        }
        h *= 60.0;
        if (h < 0.0) {
            h += 360.0;
        }
    }
    hsv[0] = h;
    hsv[1] = s;
    hsv[2] = v;
    return hsv;
}
vec3 convertHSVtoRGB(vec3 hsvColor) {
    float h = hsvColor.x;
    float s = hsvColor.y;
    float v = hsvColor.z;
    if (s == 0.0) {
        return vec3(v, v, v);
    }
    if (h == 360.0) {
        h = 0.0;
    }
    int hi = int(h);
    float f = h - float(hi);
    float p = v * (1.0 - s);
    float q = v * (1.0 - (s * f));
    float t = v * (1.0 - (s * (1.0 - f)));
    vec3 rgb;
    if (hi == 0) {
        rgb = vec3(v, t, p);
    } else if (hi == 1) {
        rgb = vec3(q, v, p);
    } else if (hi == 2) {
        rgb = vec3(p, v, t);
    } if(hi == 3) {
        rgb = vec3(p, q, v);
    } else if (hi == 4) {
        rgb = vec3(t, p, v);
    } else {
        rgb = vec3(v, p, q);
    }
    return rgb;
}
void main() {
    vec4 textureColor = texture2D(sTexture, vTextureCoord);
    vec3 fragRGB = textureColor.rgb;
    vec3 fragHSV = convertRGBtoHSV(fragRGB);
    fragHSV += vHSV;
    fragHSV.x = mod(fragHSV.x, 360.0);
    fragHSV.y = mod(fragHSV.y, 1.0);
    fragHSV.z = mod(fragHSV.z, 1.0);
    fragRGB = convertHSVtoRGB(fragHSV);
    gl_FragColor = vec4(convertHSVtoRGB(fragHSV), textureColor.w);
}

EDIT:
Using the functions Sam Hocevar provided in his answer, the problem with pink bands is solved, but I can only reach half of the color spectrum. I can change the hue from red to green, but I can't change it to blue or pink.

In the fragment shader, I'm doing this now:

void main() {
    vec4 textureColor = texture2D(sTexture, vTextureCoord);
    vec3 fragRGB = textureColor.rgb;
    vec3 fragHSV = rgb2hsv(fragRGB);
    float h = vHSV.x / 360.0;
    fragHSV.x *= h;
    fragHSV.yz *= vHSV.yz;
    fragHSV.x = mod(fragHSV.x, 1.0);
    fragHSV.y = mod(fragHSV.y, 1.0);
    fragHSV.z = mod(fragHSV.z, 1.0);
    fragRGB = hsv2rgb(fragHSV);
    gl_FragColor = vec4(hsv2rgb(fragHSV), textureColor.w);
}

sentences:
How to handle transparent pixels in a spritesheet I am trying to correctly handle transparent pixels. I have a spritesheet that gave me the following:

The green body is the ground physics body and the gray body around the sprite is the sprite's physics body - calculated with the bounds of the sprite. I plan on having images for the ground body of the same size, and wanted the sprite's feet to touch the ground. I was able to achieve this by repacking the images in a new spritesheet with TexturePacker, without any transparent pixels:

However, now my problem is other animations, like crouch for example:

As you can see, the sprite's feet are once again off the ground. Doing this animation in the game looks silly because the sprite crouches by lifting his feet off the ground body.

The output metadata in JSON from TexturePacker looks like this:

{
    "filename": "Crouch/soldier_crouch_1.png",
    "frame": {"x":712,"y":867,"w":353,"h":425},
    "rotated": false,
    "trimmed": true,
    "spriteSourceSize": {"x":49,"y":42,"w":353,"h":425},
    "sourceSize": {"w":433,"h":500},
    "pivot": {"x":0.5,"y":0.5}
},
// ...

This is a problem for several of my animations with this and other sprites. Repacking with TexturePacker allows me to remove the transparent pixels and have a more accurate physics body (which was really the goal, I'd like the most accurate collision detection once I start having projectiles) but now the animations look funny.

How is something like this handled in game development?

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:
Can you get polygon collider 2d shape from a sprite? When you create an object with polygon collider 2d from inspector, unity automatically generates polygon collider that approximately fits the sprite. My question is if there is a way to do that when creating an object from a script? While searching for a solution I found that each sprite has a sprite mesh which has vertices. I tried setting those as a path for my collider, but the result is a mess: their order appears to be messed up. My current code:

         Sprite spr; // I get that in other part of the code
         GameObject go = GameObject)Instantiate(prefab,gameObject.transform);
         go.GetComponent<SpriteRenderer>().sprite = spr;
         go.GetComponent<PolygonCollider2D>().SetPath(0, spr.vertices);

sentences:
XNA Float values don't work as parameter With the Microsoft XNA Framework I can change the color of a tinted texture by changing it's integer values like so:

Int x = 255;
if(true) { x--; tint = new Color(x, 255, 255); }
Draw(texture, Vector2.Zero, tint);

If x were a float however the appearance of the sprite wouldn't change until the value x became zero. With integer the texture fades over time with the event change.

Why is this? :S

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:
Multi-colored text and kerning Drawing multi-colored text or highlighted text in XNA/MonoGame is pretty annoying, and the standard way I've seen to do it is to just to make multiple SpriteBatch.DrawString calls, and place them using the x-coordinates given by SpriteFont.MeasureString. This is fine if you're highlighting whole words or blocks of text, but if you only want to highlight select letters inside of a word, you get a kerning nightmare:

Sometimes this looks alright, but not consistently and I can't think or find a good way to space out the letters properly.

Therefore, I would like to know if there's either a better way to draw highlighted text like this in XNA/MonoGame, or a way to pull kerning data out of a font so I can space the letters properly or some other fancy way to do it using masks or whatnot.

Thanks in advance!

sentences:
Cocos2D v3 and Physics simulation on server I'm trying to develop a real time multiplayer game using Cococs2d v3. The game is basically a side scrolling racing game. I wanted to develop the client using Cococs2d for iPhone, and the server side using Java.
I've read about real time networking and the difficulties I can encounter, but also how can I overcome it. The most helpful articles I read was Valve's, Glenn Fiedler's game networking article and Gabriel Gambetta's article on fast-paced multiplayer games.
I can attach links to those articles if anyone is interested :)

I have come to the conclusion that the physics should be implemented both on the client side and the server side. Using cocos2d v3 this could be done without any problems on the client side, but how can I use the same physics simulation in my server written in Java?
For example how could the server know if there's a hill the client player is climbing, or if there's an obstacle it need to collide with? The physics engine the client use is written in Objective C..

Am I missing something over here?
If my question is not clear enough, please tell me and I will explain it in more details.

Thanks in advance :)

sentences:
How do i draw depth complexity(overdraw) in directx 11? I want to read the stencil value in the shader so I can set colors for different depths.

What I understand. Make a loop after the scene is rendered but before is is presented.
so a loop with the number of colors(k) and in the loop, use the code:

 md3dImmediateContext->OMSetDepthStencilState(RenderStates::DrawDepthDSS, k);

This is what I know. What are the other steps? like to send the depth to the shader?

..I have this code for the shader

   Texture2D<uint> txStencil : register (t0); // set the corresponding register
float4 PSStencil(float4 pos: SV_Position) : SV_Target
{
    uint stencil = txStencil.Load(int3(pos.xy, 0));

    // debug output
    if (stencil == 1) return float4(0, 1, 0, 1);
    else return float4(0, 0, 0, 0);
}

But how do I send the shader the stencil value?

sentences:
Workflow for tagging a sprites with collision boxes I have some hundred of sprites and I need to mark collision boxes of them.

What kind of workflow can I use to help this proceed smoothly?

I've thought of using Tiled initially, however one of my requirements would be to not only mark multiple collision boxes per sprite but also to mark each one with a name or type category.

I would love to have final structure equivalent to:

<Bodies>
    <Body id="1">
        <CollisionBox>
            <Name>BODY_COLLISION</Name>
            <Vertices>
                <Vertex>12;13</Vertex>
                <Vertex>12;17</Vertex>
                <Vertex>11;17</Vertex>
            </Vertices>
        </CollisionBox>
        <CollisionBox>
            <Name>GROUND_DETECTOR</Name>
            <Vertices>
                <Vertex>12;11</Vertex>
                <Vertex>13;17</Vertex>
                <Vertex>14;17</Vertex>
            </Vertices>
        </CollisionBox>
    </Body>
</Bodies>

How can I build this data quickly & intuitively?

sentences:
Can I legally modify the Unity splash to fit the game's theme? I've been working on a retro game, and I was wondering whether I could change the Unity logo to make it fit the game's style (eg. pixelating the logo).
I know how to do this, but my question is whether it is illegal, assuming I have a Plus, Pro, or Enterprise licence for Unity that allows me to edit this splash screen at all.

sentences:
Animation clip not working I am working on playing different animation of key press.Below are the animation element attached to my player

Initially run animation is played.I have written code to play "Jump" animation on keypress.

The problem is that when I press the key "Jump" animation will be played,But this animation is played again and again.

I need to play the "Jump" animation only once.Then I need to switch to run animation

Here is the code written

public bool run=false;

void Update () {
    if(Input.GetKey(KeyCode.R))
        {
        run = true;

        }
    if (run == true) {

        GetComponent<Animation>().Play("Jump");
        GetComponent<Animation>().wrapMode = WrapMode.Loop;
    }
}

sentences:
Multi Screen Rendering in Unity My experience with Unity in not that in depth. But I am wondering if it possible in unity to split what is being rendered across multiple screens.

It's hard to explain, so here is an image:

So while the middle screen is fine to render, I want to spread the image all around the player. That is both to the side and, the bottom and top of the player.

Is such a thing possible? Has anyone ever done something similar?

sentences:
Networking SFML Berkley Sockets So I'm starting work on a multi-player space shooter. And I've run into some issues. As I type this, my system is currently:

//Main While Loop
Gather Input
Update Own Sprites Based on Input
Send Position Information to Server. [Owner,Obj#,Image,X,Y,Theta] (TCP)
Receive All Position Information for All Objects From Server
Update Game Screen.

Now I won't end up using this, it's for the initial networking testing phase. I'll probably end up using dead reckoning. However I have a couple questions:

1: I am using TCP for all my networking. However it jumps and skips if you drop any packets at all, so I'd like to switch to UDP and have a numbering mechanism to make sure all packets arrive. Is there a preferred Networking Schema for game communication?

2: For critical things like object hits with bullets Should I implement a second port for these important events, or just use the same UDP proto?

3: (Side Question) How should I regulate my framerate with the networked game? I don't want to have an unnecessary Sleep in each frame...

sentences:
Depth testing before fragment shader Accoring to this, depth testing is usually performed after the fragment shader stage. Why is that? I thought that a fragment is sent with its depth value to the FS, then the depth test happens before the FS executes, so the gpu can avoid a spare FS execution if the pixel is covered by a closer one.

Why is it not like that?

sentences:
Colliding without physics in Unity: is it possible to put OnTriggerEnter in the moving character? My main question is: is it possible to put OnTriggerEnter in a script that goes attached to the moving character instead of to trigger area/object? Let me explain my exact need.

I want to detect the collision between an object called MyCube and another called MyOther, but without MyOther stopping MyCube to go on. It is, MyCube should not be stopped or bounced. It should actually just move on, without any physics reaction. Yes, I know that it can be achieved by using Triggers.

More specifically, I should define MyOther's bounding box as a Trigger and then define MyCube as a kinematic rigidbody. Then, I should add a script to MyOther with a function like, for instance, OnTriggerEnter. However, in my scene I will have thousands of objects like MyOther, i.e. working as triggers, and also all the action to be performed when colliding would be performed on the movign character itself. So I would like to retrieve the collision not trough MyOther, but trough MyCube.

1) I thought that I could put OnTriggerEnter in a script attached to the moving character, but when I do that no collision is recognized. No trigging occurs. Is such a thing possible?

2) Otherwise, is there another way trough which I could achieve what I have described?

sentences: Is it alright to have hundreds of canvas object on screen? I am using html5 to build a game and it is based on Canvas not webGL. I am trying to build sprites from canvas object not from images. Because there will be many sprites on the screen and each of them has different size and moves to different direction I would be using many canvas objects. I wonder if it's OK to put so many canvas objects on the browser screen. Will this make the game very slow?

sentences:
Error(45,74): Identifier 'collision' is not declared in the current scope func _physics_process(delta):
    direction = Vector3(0, 0, 0)
        if Input.is_action_pressed("ui_left"):
            direction.x += 1
        if Input.is_action_pressed("ui_right"):
            direction.x -= 1
        if Input.is_action_pressed("ui_up"):
            direction.z += 1
        if Input.is_action_pressed("ui_down"):
            direction.z -= 1
        direction = direction.normalized()
        direction = direction * speed * delta
        if velocity.y > 0:
            gravaty = -20
        else:
            gravaty = -30

        velocity.y += gravaty * delta
        velocity.x = direction.x
        velocity.z = direction.z

        velocity = move_and_slide(velocity, Vector3(0, 1, 0))

        if is_on_floor() and Input.is_key_pressed(KEY_SPACE):
            velocity.y = 10
        var hitCount = get_slide_count()
        if hitCount > 0:
            var collision = get_slide_collision(0)
        if collision.collider is RigidBody:
            collision.collider.apply_impulse(collison.position, -collision.normal)

sentences:
In PhaserJS, how do I get a clicked Physics.P2 body's data? I have a sprite with Phaser.Physics.P2 enabled, using a custom shape loaded with loadPolygon() from a .json file. I have also activated its debug and debugBody properties, so I can see the custom shape:

How could I collect the shape data information when I click on the debug shape?

For example, if I were to click the head of the sprite, can I get the polygon information from the click event?

sentences:
How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation I wanted to move my character's arms up and down in a straight way.
The Rotation Gizmo tool can do exactely that.
Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked with red arrows in my screenshot), I could move the arms down in a straight way:

I can do the same using the following script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    private Quaternion _Rotation;
    private float _f = 0f;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "+"))
        {
            _f += 1;
            Shoulder.Rotate(_f, 0, 0, Space.World); ;
        }
    }
}

This works perfectly fine, but no longer when I rotate the main model (=the parent of the shoulder).
How could I make this script independend on the main transform's orientation?
Thank you!
Edit:
I would guess that I have to take the main transform (=parent) orientation into account in order to subtract its global rotation from the calculations, but not really knowing which values I should choose, I didn't find the correct formula. However, FYI, I tried the following:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    public Transform Mother;

    private float _f = 0f;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "+"))
        {
            _f += 1;
            _f -= Mother.transform.rotation.eulerAngles.x;
            Shoulder.Rotate(_f, 0, 0, Space.World); ;
        }
    }
}

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:
Adding network support I am trying to implement a simple game "Bulls and cows" in c#.
It is a final project of my university course about design patterns.
The target of the game is simple - try to guess the opponent number.

http://github.com/snoward/BullsAndCows

I try to follow the MVC and dependency injection patterns.
My problem is that I don't know what part of my program should be responsible for network connection. Is this a part of controller work?

I think that the best way is to create a new instance of network controller as server for my game. And then user choose UI to use (console or window). So, network controller must observe user's UI to update game model state.

sentences:
Drawback of using multiple bind flags As far as I understand Direct3D 11 I have to specify certain BindFlags in order to use a resource in a specific stage of the pipeline.

From my experience some combinations are more common like BindFlags.RenderTarget | BindFlags.ShaderResource for post processing effects. And I guess it could also be quite handy sometimes to set the ShaderResource flag for DepthStencilBuffers.

So I would like to know what is happening behind the scenes. What is the drawback of simply setting all of them? Would it be a minor performance hit? Or is as bad as an individual copy of the resource for every different flag?

sentences:
OpenGL: Objects wont draw at certain angles while using lighting(shaders) I was following this tutorial (http://www.lighthouse3d.com/tutorials/glsl-12-tutorial/point-light-per-pixel/) but when the camera is at a certain angle, if I had alpha test and blend enabled the cube i have in the scene wouldn't draw, otherwise they would be black(if alpha and blend was disabled) Any thoughts on what's going on?

here is some relevant code:

glClearColor(0.6, 0.6, 0.6, 1);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(80, (float)window.getSize().x / (float)window.getSize().y, 0.01f, 1000.0);
glMatrixMode(GL_MODELVIEW);

glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_ALPHA_TEST);
//glAlphaFunc(GL_GREATER, 0.1f);

glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
    .....

void Lighting(Camera cam, sf::Vector3f Pos) {
GLfloat amb[] = {0.2, 0.2, 0.2, 1};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);

GLfloat diff[] = { 1, 1, 1, 1 };
GLfloat pos[] = { Pos.x, Pos.y, Pos.z, 1 };
glLightfv(GL_LIGHT0, GL_DIFFUSE, diff);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
}
....
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
cam.up(delta, window);
Lighting(cam, Pos);
sf::Shader::bind(&shader);

cube.draw();
cube1.draw();
window.display();
sf::Shader::bind(NULL);

draw function for cubes:

glPushMatrix();
    glTranslatef(pos.x, pos.y, pos.z);
    glBegin(GL_QUADS);
        glColor3f(color.r / 255, color.g / 255, color.b / 255);

        glVertex3f(0, 0, 0);
        glVertex3f(width, 0, 0);
        glVertex3f(width, height, 0);
        glVertex3f(0, height, 0);

        glVertex3f(width, 0, 0);
        glVertex3f(width, 0, -length);
        glVertex3f(width, height, -length);
        glVertex3f(width, height, 0);

        glVertex3f(0, 0, -length);
        glVertex3f(0, 0, 0);
        glVertex3f(0, height, 0);
        glVertex3f(0, height, -length);

        glVertex3f(width, 0, -length);
        glVertex3f(0, 0, -length);
        glVertex3f(0, height, -length);
        glVertex3f(width, height, -length);

        glVertex3f(width, 0, 0);
        glVertex3f(0, 0, 0);
        glVertex3f(0, 0, -length);
        glVertex3f(width, 0, -length);

        glVertex3f(0, height, 0);
        glVertex3f(width, height, 0);
        glVertex3f(width, height, -length);
        glVertex3f(0, height, -length);
    glEnd();
glPopMatrix();

sentences:
SDL2 jagged/staircase edges I am using SDL2 and SDL2 Image to render png images.

When I rotate the textures, they turn out very ugly, like this:

This is the code responsible for the rotation and alpha mod.

SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = width * currentFrame;
srcRect.y = height * currentRow;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;

SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 10.0, 0, flip);

Do I need to set a blendmode too?

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 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:
Move car at same speed I want to move car on each game play run with same speed. At present I was getting each time different velocity. I want to fix that.

Here is game play area on which I was moving car:

At present I was moving car in infinite motion without any kind of control. When it collide with wall, it will its direction based on collision calculation.

Here is my source code that I was using to move car:

void Start ()
 {
     direction = new Vector2 (Random.Range (-1f, 1f), Random.Range (-1f, 1f));
 }

 void FixedUpdate ()
 {

     float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
     float targetRot = Mathf.LerpAngle (myRigidbody.rotation, (angle - 90f), 0.1f);
     myRigidbody.MoveRotation (targetRot);

     myRigidbody.velocity = direction * speed;
//        myRigidbody.MovePosition (myRigidbody.position + direction * Time.deltaTime * speed);

     Debug.Log("vel mag: " + myRigidbody.velocity.magnitude);
 }

 void OnCollisionEnter2D (Collision2D other)
 {
     ContactPoint2D contact;
     contact = other.contacts [0];

//        direction = 2 * (Vector3.Dot(direction, Vector3.Normalize(contact.normal))) * Vector3.Normalize(contact.normal) - direction; //Following formula  v' = 2 * (v . n) * n - v

//        direction *= -1;// Dont know why I had to multiply by -1 but it's inversed otherwisae
     Vector2 reflectedVelocity = Vector2.Reflect(direction, contact.normal);
     direction = reflectedVelocity;
 }

At present on each run of car, I was getting different velocity that I have checked via debug statement. So my target is to move car with same speed always.

sentences:
Dissolve object starting from the bottom I'm currently getting into using the new "Unity Shader Graph"s and have made an OK dissolve shader that looks like this:

My next goal is to move this effect so the object dissolves bottom-up. This is where I'm stuck. I tried blending this effect with another effect that just fades the object from the bottom up but this does not create the effect I am looking for (#1 is the fade effect, #2 is the two shaders blended together):

The end effect should look something like this:

How can I achieve this effect? Answers do not have to be specific to Unity and a good answer should include the thought-process to creating this effect, not just code or pictures of a shader graph.

sentences:
Python Opengl Procedural Terrain Rendering I am rendering procedural terrain in Python using OpenGL. Once generated, data for each terrain tile is stored in lists. However currently I am only getting around 25fps despite rendering only around 4000 polygons (2 per terrain tile). The model x and z coordinates are stored in the position matrix contained in the terrain_quad_location list where as the heights are stored in the vertices of each terrain tile quad in the terrain_VAO list.
It seems like this low fps is due to inefficiency when render large numbers of models not polygons as when I render models with high polygon counts in addition to this my fps is minimally affected. For reference I am using VAOs, VBOs and EBOs and built upon these tutorials.
Is there a way I can make the code more efficient?
Before Runtime:
count=0
for i in range(terrain_quad_number):

    terrain_VAO[count] = glGenVertexArrays(1)
    glBindVertexArray(terrain_VAO[count])

    terrain_VBO[count] = glGenBuffers(1)
    glBindBuffer(GL_ARRAY_BUFFER, terrain_VBO[count])
    glBufferData(GL_ARRAY_BUFFER, terrain_quad_vertices[count].nbytes, terrain_quad_vertices[count], GL_STATIC_DRAW)

    terrain_EBO[count] = glGenBuffers(1)
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, terrain_EBO[count])
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, terrain_quad_vertices[count].nbytes, quad_indices, GL_STATIC_DRAW)

    glEnableVertexAttribArray(0)
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, terrain_quad_vertices[count].itemsize * 5, ctypes.c_void_p(0))

    glEnableVertexAttribArray(1)
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, terrain_quad_vertices[count].itemsize * 5, ctypes.c_void_p(12))

Runtime:
moo=0
    for i in range (len(rendered_terrain_number)):
        model = terrain_quad_location[rendered_terrain_number[moo]]

        glBindVertexArray(terrain_VAO[rendered_terrain_number[moo]])
        glBindTexture(GL_TEXTURE_2D, ground_textures[int(terrain_quad_sub_biome[int(rendered_terrain_number[moo])][0][0])-1])
        glUniformMatrix4fv(model_loc, 1, GL_FALSE, model)
        glDrawElements(GL_TRIANGLES, len(quad_indices), GL_UNSIGNED_INT, None)
        moo=moo+1

I understand that I may need to lower the number of draw calls which may be done my merging terrain tile models, but how do I do this given I want each tile to have its own texture?
Apparently Minecraft does this by merging every block in a chunk into one VBO but how is this done given every block has a different texture? Instancing would not work either.
Here is a video of the program.

sentences:
What sort of things can cause a whole system to appear to hang for 100s-1000s of milliseconds? I am working on a Windows game and while rendering, some computers will experience intermittent pauses ("hitches" for lack of a better term). When profiled they appear in seemingly random places in the code. Eventually I noticed that it wasn't just my process that was affected, but (seemingly) every process on the system. All of the threads in my application hitch at once. The CPU utilization drops during these hitches and it appears as if most processes make no progress.

This leads me to believe this may be an Operating System or Driver issue, but it only occurs while playing the game (and only on some systems). What sort of operations might the operating system be doing that would require the kernel to pause all user threads and block. Some kind of I/O? At first I thought of paging but my impression is that would only affect a single process, no?

Some systems in use: Windows, DirectX (3d), nVidia cards (unknown if replicates on ATI), using overlapped io for streaming

sentences:
How do I implement group formations in a 3D RTS? I managed to get pathfinding work for a single unit, and I managed to avoid agent-agent collision, but now I need to be able to send a group of agents to some location.

This is my set-up so far:

Waypoint pathfinding
The minimum distance between two nodes is a little bigger than the
biggest bounding sphere radius allowed for an agent.
Agents avoid collisions with other agents by doing some steering behaviour I based on clearpath

So now I need to send my agents somewhere in group. I have read some posts saying that some way to do it is to create a group leader and give the other units offsets to his position.

But then the problem is, what if the group formation cannot be achieved?
e.g. you want to form a rectangle, but at the target position there is a structure nearby which prevents you from creating a rectangle setup.

sentences:
Very large terrains in Unreal-4 I was watching some YouTube tutorials on making terrains in UE4 and in each one they mention that the larger the terrain the worse the performance gets.
I was wondering what you would do if you wanted to create a map like in skyrim or WOW. Is the terrain made of one massive terrain or is it made up out of a series of terrains in a grid? And is there any optimisation that you can do or is it all handled by UE4?

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

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

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

sentences:
How to record gameplay on WP7? I need to record my wp7 game gameplay like on Hot Apps from channel 9 http://channel9.msdn.com/Shows/Hot-Apps/Hot-Apps-Minesweeper-Cheezia-Interior-Design-Talking-Alien-Zombie-Squish.

My current game is written on Silverlight, but I will have XNA games latter as well, so I need some solution which will work for both technologies. If there any free software? If yes is there any way to record video from real device, not emulator?

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:
Midpoint Algorithm - Error C++ I am currently finding an issue with my midpoint algorithm,  I have been given a formula to work out the midpoint algorithm, but it seems to not correctly orbit. The aim is to get a more accurate version of the EulerMethod to create an more approximate orbit across all frame times.  As the EulerMethod will cause a bit of an inaccurate orbit based on different frame-rates.

1st use Euler’s method to approximate half - way position / velocity :
position after half frame = current position +
half frame time * current velocity
velocity after half frame = current velocity +
half frame time * current acceleration

Calculate forces at half - way position to get half - way acceleration
Then use Euler’s method again with updated info :
position next frame = current position + frame time * halfway velocity
velocity next frame = current velocity + frame time * halfway acceleration

The method causes the 2nd sphere to move diagonally infinitely to the bottom right.

The Algorithm

void midpointmethod(CVector3& position, CVector3& velocity, CVector3& centre, float updateTime)
{
    CVector3 accel = OrbitAcceleration(position, Length(velocity), centre);
    //position = position + updateTime / 2 * velocity * updateTime;
    //velocity = velocity * updateTime / 2 * accel.Length() * updateTime;

    CVector3 halfpos = position + (updateTime / 2) * velocity;
    CVector3 halfveloc = velocity + (updateTime / 2) * accel;

    // calculate forces ?
    CVector3 halfwayaccel = accel / 2;

    CVector3 posnexf = position + updateTime * halfveloc;
    CVector3 velosnexf = velocity + updateTime * halfwayaccel;

    position = posnexf;
    velocity = velosnexf;

}

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:
Rotating towards a point in Box2D I'm using Box2d as my physics engine and I'm trying to solve what would normally be a simple problem but what has become a nightmare for me and preventing me from finishing my app. (6 months work)

I've tried implementing this: (Example of implementation below)
http://box2d.org/forum/viewtopic.php?f=18&t=7306 but it's got three problems.
1: When reaching the top angle it stops and goes the other way. (Example in logs)
2: Limited speed, some objects need turn fast.
3: Large objects with moving joints spaz out rocking all over the place.

I have a desired angle and I want my body to rotate at different speeds (depending on turn speed setting as I want large slow turn objects).

Problems with current code.
1: Large object with a moving joint either spin very fast or rock constantly.
2: The rock effect exists on everything.

Edit
This is within a game loop, so have access to delta.

Code 1: Box2D attempt:

//Testing speed.
float tempSpeed = MathUtils.PI;

float currentAngle = getBody().getAngle() % MathUtils.PI2;

float nextAngle = getBody().getAngle() + (getBody().getAngularVelocity() * update);
float totalRotation = getDesiredAngle() - nextAngle;

//Assuming this tries to prevent the switch angle problem but limits the speed??
while ( totalRotation < -MathUtils.PI * tempSpeed ) totalRotation += MathUtils.PI2 * tempSpeed;
while ( totalRotation >  MathUtils.PI * tempSpeed ) totalRotation -= MathUtils.PI2 * tempSpeed;

float desiredAngularVelocity = totalRotation;
float change = 1f * tempSpeed; //allow 1 degree rotation per time step
desiredAngularVelocity = Math.min(change, Math.max(-change, desiredAngularVelocity));
float impulse = getBody().getInertia() * desiredAngularVelocity;
getBody().applyAngularImpulse(impulse, true);

//Below shows an example of the top angle being switched.
if(getFocus()){
    Functions.log("currentAngle: " + getBody().getAngle() + " | nextAngle: " + nextAngle + " | totalRotation: " + totalRotation + " | desiredAngularVelocity: " + desiredAngularVelocity);
}
/*
Log: nextAngle: -0.1850999 | totalRotation: 6.400846 | desiredAngularVelocity: 3.1415927
Log: nextAngle: -0.02812685 | totalRotation: 6.2195992 | desiredAngularVelocity: 3.1415927

Example of top angle being reached and switching back.

Log: nextAngle: 0.21522963 | totalRotation: 5.948592 | desiredAngularVelocity: 3.1415927
Log: nextAngle: 0.45278195 | totalRotation: 5.6859627 | desiredAngularVelocity: 3.1415927
 */

Code 2: My warped attempt

//Keep the angle within range.
float currentAngle = getBody().getAngle() % 6.283185f;

//Get the next angle. Use angle in next time step
float nextAngle = currentAngle + (getBody().getAngularVelocity() * update);

float totalRotationAngle = getDesiredAngle() - nextAngle;

//Keep the total rotation within range, so we don't spin all the way around when reaching the other side.

while (totalRotationAngle < -MathUtils.PI) {
    totalRotationAngle += (MathUtils.PI2);
}
while (totalRotationAngle > MathUtils.PI) {
    totalRotationAngle -= (MathUtils.PI2);
}

//Do some other stuff.
float desiredAngularVelocity = totalRotationAngle * getRotationSpeed();

//Inertia is the amount of force required to rotate the object, without it it rotates really fast.
//If we introduce it, we get more realistic results but the horrible rock.
//float torque = (getBody().getInertia() * (desiredAngularVelocity * this.turnSpeed)) * update;

//Need inertia otherwise it can spins things right out the way.

//float turnSpeed = (this.turnSpeed * (4f * (getDesiredAngle())));

float torque = (desiredAngularVelocity * (this.turnSpeed));
torque *= (getBody().getInertia());
torque *= update;

//Apply torque.
getBody().applyTorque(torque, false);

sentences:
FBX model for 2d sprite charachter I was following along the unity platformer tutorial. https://www.youtube.com/watch?v=9WhZ1svdC3Q It is great. After looking the animation I found that there was a fbx model for 2d sprite character. I just want to ask can you use 3d animation like motion capture animation once you rig a character using bone for 2d(fbx model). I search but unable to find any good tutorial of how to create fbx model for 2d character and creating maps for these 2d character.

I am really confused. Thank you so much for helping.

sentences:
App name containing spaces? My new app is ready to publish but I have big dilema: will space characters in title hurt my game in search engines (google, google play, itunes)? There are two teams in the game called 'MAD' and 'MED' teams. Until now I used 'MADorMED', because I wanted to create a new and unique title which was never used before. But I found google play search doesnt find the app if a user searches for 'mad or med'. Plus if I search google 'mad or med', it doest find my domain madormed.com either.

Is it better to use spaces? Will the engines find it better?

It is also a thing to consider some users will swap words and look for 'med or mad'.

I personally dont like the version with spaces, as it is not a unique name, and it is made of very common word. I afraid 'mad' and 'med' words are so common words my app will be lost among other popular titles.

But if its a logical move I will rename it and use spaces.

I'm very grateful for any advice.

Thanks, Mate

sentences:
Unity: Vertical Input will not return negative values I am trying to make a 'single stick' shooter, where the character faces the direction they are moving, but I'm struggling to get the movement working correctly; no matter what I've tried, the player won't move down.
Through some investigation, the issue seems to be that hitting the s key does not return a negative Vertical axis value, and I don't know enough about the workings of the Input manager to understand why.
Here's the code, to check I haven't made a glaring mistake there:
public void FixedUpdate()
{
   Controls();
}

...

public void Controls() {

 if (gameStateManager.gameState == SingleStickShooter) {

    // Variables
    float xInput = Input.GetAxis($"{controller} Horizontal");
    float yInput = Input.GetAxis($"{controller} Vertical");

    Vector2 controlThrow = new Vector2(xInput, yInput);
    print("Control Throw: " + controlThrow.x + " , " + controlThrow.y);

    currentSpeed = runSpeed;

    // Movement

    Vector2 playerVelocity = controlThrow * currentSpeed;
    rigidbody.velocity = playerVelocity;

    print("Velocity: " + rigidbody.velocity.x + " , " + rigidbody.velocity.y);

      // Rotation

      float angle = Mathf.Atan2(yInput, xInput) * Mathf.Rad2Deg;
      if (xInput != 0f || yInput != 0f)
         transform.rotation = Quaternion.Euler(0f, 0f, angle);

I would love to go tinkering around in the Input Manager and learn through mistakes, but it's a collaborative project where other games using this system are working, so I don't want to risk breaking something by going in blind. Also, those games are successfully using the down key, but mine isn't which makes me think it's something else I'm too green to realise.
This is my first question so I don't know what else I should add, so let me know what other context you need and I'll add what I can.
EDIT: Below I've added the debugging info Ben Johnson requested. Console output returns over 1000 values due to being called in Update(); the section shown is specifically when I go from pressing right and up to right and down.

Gravity value for input manager is the only thing I can see that's different, but changing it doesn't seem to fix my problem. I thought that obviously having the vertical axis set to the Y-axis would be obvious too, but that also didn't help so I reverted to the one above it.

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:
Entity component system - game progression I'm quite new to game development (but not to programming) and I'm trying to figure out what would be the best way to handle inter-world communication. What I mean is this:

I've been reading about entity component systems (ECS) and how people suggest using different worlds/spaces (http://gamedevelopment.tutsplus.com/tutorials/spaces-useful-game-object-containers--gamedev-14091) for a subsection of a game. For example a HUD, inventory or combat/movement each get a seperate world/space (because they have different graphics and underlying logic.

However, I was wondering how the inventory, or the HUD knows about the health of a player when the health is handled by a different space/world, for example when in combat?

This also applies to game progression in general, for example dialog with NPC (a dialog would be a separate space since it's a popup screen) but how would you convey the choices made in (or the state of) the dialog to other spaces/worlds. Or basically any other type of event that influence the game progression in different spaces/worlds (health, mana, quests, dialog, combat, inventory, hud, etc)

How would one handle this kind of design? Does it need a (in implementation) singleton object that holds all this kind of information? That would be weird because then the components need to convey each change to this singleton object which feels like doing things twice (going against the main DRY of programming)...

I'm kind of at a loss here in terms of design, any pointers?

---EDIT---

So I've read a few other posts suggested by comments and got a general idea about possibilities, however each of them seems to have one major downside which makes them just not right. It's is very possible that I'm overseeing details that would solve these downsides so feel free to correct me. I'll try to give an overview as well as some answers to some questions.

I'm seeing three major options to 'share' data between spaces. Even though most posts are about sharing data between systems, I feel like the same can be applied to sharing data between systems.

1. Querying

Example: If the HUD world needs to know the current health of the player it can query another world and ask for the current health.

Downside: Worlds need to know about each other which is a major dependency issue and goes against decoupling.

2: Direct messaging (sync and async)

Example: If during combat the health of a player changes it can send messages (sync and async, whatever is needed) to other worlds that need to know about this change.

Downside: Still the decoupling issue: worlds need to know about eachother.

3: Indirect messaging (sync and async) <-- best option

Example: If during combat the health of a player changes it can send messages (sync and async, whatever is needed) to general message hub. Other worlds/systems that need to know about this change are subscribed to the particular message channel and read the messages.

Upside: Completely decoupled, easily manageable and extendable.

Downside/unclear: When does the message channel know that the messages need to be deleted? Or maybe the system that is subscribed marks (only for itself) the message as read and waits for new messages -> messagebox becomes enormous after a while. How do worlds/systems handle order? For example during a frame: if the HUD already polled the health message and after that the health changes, the next frame the HUD gets updated. For some applications this might not be the right way.

Q: A single game object can exists in multiple spaces

I'm using Artemis ECS framework which comes with build-in spaces (called worlds). Each entity (and with it, the data in the form of components) is created on a world and thus cannot be shared between worlds.

sentences: How can I implement a scrolling text ticker? How can I implement a right-to-left scrolling text ticker in libGDX (like stock tickers)?

sentences:
Rendering differences between ps_1_3 and ps_2_a I am trying to update a shader from ps_1_3 inline assembly to ps_2_a HLSL. However the HLSL shader causes things to render differently when using ps_2_a. When using my HLSL conversion with ps_1_3 it works same way as with the inline assembly.
Original assembly
Sampler[0] = (DiffuseMapSampler);
pixelShader = asm
{
    ps_1_3
    tex t0
#ifdef _POINTLIGHT_
    add r0.rgb, v0, v0
    +mov r0.a, v0.a
    mul_x4 r0, t0, r0
#else
    mul_x4 r0, t0, v0
#endif
#if defined(OVERGROWTH) && HASALPHA2MASK
    mul_x2 r0.a, r0.a, t0.a
#endif
};

Sampler and VS_OUTPUT
struct VS_OUTPUT
{
    float4 Pos  : POSITION0;
    float2 Tex0 : TEXCOORD0;
#if _HASSHADOW_
    float4 TexShadow    : TEXCOORD1;
#endif
    float4 Color  : COLOR0;
    float Fog   : FOG;
};

texture DiffuseMap;
sampler DiffuseMapSampler = sampler_state
{
    Texture = (DiffuseMap);
    MipFilter = LINEAR;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
    AddressU  = WRAP;
    AddressV  = WRAP;
    MipMapLodBias = 0;
};

My HLSL translation
float4 basicPixelShaderNoShadow(VS_OUTPUT VsOut) : COLOR
{
    float4 diffuseMap = tex2D(DiffuseMapSampler, VsOut.Tex0);
    float4 outCol;
#ifdef _POINTLIGHT_
    outCol.rgb = VsOut.Color.rgb + VsOut.Color.rgb;
    outCol.a = VsOut.Color.a;
    outCol = (diffuseMap * outCol) * 4;
#else
    outCol = (diffuseMap * VsOut.Color) * 4;
#endif

#if defined(OVERGROWTH) && HASALPHA2MASK
    outCol.a = (outCol.a * diffuseMap.a) * 2;
#endif
    return outCol;
}

And this is the result in game

For some reason when using ps_2_a the colours are oversaturated.
Edit:
HLSL that fixed the issue:
float4 vertexColor = float4(VsOut.Color.rgb, VsOut.Color.a*2);
float4 diffuseMap = tex2D(DiffuseMapSampler, VsOut.Tex0);

float4 outCol = diffuseMap * vertexColor * 2;

#if defined(OVERGROWTH) && HASALPHA2MASK
outCol.a *= 2 * diffuseMap.a;
#endif

return outCol;

dont quite understand why, but it works :)

sentences:
Dragging a Rigidbody2D without passing through obstacles I have this body of code written for an object that needs to be an obstacle and another object that is draggable.  I have colliders on both and a kinematic rigidbody on the draggable object, but the obstacle is still allowing the dragged object to be dragged through it.  This is all 2d.  I'm not sure what I'm doing wrong.

The part that I'm confused on is this - when you just add a collider to the obstacle sprite and a collider and rigidbody (all 2d) to the draggable sprite, if I don't add the script above, then the draggable sprite falls due to gravity on top of the obstacle and stop there, it doesn't fall through the obstacle sprite.  However when I add the above script which has the OnMouseDrag function, and I move the draggable sprite around because now I can, it falls through the sprite.

With no script the obstacle acts like an obstacle.  With this script the it does not.

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

public class Block : MonoBehaviour
{
    public GameObject Four_Object1;
    //public GameObject clone_Four_Object1;
    //private Vector3 screenPoint;
    //private Vector3 offset;
    private Rigidbody2D rb2d;
    private Vector3 screenPoint;
    private Vector3 offset;
    private Vector3 cursorPosition;

    public void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        GetComponent<Rigidbody2D>().isKinematic = true;
    }

    public void OnMouseDown()
    {
        screenPoint = Camera.main.WorldToScreenPoint(Four_Object1.transform.position);

        offset = Four_Object1.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    }

    public void OnMouseDrag()
    {

        Vector3 cursorScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        cursorPosition = Camera.main.ScreenToWorldPoint(cursorScreenPoint) + offset;
        transform.position = cursorPosition;
    }

    public void FixedUpdate()
    {
        rb2d.MovePosition(cursorPosition);
        Debug.Log("Update!");
    }

}

sentences:
How 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:
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:
Issue with interpolation on a burn shader (lerp and smoothstep) I'm trying to create a simple burn shader. See here for more info on the method I'm using. However, I don't get why replacing the smoothstep with a lerp results in completely different results. Am I missing something from my knowledge of maths? As far as I know they should return similar values given the same parameters.

// clips materials, using an image as guidance.
// use clouds or random noise as the slice guide for best results.
Shader "Custom/Dissolving" {
Properties {
  _MainTex ("Texture (RGB)", 2D) = "white" {}
  _BorderTex ("Border Texture (RGBA)", 2D) = "white" {}

  _EdgeColor ("Edge Color", Color) = (1,0,0)
  _EdgeSize ("Edge Size", float) = 0.1

  _SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
  _SliceAmount ("Slice Amount", Range(0.0, 1)) = 0.2

  [MaterialToggle] UseClipInstruction ("Use Clip Instruction", Float) = 0
}
SubShader {
  Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  //Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

  CGPROGRAM
  //if you're not planning on using shadows, remove "addshadow" for better performance
  #pragma surface surf Lambert alpha addshadow

  struct Input {
      float2 uv_MainTex : TEXCOORD0;
      float2 uv_SliceGuide : TEXCOORD1;
      float _SliceAmount;
  };

  sampler2D _MainTex;
  sampler2D _BorderTex;
  sampler2D _SliceGuide;
  half _SliceAmount;
  half _EdgeSize;
  half3 _EdgeColor;

  void surf (Input IN, inout SurfaceOutput o) {
    o.Alpha=1;

    //Green is a good color for estimating grayscale values
    half fragSliceValue = tex2D(_SliceGuide, IN.uv_SliceGuide).g;

    #ifdef UseClipInstruction
    clip(fragSliceValue - _SliceAmount);
    #else
    //TODO: look for an alternative to this
    if (fragSliceValue - _SliceAmount<0)
        o.Alpha=0;
    #endif

    half rampX = smoothstep(_SliceAmount,_SliceAmount + _EdgeSize, fragSliceValue);
    half3 ramp = tex2D(_BorderTex,half2( rampX,0) ) * _EdgeColor.rgb;
    o.Emission = ramp * (1-rampX);

    o.Albedo = tex2D(_MainTex,IN.uv_MainTex);
  }
  ENDCG
}
Fallback "Diffuse"
}

Left is the result of smoothstep (the provided code), right is what happens when I replace smooth with lerp.

sentences:
Entity System and "composite" entities I'm new to the Entity Component System pattern and there's something I cannot figure out. Let's say I have the following entity:

Player: {
    Components: [
        Position: {
            x: 0,
            y: 0
        },
        Health: {
            max: 100,
            current: 50
        },
        Sprites: { ... }
    }
}

When I render an entity that has a Health component I also would like to render a health bar above that entity. Do I treat the health bar as a new entity and attach it to the Player i.e., the Player becomes a composite of entities; or it [the Health bar] should be part of the Health component, in which case how would it be rendered / created?

To illustrate what I'm trying to say:

Player: {
    ChildEntities: [
        Character: {
            Components: [
                Position: { x:parent.x, y:parent.y },
                Sprites: { parent... }
            ]
        },
        HealthBar: {
            Components: [
                Position: { x:parent.x, y:parent.y },
                Health: { max:parent.max, current:parent.current }
            ]
        }
    ],
    Components: [
        Position: {
            x: 0,
            y: 0
        },
        Health: {
            max: 100,
            current: 50
        }
    }
}

Is there an idiomatic / preferred way of doing this? Thanks.

sentences:
How do you stop an Ogre PSSM shader from creating unwanted or blocky shadows due to large 'world size' I'm using PSSM Shadows in Ogre 1.6.4 and I have a scene which is around 100m square.

I also create a flat ground texture which does not cast shadows and extends off towards the horizon, but when I do this, and the Sun light source goes towards the horizon at dawn or dusk, then I get extra shadows at the edges of some of my objects. It's like some kind of self shadowing.

I'm using custom shaders, but the Ogre PlayPen PSSM shader also goes beserk in this environment too.

I've read that the world size can affect texture shadow mapping.

Is there a technique to allow this ground area to exist (ie my world to be big) without affecting my PSSM shadowing?

(btw - my derived light direction is correctly normalized!)

sentences:
How should renderer class relate to the class it renders? I am working on making a Pong clone as a practice project. I have a PongState class with members like Ball, Paddle, Board and Score. I want to structure my code so that each object doesn't have to know how to render itself, but a PaddleRenderer class will. I also want to create a PongStateRenderer class, which may use other classes like PaddleRenderer, as well.

How should I let PongStateRenderer know about the internals of PongState so that it can render it? The Ball object in PongState know's it's own position and size, does that mean Ball has to be a public member variable so that PongStateRenderer can also know the position, or is there a better way to do this without totally breaking encapsulation? Perhaps my architecture is totally wrong, and I should use a different method?

I'm working in C# as it says in the tag but a general answer that applies to many languages could also be helpful.

sentences:
Unity Make sprite visible only to shaders I have made a shader for my UI buttons, the sprites should be black and white, so they can be used as a mask when blending. They should allow for the image behind them to pass through the whiter pixels and be blocked by the darker ones.

I want to use this effect for my menu, have a black background and a colored one (like a gradient or a pattern), let the colored one pass only through the buttons and the black one everywhere else.

My shader does just that, but with one problem. I can't hide the colored background from the camera. If I change it's layer it is useless (I guess because it is the child of a canvas), and if I use a regular sprite (non UI) it is just ignored by the camera and the buttons don't pick up the color.

How can I achieve this effect, having the sprite be invisible to the camera but visible to the shaders of the buttons.

sentences:
How do 2D art assets (eg. sprites) work? I have an idea on a game and planning on developing a 2D game using XNA for Windows Phone 7.

I've started off today by free hand drawing some concept art of what I want some of the characters to looks like.  Now the problem is taking those concepts and putting them in digital form.

The first thing I realized I really don't know the different parts of game art.  I know there are sprites, textures and animation but that is about it.  I think textures are sprites on a 3D object but not sure if that is correct?  Here are some general questions about game art I have:

Do you use textures in 2D games?
Where do you apply the different parts of game art?  For example when you use sprites vs animation.
What are the difference between sprites, textures animation and other art?
Are sprites, textures and animation the only art elements to a game?
Is all 2D art in games considered sprites?  Characters, background, etc.
What size do you make your sprite sheets and each character in a sprite sheet?
Any good books or tutorials on teaching to draw art from a digital prospective?  I was thinking about getting "GIMP Bible", however most books like this teach more photo editing than digital drawing.

My objective is learn how to take my concept art(backgrounds and characters) and put them into digital form using Gimp and learning about the different parts of game art.

Anyway, thanks to anyone that can help.

sentences:
Java : 2D Sidescroller Terrain Okay so After all this Edits here is the main question. How I can generate Terrain with a 2d Simplex Noise Algorithm, I am deletng old info so the post its more readble. I´ve been doing some tests and here are my results so far. Any help is appreciated. Any Ideas why my code isnt working?

I am far from getting a good result, Here is an Image, I am using The Simplex Noise genrator Timothy oferred to me (thanks :D)

And Heres is the Code:

public void GenerateChunk(float offsetX, int amplitude, long seed)
{

    // Its += 16 Because each block is 16 pixels
    for(int x = 0; x < CHUNK_SIZE * CHUNK_SIZE; x += 16)
    {
            PerlinNoise.genGrad(seed);
            float height = (float) PerlinNoise.noise(x, 0);
            System.out.print(height);

            for(int y = 0; y < height * 16; y += 16){

                try {

                    Block B = new Block(Material.DIRT, x, y + 400, new Image("res/Dirt.png"));
                    Blocks.add(B);
                    B.setVisible(true);

                } catch (SlickException e) {

                    e.printStackTrace();

                }

            }

     }
}

Here its where I call it

world.getChunk(0, 0).GenerateChunk(4, 12, 1231233876); // 12312 etc is a test number for the seed.

Finally here is the example output (height value)

0.0-0.3244323-0.4746854-0.6980603-0.212961030.437604370.0-0.013018643-0.3333134-0.49871972-0.498743-0.226263150.43900093-0.305881470.026026215-0.341923240.0-0.3244323-0.4746854-0.6980603-0.212961030.437604370.0-0.013018643-0.3333134-0.49871972-0.498743-0.226263150.43900093-0.305881470.026026215-0.34192324

sentences:
2D Lock x Axis on character I am creating an endless runner with a flying character.

I want to lock any movement in the x axis so that the character object can only move up and down but still move forward through the scene. I have looked into freezing axes and joints, but this stops the forward movement.

Is it possible to edit the below to lock the x axis for character movement only, or is there a setting where i can apply this?

using UnityEngine;
using System.Collections;

public class moveupdown : MonoBehaviour {
    public Vector2 velocity;
    public float uservelocity;
    public Rigidbody2D rb2D;

    void Start() {
        rb2D = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate() {

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved) {
            Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;

            rb2D.MovePosition (rb2D.position + touchDeltaPosition * Time.fixedDeltaTime / uservelocity);

        }
    }
}

sentences:
Make game for iPhone only From the beginning of development on my game I was hoping to release it as a universal app, but the gameplay simply doesn't work as well on the iPad. Also, it was designed to work on the iPhone screen, and the (even slight) difference in width to height ratio gives iPhone users an advantage over iPad users by seeing more of the path ahead. Not to mention it doesn't look quite right on the larger screen.

Hypothetically, if my game becomes a top seller, would it be a bad idea to have it only an iPhone app? Would it make it far less likely for my app to become viral? My app would still work on the iPad like any other iPhone app, and I plan on eventually releasing an update that supports both iPad and iPhone.

sentences:
Using a script to draw an icon next to (i.e. inline with) a text label in Unity Suppose mystring is a string variable (whose value changes over time) and that myIcon is a texture or sprite of known dimension, say 32x32.

Is it possible to write a Unity script that draws myIcon alongside myStringlike this example (where myString is "TURTLE" in this case):

In particular, I have the following challenges:

I would like the whole construction (icon + string) to be horizontally centered on the screen).
The spacing between the icon and the text should be some fixed number of pixels.
Since the pixel width of the string changes when the value of the string changes, the appropriate horizontal positioning of the icon and the text will also change and can't be easily calculated in advance.

So, my question is: how can I draw and center such a GUI element using a Unity script?

The obvious way to do this would be to have myIcon inline in the text label, but I read that this isn't possible with unity's current GUI implementation.

It also looked like this might be possible using a horizontal layout group, but I couldn't find a clear guide on how to implement that in a script.

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:
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:
Unity: When attaching my custom camera script camera shakes when player starts to move fast Here is my player code.

Rigidbody rb;

Vector3 currMovement;
public float jumpSpeed = 10;
public float moveSpeed = 10;
public float rotSpeed = 180;

float distToGround;

public float posSmoothTime = 0.5f;
float currPos;
float targetPos;
float posVel;

public float rotSmoothTime = 0.5f;
float currRot;
float targetRot;
float rotVel;

void Start()
{
    rb = GetComponent<Rigidbody>();
    distToGround = GetComponent<Collider>().bounds.extents.y;
}

bool isGrounded() { return Physics.Raycast(transform.position, Vector3.down, distToGround + 0.1f); }

void Update()
{
    Move();
}

void Move()
{
    // Rotation smoothing.
    targetRot = Input.GetAxisRaw("Horizontal") * rotSpeed * Time.smoothDeltaTime;

    if (targetRot > 360)
        targetRot -= 360;
    if (targetRot < 0)
        targetRot += 360;
    currRot = Mathf.SmoothDampAngle(currRot, targetRot, ref rotVel, rotSmoothTime * Time.smoothDeltaTime);

    transform.eulerAngles += new Vector3(0, currRot, 0);

    // Movement smoothing.
    targetPos = Input.GetAxisRaw("Vertical") * moveSpeed;

    currPos = Mathf.SmoothDamp(currPos, targetPos, ref posVel, posSmoothTime * Time.smoothDeltaTime);
    currMovement = new Vector3(0, 0, currPos);
    currMovement = transform.rotation * currMovement;

    if (isGrounded())
    {
        if (Input.GetButtonDown("Jump"))
            rb.velocity += Vector3.up * jumpSpeed;
    }

    rb.position += currMovement * Time.smoothDeltaTime;
}

I have a Rigidbody attached to my player. I think the problem is with my camera script. Here is my camera script.

public Transform player;
Quaternion targetLook;
Vector3 targetMove;
public float smoothLook = 0.5f;
public float smoothMove = 0.5f;
public float distFromPlayer = 5, heightFromPlayer = 3;
Vector3 moveVel;

void LateUpdate()
{
    CameraMove();
}

void CameraMove()
{
    targetMove = player.position + (player.rotation * new Vector3(0, heightFromPlayer, -distFromPlayer));
    transform.position = Vector3.SmoothDamp(transform.position, targetMove, ref moveVel, smoothMove);

    targetLook = Quaternion.LookRotation(player.position - transform.position);
    transform.rotation = Quaternion.Slerp(transform.rotation, targetLook, smoothLook);
}

}

The player is not an parent of my camera. When I parent the player to my camera the shake stops. But I want a custom smooth camera movement with my custom scirpt, so I can't make the player a parent of the camera.

sentences:
how to join the body of snake in 2D snake game i'm making a snake game in javaScript from scratch. The problem is that the snake looks disjoint(see image). How can I connect the body(rectangles) of the snake?

here is the code of drawing snake:

    paintSnake(margin) {
    //draws the body of the snake
    this.snake.forEach((egg) => {
      //console.log(egg)
      const isSnakeHead = egg.cellX === this.headCellX && egg.cellY === this.headCellY
      if (!isSnakeHead) {
        this.ctx.fillStyle = "#9ef739"
        this.ctx.fillRect(egg.cellX * this.cellSize + margin,
          egg.cellY * this.cellSize + margin,
          this.cellSize - 2 * margin,
          this.cellSize - 2 * margin)
      }
    })
    //snake head
    // this.ctx.beginPath()
    // this.ctx.lineWidth = 4
    // this.ctx.strokeStyle = "red"
    // this.ctx.rect(this.headCellX * this.cellSize + margin, this.headCellY * this.cellSize + margin, this.cellSize - 2 * margin, this.cellSize - 2 * margin)
    // this.ctx.stroke()
    let head =
    {
      X: this.headCellX * this.cellSize + margin,
      Y: this.headCellY * this.cellSize + margin,
      width: this.cellSize,
      height: this.cellSize
    }

    const args = [head.X,
    head.Y,
    head.height,
    head.width]
    //draw the head of the snake
    if (this.direction === "up") {
      this.ctx.drawImage(
        snakeHeadUpImg,
        ...args)
    }
    else if (this.direction === "down") {
      this.ctx.drawImage(
        snakeHeadDownImg,
        ...args)
    }
    else if (this.direction === "right") {
      this.ctx.drawImage(
        snakeHeadRightImg,
        ...args)
    }
    else if (this.direction === "left") {
      this.ctx.drawImage(
        snakeHeadLeftImg,
        ...args)
    }
  }
}

to see the whole code go to: https://github.com/hackasaur/snake-game/blob/master/main.js

i know that the rectangles(body parts) need to be extended in the direction of the next rectangle but how can i achieve this?

sentences:
Change alpha value of the Standard Shader I want to edit the Standard shader provided by Unity in order to change the alpha value of a fragment (pixel) according to given parameters I pass to the shader.

For now, thanks to this link, I have been able to :

Retrieve the standard shader,
Retrieve a custom Core.cginc I included in the DEFERRED pass of the custom shader,
Create a custom Editor script to handle the Shader and my custom parameters,
Selecte Fade as the rendering mode of the shader to handle transparency, using the custom editor script,
Create a custom file replacing UnityStandardInput.cginc and changed the references in the Core.cginc file.

But now, I can't seem to figure where to change the alpha value of the fragment. I've tried a ton of possibilities in the Core.cginc file. Changing the color and the map of the Albedo works, but I can't find where the final alpha value is set.

I've browsed the files in the CGIncludes folder in the builtin shaders of Unity.

UnityStandardCore.cginc : Already tried many possibilities (including the returned value of Alpha declared in UnityStandardInput.cginc
CustomInput.cginc : Alpha function, no effect

Since the files are huge, I don't feel it will be useful to copy-paste them here.

Thanks for your help in advance.

sentences:
Why can't i change the background color in Phaser? what is wrong with my code? i'm using game.stage.backgroundColor but the screen remains black.

main.js:

var demo = demo || {};

demo.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '');

demo.game.state.add('state1', demo.state1);
demo.game.state.add('state2', demo.state2);

demo.game.state.start('state1');

state1.js:

var demo = demo || {};

demo.state1 = function() {};

demo.state1.prototype = {
    preload: function() {

    },
    create: function() {
        game.stage.backgroundColor = "#4488AA";
    },
    update: function() {

    }
};

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:
Questions regarding games architecture with XNA So I've finally got around to playing around with XNA and have been toying around with making a 2D game (I have a bunch of art assets from a friend who developed it on iOS)

A lot of things seem to be easy to do and come out of the box however I'm left stumped for a bunch of stuff since most of the literature (the books I bought for instance) don't pay too much attention to 2D.

I'd really appreciate any clarification or being pointed to more information on the following questins:

What is the point of a Game Service?
I understand the whole idiom of registering an object as a service so that any other GameComponent can grab it, however how does this beat out simply making it perhaps public or static?
For instance, my book recommended registering the SpriteBatch object in the Game.cs class. I'm not sure how this is preferrable to simply making it public/static since there should only be one instance of Game anyways (singleton)?
I'm confused on when I should inherit from GameComponent or RenderableGameComponent.
I'm trying to follow a Manager/Controller design, such that all entities are created/owned by a single manager and the same for other things. I currently have each Manager/Controller inherit from GameComponent, however how does this beat out having the Game object own all the Managers and manually call update on them and draw ?
I noticed that Initialize is called before ContentLoad(), I found this annoying since in my Initialize is where I'd like to create some of my entities (i.e. Sprite, Player etc..), however I can't give them their loaded SpriteSheets or Textures since the call to load them hasn't occurred yet.
Am I perhaps initializing incorrectly or do people just assign the texture further down in ContentLoad?

Those seem to be my biggest "WTF" of not really understanding

sentences:
Animation works, but Unity doesn't realize it I have an animation which plays once, and it played once just fine.  I want to Invoke a method as soon as the animation finishes.  I have been researching and experimenting for over an hour now, but without the result I want.  I try to get the animation from the Animator, but Unity says my animation is not attached.  The thing is, I don't care if it's attached...I just want to know how long it is, not actually do anything with it.  How can I achieve this?  Here is the code which results in the error:

CODE:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(PolygonCollider2D))]
[RequireComponent(typeof(Animator))]
public class Construction : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Invoke("EnableObstacleState", GetComponent<Animator>().animation.clip.length);
    }

    private void EnableObstacleState()
    {
        GetComponent<PolygonCollider2D>().enabled = true;
    }
}

ERROR:

MissingComponentException: There is no 'Animation' attached to the "Barricade(Clone)" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Barricade(Clone)". Or your script needs to check if the component is attached before using it.
Construction.Start () (at Assets/Scripts/Construction.cs:11)

sentences:
Unity: How to create a selection box around gameObjects (Text or images) similar to those in Unity editor? In my Unity app, the user has the option to input text and import images. I have implemented these using TMP_Input Field and Image/Sprites respectively. The app also requires that the user knows the currently selected text/image and can also drag these text and images and sometimes resize them.
To achieve this what I need is a UI like this.

This is the actual Unity editor. But I want to have similar box around my text and images in my app. So that the user knows the current selection and may also drag the text/Image or resize it using the blue circles in the corners.
I am not sure how I can achieve this. One way which I see is to have views which wrap my text and images and these views will have these boxes as the backgrounds.
But I thought that there may be an easier way to do this, probably something that comes with Unity since this looks like a general requirement to me. I am not sure though. What would be the best way to achieve this? WIll I have to do everything from scratch or are there any existing UI components or assets which can make this easier? Any suggestions are appreciated. Thanks!

sentences:
What's the best way of transforming a 2D vector into the closest 8-way compass direction? If you have a 2D vector expressed as x and y, what's a good way of transforming that into the closest compass direction?

e.g.

x:+1,  y:+1 => NE
x:0,   y:+3 => N
x:+10, y:-2 => E   // closest compass direction

sentences: Unity: stop/play only background music I have a music sound clip simply drag-n-dropped to my hierarchy. I also have other sound effects in my game. I want to pause/play background music on button press but only music, not all sound effects. How can I reach this music GameObject in C# code?

sentences:
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:
What's the better approach, running multiple server-builds on one instance or running one server-build and managing matches in different rooms? We are building a racing multiplayer game using Mirror and Unity and we've been able to successfully run the authoritative server on AWS-Gamelift and Playfab so far.
Both providers are with the flexibility of running multiple server-builds and mapping with different ports.
So I think running multiple server-build for different matches on one instance is a bit expensive in terms of server usage as compared to running one server and managing multiple matches in different rooms.
But overall it seems to be a safer option to go with since build crash and similar issues will only happen on one match and other matches (servers) will be running fine on the same machine and also it's a bit easier to handle and scale.
What's your opinion on this?
It might be useful if you share any blog or resource to look at for scaling and managing servers on gamelift/playfab.
thanks!

sentences:
How can I split my terrain into quads so that each quad would have a renderable vertex/index buffer? (DirectX11, C++) I am creating a quad tree to store my terrain in chunks and currently have the implementation working to an extent.

I am currently starting with a grid of triangle pairs that make squares and splitting this down into quads. I have my vertices split into quads, but I'm struggling with the indices.

Here is how I generate the plane

snip

This gives me one list of indices, and one list of vertices. This is taken by the quadtree and split into different vertex lists and stored in different nodes. This works fine and the vertices seem to be correct, however I'm not sure how to create the indices for each vertex list as before I was doing it based on the height and width of the whole terrain. How would I create an indices list for each node in the quadtree or is there a better way to do this?

If I just use the whole list of indices for each node, I get weird results

Edit: There is an issue generating my plane, I am fixing this and seeing if it resolves my problem.

Edit: I have edited the topic title to something more suitable.

I have fixed my issue with the grid generation and I am using a smaller grid to make the issues more clear. I am using a 2x2 grid (9 verts, 24 indices, 8 tris) which is split into 4 quads (4 verts per quad, 2 tris per quad) and it's almost working, just a small issue with one of the sides.

I know this is potentially duplicating verts on a small scale, but on a larger scale with culling, this should actually save performance. Can anyone spot what's going on? Vertex issue? When splitting the quads, should it be by triangle, vertices, or indices? What happens if we split by triangle and a triangle overlaps 2 quads (although  this shouldn't happen)

sentences:
SAT collision detection and stacking objects I'm working on a small game for Android which deals with some simple physics, including the need to stack objects on top of one another without jitter. This infamous "stacking collisions" issue with custom collision/physics engines really has me on the ropes with this project.

To highlight the issue I'm gonna go through a basic rundown of my gameloop and the order in which this engine computes the various steps. For example, lets say we have 3 objects in this scene. 2 boxes and a ground floor. The update loop is as follows:

Apply external and internal forces to each object (including gravity, any movement from input, etc.).
Use a collision tree to separate the various game objects into potential collision pairs (this is working just fine).
Run a collision detection algorithm on each pair to get a contact manifold for each collision that occurs this frame. My project is using SAT and its been working very well.
Sort the list of contact manifolds to order collisions by time of occurance.
Loop through the ordered manifolds and solve each collision as necessary.
Update each object's position in the world with the results of the collision correction and render.

When dealing with one pair of objects in isolation, this works great. But when you add a 3rd object to the simulation and stack them on top of each other the resulting simultaneous collisions result in visible jitter as the objects are pushed in and out of each other due to the many manifolds they have to deal with.
In my example the static ground remains stationary but the bottom box jitters in and out of the ground slightly as the top box pushes down on it due to gravity. Adding an iteration loop around steps 3, 4 and 5 helps stabilize the objects since they rerun the collision checks and get more accurate values, but to make the collisions perfectly stable I need a very high number of iterations (exponential amounts the larger the stack of objects), which kills the framerate of the game.

I'm not looking for any complete code, but some theories on how this stacking issue should be avoided would be fantastic. I'm just unsure where to take this logic-wise anymore, but I feel like anyone taking the custom physics engine route has probably seen similar issues.

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:
How to draw lines round selected objects and lights? I need two things to draw in Modern OpenGL.

Please see the image:

Draw lines to represent light's position and direction
Draw xyz axises at the origin of a selected objects

How do I draw these? should I use fragment shader or what?

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:
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:
OpenGL - How can I make the edges of this textured circle smoother? I'm building a game and I've applied a certain texture (RAW file) to a circle (GL_POLYGON) in OpenGL. It loads correctly, with the right size and all, but the edges seem a bit jagged and I would prefer them smooth (without any evidence of a polygon being underneath).

GLuint loadTex(int wrap){
GLuint texture;
int width, height;
BYTE * data;
FILE * file;

file = fopen( "tex.raw", "rb" );
if (file == NULL){
    std::cerr << "O ficheiro da textura não foi encontrado" << std::endl;
    return 0;
}

width = 128;
height = 128;
data = (BYTE*)malloc( width * height * 3 );//Alocação do buffer

fread( data, width * height * 3, 1, file );//Ler dados da textura
fclose( file );

glGenTextures( 1, &texture );//Nome da textura
glBindTexture( GL_TEXTURE_2D, texture );//Selecção da textura actual
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );//Parâmetros da Textura
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP );
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data );

free(data);

return texture;
}

void drawCircle(float cx, float cy, float r, float aspectRatio){

GLuint t = loadTex(1);
float angle, radian, x, y, tx, ty, xcos, ysin;

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t);

glBegin(GL_POLYGON);

for (angle=0.0; angle<360.0; angle+=2.0){
    radian = angle * (M_PI/180.0f);

    xcos = (float)cos(radian);
    ysin = (float)sin(radian);
    x = xcos * r  + cx;
    y = ysin * r*aspectRatio + cy;
    tx = xcos * 0.5 + 0.5;
    ty = ysin * 0.5 + 0.5;

    glTexCoord2f(tx, ty);
    glVertex2f(x, y);
}

glEnd();
glDisable(GL_TEXTURE_2D);
}

Is this a problem from my texture file? Or is it from my code? I apply Line Smoothing before drawing anything (and it is being applied correctly in my lines I believe)

sentences:
Recent mainstream games written in pure C? not C++ what was/is the point? Recent meaning the current decade. I had found this post
https://gamedev.stackexchange.com/a/15403/6544
wasnt c++ adopted as the industry standard quite some time back.
In what sort of situation does it make sense to go with games written in pure c on established consoles/pc/os

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:
drawing meshes so that they respect the position in space (doesn't draw on top of another mesh if behind it) How can i make my meshes be drawn taking in account which one is in from of another? i.e. if i have a mesh that is farder than another it should be drawn behind the second.

Is there a way to do this in xna that is more standardized or do i have to calculate for each mesh myself? If i have to calculate for each mesh by myself, from which point do i calculate the distance to the mesh? the camera position?

Here is how i draw them :

        Matrix[] transforms = new Matrix[gameobject.model.Bones.Count];
        gameobject.model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in gameobject.model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.Projection = camera.projectionMatrix;
                effect.View = camera.viewMatrix;
                effect.World = transforms[mesh.ParentBone.Index] * gameobject.orientation;
           }
            mesh.Draw();
        }

sentences:
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 to rotate the camera to point to a specified location? I have a quaternion based camera class (which controls a view matrix) and would like a function to rotate the camera to face a specified point. The best approach I can come up with is that I rotate the camera on the plane of the two vector by the angle between them.

Any advice?

sentences:
Why is my alpha transparency not working correctly in Unity? In Unity I have never seen a bug quite as weird as this one.

As usual, I import my texture with a transparent background and then check the alpha is transparency box and apply it, and everything seemed okay. It had worked like it usually does and made the background of my texture transparent. When I apply it to an object or even just paint it onto the terrain it shows the original texture, but in the areas where there should be nothing it replaces it with some nightmarish plaid hell.

I have tried other transparent textures but that doesn't seem to work either same result but for each different picture there is a different pattern and color of plaid. I really would appreciate any help I can get on this because I'm just stumped.

sentences:
Game Loop delay the right way and game speed I am a newbie game developer. I am trying to find a right way to create my game loop.

Consider following example.
Simple Android Game
I have a game with a simple gameplay - bouncing ball.

I want to have a control of the ball speed.
Also I want my game to have the same framerate (framespeed) on all devices.

Where the speed logic should be implemented ? In my case I have simple ball object with a velocity vector. I can change the velocity vector properties in order to make my ball move faster or slower, am I right ?
The Main Loop. I have read a lot of about this part of a game. I found this article http://gameprogrammingpatterns.com/game-loop.html . And decided to use this code example

    double previous = getCurrentTime();
    double lag = 0.0;
    while (true)
    {
    double current = getCurrentTime();
    double elapsed = current - previous;
    previous = current;
    lag += elapsed;

    processInput();

    while (lag >= MS_PER_UPDATE)
    {
    update();
    lag -= MS_PER_UPDATE;
    }
   render();
   }

I have a lot of questions about this example.

I have the similar loop in my game.

 @Override
        public void run() {
            while (mIsRunning) {
                processGameInput();
                updateGameState();
                drawGame();
            }
        }

I cannot understand while update(); is called while waiting for a constant delay ? Why not the render method ?
Maybe I am missing something.

Here is how my update for the ball looks like.

   public void updatePosition() {
        mCenterX += mVector.x;
        mCenterY += mVector.y;
    }

As you could see, each time I increase the position of the ball by the value of the velocity vector.

But as can guess, in case of using the example from the article, the update method will be called for instance 100 times. And the render method only once per 100 update method calls.
So in this case I guess, I the ball will be changing its position lagging.

My goal is to control the speed of the ball, for example from 0.1s - 2s.

How can achieve this ?

Please help to understand this topic. Any help would be highly appreciated.

sentences:
Materials aren't loading correctly from SketchUp into Unity I imported a SketchUp COLLADA (.dae) file from 2017 SketchUp Make, and imported it into Unity. I then clicked "Use External Materials" and the colors began to load. But I noticed quickly that one of the wings of my imported B-29 was Dark Gray, while the other way a proper color. Random parts, such as the front engine housing piece, were also dark gray. Parts of my advanced dials were also dark gray, and I immediately decided that there is now ay that I am going to manually go in and fix every single dark-gray material, but at the moment, I found no alternative.
I began with the wing. I went to assign the material that I used for the other wing, which was white, to the dark gray wing, but I found out that the other wing already had that material in use. And when I went to assign a different white color, absolutely nothing changed, aside from the fact that the wing now claimed that it had that color in use. Is there a fix for this problem? I could try importing as a .SKP file, if the reason for the issue is something to do with the COLLADA (.dae) file.
What I had was 2 wings. they were both components in SketchUp, so whatever I did to one applied to the other, Then I made them unique before importing to Unity. The Wing that won't work right is the one wing that had the USAF Insignia on it. But I doubt this is the problem, because all engines on that wing were also not colored correctly, whereas the other wing was fine. Those engines were also components, but were also made unique before the import.
Each wing has 9 groups inside of it. The other wing is identical in this sense. I imported the file from file explorer by dragging the file from file explorer and dropping it into unity.
This is what the plane looks like in Unity:

My apologies for the crude handwriting, it is difficult to draw with a touchpad.
In the image, I numbered the incorrectly-colored parts visible in the image (Right/Left references are perspective to image)
1. Left Wing. Color: Dark gray. Color intended: White.
2. Propeller blade hub. This is the part that all propeller blades are connected to. Both hubs on the two propellers on the Left Wing are colored incorrectly. Color: white. Color Intended: Grey.
3. Pistons. All piston components, such as the pistons, securing poles, and piston heads are not colored correctly; same on the other engine on the Left Wing. Color: White. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
4. Cowl Flaps. In the image, this appears to be a stripe in the engine. Same with the other cowl flaps on the other engine on the Left Wing. Color: Dark gray. Color Intended: White.
5. Propeller blades. All 4 propeller blades on both engines on the left wing are not colored correctly. Color: White. Color Intended: Black, with yellow tips.
6. Right-Wing Pistons. Most piston components, such as the pistons heads and securing poles are not colored correctly. Same with the other engine on the Right Wing. Color: White Piston Heads, Grey Pistons, Almost-Black Gray in the lines on the pistons, white securing poles. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
7. Front Engine Casing. The same error is in the other engine's front engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.
8. Rear Engine Casing. The same error is in the other engine's rear engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.

sentences:
How are minimaps rendered for open worlds? When I've created minimaps for smaller to medium levels before I would use a large texture mapped to a plane for the minimap and world map. The minimap/world map camera would then view this texture from a top down view.

For larger, open world style environments though I'm facing a performance vs fidelity issue. For example, a large environment requires a large texture to fit everything in, but at the same time the texture also needs to be a high enough resolution for when the player decides to zoom in onto a specific point in the map. I can make the map high resolution with enough detail up close but this creates quite a large texture size. Or I can make a lower res map which is more efficient but it becomes blurry/pixelated when zooming in.

Is this just a balance that I have to play with, or is there a better way to handle this? For example, creating a simple 3d mesh whose shape would act as the map. Or instead of using a texture using a vector graphic. How is this usually done?

sentences: I.T. degree for game programming? I am a 19 year old who has always been interested in video & computer games. I developed the interested for game programming about three months ago and started researching on the profession. The only degrees always suggested on the internet and in books are those of computer science, physics, mathematics, & game development. BSc Information Technology has been my major for the past two years; and even though my university teaches we the I.T. students computer programming (in c++, c#, java) and offers us the opportunity to undertake some computer science courses of our choice in addition to the regular I.T. courses, I am feeling insecure about my prospects in getting into the profession. My question is: Will a game development company hire me if I exhibit good math, physics and game programming skills with an I.T. degree? If NO, will I have to obtain an MSc in a much more related course.

sentences:
When connecting a physics engine to another engine, should you do all your logic in the units used by the physics side or the rendering side I'm currently intergrating pygame and pyBox2D, and am wondering which side is best to try to keep to in terms of game units of size.

Box2D is Meters

PyGame is Pixels

At the moment I am thinking I will keep everything on the box2D side where it makes sense, and then just use a scaling method to turn those numbers into pixel locations. But sometimes I will want to detect something in pixels (mouse location) and have this relate back to the location in the Meters side. Obviously I can use the reverse scaling to get that point, but I was wondering if there are any tips about this?

In order to make the scale easier, I have aligned the box2d world horizonal 0+ and vertical 0+ to match the location of pygame, which takes top left as 0,0 . First attempt I was doing something crazy with 0,0 being in the middle of my pygame world. Seems no reason not to calibrate the Box2D world to match the pygame rendering one to some degree.

Any thoughts or tips?

sentences:
Is the new windows 8 sdk usable with visual c++ express 2010 on windows 7? This is inspired by and related to Is the June 2010 DX SDK really the latest? asked recently but it's a different question.

I won't likely be purchasing the full visual studio 2012 for C++, I intend to use the free visual c++ express 2012 that targets desktop applications when it is released so for now I'm using visual c++ express 2010 running on windows 7.

The latest directx11 sdk is the one included in the windows 8 SDK now, it's not a separate release any more.

So my question is, can I use the windows 8 SDK to build directx11 programs that work on windows 7 using visual studio express 2010 running on windows 7. Or do I need to stick to the final DirectX SDK release for now?

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:
Attack vs Defence and who is the winner? I am in the process of creating a new simple game in mobile and I've spent several days on the following part.
For simplicity, let's say that I have two fighters. The only attribute of them is Attack and Defence. When the first attacks, the only thing that matters is the attack of him and the defence of the opponent. And vice versa.
They don't have equipment, items, stamina or health. Just Attack vs Defence.
Example:

Fighter 1:
Attack:50, Defence: 35

Fighter 2:
Attack 20, Defence: 80

The fighting process will be just a single attack which will determine the winner. So, no multiple attacks or rounds. I don't want to make it deterministic, but add a light version of unexpected. A fighter with lower attack will be able to win another fighter with higher defence (but of course not every time)
My first idea was to make it linear and call a uniform random number generator.
If Random() < att1 / (att1 + def2) {
    winner = fighter1
} else {
    winner = fighter2
}

Example with attack 50 and defence 80, the attacking fighter will have about 38% to win. However, it seems to me that the unexpected is too far and worst fighters will win a lot.
I was wondering how you have worked on similar situations.
P.S. I searched a lot in this QnA and other sources and I found similar questions mentioned as too broad for SE. But those have had many attributes, weapons, items, classes etc that could make it too complicated. I think my version is far simpler to fit it in the QnA style of the SE.

sentences:
How do I ensure that perspective and orthographic projection matricies show objects at the same size on the screen? I am working on a 3d scene editor and would like to show the scene in orthographic projection. My current problem is that I am not sure how to calculate the orthographic projection matrix such that the objects do not appear at a completely different size on the screen.

I currently have the following 2 functions for calculating the camera projection matrix.

Matrix4.createPerspective = function(fov, aspect, near, far, result) {
    if (typeof result === 'undefined') {
        result = new Matrix4();
    }

    var ymax = near * Math.tan(fov * Math.PI / 360);
    var ymin = - ymax;
    var xmin = ymin * aspect;
    var xmax = ymax * aspect;

    Matrix4.createFrustum(xmin, xmax, ymin, ymax, near, far, /*out*/ result);

    return result;
};

Matrix4.createOrthographic = function(left, right, top, bottom, near, far, result) {
    if (typeof result === 'undefined') {
        result = new Matrix4();
    }

    var re = result.elements;
    var w = right - left;
    var h = top - bottom;
    var p = far - near;

    var x = ( right + left ) / w;
    var y = ( top + bottom ) / h;
    var z = ( far + near ) / p;

    re[0] =2/w;  re[4] = 0;   re[8]  = 0;   re[12] =-x;
    re[1] = 0;   re[5] =2/h;  re[9]  = 0;   re[13] =-y;
    re[2] = 0;   re[6] = 0;   re[10] =-2/p; re[14] =-z;
    re[3] = 0;   re[7] = 0;   re[11] = 0;   re[15] = 1;

    return result;
};

And this is how they are being used:

    updateProjectionMatrix: function(entity) {
        var camera = entity.getComponent('Camera');
        if (camera.isDirty()) {
            camera.aspect = camera.width / camera.height;
            if (camera.isOrthographic()){
                Matrix4.createOrthographic(
                    0,
                    camera.width,
                    0,
                    camera.height,
                    camera.near,
                    camera.far,
            /*out*/ camera._projectionMatrix);
            } else {
                Matrix4.createPerspective(
                    camera.fov,
                    camera.aspect,
                    camera.near,
                    camera.far,
            /*out*/ camera._projectionMatrix);
            }
        }
    },

Here is an example of what I am trying to accomplish inside Blender (F5 toggles between Ortho and Perspective). Note that both cubes appear to be about the same size on the viewports:

sentences:
Determine user mouse selection of 3D Object for multiple viewports I am currently working on setting up some world objects for my level editor and am running into a bit of a snag. When I get the hit location from the mouse raycast, I would like to determine what part of the object that the user has hit. I am looking for something that would work for each viewport in my map editor.

I would like to use hit detection change the color of an object when the user mouses over it. For instance, if the user mouses over the x axis (red arrow) it would turn from red to white. It doesn’t have to be pixel perfect but I would like to find a single solution that would work in all viewports.

I was thinking that after I get the hit location, I could transform the hit location to match the inverse of the rotation of the camera and perform the checks from there. I'm skeptical that solution will work though.

sentences:
Unity: add InputTracking to my script I'm new to unity and 3D world developement so I'm following Unity's tutorial for beginners right here. And I'm in the section with title "Camera Nodes" where they gave me a c# script to attach it to the camera object.
I did attach it to the camera but the problem with the script when I debug it I get an error of undefined class:

The name 'InputTracking' does not exist in this context

And this is the script:

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

public class UpdateEyeAnchors : MonoBehaviour {

    GameObject[] eyes = new GameObject[2];
    string[] eyeAnchorNames = { "LeftEyeAnchor", "RightEyeAnchor" };

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        for (int i = 0; i < 2; ++i)
        {
            // If the eye anchor is no longer a child of us, don't use it
            if (eyes[i] != null && eyes[i].transform.parent != transform)
            {
                eyes[i] = null;
            }

            // If we don't have an eye anchor, try to find one or create one
            if (eyes[i] == null)
            {
                Transform t = transform.Find(eyeAnchorNames[i]);
                if (t)
                    eyes[i] = t.gameObject;

                if (eyes[i] == null)
                {
                    eyes[i] = new GameObject(eyeAnchorNames[i]);
                    eyes[i].transform.parent = gameObject.transform;
                }
            }

            // Update the eye transform
            eyes[i].transform.localPosition = InputTracking.GetLocalPosition((VRNode)i);//--the error is this line
            eyes[i].transform.localRotation = InputTracking.GetLocalRotation((VRNode)i);//--and this one
        }
    }
}

This is the link of the class InputTracking in Unity's API, but I don't know how to add it to my script :)
Thanks in advance.

sentences:
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:
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:
Simple Game Feasibility: Unity + Turbo Squid + $0 =? I've been coding 2D games exclusively for a while, partly because I have very limited graphics skills, partly because it takes less effort to make something look great, and partly because I have very limited time in which to code.

I have an idea for a very simple 3d kids game that I'd like to build; it would be based around a player roaming a randomly-generated city and looking for a particular building (eg. dollar store, grocery store, bank, etc.)

My question is: Would it be feasible to build this in Unity, using only free models and animation (presumably from Turbo Squid), in a decent time-frame?

In terms of features, this would range in extremes from "generate some random buildings, paths, and select one as the winning building to locate" to adding people to talk to, objects to interact with (water, ladders, keys and locks, ropes, etc.)

I haven't touched 3D modelling for years (I used 3D Studio Max 3.x back in high school), and I don't have 3-4 hours to spend creating, rigging, and animating models. That's really the crux of my doubt. I also don't have cash that I can spend on models/animation.

So to summarize, my main two questions are:

Is it feasible to create a decent-quality game using free stuff from Turbo Squid?
Are many/most/all of the models from TS compatible with Unity?

sentences:
Same image in both eyes of VR HMD results in wrong 3D effect I am trying to mod in VR support for a game without VR support via OpenVR as it proved to be the easiest one to implement with the least amount of issues, i don't think my issue is related to OpenVR but i am just asking for help.
The code i use for rendering the images to the HMD can be found below, i use ReShade for now as a base that has all DirectX functions hooked already so i can test things more easily.
_backbuffer variable is just a regular ID3D11Texture2D buffer received from the swap chain by using _swapchain->GetBuffer function.
vr::Texture_t leftEyeTexture = { _backbuffer.get(), vr::TextureType_DirectX, vr::ColorSpace_Auto };
vr::EVRCompositorError error1 = vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture);

vr::Texture_t rightEyeTexture = { _backbuffer.get(), vr::TextureType_DirectX, vr::ColorSpace_Auto };
vr::EVRCompositorError error2 = vr::VRCompositor()->Submit(vr::Eye_Right, &rightEyeTexture);

if (error1)
{
std::cout << "[TF2VR] [ERROR] IInterfaces::IVR texture error: " << error1 << std::endl;
}

if (error2)
{
std::cout << "[TF2VR] [ERROR] IInterfaces::IVR texture error: " << error2 << std::endl;
}

So does anyone have any ideas on how do i solve this problem, some things i can think of are settings custom texture bounds with vr::VRTextureBounds_t in vr::VRCompositor()->Submit or/and settings vr::EVRSubmitFlags in the same function.
Normally you would just create two cameras, set their respective render targets, get their textures and use vr::VRCompositor()->Submit to render each frame independently, but i can't figure a way to do it in my case so i just submit same back buffer to both eyes.
Also, i have concerns that if i keep doing it that way and somehow fix the double-image effect the depth effect won't work properly (Although i hope i can fix that by applying some ReShade effects as i am using it as a framework)
And before someone will offer Depth3D effect for ReShade, i obviously tried that before, all it does in my case is just renders image 4 times instead of 2 (I tried tweaking parameters for that shader but with no success), it almost works without any effects in ReShade so i think i just have to tweak it on DirectX/OpenVR level, not with a custom shader.

sentences:
how to render small texture on another texture? can anybody help me to render small texture on another texture.
i.e
I have one background image, when user touches on the screen it should draw small(circle or any object) on it.

can anybody suggest me good tutorial to starts with it?

sentences: How to get a texture from current point of view in OpenGL 2.0 ES? Probably the title is confusing, but I didn't know how to ask better, sorry about that. What I would like to do is get a bitmap texture that represents exactly what's rendered at one point in time and save it as a file (I know how to save it, I need only to find out how get the bitmap data form OpenGL) Like a screen shoot, sort of.

sentences:
How do you make small icons look good? I am running into an issue with my UI.
Basically I need to have a lot of small icons, similar to many other games, here is an example:

With Mip maps:

As you can see, these look awful. This is simply a UI Image with size 15x15, it seems when they get too small it simply does not look good. It has nothing to do with import options or anti-aliasing, I have tried everything there. I submitted it as a bug but according to Unity it simply will not look good when images are scaled down too much.I have tried both PNG with large resolutions and small, I have exported the .SVG vector image and tried using that, all look bad when scaled down.
So what are my options then when I need small icons? How do other games do it?
Here is a link to the actual .png file: https://ibb.co/nDG0hmD
For reference, here are the same icons zoomed in, as you can see, they look fine:

Im developing for PC.

sentences:
Using DLL's for a cross-platform Unity Game Just a quick theoretical question so I don't hit a landmine further down development. In my current project, I have quite a lot of dll's that I made myself for use in Unity. If I were to develop for Android, would these dll's still function or is there another library format that Unity prefers to use? Basically, I'm looking for a rundown of all the ways you have to import libraries into Unity for use on a specific platform. For example,

1.) .dll files. Can you use them on other platforms?

2.) If not, how would I have to recompile code to allow me to access it the same way I currently do on a different plaform?

sentences:
Is there an application that converts a PC into a video game kiosk/arcade machine? Sorry to make the question so vague.

What I ultimately want is software that allows people to play independent video games on a PC and not have to worry about maintaining it.

Imagine a game that was made in a few hours that does not have a restart button and crashes often. It should be able to handle these kinds of things and do more!

The software should:

allow the game to be restarted manually
handle game crashes (likely by restarting the game)
restrict the user from doing anything crazy

later...

offer a UI to select the game from a list
handle pre-configured key bindings
cross-platform (start with windows)

I just want to know if this exists already before I start creating one. As of now AutoHotKey is being used to do this sloppily.

If such software does not exist then perhaps someone could recommend a general open source Kiosk software? Open Kiosk? I'll take anything.

(I also could not find a related tag. Not even sure if this question should be here rather than stackoverflow)

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:
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 do mobile games implement time gates unhackably? Is it possible in offline games? I'm thinking about porting my game to Google Play, and it would be free to play with time gates which are skippable if you watch an ad.

What are the ways of implementing an unhackable time gating?

Is it possible without internet connection? If yes, how?
If no, is there a way to implement it without custom backend, using Google Play's services?

Or should I care about this at all? Because...

It doesn't affect other players...
Most of the audience couldn't do it anyway, and if the game stays small, hacks couldn't really spread.
Then maybe I should just let them hack those time gates, it's a marginal revenue loss.

What do you think?

sentences:
In Unity, Meta Files are Tracked but Behaviours Fall Off My team is working on a Unity game, and we are using a mercurial repository on BitBucket. Whenever we update, all of the behaviours 'fall off' of state machines, behaviours, etc. When searching for a solution, I discovered that this information was stored in the meta files. I had previously ignored the meta files, but the are now being tracked. However, the files still 'fall off'. I cannot find any other reason this would be happening.

Any assistance you can give me would be appriciated. Let me know if you need any additional details.

sentences:
How do I check for collision between transparent textures? I am creating a 2D game using OpenGL.
For sprites, I use textured quads (actually two triangles).
The texures contain transparent pixels, since objects are not always perfectly rectangular.

How do I do collision detection on the objects, not the quads?
I was thinking to first check the quads for collision and if they match, check the textures.

But how can I check if two non-transparent pixels are on top of each other (or next to each other) for the two objects?

Or is there a completely different way of how this is done best?

sentences:
What is the Basic Game Screen/Scene Life Cycle? Question

What is the standard or basic game screen/scene life cycle used in most games?

What is Screen/Scene?

The term screen or scene refers to the current displayed entity holder where game entities or objects are placed. I personally call it scene because the term screen for me is the hardware screen, but I have read that others call it screen as denoted by Screen Manager classes (I call it Scene Manager).

Understanding Scene Management and Game Scene Life Cycle

Here is my current understanding of a simple scene management and game scene life cycle:

Assuming, we have 4 screens/scenes in a basic game:

Splash Scene - used to display the company logo, the game logo and loading of most of the game resources used by the menu scene and loading scene.
Menu Scene - used to display menus and buttons, referred to as the "main menu" and the gateway to other scenes especially the game scene (sometimes there are settings scene, help scene and about scene).
Loading Scene - used to display a progress bar or anything related that indicates the loading and unloading of the game scene.
Game Scene - used to display the game logic and implementation of the game itself.

  start application ---(load splash scene contents)---> splash scene ---(load menu scene and loading scene contents and unload splash
  scene contents)---> menu scene ("start game" pressed) --->
  loading scene ---(load game scene contents)---> game scene ("return to main menu" pressed) ---> loading scene ---(unload
  game scene contents)---> menu scene

Start Application
Load Splash Scene Contents
Show Splash Scene
Load Menu Scene and Loading Scene Contents
Hide Splash Scene
Show Menu Scene
Unload Splash Scene Contents
"Start Game" Button Pressed
Hide Menu Scene
Show Loading Scene
Load Game Scene Contents
Hide Loading Scene
Show Game Scene
THE GAME IMPLEMENTATION
"Return to Main Menu" Button Pressed
Hide Game Scene
Show Loading Scene
Unload Game Scene Contents
Hide Loading Scene
Show Menu Scene

Is this the right way to do it in most cases? I know that the screen/scene life cycle varies depending on the game you are creating. I just want to know if this is the right way to do it or am I doing things the wrong way?

sentences:
How can I edit multiple sprites in Sprite Editor at once? I have 100 sprites in one atlas. I want to edit some of them with same values.

For example, I want to edit sprite's position no 1 ~ 30. Do I have to edit them one by one?

Is there any function like Shift + drag for selecting several sprites?

sentences:
Can’t Load .fbx from blender to Monogame correctly I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is this one of the correct ways to convert it properly ?).

After watching this video https://www.youtube.com/watch?v=u7tLYMPC828 I saw that you have to convert the .fbx file that you create using blender, to a new .fbx file, using a tool called fbx converter 2013, and then use that file in the pipeline.exe tool, to produce the final .xnb file. Without doing that, I can't even see my model when drawn on the screen.

With the steps I described above, I managed to see the .xnb file on my screen but it was not exactly the original model I had made. For example:

As you can see the real model I got (after the convertion with the fbx converter 2013)  is much longer, whereas the one on the left (the one I draw in my game), is like packed in a small square.

If you are using blender, please let me know how do you import the .fbx to your Monogame project. (Or you can suggest to me another software you are using to make models and tell me your method of importing models to Monogame)

This is how I am drawing my model:

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

    Vector3 modelPosition = new Vector3(-25, 0, 0);
    float modelRotation = 0;
    float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in Brick.Meshes)
    {
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 50.0f);
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = Matrix.CreateRotationZ(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);
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Edit: I also tried exporting to .X from blender and when i converted to .xnb, loaded the model and drew it, nothing shows up.

sentences: How to handling touchpad? I have a touchpad.  I tried touchpad.getKnobX> 0 and <0 (when swiping the knob left and right) the sprite still displayed but when I put touchpad.getKnobY> 0 and <0 (to swipe knob up and down) the sprite didn't show.  Why is that?

sentences:
How to change render states only when necessary? Earlier, I have been setting render states (shaders, shader resources, etc.) without checking if it is really necessary. Maybe they had been bound earlier and I could use them without setting them again.

So now I am checking for currently set render state before setting it. If there is a mismatch, then I set it. Setting a pixel shader for example:

typedef ID3D11DeviceContext*        DeviceContext;
typedef ID3D11PixelShader*          PixelShader;

inline static void BindPS(PixelShader shader, DeviceContext context){
    if(context!=nullptr){
        PixelShader s;
        context->PSGetShader(&s,nullptr,0);
        if(s!=shader)
            context->PSSetShader(shader, nullptr, 0);
        if(s!=nullptr)
            s->Release();
    }
}

I wonder if it is a welcome practice to get current render state from the device context context so often, or should I roll my own solution for checking them? Keeping pointers for currently bound states for example and checking with those?

I ask this now, because I only started implementing this for some states (PSSetshader and PSSetShaderresources), and I have a lot more, so I would opt-out early if this method could be problematic.

sentences: What roles are important when staffing up a mobile studio? For a new studio that will be focusing on social, mobile platform games. What are roles do we need to fill and how many of each role would be ideal?

sentences:
Fanmade game copyright? Possible Duplicate:
  Legal issues for a “fangame” of a commercial franchise?

What if I decide to make a fanmade game from a popular, recent game release?

100% non-profit. I will just post my game in a forum.
Graphic work is 100% mine.
I DO have some sounds from the original game. I have credited the developers.
The game's title might include the original game's title, but I do have other unique words in it.

Is that possible?

sentences:
iPhone GLSL shader dynamic branching issue I am trying to pass an array of vec3 as uniform and then iterate through them on each pixel. The size of array varies on situations so I can't make the loop with constant number of iterations.

Here is the code:

precision highp float;
precision highp int;

varying vec4 v_fragmentColor;

varying vec4 v_pos;

uniform int u_numberOfParticles;

const int numberOfAccumsToCapture = 3;
const float threshold = 0.15;
const float gooCoeff = 1.19;

uniform mat4 u_MVPMatrix;
uniform vec3 u_waterVertices[100];

void main()
{
    vec4 finalColor = vec4(0.0, 0.0, 0.0, 0.0);

    vec2 currPos = v_pos.xy;

    float accum = 0.0;
    vec3 normal = vec3(0, 0, 0);

    for ( int i = 0; i < u_numberOfParticles; ++i )
    {
        vec2 dir2 = u_waterVertices[i].xy - currPos.xy;
        vec3 dir3 = vec3(dir2, 0.1);
        float q = dot(dir2, dir2);

        accum += u_waterVertices[i].z / q;
    }

    float normalizeToEdge = 1.0 - (accum - threshold) / 2.0;

    if (normalizeToEdge < 0.4)
        finalColor = vec4( 0.1, normalizeToEdge + 0.5, 0.9-normalizeToEdge*0.4, 1.0);

    if ( normalizeToEdge < 0.2 )
    {
        finalColor = vec4( 120.0/255.0, 245.0/255.0, 245.0/255.0, 1.0);
        float shade = mix( 0.7, 1.0, normal.x);
        finalColor *= shade;
    }

    gl_FragColor = vec4(finalColor);
}

The problem is here:

for ( int i = 0; i < u_numberOfParticles; ++i )
{
    vec2 dir2 = u_waterVertices[i].xy - currPos.xy;
    vec3 dir3 = vec3(dir2, 0.1);
    float q = dot(dir2, dir2);

    accum += u_waterVertices[i].z / q;
}

When I make the for-loop like this

for ( int i = 0; i < 2; ++i )
{
    //...
}

I get double the framerate even though u_numberOfParticles is also 2

Making it like this

for ( int i = 0; i < 100; ++i )
{
    if (i == u_numberOfParticles)
        break;
    //...
}

gives no improvement.

The only way I know to cope with this situation is to create multiple shaders. But The size of array may vary from 1 to 40 and making 40 different shaders just because of the for-loop is stupid. Any help or ideas how to deal with this situation ?

sentences:
Improving the look of a character with solid parts inside a translucent jello exterior So my problem is a bit hard to explain. I have a character made out of a jello shell, with an internal skeleton. So let me introduce you to ma boi "Chonker McJello"

The problem is, that I want a rich green slightly transparent jello, without loosing too much details and "whiteness" on the internal skeleton. If I turn the transparency or saturation of the jello down, the jello looks ugly, if I put the jello as I want, the Skeleton looses too much details/turns green. I have thought of different approaches, but do not really know how to achieve the effect I want.

Single sided emission:
Is there a way to make the jello glow internally and light the skeleton up? The emission should only come from the backfaces.

Doing something with the render layers, like rendering the skeleton with transparency on top of the jello again, to make it appear "less affected" by it's color

Everything I have in mind sounds easy but is propably pretty complicated and I don't have a lot of experience with shadergraphs and unity's hdrp. If you have any idea how to achieve the desired effect (maybe not in the way I thought) I would really appreciate your help!
Thanks a lot!

sentences:
OpenGL never reverts to default FrameBuffer So I'm trying to change the texture using FBOs, When I run it, The whole game gets drawn in the new FBO that I created then deleted, Here's the function
public void ChangeTextureBuffer(int width, int height, ByteBuffer newBuffer) {
    int frameID = glGenFramebuffers();
    glBindFramebuffer(GL_FRAMEBUFFER_BINDING, frameID);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ID, 0);
    glViewport(0, 0, width, height);

    Texture texture = new Texture(width, height, newBuffer);
    glBindTexture(GL_TEXTURE_2D, texture.ID);
    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(-1, -1);

    glTexCoord2f(1, 0);
    glVertex2f(1, -1);

    glTexCoord2f(1, 1);
    glVertex2f(1, 1);

    glTexCoord2f(0, 1);
    glVertex2f(-1, 1);
    glEnd();

    texture.Delete();
    glDeleteFramebuffers(frameID);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindFramebuffer(GL_FRAMEBUFFER_BINDING, 0);
}

And here's what I'm getting

It's getting drawn where I want it to be with the size that I want, I just don't want everything to be drawn there.
Also when I delete a texture or framebuffer, OpenGL isn't reusing the id, I don't know if that's a feature or a bug.
EDIT: Here's how its supposed to look, Everything getting drawn in its place, I just want to change the text on the bottom left side to show the FPS

sentences:
What is the state of the art in procedural character animations? I'm a programmer and I'm interested in programmatic character animation — walking or running, bipedal or many-legged: what is the state of the art today?

I heard about NaturalMotion's Euphoria system and Ubisoft's IK Rig, and they look amazing. Where can I find more info about similar algorithms?

sentences: Making an enemy class for monogame c# I have been given the task to create an enemy class as well as an enemy manager. I am completely confused as to how I will attempt this. these classes will be added into one group project with my other group members. I need to include things such as enemy health, the sprite itself, animations etc. I am new to using Monogame and c# so it would be appreciated that any help given is in an extremely simple form.

sentences:
get tetrahedron centroid velocity if vertex velocities known If i have a tetrahedron and i know the velocities of the 4 vertices, how can I find the velocity of the Centroid?

I know how to get the result if i know the velocity of the Centroid (i can use Barycentric coordinates to find the vertex velocities).

sentences:
How to create heat haze effect in Libgdx? I would like to create a heat haze effect for a 2D game I am making.

Do You have ideas or suggestions, how to get that effect. I am using Libgdx(OpenGL 2.0).

Thank You in advance!

sentences: A ball hits the corner, where will it deflect? I need to brush up my trigonometry and hope you can help here with a simple mathematical model. Here is my model so far in the image attached. I am aware that the frame animation has other problems when the ball is moving very fast, but for now I just need to calculate ballDx and ballDy. It is also possible that ballDx = 0 (vertical movement only), but when the ball deflects ballDx may get a different value.

sentences:
Are there ways to limit players other than a conventional currency system or a resource system? I'm making a 2D strategy game. I want to create something unlike the current resource management type games I regularly see tagged as strategy.
My goals are:

To force the player to think about their decisions
To allow for experimentation easily and without sacrificing previous progress
To allow for multiple ways of solving problems presented in the game
To eliminate grinding simply because it won't work in whatever system I use

In effect, I want some way to limit the player and force them to make hard decisions, without using a commonly used currency or resource/crafting system, to cut down on grinding.
However, I'm actually having a little trouble implementing this sort of idea alongside the idea of progression.
My original idea was to introduce a cap on how many of each type of item a player could have at any one time. In effect, this introduces some elements of an open-ended puzzle game. However, this limits progression:

If the number of items the player can have increases over time, this means that each individual item's significance decreases over time. This has the effect of making decisions easier over the course of the game. Not what I want.
If the items get more powerful over time, then items acquired near the start of the game have no viability later on. I would like items to be at least partially viable at any stage of the game, to increase variety and make the game less linear. It turns the game into replacing old with new.
Only increasing the variety of items over the course of the game is a sure-fire way to lose players early if they believe they are not making progress.

My implementation is workable, but simply not good enough for my personal standards and goals.
Is there a better way to let limits, choice and progression go hand in hand?
I use the word "item" here not just to refer to items in game, but other things such as spells, moves, buildings, etc. that a player could acquire  and use in the game.

sentences:
Problem with gluOrtho2D() I was trying to understand the gluOrtho2D function. I have drawn 4 lines originating from the center reaching up to 4 corners of the screen.

You can follow the below code. osize is a variable which is used to set the parameters of gluOrtho2D. It will create a window of size 2*osize.

If works fine when osize is 1. Lines reach the corners. But as I increase the value of osize, the length of the lines decreases (cross becomes smaller and does not cover the whole screen). But I think it should reach the corner.

void display()
{
    glClear( GL_COLOR_BUFFER_BIT );

    //glViewport(0, 0, 100, 100);

    glMatrixMode (GL_PROJECTION);
    float osize = 1.2;
    //glOrtho(-osize*1.0, osize*1.0, osize*1.0, -osize*1.0, -1.0, 1.0);
    gluOrtho2D(-osize*1.0, osize*1.0, osize*1.0, -osize*1.0);
    glMatrixMode (GL_MODELVIEW);

    glBegin(GL_LINES);
       glColor3f(0.0, 0.0, 1.0);
       glVertex2f(0.0, 0.0);
       glVertex2f(-osize*1.0, -osize*1.0);
       glVertex2f(0.0, 0.0);
       glVertex2f(-osize*1.0, osize*1.0);
       glVertex2f(0.0, 0.0);
       glVertex2f(osize*1.0, -osize*1.0);
       glVertex2f(0.0, 0.0);
       glVertex2f(osize*1.0, osize*1.0);
    glEnd();

    glutSwapBuffers();  //includes glFlush();
}

What is the problem?

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 or when to add a copyright notice in published games? I've seen lot of videogame title screens show a copyright notice together with the company name. I'm about to publish my game and I am looking for possibilities or requirements on how or when to add such a copyright notice (including date or year published). Does it apply to both indie game makers and larger companies?

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 create a boomerang-a-like path? For the GitHub Game Off Jam, I plan to create a small game with a boomerang. But I don't know how to build the equation that will update the boomerang position.

I try to build a direction vector and rotate it a little to each update. But it generate each time a circle.

Is a bezier curve a good alternative? Or is it too complex?

sentences:
Perspective Matrix doesn't work OpenGL 4 I tried to implement my own perspective matrix and it doesn't work. I don't understand why. With just with my view matrix (without Perspective Matrix) I can see my mesh.

Here my view matrix :

Vec3f position(0.0,0.0,-5.0);
Vec3f target(0.0,0.0,0.0);

Mat4f Camera::LookAt(Vec3f target, Vec3f position)
{
 //ce dont j'ai besoin pour calculer les parametre de ma camera...
 Vec3f up_world = Vec3f(0.0,1.0,0.0);
 Vec3f forward = (position - target).normalize();
 Vec3f right = up_world.cross(forward).normalize();
 Vec3f up = forward.cross(right).normalize();

 Mat3f R;
 R.setCol(2,forward);
 R.setCol(0,right);
 R.setCol(1,up);

 R.transpose();

 Mat4f R4(R);

 Vec3f mp = position * -1.0f;
 Mat4f P4;
 P4.setCol(3,mp);

 _LookAt = R4 *P4;
 return  _LookAt;
}

And my Perspective Matrix :

Mat4f Camera::perspective(float fovy, float aspect, float zNear, float zFar)
{

  float theta = fovy * 0.5f * (180.f / M_PI);
  float range = zFar - zNear;
  float invtan = 1.f/tanf(theta);

  Mat4f projMat(invtan / aspect,  0.0f,    0.0f,                       0.0f,
                           0.0f,  invtan,  0.0f,                       0.0f,
                           0.0f,  0.0f,    -(zFar + zNear) / range,  -2 * zNear * zFar / range,
                           0.0f,  0.0f,    -1.0f,                      0.0f);

    _perspectiveCam = projMat;
    std::cout << _perspectiveCam << std::endl;
    return _perspectiveCam;
}

  Mat4f perspective(float fovy = M_PI/2, float aspect = (1280.f/720.f)*1.f, float zNear = 0.1f, float zFar = 100.f);

My shader is very simple so it can't be the problem..

#version 410 core

layout(location = 0) in vec3 V_position;
layout(location = 1) in vec3 V_color;
layout(location = 2) in vec3 V_normal;

uniform mat4 view_matrix;
uniform mat4 proj_matrix;

out vec3 color;
void main()
{
    color = V_color;
    gl_Position = proj_matrix * view_matrix * vec4(V_position, 1.);
}

when I initialise _perspectiveCam with the unit matrix 4x4 it displays my triangle..
but when I implement _perspectiveCam like in the function it does not display my triangle

Here my Set col function :

template <typename TYPE>
void Mat4<TYPE>::setCol(int i, Vec4<TYPE>& vec4)
{
  for (size_t k = 0; k < 4; k++)
  {
    setElement(k,i, vec4.getElement(k));
  }

}

void setElement(int i,int j, TYPE var){element[i*4 + j] = var;}
TYPE getElement(int i, int j) const {return element[i*4 + j];}

sentences:
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:
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:
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 keep a shape inside a rectangle? So I'm making a game which is based on randomly generated rooms and I need a way to keep the player inside them and make the player glide when he collides with the room's bounds. I currently have a SAT algorithm in place to detect collisions, but I don't know how to do collision resolution for being inside rooms.

Full code here

sf::Vector2f Collision::GetMtv()
{
    return (Mtv(small, smallestPerpendicular[smallestIndex]));
}

sentences:
How to space actors in scene uniformly? I have a Array data structure right now, which contains 10  soldiers in my army.

They can setup initially in various formations  -
e.g.

 o  o  o
 o  o  o
o  o  o  o

The user can move one of the soldier(currently selected) with the joystick.

 o  o  o
 o  o  o
o  o  o
         o

When he moves I want to automatically adjust the rest of the soldiers position so that they occupy equal areas in the scene, as well as still follow their orignal formation to some extent.

Somehow like this http://arborjs.org/halfviz/#/Mzg

How do I do this? What kind of algorithms should I look at?
How should store my soldiers? which data structure?

sentences:
How can I create straight, glowing lines? What techniques are used in this style?  What steps would be required to recreate it?

(Screenshot of this app: https://play.google.com/store/apps/details?id=com.dkeesto.holographlw)

sentences:
How to model irregular boundary of a 2D map in Game? I am creating a map in a game, the map contains different countries, my question:

Q. How to model the irregular boundary of each countries? How to do quick country searching if I click on the map (given x,y values)?

sentences: Game developing on the oculus rift My question is, do I need the oculus rift development kit to develop games or can I do it with a standard pair of oculus rift,and if I can do it with a standard pair of oculus rift why does the development kit exist?

sentences:
How do I implement the parallax effect in 3D graphics? With a perspective projection matrix and camera system already in place, I have a scene with a small jet fighter flying high over a wide and deep canyon with many cliffs and rocky surfaces; these are all being rendered as wireframes for now. The camera is following the ship which is flying entirely on the X-Z plane.

Right now, when the ship moves by some amount r, the entire canyon moves by that same amount in the opposite direction. I want to have parts that are further away from the camera to move slower, so I need parallax.

If I were going to implement parallax, in which part of the rendering system would it go, the projection matrix?

Below is a screenshot of the game as it is. The ship is moving forward and about to pass through some rocky crags.

sentences:
Creating and Destroying OpenGl objects dynamically I was trying to build a game like this

and i want to create and destroy these ships at runtime ,
I have used GL_QUADS and used an image to plot over the QUAD,
how can I dynamically create multiple Quads,paste (ship) image over them and destroy them when they collide with the canon ball, thanks

here is a chunk of code

ship = SOIL_load_OGL_texture(
        "ship2.png",
        SOIL_LOAD_RGBA,
        SOIL_CREATE_NEW_ID,
        SOIL_FLAG_INVERT_Y
        );
    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);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glColor3f(1, 1, 1);
    glBindTexture(GL_TEXTURE_2D, ship);
    glBegin(GL_QUADS);
    glTexCoord2d(0, 0);
    glVertex2d(450 - x, 0);
    glTexCoord2d(1, 0);
    glVertex2d(500 - x, 0);
    glTexCoord2d(1, 1);
    glVertex2d(500 - x, 100);
    glTexCoord2d(0, 1);
    glVertex2d(450 - x, 100);
    glEnd();

sentences:
Problems implementing a Sign Sprite in Libgdx I am making a tile based game in LibGdx. I am using the TiledMap in .tmx format. I want when my player reaches a tile whose property is set (tileType -> sign), he should see a Sign sprite and on colliding which, he should see the signScreen (small) in the Parent screen game screen.
Here is my code

//calling this method at the beginning ...in create()

    TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
    //test ="layer selected :-> "+layer;
    TiledMapTile tile;

        for(int y=0; y< mapHeight;y++){
            for(int x=0;x<mapWidth;x++){

        //Step-1: Search within the level map where should we construct a Sign
        //*
                try{
        tile = layer.getCell(x,y).getTile();

        if("sign".equals(tile.getProperties().get("tileType").toString())){
        layer.setCell(x, y, null);

//creating my sign sprite deleting that tile .. at the same position
            signs.add(new Sign(x , y , signCount++));

        }

    }
        catch(NullPointerException e){
            System.out.println("While Searching Tile for Sign ->"+e);
        }
            }
        }
}

But this code is not working. I checked ...things look Ok. But if I am placing this code in the collision detection code, where I am checking collision of player with the Layer of map. It works. But I do not want to put the code there.Because, if I am searching and replacing for the tile there..it outputs as if...........

"when the player reaches there and touchs the sign, then my Sign sprite becomes visible and at the same time, the child screen appears"....But I want all the tiles that I have marked as (tileType -> sign) should be checked at the beginning and replaced with my Sign Sprite.

Please suggest

Is there any problem with the above code or the loop
Is there is any other way to implement such a sprite that can communicate to player through a small screen .. i.e. illusion of telling something.

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

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

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

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

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

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

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

and I load an image in like this :

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

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

I render the sf::Sprite like this :

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

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

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

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

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

sentences:
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: 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:
Java2D Game Flickering I'm in the process of trying to get familiar with making games in Java, using the Swing library.

Coding my Snake game however, I've got to a point where the game is flickering/ghosting and I haven't a clue why.

An example of the flickering can be seen on this short youtube video:
http://www.youtube.com/watch?v=QP1IcZ5TRoY

I dread to post too much code here as it won't help anyone, but for glancers, I'll post some facts.

Painting on a JComponent
I do call super.paintComponent(g) at the start of my overrriden
paintComponent method
I've set setDoubleBuffered(boolean) to true.
Although unsure of its necessity, I've invoked
createBufferStrategy(2) on my JFrame
My "game loop" is based on a swing.Timer calling repaint every 17ms, but tried, 30fps
Snake piece moves at 25 pixel paces (or relative to world size).

This is how I draw each tile:

    for (int i = 0; i < gamePieces.length; i++) {
        int x = i % ROW_COL_SIZE;
        int y = i / ROW_COL_SIZE;

        if (gamePieces[i].equals(Tile.EMPTY)) {
            continue;

        } else {
            final SnakeGraphics gfx = gamePieces[i].getGraphic();
            gfx.draw(g2d, x, y, direction);
        }
    }

This is what is called on repaint:

public void render(Graphics2D g2d) {
    Direction dir = keyboard.getDirection();
    snake.setDirection(dir);
    snake.move();
    gameWorld.draw(g2d, dir);

}

and finally, how the snake moves:

public boolean move() {
    Point snakeHead = snake.getFirst();
    int x = snakeHead.x;
    int y = snakeHead.y;

    boolean success = validateStep(snakeHead); //boundary control + move

    if (success) {
        gameWorld.setTile(x, y, Tile.EMPTY);
        gameWorld.setTile(snakeHead.x, snakeHead.y, Tile.SNAKE_HEAD);
    }
    return success;

}

where gameWorld has all the tile information, i.e. what tiles get drawn and where, and Snake is just current position of the head thus far.

Apologies for the code-drop, but its all that I can determine to be relevant.

sentences: Is it possible to clone a game, and make modifiactions to it? I basically want to know whether or not it is possible to copy a mobile game and make it into a new game by modifying it . I want to be able to access , moderation tools and basically alter, things like characters, events, in ap purchases etc. Alter it to make it different enough from the original and make it available to other users. The game I want to copy is no longer in the play stores and I want to change that.

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:
Find random point on a circle with a radius of x and the players position as center (unity) First of all please note that the game is in 3d and Not 2d

The image below is seen from above. What I am trying to do is find a random point 2 - 3 meters around the player.

However I am not quite sure how to achieve it:

I have tried the following:

Vector3 randomPointOnCircle = Random.insideUnitSphere;
randomPointOnCircle.Normalize();
randomPointOnCircle *= radius;
return randomPointOnCircle;

However I am not sure how to set the player as the center?

Star - Player

Square the general ground

Circle - A visual representation of where the points should be around the player

sentences:
Bouncing Balls in angular movement I'm trying to bounce a ball off of a wall based on angular movement.
The ball comes in at angle X ( lets say 30 ).
Bouncing off with the equation 360-ballangle works for the left and right walls
180-angle works for top and bottom walls.

Edit Sorry for the vagueness - heres whats going on
When a ball hits a wall on any side, the ball bounces right back on the same angle
. I'm not sure why it does this - I am trying to have the ball flip its X velocity on a horizontal collision, and flip its Y velocity on a verticle collision. Because I am using angular movement, I need to do this by modifying the ball's angle value, and I am not sure how to set it so it bounces correctly.

(wall.getDimensions returns a rectangle with the walls size and location)

public void moveBullet(Bullet b) {
    float xpos = (float) (speed * 2 * Math.sin(Math.toRadians(b.angle)));
    float ypos = (float) (speed * 2 * Math.cos(Math.toRadians(b.angle)));
    Rectangle bulletbounds = new Rectangle((int) (b.bulletx + xpos), (int) (b.bullety + ypos), 10, 10);
    for (Wall wall : walls) {
        if (bulletbounds.intersects(wall.getDimensions())) {
            if (b.bulletx + 10 > wall.getDimensions().x || b.bulletx < wall.getDimensions().x + wall.getDimensions().width) {
                b.angle = (360 - b.angle);
            }
            if (b.bullety - 10 < wall.getDimensions().y + wall.getDimensions().height || b.bullety > wall.getDimensions().y) {
                b.angle = (180 - b.angle);
            }
        }

    }
    xpos = (float) (speed * 2 * Math.sin(Math.toRadians(b.angle)));
    ypos = (float) (speed * 2 * Math.cos(Math.toRadians(b.angle)));
    b.bulletx += xpos;
    b.bullety += ypos;

}

sentences:
Moving players into same square simultaneously? Consider a 2 x 2 grid of squares. A player can move onto a square if:

  no other player wants to move into the square next turn
  no other player has waited and is still occupying the square this turn

I have included the image above to describe my problem.

Players move simultaneously.

If 2 (or more) players try to move into the same square, neither move.

sentences:
Finding when shapes overlap and lines intersect but exclude points/edges I've been looking for a c# algorithm to help determine if shapes and lines intersect but want to exclude boundary overlaps. Here's an example:

My true problem is finding if polygons intersect but exclude boundary overlaps. I broke down the problem to look at the individual lines of that polygon and check each line segment from the shape1 against each line segment from shape2.

A: Is this an efficient/correct way to do the checking?

B: How do I ignore when they are on the boundary as illustrated above?

Here's some code I found here - I've been testing for line segments but it fails on fig 2, when the end point of the 2nd line segment finishes on the end point of the 1st segment.

private bool DoesLineIntersect(Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2)
{
    float denom = ((end1.x - start1.x) * (end2.y - start2.y)) - ((end1.y - start1.y) * (end2.x - start2.x));

    //  AB & CD are parallel
    if (denom == 0)
        return false;

    float numer = ((start1.y - start2.y) * (end2.x - start2.x)) - ((start1.x - start2.x) * (end2.y - start2.y));

    float r = numer / denom;

    float numer2 = ((start1.y - start2.y) * (end1.x - start1.x)) - ((start1.x - start2.x) * (end1.y - start1.y));

    float s = numer2 / denom;

    if ((r < 0 || r > 1) || (s < 0 || s > 1))
        return false;

    return true;
}

sentences:
How can I track how "well-lit" a player is so that I can determine if my AI can see him or her? I want to see how well-lit the player character is in an environment so that my AI can react (or not) to the player when he or she is visible.

Currently I am doing this by reading back the color data of the final render target and computing the brightness of the player's region. It seems expensive and taxing, so I was wondering if there is a better way to approach this?

sentences:
Geometry shader for multiple primitives How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;

But if I use this shader then lines or points won't show up. So adding:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
layout(lines) in;
layout(line_strip, max_vertices=2) out;

The shader will compile and run, but will only render lines (or whatever the last primitive defined is).

So how do I define a single geometry shader that will handle multiple types of primitives? Or is that not possible and I need to create multiple shader programs and change shader programs before drawing each type?

sentences:
Using sourceRect or cropping out a Texture 2D to draw? MonoGame/XNA I was wondering what is the best way to draw textures (for performance). Using the sourceRectange in the spriteBatch.Draw() call and just draw the whole spriteSheet, or crop out every texture on the spritesheet and store them in there own Texture2D object? Like this :

    public static Texture2D Crop(Texture2D spriteSheet, Rectangle source)
    {
        Texture2D croppedTexture2d = new Texture2D(spriteSheet.GraphicsDevice, source.Width, source.Height);
        Color[] imageData = new Color[spriteSheet.Width * spriteSheet.Height];
        Color[] croppedImageData = new Color[source.Width * source.Height];

        spriteSheet.GetData<Color> (imageData);

        int index = 0;

        for (int y = source.Y; y < source.Y + source.Height; y++)
        {
            for (int x = source.X; x < source.X + source.Width; x++)
            {
                croppedImageData [index] = imageData [y * spriteSheet.Width + x];
                index++;
            }
        }

        croppedTexture2d.SetData<Color> (croppedImageData);
        return croppedTexture2d;
    }

And just call that method in the LoadContent() method?

sentences:
Why doesn't SDL2 recognize a game controller button press? SDL2 recognizes my PS4 controller but not the button presses. Here is a minimal code example.

#include <SDL2/SDL.h>
#include <stdio.h>

int main(int argc, char** argv) {
  if (SDL_Init(SDL_INIT_VIDEO) != 0 ) {
    printf("Unable to initialize SDL (%s)\n",SDL_GetError());
    printf("Exit\n");
    return -1;
  }

  SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);

  SDL_GameController *gameController = NULL;
  int numJoysticks;
  numJoysticks = SDL_NumJoysticks();
  printf("%d joysticks found\n", numJoysticks);

  if( numJoysticks <= 0 ) {
    return -1;
  }

  if( ! SDL_IsGameController(0) ) {
    printf("Error: joystick 0 is not a game controller\n");
    printf("Exit\n");
    SDL_Quit();
    return -1;
  }

  gameController = SDL_GameControllerOpen(0);

  if( ! gameController ) {
    printf("No game controller found\n");
    printf("Exit\n");
    SDL_Quit();
  }

  printf("Opened Game Controller 0\n");
  printf("Found a valid controller, named: %s\n", SDL_GameControllerName(gameController));

  if( SDL_GameControllerGetButton(gameController, SDL_CONTROLLER_BUTTON_A) ) {
    printf("Button press!\n"); // Never printed
  }

  // Exit
  SDL_GameControllerClose(gameController);
  SDL_Quit();
  return 0;
}

Here is the output I get:

1 joysticks found
Opened Game Controller 0
Found a valid controller, named: PS4 Controller

What am I doing wrong?

sentences:
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 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:
Animated textures for models; How to write a shader? Was watching some Rocket League and notice there was animated decals and wheels.

.

I would like to implement something similar to the effects in the image above.

How would I go about writing a Unity Shader to do the wheel effect?

I don't know much about Shaders, but can I edit the standard Unity Shader to do the animation effect?

sentences: Calculate hockey puck bouncing off rubber bumper I am very new to game development (or any type of development for that matter) and I am trying to figure out how I would calculate a hockey type puck bouncing off a rubber bumper placed at a 45 degree angle. The puck could hit the bumper at any angle during play. Any help with this is greatly appreciated.

sentences:
How do I play a particle system when moving? I have a car that I move with a Physics-based movement (AddForce(), AddTorque(), etc...) and I have a simple particle system attached behind the car as follows:

I'd like to play this ParticleSystem whenever the car moves; I tried checking if the car's rigidbody's velocity was greater than 0:

if(m_Rigidbody.velocity.z > 0)
   m_ParticleSystem.Play();

if(m_Rigidbody.velocity.z == 0 && m_ParticleSystem.isPlaying) // velocity.z == 0 is unreliable, verified with Debug.Log
   m_ParticleSystem.Stop();

I then tried using Input:

if(Input.GetAxis("Vertical") > 0) // the car is moving along the positive z axis
    m_ParticleSystem.Play();
if(Input.GetAxis("Vertical") == 0 && m_ParticleSystem.isPlaying)
    m_ParticleSystem.Stop();

These two methods don't work, I'm probably making assumptions on how Rigidbody.velocity behaves (when you stop the car for example, it becomes negative, so the particle system would keep playing until it reaches 0);

sentences:
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:
How to store information about a simulated sport match in a browser game? There is a browser game called Soccerstar where users play in a soccer team and compete in matches against other teams. Matches are scheduled at specific times of the day and played automatically and when the user logs in he can watch an animation representing the last played match.

Now, I want to implement a similar feature: a match is simulated on the server based on the players statistics and tactical choices and the information about the match progression is stored in the database. Please note that I want the outcome of the players actions (tackles, shots etc.) not to be completely deterministic because I want to introduce some randomness.
Once the match has been simulated and stored, the client can retrieve the information and generate the animation at any time.

My main doubt is how to represent and store the information about the match progression: what would be the smartest way to do it?

sentences:
Loading Data From Lobby Scene to Gameplay Scene with Photon Network As the title suggests, I am currently stuck trying to program a way to load some game mode preferences (ie. what type of game mode/players on each team/ etc...) from a player lobby scene to the actual gameplay scene.
Currently, I have taken the approach of creating a DontDestroyOnLoad prefab that successfully passes the preferences over; however, when mixed with the Photon Networking API, this becomes very annoying as the Prefab becomes unsynced, resulting in players connecting into the game not spawning into there correct positions and teams reading empty, etc...
Is there a more proper and reliable way to approach transferring player game mode data from the lobby scene to the gameplay scene? I've heard that PlayerPrefs could work but am unsure whether or not they should be used when networking is involved.

sentences:
How can I make a ball accelerate while moving down? I am making a super monkey ball game.

I want my ball to gain velocity while rolling downwards infinitely, and I cannot find any solution to this on Google. I'm new with c# so I am having a hard time creating this code on my own, can anybody help me achieve this?

I figured the question is simple enough not to require a picture or file. In layman's terms, I want the ball to roll faster and faster while as it rolls down a slope.

I am using Unities rigidboody, which adds velocity while to falling speed, but does not add velocity to rolling speed

I decided to test it with a steeper slope and it seems the rotational velocity worked, however I cant have the game have this difficulty, as the slope has to be very steep for the angular velocity to work properly. I have no angular or normal drag, so is there a way to change the slope the ball has to be rolling at for velocity to work? Or is unities rigidbody just not very good for a game like this.

sentences:
Rectangles render with gaps in between them (Box2D) Right now I create my boxes where 1 meter is 85 pixels. Gravity is 10.  And

                        fixtureDef.restitution = 0.1f;
            fixtureDef.friction = 0.5f;
            fixtureDef.density = 1.0f;

The problem I'm having is illustrated in the image I have provided:

As you can see, there is a small gap between many, but not all the crates. What could cause this?

Thanks

sentences:
XNA 3D cube rotation problem I am new to game programming and still trying to clear up my basics. I am stuck with a problem and unable to resolve on my own knowledge. I am trying to rotate a 3d cube in MonoGame (Similar to XNA) Windows Phone 8 application. The rotation works fine but it has a problem. Following is the scenario

Y axis (up/down) rotation works fine. I am able to rotate it as
many times as possible and everything works fine.
But let's say that the cube was in its default position. I rotate
my cube 180 degree on y-axis. Now when i rotate my cube on X axis. It
rotates in opposite direction. Forexample if i try to move it towards
positive x-axis it moves in negative x-axis.
If i again move the cube 180 degree in y-axis, the x-axis
rotations works fine again.

public void Update(GameTime gameTime)
{
    _userInputHandler.HandleTouchEvents();

Matrix unrotatedView = Matrix.CreateLookAt(
    cameraPosition, ModelPosition, Vector3.Up);

viewMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(Angle.Y)) *     // right/left rotation
              Matrix.CreateRotationX(MathHelper.ToRadians(Angle.X)) *   // up/down rotation
              unrotatedView;

CameraCurPos = Cube.MatrixVectorMultiply(cameraPosition, viewMatrix);

projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 100.0f);

}

Here is the Input handle function

public void HandleTouchEvents()
        {
            TouchCollection tc = TouchPanel.GetState();

            if (tc.Count > 0)
            {
                TouchLocation current = tc[0];
                TouchLocation prev;
                if (current.TryGetPreviousLocation(out prev))
                {
                    Vector3 newAngle = _gameEngine.Angle;
                    //newAngle.X += MathHelper.ToRadians((current.Position.X - prev.Position.X) * TURN_SPEED); // pitch
                    //newAngle.Y += MathHelper.ToRadians((current.Position.Y - prev.Position.Y) * TURN_SPEED); // yaw
                    newAngle.X += MathHelper.ToRadians((current.Position.Y - prev.Position.Y) * TURN_SPEED); // pitch
                    newAngle.Y += MathHelper.ToRadians((current.Position.X - prev.Position.X) * TURN_SPEED); // yaw

                    _gameEngine.Angle = newAngle;

                }
}
}

I know the problem is simple but i am unable to resolve it. Thanks in advance.

sentences:
Interpolation between two 3D points? I'm working with some splines which define a path a character follows (you can see a gameplay video here to get a better understanding of what's going on: http://www.youtube.com/watch?v=BndobjOiZ6g). Basically the characters 'forward' look direction is set to the 'forward' direction of the spline and when players tilt their phone left and right the character is strafed along its 'right' coordinate.

The issue with this is (rather obviously) in performance, interpolating over a spline to find the nearest position and tangent relative to the player is an incredibly costly operation. To get by this I cache a finite number of positions in what I call 'SplineDetails', the class is as follows:

public class SplineDetails
{
    public SplineDetails()
    {
        Forward = Vector3.forward;
        Position = Vector3.one * float.MaxValue;
        Alpha = -1;
    }
    public float Alpha; // [0,1] measured along length of spline where 0 is the initial point and 1 is the end point of the spline
    public Vector3 Position; // the point of the spline at this alpha
    public Vector3 Forward; // the forward tangent of the spline at this alpha
}

I populate this with say 30 coordinates and I can give a rough estimate of a coordinate and 'forward' based on a position past in. It's not as accurate but it's much faster.

But now I'd like to make the system work better by estimating positions and 'forward' directions by interpolating between two of the cached points though I'm stuck trying to figure out some logic.

My first problem is, how can I determine between which two points the object is? Given each point can be placed at different intervals along the spline it could mean that two points in front or behind the object can be closer to the object.

The other problem is to figure out the proportion between the two paths it's between, i.e. if there is a point a at coordinate (0,0,0) and point b at coordinate (1,0,0) if the object is at position (0.5,0,0) then the result it should give is '0.5' (as it is equal distance away from point a and point b). That's a simple example, but what if the object is at coordinate (0.5,3,0) for example?

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:
how does collaboration in unity work? i've been working on a 2d game for a bit now, almost all assets made but when ive tried to collaborate everything was quite glitched out, edits weren't saved, nothing was working at all. im not sure quite what the problem was because we were both on the latest version.

maybe i got to something wrong, or did something wrong im not sure. this was a few months ago now and ive been busy but i want to come back to this project. should i start over?

sentences:
Shooting Bullets Around a Sphere I currently have a ship that can orbit around a sphere freely controlled by a joystick. There is a separate joystick that controls the gun and starts shooting when it is touched.

Right now the bullets start shooting and then orbit the sphere until their lifetime has elapsed. Instead of having them orbit the sphere I want them to orbit for maybe the first half of their life and then shoot off into space. Does that make sense?

It would give the effect of a kind of glancing off the atmosphere, instead of staying in orbit for the whole time.

I am working in Unity3D and using the RotateAround() method to get the bullets to orbit. I'm thinking I need to take a snapshot of there position at half life, and then figure out the vector that would shoot them off into space. If someone could help me get going in the right direction with that, that would be great!

sentences:
Simulated Economic Factors Based on Supply and Demand in MMO Resource Trading Game I'm working on a gam (naturally), and the primary activity for the player is to buy and sell commodities at various marketplaces.

Each commodity has the following properties:

Base Price: if all things were otherwise equal, this would be the measure of value for the commodity
Supply Factor: when a player sells one unit of this commodity in a market, the "supply" goes up by this factor
Demand Factor: when a player purchases one unit of this commodity in a market, the "demand" goes up by this factor.

Within each market, the commodities are given the following local properties:
Local Supply
Local Demand

To keep things "simple", I have these values generated randomly with the equivalent of a 3d6, so Supply and Demand can be anywhere from 3-18.

The price for one unit of a commodity in a particular market is calculated like so:

Price = BasePrice * (LocalDemand+DemandFactor*UnitsDemanded) / (LocalSupply+SupplyFactor*UnitsSupplied)

In this way, player purchases will drive the price up, and player sales will drive the price down.

Now comes the problem, and I'll use a concrete example as it is not entirely obvious from just looking at the formula.

We have commodity X with a base price of 100, and local demand and local supply both of 10, and a supply and demand factor each of 1.

So, desiring to purchase a single unit, I calculate the price:

Price = 100 * (10+1*0) / (10+1*0) = 100

And I purchase the unit, which drives up the price to:

Price = 100 * (10+1*1) / (10+1*0) = 110

And if the player then sells the commodity at that price, he immediately profits 10.

This is no good.

So, my first pass at this solution is to calculate the price based on what the supply or demand WILL BE after the purchase is over, which works after a fashion, but consider that in the example above, the purchase of 1 unit will be 110, whereas the purchase of 10 units will have a unit price of:

(100 * (10+1*10) / (10+1*0)) = 200 (total of 2000 to buy 10 units)

So, naturally this is unfair, and so the player would get the best price for purchasing one unit at a time.

And I don't want the player to have to do that, so I want to calculate the price one unit at a time.

This in itself is relatively easy, just loop through the units I want to purchase, and add it up.

Unfortunately, it doesn't exactly take care of the fractional units.

I might not have mentioned that you can own fractional units of commodities. You can.

Another thing to compound the issue is that the "currency" is simply another commodity, which can itself have supply, demand, supply factor, demand factor, sales, purchases, and so on.

So purchasing is a two step problem.

First, for a particular number of units of a commodity, determine the "value" of them in a way that ensure that buying and then immediately selling is a losing proposition.

Second, for a particular "value", determine the number of units that would need to be "sold" in order to make up that value.

Another wrinkle: it should not be advantageous to purchase fractional units.  The price for buying half a unit, and then buying another half a unit should not be better or worse than buying one whole unit at one time.

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:
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:
Set an scaled image rectangle coordinates I have used the Origin parameter to draw the image (the image is also scaled) in center of the screen, and created a rectangle to detect whether user tapped on that image.
The problem is that if I tap on left part of the image it doesn't happen anything but at the right part, it executes what it has to.

How can i fix this? I have tried something but any result...

ItemRectangle[ItemID] = new Rectangle((int)Position.X + (int)(Position.X * Scales), (int)Position.Y + (int)(Position.Y * Scales), ItemTexture[ItemID].Width, ItemTexture[ItemID].Height);

spriteBatch.Draw(ItemTexture[i], ItemPosition[i], null, Color.White, 0, new Vector2(ItemTexture[i].Width / 2, ItemTexture[i].Height / 2), Scale, SpriteEffects.None, 0);

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:
opengl z index changing does not zoom in I am making a simple opengl application where I have a cube and I want to move forward to it with the glTranslate3d function, where I change the z index. One would expect the object to get bigger because of the view but it does not

My code:

    glClearColor(0, 0, 0, 1);
    glClearDepth(1.0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glOrtho(30, width, 0, height, 100, -100);
    glMatrixMode(GL_MODELVIEW);

I have tried many things also I have been told that gluPerspective is out dated and should not be used....

EDIT: it works when I rotate the object you can see how 3d it is :p

sentences:
Multiple Scripts versus single script I have (methink) a simple question regarding attaching scripts to a GameObject.
Is there any performance loss if I attach a script to a GameObject for each action to be performed (such as movement, attaking, interacting) instead of attaching a single script dealing with every single aspect?

I'd like to separete these things due to clearity reasons but I wonder if calling different FixedUpdate() functions would imply some kind of issue. For example: is their execution ensured to be called sequentially or they could run asincronously?

sentences:
How can I implement pathfinding that avoids obstacles on a spherical planet? Hi everyone, I am trying to make the enemy go around the planet, towards the player (I am using Faux Gravity for the movement logic).

I tried using Unity's NavMesh tools, but because this is not a flat mesh, they didn't really get the job done;

How can I make my enemies go around the planet towards the enemy in a physics based way?

I thought about calculating the a direction from the enemy towards the player and then moving the player towards a vector perpendicular to the planet's surface (in this case transform.forward) like so:

This way I can correctly move enemies towards the player, but the AI doesn't have any notion of any possible obstacle it should avoid.

I am specifically looking for some sort of A* algorithm, that would work on a spherical surface, like the one of a planet.

Is there a better way to do this?

sentences:
Two pass blur shader using libgdx tile map renderer I am trying to apply the following technique: blur effect using two pass shader to my libgdx game using the OrthogonalTiledMapRenderer. The idea is to blur the background wich is also a tilemap but rendered with another camera with a different zoom applied.

Here is a screen capture without effect:

Using the OrthogonalTiledMapRenderer sprite batch like this:

backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
backgroundMapRenderer.render(layerBackground);

I get the following render:

Wich is ok for X blur pass. I then try using frame buffer object like in this example. But the effect seems to be too much zoomed:

I may be messing up with the camera and the zoom factor. Here is the code:

    private ShaderProgram shaderBlurX;
    private ShaderProgram shaderBlurY;

    private int FBO_SIZE = 800;
    private FrameBuffer targetA;
    private FrameBuffer targetB;

    targetA = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);
    targetB = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);

    targetA.begin();
    Gdx.gl.glClearColor(1, 1, 1, 0);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    backgroundMapRenderer.render(layerBackground);
    targetA.end();

    targetB.begin();
    Gdx.gl.glClearColor(1, 1, 1, 0);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
    backgroundMapRenderer.render(layerBackground);
    targetB.end();

    TextureRegion back = new TextureRegion(targetB.getColorBufferTexture());
    back.flip(false, true);

    backgroundMapRenderer.getSpriteBatch()
        .setProjectionMatrix(backgroundCamera.combined);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurY);
    backgroundMapRenderer.getSpriteBatch().begin();
    backgroundMapRenderer.getSpriteBatch().draw(back, 0, 0);
    backgroundMapRenderer.getSpriteBatch().end();

I know I am making something the wrong way, but I can't find any resources about applying two passes shader using tile map renderer.

Does someone know how to achieve this?

sentences:
Radiance arriving at or leaving a surface I was reading this text about radiance and according to the next figure, both leaving and arriving radiances' solid angles are anchored on the surface point?

My logic tells me that the solid angle of the radiance arriving at a surface is supposed to be anchored somewhere in the "air" (say at the light bulb position). Something like this:

This way the radiance formula makes sense too, no? (irradiance per solid angle, meaning when the solid angle gets bigger the radiance at point gets smaller)

Can someone shed some light on this?

sentences:
MonoGame Mac installation instructions Does anyone know how to install MonoGame on Mac. I have been looking around for a while and I can't find any guides. I have Mono and MonoDevelop up and running fine, but I cannot figure out how to install MonoGame.
Thanks.

sentences:
What does the Node2D transform property do? Following a Godot tutorial I encountered the transform property, but I'm not sure what it means nor how to use it.
I read the official Godot documentation, but it didn't give me a full explanation about the theme. I just got this:

Transform2D transform
Setter set_transform(value)
Getter get_transform()

Could someone explain to me more about this?

sentences:
Game Loop, Deltas. What is wrong? For my Android app this is the gameloop:

public void run(){
    while(true){
        if(frames == 0)
            cTime = System.currentTimeMillis();

        if(System.currentTimeMillis() >= lastUpdate + 5){
            if(gameState == PLAYING)
                updatePhisic();

            updateSprites();
            this.postInvalidate();
            lastUpdate = System.currentTimeMillis();
        }

        /*try{
            Thread.sleep(sleeptime);
        }catch(InterruptedException e){}*/

        if(System.currentTimeMillis() >= cTime + 1000){
            frameRate = frames;
            frames = 0;
        }
        else
            frames++;
    }
}

Please consider this should work for multiple devices.

Testing in some devices:

My phone: 180 FPS
A Smaller phone: 200 FPS
A Tablet: 120 FPS

I'm trying to put it at 60 FPS but the player moves so slow, I don't know how to calculate the Delta for player. I mean that at 180 FPS in my phone works fine, that is the speed that I want. But at 120 FPS in a tablet freezes a bit.

I think that painting the screen 60 times in a second would be enough.

And this freezes sometimes:

if(System.currentTimeMillis() >= lastUpdate + 5)

This does not:

try{
    Thread.sleep(sleeptime);
}catch(InterruptedException e){}

Why?

sentences:
How to restrict movement of Leap Motion hand object I have a "Hand" GameObject controlled by a Leap Motion Controller. The Hand despite having RigidBody and Box Collider just seemingly moves with no regards to physics (transform translate movement I suppose). So it clips through other Rigidbody objects.
I'm trying to pseudo-introduce physics to it. I created a second GameObject "HandClone" (with Rigidbody and Box Collider) that copies the first Hand position but moves with actual physics. HandClone script:
   private void FixedUpdate()
    {
        rb.MovePosition(targetTransform.position);
        rb.MoveRotation(targetTransform.rotation);
    }

Now HandClone goes where Hand goes, and HandClone is successfully bumping into other objects.
However, when HandClone gets stopped by something, Hand still keeps moving past HandClone and clips into the other objects, like before.
Now I am thinking that the way to solve this is to constrict Hand's movements to the bounds of HandClone so that finally Hand will stop clipping through objects. But how can this be achieved, would that even work, and is there a better way? Will movement streamed from Leap Motion Controller even respond to scripts like that?
__
Edit: I've now decided to hide Hand and place HandClone where Hand was.
But my script for HandClone to copy Hand's movements is making HandClone fly all over the place. Here's the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class clone1 : MonoBehaviour
{
    private Rigidbody rb;
    public GameObject target;
    void Start()
    {
        rb = this.GetComponent<Rigidbody>();
    }

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

    }
    private void FixedUpdate()
    {
        Vector3 newRotation = new Vector3(target.transform.eulerAngles.x + 8.5f, target.transform.eulerAngles.y - 172.78f, target.transform.eulerAngles.z - 94.02f);
        rb.MoveRotation(Quaternion.Euler(newRotation));
    }
}

The reason why I am adding those float numbers is because when the game isn't playing, those numbers are what make HandClone sit in the correct position, so I thought it would help with alignment in playmode. But HandClone is just flying everywhere regardless. Any advice with making the HandClone stay attached to the avatar's wrist would help.

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:
Why would a game engine developer use both DirectX and OpenGL? It's very common for cross-platform game engines to support both DirectX and OpenGL, and even Vulkan. Why would a studio want to write abstraction code 2, 3, or even 4 times? OpenGL/Vulkan are practically on par with DirectX.

In my experience, businesses care about their bottom line. Paying developers to write duplicate code gets expensive very quickly. It'd be nice to use the most native API for each target platform, but I don't understand how the cost and overhead is worth it.

Since Windows support OpenGL/Vulkan, why bother writing the DirectX code when the final game will look nearly identical?

sentences:
What is wrong with this character slope math? I'm making a sidescrolling platformer and have implemented some code that should convert the characters speed to an X speed and Y speed based on the angle of the surface they are on. This actual math for this was taken from a web page and I don't know if it's right or not.

// xSpeed and ySpeed are derived from speed, based on the angle
    xSpeed = speed * Mathf.Cos(angle);
    ySpeed = (speed * -Mathf.Sin (angle)) - gravity;

The angle is found with this code:

RaycastHit ground;
    Physics.Raycast (transform.position, Vector3.down, out ground, 1.5f);
    Debug.DrawRay (transform.position, Vector3.down.normalized, Color.green, 2, false);
    if (ground.collider != null)
    {
        angle = Vector3.Angle (ground.normal, Vector3.up);
    }
    else
    {
        angle = 0;
    }

This works fine when walking on a flat surface, but freaks out when walking on a slope. I believe the problem lies with the angle itself.

sentences:
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:
How does XNA's KeyboardState represent all keyboards? I already understand how to work with Keyboard and KeyboardState, but when debugging I happened to take a look at the KeyboardState's non-public members via the VS debugger. I expected to see a large list of values, but instead, only saw 8 uints at a static level, and another 8 uints per instance:

Non-Public members  (static)
    stateMask0  uint    976757505
    stateMask1  uint    67108863
    stateMask2  uint    3221225470
    stateMask3  uint    4294967295
    stateMask4  uint    196863
    stateMask5  uint    4244635647
    stateMask6  uint    4160752641
    stateMask7  uint    1876688932

Non-Public members  (instance)
    currentState0   uint    0
    currentState1   uint    0
    currentState2   uint    0
    currentState3   uint    1048576
    currentState4   uint    0
    currentState5   uint    0
    currentState6   uint    0
    currentState7   uint    0

There are 32 bits per uint, so having 8 of them essentially acts as a field of 256 boolean values, which loosely corresponds with the Keys enum type, so I assume that the static values act as a way to test which buttons are present on a device. However, XNA supports up to 4 keyboards, so I'm not sure how it both translates this to a button state, nor how it can differentiate between different keyboards in this way.

sentences:
3D modelling from a picture? Can I make a model from a picture? A friend of mine would like to be an NPC in my game ! :P I would like to add him, but I never did 3D modelling!

Is it possible to make 3d model from photo/picture?

sentences:
Saving a list of points into a text file I recently posted a question about this, but was not really sure where to go. I've gotten some progress, and have generated some simple noise here:

http://pastie.org/5408655

That works well enough for me, but I would really like to be able to save the points into an ascii text file. currently it's formatted so that something like this:

11111111

11111111

11111111

11111111

would create a square. I need to save in this format with the points(and lines connecting them) generated in the method above.

Essentially, I need to write the array of points created in the first example to a text file formatted like the second example.
EDIT:
I ended up using serialization. This method makes it un-editable, but works for my purposes, I can really have good terrain generation now. here's my code: http://pastie.org/5455624 Everything is working excellently. Thanks to all those who helped

sentences:
How can I get the width and height of a picture? I'm trying to make a script on RPG Maker XP that needs the width and height of an image to do some calculations. I tried @picture.bitmap.widthand @picture.bitmap.height but it returned the width and height of the image that is being shown in the screen.

For instance, if the image is 800 pixels height, and the image takes 400 pixels in the screen, @picture.bitmap.height will only return 400.
This is the code I'm using:

@picture = Sprite.new
@picture.bitmap = RPG::Cache.picture("picture")
@pictureWidth = @picture.bitmap.width
@pictureHeight = @picture.bitmap.height

sentences:
Unity 3D - Confine a gun rotation within certain degrees I am having troubles making my gun rotate up and down, and have limits, for example, I want the down limit to be 0 degrees, and the up limit to be 90 degrees.

Currently I can't figure out how to define that, and when the gun gets to one of the extremes, it gets stuck there and doesn't want to go back. Whats wrong?

Here's how I rotate the gun using an on-screen joystick

float lookAxisX = CrossPlatformInputManager.GetAxisRaw("VerticalLook");

        if ((transform.localEulerAngles.x <= 360 && transform.localEulerAngles.x > 270) ||
            (transform.localEulerAngles.x >= 0)
            ) {
            transform.localEulerAngles += new Vector3(-lookAxisX * 2f, transform.localEulerAngles.y, transform.localEulerAngles.z);
        }

        Debug.Log("transform: " + transform.localEulerAngles);

Also right now, when the gun is at the default rotation (facing forward, its X angle is 0, and when it rotates up, it goes from 0 to 359,9, and then at 270 it gets stuck

sentences:
2D game collision response: SAT & minimum displacement along a given axis? I'm trying to implement a collision system in a 2D game I'm making. The separating axis theorem (as described by metanet's collision tutorial) seems like an efficient and robust way of handling collision detection, but I don't quite like the collision response method they use. By blindly displacing along the axis of least overlap, the algorithm simply ignores the previous position of the moving object, which means that it doesn't collide with the stationary object so much as it enters it and then bounces out.

Here's an example of a situation where this would matter:

According to the SAT method described above, the rectangle would simply pop out of the triangle perpendicular to its hypotenuse:

However, realistically, the rectangle should stop at the lower right corner of the triangle, as that would be the point of first collision if it were moving continuously along its displacement vector:

Now, this might not actually matter during gameplay, but I'd love to know if there's a way of efficiently and generally attaining accurate displacements in this manner. I've been racking my brains over it for the past few days, and I don't want to give up yet!

(Cross-posted from StackOverflow, hope that's not against the rules!)

sentences: How to make your own 2D AABB collision system in unity? I can't use the built in unity 2d physics engine for my game, so I tried to make my own using the unity bounds.Intersects, that is working perfectly but my problem is that I don't know how to make the player stop when It collides. Ive tried multiple things like storing the players last position and "teleporting" it back to that position when it collides (That looks choppy). Ive also tried to invert the controls when your colliding (So like W makes the player go down, A makes it go right ect) but that is extremely buggy. How should I do it?

sentences:
Möller-Trumbore intersection point I am using the Möller-Trumbore method as part of my (still very basic) collision detection system.

The information I'm craving about is the distance from the ray origin and intersection point. The intersection point would be fine too obviously.

I probably wrongly assumed t in the code below is actually the distance from the ray origin to the intersection point. If it actually is, then I don't know what's wrong with my code.

I have got a simulation with a mesh and "bullets", sometimes firing a collision acurately, and sometimes not (bullets passing thru mesh, or firing a colision before it actually should hit).

bool rayTriangleIntersect(const XMFLOAT3 &orig, const XMFLOAT3 &dir, const XMFLOAT3 &v0, const XMFLOAT3 &v1, const XMFLOAT3 &v2, float &t, float &u, float &v) {
// http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

    float kEpsilon = 0.000001f;
    XMFLOAT3 v0v1 = v1 - v0;
    XMFLOAT3 v0v2 = v2 - v0;
    XMFLOAT3 pvec = XMFLOAT3Cross(dir, v0v2);

    float det = XMFLOAT3Dot(v0v1, pvec);

    if (det < kEpsilon) return false;

    float invDet = 1.0f / det;

    XMFLOAT3 tvec = orig - v0;
    u = XMFLOAT3Dot(tvec, pvec) * invDet;
    if (u < 0 || u > 1) return false;

    XMFLOAT3 qvec = XMFLOAT3Cross(tvec, v0v1);
    v = XMFLOAT3Dot(dir, qvec) * invDet;
    if (v < 0 || u + v > 1) return false;

    t = XMFLOAT3Dot(v0v2, qvec) * invDet;

    return true;
}

Is t really the distance im looking for ? If not how do I get it, or the intersection point. I've heard of baricentric coordinates in a triangle related to u and v - is it the way to go ? If yes I'd be thankful for an example or link related to the Möller-Trumbore method.

Thanks!

sentences:
Animating Tile with Blitting taking up Memory I am trying to animate a specific tile in my 2d Array, using blitting. The animation consists of three different 16x16 sprites in a tilesheet. Now that works perfect with the code below. BUT it's causing memory leakage. Every second the FlashPlayer is taking up +140 kb more in memory. What part of the following code could possibly cause the leak:

//The variable Rectangle finds where on the 2d array we should clear the pixels
//Fillrect follows up by setting alpha 0 at that spot before we copy in nxt Sprite
//Tiletype is a variable that holds what kind of tile the next tile in animation is
//(from tileSheet)
//drawTile() gets Sprite from tilesheet and copyPixels it into right position on canvas

        public function animateSprite():void{

                    tileGround.bitmapData.lock();

                    if(anmArray[0].tileType > 42){
                        anmArray[0].tileType = 40;
                        frameCount = 0;
                    }
                    var rect:Rectangle = new Rectangle(anmArray[0].xtile * ts, anmArray[0].ytile * ts, ts, ts);
                    tileGround.bitmapData.fillRect(rect, 0);

                    anmArray[0].tileType = 40 + frameCount;
                    drawTile(anmArray[0].tileType, anmArray[0].xtile, anmArray[0].ytile);

                    frameCount++;

                    tileGround.bitmapData.unlock();
                }

        public function drawTile(spriteType:int, xt:int, yt:int):void{

                    var tileSprite:Bitmap = getImageFromSheet(spriteType, ts);
                    var rec:Rectangle = new Rectangle(0, 0, ts, ts);
                    var pt:Point = new Point(xt * ts, yt * ts);
                    tileGround.bitmapData.copyPixels(tileSprite.bitmapData, rec, pt, null, null, true);

                }

                public function getImageFromSheet(spriteType:int, size:int):Bitmap{

                    var sheetColumns:int = tSheet.width/ts;
                    var col:int = spriteType % sheetColumns;
                    var row:int = Math.floor(spriteType/sheetColumns);
                    var rec:Rectangle = new Rectangle(col * ts, row * ts, size, size);
                    var pt:Point = new Point(0,0);

                    var correctTile:Bitmap = new Bitmap(new BitmapData(size, size, false, 0));
                    correctTile.bitmapData.copyPixels(tSheet, rec, pt, null, null, true);
                    return correctTile;

                }

sentences:
Prevent parent alarms to activate a child alarm event I'm working on a small game using Gamemaker Studio 2 and I've noticed that my Parent o_enemy.Alarm[0] Is activating the Child enemy_1.Alarm[0] event.

Both alarms were supposed to be activated under different conditions, (The parent alarm is used for all enemies, but the child alarm is used for the specific enemy) but they seem that they'll activate each other because they share the same name Alarm[0].

I could fix it by setting one of the alarms to Alarm[1], but seeing that I've only a limited amount of 9 Alarms, I think there should be an easier solution to solve this problem.

So far I've tried Event.inherited() on the child alarm, but that didn't solved the problem.

Is there a way that a child's Alarm will ignore the conditions of the parent alarm?

sentences:
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:
Why does masked animation look so strange? I have an idle and a shooting animation.
Both animations are perfectly tailored to my model.
The idle animation looks like this:

And the shooting animation looks like this:

I have 2 animation layers:
The "Base" layer plays the idle animation.
The "Pistol Shooting" layers plays the pistol shooting animation, and it has an avatar mask because it should only influence the upper body.
The results however look like this:

What might be wrong here? What could I check?

sentences: Unity2D: Click to move Snake Game I'm trying to create a click to move snake game on mobile but I'm having problems with the whole click to move functions and adding a body part every time my snake eats an apple. I want to make the click to move smooth you know like an actual snake is slithering around and when the snake eats an apple, I want to add another body part to my snake (maximum of body parts should be 5). Can anyone point me into the right direction or give me an example of what to do, thank you!

sentences:
Unity editor PropertyDrawer custom button I has a PropertyDrawer, everything goes fine, except one feature: I can't figure out how to add button and I use checkbox instead

using UnityEngine;
using UnityEditor;
using System.Collections;

[CustomPropertyDrawer (typeof (InteractiveObject))]
class InteractiveObjectPropertyDrawer : PropertyDrawer {

public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {

    EditorGUI.BeginProperty (position, label, property);
    position = EditorGUI.PrefixLabel (position, GUIUtility.GetControlID (FocusType.Passive), label);
    var indent = EditorGUI.indentLevel;
    EditorGUI.indentLevel = 0;
    Rect colorRect = new Rect (position.x, position.y, 40, position.height);
    Rect unitRect = new Rect (position.x + 50, position.y, 90, position.height);
    Rect nameRect = new Rect (position.x + 150, position.y, position.width - 150, position.height);

    EditorGUI.BeginChangeCheck();
    EditorGUI.PropertyField (colorRect, property.FindPropertyRelative ("show"), GUIContent.none);
    if (EditorGUI.EndChangeCheck() ) {
        RenderSettings.skybox.SetColor("_highlight", property.FindPropertyRelative ("id").colorValue);
    }

    EditorGUI.PropertyField (unitRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.PropertyField (nameRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.indentLevel = indent;
    EditorGUI.EndProperty ();
}
}

How I can add button there?

sentences:
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:
Animator.SetTrigger does not trigger an Animation I have a basic animator setup for my Unity Character which has a "block" functionality when pressing the E key. So far, so good.

However I've made a transition from "Blocking Idle" to "Blocking_React" (which means that the character was hit) using a Trigger "tookDamage" (default to false).
The problem is that the character gets hit but does not transition to "Blocking_React" animation.

Code Sample:

//From Character Controller script
if (Input.GetKeyDown(KeyCode.E) && !_isBlocking)
        {
            _animator.SetBool("isBlocking", true);
            _isBlocking = true;
        }
        else if (Input.GetKeyUp(KeyCode.E) && _isBlocking)
        {
            _animator.SetBool("isBlocking", false);
            _isBlocking = false;
        }
//------------------------
//From my Character script

public void TakeDamage(float damage)
    {
        health -= damage;
        this.GetComponent<Animator>().SetTrigger("tookDamage");
    }

And this is my transition:

Am I missing something?

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:
GestureListener's fling method doesn't get called I'm using SimpleGestureDetector from the libgdx-users Wiki as my InputProcessor. I set it in the created() method:

Gdx.input.setInputProcess(new SimpleDirectionGestureDetector(charController));

charController is my class which implements the DirectionListener interface defined in the SimpleDirectionGestureDetector class and it is responsible for moving the player character. However the character doesn't change direction when I'm performing a fling action in any direction. I've checked and the fling() method in the SimpleDirectionGesture class doesn't get called and I have no idea why, since everything seems good. What am I doing wrong?

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:
Raycast not working on touchscreen (Android tablet/phone) I have a raycast that works in the unity editor but not when I build it for Android( tablet or phone, neither work). The code I'm using is as follows:

public class DirectionalTilePlacing : MonoBehaviour {

public LayerMask levelLayer;
private int tileType;
public int Tiletype
    {
        get { return tileType; }
    set
    {
        tileType = value;
    }
    }
RaycastHit hit;
Vector2I placePosition;
// Update is called once per frame
void Update()
{
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    if (Physics.Raycast(ray, out hit, Mathf.Infinity, levelLayer))
    {
        if (hit.collider.tag == "Replaceable")
        {

            transform.position = new Vector3(Mathf.Floor(hit.point.x) + 0.5f, Mathf.Floor(hit.point.y), Mathf.Floor(hit.point.z) + 0.5f);
            GetComponent<MeshRenderer>().enabled = true;
        }
    }
    if (Input.GetMouseButtonUp(0))
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit, Mathf.Infinity, levelLayer))
            if (hit.collider.tag == "Replaceable")
            {
                placePosition = new Vector2I((int)transform.position.x, (int)transform.position.z);
                EditorManager.map.SetEmpty(placePosition);
                EditorManager.map.BrushTile(EditorManager.map.TypeToObject((Tile.tileType)tileType), placePosition, (Tile.tileType)tileType);
                GetComponent<MeshRenderer>().enabled = false;
                gameObject.SetActive(false);
            }
    }

}

}

Everything up until any Physics.Raycast line works. The idea is that there is a ray casted from the position your finger is at when touching the screen.

sentences: In gamemaker studio, how do I make text boxes? How to make text boxes in gamemaker studio?

sentences:
Why does rotating a polygon also translates it in libGDX? I'm using polygons for collision detection. Here is the code:
poly = new Polygon(verticies);
poly.setOrigin(100,100);
poly.setRotation(45);
renderer.setColor(Color.GREEN);
renderer.begin(ShapeType.Line);
renderer.identity();
renderer.translate(poly.getOriginX(), poly.getOriginY(), 0);
renderer.polygon(poly.getTransformedVertices());
renderer.translate(-poly.getOriginX(), -poly.getOriginY(), 0);
renderer.end();

Result, polygon is rotated, but it moves to the right. Here is the picture for 0, 30, 45, 60 , 90 degrees (from left to right). What am I doing wrong?

sentences:
2D Spatial partitioning alternatives to spatial hashes and quadtrees I've been trying to implement a spatial partitioning algorithm in my game, but both spatial hashes and quadtrees aren't what I'm looking for.

My level size is not supposed to have a limit (only Int32 limits). I need a spatial partitioning algorithm that doesn't need a "Level Width" and a "Level Height".

I have many moving physical objects. I need the algorithm to be fast enough to support 500+ objects.

Any alternative?

sentences:
In Unity, how do I make a 3D flight arc preview? I'm stuck on how to make a preview trajectory for a projectile appear when holding a button. The trajectory should start at a certain position on the scene and end wherever the player points their mouse. On mouse click, a projectile should be launched along that trajectory with the clicked position as its target.

How can I do this?

sentences:
Basic 2D game collision I've been trying to program a game for the past while and I can't ever figure out one thing: collision detection. I can get up+down and left+right to work, but when I put them together, they interfere with each other.

I seriously don't really know how to do it, and I don't want to have to use Box2D or any other premade collision detection system. All I need is something simple and will work in 4 directions.

Here's the code I have now from my Player class:

for (int i = 0; i < blocks.size(); i++) {
            Block b = blocks.get(i);

            if (isCollidingDown(b)) {
                b.doTopCollision(this);
            }

            else if (isCollidingUp(b)) {
                b.doBottomCollision(this);
            }

            else if (isCollidingLeft(b)) {
                b.doRightCollision(this);
            }

            else if (isCollidingRight(b)) {
                b.doLeftCollision(this);
            }

        }

Here's the actual detection code. I know it's long, but just roll with it:

public boolean isCollidingDown(Block b) {
        if ((Float.compare(this.yPos,b.yPos+b.height) <= 0) && (Float.compare(this.yPos,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)>=0)) {

            if (((Float.compare(this.xPos, b.xPos)>=0) && (Float.compare(this.xPos, b.xPos+b.width)<= 0)) ||
                    ((Float.compare(this.xPos+this.width,b.xPos)>=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0))) {

                    return true;

            }
        }
        return false;
    }

    public boolean isCollidingUp(Block b) {
        if ((Float.compare(this.yPos+this.height,b.yPos) >=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0) && (Float.compare(this.yPos,b.yPos)<=0)) {

            if (((Float.compare(this.xPos, b.xPos)>=0) && (Float.compare(this.xPos, b.xPos+b.width)<= 0)) ||
                    ((Float.compare(this.xPos+this.width,b.xPos)>=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0))) {

                return true;
            }
        }
        return false;
    }

    public boolean isCollidingLeft(Block b) {
        if ((Float.compare(this.xPos,b.xPos+b.width) <=0) && (Float.compare(this.xPos,b.xPos)>=0)) {

            if (((Float.compare(this.yPos, b.yPos)>=0) && (Float.compare(this.yPos, b.yPos+b.height)<=0)) ||
                    ((Float.compare(this.yPos+this.height,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0))) {

                return true;
            }
        }
        return false;
    }

    public boolean isCollidingRight(Block b) {
        if ((Float.compare(this.xPos+this.width,b.xPos) >=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0)) {

            if (((Float.compare(this.yPos, b.yPos)>=0) && (Float.compare(this.yPos, b.yPos+b.height)<= 0)) ||
                    ((Float.compare(this.yPos+this.height,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0))) {

                return true;
            }
        }
        return false;
    }

Note that I had to do this Float.compare() thing because floats aren't accurate when comparing. Also, I'm not using Java2D, I'm using a framework called libgdx. That shouldn't matter though.

What can I do? Thanks!

EDIT: Guys, that's not the point. I know my code is very unprofessional, but the point is that the collisions don't work the way they're supposed to. I just need a 4-way collision system with boxes. That's all.

sentences:
What alternatives exist of how an agent can follow the path calculated by a path-finding algorithm? What alternatives exist of how an agent can follow the path calculated by a path-finding algorithm?

I've seen that the most easy form is go to one point and when the agent has reached this point, discard it and go to the next point.

I think that this approach has problems when the game has physics with dynamic objects that can block the travel between point A and point B, then the agent is taken from his original trayectory and sometimes go to the last destiny point is not the most natural behavior.

In the literature always I have read that the path is only a suggestion of where the agent has to go, but I don't know how this suggested path must be followed.

Thanks.

sentences:
Game runs at different speeds in Chrome versus Firefox I am using Box2D for physics on the server side.
Player position is updated on the server, so there is nothing the client can do except give input.

But running game in Chrome only, the player moves faster as compared to running in Firefox only.

If running in both browsers (one player in each browser), then the game in both browsers runs at the speed at which it runs in Chrome.

Using this update loop:

function update() {

    for(let p of players){

        if(p.dead) continue ;

        p.keyEvents();

        aabb.lowerBound.Set( p.body.GetPosition().x-p.s_w/(2*scale),p.body.GetPosition().y-p.s_h/(2*scale) );//top left
        aabb.upperBound.Set( p.body.GetPosition().x+p.s_w/(2*scale),p.body.GetPosition().y+p.s_h/(2*scale) );//bottom right
        world.QueryAABB( ReportFixture , aabb , p.id );
        p.socket.emit('players',foundPlayers);

        foundBodies.players=[];

    }

    world.Step(
       1 / 60   //frame-rate
        ,  8       //velocity iterations
        ,  3       //position iterations
    );

    if(deletePlayerIds.length>0){
        deletePlayer();
    }

    world.ClearForces();
}

setInterval(update, 1000/60);//to call update loop

I have read that for Box2D there is no need to apply a delta.

What could be the reason for different speeds, and how it can be resolved?

sentences:
Unity prefab object limitations TLDR: What are limitations on how many objects a single prefab can handle safely? keeping in mind that I could potentially have almost a 100 of these

I am busy creating a system to essentially load the game world in chunks as the player moves.
This means that every single object in the world will be streamed into the game through script when needed(still designed in the editor, impossible otherwise)
The problem I am having is with methods to store and load objects.

I have looked at everything I could think of or get information on. After researching all the methods I found, I started thinking that prefabs is the best solution since it can live anywhere in the project(unlike streaming assets folder, which is also not recommended for many assets, let alone every single asset). Creating Game Objects at runtime is not as easy once GO's get complex with components and settings, also I assume the performance hit from creating GO's this way is worse than using an existing prefab.

So my question is if prefabs can handle massive amounts of objects(lets say 1000) safely? testing this is hard because i would have a prefab(or a few) for each tile that gets loaded.

sentences:
How to do score systems, combos, multipliers, chains, etc I am designing a game, but I am having some trouble implementing a decent score system. Basically I have nodes with two different possible characteristics: color and shape. Since the player click from node to node, I want to award more points to the players which hit the same shape, same color or both, like: (SAME SHAPE x 3! AWESOME!, SAME SHAPE AND COLOR x 5! ARE YOU A WIZARD?!).

However I am having a lot of trouble implementing this. Can someone point me in the right direction or show me algorithms that can do this?

sentences:
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:
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:
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:
Algorithm for 2d AI aiming to compensate for gravity In a 2d side-view scenario I have two riflemen aiming at each other. By normalizing the x and y difference they know the direct path to the enemy.

However, gravity will pull the projectiles downwards, so aiming straight for the enemy is obviously useless.

Any interesting ideas for AI-logic when it comes to adding a correction based on world.gravity (which is a "force" in y-pixels per physics tick) and enemy.path (libgdx Vector2 with the X and Y difference to the enemy. Weapon.muzzleVelocity could also be factored in (double, speed in pixels after the shot is fired.

I've been thinking of two things:

Option 1 - Magic numbers

The X distance is multiplied by a magic number (such as gravity) to produce a reasonable close result to an aiming offset. Possibly also factoring in Y-distance, but in most cases, the Y distance should be close to 0.

Pros: Simple, easy to implement, quick, low calculation overhead

Cons: Boring, A bit too arcade for my taste with a very static result, Been done before countless times including by me in previous projects

Option 2 - Firing table

AI trial and error, basically. Each time the unit fires, the X (and Y?) distance of that shot is recorded with the offset used, and the result (hit vs too low vs too high) is registered. Each time the unit fires it'll look up for the closest match to the x-distance to get a rough estimate on aiming offset.

Pros: Units become more valuable as they learn, it's a lot more modern, and it makes sense to me.

Cons: Unit types with low rate of fire will not have much use of their firing table. It's also somewhat complex to implement and will cause a much larger memory footprint as the firing table grows.

For the record, I'm writing this in java/libgdx, mainly targetting the android and HTML5 platforms, but if it turns out to be decent, ports are expected. I'd love to hear other ideas for how a unit can come up with an aiming offset, as well as pros/cons. I have to pick something, and I'm not entirely convinced either of my own algorithms are right for the task.

sentences:
Drawing game app: How to use vector graphics instead of bitmap in Android? I have a problem concerning the concept of using vector graphics instead of bitmaps in order to draw on canvas. Usually to draw on canvas we set a bitmap to that canvas and we start drawing pixels on it by simply moving our finger on the screen. However, this method will result very pixelated - relatively low-quality drawings.

It is noteworthy that there are some drawing apps that result in very smooth curves when you want to draw via them. After doing some googling and researching, I knew that there is the new concept of use vector graphics that is being used in order to draw smooth edged drawings on the screen.

Look guys, the thing is when I developed my drawing app, I used bitmap **(which was already there as an object given by Android)**in order to draw cubic Bezier curves. No matter how much I tried to smooth my drawings out, I always get stair-like edges.

If you are interested in how I developed the curve, please read this. If not, just ignore this bold paragraph:

In order to draw the cubic bezier curves I simply took the sampled touch points and for every 4 points in these sampled points I calculated the 2 intermediate control points (the ones that the curve never touch) to create a bezier through the sampled points. For the curve to appear, I used bitmap and paint objects given by android.

After getting the undesired result (low-quality curve), I decided that I want to use vector graphics in order to do the same thing but with a higher quality. The thing is that I am very new to Vector Graphics, that I don't know where to start.

My question is simple as is:
Is there a platform given to me by Android in order to use vector drawable like in the case of bitmap? If not, am I supposed to start this from scratch? I am clueless and any tip or hint from you will be greatly appreciated.

sentences:
What is Purpose of pIntermediate in UpdateSubresources? DX11 used ID3D11DeviceContext::UpdateSubresource but now DX12 seems to use a new method UpdateSubresources.  I think I can figure out most of the differences between these two functions but the pIntermediate parameter of the new function has me particularly confused.

Can someone help me understand what this new pIntermediate parameter is for?

I noticed the VS2015 Template I'm trying to work from sets up a local variable named vertexBufferUpload in a CreateDeviceDependentResources method which later uses it in an UpdateSubresources call; unfortunately, by the time I want to call the new UpdateSubresources method, the vertexBufferUpload variable is long out of scope.

sentences:
Separating logic/update from render/drawing code in a single thread using sleep I've read that the speed of game objects should not be hindered by FPS but instead should be based on time. How can I seperate the update/draw code to maximize performance without limiting the drawing rate and provide a constant logic update rate based on time?

My current pseudo code is as follows

loop
{
    draw();
    if (ticksElapsed() > 100)
    {
        update();
        ticks+= ticksElapsed();
    }
}

The problem is the drawing code hinders the performance of the update() rate. And it consumes 100% cpu because if sleep is thrown in, it throws off both drawing/logic functions.

I am also using SDL and it doesn't seem to have a vsync option. I've also heard of the terms fixed and variable time-stepping however I'm not sure how that can be done with sleep()

sentences:
I can not proceed to my room menu using photon in unity when i use PhotonNetwork.JoinRoom() I have a TextMeshProUGUI called EnterRoomName and I am trying to enter the name of the room that I'm supposed to enter, but it's not working.
This is my function:
public void JoinRoom()
{
     PhotonNetwork.JoinRoom(EnterRoomName .text);

     MenuManager.Instance.OpenMenu("loading");
}

sentences:
character movement data passing on server I am trying to build my first online game using unity with photon, the data transfer between server and clients is implemented but I am facing a great problem; How/What should be transferred to synchronise the movement data?

My game has a lobby and may have as many as 20 people online at the same time if I pass the position of every players to server and then server to clients, I believe the server would be overloaded, wouldn't it?

Hence I think an other way is to pass the movement of characters:
1) only when a player presses a movement key, then pass it to server and other clients,
2) if the player releases the key, then pass the position for validation.
It is workable?
Will there any inconsistency between the clients?

I Hope someone can give me some advice, Thank you!

sentences:
How do I add the "tween-engine-api" to my libGDX game? I finished now my first game at LibGDX (I am using Eclipse). I run the game in the desktop launcher and it works. I now want to run my game on Android and iOS.

From some guides I have read, I understand that for running the game on devices I must have the tween-engine library in my project. I tried but couldn't add it to my project.

Can someone help me? (I already tried to do that at "add jars", but it only shows me my project and not the tween-engine library)

sentences: How do I import real world models into a game engine? What are the hardware and software tools required to import physical worlds into a game engine? Can I use a HD camera to do that? What do the popular game engines support?

sentences:
Is white the best base color to start with when planning to shade sprites within Unity? I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the game.

I figure that I can import a single square sprite and shade it appropriately in Unity as opposed to imported squares of many different colors.

My experience with adjusting the hue and saturation within Photoshop shows that white is not an easy color to change as things that are white often stay white. My testing in Unity shows that I can change the "color" of a sprite to anything other than white and the sprite is seemingly shaded appropriately, despite what I would have thought given my Photoshop experience.

Since white objects do seem to take on the appropriate color shading when changed within Unity my gut tells me that this is the best base color to begin with, meaning that I can import a single white square sprite and simply adjust the color to represent different objects and object states.

Is a white sprite actually the best color sprite to begin with and why does something like this work in Unity as opposed to adjusting the hue and saturation within Photoshop?

sentences:
3D Object in 2D Unity Project Is there a way to bring 3D objects into a 2D project that is using the 2D Universal pipeline for rendering light? I have some 3D objects I want to bring in to the project I'm working on, but they just get imported as pure white.
Is there a way to import 3D models into a 2D game, and keep the 2D pipeline for lighting? I'l tried a few different shaders, but if they're not pure white they're pink. I would like them to have shading as a 3D object, and still interact with light and rotate on all axis if possible. If it's impossible to use a 3D object, if there was a way to at least have a 2D sprite taken from a 3D object, but still react to light as if it were 3D, that'd work too I suppose. This is what it looks like,
https://i.stack.imgur.com/HJeIN.jpg
I've also tried adding 3D lights as well, but to no avail. I'm guessing the issue is because of my 2D lighting renderer, and for the record, this is what this tree looks like in a 3D project.
https://i.stack.imgur.com/nKCyd.jpg
I have since attached a custom shader graph to it that I made, it looks okay, but it still doesn't receive shading at all...
Thanks in advance.

sentences:
Smooth Camera Movement Java So, I'm making a platformer game from scratch in Java and I am trying to make the camera movement smoother. Here is what it currently is

public class Camera {
    private int x, y;

    public Camera(int x, int y) {
        super();
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void tick (GameObject player) {
        setX((int) (-player.getX() + Reference.WIDTH / 2 + 16));
        setY((int) (-player.getY() + Reference.HEIGHT / 2 + 64));
    }
}

It moves too strictly and it always centres the player to the screen, I don't like it.

I tried watching this video, but it's in GameMaker. Any way to translate this to Java?
https://youtu.be/6cIN6iW5ois

Any help would be appreciated,  thanks! :)

sentences:
smoothly recenter view over time I'm currently using the Google Cardboard SDK for Unity to build a fighter pilot simulator. What I'm currently trying to do is recenter the view(CardboardHead) smoothly over time when the user looks away from the screen. This is because I want to put HUD elements out of the main central view that can be quickly seen with a "head jerk". I don't want to let the camera be free from constraints because I feel piloting is much better when the view is fixed and doesn't wobble about with every slight movement of the player's head. The Head already has a horizontal constraint that does not allow any later movement, but now I want to put a semi-constraint on the vertical axis so that the player can quickly look up or down to see something like i.e. a fuel economy indicator and then have the view quickly "follow his gaze" and recenter itself.

I noticed that the Cardboard plugin already does this type of constraint on the Head roll input when playing "in editor" and works as follows:
When you press and hold Ctrl and move the mouse left/right the  view rolls left/right. Upon release of Ctrl the view smoothly rolls back to 0.
This is the code in the Cardboard script:

bool rolled = false;
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) {
      rolled = true;
      mouseZ += Input.GetAxis("Mouse X") * 5;
      mouseZ = Mathf.Clamp(mouseZ, -80, 80);
    }
    if (!rolled && autoUntiltHead) {
      // People don't usually leave their heads tilted to one side for long.
      mouseZ = Mathf.Lerp(mouseZ, 0, Time.deltaTime / (Time.deltaTime + 0.1f));
    }
    var rot = Quaternion.Euler(mouseY, mouseX, mouseZ);
    var neck = (rot * neckOffset - neckOffset.y * Vector3.up) * NeckModelScale;
    headView = Matrix4x4.TRS(neck, rot, Vector3.one);
  }

How could I implement this for vertical rotation of the Head?

In the Update method of the script that controls the Head it simply does transform.localRotation = Cardboard.SDK.HeadRotation;

This is what I've tried but it doesn't really do anything except some jerky movements:

transform.Rotate(new Vector3(Mathf.Lerp(rot.eulerAngles.x, 0, Time.deltaTime / (Time.deltaTime + 0.1f)),0,0));

(I put this in the same Update function for the Head after the above line)

Any ideas??

sentences:
OpenGL VBO Additional Attributes If I have a buffer with my vertices, normals and texture coordinates, and I use glDrawArrays to draw the VBO to the screen, how can I send attributes per vertex that I placed in an array to the shader program? I'm making a voxel terrain, and every chunk is 1 VBO, this works all great, but I want to send the light value of each block (Just an array filled with int's) to the shader as well, how would I do that?

Edit: After reading some comments, here some clarification:
I'm trying to avoid the deprecated glVertexPointer etc, so I'm using Vertex Arrays. Here is the layout of my vertex array:

X, Y, Z, NX, NY, NZ, X, Y, Z, NX, NY, NZ,X, Y, Z, NX, NY, NZ

I'm using this to draw it: (ofcourse with the array buffer bound)

glVertexAttribPointer(0, 3, GL_FLOAT, false, 12, 0);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 12, 12);

glDrawArrays(GL_TRIANGLES, 0, arraySize / 6);

However I get some weird shapes on my screen. Apart from the light problem, that is essentially the same thing, I don't get why this doesn't just work. When I remove the normals, and use just 1 vertexattribpointer it works fine. Yes, the attributes are bound to in_position and in_normal, and the vertex shader is nothing more than gl_Position = gl_ModelViewProjectionMatrix * vec4(in_position, 1.0);

Thanks!

This is what I get:

(This are 6X6 chunks, so this code is called 6*6 times.)

sentences:
What are "frame A" and "frame B" in btGeneric6DofConstraint's constructor for? I have a very simple (and maybe too primitive to post here but I’ll try anyway :P) question about Bullet constraints. What are arguments const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA of Bullet’s btGeneric6DofConstraint? Documentation doesn’t say anything about them.

I think (but am not entirely sure) that the first two are Pivot Point Transformations relative to mass-center of two rigid bodies (in their own coordinate systems). And thus they should always point to the same point in world-space. Is that true?

Also, what is Linear Reference Frame?

sentences:
How to make a custom inspector component I have a script component, but I want to know how I can add things like sliders buttons etc.

I wrote a grid system that generates at the start of my script but I want to run it in editor when I push a button to not to force calculations, lessen load times for my game and even see result of my work in editor. How can I do that?

sentences:
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:
Changing default folder structure of New Project in Unreal Engine? I wonder is there a config option to change the default folder structure of a new project.

So for example when I create a new project there is already a folder for 'Blueprints', 'Maps', 'Audio' and 'FBX' sitting in my Content folder.

The reason I ask is it's usually the first thing i do after i create a new project.

sentences:
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:
Rotate mesh to normal I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with.
So head pixel in my texture is a normal and I want to rotate each instance with the corresponding normal in a shader. How can I achieve that in a shader only?
Unless I am mistaking, there should only be a rotation around the X and Z axes.

sentences: Should I use XNA or Unity to build a video game? My friend and I are planning to make a video game (like Slender) where the character is stuck in a building, when lightning strikes, and the lights go out and your objective is to find the back-up generators and turn the lights back on. The game will be pretty small.We are now wondering whether we should use Unity or XNA to build it. I have no experience in either, and I will mostly be writing in C# (which both have that capability). My friend will be drawing the images, and we want to import the images into the game. Which software should we use? What are the pros and cons of each? Thanks in advance.

sentences:
Objects don't instantiate at mouse position I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater).

Here is relevant part of my code:

var shotSpeed = 1000;
var projectile : Rigidbody;

function Update () {
    var clone : Rigidbody;
    if(Input.GetKeyDown(KeyCode.Mouse0)){
        clone = Instantiate(projectile, transform.position, transform.rotation);
    }
    clone.rigidbody.AddForce(Vector3.forward * shotSpeed);
}

What am I doing wrong?

sentences:
Collision Avoidance/Steering around moving obstacles I've done a decent amount of research and I've read up on pathfinding algorithms and such, but I can't seem to find anything to do with the mentioned behaviors when moving around obstacles that also move.

My character has a circular hitbox, as do the obstacles. My character has a fixed velocity, but can also come to a full stop. My character can also change directions near instantly. Acceleration/deceleration of my character is instant. I can predict, with 100% accuracy, where the obstacles will be; I know their velocity, starting position, and ending position. Obstacles are generated by the user, move at a predetermined velocity (depending on which obstacle it is), and have a predetermined length (again, depending on the obstacle).

I want my character to path from point A to point B while moving around all the obstacles (with no collisions). Point A is where my character currently is, and point B is a user picked point which might change at any time (edit: Pathfinding itself isn't the issue; it's just local collision avoidance that I need to deal with).

Let me know if you need any more info; I don't know what is needed!

sentences:
Rendering three-dimentional array of tiles (as a tilemap) I'm trying to create 2d game engine in C++ using SDL2 (actually some code was migrated from SFML). I want to have a flexible multilayer tilemap that can store different types of tiles. My current version of this kind of map uses three-dimensional array of pointers to base class of tiles ("tilemap").

First of all - is it even a good approach?

I'm using pointers to make tiles polymorphic (eg. ground tile (tile_basic) has it's act number and texture id, but chest tile (tile_chest) has also a list of items in it). However scanning trough this array every time when I'm rendering my map would take a lot of time. So I'm scanning trough three-dimensional array of sprites (drawable objects) which is generated from the tilemap every time when new sprites are meant to be shown on the screen.

std::vector<std::vector<std::vector<mg::CompactSprite> > > sprites;

The first two dimensions are quite constant, they depend on the size of the application window. When moving the camera sprites move up to their size (width, heght) and when they are about to exceed this limit, their coordinates reset (x, or y, depending on which direction the camera is moving), getting it into simple words - I'm using modulo.

The problem is that this is terribly slow (~43ms with 23x18 map with only few layered tiles; using SDL2, similar results with SFML). I know I could render the whole visible area to the one image and just move that image and then render only new areas, but then I won't be able to make animated tiles without listing their coordinates, checking if they are in the visible area and then rerendering them which sounds bit overcomplicated, and I'm not quite sure if it'll really boost the rendering process.

So is there any better way to do this? Or I should change my approach?

sentences:
Is it possible to billboard a sprite using a transformation matrix? None of the current topics on billboarding seemed to answer this question.

But, given

a sprite (or quad) that has it's own 4x4 transformation matrix
a camera with a view matrix (a standard 4x4 transformation matrix)

is it possible to compute a 4x4 transformation matrix such that when the quad's matrix is multiplied with this matrix it has an orientation of looking at the camera?

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:
How to clamp player movement correctly? I have a 2D space shooter game. I looked up some questions from unity community and came across this solution. Below is the code for my player's movement:

//horizontal <- || -horizontal ->
//vertical down || -vertical up
float h = -Input.GetAxis ("Horizontal")*speed;
float v = -Input.GetAxis ("Vertical")*speed;

// do not let the ship get out of the camera
Vector3 viewPosition = Camera.main.WorldToViewportPoint(transform.position);
viewPosition.x = Mathf.Clamp01(viewPosition.x);
viewPosition.y = Mathf.Clamp01(viewPosition.y);
transform.position = Camera.main.ViewportToWorldPoint(viewPosition);

transform.Translate (h, v, 0);

I understand these functions as 0,0 being the left bottom of the camera and 1,1 being the right top. Therefore clamp01() is used. But with this code, half of my ship gets out of the screen, which is not what I want. How am I supposed to manipulate the clamp01 function so that the entire ship of the player stays in the camera scene?

Another workaround I thought was using the screen width and height and the regular clamp() function as follows:

transform.Translate (h, v, 0);

Vector3 tmpPos = transform.position;
tmpPos.x = Mathf.Clamp (tmpPos.x, -Screen.width / 2, Screen.width / 2);
tmpPos.y = Mathf.Clamp (tmpPos.y, -Screen.height / 2, Screen.height / 2);
transform.position = tmpPos;

However I get the Screen.height as 428, although the camera sees the interval of [-10, 10]. How am I supposed to clamp the movement independent of the game resolution, i.e. not using global positions but using relative positions so that I will be able to clamp correctly player's ship whatever the resolution of the game is?

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:
Point plotting with a line graph Please see attached screenshot.

Here's how it works.

A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point.

B is another slider, but this goes left and right (stops in the middle as shown below).

The current issue is, the red line should always rest on top of B like a see-saw. Currently the line's end point has a fixed x position so it is always in line with the green crosses below to the right. But I need to position the end Y point of the line correctly so that the line as a whole is resting on top of B at all times. Whether the user slides A or B.

My guess is I need to work out some form of distance calculation with angles. I have something along the lines of:

Called 60fps:

this.startPoint.x = this.verticalSliderModel.xPos;
this.startPoint.y = this.verticalSliderModel.yPos;
this.endPoint.x = 653;
this.endPoint.y = this.horizontalSliderModel.yPos;

var angle = Phaser.Math.angleBetween(this.startPoint.x, this.startPoint.y, this.endPoint.x, this.endPoint.y);

this.seeSawController.updateModel(this.startPoint, this.endPoint, angle, width);
this.seeSawController.updateView();

I then use html canvas to draw the line:

update(start:Point, end:Point, angle:number, width:number) {

    this.bmd.clear();
    this.bmd.ctx.beginPath();
    this.bmd.ctx.moveTo(start.x, start.y);
    this.bmd.ctx.lineTo(end.x, end.y);
    this.bmd.ctx.lineWidth = 4;
    this.bmd.ctx.stroke();
    this.bmd.ctx.closePath();
    this.bmd.render();
}

So yeah I want to calculate the green cross plot points moving forward.

sentences: Unity set ui image as active onclick I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just starting out and a little lost. I think some guidance here could really set me in motion. Thanks!

sentences:
16-Bit textures in XNA 4 on WP7 WP7 textures are supported in the Reach-Profile that WP7 devices falls into. But XNA converts all my ressources upon adding them to a project to RGBA8, that's insane, the displays of WP7 devices are 16 Bit!

Information: WP7 SDK 7.1 (XNA 4), Visual Studio 2010

Question part 1: How can I add a RGB565 texture to a XNA project and what is the correct way to load them inside a game?

Question part 2: Is there a reasonable 16 Bit texture format (within Reach) that supports alpha with MORE than 1Bit?

Question part 3: Is the normal rendertarget (I think that's what the screenbuffer is?) already 16 bit?

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:
Unity 4.6 New GUI Issue with GIT I am using Unity 4.6 new UI. I have my project setup on bit bucket (using GIT). It was working fine but when I cloned the project on another macbook. All the unity new UI scripts went missing. Is there any workaround for this issue ?

I am using same unity version on both macbooks. Editor Settings screenshot attached

Ref of inspector where scripts went missing.
[Editor Settings

sentences:
Unity - Manually sync location of players from server to client I am new to Unity networking. I've set up my scene with NetworkManager and the Player prefab having NetworkIdentity. I originally had my players set up to sync with a NetworkTransform. This worked, but the objects were very choppy whenever they were children of a moving object.

In order to fix this issue, I've replaced NetworkTransform with a class extending NetworkBehavior, using UnityEngine.Networking, and containing the following code to sync localPosition:

void Update () {
    CmdSyncPos (transform.localPosition, transform.localRotation);
}

[Command]
protected void CmdSyncPos (Vector3 localPos, Quaternion localRotation) {
    transform.localPosition = localPos;
    transform.localRotation = localRotation;
}

This works really well! The only problem is that this is one-way, the server now has the updated position of all clients but the clients only have the updated  versions of themselves.

How can I do this in reverse: Manually sync the location of non-local players from server to client?

sentences:
Blending transition in cocos2d In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites.

I would like to make a smooth transition between them:

Initially, only the first background is visible
At the end, only the second one is visible

Is there a good way to set the opacity of a full hierarchy of sprites ?

I tried to recursively set the opacity of all the contained sprites. It kinda works except that:

I guess it's not very efficient
I would like the opacity of overlapping sprites to be 'merged' (as if the background was one single big sprite)

sentences:
How do I make my foreground tiles stand out more from the background? (the background implemented in the game)

In the game that I work on, the background and the map tiles are pretty indistinguishable for new players, probably because they have similar colors and theme.

Are there any tips or tricks to make the background more like a background and be distinguishable from the map tiles?

The game has motion blur which kinda helps, when the player is running the background gets blurry therefore making it more distinguishable from the map tiles.
However, that is clearly not enough.

Any suggestions, tips or tricks will be greatly appreciated!

(purely the background)

EDIT: Thank you for the suggestions and the ideas! here are some variations of this background that I came with.

(darker and way more blurry)

(dawn colors and some blur)

(one of the coolest things I've done + blur)

(one of the coolest things combined with dawn colors + blur)

sentences:
What is inertia in a physics engine? Inertia seems to be useful in a physics engine, so useful that even in Box2DLite, a demo of Box2D it hasn't been omitted.

See this Body class from Box2DLite:

struct Body
{
    Body();
    void Set(const Vec2& w, float m);

    void AddForce(const Vec2& f)
    {
        force += f;
    }

    Vec2 position;
    float rotation;

    Vec2 velocity;
    float angularVelocity;

    Vec2 force;
    float torque;

    Vec2 width;

    float friction;
    float mass, invMass;
    float I, invI; //inertia and reverse inertia
};

In the implementation of the class, inertia is set as the mass multipled by something:

I = mass * (width.x * width.x + width.y * width.y) / 12.0f;
invI = 1.0f / I;

What does this formula means ? I understood from wikipedia that Inertia is how much something doesn't want to move but there's not much formulas in this article. Why is it useful in a physics engine ? How is it used in the context of a collision ? Is it compared to other bodies ?

sentences:
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:
Playing Video In MonoGame I'm trying to play a video in a monogame project. I've done this in XNA in the past by including the Framework.Video directory and it's very simple. This cannot be done in monogame as Visual Studio 2012 wont accept the XNA directories.

I've not been able to find any other way explained anywhere if you can actually put video in monogame yer and if you can how it's done.

Any ideas?

sentences:
How should I adjust starting sample position of audio track to match next buffer fill? I've written my own audio mixer. For Linux/Windows, my game uses SDL. On a small handful of Linux machines (including my laptop), SDL has a bug where it allocates a ridiculously large (about 120 milliseconds) audio buffer. While I'm not to the point that I care so much about affected machines, it points out a problem I'd like to solve.

The problem is that when an event occurs that triggers an audio track to be played, I've already written audio for a small portion of "the future." In other words, I can't really play something "now." If I wait until the next audio buffer fill and start playing this track at sample position 0, I will effectively create a small lag period before the track is heard. With the enormous buffer size mentioned above, this is very noticeable.

One approach I've come up with is to estimate how many audio samples the track would play between "now" and the next sample I can give to the audio buffer. However, this would be incorrect if the game were to be paused/resumed or even slowed down, and this introduces some added complexity to the mixing code.

Is there a standard way to solve this problem, and/or do you have any helpful ideas?

sentences:
unity2D Top-Dow Mobile rigibody2D im using this code for my 2D TopDown mobile player movement.but when i move player With UI Image buttons player keep moving.it didnt stop.and also player starting of move he is very slow. the he accelerate his speed.how can i fix this.

i add BoxCollider 2D and Rigibody2D my sprite.the set Gravity to 0.

this is my code.

    public class PlayerScript : MonoBehaviour {
public float speed = 150f;
float hInput ;
void FixedUpdate()
{
    Move (hInput);

}

public void Move(float horizontalInput){
    if (horizontalInput.Equals(1)) {
                    rigidbody2D.AddForce (Vector2.right);

    }if (horizontalInput.Equals(2)) {
        rigidbody2D.AddForce (-Vector2.right);
    }if(horizontalInput.Equals(3)) {
        rigidbody2D.AddForce (Vector2.up);
    }
    if(horizontalInput.Equals(4)) {
        rigidbody2D.AddForce (-Vector2.up);
    }
    }

    public void StartMoving(float horizontalInput){
    hInput = horizontalInput;
    }
    }

sentences:
Problem getting information about running processes with .GetProcesses() in Unity3D on OS X I was going to ask this on Unity Answers, but I keep getting an error when trying to get to the site so thought maybe you guys could help. I've also tried the Unity3d subreddit and didn't manage to solve this there either.

I am attempting to get a list of all running processes on my Mac from my Unity application. The final idea is to check if certain applications are running (eg, TextEdit).

I first tried checking for an open application with GetProcessByName, but got this exception even though the process is running:

InvalidOperationException: Process has exited, so the requested information is not available.

Then I decided to go as simple as possible. I figured I'd just print out a list of all running processes to start off with. Here's my code:

    Process[] processes = Process.GetProcesses();
    GUI.Label( new Rect(x, y, 100, 20), "Process: " + processes.Length );
    y += 20;
    foreach (Process process in processes) {
        try
        {
            if (!process.HasExited)
            {
                GUI.Label( new Rect(x, y, 100, 20), "process: " + process.ProcessName );
                y += 20;
            }
        }
        catch (System.InvalidOperationException)
        {
            UnityEngine.Debug.Log("Holy batman we've got an exception!");
        }
    }

When I run this through the editor, here's what I see:

The number of running processes tends to fluctuate around the 200s, but the only process name being printed on screen is Unity.

If I try to print all processes by removing the HasExited if statement I get this (of course they don't all fit on the screen):

Which makes me think that it thinks every process except for Unity has exited...but I have quite a few unterminated processes running, so I wonder why it's not listing those? Basically I need to search through all currently running processes. Any ideas? Is there some sort of permission issue with not being able to access properties of external non-Unity processes?

EDIT: I should note that I've tried this both while running through the editor and after building. When run after building with !process.HasExited one process is listed with a blank name. I guess that might be the currently running application. The process count hovers around 240.

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:
How can I move an object around a canvas in a random direction at random times? I am currently trying to move an object (circle ball) around the canvas in a random direction.

I have already written the code for the wall collisions so the ball bounces back into canvas when the ball hits any of the canvas sides.

The canvas size is 600 x 500

in order to move the object around the canvas I have used;

   xPosition += ySpeed;
   yPosition += ySpeed;

From the code above, the ball moves from one end to the other end of the canvas in the same angle and direction, then bounces back at a different angle.

How can I go about doing this, if I wanted my object to move in the same speed but in a random direction around the canvas.

Any help is appreciated, thanks!

sentences:
Rearranging projects in Git and Unity I'm attempting to rearrange a Unity project that is under source control. Two problems:

In order to maintain the relationships between assets, I need to use Unity's API or interface. But when I move something that way, git loses track of them.
In order to maintain git tracking, I need to use git commands. But when I move them that way, Unity loses track of how they're related.

Is there an easy way for me to tell one what the other is doing?

sentences: Causes of screen tearing and vsync Is there an explanation of whats going on from the software down to the hardware that explains tearing? One would think that the graphics card would just tell the LCD display to change whenever it wants to. Why do LCD displays have refresh rates at all?

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:
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:
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:
Difference between CC BY-SA 3.0 and CC BY 3.0 Comparing CC BY-SA 3.0 and CC BY 3.0, both permits that you share ou even modify the material, under the term that you give credit, link the license and inform in case of any changes.

But in CC BY-SA, if you transform the material, those modifications should be distributed under the same license (or a compatible one, if I got it right). CC BY does not have such a term.

So, what's that mean? If someone got my game under CC BY, can they change it and distribute it under a different license, even a closed-source license?

In the case of CC BY-SA, in the same scenario, this version should be distributed as CC BY-SA as well?

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:
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:
Unity 5.6 - Where have Sun Shafts disappeared to? I've just upgraded to Unity 5.6 from 5.4. I need to add some Sun Shafts to my camera but I cannot find the script anywhere.

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

Has anyone else had this problem at all?

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:
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:
How to get LineRenderer coordinates? I am trying to get the coordinates or positions that are generated at the time I draw with linerenderer, but it gives me an error.

This may be a rookie mistake and I am not using the Linerenderer's methods well. I would be very grateful for your help.

LineRenderer.GetPosition index out of bounds!
UnityEngine.LineRenderer:GetPosition(Int32)
sendData_Figura:Trazo(Int32) (at Assets/sendData_Figura.cs:115)
sendData_Figura:Update() (at Assets/sendData_Figura.cs:93)

public LineRenderer  line;
public static int contadorTrazo = 0;

void Update(){
    Trazo();
}

void Trazo() {
    line = line.GetComponent<LineRenderer>();
    Debug.Log("Trazo : "+line.GetPosition(contadorTrazo));
    contadorTrazo++;
}

sentences:
Platform jumping problems with AABB collisions See the diagram first:

When my AABB physics engine resolves an intersection, it does so by finding the axis where the penetration is smaller, then "push out" the entity on that axis.

Considering the "jumping moving left" example:

If velocityX is bigger than velocityY, AABB pushes the entity out on the Y axis, effectively stopping the jump (result: the player stops in mid-air).
If velocityX is smaller than velocitY (not shown in diagram), the program works as intended, because AABB pushes the entity out on the X axis.

How can I solve this problem?

Source code:

public void Update()
{
    Position += Velocity;
    Velocity += World.Gravity;

    List<SSSPBody> toCheck = World.SpatialHash.GetNearbyItems(this);

    for (int i = 0; i < toCheck.Count; i++)
    {
        SSSPBody body = toCheck[i];
        body.Test.Color = Color.White;

        if (body != this && body.Static)
        {
            float left = (body.CornerMin.X - CornerMax.X);
            float right = (body.CornerMax.X - CornerMin.X);
            float top = (body.CornerMin.Y - CornerMax.Y);
            float bottom = (body.CornerMax.Y - CornerMin.Y);

            if (SSSPUtils.AABBIsOverlapping(this, body))
            {
                body.Test.Color = Color.Yellow;

                Vector2 overlapVector = SSSPUtils.AABBGetOverlapVector(left, right, top, bottom);

                Position += overlapVector;
            }

            if (SSSPUtils.AABBIsCollidingTop(this, body))
            {
                if ((Position.X >= body.CornerMin.X && Position.X <= body.CornerMax.X) &&
                    (Position.Y + Height/2f == body.Position.Y - body.Height/2f))
                {
                    body.Test.Color = Color.Red;
                    Velocity = new Vector2(Velocity.X, 0);

                }
            }
        }
    }
}

public static bool AABBIsOverlapping(SSSPBody mBody1, SSSPBody mBody2)
{
    if(mBody1.CornerMax.X <= mBody2.CornerMin.X || mBody1.CornerMin.X >= mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y <= mBody2.CornerMin.Y || mBody1.CornerMin.Y >= mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsColliding(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsCollidingTop(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    if(mBody1.CornerMax.Y == mBody2.CornerMin.Y)
        return true;

    return false;
}
public static Vector2 AABBGetOverlapVector(float mLeft, float mRight, float mTop, float mBottom)
{
    Vector2 result = new Vector2(0, 0);

    if ((mLeft > 0 || mRight < 0) || (mTop > 0 || mBottom < 0))
        return result;

    if (Math.Abs(mLeft) < mRight)
        result.X = mLeft;
    else
        result.X = mRight;

    if (Math.Abs(mTop) < mBottom)
        result.Y = mTop;
    else
        result.Y = mBottom;

    if (Math.Abs(result.X) < Math.Abs(result.Y))
        result.Y = 0;
    else
        result.X = 0;

    return result;
}

sentences:
Error calling a Action Map I tried calling the event Set Destination, simply to make an impression on the game screen:

I did not succeed. I modified the 3 options displayed on the right (consume input / execute when paused / override parent binding), but nothing has changed the result.

Neither change the button that calls the event (from the right to the left or even the middle button).

I created a new input (example):

And I was able to make the impression normally:

Why can not I call the Set Destination?

I need to know a way to send a warning/signal (get reference) when this event is performed.

sentences:
Button not clickable if it's under a Content Size Fitter + Horizontal Layout Group in Unity? I'd like to make a Tooltip System/Tutorial System.
I'm using the Content Size Fitter and Horizontal Layout Group components to have a dynamic text bubble..
Also I'd like to attach a button to it,

so when the tooltip appears, the game pauses,

and then when the player clicks the button, it closes the tutorial text, resuming the flow of the game.

But for some reason the click doesn't reach the component. Not even the animation happen, like something is blocking my button from being clicked.
Hierarchy:

uiTutorialText

Has a CanvasGroup to fade the whole structure.

Interactable = true, BlocksRaycast = false

TutorialText

Has an Image (background)

RaycastTarget = false

Has a Content Size Fitter and a Horizontal Layout Group

And Text and Button are just simple plain Text and Button objects, and the Button's Interactable is true.
I also tried making the Button a child of Text, and then translating it sideways, so the button doesn't share screen space with the tooltip. But it's not clickable this way as well.
As soon as I move the Button out of the hierarchy, like directly under the canvas, it works.

sentences:
How can I develop in MonoGame without relying on .xnb files? I'm new to game development, and MonoGame seems like a beginner-friendly framework, so thought I'd start with that. However, as I started reading tutorials on it, I noticed a common theme: That at its current state, MonoGame needs XNA's content compiler since it doesn't have one of its own. The only problem I have with this is because I'm unable to install XNA (followed instructions on the web, even installed the Game Marketplace). I'm on Windows 8.1, by the way.

Long story short, I gave up on trying to install XNA. However, I have played around a bit with MonoGame and found that you can use raw images (.png in my case) instead of those converted to .xnb. I haven't tried sound, so I don't know if it'll work. Or any other assets for the matter.

My question is, is it possible to develop in MonoGame without using .xnb files? Or, is it possible to develop without XNA's content compiler? If yes, then how?

sentences:
How can I make several 2D objects move in complex pre-defined patterns? I will be making my mobile 2D game in Unity and the objects in the game will have complicated movement. For example, there will be lots of squares (around 10-15 tiny squares) in the middle of the screen which will move in pre-defined patterns like in the shape of an X or an M or O. The tiny squares forming the pattern M will be constantly moving within that X symbol and will be constantly instantiated at one end and destroyed at the other to achieve the effect (or just allowed to move within a pattern if the patterns shape permits).

Unity tutorials explain the basics on how to work with the transform component, etc but I have been looking for a resource that tells you how to achieve the above. How can I implement it?

sentences:
How can I efficiently render a large, zoomable world map? We are looking to develop a grand strategy PC game in Unity with a world map similar in scale to Crusader Kings 2 and Europa 4.

We want to add more details to the map so that we can stand out visually, but we are worried that such a large zoom-able map, rendered in 3D, will cause performance issues.

How can we deal with efficiency problems related to rendering such a large map at various levels of zoom?

sentences:
Is it more efficient to store my tile grid as a dictionary or an array? I've just started making a video game in AS3, and I'm trying to keep the graphics, sound, and actual game state in three completely different spots and sets of classes.  That being the case, the graphics module will have to repeatedly parse the state module.  The game is divided into levels, and each level is divided up into square spaces (like a board game); thus the graphics module will have to repeatedly parse out a certain cross-section of spaces of the current level.

The player will always show up in the middle of the spaces' overall graphic (the "Grid"), and there will be 4 spaces in every direction from the player's positioin that will be displayed, along with any object each space may contain (such as the player, a monster, etc.).

So right now I'm trying to decide how to store the spaces in each level (all of the level's spaces themselves, not the graphics).  The first thing that came to mind was a 2D Array.  Then I started to use a 2D Vector, then came back to using an Array, like at first; and now I'm wondering whether to use an Array or a Dictionary.

The problem:

Let's say a level looks like this:

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxPxxxxxxx

x's are blank spaces, P is the space that the player.  As the Grid parses this information, if it's a 2D Array, then it can use the length property of the main Array and the length property of each sub-array to set up its for loops reasonably well.  Furthermore if a space is outside the bounds of the 2D array, then rather than wasting memory trying to form more objects in the code or something, the Grid can just assume the space is blank:

var arr:Array;
var space:Space;

for (var i:int = level.playerX - 4; i <= level.playerX; i++)
{
    arr = level.spaces[i];
    if (arr)
    {
        for (var j:int = level.playerY - 4; j <= level.playerY; j++)
        {
            space = arr[j];
            if (space)
            {
                // find every object inside space and animate accordingly
            }
            else
            {
                // assume the space is blank
            }
        }
    }
    else
    {
        // assume the whole column of spaces is blank
    }
}

Within the player's radius, the Grid must animate any non-existent spaces as blanks.  Therefore the graphical output is as follows:

xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxPxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx

But now if we have a level that looks more like this:

xxxxxxxxxxxxx
xxxxxxxxx
    Pxxxx
    xxxxx

then using an Array leaves two basic options:

Use null elements within the sub-arrays to get the Grid to animate non-existent spaces that come before the real ones in the sub-array (the sub-array's length can be used for non-existent spaces that come after the real ones).
Make that simple for-looping inside the Grid a whole lot more complex to compensate for rows and columns of spaces starting at variable locations along each axis (and not simply ending at variable locations).

I don't want to use option 2.  I was just going to use option 1 with Arrays, but now the possibility of using Dictionaries instead has come to mind.  At least with Dictionaries, I wouldn't have to just waste memory every time I wanted, let's say, for the first space in a row to begin at postion 5.

Sorry, I know this was lengthy, but I hope I've illustrated the problem.  Which is better - an Array, or a Dictionary?  If a Dictionary is better, should it use sub-Dictionaries or sub-Arrays to establish a 2-dimensional effect?  Thanks!

sentences:
Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop.

I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10-15.

I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc.

This only dropped the fps 2-4. If I can fire bullets without dropping the fps more than another 2-3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode.

I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?

sentences:
What makes a game a 3D game? This may sound pretty obvious to game devs here but I'm wondering if a game can be called 3D if it has 3D assets but static isometric like camera view and not rotating at all.

I tried searching the different types of video game graphics but I only find the inverse which is called 2.5D because it tries to fake 3D and that it uses 2D isometric assets.

My question is

1) What really makes a game a 3D game?

2) If a game have 3D assets with a static non rotating isometric camera view is not called a 3D game, then what?

sentences:
Automated texture mapping I have a set of seamless tiling textures. I want to be able to take an arbitrary model and create a UV map with these properties:

No stretching (all textures tile appropriately so there is no stretching and sheering of the texture)
The textures display on the correct axis relative to the model it's mapping to (if you look at the example, you can see some of the letters on the front are tilted, the y axis of the texture should be matching up with the y axis of the object. Some other faces have upside down letters too)
the texture is as continuous as possible on the surface of the model (if two faces are adjacent, the texture continues on the adjacent face where it left off)
the model is closed (all faces are completely enclosed by other faces)

A few notes. This mapping will occur before triangulation. I realize there are ways to do this by hand and it's probably a hard problem to automatically map textures in general, but since these textures are seamless and I just need uniform coverage it seems like an easier problem. I'm looking for an algorithmic approach to this that I can apply in general, not a tool that does it.

What approach would work for this, is there an existing one? (I assume so)

sentences:
Algorithm to produce 'Lady or Tiger' puzzles? What my problem is:
There is a puzzle by Raymond Smullyan that works something like this: You are in a room with many doors. Behind some of those doors, there are ladies; behind the others, there are tigers. Your goal is to pick one of the right doors (the ones with the ladies). On every door, there's a sign that says something like There's a lady behind this door or There is a lion behind door II and VI and so on. Now, you also have some additional information like Only one of the signs says the truth or The sign on a door is true only if there is a lady behind that door and so on. For example, the first puzzle goes like this:

There are two doors with one sign each. One of the signs is true, the other one is false:
 ---------------------    ---------------------
|      DOOR I         |  |      DOOR II        |
| There's a lady in   |  | In one of those     |
| this room and a     |  | rooms, there's a    |
| a tiger in the      |  | lady, in the other  |
| other one           |  | one there's a tiger |
 ---------------------    ---------------------

Behind which door is a lady?

Now, getting to the topic of this question: I'm looking for possible ways to auto-generate such puzzles. The (far away) goal is to build an algorithm that requires, as parameters, the number of doors (and maybe the difficulty of the resulting puzzle) and creates corresponding texts for the doors.
What I have tried so far:
Not much, as I don't really know where to start. It's easy to create a pattern for the text on the signs and it's also easy to randomly assign true and false statements to those signs, corresponding to the true-false-rule you use (e.g. Only one sign says the truth). But that's the part where it get's tricky: How to create a puzzle that is solvable and has a unique solution? My first idea was to create a random puzzle and use backtracking to search for solutions. But that way, it could take very long until the algorithm has finally found a working set of signs. Also, that way you can't easily determine how difficult a given puzzle is.
So, summing it up: Do you have any idea, any helpful links, etc.? Any help is appreciated, I don't expect anyone to post a perfect and complete solution for my problem.
(Note: I originally asked the following question on stackoverflow but was told there that I would be more likely to get an answer here!)

sentences:
Humanoid Retargetting: Number of frames in LateUpdate is not the same as frames in animation I need to play an animation in such a way that each frame is for sure being played and not skipped.
Why? I want to transfer an animation from 1 model to another. One model is Humanoid, the other one is Generic. This way, I can "save out" the Humanoid retargetting and process it in an external animation editor later.
To transfer the animations, I need to make sure that I don't miss any frame while copying the pose to the other model.
To do that, I use a very slow animator speed like this:
_animator.speed = 0.01f;

The Unity editor says this about the animation:

To make sure that each frame is really shown / played, I have implemented my own counter.
My counter however returns 43 frames and not 51 frames as the Inspector.
No matter how often I repeat this process, it always return 43 frames.
What am I missing?
Thank you!
private void LateUpdate()
{

    float f = _animator.GetCurrentAnimatorClipInfo(0)[0].clip.length * (_animator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1) * _animator.GetCurrentAnimatorClipInfo(0)[0].clip.frameRate;
    int iCurrentFrameIDInAnimationFile = (int)f;

    bool bIsNewFrame = (iCurrentFrameIDInAnimationFile != _iLastFrameIDInAnimationFile);

    if (!bIsNewFrame)
    {
        return;
    }
    else if (bIsNewFrame)
    {
        _iFrameCount += 1;
    }

    _iLastFrameIDInAnimationFile = iCurrentFrameIDInAnimationFile;

    if (_animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !_animator.IsInTransition(0))
    {
        //animation has finished playing
        Debug.Log("Frames: " + _iFrameCount); //this returns 43 frames. Why???
    }

sentences:
Canvas - darken sprites rendered by drawImage I am implementing lighting in a tile engine, and I need a way to darken tiles, based on their light level.

For the ground tiles, I can clear the context to black, then set the globalAlpha and use drawImage normally. But what about foreground tiles, such as trees? I don't want them to be translucent, just darker. Is there any way to filter the output of drawImage?

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:
How can I find the distance from bezier curve anchor points to control points for a circle approximation and their positions From the image below, I have represented a circle by a closed bezier curve made of two cubic bezier segments. I am aware that a bezier curve cannot represent a perfect circle.
How can I calculate the distance from the anchor points to the control points based on the distance from both anchor points to give a close approximation of a circle?

Also how can I use the calculated distance to find the positions for the control points?

sentences: Does a patch of simplex noise sum up to zero? Just for interest, when sampling simplex noise in any given dimension, would the sum of all samples run towards zero?

sentences:
Multiplayer synchronization and pathfinding I have a point & click type interface on a client, which runs an A* on the server, for path-finding.

The game is controlled like an RTS, but the world is persistent, so players should be able to join/leave at any time, and there will only be 30 or so units at most on the screen.

What is the best way to synchronize the player movements between the server and client, once I've computed the path(s)?

Does the server need to sync the clients on every animation step/frame? or can it just tell the client "go to position X,Y" for each node on the path, and each moving player? Or is it best to just run the animation timers on both client and server, and have it be implicitly synchronized that way?

What would the typical data-exchange be like for path-based movement?

EDIT:

Some of you have been suggesting lockstep, because I said "RTS", but the game isn't an RTS, it just has the same kind of interface. The big difference is I need to be able to have players join and leave the game at any time. Sorry for not being more specific.

sentences:
How should bullet reflections be implemented? Im working on a tank game where bullets are relected off of walls.  The formula for a relfection is r=d−2d⋅n∥n∥2n where d is the incoming vector and n is the normal of a wall.  My bullets stick to the walls and then "bounce" off at the corners; an undesirable effect.  Im honestly questioning my formula implementation at this point.
func collision():
    for i in get_slide_count():
        var collision = get_slide_collision(i)
        if collision.collider.is_in_group(globals.wall_group):
            var normal = collision.normal
            velocity = velocity - ((2 * velocity.dot(normal)) / normal.length_squared()) * normal
            rotation = velocity.angle() + PI

if i use the is_on_wall function and simply negate the velocity this does produce a bouncing effect but not a correct one.  I still need the normal.
I orignally used rigid bodies as seen in the image.  But i have switched to kinematic bodies.

sentences:
game resuming stats password i'm asking for a more clever encoding algorithm to retrieving game stats
which generates a shorter and more clear password

for example i have this information's to be saved via a short CODE

Health                    0 - 99
Armor                    0 - 99
Ammo                    0 - 999
Shells                     0 - 99
Rockets                  0 - 9
Weapon1                0 - 1 // picked or not (boolean)
Weapon2                0 - 1
Weapon3                0 - 1
Weapon4                0 - 1
Level                       1 - 3

what i did :

an inline example of above information's :
99    99  999 99  9   1111    3

the encoded result with base64 as String : OTkgOTkgOTk5IDk5IDkgMTExMSAz

the encoded result with base64 as Decimal : Y2PPp2MJ0ZcD (good but long yet)

what i know is to handly encoding some part of the code
for example for boolean part, there is only 16 states, 0000 0001 0010 0011 ...etc

so it can be reduced to only 16, information could be reduced to: 99 99 999 99 9 16 3

then result will be still same : Y2PPp2MJEAM= (ogly and long)

i used this website for decoding and encoding

sentences:
How to properly scale Image components to screen percentages? Let's take a Sprite. I have two methods for retrieving an orthographic size of the screen:

public static float Width(){
    Camera cam = Camera.main;
    float height = 2f * cam.orthographicSize;
    float width = height * cam.aspect;
    return width;
}

public static float Height(){
    Camera cam = Camera.main;
    float height = 2f * cam.orthographicSize;
    return height;
}

Now, for the Sprite, I have an extension method:

public static void ScreenPercentWidth(this SpriteRenderer renderer, float percent){
    renderer.transform.localScale = new Vector3(
        Screen.Width() / 100f * percent / renderer.sprite.bounds.size.x,
        renderer.transform.localScale.y,
        renderer.transform.localScale.z
    );

}

Which I can use like sprite.ScreenPercentWidth(50f) and it works.

What about a RectTransform/Image? Is there any way that I could create similar methods, so I can scale the Image like in the above example?

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

How can I do any of the following:

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

Thanks for any help at all.

sentences: how to modify multiples BoxCollider on a same game object? I have an game object with multiples BoxCollider attached to it, is there a way to get all the BoxCollider to an array so that I could modify their value individually ?

sentences:
How do I load Gleed 2D levels in WP7 XNA game? I've been trying so long to use this modified version of GLEED2D that includes WP7 support,

I'm stuck into loading the level into my game, now my Game1.cs class has the following:

    protected override void Initialize()
    {

        Stream stream = TitleContainer.OpenStream("Content/leveltest.xml");
        XElement xml = XElement.Load(stream);
        level = LevelLoader.Load(xml);
        base.Initialize();
    }

I included the XML file of my level into Content Directory, when I try to build the solution, It gives this error:

XML is not in the XNA intermediate format. Missing XnaContent root element.

I didn't find any reference on how to fix it on the developer's blog or the github WiKi

Any Idea?

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:
network programming: simultaneous IO over sockets? In my curses based game, I decided to add multiplayer functionality over net, in addition to one-keyboard mulitiplayer game. I use switch loop and in case it's 1st user's buttons,
user 1 is acting appropriately and second otherwise, without blocking each other's movements i.e not waiting for opponents move.
Now I read socket tutorials, and use server looking like this:

wait for 1st user to connect
wait for 2nd user to connect

loop:
read from 1st
write to 2nd
read from 2nd
write to 1st

Now problem is obvious, players would block each others movements, how this network multiplayer problems solved in games design?

sentences:
Memory-leak around SDL_FreeSurface When I call my tile engine function, the amount of memory my program uses begins to spike at about 80 - 90 megabytes per second. The memory use continues to go up until the program crashes. The function is below.

After tinkering with it, I figured out that I could reduce this bricking to about 15 megabytes per second if I called SDL_FreeSurface every time I ran the function. But this confused me, because I thought that you are only supposed to use SDL_FreeSurface when the program exits so that the images don't continue to occupy the memory.

if I don't call SDL_FreeSurface before I blit the tiles, do the previously blitted tiles continue to exist?
If I don't how do I fix the aforementioned bug?

The edit I made to bring the memory bricking down to 15 megabytes per second is commented out.

SDL_Surface* loadedTile = NULL;
SDL_Surface* modelIMAGE = NULL;

void enviroment::blitTiles(SDL_Surface* windowENVIRO, int tileAmount, int tileType[], int tileXenviro, int tileYenviro, bool quitTiles)
{
    HDcounter = -1;

//if(loadedTile != NULL)
//{
//    SDL_FreeSurface(loadedTile);
//}

loadedTile = IBFobjectENVIRO.loadIMG("tileClipSheet.png");

        for(int tiles = 0; tiles < tileAmount; tiles++)
        {

            switch(tileType[tiles])
            {
                //Black square (unpassable)
                case 1: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 0, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;

                //Grey square
                case 2: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 75, 0, 75, 75);
                break;

                //Brown square
                case 3: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 150, 0, 75, 75);
                break;

                //Invisible square (unpassable)
                case 4: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 225, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;
            }

            tileXenviro += 75;

            if(tileXenviro >= level1ObjectENVIRO.level1Width)
            {
                tileYenviro += 75;
                tileXenviro = tileXenviro - level1ObjectENVIRO.level1Width;
            }
        }

    if(quitTiles == true)
    {
        SDL_FreeSurface(loadedTile);
    }
}

sentences:
Box2d RopeJoint bug - fix or alternative solution? What I am trying to do is to create rope game. Below you can find a movie how it looks like now.

https://youtu.be/QTULCGNF70I

I am using RopeJoint and I am reducing maxLength each frame to be able to accelerate. Everything seems fine, but the problem appears for bubble kind of ball. I realized that shortening rope does not increase balls velocity. For example if I throw the rope fully vertical and the only "force" is from shortening the rope, the velocity is 0,0. Seems like, body movement is not simulated?

After I let the rope go the momentum is lost. The bubble can fly, but the factor from rope shortening is ignored.

I don't know if you understand what I mean. The movie should clarify it better.

Workarounds I tried:

Good idea was to use prismaticJoint, but the rotation is fixed, so it
doesn't work. I couldn't swing
Another idea was to use wheelJoint and make use of it's frequency
parameter. However here there's a problem that rope becomes rubber.
Swing feeling is bad, when it can extend more than initial length, it
should always only shorten.

Solutions I see, but they are not available

RopeJoint which keeps body momentum from rope shortening
PrismaticJoint without fixed rotation
WheelJoint with possibility to set max length or create the rope with it's max length, not the rest position.

sentences:
Scroller game level map advice I'm started a XNA project to make a game similar in gameplay to Super Spy Hunter on a NES, which is used as a feature reference. The first thing I thought of is how to store and display level. Currently I'm thinking of using some tile graphics editor and custom pipeline for drawing level. I'm not sure however, that all is possible to implement every feature of reference game, but at least it's a start.

Question is, looking at a given gameplay video, can you think of any possibly better approach then to design level using a tiles?

By "better approach" I mean which will be either easier to work with, which will be more "natural" for this kind of game. The doubt comes mainly from a huge technology gap between then (1990) and now. So there is possibility that using current cpu power this could be done easier.

Update 1. As I continue study reference game and @ashes999 correctly mentioned procedural generation also comes into my mind. I began to think game logic is something like (simplified):

while next road section exist:
    get road section data;
    set road generation options (borders type, road type, etc);
    set road section lenght;
    while not end of a section:
        generate road;
        apply pseudorandom eye candy stuff;

this all looks like a pretty good data driven algorithm.

sentences:
Unity Failed to create decoder for ScreenSelector.png My game works fine in the editor, but when I build and run the build the view is zoomed in, my tilemap is missing, and the camera follows a gameobject it should not.

How it should look and how it looks

I checked the logs and this is the error I am served:

  Failed to create decoder for 'C:/Users/Hamuel The First/Documents/Jetplatformer/Builds/Builds_Data/ScreenSelector.png': 0x80070002

Further Investigation shows that ScreenSelector.png is absent from the path stated in the error. I cannot find anything that says what ScreenSelector.png is, or does. I am using the post processing stack by unity.

Any help would be much appreciated!

sentences:
Representing a world in memory I'm attempting to write a chunk based map system for a game, where as the player moves around chunks are loaded/unloaded, so that the program doesn't run out of memory by having the whole map in memory.

I have this part mostly working, however I've hit a wall regarding how to represent the contents of each chunk in memory because of my so far limited understanding of OOP languages.

The design I have currently has a ChunkManager class that uses a .NET List type to store instances of Chunk classes. The "chunks" consist of "blocks". It's similar to a Minecraft style game.

Inside the Chunk classes, I have some information such as the chunk's X/Y coordinate etc, and I also have a three dimensional array of Block objects. (Three dimensional because I need XYZ values)

Here's the problem:

The Block class has some basic properties, and I had planned on making different types of blocks inherit from this "base" class. So for example, I would have "StoneBlock", "WaterBlock" etc.

So because I have blocks of many different types, I don't know how I would create an array with different object types in each cell.

This is how I currently have the three dimensional array declared in my Chunk class:

private Block[][][] ArrayOfBlocks;

But obviously this will only accept Block objects, not any of the other classes that inherit from Block.

How would I go about creating this? Or am I doing it completely wrong and there's a better way?

sentences:
SDL2 - Updating part of a texture is slower than updating all of it I'm programing a kind of cellular automaton in which each pixel is an automaton.
I'm using a SDL2 streaming texture with the SDL_LockTexture() and SDL_UnlockTexture() methods to "open" the whole texture and draw the full 426x240 array of pixels. Like this:
  // inside update() method
  world_texture_.lock((void**)&world_pixels_, &texture_pitch_);

  for (int i = rows_ - 1; i >= 0; --i) {
    for (int j = 0; j < cols_; ++j) {
      const auto current_index {getIndex(i, j)};
      checkAutomatons(current_index); // this checks stuff and changes world_pixels_ accordingly
    }
  }

  world_texture_.unlock();

Lately I figured out that I don't need to update the whole texture, as the vast majority of pixels weren't changing from frame to frame. So I made a method to create an SDL_Rect around the area that needs to be updated, drastically decreasing the number of pixels to check. Like this:
 // inside update() method
 world_texture_.lock(&bounding_box_, (void**)&world_pixels_, &texture_pitch_);

 for (int i = bounding_box_.y + bounding_box_.h - 1; i >= bounding_box_.y; --i) {
   for (int j = bounding_box_.x; j < bounding_box_.x + bounding_box_.w; ++j) {
     const auto current_index {getIndex(i, j)};
     checkAutomatons(current_index);
   }
 }

 world_texture_.unlock();

But to my surprise, this "precision" way is doing slower than checking every pixel and updating the whole texture. Profiling gives me an average of 0.001537s for the whole texture and 0.003079s for the "precision" way. You may think that my algorithm to determine the area to be updated makes it go slower, but the algorithm is running in both versions, but only the "precision" one is using the rectangle generated.
Why could this be? Reading the SDL2 docs it seems the correct way to change a texture that is being updated often. Maybe is because the range of the for loops changes at every update() call and some register or other low-level thing gets changed/updated?

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:
Effects of collisons: broken glass, damaged cars, how are they created? My question is related in particular to achieving the effects of collision in game engine, how is this done?

I have searched a bit, read from the internet and went through a few tutorials, and saw that one way to create one of the effects, explosion, or something breaking is to create the model in pieces, and apply force (in a game engine such as Unity 3D) to make the pieces fly off. It seems to be a solution, but it doesn't address the problem of items that are vaporized in a big explosion, with so many pieces. How is this done? Basic methods and tricks etc would be helpful.

Secondly, the problem of things bending and getting damaged on impact, such as a car's front end destroyed when it hits a wall? How is this done? One thing that comes into my mind is to create each component of a car in a different state as an animation in 3Ds Max or Maya, and then in the engine, according to the collision, switch the model state in the time bar. Is this how it is done?

Finally, what about materials, such as net of a basketball net, or a soccer goal net for example? Effects of ball hitting it can be calculated and applied in a script, but how to make the net bend and stretch with it? Is it done through models or materials?
Also what about a flag fluttering in the wind?

My questions are specific to game engines, particularly Unity3D. Some good links on the subject would also be helpful.

sentences:
How do I call out an IEnumerator from another script to a script which also contains IEnumerator? It is a Game Manager:
public class gm : MonoBehaviour
public IEnumerator spawnTile() .....

I want this IEnumerator spawnTile to be called on this script:
public class gmSidePlatform : MonoBehaviour
 void Start()
{
    NextSpawnSidePlatform.x = 30.5f;
    StartCoroutine(SpawnSidePlatform());
}

IEnumerator SpawnSidePlatform()....

I did follow the instructions of calling other scripts by using Public gm gameManager1;
But the variables from the gm script didn't appear on this (gmSidePlatform) script. I don't know what to do...

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 can I implement real-time mutual object reflection? So, given a scene like this (cubemap skybox with "real" spheres)

Everything looks great, except for the fact that the spheres don't reflect each other.

What's a good way to go about this? The first thing that came to mind was to render an environment map for each cube, and apply that to each cube along with the skybox. However, that will be insanely slow when updated per frame, given that the spheres are moving relative to each other and a static map won't work.

I realize this may fall under the category of ray tracing and be difficult to achieve real-time, but perhaps someone has addressed this problem in the past?

sentences:
What was the game project that felt like "YOUR" game? This question might seem a bit vague but it is hard to formulate properly. I will try as best as I can. So here goes...

For many years I have been trying to create games but I haven't managed to finish even a single one. The main reason, among others, was that the game creation process lacked focus. There never was a concrete vision of what I was trying to create.

Now I realize that I would usually want to create a game that was similar to some other that I recently played and liked. It seems like there are many games I would like to make but there is none that I would see as THE game I want to make (or one of THE games).

I really want to create something that I (and hopefully, others too) like and can be proud of. But I'm having a hard time discovering what it is. It doesn't have to be big, graphically awesome or anything like that. It should simply be something I really enjoy and am motivated to create.

So, has anyone else here had the same or similar problem? Have you found a way to overcome it? Have you discovered "YOUR" game?

If so, what was different about it from other games you tried creating?

EDIT:

Thanks for all your answers. Just want to clarify some things a bit...

Before asking this question I already read through various older questions about things like prototyping, having deadlines, to-do lists, participating in competitions with short deadlines, etc.

What I wanted to know more by asking this question was not how to create a game in general but how to discover a project that feels like what you really want to do.

For example, I play racing games very rarely, but sometimes I might play some game that is quite fun for a while and get an idea about creating some racing game of my own. But that idea won't stay for long and I will soon get bored with it because in general I am not the kind of guy who is really "into" racing games.

It would be nice if someone here could tell how they discovered what their game was. And I would appreciate if you could tell your story with more details, especially about the things that made the difference between "it would be nice to make this game for myself" and "I want to make this game really badly".

sentences:
Convert Canvas Space point to local space of a rotated rect? I got a quite tricky problem:

I have my mouse position and my rectangle position in canvas space(screen space but with adjusted scaling). Now I want my mouse position converted to local space of the rectangle. Problem is, the rectangle can be rotated. Without rotation its quite simple and works nicely.

Heres a graphic for better demonstration:

Edit3: Got it finally working. I messed up with a minus in the calculation instead of using a +. Also the hierarchy of the image in unity was incorrect. Lastly I had to change the rotation from CCW to CW(Thanks unity for using CCW in your UI...). This is my final solution:

Code Unity C#:

    var mapRect = MapContentTransform.rect;

    // Canvas Space Map Center
    var mapPositionCenter = CanvasRectTransform.InverseTransformPoint(MapContentTransform.position);
    mapPositionCenter.x += CanvasRectTransform.rect.width / 2.0f;
    mapPositionCenter.y += CanvasRectTransform.rect.height / 2.0f;
    // Mouse Position in Canvas Space
    Vector2 mousePositionCanvasSpace = CalculateScreenspacePositionCanvasSpace(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

    // Rotation angle of the Map in Radians
    float theta = -(MapContentTransform.eulerAngles.z - 360.0f) * Mathf.Deg2Rad;

    var rotatedX = ((mousePositionCanvasSpace.x - mapPositionCenter.x) * Mathf.Cos(theta) -
                   (mousePositionCanvasSpace.y - mapPositionCenter.y) * Mathf.Sin(theta)) + mapRect.width / 2.0f;

    var rotatedY = ((mousePositionCanvasSpace.y - mapPositionCenter.y) * Mathf.Cos(theta) +
                   (mousePositionCanvasSpace.x - mapPositionCenter.x) * Mathf.Sin(theta)) + mapRect.height / 2.0f;

Thank you Kyy13!

sentences:
How do I find which isometric tiles are inside the cameras current view? I'm putting together an isometric engine and need to cull the tiles that aren't in the camera's current view. My tile coordinates go from left to right on the X and top to bottom on the Y with (0,0) being the top left corner.

If I have access to say the top left, top right, bottom left and bottom right corner coordinates, is there a formula or something I could use to determine which tiles fall in range?

This is a screenshot of the layout of the tiles for reference.

If there isn't one, or there's a better way to determine which tiles are on screen and which to cull, I'm all ears and am grateful for any ideas. I've got a few other methods I may be able to try such as checking the position of the tile against a rectangle. I pretty much just need something quick. Thanks for giving this a read =)

sentences:
Zelda-style top-down RPG. How to store tile and collision data? I'm looking to build a Zelda: LTTP style top-down RPG. I've read a lot on the subject and am currently going back and forth on a few solutions. I'm using C#, MonoGame, and Tiled.

For my tile maps, these are the choices I can see in front of me:

Store each tile as its own array. Each one having 3-4 layers, texture/animation, depth, flags,  and maybe collision(depending on how I do it). I've read warning about memory issues going this route, and my biggest map will probably be 160x120 tiles. My average map however will be about 40x30. The number of tiles might cut in half if I decide to double my tile size, which is currently 16x16. This is the most appealing approach for me, as I feel like I would know how to save maps, make changes, and separate it into chunks for collision checks.
Store the static parts of my tile map in multiple arrays acting as the different layers. Then I would just use entities for anything that wasn't static. All of the other tile data such as collisions, depth, etc., would be stored in their own layers as well I guess? This way just seems messy to me though.

Regardless of which one I choose, I'm also unsure how to plan all of that other tile data. I could write a bunch of code that would know which integer represents what tile and it's data, but if I changed a tileset in Tiled and exported it again, all of those integers could potentially change and I'd have to adjust a whole bunch of code.

My other issue is about how I could do collision. I want to at least support angled collision that slides you around the corners of objects like LTTP does, if not more oddball shapes as well. So do I:

Store collision as a flag for binary collision. Could I get this to support angles?
Would it be fine to store collision as an integer and have each number represent a certain angle of collision?
Store a list of rectangles or other shapes and do collision that way?

Sorry for the large two-part(three-part?) question. I felt like these needed to be asked together as I believe each choice influences the other.

sentences: Can I write plugin/extension to Unity editor? Is there possiblity to write my own plugin/extension to Unity editor ? I want to write plugin to generate map for me from xml file.

sentences:
Correct normal map for rotated sprites I am trying to find the best way to correctly do normal mapping in a 2D batched sprite renderer.

For each sprite sheet (aka texture atlas) I render all sprites as a textured quads with a single glDrawElements() call. Therefore, vertex coordinates in VBO are already transformed (on CPU) according to sprite position, rotation and scale.

Unfortunately, on rotated sprites normal map texture is also rotated, leading to incorrect normals:

I did a bit of research on this subject and so far I found few possible solutions:

Pass tangents to shader. Pretty straightforward, the same way it's usually done for 3D models. While this approach would work, doing it for just simple 2D sprites seems quite wasteful.
Pass just sprite rotation in additional vertex attribute. Then I could use this attribute in the fragment shader to rotate normal vector accordingly.
Use dFdx(), dFdy() functions. It looks like I could use these functions to deduce transformation from screen to texture coordinates and then use it to rotate normals. To be honest, this approach is not entirely clear to me, and I don't fully understand its possible performance implications, especially on mobile platforms.
Use geometry instancing. I think if I use glDrawElementsInstanced() and just dump all the sprite coordinates + transformations in one giant texture buffer, I then could use this information in the fragment shader to rotate normals. But as with approach #3, I don't fully understand if it could lead to possible performance or compatibility issues on mobile platforms.

So far I think approach #2 is probably the better solution. Not only it is simple and requires minimal changes to the code, but it would also allow me to offload sprite rotation calculations from CPU to GPU. I'd still have to pass sprite rotation per-vertex (and not per-sprite), but I don't think this is to big overhead.

But maybe there is a better, more elegant or more performant solution to this problem? How this is typically done in 2D games?

sentences:
Push data in unity Player without Requesting I have a unity3d Player where I need some data from the server. The server code is written in python while on client side is C#.

Now I am searching a way that server directly post/push data to my unity player. IMO! it is not possible to push data to unity player without requesting the server using WWW class. My question is can python post data to my client unity player? with something like

response = requests.post(client_url, data = request_data, headers = headers)

I want to do this because i want to avoid repetitive calls to server which is not an efficient way.

sentences:
Networking - assigning IDs to entities Maybe I'm asking dumb question, but this problems bothers me...

So I have my networked game in Unity (client), and server written in C# (without Unity). I Use ENet library for networking. Most of networked components are written by myself (lobby, components etc.).

Server doesn't know about Unity entities like players, obstacles etc.
In most cases I send message ("hide object with id 4") to the server, and server pass that message to other clients where they applied message information.

What my problem is, how to assign proper IDs to networked objects, that will be the same across all players?

What I do is that:

On all clients I get all components with specific network component (e.g. NetworkRigidbody)
I sort all of objects using special comparer which compares based on component name with all parents appended to it
ID is just an index in sorted array

Above algorithm works, but I have a feeling that in normal games that problem is handled in other manner.

I searched over Mirror, MLAPI and other libraries source code and I couldn't find how entity id is generated, especially when server is not Unity application.

sentences:
Client-side login and password save I'm wondering what would be the best way to store password and login in the client. Many people complain that they need to re-enter this every time they log in and they want me to make a way to save it. But how to save it? Saving it as plain text in game folder wouldn't be clever, but neither would encrypting it help so much. It would still be easy to decrypt the data.

How would you do that?

Best regards!

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: 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:
Orientation while rotating around a point I am using this formula to rotate around a point.

X := originX + sin(angle)*Size;
Y := originY + cos(angle)*Size;

In cartesian cordinates how would I keep the objects orientation in relation to the origin object as it moves around the origin.  Any one know where I could look for answer to that?

sentences:
UE4 BlendSpace is not working as intended I am trying to set up a rifle aiming blendspace in UE4. I downloaded animations from Mixamo, added root bone and retargeted them to UE4. Then I set up the BS, but the legs of the character are behaving weirdly, they are twitching, going through each other. The animations work fine on their own, but behave that way in the BS, especially in the transition areas. Here is the video:
Video
Here is my BS:

Here is how I am setting Speed and Direction variables used in the BS:

Can someone please help me with this? I am new to UE4. How do I fix this and get a smooth Animation Blend Space?

sentences: How can I make particles glow and cast light on its surroundings? Im currently attempting to make a firefly effect on a dark forest. The level has very low light and the player is one of the few light sources. To let the player see the level better, I am attempting to making glowing fireflies appear randomly on the map. One way is to use a particle system. But I cant make the particles cast light one the surroundings. Is there a way to do this?

sentences:
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:
Android APK export duplicating libgdx assets folder I'm developing a game using libgdx targetting Java desktop and Android. For the assets I have a "data" folder inside the "assets" folder in the Android project. Then, I link it from the desktop project.

My problem comes when I export, my .apk contains:

assets
com
lib
data
META-INF
res
AndroidManifest.xml
resources.arsc
classes.dex

This means my data files are duplicated in "assets/data" and "data" being the first one the only relevant one. This increases my APK size from 5 to 10MB which is kind of annoying. In my file system I only have the "assets/data" folder, no trace of the intruder there.

Does someone have any ideas why is this happening? How can I solve it?

PS: I've tried deleting the intruder manually opening the apk with 7zip but that destroys the checksum and prevents updates to be properly installed (needs complete reinstall).

sentences:
How do you pass arguments with UnityEvents? I was inspired by a great talk at Unite by Ryan Hipple.

https://youtu.be/raQ3iHhE_Kk?t=28m

His examples didn’t cover passing arguments with UnityEvents

Do I need to extend UnityEvent, GameEvent and GameEventListener from a generic base class for this to work properly?

If so do I need to make a new set of classes for each Type and combination of Types that I want to pass?

Game Event Scriptable Object

[CreateAssetMenu]
    public class GameEvent : ScriptableObject
    {
        /// <summary>
        /// The list of listeners that this event will notify if it is raised.
        /// </summary>
        private readonly List<GameEventListener> eventListeners =
            new List<GameEventListener>();

        public void Raise()
        {
            for(int i = eventListeners.Count -1; i >= 0; i--)
                eventListeners[i].OnEventRaised();
        }

        public void RegisterListener(GameEventListener listener)
        {
            if (!eventListeners.Contains(listener))
                eventListeners.Add(listener);
        }

        public void UnregisterListener(GameEventListener listener)
        {
            if (eventListeners.Contains(listener))
                eventListeners.Remove(listener);
        }
    }

Listener Class

public class GameEventListener : MonoBehaviour
    {
        [Tooltip("Event to register with.")]
        public GameEvent Event;

        [Tooltip("Response to invoke when Event is raised.")]
        public UnityEvent Response;

        private void OnEnable()
        {
            Event.RegisterListener(this);
        }

        private void OnDisable()
        {
            Event.UnregisterListener(this);
        }

        public void OnEventRaised()
        {
            Response.Invoke();
        }
    }

sentences:
Best Way To Make Responsive UI Buttons in Unity I've been stuck on this for quite some time. I'm trying to make a platformer game for android so I need some touch buttons. I made some buttons in Photoshop but I can't figure out how to make them move the player right. I've tried implementing the IPointerDownHandler interface but once I get the player moving I can't stop it, even if I call a function in OnPointerUp to set the players velocity to a new vector3 where all values are zero. I've also tried attaching event triggers to the  buttons I made, but it's the opposite the player only moves for one frame and then I have to press the button again. I don't want to import any assets from the asset store and I don't want to use gui system. I want to learn how to do it myself. Thanks in advance. Here is the script in which I call functions from my PlayerController.

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

public class LeftButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    public Image leftButton;

    private PlayerController player;

    private void Start()
    {
        leftButton = GetComponent<Image> ();
        player = FindObjectOfType<PlayerController> ();
    }

    public virtual void OnPointerDown(PointerEventData ped)
    {
        Debug.Log("LeftButton Pressed!!");
        player.moveLeft (-2);
    }

    public virtual void OnPointerUp(PointerEventData ped)
    {
        player.stopMoving ();
        Debug.Log ("Button Lifted!!");
    }
}

Here is my PlayerController script.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    private Rigidbody2D myrb;

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

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

    }

    public void moveLeft(float moveSpeed)
    {
        myrb.velocity = new Vector3 (moveSpeed, myrb.velocity.y, 0f);
    }

    public void moveRight(float moveSpeed)
    {
        myrb.velocity = new Vector3 (moveSpeed, myrb.velocity.y, 0f);
    }

    public void stopMoving()
    {
        myrb.velocity = new Vector3 (0f, 0f, 0f);
    }
}

sentences:
Changing text through a cursor hover trigger In my game I have several house groups (see image below), I want to show a specific message when the mouse hovers a specific house group.

For some reason, this only works on the first switch case (house) but fails on the second switch (house2). The default case doesn't work either. I verified that the case house2 is found by the engine. By not working I mean the text does not appear.

Do you have any idea about the problem?

Code:

public class MouseIsOver : MonoBehaviour {

    private Image TipImage;
    private Text textObject;
    public string text;
    private bool displayInfo;

    void Start ()
    {
        TipImage = GameObject.Find("realtyInformation").GetComponent<Image>();
        textObject = GameObject.Find("realtyInformationText").GetComponent<Text>();
        TipImage.enabled = false;
    }
    void Update();
    {
        Display();
    }

    void Display ()
    {
        if (displayInfo)
        {
            switch (text.ToLower())
            {
                case "house":
                    textObject.text = "house text1";
                    break;
                case "house2":
                    textObject.text = "house text2";
                    break;
                default:
                    textObject.text = "Click on the building";
                    break;
            }

        }
        else
        {
            TipImage.enabled = false;
            textObject.text = "";
        }
        TipImage.enabled = true;
    }

    private void OnMouseOver()
    {
        displayInfo = true;
    }

    private void OnMouseExit()
    {
        displayInfo = false;
    }
}

sentences:
Add a random number to an existing number to produce output in Unity I am trying to add a random number to an existing number. I am able to get the output in Unity console, but in the inspector, I can see that the public variable is on a non stop loop.

I intend to produce the result when I press the enter key. Is this an efficient way, or can I improve on the code? I am a beginner, and passionate to learn.

Here's the code:

using UnityEngine;
using System.Collections;

public class LearningScript : MonoBehaviour
{
    public int number1 = 5;
    public int number2 = 10;
    public int number3=20;
    public int finalResult;
    public string statement = "NO KEY PRESSED";

    void Update()
    {
        input ();
        if (Input.GetKeyDown (KeyCode.Return))
            Debug.Log (finalResult);
    }

    void Start(){}

    int addnumbers(int num1,int num2)
    {
        int additionResult = num1 + num2;
        return additionResult;
    }

    void input()
    {
        int randomNumber = Random.Range (1, 10);
        finalResult=    addnumbers (number1, randomNumber);
    }
}

sentences:
Elegant solution for coloring chess tiles I am re-developing a chess game I wrote in Java, and was wondering if there is an elegant algorithm to color chess tiles on a numbered chess board.

Right now my solution uses if else statements to determine if the tile is on an even or odd row, and based on that, if it should be a light or dark square.

sentences:
Unity using raw mocap data without actually moving the character I play around with animations and unitys raw motion capture data asset pack. My problem is as followed:

I have an idle, walkforward and a runforward animation and play them based on the keyboard input. But i realized when i move my character backwards (using a movement script) but still playing the walkforward animation the character basically moves backward and forward at the same time.

So how can i play the animation but without actually effecting the position of the character?

Thank you

sentences:
Can I develop a game on PC in Java and move it to Android? I have fairly good experience with Java, but new to Android development. I would like to develop a 2D game which would have animations and online play.

Can I initially develop this game on my pc using Java and then implement in Android?

Will the canvas in Java be sufficient or should I use a game engine?

sentences:
Unity .3ds file is purple I imported a .3ds file from skethup and in the preview it shows it with the texture, but when I put it in the scene it shows it without the texture.

http://puu.sh/gyYSU/a09541420c.png

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:
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:
Best logic to create and drop new gems in a Match-3 game In a simple match-3 game, with a square gems matrix creating and dropping new gems is fairly simple: when needed I generate those gems above the matrix and then I make them fall into the main matrix simulating that common fall-from-the-ceiling behavior.

Let's now imagine I have a matrix with some rock-type gems, the ones that will never move from their position, and I have cleared an entire column via a "powerful" gem. I have something like this:

OOO OOO
OOO OOO
OOO OOO
OOO OOO
OOX XOO
OO   OO
O     O
OOOOOOO

Here O is a normal gem, and X is a rock gem, that is fixed in the matrix and will not move from its original position.

When the new gems flow into this matrix, they will eventually move to the left or to the right to fill that big empty space, but each one will be dropped into the same column.

I'm wondering what the best way to drop those new gems is. I clearly cannot simply make them move from the top of the screen directly to their final position (as in the previous case), since the would move diagonally across the other gems (too bad).

I'd like to know what's the easiest and most flexible way to compute and the configure the path that each gem will have to follow.

sentences:
How to 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: Physics-based rotation with an array of pixels Say I have a simple system, that has a large array of pixels with their own weight, velocity, coordinates etc. (by using classes) if each of those pixels can be connected to 4 other pixels (top, bottom, left, right) how could I let that object rotate, according to physics. An example of this is where I might have an array of pixels that makes a circle, and a slope, if I put the circle at the top of the slope, how would I compute the circle rotating while going down the slope?

sentences:
Copyrights and Usage of 3rd Party Intellectual Property I develop a game for a mobile platform. I would like to implement a movie figure/creature/character/vehicle into the game.

I wish to ask about Copyrights:

Is it acceptable, if I implement famous movie-like creatures (ex: Alien, Predator, Star Ship vehicle) into my game? Occasionally, I see games based on movies: "Star Trek, Star Wars, James Bond, etc..". If I wish to create a game based on successful movie, do I have to obtain approval?

What about songs? If I legaly purchase a CD in the store, can I use the song into my game?

Are there any conditions, under which I can use movie-like characters in my game? For example, if the game is going to be shareware/freeware, if the reneues does not exceed certain amount, or if some percentage of the original character look is modified?

sentences: Indexed draw vs draw array Lately I wondered, which draw command is faster, drawArrays or drawElements. I know difference between them, drawArrays just draws every vertex in the same order they were provided, and drawElements draws vertices based on the provided indices. But I'm still curious which command is faster, or when should I use drawArrays instead of drawElements and vice-versa.

sentences:
How to see the surface arc in Unity? How to see the surface arc in Unity?
There is the tutorial and in this tutorial we can see the arc in editor:

While I can not see it. I checked that all my gizmos are enabled.

How can I enable the arc?

sentences:
Creating new games on Android and/or iPhone I have a succesfull Facebook poker game that is running very nicely. I was asked if I can port my game to other platforms - mainly mobile devices (phones as well as tablets, would tablets need a separate version)?

I am currently a PHP programmer (and game designer) and I simply don't have the time to learn Android or other languages - so I have decided to pay third parties to port the game for me (if possible).

Which programming language is needed for the following four devices - Android phone, iPhone, iPad and tablets?
Can they all run off a central SQL database?  If no then I don't think I'm interested.
Do any of these run Flash?
Have I covered all my main bases here?

For example is programming for an Android phone that much different from programming for an Andorid tablet? They will have slightly different graphics (because the tablet has a greater screen area might as well use it) but does either version need to be developed separately, from scratch?

Same goes for iPhone/iPad, do they really need to be programmed separately if the only difference is the graphics?

sentences:
Video playback on mobile: can't seek to the end My Unity3D game needs to play videos on mobile devices (using Handheld.PlayFullscreenMovie()). Seeking works badly. If I tap the video progress bar near the end (expecting it to play the last second then finish), playback jumps back a full 10-20 seconds, depending on the video. What should I try to make it easier for the player to seek within the file? Force additional key frames?

I'm currently encoding with HandbrakeCLI and the following settings:

--preset="AppleTV" --x264-tune=animation --x264-preset=veryslow

sentences:
Getting an object to shoot directly towards click libgdx java I am trying to get my player to shoot a spell and it travels to where ever the player clicked. I can easily accomplish this by doing the following.

    if(position.x >= destination.x - 1 && position.x <= destination.x + 1)
        reachedX = true;
    if(position.y >= destination.y - 1 && position.y <= destination.y + 1)
        reachedY = true;

However if the players origin is at, for example, 0,0 and I click at 10,300 then it travels right and up but when the spell reaches an x of 10 it travels directly upwards. I want the spell to travel at an angle that it will reach the x coordinate at the same time as the y coordinate. Here is an image showing what happens and what I want to happen.

sentences:
Is there a common word that encompasses handling of position, rotation, and scale together? I'm looking for a name for my class that manipulates 4x4 matrices that handle position, rotation, and scale. Is there a common word that encompasses all three?

(I'm splitting the matrix math into its own file/class.)

sentences:
What should I use for the event name when logging metrics with Flurry? I'm working on a multiplayer game and I want to use Flurry to record game events.

In the game you can build, grow and train troops. In Flurry you can log an event (optionally with parameters).

It would be great to be able to track the progress of a player depending upon what kinds of things they build, grow and so on and at what experience levels they do that at, but I don't know whether it's best to just have different sets of events for different types of actions... like this:

NSDictionary *buildParams =
   [NSDictionary dictionaryWithObjectsAndKeys:
      @"Build_Type", @"Castle",
      @"EXP", @"234523", // Capture user status
      nil];

[Flurry logEvent:@"Build_Action" withParameters:buildParams];

And so on... so another for growing something, another for training, et cetera.

Or is it better to have one global type of record of an event like this:

NSDictionary *actionParams =
   [NSDictionary dictionaryWithObjectsAndKeys:
      @"Action", @"Build",
      @"Type", @"Castle",
      @"EXP", @"44234",
      nil];

[Flurry logEvent:@"Game_Action" withParameters:actionParams];

In this method all the data is stored in the one event type. I'm not sure which will give me the best result when it comes to funneling, segmentation, and all that?

sentences:
Turning a board game idea into a browser based, slow paced gameplay Suppose I want to create a strategy game with global mutable state shared between all players (think game board). But unlike a board game, I don't want it to be real time action and/or turn-based. Instead, players should be able to log in at any time of the day and spend a fixed number of action points per day as they wish. As opposed to a few hours, game sessions would run over a few weeks.

This is meant to reward good strategy rather than time spent playing (as an alternative, hardcore players could always play multiple games in parallel instead) as well as all kind of issues related to live playing like disconnections and synchronization. The game should remain addictive still have a low time investment footprint for casual players.

So far so good, but this still leaves open the question of when to solve actions and when they should be visible. I want to avoid "ninja play" like doing all your moves just a few minutes before daily point reset to take other players by surprise, or people spamming F5 to place a well-timed action which would defeat the whole point of a non real-time game.

I thought of a couple of approaches to that :

Resolve all events in a single scheduled process running once a day. This basically means a "blind" gameplay where players can take actions but don't see their results immediately. The thing is, I played a similar browser game a few years ago and didn't like the fact that you feel disconnected and powerless until there's that deus ex machina telling you what really happened during all that time. You see the world evolve in large increments of one day, which often doesn't seem like seeing it evolve at all.
For actions that have an big impact on the game or on other players (attacks, big achievements), make them visible to everyone immediately but delay their effect by something like 24 hours. Opposing players could be notified when such an event happens, so that they can react to it.

Do you have any other ideas how I could go about solving this ? Are there any known approaches in similar existing games ?

sentences: What are diegetic, non-diegetic, spatial and meta user interfaces? Could anyone please explain to me the differences between "diegetic," "non-diegetic," "spatial," and "meta" user interfaces in terms of how they are represented in games and game development?

sentences:
Why when using Linerenderer it's drawing a line also in scene view? I want to draw lines using the Linerenderer only in the game view window.

I'm using Debug.DrawLine but only drawing Red lines but for some reason when the Linerenderer draw a line/s one of the Linerender lines is yellow it seems the green linerenderer is getting on the red one in the scene view window.

 Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);

Is there a way to avoid it ? So Debug.DrawLine will draw only in sceneview and the Linerenderer will draw only in the game view window ?

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

public class RotateObjects : MonoBehaviour
{
    public GameObject[] objectsToRotate;
    public float speed = 0.1f;
    public Vector3 spinDirection;
    public bool useMouse = false;
    public bool automaticSpin = false;
    public LineRenderer linerendererPrefab;

    List<LineRenderer> lrs = new List<LineRenderer>();

    // Use this for initialization
    void Start()
    {
        for(int i = 0; i < objectsToRotate.Length; i++)
        {
            var lr = Instantiate(linerendererPrefab);
            lrs.Add(lr);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (objectsToRotate.Length > 0)
        {
            for (int i = 0; i < objectsToRotate.Length; i++)
            {
                var hits = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition), 100.0f);

            for (int x = 0; x < hits.Length; x++)
            {
                RaycastHit hit = hits[x];

                if (hit.collider.name == objectsToRotate[i].name)
                {
                    objectsToRotate[i].transform.Rotate(1, 1, 1);
                    Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);
                    SpawnLineGenerator(Input.mousePosition, hit.transform.position, false);
                }
            }

            if(hits.Length == 0)
                SpawnLineGenerator(new Vector3(0,0,0), new Vector3(0,0,0), true);

            if (useMouse == true)
            {
                if (Input.GetMouseButton(0))
                {
                    Rotate(i);
                }
            }
            else
            {
                Rotate(i);
            }
        }
    }

    private void Rotate(int i)
    {
        if (automaticSpin == true)
        {
            objectsToRotate[i].transform.Rotate(1, 1, 1);
        }
    }

    void SpawnLineGenerator(Vector3 start, Vector3 end, bool reset)
    {
        for(int i = 0; i < lrs.Count; i++)
        {
            if (reset)
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
            else
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
        }
    }
}

sentences:
Fine-tuning parallaxing objects in 2D games I'm making a 2D platformer game and I'm having a hard time figuring out how to fine-tune parallaxing objects in-game quickly enough. Problem is I don't even know how to make it faster, so I'm basically looking for standard approaches.

Currently I place a parallaxing object just like a normal static doodad somewhere on a level and then define the parallax offset multipliers (horizontal and vertical). Then I spend from five to ten minutes moving the camera around the location finding three values that satisfy me. So when placing each object takes that long, you start thinking of a way to make it faster, but unfortunately, I couldn't come up with anything better than what I have, so I'd like to learn about other approaches and possibly improve mine with that knowledge.

What are the usual approaches to placing and tuning the parallaxing objects in 2D games?

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:
How to get smooth parallax in a wrap-around world I'm working on a multiplayer space shooter a-la Star Control melee. The background of the game consists of several layers of tiles sprites making up a parallax effect of clouds and stars. The player ship is always centered in the viewport.

The game world has a fixed size and implements wrap-around, so that any object that passes the game world bounds is instantly teleported to the other side.

To make the transition seamless when reaching game bounds ,  all objects but the player ship are also rendered outside the game bounds if they are on the other side of the screen. This makes chasing a ship,  for example feel seamless.

Right now the x and y values of the background tile offsets are determined by the position of the player ship in the game world.

bg1.tilePosition.x = -playerShip.x * 0.01;
bg1.tilePosition.y = -playerShip.y * 0.01;

bg2.tilePosition.x = -playerShip.x * 0.02;
bg2.tilePosition.y = -playerShip.y * 0.02;

My problem is with the parallax background when the player reaches the game world bounds. If the ship jumps from x  position 1000 to position 0, for example,  then all the tile positions jump resulting in a jerky movement.

In the following gif I made a semi white transparent background for the game world so you can see exactly the parallax jump as soon as the purple ship wraps around the game world:

How can I avoid this so that the parallax background is always smooth?

Things I've thought of:

Not changing the position of the player when it wraps around, then use a modulo of the game world size for positioning. I can't do that because it will make the game data dirtier and harder to work with plus it increases network bandwidth which I want to avoid
Tying the tile offset to input. The player ship can move without input from collisions/inertia so that's no help

sentences:
In Unity, Is it possible to get gameobjects from non-open Scene? Sorry for my english mistakes,I treid my best to make myself easy to be understood.

On Unity 2017.1 + C#.

I am trying to make UnitTest to check the potential errors in the scenes.
and when I want to get the gameObjects from the two deifferent scenes,
I can only get the scene which is open currently in the editor.

How to solve this problem?
Or This is impossible to be done in Unity mechanism?

Two Secens I have:

Scene1 hierarchy:

Scene2 hierarchy:

Code:

Result: Only get the open scene's infomation

My Final Solution

Thanks for the help, you guys help me make progress.

This is the feedback of my work.
When I tried to solve my problems with the instruction,
I ran into some obstacle.

So, I followed the suggestion of the error message.

And the result is pleasant.

The possible reason I can not get the same result at the begining,
It may be because the different test mode(playMode/EditMode)

I will let myself take a break now and not dig deeper at this moment.

Thanks for your help and wish my dicovery can help someone too.

sentences:
Unity/C# : How to execute a function after another function has finished its execution? I've been trying to build a "event system" for a project that I'm working on . Here is how I'm doing it : I populate a list with reference to a gameObject and the functions that I need to execute from that gameObject . Then , when the "event" is triggered (in this case , when the player steps into a trigger collider) I just loop over the list and Invoke the functions inside it.

The problem with this is that every single function inside the list gets executed at the same time. This works fine in some cases but if I want to create a more cinematic event I need to have the ability to execute a function after the previous one has finished it's execution .Sadly I have no idea how to do that.

I've been reading a lot of the documentation of both Unity and C# about coroutines and delegates but I can't seem to wrap my head around all those things and find a way to do implement them on code .So I need your help with that :How can I achieve this?

TL;Dr version : I need your help in coming up with a way to execute a function after the previous function has ended it's execution .These functions would be stored in an array or list.

Here is the code of the trigger of the event itself

public class ActivateEvent : MonoBehaviour {

private bool activated;
public Signal[] actionList;
[HideInInspector]
public int actionEventAmount;

// Use this for initialization
void Start()
{
    activated = false;

}
void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.tag.Equals("Player") && !activated)
    {
        Activate();
    }
}

public void Activate()
{
    activated = true;
    for(int i=0;i<actionEventAmount;i++)
    {
        actionList[i].Invoke();
    }
}

}

and here is the code for the Signal Class

public class Signal
{
   public GameObject target;
   public string method;
   public string argType;

   public Signal()
   {

   }
   public Signal(System.Type argType)
   {
       this.argType = argType.FullName;
   }

 public void Invoke()
    {
        if (target != null && !string.IsNullOrEmpty(method))
            target.SendMessage(method, SendMessageOptions.RequireReceiver);
    }
    public void Invoke(object value)
    {
        if (argType != null)
        {
            if (target != null && !string.IsNullOrEmpty(method))
            {
                if (argType.Equals(value.GetType().FullName))
                    target.SendMessage(method, value, SendMessageOptions.RequireReceiver);
                else
                    Debug.LogError("Incorrect parameter type, expected [" + argType + "], got [" + value.GetType().FullName + "].");
            }
        }
        else
            Invoke();
    }
}

public class SignalAttribute : System.Attribute
{
    public string name;

    public SignalAttribute()
    {

    }
    public SignalAttribute(string name)
    {
        this.name = name;
    }
}

sentences:
How to vary the initial velocity of a jump based on hold time? What I want to do is, the longer player holds the screen, the longer distance the object will jump when they release the hold.

Here is my code:

private float timeBeginTap;
switch (touch.phase)
{
    // Finger start touching the screen
    case TouchPhase.Began:
        print("Start tapping");
        timeBeginTap = Time.time;
        break;

    // Finger leaving the screen
    case TouchPhase.Ended:
        //when finger release,the object jump
        float timeHolding = Time.time - timeBeginTap;
        Debug.Log($"The player1 touched the screen for {timeHolding} seconds.");

        Vector2 jumpVelocity = new Vector2(timeHolding, timeHolding);
        rb.velocity = rb.velocity + jumpVelocity;

        break;
}

So with the code above I can get the value like 0.6324167, or 0.423567 for timeHolding, which is the amount of time that user hold the finger on screen.

And I able to make the object jump by using this code below:

Vector2 jumpVelocity = new Vector2(timeHolding,timeHolding);
rb.velocity = rb.velocity + jumpVelocity;

But the distance traveled or "force" with which the object jumps is very small and it doesn't make sense. Therefore I make an attempt with the code below:

float right = 5;
float up = 10;
Vector2 jumpVelocity = new Vector2(right*timeHolding,up*timeHolding);
rb.velocity = rb.velocity + jumpVelocity;

With the code above, the distance is of course longer. But it feels constant and not dynamic, because the relationship between the Vector2's X and Y value is always constant.

Therefore my question is,

What is the correct way to define the values of X and Y for a Vector2 object based on the value of Time?

If I missed anything, please guide me in the right direction.

Desired Outcome:

For example,the velocity added to the box is to let the box jump from pole to another pole and stand on it.

The velocity is define by using the time user hold on the screen,the longer the user hold on screen,the greater the velocity,means the x,y value of Vector2 is define by the timeHolding.

Now when I hold the screen for the long time,the box will jump to  the 3rd or 4th pole,and it not guarantee will reach the pole.Like everything is by chance.

What I want is,the box will jump from 1st pole to 2nd pole,from 2nd to the 3rd and continuously.At the same time,the velocity to go higher or lower and the distance is depends on the time user hold the screen.

This is what I want and my limited understanding of the problem.

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:
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:
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:
Performance problem when multiple enemies are grouped up I have enemy with simple behavior: Reach the player's current position. In game are increasing waves, which are increasing the number of enemies. But when are more enemies (like 14), and they got too close to each other, there is big physics spike in profiler.

There are significant drop of performance... And as Profiler says, it's because of Physics...

Now I am little lost, I tried turn of the ignore collision on layer (which was turned on), so they don't overlap, but there is still little touch of course, when they group up, so still so much to process...
What is the best solution here?
I build it around rigidbodies for the use of Velocity, and detection of collisions with walls (edge collider), so when the object reaches there, it is easily stopped... But for this cases it seems now like not the best solution.

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:
Controls become inverted after a collision I'm just prototyping a simple project. I'm moving a sprite on screen using the Xbox gamepad:

public override void Update(GameTime gameTime)
    {
        gamePad = GamePad.GetState(PlayerIndex.One);
        GetPlayerRotation();
        base.Velocity = new Vector2(vSpeed.X * gamePad.ThumbSticks.Left.X, -vSpeed.Y * gamePad.ThumbSticks.Left.Y);
        base.Update(gameTime);
    }

    private void GetPlayerRotation()
    {
        leftThumb = gamePad.ThumbSticks.Left;
        base.Rotation = -(float)Math.Atan2(leftThumb.Y, leftThumb.X);
    }

This works fine to move the sprite in the correct direction (Dependent on the angle of the joystick).

However, the problem is, when I try to do a collision with a simple test object that is just a sprite, with a rectangle:

        public virtual bool Collision(Entity entity1, Entity entity2)
    {
        if (entity1.Rectangle.Intersects(entity2.Rectangle))
        {
            Debug.WriteLine("Collision");
            return true;
        }
        else
            return false;
    }

            foreach (TestBlock block in blockList)
        {
            block.Update(gameTime);
            if(player.Collision(player, block))
            {
                player.vSpeed = -player.vSpeed;
            }
        }

Whilst this does work, and the speed is inverted, when the bool returns to false after the collision, the control scheme becomes inverted (I.e, pressing the thumbstick up moves the sprite down).

I was trying to achieve a simple bounce effect off the block.

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:
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:
How would a game-state snapshot system be implemented for networked real-time games? I want to create a simple client-server real-time multiplayer game as a project for my networking class.

I've read a lot about real-time multiplayer network models and I understand the relationships between the client and the server and lag-compensation techniques.

What I want to do is something similar to the Quake 3 network model: basically, the server stores a snapshot of the whole game state; upon receiving input from the clients, the server creates a new snapshot reflecting the changes. Then, it calculates the differences between the new snapshot and the last one and sends them to the clients, so that they can be in sync.

This approach seems really solid to me - if the client and server have a stable connection, only the minimal necessary amount of data will be sent to keep them in sync. If the client gets out of sync, a full snapshot can be requested as well.

I cannot, however, find a good way to implement the snapshot system. I find it really hard to move away from single-player programming architecture and think about how I could store the game state in such a way that:

All the data is separated from the logic
Differences can be calculated between snapshot of game states
Game entities can be still easily manipulated via code

How is a snapshot class implemented? How are the entities and their data stored? Does every client entity have an ID that matches an ID on the server?

How are snapshot differences calculated?

In general: how would a game-state snapshot system be implemented?

sentences:
XNA makes the console flicker I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() for debugging.

In the game constructor I add

graphics.PreferredBackBufferWidth = 1920;
graphics.PreferredBackBufferHeight = 1080;
graphics.IsFullScreen = true;

Now the console text flicker. I use Console.Clear() the first thing I do in Update(). When I run the game in a window then the console text do not flicker. I even add counter to not update the text every time Update() is called and the console text still flicker in full screen mode. The same problem is there when I start form Windows Powershell. (The exact same thing do not flicker with MonoGame though.)

sentences:
Keep the timer counting after changing scenes In my game you have 2 minutes to finish the whole game and after searching for an answer to my problem I think I should use DontDestroyOnLoad but I can't understand how to use it correctly. Here's the code:

public class countdownTimer : MonoBehaviour {

    public float myTimer = 120;
    public Text timerText;
    private bool timerIsActive = true;

    void Start () {
        timerText = GetComponent<Text> ();
    }

    void Update () {
        if (timerIsActive) {
            myTimer -= Time.deltaTime;
            timerText.text = myTimer.ToString ("f0");
            print (myTimer);

            if (myTimer <= 0) {
                myTimer = 0;
                timerIsActive = false;
                SceneManager.LoadScene ("lose");

            }
        }

    }
}

sentences:
Alternatives to 'collecting coins' In the generic mario style game you collect coins as you go along your primary adventure (i.e. get to other side of the map). They usually offer generic additions like the ability to get extra lives and +score. Other games like platformers use them additionally as currency for skins etc. Donkey kong 64 its bananas and they do something similar, only sometimes its linked to progression itself (banana medals). These all relate to collecting the same kind of item where touching them is all you need to do.
Are there any examples or ideas applying the concept of coins (things you collect in a gameworld as you go along) to a more interesting game mechanic? For example in shooters I suppose it would be collecting weapons. In my case I'm specifically interested in what might be added to a top-down 2d game. Whether they should be optional asides (mario coins) or more important to progression (banana-medals unlocking maps)...I would look for alternatives more to the optional side.
Looking more to the collection side of the mechanic. There's alot you could do with the money, but don't focus so much on that part.

sentences:
Game world rendering I have a question about game world rendering. What is the best way to render background graphics such as grass and trees in 2D for your game?
Normally I would use array of tiles where every grass tile and tree are but I have big game world and for that this seems like too memory hungry solution
So what I need is nearly infinite game world rendering. the game I'm making is completely tileless and the game objects move using vectors
Also I need to render rivers
Some example pictures of what kind of game world I mean: maps

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:
Synchronizing "token" between players(multiplayer) I am implementing the multiplayer(client-server architecture) of a game, and I came to doubt about entities common to players.

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

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

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

I am thinking of doing the following:

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

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

advantages:
- Less work for the server to handle.

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

What could you do to avoid this disadvantage?

sentences:
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:
How can I avoid writing a class for each of my 800 different items? I have a webgame written in PHP and using MariaDB for the database. I'm currently looking into ways of improving core systems.

One example would be items. Currently, there is a table data_items that lists all of the items, what category they fall into, their sale value, description, icon and so on. There is then an inventory table with foreign keys referencing users and data_items, and a quantity column. Simple, and it works.

However, some items have effects. Actually most of them do.

Currently effects are implemented in one of two ways.

The item is requested specifically by the code. For example, a particular feature requires a particular item, so that item is loaded up, its quantity is checked in the player's inventory, and the code proceeds if the user has the item. This is fine.
The item's properties are checked. For items in the "Consumables" category, there's currently a switch statement that provides different effects based on the item in question. This is horrible.

I'm considering the idea of having a class for each item. The class can then have methods such as isConsumable(), consume(), and whatever else may be needed as applicable to each item.

Should I still have the database? I assume so. There are cases when items need to be searched, eg. by category, for showing the player's inventory. In a case like this, where there are upwards of 800 items at this point, I wouldn't want to have to load 800 classes.

What kind of combination of things should I be aiming for here? Maybe have an item "prototype" that just holds data, which can be used when enumerating the items for the inventory? Then, when the item is actually used for something, check for its specific class and only load it at that point? I think that makes sense, but any advice on this matter would be very helpful indeed.

I'm facing a similar problem for the creatures within the game. Most of them have nothing special to them, so the database works fine. But some have different images based on certain factors. One in particular can be customised to have whichever pair of colours the user chooses. These are currently all handled by switch statements in the getImage() method of the generic creature object. Should this be split into classes for each (of the 1200+) creatures?

sentences:
Can we measure the distance between and AR marker and camera? I'm in the middle of developing a game in Augmented Reality using Unity and ARToolkit plugin. I wanted to measure the approximate distance between the AR marker and the position of camera.
Can anyone help me with a solution to this problem?
Thanks in advance.

sentences:
missiles skip in collision detection I'm trying to work on spaceinvader. I have problem that missiles or the bullets skip frames due to its fast speed. I tried to use the previous position of the bullet in the collision check, but still, the collision does not work. it's pretty working on bullets with slow speed. Kindly see the attached video.
https://www.youtube.com/watch?v=jOVc-HGNI9Q&feature=youtu.be

  void Bullet::Update(float dt)
{
    Position.y -= 0.50 * dt;

    Vel = (Position - prevPosition).GetNormalised();

    if (Position.y < 0)
    {
        IsDestroyed = true;
    }
    else
        IsDestroyed = false;

    prevPosition = Position;

}

and for collision check:

// if there is intersection
        if (IntersectsWith((*it)->BoundingRect, barrierRect))
        {

            // subtract (*it) bullet position from barrrier's rect
            int normX = (*it)->prevPosition.x + (*it)->Vel.x - barrierRect.x;
            int normY = (*it)->prevPosition.y + (*it)->Vel.y - barrierRect.y;

            // barrier image pixels
            uint32* ptr = (uint32*)pixels;
            // height of the barrier

            int pixelOffset = normY*51 + normX;
            unsigned int color = ptr[pixelOffset];
            // look up the color if its not black, it should be green
            if (color != 0xFF000000)
            {
                // delete the bullet
                Bullet *bullet = *it;
                it = ship->Bullets->erase(it);
                delete bullet;
                ship->Canfire = true;
                isCollision = true;

                // blast a circle around that bullet hit position
                int radius = 9;
                for (int y = -radius; y <= radius; y++)
                {
                    for (int x = -radius; x <= radius; x++)
                    {
                        if (x*x + y*y <= radius*radius)
                        {
                            int j = x + normX;
                            int i = y + normY;
                            int pixelOffset = i*51  + j;
                            ptr[pixelOffset] = 0xff000000;
                        }
                    }
                }

            }

sentences:
Why the changes to the children and grand children objects not taken into account? Currently I am working on a framework for a game utilising the SFML graphics library and in one of the classes representing a renderable object in the framework there is an sf::Sprite that is used to represent and draw the object. The issue is that the object instance of class 1 that is represented by the sf::Sprite (which is a private member variable of class 1), is in turn a private member variable of class 2 of which an instance is in turn a private member variable of class 3 from which the sprites belonging to the instances of class 1 and 2 must be retrieved to be rendered in the renderer class. In classes 1, 2 and 3 there are appropriate getter functions like so:

class One
{
     public:

     //Functions
     One();
    ~One();

     sf::Sprite getOne(){ return oneRep;};
    animate();

     private:
     //One variables
     sf::Texture oneTexture;
     sf::Sprite oneRep;

};

class Two
{
     public:

     //Functions
     Two();
    ~Two();
     One getCOneInst(){ return cOneInst;};

    private:

    //Class 1 private member variable
    One cOneInst;
};

class Three
{
    public:

    //Functions
    Three();
    ~Three();

    initTestSprite();
    One getCTwoInst(){ return cTwoInst;};

private:

    //Class 2 private member variable
    Two cTwoInst;
};

class Renderer
{
    public:

    //Functions
    Renderer();
    ~Renderer();

    private:
    //Class 3 private member variable
    Three cThreeInst;

    //Test Class One private member variables
    One testCOneInst;
    sf::Texture oneTexture;
    sf::vector2f position

};

Which are used to access the sprites representing the instances of class 1 and 2 from the instance of class 3 so that the renderer class may render them to the screen of the game. The issue is that: if an instance of class 1 (represented by the sf::Sprite) is constructed in the renderer class like so:

initTestSprite()
{
    testCOneInst.setTexture(oneTexture);
    testCOneInst.setTextureRect(textRect);
    testCOneInst.setColor(sf::Color(255, 255, 255, 255));
    testCOneInst.setPosition(position);
}

And should the getter function be called on the instance of classOne to retrieve the sprite representing the instance of classOne for rendering in the render class

window.draw(testCOneInst.getOne());

The render class through the function above will render the sprite representing the instance of class One: testCOneInst correctly. The problem and the question is: When the sprite representing the instance of class One must be retrieved from the instance of class Two in which the class One instance is a private member variable – the functions that should be able to be called on the class One sprite to manipulate the texture being applied to it, for example setting the IntRect texture to a new location in order to animate the sprite representing the instance of class One does not function correctly – the original texture is still applied to the sprite representing the instance of class One, if the sprite is accessed by the renderer class from  the instance of class 2 and in turn the instance of class 3 like so:

cThreeInst.getCTwoInst().getCOneInst().animate();

Before rendering the sprite with the updated texture changes to the window like so:

window.draw(cThreeInst.getCTwoInst().getCOneInst().getOne());

The changes to the IntRect of the sf::Sprite instance representing class 1 will not be show when the sprite is rendered – and the question is why?

sentences:
Capturing video with sound, from cameras in Unity? I want to capture video from cameras and save them in Unity. There is a function Application.CaptureScreenShot() but it only captures images. There is another function that only captures images, too.

It's said to be possible to capture images and attach them together to make a video file but I think it uses a lot of resources and makes the process heavy and in the end there is still no sound.

I mean ingame cameras not reall cameras. I want to capture videos from game

Is there any other way for me to record sound?

sentences:
In regards to real time turn based games, where should the turn handler be? I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc.
Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself).
Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?

sentences:
How do I rotate and flip 2D sprites stored in a 1D array of pixels? I am using a 1D array of pixels for rendering in 2D in java. I am interested in rotation (in radians) and mirroring across the x and y axes. The desired result looks something like this:

Public void render(Sprite sprite, int x, int y, double rotation, boolean xFlip, boolean yFlip) {}

I am not using any libraries for the current project. The information that I have gleaned is that I must somehow multiply the points of my pixels with a transformation matrix. I am familiar with matrices (outside of a programming context) and am ok with rigorous mathematics.

How do I rotate and flip 2D sprites with a 1D array of pixels?

EDIT
The sprite class is almost exclusively a wrapped array of pixel data.
In my Screen class:

image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int[] pixels  = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();

and then

g.drawImage(image, 0, 0, getWidth(), getHeight(), null);

sentences:
Can you write the current frame number to a text file? I am running an experiment in Unity 5 to see the effect increasing the particles of a particle effect has on FPS over time. (this is background work for a much larger piece of work). Currently I write the FPS count from the profiler to a log file and this shows the framenumber and its FPS at that frame. To a seperate log file I write the number of particles on screen and the time.

I have no way of linking these two files to draw up results.

So my question is, how do I write the current framenumber to a file? Can I do this?

UPDATE

I would like the same framenumber that the unity Profiler gives me in its log.

sentences:
Voice Commands Using Microphone Possible Duplicate:
  Voice input in games beyond voip chat

I recently made a game  where you say something into the microphone, and the computer repeats it, but I was wondering how to make voice commands, where if you say a certain thing it does something. For example:

I say "Blue" and the background color changes to blue.
I say "Red" and the background color changes to red.

sentences:
Calculating gameObjects hit by a directional light source I am trying to figure out in my current game whether a gameObject is lit by a directional light or not. Below is my image inside the Unity game engine

As my game runs around a Day/Night cycle, I need to constantly check which hex tiles are lit and which are not. I am using one directional light source in my scene and I am rotating it around the x-axis for the day night cycle.

Currently, I am using the dot product to calculate if the tile is lit by the directional light but its not very accurate.

 Vector3 forward = Light.transform.TransformDirection(Vector3.forward);
 float dot = Vector3.Dot(forward, -(tile.transform.position - Light.transform.position));

Is there a better way to do check this inside Unity??

sentences:
How to change the speed of an NPC? I created a blueprint. I added several components to the blueprint. I made it follow a target point and it does it correctly. I'd like to make the NPC make this way to the target point faster, but I do not know how to set the speed.

How I Created:

Components of the NPC:

I've clicked on all components looking for a way to set their speed. I also clicked Class Settings and Class Defaults, but nothing resulted.

Then I tried to find some function or command related to the speed, taking a reference from the NPC itself:

I added values to tranform, but did not change the result in the game at all:

Links that I clicked at the time I typed the title of the question:

How do I change the speed of an object without changing path travelled?

Changing speed of an object

sentences:
Calling method with enum parameters from buttons I have the following enum:

public enum WeaponType { Sword, Spear, Blunt, Ranged }

And I have the following public methods on a component:

public void MyMethod1(int myparam) { ... }
public void MyMethod2(WeaponType myparam) { ... }

Why is it that when I try to call my methods from a Button component, I can not see the ones that use enumerations as parameters?

sentences:
Why aren't the changes to the transform being applied? I don't understand why this doesn't work. The code only acts when I press "Horizontal" buttons.
Here's the code:
using UnityEngine;
using Flycer.Helpers;

namespace Flycer.Controllers
{
    public class MovementNew : BaseController
    {
        #region ========== Variables ========

        [SerializeField] [Tooltip("Forward moving speed")] [Range(0, 1f)] float _forSpeed = 0.5f;
        [SerializeField] [Tooltip("Slide speed")] private float speedSlide = 10;
        [SerializeField] [Tooltip("Max slide distance")] private float maxSlide = 4;

        private Vector3 _curPos;
        float slide = 0;
        int i = 1;

        #endregion ========== Variables ========

        #region ========== Unity-time ========

        private void Start()
        {
            base.On();
            _curPos = transform.position;
        }

        private void Update()
        {
            if (!Enabled)
                return;

            if (Input.GetButton(Controls.Horizontal.ToString()))
                Moving();
        }

        private void FixedUpdate()
        {
            _curPos += new Vector3(0, 0, _forSpeed);
        }

        #endregion ========== Unity-time ========

        #region ========== Methods ========

        void Moving()
        {
            slide = Input.GetAxis("Horizontal") * speedSlide;

            _curPos.x += slide * Time.deltaTime;

            _curPos.x = Mathf.Clamp(_curPos.x, -maxSlide, maxSlide);

            transform.position = _curPos;
        }

        #endregion ========== Methods ========
    }
}

It doesn't move in any condition whether it has a RigidBody or not.

sentences:
How do I do 2D z-index parallax in Unity3d? I am new to unity3d and want to develop a simple game like crazy cabie. I have to implement a z-index parallax for moving sprites towards the player and generating new sprite at the farthest z-index.

How can I do this?

sentences:
How to rotate an object based on the movement and angles of Lifters I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include:

Supporting 1-4 Lifters at any side of the Object (e.g., both on one side, opposite, so on - can't make any guarantees about their positions relative to the object)
Supporting any orientation of the Object (e.g. the Object could be flipped on its side, sideways, or upside down; can't make guarantees that Forward is always facing forward, etc)

As such I implemented this by having the object move by setting its velocity to the average of the Lifters' velocity.
Now, if not all of them move (or if there's a disparity in their velocities), I want the object to rotate, like so:

This is done by keeping track of how much an individual lifter has moved in a frame from the Object's position, and calculating the angle via
m_Angle += Vector3.SignedAngle(lastPos - transform.position, currentPos - transform.position).

This "movement angle" I add up for every Lifter and then at the end, Rotate the Object via Transform.Rotate(Vector3.up, m_Angle).
However, this approach has some problems:

Calculations are done along the Y axis and therefore does not angle the Object up or down if the Lifters have different vertical positions,
m_Angle actually overshoots, but I found simply dividing m_Angle by the number of Lifters made it perfectly accurate. I do not know why this works.

Because I want this to rotate the object in "3 dimensions", I have attempted to calculate the "euler angles" of each Lifters' movement via:
Vector3 oldDisplacement = lastPos - transform.position;
Vector3 newDisplacement = currentPos - transform.position;
Quaternion rotation = Quaternion.FromToRotation(oldDisplacement, newDisplacement);
m_EulerAngles += rotation.eulerAngles;

And then at the end, I rotate the Object based on these "movement angles":
transform.Rotate(m_EulerAngles, Space.World);

This works in three dimensions, however it is off in the same way that m_Angle was before I divided it. It rotates the object too far. On top of that it seems to produce rotations along axes that have no displacement.

I want the object to only rotate exactly by the angle created by the Lifter's movement. This should keep it "synced" to Blue instead of rotating past as you see here.
When I check how much rotation Blue is adding per frame, I get an output like so:
Blue is adding (0.000, 359.507, 0.066); on movement (-0.015, 0.000, 0.000)

Despite moving solely on the x-axis, there is a z-euler angle being created, and the y-euler angle of 0.493 degrees is too much for -0.015f movement. I do not know why rotation.eulerAngles is inaccurate in my usage.
The only issue I can perceive is that since the Object's position is also moved at the end, the angle calculation assumes it is not moving and generates a larger angle (e.g., perhaps newDisplacement should be something like currentPos - (transform.position - m_Body.velocity * Time.deltaTime) ). However, removing the Object's movement from the finalPosition of the Lifter seemingly has no effect.
Or perhaps there is some finite precision in Quaternion.FromToRotation? Or my math is incorrect in some way?
I'd love a sanity check on the code or approach or if I should approach this problem from a different perspective.
EDIT: Here's an example gif of the functionality with m_EulerAngles code (so the rotation overshoots, but works in 3D - also I recorded the gif at lower fps that's not the game's framerate)

sentences:
Sync Collider size with bones in model I'm setting at runtime a BoxCollider2D size by taking the difference between the Y position of two bones on the model... but the size I'm getting out of this creates a collider that is almost twice as tall as the distance between the two points... am I making a dumb mistake somewhere? If it matters, it's a 3d model in a 2d environment.
BoxCollider.size = new Vector2(
         BoxDefaultSize.x,
         Mathf.Abs(head.position.y - Mathf.Min(leftFoot.position.y, rightFoot.position.y))
        );

In the picture the blue gizmo shows the foot position, the green one the head position. The collider is almost 2x the distance between them:

Maybe there's a better way to sync the collider with the model animation that I don't know about?
Addendum:

Vector3.Distance(head.position, leftFoot.position) returns pretty much the same result

sentences:
2015 android multiplayer server based Implementation There are a lot of old posts about multiplayer implementations on SE, so i'm looking for an up-to-date answer. What is the best server-client implementation of real-time multiplayer now? I have an Amazon MYSQL Server hosted by digitalOcean, I've made a REST web service that communicates with the Server and Android app, and I have my Android app running receiving and sending data.

I want to add a multiplayer minigame to what I have right now where 2 players would see the same screen and one user would receive location data (which i'm already storing in the server and sending to all devices with the app) from the other and would have an interface to interact with the data they're receiving (like building towers around the location and deploying units). The computer AI would need to be synced between both devices.

The matches would last maybe 3 minutes tops and the location data would have to be streamed constantly as well as the interaction from the other user. The computer AI would be streamed to both.

I've done a lot of research on the topic, and most of my experience was from a bluetooth P2P game I created in 2011 using sockets. So what are the most common implementations today? What are the most common libraries? I'm currently using Android Studio for the app and Notepad++ for the PHP webservice.

EDIT:
I'm fine with answers promoting their own products, but explain how your product is better than Google's Game Services (which appears to be the best choice right now). I'm really looking for a way to implement the multiplayer with the server I'm already using.

sentences:
How 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:
How can I make permanent death in a MUD seem acceptable and fair to players? I have considered writing a MUD for years, and I have a lot of ideas my friends think are really cool (and that's how I'd hope to get anywhere -- word of mouth).

Thing is, there's one thing I have always wanted, that my friends and strangers hated: permanent death. Now, the emotional response I get to this is visceral revulsion, every time. I'm pretty sure I am the only person that wants this, or if I'm not, I'm a tiny minority.

Now, the reason I want it is because I want the actions of the players to matter. Unlike a lot of other MUDs, which have a set of static city-states and social institutions etc, I want the things my players do, should I get any, to actually change the situation. And that includes killing people.

If you kill someone, you didn't send them to time out, you killed them. What happens when you kill people? They go away. They don't come back in half an hour to smack talk you some more. They're gone. Forever.

By making death non-permanent, you make death not matter. It would be similar if a climax to a character's arc is getting a speeding ticket. It cheapens it. Non-permanent death cheapens death.

How can I:
1) Convince my players (and random people!) that this is actually a good idea?, or

2) Find some other way to make death and violence matter as much as it does in real life (except within the game, of course) sans character deletion? What alternatives are there out there?

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:
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 to demo Advanced Game AI as a portfolio piece? Basically every Game company wants to see a portfolio that exhibits your skill set.  If you're specializing in AI though, what and how should you show off your skills.
Some thoughts

Is nice graphics in an AI demo a must(get past nontechnical HR that don't understand AI, think 3d verse 2d)?
Demo multi-featured AI or a single focused example.
Fundamental skills like path-finding, hfsm, planning, etc are critical AI components but does it really impress as a portfolio piece?
Single AI entity, multiple entities, or large populations, is more always better?
Also as a portfolio piece ideally there would be an executable, and videos which should show off whatever is trying to be shown off within only a few minutes.

Examples
I would say any of the skills exhibited in this video would make for a great portfolio piece but are game companies really expecting this from a single person.

Autodesk Kynapse

AI Sandbox is another great example but this was made from the work of many many people.

AI Sandbox

Any examples of good AI portfolios would be great.

sentences:
Vulkan vkEnumeratePhysicalDevices Returning Unexpected Device Count In the machine I'm running I have two GTX 980 Tis.
When I query the physical device count with vkEnumeratePhysicalDevices it always returns 1 despite having 2 physical discrete graphics cards. When I use vulkaninfo the only device listed is GPU0 which is a DISCRETE_GPU / GTX 980 Ti.

This happens in Windows 10 as well as GNU/Linux 4.5 using Vulkan API 1.0.11 with proprietary Nvidia drivers.

Is this normal behavior and I'm not using the API correctly or is this a bug? I feel like I've made a glaring obvious mistake but I can't find anything in the Vulkan specification about it.

For clarity, this is exactly how I query physical device count:

auto deviceCount = uint32_t{0};
instance.enumeratePhysicalDevices(&deviceCount, nullptr);
// At this point deviceCount is 1

Also, to confirm that the OS sees the cards:

Windows 10:

C:\Users\matt>wmic path win32_VideoController get name
Name
NVIDIA GeForce GTX 980 Ti
NVIDIA GeForce GTX 980 Ti

Linux 4.5:

+------------------------------------------------------+
| NVIDIA-SMI 364.19     Driver Version: 364.19         |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 980 Ti  Off  | 0000:01:00.0      On |                  N/A |
|  0%   56C    P8    34W / 300W |    444MiB /  6140MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 980 Ti  Off  | 0000:02:00.0     Off |                  N/A |
|  0%   43C    P8    25W / 300W |     22MiB /  6143MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

sentences:
Fading Text in one character at a time I'm a Unity game developer. I have a bit of a conundrum. I have two enumerators, one that displays text one character at a time, and the other takes the whole text and fades it in over time:

private IEnumerator FadeTo(float aValue, float tValue)
{
    float alpha = GameText.GetComponent<Text>().color.a;
    for (float i = 0; i < 1.0f; i += Time.deltaTime / tValue)
    {
        Color alphaChange = new Color(1, 1, 1, Mathf.Lerp(alpha, aValue, i));
        GameText.GetComponent<Text>().color = alphaChange;
        yield return null;
    }
}
private IEnumerator CharXChar(string text)
{
    for (int i = 0; i < text.Length; i++)
    {
        yield return new WaitForSeconds(0.1f);
        GameText.GetComponent<Text>().text = GameText.GetComponent<Text>().text + text[i];
    }
}

The problem is, I do not know how to get the FadeTo enumerator to modify each character individually. I just need a step in the right direction. Any help would be greatly thanked.

sentences:
Manually creating an instance of object derived from MonoBehaviour I'm currently "newing" an instance of a class I have that derives from MonoBehaviour and store it in a list. The value of this instance is "null" however, even though it has all the fields of my derived class in it so it passes as null in null checks. After more reading it seems it's a bad idea to manually new up an instance of an object that derives from MonoBehaviour.

The class is an Actor class. I have a situation where enemy actors are 3D models in my scene and so I want them to derive from MonoBehaviour, but the player actors don't have world representations really. I just have a picture of them in the corner. Similar to Legend of Grimrock.

I wanted the 1 Actor class since the data they need is all the same and I wanted to avoid having 2 classes for no seemingly reason other than not newing up a MonoBehaviour derived class.

What are my options with this requirement when my player actors don't need MonoBehaviour but my enemy actors do but they all need to have the same properties?

sentences:
Unable to open project from a scene.unity file The tutorial I'm following has provided its project files, and I'm trying to open them in Unity. Here is the project download link. You can also go to the tutorial webpage and scroll down to download.

I can't figure out how to do it. Here is what I've done.

a) Extract zip to my Unity Scenes/ folder.

b) Open Unity, create a new project called tutorial

c) File -> Open Scene -> navigate to Unity Scenes/voxeltut3/scene.unity

d) Click Open

It opens.. but then I don't see any of the tutorial's files in my project. There's none of the c# scripts, no art, no prefabs... It's just the original empty project that I created.

I also tried importing it as a new package:

e) Assets -> Import New Asset... -> select Unity Scenes/voxeltut3/scene.unity

f) Click Import

And nothing happens. The Import New Asset dialogbox is still open with the scene.unity selected. It's like it's telling me that I've selected an invalid file. So I guess this is wrong?

How do I open this tutorial project? I'm using unity 5.3.2

This is the folder structure the new Unity project that it created for me:

C:\Users\me\Documents\Unity Scenes

tutorial/
    Assets/
    Library/
    ProjectSettings/

I unzipped the tutorial files in

C:\Users\me\Documents\Unity Scenes

voxeltut3/
    Materials/
        tiles.mat
        tiles.mat.meta
    Block.cs
    BlockAir.cs
    BlockGrass.cs
    scene.unity
    ... (other files)

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

My approach:

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

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

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

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

Now to my question:

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

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

What do you recommend for such a system?

sentences:
A* pathfinding for an isometric map I am making an isometric tower defense game in XNA and trying to implement the A* pathfinding algorithms for my enemy AI. I am quite new to programming, especially AI and pathfinding, so please excuse my lack of knowledge.

I am using an a* tutorial from an XNA game programming book but it is made for standard square tile maps. I am trying to adapt this into my isometric tile engine and running into a few problems. Firstly, here are the major differences between the two maps:

Book:

Tiles are 32x32.
directions are up, down, left, right.
obstacles are wall tiles

My Map:

tiles are 64 x 64
4 directions: NE, NW, SE, SW
impassable tiles

From these differences, I can figure out that I have to make changes to the grid setup, cost calculation and tile types.

I have made adjustments for the latter two, but I am having problems setting up the grid/gridnodes which is the most important part. Or perhaps, I simply don't understand the code well enough.

Here is the code for the Pathnode:

class PathNode
{

    public PathNode ParentNode;
    public PathNode EndNode;
    private Vector2 gridLocation;
    public float TotalCost;
    public float DirectCost;
    public Vector2 GridLocation
    {
        get { return gridLocation; }
        set
        {
            gridLocation = new Vector2(
               (float)MathHelper.Clamp(value.X, 0f, (float)50),
               (float)MathHelper.Clamp(value.Y, 0f, (float)50));
        }
    }

    public int GridX
    {
        get { return (int)gridLocation.X; }
    }

    public int GridY
    {
        get { return (int)gridLocation.Y; }
    }

    public PathNode(
        PathNode parentNode,
        PathNode endNode,
        Vector2 gridLocation,
        float cost)
    {
        ParentNode = parentNode;
        GridLocation = gridLocation;
        EndNode = endNode;
        DirectCost = cost;
        if (!(endNode == null))
        {
            TotalCost = DirectCost + LinearCost();
        }
    }

    public float LinearCost()
    {
        return (
            Vector2.Distance(
            EndNode.GridLocation,
            this.GridLocation));
    }

    public bool IsEqualToNode(PathNode node)
    {
        return (GridLocation == node.GridLocation);
    }

}

What should I change in this class to adapt this pathnode.cs to an isometric map? It is probably the gridLocation property but I am stumped as to what should be in there.

Any other tips on isometric pathfinding would be greatly appreciated!

sentences:
How can I measure ms between frame to reproduce it Hello I'm coding a extension to an existing game - not really an extension since a re-code all so the it looks like another adventure for player - and to achieve it I use existing tilesets and so, but my main problem is for animated tilesets, I can't find anywhere the frame rate, sometimes I assumed it was simply 60fps (16.67ms between frame) because I figured out testing that it should be somewhere between 15ms and 20ms, but I have to good way to figure it out, I wanted to use something like OBS in 1000 fps but it doesn't seem available, in any other recording app neither. How would/did you guys do what I need to?
Thanks in advance and gl in your own projects!

EDIT1: I'm trying to find the intended frame rate of the animation (that is, how long the author of the animation expected each frame to stay on screen?) ; Because sometimes it's really really short like around 15ms how can I do that? My question is not about global fps but some animated tile fps

sentences: Voice over programming language I am looking for a voice over programming language. Instead of using people for voice over, I want to use a computer, which does voice over for different people. Is this type of thing possible, or is there any way that I can achieve this?

sentences:
Why does setting a static member value in MonoBehaviour child class constructor have no effect? I am following a tutorial for Unity. I don't know C# but I know other similar languages.

I got the tutorial to work. Here is the script I used.

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

public class PlayerMove : MonoBehaviour {

    private Rigidbody rb;
    public float speed;

    // Use this for initialization
    void Start () {
        speed = 3.5f;
        rb = GetComponent <Rigidbody> ();
    }

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

        float fx = Input.GetAxis ("Horizontal");
        float fz = Input.GetAxis ("Vertical");

        rb.AddForce (new Vector3 (fx, 0, fz) * speed);
    }
}

This goes slightly against my C++ instincts, which are to put initialization values in a constructor.

    public PlayerMove ()
    {
        speed = 3.5f;
    }

    void Start () {
        rb = GetComponent <Rigidbody> ();
    }

This doesn't work. In Unity, the speed field has an initial value of 0.

Why does setting the initial value in a constructor not work?

sentences:
Compute spheres 2D speeds in perspective projected animations I created two animations that consist of spheres moving in a perspective projected 3D space, which means that the size and speed of the spheres vary with the distance: they increase when they are closer to the viewer (the camera) and decrease when they move farther away from the viewer. Both animations are played on a computer 2D screen.

In the Random Movement Animation, the spheres are moving randomly in different directions (GIF 1). In my code, I computed their spherical coordinates (sphere.position.xyz) with the two angles theta and Phi (see below the formulas used for the position and their derivates).

In the Optic Flow Animation, it is the camera that moves along the z-axis (camera_z -= .1) and the spheres don't move (GIF 2).

In the context of a neuroscientific experiment, I need to match the perception of speed between the two animations, thus I need to first compute the 2D speed in both animations (By 2D, I refer to the screen coordinates rather than the world coordinates). What are the respective speed formulas for each animation? Does the speed of each sphere in the optic flow calculation equal to the camera's speed?

How I generated Spheres coordinates in the Random animation:

for sphere in spheres:

        sphere.position.xy = np.random.uniform(-25, 25, size=2)
        z = np.random.uniform(near_z, far_z)

        sphere.position.z = z
        sphere.position.x *= z/-50
        sphere.position.y *= z/-50

        sphere.theta_deg = np.random.rand(1) * 360
        sphere.phi_deg = np.random.rand(1) * 360

        theta_rad = sphere.theta_deg * np.pi / 180
        phi_rad = sphere.phi_deg* np.pi / 180

        sphere.dx = speed * np.sin(-phi_rad - theta_rad) / frameRate
        sphere.dy = -speed * np.cos(phi_rad + theta_rad) / frameRate
        sphere.dz = -speed * np.cos(theta_rad) / frameRate

sentences:
How to instantiate seamless scrolling tiles I'm trying to create in Unity an "Endless Runner" game, where the player remains stationary on the 0 of the axes while the tiles underneath him scroll with a fixed speed on the Z-Axis.
The script attached spawns 5 tiles at the start while already scrolling at the speed set in the GameManager and then keeps on spawning tiles based on a timer.
The issue I'm facing is the following:
The tiles that are spawned with the timer are too much distant from the starting set of tiles.
How can I calculate the correct distance between the set of the already scrolling tiles and those the script start to spawn after 5 seconds in order to have seamless scrolling?
I'm attaching the script with what I've written so far in the hope that someone knows how to proceed, or perhaps knows a different method. Thanks!
public class TileManager : MonoBehaviour
{
    [SerializeField] private Transform player;
    [SerializeField] private GameObject[] tilesArray;
    [SerializeField] private int tilesToSpawn = 5;
    [SerializeField] private float zPosSpawn = 0f;
    [SerializeField] private float tileLength = 20f;

    public List<GameObject> tilesList;
    private float spawnRate;
    private float timeSinceLastSpawned;

    void Start()
    {
        //scrollingSpeed is -5
        spawnRate = GameManager.Instance.scrollingObjectsSpeed * -1;
        StartSpawnLogic();
    }

    void Update()
    {
        timeSinceLastSpawned += Time.deltaTime;
        SpawnTimer();
        DestroyAfterSpawn();

    }

    private void StartSpawnLogic()
        {
            for (int i = 0; i < tilesToSpawn; i++)
            {
                if (i == 0)
                {
                    SpawnTiles(0);
                }
                else
                {
                    SpawnTiles(Random.Range(0, tilesArray.Length));
                }
            }
        }

    //SPAWN FUNCTION
    private void SpawnTiles(int tileIndex)
    {
        //On Instantiation a list is filled to later dispose of the tiles after they reached a certain point
        tilesList.Add((GameObject)Instantiate(tilesArray[tileIndex], transform.forward * zPosSpawn, Quaternion.identity));
        zPosSpawn += tileLength;
    }

    //TIMER
    private void SpawnTimer()
    {
        if (timeSinceLastSpawned >= spawnRate)
        {
            timeSinceLastSpawned = 0;
            SpawnTiles(Random.Range(1, tilesArray.Length));
        }
    }

    void RemoveObjFromList(GameObject tile)
    {
        Destroy(tile);
        tilesList.Remove(tile);
    }

    private void DestroyAfterSpawn()
    {
        for (int i = 0; i < tilesList.Count; i++)
        {
            if (tilesList[i].transform.position.z <= -20f)
            {
                RemoveObjFromList(tilesList[i]);
            }
        }
    }
}

sentences: Gdx.graphics.getWidth() vs cam.viewport width I'm facing difficulty understanding the difference between Gdx.graphics.getWidth() vs cam.viewportwidth, What is the difference?

sentences:
How do I add a method to a class without editing the source file? I am trying to add a method to a Minecraft source file, but I have to figure out how to do it without actually editing the source files, as it would be illegal to redistribute Minecraft's source files with the mod I am creating.

I need to add the method setInPortalZub() to the EntityPlayer class located in net.minecraft.entity.player. I am using the MCP/Minecaft Forge API. I have tried creating an EntityPlayer instance, but I'm not exactly sure how to make this work.

sentences:
How do I account for the velocity difference between a ship and it's fired projectile? In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.

The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity?
This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.

I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:

public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;

}

sentences:
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:
intersection of primitive in a unit wrapping 3D space is there people good enough for a math problem (for a shader)?
I want to write an algorithm that would intersect primitives (triangles, squares, circle, sphere, cube, cylinder) inside a unit wrapping space, no raymarching, at least axis aligned.

The goal is to write a shader. The benefit, is that, since it's analytic, I can do trick by passing parameters with the texture per pixel.

I already do this by abusing simpler variants of of interior design, by cranking the space between side low, and get dense (simple) foliage and grass for free, or brick walls, or any greebles. Except I'm confined to simple convex shapes with interior style shader, with this I could have more interesting parallax to abuse artistically. I use the flow of the polygon surface to create interesting shapes, and UV texture to break pattern artistically. Work wonder for low specs machine!

I figure out how to do it with a single point at the boundaries of the space, using the planet alignment problem (akin to the two clock hand overlap problem). But I failed to generalized it.

This problem is similar to this math problem
https://amininima.wordpress.com/2013/05/27/the-laser-gun/

But without the reflection.

Other potential benefits is that it have a period we can find mathematically, we could probably infer an analytical "overdraw", by "discarding depth" have a "traversed thickness", if we generalized the, such as we can also shift the position of the primitive at each "jump", we could probably find a consistent "integral 3D noise", which would made cloud noise in convex volume much cheaper than marching.

  Optionally "the graal" would be at least 1 period coil repeated on axis aligned.
  But we can't intersect cosine "cheaply", I tried using x²
  approximations but my math melted. A unit coil being an unwrap unit
  cylinder diagonal, was the next step explored, ie to intersect axis
  aligned cylinder then find on its surface the diagonal:
  the idea above is, taking the perpendicular going through the cylinder center, we observe that the tracing "regularly" step through it, using that stepping and the slope of the ray, we can infer point on the wrapping surface of the cylinder, the entire idea is to find the step pattern so we can intersect the diagonal within a certain distance.

EDIT: While talking below in the comment, I realized that I probably could shift the 1D wrapping space to the 2D projection of the ray direction, then find the period of the primitive's "axis" projected on that line, and since I already found the case for 1D, use that to infer the remaining intersection. Just an idea not developed yet. Should make a drawing to show what I mean, it's not clear yet in words.

sentences:
SFML title bar with weird characters when using UTF-8 (Previously asked at https://stackoverflow.com/questions/4922478/sfml-title-bar-with-weird-characters-when-using-utf-8)

I've just started using SFML and one of the first problems I've come across is some weird characters on the the titlebar whenever I try to use accents or any other extended char.

For instance, I've got:

sf::RenderWindow Ventana(sf::VideoMode(800, 600, 32), "Año nuevóóó");

And the titlebar renders like AÂ+o nuevoA³A³A³

This ONLY HAPPENS if my source code file is enconded in UTF-8. If I change the file encoding to ISO-8859-1, it shows properly. Obviously all of my files use UTF-8, as its the system-wide encoding. I'm using GCC under Ubuntu GNU/Linux.

I've tried using the different utilities in sf::Unicode to adapt the text, but none of them seems to work.

sentences:
Need to combine a color, mask, and sprite layer in a shader My task: to display a sprite using different team colors. I have a sprte graphic, part of which has to be displayed as a team color. The color isn't 'flat', i.e. it shades from brighter to darker. I can't "pre-build" the graphics because there are just too many, so I have to generate them at runtime. I've decided to use a shader, and supply it with a texture consisting of the team color, a texture consisting of a mask (black=no color, white=full color, gray=progressively dimmed color), and the sprite grapic, with the areas where the team color shows being transparent.

So here's my shader code:

// Effect attempts to merge a color layer, a mask layer, and a sprite layer
// to produce a complete sprite

sampler UnitSampler : register(s0); // the unit
sampler MaskSampler : register(s1); // the mask
sampler ColorSampler : register(s2);    // the color

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 tex1 = tex2D(ColorSampler, texCoord);    // get the color
    float4 tex2 = tex2D(MaskSampler, texCoord); // get the mask
    float4 tex3 = tex2D(UnitSampler,texCoord);  // get the unit
    float4 tex4 = tex1 * tex2.r * tex3; // color * mask * unit

    return tex4;
}

My problem is the calculations involving tex1 through tex4. I don't really understand how the manipulations work, so I'm just thrashing around, producing lots of different incorrect effects. So given tex1 through tex3, what calcs do I do in order to take the color (tex1), mask it (tex2), and apply the result to the unit if it's not zero?

And would I be better off to make the mask just on/off (white/black) and put the color shading in the unit graphic?

sentences:
how to save data in a visual novel with shared object I've been looking for ways to save data in a visual novel, I have seen that the best way to do  is with shared object but the tutorials are usually saved scores and I want to save the history progression

how can I do it?

Which variable should be used?

What should contain the variable?

shared object works for android and ios?

Thanks  for reading

sentences:
Combining two surfaces I have two surfaces. One is the back-buffer, the other is a surface with some user-interface overlay graphics already rendered onto it. Both surfaces have identical properties (size, format...etc).

I want to copy one surface onto the other and create the UI overlay.

Is this possible to do?

sentences:
How to make a bitmap font having only a PNG file? Is there a way to "convert" an existing PNG file with the characters' images into a bitmap font? Basically, I want to create a FNT file using an image like this...

(source: opengameart.org)
...without the access to a TTF file of the image's characters or any other typical font formats.

sentences:
How to implement cheat proof trading system in a game? I want to make a game where you can trade items you find from the world, the world would be static, so the master server would always know exactly how much items of X there are etc.

What should i take into account when building such a system?

I want to avoid people being able to cheat and filling the game with free items, but at the same time i want it to be as less server dependant as possible, as i cant afford buying thousands of servers just to run their games on them constantly, even if i had the money, i would prefer not make people to rely on my servers so they can be playing it at any time they want at anywhere, but if they want to ensure the validity of the objects he is going to buy from someone, he would have to connect to the master server if he wants to ensure the objects validity.

But how could i know which objects are genuine and which are fake? So i thought i would give each object in the world an unique ID which cannot be guessed. But then again, wouldnt i have to somehow prove that i collected those items with valid actions? And how could i possibly do that without making the server to run my game from the beginning? And how could i prevent someone trading the same item twice etc.

So i thought i could use a Bitcoin system, but i dont know much about it and im not sure would this be an option since there would be a lot of trading, and a lot more "coins" to trade, so the amount of history information might be too much to handle, not to mention i want to prevent people from cheating in any way, for example you cant trade stuff from the other side of the world and magically teleport the items there (assuming you dont own a teleport atm), you would have to move the items across the world, which would take some time. Also im not very excited about the fact that Bitcoins generation will use intense amounts of CPU power, and im not sure would there be enough Bitcoins for everyone to use; everyone should have equal chance of getting items without depending how fast CPU they have, and im not sure how it would work with fractions of items (like 0.1 of money etc).

Any thoughts and ideas appreciated.

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:
Picking random monster cards from a deck What is the best way to go about making user defined classes (monsters, items, loot, armor, weapons, spell types, etc) and then calling them later during an encounter? Looking at the entire card list for a trading card game is intimidating, and I would love some advice on tackling this before I go about it the wrong way.

class Card(object):
def __init__(self, name, value, type, power):
    self.name = name
    self.value = value
    self.type = type
    self.power = power
    self.expan = 'Base'

class Monster(Card):
def __init__(self, name, value, type, power):
    self.active = False
    Card.__init__(self, name, value, type, power)
    #monsterlist.append((self.name, self.value, self.type, self.power))

Is it ideal to just make a random number and create the monster like this (there's over a thousand cards, so this doesn't seem optimal to me):

def pickMonster():
    chance = random.randint(1,2)
    if chance == 1:
        goblin = Monster('goblin', 8, 'animal', 'run')
    if chance = 2:
        troll == Monster('troll', 8, 'troll', 'smash')

Can I define monsters in a list/dictionary somehow and pull them at random from there?  I was trying to use this method to make the code easier to read, but I'm having a hard time figuring out exactly how to do it that way (as I'm not even sure it's possible to put more than 2 values into a list, and dictionaries are the bane of my existence -- I'm fairly new to python).

sentences: Interfacing with bill/note acceptors in unity What ways are there to interface a unity game with a bill acceptor/validator? Usually this type of devices are connecting to a computer using a serial port and communicate over ccTalk protocol. But what ways exist of incorporating this type of devices in Unity?

sentences:
How do I make a 2D game resolution independent? I'm working on a simple 2D game. I've finished the mobile phone version.

However, my boss wants the game to works on his RT.
I'm doing the "conversion" but my buttons are in the wrong places, because I hard-coded the screen size, like this:

 texture = game.Content.Load<Texture2D>("StartScreen");
 mainFrame = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);

 // button definitions
 startbrect = new Rectangle(300, 258, 88, 88);
 startbtext = game.Content.Load<Texture2D>("bplay");

In this example, mainframe is fine, but startbrect isn't, because I defined the size to match a Windows phone's screen.
How can I handle responsive design when all Windows 8 phones' screens are different? Is there a formula or macro to calculate each time the good size?

sentences:
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:
Unity pattern for multiple game views What are some proven and preferable patterns to realise multiple "screens" in the game? Not in the sense of displays (monitors) but "views" within the application.

Say it's a Civ/Heroes-type game. We will typically have these screens during the proper gameplay:

Main map (strategic)
Battle map (tactical)
City management screen
Research screen
etc.

As you can see, some of them are UI-like in nature but some are full-blown interactive scenes.

We need to be able to:

Quickly switch between them
Keep a global game state between them (e.g. the (in-)famous GameManager instance must stay intact)
Bonus points if able to make a fancy transition (e.g. city screen rolling down from above)
Bonus points if able to keep one screen (e.g. city screen) only partly covering another (e.g. the strategic map) and both are animated

Theoretical solutions I can imagine (I'm still a Unity noob):

Separate scenes for each screen. But will the engine be able to switch between them fast? (I read that a scene is akin to a "level" in a traditional game, which usually means a loading time?) Also, how will I track the global state (GameManager)? Can I overlay one screen over another?
Everything in one Unity scene but multiple cameras looking at different objects, with switching between them or nesting. E.g. one camera looking at the map grid, another at a city screen etc. But then I run the risk of objects from one "scene" (only virtually) affecting others (e.g. lights or particles) unless I place them sufficiently far apart.

Is any of my ideas going in the right direction? Is there a better pattern that I'm missing?

sentences: 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:
why each game does not provide the option to download only one graphic quality, instead of having to download low, medium, high and ultra graphics? If there is an option like this it will definitely save storage space.
When you download or stream a film there is an option for graphic quality, and we only download that one graphic quality.
Or is there another reason behind it all?

sentences:
Is Rete an efficient algorithm to implement a system that allows NPCs to make decisions based on their world views and inner state? I'm developing an AI "mind" engine, which allows NPCs (non playable characters) to think and make decisions, based on their view on the game world, and their own inner states (in the future I may add the NPCs' memory - long or short term - if necessary).

Given those inputs, they can give a list of possible actions, with possibilities, for example with a rabbit:

World view: a wolf (enemy) is 100m away, the carrot is 40m away.
Inner state: it is hungry, it has big courage and can take risks.

So the expected type of output will be the actions that the rabbit can do:

Runs away: 40%
Bites one bite of carrot then run: 80%
Keep eating and don't give a damn about the wolf: 20%

Based on the desired actions, it will give its decision: which action to take. But that's future works, now I'm concentrating on how to produce that list of actions.

I read the chapter 5, book Artificial Intelligence for Games, Ian Millington and I found the Rete algorithm, which allows match a rule sets to a given database - in my case, the database will be the combination of the NPC's world view and inner state. It seems suit well with my needs, but after making a search, I can see very few (actually, zero) projects that use this algorithm.

Is it so heavy and slow for computer games? Or does it have any more drawbacks that can't be widely used?

sentences:
Creating Smooth Animations Possible Duplicate:
  What’s the best way to create animations when doing Android development?
  What animation technique is used in ‘Dont Starve’?

I've always admired Zeptolab for their smooth in game animations. Zeptolab has created both Cut the Rope and now Pudding Monsters.

I'm wonder how you're able to get animations this smooth? Are these sprite sheets? Are they actual 3D models?

Here's a video of their latest game:
http://www.youtube.com/watch?v=rV1dlN-dbJQ

If you get to the game play you'll see how the guys are constantly wiggling and it's so smooth. You also saw this in the monster guy in Cut the Rope.

I'm just wanting some insight into how this is done. Like what tools they may be using.

Thanks

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:
How can I switch between DirectX and OpenGL renderer in my engine? I am currently developing my engine with DirectX, but I want to make it cross-platform in the future, using OpenGL.

How can I check which platform my engine is running on?
And can I use an if statement after I've checked the platform to say which renderer to use?

I currently have an abstract renderer and a DirectX9 renderer as it's child.

sentences:
Mario like jumping and landing in box2d, help I've been trying to get Mario type jumping/landing in a Box2d game and it's been giving me some trouble.

Results: Player loses velocity on landing

Desired Results: When player lands it will continue at the same velocity it was in the air.

[edit] Player loses velocity on impact, but quickly regains its set max speed.

I know this is an issue with friction and I've tried setting the friction to 0 when the user is pressing Left and Right movement keys and back to normal friction when the player is not pressing those keys. This however, does not work as the state does not get changed until the collision is over and the player will be stuck sliding until the collision state has changed.

My next best guess is to set friction to zero all together for the player and simulating an opposing force on the player.

Solution? Tips? Heck... maybe there's a tutorial out there I missed.

Thanks in advance.

Example
http://www.guioui.com/saxattack/box2d_landing.png

        Vector2 a = entityBody.getLinearVelocity();
        float force = 0;

        if(Gdx.input.isKeyPressed(Keys.D)){
            if(a.x < 5) force = 25;
            //entityBody.getFixtureList().get(0).setFriction(0);
            //floor.entityBody.getFixtureList().get(0).setFriction(0);
            //entityBody.resetMassData();

            //entityBody.applyLinearImpulse(new Vector2(0f,1f), entityBody.getWorldCenter());
            //entityBody.applyForce(new Vector2(0f,50f), entityBody.getWorldCenter());
        }
        else if(Gdx.input.isKeyPressed(Keys.A)){
            if(a.x > -5) force = -25;
            //entityBody.getFixtureList().get(0).setFriction(0);
            //floor.entityBody.getFixtureList().get(0).setFriction(0);
            //entityBody.resetMassData();

            //entityBody.applyForce(new Vector2(0f,50f), entityBody.getWorldCenter());
        }
        else{
            entityBody.getFixtureList().get(0).setFriction(.4f);
            floor.entityBody.getFixtureList().get(0).setFriction(.4f);
        }

        if(Gdx.input.isKeyPressed(Keys.W)){
            a.y = 5;
            entityBody.setLinearVelocity(a);
        }

        entityBody.applyForce(new Vector2(force, 0), entityBody.getWorldCenter());

sentences: Rotate LWJGL 2 Vector4f by an angle around an axis There is a method in LWJGL 2 to get the rotation Matrix around an axis with a certain angle- Matrix4f.rotate(angle, axis, dest, src). Is there a similar way to rotate a Vector4f around a Vector3f or Vector4f? What can I do to rotate around 2 axes? I am implementing an FPS Camera

sentences:
Blending issue with framebuffer I'm trying to get some particles to work properly - they should blend among themselves but not with the background color. For this I'm using additive blending, textures with premultipled alpha and set the color as (r*a, g*a, b*a, 0) on textures I want to add up.
I'm using the blend mode: glBlendFunc(GL11.GL_ONE, GL_ONE_MINUS_SRC_ALPHA); for everything.

I found out that what I want to do can be achieved by rendering and additively blending the particles in a framebuffer and then render that framebuffer on top of the background with standard alpha blending. In theory I think this should work..however i'm still getting the same result as I did before which is very bright particles at bright areas of the background.

So what I'm doing is simply:
1)Render the background as usual with color (r*a,g*a,b*a,a)

2)Bind my fbo

3)Use GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClearColor(0f, 0f, 0f, 0.0f);

4)Render all the particles with color as (r*a,g*a,b*a,0)

5)Unbind the fbo and render it on top of the bg with (1,1,1,1) color.

Why doesn't this work?

sentences:
GetButtonDown for Unity keyboard UI navigation? By default, Unity's keyboard navigation for buttons seems to check for GetButton rather than GetButtonDown--if a menu has 5 items and I hold the down arrow, it'll scroll very quickly to the bottom.

This feels awkward; it would make more sense to check for GetButtonDown and only move 1 space per input. However, I can't find any option to let me change that. Any ideas or workarounds?

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: Is it a good plan to use 2D physics for a 3D racing game? I am working on a 3D racing game using SDL and OpenGL. I thought it would be easier to use a 2D physics engine, since I really don't need the 3rd dimension. There will be no flying cars or jumps, they will just be stuck to the floor, so I would use 2D colliders and that things to simulate collisions in a plane but render the actual game from a 3D perspective. So the real question is: is it possible, is it a dumb idea, what else can I do?

sentences:
Rain World : How to have intelligent movement / animation? In the project RainWorld the characters seem to move "intelligently" as they move "unrestricted". They seem to know "how" to move their limbs and "what" needs to be done.
Here for an example the lizard seems to know how to move his body after he got struck by a weapon.

Also here it looks as if it is intelligently grasping the long ladder/using the jet thinging to climb itself up.

I had been looking into many sources to find out how such gets done but with no significant result. I need help to point myself to the right direction.

Edit

I have figured out from dev log  that characters are just bunch of boxs connected/bounded by an elastic bound "string". But the way the character moves still eludes me.

sentences:
TModLoader reports a file to be missing when its not I'm Making a terraria Mod that adds all sorts of Junk, but one single issue keeps hitting me: It Thinks one of the Items needed does not exist.

The error I seem to be getting is:

 The item Copper Shortsword Stack of twenty does not exist in the mod GrandFinale.
If you are trying to use a vanilla item, try removing the first argument.
   at Terraria.ModLoader.ModRecipe.AddIngredient(Mod mod, String itemName, Int32 stack)
   at GrandFinale.Items.OmegaHeadbutt.AddRecipes() in c:\Users\sjpar\Documents\My Games\Terraria\ModLoader\Mod Sources\GrandFinale\Items\OmegaHeadbutt.cs:line 32
   at Terraria.ModLoader.RecipeHooks.AddRecipes()

Even Though The item exists here (full code)

using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GrandFinale.Items
{
    public class TwentyStack : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Copper Shortsword Stack of twenty";
            item.width = 40;
            item.damage = 1;
            item.melee = true;
            item.height = 40;
            item.toolTip = "This is a modded sword.";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 2;
            item.autoReuse = true;
            item.UseSound = SoundID.Item7;

        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient("Copper Shortsword", 20);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

And Is Being Called By this Other Item:

using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GrandFinale.Items
{
    public class OmegaHeadbutt : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Omega Slash";
            item.damage = 10000;
            item.melee = true;
            item.width = 40;
            item.height = 40;
            item.toolTip = "The Sword Of The Ancients. Using it deals 499 Damage to the user, to deal 10,000 Base Damage";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 12;
            item.UseSound = SoundID.Item7;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "Copper Shortsword Stack of twenty", 2);
            recipe.AddIngredient("Flask of Poison", 2);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

(The Null on the line beginning tells of recipe.AddIngredient tells TModLoader that the item needed for crafting belongs to a Mod (not vanilla))

Any Help?

sentences: Adding large 3d models into Unity I have a 3d model of a restraunt with several characters in it probably over a hundred objects. Whenever I try to import it into Unity Unity just loads forever until I force close it. How do you import such large models without Unity crashing?

sentences:
How can I debug _why_ glDrawArrays is very slow? I'm working on a game that uses CEGUI and Ogre.  Recently, we've discovered that some of our customers with GeForce4 MX 4000's, performance is terrible.

After a night spent debugging, I've tracked the issue down to a glDrawArrays call inside the Ogre GL Renderer.  Most executions of this call are pretty quick (<10ms, which still sucks but is ok for this terrible card).  But one execution of the GLRenderSystem::_render function takes 3500ms every single frame.

It's only drawing a 54-element TRIANGLE_LIST.  All the other calls to it are drawing similar-sized TRIANGLE_LISTs, so it's not the size of the array or its type that is the problem.

I've:

disabled fragment shaders (the GF4 MX doesn't support them)
disabled vertex shaders (it supports them, but CEGUI can only do all types of shaders or none of them)
attempted to disable a nearby call for multitexturing
massively simplified the UI that I'm drawing so that it is only a single CEGUI::Window

But I'm really just shooting in the dark.  I'm in a windows environment.  What's a good tool to figure out the OpenGL state at the time of a function call?  I'm guessing that there's a particularly piggish texture or a fragment shader somehow slipping through and getting rendered.

If there aren't any tools to do what I need, can anyone suggest ways that glDrawArrays could be made really slow on an old card?

Update:

I grabbed GLTrace and compared the calls that precede both a fast glDrawArrays and a slow one.  They're absolutely identical, they're even binding the same texture IDs.
One consistent difference however, is that the call that executes slowly is the first one in each OGRE/cegui render frame.  Perhaps there is some copying-over of texture data to the video card each frame (which would be ridiculous and clearly doesn't happen on other cards...).  Update: this isn't the case - no matter where in the queue I draw the offending object, it still takes forever.  See below.
There are 3 main objects being drawn: a full-window background (plain white, gets textured with a 128x128 texture), a smaller rectangular label, and text in that label.  The ratios between their draw speeds are approximately the same the ratios between their areas
If I force the slow object to be drawn several times instead of drawing the entire render queue, it is slow every time, which means it's not a one-time-loading issue.

Update for current theory: this is somehow a fill-rate issue.  Is there a way to configure a window so that the card has issues filling it?  Since I'm drawing in windowed mode, will that mess up a card sometimes?  My window doesn't have power-of-two dimensions (or dimensions similar to any standard resolution), could that be a chokepoint?

sentences:
Without using a pre-built physics engine, how can I implement 3D collision detection from scratch? I want to tackle some basic 3D collision detection and was wondering how engines handle this and give you a pretty interface and make it so easy... I want to do it all myself, however.

2D collision detection is extremely simple and can be done multiple ways that even beginner programmers could think up:

When the pixels touch;
when a rectangle range is exceeded;
when a pixel object is detected near another one in a pixel-based rendering engine.

But 3D is different with one dimension, but complex in many more so... what are the general, basic understanding/examples on how 3D collision detection can be implemented?

Think two shaded, OpenGL cubes that are moved next to each other with a simple OpenGL rendering context and keyboard events.

sentences:
Implementing rubber rope I'm using LibGDX to implement rubber rope in which player can fly and launch. I know I could use Box2D as physics engine and I'm going to one day, but I'd like to learn it myself for now.

I've already got it working, but some unexpected movements are sometimes noticeable and I don't understand why. I feel like I haven't thought of something important. So I figured you guys might find a flaw in my implementation.

For starters, it looks like this:

My maths is basically taken straight from the physics class. There are two forces applied to the bird, because there are two fractions of the rope. Their sum is the actual force.

Both forces are obviously laid along the corresponding rope fractions. Magnitude of the force is |F| = kx, where k is some constant and x is how much this fraction had to stretch. I cache its initial length at the beginning of collision, then measure it each frame and calculate the difference. The code:

private void calculateForces() {
    //A and B are blue circles in the picture; M and Z are red

    //Negative number means no extension, hence Math.max call
    float modifierA = Math.max(0, A.dst(M) - mLengthA);
    float modifierB = Math.max(0, B.dst(Z) - mLengthB);

    mForceA.set(A.x - M.x, A.y - M.y).setLength(K*modifierA);
    mForceB.set(B.x - Z.x, B.y - Z.y).setLength(K*modifierB);
}

What am I not taking into consideration?

EDIT:

As requested, I made a video. You can see some weird movement at the end of second swing, and the third one is completely wrong.

I also tried getting rid of Math.max() call changing line to float modifierA = A.dst(M) - mLengthA;  and, suprisingly, it looks much better. Video. The question is why. Isn't it logical for the rope not to apply any force when it's not being stretched?

sentences:
2D jerky motion with AddForce and physics I have a problem smoothly motion - I see jerking when I am using physics and AddForce.

It's not a question related to Update or Time.deltaTime -
I created simple scene with few lines and sphere.
When player clicked ">" button, I apply force to sphere, but motion is jerky and is not smoothly (please see web version below).

Project: fixed ortho camera, sphere with disable gravity, few cubs and bouncy as default material.

To fixed this problem, I tried to use some solutions from posts, related with jerking motion in Unity:

http:// answers.unity3d.com/questions/10907/smoothing-rigidbody-movement-over-a-bumpy-track.html
answers.unity3d.com/questions/228095/why-is-the-motion-jerky-in-a-simple-2d-game.html
answers.unity3d.com/questions/275016/updatefixedupdate-motion-stutter-not-another-novic.html

Things, that I tried:

Interpolate for sphere rigibody - slightly better, but jerky is still here.
Change Vsync(Dont Sync, Every Blank, Every Second Blacnk) and Quality (Fastest-Fantastic) - nothing
Use different object for collission (just rigibody and collision object) and display object(mesh renderer). This InterpolateToTarget.cs script in source folder - nothing.
In previous other game (with gravity, other default material, etc.) I used motion forward without AddForce, but I faced with jerky motion, too. I tried all solutions, that I find (FixedUpdate/Update with deltaTime, Coroutine, Transform.Translate, Interpolation, Lerp, LateUpdate...) and I saw that only one combination (small AddForce/Interpolation and Simply Quality setttings (VSync is turn off)) give me acceptable smoothly motion. But in this game I need AddForce with larger value and this solution is not work in this case.

Web version:
https://dl.dropbox.com/u/15321992/2DjerkyMotion.rar

Sources:
https://dl.dropbox.com/u/15321992/2DjerkyMotion.rar

Android apk:
dl.dropbox.com/u/15321992/2dJerkyMotion.apk

Code that I am using for motion:
    public class TestMovingScript : MonoBehaviour {

private Rect restartBtnRect = new Rect(20, 20, 120, 60);
private Rect rightMoveBtnRect = new Rect(Screen.width - 100, Screen.height - 100, 100, 100);
private GameObject _player;
private Vector3 _movingVector = new Vector3(1, 0, 0);

// Use this for initialization
void Start () {
    _player = GameObject.FindGameObjectWithTag("Player");
    _player.rigidbody.AddForce(_movingVector * 20);
}

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

}

private void OnGUI()
{
    if (GUI.RepeatButton(restartBtnRect, "Restart"))
    {
        Application.LoadLevel(0);
    }
    if (GUI.RepeatButton(rightMoveBtnRect, ">"))
    {
        {
            _player.rigidbody.AddForce(_movingVector * 20);
        }
    }
}

}

I suppose in web version this jerking is not as noticeable, but on Android it is a horrible.
Also, try to play in web version few minutes and you will see it.
I don't believe, that Unity3d does not allow to build smoothly Android game, so maybe I missing something in physics/player setting.

I will be grateful for any suggestions and ideas.

Thanks,
Dmitry.

sentences:
What's in Nintendo's "Dev Interface?" Not that long ago, Nintendo opened their developer program for access by anyone who registers a Nintendo Developer account, giving equal access to indie and commercial developers. Or, at least thats what the linked page says.

The tools page lists Unity and a HTML5 framework for game development, as well as the "Nintendo Dev Interface (NDI)." Since I am not really interested in developing using Unity (or HTML5, for that matter) I want to know what the NDI contains, at least in general terms.

(I don't doubt that at least some of that information is covered by an NDA, but I'd like to know as much as possible, since I can't register for a while)

I'm especially interested in what sort of compiler/languages are supported, what graphics APIs (and/or abstraction layers, like SDL) are allowed and how play testing works (some sort of compatability layer? Nintendo sanctioned emulation?).

sentences:
Identifying quad patterns in a two-dimensional array In the tech demo I'm trying to make, tetrominoe-style blocks will be placed by the player, at which point the game checks to see if they've made a quad with any existing shapes on the board (a 2D array). If so, the quad should be processed in some way.

I have a 2D array like so:

[ [0, 0, 0, 1, 1, 1],
  [0, 1, 1, 1, 1, 1],
  [1, 0, 0, 1, 1, 1],
  [1, 0, 0, 1, 0, 1] ]

And I need to identify 'quad' patterns such as that in the top-right corner, e.g.

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

I'm not sure of the best way to do this. I've had a look at some two-dimensional array pattern matching algorithms, which all seem to flatten the 2D array into 1D, then use a 1D text searching algorithm (e.g. KMP) to identify any matches. My problems with that idea are that the quad can be any size, as long as it's rectangular and bigger than an arbitrary minimum (in my case, 2 x 2).

I also thought about using some variant of the 4 way flood fill algorithm or connected-component labelling, for each position of the newly-place tetrominoe. But I'm not quite sure how to best follow the path out and establish the bounds of a quad (for example, capturing this:

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

out of this:

[ [1, 1, 1, 1],
  [1, 1, 1, 0],
  [1, 1, 1, 0] ]

My latest though is perhaps a floodfill to get all interconnected parts after a tetrominoe lands, then 'round off' the jagged edges, maybe by checking the number of neighbours of each block, if it's 1, remove it, repeating the process until all remaining blocks have 2 or more neighbours. But this seems like it could be slow.

Has anyone any experience of this problem, or any pointers about how best to accomplish this task? I'm sure there's a common or at least applicable algorithm, I just don't know it!

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:
How can I reduce the data sent to the GPU for a voxel? I'm making a minecraft style game where each chunk each chunk has buffers holding the position of all visible blocks and texture atlas coordinates of the 36 vertices that are needed to draw the triangles.

I have 8 vertices and an EBO that I use for the triangles so it takes up sizeof(GLfloat)*3*8 + sizeof(GLuint)*36 + sizeof(Glfloat)*2*36 so 528 bytes. that seems like a lot per block meaning that if I am rendering around 16*16 chunks(I use an stl::map not an array) 16*16*256 chunks that have around 300 visible blocks that means I am sending about 40 mb of data to the GPU each frame.

It runs smoothly now but could this end up being a problem? or is there a way to reduce this?

one other thing, I tried to change my program from using gldraw arrays and having 720 bytes for each block to using an EBO for just the position. how can you control what vbo the ebo operates on?

for example the EBO would have indices to the points of the cube and texture coordinates but still have an instance array for the position

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:
Triangle mesh smoothing I have a grid in terms of two arrays:

points: contains 3D coordinates of points.

triangles: contains 3 indices per line for each triangle of the grid.

I would like to interpolate the grid to make it smoother, i.e. add extra points and triangles in such a way that the grid is smoother than it is at the moment. But I found that scipy.interpolate only works if the xy-points are regular, which is not the case here. Any suggestions?

sentences:
How to construct a matrix with the following mapping How would I create a matrix that maps coordinates like so:
Near plane
x: [-3,3] -> [-1,1]
y: [-6,2] -> [-1,1]
z: 2 -> -1

Far plane
x: [-4,4] -> [-1,1]
y: [-4,4] -> [-1,1]
z: 0 -> 1

Visual

Result:

My current solution is a transformation in a vertex shader like below, but if it's possible to use a matrix I can keep my shaders as is.
vec4 special_projection(vec4 p){
  float ty = 0.25 * p.z;
  float tx = 0.25 * p.x;
  float xz = (tx / 3.0) * (p.z / 2.0);
  float x = tx + xz;
  float y = 0.25 * p.y + ty;
  float z = -0.5 * p.z;
  return vec4(x,y,z,1);
}

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:
What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform? I am thinking about giving a go to one of my ancient ideas for a game. The core point of this game would be the possible level of functional customization of the game environment and objects (such as modifying the behavior of a space ship weaponry). For this the game would need to be scriptable. Also I don't aim to commercialize it, it is merely an interesting programming challenge for me.

As I am mostly a .NET guy I will use XNA/C# for the game itself. For the scripting I think about going with Python or Lua. I have previous experience with Python and have nothing against it as a language. Lua on the other hand is almost completely new to me, besides some minor World of Warcraft addons modifications I did here and there, and it looks promising. So here is my question:

What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform?

Is one of them considerably easier to use with XNA/C#? Has one of them some specific advantages or disadvantages when used with XNA/C#? Why would you recommend one over the other for XNA/C#?

sentences:
How to create an RTS gameplay experience where all phases of a match are equally engaging without spikes in required concentration? In games such as Starcraft Brood War, players at the start of the game don't have as much to do compared to later on when they have to manage multiple battles and multiple bases at once. This means at the start of the game, the gameplay is fairly dull, whereas later in the game it becomes so frantic that only extremely high APM players can play competently.

This is especially a problem in Total Annihilation where being able to quickly react to incoming enemy bombers allows for the minimization of damage from the bombing run, which means a player who can react faster has an advantage over a player with a slower reaction time.

In general, for any RTS game with a fog of war such that when enemy units are discovered, fast reactions would grant an advantage, this is a problem.

I want to create a game which not only removes micro but also removes any requirements for fast reactions throughout the game. In other words the gameplay experience should be "flat" without any spikes in activity, and there should be no surprises possible.

Players should not be sitting around waiting for something to happen and then have to frantically try to click as fast as possible once that something happens. In other words the game should feel more like a slow and steady tug of war than paintball. There are such games in other genres, such as fighting games where, ignoring the power-up bar, gameplay does not change much at all over time.

In my opinion, this means that all changes perceived by the players must be a constant stream throughout the game (to avoid spikes in gameplay) as well as that players must have plenty of time to react to each change, and that reacting faster to the change gives no advantage.

How can I go about designing this kind of game? I can't even think of any RTS game that comes remotely close to this.

sentences:
How to add caves to a terrain mesh generated with 2D noise Am I getting it right, that when I'll make a single mesh that represents terrain using unity's built-in 2D Perlin noise function, then I'll be able to somehow add caves using whatever (Perlin worms for example)?
Or do I need to find solution with 3d noise?

sentences:
How dev consoles work? I want to implement a dev console similar to what is in DOOM.
Is there a standard implementation for dev consoles or would I have to build everything from scratch?

sentences: Only 4 point lights display in unity When ever I have more than 4 point lights in my scene, only 4 show up. Why does it do that? Is there anything I can do to show more than 4 at a time?

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:
Rotating a polygon around it's center I have drawn a ship using three lines, and would like to rotate the ship around its axis in opengl, I have tried the following, but the ship translates while rotation!.

void Ship::Draw( )
{
    gl::pushMatrices();
    gl::translate(Vec2f(-m_Pos.x, -m_Pos.y));
    gl::rotate(m_Angle);
    gl::translate(Vec2f(m_Pos.x,m_Pos.y));
    gl::color(ci::Color(1,0,0));
    gl::drawLine(Vec2f(281,70),Vec2f(383,123));
    gl::drawLine(Vec2f(310,85),Vec2f(310,160));
    gl::drawLine(Vec2f(383,123),Vec2f(281,176));

    gl::popMatrices();
    m_Angle+=0.2f;
}

sentences:
How do I get an Android device's screen size in exact pixels? On every single android device {emulators} from ldpi to xxhdpi, both DisplayMetrics and native JNI EGL return width:320 and height:526. Even on actual HTC ONE mobile it returns something like 320x526. This is annoying. I need to know the exact pixel dimensions of the GL rendering surface {framebuffer/renderbuffer etc}. How can I do that ?

From Java activity class I am doing:

DisplayMetrics metrics = getResources().getDisplayMetrics();
int widthPixels = metrics.widthPixels;
int heightPixels = metrics.heightPixels;

From the JNI C++ code I am going following with NO luck (again output: Size = 320 x 526):

int W, H;
EGLDisplay display = eglGetCurrentDisplay();
EGLSurface surface = eglGetCurrentSurface(EGL_READ);
eglQuerySurface(display, surface, EGL_WIDTH, &W);
eglQuerySurface(display, surface, EGL_HEIGHT, &H);

LOGI("JNIGlue.cpp:Init:EGL-Width : %d", W);
LOGI("JNIGlue.cpp:Init:EGL-Height: %d", H);

glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &W);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &H);

LOGI("JNIGlue.cpp:Init:RB-Width : %d", W);
LOGI("JNIGlue.cpp:Init:RB-Height: %d", H);

So how do I get the exact OpenGL rendering surface/buffer size ?

sentences:
Difficulty with linked lists in drawing I've recently started game development in C++ and decided to make an ASCII based snake game. To hold the values of the snake tail I decided to use a linked list due to its flexibility when it comes to manipulating it.

Each node holds the x and y coordinates of a segment of the snake's tail.

The linked list is successful in holding data, creating a new node whenever the snake eats the fruit, but I do not know how to implement this data into my draw function.

I am aware of the issue being caused by a logical error in my program due to the while loop breaking my if else sequence. I just don't know how to fix it.

Here is my current draw function:

void draw() {
    system("cls");
    for (int i = 0; i < width+2; i++)
        cout << '#';
    cout << endl;

    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            if (j == 0)
                cout << '#';
            if (i == posY && j == posX)
                cout << 'O';

            Node *current = head->next;

            while (current != nullptr) {
                if (i == current->y && j == current->x)
                    cout << 'o';
                current = current->next;
            }
            if (i == fruit.y && j == fruit.x)
                cout << 'F';
            else
                cout << ' ';
            if (j == width-1)
                cout << '#';
        }
        if (i != height-1)
            cout << endl;
    }
    cout << endl;

    for (int i = 0; i < width+2; i++)
        cout << '#';
    cout << endl;

    cout << "Score: " << score << " || Tail len: " << tailLen << endl;

}

As you can see I've tried to retrieve the values from the nodes via a while loop. Unfortunately by doing so extra spaces are added and the frames are extremely glitchy. I've been racking my brain over this issue for ages. Any suggestions would be appreciated, thanks.

Screenshot:

sentences:
Zelda LttP (Super Nintendo) room changes? I'm trying to make a tile-world adventure game on iOS similar to Zelda Link to the Past on SNES, and one issue I've run into is having my camera move beyond walls revealing the rooms on the other side.
I like the way Zelda handled room changes where once you went through a door the screen would slide over to show the new room, but I can't figure out how they did it.
I'm using Obj-C on my own tile-world engine, so I'm more interested in logic than code, but anything would help.

I'd also be interested to hear any alternative suggestions for limiting the movement of the camera.
(Presently I have the position of the camera restricted to the bounds of the level being drawn, but in order to reduce loading I've decided to increase the size of levels to put multiple rooms/floors on the same map.)

Edit
One of the key things that the transition I am asking about offers is the ability for the player to leave the center of the screen. I think that you lose a sense of motion or progress when the player is always dead center in the screen. My camera is designed to stop moving at the world bounds, but I'm having trouble figuring out how to define 'room bounds' within a world for the camera to stay within until triggered to move.

I also recognize how transitions break up gameplay, but when you're dealing with a top-down 2D adventure game, if you want to conceal the contents of the next room over and also allow for some range of motion free of the camera, I'm not sure what better way there is.

sentences:
Random numbers on C++ Recently I got used to modern languages which include a stock good random generator, which usually is the Mersenne Twister; now that I got back to C++ I have to decide what to use.

I searched for Mersenne Twister implementations and I noticed there are so many: is there one which is more used and widespread, or am I supposed to pick one assuming they are all equally good?

sentences:
How can I calculate "All squares within R" in a natural looking manner? I'm working with a square grid, and I have a couple of effects that target all squares within R; in other words, a circular (or spherical) effect.

But, circles being, well, circular, and squares being... less so, things obviously have to be approximated. For instance:

But! I feel that some of these approximations don't quite give the approximation I want. For instance, consider this square:

It's obvious that the majority of the square falls within the circle, but using a pure "square counting" method (i.e., all squares within R of the origin), it gets left out.

Is there a better algorithm to grab all squares for which the majority of their area lies within the circle?

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:
Why when releasing a DirectX Texture it fail I have an instance where a class creates a DX9 texture via

UINT usage = D3DUSAGE_RENDERTARGET;
HRESULT hr = D3DXCreateTexture (m_D3DDevice,
                                200,
                                200,
                                0,
                                usage,
                                D3DFMT_X8R8G8B8,
                                D3DPOOL_DEFAULT,
                                &m_texture)

Where m_texture is IDirect3DTexture9*  and hr = S_OK after creation.

But when I come to cleaning it up in the destructor via

if (m_texture != NULL)
{
    hr = m_texture->Release();
}

hr = S_FALSE

Why would it fail to release a texture?

sentences:
How to convert 3D coordinates to 2D Isometric Coordinates? I wanted to make an isometric game which has a bouncing ball.

I assume that there is a way I can "show" a jumping motion in isometric, since it has been done before, but I was unable to find the maths/formulae which will help me depict this (Z-axis)motion.

If you know how i could do this please share.

Thank you :D

PS: If this sounded a bit confusing to you, just ask me in the comments.

sentences:
How to Prevent Enemy Overlap I am working on a 2D side-scrolling action platformer.

I am currently working on the state logic for my enemies. These are humanoid enemies that walk on the ground

They currently have  idle, patrol, chase, engage, and attack states.

The default state is patrol, where they walk back and forth on a platform. If they encounter a wall or cliff, they idle for a few seconds then turn around and patrol in the other direction.

If the player comes within a chase_radius, they start chasing the player. If the player comes within an attack_radius, they enter an engaged state where they attack every few seconds.

Currently, I don't have enemies colliding with one another. I allow them to overlap each other. This is nice in the event that two enemies are patrolling in opposite directions. They simply walk passed each other.

The problem is that when two enemies are chasing a player, when one enters the engaged state, they stop and idle until they attack. The second enemy continues to walk until they too are within attack range. They then stop directly on top of the previous enemy and idle until they attack.

In this case, the enemies pretty much completely overlap and it turns an interesting situation with two enemies into a situation with essentially one enemy.

What are some techniques or design choices I can make to prevent this ugly overlap? Ideally, I'd like the enemies  to be able to walk passed each other when they are not engaged, but to do something different during combat so that they don't end up overlapping.

I have access to all the normal stuff (for example, raycasting, collision boxes, etc.).

Similar Questions:

Enemies overlapping (involves pathfinding, and isn't applicable to 2D sidescroller where enemies walk on ground.)
How to avoid enemies overlapping each other when chasing player in Unity? (solution of gradually pulling enemies apart when they overlap won't look natural with humanoid enemies that do melee attacks).

sentences:
Help Understanding libgdx create animations example game I am trying to understand the example game, cuboc. GitHub is https://github.com/libgdx/libgdx-demo-cuboc. I have generated my texture atlas but I do not understand the code that uses this texture atlas.  Here's the code (you can see on github too here:

package com.badlogic.cubocy;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.FPSLogger;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.SpriteCache;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer20;
import com.badlogic.gdx.math.Vector3;

public class MapRenderer {
...
    private void createAnimations () {
        this.tile = new TextureRegion(new Texture(Gdx.files.internal("data/tile.png")), 0, 0, 20, 20);
        Texture bobTexture = new Texture(Gdx.files.internal("data/bob.png"));
        TextureRegion[] split = new TextureRegion(bobTexture).split(20, 20)[0];
        TextureRegion[] mirror = new TextureRegion(bobTexture).split(20, 20)[0];
        for (TextureRegion region : mirror)
            region.flip(true, false);
        spikes = split[5];
        bobRight = new Animation(0.1f, split[0], split[1]);
        bobLeft = new Animation(0.1f, mirror[0], mirror[1]);
        bobJumpRight = new Animation(0.1f, split[2], split[3]);
        bobJumpLeft = new Animation(0.1f, mirror[2], mirror[3]);
        bobIdleRight = new Animation(0.5f, split[0], split[4]);
        bobIdleLeft = new Animation(0.5f, mirror[0], mirror[4]);
        bobDead = new Animation(0.2f, split[0]);
        split = new TextureRegion(bobTexture).split(20, 20)[1];
        cube = split[0];
        cubeFixed = new Animation(1, split[1], split[2], split[3], split[4], split[5]);
        split = new TextureRegion(bobTexture).split(20, 20)[2];
        cubeControlled = split[0];
        spawn = new Animation(0.1f, split[4], split[3], split[2], split[1]);
        dying = new Animation(0.1f, split[1], split[2], split[3], split[4]);
        dispenser = split[5];
        split = new TextureRegion(bobTexture).split(20, 20)[3];
        rocket = new Animation(0.1f, split[0], split[1], split[2], split[3]);
        rocketPad = split[4];
        split = new TextureRegion(bobTexture).split(20, 20)[4];
        rocketExplosion = new Animation(0.1f, split[0], split[1], split[2], split[3], split[4], split[4]);
        split = new TextureRegion(bobTexture).split(20, 20)[5];
        endDoor = split[2];
        movingSpikes = split[0];
        laser = split[1];
    }

What I do not understand is what is split used for? Like, what is going on here:

split = new TextureRegion(bobTexture).split(20, 20)[1];

And sometimes it looks like split is a method that takes two int's, 20 and 20? Why 20?
Othertimes split is used as an Array like in ...

rocketExplosion = new Animation(0.1f, split[0], split[1], split[2], split[3], split[4], split[4]);

... and I just can't follow what's going on here.  Thanks!

sentences: Good Video Game User Interface Design Books/Websites? I having been programming games for some time, but while my teachers say that my code is good and advanced, my friends say that the interface is hard to understand and not the easiest to navigate. I want to learn how to design good user interfaces so that I can program better games, and people will have a easier time getting around. Does anyone know of any good books or websites about designing video game interfaces?

sentences:
How Can I Find a Shape on 2D Array? For the code in my test project,  I want to find 2D[,] array shape on the char[][] list. I created an actual map with 'char[][]' array.
So, how can I find a tileChar's shape on the worldChar array?

How to do this in Java, C#, JavaScript, pseudo-code, algorithm or etc.?

For Example;

List<string> mainShape = GetRandomShape().Split('#').ToList();
char[][] tileChar = mainShape .Select(a => a.ToArray()).ToArray();
char[][] worldChar = GenerateRandomWorld();

Example Image:

'*' -> NOT NULL

'-' -> NULL

sentences:
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:
Why do characters only move in 4/8 directions in top games? In many top down games, like Zelda (4 directions)

There are only 4 or 8 possible directions.

Why is this? Is it a design choice or a technology limitation? I can't think of any reason that even older hardware couldn't handle 360 degree movement.

If it is a technology limitation, then what is limiting it?

But mainly, why is this such a popular design choice? What are some pros and cons to this limited movement style instead of granting freedom to move in any direction?

sentences:
Is there a generic name for the "layered" dictionary typically used in mod-capable games? I'm asking here rather than on SO/SE/CS because I'll probably have less to explain what I'm talking about...

I hope a lot of the users here are familiar with how many games implement modding (or sometimes even their own add-ons, levels etc.) Conceptually, what I've seen most often is a data structure that acts like a layered dictionary. With no mods, there's lookup in the base dictionary layer; whenever a mod is added/enabled, it comes with its own dictionary layer from which lookups are served first, with fallback to the underlying layers if a key is not found. (Note that I'm not talking about a nested dictionary.)

So, my question is simply if there's a generic name for this data structure. (Googling for "layered dictionary", which is how I dubbed it, doesn't turn up anything useful...) In the world of file systems, the closest thing that probably resembles it is a union mount. Alas "union dictionary" doesn't get any useful results either... (Also the word "union" is rather misleading in this context because there's an order in the layers of a "union mount".)

Added: By the way, I'm not asing how to implement it, as that's rather obvious from the description. Perhaps that's why no name have been devised for it... Also most game engines I've seen implement multi-layer (not just two) and some allow the (top) layers to be removed at any time so you can do (game) "levels" that way; others require an engine restart so it's only usable for "global mods", i.e. they optimize lookup time by "flattening" the layers down to one as they are added, which is basically why they need an "engine restart" to remove a layer.

Also, it seems the R (statistical) programming language basically has this its get functions:

  These functions look to see if each of the name(s) x have a value bound to it in the specified environment. If inherits is TRUE and a value is not found for x in the specified environment, the enclosing frames of the environment are searched until the name x is encountered.

So I guess something like "environments and their enclosures" is one term...

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: Linux Mint Godot window when ran very small I am running my game on Linux Mint 20 Cinnamon. When I run my game I get a very small window that is about 1 pixel tall. This happens across all projects. I have tried uninstalling Godot and reinstalling it from the package manager. I have also tried the official launcher from their website. Updating through update manager does not help as well. I get the same issue using Godot 3.2.2 and 3.2.3

sentences:
Cocos2d pause game freezes the screen I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right).

Below is the code:

  PauseScene.h

@interface PauseScene : CCNode {}
@property (nonatomic, retain) HelloWorldScene *mainScene;
//+ (PauseScene *)scene;
- (id) init;
@end

  PauseScene.m

@implementation PauseScene

- (id) init {
    if (self = [super init]) {
        // Adding RESUME and QUIT button and few others to make the whole Pause screen
    }
    return self;
}

// Called the method when Resume button is selected
- (void) Resume:(id) sender {
    //[[CCDirector sharedDirector] startAnimation];
    //[[CCDirector sharedDirector] resume];

    self.mainScene.userInteractionEnabled = YES;
    [self.mainScene removeChild: self];
    [self.mainScene StartGame]; // StartGame in MainScene contains the same code which commented out above, I will paste StartGame method later
}

// Quit method is called when the Quit button is pressed
- (void) Quit:(id) sender {
    //[[CCDirector sharedDirector] resume];
    //[[CCDirector sharedDirector] startAnimation];

    self.mainScene.userInteractionEnabled = YES;
    [self.mainScene removeChild: self];
    NSLog(@"Pre Reload", nil);
    //[self.mainScene scheduleOnce:@selector(ReloadGame) delay: 1.0f];
    [self.mainScene ReloadGame]; // Reload method contains the code commented above
}

@end

PauseScene is mere node class.

  StartGame and ReloadGame methods in MainScene file

- (void) StartGame {
    // Create and display HUD layer, like, scores, navigation buttons, etc.

    // Resuming the game
    //[[CCDirector sharedDirector] stopAnimation];
    [[CCDirector sharedDirector] resume];
    [[CCDirector sharedDirector] startAnimation];
}

- (void) ReloadGame {
    // Resume the game
    //[[CCDirector sharedDirector] stopAnimation];
    [[CCDirector sharedDirector] resume];
    [[CCDirector sharedDirector] startAnimation];

    [[CCDirector sharedDirector] replaceScene:[HelloWorldScene scene] withTransition:[CCTransition transitionFadeWithDuration:1.0f]];
}

  The pause button is displayed in HUD layer of MainScene, so, when the pause button is clicked, we will pause the game and display the PauseScene

- (void)onPauseClicked:(id)sender {
    // Code to display the pause node of this scene

    // Pause the game
    [[CCDirector sharedDirector] stopAnimation];
    [[CCDirector sharedDirector] pause];
}

When I comment out that stopAnimation and pause part the Pause and Resume works perfect. But when I implement any of these, at the time of quitGame, replaceScene is not working somehow. I think this is because game goes in pause mode but it is not working even if I call replaceScene using scheduler on delay of 5-10 seconds.

And if I don't use these stopAnimation and pause, some sprites which are given CCAction are not being paused and goes on even when my game is paused.

Your help is appreciated because I am using Cocos2d 3.0 and unable to find any proper help.

sentences:
Entity interpolation with a Unity listen server How can this be done? I've implemented client side interpolation but I'm at a loss on how to implement it on a listen server. In order for the listen server player to see the same thing as the clients, it needs to display it's past positions.

The problem with this is, as far as I know, there's no way to specify positions for rendering and positions for collision and everything else in Unity. transform.position is used for everything. Is there a way to draw in a different position?

sentences:
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 to adjust my games speed to fps Hi so i am making a small sort of physics engine, but if your fps is really slow the physics will update slower and objects will move slower. How do i make the speed of objects greater if the fps is lower so that on a computer with 5 fps the object will land at the same time as on a 60 fps computer? (just with that slow framerate)

sentences: Make a callback to android methods from libgdx How can I make a callback from libgdx to an Android method? I want to use the method to overwrite a file in the internal memory.

sentences:
Efficient approaches to updating adjacent grid tiles when one tile is disabled? I'm trying to update the surrounding grid of tiles if one of them is disabled (not removed). For example,  imagine we have a grid of tiles each with x representing one texture:

x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x

Now if some of these tiles are disabled, I need to update the surrounding tile textures to a different texture:

x, x, x, x, x, x
x, y, y, y, x, x
x, y,  , y, y, y
x, y,  , y,  , y
x, y, y, y,  , y
x, x, x, y, y, y

I'm trying to find the most efficient way of doing this. At present all of the tile data is stored in a dictionary with the key as a vector2.

I'm using C#/Unity 3D, however, I'm not necessarily looking for code but more or less logic on how to do this efficiently so I can program it in.

Any suggestions, examples, or what not would be helpful.

Thanks.

sentences:
Decoupling the entity from whatever controls it In a lot of games the player can choose whether an entity will be controlled by the AI or by the player. For example in the game Little Fighter 2, the player can choose how many of a maximum of 8 characters would be AI-controlled and how many of them would be human-controlled.

I was thinking how I can achieve this in my game. Currently in my game whatever controls the characters is hardcoded into them. I even have an AIAgent abstract superclass that all AI characters derive from, and a Player class that represents the player-controlled entity.

I realized that in order to be able to choose dynamically if an entity will be controlled by the player or by the AI, I need to decouple the entity itself from "it's brain", i.e. whatever controls it.

By "the entity itself" I mean the attributes and actions of the entity: it's mass, it's image, the way it implements shooting a missile, etc. By "the brain" I mean the system that decides when, and possibly how, to act.

As I said, currently "the brain" of my entities is hardcoded in their update() function. My Player class responds to player input in it's update() method, and my AIAgent subclasses usually delegate to a StateMachine of some sort in this method.

So I was thinking: how can I decouple the entities from their "brains", in order to be able to choose dynamically whether a Monster is player or AI controlled - and without a lot of ugly code duplication.

The solution that comes to mind is creating an abstract Controller class, with subclasses that can be plugged into the entities. Then the entities simply delegate to their controllers in the 'update()` function, and the controller controls the entity through it's interface.

To demonstrate:

abstract class Entity{
    // .. stuff omitted
    Controller brains;

    public void update(){
         brains.update(this);
         // .. non-behavioral physics stuff omitted
    }

    public void setController(Controller brains){
        this.brains = brains;
    }

    // methods that will be called by the controller in order to control the entity:
    public void attack(){
        ....
    }
    public void moveLeft(){
        ....
    }
    // ....
}

A PlayerController can read user input and control the entity accordingly, while an AIController would implement a state machine to control the entity. The controllers would use the entity's public interface to control it.

The only doubt I have about this approach is that it forces the entities to offer a lot of public methods to control them, such as moveLeft() and shootMissile().

Conceptually, it doesn't "feel right" that the entity would expose methods like these to the outside world, when 'conceptually' it should be it's own job to control itself. Just like it isn't possible to control a human's legs or heart from the outside. Feels like it breaks encapsulation.

So my question is: what do you think of this approach? Can you recommend a better one? How is this often done in games?

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:
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:
My pixel art looks weird in the game view in Unity I am making my first 2D game in Unity and something has been bothering me. If I'm in the scene view, my game looks fine but when I go to the game view the pixels in the sprites aren't rendered correctly and everything looks distorted.

Does anyone know an answer to this?

sentences:
How do I differentiate between the two Vive motion controllers? I am working with a Vive Pre (devkit) and I have most everything working the way I want it to. However I am wondering how do I refer to or even know which motion controller is which? From what I can tell the headset is ALWAYS assigned first into a list, and the others are seemingly randomly assigned.

So how do I differentiate between the two or refer to one separately?

sentences:
Is a Computer Graphics book being outdated a problem? Me and my friends decided to make a game engine as a graduation project and this summer we are dedicating ourselves to really get into the knowledge we need before actually starting the project.
We are starting by watching the UC San Diego CG course(s) (there is an advanced course now) and also read the Essential Mathematics for Games and Interactive Applications 3rd Edition book (we are a bit undecided about the book so if you have any comments about it we will greatly appreciate them).
Our problem mainly is that while googling for CG books, answers on this community and even on other sites seem to always suggest outdated books (like Computer Graphics C Version 2nd Edition).
Now, I personally don't think a book being outdated is necessarily bad, but it could be. Depends on how differently things in the 2020 are being done and as a beginner I am obviously ignorant of that aspect.
Is a book being outdated a problem?

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:
Having the same camera in all scenes I have 100 scenes, each scene has a camera, but I want only the camera from scene 1 to exist in each scene that I appear in.

I use the function DontDestroyOnLoad() to make the camera exist in each scene but I always find my self with another camera that I don't want.

Any ideas? thank you in advance.

sentences:
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:
Loading class instance from XML with Texture2D I'm having trouble with XML and XNA. I want to be able to load weapon settings through XML to make my weapons easier to make and to have less code in the actual project file. So I started out making a basic XML document, something to just assign variables with. But no matter what I changed it gave me a new error every time. The code below gives me a "XML element 'Tag' not found", I added  and it started to say the variables weren't found.

What I wanted to do in the XML file as well, was load a texture for the file too. So I created a static class to hold my texture values, then in the Texture tag of my XML document I would set it to that instance too. I think that's were the problems are occuring because that's where the "XML element 'Tag' not found" error is pointing me too.

My XML document:

 <XnaContent>
   <Asset Type="ConversationEngine.Weapon">
    <weaponStrength>0</weaponStrength>
    <damageModifiers>0</damageModifiers>
    <speed>0</speed>
    <magicDefense>0</magicDefense>
    <description>0</description>
    <identifier>0</identifier>
    <weaponTexture>LoadWeaponTextures.ironSword</weaponTexture>
   </Asset>
 </XnaContent>

My Class to load the weapon XML:

public class Weapon
{
    public int weaponStrength;
    public int damageModifiers;
    public int speed;
    public int magicDefense;
    public string description;
    public string identifier;
    public Texture2D weaponTexture;
}

public static class LoadWeaponXML
{
    static Weapon Weapons;

    public static Weapon WeaponLoad(ContentManager content, int id)
    {
        Weapons = content.Load<Weapon>(@"Weapons/" + id);

        return Weapons;
    }
}

public static class LoadWeaponTextures
{
    public static Texture2D ironSword;
    public static void TextureLoad(ContentManager content)
    {
        ironSword = content.Load<Texture2D>("Sword");
    }
}

I'm not entirely sure if you can load textures through XML, but any help would be greatly appreciated.

sentences:
Sphere / Simple Gravity (relative magnitude) - Push-back force C++ To save time in my game with pathfinding, I have a lower quality pathfinder, but the way units move between points is direct using

double distance = sqrt(xDistance * xDistance + yDistance * yDistance + zDistance * zDistance);
util_timer_movedelay += updatetime;
if (util_timer_movedelay > speed / 1000)
{

//  cout << "Distance:" << distance << endl;
    if (distance > 0.05)
    {
        unit_x += (0.5 * xDistance * speed * updatetime / distance);
        unit_y += (0.5 * yDistance * speed * updatetime / distance);
        unit_z += (0.5 * zDistance * speed * updatetime / distance);
        util_timer_movedelay = 0;

    }

Diagram
I would like help with a formula to help 1 push objects away from the sphere, but also attract objects to the sphere, now I already know how to calculate the distance that is easy as the above method is also spherical.

precision is an issue, due to the nature of how I've developed my game and the engine, the units are very compact, I'm having to use .3 float accuracy, so being as accurate as is reasonable is important (don't want to get stuck inside the planet or too far away for my path-finding to work), I don't want to push out 1 whole unit of location if the units on the surface of the globe are only 0.5 units in.

And obviously this would be able to work in the same way for the opposite direction yes ?

Basically simple question, how do I find the relative magnitude off distance for my red dot in the diagram to move exactly to the surface, or as close as possible. Should I just project a dot outwards ? I'm unsure / can't remember how to translate the point outwards relative to the sphere.

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

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

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

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

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

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

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

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

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

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

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

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

sentences:
Loading Wavefront Data into VAO and Render It I have successfully loaded a triangulated Wavefront (.obj) into 6 vectors, the first 3 vectors contain the locations for vertices, UV coords, and normals. The last three have the indices stored for each of the faces.

I have been looking into using VAO's and VBO's to render, and I'm not quite sure how to load and render the data. One of my biggest concerns is the fact that indexed rendering only allows you to have one array of indices, meaning I somehow have to make all of the first three vectors the same size, the only way I thought of doing this, is to make 3 new vertex's of equal size, and load in the data for each face, but that would completely defeat the purpose of indexing.

Any help would be appreciated.

sentences:
How to sort poker hands? c++ The examples below come from the answer by Steven Stadnicki in Determining Poker Hands

Suppose a player get a hand like A9772. I would like to store the hand as
either 77A92 or, better yet, 7A927. A hand of two pair would be stored with the higher of the two pairs first, then the lower, then the 'kicker' (so, e.g., A9977 would store as 97A97). Three of a kind would be stored with one card of the three first, then the kickers, then the other cards (e.g., A7772 would be 7A277); a full house would be stored with one of its three and then one of its two (e.g., 99777 would be stored as 79779);

How can I do that? Suppose I have a vector of cards :

std::vector<Card> m_cards;

Or simpler a vector of int

std::vector<int> v = {3, 9, 7, 7, 2};

The goal is to sort the above vector as follows: 77932.

sentences:
How to evaluate a user against optimal performance? I have trouble coming up with a system of assigning a rating to player's performance. Well, technically there is is a trivial rating system, but I don't like it because it would mean assigning negative scores, which I think most players will be discouraged by.

The problem is that I only know the ideal number of actions to get the desired result. The worst case is infinite number of actions, so there is no obvious scale. The trivial way I referred to above is to take score = (#optimal-moves - #players-moves), with ideal score being zero. However, psychologically people like big numbers. No one wants to win by getting a mark of 0. I wonder if there is a system that someone else has come up with before to solve this problem?

Essentially I wish to score the players based on:

How close they've come to the ideal solution.
Different challenges will have different optimal number of actions, so the scoring system needs to take that into account, e.g. Challenge 1 -> max 10 points, Challenge 2 -> max 20 points.
I don't mind giving the players negative scores if they've performed exceptionally badly, I just don't want all scores to be <=0

sentences:
In Unity, how do I move my character to an object when I click on it? Basic question here, and I feel like I'm close but can't quite get it.

I have an object--it's a pot on a stove--that is in my 2D game. There will be multiple pots that appear and disappear in the game, all in predefined places (like on top of the burners of a stovetop). There's also a chef in the game, who goes to each pot and does an action. The user never directly controls the chef's movement--instead, when the user clicks a pot, the chef runs over to the counter in front of that pot, where he can perform an action on the pot.

Can someone tell me how to do this? I'm not only looking for the code but for a "correct" design, in terms of where the various variables and methods should be located. In other words, what goes in the pot's script and what goes in the chef's script? (I'm using C#.)

My thought was that the pot GameObject would have an OnMouseDown() method, to catch the user clicking on it. And in that method, there should be a call to a Move() method that is attached to the chef GameObject.

But what I have is not quite working. The chef moves one small bit toward the pot but then stops. I realize that this is because I'm calling the Move function once and that's it; it seems like the Update method should be involved somehow (the pot's or the chef's?); or maybe I should have an if statement in my Move method that checks to see if the user is at the pot, and if not, runs the move code in a loop. Or maybe the design is just fundamentally wrong and it could be done more easily.

Here is the code I have:

public class PotController : MonoBehaviour {

    private GameObject chefObject;

    void Start () {
        chefObject = GameObject.Find ("Chef");
    }

    void OnMouseDown() {
        ChefController chefScript = chefObject.GetComponent<ChefController> ();
        chefScript.Move ();
    }

}

public class ChefController : MonoBehaviour {

    public float moveSpeed;
    private Vector3 moveDirection;

    public void Move () {

        Vector3 currentPosition = transform.position;
        if (Input.GetButton ("Fire1")) {
            Vector3 moveToward = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            moveDirection = moveToward - currentPosition;
            moveDirection.z = 0;
            moveDirection.Normalize ();
        }
        Vector3 target = moveDirection * moveSpeed + currentPosition;
        transform.position = Vector3.Lerp( currentPosition, target, Time.deltaTime );

    }

}

sentences:
Can't go above max speed with RigidBody2D.AddForce() I'm having trouble making a character move faster than a certain limit using RigidBody2D.AddForce(). My game is a top-down 2D game (constrained to the x/y plane).

I'm using a float 'MovementSpeed' to scale a normalized vector passed to RigidBody2D.AddForce(), however, when I increase MovementSpeed past 1000, there's almost no noticeable difference in the object's "speed"; going from 100 to 1000 is a drastic difference, but there's almost no noticeable difference going from 1000 to 1000000. Here's my WASDMovement() function (called during FixedUpdate() ):

private void WASDMovement() {
    Vector3 translationVector = Vector3.zero;

    if (Input.GetKey(KeyCode.W)) {
        translationVector += new Vector3(0.0f, 1.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.A)) {
        translationVector += new Vector3(-1.0f, 0.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.S)) {
        translationVector += new Vector3(0.0f, -1.0f, 0.0f);
    }
    if (Input.GetKey(KeyCode.D)) {
        translationVector += new Vector3(1.0f, 0.0f, 0.0f);
    }

    translationVector.Normalize();
    rigidbody2D.AddForce(translationVector * MovementSpeed);
}

Here's a video demonstrating my problem to make it easier to see what I'm doing wrong: http://youtu.be/9kwKvfDOYoo

sentences: What would be the best way to implement a multi-directional "board game" movement system? I'm pretty new to game dev, and can't figure out how to do this, even though it is probably really easy. If you need more reference, look up some gameplay of the Wii game Dokapon Kingdom, that's the kind of system I'm trying to create. I also made a picture to help you better understand my dilemma. Thank you all so much in advance!

sentences:
Is there a way to use other fonts, besides the default ones in OpenGLUT? I'm using OpenGLUT functions like glutBitmapString to render sentences and words in a game. However, there is a limited set of fonts to use and I need some bigger size fonts. Is there a way to add new fonts to these functions/API?

Thanks

sentences:
How could I figure out the shortest way to turn, and whats the angle? I'm creating some robots for my tank game. I want them to find each other and shoot each other down, so I'm trying to implement a way for them to turn towards each other, and turn the shortest way. For instance, if we where T1 (tank 1), how could I figure out if I where to turn right of left, and at what angle to turn if

Tank1 (us) position is (8906,76), facing is 23 degrees.
Tank2 (enemy) position is (888,61)

0/360 is straight up.

The way I've tried to do is to decide what quadrant the enemy is of myself. But that leaves out a 45 degree angle to fail. I know there is some archtan but I cant simply get a grip on them...

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: 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:
Grouping game objects I'm trying to create a simple turn based console (command line) game but I'm confused of what approach to use when creating classes for objects. My concern is maintainability and flexibility.

First Approach:

class Weapon{
    ...
}

class Sword:Weapon{
    ...
}

class ShortSword:Sword{
    ...
}

class TwoHandedSword:Sword{
    ...
}

class Axe:Weapon{
    ...
}

class HeavyAxe:Axe{
    ...
}

Second Approach:

class Sword{
    SwordType type;
    ...
}

class Axe{
    AxeType type;
    ...
}

So which is better, first or second? Why?

Important Note: I'm a beginner in game development.

sentences:
Editing attached component property in Unity (C#) This might be more of a general C#/programming query, but since it's game dev related, I'm putting it here.

I am trying to randomise a property in a custom component (C# script) across several Unity game objects.

hostiles is a list of game objects, each with an attached Stats component.

foreach (GameObject gO in hostiles)
{
    // Randomise spawn area…
    gO.GetComponent<Stats>().AreaNo = Random.Range(0, 3);
}

Perhaps unsurprisingly, all of my objects end up with the same value for AreaNo. It seems as though I’m reassigning some global version of Stats.AreaNo in my loop, rather than the individual instances. What am I missing?

(Sorry in advance for the noobish question!)

sentences: What are the makings of a good Character What properties make the main character of a game such that players can easily identify with it? Can the same set properties be used when designing the NPC characters players interact with, or should a different set of properties be considered?

sentences:
How to play the sound of an object sliding on another object for a variable duration I would like to add sound effects to a basic 2D game. For example, a stone sphere is rolling on wood surface. Let's say I have a 2 second audio recording of this. How could I use the sample to add sound for an arbitrary duration ?

So far I have two solutions in mind:

a/ record the sound for an amount of time that is greater than the maximum expected duration, and play only a part of it;

b/ extract a small portion of the sample and play it in a loop for the duration of the move; however I'm not sure if it makes sense with an audio wave.

sentences:
Took one major now want to be in different industryssT How different is Programmer Analyst from Game Programmer?
I took the first one as my major but want to go with game development industry.
Is it possible to transition from one to another?

EDIT: There is a single class about game development in this major

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

sentences:
How to 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:
What are the properties of "position, velocity, acceleration, rotation" collectively named? They say naming things is one of the hardest problems in computer programming. They were right.

Given the pseudocode below, what is a more appropriate name for this collection of properties? "Course", "Route", "Heading", "Orientation" all don't capture it.

class NewtonianStuff { // <-- Needs a better name
  vec3 position, velocity, acceleration; // <-- What is this group called
  quat rotation;
};

class SpaceShip {
    NewtonianStuff xxxxxx; // <-- What do you call that
};

Perhaps that collection is too abstract. What is the formal name for this collection of properties?

vec3 position, velocity, acceleration;

The best I can come up with is "PositionAndDerivatives", which doesn't really flow.

sentences:
Unity - Static Camera Perspective, Walls Obscure Player Pretty simple and common problem here.
The world I'm designing is fully explorable, no invisible walls or tricks. It's presented as a single seamless area, a School complex with 9 buildings, some of which have 2 or 3 floors and contain many rooms.

The perspective I've chosen is simple, inspired by topdown RPGs:

A problem arises with walls. They obscure the player.

I've tried some shaders which draw a silhouette of the player ontop but I don't like this approach, other objects and decoration remains obscured behind the wall.
Some kind of dissolve effect allowing you to see through the walls would be preferable, but writing my own shaders is not my forté...

Another problem is with large buildings outside. The camera is at a fixed distance, about 14 metre's away. If the player walks behind a large building (over ~10 metres tall) then the camera cuts off the top of it as it is now within the building.

The only way I can think of fixing this is to adjust the distance between player and camera, but some of the buildings are so tall the zoom-out looks very unusual and impractical.

I suppose this is why you don't see this simplistic camera setup in large explorable games...

While I've been developing games for some years now, I've only come to 3D and Unity fairly recently, so there might be a jaw-droppingly simple solution which I'm not seeing.

Anyway, I'd like to hear some interesting or novel approaches towards fixing these problems, besides the simple ones I've suggested.

I hope that's not asking too much.

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

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

sentences:
How to shade a texture two different colors? To give an example of what I'm asking about, I'll use Saints Row 3 since I've been playing that lately.  In that game you can customize your looks and your car's appearance a lot.  Your coat can have a primary color and a trim color.  Your car can have a primary color and a stripe color, etc.

Is there just a single coat texture that is being shaded two different colors somehow or are they overlaying a transparent second texture for the trim/stripes that gets shaded differently?

If it's just one texture I'd like to know how it's done.

If it's two different textures it seems like it's a waste of space.  The second texture would be the same size as the first one but mostly transparent if you just wanted to lay it on top of the first one.  Or are they just carefully positioning a second, smaller texture so that it aligns properly with the first one?

sentences:
Sprite Animation Using Multiple Images (XNA / C#) all.

Right now I am currently working on a game with my Australian buddy and I just am having such a difficult time with the spriting process.  As the programmer of our game, it is my responsibility to get the sprites he models drawn and animated onscreen.  However, the sprites he's drawing are huge images and the animation sequences are always at least 20 images wide, which means they're too big for the FileOpen method to read...  Which brings me to my question: Is there a way to use a directory as the animation sequence?  Like instead of stringing all the images together in a chain and animating the sequence, can I make an animation from a collection of the images in a folder?

For this example, use Animation.png to represent the chain of images version and Image1, 2, and 3.png for individual images in a directory.

Thanks in advance!

sentences: How to change FPS when using a sprite sheet and AnimationPlayer? With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer?

sentences:
Simple Orbital transfer and intercept equation I'm working on a game which has a game board made up of objects orbiting the center of the board.  You can think of it as our solar system, but greatly simplified in terms of physics.  All objects have a mass and gravity of 1.0.  Their orbital speeds are simply a linear function of their radius from the center (Sun).

The player has a base, which in terms of our solar system would be Earth.  The player needs to send a spaceship to another planet in a different orbit.  The spaceship has a constant acceleration (or deceleration), and unlimited fuel.

I need to figure out an equation to get this spaceship going towards one of the planets and intercept it.  I've looked at some orbital mechanics web pages, but this is a little beyond my math skills and I think too complex for what I'm trying to achieve.  Any help would be much appreciated.

NOTE:  If this is better suited for SE.Mathmatica, please feel free to move.

sentences:
Why can't I read .ttf file when running Android configuration? When running or debugging my game on Android device, I get this error in the logcat:

  com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/fonts/myFont.ttf (Internal)

Which is created by this code line:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

where fontFile is defined like this:

FileHandle fontFile = Gdx.files.internal("data/fonts/myFont.ttf");

This doesn't happen when I run the desktop configuration.

I know that for desktop configuration you have to define the working directory of your project, but I don't see such option in android configuration and it also makes no sense, so I don't think it's a "working directory"-related problem.

Obviously, the file is in the correct path.

Also note that everything worked fine in my previous project. I created this new project by creating a new blank prj using libgdx-setup and then copying all the classes and packages from the older project. So maybe it's a problem related to some Gradle file?

sentences:
OpenGL ES 2.0: Mixing 2D with 3D Is it possible to mix 2D and 3D graphics in a single OpenGL ES 2.0 game, please?

I have plenty of 2D graphics in my game. The 2D graphics is represented by two triangular polygons (making up a rectangle) with texture on them. I use orthographic matrix to render the whole scene.

However, I need to add some 3D effects into my game. Threfore, I wish to use perspective camera to render the meshes.

Is it possible to mix orthographic and perspective camera in one scene? If yes, is there going to be a large performance cost for this? Is there any recommended approach to do this effectively? I wil have 90% of 2D graphics and only 10% of 3D.

Target platform is OpenGL ES 2.0 (iOS, Android). I use C++ to develop.

Thank you.

sentences:
How to trigger OnMouseX events on Kinematic Rigidbody2D object with a different collider than one used for collisions? I have a use-case where I have an object with a Collider2D and a Kinematic RigidBody2D in order to do Kinematic movement.
However, I also want to be able to select/hover that object with a OnMouseDown/OnMouseEnter/etc, using a larger collider than I would use for the kinematic movement.
My current attempt at a solution is to have Physics-related scripts/rigidbody2d/collider2d as the top level game object, and to have a child object, with a larger collider2D which will respond to OnMouseX events.

In order to ignore OnMouseX events on the parent, I'm putting it into its own user_ignore_raycasts layer (I need it as its own layer for the layer collision matrix). I'm also putting the child in its own user_use_raycasts layer.
I'm passing that into a script that sets MainCamera's event mask:

using UnityEngine;

[RequireComponent(typeof(Camera))]
public class CameraEventMasker : MonoBehaviour
{
    [SerializeField]
    private LayerMask cameraEventMask;

    // Start is called before the first frame update
    void Awake()
    {
        GetComponent<Camera>().eventMask = cameraEventMask;
    }
}

What I notice is that OnMouseX events on the child will work IF the RigidBody2D on the parent is deleted...however, if the RigidBody2D is there, I won't receive any events. Anyone know why this is the case, and if there are other workarounds or solutions?

sentences:
is a good practice to orgnize MVC classes in diferent packages? Im,working on a project where the classes are organized by subject like gameplay, menus, utilities etc... Basically this 3 packages.

is a good practice to organize classes in controller, view and module packages ?

games are typically visual applications. This question is regarding the viability of a particular organization and pattern in a game application, which are mostly visually oriented.

sentences:
How do I programmatically remove an image's background color? I have a sprite sheet (image) and want to draw it on screen.

image  = sprite sheet image
x      = player x position
y      = player y position
width  = player width
height = player height

public class main extends japplet
{
    ...

    public void paint(Graphics g)
    {
        g.drawImage(image, x, y, x+width, y+height,
                   0, 0, 40, 40 ,sprite_sheet.m1);
    }
}

On the sprite sheet, I have the image of a player with a blue background color. Calling drawImage shows the blue background too. I could remove the color with Photoshop, but I really don't want to, because it would remove part of my player.

Can I remove the background color with Java code?

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:
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:
LibGDX cannot save to internal file I want to save the state of the game in a file, so I can read it at the next start.
The Problem is, that I get a exception, if I try to save something internal.
If I try to save it local all work fine.
I save the file as a Json.

Bird bird = new Bird();
bird.setName("Foo");
bird.setSkin(new Texture("data/foo.png"));
bird.save(Gdx.files.internal("bird.json"));

The save mthod:

Json json = new Json();
file.writeString(json.prettyPrint(this), false);

  Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: bird.json (Internal)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:349)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:335)
      at com.buschmannmichael.fattybird.core.Bird.save(Bird.java:31)
      at com.buschmannmichael.fattybird.game.FattyBirdGame.create(FattyBirdGame.java:16)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:137)
      at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:115)
  Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Cannot write to an internal file: bird.json
      at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:315)
      at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:346)
      ... 5 more

Whats the problem of LibGDX, where I should save the files, so I can run the game on android, desktop and html ?
(I tested this method I showed above only on desktop, maybe it works on android but I want a solution for all platforms)

Maybe someone can help me :)

sentences:
How to draw to a surface, then draw that surface to the screen i have a 2D MonoGame Game (using DirectX), that was originally an XNA game. It involves prerendered shadows (they are Texture2Ds drawn with SpriteBatch.draw). Right now the shadows are being drawn with an alpha value, so overlapping shadows appear darker. This is NOT what i want. Overlapping shadows should be the same shade of black.

So what i want to do is draw all these shadows to a surface, such that the shadows are completely black (alpha == 255), and the surface background is completely transparent (alpha == 0), and then take that surface and draw it to the screen using Color.White*0.25f to give alpha to the shadows at the end.

I'm not sure how to switch rendering targets, or whatever the terminology is, and go about this. Can someone help?

what ive tried so far:

GraphicsDevice.SetRenderTarget(RENTAR); // RENTAR is the name of my RenderTarget2D
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // not really sure what this does but it was in examples
GraphicsDevice.Clear(Color.White*0.0f); // i clear it with a totally transparent white background, in other words, white with alpha == 0

// now draw shadows normally, but instead of Color.White*0.25f, i use Color.White so that the black shadows are drawn completely black, with no alpha

GraphicsDevice.SetRenderTarget(null); // switch render target back to the screen
SpriteBatch.Draw(RENTAR, new Rectangle(0, 0, 800, 600), Color.White*0.25f); // see i added the "*0.25f" to try to draw this texture with alpha, but it comes out totally blank

So all of this works except that the shadows end up being completely black. I want them completely black in the RenderTarget, so that they dont overlap with any darker shades, and then i want to draw the final RenderTarget on the screen with an alpha of 0.25f, hence "Color.White*0.25f" in the final spritebatch draw. But its as if that 0.25f doesn't exit.

sentences:
Can one draw a cube using different method/drawing mode? I've just started learning gamedev (in particular android EGL based) and have ran over a code from Pro Android Games 2 that looks as follows:

  /*  * Copyright (C) 2007 Google Inc.
  *  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.  * You
  may obtain a copy of the License at  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *  * Unless required by applicable law or agreed to in writing, software  *
  distributed under the License is
  distributed on an "AS IS" BASIS,  *
  WITHOUT WARRANTIES OR CONDITIONS OF
  ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and  *
  limitations under the License.  */

  package opengl.scenes.cubes;

  import java.nio.ByteBuffer; import
  java.nio.ByteOrder; import
  java.nio.IntBuffer;

  import javax.microedition.khronos.opengles.GL10;

  public class Cube {

public Cube(){

    int one = 0x10000;
    int vertices[] = {
            -one, -one, -one,
            one, -one, -one,
            one,  one, -one,
            -one,  one, -one,
            -one, -one,  one,
            one, -one,  one,
            one,  one,  one,
            -one,  one,  one,
    };

    int colors[] = {
            0,    0,    0,  one,
            one,    0,    0,  one,
            one,  one,    0,  one,
            0,  one,    0,  one,
            0,    0,  one,  one,
            one,    0,  one,  one,
            one,  one,  one,  one,
            0,  one,  one,  one,
    };

    byte indices[] = {
            0, 4, 5,    0, 5, 1,
            1, 5, 6,    1, 6, 2,
            2, 6, 7,    2, 7, 3,
            3, 7, 4,    3, 4, 0,
            4, 7, 6,    4, 6, 5,
            3, 0, 1,    3, 1, 2
    };

    // Buffers to be passed to gl*Pointer() functions
    // must be direct, i.e., they must be placed on the
    // native heap where the garbage collector cannot vbb.asIntBuffer()
    // move them.
    //
    // Buffers with multi-byte datatypes (e.g., short, int, float)
    // must have their byte order set to native order

    ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
    vbb.order(ByteOrder.nativeOrder());
    mVertexBuffer = vbb.asIntBuffer();
    mVertexBuffer.put(vertices);
    mVertexBuffer.position(0);

    ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4);
    cbb.order(ByteOrder.nativeOrder());
    mColorBuffer = cbb.asIntBuffer();
    mColorBuffer.put(colors);
    mColorBuffer.position(0);

    mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
    mIndexBuffer.put(indices);
    mIndexBuffer.position(0);
}

public void draw(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CW);
    gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
    gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer);
    gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
}

private IntBuffer   mVertexBuffer;
private IntBuffer   mColorBuffer;
private ByteBuffer  mIndexBuffer;}

So it suggests to draw a cube using triangles. My question is: can I draw the same cube using GL_TPOLYGON? If so, isn't that an easier/more understandable way to do things?

sentences:
How to poll input for a gui in libgdx? Ok, so my question is simple. How do you poll input with a GUI class without it affecting what's underneath the GUI? So suppose you have an RPG game with a gui for the d-pad and other controls:

gui.getInput(); //User taps button in the gui
world.getInput(); //The tap should have only affected the gui, but instead goes through and also affects the world

How can you deal with this problem? I thought of some ways but I don't like them.

sentences:
How to make glow effect in cocos2dx i searching the web for glowing effect , i like to be able to create misc glowing effects ,
like lasers , glow around sprites and such .
couldn't find any thing on the web , any body have any direction ?
something like this :

sentences:
Beat detection and FFT I am working on a platformer game which includes music with beat detection. I am currently detecting beats by checking for when the current amplitude exceeds a historical sample. This doesn't work well with genres of music, like rock, which have a pretty steady amplitude.

So I looked further and found algorithms splitting the sound into multiple bands using FFT...  then I found the Cooley-Tukey FFt algorithm

The only problem I'm having is that I am quite new to audio and I have no idea how to use that to split the signal up into multiple signals.

So my question is :

How do you use a FFT to split a signal into multiple bands ?

Also for the guys interested, this is my algorithm in c# :

// C = threshold, N = size of history buffer / 1024
    public void PlaceBeatMarkers(float C, int N)
    {
        List<float> instantEnergyList = new List<float>();
        short[] samples = soundData.Samples;

        float timePerSample = 1 / (float)soundData.SampleRate;
        int sampleIndex = 0;
        int nextSamples = 1024;

        // Calculate instant energy for every 1024 samples.
        while (sampleIndex + nextSamples < samples.Length)
        {

            float instantEnergy = 0;

            for (int i = 0; i < nextSamples; i++)
            {
                instantEnergy += Math.Abs((float)samples[sampleIndex + i]);
            }

            instantEnergy /= nextSamples;
            instantEnergyList.Add(instantEnergy);

            if(sampleIndex + nextSamples >= samples.Length)
                nextSamples = samples.Length - sampleIndex - 1;

            sampleIndex += nextSamples;
        }

        int index = N;
        int numInBuffer = index;
        float historyBuffer = 0;

        //Fill the history buffer with n * instant energy
        for (int i = 0; i < index; i++)
        {
            historyBuffer += instantEnergyList[i];
        }

        // If instantEnergy / samples in buffer < instantEnergy for the next sample then add beatmarker.
        while (index + 1 < instantEnergyList.Count)
        {
            if(instantEnergyList[index + 1] > (historyBuffer / numInBuffer) * C)
                beatMarkers.Add((index + 1) * 1024 * timePerSample);
            historyBuffer -= instantEnergyList[index - numInBuffer];
            historyBuffer += instantEnergyList[index + 1];
            index++;
        }
    }

sentences: Public format for 2D animations What public animation file formats are there available for 2D games? I'd like to know about both formats for procedural/skeletal animation, as well as traditional animation.

sentences:
Problem with Factory Method Pattern when I try to create a Weapon:MonoBehaviour I'm learning about Design Patterns using Unity and I'm not sure about how to solve the following problem with the Factory Method Pattern:

I want to read a XML file and using the Factory Method Pattern to create a Component (a Weapon) to add it to a GameObject which will be cointained on a Pool Manager, but Weapon "Is A" MonoBehaviour and for that reason It can't be instantiated using a "machineGun = new MachineGun();"

public abstract class WeaponFactoryMethod
{
    protected string fileName = "weapons.xml";
    public abstract Weapon CreateWeapon();
}

public class MachineGunFactoryMethod : WeaponFactoryMethod
{
    public override Weapon CreateWeapon()
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
        Weapon machineGun = null;
        XmlReader xmlReader = new XmlTextReader(filePath);
        if (xmlReader.ReadToDescendant("Weapons"))
        {
            if (xmlReader.ReadToDescendant("Weapon"))
            {
                do
                {
                    // I CAN'T DO THIS:
                    machineGun = new MachineGun();
                    machineGun.ReadXml(xmlReader);
                } while (xmlReader.ReadToNextSibling("Weapon"));
            }
            else
            {
                Debug.LogError("There aren't definition for Weapon");
            }
        }
        else
        {
            Debug.LogError("There aren't definition for any Weapon");
        }

        return machineGun;
    }
}

public abstract class Weapon : MonoBehaviour, IXmlSerializable
{
    public float AttackRange { get; set; }
    //Every weapons Shoots in a different way
    public abstract void Shoot();

    //Serialization
    public XmlSchema GetSchema()
    {
        return null;
    }

    public void ReadXml(XmlReader reader)
    {
        XmlReader childReader = reader.ReadSubtree();
        while (childReader.Read())
        {
            switch (childReader.Name)
            {
                case "AttackRange":
                    childReader.Read();
                    AttackRange = childReader.ReadContentAsInt();
                    break;
            }
        }
    }

    public void WriteXml(XmlWriter writer)
    {

    }
}

public class MachineGun : Weapon
{
    public override void Shot()
    {
        //Raycasting..
    }
}

At the end I want something like

GameObject (player)
 - Component (A Weapon script with the data from the xml)

Should I just create a GameObject (player) and do an "AddComponent < MachineGun >" and later copy the info from the xml file instead using the Factory Method Pattern??

Is there a better way??

Any suggestions, corrections or advice will be very grateful.

I'm sorry by my English.

sentences:
Does there exist a library of animations for easing, skewing, bouncing, and squishing? I'm specifically referring to the types of animations that are typical in 2D hand held games on the Nintendo platform, where menus slide in, bounce, squish, etc.

I'm looking for something that is somewhat canned but allows for tweaks. Does something like this exist in any form (don't really care what language or for what targeted platform, I'm just looking for the pure math behind it).

sentences:
How to deallocate/release/delete of a glTexStorage2D? I tried to find this but found nothing.

Does anyone know how to 'deallocate' textures/mipmap from glTexStorage2D once you don't need it anymore?

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:
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:
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: When does "frustum culling" actually happen? So I am a little bit confused, and hopefully not too far off, about when frustum culling actually occurs. Let's suppose that I already have my objects in camera space, and then I have applied the perspective matrix onto it which puts everything into a cube AKA the canonical volume. From there, do I immediately do the "culling" and then simply drop the "z" axis of each point to draw it on 2D image plane? How exactly do I do the culling in the canonical cube volume?

sentences:
How to remove skeleton from a model? I have bought a 3d character on turbosquid. I opened it in Unity and everything loads fine except the animations. I then imported the skeleton to Mixamo to find out the skeleton is messed up. I use the set joints manually in Mixamo, but when it tries to fix the issue, the hands get attached to the butt/hips. I would like to get rid of the skeleton and remake it. How would I go about doing this?

I believe what I am trying to do would be called derigging? I could then use Mixamo's autorig tool to make a better skeleton.

sentences:
Application toolkits like QT versus traditional game/multimedia libraries like SFML I currently intend to use SFML for my next game project.  I'll need a substantial GUI though (RPG/strategy-type) so I'll either have to implement my own or try to find an appropriate third party library, which seem to boil down to CEGUI, libRocket, and GWEN.  At the same time, I do not anticipate doing that many advanced graphical effects.  My game will be 2D and primarily sprite-based with some sprite animations.

I've recently discovered that QT applications can have their appearance styled so that they don't have to look like plain OS apps.  Given that, I am beginning to consider QT a valid alternative to SFML.  I wouldn't have to implement the GUI functionality I'd need, and I may not be taking advantage of SFML's lower-level access anyway.  The only drawbacks I can think of immediately are the learning curve for QT and figuring out how to fit game logic inside such a framework after getting used to the input/update/render loop of traditional game libraries.

When would an application toolkit like QT be more appropriate for a game than a traditional game or multimedia library like SFML?

sentences:
How are lights rendered as geometry in deferred shading? So my problem is that: At the last stage of implementing this I had problem with this sentence, " the lights in the scene are rendered as geometry". What does this mean?
Why do I store depth info for the model in an earlier stage?
What is texture projection ?

I had try to read many tutorials, but every time I end up coming here because I find what I need.

sentences:
Data structures for a 2D multi-layered and multi-region map? I am working on a 2D world editor and a world format subsequently. If I were to handle the game "world" being created just as a layered set of structures, either in top or side views, it would be considerably simple to do most things.

But, since this editor is meant for 3rd parties, I have no clue how big worlds one will want to make and I need to keep in mind that eventually it will become simply too much to check, handling and comparing stuff that are happening completely away from the player position.

I know the solution for this is to subdivide my world into sub regions and stream them on the fly, loading and unloading resources and other data. This way I know a virtually infinite game area is achievable. But, while I know theoretically what to do, I really have a few questions I'd hoped to get answered for some hints about the topic.

The logic way to handle the regions is some kind of grid, would you pick evenly distributed blocks with equal sizes or would you let the user subdivide areas by taste with irregular sized rectangles?
In case of even grids, would you use some kind of block/chunk neighbouring system to check when the player transposes the limit or just put all those in a simple array?
Being a region a different data structure than its owner "game world", when streaming a region, would you deliver the objects to the parent structures and track them for unloading later, or retain the objects in each region for a more "hard-limit" approach?
Introducing the subdivision approach to the project, and already having a multi layered scene graph structure on place, how would i make it support the new concept? Would you have the parent node have the layers as children, and replicate in each layer node, a node per region? Or the opposite, parent node owns all the regions possible, and each region has multiple layers as children? Or would you just put the region logic outside the graph completely(compatible with the first suggestion in Q.3)
When I say virtually infinite worlds, I mean it of course under the contraints of the variable sizes and so on. Using float positions, a HUGE world can already be made. Do you think its sane to think beyond that? Because I think its ok to stick to this limit since it will never be reached so easily..
As for when to stream a region, I'm implementing it as a collection of watcher cameras, which the streaming system works with to know what to load/unload. The problem here is, i will be needing some kind of warps/teleports built in for my game, and there is a chance i will be teleporting a player to a unloaded region far away. How would you approach something like this? Is it sane to load any region to memory which can be teleported to by a warp within a radius from the player?

Sorry for the huge question, any answers are helpful!

sentences:
Precision loss when transforming from cartesian to isometric My goal is to display a tile map in isometric projection. This tile map has 25 tiles across and 25 tiles down. Each tile is 32x32. See below for how I'm accomplishing this.

World Space

World Space to Screen Space Rotation (45 degrees)

Using a 2D rotation matrix, I use the following:

double rotation = Math.PI / 4;
double rotatedX = ((tileWorldX * Math.Cos(rotation)) - ((tileWorldY * Math.Sin(rotation)));
double rotatedY = ((tileWorldX * Math.Sin(rotation)) + (tileWorldY * Math.Cos(rotation)));

World Space to Screen Space Scale (Y-axis reduced by 50%)

Here I simply scale down the Y value by a factor of 0.5.

Problem

And it works, kind of. There are some tiny 1px-2px gaps between some of the tiles when rendering. I think there's some precision loss somewhere, or I'm not understanding how to get these tiles to fit together perfectly. I'm not truncating or converting my values to non-decimal types until I absolutely have to (when I pass to the render method, which only takes integers). I'm not sure how to guarantee pixel perfect rendering precision when I'm rotating and scaling on a level of higher precision. Any advice? Do I need to supply for information?

sentences:
Network protocol for chat -- UDP or TCP I'm trying to develop a fast-paced multiplayer game.

Now I'm using UDP as a transport-layer protocol to communicate between clients and server. But what if I want to implement a chat? Should I send chat messages via UDP as well (with re-sending and other TCP-like stuff) or should I use another TCP socket for such purposes?

Which one is the best practice?

sentences:
Existing master server software? Considering there are many games out there that use some sort of a server that contains a list of current games/servers, is there an existing library I can use instead of writing my own master server?

I only wish to store game/server data (server name/ip, num players, game-specific data...).

Thanks!

sentences:
Shadowmap moving with camera I am trying to shadowmap a large terrain, I position my light that it is always at the position of the player and looking at the player, the problem is that the shadows now move with the player, I tried to set the position to 0 1000 500 and look at the player always and its a good improvement however the player moves out of the light there are now no shadows :(

How am I supposed to make the light so it covers the entire terrain and everything has shadows all the time without the shadow moving effect?

I am really stuck right now, do I need to somehow calculate scene bounds? would that help at all?

sentences:
Position is not what it should be when attaching fixture In XNA / Farseer I have something like this:

Body body = BodyFactory.CreateRectangle(world, 1f, 2f, 1f);
FixtureFactory.AttachCircle(0.5f, 1f, body, new Vector2(0f, 1f));

I have been told that body.Position property is the center of the AABB of the Body. In this example it seems not to be so. When I do something like this to display the coordinates of the position I see that they are at the center of the rectangle created at the beginning:

BodyFactory.CreateCircle(world, 0.1f, 1f, Body.Position);
BodyFactory.CreateCircle(world, 0.1f, 1f, Body.WorldCenter);

The center of gravity seems also to be the same.
I need this for drawing my texture over the Body. The origin for drawing is then like this:

Vector2 Origin = new Vector2(Sprite.Width / 2, Sprite.Height / 2);

Am I doing something wrong or does the engine not recognize, that a circle fixture is attached to the rectangle?
Is there any workaround?

sentences:
Heightmap using Simplex noise with octaves: help with parameters and interpretation I've found a few pieces of code around, where Java code for Simplex noise (based on this widely quoted paper) was coupled with octaves to get a heightmap. However those classes/snippets are NOT in the -1,1 range despite saying so, so I had to add some modifications.

By trial and error and some brain work I got to a version that produces an output within -1 and 1, here (could you sanity check it please? It this correct?):

public static float[][] generateOctavedSimplexNoise(final int width,
                                                    final int height,
                                                    final int octaves,
                                                    final float roughness,
                                                    final float scale)
{
    final float[][] totalNoise = new float[width][height];
    float layerFrequency = scale;
    float layerWeight = 1f;
    float weightSum = 0f;

    for (int octave = 0; octave < octaves; octave++)
    {
        // Calculate single layer/octave of simplex noise, then add it to total noise
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                totalNoise[x][y] += (float) noise(x * layerFrequency, y * layerFrequency) * layerWeight;
            }
        }

        // Increase variables with each incrementing octave
        layerFrequency *= 2f;
        weightSum += layerWeight;
        layerWeight *= roughness;
    }

    // scale output between -1 and 1, as we are doing
    // a weighted average
    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            totalNoise[x][y] /= weightSum;
        }
    }

    return totalNoise;
}

My understanding is that "roughness" must vary between 0 and 1, and influences the "flatness" of the final image. What "scale" is I cannot fathom yet - any help?. Also, more than 6-7 octaves seems useless in my tests, hopefully this is expected.

But most of all my question is: how do I work in a top-down way? That is, knowing the kind of map I roughly want (a big island in the ocean, with a few lakes and a few mountains, but mostly plain and hills) how do I choose parameters and the thresholds for terrain types?

I've tried a lot, but I can't seem to control the function to produce a nice map..

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:
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:
I need to move an entity to the mouse location after i rightclick Well I've read the related questions-answers but still cant find a way to move my champion to the mouse position after a right-button mouse-click.
I use this code at the top:

float speed = (float)1/3;

And this is in my void Update:

  //check if right mouse button is clicked
        if (mouse.RightButton == ButtonState.Released && previousButtonState == ButtonState.Pressed)
        {
            // gets the position of the mouse in mousePosition
            mousePosition = new Vector2(mouse.X, mouse.Y);

            //gets the current position of champion (the drawRectangle)
            currentChampionPosition = new Vector2(drawRectangle.X, drawRectangle.Y);

            // move champion to mouse position:
            //handles the case when the mouse position is really close to current position
            if (Math.Abs(currentChampionPosition.X - mousePosition.X) <= speed &&
                Math.Abs(currentChampionPosition.Y - mousePosition.Y) <= speed)
            {
                drawRectangle.X = (int)mousePosition.X;
                drawRectangle.Y = (int)mousePosition.Y;
            }
            else if (currentChampionPosition != mousePosition)
            {
                drawRectangle.X += (int)((mousePosition.X - currentChampionPosition.X) * speed);
                drawRectangle.Y += (int)((mousePosition.Y - currentChampionPosition.Y) * speed);
            }
        }
        previousButtonState = mouse.RightButton;

What that code does at the moment is on a click it brings the sprite 1/3 of the distance to the mouse but only once. How do I make it move consistently all the time? It seems I am not updating the sprite at all.

EDIT
I added the Vector2 as Nick said and with speed changed to 50 it should be OK. I tried it with if ButtonState.Pressed and it works while pressing the button. Thanks.
However I wanted it to start moving when single mouse clicked. It should be moving until reaches the mousePosition.

The Edit of Nick's post says to create another Vector2, But I already have the one called mousePosition. Not sure how to use another one.

            //gets a Vector2 direction to move *by Nick Wilson
            Vector2 direction = mousePosition - currentChampionPosition;

            //make the direction vector a unit vector
            direction.Normalize();

            //multiply with speed (number of pixels)
            direction *= speed;

            // move champion to mouse position
            if (currentChampionPosition != mousePosition)
            {
                drawRectangle.X += (int)(direction.X);
                drawRectangle.Y += (int)(direction.Y);
            }
        }
        previousButtonState = mouse.RightButton;

sentences:
Using 3D models in an 2D Game in libGDX In my libGDX 2D RPG-Game (like Zelda or something) I want to display some items as 3D-Objects. Since I'm using an OrthographicCamera like this:

this.gameWorldCam = new OrthographicCamera();
this.hudCam = new OrthographicCamera();
gameWorldCameraViewport = new ExtendViewport(FRUSTUM_WIDTH, FRUSTUM_HEIGHT, gameWorldCam);

I don't know how to render 3D-Object on it. In my render loop I call this:

// 2D
spritebatch.begin();
...
spritebatch.end();

// ----------------------------------------------
// Just some hardcoded model creation for testing
// ----------------------------------------------
Model model;
ModelInstance instance;
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(
  5f,
  5f,
  5f,
  new Material(ColorAttribute.createDiffuse(Color.GREEN)),
  Usage.Position | Usage.Normal
);
instance = new ModelInstance(model);
// ---------------------------------------------

// 3D
modelBatch.begin(gameWorldCam);
modelBatch.render(instance);
modelBatch.end();

// 2D
spritebatch.begin();
...
spritebatch.end();

What do I have to do, to get the proper result? Right now, nothing of the green 3D cube is visible.

sentences:
How 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:
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:
Unity sprite rig affecting performance I created a simple sprite rig using the skinning editor provided by the new 2D Animation V2 package. But it causes a huge FPS drop when added to the scene.

Methods such as SpriteSkin.LateUpdate generates significant amount of garbage as shown in the picture: See the spike shown on the CPU profiler when the rig is being enabled:

The rig is not even animated.  I also checked the other sample rigs provided by Unity and they also performed in a similar fashion.

Is this normal? I'm targeting mobile, so anything that can be done to avoid or improve the situation will be helpful.

I'm using 2d-animation-v2 2.0.0-preview.2 in Unity 2018.3.8f

sentences:
how to sync clients and local avoidance in mobile RTS game? I have been making mobile RTS game in Unity look like Clash Royale similarly.

Unfortunately, I faced to two big problems.

First is two phones(clients) to be synchronized each other in game state.
And second is "path finding" or "local avoidance"(collision check).

To solve the path finding issue, I have searched about "Flow Field".

Should I do consider on 3 layer map(cost field, integration field, flow field) to apply "Flow field"?
If I do apply "flow field" to my game, can I have a liberty from the problem of Sync two clients?

Thank you in advance.

sentences:
A simple map, four biomes, and how to distribute them Here's the basic idea: I've got a Rogue-ish, perhaps Dwarf Fortress-ish game, with a randomly generated overworld and several dungeon entrances scattered around it. I already have the dungeons basically covered, but I'm stuck on an aspect of the overworld.

Said overworld, considered as a 2D map of screens, should have a perhaps blob-like distribution of four different themes or biomes -- grasslands, desert, snow and swamp, each with their own total amount of screens. Let's say the map is 8x8, which gives 64 unique screens. Half of those could be grasslands, a quarter desert, and swamp and snow get a quarter each:

It seems palette reduction has made snow the same color as swamp. Originally, there were eight snow screens in the bottom corner, and a slightly staggered eight-screen swamp area in the middle. Sorry 'bout that, and please ignore the location markers.

The best I could get was some snaking shapes, and often enough with nonsensical combinations like desert snaking through snow (or vice versa). I can't for the life of me figure out how to get it nice and blobby, let alone having it make climatical (?) sense. So how do I generate a biome map like in the mockup?

Okay, by request: the world really isn't much bigger than that example, and what I need is just a way to spread some blobs that determine thematic appearances, with the extra limitation that snow can't touch desert. Screens don't scroll, and if a screen is set to "desert", there'll be no grass anywhere on it.

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:
Vertices displaced when smoothing in Maya The issue below appears when smoothing in maya. I would prefer to solve the problem normally as opposed to import/export obj.

Below the image is a .ma file you can download yourself.

File: https://www.dropbox.com/s/nhtc1uj2lvakjwf/reload.ma?dl=0

Steps Taken To Isolate Problem

-Issue does not occur when doing a smooth mesh preview with the EXCEPTION of 1 face

-Deleted face. Error moves up another face.

-Continued to delete the face ring one face at a time and noticed the error moves up.

-Selected face ring, delete and rebridged. Fixed.

-Infered that the root cause of the problem has something to do with the way I created face ring or edge ring.

-The issue only occurs in this one mesh object.

-Deleted all items in the scene except the problem mesh and saved an isolated file.

-Deleted UVs.

-Deleted history.

-Optimized scene.

-Cleaned mesh with the following settings.

-Select matching polygons.

-Apply to selected objects, Keep Construction History.

-Lamina faces.

-Nonmanifold geometry, Normal and geometry.

-Merged all vertices with a tolerance of 0.01.

-Unlocked normals.

-Ensured normal directions were correct.

-Ensured there were no faces inside of edges.

-Issue ONLY occurs with 1 subdivision.

-Hardened all the edges.

-Exported and reimported OBJ. Again, I do not want the lazy solution, I want the correct one. I did this so I can infer that the root cause is not mesh-related.

-Combined with cube

-Deleted history (again)

-Optimized scene (again)

-Cleaned mesh (again)

Specs

Maya Version: Maya 2016.5 Ext 2 (64bit)

OS: Windows 10 Pro (Build: Latest)

Video Card: Nvidia GeForce 980 X (Driver: Latest)

CPU: Intel Core i7 3930K

Mirror Threads

http://polycount.com/discussion/198641/maya-2-vertices-displaced-when-smoothing/p1?new=1

sentences:
How can I change the camera to work from an Y up system to a Z up I am following the tutorial from learnopengl.com but it uses a Y-up system, but I would like to change it for a Z up system because I'm more used to it.

I tried changing the up vector to be 1.0 on the last coordinate but and inverting the pitch And the Yaw, but when having the camera face the positive y-axis the mouse movement breaks and starts to move slower and opposite to the way I move the mouse.

The Axis system I'm trying to achieve:

That is the same as the Blender one.

This is the function of the camera class which handles the Pitch and Yaw: (offset is the mouse movement on the x axis and y axis):

void Camera::updateCameraVectors()
{
    // Calculate the new Front vector
    glm::vec3 front;

    front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch));
    front.y = sin(glm::radians(Pitch));
    front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch));

    Front = glm::normalize(front);
    // Also re-calculate the Right and Up vector
    Right = glm::normalize(glm::cross(Front, WorldUp));  // Normalize the vectors, because their length gets closer to 0 the more you look up or down which results in slower movement.
    Up = glm::normalize(glm::cross(Right, Front));
}

Up is the vector that I initialized as (0.0f, 0.0f 1.0f)

Are there any resources available online that explain how to make the switch from a Y-up to Z-up system?

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:
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:
When I use rigidbody.move rotation, my player sinks I am trying to implement a simple movement on an object and when I use movePosition from rigid body, the player starts to sink:

How can I resolve this issue?
Below is my code.
void Update()
{
    Movement();
    MouseLook();
}

void MouseLook()
{
    //get X movement of mouse and save as float y
    //get Y movement of mouse and save as float x
    float _xMove = Input.GetAxis("Mouse Y") * mouseSensetivity * Time.deltaTime;
    float _yMove = Input.GetAxis("Mouse X") * mouseSensetivity * Time.deltaTime;

    //make vector of that movements
    Vector3 xLook = new Vector3(_xMove, 0f, 0f);
    Vector3 yLook = new Vector3(0f, _yMove, 0f);

    //apply Y vector to body and rotate it entirely
    _rigidBody.MoveRotation(_rigidBody.rotation * Quaternion.Euler(yLook));
    //apply X vector on camera to rotate it.
    _camera.transform.Rotate(-xLook);
}
void Movement()
{
    //Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    //_charController.Move(move * Time.deltaTime * WalkSpeed);

    //register x axis movement
    //register y axis movement
    float _xWalk = Input.GetAxisRaw("Horizontal");
    float _zWalk = Input.GetAxisRaw("Vertical");

    //Make vectors
    Vector3 _WalkSum = (transform.right * _xWalk + transform.forward * _zWalk).normalized;

    //feed this to Move position of rigid body
    if (_WalkSum != Vector3.zero)
    {
        //_rigidBody.velocity=transform.forward+_WalkSum;
        //_rigidBody.AddForce(_WalkSum*WalkSpeed);
        //_rigidBody.MovePosition(_WalkSum);
        _charController.Move(_WalkSum * WalkSpeed * Time.deltaTime);
    }
}

sentences:
libGDX application does not support 800x480 resolution I have an application written with libGDX that does not run with a resolution of 800x480, whereas on devices with other resolutions (e.g. 480x320) it works perfectly. It also works perfectly as a desktop application with a resolution of 800x480.

In onCreate() method I only have this code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        initialize(new BreakTheBall(), false);
}

So what do I have to do to have it work in a resolution of 800x480?
I have to ask this question because my samsung galaxy sx2 display only blank screen at the time of game execution but emulator work perfectly. I also want to said that all the given demo application by libGDX could not run on the same device resolution.

Also I like to mention the base class of my project which specify about stage, camera and viewport declaration

protected BreakTheBall game;
protected Stage stage;
protected World world;
protected OrthographicCamera camera;
protected Preferences preferences;
protected ArrayList<Obstacles> boxArrayList;
protected ArrayList<BlastBall> blastBallArrayList;

private static final int VIRTUAL_WIDTH = 480;
private static final int VIRTUAL_HEIGHT = 320;
private static final float ASPECT_RATIO = (float) VIRTUAL_WIDTH
        / (float) VIRTUAL_HEIGHT;
private Rectangle viewport;

// protected Box2DDebugRenderer renderer;

public AbstractScreen(BreakTheBall game) {
    this.game = game;

    Texture.setEnforcePotImages(false);
    stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(),
            false);

    Constant.setStageRatio(stage.width(), stage.height());

    world = new World(new Vector2(0.0f, 0.0f), false);
    // camera = new OrthographicCamera(Gdx.graphics.getWidth() / 10.0f,
    // Gdx.graphics.getHeight() / 10.0f);
    camera = new OrthographicCamera((float) VIRTUAL_WIDTH / 10.0f,
            (float) VIRTUAL_HEIGHT / 10.0f);

    // camera.position.scale(0.0f, 0.0f, 0.0f);

    // renderer = new Box2DDebugRenderer(true, false, false);
    Gdx.input.setInputProcessor(stage);

    preferences = new Preferences();
}

@Override
public void render(float deltaTime) {
    GL10 gl = Gdx.graphics.getGL10();

    camera.update();
    camera.apply(gl);

    gl.glClearColor(0f, 0f, 0f, 1f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glViewport(0, 0, (int) viewport.width, (int) viewport.height);

    world.step(1 / 60f, 3, 3);
    world.clearForces();

    stage.act(deltaTime);
    stage.setCamera(camera);
}

@Override
public void resize(int width, int height) {

    float aspectRatio = (float) width / (float) height;
    float scale = 1f;

    Vector2 crop = new Vector2(0f, 0f);

    if (aspectRatio > ASPECT_RATIO) {
        scale = (float) height / (float) VIRTUAL_HEIGHT;
        crop.x = (width - VIRTUAL_WIDTH * scale) / 2f;
    } else if (aspectRatio < ASPECT_RATIO) {
        scale = (float) width / (float) VIRTUAL_WIDTH;
        crop.y = (height - VIRTUAL_HEIGHT * scale) / 2f;
    } else {
        scale = (float) width / (float) VIRTUAL_WIDTH;
    }

    float w = (float) VIRTUAL_WIDTH * scale;
    float h = (float) VIRTUAL_HEIGHT * scale;

    viewport = new Rectangle(crop.x, crop.y, w, h);

}

I think above specified code provide more guidance to community members so please help me to come out of this problem.

sentences:
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:
Rotation matrix to look at point p Assume a left-handed coordinate system where x is right, y is up, and z is into the screen. You have a unit vector pointing up along the y-axis. What's the rotation matrix for pointing the unit vector along the y-axis to an arbitrary point p?
I was asked this question during a phone screen. The interviewer implied there's an easy way to get this rotation matrix by "dropping in" a few values. I'm reading a 3D math book hoping to find this easy way but no luck yet. The ways to get this matrix in the book all seem too long to recite over the phone during an interview.
I think I can see part of the solution. The rows of the matrix are the post-transformation basis vectors. So the middle row of the matrix is just the point p possibly normalized (since that's where the y-axis will be post-rotation).
Any help with this easy "drop in" way of getting the rotation matrix is much appreciated!
Edit: If it seems like the problem statement is missing information please call it out. I feel like I remember the interview clearly but I could have left something out (or the interviewer could have).

sentences:
Is it possible to gain performance by omitting vertex normals in the GPU pipe? I am working on a rendering problem where I want to render as many raw triangles to the screen as I can with either OpenGL or DirectX with the absolute fastest performance possible.

I wondered about omitting vertex normals completely and only transforming vertex positions during the vertex shader stage.

1)  Is this possible?

2)  Is it actually going to increase performance --or-- is the "bare metal" of the GPU designed in such a way that trying to omit normals won't gain any more throughput?

p.s.  Yes, I realize that omitting normals will leave you with the problem of how to shade the triangle during the shader stage, but I could at least render a solid color to the screen (no shading).  At this point, all I'm wondering about is how much data I can eliminate from the typical pipeline to increase the pipeline throughput to the absolute maximum.

sentences:
Score does not increment by 1 in Unity I have made a simple code where once the player moves through the collider that acts as a trigger then Unity adds a score. However, it increases by increments of 8 and I am not sure why.

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

public class Game : MonoBehaviour
{
    public int Score = 0;

    void Start()
    {

    }

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

    }

    private void OnTriggerEnter2D(Collider2D other)
    {

        AddScore();
    }

    void AddScore()
    {

        Score++;

    }
}

sentences:
What are the advantages of a sprite sheet over an image sequence/flash timeline? I've noticed sprite sheets are used more and more in Flash games and I don't fully understand what are the advantages over an image sequence/flash timeline - MovieClip.

I've read this related question:
2D graphics - why use spritesheets?
and that makes sense for hardware accelerated games, but that's not the case for
flash yet.

Any Flash Player specific insights ?

sentences:
Isometric Tilemap is blocking UI elements I'm using Unity 2019.4.6f1, and I'm working on Isometric Tilemaps.
The hierarchy is like this:

The VillageScreen is a Canvas, img-bg is an UI Image, the two Panels are UI Panels, and the Grid and two Tilemaps are the isometric tilemaps. The problem is, the Grid & Tilemap is blocking all other UI elements, and it seems to be always on top, no matter how I set the Z value.
The Grid setting is:

And the Panel setting is:

My question is: How do I put the UI elements ABOVE the Tilemap?
p.s. the UI button is clickable, it just cannot be displayed properly.
--
UPDATE: Added a mockup screen - Black circles are buttons, while Red texts are UI texts for displaying scores.

sentences:
How would you structure a weapon class such that it works for many types of weapons? How would you go around creating a reusable weapon class? I can't really wrap my head around creating a class, which will work for both melee and ranged weapons.

Example given, that you have a knife, an RPG, and you have an ordinary pistol. How would you go around creating a class all three can inherit from?

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:
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:
XNA matrix order problem I want a matrix that scales first and then rotates. I tried the code below, but it didn't work. zRotation, yRotation and xRotation are rotations that shouldn't be affected by the origin. allrot should be affected.  xScale, yScale and zScale are the scaling variables. The code below works except that it rotates and then scales.

Matrix worldMatrix = (
    Matrix.CreateRotationZ(MathHelper.ToRadians(zRotation)) *
    Matrix.CreateRotationX(MathHelper.ToRadians(xRotation)) *
    Matrix.CreateRotationY(MathHelper.ToRadians(yRotation))
) * (
    Matrix.CreateTranslation(origin) *
    Matrix.CreateRotationY(MathHelper.ToRadians(allrot)) *
    Matrix.CreateScale(xScale, yScale, zScale)
);

sentences:
Processing through multiple shaders (LWJGL/Java/OpenGL) Very simple question: Is it possible to process a vbo through different shaders? If so, how? What I want is sth like this:

reflectionShader.bind(); //starts shader
reflectionShader.load(some_values); //loads uniform vars into shader
process(vbo); //"renders" vbo using bound shader
reflectionShader.unbind(); //stops shader
refractionShader.bind();
refractionShader.load(some_other_values);
process(vbo);
refractionShader.unbind();
render(vbo); //output to screen

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:
DirectX: Render the black bars I'm still quite a beginner in the industry. I'm working on a game with some friends and I would like to add a cinematic between 2 levels like in the attached picture.

My question is how can I render the black bars in DirectX 9 or 11? Moreover, do I need to change the aspect ratio when I'm playing the cinematic?

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:
Limit rotation angle I am currently trying to rotate the weapons of a spaceship towards the mouse position, but in order to avoid the collision of projectiles with the ship I want to limit the angle the weapon can turn.

I've tried doing this:

    Vector3 mousePos = Input.mousePosition;
    float range = 100.0f;
    float rotStep = 0.1f;

    Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range);

    Vector3 targetDir = positionOnScreen - transform.position;
    Vector3 newDir = Vector3.RotateTowards(transform.forward, targetDir, rotStep * Time.deltaTime, 0.0f);

    Quaternion lookRot = Quaternion.LookRotation(newDir);

    float xAngle = lookRot.eulerAngles.x;
    if (xAngle > 10 && xAngle <= 180)
    {
        xAngle = 10;
    }
    else if (xAngle < 350 && xAngle > 180)
    {
        xAngle = 350;
    }

    float yAngle = lookRot.eulerAngles.y;
    if (yAngle > 10 && yAngle <= 180)
    {
        yAngle = 10;
    }
    else if (yAngle < 350 && yAngle > 180)
    {
        yAngle = 350;
    }

    float zAngle = lookRot.eulerAngles.z;
    if (zAngle > 10 && zAngle <= 180)
    {
        zAngle = 10;
    }
    else if (zAngle < 350 && zAngle > 180)
    {
        zAngle = 350;
    }

    lookRot.eulerAngles =new Vector3(xAngle, yAngle, zAngle);
    transform.rotation = lookRot;

The problem here is that I don't know how to limit the rotation angle since it's not the same depending on the ship rotation (for example if it's (0, 0 , 0) or (-90, -90, -90)). I've tried using transform.localRotation too, but still happens the same.
Do you how could I limit the rotation regardless of the ship rotation?

sentences:
RPG combat and gold/exp reward equations I have a game that I'm creating, but I'm running across issues in keeping the ratios between high and low level players similar in the battle and reward equations. Obviously a higher level player should receive less experience, but have the upper-hand in battle when fighting lower level players and monsters. Here is how I'm calculating things currently:

Battle starts If player.dex > enemy.dex Accuracy = ((player.dex - enemy.dex)/2)*20

If player.dex < enemy.dex Accuracy = ((enemy.dex*player.dex)-enemy.dex)/player.dex

Accuracy is a percentage tested against a roll of a 100 sided die.

If accuracy > roll Hit success

If accuracy < roll Hit fails

If hit success All of the attacker's damaging items (spiked helms and shields, weapons, etc.) are added together and applied as such: Damage = (player.str + item.damage)-(enemy.dex + enemy.armor)

If the player is fighting a monster, I have a base amount of gold and experience which is modified according to the player: Gold gained = (enemy.gold*rand(1,10))/player.level Exp gained = (enemy.exp*rand(1,3))/player.level

If the player is fighting another player, then there will have to be a different equation for the rewards, but I'm not sure how to go about creating that one.

As this is my first attempt at creating (though I'm an avid RPGer), I'm not sure if there is kind of an "industry standard" form of calculating these things or not. I'm also afraid that these equations won't hold up once the player reaches higher levels (say level 50+).

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:
Comparison between Cocos2d and Corona I'm having a really hard time deciding which way to go on this.  I'm about to start developing a game and I haven't been able to find many good comparisons between these approaches.  I don't have many requirements for the game yet, but here is what I do know.

needs to work on iPhone
I don't have much money ($400 for Unity for iPhone is probably too much. I can probably afford $99 for Corona.)
Graphics will be 2D
Physics support is not needed
Ability to use particles would be nice
Game Center support would be nice (Corona is planning to support it soon)
It would be nice to be able to support Android as well if it isn't much effort.

I have done my own research, so I know basic things about them.  I know Corona uses Lua and Cocos2D uses Objective C.  I know that Corona allows deployment to iPhone and Android, but how easy is it?

Cocos2D is free, but so many people talk about how easy it is to use Corona, but I don't like being restricted to features Corona supports or the price tag.  I feel so torn here.

sentences:
Make an object follow the mouse pointer with LÖVE2D I've been trying to make a picture follow the mouse pointer with LÖVE2D.

I want that the object follow the mouse, and not just be the mouse coordinates, I did that. So I toked the distance between the objects:

distance = dist(object.x, mouseX, object.y, mouseY)

the dist definition is the one from analytic geometry(Distance between two points in the Cartesian plan), well, now I don't know what to do, I tried a timer to update the object's coordinates but didn't work out.

if object.timer >= 2 then
    --object.x = mouseX
    --object.y = mouseY
    object.x = mouseX - distance
    object.y = mouseY - distance
    object.timer = 0
end

It didn't work out either :(. Well, I tried some other stuff, like whale.x - distance, but didn't worked out either, how can I make the object follow the mouse, like, if I let my mouse on (500, 300(Screen coordinates) the image would follow until it reaches the position desired which is the mouse position.

And yea, I really need to learn more math. >.>

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 can I convert .X files from text to binary form? Is there a tool for Linux (preferably a command-line tool) that can convert from the .x text format to the binary format? I wish to use this format with Irrlicht but the text format is loading very slowly (taking around 8 seconds to load one model), so I'm wondering if the binary format will be faster.

I have seen this question, but that seems to be asking more for pointers on learning the .x format, whereas I am specifically looking for a Linux tool.

sentences:
Rotating projectile in direction it is moving I am using a parabola curve to launch my arrows:

public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
    Func<float, float> f = x => -4 * height * x * x + 4 * height * x;

    var mid = Vector3.Lerp(start, end, t);

    return new Vector3(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t), mid.z);
}

I have a projectile that is a simple capsule scaled down to be long and thin like an arrow. I've tried every way to rotate it I could find online, but there is always something off. In order to follow the curve I need the direction between the last position and the new position, so I have been trying things like:

void ParabolaMovement() //Called in Update()
{
    parabolaAnim += Time.deltaTime;

    parabolaAnim = parabolaAnim % 5;

    Vector3 newPos = MathParabola.Parabola(start, target, 5f, parabolaAnim / 5);
    Vector3 dir = newPos - transform.position;
    transform.LookAt(dir);

    transform.position = newPos;
}

As for what is going wrong, it does not point AT the target, which I udnerstand it can't because nowhere do I specify target pos, which I should, but don't know where. I cannot simply tell it to lookat target, since I want it to lookat the direction it is currently going in the curve, but it also needs to face the target.

sentences:
Implementing a game in Unity without Unity Networking I have been programming in Unity for a while, and ever since I started I could not wrap my head around the Unity Networking system. I understand on a whole how it works, I even made a small project using it, but it has always seemed to me like I did not have much control over the system (e.g. managing the streams of data, the lack of documentation about more advanced topics). Therefore, I would like to try to implement a peer-to-peer game without Unity Multiplayer.
My current project has a lot to do with movement ( take for example a fighting game, a brawler), where there is real-action constantly being streamed. It is important that when something gets hit, killed, crashed into, the players get the update immediately. I know a few basic thing about socket programming and I am ready to learn even more. I imagine the system being based on byte arrays messages, that trigger specific actions on each player. For Remote Procedural Calls (RPCs), this looks like a good solution, but what about streaming the constant position of a player? How can I stream it fast and easy without overloading the network channel?

I would like to hear different approaches to this problem.

sentences:
Sound plays several times upon collision Upon collision, my sound effect plays several times. How can I fix this?

public Sprite charAlive, charDead;
public AudioClip popAudio;

void  OnCollisionEnter2D (Collision2D col ){

    if (col.gameObject.name == "dirtWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        AudioSource.PlayClipAtPoint(popAudio, transform.position);
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "gooWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "grassWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
}

IEnumerator Dead() {
//      AudioSource.PlayClipAtPoint(popAudio, transform.position); // PLAYS SEVERAL TIMES
//      AudioSource.mute(popAudio);
    yield return new WaitForSeconds(3/2);
            Application.LoadLevel ("untitled");
    // LOAD LEVEL RESETS EVERYTHING, MAKE LOAD CHAR INSTEAD?
}

sentences:
How to retarget animation from Generic to Humanoid? I am in a constant struggle to convert a character that is indeed a humanoid character but its rig has been assigned as a generic rig. I want it to be humanoid so I can easily retarget its animation and apply them to another character of my own.
The problem that I am facing is that the animations when I run from the Animation tab of Unity Editor Works just fine but when I try to play them from the Script. The animations doesn’t play at all.
I don’t know what could be the problem. I need help in this regard. I have explored google all around and I am in a need of serious help. If someone can I’ll be really very grateful.
Thanks

sentences:
Have a simple enemy detecting he touch a wall to make him stop/turn around I am doing a very simple scene with a cube sliding on the "ground". Once the cube reach a wall, he is blocked.

I want to detect the wall to make the cube go in the other direction. I used OnCollisionEnter but it is triggered at the scene start as my cube touch the ground.

I could make a difference between grounds and wall, but my game will make the whole scene rotate, and floor will become wall and wall floor.

I wanted to add "physics whatever object" to allow a left/right detection but i cannot add collider or rigidbody to my cube.

How can i have a cube knowing when he touch a wall without having a false positive with the ground ?

sentences:
Synchronized non-local CharacterController's velocity is stuck at the last movement in Unity3D I have CharacterControllers as players in my multiplayer scene, and they got NetworkTransforms attached, with

Sync Mode = Sync Character Controller.

When I stop running with my character, my character stops on the other players' screens as well.

I've got MonoBehaviours attached to them, where I control the character's animations based on characterController.velocity.

The problem is this:

The animations won't stop because characterController.velocity is the same as it was when I was running.

This only occurs on non-local characters, because the local player got Local Player Authority checked, so its controller isn't synced from the server but to the server.

Why and how could I fix this?
Thanks in advance!

sentences:
2D Physics: storing previous position vs storing velocity I saw a number of 2d game tutorials and books where previous position of an object was stored in state instead of velocity vector. Velocity is then calculated each frame as a difference between positions.

What are the advantages of that method?

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:
How to create a 3D network-like interactive model? link: Link to video. it's a small video only 1 min 40 sec
I have included a link to the video which shows what I am trying to achieve, I am a beginner and I don't have any idea to do it, also I am using this for something like showing the network I have to people and not for game development, If my question is not clear please comment I will try to clear the problem with my question

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 I get the position of a static body in Jbox2D? I'm trying to get the position of a static body in JBox2D, how do I do that?

sentences:
MMORPG game balancing I've seen a couple of examples of some game balancing techniques in books yet they are not comprehensive and not particularly aimed at MMORPGs but I'm looking for practical examples of game balancing techniques for MMORPGs. I am interested to know if anyone has documented the techniques used in popular games with proven success in this area. Ideally, any resource would cover most common types of stats and include layman mathematical models or techniques used to balance game mechanics found in advanced MMORPGs (I know it's a cliché, but WoW style)

Any help would be great!

sentences: In Unity, how do I make text/annotations appear when I mouse over GameObjects in playmode? How do I make text appear when I mouse over GameObjects in-game? What is the Unity jargon for this? I'm assuming it's 'annotations'.

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

sentences:
Texture errors in CubeMap I am trying to apply this texture as a cubemap. This is my result:

Clearly I am doing something with my texture coordinates, but I cannot for the life of me figure out what. I don't even see a pattern to the texture fragments. They just seem like a jumble of different faces. Can anyone shed some light on this?

Vertex shader:

#version 400
in  vec4 vPosition;
in  vec3 inTexCoord;

smooth out vec3 texCoord;

uniform mat4 projMatrix;

void main()
{
   texCoord = inTexCoord;
   gl_Position = projMatrix * vPosition;
}

My fragment shader:

#version 400
smooth in vec3 texCoord;

out vec4 fColor;

uniform samplerCube textures

void main()
{
           fColor = texture(textures,texCoord);
}

Vertices of cube:

point4 worldVerts[8] = {
    vec4(  15,  15,  15, 1 ),
    vec4( -15,  15,  15, 1 ),
    vec4( -15,  15, -15, 1 ),
    vec4(  15,  15, -15, 1 ),
    vec4( -15, -15,  15, 1 ),
    vec4(  15, -15,  15, 1 ),
    vec4(  15, -15, -15, 1 ),
    vec4( -15, -15, -15, 1 )
};

Cube rendering:

void
worldCube(point4* verts, int& Index, point4* points, vec3* texVerts)
{

    quadInv( verts[0], verts[1], verts[2], verts[3], 1, Index, points, texVerts);
    quadInv( verts[6], verts[3], verts[2], verts[7], 2, Index, points, texVerts);
    quadInv( verts[4], verts[5], verts[6], verts[7], 3, Index, points, texVerts);
    quadInv( verts[4], verts[1], verts[0], verts[5], 4, Index, points, texVerts);
    quadInv( verts[5], verts[0], verts[3], verts[6], 5, Index, points, texVerts);
    quadInv( verts[4], verts[7], verts[2], verts[1], 6, Index, points, texVerts);
}

Backface function (since this is the inside of the cube):

void quadInv( const point4& a, const point4& b, const point4& c, const point4& d ,
      int& Index, point4* points, vec3* texVerts)

{
    quad( a, d, c, b, Index, points, texVerts, a.to_3(), d.to_3(), c.to_3(), b.to_3());
}

And the quad drawing function:

void quad( const point4& a, const point4& b, const point4& c, const point4& d,
      int& Index, point4* points, vec3* texVerts, const vec3& tex_a, const vec3& tex_b, const vec3& tex_c, const vec3& tex_d)

{
    texVerts[Index] = tex_a.normalized(); points[Index] = a; Index++;
    texVerts[Index] = tex_b.normalized(); points[Index] = b; Index++;
    texVerts[Index] = tex_c.normalized(); points[Index] = c; Index++;
    texVerts[Index] = tex_a.normalized(); points[Index] = a; Index++;
    texVerts[Index] = tex_c.normalized(); points[Index] = c; Index++;
    texVerts[Index] = tex_d.normalized(); points[Index] = d; Index++;
}

Edit: I forgot to mention, in the image, the camera is pointed directly at the back face of the cube. You can kind of see the diagonals leading out of the corners, if you squint.

I tried writing the texture coordinates as colors as Nathan Reed suggested, and still got random values from the fragment shader, so I tried replacing all texture coordinates with (0,1,0) (so as colors, all faces should be green). Instead, I got this:

Old result with b and d vertices swapped in texture:

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:
Why does this variable keep returning to its original value? In my 2D platformer game, I'm trying to create a button that, when the player or a box is on top of it, opens a door of the same color. Here is the code for the button:
extends StaticBody2D

onready var is_object_on_button = false

func _on_Green_Button_Area_body_entered(body):
    is_object_on_button = true
    print("button is down")

func _on_Green_Button_Area_body_exited(body):
    is_object_on_button = false
    print("button is up")

Code for the door:
extends StaticBody2D

onready var is_object_on_button = Green_Button.is_object_on_button
onready var door_collision = $CollisionPolygon2D

func _process(delta):
    if is_object_on_button:
        door_collision.set_disabled(true)
        print("unlocked")
    else:
        door_collision.set_disabled(false)
        print("locked")

The button prints the right things at the right time, so I assume the button is working properly, but the door constantly stays (and prints) locked. How do I fix this?
Edit: After a bit of experimentation, I think that the problem is that is_object_on_button keeps returning to whatever value its assigned at the start: If I set it to true at the onready, it stays true. I do not know how to fix this, either.

sentences:
Apply Filters to WebGL Canvas Itself I am making a game in JavaScript and rendering it to a WebGL canvas.

To give the game some extra spice, I'd like to create filters (or perhaps they're called "Shaders?") to apply directly onto the game's WebGL canvas. More specifically, I'd like to be able to modify the game's brightness, hue, saturation, and give it a bulge effect.

I am totally new to WebGL and would love some guidance!

sentences: UnityEditor.SyncVS.SyncSolution putting wrong language version in generated files I'm working on getting our Unity projects building in bamboo for our build server. We have a cli step that runs through the Unity commands for creating a build. It works fine on several projects, but for some reason this particular project I'm working on I'm getting an error that states I need to use c# version 7.2 or newer. If I log in to the build server and open the .csproj files in notepad and check the language version, it's setting them to 7.0. However, if I deactivate the cli step so that the build job only clones the project, then manually log in and open unity and go through the process so it generates the .csproj files, then check them, the language version is set to 8.0. The project works fine locally on my own pc. And it works when setup manually on the build server pc, but when ran through the cli step, it generates them at an earlier c# version. This leads me to believe there is a problem with the UnityEditor.SyncVS.SyncSolution step in my commands. I'm just not sure what it could be, or why it's behaving differently for this project as opposed to other projects that are using the same code base (where the problem is said to occur), same Unity version, same build server, etc. Anyone else experience this issue or have any thoughts on a solution?

sentences:
Difference in glDrawArrays and glDrawElements While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements.

I understand how they are used and sort of understand why they are different.

What I do not seem to understand is that, I fail to see how glDrawElements can save draw calls (saving draw calls is a description that is mentioned by most of the books I have read, hence my mentioning of it here).

Imagine a simple scenario in which I tried to draw a square using 2 triangles.

I would need to have a set of 6 vertices using glDrawArrays while using glDrawElements, I would need only 4 in addition to an index array that has 6 elements.

Given the above, here is what I do not understand:

how could glDrawElements save draw calls, if it still needs to use the index array (6 indices, in case of a square) to index into my vertex array that had 4 elements (6 times)? Other words, does it mean glDrawElements would still need to have a total of 6 draw calls just like glDrawArrays?
how would using glDrawElements save space, if one would still need to have 2 arrays, namely, one for the vertices and one for the indices?
In the case of drawing a square from 2 triangles, for simplicity, how many draw calls does glDrawElements (4 items in vertex array and 6 items in index array) and glDrawArrays (6 items only in vertex array) need, individually?

Thanks.

sentences:
How does lookAt matrix math work? Can someone provide me an explanation of how the lookAt matrix works?

+----+----+----+----+
| Xx | Xy | Xz |  0 |  <- x axis
+----+----+----+----+
| Yx | Yy | Yz |  0 |  <- y axis
+----+----+----+----+
| Zx | Zy | Zz |  0 |  <- z axis
+----+----+----+----+
| Tx | Ty | Tz |  1 |  <- camera position
+----+----+----+----+

From my current understanding using the diagram above from this tutorial, the zAxis is created by subtracting camera position from the target position. Then you create two more perpendicular vectors calculated by: xAxis = zAxis x up, yAxis = xAxis x zAxis.

However, I don't understand how these exact operations result in the camera facing towards something? Like why are these exact calculations needed? Why could it not have been zAxis = camPosition - targetPosition? Or yAxis = zAxis x down instead of zAxis x up? Or have xAxis = targetPosition - camPosition instead of the zAxis?

sentences:
Blender models appear in UDK asset manager, but not in game I am new to UDK and blender. I am using UDK3.

I have tried the following so far:

Making the mesh origin, (0,0,0)
Making the parent bone origin (0,0,0)
Parenting the root bone with the mesh

I have tried exporting in the following file formats:

*.psk
*.fbx

Both fbx and psk import into the UDK asset manager, and are viewable in the asset manager. I have also previewed my weapon Im importing against a chracter model, and it appears to be slightly too large (which is easy to fix). Many other forums mentioned for other people that the models might be displaying but be very very small.

I have tried viewing in:

3rd person
1st person (Weapon factory, and giving weapon via console command)

I have made the blender file avaliable here: http://www.fileswap.com/dl/m1BiH78Gba/

The code is just standard wizard generated code and has worked previously for other weapon models.

Any ideas or clues about how I can go about trouble shooting this would be greatly appreciated.

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:
Creating a Model out of Math primitives Here is a litte sample that I drew in Blender to visualize what I am planing to create:

Cone with spheres sample

I already have the code to generate the cone and the spheres as mentioned in my former Post Combine 3D objects in XNA 4.

I thought that it would be nicer to generate a model and add these models to the sceen graph. My problem for now is that I wasn't able to generate a model out of my primitivas. I was planning to create one Mesh for the cone and one for each sphere that I want to attach to the cone and arrange all this in a Model, but there are no constructors for a Model or a Mesh.

So the question is: Is there a way to generate a model out of my primitives?

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

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

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

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

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

sentences:
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:
Correct architecture for weapon class in RPG So, I'm a little stuck on what the best way to implement weapons is. The problem I'm running into is, what exactly is a weapon.

I have a Player Class that has an attack method.

public class Character
{
    public int MaxDamage;

    public bool IsAlive = true;

    public Character Attack(Character target)
    {
        Random attackRange = new Random();
        int damageValue = attackRange.Next(0, MaxDamage);

        target.TakeDamage(damageValue);

        Random critCheck = new Random();
        int critCheckValue = critCheck.Next(0, 100);
        //hitChance = dex - target.dex;

         if (critCheckValue <= CritChance)
         {
          //dmg min = dmg min + (dmg min*crit damage);
          MaxDamage = MaxDamage + (MaxDamage * CritDamage);
         }
     }
}

So this works. But once I implement a weapon, it gets a little confusing.

Does the player still have the attack method and the weapon just modifies the values?
Does the weapon really have the attack method and the player just calls it?
How would you handle something like a power swing that may hit 3 characters?
Does the weapon contain the range or the player?

sentences:
What is a good strategy to recruit test players for a chess app? We developed a chess app for iMessage and we would like to have people try it out and tell us their opinions.

Do you know a good strategy to give away free promo codes for the pro version of our new game?

sentences:
Board-Games Design: Physical vs Digital? Is there any difference when learning the designing of a physical board-game and digital board game, meaning if I watch a tutorial about a physical board-game design is it applicable on a digital one?

Note: I'm focusing only on design process, not the art-design, only on the gameplay-design (rules, levels, obstacles, etc).

sentences:
Saving game data to server What's the best method to save the player's data to the server?

Method to store the game saves
Which one of the following method should I use ?

Using a database structure(e.g.. mySQL) to store the game data as blobs?
Using the server hard disk to store the saved game data as binary data files?

Method to send saved game data to server
What method should I use ?

socketIO
web socket
a web-based scripting language to receive the game data as binary?
for example, a php script to handle binary data and save it to file

Meta-data
I read that some games store saved game meta-data in database structures.
What kind of meta data is useful to store?

Edit-1
This question was to actually see what technology is better to use based on the situation.
The situation is a game that will be on cross-platform, save game throughout the cloud.

Method of delivery from game client(iOS, Android, Windows Phone 8, etc..) to game server(Linux, Windows, etc.)
Im using a Ubuntu server at this moment.

Method of storage of binary data
Inside a database system or file system.
The up and down side to it and the community options of existing structures.

Storing of meta-data
Well, I'm not too sure about how to store saved game data to server at the moment.
Thus, was wondering if the community can provides tried and tested methods used by the community. and their preferences.

sentences:
Most common resolution used in Android phones as of 2013 Before making an Android app, I want to know what screen resolutions I should target. I know there are resolutions of 1280x800, 1280x720 and 800x480, but I would like to know which are most common.

Are there any recent stats on the distribution of Android devices' screen resolutions?

sentences:
Bouncing ball isssue I am currently working on the 2D Bouncing ball physics that bounces the ball up and down. The physics behaviour works fine but at the end the velocity keep +3 then 0 non-stop even the ball has stopped bouncing. How should I modify the code to fix this issue?

Here is the video shows how it works.
Note: Bandicam cannot record the velocity transition between -3 and 0. So, it just shows -3 when the ball stops bouncing.
http://www.youtube.com/watch?v=SEH5V6FBbYA&feature=youtu.be

Here is the generated report: https://www.dropbox.com/s/4dkt0sgmrgw8pqi/report.txt

    ballPos         = D3DXVECTOR2( 50, 100 );
    velocity        = 0;
    acceleration    = 3.0f;

void GameClass::Update()
{
    // v = u + at
    velocity += acceleration;

    // update ball position
    ballPos.y += velocity;

    // If the ball touches the ground
    if ( ballPos.y >= 590 )
    {
        // Bounce the ball
        ballPos.y = 590;
        velocity *= -1;
    }

    // Graphics Rendering
    m_Graphics.BeginFrame();
    ComposeFrame();
    m_Graphics.EndFrame();
}

sentences:
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:
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:
Mathf.Hermite not available in Mathf I see here that Hermite should be function in the class Mathf.

However, when I try to use it, the compiler tells me that Mathf doesn't contain a definition for Hermite.

This is an example:

    float fNewDistance = Mathf.Hermite(_initialDistance, _GoalDistance, fTime);

What am I doing wrong here?

Thank you!

sentences:
How does one write a wrapper for a game server? From what I gathered, wrappers mimic the game server in question, receiving packets from client and sending them to the server (and vice versa). It acts like a bridge between the client and server, allowing data to flow and modifying/reading it as it travels through it.

Am I right in how wrappers work? What is the general gist of them? How would one go about writing one?

I plan to write one for Starbound in Java, using https://github.com/StarryPy/StarryPy as a reference to the packets.

sentences:
Game Opens then Stops Responding Python Sorry for the bad title, if you think of a better one please tell me.

So I was asked to make a button that says a line from a video game. I attempted to have the while loop add 1 to a variable every time it looped through, then display the variable in the caption of the window. I did this so that I could see if it was looping, and really, what was going on. It showed a rapidly increasing number, then froze the computer (I had to restart the computer). I tried putting a short wait in the loop, still would not respond. I am also having this exact same problem in a much longer and more complex program that I'm working on, so if I figure it out, it will solve both issues. Don't just give me code, please tell me why I need to use it or what it does. Here's the program:

from pygame import *
import pygame
pygame.init()

pygame.display.set_caption('Potato')
screen = pygame.display.set_mode((224, 224))
button = pygame.image.load("C:/Python34/redbutton.jpg")
screen.blit(button,(0,0))
pygame.display.flip()

potato = pygame.mixer.Sound("C:/Python34/potato.wav")

test = 0
pressed = False

while pressed == False:
    if pygame.mouse.get_pressed()[1]:
        pressed = True

    if pygame.mouse.get_pressed()[0]:
        potato.play()

sys.exit()

sentences:
Game Design: Faction/Player circular relationship For a Java game, say I have two classes:

Player, representing a player in the game.
Faction, representing a faction of players in the game.

When the game starts up, all factions are loaded into some collection and all players are loaded into some collection.

Collection<Player> players;
Collection<Faction> factions;

Say there are two variables:

Player player1;
Faction the_destroyers;

player1 is in the faction the_destroyers.

the_destroyers needs to reference player1, since player1 is in the_destroyers. At the same time, player1 needs to reference the_destroyers, for quick lookup (otherwise I would have to iterate through the collection of factions, which may be a very large collection).

Obviously, whichever variable is loaded first cannot reference the other, since the other has not yet been loaded.

Generally speaking, how do I get around this issue? Is there a simpler solution?

sentences:
Unity3D - different object with the same mesh imported from Blender I would like to instantiate different objects (i.e. poker chips with different values) that actually share the same mesh imported from blender. To this end I have copied the assets and changed the texture but all the assets automatically switch to the last texture I choose as they are actually the same entity.
What am i doing wrong?

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:
Add picture in the Hierarchy view in Unity How can I add a picture in the Hierarchy view in Unity? For example, Dragon bones does it automatically. Here it is :

As you can see there is a picture on the right of the gameObject name.

sentences:
2D Rope Collision Detection I'm wanting to create a rope that can collide with objects like in the following youtube video:

2D Game Physics Rope

I'm thinking that you implement the verlet integration which uses points and connects these points with lines. I'm trying to figure out what type of collision detection you would apply to the rope to get the effect in the video.

I'm thinking you would have to do some cd to each point. I would like to use box2D, so I'm wondering would making each point a rigid body work? Any advice would be appreciated.

sentences:
Can't drag image onto scene First time trying Unity and I'm having trouble with importing assets.

border_horizontal.png is fine, but I can't drag border_vertical.png onto my scene. It also doesn't have an arrow next to it in the asset menu. What is going on here?

sentences:
How can I create a smooth simulation for a fast-paced, multiplayer table hockey game? I'm adding multiplayer to an iPhone game that we have in our company. It's a sort of 'table hockey' game, with a puck and two mallets.

It's a pretty fast game, so I need a smooth experience at both ends. What I'm doing right now is using Game Center, and setting up the iPhone that starts the game as the "server."

So, the client runs its physics the same as the server, but the server adjusts the speed of the puck on the client and adjust its position when they are going on the same direction. The problem that it has some glitches, when the physics simulations differs a bit between then and the server sends the command to correct and the client kind of jumps around.

Does anyone has a suggestion how should I can handle this? Or should I try a different way?

sentences:
Persist emitted particles in scene after particle system has ended/destroyed? In Unity, is is possible to persist emitted particles in a scene after the system has ended or even possibly destroyed?

I have a particle system attached to my player prefabs that does a rudimentary blood splatter, and I'd like for the emitted "blood" particles to stay in the scene for as long as the scene is active, even after the player prefab that originally emitted the particles is destroyed.

sentences:
unity graphics initialization Pretty short question, when I load unity, I get this error:

Is this fixable with driver downloads, or do I need a new PC?*
*if so, how do I find out my computer's default built-in graphics driver?

sentences:
An Object is moving but its velocity is 0 In Unity 5 I have an object move when I press a button, force is added as seen by the code below. Then once this force is added I print out its velocity. The problem is that in the console my first print out with the first button press is "velocity(0.0,0.0)" then the second button press gives the printout "velocity(2.0,0.0)". Why is it that i get a velocity of 0 on the first button press even though my object is moving on the screen?

if (isPressed == true) {
            moveableBarrel.GetComponent<Rigidbody2D> ().AddForce (new Vector2 (100, 0));

            Debug.Log ("velocity" + moveableBarrel.GetComponent<Rigidbody2D> ().velocity);

            isPressed = false;
        }

Edit **Incase anyone else asks, the code is within a FixedUpdate Method

sentences:
A collider defined as intersection of two colliders I'm working in unity and I have the following problem :
Suppose you have an object that's very similar to say the intersection of say the corner of a cube and a ball, and you want a nice collider for this object.

First option is to simply use the mesh collider option - but this is apparently not  very efficient, and if for example the sphere is very smooth, there might be a lot of polygons and that could be a problem.

Second, you could just fill the object with various simple colliders.

However, both of the above options seem unnecessarily complicated - it would seem natural to me to somehow work with both colliders - the sphere collider and the cube collider. To determine if the object is touching something, the requirement is that both the cube and sphere collider are touching something, not just one of them.

I don't know how the actual collision checks work, but I would expect that say in the second option I wrote above (placing a few small colliders inside the object), a collision check sees if any of the colliders is touching a collider of some other object - so there is an option for "union" type of collision check (see if any of the colliders are touching something). Similarly, I would expect there would be an option of checking whether both the colliders are touching something, but I'm not aware of it.

Either way, I would appreciate ideas on how to implement a good collider for this problem, and whether there's a way to implement it by the way I described, using the "intersection" of two colliders.

sentences:
Best client/server architecture for a mobile management game? For the past year I have worked on a small company that develops a traditional browser based strategy game, of the likes of Travian or Ogame, but using a more interactive approach like Tribal Wars 2.

The game is made in a simple php server without frameworks and a simple mysql database, and all of the game happens in a single static page that is changed through ajax calls and has a map made in pixi.js. The automatic updates are delivered to the client side through polling the server which then queries some specific database tables made for the purpose for changes.

While this approach is solid and works, it has 2 big problems:

Having a mobile app is increasingly more important and there are not enough resources for having two separate codebases. Having a app which is simply a wrapped webview is also not a solution because the performance of a really complex page with a giant webgl map is, while usable, really subpar;
Polling the server for changes creates a lot of programing challanges that make some simple tasks really complicated and creates a lot of convoluted code if we dont want to hurt the game performance, as we are not going make dozens of database queries every 5 seconds.

I want to start developing a game idea that I have that is basically inserted in the same genre and which is going to be, at least initially, mobile only. The real problem here is that after reading a lot on the internet, I am confused on what should be a good client/server architecture for me to start prototyping in a way that I do not run in the problems mentioned above.

Basically, above all, I want the server to be able to know which page/screen/state is each client looking at, and be able to send them messages when another client changes something on that specific screen. It would also be nice if the solution is something lightweight on the server side to be able to scale a little.

Client side I was thinking about Unity because of being cross platform, of all the environment around it (ads, analytics, a lot of support and answers on the internet), and because I have previous development experience with it.

Server side is the real question.

Simple http calls will not work and so PHP is out of the equation.
I have though about using node.js with socket.io to use websockets solving the polling problem. Is this a good idea? Would it be better to store the game state in a relational or nosql database in this case? Would this work on unstable mobile conections?
Lots of people seem to use a c# and sockets for unity. Would this be overkill in this situation? Taking this approach how would the data be stored? would it be feasible with a linux server or would I need a windows server? Would this work on unstable mobile conections?
Don't know, I'm open to suggestions.

tl:dr: I want to make a mobile management game in unity but am confused what to choose for the server side architecture considering that I want the server to be ablose to send a message to the client without the client asking for it. Is there anything I should take in account?

Sorry for the broad question and thanks for the help.

sentences:
HTML5 Canvas Depth Sorting I'm have problem with Isometric. I'm don't know how to name this "problem", but I'm show you some sceen what I get and what I'm need to get.

My code now drawing something like: http://2.bp.blogspot.com/_rqhF_8E1nlA/R59d_PmoREI/AAAAAAAAAGo/3yHpmy55moc/s400/lore2.png

But I'm need draw something like this:
http://3.bp.blogspot.com/_rqhF_8E1nlA/R59epfmoRFI/AAAAAAAAAGw/cE_o-A0bvm0/s400/lore3.png

I'm hear this is "Depth sort" But what it is? how I'm can apply to my code and where I'm can learn this?

My code: 'http://jsdo.it/keichioor/exU1

sentences:
Array with multiple linked objects in Unity This might be too primitive, but for my use case, I need to maintain an array in which two attributes are linked to each other... For example - If I want to do Score gathering... Then I need an array which has scores and corresponding player names as each element.

So, when I do Array.Sort(PlayerScorearray) I even need the playername to be sorted in the order so that if I want to know the player with lowest score, I just go for the first element and then go to the corresponding player name.. Is it possible to do it in a simpler way? My mind can't think of a simple way to do this.

Edit : I am using C# for scripts

sentences:
Turn based Android game using google play games services I want to develop a turn-based,multiplayer android game.Its very similar to chess.Is it possible to make entire game just by using google play games services(GPGS) ? ie, creating a game between 2 players,managing player moves,changing game states in database, all this can be done using GPGS?
Also,is google-app-engine anyhow related to this ?

sentences:
Sprite framework binding multiple textures In an attempt to batch render as many quads (sprites) as possible, I'm instance rendering a single unit-sized quad and passing in a buffer of per-instance data that includes width/height, texture coordinates, color, texture Id, etc.

Offline, I have a tool that constructs texture atlases based on any particular sprite animation, so the output is flexible in terms of texture atlas width/height, which sprites reference which texture atlas, and so on.

The end result is that I may have many texture atlases, and sprites which reference any one of those atlases for their current frame.

I need a robust solution that'll allow me to draw these sprites in any order while reducing texture binding as much as possible. After some research there are two options:

combine multiple 2D textures into a 2D array texture (up to GL_MAX_ARRAY_TEXTURE_LAYERS_EXT)
bind multiple textures in array of samplers (up to MAX_TEXTURE_IMAGE_UNITS)

The first solution I believe requires all textures to be the same height/width.
The second solution seems to have a limitation that requires a constant index to access the array of samplers in the fragment shader.

I think I want to go with the second solution, but I'm worried I won't be able to properly write a fragment shader if I have to use a constant index, as I'd be getting the index via per-instance data input.

Are my above suspicions correct? Is there a known work-a-round for the second solution? Or is there a better way to do this than what I presented.

sentences:
C++ entity component system framework I have found several entity system frameworks for other languages besides C++, like Ash and Rush for ActionScript and Artemis for Java and C#.

My question is whether there exists a framework like one of the ones mentioned above for C++?

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:
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:
A* Start path finding in HTML5 Canvas I'm trying implement A* Start path finding in my games(which are written with JavaScript, HTML5 Canvas). Library for A* Start found this - http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html and now I'm using this library for path finding. And with this library, I'm trying write a simple test, but stuck with one problem. I'm now done when in HTML5 canvas screen click with mouse show path until my mouse.x and mouse.y. Here is a screenshot:

(Pink square: Player, Orange squares: path until my mouse.x/mouse.y)

Code how I'm drawing the orange squares until my mouse.x/mouse.y is: http://pastebin.com/bfq74ybc (Sorry I do not understand how upload code in my post)

My problem is I do not understand how to move my player until path goal. I've tried: 'http://pastebin.com/nVW3mhUM

But with this code my player is not beung drawn.(When I run the code, player.x and player.y are equals to 0 and when I click with the mouse I get the path player blink and disappear)

Maybe anyone know how to solve this problem?

And I'm very very very sorry for my bad English language. :)

sentences:
Unity - How can I make my player's gun point at the cursor, not the player itself? I'm making a 2D top-down shooter in unity. Currently, I'm using the code below to point my player towards my cursor at all times, this works but isn't exactly what I want.

//Find the mouse position on the camera view
Vector3 mousePoint = theCamera.ScreenToWorldPoint(Input.mousePosition);

//Find how the mouse relates to the object's position
Vector3 difference = mousePoint - transform.position;
difference.Normalize();

//Find wanted angle of rotation
float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
Quaternion newRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, rotZ + adjustmentAngle));

//Apply wanted angle of rotation
transform.rotation = Quaternion.Lerp(transform.rotation, newRotation, Time.deltaTime * smoothing);

While this works, my player's gun isn't in the centre of my player so when the gun fires it actually skims past the cursor missing slightly.

How can I get my player to rotate so his gun is what points towards the cursor rather than himself? I have a child GameObject at the end of the barrel of his gun used to Raycast and stuff which I figure can be used?

sentences: Way to prevent jumping pieces I have a chess game and I have all the movement for the pieces coded but all of the pieces, not just the knight, can move over the top of the other pieces. What would be the least intrusive way to prevent this in Game Maker DnD (Drop and Drag)?

sentences:
How do I implement following behavior with a state-based AI? I'm making a 2D game with two spaceships flying around shooting each other. One spaceship is controlled by the user, the by an AI. I want to use a simple Finite State Machine (FSM) for the AI.

I'm trying to make the AI ship follow the player's ship and stop at a given radius from it.

I've got a GetInsidePlayersRadius state, and a StopMoving state. But so far I got a weird bug involving the AI ship moving a few pixels, then stopping for a moment, than moving again, creating very fragmented movement.

The AI can move up, down, left, right, up-left, up-right, down-left, or down-right, just like the player.

What could create this fragmented movement behavior, generally when an AI agent is constantly trying to get inside a certain radius from an object, and stop when it's inside it?

How would you implement a following behavior of an AI as part of a Finite State Machine?

sentences:
Is there any way to get PVRTexTool's version from the command line? I am to make an automated task which involves requiring the version of the PVRTexTool that comes with the Unity installed in a machine.

Is it possible to get the version of PVRTexTool on the command shell?

sentences:
How to store the state of the world for a fixed time step? Most of the posts on fixed time steps say something like this:

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;   // note: max frame time to avoid spiral of death
     currentTime = newTime;

     accumulator += frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );

How do they calculate and save a State snapshot of the whole world?  do they just make memcpy's or something?  I'm working in Flash and don't have that kind of cloning capability.

sentences:
Unity UI Button not working on PC build but working on Android mobile build I am using Unity to build a game that is going to be used on PC and Android mobile devices. The problem I have is that when I use a UI Button, it works perfectly on mobile, but on PC and in the editor, is not working.

Why could this be happening?

sentences:
How do I make my camera follow my cube? I've recently started to learn some C# scripting in Unity. I've been able to make my PlayerCube move around using Vector3 Transform.translations, but I want my camera to follow my cube while moving around, and it's not working since Unity can't find PlayerCube. How do I make make it so it understands that there's a PlayerCube?

using UnityEngine;
using System.Collections;

public class CameraScript : MonoBehaviour {
    Player = GameObject.Find("PlayerCube");

    // Use this for initialization
    void Start ()
    {
    //  GameObject.Find(PlayerCube);
    }

    // Update is called once per frame
    void Update ()
    {
        Transform.LookAt (PlayerCube);
    }
}

sentences:
Draw user interface in OpenGL using web technologies I am developing a desktop game in C++ and OpenGL. Frameworks I use are GLM and SFML. Since today I used the console window for debug messages. But I want to get rid of that and display debug information right into the render window.

Since I also want to implement a generic way to realize user interface, I decided to use web technologies for that. Note that the user interface will be only a two dimensional overlay on the rendered three dimensional scene. I consider using the webkit browser engine but that might be overkill since I do not need page loading and networking but only HTML and CSS rendering (and maybe JS execution). Because the user interface and debug messages will change every few frames, this is performance related.

How to render fullscreen webpages (with a transparent background) over my OpenGL scene? I would like a cross-platform solution.

sentences:
How can I expose a property to Unity that should be treated like an asset path? I want to be able to do something like this:

public FileInfo XmlBehaviourFile;

And then use the asset browser in the Unity editor to select an asset. Ideally, I would like to limit it to XML files but that isn't too important.

I am aware of TextAsset but I can only access either a string or byte array of the contents. I can probably make this work, but at the moment, my library takes a FileInfo and handles the reading itself.

Is there a Type I can use that will make Unity let me choose a file in the editor and then simply store the path (ideally, it would handle making sure the path is relative and including the asset in the build).

Alternatively, would it be possible to write such a type that would work, I've not extended Unity, but I am aware it is possible.

sentences:
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:
How can I send effects to joystick connected to my PC USB using C# and sharpdx? I can get a list of the joysticks connected to my PC.
But now I want to send effects for example to send a command that will make a button click for example the triangle button or the square button.

But I'm not sure how to continue with the effects and how to send the commands to the buttons.

I'm stuck in the HandleJoystick method.

namespace Ps4_Controller
{
    public partial class Form1 : Form
    {
        DirectInput input = new DirectInput();
        Joystick stick;

        public Form1()
        {
            InitializeComponent();

            stick = ListJoysticks()[0];
        }

        private Joystick[] ListJoysticks()
        {
            List<Joystick> sticks = new List<Joystick>();

            foreach (DeviceInstance device in input.GetDevices(DeviceClass.GameControl, DeviceEnumerationFlags.AttachedOnly))
            {
                Joystick stick = new Joystick(input, device.InstanceGuid);
                stick.Acquire();

                foreach (DeviceObjectInstance deviceObject in stick.GetObjects(DeviceObjectTypeFlags.Axis))
                {
                    stick.GetObjectPropertiesById(deviceObject.ObjectId).Range = new InputRange(-100, 100);
                }
                sticks.Add(stick);
            }
            return sticks.ToArray();
        }

        private void HandleJoystick()
        {
            Joystick stick = ListJoysticks()[0];
            int[] axis = new int[0];

            foreach (DeviceObjectInstance doi in stick.GetObjects())
            {
                axis = new int[axis.Length + 1];
                axis[axis.Length - 1] = doi.Offset;
            }

            EffectParameters ep = new EffectParameters();
            DeviceInstance stick1 = new DeviceInstance();

            Effect effect = new Effect(stick.);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
}

sentences:
How can I modify PlayStation 1 games? Is it possible to modify Sony PlayStation 1 games?

For example I'm planning to modify a soccer game called Winning Eleven 3. What I'm exactly trying to modify is player properties such as speed, shot power and so on.

sentences:
Collision detection of player larger than clipping tile I want to know how to check for collisions efficiently in case where the player's box is larger than a map tile.

On the left is my usual case where I make 8 checks against every surrounding tile, but with the right one it would be much more inefficient.

(picture of two cases: on the left is the simple case, on the right is the one I need help with)

How should I handle the right case?

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:
How do you do AI path following within a 2d physics engine like farseer/box2d? I'm in the process of moving a 2d top down game I've been working on into a proper rigid body physics engine like Farseer. Up until now, I had just hacked together my own physics code where needed.

I'm trying to learn the proper way of doing things here.

What is the proper way to make your AI follow a set path once you have made them rigid bodies inside of the physics engine?

If I have a path of navigation nodes on my map that I need the AI to follow, previously I would just move them along the path manually by calculating the next position they should be at for the next time step and manually setting them to that position.

But now they are rigid bodies and subject to collisions and any forces that may hit them and knock them off path.

So to make the AI move I believe I should now be applying impulses/forces to them? I should no longer be manually setting their position each frame.

So I think I need to go from a deterministic world where I force the AI to strictly follow a path to a non-deterministic world where they could get knocked about in any direction if hit and I simply nudge them towards the next node in the path to make them move.

Is that right? Is that how other people do it?

This raises some questions about how to then avoid your AI getting stuck on corners of scenery now that they aren't walking a precise path, how do you guys handle that type of thing?

Or is it better to somehow mix the two and still have your AI follow a fixed path by setting their position manually, and only react to other forces under certain circumstances you can easily control?

Thanks for any advice guys.

sentences:
Textures on grass not showing on android I'm using assets from InfinityBladeGrassLands, and used SM_Plains_Grass01 for some foliage on my landscape.
In editor, the foliage looks like this:

But when building for andoroid, this is what shows up:

What's the problem here?
Edit: I manually added an instance of the grass to the viewport, and that one is showing fine in android, but still the rest added using Foliage tool are not.

sentences:
Pygame 2D Vector Math Mouse Input The following code is supposed to move a player sprite (in this case it's an 8x8 red square) to the coordinates of where the mouse is clicked. I'm able to move the square in the general direction of the click but the sprites path does not always pass precisely through the point. I'd love someone to analyse the code and show me where I'm going wrong with this.

from __future__ import division
import math
import pygame

SCREEN = pygame.display.set_mode([700, 700])
SCREEN_HEIGHT = pygame.display.Info().current_h
SCREEN_WIDTH = pygame.display.Info().current_w
pygame.display.set_caption('Window Caption')
clock = pygame.time.Clock()

class Player(pygame.sprite.Sprite):
    def __init__(self, color=(255,0,0), dims=[8,8], (originx, originy)=(100,100)):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface(dims)
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.rect.centerx = originx
        self.rect.centery = originy
        self.speed = 10
        self.vx = 0
        self.vy = 0

    def normalize(self, (p1x, p1y), (p2x, p2y)):
        dx = p2x - p1x
        dy = p2y - p1y
        vlength = math.hypot(dx, dy)
        vnorm = (dx / vlength, dy / vlength)
        self.vx = vnorm[0]
        self.vy = vnorm[1]

    def update(self):
        self.rect.centerx += (self.vx * self.speed)
        self.rect.centery += (self.vy * self.speed)
        print self.rect.centerx, self.rect.centery, self.vx, self.vy # verify calculations

pygame.init()

sprites = pygame.sprite.Group()
player = Player()
sprites.add(player)

looping = True
while looping:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            print "Exiting..."
            looping = False
        if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    print "Exiting..."
                    looping = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            (left_click, middle_click, right_click) = pygame.mouse.get_pressed()
            mouse_pos = pygame.mouse.get_pos()
            if left_click:
                print "left click", (player.rect.centerx, player.rect.centery), mouse_pos
                player.normalize((player.rect.centerx, player.rect.centery), mouse_pos)
            if middle_click:
                print "middle click", mouse_pos
            if right_click:
                print "right click", mouse_pos

    SCREEN.fill((0,0,0))
    sprites.update()
    sprites.draw(SCREEN)

    # Redraw everything we've asked pygame to draw
    pygame.display.flip()

    # Set frames per second to 60
    clock.tick(60)

# Quit gracefully if we exit the main loop
pygame.quit()

sentences:
how to ignore physics collision of some objects in box2d I know this sounds silly but I would like some objects to follow physics while others not to collide each other.

I tried to achieve them by setting their position exclusively. But then it will ignore all physics.

Is what I am trying to do even possible?

sentences:
How do I design my classes so that my Player.cs code can use class-specific abilities from another script? Right now, I have a Player.cs class that handles button pushes, movement speed, damage, Update() etc. At the moment, all of the logic for button presses triggering an ability, and the logic surrounding that ability lives in my player.class. I'd like to take that logic and put it into an Abilities.cs class. All I want in my player at most would be:

public override void Update()
{
    if (button.pushed == "berserkKey")
    {
       ability.berserk();
    }
}

... where for example berserk is a stacking buff but none of that logic is in my player class anymore.

For additional context, I plan to implement a Classes.cs class which will hold the info on classes (warrior/archer/etc) which will know exactly what the class and therefor player can use. The code above will likely abstract out even more when that is the case.

The problem is that my Player class already inherits from another class. How do I go about designing my Classes and Abilities classes in a way that my player can use them in the example above?

I'm also open to a completely different way if my initial thought here isn't ideal.

sentences:
How do I make game server for UDK game? I'm new in UDK and I'm starting to develop online multiplayer games.
There is a one problem, I couldn't find any tutorials about how to make a game server using udk. I suppose, that it uses unreal script. But that's about all I know about it.
So I'd really like for some help.

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:
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:
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:
Optimization of 2D terrain generation algorithm I am generating 2D terrain with 2D opensimplex noise, however I am having a problem with the FPS that is low when generating the terrains in TileMap. An example of how my game generates the terrain in javascript:

function generator(map_size=0, _posWorld=[0, 0], size=[1, 48], seed=0) {
    var simplex = new SimplexNoise(seed);

    var x = 0;
    var y = 0;
    var pos_modx = 0;
    var pos_mody = 0;
    while (x < size[0]) {
        pos_modx = utilsfunctions.mod(_posWorld[0] + x, map_size);
        y = 0
        while (y < size[1]){
            pos_mody = utilsfunctions.mod(_posWorld[1] + y, map_size);
            // GENERATION NOISE
            // TEMPERATURE
            var nx = parseFloat(pos_modx)/map_size - 0.5;
            var ny = parseFloat(pos_mody)/map_size - 0.5;
            var v1 = temperature * simplex.noise2D(1 * nx, 1 * ny);
            var v2 = 0.4 * simplex.noise2D(2 * nx, 2 * ny);
            var v3 = 0.23 * simplex.noise2D(4 * nx, 2 * ny);
            var v4 = 0.134 * simplex.noise2D(8 * nx, 8 * ny);
            var e = v1 + v2 + v3 + v4;

            // HUMIDITY
            var unx = parseFloat(pos_modx)/map_size - 0.4;
            var uny = parseFloat(pos_mody)/map_size - 0.5;
            var u1 = humidity * simplex.noise2D(1 * unx, 1 * uny);
            var u2 = 0.6 * simplex.noise2D(2 * unx, 2 * uny);
            var u3 = 0.7 * simplex.noise2D(4 * unx, 2 * uny);
            var u4 = 0.073 * simplex.noise2D(8 * unx, 8 * uny);
            var u5 = 0.09 * simplex.noise2D(16 * unx, 16 * uny);
            var u6 = 0.03 * simplex.noise2D(32 * unx, 32 * uny);
            var ue = u1 + u2 + u3 + u4 + u5 + u6;

            if (pos_modx >= 0 && pos_mody >= 0) && (pos_modx < map_size && pos_mody < map_size) {
                tile_map.set_cell(_posTileMap.x + x, _posTileMap.y + y, biomes.solos(e, ue));
            }
            y += 1;
        }
        x += 1;
    }

The problem is that I am generating several layers of tilemap, one for terrain, one for relief and one for trees. That is three scripts of these, of course for the relief and trees is much less complex, and alone for example, even the two together do not interfere almost anything in the FPS. However, only generating with the above-ground script is already a big problem, and I generate only one minimum possible bit at a time, which is (1, 48) for when moving up or down, and (48, 1) when moving to the right and left, it is clear that there is the case of the diagonal movement, having to generate 48 + 48, which is the worst case. However, even only the 48 are already leaving the FPS bad, nor do I need to move diagonally to feel the FPS suffer.

I would like tips to be able to optimize this generation, and if know any way to use only one algorithm to generate everything (terrain + relief + trees), or any help that can take me to a better way.

Understand why I am generating with 3 different scripts for terrain, relief and trees:

Terrains are large areas within large areas.

Reliefs are crooked lines on the map.

Trees are only points of a dirty noise on the map.

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:
Looking for articles/books on: How do games make money? What models do they use? I'm trying to research the ways in which games make money. I want to know more about the models they use (free/premium, trial/subscription, free-to-play with micro-transactions, etc.). In addition, I want information on which models work for which games, what models are best for which age groups, etc.

I've tried my best to find information, and Google hasn't turned anything up at all. I think I'll stop by my University's library and see if there's anything there.

This may seem like a broad question, but I'm looking for links and titles of books, not typed-out answers.

sentences:
Issues with percentage closer filtering I'm trying to code a simple game via OpenGL C++.
I've implemented a point light, parallax effect with textures, objects from blender etc. but I seem to have an issue with my percentage closer filtering implementation. The shadows are casted on top of a floor which is just a rendered texture below my objects. Im pretty new with how shadows work in OpenGL. This is my attempt to achieve pcf in the fragment shader:
in vec4 shadowMapCoord;

layout(binding = 10) uniform sampler2D shadowMapTex;
// area around each fragment that will be sampled
const int pcfCount = 10;

void main():
float shadowFactor = 0.0f;
for (int x =-pcfCount; x <= pcfCount; x++){     // x offset from inner pixel
        for (int y =-pcfCount; y <= pcfCount; y++){     // y offset from inner pixel
            shadowFactor += textureProjOffset(shadowMapTex, shadowMapCoord, ivec2(x,y));
        }
    }
    float visibility = shadowFactor;

Does someone maybe spot any issue with my implementation of textureProjOffset() or can I achieve pcf with another type of implementation?

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:
Rotate sprite along the angle between two objects Im trying to make flames follow my object, I set the direction for my moving object using the points between it and another object (using static destination for testing).

No matter what I do I cannot use the radians (which I use to set the direction), translate them to degrees, then rotate my flames so it looks like they are following it (like a comet).

What I try:

sprite.setPosition(pos.x, pos.y);
radians = Math.atan2(0 - pos.y, 540 - pos.x); //set radians
degrees = radians * 180 / MathUtils.PI; //calculate degrees
fireSprite.setPosition(sprite.getX(), sprite.getY());
fireSprite.setRotation((float)degrees); //rotate according to degrees

I move the object like this:

pos.x += 200 * Math.cos(radians) * delta;
pos.y += 200 * Math.sin(radians) * delta;

Am I missing something in the math? I feel like it should work.

An example of result from calculations:

radians: -1.8745297149164084, degrees: -107.4026382478209
radians: -1.1776894171295331, degrees: -67.47663130103584
radians: -2.1756410640936705, degrees: -124.65504723907603
radians: -1.2244578042111383, degrees: -70.15626242087843

The flames face the wrong direction, and not in a any sort of pattern I can use to debug my problem.

sentences:
Sounds overlapping when playing too many at the same time I am pretty novice when it comes to game sound management, so excuse my ignorance.

I am having an issue when playing too many sounds at the same time where some sounds stop playing, or doesn't play at all, almost like some sounds overlap others. I've read some about the sounds using individual buffers and that there should be no problem playing these at the same time at runtime. When I only had a small ammount of sounds in the game, it all worked flawlessly. My SoundManager had no problem playing multiple sounds at the same time ( I loaded the sound to memory when I  was going to play it and disposed it when it was done playing, approx. 5 seconds).

My SoundManager Class

I've recorded a video to better illustrate what this sound problem is. As you can hear in the video below, the attacking sounds can only be heard at some points, as for some enemy sounds. The idling sounds of the enemies (breathing and bat sounds) seem to work without issues, though.

Video

Thank you for helping, because I have no clue how to fix this issue. Is there something that I've left out in my SoundManager?

sentences:
Drawing the same mesh or drawing the same material? I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights.

Does my GPU speed up if I only draw one mesh over and over again? Or is only the material switching and uniform setting the main problem?

So: Should I consider going to only one mesh a 1000 times, or is it ok to have a lot of different meshes with only the same material?

sentences:
Editor Window Show method is not working properly Documentation says that EditorWindow.Show show the EditorWindow.

I have two classes:

public class WindowOne : EditorWindow {

    public static WindowOne windowOneInstance;

    [MenuItem("Window/Open Window One")]
    public static void Init() {
        windowOneInstance = GetWindow<WindowOne>(false, "Window One", true);
    }
}

and

public class WindowTwo : EditorWindow {

    public static WindowTwo windowTwoInstance;
    public static WindowOne windowOneInstance;

    [MenuItem("Window/Open Window Two")]
    public static void Init() {
        windowTwoInstance = GetWindow<WindowTwo>(false, "Window Two", true);
        windowOneInstance = WindowOne.windowOneInstance;
    }

    public void OnGUI() {
        if (GUI.Button(new Rect(0, 0, 200, 50), new GUIContent("show window one"))) {
            windowOneInstance.Show();
        }
    }
}

In menu I click Open Window One, then Open Window Two, then I close the first window

Now if I click a Button on WindowTwo it doesn't show me WindowOne. Or at least it shows one-pixel of window that I cannot move or resize or do something else.

If I use GetWindow(typeof (WindowOne)); instead of  .Show() - it shows the window, but I'm not sure that it shows the same instance I created before, because instanceID of that window will be different.

Why Show method works so strange? Am I doing something wrong? And  what should I do to show the same instance of closed (temporarily hidden) window?

Unity version - 5.6.0p4

sentences:
Will my huge sprites for a 2d game create performance issues? I'm new to Unity, and have been confused about this issue for a while. Some people say that for 2D games you don't need to worry about performance (I'm making the game for PC, not mobile) while others report bad performance with larger sized sprites

I have a long scene with some large background sprites, measuring about 14552x3308 (weird resolution I know, would that also cause issues?) All methods of scaling it down and resizing in Unity lead to jagged edges (these are basically hills so I need them to be significantly bigger than the player character) I always keep the image size in the inspector similar to the resolution of the actual file, and set the filter mode to Point, so the jagged edges are not due to that, but only because of me scaling up a smaller file size to fit the scene.

If I use the original sprites of 14552x3308, it's perfectly smooth (image size set to 8192 in inspector) but each file takes about 120mb in the profiler. All combined, my assets are showing a usage of 1.25 GB for this scene. How bad is this? Should I be trying to keep it under 1GB?

I don't really know what the best practices are in this situation, so I don't know what to aim for. I'd ideally like to keep the sprites at this large size so that I don't have to redraw anything.

sentences:
Trying to set up a simple swapping system to swap two game pieces using a button press I am trying to set up a system that will move two objects. This is a puzzle game with a cursor to visualize where the player is. I need to get the position of the cursor's left and right half, send that to a function that will then switch the two blocks when a key is pressed.
I have code that will move the cursor around but cannot figure out how to swap two blocks based on the position of the cursor.
I do not know if the code that is currently attached to the cursor will be of any help, but I can provide if necessary.
I am more or less looking for a general solution that I could apply to swapping two blocks.
I do not know if I need to be sending the positions of the cursor to the swap function in order to swap. How would I connect this to the tiles themselves? The code below is located in the board classv2 class. I am not very good with Unity as of yet. Any additional help would be appreciated.
 void Update()
    {
        if (Input.GetButtonUp("Swap"))
        {
            swapTiles(cursorLeft.transform.position.x, cursorRight.transform.position.x);
        }
    }

void swapTiles(float x1, float x2)
{

}

Game pieces are created and have an x and y number associated with a game board I created.
The Game pieces have a move routine. I can't seem to get the pieces to actually swap.
public void Move(int destX, int destY, float timeToMove)
{
    if (!m_isMoving)
    {
        StartCoroutine(MoveRoutine(new Vector3(destX, destY, 0), timeToMove));
    }
}

//Moves the piece.
IEnumerator MoveRoutine(Vector3 destination, float timeToMove)
{
    Vector3 startPosition = transform.position;

    bool reachedDestination = false;

    float elapsedTime = 0f;

    m_isMoving = true;

    while (!reachedDestination)
    {
        //if we are close enough to destination
        if (Vector3.Distance(transform.position, destination) < 0.01f)
        {
            reachedDestination = true;

            if(m_board != null)
            {
                m_board.PlaceGamePiece(this, (int)destination.x, (int)destination.y);
            }
            break;
        }

        //track the total running time
        elapsedTime += Time.deltaTime;

        //calculate the lerp value
        float t = Mathf.Clamp(elapsedTime / timeToMove,0f,1f);

        switch (interpolation)
        {
            case InterpType.Linear:
                break;
            case InterpType.EaseOut:
                Mathf.Sin(t * Mathf.PI * 0.5f);
                break;
            case InterpType.EaseIn:
                t = 1 - Mathf.Cos(t * Mathf.PI * 0.5f);
                break;
            case InterpType.SmoothStep:
                t = t * t * (3 - 2 * t);
                break;
            case InterpType.SmootherStep:
                t = t * t * t * (t * (t * 6 - 15) + 10);
                break;
        }

        //move the game piece
        transform.position = Vector3.Lerp(startPosition, destination, t);

        //wait until next frame
        yield return null;
    }
    m_isMoving = false;
}

sentences:
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:
My model is drawn wrong in 3d I'm learning OpenGL and now after I made everything I needed, I started with 3D, my first problem is that my mesh doesn't draw like I intended...

Here's my rectangle (uses GL_TRIANGLES):

std::vector<GLfloat> Vpos =
{
    0.5, 0.5, //0.0,
    0.5, -0.5, //0.0,
    -0.5, -0.5, //0.0
    - 0.5, -0.5, //0.0
    - 0.5, 0.5, //0.0,
    0.5, 0.5, //0.0
};//comms are the 3d version

And here I draw my array:

glDrawArrays(GL_TRIANGLES, 0, verNum / 2); //it is binded with vertex array, I use shaders

And my fragment shader is:

#version 330

in vec2 passTextureCoords;

out vec4 outColor;

uniform sampler2D ourTexture;

void main()
{
    outColor = vec4(0.0, 1.0, 0.5, 1.0);// texture(ourTexture, passTextureCoords); I don't have a texture so I use a lightgreen for debug proposes
}

Also my vertex shader:

#version 330

layout (location=0) in vec3 inVertPos;
layout (location=1) in vec2 inTexCoords;

out vec2 passTextureCoords;

void main()
{
    gl_Position = vec4(inVertPos.x, inVertPos.y, inVertPos.z, 1.0);
    passTextureCoords = inTexCoords;
}

Thanks for help by now, I pretty sure that I missed something small but important.

sentences:
Why does my game display the wrong "required Android version" on Google Play? I'm porting a Unity game to Android, and I've set up the "Minimum API Level" in the Player settings to "2.3.3 (API level 10)".

However, on the store, it says "Requires Android: 1.6 and up".

On the Google Developer Console I didn't find this setting, so I guess the store is just trying to "guess" it examining the application, and failing.

Did I miss something?

sentences:
Please help with bounding box/sprite collision in darkBASIC pro So I just recently learned BASIC and figured I would try making a clone of pong on my own in darkBASIC pro, and I made everything else work just fine except for the part that makes the ball bounce off the paddle. And yes I'm aware that the game is not yet finished. The error is on lines 39-51
EVERYTHING IS 2D.
The problem i am having is that when the ball hits the paddle it gets like stuck(itll move away like 3 pixels and the back onto the paddle), and will move up or down until it
finally gets to the edge of the paddle, or it gets sucked into the inside of the paddle, or it does the same thing where it gets stuck on the paddle, but it does it from behind.

  ///////////////////////////////////////////////////////////
  //
  //     Project: Pong
  //     Created: Friday, August 31, 2012
  //     Code: Brandon Spaulding
  //     Art: Brandon Spaulding
  //     Made in CIS lab at CPAVTS
  //     Pong art and code © Brandon Spaulding 2012-2013
  //
  //////////////////////////////////////////////////////////
y=150
x=0
ay=150
ax=612
ballx=300
bally=200
ballx_DIR=1
bally_DIR=1
hide mouse
set global collision on
//objectnumber=10
//make object box objectnumber,5,150,0
do
load image "media\paddle1.png",1
load image "media\paddle2.png",2
load image "media\ball.png",3
sprite 1,x,y,1
     sprite 2,ax,ay,2
     sprite 3,ballx,bally,3
     if upkey()=1 then y = y - 4
     if downkey()=1 then y = y + 4

    //num_1 = sprite collision(1,0)
    //num_2 = sprite collision(2,0)
      num_3 = sprite collision(3,0)

for t=1 to 2

//ball&paddle collision
if num_3 > 0
    if bally_DIR=1
        bally_DIR=0
    else
        bally_DIR=1
    endif
    if ballx_DIR=0
        ballx_DIR=1
    else
        ballx_DIR=0
    endif
endif

//if bally > 1 and bally < 500 then bally=bally + 2.5
if bally_DIR=1
    bally=bally-2.5
        if bally<-2.5
            bally_DIR=0
        endif
else
    bally=bally+2.5
        if bally>452.5
            bally_DIR=1
        endif

endif
if ballx_DIR=1
    ballx=ballx-2.5
        if ballx<-2.5
            ballx_DIR=0
        endif
else
    ballx=ballx+2.5
        if ballx>612
            ballx_DIR=1
        endif

endif
//bally = bally + t
//if bally < 600 or bally > 1 then bally = bally - 2.5
//if ballx < 400 or ballx > 1 then ballx = ballx + 2.5
//move sprite 3,1

   next t
   if escapekey()=1 then exit
   loop
   end

Thank you in advance for the help.

sentences: How does UV mapping work for the spaces between vertices? In UV mapping each vertex has a UV coordinate, but wouldn't that just make 1 pixel for every vertex? How do you find out the texture coordinate for the spaces in between the vertices? Am I not understanding UV mapping right?

sentences:
Show view over existing view in same activity I am newbie Android developer, and I am starting out with a simple Sudoku game. The problem I am facing right now is that I have my game showing on a dedicated Activity, which is displaying a custom View class. I have the code within the onDraw function. Now I want to show a custom keypad view, which is a separate class extending View, whenever a user clicks on a block in the Sudoku grid.

I am extremely confused as to how I should go about doing this. I am reluctant to create a dedicated activity for just this keypad, and want to show this keypad over the Sudoku grid view that the activity is currently displaying.

The activity is using setContentView(myCustomGridViewClass) to show the grid. Now I want something to the equivalent of

onTouch -> setContentView(myCustomKeypadView), though this should appear over the previous view.

I have tried reading about the LayoutInflater, but did not understand how to use it to show the keypad within this same activity. This is probably a very noob question, but any help, including any other questions, or sources I could refer to for an answer would be highly appreciated.

Regards,

sentences:
Check which object was activated first How do I check which object was activated before the other?
Let's say that there's door to open. To open the door you need to press firstly the second button and then the first button...but not the other way around.

I have these scripts for now:

Switch script (it's on 2 objects that are switches and both objects have colliders with IsTrigger checked):

public var IsPressed : boolean = false;
public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Update()
{
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1))
        IsPressed = true;
}

SwitchCheck script (it's on door that should be opened)

public var Switch1 : Switch;
public var Switch2 : Switch;

function Update()
{
    if (Switch1.IsPressed && Switch2.IsPressed)
    {
        Destroy (gameObject);
    }
}

EDIT:
Let me explain this in detail.
If Button1/ Switch1 is pressed, door opens to World1.(no Button2 needs to be pressed.)
If Button2 and then  Button1 is pressed, door opens to the World2.

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:
Subsurface Scattering - Transmittance I have a question related to SSS and especially transmittance. I've looked at several papers about that topic, most of them from Jorge Jimenez, which are very interesting and, I admit, a bit hard for me.

Here is one of the papers : http://www.iryoku.com/translucency/

I have some difficulties to understand the way it works and the way it calculates the distance the light traveled through the object. I think that I understand the very big lines but I am also a bit confused as I am trying to integrate this into the Unity engine and I have some difficulties to match Unity engine available values such as the shadows maps, the shadows coords, etc... to make them fit the way they are used in the paper.

So here it is, I am a bit lost in the "in-between" and I hope that somebody might be able to help me.

Thanks a lot.

EDIT : added the shader code from referenced paper

float distance(float3 posW, float3 normalW, int i) {
  // Shrink the position to avoid artifacts on the silhouette:
  posW = posW - 0.005 * normalW;

  // Transform to light space:
  float4 posL = mul(float4(posW, 1.0), lights[i].viewproj);

  // Fetch depth from the shadow map:
  // (Depth from shadow maps is expected to be linear)
  float d1 = shwmaps[i].Sample(sampler, posL.xy / posL.w);
  float d2 = posL.z;

  // Calculate the difference:
  return abs(d1 - d2);
}

// This function can be precomputed for efficiency
float3 T(float s) {
  return float3(0.233, 0.455, 0.649) * exp(-s * s / 0.0064) +
         float3(0.1,   0.336, 0.344) * exp(-s * s / 0.0484) +
         float3(0.118, 0.198, 0.0)   * exp(-s * s / 0.187)  +
         float3(0.113, 0.007, 0.007) * exp(-s * s / 0.567)  +
         float3(0.358, 0.004, 0.0)   * exp(-s * s / 1.99)   +
         float3(0.078, 0.0,   0.0)   * exp(-s * s / 7.41);
}

// The following is done for each light 'i'.

// Calculate the distance traveled by the light inside of the object:
// ('strength' modulates the strength of the effect; 'normalW' is the vertex
//  normal)
float s = distance(posW, normalW, i) / strength;

// Estimate the irradiance on the back:
// ('lightW' is the regular light vector)
float irradiance = max(0.3 + dot(-normalW, lightW), 0.0);

// Calculate transmitted light:
// ('attenuation' and 'spot' are the usual spot light factors, as in regular
//  reflected light):
float3 transmittance = T(s) * lights[i].color *
                       attenuation * spot * albedo.rgb * irradiance;

// Add the contribution of this light:
color += transmittance + reflectance;

sentences: 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:
Shader that "cuts" hole through all geometry How can I create a shader that "cuts" through all geometry, only rendering the clearing background in Unity? An example:

That's a prism in a huge white box-shaped room. The surface of the prism is just rendering the skybox of the scene (a starry sky). I used multiple cameras, which is pretty inefficient... There must be a way with just shaders.

How can I do this?

sentences:
How to make players be creative in a game, if the game cannot evaluate it? I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer.

So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations).

For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world).

Please tell me if you have any ideas, articles or references that could help me coping with this problem.

sentences:
Deciding Which Platforms to Support -- Silveright (+Android?) My "usual" stack for game dev is to create (in-browser) Silverlight games. I've decided I want to branch into iPhone or Android, and decided to go droid because it's cheaper (considering I don't have a Mac).

Having now all the requisite software and hardware, how do I decide which games to code on both platforms and which to not?

In an ideal world, it would only cost me 5-10% more (time/effort) to port it to Android having developed it for SL. But I know the worst case is 100%+ (i.e. rewrite), and that it'll be somewhere in the middle.

Considering everything will likely be free (although it might be worth it to release the SL one free and offer a $5 paid one on Android, not sure), what are factors to look at?

sentences:
Making a HUD/GUI with OpenGL (LWJGL) I'm at the stage in my game development where I need to make a HUD or GUI. I've never gotten to this part, so I don't know how its done. I tried rendering a simple quad at a fixed position on the screen, but there's a problem. To make my camera work with orthographic, I use this:

public void lookThrough()
{
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(position.x, position.x + Display.getDisplayMode().getWidth()/zoom, position.y + Display.getDisplayMode().getHeight()/zoom, position.y, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

I don't see how I would be able to make something fixed on the screen using this method? Any way around this? Thanks :)

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:
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:
Bukkit Scheduler not in main Class I want to make an Repeating Task whisch isn't in the main Class. ("Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {},20,20);")

But it says that it can't resolve the method.

sentences:
Input handling in component based design I know this question has been asked several times, but I'm still not sure how to implement input handling in a component based engine.

The component based design I used was based on T=Machine's blog series and on Artemis in which Entities are just ids.

There are three main ideas I have in implementing input handling:

The input component will hold events it's interested. The input system will translate key and mouse events to game events and loop through the entities with the input component and if they are interested in the event an appropriate action will be taken by the input system. This action would be hard coded to the input system.
No input component. You would register entities with specific events to the input system. The input system would then send messages (with the entity id and event type) to other systems so that these can take the appropriate action. Or as in the first case, the actions would be hard-coded to the input system.
Similar to the first method, but instead of hard coding the action to the input system, the component would contain a map of events to functions (i.e. std::map<std::function>) which would be called by the input system. This has the added effect of being able to couple the same event to different actions.

Would you recommend any of the above methods or do you have any suggestions that would help me implement a flexible input handling system? Also, I'm not yet familiar with multi-threading but any suggestions that would make the implementation thread-friendly are also welcome.

Note: One added requirement I'd like the implementation to fulfill is that
I'd be able to pass the same input to many entities, like for example moving a camera entity and the player at the same time.

sentences:
UNET spawn dynamically generated object unity Spawning works when all clients are connected, but if a client connects after I spawn all my prefabs there are errors.  I spawn the object before changing its Rigidbody's velocity, which seems to cause the problem. I spawn objects, change them, then the other client joins, and the errors come. these are the errors:

Failed to spawn server object, assetId=953c1c6ecbb84304280d1334ef5dae0b netId=26

I also make changes to variables on other scripts.

All objects have network identities, network transforms, and are spawnable prefabs.

sentences: Unity: Build looks different then gameview: runtime reflection probes not working correctly Im having a really hard time figuring out how to configure my reflection probes to update in runtime once I build. The game port view looks totally different than the build view. Ive tried turning off baked GI in the lighting > scene panel, and unchecking "auto" under "other settings" but keep getting an error message "baking lighting data asset failed" when I try to build the light maps. Maybe this is not the right way to solve the problem? Has anyone else encountered this and figured it out?

sentences:
Segmentation Fault using Allegro_Tiled, function al_open_map(); I have consistently segfaulted trying to load a TMX file into a *map.

int main(int argc, char *argv[])
{
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer = NULL;
    ALLEGRO_KEYBOARD_STATE keyboard_state;
    ALLEGRO_MAP *map = al_open_map("data/maps", "TestMap.tmx");
...

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/X/Desktop/Programming/C/AllegroRoboticsTest/
Adding source dir: /home/X/Desktop/Programming/C/AllegroRoboticsTest/
Adding file: /home/X/Desktop/Programming/C/AllegroRoboticsTest/bin/Debug/AllegroRoboticsTest
Changing directory to: /home/X/Desktop/Programming/C/AllegroRoboticsTest/.
Set variable: LD_LIBRARY_PATH=.:/usr/local/lib:/opt/opencascade/lib
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/X/Desktop/Programming/C/AllegroRoboticsTest/bin/Debug/AllegroRoboticsTest
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 8.1
Program received signal SIGSEGV, Segmentation fault.
In al_get_standard_path () (/usr/lib/liballegro.so.5.2)
#2  0x00005555555563ba in main (argc=1, argv=0x7fffffffe3a8) at /home/X/Desktop/Programming/C/AllegroRoboticsTest/main.c:45

At first I thought, maybe I just didn't build the library right, so I rebuilt it 2 more times, once as a static and another as a shared library.

The interesting thing is that it builds just fine when using the cmake files that came in the example.

I cannot recreate it though.

This is the callback after I moved the open map command into it's usual place, directly from the example that comes with allegro_tiled.

// If MAP_FOLDER is relative to the working directory and not the running
// executable, then add a call to `al_find_resources_as(RELATIVE_TO_CWD);`
// before calling `al_open_map()`.
//al_find_resources_as(RELATIVE_TO_CWD);
map = al_open_map("data/maps", "TestMap.tmx");
int map_total_width = al_get_map_width(map) * al_get_tile_width(map);
int map_total_height = al_get_map_height(map) * al_get_tile_height(map);

// Draw the map
al_clear_to_color(al_map_rgb(0, 0, 0));
al_draw_map_region(map, map_x, map_y, screen_width, screen_height, 0, 0, 0);
al_flip_display();

   ...
   Setting breakpoints
   Debugger name and version: GNU gdb (GDB) 8.1
   Child process PID: 25749
   In ____strtoll_l_internal () (/usr/lib/libc.so.6)
   #3  0x0000555555556615 in main (argc=1, argv=0x7fffffffe3a8) at /home/X/Desktop/Programming/C/AllegroRoboticsTest/main.c:114

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

For example:

XXOO       OXOO
XXOX       XXOO
XOOX  and  XOOO
XXXX       OXXX

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

  oo
  o
 oo

and the 2nd:

  oo
  oo
 ooo

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

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

sentences: OpenGL align grid like glOrtho but with gluPerspective? Using gluPerspective makes OpenGL's grid really messy and rather hard to use especially when trying to do mouse input. The grid that perspective uses is completely messed up compared to the grid you get with the mouse. When using glOrtho the grid is fixed to the mouse grid, but then you can only do 2D work, how would I set up perspective to get the same results as if I were using glOrtho?

sentences:
Minecraft Bukkit Rename world and use in Java Plugin I run a Minecraft server (Bukkit 1.7.9) and would like to have a second overworld-like world, into which I can teleport players from my plugin.
I did some testing with the "world" folder:

tried to simply rename the folder, but then a new world is generated on server start (into folder "world")
moved another world with different folder name into the server directory (in addition the original world folder)
tried to change the "level-name" value in server.properties but that does just generate new nether and end folders containing the new name

But in all cases the additional world is not listed when

Bukkit.getWorlds()

is called from the plugin (of course I restarted the server after adding the world).
So now the question is how do I properly rename a world?
I was not able to find something via a search engine nor could I find a file in the world folder that contains the world's name to change it there.

I know that I could use Multiverse or a similar plugin to do what I want but I hope that there is an easier way (like the one i tried).

I hope you can understand everything, sorry that it's not the best English but I'm not a native speaker ^^ .
If I missed to tell you something you need to know please ask :)
If anything else is wrong with this post please tell me as this is my first question posted here.
Any idea or help is appreciated!

sentences:
Associating materials and primitive I'm trying to find a way of setting any kind of material class on any kind of primitive class (all the material classes have a base material class, same goes for the primitive classes).

What I mean by that, is, I'm looking for a way to do something like this:

Cube a = Cube( ColorMaterial( COLOR_RED ) );
Cube b = Cube( TexturedMaterial( ambienTex, diffuseTex, specularTex ) );

Ok, so that looks pretty easy, but I've got a few problems.
First of all, inside my Cube class I've got a function in which I build the cube's geometry, as such:

VertexPositionColor vertices[36] =  { VertexPositionColor( pos, color ), ... }

Because of this, I can't just pass any type of material to my primitive class, because that would mean that the function that builds the geometry would need to be able to change the type of vertex it uses.
I can't use templates either, because, even though it would solve the type issue, different vertex types are not constructed the same way.

So, is there any way of associating a material to a primitive?

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:
Changing Ogre3D terrain lighting in real time I'm looking at the Ogre 3D library and I'm browsing through some examples / tutorials. My question is about terrain. There are a few examples showing how great the terrain system is, but I think that the global illumination and shadows of the terrain have to be pre-computed, which kinda makes it impossible to integrate this with a day / night cycle.

Is there a way to change the terrain light sources in real time? If so it is possible to do it and keep a decent FPS?

sentences:
Retro Racing Renderer While I have a lot of experience with coding SW&HW 3D rasterizers across multiple platforms and eras, I never got to coding a 2D renderer for a non-polygonal racing game with multiple rolling hills (with correct perspective and occlusion). Say, something like a Lotus from 1990.

Of course, the roadside props and cars are all sprites, but I'm curious as to how the road, especially with rolling hills is done.
My uneducated guess is that it's composed from separate horizontal lines (that have the terrain and road texels), which are simply stacked above each other with zero horizontal offset (for the straight road) and once you approach the curve, the horizontal offset for the given scanline is taken from a look-up table (for a given curve). Given enough RAM we could have a lot of different curves. Or perhaps if the curve equation is simple (not some Bezier stuff), then it could be even calculated at run-time (integer / fixed-point, of course).
This should supply the illusion of curved road.

Now, for the single rolling hills, we would probably merely introduce a vertical offset to our road scanlines, so this could give an illusion of going up/down the rolling hills, as all scanlines would move up/down on the screen.

What I don't quite understand is how the multiple rolling hills with a perspective are done, especially if they are overlapping correctly. This is probably hard to visualize, but imagine there is a second hill in the distance, and you are climbing up the hill in front of it. While climbing up, you can see it in the distance, and when you get to the top of the hill, the valley between two hills appears. With polygonal gfx, this is super easy and you don't even think about it - the valley is just back-face culled polygons, so it's obvious they did not get rendered when climbing up the first hill. Meaning - the valley is transformed, clipped and discarded thanks to back-face culling.

But how would you do that with the 2D horizontal scanlines ? Perhaps using SW Z-Buffering on each scanline ? One idea could be that you separate the scanlines for the hill up and the hill down - e.g. you only start rendering those scanlines when you get to the top of the hill- but I doubt it would work flawlessly.

I suspect, as with everything in game coding, once you start prototyping it, a solution would simply be reached by multiple iterations/prototypes. I'm in the middle of some other project now, so I don't want to distract myself with another project, hence this question.

EDIT: StackOverflow supplied few links, right before I submitted the question, and one of the threads contained this link:
http://www.extentofthejam.com/pseudo/
It explains in a great amount of detail various techniques for this type of rendering. I am in the middle of it right now. From what I can see, the early games did actually use the FOV projection! That explains why their 'feeling' of perspective was so exact, as you can't really hack it properly (especially for a 3D-trained eye).

sentences:
Potential Field Pathfinding in a non Axis Aligned World I am trying to create a game that has player created obstacles which can be placed anywhere in free space, and which has a large amount of enemy agents. In persuit of maximizing the number of agents I can have active at any given time, and as a secondary goal of maximizing the possible size of my map, I found potential/vector fields to be a very appealing solution, except for one thing.

Since the geometry is not aligned to any particular grid I have the problem of what to do when I have a narrow alley between obstacles that is approximately the size of one of my units (As such:)

In this case, cells approximately the same size as the unit would consider this route impassable. One solution would be to use a smaller size of cell, but this of course means more computational resources. Does anyone know of an alternative solution to this problem?

sentences:
Video play in unity3d skybox I want to play 360 video in skybox. Is there any direct way avaiable to do this task. One long, boring, inefficient  procedure which seems that

Convert 360 to frames
Convert frames into cubmap
Use that cubeMap in skybox and Programatically change it's textures(Frame) quickly so that video effects shown

This is the long task which seems to me possible but is there any other way available?

sentences:
what do you choose to point player in multiplayer game coding? I'm making C or C++ texture multiplayer game (monopoly) and
to code multiplayer, defined type user
when you change player or point player in main() or other()
you choose Number or pointer?
for example, when one turn finish how do you change player
like user++ (user is int) or use changeUser() ...
i'm newby and know nothing

sentences:
Moving the rendered object/the projection perspectives based on an AR marker I saw this video and now I am trying to making it.

I have used Vuforia AR Camera Pulgin, and so far tracked the image on a marker but the problem is getting the four projections of the 3D object on a screen. Here is an example of what it looks like.

I have used Viewport Rect method with four cameras but that does not seem to change the projections as I move the marker.

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:
Arbitrary projection matrix from 6 arbitrary frustum planes A projection matrix represent a tranformation from the camera view space to the rendering system clip space. In other words, it defines the transormation between a 6-sided frustum to the clip cube.

The glOrtho and glFrustum use only 6 parameter to define such a projection, but impose several constraints on the frustum that will get projected to the clip cube: the near and far planes are parallel, the left and right planes intersect on a vertical line, and the top and bottom planes intersect on a horizontal lines, both lines being parallel to the near and far planes.

I'd like to lift these restrictions. So, from the definition of the 6 frustum side planes (in whatever representation you see fit), how can I compute a general projection matrix?

sentences: How to use an A* Pathfinding System across uneven environments? I am developing a game in Unity3D. I want an enemy character to follow the player around. The problem is, my surface is uneven and full of mountains. I am using aarongranberg's pathfinding project. Every time that a player climbs a hill or a mountain, the enemy stops because the grid is flat and it considers the mountain to be an obstacle. How do I solve this problem ?

sentences:
Efficiently color a procedural mesh? I'm creating a procedural world with LWJGL and GLSL. I want to better visualize the biome map being produced and the height map it creates, but my attempts so far have been very inefficient. My first idea was to make a vec3[] holding the biome color for each vertex, but that very quickly took the game from 150 fps to 10-15. The time to render a 512x512 chunk went from around 3 per second to one per five seconds. As you could expect, there was also a problem with it very quickly using up 12gb of ram.
I then thought about making an int[] array for each vertex where each point of the mesh would be able to use as a dictionary to grab a vec3 for the color. So 512*512 integers in an array getting from an array of 15 colors intead of a single array of 512*512 vec3s. This seemed even worse somehow in both FPS and chunk rendering time.
To summarize again, I'm trying to color each vertex with its own color to visually show the biomes. What is a more efficient way to do this?

sentences:
Is there a way to assign a texture to a button and resize it in the Unreal Engine? I'm attempting to create a main menu for my game and have followed an easy tutorial to do so. The tutorial doesn't cover assigning textures or images to buttons, so I set out to do this myself.

Assigning the image to the button (I have a 'normal', 'hover', and 'clicked' texture) was rather easy, but the images don't fit.

Using the 'Image Size' options don't do anything at all and I've got no idea on how to change the image without going back into Photoshop or GIMP and just redoing the whole image to fit the button size.

Is there any way to actually change the size of the image inside the button in Unreal? Or do I just have to suck it up and re-do it?

sentences: Android multiplayer via bluetooth How do I transfer game commands between 2 android devices via bluetooth first of all is possible to do this??If possible then someone please help in doing so.Thank u

sentences:
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:
How do I make a low pass filter (average of readings over time) for compass? I'm making a prototype for android that pulls compass data from the phone. I want to stabilize it so it is less jerky, by taking the average of the last couple of readings.

I have done this for accelerometer readings with great success, but adding every measurement to a queue and then collapsing it and dividing it by the queue size (= calculating the average) but for angles this is different.

If my measurements are for example:

  350, 359, 360

I could calculate the average as 356.3

But if my measurements are

  350 359, 1

Then my average is  236 which is a radically different angle.

Is there any way you guys can think of I could deal with this?

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:
What is the best rate at which to send updates to clients for a first person shooter NodeJS WebSocket server? I developed a multiplayer FPS using WebGL, Nodejs and WebSockets.
So far it is running great.
I am currently using setInterval(sendPlayerPositions, 16); to send updates to WebGL clients.
Ideally I would use 16.66667 but this is not possible to my understanding.
So I wonder if I should change to setInterval(sendPlayerPositions, 10); to make up for the drift.
And in general it might be a good idea to send stuff faster than the client frame rate (60 in most cases).
I also recently learned about process.nextTick and setImmediate and I wonder if I should use those
instead...
Any advice ?
PS: I am currently using Nodejs 10 on my Linux server and Nodejs 14 on my dev machine.

sentences:
Unity custom shaders and z-fighting I've just readed a chapter of Unity iOS Essential by Robert Wiebe.

It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset.

Basically it modified Normal-Diffuse shader provided by Unity, specifing the (texture?) offset in -1, -1.

Here's basically what the shader looks like:

Shader "Custom/ModifiedNormalDiffuse" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
        Offset -1,-1   //THIS IS THE ADDED LINE
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;
        fixed4 _Color;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex) *_Color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Ok. That's simple and it works.
The author says about it:

  ...we could use a copy of the shader that draw the road at an Offset
  of -1, -1 so that whenever the two textures are drawn, the road is
  always drawn last.

I don't know CG nor GLSL, but I've a little bit of experience with HLSL. Anyway I can't figure out what exactly is going on.

Could anyone explain me what exactly Offset directly does, and how is solves z-fighting problems?

sentences:
How to update a dynamic texture I'm using Ogre 1.10, I have a dynamic texture assigned to a material that I need to update its buffer with a new image every few seconds.
How can I transfer pixel data from an image to my dynamic texture?

I've created a manual texture like:

         // Create the texture
        Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(
            "dyn_texture", // name
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,      // type
            256, 256,         // width & height
            0,                // number of mipmaps
            Ogre::PF_BYTE_BGRA,     // pixel format
            Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);

And on my update function I have the image that I want to transfer:

Ogre::Image img;
img.load(basename.toStdString(), "resources");
//Copy pixels from img to texture
//??

I've already tried doing:

Ogre::HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
pixelBuffer->blitFromMemory(img.getPixelBox());

works but it's quite slow, gui freezes when updating like that.

sentences:
OpenXR device not present in Start or Awake methods in Unity C# script I'm developing a VR game using OpenXR in Unity (specifically developing on a Valve Index). When I try to access the input devices through the InputDevices.GetDevices() function, I get 0 devices back when I call this function from my script's Awake() or Start() methods. But when I call the same function from my script's Update() method, I see all the devices (e.g. head set, left controller, right controller).
Why can't I see the devices in the Awake() or Start() methods?

sentences:
Jitter during wall collisions with Bullet Physics: contact/penetration tolerance? I use the bullet physics engine through Panda3d.

My scene is still very simple, think 'Wolfenstein3d': tile-based, walls are solid cubes.

I expect walls to block the player, and I expect the player to slide along the walls in case of non-normal incidence.

What I get is what I expect, with one difference: there is some jitter.  If I try to force myself into the wall, then I see the frames blinking quickly between two positions.  These differ by about 0.04 units of distance, which corresponds to 4 cm in my game.

I noticed a 4 cm elsewhere: the bottom of my player capsule is 4 cm below ground, when at rest.

Does that mean that there is somewhere in the Bullet engine a default 0.04-units-long tolerance to differentiate contact from collision?  If so, what should I do ?  Should I change the scale of my game so that these 0.04 units correspond to 0.4 cm, making the jitter ten times smaller?  Or can I ask bullet to change its tolerance to a smaller value?

Edit

This is the jitter I get: 6.155 - 6.118 = 0.036

LPoint3f(0, 6.11694, 0.835)
LPoint3f(0, 6.15499, 0.835)
LPoint3f(0, 6.11802, 0.835)
LPoint3f(0, 6.15545, 0.835)
LPoint3f(0, 6.11817, 0.835)
LPoint3f(0, 6.15726, 0.835)
LPoint3f(0, 6.11876, 0.835)
LPoint3f(0, 6.15911, 0.835)
LPoint3f(0, 6.11937, 0.835)

I found a setMargin method.  I set it to 5 mm both on the BoxShape for the walls and on the Capsule shape for the player.  It still jitters by about 35 mm as illustrated by this log (11.117 - 11.082 = 0.035):

LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1169, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.082, 0.905)
LPoint3f(0, 11.117, 0.905)
LPoint3f(0, 11.0821, 0.905)
LPoint3f(0, 11.1175, 0.905)
LPoint3f(0, 11.0822, 0.905)
LPoint3f(0, 11.1178, 0.905)
LPoint3f(0, 11.0823, 0.905)
LPoint3f(0, 11.1183, 0.905)

The margin on the capsule did change my penetration with the floor though, I'm a bit higher (0.905 instead of 0.835).  However, it did not change anything when colliding with the walls.

How can I make the collisions against the walls less jittery?

Edit, the day after:

After more investigation, it appears that dynamic objects behave well.  My problem comes from the btKinematicCharacterController that I use for moving my character; that stuff is totally bugged, according to the whole Internet :/.

sentences:
Getting more particles in engine I followed rbwhitakers tutorial on making a particle engine and I'm wondering how to get more particles on the screen. I was thinking that the "total" variable would do it but it doesnt. Is this something I'm doing wrong in the method or a hardware problem?

private Particle GenerateNewParticle()
    {
        Texture2D texture = textures[random.Next(textures.Count)];
        Vector2 position = EmitterLocation;
        Vector2 velocity = new Vector2(0, 10);
        float angle = 0;
        float angularVelocity = 0;
        Color color = Color.LightSkyBlue;
        float size = (float)random.NextDouble();
        int ttl = 100;

        return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
    }

    public void Update()
    {
        int total = 100;

        for (int i = 0; i < total; i++)
        {
            particles.Add(GenerateNewParticle());
        }

        for (int particle = 0; particle < particles.Count; particle++)
        {
            particles[particle].Update();
            if (particles[particle].TTL <= 0 || particles[particle].Position.Y > 550)
            {
                particles.RemoveAt(particle);
                particle--;
            }
        }
    }

Im creating rain but I want it to be really heavy rain. Right now it just looks like a heavy sprinkle...I guess I would call it.

            particleEngine.EmitterLocation = new Vector2((float)rand.NextDouble() * (graphics.GraphicsDevice.Viewport.Width), 0);

sentences:
Load nextLevel with a button click Can anyone help me someone with this code?

I'd like to go to the next level by clicking a button: example my level name is L1,L2,L3,L4,L5,L6,L7 and when I finish level L1, I want to go to level L2 with the click of a button, and from L5 go to L6 like this.

public class GameLevels : MonoBehaviour {

 public Button Play;
 private int idLevel;
 // Use this for initialization
 void Start ()
 {
     idLevel = PlayerPrefs.GetInt("idLevel");
     Play.interactable = false;
 }
 public void SelectLevel(int i){
     idLevel = i;
     PlayerPrefs.SetInt ("idLevel", idLevel);
     Play.interactable = true;
 }

 public void LoadLevel(string Levels)
 {
     SceneManager.LoadScene (Levels);
 }
 public void Replay()
 {
     SceneManager.LoadScene ("L" + idLevel.ToString ());
 }
 public void loadNextLevel()
 {

 }
}

sentences:
How to draw a character behind and in front of a building? (isometric map) how is it possible to draw the player behind and in front of some building in an isometric map : should I slice them, replace the number in the map (one number for a tile usually) by an array of number (each being a piece of a bigger tile), and somehow add a Z-order related to each small number (the pieces of building), something like this?

//replace :
var map = [
    [1,0,1],
    [0,1,1],
    [0,0,1],
    [0,0,1]
];

//by :
var map = [
    [["2-zOrder/1","3-zOrder/1"],0,1],
    [1,1,1],
    [1,0,1],
    [0,0,1]
];

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:
OpenGL Textures not sitting right on model I have been trying to get textures loading properly onto my models but to no avail. I'm using picopng to load my images.

Here is my code.
[Texture code]

std::vector<unsigned char> buffer, image, aaa;

std::ifstream file(location.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
std::streamsize size = 0;
if (file.seekg(0, std::ios::end).good()) size = file.tellg();
if (file.seekg(0, std::ios::beg).good()) size -= file.tellg();
if (size > 0)
{
    buffer.resize((size_t)size);
    file.read((char*)(&buffer[0]), size);
}
else {
    buffer.clear();
}
unsigned long w, h;
int error = decodePNG(image, w, h, buffer.empty() ? 0 : &buffer[0], (unsigned long)buffer.size());

if (error != 0) std::cout << "error: " << error << std::endl;

glEnable(GL_TEXTURE_2D);
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, &image[0]);

glBindTexture(GL_TEXTURE_2D, 0);

glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
float mipMapingAffectivness = 0.4f;
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, mipMapingAffectivness);

Any advice?

[Update]
I have tried flipping the image but to no avail, I have tried all 8 orientation variations and non seem to work.

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:
XNA 2D Spritesheet drawing rendering problem I'm making a tile-based game, using one spritesheet containing all tile graphics.

Each tile has a size of 32x32 pixels.

The main problem is: when I draw the tile to the screen, if the tile position x and y are not rounded or if scale is activated in spriteBatch.Draw() method (scale != 1.0f), I get some lines of adjacent tiles on the spritesheet into the current tile drawed.

I already tried setting SamplerState to PointClamp, removing AntiAlias, but still doesn't work.

Here I'll show images of some tests that I made, with a test sprite sheet that I've created (I made a 9x9 spritesheet, with each sprite of size 32x32 containing a unique solid color).

Tests:

SpriteSheet used:

Already tried to remove anti-alias, set PointClamp as sampler state, but still getting this issue, XNA keeps drawing part of the adjacent pixels of the texture on the screen.

What I want is to get the correct area of the tilesheet texture (as seen in the first test, that gets just the yellow pixels).

My question is: Is there any way that I can fix this, WITHOUT adding tile spacing or any other modification involving the tilesheet?

Maybe disabling a texture filtering that is done by XNA, or something like that.

sentences:
Display dynamic texture image on inside of sphere I'm displaying a ring wherever the camera 'looks'. When the camera faces the ground (green) the ring image always looks correct, see image:

However, my scene is within a sphere (purple)... and when the ring reaches the sphere it does not display correctly. See image:

This second image, the ring should be facing the camera since it's on a surface that is in front of the camera (not on the ground like the image appears).

Sorry if my images are poor representations. I basically have a flat plane which is within a sphere. The sphere has flipped normals to be able to display from within the sphere. I need the ring to "attach" or bend to the shaped of the object it is being drawn against. Any help is greatly appreciated.

EDIT: (more details). You can't raycast to a collider from within the same collider, so I'm using a raycast in the opposite direction. Code:

Ray ray = new Ray(m_Camera.position, m_Camera.forward); // get ray
Vector3 forwardVector = ray.GetPoint(100); // get a point 100 away
ray = new Ray(forwardVector, m_Camera.forward); // create new ray from this point
ray.direction = -ray.direction; // reverse ray direction
if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers)) {
     imageTransform.rotation = Quaternion.FromToRotation (Vector3.forward, hit.normal);
}

sentences:
2D Mask antialiasing in xna hlsl I have two texture2d , one of these is a mask texture and have 2kind color
and i use that for mask (filter) second texture2D
something like

     float4 tex = tex2D(sprite, texCoord);
float4 bitMask = tex2D(mask, texCoord);
if (bitMask.a >0)
{
 return float4(0,0,0,0);
}
else
{
      return float4(tex.b,tex.g,tex.r,1);
}

but because mask texture is just two color the result is too jagged
i want know how i can do some antialiasing for edges that smooth these
ty for reading and sry for my bad english

sentences:
Unity rigidbody glitch throu corners No matter how thick the wall is, the player will glitch through. I've tried changing the settings on the rigidbody but nothing have worked. The walls fits together almost perfectly. Why is this happening?

I already searched a lot and also found a lot of questions regarding the same problem at "Unity Answers" - not a single one of them gets answered. I dont know why, it seems theyr community is almost dead.

sentences:
XNA mouse position in windows forms I am using this code in Update method in XNA RenderControl in Windows Forms:

...
Mouse.WindowHandle = renderControl1.Handle;
MouseState stat=Mouse.GetState();
...

Everything works fine but when I want to record it with Fraps I get this result: http://www.youtube.com/watch?v=oDmzAIx_wU0 mouse position is moved but in screen everything is OK. When first line is removed I have moved cursor on screen but not in video. Is posible to have same result in both cases?

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:
Better solution for boolean mixing? Sorry if this question has been asked in the past, but searching Google and here didn't yield relevant results, so here goes.

I'm working on a fragment shader that implements both conditional/boolean diffuse and bump mapping (that is to say, you don't need a diffuse texture or a normals texture, and if they're not present, they're simply changed to default values).

My current solution is to use a uniform float to say "mix amount". For example, computing the diffuse texel works as:

// Compute diffuse amount scaled by vCol
// If no texture is present (mDif = 0.0), then DiffuseTexel = vCol
// kT[0] is the diffuse texture
// vTex is the texture co-ordinates
// mDif is the uniform float containing the mix amount (either 0.0 or 1.0)
vec4 DiffuseTexel = vCol*mix(vec4(1.0), texture2D(kT[0], vTex), mDif);

While that works great and all, I was wondering if there's a better way of doing this, as I will never have any use for in-between values for funky effects.
I know that perhaps the best solution is to simply write separate shaders for mDif=0.0 and mDif=1.0, but I'd like a more elegant solution than splicing shaders before compiling or writing multiple shader files and keeping each one updated.

Any ideas are greatly appreciated. =)

sentences:
Finding out what pixel on the screen the fragment falls on In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen.

Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so that it knows what pixel on the scren it will fall on. That way I can do per pixel lighting.

Currently I only get the UV coord relative to the texture, not the screen.

Thanks

Using ps 2.0

sentences:
How to make Pong ai paddle? I'm trying to make an ai so the paddles will move to position before the ball reaches it. I'm not sure how to go about it in this case.
Here's the game http://cssdeck.com/labs/ping-pong-game-tutorial-with-html5-canvas-and-sounds

// Function to increase speed after every 5 points
function increaseSpd() {
    if(points % 4 == 0) {
        if(Math.abs(ball.vx) < 15) {
            ball.vx += (ball.vx < 0) ? -1 : 1;
            ball.vy += (ball.vy < 0) ? -2 : 2;
        }
    }
}

// Track the position of mouse cursor
function trackPosition(e) {
    mouse.x = e.pageX;
    mouse.y = e.pageY;
}

// Function to update positions, score and everything.
// Basically, the main game logic is defined here
function update() {

    // Update scores
    updateScore();

    // Move the paddles on mouse move
    if(mouse.x && mouse.y) {
        for(var i = 1; i < paddles.length; i++) {
            p = paddles[i];
            p.x = mouse.x - p.w/2;
        }
    }

    // Move the ball
    ball.x += ball.vx;
    ball.y += ball.vy;

    // Collision with paddles
    p1 = paddles[1];
    p2 = paddles[2];

    // If the ball strikes with paddles,
    // invert the y-velocity vector of ball,
    // increment the points, play the collision sound,
    // save collision's position so that sparks can be
    // emitted from that position, set the flag variable,
    // and change the multiplier
    if(collides(ball, p1)) {
        collideAction(ball, p1);
    }

    else if(collides(ball, p2)) {
        collideAction(ball, p2);
    }

    else {
        // Collide with walls, If the ball hits the top/bottom,
        // walls, run gameOver() function
        if(ball.y + ball.r > H) {
            ball.y = H - ball.r;
            gameOver();
        }

        else if(ball.y < 0) {
            ball.y = ball.r;
            gameOver();
        }

        // If ball strikes the vertical walls, invert the
        // x-velocity vector of ball
        if(ball.x + ball.r > W) {
            ball.vx = -ball.vx;
            ball.x = W - ball.r;
        }

        else if(ball.x -ball.r < 0) {
            ball.vx = -ball.vx;
            ball.x = ball.r;
        }
    }

    // If flag is set, push the particles
    if(flag == 1) {
        for(var k = 0; k < particlesCount; k++) {
            particles.push(new createParticles(particlePos.x, particlePos.y, multiplier));
        }
    }

    // Emit particles/sparks
    emitParticles();

    // reset flag
    flag = 0;
}

//Function to check collision between ball and one of
//the paddles
function collides(b, p) {
    if(b.x + ball.r >= p.x && b.x - ball.r <=p.x + p.w) {
        if(b.y >= (p.y - p.h) && p.y > 0){
            paddleHit = 1;
            return true;
        }

        else if(b.y <= p.h && p.y == 0) {
            paddleHit = 2;
            return true;
        }

        else return false;
    }
}

//Do this when collides == true
function collideAction(ball, p) {
    ball.vy = -ball.vy;

    if(paddleHit == 1) {
        ball.y = p.y - p.h;
        particlePos.y = ball.y + ball.r;
        multiplier = -1;
    }

    else if(paddleHit == 2) {
        ball.y = p.h + ball.r;
        particlePos.y = ball.y - ball.r;
        multiplier = 1;
    }

    points++;
    increaseSpd();

    if(collision) {
        if(points > 0)
            collision.pause();

        collision.currentTime = 0;
        collision.play();
    }

    particlePos.x = ball.x;
    flag = 1;
}

// Function for emitting particles
function emitParticles() {
    for(var j = 0; j < particles.length; j++) {
        par = particles[j];

        ctx.beginPath();
        ctx.fillStyle = "white";
        if (par.radius > 0) {
            ctx.arc(par.x, par.y, par.radius, 0, Math.PI*2, false);
        }
        ctx.fill();

        par.x += par.vx;
        par.y += par.vy;

        // Reduce radius so that the particles die after a few seconds
        par.radius = Math.max(par.radius - 0.05, 0.0);

    }
}

sentences:
Algorithm for sensing mouse movements like a wiimote I want to make a driving game where you can do tricks with your mouse when you hold down LMB. Ex. if you move it up in a straight line really fast (your cursor goes from the bottom to the top of the screen in, say, 0.1s),  your bike will do a flip. If you do a quick circular movement, your bike will spin. Essentially, drawing a shape onto the screen = performing a move.
How would this be sensed? Currently, I can only think of having shapes defined by coordinates relative to some starting position (it would be some function taking in your mouse down coords), and within a certain time frame, every update loop will check to see if the current mouse coordinate pair is between the current preset one and the next preset one (and within a margin of error). To know which shape to use, you'd loop through the shape list, see whether or not the mouse coord is invalid for the current shape, and knock it off the possibilities if true.
Example circle path:

X = Coordinate
Red arrows = Expected mouse movement path
Green = Margin of Error

Problems I can see with this algorithm right now:

If I have a lot of moves, then there are a lot of shapes to loop through every frame before the deduction process kicks in
It's not an optimal solution for doing consecutive moves in a short timespan, because the player would have to release LMB before pressing it down again for the system to sense that a new shape is starting
Tiny circles vs big circles, how wide the margin of error would need to be to allow for both, and how that would affect calculations (clashing with other shapes that have similar valid spaces)
What if you draw circles like flattened, diagonally skewed ovals, even when you're not trying to do it fast? It is indeed a circular motion, but maybe diagonally skewed ovals are for another move. Is it okay to just shun your artistic ability?
How much time will it take before the system recognizes that you're doing a specific move? Must a full circle be completed before any bike spinning occurs?

What would be a better algorithm?

sentences:
Smoothly move camera to follow player I'm trying to move my camera with the player but I'm trying to move/lerp over time, so that the camera allows the player to get a small radius from the center as it gets up to speed, and the camera will "catch up" when the player slows or stops.

I've written code that increases the movement speed of the camera the further the player gets - ideally you should only be able to go a set radius before the camera just "follows" you.

This works, except it's too jittery when the player is moving. The larger the distance, the more noticeable the jitter. I've tried different speeds but nothing seems to satisfactorily solve the issue.

Player.cs Update():

var moveHorizontal = player.GetAxis("Move Horizontal") * rigidBody.mass;
var moveVertical = player.GetAxis("Move Vertical") * rigidBody.mass;

var forceDirection = new Vector3(moveHorizontal, 0, moveVertical);

rigidBody.AddForce(forceDirection);

Camera's Follow.cs:

void Awake() {
    offset = transform.position - player.transform.position;
}

void LateUpdate() {
    var dist = Vector3.Distance(transform.position - offset, player.transform.position);

    if (dist != 0) {
        transform.position = Vector3.Lerp(
            transform.position,
            player.transform.position + offset,
            Time.deltaTime * dist * speed);
    }
}

Per the first answer, I've also tried setting my player's rigibody to "Interpolation" mode, and I update my follow script with the suggested smoothing code:

// Compute our exponential smoothing factor.
float blend = 1f - Mathf.Pow(1f - followSharpness, Time.deltaTime * 30f);

transform.position = Vector3.Lerp(
    transform.position,
    player.transform.position + offset,
    blend);

This works initially, but I get awful jitter once my player collides with an object. Plus, interpolation mode appears more susceptible to framerate drops but that's an aspect of my game I haven't worked on yet.

sentences:
Ogre3D Fog with overlays I'm building a game with Ogre3d, I've got fog working properly with:
scenemanager->setFog(Ogre::FOG_LINEAR, Ogre::ColourValue( 0.23f, 0.725f, 1.0f ), 0, 18, 20 );

However I'm currently implementing a GUI system (libRocket) which is rendered on top of everything else, and this removes the fog, does anyone know how to fix this? (I'm using the default libRocket rendering system for ogre as included in the samples, but this problem also appears when using a semi-transparent overlay).

sentences:
How can I make an inventory system in Unity? I am trying to make an inventory system for the game I'm working on with Unity and I want it to expand and compress whenever objects are added or removed.
Is there any go-to way to do this?

sentences:
Overlapping svn repositories We use svn at work, but the repository is getting pretty large, so checkout times are long, as is update when artists batch process all assets.

The problem is that we also store work in progress, prototypes, small tests, legacy stuff and other 'junk'.

Now theoretically, some of it can remain local and uncommitted until it is ready to be included, and a lot could be deleted and cleaned, but that's irrelevant for this question.

Imagine a new asset, a level for example. The artists and designers want it shared and in version control so several of them can work on it, but everybody else does not need it.

Obviously multiple repositories are an answer: one for artists, one for programmers and one for the main project (for testers, building demo versions and finally the main product), which would be really tight and minimal, with everything needed for the game and no more. And then when an asset or some code is 'mature', it can be copied into the main project and committed.

Here's my questions: is it possible to have multiple repositories overlapping so that the artists can have one with everything they need, likewise for programmers. And only when ready commit the same file into the project repository too? This would eliminate bloat of having multiple copies of files and avoid conflicts between repositories.

I know old svn versions stored invisible files in all directories, so it would be impossible, but new svn versions store all meta data in the root directory right? So it might be possible.

I imaging the answer will be 'impossible', or even if possible, yuck! I suppose it would cause all kinds of headaches. Like checking it out in one repository would mean it would need to be committed/deleted in another.

But how about making a svn_commit script, that overrides svn commit with additional checks and housekeeping?

This is just a thought experiment really. I was wondering if anyone has ever done anything like this, and what would be the issues to be resolved.
Cheers

sentences:
Way to Prevent Stacking Pieces I have a chessboard with all the black pieces that move with this code:

I found that when I move the pieces, they will stack on top of each other. How can I prevent this?

I have since changed the code to this:

When I move a piece over another it still picks that piece up, but now it will occasionally completely prevent any stacked pieces from moving. What can I do, and is there a way to do this while still being able to move one piece over top of another?

Also, the pieces origin and collision box ( all similar to the king) look like this:

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:
Android Device Screen Flicker I have made sudoku type game. I am about to complete my game in 2d. At present, my game run smoothly on higher configuration devices such as Sony Experia Sola, Samsung Note 2 and Google Nexus.

But it creates screen flickering problem in my HCL ME tablet. I don't what is problem going on. I notice that when I load prefabs then it start flickering problem. If I don't create any prefab then it don't flicker at all.

At present my development game resolution is 2048x1536. So friends I need support from your side. If you want any more detail then I will provide any time.

sentences: Pygame Tiled Map Object layer collision I'm using pygame to make a top down shooter I've placed my tiles and object layers using Tiled Map Editor. My player and mobs collide with their spawn locations (object layer) is anyone able to help? It's as if the object layers for items, player and enemies are physical so they can't pass through and just walk around.

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:
Touch control pan 3D map I'm working on recreating the board game "Hex" as a mobile game. I'm working on implementing zoom and pan features using two fingers. I feel like I managed to get the zoom to work, but the pan moves more than I want it to and I feel like it is because I'm missing something and must be somewhere in the conversion to World Space coordinates. if I could get some help it would be greatly appreciated.
For reference, oldMidpoint is initialized to 0 earlier on.
        Touch touchA = Input.GetTouch(0);
        Touch touchB = Input.GetTouch(1);

        Vector3 midpoint = (touchA.position + touchB.position) / 2;
        if(midpoint != oldMidpoint)
        {
            if(oldMidpoint == Vector3.zero)
                oldMidpoint = midpoint;

            Vector3 moveDistance = oldMidpoint - midpoint;
            moveDistance.y = 0;

            Camera.main.transform.Translate(moveDistance, Space.World);

            oldMidpoint = midpoint;
        }

sentences:
Soccer Game only with National Team names (country names) what about player names? Ok...this question hasn't been asked before, its very similar to some, but here's the difference:

I am making a soccer/football simulator game, that only has national teams (with no official logos) just the country names and flags.
Now, my doubt is the following...can I use real player names (that play or played on that national team?)

From what I understand if I use a player name linked to a club like Barcelona FC (not a national team) I need the right from the club and the association that club is linked to, right?
But If I am only linking the name just to a country...I might just need the permission of the actual player (that I am using his name) and not any other associations, correct?

Thanks a lot in advance!
Cheers,
Diego.

sentences:
How to do collision resolution with 2d rectangles? I am trying to create a basic side scroll 2D game. There are lots of documentation on collision detection but I find the easiest to use at the moment is just basic AABB Collision. This is my basic outline
Rect old_position = player->rect;
if(key == a) {
    player.x += 5; // move 5 px to right
}
if ... // same for up and left

if(key == s) {
    player.y += 5; // move 5 px down
}

player.y += 4; // move player down, gravity

if(collision_detection(player->rect, rectangle->rect)) { // rect = {x pos, y pos, w idth h eight}
    if(player->rect.y - old_position.y > 0) {
        player->rect.y = rectangle->rect.y - player->rect.h; // if player moved down and collided, move the player to the same pos as object + its own height to get directly above the object.
    } else if(player->rect.y - old_position.y < 0) {
        player->rect.y = rectangle->rect.y + rectangle->rect.h; // move to directly under collided object.
    }
     ...
}

this does not work since if I come from the side, falling down, I get teleported up above the object! There are people who write about things such as roleback / moving back before the collision happened, etc. but there is not straight forward way of doing collision resolution. When I try different methods they might work but I always slide into them if I walk straight into a wall or if I jump and move into a wall in the air while jumping I glitch inside the rectangle, etc, etc.
Does anyone have a blueprint for different 2D collision resolution? I am curious what types there are and what pros and cons there is. The above code is just sample dummy code, so there is no need to critique it. Thanks!

sentences:
Copyright and patents on game design and names? We all know that each game has elements from another game but when does one cross the line of copyright? I have a view particular questions about this since this "line" is very vague.

While looking for a name and Googling it usually return some kind of old or unknown game already with the exact same name. Can i use this name? And what about a name like Diablo, since Diablo is the commonly used name for the devil there cannot be a patent on this afaik. So would a different kind of game named Diablo be allowed?
Let's say i want to make a game of mechs like in Mechwarrior. Obviously the mech designs have copyright, the name as well since i suppose. But am i crossing any rights if i make a top down tactical squad game that include mechs of different designs/names and call it Clash of Steel?

I understand there are not much lawyers here, but how could anyone create a game these days that does not cross the lines of copyright. Like the Mechwarrior example, there are plenty of games nowadays even movies that use this concept. For what it matters Mechwarrior could have ripped the idea from the Gundam anime series. With so many titles coming out each week including the indies it is next to impossible not to infringe into someone copyright.

sentences:
How to perform a fast ray cylinder intersection test? I need an algorithm in c++ to get the intersection point of a line if there is an intersection. My cylinder is defined by a 3d vector center point, a float height and radius. I don't need to take rotation into consideration at all so I don't need any rotation parameters.
The only one found similar to my needs was this: https://github.com/iceman201/RayTracing/blob/master/Ray%20tracing/Cylinder.cpp
but after implementing it gave me wrong results. All the other ones I found used weird arguments that weren't even close to my desire. So I am pretty stuck now.

sentences: Libgdx box2d bodies go through other bodies I'm  developing a game using libGDX and box2d. I am facing a problem that bodies go through each other... I'm moving the body using a TouchPad by setTransform. I think the problem is that I use setTransform.

sentences:
How do I convert DirectX's .X from binary encoding to text encoding and back As far as I know, .X format can be text encoded and binary-encoded.

I basically want to look into the model I'm playing with, get a better understanding of .X, possibly make some changes in it and convert back.

sentences: Is C++ being replaced by C# in industry games? In industry games I mean like Quake, CoD etc.

sentences:
Changing the RotateAround center point dynamically Black circles are static
Red - player
Blue line - path

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

void Update(){

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

}

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

I came up with something like:

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

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

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

sentences:
Dynamically added gameobject didn't show on canvas I have a canvas with a Scroll View in it.

When I manually add a prefab under the Content, it showed up nicely.

But when I add it through the following code, nothing showed up!

GameObject RaceGO = (GameObject)Instantiate(Resources.Load("Race"));
RaceGO.transform.SetParent(Content);

Could somebody please tell me why!?

Much appreciated!

PS. I had checked that the gameobject IS in the content! I just can't see it!

sentences:
Restart a 2D game - OpenGL, GLUT I started learning OpenGL and GLUT by making a snake game. The problem I encountered is that when I press the "new game" in the menu, the window has to be resized so that the content of the window to be updated.

From what I have read, it's because of the MainLoop that's waiting for an event, but I don't know how to fix it. I've tried with glutPostRedisplay, but it doesn't change anything; maybe I'm placing it wrong. Here is the code associated with the restart of the game:

int main( int argc, char** argv ) {
  glutInit( &argc, argv );
  glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB );
  glutInitWindowSize( 800, 600 );
  glutInitWindowPosition( 100, 100 );
  glutCreateWindow( "Aarghhh! O ramaaa !" );
  createMenu();
  glClearColor( 0.0, 0.0, 0.0, 0.0 );
  init();
  glutReshapeFunc( reshape );
  glutDisplayFunc( dreptunghi );
  glutSpecialFunc( player );
  glutMainLoop();
  return 0;
}

void init( void ) {
  glClearColor( 1.0, 1.0, 1.0, 0.0 );
  glMatrixMode( GL_PROJECTION );
  gluOrtho2D( 0.0, 800.0, 0.0, 600.0 );
  glShadeModel( GL_FLAT );
}

void menu( int num ) {
  if ( num == 0 )
    exit( 0 );
  else {
    if ( num == 1 ) {
      menu_value = num;
      snake.clear();
      i = 30.0;
      j = 30.0;
      alpha = 1.0;
      value = -1;
      speed = 3;
      eaten = true;
      collided_food = false;
      collided_self = false;
      createMenu();
      glClearColor( 0.0, 0.0, 0.0, 0.0 );

      init();
      glutDisplayFunc( dreptunghi );
      glutReshapeFunc( reshape );
      glutSpecialFunc( player );
    }
  }
  glutSwapBuffers();
  //glutPostRedisplay();
}

void createMenu( void ) {
  glutCreateMenu( menu );
  glutAddMenuEntry( "New game!", 1 );
  glutAddMenuEntry( "Exit", 0 );
  glutAttachMenu( GLUT_RIGHT_BUTTON );
}

I have also tried to write a function for the display of the menu, that's called using glutIdleFunc, but it didn't solve anything either.

I have ran out of ideas.

sentences:
Why does Unity heavily blur edges of a single cube despite 8x antialisaing I was messing around a random project and everything was working perfectly, when all of a sudden jagged edges appeared on all objects. I've been trying to resolve this issue for the past two dails, only to no avail. I have tried changing various settings, when at last I've uninstalled unity and removed all projects. After re-installing it, however, the problem still persists:

What I've tried:

changing settings in Nvidia Control Panel (for example, settingantialisaing mode to application-controlled)
changing the Quality settings inside Unity
removing any normal/texture maps
changing metallic and smooothness of the material and removing specular highlights
reinstalling Unity

These pictures depict current settings/object properties:

Properties of material added to the cube

Camera properties:

Quality settings:

Graphics settings:

sentences:
Why don't game developers change game stories after launch? Game developers have shown willing to remove and add game features, change art assets and remake parts of their games in following updates, but why don't they ever change the plot? Some times parts are added to the story, but only as attachments, never revisions.

Why is plot thought as a feature beyond editing, even if it would enhance player experience just as much as any graphical update or gameplay tweak?

P.S.: I would like to ask for a game-narrative/writing/story tag, and they are just as important part of game development as game mechanics.

P.S.²: This is as broad a question as why not to release source code. Therefore I think it is not too broad for answering.

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:
Blending textures together, texture fade over / fade in What is the best way to render a texture overlapping effect?

Like in this example:

I want either the grass to fade in to the snow texture, or the other way around. No rough edges. Somehow make them blend over. So the grass has a bit of snow or the snow has a bit of grass How is this possible during runtime? If that's possible.

I don't render this by using the SpriteBatch, since the ground isn't rectangles (they can be moved).

This is the way I render each shape (each one of those squares):

// LoadTexture
// Apply EffectPass

device.DrawUserIndexedPrimitives<VertexPositionNormalTexture>
(
    PrimitiveType.TriangleList,
    render.Item.Points, // Array of VertexPositionNormalTexture
    0,
    render.Item.Points.Length,
    render.Item.Indexes, // Array of int indexes (triangulation)
    0,
    render.Item.Indexes.Length / 3,
    VertexPositionNormalTexture.VertexDeclaration
);

sentences:
Black screen after running emulation mode in the Unity Editor for hololens I am having issues with black screen when running the emulation mode or simulator for Microsoft hololens. In the preview the camera shows what the user should see. I see no obvious reason to behave like this and no error/warning is given. I am using code snippets from the Origami tutorial,except I chose to use RayCastNonAlloc.

Movement.cs
           public class Movement : MonoBehaviour {
        public GameObject person;
        public float seconds;
    private Vector3 point = new Vector3(0,0,0);
    private RaycastHit[] rayHit = new RaycastHit[5];

void OnSelect()
{
    person.transform.position = Vector3.Lerp(person.transform.position, point, seconds * Time.deltaTime);
}

// Update is called once per frame
void Update()
{
    if (Physics.RaycastNonAlloc(Camera.main.transform.position, Camera.main.transform.forward, rayHit, Mathf.Infinity, ~0) > 0)
    {

        foreach (RaycastHit hit in rayHit)
        {

            point.x = Mathf.Clamp(hit.point.x, -290f, 6970f);
            point.y = Mathf.Clamp(hit.point.y, -40f, 1860f);
            point.z = Mathf.Clamp(hit.point.z, -1700f, 140f);
        }
    }

}
}`

Scene.cs

   using UnityEngine; using UnityEngine.XR.WSA.Input; public class Scene : MonoBehaviour

{

public GameObject cursor;
public GameObject Focused { get; private set; }
public Scene Instance { get; private set; }

private GestureRecognizer recognizer;
private MeshRenderer Renderer;
private readonly RaycastHit[] rayHit = new RaycastHit[5];

void Awake()
{
    Instance = this;
    recognizer = new GestureRecognizer();
    recognizer.Tapped += (args) =>
    {
        if (Focused != null)
        {
            Focused.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
        }

    };
    recognizer.StartCapturingGestures();
    Renderer = cursor.GetComponent<MeshRenderer>();
}

void Update()
{
    GameObject oldFocused = Focused;

    if (Physics.RaycastNonAlloc(Camera.main.transform.position,Camera.main.transform.forward,rayHit,Mathf.Infinity,~0)>0)
    {
        Renderer.enabled = true;
        foreach ( RaycastHit hit in rayHit)
        {

            cursor.transform.position = hit.point;
            cursor.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
            Focused = hit.collider.gameObject;
        }
    }

    else
    {
        Focused = null;
        Renderer.enabled = false;
    }
    if (Focused != oldFocused)
    {
        recognizer.CancelGestures();
        recognizer.StartCapturingGestures();
    }
}

}

sentences:
Complex Machine handling through VR controller I have a very Complex Machine which I want to operate through my VR controller (HTC Vive Controller). As you can see its short animated video here. I want to pull the machine cover through VR controller which is easy to do but i want to scale and pull some of the other related objects of the machine too (like spring, piston etc, you can see in the video) as i pull its cover through VR controller.

The problem is that i am unable to do this using Joints and Animation play. I almost tried anything but nothing worked for me. My question how can i imitate animation all work through code or through physics. Like if i pull an object the rest related object should be stretched like chain. And piston should open or closed according to force.

sentences:
SNES development: why bitplanes get scrambled? I am following this tutorial https://georgjz.github.io/snesaa04/. I am stuck on trying to draw a sprite.
Where the end result should be this:

My end result is this:

As I have not been able to find samples of tile and palette files, I am not sure if I have done everything right.
Sprites.vra:
0b 2e 2a 3f 1e 1f 0f 3f 2e 3f 1c 1f 0c ff f3 fe
2f 00 3f 00 1f 00 3c 00 38 00 10 00 00 00 00 00

SpriteColors.pal:
fe 3f 3e 77 f8 5d 0f 49 ff 7f f8 6f 8a 6b 49 62
64 39 e0 2c 60 18 98 04 9f 0e 3e 09 2c 00 00 00

As the tutorial proposes, I use cc65 as a compiler. The files are included like this:
.segment "SPRITEDATA"
SpriteData: .incbin "Sprites.vra"
ColorData:  .incbin "SpriteColors.pal"

As I could not get bsnes working, I am using Snes9X.
As this failed, I tried to draw a plane with just one color as well to figure out the logic. I did not manage, as the colors were always scrambled.
Questions:
How should the tile/bitplane and palette files look like?
What is the checksum error my emulator throws?
As a last note: please be patient if this is basic stuff. I am ex web dev and a retro game hobbyist, and assembly code is completely foreign world to me.

sentences:
How to attach "exiting" event in OpenFL? What is the exiting event (closing app by user or system) in new OpenFL?

And how does it differs between target platforms?

sentences:
2D AI Engines/ Resources? i'm wondering if there's any 2D AI source code or engines out there. I'm inspired by  the Euphoria engine, and want to use whatever is already out there to make something like it in 2D, where the characters can move left and right, and attempt to preserve themselves. The only new feature i would want to add on is ability to learn from common results after an action.

I'm thinking the way it would work is you attach some AI to a character, and it determines movement/detection based on the number of arms, legs, joints, restrictions, and other movement-related body parts.

anything relating to AI would probablly be helpful as i've never worked with it:

How do you guys suggest i get started? (Btw: i'm using box2D/ SFML at the moment)

oh yeah and preferably open source =)

sentences:
How can I detect connected (but logically distinct) bodies of water in a 2D map? I have a 2D hexagonal grid map. Each hex cell has a height value used to determine if it's water or ocean. I'm trying to think of a good way to determine and label bodies of water. Oceans and inland seas are easy (using a flood fill algorithm).

But what about bodies of water like the Mediterranean? Bodies of water that are attached to larger ones (where "seas" and "gulfs" differ only by the size of the opening)?

Here's an example of what I'm trying to detect (the blue body of water in the middle of the image, which should be labelled differently from the larger body of ocean on the left, despite being technically connected):

Any ideas?

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:
Help with a Fast 2D Grid-Based world rendering technique First I'm going to give you my current situation and explain what I'm attempting. I will then pose my question below. I will attempt to include a "TL;DR" for those of you who prefer things to be concise.
OVERVIEW OF CURRENT SETUP:

The current representation of my game world is one where ' Pieces ' of a larger world are represented by three layers of IDs as follows.

//This is being done in C++
struct WorldPiece {
   ivec2 pieceLocation;         //Where ivec2 is a vector containing ints
   short backLayer[PIECE_SIZE]; //Where PIECE_SIZE is the size of the grid this piece contains, ie. for a 32x32 grid, this is 1024
   short middleLayer[PIECE_SIZE];
   short frontLayer[PIECE_SIZE];
};

The world as a whole is then composed of these pieces, which are loaded (and cached as needed) as the player traverses from piece to piece.
I currently have the data side of this all working. I may change the active data set and move around the camera (zoom in and out as well) and watch it all function.
I have also written a tool to support the loading and saving of pieces, and the painting of IDs across the world.
I HAVE THIS DATA:

Each ID within a piece maps to a texture that will be used when that ' cell ' of the piece must be rendered.

QUESTION:

How might I go about rendering each piece in such a way as to do this in as few passes as possible? I could render each cell at a time, but that would be slow. I could generate a list of vertices and indices and create massive VBOs, or sets of quads. Or perhaps there is a better way?
I would prefer to keep the data separate from the rendering and to keep the size of the data as small as possible (so as to have a small as possible load time while the game is running).
If possible, I would like this to be fast enough to render large swaths of tiles, (for example a 3x3 area of 1024 tiles apiece, or more). Since zooming in and out is possible it would be nice to provide this functionality to the player while still maintaining the detail of rendering the world.

If there would be a better setup for the world data to accommodate these requirements, I'm open to suggestions.
SIDE NOTES:

Please do not bring collision/physics, or other game-map-related things into this. I have that worked out and it will not be a bottleneck. I am merely concerned with a best approach to a rendering pipeline where speed is the top concern.
Please do not suggest API X or ENGINE Y. I have looked around quite thoroughly and nothing available would properly provide what I need or integrate with my current codebase.
I will be using a texture atlas.

tl;dr version-  I have a grid based world that streams pieces in as needed, I would like suggestions on a fast way to render these pieces and nothing I have found anywhere has a suitable solution for my current situation.

sentences:
Passing through edges of AABB collision When I move, I grab the tile in front of the player, but when the player is colliding between two tiles, I grab the wrong tile due to rounding error. I made a video explaining what I mean.

As you can see, when the player is moving down on the edge of a tile, they pass through. This is how I find the tile:

Tile t = world.tiles[(int) ((int) getX() / 32 + x)][(int) ((int) getY() / 32 + y)];`

This is my collision detection code:public static boolean isColliding(AABB a, AABB b) {
        if (Math.abs(a.pos.getX() - b.pos.getX()) < a.size + b.size) {
            if (Math.abs(a.pos.getY() - b.pos.getY()) < a.size + b.size) {
                return true;
            }
        }
        return false;
    }
The pos variable in the AABB class is the center of the entity and the size is half the size of the player.

How can I fix this so it finds the correct tile?

Edit:
Ok, I changed my move method to get the tiles around the player, but now the player only collides if he is colliding in the middle of four solid tiles! I don't understand!

private void move(int x, int y, float sx, float sy) {
    Vector2f tempPos = new Vector2f((pos.getX() + (pos.getX() + 32)) / 2, (pos.getY() + (pos.getY() + 32)) / 2);
    box.update(new Vector2f(tempPos.getX() + sx, tempPos.getY() + sy), 16);
    if (getX() / 32 + x > 0 && getX() / 32 + x < world.mx && getY() / 32 + y > 0 && getY() / 32 + y < world.my) {

        for (int xx = 0; xx <= 1; xx++) {
            for (int yy = 0; yy <= 1; yy++) {
                if (world.getTile((int) (getX() / 32) + xx, (int) (getY() / 32) + yy) != null) {
                    Tile t = world.getTile((int) (getX() / 32) + xx, (int) (getY() / 32) + yy);
                    t.color = true;
                    if (t.type != 0 && !Collision.isColliding(box, t.getBox())) {
                        setPos(getX() + sx, getY() + sy);
                    } else if (t.type == 0) {
                        setPos(getX() + sx, getY() + sy);
                    }
                } else {
                    setPos(getX() + sx, getY() + sy);
                }
            }
        }

    } else {
        setPos(getX() + sx, getY() + sy);
    }
    glPushMatrix();
    glTranslatef(getX(), getY(), 0);
    glPopMatrix();
}

The type in Tile is just for checking to see if the tile is air. As you can see, I have two for loops that loop through the four tiles above, below and to the right and left of the player, and see if he collides with any of them. I have no idea why this isn't working, and I've tried to figure out how to do this for a week now. Can anyone show me a link or code to get the tiles around a player and see if he collides with them?

sentences:
Game runs in UE4Editor but not standalone I have just completed these instructions to build and run UE4Editor for Linux.

I created a new C++ project and in the editor I hit the Launch button and after a while it compiled and ran successfully.

If I close down UE4Editor and cd to MyTestProject/Binaries/Linux/ there is a MyTestProject executable, but if I try to run that from the shell I get

error while loading shared libraries: libApexCommonPROFILE.so: cannot open shared object file: No such file or directory

How do I set up the program so that it can be run standalone, not from within the editor?

sentences:
Finite State Machine for player states I have a state machine for a game I am developing. The player can be in four states, depending on button clicks, and some game elements (being in thin air, or standing on the ground). I am just wondering if I should use arrows between all the possible states changes? All states in this diagram need to go through the Idle state, but in the game, you could easily go from Walking to Jumping by pressing the "jump"-button whilst walking. The same applies for the Jump state to the Falling state. After a jump, the player immediately transfers to the Falling state. Is this something I need to put in the finit state machine diagram? The diagram might end up messy with extra arrows, and I would like to avoid it, but if this diagram was meant for a thesis or in lecture I want the diagram to be correct.

I am sorry if this question is too opinion based.

sentences:
OpenGL ES 2 - Developing snowfall particle system I've recently begun OpenGL ES 2 and I'm trying to implement a snowfall (on Android), but I'm not sure what's the best approach. I would like to develop it myself rather than use a library. It really helps a lot in understanding OpenGL.

What I'm doing at the moment is: I have an array of, say, 1000 particles, each with its own lifetime (=number of frames it will live). It works fine if a particle "dies" and starts all over when it already left the screen, but if it is still on the screen and it has to die, the user will notice that the particle suddenly disappeared. The problem is very noticeable if this happens very often. I need a way to kill a particle only when it left the screen.

Is there a way to improve my approach or maybe I should change it completely?

sentences:
Optimize polygons renderization I'm developing a game (in Ogre3D) that, in short, consist in a vehicle that moves along a terrain and leaves a colored trail behind it. The trails are basically quads (a), these quads changes their color accordingly to the vehicle's speed.
My challenge now is that I need to subdivide these quads into 5 (or more) sub-polygons (b) and each one of them should have a different color accordingly to others vehicle's properties. When moving around for a while these quads start to accumulate on screen and the render process starts to heavily lag and thus fps count is sub optimal.

Some considerations:
 - All quads are appended to a single mesh that belongs to a single entity sharing the same material, so batching should be optimal.
- Tried adding LOD for this mesh but I had no luck to make it work in Ogre1.9.

So, my main question is how can I optimize the rendering of this polygons??
Can I delegate this task by somehow to the gpu via shader programming?

Edit: My goal would be to avoid having to draw each one of those sub-quads in (b) (only draw the big quad (a)) but by somehow being able to colorize each  one of those sub-quads.

sentences:
Mobile Multiplayer games and coping with high latency I'm currently researching regarding a design for an online (realtime) mobile multiplayer game.

As such, i'm taking into consideration that latencies (lag) is going to be high (perhaps higher than PC/consoles).

I'd like to know if there are ways to overcome this or minimize the issues of high latency?

The model i'll be using is peer-to-peer (using Photon cloud to broadcast messages to all other players).

How do i deal with a scenario where a message about a local object's state at time t will only get to other players at *t + HUGE_LAG* ?

sentences:
How to smooth the model/texture look from a distance? (First of all, I really didn't know how to title my question so it tells exactly what I mean so if anyone has a better title feel free to edit my question or leave a comment.)

Look at the water in the screen:

See all the annoying white pixels? That's the specular. It looks nice up close:

But when I move the camera away from water it starts to look bad. Actually, the same problem occurs elsewhere (e.g. with grass or rocks) but it's not as bad as with the specular.

I think I know why it looks the way it does but I don't know how to make it look better, more smooth, something like this:

Well, blur helps but blur is an expensive post-process and it's not the way I want to do it.

How can I make it look better, less pixelated and more natural?

Edit: I mentioned that I have the problem with e.g. grass. The grass' shader only uses a texture. The water's shader, however, uses normal mapping and based on the mapped normal it calculates light's specular component.

Update: Following Tording's advice I've used NVIDIA DDS plugin to generate mipmapped normal map DDS file and I've used that instead in my project. Although I'm not sure if I prefer the result to the previous one:

I realize that my normalmap texture and/or my water shading technique might be to blame, though. :P But my point is - using mipmapping might solve my problem (a lot of sharp pixels/noise) but it also introduces new problems.

sentences: Back to front drawing in an Unorginized array of tiles I have an Array of tiles in no particular order. How would I do a isometric back to front rendering on it? Do I HAVE to order it?

sentences:
How to handle player actions in a multithreaded gameserver I'm working on a multiplayer game, and today I implemented basic "spatial hashing" in my entity-component-system.

Before implementing that algorithm, I was sending players actions to all connected players :

public void onPlayerMovement()(auto ref PlayerMovementMessage message, ClientSocket socket)
{
    this.m_gameServer.sendToAll(message);
}

My code is now :

public void onPlayerMovement()(auto ref PlayerMovementMessage message, ClientSocket socket)
{
    auto entity = this.m_gameServer.findEntity(socket);

    auto nearbyEntities = this.m_gameServer.world.getNearbyEntities(entity.get!PositionComponent().bucket)
        .filter!(e => e.hasComponent!PlayerComponent()).array();

    if(nearbyEntities.length)
    {
        this.m_gameServer.sendTo(nearbyEntities, message);
    }
}

As you can see im now calling this.m_gameServer.world.getNearbyEntities() from SpatialHashingSystem.d to get nearby players.

onPlayerMovement function is called by class GameServer.d in a new thread, so it might be called before SpatialHashingSystem.d executes his algorithm,
therefore calling getNearbyEntities() directly returns invalid data.

What can I do at this point ? Event system ? isnt that bad for a real time game ?

Thanks

sentences:
Unity Material Override Video is too dark I have made a TV in Blender, UV Wrapped a material and applied a  video on it in Unity.
But the picture is too dark, and I would like to make it brighter.

How could I solve this problem?

The left one

sentences:
Four (4) color channel png has black "background" I am experimenting with C++ code to load a png file, using libpng.  When I get to the color data in the file, I load it into a std::vector.  I have found that the interface between the C code libpng and my C++ code is straightforward.

I then draw the image using OpenGL.

When the image file is opened in GIMP, it displays as,

When I display the image with my OpenGL code it displays as,

The file I am using is an RGBA image without a backround, i.e., no kBKG chunk.

In looking at the pixel data in my std::vector, it appears that the OpenGL data for the lower right is all RGBA = (0, 0, 0, 0).

I was expecting that the png IDAT chunk would carry and display the transparency information.

In OpenGL I am setting the background to RGBA = (1, 1, 1, 1), i.e., in 8-bit RGBA terms (255, 255, 255, 255), white.

I am obviously missing something, but cannot see what it might be.

sentences:
How do I rotate a sphere so that a position on it comes to a specific location? Sorry for my english. I added a picture to explain what i want.
I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position)
not black point moving, whole sphere moving.

or is it better to move camera to black point?

which API should i use?

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:
Unity game debugging on Xcode This question has two parts:

1. How to get meaningful information out of Xcode crash logs? The game runs fine on the editor but when running on an iOS device it crashes and then gives information like this:

How can I dig out which script actually causes this?

2. Which Xcode debugging tools are available for Unity games? There are plenty of them mentioned here. Especially the frame capture and Instruments profiling seem very handy.

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:
Libgdx SpriteBatch won't position correctly on Screen I have been trying to position my spritebatch correctly regardless of screen size but it simply wont scale..This is what I want to achieve on every screen size..I want my Sprite Object to be positioned at the center of the x-axis on every screen size and on the first half of the screen (above dotted line) and have it scale as well..I have also noticed that spritebatch doesn't respect my gameheight and gamewidth instead opting for screenwidth and screenheight. The dimensions for my sprite anim are 900 by 700 and I am hoping it can scale for lower resolutions

Code :

batch.draw(animation.getKeyFrame(elapsedTime, true), 20, app.midPointY + 350, app.screenWidth, 465);

sentences:
How to create a delay/timer and fire an action once it expires in C# Monogame? First off I'm somewhat new to C# but I'm working on a game in C# Monogame and I'm trying to get timers working. There was a similar question answered around here a while back but I found that the solution doesn't work for me, perhaps an older version or I'm missing something, so I wrote similar timer and timer manager classes myself.

I ended up with a wait(time) function (that seems to work from looking through the debugger but not sure) now I'm wondering how can I get an action to be executed when the timer created by that expires.

Ideally I'd like something like

timerManager.Wait(10)
{
    //do stuff once done waiting
}

Here's my timer classes - Timer.cs and TimerManager.cs

TimerManager gets instantiated in my player class and wait is called in the update function by keyboard input.

if(keyState.IsKeyDown(Keys.Space))
{
    if(canJump)
    {
        vAccel = jumpSpeed * -1;
        stripManager.setCurrentAction(PlayerActions.jump);
        timerManager.Wait(1);
    }
}

So my question is how can I get an action to trigger, ideally with a set of {} as shown above. I'm aiming to having a class I can reuse for any sort of delay I need in my game.

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:
How do I get the 3d coordinates of my model Instance? [LibGDX] I want to get the 3d coordinates (as a Vector3) from my model Instances.
with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-axis (and moving at the same time) and I want to get its coordinates each frame.
I'm using a little class created by @Xoppa :

public static class GameObject extends ModelInstance {
    public Vector3 center = new Vector3();
    public Vector3 dimensions = new Vector3();
    public float radius;

    public BoundingBox bounds = new BoundingBox();

    public GameObject (Model model, String rootNode, boolean mergeTransform) {
        super(model, rootNode, mergeTransform);
        calculateBoundingBox(bounds);
        bounds.getCenter(center);
        bounds.getDimensions(dimensions);
        radius = dimensions.len() / 2f;
    }
}

and here's my code:

public void render(float delta) {
    super.render(delta);
    if (loading && manager.update()) {
        doneLoading();
    }

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    batch.begin();
    backgroundSprite.draw(batch);
    batch.end();

    for(GameObject instance : instances){
        instance.transform.rotate(new Vector3(0, 1, 0), 0.5f);
        float x = instance.bounds.getCenterX();
        float y = instance.bounds.getCenterY();
        float z = instance.bounds.getCenterZ();
        System.out.println(x+" "+y+" "+z);
        if(isVisible(cam, instance)){
            modelBatch.begin(cam);
            modelBatch.render(instance, environment);
            modelBatch.end();
        }
    }
}

Please help, there's no function "getPosition" or sth like that, it's all about Matrix4 and I have never had a math course about it. I'm stuck.

sentences:
Floor is moving faster than ball above it , and it causes ball to fall off the map. UE4 I am creating a game ( following Udemy lesson on Marble run) which is basically a maze and ball and we move ball my rotating floor on x or y axis through obstacles .
Floor movement is linked on Mouse values.
BP

My problem is if I move my mouse too fast ball comes below floor and drops.
I know there could be multiple hacks to solve this . but I am looking for best solution ( professional solution) I am a newbie so please bear with me :)
Below is screenshot of ball below maze

sentences: Does it make sense for a view matrix to have a scale? When building a view matrix from an SRT matrix multiply, examples (here and here) only ever compose it with a R and T. Does it make sense to have the S component be anything other than the identity? What does it mean to scale the view matrix anyway?

sentences:
Pathfinding and BSP with Box2D I'm looking into implementing AI in my 2D side-scrolling platformer, and I'm looking into using algorithms such as A*. For many kinds of pathfinding, we need some sort of grid or systems of nodes or polygon areas. My problem is that I am using Box2d for physics and I am not sure how best to create a structure that my AI can use besides placing individual nodes manually (something I really want to avoid) and using some sort of steering behavior.

My level design is tile-based with each tile being about half of the height/width of my main character. The tiles are not all square (some are sloped). I'd like to have a system that can see what the terrain looks like for pathfinding and also keep track of the positions of other actors such as enemies. I'd like to avoid directly placing any nodes into my level design except for possible endpoints or goals.

This question is related: How do you do AI path following within a 2d physics engine like farseer/box2d?, but it doesn't specify what kind of structure I could use instead of a list of nodes. I'm looking for some kind of grid or type of BSP that I can query for algorithms like A*.

EDIT: I am looking for a data structure that meets the following requirements:

Can be searched by algorithms like A*
Can keep track of objects that move around
Can keep track of objects of different shapes and sizes
Does not require me to manually create paths or place nodes

When I first load my level, I have a 2D array (actually just a width, height, and string of ints), but this doesn't allow me to track objects that move not to mention other shortcomings.

sentences: Defining a projectiles speed and angle before Instantiating I have a 360 degrees shooter object and a projectile to shoot. My projectile has a Rigidbody2D with zero gravity scale. I want it to bounce off of colliders when it gets hit, but when I instantiate it from my shooter I have to write the velocity value in update so it keeps going against the colliders when shot. I figured that I should assign it a velocity in start function, but then it only goes in one direction. How do I fix this?

sentences: FPS Collision detection and movement How is collision detection and movement typically handled in a FPS, particularly handling slight changes in ground height such as stairs (both on incline and decline)?

sentences:
How to give a certain scene different preference settings then other scenes unity In my unity game that I am creating there are 4 scenes. 3 of those scenes rely on a backdrop because they are the main menu, death screen and the escape screen(for when you escape the place). Therefore they need a high resolution image. However, the other scene (the main game scene) is incredibly laggy when the quality setting for the texture quality isn't "eighth res". How can I make it so that the texture quality for only my game scene is eighth res and the rest is normal res? This might help: my build order value is the main menu is 0, my game is 1, my death scene is 2 and my escape scene is 3.
thanks in advance

sentences:
"Compose PSM Master Package" doesn't do anything I made a game for PlayStation Mobile, and I'm ready to build the master for publishing.

Per the mastering instructions, I have filled out all the required information in app.xml, created app keys for this specific application, and built on Release.

And now that I click on "Compose PSM Master Package", the PSM Studio pretty much does nothing. I have .psdp and .pspp files in the Release folder, but I don't get a .psmp file for submission.

I think all my account information is okay, including bank account information.

I also tried deleting and recreating the app keys, but "Compose PSM Master Package" still refuses to do anything.

What am I missing? What kind of interaction should I expect from "Compose PSM Master Package"?

sentences:
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:
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:
Physics Object on Client moving too quickly in comparison to the Server: Should be a copy I have a client server scenario. On the Server a force is applied to a 2d object. I want the client to copy the movements of the server but not through constant positional updates. My current approach is to send the objects name, position and speed to the client for the client to apply those to its own object and therefore copy the server. The speed is calculated by subtracting the last known position from the current one and working out the magnitude:

physicsManagerScript.SendInfo (transform.name, transform.GetComponent<Rigidbody2D>().position, (transform.GetComponent<Rigidbody2D>().position-lastPos).magnitude);

The position and speed are received via RPC and each go into a list on the client and then the client object applies these via Vector3.MoveTowards:

transform.position = Vector3.MoveTowards (transform.position, receivedPos [index], receivedSpeed [index]/Time.deltaTime);

My problem is that even though the same magnitude is applied on the client as the server, the clients object moves very quickly in comparison to its server counterpart. The server object bounces around and eventually slows, however when it is moving slowly the client object flashes to its new position. I dont understand why this is happening when it should be moving at the same speed as the server object. Any help would be greatly appreciated.

**Additional Info

I have an invokerepeating method on the server that every second sends the name, position and magnitude to a physics manager script. This physics manager script then RPC's the client sending the correct position and magnitude to the correct name of object. The client object places the received position and magnitude into seperate lists. Vector3.MoveTowards is then used to move the client object to its new position at a new speed. However the speed it moves at is very quick in comparison to the server, when i want it to copy the server. This is for a distributed physics project, ie the server handles the physics and sends down the appropriate info without the client using any physics.

sentences:
Improving the efficiency of frustum culling I've got some code which performs frustum culling. However, this defines the "frustum" way too broadly- when I have ~10 objects on screen, the code returns 42 objects to be rendered. I've tried taking "slices" through the frustum to attempt to increase the accuracy of the technique, but it doesn't seem to have made much impact. I also significantly reduced the far plane, so that the objects are barely at the edge. Here's my code (where size is the size in screen space- the resolution of the client area of the window I'm rendering into). Any suggestions?

    auto&& size = GetDimensions();
    D3DVIEWPORT9 vp = { 0, 0, size.x, size.y, 0, 1 };
    D3DCALL(device->SetViewport(&vp));
    static const int slices = 10;
    std::vector<Object*> result;
    for(int i = 0; i < slices; i++) {
        D3DXVECTOR3 WorldSpaceFrustumPoints[8] = {
            D3DXVECTOR3(0, size.y,      static_cast<float>(i) / slices),
            D3DXVECTOR3(size.x, 0,      static_cast<float>(i) / slices),
            D3DXVECTOR3(size.x, size.y, static_cast<float>(i) / slices),
            D3DXVECTOR3(0, 0,           static_cast<float>(i) / slices),
            D3DXVECTOR3(0, 0,           static_cast<float>(i + 1) / slices),
            D3DXVECTOR3(size.x, 0,      static_cast<float>(i + 1) / slices),
            D3DXVECTOR3(size.x, size.y, static_cast<float>(i + 1) / slices),
            D3DXVECTOR3(0, size.y,      static_cast<float>(i + 1) / slices)
        };

        D3DXMATRIXA16 Identity;
        D3DXMatrixIdentity(&Identity);
        D3DXVec3UnprojectArray(
            WorldSpaceFrustumPoints,
            sizeof(D3DXVECTOR3),
            WorldSpaceFrustumPoints,
            sizeof(D3DXVECTOR3),
            &vp,
            &Projection,
            &View,
            &Identity,
            8
        );
        Math::AABB Frustum;

        auto world_begin = std::begin(WorldSpaceFrustumPoints);
        auto world_end = std::end(WorldSpaceFrustumPoints);
        auto world_initial = WorldSpaceFrustumPoints[0];
        Frustum.BottomLeftClosest.x = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.x < rhs.x ? lhs : rhs; }).x;
        Frustum.BottomLeftClosest.y = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.y < rhs.y ? lhs : rhs; }).y;
        Frustum.BottomLeftClosest.z = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.z < rhs.z ? lhs : rhs; }).z;
        Frustum.TopRightFurthest.x = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.x > rhs.x ? lhs : rhs; }).x;
        Frustum.TopRightFurthest.y = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.y > rhs.y ? lhs : rhs; }).y;
        Frustum.TopRightFurthest.z = std::accumulate(world_begin, world_end, world_initial, [](D3DXVECTOR3 lhs, D3DXVECTOR3 rhs) { return lhs.z > rhs.z ? lhs : rhs; }).z;
        auto slices_result = ObjectTree.collision(Frustum);
        result.insert(result.end(), slices_result.begin(), slices_result.end());
    }
    return result;

sentences:
Welcoming new players to an MMO game with veteran players who have amassed lots of wealth One of the main problems in the game Knight Online has been that the servers that have been open for a long time have users with a lot of items.

If I want to join as a new player, it is not logical for me to play the game in those servers because there is no way that I can catch up with the players there (unless I buy a lot of item with real money). Because, in order to obtain "good" items, you have to be in the regions of the game where you will fight with other users, so as a newbie, there is no chance that you can compete with those users.

For example, there is a trend in KO: a new server opens, after ~two years people get quite strong and almost no new user joins the server, and then those strong users just gain more and more items and sell them. Then the server dies practically, with no new blood joining it and old users eventually leaving.

What is a strategy I can use in my MMO to regulate the wealth distribution, or keep it accessible to new players, even when other players have been accumulating wealth for a long time?

sentences:
Why does collision only work when keys are being pressed? My player object containing a rigidbody that is controlled using Input, is not colliding with an enemy unless keys are pressed. When no keys are pressed, the enemy simply goes through the player without collision. I'm using Unity 5.6.1f1.

I figured the problem is in the Patrol class because when I don't attach the script to the enemy object the collision appears to take place fine.
But I don't know what I'm doing wrong in this script because I seems to do it's task well. I wrote this script to make the enemy object move between points in patrolPoints which are just some empty's in the game world.

So, I would like to know if I'm doing it right or is there another way to do it.

Patrol.cs

public class Patrol : MonoBehaviour {
    public Transform[] patrolPoints;
    public float speed;
    private int currentPoint;
    private bool forward;

    // Use this for initialization
    void Start () {
        transform.position = patrolPoints [0].position;
        currentPoint = 0;
        forward = true;
    }

    // Update is called once per frame
    void Update () {
        if (transform.position == patrolPoints [currentPoint].position) {
            if (currentPoint < patrolPoints.Length - 1 && forward) {
                currentPoint++;
            } else {
                currentPoint--;
                forward = false;
            }

            if (currentPoint == 0)
                forward = true;
        }

        transform.position = Vector3.MoveTowards (transform.position,
            patrolPoints [currentPoint].position, speed * Time.deltaTime);
    }
}

sentences:
How do I fairly distribute new powerful cards to players in a collectible card game? I'm writing a game in which users start with a few cards. They use those cards to play against other players. The winner can steal a card from the other player.

The aim is to get more/different/rare/higher-powered cards.

If everyone starts with 10 low-powered cards, how would anyone ever get higher powered cards? They'd just be playing against people who have the same type of cards as them.

How do you fairly distribute these more powerful cards among players?

sentences:
Huge 2d pixelized world I would like to make a game field in a indie-strategic 2d game to be some a-like this popular picture.

So every "pixel"(blocks) changes it's color slowly, sometimes a bright color wave happens, etc, but the spaces beetwen this pixels should stay dark (not to count shades, lightning and other 3rd party stuff going on). Units are going to be same "pixelized" and should position them-selfs according those blocks.

I have some experience in game-developing, but this task seems not trivial for me. What approaches (shader, tons of sprites or code-render, i don't now) would you recommend me to follow?
(I'm thinking of making this game using Unity Engine)
Thanks everyone! :)

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:
Server Side Speed Hack Detection Techniques I have a client side speed hack detection that initiates a timer on both the client and server on connection. When the difference becomes too much the client gets detected as using speed hack.

But I have one problem, they found a way to run a speed hack program and close it but keeping the speed hack activated on the game client (odd) which made the counter on the client run normally even with speed hack enabled.

So I added detection to the server by using the movement packets and checking the time difference between 2 different movement packets come in. The design was okay, it did detect the speed hack by checking that the difference is not less than 50ms but when someone was lagging (queued movement packets) it also detected it as speed hack.

So I improved this by considering a factor of how fast it would process each packet that arrived in bulk which means microseconds. Now I adjusted the detection to less than 50ms but greater than 1ms. This was better it didn't detect lagging too much but it still did.

Now my problem is how can I implement this in a way that I can still check how fast the packets are coming in but not detect the people that are experiencing lag falsely. Or should I just keep adjusting the parameters for detection until I get to the sweet spot?

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:
What resources are available to read and share pyglet code? I am a Python programmer (I know the ins and outs decently well), and I have dabbled with Pygame. I want to make 3D applications and games, and so naturally I've been looking at OpenGL.

pyglet uses OpenGL, and the programming website and documentation is up there with the best I've seen as far as libraries and APIs go.

Is there a place on the net where other pyglet programmers go to share projects and source code, like there is for Pygame?

I would love to see how other people are combining game logic and OpenGL graphical code to create a simple game (it really helps the learning process).

sentences:
Multithreaded Game Loop I'm trying to implement a multithreaded game loop. I already did that but had to use a few locks for that, which ruined the performance. After researching a bit I came up with this idea:

Instead of splitting the engines subsystems into different threads (e.g. physics, animation), all subsystems run on all threads. So when we got four CPUs, four threads are created, with each thread having one loop for all subsystems. So the single-core game loop is copied on all four threads.
These game loops are controlled by one other loop, which sends messages (or 'jobs', 'tasks') to one of these threads (depending on their usage) according to user-input or scripts. This could be done with a double buffered command buffer.

Only the rendering loop is alone in a thread for maximum rendering performance.
Now I'm thinking of the best way to communicate with the rendering loop. The best idea I could come up with is to again use a command buffer and swap it when the rendering loop is complete. That way the rendering loop doesn't have to wait for any of the loops and can go on rendering. If the game loop hasn't finished when the rendering loop swapped the buffer, all commands after that will be executed in the next frame of the rendering loop. To make sure that all objects will be drawn even if the game loop hasn't finished, the rendering loop holds all objects that will be drawn and draws them until it gets the command to stop drawing them.

My goal is to make the engine scalable to cpu numbers and make it to use all cores. Is this a way to do that? What is the best approach to this and how are modern engines handling this?

sentences:
Setting object O2 to have the same geometric relation to P2 as O1 has to P1 I'm trying to place Object O2 with the same relation to P2 that O1 has to P1, like shown in the picture below.

This is a problem that I'm facing trying to implement portals in Unreal Engine 4, where:

O1 is the player camera
P1 is a portal
O2 is a second camera, used to render the scene from the perspective of the other portal
P2 is the portal linked to P1

// Get the player position in relation to this portal and project it in relation to the linked portal
FMatrix NewCameraWorldMatrix = LinkedPortal->GetTransform().ToMatrixWithScale() * GetTransform().ToMatrixWithScale().Inverse() * PlayerCamera->GetComponentTransform().ToMatrixWithScale();
FTransform NewCameraWorldTransform = FTransform(NewCameraWorldMatrix);
PortalCameraAnchor->SetWorldLocationAndRotation(NewCameraWorldTransform.GetTranslation(), NewCameraWorldTransform.GetRotation());

However, the above code is not solving the problem I presented and I can't figure out why.
Any ideas on what may be the issue?
Note: I've wrapped the PortalCamera with an Anchor since the PortalCamera must have a specific relative orientation at all times and using SetWorldLocationAndRotation directly on it would mess up its rotation.
Note: I have these logs (one per portal) which might be useful:
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [-1 2.38419e-07 0 -0] [-2.38419e-07 -1 0 0] [0 -0 1 -0] [-1410 1570 -420 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [1 0 0 0] [0 1 0 0] [0 0 1 0] [820 -1410 420.238 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791793 -0.214042 0] [-0.810578 -0.585631 -5.10315e-08 0] [-0.125349 0.173497 0.976825 0] [767.052 3445.01 -144.706 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.052 Y=3445.011 Z=-144.706
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848404 Y=0.048997864 Z=0.885227978 W=0.452530354
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [1 -0 0 -0] [-0 1 -0 0] [0 -0 1 -0] [-820 1410 -420.238 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [-1 -2.38419e-07 0 0] [2.38419e-07 -1 0 0] [0 0 1 0] [-1410 1570 420 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791792 -0.214041 0] [-0.810577 -0.585631 5.10314e-08 0] [-0.125349 0.173497 0.976825 0] [767.11 3444.93 -145.171 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.110 Y=3444.927 Z=-145.171
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848396 Y=0.048997886 Z=0.885228097 W=0.452530175
LogTemp: Warning: ---------------------------------------------------------------------------------------

sentences:
Is multitexturing really just "using more than one texture"? This might seem stupid, but it bugs me. From what I understand, multitexturing is just using more than 1 texture per shader (usually to blend them somehow). So instead of creating 1 texture, I create 2 or more which is... pretty obvious!

Why is there a special term for that? Is there more to it than just "using more than 1 texture"? Am I missing something?

sentences:
Scrolling a WriteableBitmap I need to simulate my background scrolling but I want to avoid moving my actual image control. Instead, I'd like to use a WriteableBitmap and use a blitting method. What would be the way to simulate an image scrolling upwards? I've tried various things buy I can't seem to get my head around the logic:

 //X pos, Y pos, width, height
 Rect src = new Rect(0, scrollSpeed , 480, height);
 Rect dest = new Rect(0, 700 - scrollSpeed , 480, height);

 //destination rect, source WriteableBitmap, source Rect, blend mode
 wb.Blit(destRect, wbSource, srcRect, BlendMode.None);
 scrollSpeed += 5;

 if (scrollSpeed > 700) scrollSpeed  = 0;

If height is 10, the image is quite fuzzy and moreso if the height is 1. If the height is a taller, the image is clearer, but it only seems to do a one to one copy. How can I 'scroll' the image so that it looks like it's moving up in a continuous loop? (The height of the screen is 700).

sentences:
Fast fullscreen quad rendering in Direct3D 11? For the last few weeks, I've been trying to port a DX9 implementation of HDR rendering (tone mapping, bloom, stars, etc.) over to DX11. I believe I've got all features working but I'm not getting good enough performance. I'd like to be able to render the whole effect in under 4ms on a fairly low-powered GPU, but using D3D11 Queries I'm noticing that it takes 0.5ms to just render a fullscreen quad with a solid color, and 1.0ms to render a fullscreen texture! And because tone-mapping is the only part of the effect that uses a fullscreen texture, this makes it the most expensive!

I'm already doing some optimisations with my limited graphics knowledge, I've disabled blending and depth-testing, I make sure that the texture sampler uses sensible filtering settings, and I'm pretty sure that the effects of any state-changes are negligible. I've heard that rendering 1 oversized triangle instead of 2 can yield some improvements, but I'm not sure if that will help me in this situation. Basically, does anyone have any suggestions to speed up rendering of a textured quad?

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:
Can't set object's local rotation like rotating from gizmo in the scene Here, I have a plane model with some sub parts(like aileron) can rotate:

That red section is weight painted(rigged) vertices, and I need to control the rotation of this in Unity by script.

So this is the image in Unity, rotating through green ring(along x axis) of aileron bone from gizmo works exactly I want.

However as you can see in the inspector, I rotated along X axis but it doesn't changed only x axis, it also changed other axis like Y and Z.

So when I just rotate X rotation of aileron from the script or inspector, it gives me total wrong rotation, and here is the solution I got: How to rotate object just like in the scene?

So I wrote the code:

leftAileron.Rotate(0, value, 0);

Now it rotates desired angle but the problem is transform.Rotate method is just rotating the object, means adding the new value to current rotation.

In my case, I need to "set" the rotation, not adding it, because it gives wrong rotation in this case.

I made a slider for explain and demonstrate my problem: here is the slide and it's range is -5 to 5 and default is 0.

The code for rotating aileron is this:

sliderLeftAileron.onValueChanged.AddListener((value) => {
    leftAileron.Rotate(0, value, 0);
});

When I moved slide to left, value goes negative so it rotates like this.

But when I slightly moved the slide to right, it still rotate same direction because the value is still negative and just try to adding it.

So I need to set the rotation of aileron, not adding it, moving slide to right should moves opposite direction and vise versa.

Is there a way to set rotation just like Rotate(0, value, 0) but not adding it in this case, like this:

transform.rotation = Quaternion.Euler(0, value, 0);

I tried bunch of ways but none of them worked, how do I treat my aileron rotation just like in gizmo in the scene?

sentences:
Timing Calculations for Opengl ES 2.0 draw calls I am drawing a cube in OpenGL ES 2.0 in Linux.
I am calculating the time taken for each frame  using below function

#define NANO 1000000000

#define NANO_TO_MICRO(x) ((x)/1000)

uint64_t getTick()
{
  struct timespec stCT;
  clock_gettime(CLOCK_MONOTONIC, &stCT);
  uint64_t iCurrTimeNano = (1000000000 * stCT.tv_sec + stCT.tv_nsec); // in Nano Secs
  uint64_t iCurrTimeMicro = NANO_TO_MICRO(iCurrTimeNano); // in Micro Secs

  return iCurrTimeMicro;
}

I am running my code for 100 frames with simple x-axis rotation.
I am getting around 200 to 220 microsecs per frame.

that means am i getting around (1/220microsec = 4545) FPS
Is my GPU is that fast?
I strongly doubt this result.

what went wrong in the code?

sentences:
Fixed timestep on the server without hogging CPU? It sounds backwards, but it's the situation I'm currently trying to solve on my dedicated server.

Everything I've read about fixed timestep assumed it was on a client, where you're already running in a loop as fast as you can to render the game, and you are just inserting the fixed timestep updates within that.

Problem is, on the server, that's the only thing being done in the loop, aside from checking for network activity. So my server ends up using 100% CPU, looping needlessly while waiting for the next fixed timestep.

The only way I know to fix this is by adding a sleep to the loop, but I know how inaccurate that delay can be, which would throw off the accuracy of the timesteps.

Is there a better way to keep it from burning CPU? Or is sleep what most dedicated servers are doing anyway?

sentences:
How should I implement lag compensation in my racing game? I've looked around and I see a lot of discussion about lag compensation for FPS's, but none for racing games.

I know Mario Kart uses some sort of interpolation for other racers, but it doesn't provide very smooth results a lot of the times, when the simulated kart goes way off course and then teleports back on track with the next server update. I think games like Forza also use interpolation, but the cars in games like that move a lot more predictably, so it doesn't seem noticeable.

If I'm going for a game with the same type of chaotic movement that of Mario Kart, will I just have to accept that there will be sudden visible teleporting when a player has a bad connection to the server?

sentences:
Google Cardboard XR Settings Is there a way to access settings for Google XR Cardboard? I've got a project straight from Google Cardboard for Unity with examples. After building it and running on a phone it shows X and Gear icons in corners of the screen. X exits the application, Gear shows some settings. Can I modify these settings?
Loading up the package creates XR Settings scriptable object, which has nothing in it. I think maybe I should extend the class, fill it with custom settings (by some key that will be then recognized by Google XR) and replace instance of generic XR Settings with my custom ones?

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:
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:
Load state / continue game based on user input I'm working on a rather simple 2D game, with a pretty small set of values that will need to be preserved for a user to pick up where they left off last time they played.

Rather than saving/loading the state of the game for users to leave/return, I'm considering something akin to what MegaMan did, where a user enters a "password" to resume from their previous state, like so:

How is something like this generally implemented? My two thoughts were

Build list of all valid passwords and their corresponding states. Reject anything not on the list, and load the corresponding state when correct input is received.
Represent the state as a binary string, and make that the password. If the user's input parses validly, assume it to be valid and set it to the state.

What are the concerns with each of these approaches, and is there another way to go about this that I've overlooked?

Note: If this question is tagged poorly, it's because this is my first question on gamedev.stackexchange, and I'm not yet familiar with the ta

sentences:
How to reduce color space in a post-processing material in Unreal Engine 4 I'm trying to get an old-school Quake 1 look going in UE4.

I am currently using this blueprint in order to get a retro style large pixel filter.

In game (might need to zoom in to see the difference):

The look I am going for now is a low color depth (8 bit etc) that old games such as Quake had. Here is a picture for reference.

Is there any way I can reduce the color space through either a post-processing volume itself or a post-processing material?

sentences:
Picking a suitable resolution for a modern low-res game? I'm working on a 2D game project right now (using SFML+OpenGL and C++) and I'm trying to figure out how to go about choosing a resolution. I want my game to have a pixel resolution that is around that of classic '16bit' era consoles like the Super Nintendo or Neo Geo. However, I'd also like to have my game fit the 16:9 aspect ratio that most modern PC monitors use. Finally I'd like to be able to include an option for running full screen.

I know that I could create my own low-res 16:9 resolution that is more-or-less around the size of SNES or NeoGeo games. However, the problem seems to be that doing so would leave me with a non-standard resolution that my monitor would not be able to support in fullscreen mode.

For example, if i divide the common 16:9 resolution 1920x1080 by 4, I would get a 16:9 resolution that is relatively close to the resolution used by 16bit era games; 480x270.
That would be fine in a windowed mode, but I don't think that it would be supported in fullscreen mode.

How can I choose a resolution that suits my needs? Can I use something like 480x270? If so, how would I go about getting fullscreen mode to work with such a non-standard resolution? (I'm guessing OpenGL/SFML might have a way of up-scaling...but..)

sentences: What is XNA's GameTime used for? I'm developing a game using fixed time step, and so far I haven't been using XNA's GameTime class in my code.  What uses does the class have, and should I definitely use it in my game, or can I ignore it?

sentences: 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:
How to break the feeling of busywork in a game I don't know if this topic has been explored before but in a handful of games I've played there comes a point where trying to explore everything, doing sidequests, or even trying to get gear starts feeling like busywork. That sort of feeling makes me less interested in the game, and I usually wind up either just stopping playing altogether or just breezing through the rest of the game just to get it finished and out of the way. This feeling seems to happen mostly with RPGs from my own personal experiences.

How do you prevent activities the player can do (sidequests, exploration, item crafting, etc.) from feeling like artificial time padding or busywork?

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:
(Unity) Spawning AI cars - weighted to ahead of camera? I'm working on a little project where I drive around a small city with a top-down but slightly angled camera view (like GTA Chinatown Wars). Cars are instantiated from spawners that aren't in camera view, then destroy if they drive too far from the player.
To spawn a new car, I loop through all my spawner gameobjects and if they are within a certain distance to the player (and not in view of the camera), then they get added to a 'spawner' list, of which I pick a random.
The loop is something like this;
float dist = Vector3.Distance(player.transform.position, spawner.transform.position);
Vector3 screenPos = Camera.main.WorldToViewportPoint(spawner.transform.position);
bool inView = screenPos.z > 0 && screenPos.x > 0 && screenPos.x < 1 && screenPos.y > 0 && screenPos.y < 1;
if (!inView && dist < 15) { list.Add(spawner); }

This works, but I find that when I'm driving around barely any traffic spawns on roads ahead of me, maybe because the camera angle is removing a chunk of the possibility area.
Is there anyway to 'weight' it so spawners in the direction the camera (or beyond) have more chance of being picked, rather than ones behind me? In games like GTA Chinatown Wars you will be driving through rows of traffic, and I'm trying to get more density.

sentences: Should I Have a Ridiculously Easy First Level? I am making a game based on a grid and filling in certain squares with certain colors according to some rules. It is level-based, and the difficulty of a level is determined by the size of the grid and how many colors you have to fill in. Should the first level be ridiculously easy to allow players to get used to the UI?

sentences:
Font rendering, how do you align glyphs of a font? I'm trying to render text quad using texture generate by BitmapFontWriter of libgdx.
For the font I can get size, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, LineHeight, CapHeight, Baseline, Ascent, Descent.

For each glyph I can get u, v, width, height, x offset, y offset, x advance

The chars rendered are OPQZ[\\]^_`abcdefg你好,. If I just render the quad. I get:

Q, g and the `are definitely incorrect. The brackets and notdef are a little large.
The only thing that I find meaningful for me is y offset. If I shift the quad with it, I get:

Q is not changed at all. g gets slightly better. Lots of them get worse.

sentences:
"Unclutter" units in RTS game For intentional reasons, certain units in the game I'm currently programming don't have any collision detection and response among each other.

This enables them to clutter right on top of each other. This is a wanted behavior, since there will be situations in the game when the player does want them to stack like that.

However, I want to make the process of uncluttering them easy for the player, so that they just have to press a hotkey or click some button on the screen and have the units disperse just enough so it's easy to select a group of them with the mouse (if they stand on top of each other one mouseclick selects all units).

How could I do this without running a brute force N^2 nearest neighbor search on all units?

sentences:
Shortcut for empty with collider How to add shortcut key to add new empty already with a box/circle collider ?

If possible, it would be nice that empties are enumerated.

sentences:
Platforms collide-able on one side only I have frequently tried to make some sort of a platformer, but when I actually code it, I run into a bit of a snag. How would I be able to make platforms in the air stop objects if they hit the sides or bottom, but allow them to sit on top of them?

I have tried many different methods, and some work slightly, but have many bugs, or some don't even work at all. Like this one I tried made it so that if you hit the side of the platform at the right angle, it forced you up on top of it.

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:
How should I parse user input in a text adventure game? Parsing user commands in a text adventure is a spectrum from Adventure's simple "go north" to some mind-bogglingly clever ones in hhgttg.

I seem to remember reading nice how-tos in computer magazines back in the 80s, but now I find almost nothing on the 'net except a brief Wikipedia ref.

How would you do it?

Update: I went with the simplest approach possible in my Ludum Dare entry.

sentences:
Ways to "invert Z-axis" in shader-based core-profile OpenGL? In my hobbyist shader-based (non-FFP) GL (3.2+ core) "engine", everything in world-space and model-space is by design "left-handed" (and to stay that way), so X-axis goes from -1 ("left") to 1 ("right"), Y from -1 ("bottom") to 1 ("top") and Z from -1 ("near") to 1 ("far").

Now, by default in OpenGL the NDC-space works the same but the clip space doesn't, from what I gather, here z extends from 1 ("near") to -1 ("far").

At the same time I want to ideally keep using the "kinda-sorta inofficial quasi-standard" matrix functions for lookat and perspective, currently defined as:

func (me *Mat4) Lookat(eyePos, lookTarget, upVec *Vec3) {
    l := lookTarget.Sub(eyePos)
    l.Normalize()
    s := l.Cross(upVec)
    s.Normalize()
    u := s.Cross(l)
    me[0], me[4], me[8], me[12] = s.X, u.X, -l.X, -eyePos.X
    me[1], me[5], me[9], me[13] = s.Y, u.Y, -l.Y, -eyePos.Y
    me[2], me[6], me[10], me[14] = s.Z, u.Z, -l.Z, -eyePos.Z
    me[3], me[7], me[11], me[15] = 0, 0, 0, 1
}

//  a: aspect ratio. n: near-plane. f: far-plane.
func (me *Mat4) Perspective(fovY, a, n, f float64) {
    s := 1 / math.Tan(DegToRad(fovY)/2) // scaling
    me[0], me[4], me[8], me[12] = s/a, 0, 0, 0
    me[1], me[5], me[9], me[13] = 0, s, 0, 0
    me[2], me[6], me[10], me[14] = 0, 0, (f+n)/(n-f), (2*f*n)/(n-f)
    me[3], me[7], me[11], me[15] = 0, 0, -1, 0
}

So, for the lookat-part to have my world-space camera (positive-Z) work with lookat (negative-Z) as per this pseudocode:

// world-space position:
camPos := cam.Pos
// normalized direction-vector, up/right/forward are 1 not -1:
camTarget := cam.Dir
// lookat-target:
camTarget.Add(&camPos)
// invert both Z:
camPos.Z, camTarget.Z = -camPos.Z, -camTarget.Z
// compute lookat-matrix:
cam.mat.Lookat(&camPos, &camTarget, &Vec3{0, 1, 0})

That works well. Moving the camera in all 6 degrees of freedom produces correct on-screen movement and correct new camera world-space coords.

But geometry is still inverted on the Z-axis. When I position two boxes, A at (-2, 1, -2), to appear near-left and B (2, 1, 2) to appear far-right,  then A appears far-left and B appears near-right. Z is still inverted here.

Now, these nodes have their own world-space coords and update from those their own model-to-world matrices. I shouldn't invert posZ there as they form a hierarchy of sub-nodes multiplying with their parents transforms and all that. They're still in model or world space, which as per my decree is to remain left-handed.

Their world-to-camera calculation happens on the CPU at my end, not in a vertex shader which just gets a single final (mvp/clip-space) matrix.

When that happens -- multiplication of world-space-object-matrix with clip-space lookat-and-projection matrix -- at that point I need to somehow invert Z.

What's the best way to do this? Or, more generally speaking, what's a common way that works? Do I have to modify the projection to accept left-handed but output-to-GL right-handed? If so, how? And then wouldn't I also have to modify lookat? Is there a smart way to do all this without having to modify the somewhat-standard lookat/projection matrices while also keeping model-transform-matrices in left-handed coords?

sentences:
Getting Started with 2d Game Dev (C++): DirectX or OpenGL? So, i'm a student looking to get my foot in the door of game development and im looking to do something 2D, maybe a tetris/space invaders/something-with-a-little-mouse-interaction clone.

I pointed my searches in the direction of C++ and 2d and was eventually lead to DirectX/OpenGL

Now as i understand it, all these packages will do for me is draw stuff on a screen. And thats all i really care about at this point. Sound isn't necessary. Input can be handled with stdlib probably.

So, for a beginner trying to create a basic game in C++, would you recommend DirectX or OpenGL? Why? What are some key feature differences between the two? Which is more usable?

sentences:
Is it better to combine or leave alone 2D polygons I'm making a modular system for a 2D spaceship arcade like game, the user builds their own ship with equilateral triangles to make more complex shapes. When the ships are small it's no problem, but as you make bigger ships you would have to add more bodies to the physics engine, so I think I should just combine all the bodies and make a polygon outlining the shape I'm making and simply render it as multiple. But I've also heard it's really computationally expensive to use shapes other than squares, triangles, and circles.

Tldr: I have a compound of triangles, should I just leave it as is? Or make a polygon outlining the overall shape? Which is better performing? Is there anything I'm missing?

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:
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:
Keeping track of focused widget in GUI tree I'm designing a GUI framework based on trees of widgets.  Widgets are general control and container structures that are everything from panels to buttons to file dialogs.  Widgets have an array of child widgets; a button contains a label and maybe an icon.  Widgets are fed input events where the widget first does its own logic with the event then passes it on to its children.  The application feeds input events to a single root widget, which can be anything from a single button in the middle of the screen to a full control window.

I need a way to handle which widget(s) receives keyboard events.  I've decided that one of the widgets in a given widget tree would be the focused widget.  Widgets would have a gainFocus method and a loseFocus method, which would be used in response to mouse click events or manually by the application.  It's unlikely I'll implement tabbing.  When one widget gains focus, any existing focused widget would naturally lose focus.

I still want each ancestor of the focused widget to see a given keyboard event in turn before it's given to the focused widget itself.  So if I have a panel with a text box in it, the panel would see the event before the text box does.  Therefore I really need to keep track of the chain of widgets from the root widget to the focused widget.  I also need to maintain data integrity when I change focus so that all widgets in a tree can correctly tell whether or not they're the focused widget or an ancestor of the focused widget.

I've so far come up with giving widgets a hasFocus boolean and a focusedChildIndex integer.  hasFocus would be set to true when the widget has focus.  focusedChildIndex would be set to the index of the focused child in its child array, which could be the focused widget itself or the next widget in the chain leading to the focused widget, or -1 to indicate that there's no focused child.  Setting these variables when one widget in the tree gets its gainFocus or loseFocus method invoked is something I'm stumped on though.

Edit

So we're clear, this is what I think my widget class will be like:

class Widget
    private Widget parent
    private Array<Widget> children

    // Methods for getters, adding widgets to widget trees, etc.
    ...

    public void mouseClick(int x, int y)
        doMouseClickEvent(x, y)
        for c in children
            c.mouseClick(int x, int y)

As you can see in mouseClick the widget sees the event before its children does.  I want keyboard inputs to work the same way, except this time I want to only have a single chain from the root to the focused widget to see the event.  Plus I need to make sure that when one widget gains focus the currently focused widget in the tree loses focus.

sentences:
Reduce texture switches in UI I'm working on game which uses LibGDX's Stage2d for GUI.

All textures for UI are packed into one texture atlas.

Fonts (BitmapFont) are generated in runtime by gdx-freetype for different locales and font sizes (at least 6 locales and 4 font sizes for each locale) and then placed into separate texture.

Game UI contains much different elements (strategy game with lots of numbers) - buttons, icons, text labels, which usually alternate between each other and trigger many texture switches when drawn. I wonder if there's any way to reduce the number of texture switches as it sometimes takes up to 5ms per frame for stage.draw().

The only way I see is to draw fonts only when all UI textures are drawn, when it is possible, but it will produce awful code and will harm the hierarchy of elements in stage.

I didn't merge textures (but thought of it), because:

Textures use different filtering (MipMapLinearNearest for UI textures, Linear for fonts) and it will require manual texture filtering switches or mess with stage2d overriden Label class.
UI texture already has a size of 2048x2048px, and I can't add all font size textures to it as it will require higher texture sizes, which are not supported by many old devices.

Is there any good way of solving this issue?

sentences:
I am looking to make a spaceship tilt as it corners but I cant get it to return I am using the TL game engine I am not allowed to use a physics engine but I need to make the spaceship lean as it corners, I can make it lean but cannot make it return to its starting position. I have looked at implementing some kind of spring physics but I don't understand it.

Here is my code so far

if(myEngine->KeyHeld(Key_A))
    {
        car->RotateY(carSteer * frameTime);
        if(carSteer >= -carMaxSteer)
        {
            carSteer -= carSteerIncrement;
            car->RotateLocalZ(-(carSteer * frameTime));
        }
    }
    if(!myEngine->KeyHeld(Key_A))
    {
        if(carSteer < 0)
        {
            carSteer = 0;
        }
    }
    if(myEngine->KeyHeld(Key_D))
    {
        car->RotateY(carSteer * frameTime);
        if(carSteer <= carMaxSteer)
        {
            carSteer += carSteerIncrement;
            car->RotateLocalZ(-(carSteer * frameTime));
        }
    }
    if(!myEngine->KeyHeld(Key_D))
    {
        if(carSteer > 0)
        {
            carSteer = 0;
        }
    }

All the functions I am calling are built into the engine and I did not write them.
Any Help Would Be Appreciated Thanks.

sentences:
Helicopter controller, spherical world with faux gravity I followed this tutorial to create a planet with faux gravity that attracts objects.

Further I'm trying to create a helicopter-like controller that could move vertically and horizontally and that when the player presses control buttons this would compensate the faux gravity applied with AddForce to Rigidbody and the helicopter could fly. I implemented that in a way that when player presses buttons faux gravity with AddForce is not applied, but still the control feels very awkward.

What would be the best way to compensate the faux gravity to move the helicopter?

Edit: I only need it to move in XY plane (so only up/down/left/right). The camera looks on helicopter from its right side. The attractor script works in 3 axis and this is ok for now.

Player controller (assigned to the helicopter):

public class PlayerController : MonoBehaviour {
    public float moveSpeed = 15;

    private Rigidbody rb;

    private Vector3 moveDir;
    private float h;
    private float v;

    void Awake() {
        rb = GetComponent<Rigidbody>();

        if(!rb) throw new Exception("Game Object must have Rigidbody!");
    }

    void Update () {
        GetControls();
        moveDir = new Vector3(h, v, 0).normalized;
    }

    void GetControls() {
        h = Input.GetAxis("Horizontal");
        v = Input.GetAxis("Vertical");
    }

    void FixedUpdate() {
        rb.MovePosition(rb.position + transform.TransformDirection(moveDir) * moveSpeed * Time.deltaTime);
    }
}

Faux Gravity Attractor (assigned to the planet):

public class FauxGravityAttractor : MonoBehaviour {
    public float gravity = -10;

    public void Attract(Transform body) {
        Vector3 gravityUp = (body.position - transform.position).normalized;

        Vector3 bodyUp = body.up;

        Rigidbody bodyRb = body.GetComponent<Rigidbody>();

        bodyRb.AddForce(gravityUp * gravity);

        Quaternion targetRotation = Quaternion.FromToRotation(bodyUp, gravityUp) * body.rotation;
        body.rotation = Quaternion.Slerp(body.rotation, targetRotation, 50 * Time.deltaTime);
    }
}

Faux Gravity Body (assigned to the helicopter):

public class FauxGravityBody : MonoBehaviour {
    [SerializeField]
    float gravity = -10;

    public FauxGravityAttractor attractor;
    private Transform myTransform;

    void Start () {
        Rigidbody rb = GetComponent<Rigidbody>();
        rb.constraints = RigidbodyConstraints.FreezeRotation;
        rb.useGravity = false;
        myTransform = transform;
    }

    void Update () {
        attractor.Attract(myTransform);
    }
}

sentences:
Create a new Surface type with SDL_Texture So I started using Awesomium, and I'm experiencing some difficulties.

I want to create a new type of Awesomium::Surface and implement it in my custom Awesomium::SurfaceFactory to render Awesomium::WebView->surface as SDL_Texture.

I'm currently stuck at the Paint function which is supposed to update some pixels, so I have this (in the project it's separated in header and definitions):

class AwsSurface {

    public:
    AwsSurface(int w, int h) : public Awesomium::Surface {
        // _renderer is my global renderer, on Awesomium DOCs it says that pixels are
        // "in 32-bit BGRA format" so I guess the format is right...
        texture = SDL_CreateTexture(
            _renderer,
            SDL_PIXELFORMAT_BGRA8888,
            SDL_TEXTUREACCESS_STREAMING,
            w,
            h
        );
        dst_rect = {0, 0, w, h};
    }

    void Paint(unsigned char* src_buffer,
             int src_row_span,
             const Awesomium::Rect &src_rect,
             const Awesomium::Rect &dest_rect) {
    }

    protected:
    SDL_Texture* texture;
    SDL_Rect dst_rect;
};

I'm not sure if I get it right, but fromwhat the DOCs say if I'm given a src_rect={2, 1, 2, 3} and src_row_span=20 I am in this situation, right?

Now, I understood how the buffer works (more or less), but I don't know how to copy the pixels from it onto my texture (in the given position).

Edit: I came up with this paint function:

void AwsSurface::Paint(unsigned char* src_buffer,
                       int src_row_span,
                       const aws::Rect &src_rect,
                       const aws::Rect &dest_rect) {
    Uint32* src_buffer_i = (Uint32*)src_buffer;
    src_row_span /= 4;
    int dest_row_span;
    Uint32* dest_buffer;
    SDL_Rect r = AwsRectToSDL(dest_rect); // Custom function to convert the rect
    SDL_LockTexture(
        texture,
        &r,
        (void**)&dest_buffer,
        &dest_row_span
    );
    dest_row_span /= 4;
    for (int x = 0; x < src_rect.width; x++) {
        for (int y = 0; y < src_rect.height; y++) {
            Uint32* s = src_buffer_i + (src_rect.y + y) * src_row_span + src_rect.x + x;
            Uint32* d = dest_buffer + (dest_rect.y + y) * dest_row_span + dest_rect.x + x;
            *d = *s; // Here happens the exception
        }
    }
    SDL_UnlockTexture(texture);
}

But I get an "access violation on writing" exception on the line above, this happens after some successful executions (usually 6/7) and every time on the same rectangle {0, 0, 466, 26}.

sentences:
Unexpected results during collisions in Unity I've got a basic car-based game I'm starting in Unity.  Currently the scene has only a floor, a car (player-controlled), and one building.

Bumping into the building at low to medium speeds works as expected.  When getting the car up to max speed and smashing into the building, though, weird results happen.

Originally, the car was being pushed through the floor and falling off the map.  I changed the floor from a plane to a cube that was stretched to be broad and flat (scale 2 height), and that helped.  Now the car seems to clip right through the building at top speed, sometimes flipping itself into the air when it emerges.

So what gives?

The car and building are both imported .fbx models and both have box colliders stretched to the outer bounds of the models.  The car has a rigid body with gravity.  The building used to have a rigid body, but I removed it once I realized it was making the building fly into the air on impact (which was definitely not what I wanted).

Here are the relevant parts of the movement code:

  bool key_up = false;
  float top_speed = 1f;
  float current_speed = 0f;
  float acceleration = .01f;

  void Update ()
    {
    if (Input.GetKeyDown (KeyCode.UpArrow) && !key_up) key_up = true;
    if (Input.GetKeyUp (KeyCode.UpArrow) && key_up) key_up = false;

    if (key_up)
      {
      if (current_speed < top_speed) current_speed += acceleration;
      }

    else
      {
      if (current_speed > -.1f && current_speed < .1f) current_speed = 0f;
      if (current_speed != 0f) current_speed = current_speed * 0.9f;
      }

    transform.Translate (0f, 0f, current_speed);
    }

Update:

After switching the camera to a fixed position (rather than following the car), I've gotten better observations.  The car will clip right through at any speed if I keep pushing forward.  There's initial resistance from the collision detection and some stuttering from the car, but it always breaks through and then flips into the air on its way out.

I've added the following function to the car code:

void OnCollisionEnter (Collision collision_info)
  {
  current_speed = 0f;
  }

current_speed is what's being used to translate the car forward each frame.  This has slowed the bug down, but the car always eventually pushes through if I hold down the gas long enough.  It looks as if Unity's collision detection isn't moving the car back far enough on each frame that the car is colliding.  Must I handle that portion on my own?

sentences:
Tile map only rendering 1 layer when it should be 3 I've been working on this for a while and I can not seem to figure it out. I had the fileParser() method in the constructor and it worked fine. Then I was told it's very bad practice to have it in the constructor. So I moved it to it's own method(which required making most of the variables static) and moved the call to the main Game class and now it runs without errors, but only my last layer is rendering. I've moved things in the class around. I've used more variables than there are at the moment. I've checked my files and they are for sure 32 by 32. So I have no clue why this is happening.

import com.stardust.main.gfx.Assets;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class TileMap
{
   private static final int TILE_SIZE = 32;
   //placeholder for each tile
   BufferedImage[] tiles = new BufferedImage[37];

   //array of tile types
   private static int[][] map = new int[TILE_SIZE][TILE_SIZE];
   //position coordinates
   private int posX, posY;
   //Edge of map Cooridinates
   public static int sx, sy;
   private String fileName;
   private static int x = 0, y = 0;

   public TileMap(int posX, int posY, String fileName) throws IOException
   {
       this.fileName = fileName;
       this.posX = posX;
       this.posY = posY;
       this.sx = map.length * TILE_SIZE;
       this.sy = map.length * TILE_SIZE;

       setTile();

   }

   public void render(Graphics g)
   {
       for(int x = 0; x < TILE_SIZE; x++)
       {
           for(int y = 0; y < TILE_SIZE; y++)
           {
               int textureType = map[x][y];
               BufferedImage texture = tiles[textureType];
               g.drawImage(texture, posX, posY, null);
               posY += TILE_SIZE;
           }
           posX += 32;
           posY = Game.mapY;
       }
       posX = Game.mapX;
       posY = Game.mapY;

   }

   private void setTile()
   {
       tiles[0] = Assets.grass;
       tiles[1] = Assets.dirt;
       tiles[2] = Assets.water;
       tiles[3] = Assets.tree;
       tiles[4] = Assets.multiTree;
       tiles[5] = Assets.NSpath;
       tiles[6] = Assets.uprtPath;
       tiles[7] = Assets.EWpath;
       tiles[8] = Assets.upltPath;
       tiles[9] = Assets.dnltPath;
       tiles[10] = Assets.dnrtPath;
       tiles[11] = Assets.watgrsdn;
       tiles[12] = Assets.watgrslt;
       tiles[13] = Assets.watgrsup;
       tiles[14] = Assets.watgrsrt;
       tiles[15] = Assets.watgrsSE;
       tiles[16] = Assets.watgrsSW;
       tiles[17] = Assets.watgrsNW;
       tiles[18] = Assets.watgrsNE;
       tiles[19] = Assets.wallWood;
       tiles[20] = Assets.pointer;
       tiles[21] = Assets.pathOpRt;
       tiles[22] = Assets.pathOpLt;
       tiles[23] = Assets.pathOpDn;
       tiles[24] = Assets.pathOpUp;
       tiles[25] = Assets.pathOpAll;
       tiles[26] = Assets.roughWood;
       tiles[27] = Assets.pathOpen;
       tiles[28] = Assets.counter;
       tiles[29] = Assets.storeDude;
       tiles[30] = Assets.pot;
       tiles[31] = Assets.singleHouse;
       tiles[32] = Assets.doubleHouse;
       tiles[33] = Assets.wepBanner;
       tiles[34] = Assets.armBanner;
       tiles[35] = Assets.innBanner;
       tiles[36] = Assets.blankTile;
   }

   public void fileParser() throws IOException
   {
       BufferedReader in = new BufferedReader(new FileReader(fileName));

       String line;

       while((line = in.readLine()) != null)
       {
           String[] values = line.split(",");

           for(String str : values)
           {
               int str_int = Integer.parseInt(str);
               map[x][y] = str_int;
               ++y;
           }
           ++x;
           y = 0;
       }
       x = 0;

       in.close();
   }
}

sentences:
Removing delay at start of a key press I'm making a simple game, and one of the problems I encountered is the annoying delay when pressing a key continuously.

So basically, when I press (for a very long time) for example Up, my object will move 1 unit up, not move (for approx. 1 second), and then move continuously 1 unit up (without any delays).

Currently, I use this to move the object (SDL2):

while (SDL_PollEvent(&event))
{
    switch (event.type)
    {
    case SDL_KEYDOWN:
        switch (event.key.keysym.sym)
        {
        case SDLK_UP:
            //Move object 1 unit up
            break;
        //Other unrelated things omitted
        }
        break;
    //Omitted other cases
    }
}

What I would like to have is to remove the delay, so that the object can immediately move Up very quickly. Is there any way to do this?

sentences:
SharpDX DirectInput Force feedback actuators are missing I am using a simple code to read input from a DirectInput device. I would like to add force feedback to the device, however when I run this test, I cannot find any ForceFeedbackActuator, however my device supports rumble effects.

public void Test(Joystick joystick)
{
    joystick.SetCooperativeLevel(new WindowInteropHelper(Application.Current.MainWindow).Handle, CooperativeLevel.Background | CooperativeLevel.Exclusive);
    joystick.Properties.AxisMode = DeviceAxisMode.Absolute;
    joystick.Properties.AutoCenter = false;
    joystick.Acquire();

    foreach (var deviceObjectInstance in joystick.GetObjects())
    {
        if (deviceObjectInstance.ObjectId.Flags.HasFlag(DeviceObjectTypeFlags.ForceFeedbackActuator))
        {
        }
    }
}

I checked the Microsoft specification but found nothing so far.

However my driver is null as well:

deviceInstance.ForceFeedbackDriverGuid

But this can be set from registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM adding a new CLSID value for the current device.

Any help is appreciated.

sentences: How to simulate cylinder shape in collision detection? AFAIK, many physics engines like Physx and Havok don't incorporate cylinder as basic shape because it is expensive than sphere, box and capsule. But bullet engine does incorporate cylinder as a basic shape. Do they found any fast algorithm to simulate the cylinder and what is that?

sentences:
Scaling/Rotating triangle I have a Triangle class and a list of triangles representing my 3D model shape.

When I update the position, the rotation or the scale of my model, I also want my triangles list to be updated.

I already made the function to update triangle position, but I can't make it for rotation/scale...

private void UpdateModelTrianglesPos(Vector3 oldPos, Vector3 newPos)
{
    Vector3 diff = newPos - oldPos;
    for (int i = 0; i < _trianglesPositions.Count; i++)
        _trianglesPositions[i].UpdatePosition(diff);
}

Thank you for your help!

sentences:
Optimal way to create/spawn multiple sprites in mini2dx(subset of libgdx) What is optimal way to spawn new sprites with different sizes in mini2dx(subset of libgdx)?
Currently I am maintaining ArrayList of enemy sprites

private ArrayList<Sprite> enemies = new ArrayList<Sprite>();

In the generateEnemies method:

private void generateEnemies() {
    // How many enemies to spawn max?? X
    for (int i=0; i<=5;i++) {
        float size = (float) Math.random() * 3;
        float speed = (float) Math.random() * 3;
        float y = (float )Math.random() * Gdx.graphics.getHeight();
        enemies.add(new Enemy(new Texture(Gdx.files.internal("gfx/enemy.png"))));
        enemies.get(i).setScale(size);
        enemies.get(i).setSpeed(speed);
        enemies.get(i).setPosition(0,  y);
    }
}

In render method:

for (int i = 0;i<=5;i++) {
    g.drawSprite(enemies.get(i), collisionPoint.getRenderX(),
    collisionPoint.getRenderY());
}

Although I seems to render the enemy but there is no control over the enemy sprite to respawn.
Is there any optimal way to do it?

sentences:
How do I wrap textures inside shader GLSL? I'm trying out GLSL and one of the problems I'm facing is wrapping a random texture sampler in the shader. Searching for answers on the web first, this leads me to using these:

glTexParameter()
GL_TEXTURE_WRAP_S GL_REPEAT
GL_TEXTURE_WRAP_T GL_REPEAT

I'm not sure where to put this or how to use it. I'm using a custom engine for this shader and I would assume I could wrap the texture in the shader.

My main concern on this is my final output render having left and bottom artifacts. I got some previous advise it has to do with wrapping a random texture that is used for noise if that helps in my case.

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:
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:
Light point buggy on old device after migrating to URP Light point is very buggy on Samsung A5 after migrating to URP, it works well on PC and Samsung A7.
Altought it has light points, these are really few and using lowest settings by default, all other graphic stuff is lightweight and runs well.
Does someone know if it's expected or what can I do? I tried to reduce the lightning settings and add OpenGL-ES 2, but I've got the same results.

sentences:
How can I remove the 'already played' moves from the 'available moves' list? List<int> boardmove = new List<int>();
            boardmove.Add(0);
            boardmove.Add(1);
            boardmove.Add(2);
            boardmove.Add(3);
            boardmove.Add(4);
            boardmove.Add(5);
            boardmove.Add(6);
            boardmove.Add(7);
            boardmove.Add(8);

            int rand = rnd.Next(1, count);

            int num_one = boardmove[rand];

            boardmove.RemoveAt(num_one);

            count--;

I  am trying to implement a computer player for my tic tac toe game. I am  using a list to move the computer player, I want to index in the list and then remove the value I have selected. I want to select a unique value from the list each time.

            List<int> boardmove = new List<int>();
            boardmove.Add(0);
            boardmove.Add(1);
            boardmove.Add(2);
            boardmove.Add(3);
            boardmove.Add(4);
            boardmove.Add(5);
            boardmove.Add(6);
            boardmove.Add(7);
            boardmove.Add(8);

            int selectedIndex = rnd.Next(0, boardmove.Count);

            int selectedMove= boardmove[selectedIndex];
            Console.WriteLine(selectedMove);

            boardmove.RemoveAt(selectedIndex);
            Console.WriteLine(selectedIndex);

sentences:
Circular trajectory for sprite in LibGdx I want four sprites to orbit a single origin point. But if I use like this

    sprite_p1_avatar = new Sprite(dummyText);
    sprite_p1_avatar.setPosition(200, 200);
    sprite_p1_avatar.setOrigin(100, 100);

    sprite_p2_avatar = new Sprite(dummyText);
    sprite_p2_avatar.setPosition(300, 300);
    sprite_p2_avatar.setOrigin(100, 100);

    sprite_p3_avatar = new Sprite(dummyText);
    sprite_p3_avatar.setPosition(400, 400);
    sprite_p3_avatar.setOrigin(100, 100);

    sprite_p4_avatar = new Sprite(dummyText);
    sprite_p4_avatar.setPosition(500, 500);
    sprite_p4_avatar.setOrigin(100, 100);

    sprite_p1_avatar.rotate(40 * delta);

    sprite_p1_avatar.draw(batch);

    sprite_p2_avatar.rotate(40 * delta);
    sprite_p2_avatar.draw(batch);

    sprite_p3_avatar.rotate(40 * delta);
    sprite_p3_avatar.draw(batch);

    sprite_p4_avatar.rotate(40 * delta);
    sprite_p4_avatar.draw(batch);

the sprite get inverted while revolving, as these sprites are profile pictures of users I want them to stay straight while orbiting at every point. Is there any way to move the sprites along a circular path without rotating.

sentences:
How to achieve sprite reflection effect in libgdx I am currently working on an open world game similar to Pokemon using libgdx. I am currently stuck on this effect that I really want to be done before moving to other features of my game. How can I achieve the following water reflection effect?

I also want it to shimmer like in this video:

"Pokémon Sapphire | Reflections in the water | Episode 4" - 3:38

sentences:
How to create a Unity Editor box grouping with a header and vertically stacked content inside? I am trying to do something like this with Unity Editor for my window but I am not sure how it is done.

So it is basically a box ( a wrapper ) with a title at top. Beneath the title there are boxes or "cards" where you add text to it.

Any help is appreciated!

sentences:
How to animate a destruction of a model? I have a model (see image) and I am trying to animate a destruction.

But it doesn't seem possible, since XNA is using only bones to animate.
So my question is:

Which workflow should I use, to animate 4 independent objects (being one big model), which lie on top of each other?

Regarding this model:

sentences:
Open_GL Camera somehow not centered I setup my OpenGL viewport via

    ViewPort( 0,0,WindowW, WindowH )
    MatrixMode( Projection )
    LoadIdentity()
    MaxY = ClipNear * Tan(FieldOfView * 0.00872664626)
    MaxX = MaxY * Ratio
    Frustrum(-MaxX ,MaxX ,-MaxY ,MaxY ,ClipNear ,ClipFar)
    MatrixMode(ModelView)

Then I add rotation and move the Camera accordingly

    LoadIdentity()
    Rotated(ry,1,0,0)
    Rotated(rx,0,1,0)
    Translated(z,y,x)

However the center of the frustrum is not the middle of the Window.
It is slightly right and up in the window.

I'm sure there is a bug in my code but I can't seem to find it.
I have checked every place I could think of.

The bug could be caused by setting a wrong viewport however that doesn't seem to be the case as a similar Project (however not using modular code) works fine with the same viewport settings.

The bug could also be caused by setting a wrong Frustrum. However that also works in the other project.

Aside from that I do not know of anything that could cause this.

As my Code is written in a rather weird language posting it here wouldn't do any good.

So my question is what kind of mistake/bug can cause a behaviour like that.

sentences:
Trying to create a '2D 8 Ball Pool' game - Trajectory Prediction I am trying to create a game similar to (Pocket Run Pool) https://www.youtube.com/watch?v=ewlAE6NQnsI&t=215s a 2D pool game that is much simpler than a 3D one I need help with creating code for trajectory prediction something similar to this https://docs.unity3d.com/Manual/physics-multi-scene.html
How do I go about doing this?

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 can I move an object around the screen in cocos2d? I am trying to move the object around the screen using cocos2d. I have this code:

-(void) move
{
  CGFloat upperLimit = mWinSize.height - (mGunda.contentSize.height / 2.0);
  CGFloat upperLimit1 = mWinSize.height;
  CGFloat lowerLimit = (mGunda.contentSize.height / 2.0);
  CGFloat RightLimit = mWinSize.width - (mGunda.contentSize.width/2.0);
  CGFloat Right = (mGunda.contentSize.width/2.0);

  if(mImageGoingUpward ) {
    mGunda.position = ccp( mGunda.position.x, mGunda.position.y + 5);

    if(mGunda.position.y >= upperLimit) {
      mImageGoingUpward = NO;
      mHori = NO;
    }
  } else {
    mGunda.position = ccp( mGunda.position.x, mGunda.position.y - 5);
    if(mGunda.position.y <= lowerLimit) {
      mGunda.position = ccp(mGunda.position.x +5, lowerLimit);
    }

    if(mGunda.position.x >= RightLimit) {
      mGunda.position = ccp(mGunda.position.x, mGunda.position.y+10);
      mHori = YES;
    }

    if(mHori) {
      if(mGunda.position.y >= upperLimit) {
        mGunda.position = ccp(mGunda.position.x - 5,mGunda.position.y);
      }
    }
  }
}

It is supposed to move the object around the screen. The code mostly works, but it doesn't move the object from the top-right of the screen to the left of the screen.

sentences:
Rotate heading relative to agent's local space I'm having a little trouble translating a point in my game's world space to an object's local space.

I have a cannon in my game with a normalized heading vector that's always supposed to point in the direction of a target. The target is set by an incoming screen touch event.

My problem is that the coordinates I get from the incoming touch events are relative to the game world's axis centered at the world's origin, not relative to the cannon's position like I need. The angle I calculate to rotate the heading is relative to the world's X-axis, not the cannon's local X-axis, this means I can never rotate the heading by anything outside of 0 < x < 90.

I hope my crude drawing conveys what I mean. In the picture below, A is the cannon's position (with the blue heading vector), and B is the target's location (set by an event). The green line represents the angle the game is giving me, and the angle between red line and the heading is what I need to find (the little curved blue arrow).

Here's the code I use to calculate the heading:

 float xDistance = target.x - position.x;
    float yDistance = target.y - position.y;
    float angleToTurn = (float) Math.atan2(yDistance, xDistance);

    vec2RotateAroundOrigin(heading, angleToTurn);

Thanks in advance. Any help is greatly appreciated.

sentences: Line of Sight/Clear Path Check Theta* For Rectangle Character I am implementing Theta* pathfinding in a tile-based 2D game. A tile is either blocked or unblocked. The character has a rectangle collider with a width and height in tiles. Is there an algorithm for finding all the tiles the rectangle will overlap when moving in a straight line from A to B on the tile grid?

sentences:
Cocos2d v3.4 Templates How to create cocos2d v3.4 without using Cocos2D-SpriteBuilder?

I installed Cocos2D-SpriteBuilder as they recommended in cocos2d blog:

http://cocos2d.spritebuilder.com/get-started

But I need to create cocos2d v3.4 project from Xcode without creating it first in Cocos2D-SpriteBuilder.

Any help?

sentences:
How could I do simple per-fragment lighting on BSP geometries? I am programming a graphics engine for an old game. The game uses a BSP geometry which I have rendering perfectly. For it's lights however, it simply has light instances with the standard x, y, z, rgba, brightness, type. Now I know that OpenGL has an 8 light limit. How should I go about handling multiple lights.

I am learning per fragment light just to have the concepts under my belt. I know per pixel lighting is the standard and I will eventually move there, just want to learn how to get this concept put in play as well.

I assume I will just calculate which lights are the closest and render those 8. Does anyone have any other ideas?

sentences:
Lag Spike When Creating Model I am creating a game using OpenGl in c++. Whenever I create a new model while the game is running, such as fire a bullet, there is a huge lag spike. The function that creates the model is below.
    std::string jsonString;
    jsonString = file->load(type);
    json jf = json::parse(jsonString); //Might be causing the lag

    indicesSizeTexture = jf["textureIndices"].size();
    verticesSizeTexture = jf["textureVertices"].size();
    indicesSizeCollision = jf["collisionIndices"].size();
    verticesSizeCollision = jf["collisionVertices"].size();
    verticesTexture = new float[verticesSizeTexture * 8];
    verticesCollision = new float[verticesSizeCollision * 8];
    verticesCollisionUpdated = new float[verticesSizeCollision * 8];

    indicesTexture = new int[indicesSizeTexture];
    indicesCollision = new int[indicesSizeCollision];

    for (int i = 0; i < verticesSizeTexture; i++) {  //responsible for just the texture vertices
        verticesTexture[i] = jf["textureVertices"][i];
    }
    for (int i = 0; i < indicesSizeTexture; i++) { // responsible for just the texture indices
        indicesTexture[i] = jf["textureIndices"][i];
    }
    for (int i = 0; i < verticesSizeCollision; i++) {  //responsible for just the collision vertices
        verticesCollision[i] = jf["collisionVertices"][i];
        verticesCollisionUpdated[i] = verticesCollision[i];
    }
    for (int i = 0; i < indicesSizeCollision; i++) { // responsible for just the collision indices
        indicesCollision[i] = jf["collisionIndices"][i];
    }

    //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);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    stbi_set_flip_vertically_on_load(true);
    unsigned char* data = stbi_load(texturePathString.c_str(), &width, &height, &nrChannels, 0);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);
    stbi_image_free(data);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

I stripped out a lot of parts that I am almost certain aren't causing the lag. There is a lot of stuff going on, but it is mostly simple mathematical operations. The only parts that I think could be causing the lag is the json section used for loading the model data. The model data is stored in a variable from file as a string. I need the json section for the data storage though. What could be causing the lag? should I find a different data storage type? What if I created a bullet offscreen on startup, then copied it whenever I needed it? The specific json library I am using is https://github.com/nlohmann/json

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:
Shader is distorting a Texture of a sprite it's working on I've been testing out fragment shaders in SFML, trying to learn how to write and use them and I've run into a recurring problem. Every shader distorts the texture.
Top left is the distorted test texture, top right and bot left are there for comparison along the axis.

The texture is 512x512 pixels in size and the sprite has the same dimensions. I've narrowed down the problem to this line.

vec2 texCoord = (gl_FragCoord.xy / sourceSize.xy);

Where sourceSize is the resolution. The value I'm passing in being (512,512). I've tested around with different values, the closest to the correct output is when I pass in the values (512, 1086) giving this.

Top left is the distorted texture. The X axis is correct but the Y axis is stretched enough to hide the numbers and enlarge the border.

Currently the shader does nothing for testing purposes.

uniform sampler2D       source;
uniform vec2            sourceSize;
uniform float           time;

void main( void )
{
        vec2 texCoord = (gl_FragCoord.xy / sourceSize.xy); //Value between 0.0 and 1.0
        texCoord = vec2 (texCoord.x,1.0-texCoord.y);    //Inverts the y component. GLSL treats bot left corner as the origin, sfml treats top left as it.
        vec4 Color = texture2D(source, texCoord);

        gl_FragColor = Color;
}

I'm not sure how to fix this. What I'm trying to achieve is a shader that doesn't distort the base texture so I can build on from there. Thanks for any help you can give.

sentences:
Moving a div with hotkeys using easing in and out I'm working on replicating Tagpro using AngularJS and Firebase as a learning project.

I want this ball to move using ease in and out like in the youtube video below.

My code: http://codepen.io/clouddueling/pen/vCpuf

http://tagpro.koalabeast.com/

https://www.youtube.com/watch?v=cyAeDTmG8GI

At least my method goes in the right direction but is super glitchy.
Does anyone have an example of the algorithm that makes this happen? Code sample?

Here is a weird graph of the movement I'm trying to achieve:

Sorry if this is a duplicate I came from stackoverflow.

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:
XNA 4.0 - Mixing 3D and 2D - SpriteBatch putting weird alpha texture over whole scene I am working on a game in XNA 4.0 that has been entirely in 3D so far but now I want to incorporate a HUD.

I have tried doing a simple test using spriteBatch as such:

spriteBatch.Begin();
spriteBatch.Draw(Player.Texture, new Rectangle(0, GameConstants.GraphicsDevice.Viewport.Height - 50, 50, 50), Color.White);
spriteBatch.End();

This works fine and the test texture shows as a rectangle in the correct position but the 3d World behind seems to have a sort of "haze" over the top which looks like the drawn "Player.Texture" has been put all over the viewport but at an alpha of like 0.1f.

I googled around and have a reset() function to change some of the GraphicsDevice properties back after drawing the SpriteBatch but nothing has changed and I haven't seen anyone else with this problem.

I thought it would be that SpriteBatch changes the blendmode to additive but in my reset() function I set the blendmode to opaque so I have no idea where this strange effect is coming from, it looks like I've ran some post-processing on the whole scene.

If I change the Player.Texture that is drawn in the SpriteBatch then the "haze" changes to look like the new texture so it is definitely to do with that.

Are there any other GraphicsDevice propterties I should check to change back?

Edit

Okay, I have just realised the "haze" over the top is from the SkySphere texture, I am using the MSDN skysphere shader from this tutorial.

So when I comment out the SkySphere code, the spritebatch and 3d drawing looks completely fine, but this leaves me with the problem that I can't have a SkySphere anymore.

Is there some reason why the skysphere is sort of drawn over the scene translucently rather than behind the 3D after I use a SpriteBatch? As I said before, it kind of looks like additive blending.

Below are 2 screenshots, the top is with spritebatch and no skysphere, below is with spritebatch and skysphere where I am having problems. I have cropped the images down to save upload (my internet is pretty slow at the moment) and I've changed the area of the scene in the 2nd image to show more clearly what it looks like. As I move around the scene with the camera the "haze" overlay stays in the same place exactly as how the SkySphere works, as in not taking into account the world matrix.

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 can I get the user altitude from an iPhone using Unity 3D? I can see in the Unity 3D documentation that its possible to get the altitude of the user from their iPhone, but I cannot figure out how to actually do it.

I try this code:

using UnityEngine;
using System.Collections;

public class Altitude : MonoBehaviour {

    void Start () {
        Input.location.Start();
    }

    void Update () {
        Debug.Log (LocationInfo.altitude);
    }
}

and I get this error:

  Assets/Altitude.cs(11,41): error CS0120: An object reference is
  required to access non-static member
  `UnityEngine.LocationInfo.altitude'

sentences:
How to give a Jerk Effect when the player is moving left of right float amttomove = Input.GetAxis("Horizontal") * playerspeed * Time.deltaTime;
            transform.Translate (Vector3.right * amttomove);

Currently, I have above script in Update function to move the object to left or right.But this movement is way smoother.To give it more realistic feel, I want it to have a slight jerk when it stops moving to left or right and not just stop right there and then.

What exactly needs to be done to have that effect?

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

Attached is the code:

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

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

    void Start()
    {
        Stamina = 100;
    }

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

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

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

Any Ideas

sentences:
RPG like hit points growth algorithms help I am currently making an XNA game in C#. I want to increase health as the player level up. I am currently using this equation.

  MaxHealth = Convert.ToInt32(100 * Math.Pow(1.17, level - 1));

Its fine before the first 20 levels, but afterwards the health starts to increase extremely fast:

  Level 1: 100 Hp.

  Level 20: 1.975 Hp.

  Level 30: 9.493 Hp.

  Level 40: 45.630 Hp.

  Level 100: 658.546.089 Hp.

  Level 109: Crash: value too big for an integer.

How should i create these growth algorithms, so that the growth of hit points pr. level, will increase slowly. This is just an example, if you know a better growth rate, I will be happy to know that too.

  level 2: Hp = base health + 60 (Base health = 100)

  level 3: Hp = base helath + 60 + 120

  level 4: Hp = base helath + 60 + 120 + 180.

But the max health formular will run on every update/tick, so all this should happen in the same calculation.

Edit:

Thank you all for your input, I really appreciate it. But while away from the question, I found a solution myself. Thank you very much. The solution:

if (level < 35)
    this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
else
    this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);

I added vitality as an upgrade you can spend skill points or something on

EDIT 2:

I improved the code a bit

        if (level < 35)
            this.baseMaxHealth = Convert.ToInt32((vitality * 10) + Math.Pow(level, 2) * 4);
        else if (level > 125)
            this.baseMaxHealth = Convert.ToInt32((vitality * 100) + Math.Pow(level, 2) * 4);
        else
            this.baseMaxHealth = Convert.ToInt32((vitality * (level - 25)) + Math.Pow(level, 2) * 4);

sentences:
When applying Bloom postprocess, error: "XNA...requires TextureFilter to be Point when using texture format Single." I have an almost unmodified copy of the bloom sample in my project. I pass it a texture to apply the bloom post process on.

The only modification is that, instead of calling BeginDraw() (to set a render target) in the bloom sample and then doing all of my drawing, I simply do all of my drawing to a rendertarget outside of the bloom sample, and then pass that rendertarget to the bloom sample's Draw() method, which the bloom sample can then use to perform the bloom postprocess.

The texture that I pass to the bloom sample Draw() has format Color, according to the debugger (and by code inspection).

However, on the first draw call in the bloom sample, I get the following error:

The framework produces the error "XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Single."

The code that produces this is as follows:

1   public void Draw(RenderTarget2D sceneRenderTarget)
2   {
3       GraphicsDevice gd = Game3.GDM.GraphicsDevice;
4
5       gd.SamplerStates[1] = SamplerState.LinearClamp;
6
7       //gd.SamplerStates[1] = SamplerState.PointClamp;
8
9       // Pass 1: draw the scene into rendertarget 1, using a
10      // shader that extracts only the brightest parts of the image.
11      _bloomExtractEffect.Parameters["BloomThreshold"].SetValue(
12      Settings.BloomThreshold);
13
14      DrawFullscreenQuad(sceneRenderTarget, _renderTarget1,
15                 _bloomExtractEffect,
16                 IntermediateBuffer.PreBloom);

If I uncomment line 7 above, then the code runs without error (as point sampling will be enabled), but this should be unnecessary (and is not desired) as all rendertargets involved here are SurfaceFormat.Color -- which is not a floating point format!

Does anyone have any idea what might be going on? Perhaps someone has seen this before, and can give me a clue where to look next.

I have some experience with PIX, but I don't know how to use PIX to debug when the program crashes (basically I only know how to take single frame captures in PIX).

sentences:
General directions on developing a server side control system for JS/Canvas Action RPG Well, yesterday I asked on anti-cheat JS, and confirmed what I kind of already knew that it's just not possible.

Now I wanna measure roughly how hard it is to implement a server side checking that is agnostic to client input, that does not mess with the game experience so much.

I don't wanna waste to much resource on this matter, since it's going to be initially a single player game, that I may or would like to introduce some kind of ranking, trading system later on. I'd rather deliver better more cool game features instead.

I don't wanna have to guarantee super fast server response to keep the game going lag free. I'd rather go with more loose discrete control of key variables and instances. Like store user's action on a fifo buffer on the client, and push that actions to the server gradually.

I'd love to see a elegant, generic solution that I could plug into my client game logic root (not having to scatter treatments everywhere in my client js) - and have few classes on Node.js server that could handle that - without having to mirror/describe all of my game entities a second time on the server.

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: Get the scene that MonoBehaviour belongs to (multi-scene setup) Is there a way to get the scene that a MonoBehaviour component belongs to? The MonoBehaviour is part of a setup with several additivly loaded scenes. What I'm looking for is not the currently active scene but an additionally loaded one.

sentences:
Algorithm to shoot at a target in a 3d game For those of you remembering Descent Freespace it had a nice feature to help you aim at the enemy when shooting non-homing missiles or lasers: it showed a crosshair in front of the ship you chased telling you where to shoot in order to hit the moving target.

I tried using the answer from https://stackoverflow.com/questions/4107403/ai-algorithm-to-shoot-at-a-target-in-a-2d-game?lq=1 but it's for 2D so I tried adapting it.

I first decomposed the calculation to solve the intersection point for XoZ plane and saved the x and z coordinates and then solving the intersection point for XoY plane and adding the y coordinate to a final xyz that I then transformed to clipspace and put a texture at those coordinates. But of course it doesn't work as it should or else I wouldn't have posted the question.

From what I notice the after finding x in XoZ plane and the in XoY the x is not the same so something must be wrong.

    float a = ENG_Math.sqr(targetVelocity.x) + ENG_Math.sqr(targetVelocity.y) -
            ENG_Math.sqr(projectileSpeed);
    float b = 2.0f * (targetVelocity.x * targetPos.x +
            targetVelocity.y * targetPos.y);
    float c = ENG_Math.sqr(targetPos.x) + ENG_Math.sqr(targetPos.y);
    ENG_Math.solveQuadraticEquation(a, b, c, collisionTime);

First time targetVelocity.y is actually targetVelocity.z (the same for targetPos) and the second time it's actually targetVelocity.y.

The final position after XoZ is

    crossPosition.set(minTime * finalEntityVelocity.x + finalTargetPos4D.x, 0.0f,
                minTime * finalEntityVelocity.z + finalTargetPos4D.z);

and after XoY

    crossPosition.y = minTime * finalEntityVelocity.y + finalTargetPos4D.y;

Is my approach of separating into 2 planes and calculating any good? Or for 3D there is a whole different approach?

sqr() is square not sqrt - avoiding a confusion.

sentences:
Partial object culling without alpha + transparency? I am trying to partially cull an object which has subsurface scattering.  It's simple to do it with an alpha channel, however, using an alpha channel with transparency will disable subsurface scattering.

Potentially relevant information: I am using Unity 2018.3.0b12 with v4.8.0-preview HDRP

Example: here I am achieving the effect with alpha + transparency. The object is either fully opaque or invisible

sentences:
Dictionary of common names for code objects I'm looking for a common dictionary of terms (much like design patterns have a common language for how things interact) that are specific to games.

For instance, if I'm making a game of pong with a high level of complexity, I want to name things accordingly.

I've seen some visual objects that a user can interact with called a widget, some non-interactive ones called a doodad (back when I played with starcraft map editor anyway). Is there a proper name for the frame rate clock? Is there a proper name for the game clock (the clock that is about the movement of objects in the world but not the visual drawing)?

I just want a dictionary so I can speak the same language and not make up things as I go. I'm concerned I'm going to create things named doodads, whosits, whatsists, and flim-flams... and I don't want to do that.

sentences: How do I remove 'playerachievementcache.dat' from my GMS project? I am working with a GameMaker: Studio project that outputs a file called "playerachievementcache.dat". It isn't used for anything, and I can't seem to remove it from my project. Is it possible that this is something the studio automatically includes? Any ideas on how to locate what is creating the file?

sentences:
Box Zoom - Fit to rectangle I want to box select a section of my screen and then zoom in that selection. So I have four corner points (my rectangle which I can drag with the mouse) in pixel coordinates. I have a perspective projection.

How can I create the camera view that has these four corner points as the corner points for the view? I guess that I have to calculate maybe a view frustum for my section?

sentences:
Theory behind worm like movement? I don't want code or anything that will make this too easy for me, but I'm just starting the development of a little game and I want to add worms to it, I want the worms to be Terraria like. My current idea is to make the worm be composed of multiple entities, one being the head and the rest parenting each other leading downwards from the head. However, this in my opinion sounds inefficient and might be lag inducing when there are a large number of worms in the entity map. Does anyone have any other theories on how I can implement a worm- like movement?

Terraria worm video: http://www.youtube.com/watch?v=PhFR8bDQA5w

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:
Choosing an engine for a new game Right now, I'm planning a new FPS single-player Half-Life 2/Call of Duty: Black Ops/Crysis 2-like, and I'm trying to determine what game engine should I use. Right now, my team is me, as a programmer, and only one models/textures artist, so each model takes us a lot of time.

I thought about:

Source Engine - because it has a lot of existing content I can use to write my game much more quickly. The main disadvantage of Source is that it lacks in the graphics area (especially in vegetation).
Unity - the ability to use C#, which is my favourite programming language. It is perfect when it comes to graphics, but it doesn't have so much existing content like Source.  Plus, it is cross platform.

I also thought about some open source game engines, but most of them (Ogre3D, for example) lacks in development speed and some graphics capabilities.

If there was some model/textures/sound repository (not necessarily free, but also not really expensive), I'd use Unity.

UDK is not an option, as it doesn't give me access to native code and I'll need to use some libraries wrriten in C++.

Are there any more advantages/disadvantages to each engine? Feel free to suggest new  game engines. Also, in your opinion, what game engine should I use? Do you know some content repository I can use?

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:
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:
Recommended formats to store bitmaps in memory? I'm working with general purpose image rendering, and high-performance image processing,  and so I need to know how to store bitmaps in-memory. (24bpp/32bpp, compressed/raw, etc)

What is the "usual" or "normal" way to store bitmaps in memory? (in C++ engines/projects?)

How to store bitmaps for high-performance algorithms, such that read/write times are the fastest? (fixed array? with/without padding? 24-bpp or 32-bpp?)

How to store bitmaps for applications handling a lot of bitmap data, to minimize memory usage? (JPEG? or a faster [de]compression algorithm?)

I'm not working with 3D graphics or DirectX / OpenGL rendering and so I don't need to use graphics card compatible bitmap formats.

Some possible methods:

Use a fixed packed 24-bpp or 32-bpp int[] array and simply access pixels using pointer access, all pixels are allocated in one continuous memory chunk (could be 1-10 MB)
Use a form of "sparse" data storage so each line of the bitmap is allocated separately, reusing more memory and requiring smaller contiguous memory segments
Store bitmaps in its compressed form (PNG, JPG, GIF, etc) and unpack only when its needed, reducing the amount of memory used. Delete the unpacked data if its not used for 10 secs.

sentences: How to handle gun position while running and aiming in an FPS In an FPS, when a character runs, from the view of another character, the gun moves, and similarly when the character aims down sight.  Are the views from the third person and from the first person actually showing the same gun position?  I feel like it would be tricky to that happen and have it look natural from both perspectives.

sentences:
Collider Effeciency Question I'm creating a game where hundreds of rockets with colliders attached are shooting at a player.  Should I write my script where:

1: The player script reads the collision from hundreds of rocket colliders
or
2: Each rocket collider updates information when colliding with the player

Thanks!

sentences:
How does Minecraft compute lighting for it's non-block objects? I was wondering how the creator of Minecraft went about lighting the objects (player and pickaxe) based on the lighting level around the player. I have implemented the ability to light the blocks around the player but I can't really think of anyway to implement with objects. Also, when I the player moves and the lighting values change will I have to rebuild it's vertexbuffers? Or is there some other way?

Any ideas?

sentences:
How do you get audio clips to play on all clients? I am new to networking with so this is probably a noob question.
For context I am trying to get a gunshot sound effect to play and be heard by all players.

sentences:
How to make an event happen only at the first start of the game? I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.

I want to give players some amount of gold when they first got their hands on my game ... but I do not want to give them that again and again whenever they restart the game ...

So I want to know how to make something happen only once in a game application..

I hope you get my point ... thanks ..

sentences:
How can I convert an orthographic camera to a perspective camera? How can calculate perspective camera parameters from orthographic camera parameters (left, right, top, bottom, near, far)?

Specifically I don't know how calculate the FOV for a perspective camera from orthographic camera.

sentences:
How to prevent top down sprite snapping during diagonal movement upon keyboard release I have a sprite that faces 4 directions depending on input. This is all working well except for my keyboard input..

If I am pressing down-right at the same time on the keyboard and release both keys there is a moment where I am pressing only the right key. This creates a snapping of my sprite upon key release where now im suddenly facing right instead of down.

basically i would like to release both the x and y buttons at the same time but i dont have a good way of detecting this. its TOO sensitive.

    pressed_vector.x = int(directions.right) - int(directions.left)
    pressed_vector.y = int(directions.down) - int(directions.up)

    dpad_vector = pressed_vector.normalized()
    owner.direction_changed(dpad_vector)

its the standard input code you see everywhere.

I have the player mapped to a virtual joystick, dpad etc and i dont have this issue because on release you're going to be releasing your x and y keys at the same time. not sure how to handle this with the keyboard.

sentences:
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:
What are some methods to represent train tracks? I looked into this a while back for a small project, but didn't get too far.  I'd like to create a small program that lets a user draw a train track and then allows a "train" to follow said track on a 2D plane.  I'd like the track to be pretty free form and result in a nice smooth line.  I played around with cubic splines and had decent results, but had a ton of trouble getting the train to follow the spline.  I also had a lot of trouble creating multiple tracks and switching a train from one track to another.

Does anyone have advice, articles, or source code that can help me figure something out?  Thanks!

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:
Is it really more efficient to have a local variable for transform here or is Rider being over-zealous? I'm just going through a quick C# / Unity crash course (coming from Java) and I recieved a warning about "Repeated property access of a built-in component is inefficient" while working in Jetbrains Rider for the following code snippet.

if (Mathf.Abs(horizontalMovement) > Mathf.Epsilon) {
        horizontalMovement += horizontalMovement * Time.deltaTime;
        var position = transform.position;
        horizontalMovement += position.x;

        position = new Vector2(horizontalMovement, position.y);
        //warning is for this line
        transform.position = position;
    }

It was already complaining about using transform.position.x and transform.position.y which seemed fair enough so I created the position var but would declaring var cachedTransform = transform; ...; cachedTransform.position = position really be more performant here or is the overhead of creating the local variable just going to negate it?

I'm not asking if this is a valid warning in general, it seems to be. I'm asking if it's valid when you're literally just reassigning in the same statement as I am in the last line of my code above

For reference here's what I would end up with if I followed the warning -

 if (Mathf.Abs(horizontalMovement) > Mathf.Epsilon) {
            horizontalMovement += horizontalMovement * Time.deltaTime;
            var cachedTransform = transform;
            var position = cachedTransform.position;
            horizontalMovement += position.x;

            position = new Vector2(horizontalMovement, position.y);
            cachedTransform.position = position;
        }

sentences:
Is it possible to use 3G internet for a TCP/IP game server? I'm working on a turned based multiplayer android game with a friend.
I started working on the game server and client using socket programming.
I found a few tutorials on how to implement a basic chat on android and I started extending that example to suit my needs.
Basically the game is really simple and the communication only include sending a few string from the client to the server every turn and sending the calculated scores back to all the clients after each turn.
the idea is that one of the players creates the game and thus initialize the server, and each player connects to this client using ip.
I tried this solution and it seems to work great when all the players are using the same wifi connection or by using router port forwarding.
The problem is when trying to use 3G internet for the server, I guess the problem is that 3G ip address isn't global and you can't use port forwarding there, correct me if I'm wrong here.

Is there a way to overcome this issue? or the only solution is to limit my game to wifi only or think of a different solution than the standard socket programming solution? I.E web server etc.

what do you think would be the best approach here?

Thanks.

sentences:
How can I make players move diagonally at equal speeds? In a tile-based 2D RPG, a character is supposed to walk into all eight directions.

However, if we blindly tell the player to move in the direction (1, 1), he will be around 41% (√2-fold) faster. Thus, my next idea was to normalize the direction vector before moving.

Unfortunately, since the vector (1, 1) normalizes to (√2 / 2, √2 / 2) ≈ (0.71, 0.71), but the game functions on a whole-pixel basis, this will make the player reach invalid 2D locations. My next idea was that I should just make diagonal movement slower by √2 somehow.

So next, I tried another approach: When I receive an input and the player isn't already walking, I set the player's destination point. Then, I compute how much of his way to the destination the player can actually walk in one frame, given the player's velocity in "pixels per frame". I will repeat the player position update every frame, until the destination is reached.

So for example, if the player needs to move from the origin (0, 0) in the direction (1, 1) at speed 1, his sprite will be displayed at (0.71, 0.71) after one frame, and in the next frame it snaps to his destination (1, 1). This is okay, because the player ends up at a valid coordinate.

While this last approach sounds okay, it has only created more problems, because now diagonal movement takes two frames, and orthogonal movement takes only one frame. In other words, the walking speeds are still not equal.

How do you usually solve this?

sentences:
Reconstruct Quaternion from 48 bit rotation data I'm trying to reverse an animation file from a commercial multiplayer game, whose format was recently updated. The problem lies within joint rotation information, which changed from a 128bit format to a 48 bit format.

The old format actually was using a quaternion representation with 32 bit floats for each component (32 * 4 = 128 bit)

The new format was probably added for quantization purposes (serving better multiplayer performance). I played around trying to apply an euler angle representation (3 x 16 bit integers or 3 x 16 bit half floats) but i failed miserably so I think it should be still a quaternion representation of some sort.

I have located a model which has not changed at all structurally but obviously the model files have been updated to the newest format.

So I do have the byte data, I know the correct rotation angles (again from game data) that correspond to those values as well as the quaternion values from the old version of the files.

New Format Bytes       Rotation(deg) X,Y,Z       Quaternion
41 ED 3F ED 41 6D      0, 90.0, 89.99             0.5, 0.5, 0.5, 0.5
85 F7 2C A0 85 77      59.64, 90, 0               0.3516, 0.61347, -0.351634, 0.61347
AE CE FF BF FF 3F      -180, 0, 18.54             0.98 0.16 0 0
40 ED BE 92 BE 12      0,-90,90                   0.5, -0.5, -0.5, 0.5
DE 40 DA 42 CA 3C      -1.017, -3.633, 4.091      -0.009633918, -0.03154902, 0.03542599, 0.9988277

I'm currently searching the web for quaternion quantization techniques and I'm experimenting with different stuff, so if I find anything I'll make sure to update. Thanks in advance

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:
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:
How do you calculate if 2 lines are facing toward or away? Given the 4 points describing 2 line segments, how do you calculate if line A is towards or away from line B?

The 2 lines have a fixed length, and can be measured as distance from x1/y1 to x2/y2.

sentences:
Unity : Changing color of 2D sprite distorts sprite shape In my 2D game, my circle shape for example, appears round, but when I change the color then it turns into a low poly circle with 8-16 points, more like a potato. Is there any way around this?

    myColor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, visibility);
    Color32 negativecolor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, (byte)(255-visibility));
    MaterialPropertyBlock props = new MaterialPropertyBlock ();
    props.SetColor ("_Color", myColor);
    rend.SetPropertyBlock (props);
    props.SetColor ("_Color", negativecolor);
    backchildrend.SetPropertyBlock (props);

sentences:
Does transparency work with SSS in Unity's HDRP Lit shader? I am using Unity's HDRP Lit shader in Shader Graph (all are version 4.8.0-preview) on Unity 2018.3.0b12.

I am trying to use both transparency and subsurface scattering on the material. However, it appears that the visual appearance loses SSS when transparency is introduced.

Example: The cube on the left has transparency enabled, and has no visible SSS. The cube on the right has the same SSS settings as the left cube, however the right cube has no transparency enabled.

I need transparency to fade in the cube depending on its position, like this:

And here is my master node:

If anyone has an alternative solution that sidesteps this potential limitation, I am all ears. Cheers!

sentences:
I have a problem rotating a 2D game object after collision I'm developing a simple flip game where a cube flips and the bar a it collides with should start rotating after collision. Most snips involve destroying an object, but that's not my case.

Here is my code:

using UnityEngine;

public class CheckI : MonoBehaviour
{
    float x;
    public Rigidbody2D rb2d;

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "bar")
        {
            x += Time.deltaTime * -10;
            transform.rotation = Quaternion.Euler(0, 0, x);
        }
    }
}

How do I start rotation after collision?

sentences:
SetActive doesn't work for GameObject I'm using Unity 2D for my game and I'm facing a weird problem. I have a GameObject (an image) in my scene with a button attached to it. When the player is out of the screen, the image that works as a GameOver panel appears and in case of enough coins, you can resume the game. Everything works fine but when the image appears and I click on button to resume, the image doesn't disappear while the function for decreasing number of coins still works.

Here is my script in which di() is for die and but() for button:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using CodeStage.AntiCheat.ObscuredTypes;
using CodeStage.AntiCheat.Detectors;

public class UIManager2 : MonoBehaviour {

    public static ObscuredInt coin_score = 0;

    public Text coin_text;
    public Slider slider;
    public Slider slider1;
    public Slider slider2;
    public GameObject bul;
    public bool reverse;
    public float timer;
    public int delay = 1;
    public float speed=0.5f;
    public GameObject pause;
    public AudioSource[] aud=new AudioSource[3];

    void Start () {
        coin_score = ObscuredPrefs.GetInt ("Score");
        StartCoroutine (elapsed ());
        slider1.minValue = 0;
        slider1.maxValue = 20;
        bul = GameObject.FindGameObjectWithTag ("Player").GetComponent<Plane19> ().bullet;

   }

    void Update () {
        timer += Time.deltaTime;
        if (timer >= delay && reverse == false) {
            timer = 0f;
            slider2.value++;
        }

        if (timer >= delay && reverse == true) {
            timer = 0f;
            slider2.value -= speed;
      }

        coin_text.text = coin_score.ToString ();
        ObscuredPrefs.SetInt ("Score", coin_score);

        if (slider2.value == 10) {
            bul.SetActive (false);
            reverse = true;
        }

     if (slider2.value == 0) {
            bul.SetActive (true);
            reverse = false;
        }

    }

    public void di(){
        pause.SetActive(true);
        GetComponent<AudioSource>().Pause();
        Time.timeScale = 0;
        aud[0].Play();
        aud[1].Pause();
        aud[2].Pause();

}

    public void but(){
        pause.SetActive(false);
        Time.timeScale=1;
        aud[0].Pause();
        aud[1].UnPause();
        aud[2].UnPause();
        GetComponent<AudioSource>().UnPause();
        UIManager2.coin_score-=2;

    }

IEnumerator elapsed () {
        yield return new WaitForSeconds (2f);
        slider.value++;
        StartCoroutine (elapsed ());
    }
}

sentences:
How to program smooth player 2D movements I am writing a simple 2D game in Rust, having access to the following dependencies:

Piston: for the graphic engine
nphysics: for the physics engine

The genre is Metroidvania, the game features a single map Super Mario style, where the player can only move backwards and forwards and jump (and throw attacks). Modern games, such as Hollow Knight just to give an example, allow the player the same type of movements and they are very smooth.

I have never developed a game with these features, and from my first attempts now it looks like developing these smooth movements is harder than I thought it would be.

I have thought of several alternatives in order to move the player, but I am not sure which of these approaches is the best one or if there are others that are even better:

Do not rely on the physics engine at all and implement the movements just by changing the position of the graphics (shapes/sprites...). I personally didn't try this one because it sounds like a lot of work that does not guarantee good results.
Implement the movements by setting the velocity of the player through the physics engine.
Implement the movements by applying a force to the player through the physics engine.

I guess the answer would also depend on how to handle the user inputs properly and link them to the player movements, since they are very strictly related to each other.

sentences: Box2D Lights - Simulate water I have a libGDX project, in which I have a Box2D world, which is currently filled with some boxes as a terrain. I also added a DirectionalLight to the scene for simulating the Sun. I almost have the effect I'd like to achieve, but is there any way to let the light shine through the water more deeply than it does on the surface?

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:
Recommend a game engine with 2D GUI for a UI-intensive strategy game Yes, this is another recommend game engine request; the 'twist' is I am doing a strategy game and on top of sprites, animation and abstraction of input controls, it has to have GUI support for rather complex controls, such as scroll-bars, select boxes, buttons and such.

I  have tried XNA with various GUI libraries, but the problem is that those libraries was not 'completed'.
 I am just wondering if there are other engines which I can look at?

sentences:
Automated testing of games Are there methods of automated testing of games?

Specific experiences are appreciated, with relevant information about the project such as platform and type of game if that helps with clarification.

sentences:
How to implement smooth wandering on an annulus? I am creating a 2D action platformer and want to create some steering behavior for a mage enemy.

Basically, I want the mage to smoothly wander inside an annulus centered on my player.

Below is an image depicting an example path the mage could follow.

The enemy currently has simple seek behavior. It simply accelerates toward whatever is set as its target.

I tried choosing a random target point in the annulus every so often, but when you do this, the enemy sometimes drifts across the center of the annulus to reach a point chosen on the other side.

So my question is, how can I achieve the desired movement?

sentences:
Could not establish connection with local server process when opening or making Unity project Whenever i try to either create or open a Unity project, I get faced with this error.

Does Unity need a proxy server, because I dont have one. (If so, how do I get one?) And
apparently I need to add some environment variables, (HTTP_PROXY, HTTPS_PROXY and
UNITY_NOPROXY=localhost,127.0.0.1) what values do i add to these?

Unity Package Manager Diagnostics (v0.1.5)

Ran 7 checks

1 succeeded

6 failed

❌ UPM registry reachable (FAIL)
Make an HTTP request to the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Ping UPM registry (FAIL)
Measure the latency of the UPM package registry API

    No successful pings could be made in 0.062 seconds (30 failed)

❌ Ping UPM download (FAIL)
Measure the latency of the UPM package download endpoint

    No successful pings could be made in 0.039 seconds (30 failed)

❌ UPM registry download speed (FAIL)
Test the Internet connection using the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Speedtest.net (FAIL)
Test the Internet connection using Speedtest.net

    Connection error. This could be because a proxy is misconfigured.

✅ HTTP proxy environment variables (PASS)
Detect whether proxy-related environment variables are set (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, UNITY_PROXYSERVER, UNITY_NOPROXY)

    Proxy support has been configured through the following environment variables:
    HTTPS_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    HTTP_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    UNITY_NOPROXY = C:\Program Files\Unity Hub\Unity Hub.exe

❌ UPM health check (FAIL)
Start the UPM process and call its health endpoint

    Server started but did not respond to health requests:
    Error: Invalid protocol: c:

How do I fix this?

sentences:
Phaser Always Fix Camera Position to Sprite I am developing a cross-platform overhead game using Phaser.

Is there a way to always fix the position of a camera to a sprite? The following function works great, but I want the camera to always be centered on the sprite - even when the sprite is nearing the edge of the tilemap.

this.game.camera.follow(this);

The reason I would like this capability is because I am developing a mobile game, and the player sprite manages to get in the way of crucial UI elements. This could be fixed by providing a constant camera on the sprite. Areas without tiles can be filled with a black background.

Here is my problem visualized. As you can see, when nearing the edge of the tilemap, the sprite is no longer centered and it is in the way of my joystick. Instead, I would like the sprite to be centered and the camera to display a black background past the tilemap when it gets near edges.

Thank you in advance,

Christopher

sentences:
vector rotations for branches of a 3d tree I'm attempting to create a 3d tree procedurally.  I'm hoping that someone can check my vector rotation maths, as I'm a bit confused.

I'm using an l-system (a recursive algorithm for generating branches).

The trunk of the tree is the root node.  It's orientation is aligned to the y axis.

In the next iteration of the tree (e.g. the first branches), I might create a branch that is oriented say by +10 degrees in the X axis and a similar amount in the Z axis, relative to the trunk.

I know that I should keep a rotation matrix at each branch, so that it can be applied to child branches, along with any modifications to the child branch.

My questions then:

for the trunk, the rotation matrix - is that just the identity matrix * initial orientation vector ?

for the first branch (and subsequent branches)  - I'll "inherit" the rotation matrix of the parent branch, and apply x and z rotations to that also.

e.g.

using glm::normalize;
using glm::rotateX;
using glm::vec4;
using glm::mat4;
using glm::rotate;

vec4 vYAxis     = vec4(0.0f, 1.0f, 0.0f, 0.0f);
vec4 vInitial   = normalize( rotateX( vYAxis, 10.0f ) );

mat4 mRotation  = mat4(1.0);

// trunk rotation matrix = identity * initial orientation vector
mRotation *= vInitial;

// first branch = parent rotation matrix * this branches rotations
mRotation *= rotate( 10.0f, 1.0f, 0.0f, 0.0f );     // x rotation
mRotation *= rotate( 10.0f, 0.0f, 0.0f, 1.0f );     // z rotation

Are my maths and approach correct, or am I completely wrong?

Finally, I'm using the glm library with OpenGL / C++ for this.  Is the order of x rotation and z rotation important?

sentences:
Time to render each frame is proportional to the amount of models in the scene This question is deliberately written in a "High-Level" manor to avoid screeds and screeds of code snippets, hopefully I can get my point across, I am using C++ and OpenGL.

I have a game engine, and in the engine I have my "game loop" that is called every frame, one of the things in this game loop is my call to Render(), before a call to SwapBuffers(), nothing new there.

Essentially my engine draws the scene using a scene graph, that is I have GameObject's and each object has a GameComponent. So when the Render() is called in the "game loop" I get the root GameObject and render its GameComponent and then move onto the next GameObject and render its GameComponent, etc. until all GameObject's and each of their GameComponent's are drawn using glDrawElements(...).

One of the GameComponent's a GameObject can have is a MeshRenderer, that is a Mesh paired with a Texture. In my scene I want to add loads of tree models, therefore I create for example 50 GameObject's that each have a MeshRenderer component (a tree) that will eventually in the game loop described above be drawn.

The issue with this is that the time it takes to render a frame is directly proportional to the number of tree models I have (O(N) I think is how you word it). For example with 100 trees the render time is 23ms, with 200 trees it is 46ms, with 400 trees it is 90ms so on and so forth.

This is terrible, I need at least 1000 trees in my "game world" and even at around 400 my game is "laggy". Because the time to draw a frame is proportional to the number of tees I know that each frame it is re-drawing each mesh essentially (every frame drawing 100 trees, and then 200 and so on, and the time to draw scales with it)

My question is this - How can I store the mesh data so that I don't need to draw them from scratch every frame, I can just draw them once, and then re-use that data for the next frame, but don't re-draw it all? is there a way to firstly use glDrawElements(...), then store that mesh data(all the vertices etc.) and then every frame after call something like for example glDrawExcistingElements() instead of  glDrawElements(...). Ultimately meaning that for consecutive frame draws the time is the exact same wether I have 1 tree or 1000 trees because the system is simply saying "here is the scene I already drew", instead of "lets draw it all again from scratch".

sentences:
Is it possible to prevent the collider 2D outline from hiding in Unity? Is it possible to prevent the collider 2D outline from hiding in Unity?
I am creating some animations in Unity. To create animations I select different parts of a hero and move them frame by frame. Now I am working on the run animation and would like to see the bottom collider during parts movement for the animation creation.
In my case the collider outline is red:

I don't want the red bottom line (which is the collider outline) to disappear while I am creating animations. Should I research the Unity extensions and maybe write my own which would prevent the collider from hiding or is it possible to achieve what I want out of the box somehow?

sentences: Displaying normals of a geometry I have a rectangle which is created by 2 triangles and it is in x-z plane, and i have object on it. Now, the normals of two triangles (face normals) are y axis i.e. (0,1,0). I want to display normals of two triangles for which i need two points to draw a line to show normal. Intuitively if i take center of a triangle as one and (0,1,0) as second point of a normal then both of the normals will converge to single point. I dont think it is correct as the normal should be exactly perpendicular to the surface. We can do a trick and take one point as a center and other by increasing y coordinate keeping x and z same, but what if we have curved surface and not a plane board? What about the cylinder made of triangles? How could we display normals as a lines of cylinder? I guess i am missing very basic concept here, please help me to understand it and tell me how to calculate the two points of normal.

sentences:
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:
Shader compile log depending on hardware I'm done with the core of my graphics engine and I'm testing it on every platform I can get my hands on. Now, what I noticed is that different drivers return different shader and program compile log content.

For example, on my friend's laptop if you successfuly compile a shader then the log is simply empty. However on my PC I get some useful information along with it.

So if I compile a vertex shader, I'll get:

  Vertex shader was successfully compiled to run on hardware.

Which isn't that impressive, but is what happens when I compile a program. On my friend's computer the log is empty, since the program compiles. However on my own computer I get:

  Vertex shader(s) linked, fragment shader(s) linked.

Which is awesome, because I'm attaching a geometry shader with 0 (I have a geometry shader file with trash, so it doesn't compile and the pointer is set to 0), and the compiler just tells me which shaders linked.

Now it got me thinking, if I was going to buy a graphics card, is there a way for me to get the information about whether or not I'll get this "extended" compile information? Maybe it's vendor specific? Now I don't expect an answer TBH, this seems a bit obscure, but maybe somebody has any experience with this and could post it.

sentences: OpenGL: VBO or glBegin() + glEnd()? I recently was given this link to a tutorial site from someone who I gave the original OGL Redbook to. The third header down says distinctly to forget glBegin() & glEnd() as the typical render method. I learned via the Redbook's method, but I see some benefit in VBOs. Is this really the way to go, and if so, is there a way to easily convert the render code, and subsequent shaders, into VBOs and subsequent datatypes?

sentences:
Unity3d - Transform rotation(angle) help Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right.

Here's the part of the code which controls the rotation:

rotationDestination = new Vector3(60, 270, 0);
if (Vector3.Distance(transform.eulerAngles, rotationDestination) > 0.2f) {
  transform.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles,
                                       rotationDestination,
                                       rotationSpeed * Time.deltaTime);
}

If I try to make the Y axis -90 a.k.a (60, -90, 0) then it rotates constantly to the left.

How do I make it rotate straight to the left (90 degrees) ?

Thank you.

sentences:
Custom functionality for content saved to database I'm creating a turn-based game where I store most of my content in a database (enemies, items, npcs, location data, etc). This allows me to update the content easily without needing to rebuild anything.

I'm wondering if there is a way to safely link something like an enemy db instance to some hardcoded custom functionality. For example, maybe at the start of combat a certain enemy casts a specific spell or yells something.

I could look up a custom behavior file based on an enemy name or db id, but then if it changed that functionality would break. I could have a field for uploading a custom behavior script but that could introduce a slew of issues.

tl;dr; Are there standard patterns for adding custom functionality to content that is saved/loaded from a database?

sentences:
Pros & Cons on different game engines I've been working with the XNA-Framework(only in 2D) for over a year now. Now I want to try and start a bigger 3D-project. But somehow I have difficulties to decide which engine/Framework I should use. So far I gathered three possible Frameworks, I want to list here:

XNA with the OX-engine: I already have some experience with XNA and the Ox-engine seems to be the best possible open source engine I could use here.
OGRE-engine: Always wanted to get a little deeper into C++ and the engine seems to be well documented.
Cryengine/Sandbox 2 or higher: Well this one also needs C++ knowledge, seems to be user friendly and lets face it one of the most powerful engines out there.

My goals are to start learning 3D-programming and to realize first 3D projects by taking baby steps.

So the question is what engine would you guys recommend? Is there any other stuff I have overseen? as mentioned before getting a little more into C++ would be great to but it is not a "must have" as I alredy worked with C/C#. Most important to me would be that I could lear stuff that I can use later on for example in other Frameworks. This is important to me because I want to get deep into one thing I will be doing for a long time.

Thanks in advance!

sentences: How Plants vs Zombies animation is done? I really like the plants vs zombies style of animation and it doesn't look complicated yet the result is really good. I doubt it's made of sprites seeing there's a large number of animations, combinations, distortions, outfits. So how that kind of animation is done?

sentences:
Why is that when I use Rigidbody the object falls through the floor? It keeps falling through the floor.

On the object I added a Rigidbody and it already has a box collider.

And the floor:

I want to make a bouncing ball effect. I'm using the official unity tutorial:

Tutorial

However, my object falls through the floor.

sentences:
SpriteBatch passing textures to GPU How exactly (or, how often) are textures passed to the GPU shaders in MonoGame/XNA?

I am asking because I was profiling a MonoGame/XNA application and noticed that the memory controller load (using GPU-Z) was pretty high.

After disabling pretty much everything except the background texture (a static 24-bit 1920x1080 image), my frame rate went up as expected (~500fps) with GPU load peaking at 99% - but what surprised me was that the GPU memory controller load remained at ~50%.

Setting the breakpoint inside TextureCollection.PlatformSetTextures confirmed that SpriteBatch is indeed passing this texture to the pixel shader on each call.

Does this really mean that all textures are being passed to GPU on each frame over and over again? Am I misinterpreting these readings, or have a fundamentally wrong understanding of how the rendering process should work? Or did I mess something up with my Draw calls?

sentences:
How can I drag a polygon based on a mouse-moved event? I have drawn a polygon in Java using java.awt.Polygon. I want to move that polygon with the mouse (by dragging it). I know that I have to use mouseDragged  method in addMouseMotionListener. That way I can know coordinates of the path in along which the mouse is dragging the polygon.

But the problem is that I do not know what to do with the coordinates I get from the mouse to move the polygon. This is a part of the code:

public void mouseListeners(DrawEverything det) {
    det.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseDragged(java.awt.event.MouseEvent evt) {

            if( isMouseInMe(evt.getX(), evt.getY())){//this "if" checks if the cursor is in the shape when we drag it

                int xTmep , yTemp ;
                xTmep = (int) (evt.getX() - xMousePressed) ;//xMousePressed--> the x position of the mouse when pressed on the shape
                yTemp = (int) (evt.getY() - yMousePressed) ;

                for(int i = 0 ; i < nPoints ; ++i){
                    xPoints[i]  +=    xTmep;//array of x-positions of the points of polygon
                    yPoints[i]  +=   yTemp;
                }
            }
        }
    });

This part is the main part that I am having trouble with:

for(int i = 0 ; i < nPoints ; ++i){
    xPoints[i] += xTmep;
    yPoints[i] += yTemp;
}

sentences:
How do I determine the position of one vector relative to another? I'm making a game for Kinect in Unity which tracks hand movements. I have the player's root position and the position of their fist stored as 3-dimensional vectors (Vector3 in Unity), but they're both in world space.

How can I determine the location of the player's fist relative to their root position?

sentences:
How do I efficiently generate chunks to fill entire screen when my player moves? In my game I generate chunks when the player moves. The chunks are all generated on the fly, but currently I just created a simple flat 8X8 floor.  What happens is that when he moves to a new chunk the chunk in the direction of the player gets generated and its neighboring chunks.

This is not efficient because the generator does not fill the entire screen. I did try to use recursion but its not as fast as I would like it to be.

My question is what would be an efficient way of doing so? How does minecraft do so?
When I say this I mean just the way it PICKS which chunks to generate and in what order. Not how they generate or how they are saved in regions, just the order/way it generates them.

I just want to know what is a good way to load chunks around the player.

sentences:
UE4 bone sockets imported from blender have buggy local transform I'm exporting this armature with two sockets for left and right hands. As you can see on the Transforms location and rotation are all 0s.

Here's my export settings on blender:

Now I import it into UE4 and if I check the socket I get this:

The Y axis local transform has value -0.085241. And I cannot get rid of it for the life of me.

sentences:
How to implement 3d maneuver gear physics in unity? I am trying to create a attack on titan styled game for a school project. I am not new to programming, but I am new to game development. I couldn't find any resources for this, hence I am posting it here.

How do I go about implementing 3d maneuver gear physics from attack on titan anime?

What is it?

In case you don't know, here's a brief link about 3d maneuver gear.

A brief commentary about 3dMG

It's basically a grappling hook based system (similar to what you would find in a spiderman game), but it has different components to it, which makes it quite complex to think about.

My Approach so far

I have seen tutorials on how to use hooks in unity and stuff, but it would be great if someone could give me a general idea as to how to even start with this kind of thing. I would appreciate your answer, even though it is not unity specific.

The idea is to have two points on the character, from where we fire the ropes. These ropes could simply be graphics (or unity's RaycastHit). And then we would also need information about the hook "hit point". Once we know that, we just reel in ourselves towards that. However the problem is that I don't know how to use momentum etc to effect the character's movement. Also since it's not just one rope(like a spiderman's game), but two, it's even difficult to think as to how would the movement be if user uses only left hook, or right hook or both. Also there is this gas aspect, which would propel you further and it should also be taken into account, along with momentum that we would carry.

So any general idea would be greatly appreciated.

sentences:
LibGDX touchDown event continues I'm using libGdx to create a simple platformer.

I used a set of images as an onScreen controller for Android, and use this code to fire a shot ->

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            downPressed = true;
            return true;
            //return super.touchDown(event, x, y, pointer, button);
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            downPressed = false;
            //super.touchUp(event, x, y, pointer, button);
        }

But when I keep the button pressed, the player continues to shoot which I don't want, I want the player to tap-to-shoot.

What am I doing wrong?

sentences:
Sending a Tilemap Layer over a socket connection (GMS2/GML) I'm working on a multiplayer game in GameMaker Studio 2 using sockets and built-in networking functions. I have a server that can receive and send messages to and from clients.

What I'm trying to do is take the map data (on the server) and send it to the clients, so that I can create a map on the server and have it automatically sent to clients upon entering the game. This map will be a Tilemap Layer.

Does anyone have any ides on how to serialize a GameMaker Studio 2 Tilemap to a data type that can be sent over sockets?

sentences:
How to keep a round body rotating without rotating it's center I want to make a game in Unity in which the Player is a sad star.  I want to have the points (The "arms and legs and head") of the star to rotate like a circle but to keep it's face (which is in it's center) still.  How can I do that ?

The body should rotate and it's center should stay still. Many thanks in advance!

sentences:
How to rotate a gameobject to the specific angle I have tree model that is being rotating .After certain angle it should stop rotating.I have done a sample code.But the tree is not stopping.

void Update () {

        //transform.Rotate (0f,0,0.5f*Time.deltaTime);
        //transform.Rotate (Vector3.forward,Time.deltaTime*5);
    transform.Rotate (0f,0f,time);
    Debug.Log(time);
    time+=0.5f;
   if(time==5.5f)
    {
        transform.eulerAngles=Vector3.zero;
    }

}

From the above code I need to stop the rotation when the z axis value is 5.5f.How can I do this . Please help me.

sentences:
Which part of MVC should be responsible for selecting a unit Imagine a turn-based tile game, that generally looks like Heroes' combat view. Except for the fact a player can choose any of his units to command.

Our team is implementing the game according to MVC paradigm.

Some logic needs to be defined in order to allow selecting only allied units, for instance. And the selected one should be highlighted by the View.

For now we have made a Controller responsible for this. But to me it feels strange when the View is rendering data that comes from the Controller itself instead of the Model.

Is there any common practice to put such logic in Model or Controller?

sentences: How to add slowmotion effect in libgdx> I want to add slow motion effect with a collision as a trigger. So I want to have an effective way to trigger a slowmotion effect on bodies as well as sprites that can be caled in the update method. Can anyone please help me with this or provide a link as to where I can find the answer?

sentences:
How to handle global Data within a state machine setup? (C#) I am currently building a turn-based framework (Unity,C#)

I was tired of my former tight-coupled systems and opted for a state machine this time, basically all components subscribe to the state-Enter and state-Exit event. I am aiming for scalability and structure.

But I ran into a problem. If the components cannot communicate directly, how to store and forward data in between states?

Example: The game starts with unit placement. The player has the option to select a unit in his pool via the ui and place it on the board.
The Unit-creation logic is and should(?) be handled inside the level script. How does it know where to create which unit?
Ive done a workaround with a static container class, with is basically my clipboard. The player assigns a grid cell for his selected unit and the game leaves the state.
While leaving the state the level scripts scans the clipboard and creates any assigned units.

But I feel like a cheated my attempt to really work strictly within a firm structure this time to guide the design process.

Is there a better way?

sentences:
Tweaking incentives for lottery with a twist I have been developing a game which is a lottery where your chance of winning is proportional to the square of your bet.

To prevent people from overbetting the pot (optimal strategy shouldn't just be to bet as much as possible, I think), and to make subsequent jackpots appealing, I've made it so the winner gets (current round bets + past round leftovers) / 2.  48% of the jackpot goes forward, and 2% of the jackpot goes to the house.

This is generally working, but when there are not many people on the site, one person will sit there and drain the pot every round with the minimum bet.

Though I think the concept is pretty cool, I have the feeling that some small tweaks could make a big difference.

Any ideas how to get the pot to grow as big as possible?

Apologies if this is not the right place to post.

sentences:
How can C# access JavaScript variables in Unity 5? I have a static public boolean in a JavaScript and I want to access it in a C# script. When I tried the way that you would call a static variable from another script though, it said that the variable and script weren't recognized. Here is my JavaScript code:

public static var ItemPurchased = false;
function OnGUI () {
    if (GUI.Button(new Rect(10, 90, 190, 24), "Click here to collect water.")){
         ItemPurchased = true;
}

I do believe that the JavaScript is correct. On the other hand, here is my C# script:

public static bool itemowned = false;
void Update () {
    if(PurchaseItemScript.ItemPurchased == true){
        itemowned = true;
        PurchaseItemScript.ItemPurchased = false;
    }
}

PLZ HELP!

sentences:
OpenGl lighting casting black shadow I'm having issues with lighting that I can't figure out, namely solid black sections. Any ideas?

Here's my fragment shader code:

#version 400 core

in vec2 pass_textureCoords;
in vec3 surfaceNormal;
in vec3 toLightVector;
in vec3 toCameraVector;

out vec4 out_Colour;

uniform sampler2D modelTexture;
uniform vec3 lightColour;
uniform float shineDamper;
uniform float reflectivity;

void main(void) {
    vec3 unitNormal = normalize(surfaceNormal);
    vec3 unitLightVector = normalize(toLightVector);

    float nDot1 = dot(unitNormal, unitLightVector);
    float brightness = max(nDot1,0.4);
    vec3 diffuse = brightness * lightColour;

    vec3 unitVectorToCamera = normalize(toCameraVector);
    vec3 lightDirection = -unitLightVector;
    vec3 reflectedLightDirection = reflect(lightDirection,unitNormal);

    float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
    specularFactor = max(specularFactor,0.0);
    float dampedFactor = pow(specularFactor,shineDamper);
    vec3 finalSpecular = dampedFactor * reflectivity * lightColour;

    vec4 textureColour = texture(modelTexture,pass_textureCoords);
    if(textureColour.a < 0.5) {
        discard;
    }

    out_Colour = vec4(diffuse,1.0) * textureColour + vec4(finalSpecular,1.0);
}

and vertex shader code:

#version 400 core

in vec3 position;
in vec2 textureCoords;
in vec3 normal;

out vec2 pass_textureCoords;
out vec3 surfaceNormal;
out vec3 toLightVector;
out vec3 toCameraVector;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform vec3 lightPosition;

uniform float useFakeLighting;

void main(void) {
    vec4 worldPosition = transformationMatrix * vec4(position,1.0);
    gl_Position = projectionMatrix * viewMatrix * worldPosition;
    pass_textureCoords = textureCoords;

    vec3 actualNormal = normal;
    if (useFakeLighting > 0.5) {
        actualNormal = vec3(0.0,1.0,0.0);
    }

    surfaceNormal = (transformationMatrix * vec4(actualNormal,0.0)).xyz;
    toLightVector = lightPosition - worldPosition.xyz;
    toCameraVector = (inverse(viewMatrix) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz;
}

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:
How do I make circles bounce off each other realistically? I'm trying to create bouncing balls with realistic physics. At the moment, when the balls hit each other, they bounce back in the same direction they came from. How do I make them more realistic?

I don't know much about physics. What things should I be reading about?

Here's an image of how I imagine balls would bounce in real life:

how I think it should work (original source: http://thewombatguru.nl/Bouncing.png):

Is this how it works?

sentences:
Connecting android game with website to show user scores on logon How do I make my android game users logon to my website to see their scores? I can create fb login in app and website, but I need to show the score of the particular user in the website.
An example: A user opens my game,sees a login page(saves data online) or sign in as guest(saves data locally), plays sometime. If user goes to my website using the login, they should see their scores there.
This should be achievable by using Google play services. How do I make the user login to my website using google play login?. Is that even possible?

sentences:
Will working with a publisher help me prevent my game from being cloned? I read many articles on "How (or why not without) to make mobile game without publisher". But the question that bothers me is:

"What if I make a game, that really hits the market in the eye and people start playing it BUT some publisher will see my game and make the very similar game in 2 weeks and makes it ever more succesfull?"

Is this the main reason why I should choose to go with the publisher?

EDIT: My main concern is not about my weeks spent on developing (I love it!). My concern is: Me working WITHOUT publisher (therefore using not so great marketing techniques) can take some time to get my game to peoples hart VS other developer (USING publisher) can clone my game and with publishers help get their cloned game to public much faster. Before people even realizing it is a copycat.

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:
Game timings and formats There are more or less standardized TV-show/movie formats and recommended timings:

1.

  By the early 1960s, television companies commonly presented half-hour long "comedy" series, or one hour long "dramas." Half-hour series were mostly restricted to situation comedy or family comedy, and were usually aired with either a live or artificial laugh track. One hour dramas included genre series such as police and detective series, westerns, science fiction, and, later, serialized prime time soap operas. Programs today still overwhelmingly conform to these half-hour and one hour guidelines. Source

2.

  In the United States, most medical dramas are one hour long. Source

3.

  Traditionally serials were broadcast as fifteen minute installments each weekday in daytime slots. In 1956 As the World Turns debuted as the first half-hour soap opera. All soap operas broadcast half-hour episodes by the end of the 1960s. With increased popularity in the 1970s most soap operas expanded to an hour (Another World even expanded to ninety minutes for a short time). More than half of the serials had expanded to one hour episodes by 1980. As of 2010, six of the seven US serials air one hour episodes each weekday. Source

Interesting. Are there any standards of timing in game development?

Well, 5-20 minutes casual games, of course. There is even a "5-minutes-game" site. And 1-hour-gamer site. Are there 1-week, 1-year, 1-eternity game formats? Chess and Go - deep games that you can study all your life; but they are played in hour or several days (pro games). Addictive long-term online role-playing games (without win-condition) are played in monthes and, possibly, years. Replayability is an important factor to consider.

It's good when game design document contains a line: "A game is designed for solving in X hours". How can it be measured before there is any prototype or demo? When you know your game format, you know your audience (and vice versa). It is practical question.

Are there psychological researches about dynamic of gaming interest and involvement?

And is there a correlation between game format and game genre?

sentences:
dual contouring concept and term translations I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've read about every paper i could find on the internet about how to implement such a thing and, since i have a very basic experience in game/3d/complex programming, I've had quite a hard time. but I think I've found the solution i was looking for and would like to check with some more experienced programmer if my solution seems right and if I really successfully wrapped my mind around some of those pesky terms that were haunting my nights for the last few months;

Edit: I will try and add some more precise detail as to what i already do here in bold

so, first of all, I've created an object called voxel when I say object, i refer the the user side's way of handling the data received from the server. I already compress the data as to have it fit a byte or a short and use bitwise operations. Voxels are loaded once from the server then stored to memory unless the server returns a change to that voxel (not sending entire chunks for a small change), a voxel knows it's type and it's "integrity" (in this case, how much that stone voxel has been mined for example. I think it refers the the volume i often read about?). Those voxels "will" be created from a pre generated world map for a persistent world. Yes, the world will have overhangs and most of all, tunnels players can mine.

then i got a chunk, composed of at most 32x32x32 voxels. A chunk knows it's world position and has a 3D array of voxels passed from the server when first loaded to memory, then the client/server only updates the voxels that have changed since the last update. A chunk also knows it's neighbors (if such neighbors have been loaded into memory, or creates a default chunk of 32x32x32 air voxels)

To find the surface, inside a chunk, i check every voxel from the bottom,left,near (I think it is the right order to fit with the way OpenGL read it's coordinates?) to the top,right,far. each time, i take the current voxels and all it's 7 neighbors in a cube shape and check whether their is a type change from solid to air in any of them, indicating a surface running through that cube. If there's a type change, i compare every edges to see if there's a type change and if so, place the entersection of that edge using and average of both corners integrity. doing so for all 12 edges allows me to average all the planes to a single point inside that cube and create a vertex and store it in an array.

The point where I'm confused is this: what should i do next? I think I should check along one edge that displays a type change to find the 3 other cubes that has the same edge and find their vertices. Since i know what direction the ground is (comparing the type change along the edge axis) I can deduce the front and back of the quad. taking 3 of those 4 vertices should allow me to get a normal from their dot product and from there, go around that normal CCW and send those vertices to the GPU for the rendering phase. I guess the real question here is: How do I get the right order of vertices to form triangles that OpenGL can draw correctly from that large collection of vertices generated while finding the surface?

In theory, in my mind, it makes sense! but I find it so much simpler than all those papers I've found, that i fear I've missed the boat completely! I get lost when it comes to Isosurface (I guess here, the formula they're talking about would be the average of integrity along any type change?) and hermite data (here, should i read voxel collection instead?) and most maths are slightly beyond my understanding yet (working on it tho and I progressed quite a bit) please, can you help me out here and guide me a bit?

sentences:
Cull mode back faces When i draw a cube using indices, the faces of the cube are skewed but only when CullMode is set to cull back. When i switch it to cull none, it draws the cube perfect. Unfortunately i cant post any code at the time because I'm using my phone, but what are some possible explanations for why the faces of my cube are skewed wjile culling the back? I was thinking the order of my indices may be the problem.

http://i.imgur.com/S1PfxCr.png

VertexType* vertices;
unsigned long* indices;
D3D10_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
D3D10_SUBRESOURCE_DATA vertexData, indexData;
HRESULT result;

m_vertexCount = 8;
m_indexCount = 36;

vertices = new VertexType[m_vertexCount];
if(!vertices)
{
    return false;
}

// Create the index array.
indices = new unsigned long[m_indexCount];
if(!indices)
{
    return false;
}

vertices[0].position = D3DXVECTOR3(-1, 1, -1);
vertices[0].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[1].position = D3DXVECTOR3(1, 1, -1);
vertices[1].color = D3DXVECTOR4(1, 1, 0, 1);

vertices[2].position = D3DXVECTOR3(-1, -1, -1);
vertices[2].color = D3DXVECTOR4(1, 1, 1, 1);

vertices[3].position = D3DXVECTOR3(1, -1, -1);
vertices[3].color = D3DXVECTOR4(0, 1, 0, 1);

vertices[4].position = D3DXVECTOR3(-1, 1, 1);
vertices[4].color = D3DXVECTOR4(0, 1, 1, 1);

vertices[5].position = D3DXVECTOR3(1, 1, 1);
vertices[5].color = D3DXVECTOR4(0, 0, 1, 1);

vertices[6].position = D3DXVECTOR3(-1, -1, 1);
vertices[6].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[7].position = D3DXVECTOR3(1, -1, 1);
vertices[7].color = D3DXVECTOR4(1, 0, 0, 1);

//indices = { 2, 0, 3, 3, 1, 0, 3, 1, 7, 7, 5, 1, 6, 4, 2, 2, 0, 4, 7, 5, 6, 6, 4, 5, 0, 4, 1, 1, 5, 4, 6, 2, 7, 7, 3, 2 };

indices[0] = 2;
indices[1] = 0;
indices[2] = 3;
indices[3] = 3;
indices[4] = 1;
indices[5] = 0;
indices[6] = 3;
indices[7] = 1;
indices[8] = 7;
indices[9] = 7;
indices[10] = 5;
indices[11] = 1;
indices[12] = 6;
indices[13] = 4;
indices[14] = 2;
indices[15] = 2;
indices[16] = 0;
indices[17] = 4;
indices[18] = 7;
indices[19] = 5;
indices[20] = 6;
indices[21] = 6;
indices[22] = 4;
indices[23] = 5;
indices[24] = 0;
indices[25] = 4;
indices[26] = 1;
indices[27] = 1;
indices[28] = 5;
indices[29] = 4;
indices[30] = 6;
indices[31] = 2;
indices[32] = 7;
indices[33] = 7;
indices[34] = 3;
indices[35] = 2;

vertexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
vertexBufferDesc.ByteWidth = sizeof(VertexType) *m_vertexCount;
vertexBufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.MiscFlags = 0;

vertexData.pSysMem = vertices;

result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
if(FAILED(result))
{
    return false;
}

indexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(unsigned long) *m_indexCount;
indexBufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0;

indexData.pSysMem = indices;

result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);

return true;
}

void CubeClass::RenderBuffers(ID3D10Device* device)
{
unsigned int stride;
unsigned int offset;

stride = sizeof(VertexType);
offset = 0;

device->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);

device->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);

device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

device->DrawIndexed(36, 0, 0);

}

sentences:
Best way to do large XNA animations? What's the best way to have large animations in XNA 4.0? I have created a spritesheet with the sprite being 250x400 (more of an image than a sprite but hey ho) and there are approximately 45 frames in the animation. This causes problems for XNA as it says that the maximum filesize for Reach is 2048.

I'd rather not change to hidef as I heard that means that your game is less compatible with some computers and systems so does anyone have any idea what the best thing I could do is? The only thing I could come up with is to have a list of textures to flick through but that's not ideal.

sentences: Difference between Material and Shader In games, materials often only influence the visual appearance of objects. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and shaders? Should you write one shader for one material?

sentences:
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:
Passive skills and items I'm making a small text browser RPG game using PHP, MySQL and Java Script (and jQuery). All the items are saved in the MySQL database.

Every now and then a character have to make a skill roll (Talk, Climb, Sneak, etc. ), but I have the following problem - some of the items give passive bonuses to some skills. Let's say we have Official Suit item, it gives +1 to Talk rolls and One time use only - automatic success on a Talk roll.

My problem is the following - how can I implement a function for every item, that gives the bonuses or other options when the appropriate roll is made. I want when the player click the Talk option, a function to be run that makes the Talk roll and searches character's inventory for items that give him bonuses to that roll. If it sees that the player have such an item, let's say it's the Official Suit, it runs the item's function which gives the +1 Talk bonus and if the roll fails, the function gives an option to use the special ability of the item for automatic success.

So what is the best way to do this? Keywords to each item or some other way? I can't think of a scalable solution.

sentences:
Where can I find good (well organized) examples of game code? Where can I find good (well organized) examples of game code? I'm hoping that I can pick up some organizational tips. Most examples in books are too short and leave out lots of detail for the sake of brevity. I'm particularly interested on how to group your variables and methods so that another programmer would know where to look in the code. For example initializers at the top, then methods that take input, then methods that update views.

I don't care about a particular language, as long as its OOP. I looked at the Quake 2 and 3 sources, but they're straight C and not much help for getting tips on organizing your objects.

So, have you seen some good source? Any pointers to code that makes you say "wow, that's well organized" would be great.

sentences:
3D models on 2D tilemap perspective when scrolling I am creating a small top-down game, where the player traverses a 2D tilemap, with an illusion of depth provided by 3D models for things like buildings or trees.

Having gotten to the point where I can render models and a basic terrain as a background, I've gotten stuck on the task of joining both together in a way as to seem not too unnatural.

I think an image description of my problem would be best suited for this. For the sake of explanation, the model I am rendering is a transparent cube.

In this position, where the camera has a head-on view, everything looks generally normal. Now, if I shift the model a bit to the right, the following gets displayed:

Not horrible by any means, but it does look a tad bit awkward: the road remains straight while the building seems to be jutting out from the path. The building itself has been panned, but the ground has remained static. Additionally, this has proven rather nausea-inducing during testing, due to the awkward mixing of angles.

The only possible solution that came to me (and hence why I am asking here) would be to render each tile as a model as well. I think that creating a flat rectangle the size of the viewable screen and texturing it with the visible tiles could possible work: that way, since it is a model, it can be rotated and shrunk based on visibility, like the model.

However, I am (very) new to OpenGL, and I fail to see how I could implement this. I know that I can draw a textured rectangle with one, solid texture. I don't know how to draw multiple, smaller textures across a face of the rectangle: is it even possible?

Then, considering that I wish to have other things like cliffs, I wondered if cliff tiles could be rendered as being slanted. My map format has a height map, so the slant could be determined by the direction in which the nearest tile with a smaller height resides.

I fear I'm being rather clumsy at explaining this, which is why, using my most Picasso-esque skills I have put together the next image:

Essentially, though the map itself is made up of 2D tiles, by changing the angle they are being rendered at I reckon it would be possible to simulate a 3D effect: the player camera (smiley in the image) would not be able to see the leftmost side (yellow) if they are positioned towards the right.

Regardless, this is all hypothetical and I have no idea where to even begin. Is it possible to render the background as essentially a model in 3D space? If so, how would this be done: via one large cuboid, or multiple smaller ones? Lastly, would slanting textures based on neighbor height work? More importantly, is there a better way to achieve my goals than what I have proposed?

For all it matters, I am writing this game in Java, utilizing the LWJGL OpenGL wrapper.

sentences:
What is the most efficient container to store dynamic game objects in? I am making a first person shooter and I know about about a lot of different container types but I would like to find the container that is the most efficient for storing dynamic objects that will be added and deleted from the game quite frequently. EX-Bullets.

I think in that case it would be a list so that the memory is not contiguous and there is never any re sizing that is going on.  But then I am also contemplating using a map or set.  If anyone has any helpful information I would appreciate it.

I am writing this in c++ by the way.

Also I came up with a solution that I think will work.

To start off I am going to allocate a vector of a big size.. say 1000 objects.  I am going to keep track of the last added index in this vector so that I know where the end of the objects are.  Then I will also create a queue that will hold the indices of all objects that are "deleted" from the vector. (No actual deleting will be done, I will just know that that slot it free). So if the queue is empty I will add to the last added index in the vector + 1, else I add to the index of the vector that was at the front of the queue.

sentences:
Rotating gradually in response to input, instead of snapping I'm trying to replicate Silent Hill's mechanic where if you press a button, the character does a 180, but instead of getting a smooth turn around, my character is snapping from one rotation to another.
This is the code I have so far:
if (Input.GetKeyDown(KeyCode.Tab))
{
    transform.Rotate(0f, 180f, 0f);
}

I also have a Sprint(); function and I want to disable this feature if the character is sprinting.
Here's the code for that:
private void Sprint()
{
    float newTurnSpeed = _turnSpeed - 1.4f;

    vertical = Input.GetAxis("Vertical");
    horizontal = Input.GetAxis("Horizontal");

    Vector3 direction = new Vector3(0f, 0f, vertical);
    Vector3 movement = transform.TransformDirection(direction) * _sprintSpeed;

    transform.Rotate(0f, horizontal * newTurnSpeed, 0f); //add the new turn speed
    isGrounded = _characterController.SimpleMove(movement);
}

Any help is appreciated!

sentences:
Texture not appears? I make fat cube "fbx" with blender and export it to unity. this fat cube not allowed texture to appears ! i make a small cube by unity and texture pop-up !
What is wrong ?

sentences: Is there a way to check android version running the game using Unity3D? I want to separate code to run only on android 4.4 or higher. If it's lower, I do not want to run  this code. What should I do?

sentences:
How to rotate camera around some point? I have screen with dimensions: 800x600.
The object that I want to rotate around is located at (400,300, -50) - center of the screen.
Orthogonal projection:
Near plan - 0.1f, far plane - 1000.0f
left - 0, bottom - 0, right - 800, top - 600

Camera:
position at (0,0,0)
look at (0,0,-50)
up vector (0,1,0)

Now what I'm doing to rotate is calculate the X of "look at" using: 0 + width * cos(A).
Y remains the same (0).
Z is calculated using: -50 + width * sin(A).

Now the problem that I'm facing is that after some angle the object starts to disappear, and it doesn't rotate around the object. What can be the problem?

sentences:
What's an optimal procedure to create a connected cyclic grid of nodes and edges for A* pathfinding like the title says, I'm trying to create a grid of nodes that hold edges or connections to each other so I can perform A* algorithm to have objects traverse across them as seen in your standard RTS.

I want to know if there is a general structure and algorithm for this node grid data structure as I can't find a good resource online. For instance, I will be moving my objects via position (Vector3) so I will have to calculate my edge weight to be the magnitude between two nodes. Is this a standard practice?

Could anyone perhaps guide me to the rough basics on how this is achieved in a standard RTS? I would greatly appreciate any information!

sentences:
Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX) Here's my game loop:

uint64 target_fps = 60;
  uint64 ticks_per_s = SDL_GetPerformanceFrequency();
  uint64 target_ticks_per_f = ticks_per_s/target_fps - (ticks_per_s/1000); //aim for (target - 1ms) to err on side of > 60fps

  uint64 ticks_per_cur_f = 0;
  uint64 t_last_render = 0;
  uint64 t_last_update = SDL_GetPerformanceCounter()-target_ticks_per_f;
  int max_updates = 3;
  int updates = max_updates-1;

  while(!done)
  {
    while(
      t_last_update > SDL_GetPerformanceCounter() - target_ticks_per_f &&
      t_last_render > SDL_GetPerformanceCounter() - target_ticks_per_f
    )
    {
      SDL_Delay(1);
    }

    //update
    updates = 0;
    while(updates < max_updates && t_last_update < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      t_last_update += target_ticks_per_f;
      updates++;
      pollEvents(); //possibly sets done = true
      simData();
    }
    if(updates >= max_updates) t_last_update = SDL_GetPerformanceCounter();

    if(t_last_render < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      ticks_per_cur_f = SDL_GetPerformanceCounter()-t_last_render;
      t_last_render = SDL_GetPerformanceCounter();
      render();
      SDL_GL_SwapWindow(window);
      glFinish();
    }
  }

It's a fixed timestep (to simplify/make consistent any updates).

It essentially just does this:

Wait (SDL_Delay()) until enough time has passed requiring either an update or a render
While "last update" was > 16ms ago, update() and add 16ms to when "last update" was (maxing out at 3 updates assuming it got really far behind)
If "last render" was > 16ms ago, render (and set "last render" to "now")
Repeat

Even when I do nothing in update() or render(), it fluctuates anywhere between 58FPS and 62FPS. Why would this be?
I understand that SDL_Delay only has a fidelity of 1ms, but I even set "target ticks" to be 1ms less than necessary to try to account for this.

Any ideas?

Thanks!

sentences:
GLSL pack floats into an RGBA texture I want to compose conventional triangle-based models and particles with a ray-traced scene at a reasonable frame-rate.

webGL does not let you write the gl_FragDepth in the fragment shader.  You cannot have multiple render targets, but you can render to an RGBA texture and then use that texture as input to another draw-op.  So I can render my ray-traced scene and store the depth as input to the next stage.  This is obviously far from ideal, but workable.

I'd love to be wrong about this, and this is gathered from trial and error rather than any definitive source; please correct any flawed assumptions

How can you pack/unpack a float and, ideally, some flag bits and such, into an RGBA texture efficiently in a GLSL fragment shader?

sentences:
How make circle with multiples holes In Unity, how can I programmatically make a shape like:

The gaps in the shape will all be the same size but their number may vary.

sentences:
Game Maker - Shader CGA - how to swap the palette I created a shader that get the actual color of the surface and render it to the closer of a cga palette

I have to change it to swap the palette in 4 colors but I don't know how
secondary, I have to render it dynamic (maybe using an uniform variable)
because it have to change in base of the palette

please help me, thanks

///CGA Shader
varying vec2 v_vTexcoord; //xy
varying vec4 v_vColour; //rgba

#define _ 0.0
#define o (1./3.)
#define b (2./3.)
#define B 1.0

#define check(r,g,b) color=vec4(r,g,b,0.); dist = distance(sample,color); if (dist < bestDistance) {bestDistance = dist; bestColor = color;}

void main(out vec4 v_vColour, in vec2 v_vTexcoord)
{
    float dist;
    float bestDistance = 1000.;
    vec4 color;
    vec4 bestColor;

    vec2 pixel = vec2(320,200)-floor( v_vTexcoord.xy / iResolution.xy * vec2(320,200));
    vec4 sample = texture2D(iChannel0, pixel / vec2(320,200));

    sample += (texture2D(iChannel1, pixel / iChannelResolution[1].xy)-0.5)*0.5;

    // pallete 0

    check(_,_,_);
    check(o,B,o);
    check(B,o,o);
    check(B,B,o);

    vec4 color1 = bestColor;
    bestDistance = 1000.;

    // pallete 1

    check(_,_,_);
    check(o,B,B);
    check(B,o,B);
    check(B,B,B);

    vec4 color2 = bestColor;

    float t = (clamp(sin(iGlobalTime)*4.,-1.,1.)+1.)/2.;

    v_vColour = mix(color2, color1, t);

    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}

sentences:
HLSL Gaussian blur pixelshader: blur is not occurring I am trying to use postprocessing to create a gaussian blur, however, no blur is to be seen, what am I doing wrong?

I have included the full code at the bottom of this post in a google docs link, but here are the most important bits and pieces.

Part of the xna draw method:

RenderTarget2D renderTarget;
renderTarget = new RenderTarget2D(this.device, screenWidth, screenHeight, true, pp.BackBufferFormat, pp.DepthStencilFormat);
this.device.SetRenderTarget(renderTarget);
this.device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DeepSkyBlue, 1.0f, 0);
Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

// Set the effect parameters (the 'simple' technique creates a red lambertian shaded model, like is shown on the image below)
effect.CurrentTechnique = effect.Techniques["Simple"];
effect.Parameters["TextureWidth"].SetValue(screenWidth);
device.DepthStencilState = DepthStencilState.Default;
device.BlendState = BlendState.Opaque;

// Draw the model
mesh.Draw();

// Render our scene
this.device.SetRenderTarget(null);

effect.CurrentTechnique = effect.Techniques["GaussianBlur"];

spriteBatch.Begin(0, BlendState.Opaque, null, null, null, effect);
spriteBatch.Draw((Texture2D)renderTarget, screenRectangle, Color.White);
spriteBatch.End();

The pixelshader:

float Pixels[13] =
{
   -6,
   -5,
   -4,
   -3,
   -2,
   -1,
    0,
    1,
    2,
    3,
    4,
    5,
    6,
};

float BlurWeights[13] =
{
   0.002216,
   0.008764,
   0.026995,
   0.064759,
   0.120985,
   0.176033,
   0.199471,
   0.176033,
   0.120985,
   0.064759,
   0.026995,
   0.008764,
   0.002216,
};

float4 GaussianPixelShader(float2 TextureCoordinate : TEXCOORD0) : COLOR
{
    // Pixel width
    float pixelWidth = 1/TextureWidth;

    float4 color = {0, 0, 0, 1};

    float2 blur;
    blur.y = TextureCoordinate.y;

    for (int i = 0; i < 13; i++)
    {
        blur.x = TextureCoordinate.x + Pixels[i] * pixelWidth;
        color += tex2D(TextureSampler, blur.xy) * BlurWeights[i];
    }

    return color;
}

What I have further found out by testing

The code in the GaussianPixelShader does get executed (if I set it to just return a black color it gives an entire solid black screen) but just doesn't seem to work/do the blurring.

Images

This is how currently my model looks (I cant see any blurring but maybe the blurring is just too light): image.

Full Code

Link to the shader code and the link to the xna/c# code.

sentences:
How do I find two points at an angle on opposite sides of a circle? With reference to my previous question:

I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to change that such that I can give it a center point, an angle in degrees, and a length.

If you look at the picture from the other question:

You can sort of discern where the center point is, the x,y of starting/ending locations become the dots based on the length of the gradient.

I assume I would have to:

Take the center location
Apply the angle + length
Gives me my ending x,y
Take the center location
Calculate the reverse angle
Apply the reverse angle + length
Gives me my starting x,y
Plug these starting/ending positions to the answer from the other question.

Am I correct? How would I do those steps?

sentences:
How to calculate move while avoiding deep copy Suppose in a turn-based game, I have an object holding the current status of the game (like players, board information, positions of pawns, things like that). Now I want my AI to calculate the best move (or at least a good move).

My first try was to determine all allowed actions and generate a new game object for each action the player or computer could do. Then I would repeat the process for all resulting game objects. This would yield a form of tree with all the future possibilities, from which the AI simply could select the optimum.

But it turns out that this approach is cruelly slow, mostly to me deep copying the game object thousands of times and holding thousands of copies of the game object in the memory.

I am now searching for a better approach to calculate a good move. Are there technics for this type of problem. I am aware that this probably depends on the kind of choices the player or AI has to make in the game. But I am more interested in general technics used to tackle this kind of problem.

Any help is appreciated. If this question is more appropriate for somewhere else (for example StackOverflow), please move it there. Thanks!

sentences:
How to stop jumping again when 3D character is in air (double jump)? I'm working on simple rpg and having some trouble with player jumping. I'm trying to use unity's raycast to check colliders under the player before jumping again. The problem appears that no matter how many tweaks I make to the distance or the validation of the canJump function, the raycast the player seems to at max jump twice. At lower levels the player can even hover if timed correctly. Could someone overlook my code since it appears that I might have a noob glitch somewhere?

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

public class Player : MonoBehaviour
{

    public float speed;
    public float jumpForce;
    public float turningSpeed;

    private bool canJump;

    void Start()
    {

    }

    void Update()
    {

        RaycastHit hit;
        if (Physics.Raycast(transform.position, Vector3.down, out hit, 1.01f))
        {
            canJump = true;
        }

        ProcessInput();

    }

    void ProcessInput()
    {
        if (Input.GetKey("right") || Input.GetKey("d"))
        {
            transform.position += Vector3.right * speed * Time.deltaTime;

        }

        if (Input.GetKey("left") || Input.GetKey("a"))
        {
            transform.position += Vector3.left * speed * Time.deltaTime;

        }

        if (Input.GetKey("up") || Input.GetKey("w"))
        {
            transform.position += Vector3.forward * speed * Time.deltaTime;
        }

        if (Input.GetKey("down") || Input.GetKey("s"))
        {
            transform.position += Vector3.back * speed * Time.deltaTime;
        }

        if (Input.GetKeyDown("space") && canJump)
        {
            canJump = false;
            GetComponent<Rigidbody>().AddForce(0, jumpForce, 0);
        }

    }
}

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:
How to do multi-agent 2d pathfinding when agents can block each other? I recently restarted on my long time game development project and had a few questions about how to improve my games AI.

I am a little stuck on the best way to implement my Enemy path finding when there are multiple enemies that can collide with each other.  Here is an example of the way my AI works at the moment.

The melee enemy has the following states:

Aggressive Attacking - Is in range of attacking player

Aggressive Stuck - Is trying to reach the player but blocked by a collision object

Aggressive Clear - Is trying to reach the player but is not blocked by a collision object

Passive - not currently looking for the player but if it moves in it's line of sight it will move to the aggressive state

Currently I am using a uniform tile system.  Here is the basics on how the pathing works.

FIND PATH FROM ENEMY TO PLAYER

    IF [BLOCKED BY A COLLISION TILE]

             CALL A STAR ALGORITHM

    ELSE IF [NO COLLISION ON PATH]

            MOVE TO PLAYER

I do this every frame.  This seems to work ok, but things have got more complicated when I bring in multiple enemies.  What would be the best way to achieve the following.

Find a path for the enemy to the player when there are multiple enemies that can all collide with each other?  If I just call A STAR it won't work correctly as the other enemies who are collision objects are also moving.

Sorry I hope this made sense, any help would be great.

sentences:
How can I draw a rectangle with a color gradient? I'm trying to implement the below picture in my code but doesn't work. It only shows red color on all sides. I'm using line renderer and color gradient. Kindly check my code.

void Start()
{
lineGeneratorPrefab = new GameObject();

DrawLine();
}

private void DrawLine()
{
GameObject myLine = new GameObject();
myLine.transform.position = start;
myLine.AddComponent<LineRenderer>();
lr = myLine.GetComponent<LineRenderer>();
lr.material = new Material(Shader.Find("Sprites/Default"));
lr.positionCount = 4;
lr.SetPosition(0, new Vector3(-2, 0, 0));
lr.SetPosition(1, new Vector3(2, 0, 0));
lr.SetPosition(2, new Vector3(2, -2, 0));
lr.SetPosition(3, new Vector3(-2, -2, 0));
lr.loop = true;

Gradient gradient = new Gradient();
gradient.SetKeys(
    new GradientColorKey[]
    {
        new GradientColorKey(Color.red, 0.25f),
        new GradientColorKey(Color.blue, 0.25f),
        new GradientColorKey(Color.green, 0.25f),
        new GradientColorKey(Color.yellow, 0.25f)
    },
        new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f) }
    );
lr.colorGradient = gradient;

}

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:
Reusing tilemap segments I'm wondering how I can incorporate reusable tilemap segments in my workflow.

For example: I construct a room out of my tile palette, and I want to reuse this room in multiple places.

Is there some way to "prefab" a section of a tilemap? I haven't found such a thing.

Or perhaps I should just prefab the whole tilemap, and use multiple tilemap objects within one grid? Won't that introduce significant overhead?

What if I want to prefab a section of a tilemap with some additional, non-tilemap objects?

sentences:
Point[] and Tri not "could not be found" Hi I'm trying to learn how to load a .obj file using OpenTK in windows Forms.  I have seen a lot of examples out there, but I do see almost everyone uses List<Tri>, and Point[].  Code examples show these highlighted like there IDE know what these are; for example

List<Tri> tris = new List<Tri>();

but mine just returns "The type or namespace name 'Tri' could not be found"
is there an include I need to add or a using I am missing.  Currently have this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;

EDIT: I have been trying to piece it together primarily from using code samples found here:

http://www.opentk.com/node/1946

As well as from here
Missing triangles in model

I have been trying to piece it together primarily from using code samples found here

http://www.opentk.com/node/1946

As well as from here
Missing triangles in model

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:
How should I handle shared classes between the Game project and the Content Extension Library? I've been using XNA for a while but recently I've needed to write a content extension library which I haven't done before. I need to import a TextureAtlas class from a file that is exported by a tool I wrote. The output of my editor is a serialized XML file that contains a list of all StaticImages and Animations in the TextureAtlasFile class that its serialized from. In my solution I have the TextureAtlasContentLoader project which holds all of the classes that I will need for the texture atlas both in game and for loading the actual content. The importer deserializes the xml back to a TextureAtlasFile and the processor converts it to a TextureAtlas to return after it is loaded.

The problem is that I have no idea how to share the classes between the content extension project and the game project that will be using the TextureAtlas class. I've tried referencing the content extension project in the game project and that works fine to get me pass compiling but it throws a ContentLoadException exception when I call

textures = Game1.content.Load<TextureAtlas>("MainMenu");

saying

  Error loading "MainMenu". Cannot find type Client.Render.TextureAtlas,
  TextureAtlasContentLoader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

The only other clue to whats wrong I have is a warning while compiling that says/

  Warning   2   The referenced assembly
  "Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral,
  PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" could not be resolved
  because it has a dependency on "Microsoft.Build.Framework, Version=4.0.0.0,
  Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently
  targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove
  references to assemblies not in the targeted framework or consider retargeting your
  project.   Client

which leads me to believe I'm not supposed to reference it in the game project. So to summarize my question, how do I handle my TextureAtlas and TextureHandle class that both the content loader and the game project need without causing errors?

sentences: Does AndEngine have a way to manage scenes? Does AndEngine have a way to manage scenes (for example, main splash, menu, options, main game), and should I use a different scene per activity?

sentences:
Instance vs individual updating I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a function in each of the entity class instances.

I know that instance rendering is much faster but was wondering if this would even be needed for updating the logic of the game, afterall I'm not making a giant physics simulation.

So, I am wondering what would the effect be if I updated the game logic for each entity individually or did it via instancing. And if there is an impact is it really worth it for a game like mine where there isn't too much complexity.

sentences:
What's better - drawing every interval that the window updates, or drawing when necessary and updating when drawing? So what's better?

In case the title is a bit confusing I mean:

1) Drawing every window update interval. For example, for a 60FPS window, every 17 milliseconds. For example:

window.setFramerateLimit(60); //Update every 17 milliseconds for 60FPS
while(window.isOpen()) {
window.display();
}

Or

2) Drawing when you need to (for example, when a sprite moves) and displaying it straight after.
For example:

void func(sf::RenderWindow& window) {
window.draw(sf::Sprite()); //Whatever you're drawing
window.display();
}

Or is there a much better way?

sentences: Why is the distance from object to eye irrelevant in illumination models? For example in Phong model and Blinn model, the light intensity does not change depending on how far away the camera is. Why is that?

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:
How to create a mini-map in XNA 3? simple map

The map i would like to create is like this one, but simpler , what i want to have is a geographical map indicate high /low and a point that show where am i and  points indicate enemies

Thank you

sentences:
2D physics collision/gravity problem? I'm using Love2D and my own physics engine to create a 2D platformer. Y collision works fine, but X collision... well, it's a bit buggy. When I move off of a small platform I've created, I fall but it is a lot slower than what my gravity is set to. Here's my code for collision:

function world.collisionCheck(o)
    for k, v in pairs(world.objects) do
        if v ~= o then
            if v.Type == "Rectangle" and o.Type == "Rectangle" then
                if o.Position.Y + (o.Size.Y / 2) > v.Position.Y - (v.Size.Y / 2) then o.Velocity.Y = 0; o.onGround = true; end
                if not (o.Position.X + (o.Size.X / 2) > v.Position.X and o.Position.X - (o.Size.X / 2) < v.Position.X + (v.Size.X)) then o.onGround = false; end --right left
            end
        end
    end
end

As you can see, it's pretty bad. The code for the actual physics (gravity, movement, etc.) is a bit better:

function world.update(t)
    for k, v in pairs(world.objects) do
        if v.Static ~= true then
            v.Position.X = v.Position.X + v.Velocity.X
            if v.onGround == false then if v.Velocity.Y < world.Gravity then v.Velocity.Y = v.Velocity.Y + world.Gravity * t end end
            v.Position.X = v.Position.X + v.Velocity.X * world.Meter
            v.Position.Y = v.Position.Y + v.Velocity.Y * world.Meter
            v.Velocity.X = v.Velocity.X * world.Friction
            world.collisionCheck(v)
        end
    end
end

However, it could still use some work. Whenever I step off of a 150 pixel by 15 pixel platform, I fall a lot slower than 9.8 meters per second. My meters are set to two pixels, and I'm falling at about a meter per second, which is much slower than the expected ~20 pixels per second I get while still on the platform. Everything I've tried doesn't seem to fix it; there's no problem in the movement code, and nothing I change in the collision code seems to fix it. Is there some silly problem I've overlooked?

EDIT: Okay, so I implemented a small fix which somewhat solves my problem. I modified the collision code so that it checks if it is below what is being tested for collision, and it seems to accelerate as normal when the top of the object is below the object being collided with, and vice versa. Am I correct in assuming I just need to add something to detect if the x-value is in the correct range, too?

sentences:
Why isnt setting the global_position working? Previously my items were relative to the player by node hierarchy.  But for items like bombs this is not ideal so i tried to add the items to the world scene, but when i try to adjust the position of the item to the players position it doesnt work and i see the sword in the top left corner of the screen the worlds origin.
Entity Script
func use_item(item):
    var newitem = item.instance()
    newitem.own = self
    newitem.global_position = global_position

    #not setting the position of the item correctly

    newitem.add_to_group(str(newitem.get_name(), self))
    get_node("..").add_child(newitem)

    if get_tree().get_nodes_in_group(str(newitem.get_name(),self)).size() > newitem.maxamount:
        newitem.queue_free()

Sword Script
func _ready():
    type = own.type
    $anim.connect("animation_finished",self,"destroy")
    $anim.play(str("swing",own.spritedir))
    if own.has_method("state_swing"):
        own.state = "swing"

func destroy(animation):
    if own.has_method("state_swing"):
        own.state = "default"
    queue_free()

It seems like it should work but with an engine like godot there could be several reasons why a certain thing is not working.
https://github.com/MonkeyToiletLadder/wendingo
could it be that in my animation player i set the sword positions as key frames and thats why its not working?

sentences:
How can I display Unity games in Flex? We have tried the following methods to upload sample Unity3D build to a desktop application in Flex: HTML Loader, NavigateToURL, iFrame and resolvePath.

But we only see the text content, not the 3D content. What is the solution for that? How can I host a Unity game inside Flex?

sentences:
Item find rate formula I have an RPG game where players can fight monsters limitless, and can get drops from these monsters.

Currently I store in my database a table called monster_drops with find_rate column which is a number between 1 to 10,000.  Whenever a player kill a monster, a number is generated and if it's lower from the current number stored in the monster find_rate column, he gets the item.

For example, if the find_rate of the item will be 10k, he will get the item every monster.
If the find_rate will be 1k, there is 10% chance he will get it.

My question- is there any better way, maybe simpler, or more accuarate, to calculate and set item drops?

sentences:
Programming Pattern: Representation of pick up objects I'm pondering about the best way to represent objects that can be picked up in my 2D engine.

I have an Actor class which is the base for all objects that can be spawned into the game. This class offers a location and some other information needed by all actors.

Now, let's take an Apple for example. It's derived from Actor and carries with it all the information needed to be in the game-world. But when I pick this item up and put it inside an inventory, I don't need all that Actor stuff. So I was pondering. Does it make sense to maybe have an AppleActor class instead that derives from Actor, and inside it have an Apple class derived from something like InventoryItem?

When I pick up an Actor, I would take the InventoryItem out of it, store it in my inventory and destroy the Actor. Then, when I drop the InventoryItem, I would first create the corresponding Actor for it, put the InventoryItem inside it and spawn that Actor in the world.

Does this make sense at all? Any feedback or advice from more experienced people here is welcome.

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:
MMO - Some NPCs controlled clientside? I'm making an online game and considering whether to handle certain NPCs clientside. Is this common?

For example I play Elder Scrolls Online and it seems basic townspeople NPC locations aren't quite synced up with my friends. I guess it makes sense if they're only wandering around in a set area for that to be handled clientside right?

So my question is, should I go with this method, or are there any good reasons why I shouldn't? Any examples of games that do, so I can see how they handle it?.

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:
3D Picking: Doesn't Work Consistently I'm trying to implement a 3D picking function that at the moment simply calculates the ray being sent from the camera after the user clicks the mouse on the window.

It kind of works well when the camera is facing forward (orientation [0.0, 0.0, 1.0]) but when I orient the camera upside-down or looking up/down it produces really stupid results (i.e. the ray is wildly out-of-line with the cursor, or even sometimes points behind the camera somewhere).

Here is the code:

// sv (the SceneViewport) is the window/viewport I'm clicking in
// pixel (the Vector2) is the position of the cursor, relative to the viewport centre, in pixels
public Ray PixelRayCast(SceneViewport sv, Vector2 pixel) {
    Vector2 viewportSizePixels = sv.SizePixels;
    float aspectRatio = sv.AspectRatio;
    float invFov = (float) Math.Tan(GetVerticalFOV(aspectRatio) * 0.5f);
    Vector3 rayOrientation = new Vector3(
        ((2f * pixel.X) / viewportSizePixels.X) / (1f / (aspectRatio * invFov)),
        ((2f * pixel.Y) / -viewportSizePixels.Y) / (1f / invFov),
        1f
    ) * Quaternion.FromVectorTransition(Vector3.FORWARD, Orientation); // Orientation is the camera's current orientation
    Vector3 rayStart = Position; // Position is the camera's current position
    return new Ray(rayStart, rayOrientation);
}

I'm not really a great mathematician so I'm hoping someone will be able to read through my small function and spot the mathematical error I'm making.

sentences:
Multiple Texture Coordinates Per Vertex (DirectX11) The models my artists are making in maya have multiple different texture coordinates per vertex depending on what face the vertex happens to be a part of.

Originally, to fix this problem, I duplicated each vert every time it appears in a face so each vert can have its own texture coordinates / face normals. This worked out well for a while until I started working on skinned skeletal animation.

I could not seem to get skinned skeletal animation working with this duplicate vertex method. There would be serious gaps in the mesh as it animated. In order to try and fix this, I switched back to indexed drawing, where faces share verts instead of each face having its own unique copy of a vert.

This fixed my skinned animation but now I'm at a loss as how to encode the multiple texture coordinates / face normals that are associated with verts. I was hoping there might be a way to use the index buffer and an array of face normals / uvs to fix this issue. Basically, I figure I can easily add an array of normals/tex coords to each vert but I have no idea how to instruct the gpu to properly index into it.

sentences:
How could I access game data from a dev machine at runtime from a mobile platform? When working on a game on a mobile platform, having read/write access to game data (assets, configuration files) stored on the dev machine at runtime would enable building of tools to quickly iterate, debug, and analyze the game at runtime.

For iOS & Android, is there any way to have access to these data files from the dev machine while the game is running on the mobile device?

Please do not recommend a tool, or a 3rd party engine that does this.

sentences:
Picking multiple choices from an enum I recall in a certain code, there were named constants with exponential values. Two constants' values could be added two include both of them in one go.

Example:

{ STR = 1, AGI = 2, INT = 4}
From this, combining the enumerations would always give a unique number, which lets us identify "3" as "STR&AGI" and 5 as "STR&INT".

How I would implement this is somewhat confusing.

sentences:
Scene graphs vs in-game representation This is a general question which aim is to allow me to start digging on the subject by myself.

As I noticed the general opinion is that scene graphs are good for describing the scene in a level editor (or any editor that the game is using), but the game itself should use some sort of optimized data structure internally and the scene graphs should be somehow "translated" to that data structure before use.

What such internal data structures would be? How one would "translate" a scene graph to such structures.

In general - the more detail you can give me then better. Also references/links are more than welcome. :)

sentences:
Gameobjects disappearing when changing renderer.material.color I'm generating an array of objects using this code:

    while(currentPosition.z < poolSize){
        var ringObj = GameObject.Instantiate(ring) as GameObject;
        ringObj.transform.position = currentPosition;
        ringObj.GetComponent<Renderer>().material.color =  new Color (1.0f, 0f, 0f);
        // Adds the ring to the pool.
        pool[(int)currentPosition.z] = ringObj;
        updateCurrentPosition ();
    }

This works fine without this line:

ringObj.GetComponent<Renderer>().material.color =  new Color(Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f));

Which should randomize the color of the object. The problem is that instead of doing this, the whole code would generate only one object (I can see it on the hierarchy view) with the standard material color and then stops the generation.
Also, the material is not changing color.

I can't understand why this happens. Can someone explain this to me, please?  I'm using Unity 5.3.4f1. Thank you.

sentences: transformation before the perspective divide but after projecting perspectively My problem is that I would like to confine a scene render to a (possibly rotated) rectangle without using glViewport(). I don't want to use it to save, if possible, some cycles that would otherwise be spent on state switching. Also, there is the tantalizing possibility of rotating the scene render, which is not possible with glViewport... Is it possible to confine a scene render to this (possible rotated) rectangle in this way?

sentences:
Separating axis theorem with multiple polygons? I am attempting to implement the separating axis theorem in C#. I have a function that can calculate the minimum translation vector between two polygons. However, I can't seem to create a function that calculates the minimum translation vector between one polygon and multiple other polygons. Honestly, I've been working on this for months and am no closer to a solution and have not been able to find a solution online. There's always a few edge cases that do not return the correct result, leading to high priority bugs in my game.

Here are common edge cases that do not work correctly:

Is there a well-known solution for this problem? All I can find is people saying "just perform the SAT on each polygon" but this rarely produces the minimum translation vector.

Any help would be highly appreciated.

sentences:
Game Object, components priority? So, my first attempt to create a component based game object is this:

class GameObject;

class GameObjectComponent
{
public:
    virtual ~GameObjectComponent();
    virtual void Update(GameObject* obj, const sf::Time& deltaTime) = 0;
};

class GameObject
{
public:
    GameObject();
    virtual ~GameObject();

    virtual void Update(const sf::Time& deltaTime);
    virtual void AddComponent(
      std::unique_ptr<GameObjectComponent> component,
      std::string componentName);
    virtual GameObjectComponent* GetComponent(std::string componentName);

    float GetVelocity();
    float AddVelocity(float velocity);
    void SetVelocity(float velocity);
    sf::Vector2f GetPosition();
    sf::Vector2f MovePosition(sf::Vector2f movement);
    void SetPosition(sf::Vector2f position);

private:
    float mVelocity;
    sf::Vector2f mPosition;
    std::unordered_map<std::string, std::unique_ptr<GameObjectComponent>> mComponents;
};

The cpp

#include "GameObject.h"

namespace Engine{
GameObjectComponent::~GameObjectComponent()
{
}

GameObject::GameObject()
{
    mVelocity = 0.f;
    mPosition = sf::Vector2f(0.f,0.f);
}

GameObject::~GameObject()
{
}

void GameObject::Update(const sf::Time& deltaTime)
{
    for (
      auto iterator = mComponents.begin();
      iterator != mComponents.end();
      ++iterator)
    {
        iterator->second->Update(this, deltaTime);
    }
}

void GameObject::AddComponent(
  std::unique_ptr<GameObjectComponent> component,
  std::string componentName)
{
    mComponents[componentName] = std::move(component);
}

GameObjectComponent* GameObject::GetComponent(std::string componentName)
{
    return mComponents[componentName].get();
}

float GameObject::GetVelocity()
{
    return mVelocity;
}
float GameObject::AddVelocity(float velocity)
{
    mVelocity += velocity;
    return mVelocity;
}
void GameObject::SetVelocity(float velocity)
{
    mVelocity = velocity;
}
sf::Vector2f GameObject::GetPosition()
{
    return mPosition;
}
sf::Vector2f GameObject::MovePosition(sf::Vector2f movement)
{
    mPosition += movement;
    return mPosition;
}
void GameObject::SetPosition(sf::Vector2f position)
{
    mPosition = position;
}
}

and it works, but now I'm worried about priority.

Let's say I have these components: Movement, Phyisic, Renderer, NetworkSync
then they should run in order, otherwise the player could be rendered in the wrong spot, make a movement they should be able to do, or don't sync correctly with other players.

I'm not sure how to handle this without tanking the performance, and without losing too much flexibility.

Any suggestions?

Thank you.

sentences:
2D collision-detection middleware (This question was split off from 3D collision-detection middleware)

Are there any recommendable middleware available for 2D collision detection?

I believe I've heard that Box2D could be used for collision detection without the physics part. I'd like to hear if people have any experiences on Box2D or others libraries for 2D collision detection specifically.

sentences:
What is a good way of handling shaders? I'm currently reading this book and are at the chapter about the rendering subsystem of a game engine.

Now, the book suggests that a material is a structure that provides information on how to shade a mesh. So the material contains visual properties and also what information to send to the shader prior to rendering.

My question is: What is a good tructure/syntax of such a material model?

My current ideas are that the material holds info such as specularity, diffuse colors, textures and so on. The (to me) tricky part comes when a shader needs multiple render passes.

A simple material could be something a long the lines of:

Transform info:
ModelMatrix : get_from_model
ViewMAtrix: get_from_camera
ProjectionMatrix: get_from_camera

Textures:
diffuse: get_from_file
normalmap: get_from_file
glossmap: get_from_file

Lighting:
direction: get_from_somewhere
.
.
.

But for instance, if I want to render the reflection of a mirror,  need a good way to tell the engine that I want to render the scene with the camera flipped in the mirror plane, and perhaps with a lower LOD. Is there a well know good way to encode this in the interface between user-data and the shader program?

Also, in general, are there well proven methods for mapping in-game data to shaders without too much manual instruction on where to find the data?

Thanks in advance : )

sentences:
What can I use to make my unique music ideas a reality? I have several different music ideas for my game BGMs, but I do not have the musical skills nor the equipment to make them. The most I can do is beat-box them or make a drum beat (had I a drum). Is there a program or some other way to make my music real?

For instance, I've recently been trying GarageBand's Musical Keyboard to create the music but they don't have the exact beats I'm looking for, like a particular tap of a drum for example.

sentences:
Efficient systems in an Entity Component System I'm designing a simple Arcanoid game with ECS.

With ECS there are many systems that only update components once in a while. For example, Particle systems are animated sprites that can be used for collision effects or explosions. These kind of effects happen rarely.

ParticleSystem will only update ParticleComponent when they exist, which happens rarely, just on collisions, etc. The rest of the time it's polling to find entities with ParticleComponent.

Isn't this polling inefficient? If I have many more functions similar to the ParticleSystem, that only do work rarely, the update will be clogged with systems that do not update anything. Would it be good practice to "sleep" the system until an entity is assigned to the ParticleComponent?

For example (using EntityX):

class ParticleComponent : Component<ParticleComponent>
{
public:
    ParticleComponent(ParticleId id) : id(id), time(0.0){};

    ParticleId id;
    double time;
};

class ParticleSystem : System<ParticleSystem>
{
public:
    void update(EntityManager & entities, EventManager & events, TimeDelta dt)
    {
        // this list will be empty if there are no entities.. but there is still a search
        entities.each<ParticleComponent>([](Entity & entity, ParticleComponent & particle)
        {
            // update current animation time
            particle.time += dt;
        });
    }
};

class Game : public EntityX
{
public:
    Game()
    {
        systems.add<ParticleSystem>();
        systems.configure();
    }

    void update(TimeDelta dt)
    {
        // this is only useful when there are entities with ParticleComponents
        systems.update<ParticleSystem>(dt);
    }

    void onRareEvent()
    {
        auto entity = entities.create();
        entity.assign<PositionComponent>();
        entity.assign<ParticleComponent>(FIRE_PARTICLE);
        // destroy in 3 seconds
        timer.schedule(3, Game::destroyEntity, entity);
    }

    //void render()...
}

sentences:
Animation is not starting even though collider is triggered? progress is steady but it is a bumpy road. I have removed the animation script from my character and reworked it into the controller script. I have also added new animations. Doing this required replacing the character FBX I was using earlier.

Doing this has caused an unexpected problem: Remember that super-cool item box that I made, that the character can trigger when he jumps under it, causing it to play an animation where the lid pops off?  Well, that's broken now. The box's idle animation still plays, but the GetItem animation does not.  Before importing the new character, his animations and the box's animations were in the same animation controller. I separated them into their own controllers, and applied them each where they belong. I did not make any more changes ( you can see all its properties in the demos below). There are still no transitions or parameters for the ItemBox. Funny enough, I tested it and the ItemBox's trigger is being activated. What could be wrong?

Video links (SHORT):

Link to video of new character demo

Link to Animators Panels Video

How can I get the GetItem animation to play for my itemBox again?

whoops, here is the relevant script:

ItemBox.cs:

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

public class ItemBox : MonoBehaviour
{
    // Start is called before the first frame update

    bool disabled = false;
    Animator anim;

    void Start()
    {
        anim = GetComponentInChildren<Animator>();
        if (!disabled)
        {
            anim.Play("ItemBox_Idle");
        }
    }

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

    }

    void OnTriggerEnter (Collider other)
    {
        if (!disabled && other.gameObject.tag == "Player")
        {
            print("itembox triggered");
            anim.Play("ItemBox_GetItem");
            disabled = true;
        }
    }
}

**This is the heirarchy for the ItemBox prefab. Notice that animation frames can only be seen from first child ("Parent") of that prefab, downward: **

UPDATE! GetItem animation is playing in the animation graph while I play the game, hitting the box from below, but the animation doesn't play in the game!  The plot thickens!  See (shorter) video:

shorter video

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:
Cannot create a neutral unit with a trigger I've been playing around with the starcraft UMS (Use map settings) for a while and usually i figure things out pretty quickly when im stuck. Alas not this time.

I'm trying to place a neutral unit (player 12) using a trigger. It refuses to work.
I'm using Scmdraft 2.0 as my editor (but i cant get it to work in other editors either)
(all neutral units placed before the game starts are visible and all other triggers work fine. Also i created a text msg and it does displays it in-game so the trigger triggers )

For testing I created a trigger that looks like this:

Player: neutral (i tried neutral players player 1 and all players as well)
Condition:
-always
Action:
-Create *1 Terran Medic* at '*location 022*' for *Neutral* (also tried neutral players)

When I start the game nothing happens.

Here is what I tried:

I tried placing a start location for neutral player (player 12)
I tried changing the owner under map properties of player 12 to neutral and computer from unused which was the default.

Although it seems like it should be a common enough problem, I don't see it in any FAQ and I cant find anything about it when I Google it.

Thanks in advance.

sentences:
Split Texture2D Across Line Background

I'm using a texture as a damage map represented by an array of floats for displaying damage effects on a space ship in a process.

An upside of this is being able to 'slice' ships in half, using an input damage map with a line down the middle, as shown in the diagram below.

Question

However, I'm encountering problems separating this split ship into two different entities. I would like to be able to split the image down the 'damage line', in a process similar to this:

I don't have much idea where to start detecting the red line above. Any advice would be welcome.

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:
How to import the .fbx scene with multiple objects in XNA so that the objects retain their scene position? I have a scene that contains mutiple objects. How can I import it in XNA and maintain each object position? Right now I export the scene in .fbx and load it in a model like this:

 cube.model = contentManager.Load<Model>("cub");

But the objects don't retain their position and are all gathered in one point.

I need a method to import all the objects as individual objects but to retain the objects position in the scene. (i.e. I need to import the scene so that I may manipulate the objects and retain their position in the scene so that I shouldn't reposition all the objects by myself)

The objects are not connected, thus there are no bones. They are individual objects, just placed in some positions.

This is my drawing function, the cube is the gameobject.

void DrawGameObject(GameObject gameobject)
{
    foreach (ModelMesh mesh in gameobject.model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.PreferPerPixelLighting = true;
            Matrix b = Matrix.Identity;
            effect.World = b * gameobject.orientation;
            effect.Projection = camera.projectionMatrix;
            effect.View = camera.viewMatrix;
        }

        mesh.Draw();
    }
}

sentences:
Zune same features as WP7? (gesture, accelerometer) We don't have zune HD in Canada (yet) just wondering if it has the same programmable features as WP7? Like gestures and accelerometer.

Basically if I am just making a game, with screen controls (thumbsticks on the screen) is this an easy port to zune?

Thanks!

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:
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:
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:
Inconsistent CapsuleCast/Collision behavior when a GameObject is selected My gameobject has a CapsuleCollider and I use CapsuleCast to check for horizontal collisions when moving horizontally so the gameobject won't pass thru obstacles.
It works 100% of the time except when I select the gameobject in Hierarchy.

When I have the gameobject selected, whenever I try to bump a wall continuously, it shakes/jitters until it eventually goes thru the wall. But this only happens when I have the object selected in Hierarchy. If I click on the scene so that the object is not selected and do the exact same thing (bump a wall continuously), there is no shaking/jitter and it doesn't pass thru the wall no matter how long I bump it.

This passing in the wall when selected is also consistent. Hundred percent of the time it will pass thru when I have it selected (and does the shaking) and also hundred percent of the time it doesn't if I don't have the object selected. Shouldn't selecting an object don't have any effect on this? Please give me some ideas of why.

sentences:
how can i fix my code in order to get rid of the error that says that the object I want to instantiate is null? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class replicate : MonoBehaviour
{

    public void replicateCube(InputField T)
    {
        int H = int.Parse(T.text);

        for (int i = 0; i < H; i++)
        {

            GameObject prefab = Resources.Load("Cube") as GameObject;
            GameObject go = Instantiate(prefab) as GameObject;
            go.transform.position = new Vector3(0, i*5, 0);

        }
    }
}

sentences:
Problem with Update(GameTime) Methods and Pause implementation I have the pause function implemented and it works correctly in that it dims the player screen and stops updating the gameplay.

The problem is that GameTime continues to increase while it is paused, so my method that checks gameTime versus previousSpawnTime before spawning another enemy gets messed up and if the game is paused too long it is noticeable that the next enemy draws far too early.

Here is my code for the enemy update.

private void UpdateEnemies(GameTime gameTime)
    {
        // Spawn a new enemy every 1.5 seconds
        if (gameTime.TotalGameTime - previousSpawnTime > enemySpawnTime)
        {
            previousSpawnTime = gameTime.TotalGameTime;

            // Add an Enemy
            AddEnemy();
        }
...

I also have other methods that depend on gameTime.  I've tried getting the total pause time and subtracting that from the total game time, but I can't seem to get it to work correctly if that is the way I should go about solving this.

If you need to see any other code let me know.  Thank you.

sentences:
New to OpenGL , having trouble understanding matrix transformation I have modest experience of developing games with sdl , libgdx , unity etc. But never got into learning any low level API. So I thought about learning OpenGL and got started with tutorials provided by lazyfoo.net.(Yes I know he is using the legacy OpenGL but he migrates to modern OpenGL as he progresses through the tutorials).
On the fourth chapter he shows the use of glPushMatrix() and glPopMatrix (). Up until then I had the understanding that whenever I translate the modelview matrix that translates the whole gameworld. Now this process of saving the current matrix on stack has put me into some confusions. They are:
1.If I push the current matrix on the matrix stack and make change to current state, then pop that saved state again; how are these transformations combined into one matrix?
2.In the tutorial he shows how to do scrolling background with four quads in the background.He translates the matrix to position the camera in the proper place based on user input. Then he pops the matrix from the stack in the render method and translates it to four different positions to draw four quads. My question is why don't we see the quads moving with the camera(which means not moving at all relative to the camera) since they are drawn relative to the camera.
In key input function:

//Take saved matrix off the stack and reset it
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
glLoadIdentity();

//Move camera to position
glTranslatef( -gCameraX, -gCameraY, 0.f );

//Save default matrix again with camera translation
glPushMatrix();

in render function:

//Pop default matrix onto current matrix
glMatrixMode( GL_MODELVIEW );
glPopMatrix();

//Save default matrix again
glPushMatrix();

//Move to center of the screen
glTranslatef( SCREEN_WIDTH / 2.f, SCREEN_HEIGHT / 2.f, 0.f );

//Red quad
glBegin( GL_QUADS );
    glColor3f( 1.f, 0.f, 0.f );
    glVertex2f( -SCREEN_WIDTH / 4.f, -SCREEN_HEIGHT / 4.f );
    glVertex2f(  SCREEN_WIDTH / 4.f, -SCREEN_HEIGHT / 4.f );
    glVertex2f(  SCREEN_WIDTH / 4.f,  SCREEN_HEIGHT / 4.f );
    glVertex2f( -SCREEN_WIDTH / 4.f,  SCREEN_HEIGHT / 4.f );
glEnd();

 These all might be very silly questions and I believe they are. I think there is a problem in my understanding of how matrices work in OpenGL. It would be very nice of you to enlighten me on this matter :)

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:
(LWJGL) Pixel Unpack Buffer Object is Disabled? (glTextImage2D) I am trying to create a render target for my game so that I can re-render at a different screen size. But I am receiving the following error:

Exception in thread "main" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Pixel Unpack Buffer Object is disabled

Here is the source code for my Render method:

    // clear screen
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // Start FBO Rendering Code
    // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer.
    int FramebufferName = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, FramebufferName);

    // The texture we're going to render to
    int renderedTexture = glGenTextures();

    // "Bind" the newly created texture : all future texture functions will modify this texture
    glBindTexture(GL_TEXTURE_2D, renderedTexture);

    // Give an empty image to OpenGL ( the last "0" )
    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, 1024, 768, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);

    // Poor filtering. Needed !
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    // Set "renderedTexture" as our colour attachement #0
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, renderedTexture, 0);

    // Set the list of draw buffers.
    IntBuffer drawBuffer = BufferUtils.createIntBuffer(20 * 20);
    GL20.glDrawBuffers(drawBuffer);

    // Always check that our framebuffer is ok
    if(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE){
        System.out.println("Framebuffer was not created successfully! Exiting!");
        return;
    }

    // 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();

It is crashing on this line:

glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, 1024, 768, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);

I am not really sure why it is crashing and looking around I have not been able to find out why. Any help or insight would be greatly welcome.

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:
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:
Do I need path finding to make AI avoid obstacles? How do you know when a path-finding algorithm is really needed?

There are contexts, where you just want to improve AI navigation to avoid an object, like a space -ship that won't crash on a planet or a car that already knows where to steer, but needs small corrections to avoid a road bump.

As I've seen on similar posts, the obvious solution is to implement some path-finding algorithm, most likely like A*, and let your AI-controlled object to navigate through the path.

Now, I have the necessary skills to implement a path-finding algorithm, and I'm not being lazy here, but I'm still a bit skeptical on if this is really needed. I have the impression that path-finding is appropriate to navigate through a maze, or picking a path when there are many alternatives. But in obstacle avoidance, when you do know the path, but need to make slight corrections, is path finding really necessary? Even when the obstacles are too sparse or small ?

I mean, in real life, when you're driving and notice a bump on the road, you will just have to pick between steering a bit on the left (and have the bump on your right side) or the other way around. You will not consider stopping, or going backwards. A path finding would be appropriate when you need to pick a route through the city, right ?

So, are there any other methods to help AI navigation, except path-finding? And if there are, how do you know when path-fining is the appropriate algorithm ?

Thanks for any thoughts

sentences:
if touching line renderer (do something) I have this laser script for a ship and I am trying to make it kill an enemy when it is hit with the line rendered laser. How can I achieve this. All things I found online I just could not get to work. An outline of the code would be (this isnt real code).

public gameobject linerenderer;

void update()
{
   if (touching gameobject.linerenderer)
   {
       die
   {
}

 private LineRenderer lr;
    void Start()
    {

        lr = GetComponent<LineRenderer>();
    }

    void Update() // consider void FixedUpdate()
    {

        lr.SetPosition(0, transform.position);
        RaycastHit hit;
        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            if (hit.collider)
            {
                lr.SetPosition(1, hit.point);
            }
        }
        else lr.SetPosition(1, transform.forward * 5000);

    }

However there is an anoying bug with this code...
Before:

After you play the game for about 30 secs:

Settings:

sentences:
How can I gradually increase the speed of my game? I recently made a replica of (Dino run) game in Unity2d.

But I'm stuck on how can I speed up my game gradually.
Should the game speed be increased or should I increase the speed of the camera.

Here is my spawn obstacles script.

public class SpawnObstacles : Monobehaviour

{
    public GameObject [] obstacles;
    private GameObject obj;
    private float XPos = 0;
    private int number = 0;

    private float randomPosition = 0;

    // Start is called before the first frame update
    void Start()
    {
        InvokeRepeating("Spawn", 1.5f, 1.6f);
    }

   private void Spawn()
    {
        if (GameObject.Find ("Cube").GetComponent<Cube> ().isDead == false)
        {
            number = Random.Range(0, 12);
            randomPosition = Random.Range(19, 29);

            XPos = transform.position.x + randomPosition;
            obj = obstacles[number] as GameObject;

            Instantiate(obj, new Vector2(XPos, obj.transform.position.y), Quaternion.identity);

        }
    }
}

sentences: Free physics library? What are some good recommendations?  I have a vertex buffer and indices and I want to be able to detect collision between it and a bounding box or another object.

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 to use proximity sensor in android with unity3d? I want to create a android game with unity3d using proximity sensor an I don't know how to access that sensor with java script

sentences:
Creating a full-screen window in Windows API I've got a Windows API Window. I've managed to make it windowed, and "fullscreen windowed". But I can't seem to make the window just full-screen- for example, even if I specify WS_POPUP, I can still freely move the cursor to my second screen. However, if I launch full-screen games, they don't permit it, and exist only exclusively or minimized. How can I make a window that behaves this way?

Edit: Excuse me. Limiting the mouse movement was just one example of how a full-screen window behaves differently to a non-fullscreen window, I'm not looking for how to limit the mouse movement.

Or is this set in the D3DPRESENT_PARAMETERS, rather than just communicated?

sentences:
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:
Object completely losing orientation using Lerp So, I am making a 2d board game with unity.
Basically, two characters are moving on the board when clicking a spot on the board.
Since it's a static one frame 2d game, I put all of my game objects children of the canvas.
All the positions seems to be aligned, in the canvas itself everything is in place, also when I am debugging I notice that both of the positions, the local position and the target position are correct, so when I'm not using lerp and just setting the character position to the target position, it works perfect.
Lerp/Smooth damp are working perfect outside the canvas
I think it's something related to the update function, as it's updating false positions, but that's all I can guess...
This is the Update function of the Player class:
        private void FixedUpdate()
{
    if (moveTowards == true)
    {
        velocity = Vector3.zero;
        this.transform.position = Vector3.SmoothDamp(this.transform.localPosition, targetSpotPosition, ref velocity, .08f);
    }

    if (this.transform.position == targetSpotPosition)
    {
        moveTowards = false;
    }
}

moveTowards set to true when clicking a spot.
    public void movePlayerTo(Spots moveHere)
{
    moveTowards = true;
    moveHere.transform.position = Camera.main.ScreenToWorldPoint(moveHere.transform.position);
    targetSpotPosition = moveHere.transform.position;
    //targetSpotPosition = Camera.main.ScreenToWorldPoint(targetSpotPosition);
}

moveHere is the spot's position, there's no problem there.
I set my canvas to camera space render mode, and of course scale with screen size. Before putting everything in the canvas, it worked perfectley.
HELP PLEASE.
Thanks in advance,
Omer

sentences:
How to make UI text longer? I'm working on a menu that needs a wordy description, but I've noticed that it only shows 4 letters, then cuts off and this doesn't seem right.

I right click, select UI > text and again, it only displays 4 words, even though I can write a lot more there. Am I doing something wrong here?

I'm not sure how to get past this and I want to ask if anyone knows how to get past this? It seems like such a strange limit to put on the UI canvas.

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

I have the following parts in my engine:

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

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

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

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

What is the proper use for glunproject

sentences:
Elegantly exposing properties in Unity inspector There are various game objects in my scene that share some common characteristics, so I created an interface, like so:

public interface IHasLimitedRangeOfMotionAlongZAxis
{
    float MinimumZ { get; }
    float MaximumZ { get; }
}

For certain types that implement this interface, I would like MinimumZ and MaximumZ to be publicly assignable in the Unity inspector. Therefore, I would like to be able to expose these properties in Unity.

I am aware that one approach is to write C# scripts in the Editor folder to implement an ExposePropertyAttribute (see here).

However, this approach is unsatisfactory for two reasons:

My solution is not co-located with my Assets folder. I write my code in a separate solution, and then use pdb2mdb.exe to import my scripts into my Unity scenes. (The reason for doing this is to avail myself of C# language features introduced beyond C# 4.0, which nonetheless target .NET Framework 3.5.)
I shall have to create a custom editor for every single type that implements the interface with publicly assignable properties. This leads to a lot of boilerplate code.

Is there a more elegant approach than adding private backing fields with the SerializeField attribute for all of my public properties?

sentences:
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:
Why is the drag force multiplied by the inverse normalised velocity vector? In pure physics texbooks, I'm seeing this formula to calculate fluid drag force:

It is clearly stated that it should be opposite to the velocity. Now to me that means, in pseudocode:

fd = get_drag(v) // using the above formula
if v < 0: fd = -fd

That is, if the velocity is negative the drag should be positive, so we invert the returned value.

However, in game code, game physics books and tutorials, I see people doing:

drag = -v
drag.normalise()
fd = get_drag(v)
fd *= drag

That is, we multiply the drag force by the (inverted) velocity unit vector.

This to me is logic in regard to the sign, but also it scales down the drag force by a factor between 0 and 1.

Which one is correct, and why?

PS: to be noted, normalisation involves square root, multiplications and divisions, so it's more expensive than a conditional check and subtraction.

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:
XNA tiling a sprite with a camera.viewmatrix in the Draw method I'm looking for help fixing a small problem that I have with my XNA game project.

I currently have:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
            null, null, null, null, camera.ViewMatrix);
        spriteBatch.Draw(Stone, TestPosition, Color.White);
        spriteBatch.Draw(Person, playerPosition, Color.White);
        spriteBatch.End();

and

spriteBatch.Begin(SpriteSortMode.Deferred,
              null, SamplerState.LinearWrap, null, null);
        spriteBatch.Draw(Grass, grassPosition,
             new Rectangle(0, 0, Grass.Width * 60, Grass.Height * 1),
             Color.White);
        spriteBatch.Draw(Stone, StonePosition,
             new Rectangle(0, 0, Stone.Width * 60, Stone.Height * 10),
             Color.White);

        spriteBatch.End();

I am looking to combine these two spriteBatch so that the stone and grass in the second spriteBatch will be affected by the viewmatrix.

I have tried:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
                SamplerState.LinearWrap, null, null, null, camera.ViewMatrix);
            spriteBatch.Draw(Grass, grassPosition,
                 new Rectangle(0, 0, Grass.Width * 60, Grass.Height * 1),
                 Color.White);
            spriteBatch.Draw(Stone, StonePosition,
                 new Rectangle(0, 0, Stone.Width * 60, Stone.Height * 10),
                 Color.White);
            spriteBatch.Draw(Stone, TestPosition, Color.White);
            spriteBatch.Draw(Person, playerPosition, Color.White);
            spriteBatch.End();

However when I go to run the code, I get the following error:

XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two.

I hope that someone can help me achieve this,
Thank You.

sentences:
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:
Minecraft-style player-gound collision detection The title pretty much says it all... (Minecraft is a game consisting of evenly-spaced cubes for terrain, like voxels)
Note: I am using C# XNA.

I am pretty sure AABB is the way to go, yet I don't know how to implement it. I admit, I'm almost looking for code, but theories/ideas are very welcome.

Important capabilities of my code: I have a function that can get a block anywhere in the world, and get a BoundingBox for that cube. Hence, I have created a BoundingBox for the player to collide with those cubes. My idea was to get the blocks around the player (maybe 4x6x4) and test against those.

The problems I have been having: Say the world is a flat plane. If I use the method of go the shortest distance out, then if the player is slightly clipped into the ground (from gravity), but even slighter into the next block over, then the player will be pushed sideways (and so cannot walk along ground). Of course, this is assuming I react to every block intersected. Another problem is knowing which direction to go (aka negative x or positive). That takes me to my final problem- Getting the amount of intersection, in the correct direction (+ or -) has been tough for me.

I hope I haven't been too hard to understand, I'm not too good at explaining things... And if this question has already been asked, I'm sorry, I looked for it... for 3 days straight.
One last thing, if someone knows exactly how minecraft does it, or has source (I know MC modders have the source, how else would they mod), please point me to it.

sentences:
Questions about "stateless, layered multi-threaded rendering" I have read this blog:
https://blog.molecular-matters.com/2014/12/16/stateless-layered-multi-threaded-rendering-part-3-api-design-details/
Where does a setup like this bind textures/buffers and does state(shaders, blend, rasterizer) switching?
Wouldn't that mean that is anything but stateless when i submit a command only for drawing? Drawing Command would expect correct state, wouldn't it?

sentences:
Calculate damage values from bullet velocity and size I'm trying to make a top-down game using Javascript and Pixi which involves multiple different guns.
Instead of giving each gun an individual damage value, I wanted to calculate the damage by the bullet's dimensions and velocity as it leaves the gun (which is all available on Wikipedia).
However, I'm having issues where despite some damage values looking okay (e.g. UMP-45 has about 40, Mac-11 has about 22, TEC-9 has around 35 and Glock has about the same) some values are too high to offer a challenge to the player (AK-47 has 110, M4A1 has 220, Desert Eagle has 100+).
The current calculation I'm using is:
\$ \frac{velocity \times bullet\ length}{1000} \times \frac{bullet\ radius}{2}\$
Or in pseudocode: (velocity*bulletLength/1000)*(bulletRadius/2)
Anyone have any ideas for tackling this issue, or is it best to just use straightforward values? The game would be a horde-like sandbox game, so the damage values can't be too low or it would be almost impossible.

sentences:
Get all supported resolutions for a monitor I've been receiving complaints from users that my game doesn't support the 16:10 aspect ratio.
Currently I list everything in Screen.resolutions in a dropdown and allow the user to pick from that. I have since come to the understanding that the first element is not necessarily the native resolution of the monitor.
I've found the Display class but this appears to only give the native resolution, not all scaled resolutions. E.g. if the monitor is 1920x1080 then I need a list of 1600x900, 1280x720, 640x360 etc.
I thought about just multiplying by some scale factor but then I'm afraid I'll get something obscure like 885x497.8. And if I have a pre determined list of resolutions for a specific aspect ratio, how do I support obscure aspect ratios like widescreen for example.

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:
Fixed Time Step Flutter I've seen a lot of questions about this problem, but really no solution. Hopefully I can explain the issue well enough that I can get some sort of closure on this problem.

I'm using a Fixed Time Step based on the code found here : GAFFER ON GAMES / Fix Your Timestep! , and with that method I'm using an accumulator value to compensate for any slowdowns or speedups in the frame rate. Typically the time between frames is between 15.5 and 17.5 ms (with the fixed rate aiming for 1000/60 fps). What ends up happening is this:

That green chart is showing the accumulator. Which freaks out once the accumulator gets beyond 1000/60 fps. At this point you can see that because of the variance between refresh rates (15.5-17.5) sometimes the accumulator is above or below the threshold of 16.66666666... until it eventually gets to a point that the accumulator is too big to be negated by the next frame variance.

If I simply ignore the refresh rate and assume a constant 60fps the flutter never occurs, so its shouldn't be a vsync issue (right?), it's not the GC kicking in. It's an issue with this part of the code:

accumulator += frameTime;

while ( accumulator >= dt )
{
    update_logic();
    accumulator -= dt;
}

I realize the issue is when the accumulator hits ~0 it actually starts doing double updates and skipping updates for a while causing the flutter/stutter look.

It's very possible that I'm just not understanding how the accumulator is suppose to work, or perhaps the variance in screen refreshing is too much for this to work well.

Thanks in advance!

Update

Here is a screen cap of an output log showing how the variance in frameTime is causing the update call to double up and skip.

The items in red are when the accumulator never gets to 16.66666666...

For the time being I'm 'fixing' the issue by never letting the accumulator to get below the frameTime variance, but this doesn't feel like a real answer, just a patch.

if(accumulator < 1){
    accumulator = 1.5;
}

Perhaps this bit will help explain. If you start the accumulator at 0 and the first frame takes 15.89999ms, we don't update anything, and then if the next frame is 17.55555ms we now have (~33.44ms) so it updates twice. The more the variance in the frameTime the worse the problem.

I've noticed plenty of people with this issue, and typically the conversation ends with no posted solution, it either "goes away" or the thread dies.

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: Do I need to use the Kinect SDK to develop for Xbox? I was wondering if I need to use the Kinect SDK from Microsoft to develop games for the Xbox 360. I know there are other libraries such as OpenNI and OpenGL, but can I develop games using Kinect for those? Also where would I get a License to develop for the 360?

sentences: How to implement Long Polling with PHP and flash? I'm trying to make a multiplayer game but am a newbie to server side programming except that I know a little PHP. I learnt about this technique called long polling where the server can wait for fresh data to be available and then send it. How does one do long polling using PHP? Are there any libraries available. I'm already using ZendAMF, so how do I make zendamf and long-polling to co-exist?

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:
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:
Utilize remote PC to Boost UE4 Editor Performance As the title suggests, I would like to know how I can take advantage of a desktop PC at my workplace to help boost the performance of the editor on my laptop at home.
General editor actions such as shader compilation, light building, and terrain generation require large amounts of CPU power and RAM, both of which are much better suited for a desktop PC. It would be great if there is a service that can allow me to offload the tasks from my laptop to the remote PC. Unfortunately, directly remoting into that PC does not work for my case.
I am aware of a system known as UnrealSwarm, but have had difficulty finding recent documentation and substantial resources showing it can effectively run jobs other than lightmass rendering.
Please let me know how I can solve my problem!
Thanks in advance!

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 is the difference of target frameworks for unity3d? In Visual Studio in properties I can change target framefork.

I cannot find anywhere what means all of these magic titles.

What does it all mean (full, micro base, subset, web base)?

And...Can I use functionality of .NET 4.6.1 ?

sentences:
How can I center a circle around a point on an HTML canvas? I've got a job to make an engine and light game for canvas in HTML5. I like the things I make to be centered on the x,y positions I give it, I don't know why, it just helps me think about them clearer. I've got it set up for rectangles, all I had to do was subtract half the hieght and half the width from the x/y supplied like this:

c.fillRect(x-width/2,y-height/2,width,height);

But I'm rather stumped when trying to do this with arcs. At first I thought it would be simple, I just did this:

c.beginPath();
c.arc(x-rad/2,y-rad/2,rad,0,Math.PI*2,false);
c.closePath();

But here's how they look when I try them out, 4 rects of increasing width/height and 4 circles of increasing radius.

Does anyone know the math needed to calculate the correct offset for arcs?

sentences:
How to design a class for an object that its state varies over time I have a soccer team with 14 players (11 active + 3 substitutes). The team is going on a tour participating in different matches across the world. I have two very different design ideas of how for the classes for such match, and I am wondering if there is a better approach here. The language is Python and the database is Mongo.

My requirements:

At any time during a match, I want to know the current status of a player. (substitutes, active, injured) as well as their penalty cards if they got any. If they are actively playing, I want to know when they started. If they got back to sitting or got injured, I want to know their most recent start time and end time.
I want to be able to retrieve the information about a past match. For any player in a past match, I only need to know their latest status (as described above)

Here is my idea about db collections:

Players collection:
- Player ID
- Player Name
- Player Tshirt Size

Teams collection:
- Team ID
- Team Player IDs []
- Team Name
- Team logo

Matches collection:
- Match ID
- Team ID
- Match Location
- Match Time

Match Participants collection:
- Player ID
- Match ID
- Latest Status
- Latest Start Time
- Latest End Time
- Latest Penalty Card
- Latest Injury Note

As you see, I tried to separate the static information about a player (Players collection) from their dynamic information in a match (Players History collection) but I not sure how to define classes?

Class Player:
- Player ID
- Player Name
- Player Tshirt Size
- Latest Status
- Latest Start time
- Latest End time
- Latest Penalty Card
- Latest Injury Note

Class Match:
- Match ID
- Player IDs []
- Match Location
- Match Start time
- Match Tshirt color

The second option would be creating another class for the dynamic part to match to my db collection:

Class Player:
- Player ID
- Player Name
- Player Tshirt Size

Class Match:
- Match ID
- Player IDs []
- Match Location
- Match Start time
- Match Tshirt color

Class Match Participant:
- Player ID
- Match ID
- Latest Status
- Latest Start time
- Latest End time
- Latest Penalty Card
- Latest Injury Note

I do not know how I should decide which approach is better. I would appreciate if you help me figure out the approaches pros and cons or even just what criteria I need to think about when deciding between the two.

Is there any design patterns that would describe any of these approaches?

sentences:
How to implement a component-based model for menus in Unity? I'm trying to create a "sims-like" context menu when an item / game object is clicked.

This comes as an add-on question from this question:
How to design context menus based on whatever the object is?

Specifically:

  Each object of class Item would have a list of components like
  Equipable, Edible, Sellable, Drinkable, etc. An item can have one or
  none of each component (for example, a helmet made of chocolate would
  be both Equipable and Edible, and when it is not a plot-critical quest
  item also Sellable). The programming logic which is specific to the
  component is implemented in that component. When the user right-clicks
  on an item, the components of the item are iterated and context-menu
  entries are added for each component which exists. When the user
  selects one of these entries, the component which added that entry
  processes the option.

  You could represent this in your XML-file by having a sub-node for
  each component. Example:

 <item>
      <name>Chocolate Helmet</name>
      <sprite>helmet-chocolate.png</sprite>
      <description>Protects you from enemies and from starving</description>
      <edible>
          <taste>sweet</taste>
          <calories>2560</calories>
      </edible>
      <equipable>
          <slot>head</slot>
          <def>20</def>
      </equipable>
      <sellable>
          <value>120</value>
      </sellable>
   </item>

When I read this, it reminds me of an interface in programming. My question is, how do you implement this? Perhaps a better question is "is the answer still valid" but it does seem relevant to me.

What have I tried?
Nothing at this point, because I'm not sure where to start. Given the example above, I'd guess that Item would have a list of... interfaces? that it could implement? This is why I am a bit confused.

I want to add, this isn't just a UI issue. I found a few radial menus in the store, my issue is how to populate the menu depending on what game object is clicked.

sentences:
Unwanted line between chunks in heightmap infinite terrain I can't figure out what is causing the line between my two chunks.  They are completely aligned.  It must be something to do with the algorithm.  I am using lua with the love2d game engine.  Here is a pic:

Here is the code:

seed = 257
local canvas = love.graphics.newCanvas()

function Interpolate(a, b, x)
    ft = x * 3.1415927
    f = (1 - math.cos(ft)) * 0.5

    return  a*(1-f) + b*f
end

function Noise(x, y)
    n = x + y * seed
    n = bit.bxor((bit.lshift(n,13)),n)
    return ( 1.0 - ( bit.band((n * (n * n * 15731 + 789221) +
      1376312589), 0x7fffffff) / 1073741824.0))
end

function SmoothedNoise1(x, y)
    corners = ( Noise(x-1, y-1)+Noise(x+1, y-1)+Noise(x-1,
      y+1)+Noise(x+1, y+1) ) / 16
    sides   = ( Noise(x-1, y)  +Noise(x+1, y)  +Noise(x, y-1)  +Noise(x,
      y+1) ) /  8
    center  =  Noise(x, y) / 4
    return corners + sides + center
end

function InterpolatedNoise_1(x, y)
    integer_X, fractional_X = math.modf(x)
    integer_Y, fractional_Y = math.modf(y)

    v1 = SmoothedNoise1(integer_X,     integer_Y)
    v2 = SmoothedNoise1(integer_X + 1, integer_Y)
    v3 = SmoothedNoise1(integer_X,     integer_Y + 1)
    v4 = SmoothedNoise1(integer_X + 1, integer_Y + 1)

    i1 = Interpolate(v1 , v2 , fractional_X)
    i2 = Interpolate(v3 , v4 , fractional_X)

    return Interpolate(i1 , i2 , fractional_Y)
end

function getExampleMap()
    mapWidth = 400
    mapHeight = 400
    mapMin = InterpolatedNoise_1(0, 0)
    mapMax = mapMin
    map = {}
    amp = 128
    freq =32
    octaves = 6
    for x = 0, mapWidth - 1 do
        map[x] = {}
        for y = 0, mapHeight - 1 do
            map[x][y] = 0
            for i = 1, octaves do
                map[x][y] = map[x][y] + getNoiseValue(x, y, freq / i,
                  amp / i)
            end
            mapMin = math.min(mapMin, map[x][y])
            mapMax = math.max(mapMax, map[x][y])
        end
    end
    -- /*scale the values between 0 and 255 for rendering in grey
      scale.*/
    mapMultiplier = 255 / (mapMax - mapMin)
    for x = 0, mapWidth - 1 do
        for y = 0, mapHeight - 1 do
            map[x][y] = map[x][y] * mapMultiplier
        end
    end
end

function getExampleMap2()
    mapWidth = 400
    mapHeight = 400
    mapMin = InterpolatedNoise_1(0, 0)
    mapMax = mapMin
    map2 = {}
    amp = 128
    freq =32
    octaves = 6
    for x = 400, (mapWidth + 400) do
        map2[x] = {}
        for y = 0, mapHeight - 1 do
            map2[x][y] = 0
            for i = 1, octaves do
                map2[x][y] = map2[x][y] + getNoiseValue(x, y, freq / i,
                  amp / i)

            end
            mapMin = math.min(mapMin, map2[x][y])
            mapMax = math.max(mapMax, map2[x][y])
        end
    end
    -- /*scale the values between 0 and 255 for rendering in grey
      scale.*/
    mapMultiplier = 255 / (mapMax - mapMin)
    for x = 400, (mapWidth + 400) do
        for y = 0, mapHeight - 1 do
            map2[x][y] = map2[x][y] * mapMultiplier
        end
    end
end

function getNoiseValue(x, y, freq, amp)
    return InterpolatedNoise_1(x / freq, y / freq) * amp
end

function love.load()
    love.window.setMode( 1920, 1080, {fullscreen=false})
    getExampleMap()
    getExampleMap2()
end

function love.draw()

    for x = 0, mapWidth - 1 do
        for y = 0, mapHeight - 1 do
            love.graphics.setColor(map[x][y], map[x][y], map[x][y], 255)
            love.graphics.point(x,y)
        end
    end
    for x = 400, (mapWidth + 400) do
        for y = 0, mapHeight - 1 do
            love.graphics.setColor(map2[x][y], map2[x][y], map2[x][y],
              255)
            love.graphics.point(x,y)
        end
    end

end

function love.update()

end

function love.keyreleased(key)
    if key == "escape" then
        love.event.quit()
    end
end

If I use seed 345 there is no line.

sentences:
PC game update systems I've almost finished a PC game (I'm releasing it in a day or two). I'd like a way to easily release patches over the net in case I find a bug in the game right after release, or in case I want to add features later on.

I am using InstallJammer as my install system. Are there good update/patch programs (preferably free) which can check for and send updates to players over the Internet?

For instance, if a player opens my game, the game first starts the update program that checks for updates. If updates are available, it will let the user know where to get it. I can modify the source code to the game engine I own, but I'd prefer not to re-invent the wheel.

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:
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:
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:
Donut-shaped / inverse mask in Phaser I am trying to get a donut-shaped mask in Phaser (essentially the inverse of a regular mask). The mask shape is dynamic so it needs to be a Phaser.Graphics polygon object.

Desired result:

The blue shape is the sprite I want to mask, the hole in it is the mask itself.

I've searched the Phaser and Pixi v2 documentation and forums - found nothing though. Anybody who knows how I can do this?

If it is not possible, I am thinking of dividing the mask up into eight polygons:

How sound is that idea? Is that going to be expensive or would it be ok? Or any other ways to achieve this?

sentences:
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:
Walking over walls - Game maker studio I am having an issue with the walls in my game. I have set them as objects and used the script:

depth = -y;

inside their create event.

However, when I walk my character in front of them, the correct depth is only kept until the character kindof goes half in front of the wall.

Like this:

These are the collision shapes

And this shows how I inherit from one door parent and add the depth = -y; script to the create event of the wall child.

My character also has depth = -y; but on its step event.

sentences:
How can I make a level generator script run in Edit Mode? Description
I've a script that takes in a PNG bitmap (e.g. 8x8) and, reading from that, populates the grid with cells where alpha > 0.
Problem
The script runs in Awake(), so it can only be seen in Play Mode. I want it to always appear in the scene, even in Edit Mode.
Potential Solutions
I know of the [ExecuteInEditMode] attribute, as well as the OnValidate() callback. I don't know which is better to use, though, or what pitfalls to avoid.
Additionally, in the past, I created a level generator that created a mesh, which I saved as an .asset with a custom editor button. The .asset was then loaded from inside the script. However, if possible, I'd like a more elegant — and automatic — solution.
Other
I'm using Unity 2018.4, and the grid is isometric. (I'm not using Unity's built-in Tilemap.)

sentences:
I have problems for export from Blender to Ogre3D I don't speak good english, but I will try..
I need to make a game for my University.
Exists lot of models in blendswap but, I have problem for export.

Many of these models have extra objects, such as a floor, I need to remove those extra objects and export the weapon and hand.

My idea is:

Import a weapon model with hand with 2 actions, reload and shoot.
How can I do it?

I love this models:

http://www.blendswap.com/blends/view/85257 or 67870 or 70607 (change number in link, because I don't can put more 1 link, because I'm level noob)

sentences:
Texture Not Rendering in C++ SDL OpenGL(glut) I don't understand why my texture("texture.bmp"), is not showing on the screen. Please help me.

The whole drawing function:

///HERE EVERYTHING IS BEING RENDERED
void Main::display(){

    int startTime = GetTickCount();

    ///BACKGROUND COLOR
    glClearColor(0.3f, 0.3f, 2.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ///LOAD THE IDENTITY MATRIX FOR THE DRAWING
    glLoadIdentity();

    ///SO EVERYTHING HAS THE CORRECT SIZE
    glTranslatef(0.0f, 0.0f, -5.0f);

    ///CAMERA MOVEMENT
    glTranslatef(cameraX, 0.0f, 0.0f);

    ///THE SUN
    glBegin(GL_QUADS);
        glColor3f(1.0f,1.0f,0.0f);

        glVertex2f(-3.0f, 2.0f); // The bottom left corner
        glVertex2f(-3.0f, 2.5f); // The top left corner
        glVertex2f(-2.5f, 2.5f); // The top right corner
        glVertex2f(-2.5f, 2.0f); // The bottom right corner
    glEnd();

    ///THE GROUND
    glBegin(GL_QUADS);
        glColor3f(0.5f,2.0f,0.5f);

        glVertex2f(-20.0f,-4.0f);
        glVertex2f(-20.0f,-1.0f);
        glVertex2f(130.0f,-1.0f);
        glVertex2f(130.0f,-4.0f);

        glColor3f(0.0f,1.0f,0.0f);

        for(float i = 0.0f ; i < 100.0f ; i += 5.0f){
            glVertex2f(i,-1.0f);
            glVertex2f(i,ranFloat[static_cast<int>(i-4.0f)]);
            glVertex2f(i+1.0f,ranFloat[static_cast<int>(i-4.0f)]);
            glVertex2f(i+1.0f,-1.0f);
        }
    glEnd();

    ///THE GRASS
    glBegin(GL_QUADS);
        glColor3f(0.0f,0.5f,0.0f);

        glVertex2f(-20.0f,-1.2f);
        glVertex2f(-20.0f,-1.0f);
        glVertex2f(130.0f,-1.0f);
        glVertex2f(130.0f,-1.2f);
    glEnd();

    ///THE PLAYER
    glTranslatef(playerX,playerY,0.0f);
    glBegin(GL_QUADS);
        glColor3f(1.0f,0.0f,0.0f);

        glVertex2f(-3.0f,-1.0f);
        glVertex2f(-3.0f,0.0f);
        glVertex2f(-2.8f,0.0f);
        glVertex2f(-2.8f,-1.0f);
    glEnd();

    ///TEXTUREEEEEEEEEEEEEEEEEEEEEE
    glBindTexture(GL_TEXTURE_2D,texture);
    glEnable(GL_TEXTURE_2D);

    int X = 0;
    int Y = 0;
    int Width = 1;
    int Height = 1;

    glBegin(GL_QUADS);
        glTexCoord2f(0, 0); glVertex3f(X, Y, 0);
        glTexCoord2f(0, 1); glVertex3f(X + Width, Y, 0);
        glTexCoord2f(1, 1); glVertex3f(X + Width, Y + Height, 0);
        glTexCoord2f(1, 0); glVertex3f(X, Y + Height, 0);
    glEnd();
    glDisable(GL_TEXTURE_2D);

    ///CLOUDS
    glBegin(GL_QUADS);
        glColor3f(1.0f,1.0f,1.0f);
        for(float i = 0.0f ; i < 100.0f ; i += 5.0f){
            glVertex2f(i,3.0f);
            glVertex2f(i,4.0f);
            glVertex2f(i+4.0f,3.0f);
            glVertex2f(i+4.0f,4.0f);
        }
    glEnd();

    if(Input::flying){
        Input::returnFly(0.007f);
    }

    elapsedMS = GetTickCount() - startTime; // Time since start of loop
    //std::cout << "FPS: " << elapsedMS << std::endl;

    ///THE ACTUAL MOVEMENT
    playerY += playerFly;//*elapsedMS;
    playerX += cameraSpeed*-1;//*elapsedMS;
    cameraX += cameraSpeed;//*elapsedMS;

    ///SWAP THE BUFFERS FOR SMOOTH RENDERING
    glutSwapBuffers();
  }

The rest of my code has nothing to do with the texture loading. The loading is not the problem, because I didn't get any errors.

sentences:
Calling CCRepeaForever on CCLabelTTF Makes Label Not Show Up I have a CCLabelTTF in the top right hand corner of the view.

-(void)scrollScoreLabelAndMonkey{
scoreLabel = [CCLabelTTF labelWithString:@"0000" fontName:@"Marker Felt"
fontSize:30 ];
scoreLabel.position=ccp(420,300);
scoreLabel.color = ccGREEN;
[self addChild:scoreLabel];
}

I simply add this code to the bottom of the above method. However as soon as i add this line, the label doesnt show up at all.

id moveScore = [CCMoveBy actionWithDuration:.7 position:ccp(scoreLabel.position.x + 10, 0)];
CCRepeatForever *scrollScoreLabel = [CCRepeatForever actionWithAction:moveScore];
[scoreLabel runAction:scrollScoreLabel];

Any help is greatly appreciated!

sentences:
Does SFML render it's graphics using OpenGL internally? By that, I mean that SFML has an abstraction for OpenGL? Sort of like SDL's blit functions, but using OpenGL internally?

"Yes SFML uses OpenGL for all the graphical stuff. "

Received this comment in an earlier question, which sort of baffled me since I find nothing about it.

sentences:
Which protocol should I use for a networked Pong clone? I have to design a Pong game for Android. There are multiple mobiles and a game server. Application is installed in mobile. Mobile 1 (M1) can see the movement of bat and ball of mobile 2 (M2) an vice-versa.

Suppose if M1 hits the ball, all the movements of the ball and bat of M1 can be seen on M2's screen and vice-versa. Now I want to know which protocol I should use and why?

Edited:
how can a server take the initiative to send a message? What are the different methods to do this:  i.e. "push", other,...

sentences:
Too much delay while sending object over UDP to server I'm getting 4 sec delay when sending objects over UDP. Working on small game and trying to implement multiplayer. For now just trying to synchronize movements of 2 balls on the screen. StartingPoint.java is my server(first player), that receiving serialized objects (coordinates). SecondPlayer.java is client that sending serialized objects to server.
   When I'm moving my first object it appears 4 seconds later on different screen.

StartingPoint.java

@Override
public void run() {

    byte[] receiveData = new byte[256];
    byte[] sendData = new byte[256];
   // DatagramSocket socketS;
     try {
        socket = new DatagramSocket(5000);
        System.out.println("Socket created on "+ port + " port");
    } catch (SocketException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    while(true){

        b1.update(this);
        b3.update();

        System.out.println("Starting server...");

        //// Receiving and deserializing object

            try {
                //socket.setSoTimeout(1000);
                DatagramPacket packet = new DatagramPacket(buf, buf.length);
                socket.receive(packet);

                 byte[] data = packet.getData();
                    ByteArrayInputStream in = new ByteArrayInputStream(data);
                    ObjectInputStream is = new ObjectInputStream(in);
                  //  socket.setSoTimeout(300);
                        b1 = (Ball) is.readObject();

            } catch (IOException | ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        repaint();

        try {       Thread.sleep(17);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }

SecondPlayer.java

@Override
public void run() {

    while(true){

        b.update();
        networkSend();

        repaint();

        try {
            Thread.sleep(17);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }

    }

public void networkSend(){

    // Serialize to a byte array
    try {
                ByteArrayOutputStream bStream = new ByteArrayOutputStream();
                ObjectOutputStream oo;
                oo = new ObjectOutputStream(bStream);
                oo.writeObject(b);
                oo.flush();
                oo.close();

                byte[] bufCar = bStream.toByteArray();

                //socket = new DatagramSocket();
                //socket.setSoTimeout(1000);
                InetAddress address = InetAddress.getByName("localhost");
                DatagramPacket packet = new DatagramPacket(bufCar, bufCar.length, address, port);
                socket.send(packet);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

sentences:
Attach movement to each list object How would i move every sphere that gets spawned every 2 seconds ? Basically i want every sphere to follow the previous spawned sphere or even all N-1 spheres should follow the first spawned sphere along a predefined path and they should keep rolling as a train of spheres. I am lost when i try to imprint movement to each sphere.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spawner : MonoBehaviour
{
    public GameObject[] prefabs;
    public List<GameObject> listBalls = new List<GameObject>();
    private GameObject x;
    public int timer = 0;
    private float movementSpeed = 5f;

    void Start()
    {
        createBall();
    }

    void Update()
    {
        if (Time.time - timer > 0.8f)
        {
            createBall();
            timer += 2;
        }
        listBalls[listBalls.Count-1].transform.position += new Vector3(0, 0, movementSpeed * Time.deltaTime);
    }

    void createBall()
    {
        x = prefabs[Random.Range(0, prefabs.Length)];
        Instantiate(x, x.transform.position, Quaternion.identity);
        listBalls.Add(x);
    }

    void moveBall(GameObject x, GameObject y)
    {
        x.transform.position += y.transform.position - new Vector3(0,0,-1);
    }
}

Loop added but movement staggered

        void Update()
    {
        if (Time.time - timer > 0.8f)
        {
            createBall();
            timer += 2;
        }
        foreach (GameObject item in listBalls)
        {
            item.transform.position += new Vector3(0, 0, movementSpeed * Time.deltaTime);
        }
    }

```

sentences: Scoping my first project So I'm writing my first game which is a RTS and one of my main ideas for it is multiplayer deception however I'm finding it hard to control the scope of my project. Yes im thinking pretty small but because a key element of the game is multiplayer I'm wondering if its a good idea for a first game I know APIs such as appwarp exist and allow easier multiplayer integration but is this realistic for a first game or is it a better idea to go single player?

sentences:
How to not move my character when they collide using Unity and Box Collider? I'm trying to get my characters near to each other so they can attack the other one, but when the player character or otherwise gets near they are pushed to the other direction when they collide. How to prevent that happen so they won't move when touching each other?

This is the player objects:

The Treant objects:

I what I want is that they collide and can't move through each other and stop moving. But this keep happen: gif of my treant getting pushed away

Can someone help me with this issue?

sentences:
JBox2D bodies don't collide? I have two objects. A dynamic player and a static ground object.

It was working for a while until I did some refactoring and suddenly my play falls right through my ground object.

Is there anything obviously wrong with the following? I have no idea what might be wrong so  if you have experienced this before, enlighten me!

Here's the initialization code of the objects:

(pixelsPerMeter is 10)

    int pixelsPerMeter = Game.instance.pixelsPerMeter;

    //create body def
    BodyDef boxDef = new BodyDef();
    boxDef.position.set(0, 0);
    boxDef.type = BodyType.DYNAMIC;

    //create shape
    PolygonShape boxShape = new PolygonShape();
    boxShape.setAsBox(this.size.width / pixelsPerMeter, this.size.height / pixelsPerMeter);

    //create body
    body = Game.instance.world.createBody(boxDef);

    //finally create the fixture
    FixtureDef boxFixture = new FixtureDef();
    boxFixture.density = 1;
    boxFixture.shape = boxShape;

    //add the fixture to the box? :\
    body.createFixture(boxFixture);

This is done twice, one for the player and once for the ground object.

The player's body type is set to BodyType.DYNAMIC while the ground is STATIC.

And of course the ground is below the body, and gravity is set to 9.8f.

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 to prevent constant movement So I have this code for moving a pointer up and down in a menu. The only problem is it moves way too fast to even stop on any of the selections. It does go to each one, but even just a quick tap of the button the pointer moves down 3 selections. If you go up and down a few times it will go to the selection you want, but it's a hassle. So is there a way to maybe disable movement for about half a second?

        if(Game.stateEngine.menuState == StateEngine.MenuState.ITEM)
        {
            if(Input.dn && Game.pointer.y < 430)
            {
                Game.pointer.y += 15;
            }
            if(Input.up && Game.pointer.y > 172)
            {
                Game.pointer.y -= 15;
            }
            if(Input.x && Game.stateEngine.menuState != StateEngine.MenuState.MAIN)
            {
                Game.stateEngine.menuState = StateEngine.MenuState.MAIN;
                Menu.firstPass = true;
            }
        }

sentences:
Where to put SFML Window in GameStateManager I have a Pong game using SFML organized after this tutorial.

This is the UML diagram from the tutorial.

Now I am not sure where I should put my SFML RenderWindow variable (and other things that might need to be shared between game states.

I have a PlayingGameState with a shared_ptr to a GameStateManager. So the right place should be the GameStateManager class. Or should I put it into the DirectRenderingGameStateManager and change the shared_ptr to DirectRenderingGameStateManager?

sentences:
Problem with action mapping Summarizing my problem well, I need a single button (right mouse button) to do two things.

In my project (TopDown) I defined that instead of the left mouse button, the character moves with the right mouse button.

I happen to like that when I click the right mouse button on a particular actor, a simple event is called (print hello).

I tried doing this with the Event On Clicked, but it only works with the left mouse button:

With the help of these links:

https://www.unrealengine.com/en-US/blog/input-action-and-axis-mappings-in-ue4

https://answers.unrealengine.com/questions/134349/right-click-on-an-actor.html

https://answers.unrealengine.com/questions/17729/how-to-create-a-right-mouse-click-event-with-bluep.html

I figured out how to do an action/event call with the right mouse button, but even then I did not succeed.

Soon I discovered that the reason was that there was already an action that was executed with the right mouse button (walk/set destination):

I would like my character to continue to move with the right click of the mouse, but how do I also call an event when I click the right mouse button?

EDIT 1

If the mapping is done with two different keys, it works perfectly:

In this case the character jumps and walks (instead of jumping it could be anything else):

I want this to happen by right-clicking (walking and jumping):

This action I want to perform is when clicking on the mesh of any actor, but I can only do this with the left button.

sentences:
Cannot find GameController script - causing errors with logging and references I am learning the Unity engine and have been practicing with various tutorials, but there is a curious error I am experiencing with the space shooter tutorial. Collisions with the player ship do not destroy asteroids or the player, while collisions with bolts fired by the player will destroy the asteroids but not increase the score at all.

The error being logged is "Cannot find GameController script" which makes me think there is a problem with my code below, specifically the void Start() function that checks if GameController != null.

Is there something about Unity 5 that differs from Unity 4 that I would need to change? Or have I made a mistake in this code attempting to reference the GameController script?

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

public class DestroyByContact : MonoBehaviour {

    public GameObject explosion;
    public GameObject playerExplosion;
    public int scoreValue;
    private GameController gameController;

    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        if (gameController != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }
    }

    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }
        Instantiate(explosion, transform.position, transform.rotation);
        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }

        Debug.Log(other.name);
        Destroy(other.gameObject);
        Destroy(gameObject);
        gameController.AddScore(scoreValue);
    }
}

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:
The camera in a 2D tile based side scroller is moving slower than the player In my 2D tile based side scroller, I want a camera that scrolls in the x direction, but not in the y direction. The world is separated into three zones; one on the left and one on the right where the camera doesn't move, and one in the middle where the camera should move left and right and centered on the player.

The world is a 2D int array where each tile has it's own ID (number). The player's position is in pixel coordinates.

My problem is that when the player moves outside the left zone (and into the middle), the camera always move slower than the player, which means the player disappears of the screen. Since I calculate the camera's position from the player position when the player is in the middle zone, I don't understand why the camera isn't always centered around the player.

My code for calculating the camera's position and drawing the background is as follows (in C#):

int worldWidth = world.GetLength(0) * _TILE_WIDTH;
int resX = camera.Width / TILE_WIDTH;
int resY = camera.Height / TILE_HEIGHT;

Bitmap screenBmp = new Bitmap(camera.Width, camera.Height);
Graphics g = Graphics.FromImage(screenBmp);

// upper left corner of the camera in the world
Vector2D pCamera = new Vector2D(p.X + (p.PlayerSize.Width / 2) - (screenBmp.Width / 2), 0);

int oneMoreX_tile = 0;  // draw one more tile off the screen?

if (p.X + (p.PlayerSize.Width / 2) < 0 + screenBmp.Width / 2) // past the left zone
{
    pCamera.X = 0;
}
else if (p.X + (p.PlayerSize.Width / 2) >= worldWidth - screenBmp.Width / 2) // past the right zone
{
    pCamera.X = worldWidth - screenBmp.Width;
}
else  // between the zones
{
    oneMoreX_tile = 1;
}

int xOffset = (int)pCamera.X % TILE_WIDTH;
int yOffset = (int)pCamera.Y % TILE_HEIGHT;

int startX_tile = (int)pCamera.X / TILE_WIDTH;
int startY_tile = (int)pCamera.Y / TILE_HEIGHT;

for (int i = 0; i < resX + oneMoreX_tile; i++)
{
    for (int j = 0; j < resY; j++)
    {
        int tileValue = world[startX_tile + i, startY_tile + j];

        // tile coord in tileset
        int x = tileValue % tilesetWidth_tile;
        int y = tileValue / tilesetWidth_tile;

        // pixel coord in tileset (top left)
        int x_px = x * TILE_WIDTH;
        int y_px = y * TILE_HEIGHT;

        g.DrawImage(tileset,
            new Rectangle(i * TILE_WIDTH - xOffset, j * TILE_HEIGHT - yOffset, TILE_WIDTH, TILE_HEIGHT),
            new Rectangle(x_px, y_px, TILE_WIDTH, TILE_HEIGHT),
            GraphicsUnit.Pixel);
    }
}

This code runs every time the graphics timer ticks. (I'm using Windows Forms..) I have two timers set at the same interval; one graphics timer and one physics timer. The physics timer just updates the player's position.

Regardless of world length, the player always disappears of the screen at 640 pixels (which is also the width of the screen), and the camera's position is 336 pixels from the left. I have also tried with lower speeds with no success.

Please ask if there's anything more you need to know. Any help would be appreciated.

sentences:
Unwanted rotations with transform.RotateAround I didn't tough i would have issues with this, but unfortunatly I did. I have a Character (which is more a pile of cube) with a body, a empty GameObject for each leg attached to the body with a join and 2 cubes for leg too. The body and the two empty gameobject are child of a Empty gamebject. The 2 cube that represent leg are both child of one of the empty gameObject. What I want to achieve is to rotate the leg around the position of its empty parent by doing this:

if(Input.GetKey("l"))
    {
        l_leg.transform.RotateAround(l_leg.transform.parent.transform.position, new Vector3(1,0,0), 75 * Time.deltaTime);
    }

unfortunatly, I only want it to rotate on x, but all of the axis are changing, which lead to unwanted rotation. Now, I know rotations aren't independant like translations, but I don't know how to fix this. If possible, i'd prefer to rotate locked joint via script but I have now idea how, I haven't seen anything about it when I looked up]2

sentences:
What is the transformation order when using the Transform Class? I am currently using Unity 5.5 for the first time in a project and I've got some problems regarding transformations.

I've got a background in more general 3D graphics meaning that I'm used to manually manage scene graphs and matrix transformation orders.

My greatest problem when moving to Unity, and using their built in Transform Class, is that I can't find any information regarding the transformation order of rotation, localrotation, scaling, localscaling, position and localposition.

I can't find any good information of this and It's driving me slightly mad.

TL;DR: What's the transformation order of the Transform class?

sentences:
Java BufferStrategy Flickering I was watching a tutorial on using a BufferStrategy in Java and I wanted to test a very simple example. The issue is that it flickers intensely and it seems as if a piece of the starting oval stays on the screen. I know that the loop is a very bad practice but I just wanted to very simply test the BufferStrategy.

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferStrategy;

public class Game extends JFrame {
    private Canvas canvas = new Canvas();

    public Game() {
        setBounds(0, 0, 1280, 720);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        add(canvas);

        setVisible(true);

        canvas.createBufferStrategy(3);
        BufferStrategy bufferStrategy = canvas.getBufferStrategy();

        int x = 0;
        int i = 0;

        while(true) {
            i++;

            if(i == 10) {
                i = 0;
                x++;
            }

            bufferStrategy = canvas.getBufferStrategy();
            Graphics g = bufferStrategy.getDrawGraphics();
            super.paint(g);
            g.setColor(Color.RED);
            g.fillOval(x, 200, 50, 100);
            g.dispose();
            bufferStrategy.show();
        }
    }

    public static void main(String[] args) {
        new Game();
    }

}

sentences:
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:
Using 60 frames per second causes the screen to leave a drawn trail of textures, when there is movement I'm trying to implement a frame rate feature, and I have noticed that using 60 frames per second causes the screen to leave a drawn trail of textures, when there is movement.

Here's the code I'm using to make the frame rate feature:

public void render(float deltaT){
    currentLevel.updateWorld(deltaT);

    if((fps+=deltaT) >= 1.0/60.0){
        fps = 0;
    }else
        return;

    super.render(deltaT);
    Gdx.gl.glClearColor(103 / 255f, 69 / 255f, 117 / 255f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    currentLevel.updateScreen(deltaT, gameCamera);
}

The currentLevel.updateWorld updates the game's logic.
The currentLevel.updateScreen method updates the camera's position, drawn to the screen.

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:
What are the most suitable 3D sound engines out there for a FPS? We are looking for a good 3D sound engine for a game written in C#.
We know of irrKlang, which looks great but isn't free for commercial uses, nor is it open source.
XNA has an alright one, but it binds us to DirectX and therefore, windows.
Are there any other good free ones out there?

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:
Defining lines from a heightmap To a pixel shader of a 2D game, I'm passing a 1-row heightmap that holds the height in UV coordinates of evenly distributed points throughout the texture I'm drawing, but as for n points there will obviously be n-1 lines connecting consecutive ones, I can't make these lines as wide as they should be.
For example, filling the pixels below the lines of a heightmap that holds 3 values ({0f, 1f, .5f}) should result in something like:

but instead, it looks like this:

It is visible that the correct result lies on the first 2/3 of the second one, and the last 1/3 comes from clamping the heightmap.

Here is a simpler version of the pixel shader code.

float4 PixelShaderFunction(float4 texCoords:TEXCOORD0):COLOR0
{
    float verticesCount = 3;
    float verticesFrequency = 1/verticesCount;

    float lastHeight = tex2D(heightMapSampler, float2(texCoords.x, 0));
    float nextHeight = tex2D(heightMapSampler, float2(texCoords.x + verticesFrequency, 0));

    float delta = (texCoords.x % verticesFrequency)/verticesFrequency;
    float height = lerp(lastHeight, nextHeight, delta);
    if(texCoords.y > height)
        return float4(1, 0, 0, 1);
    return float4(0, 0, 0, 1);
}

I tried multiplying the texture coordinates by (verticesCount-1)/verticesCount but that didn't seem to do the job. Thank you!

sentences:
Generating a sprite using a list of points I am trying to dynamically generate a sprite in Unity to visualize a list of points.

What I've got so far is creating a small Texture2D object and then trying to override the geometry:

static SpriteRenderer SpriteRendererFromPoints(SpriteRenderer spriteRenderer, List<Vector2> points) {
    var texture = Texture2D.whiteTexture;
    spriteRenderer.sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f));
    Sprite sprite = spriteRenderer.sprite;
    sprite.OverrideGeometry(points.ToArray<Vector2>(), sprite.triangles);
    return spriteRenderer;
}

I am adding this SpriteRenderer and a PolygonCollider2D to my gameobject and the instantiate it like this:

    GameObject meshObject = new GameObject();

    PolygonCollider2D polygonCollider = meshObject.AddComponent<PolygonCollider2D>();
    PolygonCollider2DFromPoints(polygonCollider, points);

    SpriteRenderer spriteRenderer = meshObject.AddComponent<SpriteRenderer>();
    SpriteRendererFromPoints(spriteRenderer, (from point in points select new Vector2(point.x, point.y)).ToList<Vector2>());
    Instantiate(meshObject);

It all runs fine but when running this, the sprite is nowhere to be seen:

Any help as to what I'm missing here or alternative ways of accomplishing this would be much appreciated.

sentences:
Unity find position within range of object Say you have a gameobject that is at a certain position(this could be your player).

Now say that you have a melee NPC that has to be within a certain range to hit the Player.

Now you would do something like this to find out where the player is:

var targetPosition = target.transform.position;

Say that the range of the NPC is 4 meaning he can be 4 units away from the player before he can start attacking him.

My question is how would you subtract that to get a position that is within range?

And am i doing this type of thing correctly? or is there a better way of doing it?  :)

Any help would be appriciated a lot!

sentences:
Unity settings overlapping other settings error In my unity game, I am using the amazing unity asset aura volumetric lighting and when I add its script into my camera this happens:

Yeah... I can't see anyone else who got these settings overlapping each other on the stack exchange or anywhere else. Not only does it overlap but I can actually change its settings and the camera settings if I click in the right areas! I restarted unity but it still doesn't fix anything. Please help. Thanks in advance!

sentences:
How to get "this" object collider name when OnTriggerEnter is fired? I have a "car" object with 2 colliders attached, a base and a top collider. Then I have a script attached to my car.
I'm using OnTriggerEnter event to detect collisions with an invisible "Checkpoint".
The problem is that OnTriggerEnter is called twice, I suppose because it is called either from the base collider and top collider.
I want to check my object collider's name.
OnTriggerEnter expose me with "other" collider; however, how can I test my collider's name?

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:
Draw contour around object in Opengl I need to draw contour around 2d objects in 3d space. I tried drawing lines around object(+points to fill the gap), but due to line width, some part of it(~50%) was covering object. I tried to use stencil buffer, to eliminate this problem, but I got sth like this(contour is green):

http://goo.gl/OI5uc (sorry I can't post images, due to my reputation)

You can see(where arrow points), that some parts of line are behind object, and some are above. This changes when I move camera, but always there is some part, that is covering it.
Here is code, that I use for drawing object:

    glColorMask(1,1,1,1);
    std::list<CObjectOnScene*>::iterator objIter=ptr->objects.begin(),objEnd=ptr->objects.end();
    int countStencilBit=1;
    while(objIter!=objEnd)
    {
        glColorMask(1,1,1,1);
        glStencilFunc(GL_ALWAYS,countStencilBit,countStencilBit);
        glStencilOp(GL_REPLACE,GL_KEEP,GL_REPLACE );
        (*objIter)->DrawYourVertices();

        glStencilFunc(GL_NOTEQUAL,countStencilBit,countStencilBit);
        glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
        (*objIter)->DrawYourBorder();

        ++objIter;
        ++countStencilBit;
    }

I've tried different settings of stencil buffer, but always I was getting sth like that.
Here is question:
1.Am I setting stencil buffer wrong?

2. Are there any other simple ways to create contour on such objects?

Thanks in advance.

EDIT:

1. I don't have normals of objects.

2. Object can be concave.

3. I can't use shaders(see below why).

sentences:
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:
Tile map/terrain implementation with differing heights of neighbouring tiles Ahoy!

I'm looking for some information about tile maps, or rather, what a specific type of tile map is called.

I'm interested in the kind of implementation used in rollercoaster tycoon, or the transport tycoon series of games and have been looking into vector field terrain and height map terrain but i'm not sure they're suitable for what i'm looking to develop.

It's been a struggle to find any decent info as most people refer to it as an isometric tile map, but I'm looking to create something in 3D with a fixed orthographic perspective. I understand that the underlying storage of the tile map has nothing to do with how it is rendered but i'm not looking to create a 2D tile map like old school pokemon/zelda games, more along the lines of diablo with the capability to include overhanging cliffs and sloping terrain.

I'm just trying to find the right terms to search google and stackoverflow for resources to help me decide which path to proceed.

So far i've managed to flesh out a basic tile map without using the height/y component stored in a VBO and rendered as a wireframe. This looks fine so far but I envisage that I will encounter problems when trying to manipulate a single vertex to create cliffs and slopes without affecting a neighbouring tile.

Is there a specific type of implementation I should be looking into? I thought i'd cracked it when I found a fair amount if info on vector field terrain but i'm not sure this would yield the correct results either.

If anyone can shed some light on this for me please, the help would be greatly appreciated :)

Update

I've included an image for further clarification as to what i'd like to achieve:

Image borrowed from How to create tilted (height) isometric tiles

This image shows the type of terrain i'd like to generate but doesn't include the "cliffs" or overhanging terrain types i'm interested in modelling. It does however raise a few other questions I hadn't considered, namely;

How would 'layers' such as the water (top left of the image) be handled to include the visible ground underneath the water?
How would the "edges" of the map be catered for so that the earth/mud is rendered to depict the world as a non-flat entity?
Could the underlying storage for this kind of terrain be used to model physics such as a ball rolling down a hill or movement speeds of a player traversing a slope?

I had an idea in that each tile of the terrain could be modelled with 8 vertices where the 4 main vertices cover the actual tile itself and the remaining 4 vertices are used to model the sides/walls of each tile. The two problems I see with this implementation is that a) the world map is essentially doubled in size and b) given that not all tiles will include "walls", some tiles will end up with redundant vertices which are not used.

I'd like to create a terrain editor which allows for each tile to be deformed as well as including the ability to change the terrain during game play. This in itself poses additional questions such as; Can a VBO be used to store and render the terrain whilst being modified on the fly and also, is it possible to modify vertices without affecting neighbouring tiles?

I'm under the impression that i'm either over-complicating things or running into analysis-paralysis in that i'm neglecting to write any code to solve the problem without having a clear idea of how I would achieve what I want.

Again, i'm really just looking for a shove in the right direction with this. Is there a specific type of tilemap/terrain implementation that would cater for a 3D map to be deformed by both a map editor as well as during gameplay or do I have to roll my own, so to speak? I'm not trying to reinvent the wheel here but I am struggling to find any resources given that I'm not sure what to be searching for.

If anyone can provide any info, resources or snippets of code, that would be hugely appreciated as i'm eager to get my hands dirty and start producing something other than the flat wireframe I currently have.

Thanks for reading!

sentences:
Integrating ogre3d with hololens I would like to integrate ogre3d with directx and c++ using hololens.

is it that possible to do so ?

what are the steps to convert the rendering engine, what's rendered to the frame buffer to the hololens buffer?

sentences:
How do the systems find the entities they should operate on in Entity-Component-System pattern? I have read many articles about ECS patterns. Many of them are clear on what the entity and components are  but don't really talk about the system because it "varies" or just use plain English to describe the behavior like "it finds the entities the system should work on", but how exactly that happens?

Let's say we have an Entity class which holds the all the components it needs (Transform, Texture, and Rigidbody). Now I have one system called RenderingSystem that uses Texture and Transform to render the entity to the scene. Then how would this RenderingSystem efficiently find all the Entities that need to be drawn on the scene?

sentences:
What are projection independent ways of determining whether a normal is facing the viewer? A position v and normal n are given in world coordinates. Also there is a view matrix V for world-eye coordinate transition and a projection matrix P for eye-ndc transition. I would like to determine, whether the normal is facing the viewer.

If we assume that P is a perspective matrix, we can compare the normal direction with the direction to the viewer, both in eye-space. Note that the approach won't work for an orthographic projection, because there is no well defined eye position. But if P is orthographic, we only need to check the Z coordinate of n in eye space. Nevertheless, I'm seeking a solution that does not make assumption about what projection type we're using.

One way of achieving this is to compute the inverse P' of P and retrieve the viewing direction as a vector spanned between P' [u.x, u.y, -1] and P' [u.x, u.y, 1], where u is v transformed to ndc. The drawback here is that it requires inverting a matrix and in my case also passing it to the shader.

Another solution would be to construct a small triangle around v within the normal plane of n, and check what's its winding direction in the ndc. The problem with this approach is that it's computationally heavy and it's still seems to me more like a hack than a proper solution.

I am not very satisfied with these two solutions. Do you have any other ideas? Am I missing something very simple?

EDIT:
Since it seems unclear why the dot(v - eye, n) < 0 is not satisfactory in my case, I post an exaple showing the difference between perspective and ortho projection for this particular problem.

As you can see, the vector is facing slightly away in the perspective projection, but clearly towards in the orthographic projection. More specifically, a face having that particular normal would be culled in perspective, but not in ortho.

sentences:
2D Collision Resolution getting stuck on walls I've been writing this collision detection system using a tutorial from an article I read and I just cannot for the life of me get it to function 100% correctly. Here's the code for starters:

BoundingBox aBox;
aBox.Convert(a);
BoundingBox bBox;
bBox.Convert(b);

Vector2 aMin = aBox.GetTopLeft();
Vector2 aMax = aBox.GetBotRight();
Vector2 bMin = bBox.GetTopLeft();
Vector2 bMax = bBox.GetBotRight();

Vector2 minDistance;

float left = (bMin.x - aMax.x);
float right = (bMax.x - aMin.x);
float top = (bMin.y - aMax.y);
float bottom = (bMax.y - aMin.y);

// Check for intersection internally
if (left > 0 || right < 0) return;
if (top > 0 || bottom < 0) return;

// Find the minDistance
if (abs(left) < right)
    minDistance.x = left;
else
    minDistance.x = right;

if (abs(top) < bottom)
    minDistance.y = top;
else
    minDistance.y = bottom;

// Null axis with biggest value
if (abs(minDistance.x) < abs(minDistance.y))
    minDistance.y = 0;
else
    minDistance.x = 0;

The problem right now is that the character is fine walking and hugging the top of a block and the bottom of a block, but once he has to walk UP two blocks, he gets stuck in between them. Coincidentally, walking down works perfectly fine. Just wondering if anyone has a solution to this problem, it would be much appreciated!

Here's a gif to better display the problem:

sentences:
How do I download audio resources and save them in cache? I am developing a game in Unity3d 2019, the instructions of the game must be translated into several languages. Right now, they are part of the compilation, but this makes the compilation very large.

I would like, according to the selected language, to be able to download the corresponding audio and save it in the cache.

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:
Does GLSL support multitexturing? I am using LWJGL libraries to code myself a game. I want to be able to import a project from blender to my game. I have the wavefront .obj reader and it works perfectly for my needs. Although because my model uses multiple images I do not know how to set that up in my game engine. All it does is stretch the first image I send to the shaders across the entire model. Then I ran across a couple videos that makes me doubt that GLSL can support multiple images. Also, I found a couple solutions but they were depreciated because I use LWJGL 3 with slick-util 3 to load the image.

So I would first like to know, does GLSL support rendering multiple images on a single object?

If GLSL can support rendering multiple images on a single object, how would I proceed conceptually to perform this feat?

P.S. Let me know if want images or anything to better understand my question. Thank you all!

sentences:
Setting a texture's "Max Size" while ensuring that its dimensions are still multiples of 4 A version of my game has several large textures with dimensions that are multiples of 4 so that Crunch compression can kick in.
A ported version of my game, for platforms that have very limited RAM restrictions, will need us to limit the "Max Size" of our textures to 512 or 256, etc.
There are some cases in which a Crunch-friendly texture, when resized by Unity's "Max Size" parameter, will actually end up with dimensions that aren't multiples of 4.
944x800 would end up as 512x434, if we select "512", which isn't good for Crunch.
The naive solution in my mind is to write a simple script/tool that resizes/pads all my textures by a couple of pixels in such a way that Unity's resize will end up in a Crunch friendly way. However, I'd rather do that as a last recourse if possible.
Is there a more standard way to approach this situation of mine?

sentences:
Tile based map player movement I'm doing a tile based 2d rpg in pygame. The problem I'm working on right now is character movement...
I am already able to create a map by using multidimensional arrays and a 'camera' follows the player.
My problem is now the collision detection... The player should only move one tile at the time so I can easily get his position in tile coordinates and check if he's collided. But I don't know how to do that! At the moment, if a key is pressed, the player moves four pixels in a direction every frame. But that makes tile based collision detection nearly impossible. The player has the size of one tile and yeah, my question is, how can I make the player move only one tile (but NOT every frame since then he would move 32 pixels every single frame.)
I know this question was asked before : Pygame Tile Based Character movement speed  but this wouldn't work for me, because you had to press the key EVERY TIME you want to move one tile. I use booleans so the player moves as long as the key is pressed.

sentences:
Why are there no dynamic shadows in UE4? So my problem is that other than for static objects which have baked shadows from building lighting, there are no shadows for movable objects, like those cubes. Neither from the Light source actor, which is stationary, nor from Point lights that are either static or moveable.

I may be wrong but I think it used to have dynamic shadows (or I didn't notice the lack of them until recently). So any ideas how to get dynamic shadows?
Thank you

sentences:
Unity - animations threading As one cannot play around with threads themselves, the user-made code that uses unity's API is executed on the main thread. I'm sure unity uses some sort of thread management on its own though.

Thing is, I wrote some basic UI animation toolkit (rotate, scale, lerp alpha, move and tie events etc) that - as being user code - runs on the main thread, taking up CPU power, even if they are not vital to be completely synchronized with the logic. (Event connected to them only start other animations).

I would like to know if Unity uses another thread for animations as well and if so, is it possible to mark this UI toolkit to be executed on that thread or - as I said - user code with unity api can be only ever executed on the main thread?

sentences:
Techniques for drawing lines, with mouse, on 3D objects in WebGL or OpenGL? Can anyone point me to techniques for drawing lines, with the mouse, on 3D objects in WebGL or OpenGL?

Here's the effect I'm looking for, using WebGL: http://www.spacegoo.com/cadillac/

I can imagine the general idea - projecting a ray onto the surface, then perhaps using normals and UVs, transform the intersections into UV-space and drawing the line on a texture, which gets mapped onto the object.

Would love to find some proper literature on it though.

sentences:
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:
Adding multiple animated sprites on canvas make the game FPS drop sharply I am using PIXI.js to build a html5 canvas game. Although this is PIXI.js specific question I think this may happen very often in HTML5 canvas games.

I have placed hundreds of static sprites in my game and all goes well. But when I try to add 30 animated sprites (AI players) in the game, the FPS drops from 60 to 30. If I add even more it becomes very slow and unplayable. I have profiled my program on Chrome and found that this method

CanvasSpriteRenderer.prototype.render

is using too many CPU resources. Is there a way to reduce the CPU consumption and make my game smooth again?

sentences:
Why does this order of Quaternion multiplication not introduce roll into my fps-style character controller? I'm working on an OpenGL based project (in C#), employing Quaternions to rotate my camera I first tried to:
cameraOrientation = cameraOrientation * framePitch * frameYaw;

This accumulated an undesired roll in my cam-controller which made rotations unusable.
I found a post on stack exchange which suggested this reordering of operations:
cameraOrientation = framePitch * cameraOrientation * frameYaw;

Which completely solved this accumulation of roll. While I'm comfortable with matrix multiplication, I can't seem to understand why this removes roll accumulation. Does anybody have any articles or images so I can grok what's happening here?
It feels weird not to understand such a fundamental operation in my project.
Thanks!

sentences:
Unreal Asset export : vertex-shader I have an Unreal asset, and we need to convert or replicate a similar visual appearance in Unity.
Initially, we started converting the Unreal asset into FBX. Used MAYA to reload the content with relative textures and maps.
As a result, the colour scheme I see on the buildings in the Unreal engine is not the same in MAYA.
Few of the known experts said that in Unreal they might have used vertex colour for the polygons.
Question:

Can we apply a vertex colour in the Unreal engine? if you have a huge scene, how can we control assigning the wall colour (vertex colour)?
If there is an option to add the vertex colour, How can I read that data(Information) in Unreal?
Is it possible to export these properties in any form of data? so that we can load and replicate(duplicate the effect done to get a different wall colour) in MAYA?
Is it possible to make the identical scene in Unity by using Unreal asset?

I am very curious to know the answers to the above questions, any answers from you can provide an insight for us to look for the solution from a different angle.
Thanks in advance for the help.

sentences: How to get the mouse events in an unreal engine editor plugin? I would like to react to user inputs in an editor plugin, how can I do that? In a game I can use a custom Pawn or a custom PlayerController but how can I do it in the editor?

sentences:
Why are there weird texture artifacts in baked light which don't appear with realtime light? This is the comparison of the same scene, realtime light vs baked light.

What's am I wrong ?

EDIT: In particular, also texture are low quality (see image 2). Why ?

sentences:
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:
Phaser: show text when overlap sprites I am trying to work out a way to add a text to the top left corner of the viewport when two of my sprites overlap. One of them is a item and the other is my character. I can already detect for overlap and even "pick" the item (kill the sprite) when I click a key. However I would like that a text saying something like "Click "E" to pick the sword!" appeared while the collision function is active and when I kill the sprite by picking it up the text would vanish.

I tryed including the text in the collision function itself but I suppose this way I am rendering the text multiple times ( the fps drop a lot) and I just want to create it once and remove it according to my purposes. My code:

function collisionHandler(dude,the_sword) {
pickObject.onDown.add(function () {
        the_sword.kill();
    }, this);
 }

game.physics.isoArcade.overlap(dude, the_sword, collisionHandler, null, this);

 // message saying to pick // Where to put this?
var style = { font: "30px Arial", fill: "#ff0044"};
var pick_message = this.game.add.text(0,20,"Click 'E' to pick up the sword!",style);
pick_message.fixedToCamera = true;

Any idea on how to do this? Thank you.

sentences:
Euler (right-handed) to Quaternion (left-handed) conversion in Unity I'm having trouble figuring out the proper conversions from Euler angles to Quaternions. The Eulers come from BVH files, which use a right-handed coordinate system (Y is up, Z is forward) and can have any rotation order specified. The Quaternions are in Unity, which is left-handed (Y is up, Z is back).

I'm composing the Quaternions from three AngleAxis rotations, but messing up the order somewhere. So far I can't find understandable and generalized information for doing these types of conversions.

public enum AxisOrder
{
    XYZ, XZY, YXZ, YZX, ZXY, ZYX, None
}

public Quaternion EulerToQuat(Vector3 eulerAngles, AxisOrder rotationOrder)
{
    // I've tried various combinations of axis angles here, but would
    //  like to understand what's wrong rather than brute-force
    //  every combination
    var xRot = Quaternion.AngleAxis(eulerAngles.x, Vector3.left);
    var yRot = Quaternion.AngleAxis(eulerAngles.y, Vector3.down);
    var zRot = Quaternion.AngleAxis(eulerAngles.z, Vector3.back);

    switch (rotationOrder)
    {
        case AxisOrder.XYZ: return (xRot * yRot) * zRot;
        case AxisOrder.XZY: return (xRot * zRot) * yRot;
        case AxisOrder.YXZ: return (yRot * xRot) * zRot;
        case AxisOrder.YZX: return (yRot * zRot) * xRot;
        case AxisOrder.ZXY: return (zRot * xRot) * yRot;
        case AxisOrder.ZYX: return (zRot * yRot) * xRot;
    }

    return Quaternion.identity;
}

...and converting translation data like so (I believe this is working):

public static Vector3 BvhToUnityTranslation(float xPos, float yPos, float zPos)
{
    return new Vector3(xPos, yPos, -zPos);
}

If anyone can help me better understand how to conceptualize coordinate system conversions, and where I'm going wrong, I'd greatly appreciate it.

sentences:
Java - 2d Array Tile Map Collision How would I go about making certain tiles in my array collide with my player? Like say I want every number 2 in the array to collide. I am reading my array from a txt file if that matters and I am using the slick2d library.

Here is my code if needed.

public class Tiles {

Image[] tiles = new Image[3];

int[][] map = new int[500][500];

Image grass, dirt, mound;

SpriteSheet tileSheet;

int tileWidth = 32;
int tileHeight = 32;

public void init() throws IOException, SlickException {
    tileSheet = new SpriteSheet("assets/tiles.png", tileWidth, tileHeight);

    grass = tileSheet.getSprite(0, 0);
    dirt = tileSheet.getSprite(7, 7);
    mound = tileSheet.getSprite(2, 6);
    tiles[0] = grass;
    tiles[1] = dirt;
    tiles[2] = mound;

    int x=0, y=0;
BufferedReader in = new BufferedReader(new FileReader("assets/map.txt"));
String line;
while ((line = in.readLine()) != null) {
        String[] values = line.split(",");
    for (String str : values) {
            int str_int = Integer.parseInt(str);
            map[x][y]=str_int;
            //System.out.print(map[x][y] + " ");
            y=y+1;
        }
//System.out.println("");
x=x+1;
    y = 0;
}
    in.close();
}

public void update() {

}

public void render(GameContainer gc) {
    for(int x = 0; x < 50; x++) {
        for(int y = 0; y < 50; y ++) {
            int textureIndex = map[y][x];
            Image texture = tiles[textureIndex];
            texture.draw(x*tileWidth,y*tileHeight);
        }
    }
}

}

Edit - Solved

public boolean collision() {
    playerRect = new Rectangle(x,y, playerWidth, playerHeight);

    for(int i = 0; i < tiles.map.length; i++) {
        for(int j = 0; j < tiles.map.length; j++) {
            if(tiles.map[j][i] == 2 || tiles.map[j][i] == 3) {
                tileRect = new Rectangle(i*tiles.tileWidth, j*tiles.tileHeight, tiles.tileWidth,tiles.tileHeight);
                rect.add(tileRect);
            }
        }
    }
    for(Rectangle collision : rect) {
        if(collision.intersects(playerRect)) {
            return true;
        }
    }
    return false;
}

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:
Creating a highlight halo around a selected object I'm looking to create a halo highlight around the selected objects in my game screen.
The main platform is android, but I am writing an iOS version as well, updating it whenever I successfully add the next feature.

I am trying to ensure that the game is capable of working in both OpenGLES 1 and 2, but of course I expect v2 to have more effects eventually.

The effect I want to achieve is to have a halo around the edge of the selected object (I believe Diablo II did something similar). In theory my idea is to render the scene, enabling stencil ops when the selected object is rendered then enable stencil testing, disable depth and set an orthogonal projection and draw the halo colour 5 pixels larger in each of the X and Y dimensions from the object's centre with 0.2 alpha then successively draw again reducing the size and blending.

Using this method, I also need to figure out the most efficient way of determining the centre and extents of the objects.

EDIT:
Another technique I just thought of after posting is, after the stencil op render, render a coloured ortho rectangle to texture through the stencil then shrink and re-enlarge the image to blur the edges then render the resultant texture back on top of the scene, around the stencilled area

Are either of these a good/efficient way to achieve the effect? Is there a better/faster/more efficient/more common way of doing this?
Should I bother doing it for v1 and make it a v2 only effect?
Should I bother with v1 at all if I want these sorts of effects?

sentences:
Move gameObject in its facing direction I have the following four gameObjects, they have, respectively, the rotations: -90, 0, 90, 180. I want them to move as denoted in the image below

This is what I got so far:

public class Projecttile : MonoBehaviour
{
    public float speed;

    private void Update()
    {
        transform.Translate(transform.up * speed * Time.deltaTime);
    }
}

The result of my code is the following:

Why does my code result in this outcome, and how can I make each gameObject move in the direction it's facing?

sentences:
Unity - Get list of gameobjects close to object clicked? I have a stack of balls of 4 colors some touching some not. When you click on one color ball I want to destroy that ball and any other balls of that color that are close. They may not be touching so collision wont work.

How do I detect gameobjects close but not touching that are the same color? Say half a radius away from the edge of the ball clicked.

Here are the two scripts I'm working with to create and touch the game objects.

public class SpawnBalls : MonoBehaviour {
public Rigidbody ball;
public float waittime = 0.5f;

// Use this for initialization
void Start () {
    spawn ();
}

// Update is called once per frame
void Update () {
    //Instantiate (ball);

}
public void spawn(){
    //yield WaitForSeconds(waittime);

        for (var i = 0; i < 10; i++) {
            Instantiate (ball);
        }
}

}

Selecting the balls

public class Ball : MonoBehaviour {

public Color[] colors;
private Color ballpicked;

// Use this for initialization
void Start () {
    GetComponent<Renderer>().material.color = colors[Random.Range (0, 4)];
}

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

}
 void OnMouseDown(){
    if (Input.GetKey("mouse 0")){

        ballpicked = GetComponent<Renderer> ().material.color;

        //if (ballpicked == "Any other balls within a half a ball width") {

        //}

        Destroy (gameObject);
    }
}

sentences: 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:
Why does texture-sampling only work at (0,0,0)? I want to save the color of every point of one object in the RWTexture3D(UAV Resource) and transfer them to another object in its shader.

I made a test in the two shaders. Both in the fragment shader.

In first shader, I gave

RWTexture3D<float4> gUAVColor;
gUAVColor[uint3(0,0,0)] = float4(1.0f,0.0f,0.0f,1.0f);

In second shader:

Texture3D<float4> gVoxelList;
float4 output = gVoxelList.SampleLevel(SVOFilter, uint3(0,0,0),0);

The result is correct, I got red as the result.

But when I change the code, the texture cant be sampled correctly.

In first shader, I gave

RWTexture3D<float4> gUAVColor;
gUAVColor[uint3(1,0,0)] = float4(1.0f,0.0f,0.0f,1.0f);

In second shader:

Texture3D<float4> gVoxelList;
float4 output = gVoxelList.SampleLevel(SVOFilter, uint3(1,0,0),0);

I only changed the pos which save the red color from uint(0,0,0) to uint(1,0,0), but what I got changed to black, which means it's uncorrect.

If I use gVoxelList[uint(1,0,0)].xyz ,it works.

I have no idea where the mistake will be.

sentences:
What OpenCL video cards (or FPGAs) features are needed for high speed multiplication? I'm benchmarking some cryptographic related software and am looking for video cards that are better at parallel multiplication vs parallel addition.

Is there any prior work that would graph video card performance against math operations (calculating large digits like 256^2048, calculating the modulus etc.)
What GPU features should I look for?

sentences:
Can’t find component Unity so, I want to add a Cloth component.
I click on a gameobjects, press “Add Component” in the Inspector search “Cloth”
And nothing comes up.

From my searches in google, nobody had such a problem ever, nor is there any answers.

How can I fix it?
Or reload/reimport the physics components?

Unity version 2019

Thanks in advance!

sentences:
Unity Isometric Tilemaps Appear Jagged I had issues using the isometric tilemaps feature in Unity. Whenever I try to place tiles, they don't seem to line up and create this jagged effect. I've tried messing with the anchor points and am a complete beginner at this.
Edit: My grid component looks like this:

sentences:
Allow player to restart animation after it plays fully I have this code that plays an animation when the player touches the screen. The animation lasts 3 seconds.
public class canCDanim : MonoBehaviour
{
    public Animator anim;
    private void Start()
    {
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        Touch touch = Input.GetTouch(0);
        if (touch.phase == TouchPhase.Began)
        {
            anim.Play("CanReload");
        }
    }
}

The trouble is that if the player touches the screen again, the animation will not play again.
How can I make it so that I can restart the animation, but only after it's finished playing?

sentences:
How do I set the opacity of a Button to 0? (Unity) I'm trying to hide a button when you click that button (I meant setting the opacity to 0, not disabling the game object of the button). What the button does is it loads a scene async. If I disable the game object I won't be able to load the scene async. Any way to set the opacity of the button?
Sorry if the question is already asked as I wasn't able to find any questions related to this.

sentences:
Gizmos.DrawMesh does not render anything I would like to draw a procedural mesh as a gizmo:

Gizmos.DrawMesh(mesh);

however this does not render anything no matter what. I can confirm that the mesh in question is a correct one by both GetComponent<MeshFilter>().mesh = mesh assigning it to Renderer and rendering it using default material and Gizmo.DrawLine drawing it edge-by-edge.
No error are logged in debug window, setting position or flipping triangle orientation has no effect neither. Version of Unity is 5.6.2f1. Am I missing something?

void Start ()
{
   GetComponent<MeshFilter>().mesh = mesh; //renders without any problems
}

void OnDrawGizmos()
{
   Gizmos.color = Color.red;
   Gizmos.DrawMesh(mesh);//nothing rendered
   //renders without any problems
   for (int i = 0; i < mesh.triangles.Length / 3; i++)
   {
      Gizmos.DrawLine(mesh.vertices[mesh.triangles[i * 3 + 2]], mesh.vertices[mesh.triangles[i * 3]]);
      Gizmos.DrawLine(mesh.vertices[mesh.triangles[i * 3]], mesh.vertices[mesh.triangles[i * 3 + 1]]);
      Gizmos.DrawLine(mesh.vertices[mesh.triangles[i * 3 + 1]], mesh.vertices[mesh.triangles[i * 3 + 2]]);
   }
}

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:
Conundrum with quality and virus reports: is our game releasable? I've just got done talking to the CEO of our independent game studio about one of our projects nearing completion. We're considering canning the whole project for a number of reasons:

There are partly, some quality issues. Combat can be fun and in depth but for the most part you can get by with mashing buttons. It leaves the feeling that the advanced combat was really tagged on just to add something. When in reality a lot of work went into it.
The game didn't end up as envisioned. It's become really a mindless combat game when originally story was planned to be important. Now the story is rather nonexistent.
And probably the biggest issue. Rather recently we've been getting reports from testers that the game is being reported as a virus(in a few cases). We looked into this and found it's the way the engine was made. We're using a 3rd party engine and while originally the maker was very approachable, he's become rather unreachable and apathetic to our problems.

Me and him have talked a long time on this and we lean on it not being releasable. This would also though be a very big hit to the lead programmer who's put in a considerable amount of time on this, nearly a year.

What ramifications would happen if this is released? I'm told it could get on steam, and I'm thinking it could be pulled and really hurt our image. Also I mentioned we could be backlisted by our publisher if they consider the virus issue to be deceiving them. Could we be sued? Would you consider it releasable?

I think this is a very important decision every game studio might have to make one day and I'd really like as much input as I can get.

Thank you

[edit]
Also it might matter that we have another version of the game already being made for html5 which is being developed in house with our own custom engine. We're thinking of just focusing on this and learning from our mistakes.

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:
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:
what is the math behind the parenting a transform in unity? in unity when you parent an object or transform with another object, all transform(position, rotation, scale) are calculated depending on that parent object. sometimes we need to know about the local data of that transform and sometimes we need to know that data based on the world axis.
I need to know how that is implemented in math and vector functions.

sentences:
How do I rotate a structure of hexagonal tiles on a hexagonal grid? My 2D isometric game uses a hexagonal grid map. In reference to the image below, how do I rotate the light blue hexagon structures by 60 degrees around the pink hexagons?

EDIT:

Main hex is (0,0). Other hexes are children, count of them is fixed.  I'm going to define only one position (in this case its right) and calculate other directions if needed (left-bottom, right-botom, right-top, left-top and left). Other hexes are defined like: Package.Add(-1,0), Package.Add(-2,0) and so on.

switch(Direction)
{
case DirRightDown:
    if(Number.Y % 2 && Point.X % 2)
        Number.X += 1;
    Number.Y += Point.X + Point.Y / 2;

    Number.X += Point.X / 2 - Point.Y / 1.5;
    break;
}

In this code Number is the main hex and Point is the hex that I want to rotate, but it doesn't work:

sentences:
Why are my exported illustrator graphics blurry and messy in-game when scaling? Non-scaled image:

And this is 2x-scaled:

I use 300dpi and did tick anti-aliasing settings for export png-24 image for my game in illustrator. But it look still bizzard when scaling. Could you please tell me what's wrong here??

What is the best way to get better art in my case?

Thank you in advance!

sentences:
Export Blender 3D animation to be played by Android OpenGLES Below code snippet shows the way to export coordinate of bones:

def export_bone_matrix(armature, bone, label, file_handler):
  SystemMatrix = Matrix.Scale(-1, 4, Vector((0, 0, 1))) * Matrix.Rotation(radians(90), 4, 'X')

if (bone.parent):
    Export_babylon.write_matrix4(file_handler, label, (SystemMatrix * armature.matrix_world * bone.parent.matrix).inverted() * (SystemMatrix * armature.matrix_world * bone.matrix))
else:
    Export_babylon.write_matrix4(file_handler, label, SystemMatrix * armature.matrix_world * bone.matrix)

I have create a 3D character in Blender, and add keyframes in it by transforming
in some frames.  From the graph editor, you can easily tell the all displacement
of transformation - translate, rotate, scale are all measured with respect to the
original value in frame 0.

Is it possible to write OpenGL in Android to animate the same 3D animation in Blender?
I'd like to transform the 3D character - translate, rotate in each frame according to
the displacement value exported from Blender.

Below lists the python function to export translate, rotate displacement in each frame:

def get_bone_action_location(action, bonename, frame=1):
loc = Vector()
if action == None:
    return(loc)
data_path = 'pose.bones["%s"].location'%(bonename)
for fc in action.fcurves:
    if fc.data_path == data_path:
        loc[fc.array_index] = fc.evaluate(frame)
return(loc)

def get_bone_action_rotation(action, bonename, frame=1):
rot = Quaternion( (1, 0, 0, 0) )  #the default quat is not 0
if action == None:
    return(rot)
data_path = 'pose.bones["%s"].rotation_quaternion'%(bonename)
for fc in action.fcurves:
    if fc.data_path == data_path: # and frame > 0 and frame-1 <= len(fc.keyframe_points):
        rot[fc.array_index] = fc.evaluate(frame)
return(rot)

Or I need to transform the meshes with vertex group controlled by root bone by the
transform matrix - SystemMatrix * armature.matrix_world * bone.matrix?  And for those
controlled by child bones by the matrix in terms of (SystemMatrix * armature.matrix_world * bone.parent.matrix).inverted() * (SystemMatrix * armature.matrix_world * bone.matrix)?

sentences:
Unity 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:
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:
Why does Unity launch Visual Studio but opens files in Notepad? In Unity 5.2.0f3, when I double-click a C# script, it effectively launches Visual Studio Community 2015 but then opens the source code file in Notepad instead of inside the Visual Studio IDE.

How can I make sure that source code is opened inside Visual Studio (the one Unity started)

Investigation Notes:

It happens both from double-clicking an attached script the inspector or the script icon in the project/assets panel.
Although the specific file is not open, the "Class View" in the VS IDE loads that I'm in MyGame.CSharp and MyGame.CSharp.Editor, so some kind of interaction must happen.
It happened to me that initially Visual Studio claimed it was in "expired trial mode", then I created a MS account and bound it to the the VS. Don't know if this had any effect on that.
I can't tell if it was working previously, as I come from a Unity version
that used to use MonoDevelop.

sentences:
Check whether an object is fully inside/overlapped by other objects in Unity3D? I have structures made of voxels (cube gameobjects), and I want to make complex structures from them.

But I don't always want to place them on the grid. I want them to be more realistic, like diagonal:

(Don't mind those visual artifacts)

(If I would want to make a fortress like this on the grid, these diagonals would be ugly and zigzaggy.)

My problem is that due to this there would be double the voxels at the overlapping places. I want to remove every cube (for example from the selected wall object) which are being FULLY overlapped.

This way there won't be double voxels (only partially at the edges, which is fine) and it would look good as well.

How could I check this? I don't want to modify the structures manually because both the angle and the other object may vary, thus one structure would need lots of variations.

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:
Unity - separate shapes on a map into individual objects? Okay, I asked this question yesterday anonymously thus I couldn't edit it so I'm remaking it.

Short version:
I have a transparent map with black borders (Colored map) and I want those shapes formed by these borders to become individual objects in Unity. Is it even possible and if it is, how?

Long version:
I want to make a Grand Strategy type game with provinces and countries. However, I'm not really an experienced graphics nor Unity programmer.

I already have a map drawn with the desired black borders with each province being defined by these very borders and each has an unique color (sort of an identifier). Having just this seems plain and complicated to use so I'd like for each province to emit a color corresponding with a selected map type (diplomacy, terrain, domains, etc.). Obviously, this would be hard to do with just a single plain texture therefore I need to make objects and this is where my inexperience blocks me from continuing.

Is there anything I can do (in Unity and/or Photoshop) that could make the provinces be objects without manually isolating, importing and matching (as a puzzle) each single one?

I've already looked at countless questions and answers but still none fit my problem. I'm at my wits' end with this to the point where I'm actually thinking about scrapping the project.

sentences:
Transformation by right vector using TransformPoint return an identical position I think the following code should work. I'm trying to set the position of a GameObject where the pointer currently is, I mean, where the player is looking currently:

public void SetTransform (Transform callerTransform) {
   Debug.Log("original position: " + transform.position);
   Debug.Log("caller GameObject position: " + callerTransform.position);
   transform.position = callerTransform.TransformPoint(Vector3.right);
   Debug.Log("result position: " + transform.position);
}

Unfortunately it seems that TransformPoint is doing absolutely nothing as we can see on the logs. Vector3.right has been not change the position:

original position: (0.0, 1.2, 1.0)
caller GameObject position: (0.0, 1.0, 0.2)
result position: (0.0, 1.0, 0.2)

I also have tried the following code with the same result:

GetComponent<RectTransform>().position = callerTransform.TransformPoint(Vector3.right);

But it seems senseless for me (callerTransform is not a RectTransform, gameObject.transform is a canvas).

sentences:
How can I make that when the first animation end the next animation will start but from the same position? I have two animations.
The first animation I downloaded from the Mixamo site.  The game start when the player is on his back on the ground and then slowly stand up. When the animation end the player is standing : Look at the player legs :

Then it's starting playing the next animation idle animation : Look at the player legs now when the idle animation start :

There is no problems with the animations.  It's just when the first animation end the player legs move close to each other because the legs position in the start of the second animation is not the same position when the first animation end.
I need somehow to make if it's possible that the first animation legs will end at the position of the second animation start. Now the legs are moving to each other and it looks funny. If I was showing a gameplay you will see the legs moving to each other like the player is closing his legs.
This screenshot is of the Animator controller where the left New State is the first animation and the Grounded is a blend tree with the idle animation inside :

And this is a screenshot of the blend tree and the first top state is the idle animation :

The transition between the two animations looks bad/funny. The player is closing his legs. Instead I wish there was a way to make the first animation to end with the legs close like in the second animation start.

sentences:
How to deal with references to shared manager classes I am using C# with MonoGame, although this is relevant for any object-oriented programming language
Static classes should be reserved for stateless utility classes (for example System.Math) and they should generally be avoided along with singletons for manager-like classes. The reason for this is it prevents object-oriented strategies and may be under the false pretense that there is only one instance required at all times.
To solve these issues you could have instances like AudioManager, EffectManager, Time, etc. in a single global static object. But this does not solve another issue which is you do not control who has access to these instances. So instead pass in these instances from the top down through constructors to classes who need to access certain things.
In my game I have an entity component system. Character derives from Actor which derives from Component which is contained within an Entity. When a Character gets hit I want time to stop briefly (Time instance), the camera should shake (Camera instance), he should flash white (Effects instance), Damage text should be spawned (FloatingText instance) and a sound effect should be emitted (AudioManager instance).
This is just one example and child classes may need more things or pass in different parameters to these instances. Additionally, anyone higher up the hierarchy will need more instance references if they need to pass it down to someone who is lower down.
Q: "What is the problem in that?" A: "It is cumbersome and I am modifying an entire hierarchy when I want to change something one place"
If I realize a component needs a reference to another instance I need to modify the code throughout the entire hierarchy. A solution is to make the global static object itself a non-static instance and pass down the whole thing to all components (but I might only pass down a certain instance to other parts of the game).
"Maybe you just have a coupling problem? Character should not be the one to stop time, shake camera, etc."
Okay, who should then? I could use an OnHit event in Character and let AudioManager for example hook up to that for all characters and play a sound effect with different parameters depending on the type of Character. But now I need to make a switch statement on type inside AudioManager, not very object-oriented. Instead, I could have one request manager instance to all of these things that takes in a parameter list as well. But what is the difference between this and a shared object instance? Anyone with a reference to request manager can make any request it's just a bit more indirect.
Passing in a container to all shared instances in the constructor of e.g. Component seems like the best compromise. What do you think?

sentences:
How to make my player move forward? PlayerMovement.cs :
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody rb;
    public float forwardForce=2000f;

    void FixedUpdate()
    {
        rb.AddForce(0,0,forwardForce * Time.deltaTime);
        if(Input.GetKey("d")){
            rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }else if(Input.GetKey("a")){
            rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
        }

        if(!Input.touchSupported)
        {
            // Still support PC keys
            if(Input.GetKey(KeyCode.D))
            {
                rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
            }
            else if(Input.GetKey(KeyCode.A))
            {
                rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
            }
        }
        else
        {
            // For touch devices
            if(Input.touchCount == 1)
            {
                var touch = Input.GetTouch(0);
                var touchPos = touch.position;

                var isRight = touchPos.x >= Screen.width / 2f;

                if(isRight)
                {
                    rb.AddForce(30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
                }
                else
                {
                    rb.AddForce(-30 * Time.deltaTime,0,0, ForceMode.VelocityChange);
                }
            }
        }

//        if(Physics.Raycast(transform.position,Vector3.down,0.5f)==false){
            // rb.velocity = new Vector3(0, rb.velocity.y, 0);
//            rb.constraints = RigidbodyConstraints.FreezePositionZ;
//        }else{
//            rb.constraints = RigidbodyConstraints.None;
//        }

        if(rb.position.y < -1f){
            FindObjectOfType<GameManager>().EndGame();
        }
    }
}

I tried to debug am I able to click any button. Than, I noticed I got message in console. I think I am unable to add force to player.
PlayerCollision.cs :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

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();
        }else if(collisionInfo.collider.name == "END"){
            FindObjectOfType<GameManager>().CompleteLevel();
        }
    }
    void Restart(){
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

Ground:

Actually, now I think physics isn't working on Player.

The Player object is floating. it isn't falling down. Even, it has RigidBody it's not freeze while running the game.

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:
How can I scale a color component by Time.deltaTime and still fit it into a byte? I am confused about this issue, and I can't find why I get this and how to fix it properly from  the Google searches I've tried.

This is a short version of my code:

     byte redtarget = 70;
     byte greentarget = 222;
     byte bluetarget = 255;
     byte opacitytarget = 1;
     byte redcurrent = 0;
     byte greencurrent = 0;
     byte bluecurrent = 0;
     void OnMouseOver() {
        redcurrent = redcurrent + redtarget * Time.deltaTime;
        greencurrent = greencurrent + greentarget * Time.deltaTime;
        bluecurrent = bluecurrent + bluetarget * Time.deltaTime;
    if(redcurrent >= redtarget) {
        redcurrent = redtarget;
    }
    if(greencurrent >= greentarget) {
        greencurrent = greentarget;
    }
    if(bluecurrent >= bluetarget) {
        bluecurrent = bluetarget;
    }
    theobject.GetComponent<Renderer>().material.SetColor("_EmissionColor",new Color32(redcurrent,greencurrent,bluecurrent,opacitytarget)) ;
     }

Please ignore the other errors that could have been introduced when I copy + pasted it to here.

And this is the error I get:

As you see the error, "cannot implicit convert type float to byte", the problem is caused by Time.deltaTime that returns a float value, and I need a byte due to Color32.

Is there any way to turn Time.deltaTime to byte? Or should I use another type of color that use floating point numbers?

I'm a beginner with Unity so I'm sorry if this has already been asked somewhere; as I said, I can't find it on the Internet.

sentences:
How to post player´s score on Facebook (with js) I have my game made with Phaser (and compiled with cocoon.io) and on the leadersboard state I want to let the user to post his score on Facebook.

Well, I created an App on Facebook and I´m not finding a good solution to create this simple post, something like "I scored 10 points on this riduculous game..." Pretty easy on Twitter and not so easy on Facebook, I can find information about posting links and that stuff but I´m not finding a proper way to create a simple post just with text.

How do you guys do this? I guess I´m missing something, it shouldn´t be so complicated.

(I already tested this link and it´s not working for me Simple way to post score from my game to Facebook and Twitter? API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.)

sentences:
Player not detecting layermask I'm trying to implement a simple collision detection for my player but it is not detecting the layer mask as my Player comes into contact with it. I have a move point that moves slightly ahead of the player, and if it comes in contact with the StopMovement layermask then it should NOT move any further. Unfortunately, the layer is never detected and therefore the player just moves right through the object.
Script:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    public float moveSpeed = 5f;
    private float moveHorizontal;
    private float moveVertical;

    public Transform movePoint;

    public LayerMask whatStopsMovement;

    // Start is called before the first frame update
    void Start()
    {
        movePoint.parent = null;
    }

    // Update is called once per frame
    void Update()
    {
        moveHorizontal = Input.GetAxisRaw("Horizontal");
        moveVertical = Input.GetAxisRaw("Vertical");
    }

    private void FixedUpdate()
    {
        transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.fixedDeltaTime);

        // stops the movePoint from going too far
        if (Vector3.Distance(transform.position, movePoint.position) == 0f)
        {
            if (Mathf.Abs(moveHorizontal) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveHorizontal, 0f, 0f), 0.2f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(moveHorizontal, 0f);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }

            else if (Mathf.Abs(moveVertical) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveVertical, 0f, 0f), 0.4f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(0f, moveVertical);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }
        }
    }
}

Any help at all is appreciated.

sentences:
How to smoothly rotate a vector in a direction? I'm looking for an easy way to achieve the following:

Object A, B
{
    Vector2D position;
    Vector2D orientation;
}

update(elapsed)
{
    //rotate A's orientation in B's direction by x * elapsed degrees
    //until A's orientation equals the direction from A to B
}

I am trying to align object A with an object B.
Object A should rotate in B's direction by certain degrees/sec, e.g. max 45/sec.

I calculate the direction from A to B with normalize(B.position - A.position),
but I don't know how to rotate A's orientation vector stepwise in B's direction.

sentences:
Getting around limitations posed by float in space game I'm working on a procedurally generated game set in outer space. As in the real world, the game universe will be pretty much 99% empty, with planets/stars/solar systems etc... being very far apart.

For example at the beginning of the game, you will pretty much be stuck in the solar system you spawn in, as even flying from planet to planet will take a very long time. Flying from one solar system to another will be theoretically possible, however it would take days of IRL time without obtaining the in-game equivalent of a warp-drive.

I realize with all the thousands of planets/stars etc... they can't all be updated 60 times per second, and I can deal with that. Let me describe my problem.

Okay, so lets say 1 meter is 16 pixels.

Earth diameter      =  12,756,000 meters
Earth diameter      = 204,096,000 pixels
Earth circumference = 640,861,440 pixels

Okay, that's... still arguably manageable. Obviously there wouldn't be an earth.png, it could be procedurally rendered. But it gets worse:

Distance from earth to sun =   149,600,000,000 meters
Distance from earth to sun = 2,393,600,000,000 pixels

So if we define earth as our arbitrary origin, and we travel to the sun in our ship:

int main()
{
    //        Distance to sun:
    //        2393600000000
    float X = 2383695718491;
    std::cout << X << "\n";

    X += 6;
    std::cout << X << "\n";
}

This outputs:

2.3837e+012
2.3837e+012

That's the correct amount of zeroes, but now over 4 million pixels of precision is lost, and that's a big deal. And of course, the distance to the sun is tiny compared to the distance to the nearest star.

For the purpose of the game universe, I will decrease the distances just to make travel a little less boring, but this is still clearly impossible by only using x and y variables.

How should I handle these huge distances?

UPDATE: Just to clarify, I realize that earth is unimaginably huge and there's no way I'd be able to fill it with meaningful content. GTA V's map is about 100 square miles, and that's less than .00000005% percent of earth's surface. So my planets will definitely be significantly smaller than this, however the issue with huge distances remains.

sentences:
What makes movement feel smooth, and what are some standard methods to achieve this? I'm either not searching correctly or there is really not a lot of material on character movement in 3D games. I'm mostly interested in how people usually implement character movement in games like FPS and action games, where usually the WASD keys are used to move backward and forward and for strafing, with the mouse used for turning. I'd like to learn what methods are generally used, and what makes the movement handling feel right.

For example, I tried to implement movement handling using some 'walking' force to move my character, by integrating the equations of motion. Needless to say, this felt more like handling a spaceship, rather than a human. Others probably use just some velocity to steer the characters, maybe coupled with a deceleration when no buttons are pressed. I tried something similar in following code, but it still feels kinda clunky.

if(move_comps_[*entity]-&gtmv_direction != glm::ivec3(0))
{
    glm::vec3 mv_dir(0.0);
    mv_dir += (float)move_comps_[*entity]- &gt mv_direction.z
        * transform_comps_[*entity]-&gtforwardVec();
    mv_dir += (float)move_comps_[*entity]-&gtmv_direction.x
        * transform_comps_[*entity]-&gtrightVec();
    mv_dir = glm::normalize(mv_dir);

    glm::vec3& velocity = move_comps_[*entity]-&gtvelocity_;
    velocity += dt * move_comps_[*entity]-&gtacceleration_ * mv_dir;

    if(glm::dot(velocity, velocity) &gt sqr(move_comps_[*entity]-&gtmax_velocity_))
    {
        velocity = move_comps_[*entity]-&gtmax_velocity_ * mv_dir;
    }

    transform_comps_[*entity]-&gtpos_ += dt * velocity + 0.5f
        * move_comps_[*entity]-&gtacceleration_ * sqr(dt) * mv_dir;
}
else if(glm::length(move_comps_[*entity]-&gtvelocity_) &gt 0.0)
{
    glm::vec3& velocity = move_comps_[*entity]-&gtvelocity_;
    glm::vec3 mv_dir = glm::normalize(velocity);
    velocity -= dt * move_comps_[*entity]-&gtacceleration_ * mv_dir;

    if(glm::dot(velocity, velocity) &lt 0.01f)
    {
        velocity = glm::vec3(0.0);
    }
    else
    {
        transform_comps_[*entity]-&gtpos_ += dt * velocity + 0.5f
            * move_comps_[*entity]-&gtacceleration_ * sqr(dt) * mv_dir;
    }
}

Here in essence, I use an integer vector which can hold (-1, 0, 1) in each dimension. When a walk_forward_start event is fired, for example, this z component is increased by 1 and decreased when the player releases the button. This vector is used to find out in which direction to move the player. I also added a simple deceleration mechanism. As I said, this still doesn't feel right, and is certainly not really smooth. What could I do to improve it?

Others have gone as far as implementing advanced techniques such as inverse kinematics, too. I wouldn't go that far, but how far do you have to go to make a movement system feel good?

Essentially, beyond the sauce, I want to know what makes pushing forward, strafing, turning and stopping feel smooth and what are some standard methods to achieve this. Do you use some impulse/force based method? Do you use a linear velocity method?

Note: This may seem like a subjective question and it might be up to some point, but I think there must be some general consensus or else there would be a big variations on how these controls are handled by games.

sentences:
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 make one material on object with many parts inside? I have a weapon witch have many parts, it also have many materials. Do I really need to make it like that?
It's like about 8 mats! :(

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:
how to move object in a circle around point? There are two controllable objects orbiting around a centre block. Unfortunately, I don't really know how to stick them so they can only move around the block (left/a sends them clockwise, right/a sends them anti-clockwise) and can only get them to move like normal sprites not on a set path.

I haven't got any code to show yet, but I could really appreciate either some advice, or preferably some examples.

sentences:
How I randomise a list of audio clips in Unity and remove it from the list once the clip is finished? I have 4 audio clips. When I play a press a certain button in Unity, the data is sent to MAX/MSP and the audio is played. I created a list a signals (As shown below in the code). What I want is that, the signal list is randomised. The user presses a button to listen to the audio (which works fine). Once the clip is finished the user presses Next Trial button. Once the Next Trial is pressed. The previous clip is removed from the list. Once all the clips are finished. A message is displayed in the Debug.Log("All trials finished"). I have the following problems:

One of the audio clips is repeated again. It appears that the audio clips are not removed from the list.

How do I write the audioclip index to a csv file?

Code:
public class SignalToMax : MonoBehaviour { private static int localPort; private string IP; // define in init public int port = 8050; // define in init

 // "connection" things
 IPEndPoint remoteEndPoint;
 UdpClient client;
 // experiment case
 public string experimentCase = "A";
 string strMessage = "";
 public List<int> signals;
 public static int stimIndex;
}

void Start() {

NextTrial = GameObject.FindGameObjectWithTag("NextTrial").GetComponent();

     signals = new List<int> { 1, 2, 3, 4 };
     // define
     IP = "127.0.0.1";
     port = 8050;
     // ----------------------------
     // Senden
     // ----------------------------
     remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);
     client = new UdpClient();
     NextTrial.onClick.AddListener(Advance_Trial);
}

void Advance_Trial() {

     int signalIndex = Random.Range(0, signals.Count);
     int currentSignal = signals[signalIndex];
     stimIndex = currentSignal;
     signals.RemoveAt(signalIndex);
     string text = signalIndex.ToString();
     byte[] data5 = Encoding.ASCII.GetBytes(text);
     client.Send(data5, data5.Length, remoteEndPoint);
     Debug.Log("<color=magenta>Current source signal is:</color>" + currentSignal);

     if (signals.Count > 0)
     {
         Debug.Log("<color=blue>Signal count before removal was:</color>" + signals.Count);
         Debug.Log("<color=yellow>Source signal removed</color>");
     }
     else
     {
         Debug.Log("<color=green>All Trials finished</color>");
     }
 }

sentences:
How to communicate with LibGDX HTML5 app? I'd like to have a HTML form send data to a LibGDX game deployed as HTML5. Ideally as a form in HTML as part of the same page that contains the LibGDX div/canvas, and use the form to set up some data that I can pass into the game, probably using Javascript.

Is this or any other method of sending data to the LibGDX app (when deployed as HTML5) possible?

sentences:
Best way to distribute graphics, audio and levels with an SDL game? I'm working on finishing up a game written in C++ with SDL I've been working on for awhile, and I'm starting to ponder how I'm going to distribute it. It has hundreds of images that are loaded and used throughout the game, as well as a couple dozen .wav files for audio effects.

What is the best way to distribute these? Should I just include the folders with all the files? Or is there a way I can package them into a single file, then open and extract them in my application?

What's the best way to go about this?

sentences:
How can I make sure all army compositions are counterable in an RTS game? Most RTS games I played have some kind of rock-paper-scissors system that ensure that there is no single best unit you can mass and win with all the time.
However this breaks down when players start to combine different kinds of units. Just make one unit type then make the counter of its counters to protect it. Eventually players will find the best pairing that mutually protect each other, then everyone will copy that and all other combinations become inferior to that and won't see play.
We can see this in Empire Earth 1 for example, where up to middle ages all you need to do is just mass chariot/cavalry archers and swordsmen. Although spearmen and knights wreck the swords, they are destroyed by arrows. And archers are destroyed by swords, but your swords are blocked by enemy swords so you'll have hard time reach enemy archers... So all you can do is just try to make more swords and archers than the enemy.
You can also use area of effect siege weapons against archers, but they are expensive and totally wrecked by swords.
So all players use just swords and archers against everything - including buildings. This what I would like to avoid and I would like to make sure other units also see play.
So the question is: How can I make sure that not just individual unit types but but all possible combinations of them have a counter combination that costs less resources than the opponent's army?
Is there a mathematical framework for that?

sentences:
How to move a sprite on a slope in chipmunk Spacemanager Possible Duplicate:
  How to move the object(tanker ) on slope image in chipmunk Spacemanager

I have used one polygon shape image (terrain) in my game. It's just like a mountain, and now I want to move the tanker on a mountain path from one side to the other and then turn around at the edge of the screen and go back. I don't understand the method to move the tanker on the slope (image) path in chipmunk spacemanager.

When collision detection happens like that, if any bomb falls on the slope (image of mountain) then I want to do a little damage to the slope (image of mountain) like this video.

sentences:
How can I support multiple player inputs in Pygame? I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players using a single computer? Is it even possible? At the moment I'm working with a couple of old XBox controllers and a keyboard and it's almost working...

Is it possible to add additional keyboards? And would you arrange the code into one big get events function or is there a better way to check for user inputs at this scale?

sentences:
Libgdx Music error QCMediaPlayer mediaplayer NOT present Problem solved with music = Gdx.audio.newMusic(Gdx.files.internal("song.mp3"));

I am looking for music implementation in my app with LibGDX. I saw the guide provided in LibGDX documentation but it doesn't work for me and this is my code :

public class GameScreen implements Screen {

    Music music;
    public GameScreen(MyGdxGame game)   {

        music = Gdx.audio.newMusic(Gdx.files.local("assets/song.mp3"));
        music.play();

    }

When I run my code it returns me this error :

    at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:124)
            at GameScreen.<init>(GameScreen.java:62)
            at FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
05-22 20:49:06.213  15534-15534/  E/SysUtils﹕ ApplicationContext is null in ApplicationStatus
05-22 20:49:09.358  15534-15572/ E/MediaPlayer-JNI﹕ QCMediaPlayer mediaplayer NOT present
05-22 20:49:09.374  15534-15572/ E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 10072

com.badlogic.gdx.utils.GdxRuntimeException: Error loading audio file: assets/song.mp3
            at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:132)
            at .GameScreen.<init>(GameScreen.java:62)
            at .game.FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
     Caused by: java.io.IOException: setDataSource failed.
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1076)
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1022)
            at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:124)
            at .game.GameScreen.<init>(GameScreen.java:62)
            at .game.FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)

sentences:
How would I go about serializing my LibGDX game? I am currently using Kryo for serialization. I have a Player class, but it extends Sprite. Sprite isn't serializable. This means I can't serialize Player as a whole. Is there another way to do this? Or should I make a separate class for every object that needs to be saved, and manage all the data that needs to be saved in there?

This is my first game and I'm going for a top-down (like pokémon) RPG game. I also need to save locations of monsters and animals in certain maps etc. So I'm not sure if this would be the right way to go about it? I can't find that much about this topic for games and kryo in specific online, so hopefully someone can enlighten me a bit.

sentences:
Why is the movement space increasing? This is a follow-up question to my previous question. I got my key holding to move, using boolean variables and making another method with a javax.swing.Timer for delays(Thank you to KingDolphin), but strangely when I move my Icon it seems to increase how many pixels it moves each time by 1. It moves one pixel the first keyPressed, then two for the next, then three, etc. This may not seem like much, but when you are moving by 30+ pixels, it gets out of control. I really have no Idea how to fix it. I have tried changing some things, and I have "done my homework"(Googled and searched StackExchange sites including this one and StackOverflow), but have found nothing even related to it. Here's my layoutGame and move methods(The problem is in there), and thank you for helping me out:

    private void layoutGame() {
        JLabel title = new JLabel("Dodge The Enemies!");
        Font titleFont = new Font(Font.SERIF, Font.BOLD, 32);
        title.setFont(titleFont);
        title.setHorizontalAlignment(JLabel.CENTER);
        title.setBackground(Color.BLACK);
        title.setForeground(Color.WHITE);
        title.setOpaque(true);
        add(title, BorderLayout.NORTH);

        JLabel background = new JLabel();
        background.setIcon(backDrop);
        add(background, BorderLayout.CENTER);

        JLabel you = new JLabel();
        you.setBounds(x, y, 50, 50);
        you.setIcon(new ImageIcon(this.getClass().getClassLoader().getResource("happy.png")));
        background.add(you, JLabel.CENTER);

        JTextPane direction = new JTextPane();
        direction.setText("Direction");
        add(direction, BorderLayout.SOUTH);

        direction.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                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 = 100; //milliseconds
        ActionListener taskPerformer = new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                if (wPressed) {
                    y = y - 1;
                } else if(aPressed) {
                    x = x - 1;
                } else if(sPressed) {
                    y = y + 1;
                } else if(dPressed) {
                    x = x + 1;
                }
                icon.setBounds(x, y, 50, 50);
                icon.repaint();
            }
        };
        new Timer(delay, taskPerformer).start();
    }

sentences: Why do game studios need graphics programmers if they're using game engines? In the credits section of the games I play, there are names of graphics programmers. If they used a game engine, why do they need a graphics programmer? Isn't the game engine doing their job?

sentences:
How to convert .max files to .egg on linux I am very new to 3d graphics and game engines and panda3d and python. I followed few panda3d tutorials and now I want to test them with few new models. High majority of 3d models in the internet are in .max format.

Is there a way to convert these models to a format that can be used with panda3d. (.egg or .bam, I think). I am using linux. Thank you

sentences:
How to display a tile map from a 2D array in JavaScript? I have stored my map, but the problem I am having is displaying it. My map is 100x100 tiles which are 40x40px.

I have my loop running through the array but I'm having difficulty selecting the portion of the map image to relate to the tiles. This is the code which selects the portion of the image on each iteration:

var sx = Math.floor(tileId % 8 * tileWidth); //source x
var sy = Math.floor(tileId / 8 * tileHeight); //source y

I'm using Canvas and keep getting this error message:

INDEX_SIZE_ERR: DOM Exception 1: Index or size was negative, or greater than the allowed value.

I'm guessing the remainder or division by 8 is wrong, this is something I picked up from the net, but what exactly does that integer need to be?

Thanks

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:
Why is custom memory management needed for assets? Pretty much all resources relating to game programming, especially 3D open-world games, talk about how you have to constantly be unloading and reloading assets to and from disk, system memory, and video memory.  I can understand this on consoles, as they have very simple memory management schemes that cannot deal with any potential overflow.

However, on the PC, the situation is very different.  There is virtual memory provided by the OS for system memory and the graphics driver handles swapping back and forth from the CPU to the GPU.  So why is it that it's not sufficient to load everything at once and only have to deal with prefetching and possibly making sure that there is no blocking while a required asset is being swapped?

This is not to say that everything is being allocated naively using something like malloc.  Everything will be kept contiguous and cache-coherent.  It's arguably easier to make your memory access efficient if you don't have to worry about paging in and out manually anyways...

UPDATE:

After reading a bit into asynchronous buffer transfers, I get the idea that the way the graphics driver can automatically page memory in and out is suboptimal.  Does this also hold true for CPU resources; i.e., is it better to always manually manage when a given resource is to be loaded and unloaded even in the presence of virtual memory?

sentences:
My transparent objects overwrite opaque objects depth and always draw on top? I have set up an 'Order Independent Transparency' method for drawing my transparent objects.

The algorithm can be simplified as follows:

DrawOpaqueObjects()
DrawTransparentObjects()

Drawing the transparent objects uses the following render target setup:

        colourAccumulation = new RenderTarget2D(
            game.GraphicsDevice,
            game.GraphicsDevice.PresentationParameters.BackBufferWidth,
            game.GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,           // 16 bit floating point texture (required for alpha blending caculations)
            DepthFormat.None
            );

        depthComplexity = new RenderTarget2D(
            game.GraphicsDevice,
            game.GraphicsDevice.PresentationParameters.BackBufferWidth,
            game.GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,           // 16 bit floating point texture (required for alpha blending caculations)
            DepthFormat.None
            );

The transparent objects are combined with another render target texture that all the opaque objects are drawn to before hand:

        scene = new RenderTarget2D(
            graphicsDevice,
            graphicsDevice.PresentationParameters.BackBufferWidth,
            graphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Color,
            DepthFormat.Depth16,        // Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model)
            0,
            RenderTargetUsage.PreserveContents
            );

They are combined as follows:

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
PixelShaderOutput output;

// Background colour 'Cbg'
float4 BackgroundColour = tex2D(BackgroundSampler, input.TextureCoordinates.xy);

float4 SumColour = tex2D(Texture0Sampler, input.TextureCoordinates.xy);

// [Depth complexity]
// • Each time a pixel is written by the transparent object it adds 1 to the value [float4(1, 1, 1, 1)]
// • This is why a render target with 16-bits per channel is required (SurfaceFormat.Rgba64)
float n = tex2D(Texture1Sampler, input.TextureCoordinates.xy).r;

// If no transparent pixel has been drawn at this location, return the background colour
if (n == 0.0)
{
    output.Colour = BackgroundColour;

    return output;
}

SumColour = Upscale(SumColour);
n = Upscale(n);

// Average colour 'C'
float3 AvgColour = SumColour.rgb / SumColour.a;

// Average alpha based on depth complexity 'A'
float AvgAlpha = SumColour.a / n;

// T = (1 - A) ^ n
float T = pow(abs(1.0 - AvgAlpha), n);

// [Weighted Average Formula]
// • Cdst = (C * A * (1 - (1 - A)^n) / A) + Cbg * (1 - A)^n
// • Cdst = (C * A * (1 - T) / A) + Cbg * T
// • Cdst = C * (1 - T) + Cbg * T;
output.Colour.rgb = AvgColour * (1 - T);
output.Colour.rgb += BackgroundColour.rgb * T;
output.Colour.a = 1;

return output;
}

The problem is that all transparent objects are never obscured by the opaque objects drawn before hand as denoted by the yellow circle in the following picture:

The depth test has to be disabled for the transparent objects but it is enabled for the opaque.

Why is this incorrect effect occurring?

sentences:
license for old vehicle/track If I want to develop an android racing game set in the 1940-1950, with the real track of that period (that differs from the actual one), both closed and street circuit, and the real car of that period (F1 car), do I have to pay a license to use its name and aspect?

If so, how much it would be cost?

sentences:
Is it possible to use SFML with the Android NDK? I've started using SFML recently and I absolutely love it. I'd like to make games that could be ported to android, linux, mac and windows, but it seems that SFML lacks portability.

I've searched for a while and I've only found unrelated or unanswered questions on forums.

Does anyone know of any way to use SFML with the android NDK or any plans to support it in the future?

sentences:
How would I setup fog to follow a players coordinates? I'm wondering if its possible to setup a fog to a player's coordinates (where there is fog around the player to make it more third-person) the main reason I ask this is because I have my player more towards the top right corner of the screen

Here's some code that can give you a guide on what im doing:

glEnable(GL_FOG) GLfloat FogColor[] = {0.8,0.8,0.8,1.0};
glFogfv(GL_FOG_COLOR,FogColor);
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogf(GL_FOG_START,30);
glFogf(GL_FOG_END,);
glHint(GL_FOG_HINT,GL_NICEST);

and I want the fog to follow a player with a position as said in

posX,posY,posZ

If anyone can turn this into some example code that would be very helpful, thanks

If this is not possible then how would I setup the fog to be around a certain position of the camera, like show on the top right corner of the camera instead of the center?

Here's a picture of the game screen so you can see what im talking about:

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:
How to solve "server lag" problems that break the game How do real-time multiplayer games deal with latency problems (or “server lag”)?

Imagine an online fighting game where 2 players battle head-to-head in real time. When a player performs an action, there'll be a short delay until that player's action appears on the opponent's computer screen. This delay causes many game-breaking problems.

Let's say 2 hypothetical players, Player A and Player B, are fighting against each other right now in the game, and the latency is 1 second. Player A is moving toward Player B, but then Player B places a wall (or something of the like) that stops Player A from moving toward Player B. Player A doesn’t see the wall appear on his/her computer screen until 1 second later, but by then Player A has already moved past where the wall was placed.

In a more game-breaking situation, Player B is just about to kill Player A. Right before that happens, Player A uses a special attack that instantly kills Player B. But on Player B’s computer, Player B kills Player A, because it takes 1 second before Player A’s special attack happens on Player B’s computer. This makes it so both players die even though only Player B was supposed to die.

One solution to deal with the latency issue is to implement an artificial delay so that when there’s a discrepancy, one player’s game is momentarily paused to wait for the other player’s game state to “catch up.” This is not a good solution because it makes the game feel extremely laggy and unresponsive, and it also renders some reactive actions useless (like dodging) because of the artificial delay.

What can be done to fix these latency problems?

sentences:
Do I need to update my DirectX SDK in order to fix a crash with D3D10_CREATE_DEVICE_DEBUG? I am currently using the DirectX June 2010 SDK. Everything was working fine with my installation until recently. Unfortunately I'm not sure what changed or when, but now when I create a device with D3D10CreateDevice1(), it always crashes with a memory error if the device is created with the D3D10_CREATE_DEVICE_DEBUG flag. Even reverting to old code which used to work causes this error.
Additionally, PIX always crashes every time I use it with my game.
I did some searching and found a lead that I may need to update my SDK installation. This page also indicates that I need to "install the updated SDK Debug Layers".
How do I do this? I have no idea how to install the "Debug Layers"...
Additionally, is it a mistake for me to be using the June 2010 SDK? Apparently DirectX is now included with the Windows 8 SDK, which I haven't been using because I've no interest in Windows 8 development. Is this foolish? Is there any downside to me using the Windows 8 SDK just for Windows 7 DirectX development using Visual Studio 2010?

sentences: Why do games for Facebook have to be about 622 pixels high? I am wondering, why do games for Facebook have to be about 622 pixels high?

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:
Determining whether an object is in field of view considering obstacles I'm thinking of stealth games where an object has a certain field of view that you want to avoid otherwise game over.

The field of view may be linear or circular or any arbitrary group of pixels/tiles.

If I don't consider obstacles (for example, if you're standing behind a wall, they can still see you), I can determine whether the player is within an object's field of view using simple geometric properties using the two object's positions and range. This can be done efficiently, though it kind of assumes the objects are points.

However, to make it realistic, you should be able to hide behind a wall or a tree without being seen.

How is this problem usually solved?
What are some articles that I can read to understand more about this problem?

sentences: How to achieve graphics like those in Spy Mouse I'm really interested in making a new application for iPhone, and I have some experience in objective-c. My main problem is the visual part. I want to have graphics like in Spy Mouse. Could this be achieved using simple 2D graphics? Or would I need to use 3D, and just show it from this perspective?

sentences:
How do you extract a Vector3 positions only from a world matrix in an array of positions (from Kinect) 've just started building a physical camera class for the depth data you get from a Kinect. I have a Vector3 array of [imageWidth, imageHeight] describing the LOCAL positions I get in from the kinect (once I project them back at the FOV of the camera lens etc). I then translate, scale and rotate the whole virtual kinect camera in space.

What I'm looking to do is to extract back again the positions of the kinect camera input but in WORLD space, not LOCAL space (i.e. it's gone through the translation, scale and rotation and gives me a Vector3 for each value of the kinect in WORLD space).

Any 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:
Unity inspector not showing variables of custom component that inherits from a built-in class I made a class AdvancedButton that inherits from the built-in class Button:
public class AdvancedButton : Button
{
    public bool advancedTest = false;
}

The Unity inspector only shows the variables of Button, but not the variable advancedTest. Is this normal or am I missing something?

sentences:
Tank movement based on track speeds I want a system, where a tank moves and rotates based on the speeds I give him for the two tracks, for example, if I give the left track a speed of 1 and the right one a speed of -1, then I want the tank to stay still and rotate right, while if I give the left track 1 and the right track -0.5, I want it to rotate, but at the same time move forward

Of course the speeds will be between -1 and 1

sentences:
SFML Trying to shoot bullets but it moves with the gun I'm pretty new to SFML and C++ and I'm trying to figure out how to shoot bullets. I've done the shooting part and it's origin is from a moving shape controlled by the user called Player.

The problem is when I move, the origin moves as well which is why the bullets move with the origin. I feel like it's something really basic but I cannot for the life of me figure this out. Can anyone help?

This is the part of the code that creates and moves the shapes:

        //creates a new bullet when pressed
            else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) {
            rects.push_back(sf::RectangleShape(sf::Vector2f(40, 10)));

        }
    }

    // clear the window with black color
    window.clear(sf::Color::Black);

    sf::Vector2f pl = player.getPosition();

    //draw active shapes in the vector and move them to the right
    for (int x = 0; x < rects.size(); x++)
    {
        rects[x].setOrigin(-pl.x,-(pl.y + 10));
        window.draw(rects[x]);
        rects[x].move(10, 0);
    }

sentences:
For the handling of buildings on a tile-based strategy game, what aproach should I use? On a tile-based game of the strategy genre, which allows the player to place buildings over the terrain tiles, there are multiple approaches that can be taken for handling such situation.

The ones that I immediately think about regarding that are:

Create two layers. One for the base tiles (terrain), and
a second for buildings. And, for handling (operations before rendering), iterate them.
Create a single layer, with the tile class having both the
reference to the base (terrain) and the building reference (null if no
building at that tile). And for handling, iterate just one
tile-map, but each iteration will then have to have an
if(building!=null){...} added to it.

EDIT:

As further specification, the situation is that the game will be more focused on management and sandbox (tough combat will still be present), and every building will have many variables that are independent from the other buildings (even of the same type of building). NOTE: You can use the game "Caesar 3" as an example of what I'm going for.

For example, for "housing" buildings, they will have leveling, with a growth (level-up) based on the meeting of the required resources needed for the next level (from "materials", like wheat and wine, to access to specific "infrastructure", like public bathhouses or religious buildings), as well as the handling of such resources (current amount of "material X" stored, max amount of "material X" to be stored, consumption-ratio of "material X").

Another thing is, I don't need to literally render buildings on top of terrain (render both), and actually, I think it's probably a bad thing...So instead, I'm trying to do the handling in a way that will also not do unnecessary rendering. On the rendering loop, the building is rendered when its present, or the terrain otherwise. (This might be a worse approach instead of a better one, tough. Please tell me if so!)

EDIT 2: Please regard the part above as a note. This question is not as related to rendering as it is to handling! I'm beginning to think about removing it.

For my exemple aproaches, both would have a separated logical layer for buildings, as a single building can occupy more than a single tile (a building can be 2x2, 3x3 or 4x8 terrain-tiles, for example).

So, regarding terrain-to-building relation, approach-1 would would go:

  2 iterating loops...

  BUILDINGS-loop: "You are currently iterating me; I am above the
  following terrain-tiles: 1,2,3 and 4; My current resources are: [...]"

  TERRAIN-loop: "(My coords are under a building, render that building instead!)
  || (I'm not under any buildings! Render me!)"

While approach-2 would go:

  1 iterating loop...

  TERRAIN-loop: "If you are searching for the building that was built
  over me, (it's null, render me!) || (its not null, proceed to
  the building's door, over there!)"

  BUILDING: "Terrain x-y sent you to my door? (Sorry, i have already
  been iterated, skip me) || (Hmm, and it seems I have not been iterated
  yet! Alright then! My current resources are: [...]; Render me!)"

Note: The "render" parts are to be considered as just flags to be used by the rendering loop that comes after all handling is done, thus, not as the actual time the rendering happens.

END OF EDIT.

The questions are...

Which is best overall? (why?)
Is either best for a specific matter? (EX: "This uses more
processing, but is less memory-heavy, because...")
And, are there other (better?) approaches?

sentences:
Using CNN's in Unity via Tensorflow and TensorFlowSharp I have a project that tracks hands made in python, shown here: https://github.com/timctho/convolutional-pose-machines-tensorflow

I want to effectively import this into Unity. I have generates the .bytes file from the model, but have no idea how to do anything further than this. If anyone has worked with ML-Agents or TensorflowSharp in Unity and/or would be willing to have a look, this would be great. The image-processing stuff would be done probably in a C# file beforehand, I just want to know how to run the network.

Thanks.

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:
LibGDX Letter spacing is reduced if I use GlyphLayout to draw a bitmap font I need to use glyphlayout so that I can centre the text, but I found if I do the text gets distorted due to the spacing being incorrect.

public SimpleButton(String text, float x, float y, float w, float h, BitmapFont font) {
    pos = new Vector2(x, y);
    this.w = w;
    this.h = h;
    this.text = text;
    this.font = font;
    glyphLayout.setText(font, text);
    hitbox = new Rectangle(x, y - h, w, h);
}

public void render(SpriteBatch batch) {
    font.draw(batch, text, pos.x, pos.y);
}

Like this it displays fine:

But using glyphlayout to draw it the spacing for some reason is different:

public void render(SpriteBatch batch) {
    font.draw(batch, glyphLayout, pos.x, pos.y);
}

Glyphlayout seems to be changing the spacing here, but I couldn't see any options for setting the spacing with it.

These are the settings for the Bitmap font in Hiero. No special fx, padding and spacing set to zero:

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:
Transform components in ECS Many game engines I've seen which are based on an Entity Component System. It has some kind of a Transform Component as a necessary component attached to all of their entities. While this does seem to make kind of sense considering an entity is only some kind of property bag and a collection of components and transformations are world space behavior (hence just part of the composition). I've noticed two other things which are very weird:

Transform components are used to build up the hierarchy between entities as they have a parent entity as well as child entities
Transform components are specialized for only a single kind of world space, e.g. 2D or 3D.

Examples:

The Unity3D engine. Entity children and parents seem to be accessed through the Transform Component of each entity. Also, the Transform Component features coordinates in 3D vectors.
The Xenko Game Engine (previously Paradox3D), which can bee seen on GitHub.

So, is this a common practice? Best/worst practice? What's the reason behind having:

a fixed Transform component,
making the Transform component only suitable for one world space
using the Transform component as an hierarchy graph?

sentences:
JavaScript 2D liquid flow Brand new to games/graphics and I'm attempting to find a method to create a 2D liquid effect with JavaScript. Ideally I could adjust the viscosity and flow from a gas/fog effect to oil and between.

As an example, the effects in the PixelJunk Shooter trailer have stuck with me for years and I haven't ever seen another implementation with this style.

There is another question, as well, but no real implementation.

I also found a nice synopsis of ideas on gamedev so maybe that's the extent of my answer?

I'm currently using createjs but suspect I'd need another library so I'm not against using multiples.

I've looked at threejs and craftyjs but they don't seem to fit the criteria.
In order to keep with easeljs maybe I'll just check out a tutorial on how to create a particle system.

The heart of my question is really about a simple implementation rather than reading complicated mathematical presentations on the subject.  While interesting it's pretty far above my head.  Am I simply finding it's impossible to create a nice effect without some heavy lifting?

Thanks for any ideas on how this might be accomplished.

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 does SDL render the background from the operating system to the window? My code displays a fully transparent window that copies the background from the operating system.

This is the code I use for rendering:

void render()
{
    SDL_RenderClear(renderer);
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderDrawRect(renderer, &background);
    SDL_RenderPresent(renderer);
}

And this is the code I use to create my window:

window = SDL_CreateWindow("title", posX, posY, windowWidth, windowHeight, SDL_WINDOW_OPENGL);

sentences:
THREE.JS: why is the rotation only applied on the last axis used? my function:

    function rotateAroundWorldAxis2(object, radians1, radians2) {

        object.rotWorldMatrix.makeRotationX(radians1).makeRotationZ(radians2);
       // object.rotWorldMatrix;

        // old code for Three.JS pre r54:
        //  rotWorldMatrix.multiply(object.matrix);
        // new code for Three.JS r55+:
        object.rotWorldMatrix.multiply(object.matrix);                // pre-multiply

        object.matrix.copy( object.rotWorldMatrix );

        // old code for Three.js pre r49:
        // object.rotation.getRotationFromMatrix(object.matrix, object.scale);
        // old code for Three.js pre r59:
        // object.rotation.setEulerFromRotationMatrix(object.matrix);
        // code for r59+:
        object.rotation.setFromRotationMatrix(object.matrix);

    }

my object was initialized like this:
object.rotWorldMatrix = new THREE.Matrix4();

sentences:
Java - set resolution of game Hi everybody I am making small game using  pure Java 8 and rednering it by Java AWT Graphics2D method . My question  is how to make that user can change the quality of game. For example: 720p, 1080p, 1440p. Something similar that is when playing YouTube video.
The steps I will make?

Make 3 pictures of each, each with different quality.
Then load them.

Is this the right way?
But Java is default only 72dpi so each of them will be the same quality. So how to render it in different resolution?
Thanks in advance,
Maratonec
Edit:
I will be using LibGDX for rendering. So I will be using OpenGL.
But still don’t know how to make in LibGDX.
Edit:
So I now understand that using LibGDX mipmap I will make my scaling nicer. So I will have 1440p image and scale it up down? Or I will have to have each image for each resolution (720p, 1080p,1440p) and they will change to user selected resolution and only scaling to the window size?
The second method I have in mind how to do, but for second I need code example.
Thanks one more time for spending time with beginner!

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:
What are the cons of a 3 team FPS? In creating a video game concept, there are very little video games that offer a 3 team multiplayer FPS (think like Overwatch/Call of Duty but with 3 teams instead of 2). The only 'mainstream' games that offer this are RTS games.

What are the cons of implementing a 3 team multiplayer FPS game?

sentences:
Mesh disapears before out of fov I use a C# script to move the vertecies of my quad around the world space.
It works perfectly fine, but when I move/ rotate the camera away, so it does not look at the position of the quad, the quad disappears.

I cannot change the size of the quad, since that would not work with my other scritps.

How can I force the camera to allway render the mesh of the quad?

sentences:
How to send multiple MVP matrices to a vertex shader in OpenGL ES 2.0 I'm working my way through optimizing the rendering of sprites in a 2D game using OpenGL ES and I've hit the limit of my knowledge when it comes to GLSL and vertex shaders.

I have two large float buffers containing my vertex coordinates and texture coordinates (eventually this will be one buffer) for multiple sprites in order to perform a single glDrawArrays call.  This works but I've hit a snag when it comes to passing the transformation matrix into the vertex shader.

My shader code is:

uniform mat4 u_MVPMatrix;
attribute vec4 a_Position;
attribute vec2 a_TexCoordinate;
varying vec2 v_TexCoordinate;

void main()
{
    v_TexCoordinate = a_TexCoordinate;
    gl_Position = u_MVPMatrix * a_Position;
}

In Java (Android) I am using a FloatBuffer to store the vertex/texture data and this is provided to the shader like so:

mGlEs20.glVertexAttribPointer(mVertexHandle, Globals.GL_POSITION_VERTEX_COUNT, GLES20.GL_FLOAT, false, 0, mVertexCoordinates);
mGlEs20.glVertexAttribPointer(mTextureCoordinateHandle, Globals.GL_TEXTURE_VERTEX_COUNT, GLES20.GL_FLOAT, false, 0, mTextureCoordinates);

(The Globals.GL_POSITION_VERTEX_COUNT etc are just integers with the value of 2 right now)

And I'm passing the MVP (Model/View/Projection) matrix buffer like this:

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mModelCoordinates);

(mModelCoordinates is a FloatBuffer containing 16-float sequences representing the MVP matrix for each sprite)

This renders my scene but all the sprites share the same transformation, so it's obviously only picking the first 16 elements from the buffer which makes sense since I am passing in "1" as the second parameter.  The documentation for this method says:

  "This should be 1 if the targeted uniform variable is not an array of matrices, and 1 or more if it is an array of matrices."

So I tried modifying the shader with a fixed size array large enough to accomodate most of my scenarios:

uniform mat4 u_MVPMatrix[1000];

But this lead to an error in the shader:

  cannot convert from 'uniform array of 4X4 matrix of float' to 'Position 4-component vector of float'

This just seems wrong anyway as it's not clear to me how the shader would know when to transition to the next matrix anyway.

Anyone have an idea how I can get my shader to pick up a different MVP matrix (i.e. the NEXT 16 floats) from my MVP buffer for every 4 vertices it encounters?  (I am using GL_TRIANGLE_STRIP so each sprite has 4 vertices).

Thanks!

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:
Rotate an object smoothly by using Accelerometer Input in Unity There is a simple script where the object orientation is equal to the mobile devices orientation.

it works but the object doesn't rotate smoothly.

void FixedUpdate()
{
    float accelx = Input.acceleration.x;

    float angle = Mathf.Asin(accelx) * Mathf.Rad2Deg;

    transform.eulerAngles = new Vector3(angle , 0, 0);
}

How to rotate an object smoothly by using Accelerometer Input ?

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:
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:
Player motion and combo systems Where do you usually implement player motion when going through the state machine of a combo system?

An example, when player presses X+Y it must do an uppercut like movement (Like street fighter) where the player jumps and hits. Another example could be the Devil may cry series where you can press down+sword button and the enemy is thrown up and the player authomatically jumps to let player hit target in the air.

When creating a combo, you have 2 things to take care of. One is the media that will be played when the combo is done (sound, animation, etc...) and the other the movement of the player when doing this combo.

How do you handle the movement of the player? I have 2 posible options:

1) Include the player motion (translation, rotatio, etc...) in the animation

2) Delegate the player motion to the combo nodes while they are being linked.

First option could be the easiest but seems a bit restrictive. For example if you want to let the player do some other action while the current combo node media is playing (ej. jumping) could be tricky (Jump + hit).

Second option would need to have some many diffeernt nodes (We could use some kind of delegates here to minimize the node count(IOC)) to cover all the motion needs of every part of the combo.

What do you think. Am I thinking too much?

Cheers.

sentences:
Clothing and physics asset collisions not working I"m making a character in Blender where there's a character mesh and a simple skirt.
The skirt has a different material slot, which allows me to use the Unreal Clothing tool. I created the clothing data, applied it, painted it so the top part isn't moving at all and bottom has 100 "dynamics".
I also created a physics asset, however no matter what settings I try, the skirt will always poke through the thighs like they don't exist. All the colliders are capsules. I also get the feeling that the hip collider actually works. But only that one!
The skirt works perfectly with the wind, which makes it even weirder.
Does anyone know what can cause this?

sentences:
How do I debug two android devices simultaneously in Eclipse? I have a multiplayer game which should be tested on two devices at the same time, if possible, with debugging.

Can eclipse do this?  If so, how?

sentences:
How to better refactor loops in procedural world generation? One of the steps for cell-based dungeon generation is deciding the amount and location of exits for each room. My current set up consists of the following:

Define my exits. There are 15 types of room exits:

Left (L), Right (R), Top (T), Bottom (B).
Every non-redundant combinatoric of two directions (LT, TR, RB, BL, LR, TB)
The same for three directions (LTR, TRB, RBL, BLT)
All directions (LRTB)

Create a list exitsList that contains the type of exit of that index, i.e. exitsList[0] = L means that our first room has a single exit: one to the left.

After creating my basic level layout and having my exit generation ready, it's time to go back to each room and assign its exits, and this is the part I'm having my doubts about.

Currently, my method for assigning rooms is to make a case check looping through each cell. Something such as:

for (each room){
    switch (exitsList[this_room]) {
        case L:
            place_exit_L;
            break;
        case LT:
            place_exit_L;
            place_exit_T;
            break;
        case TR:
        .
        .
        .
        case LTRB:
            place_exit_L;
            place_exit_T;
            place_exit_R;
            place_exit_B;
            break;
        default:
            return_error;
            break;
    }
}

While this can work, it seems very inelegant, and more importantly obnoxious to read by a human. I was able to refactor cases that shared the same type of exit by omitting breaks, for example:

case LTR:
    place_exit_R;
case LT
    place_exit_T;
case L
    place_exit_L;
    break;

But this seems rather arbitrary. I suspect there's a more efficient way to do this, or at least one that won't become a pain to read by other people if the number of exits somehow increases.

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:
Entity System with C++ templates I've been getting interested in the Entity/Component style of game programming, and I've come up with a design in C++ which I'd like a critique of.

I decided to go with a fairly pure Entity system, where entities are simply an ID number. Components are stored in a series of vectors - one for each Component type.

However, I didn't want to have to add boilerplate code for every new Component type I added to the game. Nor did I want to use macros to do this, which frankly scare me. So I've come up with a system based on templates and type hinting. But there are some potential issues I'd like to check before I spend ages writing this (I'm a slow coder!)

All Components derive from a Component base class. This base class has a protected constructor, that takes a string parameter. When you write a new derived Component class, you must initialise the base with the name of your new class in a string. When you first instantiate a new DerivedComponent, it adds the string to a static hashmap inside Component mapped to a unique integer id. When you subsequently instantiate more Components of the same type, no action is taken. The result (I think) should be a static hashmap with the name of each class derived from Component that you instantiate at least once, mapped to a unique id, which can by obtained with the static method Component::getTypeId ("DerivedComponent"). Phew.

The next important part is TypedComponentList<typename PropertyType>. This is basically just a wrapper to an std::vector<typename PropertyType> with some useful methods. It also contains a hashmap of entity ID numbers to slots in the array so we can find Components by their entity owner. Crucially TypedComponentList<> is derived from the non-template class ComponentList.

This allows me to maintain a list of pointers to ComponentList in my main ComponentManager, which actually point to TypedComponentLists with different template parameters (sneaky).

The Component manager has template functions such as:

template <typename ComponentType>
void addProperty (ComponentType& component, int componentTypeId, int entityId)

and:

template <typename ComponentType>
TypedComponentList<ComponentType>* getComponentList (int componentTypeId)

which deal with casting from ComponentList to the correct TypedComponentList for you.

So to get a list of a particular type of Component you call:

TypedComponentList<MyComponent>* list =  componentManager.getComponentList<MyComponent> (Component::getTypeId("MyComponent"));

Which I'll admit looks pretty ugly.

Bad points of the design:

If a user of the code writes a new Component class but supplies the wrong string to the base constructor, the whole system will fail.
Each time a new Component is instantiated, we must check a hashed string to see if that component type has bee instantiated before.
Will probably generate a lot of assembly because of the extensive use of templates. I don't know how well the compiler will be able to minimise this.
You could consider the whole system a bit complex - perhaps premature optimisation? But I want to use this code again and again, so I want it to be performant.

Good points of the design:

Components are stored in typed vectors but they can also be found by using their entity owner id as a hash. This means we can iterate them fast, and minimise cache misses, but also skip straight to the component we need if necessary.
We can freely add Components of different types to the system without having to add and manage new Component vectors by hand.

What do you think? Do the good points outweigh the bad?

sentences:
How does a collision engine work? How exactly does a collision engine work?

This is an extremely broad question. What code keeps things bouncing against each other, what code makes the player walk into a wall instead of walk through the wall? How does the code constantly refresh the players position and objects position to keep gravity and collision working as it should?

If you don't know what a collision engine is, basically it's generally used in platform games to make the player acutally hit walls and the like. There's the 2D type and the 3D type, but they all accomplish the same thing: collision.

So, what keeps a collision engine ticking?

sentences: picking 3D objects rendered using instancing i have a peice of code that renders a 3D image, say a cube. I require 3 cubes in in different locations, this is done using instancing and i am able to render the cube in 3 different locations. However, i now need to pick any of the 3 cubes. I am pretty new to DirectX(11) and searches online did not yeild any answers. So how i pick an object when i only have a single set of vertices(triangle) used for the render?

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:
LibGDX - how to close game and dispose objects properly can someone tell me how to close game and dispose objects properly? I tried several methods but always have problems. I have ImageButton with ClickListener.

Here's code of listener:

exitListener = new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                getGame().dispose(); // reference to GameClass
                Gdx.app.exit();
                super.clicked(event, x, y);
            }
        };

but something causes problems because I have error:

  buffer not allocated with newUnsafeByteBuffer or already disposed

and logs show that stage.dispose() causes problems.

sentences:
How to create OpenGL models like the ones created by blender's wireframe modifier? How could I create programatically wireframe models like this out of a triangular mesh? What'd be the algorithm behind?

(Source)

Creating an additional mesh using lines instead triangles or just using a single mesh with the typical geometry shader using barycentric coordinates are the most straightforward approaches. But they're far away from being as cool as the results shown in the above link.

So I was wondering how difficult would be creating a new mesh like the shown in the above link, would it be possible to achieve by just having a simple triangle soup?

sentences: Copying rotation between matrices I have a transformed Matrix A and an another transformed Matrix B. How can I COPY the rotation of Matrix B to Matrix A?

sentences:
I've completed my mobile game - now what? After months of development, I've finally finished my mobile app, but I have no idea what to do next. I want to publish my app to the Google Play Store and the App Store, yet I don't know how. I've done tons of research and every single website shows different methods and requirements. I've seen that I'm supposed to have some kind of license, a specific certificate, and all these other connections that I'm really confused on how I'm supposed to get them, and where to even start. I've gotten as far as getting Apple Developer and Google Developer, but that's basically it. I just want a simple step-to-step guide. I've already looked on StackExchange for an answer, but all have slightly different questions, such as marketing the app and updating the app, but nothing on how to get it out there.

I'm using Unity as an engine and X-Code via my Mac to test my app on my iPhone.

I appreciate any help in advance. Thank you!

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: Possible to yield a coroutine when it is taking too long to run? Suppose I have a function that raycasts from (0,0,0) to every object in the scene.  Sometimes the scene contains just a couple objects and sometimes it contains several hundred.  Is it possible to setup the raycasting function in a way that  ensures a good framerate? For example, within the "for" loop that shoots the rays could I somehow evaluate how much time has passed since the loop started and "yield return null" if the time in seconds is greater than the target time of each frame?

sentences: Blurring point light variance shadow map I've been working on implementing variance shadow mapping for my game.  I was able to get a spot light working with variance shadow mapping with a gaussian blur applied to the shadow map to reduce the aliasing.  Now I'm trying to implement point lights but I'm not sure how to adapt the gaussian blur to work with the the shadow map when its stored in a cube map.  I've searched around for a while but I can't seem to find any examples that use point lights.  Can anyone help me out here?

sentences:
Can I use remade sprites in my game? Possible Duplicate:
  How closely can a game resemble another game without legal problems

Can I use remade sprites in my game?

I am making a game and I used some sprites, but I didn't copy them. I remade them completely the character looks nothing like the original. I only did this to get the movement of the character right (moving, running, jumping, punching). I've been working on the game for a long time, so I really need to know is it safe and legal to do this. I do intend making a small profit.

sentences:
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:
Is it feasible to playback 4K video in Unity? I'm starting work on a 360 VR video player, aimed at mobile devices (iOS/Android Cardboard + GearVR) and I'm evaluating whether it is possible to get video quality from 1080p to 4k in Unity or if I should instead just do the project natively (aka, OpenGL).

I've been trying to find information on the state of video in Unity but I haven't arrived to a clear answer. I'm going to explain the info I'm running on as of now, hopping that someone can add to this or provide an answer or at least show that I am erring on the side of ignorance :)

Assume a video in mp4, H264 at 4K resolution (equirectangular mapping):

OpenGL Approach:

If I were to do this in OpenGL, a (somewhat simplified) workflow would entail decoding each video frame, updating a GL_TEXTURE_2D with the pixel contents, and rendering to a sphere with glCullFace(GL_FRONT) as if it where a regular skybox.

With the above setup, the limiting factors would be:

Does the GPU in my device support 4K textures?  what marketing calls 4k is usually 3840 horizontal, and, an iPhone6 for instance, returns 4096 for glGetIntegerv(GL_MAX_TEXTURE_SIZE,...). So I'd assume the iPhone6 can load textures as big as required for 4K.
Fill rate: i.e.: my iPhone6's GPU might be capable of storing 4K Textures, but it might not be fast enough to fill up a 4K frame buffer at an acceptable frame rate. This unfortunately I think the only way to know is by testing. There is also the added overhead of the Cardboard rendering which means 2 passes per frame.

Unity Approach:

Now for a Unity approach, this is what I did:

Empty scene with a sphere and cardboard camera at the origin.
For the sphere, I created a material based on the Unlit shader with one texture and set the cull face to front.
imported the video and assigned it as the material's texture.

My observations from the above test are:

When importing images, Unity also allows texture sizes of 4096 so 4K should be possible.
Importing a video however, takes a ridiculous amount of time. I believe this is because Unity actually uses Ogg Theora and so it takes forever to transcode to Ogg. As a matter of fact, sometimes I was able to import and sometimes Unity would just stall.
When importing a video, I was not given any mmap, filtering or size options as if I was importing an image. So I'm not really sure what Unity is doing to the video. All I get is a quality / compression slider. The end video is still 3840x1920, which was the original resolution.
The rest of the experiment works ok, as in, yes, the video playbacks in the sphere. But the framerate is not great.

So at this point my conclusions are:

Is it possible to do 4K in Unity? Kind of, In the sense that you can import 4K videos and reproduce them without any external assets.
Is it really 4K quality? Probably not. mp4 is lossy and so is ogg, So I assume my video went a second round of lossy compression when it was transcoded to Ogg.
Is it practical? Not sure. So far, video importing takes an impractical amount of time. Also, 4K in general might be too much for a mobile device rending in stereo, regardless of Unity or doing it straight in OpenGL.

sentences:
How do I make my camera follow a Box2D object? I'm implementing a camera in my game. It worked for regular objects, but I began using Box2D and obviously things changed a bit. I have a Body object that I want to draw at the center of the screen. Basically what I'm doing is subtracting the viewportX and viewportY from the Body's position.

The relevant code:

public void paint(Graphics2D g, int viewportX, int viewportY) {
    Transform xf = new Transform();

    // m_body is the Body object
    xf.set(m_body.getTransform());

    // Here I attempt to take the transform and alter it by the viewportX and
    // Y, which are something like (-240, -150). It's negative because an
    // object at (500, 300) would be displayed at (160, 150) after the
    // subtraction. DrawUtils.toScale(), is just how I convert units from
    // JBox2D units to my units.
    Vec2 v = Transform.mulTrans(xf, new Vec2(DrawUtils.toScale(-viewportX),
        DrawUtils.toScale(-viewportY)));

    // Set the new transform to the new vector. Keep the old angle.
    xf.set(v, xf.q.getAngle());
    g.setColor(Color.white);

    // I know the following method works correctly. It displays my object,
    // just doesn't follow it.
    for (Fixture f = m_body.getFixtureList(); f != null; f = f.getNext())
        DrawUtils.drawShape(f, xf);
}

I don't want to alter the actual physics position of the object, just its graphical position such that it's displayed it in the center.

sentences:
Behaviour Trees: How to clean up when a sequence is interrupted? I'll try to show my problem on a minimal example, in reality it's more complex:

It's a simple behaviour, that repeats "an action" that has a certain animation. If a player gets close, this sequence gets interrupted and the AI executes the "Flee" action.
The interruption happens because the top level selector is "dynamic" which in Unity/NodeCanvas means, that its higher priority nodes get executed every frame and if they succeed they interrupt the lower priority ones.
My problem is shown via the red arrow - if the "action" gets interrupted, the clean up (in this case "stop animation") doesn't execute.
What is the best practice to handle the clean up? Is my setup flawed? Or should I just be using a different interrupting mechanism?
Thanks for any help!

sentences:
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:
How to design a multi-step game menu system? I am getting started with game programming. I am designing a game that starts by taking you through a series of menu screens. I am interested in learning how this is typically structured in professional game development.

Currently I handle the controller inputs from the main file and have individual classes for each menu screen. When the user makes a selection, I need to transition to the next menu screen. It seems like I either need some sort of "menu screen manager" for keeping track of the previous selection and transitioning between menu screens, and/or I need to pass the controller input handling down to the menu objects, since I want to use up/down on one menu and left/right on the other menu.

How would a professional game programmer architect/design this?

require "components/first_menu"
require "components/second_menu"

first_menu = FirstMenu.new
second_menu = SecondMenu.new
menu = first_menu
menu.render

on(controller: "up")   { menu.prev_option }
on(controller: "left") { menu.prev_option }

on(controller: "down")  { menu.next_option }
on(controller: "right") { menu.next_option }

on(controller: "buttonA") do
  if menu.is_a? FirstMenu
    menu.hide
    selected_option = menu.select_option
    menu = second_menu
    menu.show(selected_option)
  else
    selected_option = menu.select_option
    launch_game(selected_option)
  end
end

sentences:
How can I implement smooth rotation from one direction to another? I'm having a problem with animating rotations with 1Matrix.CreateRotationY() with my basic 3D game. Based on where you click the mouse, I want the 3D object to rotate to that direction and then move.

I am using this to determine the target direction:

float rot = (float)(Math.Atan2(X, Z));

It gives me the correct value, but I am not sure how to handle the rotation animation from current direction to new direction. I've tried a few things, but to no avail.

Do you guys know of any good ways of solving this issue?

sentences:
Is replacing a struct field in a class generating garbage using C#? I am somewhat aware of the differences between classes and structs, when each is allocated on the heap vs the stack, what happens when calling methods etc.

As far as I know, the memory for a struct field in a class is located on the heap, since it is part of the class. What happens when the struct is replaced with a new instance though? Is the content in the area on the heap that the old instance pointed to simply replaced with the content of the new instance? Or is the memory of the old instance targetted for garbage collection and the new instance getting some fresh memory?

struct Vector2 { ... }
class Player
{
     public Vector2 Position;
     ...
}

void Main // Whatever
{
    var player = new Player();
    player.Position = new Vector2(); // <--- Will this cause garbage collection?
}

sentences: Thread.SetProcessorAffinity() equivalent for Windows? I want to be able to use multiple cores in my XNA game, but it seems that Thread.SetProcessorAffinity() is only usable on xbox. That being said, is there any way to run a small chunk of my code on another core, or failing that, share the load between all cores?

sentences:
Unet Syncing within AR Hololens I am out of options. I have tried everything I could and no matter what I do, the Transforms don't sync up. I have had multiple solutions that worked in my test, non AR project, but once I put on the HoloLens, it doesn't work.
Here is what I did:

//PlayerObject that is spawned by the NetworkManager
//(obviously has Network Identity component)
public class ClientObject : NetworkBehaviour {
    public static ClientObject CurrentClient;

    private void Start() {
        if(isLocalClient) CurrentClient = this;
    }

    public void MoveObject(GameObject obj, Vector3 position) {
        Cmd_MoveObject(obj, position);
    }

    [Command]
    public void Cmd_MoveObject(GameObject obj, Vector3 position) {
        obj.transform.localPosition = position;
    }
}

And now the object that wants to get synced. It has a Network Transform with standard settings, a network identity and (obviously) no-one has authority since it doesn't get spawned:

public class AnObject : MonoBehaviour {
    public void IWasMoved() {
        /*
         * Someone Moved this object, either by dragging it or
         * clicking on one of it's arrows through the hololons.
         */

        Vector3 newPosition = (the new position i want this object to have);
        ClientObject.CurrentClient.MoveObject(gameObject, newPosition);
    }
}

That's what I have. The only thing different from the version that works on my PC without the HoloLens is that I don't set localPosition = position, but instead use Translate(position) (which is obviously the non local version);

I am tired of writing new code, building the project, having Visual Studio translate the code to C++, start my HoloLenses and test if it works, which takes over an hour every time I do so.

So: is there anything fundamentally wrong with my code? Again: it works on my test project just fine. I refuse to believe that it's the HoloLens's fault...

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:
Element's texture is null - Monogame/XNA, C# I have a ArgumentNullException everytime I try to call the Draw() method of my Projectile class in the Game1.Draw() method.

In Game1.cs Initialize() method:

//PROJECTILES INITIALIZATION
        lesProjectiles = new List<Projectile>(20);
        for (int i = 0; i < lesProjectiles.Capacity; i++)
        {
            lesProjectiles.Add(new Projectile(projectileSprite,
                new Vector2(playerPosition.X - 15.5f, playerPosition.Y - 20)));
        }

This is the Projectile class constructor:

public Projectile(Texture2D texture, Vector2 startPos)
    {
            this.projectileSprite = texture;
            this.projectilePosition = startPos;
    }

The -15.5f and -20 values are for placing the projectile at the middle of my spaceship. (Not optimized logic ikr.)

Apart from my whole game logic, let's say I wanna draw the first element of my array. I'm doing that:

In Game1.cs Draw(GameTime gameTime) method:

        spriteBatch.Begin();
        lesProjectiles[0].Draw(gameTime, spriteBatch);
        spriteBatch.End();

And there is the Draw() method from my Projectile class :

public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(this.projectileSprite, this.projectilePosition,
            Color.White);
    }

The returned error:
System.ArgumentNullException: Value cannot be null. Parameter name: texture

I don't understand why the projectileSprite values of my array elements are null, considering it's done in the initialization method whenever the constructor is called.

Thanks for further help, sorry if my explanations are bad

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: Is there any quick and easy way to make all bodies visible with Farseer physics engine for XNA? I just want to be able to see all my bodies on the screen for debugging purposes and i cant think of an easy way, for example i have make some edge fixtures with curved arcs attached and i just want to see what they look like!

sentences:
How can I find all connected objects of the same type recursively? In my game, when a user selects an object of some type, I'd like to search for all other objects of the same type that are connected to that first one.

For example, if the user selects a object of type 2, I want to check the object next to that one to see if it is also of type 2 and so on in all directions (up, down, left and right, et cetera) until there are no more objects of that type connected.

Does anyone know how I could do something like this? You can assume I have access to the set of connections from any given object.

sentences:
Pathfinding onComplete event? In HaxeFlixel 4 all FlxObjects have a path property which must be a FlxPath instance

class FlxObject extends FlxBasic
{
    ...
    /**
     * The path this object follows.
     */
    public var path(default, set):FlxPath;
    ...

a tilemap can be used to find a path

var points:Array<FlxPoint> = tileMap.findPath(pathStart, pathEnd);

and then an object can walk that path

object.path = new FlxPath();
object.path.start(points);

What I want to do is run some custom code when the path ends, whether it was cancelled or was fully completed

what I see others do is this (player being the object in question)

override public function update(elapsed:Float):Void
{
    if(Std.is(player.path, FlxPath)){
        if (player.path.finished || player.path.nodes==null) {
            trace('finished walking');
        }
    }

But this tends to run indefinitely once the player has finished walking, yet I want it to run once. Secondly I don't even want the PlayState update function to be aware that there was an event where the player finished walking, it's none of it's business unless I tell it that it happened, I want this code block to be self-contained.

I discovered that FlxPath has an onEnd function, which is exactly what I need, but it does not call any callback, neither are there any ways that I know of to attach it, there is also the onComplete property, but I was not able to make use of it.

so here is what I'd ideally like

object.path = new FlxPath();
object.path.start(points, function(cancelled){
    trace((cancelled) ? 'path cancelled': 'path completed');
});

and this would run only once upon the path ending or getting cancelled

any ideas on some way of achieving this?

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:
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:
surface.Bake(); no such command Regarding the code shown in this video at 13:50:
When I try: surface = GetComponent (); surface.Bake();
I am getting the following error message:

UnityEngine.AI.NavMeshSurface does not contain a definition for bake
and no extension method Bake of type UnityEngine.AI.NavMeshSurface
could not be found "are you missing an assembly reference

I am struggling to get the dynamic navmesh working with Unity 2017.1.

sentences:
Should I create generic bitmap/sound/et cetera wrappers for Allegro? Basically, I have been writing a game in C++ using Allegro.
I mostly just use the library to draw bitmaps, draw text, and play audio.

My main concern as the game continues to grow code-wise, is that with all the places I use al_draw_bitmap, al_play_sample, etc it becomes harder and harder to ever switch libraries if I so desire.
Aka all the places in code I would have to change the function calls and data types (ALLEGRO_BITMAP, ALLEGRO_SAMPLE, ALLEGRO_COLOR, etc).

I was wondering if it is a good idea to make a class (or classes) with generic mappings so that my code calls my own DrawImage(), PlaySound(), etc and then maybe typecast the data types (ALLEGRO_BITMAP, etc)?

This way its much less to change in the long run. I understand there would still be work involved and obviously I could only switch to another C++ library.

I'm not sure if there is a reason why this would be a bad idea, or if its actually a good idea, whats the best way to go about it.

sentences:
Game build crashes on scene load I built out my project to Android to do some testing and stuff, but I can't get any further than the main menu scene. I built it out previously and it was running fine. Now as I try loading level0 it crashes with no error messages from adb logcat. Just exits the game and that's it. It works fine in the editor.

I tried several things. I changed the color space back and forth, I built my addressables, tried development built and non development one, and the Split application binary checkbox is false as well...

Unity 2019.2

My adb catlog output

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:
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:
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 do I structure AI that uses both Behavior Trees and Pathfinding? Architecturally, what are the best practices for how these two concepts interact with each other?

For instance, say I have an asteroids like game where the AI player must dodge floating asteroids while at the same time collecting powerups. If we want him to perform well we can't just have two separate behaviors for dodge and collect, he should consider everything on the screen.

Should the behaviors in the tree modify the weights of the pathfinding graph nodes (assuming using a graph based approach here)? Is A* like path finding even the best approach for this scenario?

sentences:
Fast texture pixel access using SDL2 People have asked questions on fast pixel manipulation, but I'm looking to read the RGB color values of each pixel.

I've heard of SDL_RenderReadPixels but in the docs it says:

  WARNING: This is a very slow operation, and should not be used frequently.

Is there an SDL2 function that returns an array of all the pixels of a texture or an SDL2 routine that I can use to loop over each pixel?

sentences:
Creating state machines to handle multiple aspects of a game? So first off, I'm not sure if it matters but I am using SFML and C++. I've been wanting to write a game and I've read a lot on FSMs and what they do/make things easier for managing games, etc. What I gathered so far is that a state machine can be set up for each entity as well as the overall game so we are transitioning between states. What I am having trouble with is actually starting off and making a basic implementation of this. So I'd appreciate it if someone can point me in the right direction.

  How do I implement multiple state machines to handle different aspects of the game? For example for characters, for menu/loading/splash/credits etc. If I understood it correctly I would need something like an entity class, and then derive/inherit from it in order to make characters/mobs with various AIs? Is that the right way? Can I do it in a simpler fashion?
  How do I handle transitions if I don't want to use a switch statement? It seems like a naive approach if a more object oriented method exists. What is going to do the switching, do I have to remember the previous state or only know next state?

Thank you in advance!

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:
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:
Placing an AABB close to a point so that it doesn't intersect any other AABBs Give a 2D space with a bunch of non-intersecting AABBs, and a point in this space (that may or may not be inside an AABB), how can I find the closest place where I can place a new AABB of a given size?

For example, given the space below and the point 'X', the correct position for a certain AABB is marked in green:

One solution I have considered is to iterate every edge, and find the closest point on that edge where the shape doesn't intersect (if such a point exists). This could be achieved by placing the AABB at the closest point on the given edge, and then if it's intersecting with another shape, move it to the outside edge of that shape, along the given edge, repeating until it's no longer intersecting. This seems relatively expensive (though could probably be optimized by using some kind of spatial hashing), but might be the way to go.

I'm wondering if there are any obvious or not so obvious solutions I'm missing here.

sentences:
What does EventSystem.currentSelectedGameObject consider the current object to be? I've been working with UI in my project as of late and I can't figure out what Unity's event system is supposed to return for currentSelectedGameObject.

if (EventSystem.current.currentSelectedGameObject != null)
{
    Debug.Log(EventSystem.current.currentSelectedGameObject.name);
}

With the code above I figured that it should return something when I'm moving the mouse across the various UI elements. Unity's documentation appears to be poor on this function stating:

  The GameObject currently considered active by the EventSystem.

maybe I'm just being stupid but does anyone know what triggers currentSelectedGameObject?

sentences:
Is there a need to set the parameters again when updating a texture? Suppose that I'm developing the class COpenGLControl here in code guru to use it for showing a 2D texture in an MFC CPictureControl. and after applying some filters on the image, I will update the texture to show the filtered image on the picture control.

I have set a rule for the clients of my class as follows:

Call function setImageWidthHeightType just first time of calling OnTimer and after setting pImage
pImage is the rastetr data that will be provided by another classes that have been developed using OpenCV and GDAL libraries
for the next calls of OnTimer and when updating pImage there's no need to call this function. If you do so, your client code slows down because the function InitializeTextureObject() is called in the setImageWidthHeightType function
For second and more calls of OnTimer you should call updataTextureObject() function after setting pImage. In the first call of OnTimer and before calling setImageWidthHeightType, the function updataTextureObject() should not be called and if so, the program will encounter an unhandled exception because there you still don't have any texture object to be updated.

any way I have used the following codes for the functions that are mentioned above:

OpenGLControl.h
allocate texture name which will be an unsigned integer

GLuint texture;

OpenGLControl.cpp
Generate just one texture and bind it to the target:

void COpenGLControl::InitializeTextureObject()
{
    wglMakeCurrent(hdc, hrc);
    glEnable(target);
    glGenTextures(1,&texture);
    glBindTexture(target,texture);
    glTexParameteri(target,GL_TEXTURE_WRAP_S,GL_REPEAT);
    glTexParameteri(target,GL_TEXTURE_WRAP_T,GL_REPEAT);
    glTexParameteri(target,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(target,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
    glPixelStorei(GL_UNPACK_ALIGNMENT,1);
    glTexImage2D(target,level,internalformat,ImageWidth,ImageHeight,border,format,type,&pImage[0]);
    wglMakeCurrent(NULL, NULL);
}

the question that roses up is that
Is there a need to set the parameters again when updating texture because of using wglMakeCurrent(NULL,NULL) at the end of the function above?
In other words should I write the function updataTextureObject() as this:

void COpenGLControl::updataTextureObject()
{
    wglMakeCurrent(hdc, hrc);
    glEnable(target);
    glBindTexture(target,texture);
    glTexParameteri(target,GL_TEXTURE_WRAP_S,GL_REPEAT);
    glTexParameteri(target,GL_TEXTURE_WRAP_T,GL_REPEAT);
    glTexParameteri(target,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(target,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
    glPixelStorei(GL_UNPACK_ALIGNMENT,1);
  glTexSubImage2D(target,level,xOffset,yOffset,ImageWidth,ImageHeight,format,type,&pImage[0]);
    wglMakeCurrent(NULL, NULL);
}

Or just as this:

void COpenGLControl::updataTextureObject()
{
    wglMakeCurrent(hdc, hrc);
    glTexSubImage2D(target,level,xOffset,yOffset,ImageWidth,ImageHeight,format,type,&pImage[0]);
    wglMakeCurrent(NULL, NULL);
}

What way is the correct one?

sentences:
XNA change a specific color of a model to another Is it possible to change a specific color of a model to another?

Example:

Everything that's blue should be red or something like that.

And is it possible to do this without the use of effects? I still want to use the basic effect.

sentences:
Having trouble making game time pause and unpause I've been trying to make it where when the player does a certain task, the game's time will pause. When the player does another action, the game's time would unpause and continue. I had my code like so:

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

public class timeScript : MonoBehaviour
{
    //uGUI Items
    public Text date;
    public Text playerCash;

//Times
public static int week;
public static int month;
public static int year = 1980;
//amount of cash
public static int myCash = 10000;
public AlertBox alert;
public Text timeText;

bool timeActive = true;
int time;

int day;

void Start()
{
    InvokeRepeating("Timer", 0, 1);
}

public static void Timer()
{
    timeText.GetComponent<Text>().text = "W" + week.ToString() + "" + year.ToString();

    playerCash.GetComponent<Text>().text = "$" + myCash.ToString();

    #region YEAR
    //Check if month equals 13 (allows for 12th month to be counted)
    if (month == 13)
    {
        year++;
        month = 0;
    }
    #endregion
    #region MONTH
    //Check if week equals 5 (allows for 5th week to be counted)
    if (month == 5)
    {
        month++;
        week = 0;
    }
    #endregion
    #region WEEK
    //Check if day equals 8 (allows for 7th day to be counted)
    if (day == 8)
    {
        week++;
        day = 0;
    }
    #endregion
    #region DAY
    //Check if Time equals 5 (allows for 4 seconds)
    if (time == 2)
    {
        day++;
        time = 0;
    }
    else
    {
        time++;
    }
    #endregion

I tried using CancelInvoke(timeScript.Timer()); in another c# file but all it did was give me an error that stated I couldn't convert from string to void.

sentences:
Collision stickyness problem on multiple inputs I've been trying for a couple of days to solve an issue I'm having with top-down 2D collisions, whenever I collide with tiles that have adjacent collidable tiles my player sticks to the wall, If I collide right or left I can't move up or down, the same for the Y axis, I can't move left or right when colliding from the top or bottom. Here's a picture to represent my issue a bit better:

The gray boxes represent the collision area.

Here is my code:

            Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
            Vector2 temporaryPlayerPosition = player.Sprite.Position - player.Velocity;
            if (player.CollisionBox.Intersects(tileRect))
            {
                if ((player.CollisionBox.Right >= tileRect.Left && player.CollisionBox.Right < tileRect.Right) ||
                    (player.CollisionBox.Left <= tileRect.Right && player.CollisionBox.Right > tileRect.Left))
                {
                    player.CollisionBox.X = (int)temporaryPlayerPosition.X;
                    player.Sprite.Position.X = temporaryPlayerPosition.X;
                }
                if ((player.CollisionBox.Bottom >= tileRect.Top && player.CollisionBox.Bottom < tileRect.Bottom) ||
                    (player.CollisionBox.Top <= tileRect.Bottom && player.CollisionBox.Top > tileRect.Top))
                {
                    player.CollisionBox.Y = (int)temporaryPlayerPosition.Y;
                    player.Sprite.Position.Y = temporaryPlayerPosition.Y;
                }
            }

If anyone could point me to the right direction I would be grateful!! Thanks again!

EDIT!!!

I changed my whole collision code so it does a forward check before handling the displacemente of the sprite, I still have the stickyness issue though. This is the new code:

Rectangle forwardCollision = new Rectangle((int)(player.CurrentPos.X + (player.Velocity.X*4)), (int)(player.CurrentPos.Y + (player.Velocity.Y*4)), player.Sprite.SourceRect.Width, player.Sprite.SourceRect.Height);
player.CanRunX = player.CanRunY = true;
foreach (TmxTile tile in tileList)
{
    tile.Update(gameTime);
    Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
    if (forwardCollision.Intersects(tileRect) && SolidTileIds.Contains(tile.Id))
    {
        if (player.Velocity.X != 0)
            player.CanRunX = false;
        if (player.Velocity.Y != 0)
            player.CanRunY = false;
    }
}
foreach(DebugRectangle rectangle in rectangleList)
{
    rectangle.Update(gameTime);
}

if (player.CanRunX)
    player.Sprite.Position.X += player.Velocity.X;
else
    player.Sprite.Position.X -= player.Velocity.X;
if (player.CanRunY)
    player.Sprite.Position.Y += player.Velocity.Y;
else
    player.Sprite.Position.Y -= player.Velocity.Y;

player.CurrentPos = player.Sprite.Position;
player.CollisionBox.X = (int)player.Sprite.Position.X;
player.CollisionBox.Y = (int)player.Sprite.Position.Y;
player.DebugRectangle.Position.X = forwardCollision.X;
player.DebugRectangle.Position.Y = forwardCollision.Y;

sentences:
Finding out which Panel was clicked in function I have a panel with 10 sub panels in it. I am using Event Trigger to intercept the messages from these sub panels OnPointerDown  event calls some function in the some script of an Game Object.

Is there a way to know in the function which of the sub panels was clicked. That way I can use the same function for all the sub panels or should I make individual function for each of the sub panels.

sentences:
Buffer System For Items I am going to reference this image of what I want to accomplish in JavaScript.

This is the Diablo buffer system.  This question may be a bit advanced (or possibly not even allowed).  But I was wondering how you might go about implementing this type of system in a JavaScript game.  Currently to implement such a system in JavaScript escapes me, and I am turning to SO to get some suggestions, ideas, and hopefully some insight in how I could accomplish this without being to costly on the CPU.

Some thoughts of mine for implementing such a system would be to:

Create DIVS within a DIV that hold each position of the inventory
Go through each item you own in a container and see which DIV it belongs to
Make said item images the DIVs image

This type of system might possibly work if ALL items were 1x1, but for this example its not going to work out.

I am at a complete lost of ideas how to even accomplish this.  Although, maybe rendering directly to the canvas and checking mouse cords could work, there would more than likely be A HUGE annoyance when checking if other items are overlapping each other (meaning you cant place the item down, and possibly switching item with the cursor item ).

That said, what am I left with?  Do I need to makeshift my own hack system with messy code, or is there some source out there (that I don't know about) that has replicated this type of system in their own game.

I would be very grateful to get some replies on how you might go about doing this, and will accept answers that can logically explain how you might implement such a system (code is not required).

P.S. Id like to use pure JavaScript, and nothing else (even though it might be "reinventing the wheel", I also like to learn).

sentences:
How to make Line Renderer lines stay flat? I've noticed that as I add more vertexes to a Line Renderer line the line twists and stops being a smooth line.

.GIF Here: http://i.imgur.com/hRAhCXM.gif

All lines are on the same z level, even if I remove the materials the lines still seem to twist.

I have no idea why it does this, or how to go about resolving it, any suggestions?C#

sentences:
Authorization in scaling multiplayer game I have an architectural problem associated with authorization.

I'm making an MMORPG multiplayer mobile game without separation onto different servers. What I mean by that is that a player from USA could have a mission with someone from China.

Currently I have an authentication microservice that issues JWT tokens. Another types of microservices are game microservices that handles all game logic. By design they would scale to meet the demand.

Every account can have multiple characters created, but only one can be online at the time.

My question is: How can I ensure that only 1 character can be online? Do I attach selected character to JWT? But the player can request another JWT with another character and the previous one would be valid as well until it expires. In this case I would need to look up database with every request, but that defies the purpose of JWT. Should I be using JWT or is there another way authorize players?

sentences:
Give a message box where yes no question should be answered Message boxes, had some time put in creating some for my program, now it all were informative message boxes where an OK button was available and then it closed.

I worked with a canvas that would be enabled when needed and gets disabled on clicking OK.

But now I'm in need of a messagebox that gives an output.
I've tried to do the same and test some stuff with public variables, but my code kept going and didn't wait for the response of the "dialogue box" which results in the changes going through and an unused canvas that opened behind my active screen. (Another canvas is loaded when running the code while the current canvas gets disabled).

Code example:

 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on cnvCleanup
 if (CleanUpDone == true)
 {
 usages = 0;
 }
 else
 {
 usages++;

The cnvCleanup will get disabled on the script I wrote for clicking on the OK button.
In case the Not OK button is clicked the bool CleanUpDone should remain false so there the cnv gets disabled.

EDIT: More code.
The CleanUpDoneis public bool CleanUpDone; that gets changed in the cnvCleanup.

int usages;
usages = System.Int32.Parse(AssetList[2]);
if (usages < 10)
 {
 usages++;
 AssetList[2] = usages.ToString();
 }
 else
 {
 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on the cnvCleanup
  if (CleanUpDone == true)
  {
  usages = 0;
  AssetList[2] = usages.ToString();
  }
  else
  {
  usages++;
  }
}

sentences:
How to use SDL_RWops and SDL_RWseek to read text files, line by line? I'm right now looking for alternative ways to read text files on a line-by-line basis, for cross-platform compatibility (Windows / Linux).

My current solution is to go look for (or seek out) the newline (line break) in a text file using SDL2.

To demonstrate, I have a simple text file, with just 2 lines of gibberish text:

Hello world,
This is a new line with a line break.

On some text editors, you are able to display newlines or line breaks, and the above text would look somewhat like this:

Hello world,↵
This is a new line with a line break.

I want to use SDL_RWops, and if possible, use SDL_RWseek, or (SDL_RWops*)->seek(SDL_RWops*), to find the newline (line break), denoted by ↵ in the above example. That way, I can write a shorthanded version of SDL_RWreadToLine or some method that allows me to fetch text, line by line.

I believed the current method is very inefficient to check to see if I reached a newline, using psuedo-code:

//File reading/writing (We're only going to read)
//edict2 is a gigantic UTF-8 Japanese <-> English dictionary text file.
//That text file is useful for text operations (read/write) testing purposes.

SDL_RWops* edict2 = SDL_RWFromFile("edict2u", "r");         //The "u" stands for UTF-8 compatible.
if (edict2) {
    Sint64 currentBytePointer = 0;              //Holds the current pointer.
    Sint64 currentReadPointer = 0;              //Holds the current read pointer.
    Sint64 fileSize = edict2->size(edict2);     //Grabs the file size of the file.
    char* buffer = new char[256];               //Some buffer to capture the read text characters.
    while (currentBytePointer < fileSize && currentReadPointer != 0) {
        Sint64 length = edict2->seek(edict2, 1, RW_SEEK_CUR);       //Reads 1 byte from current read position.
        Sint64 temp = edict2->read(edict2, buffer, length, length); //Implicit C conversion from void* to char*.
        if (buffer[0] != '\0' && buffer[0] == '\n') {
            //Found, do something about it
        }
    }
    delete buffer;
}
else {
    //File doesn't exist, do nothing.
}

I'm sure there are bugs that I may have missed out on, considering that I'm reading from a text file that may contain multiple bytes.

And that's why I wanted to look for SDL2 alternatives.

Does anyone know of a better way to read text line by line using SDL2?

sentences:
What threading strategy does a game like Transport Tycoon use? Transport Tycoon is a simulation game where you control a transport company, place railroad tracks and trains, airports, bus depots, boats etc. Now the game is about 15 years old and I remember running it on a 486sx25 with 4Mb of RAM without any problems.

I was recently thinking about modern simulation game requirements and how high they are for relatively little increase in graphics and gameplay, so how did they managed to pull it with so little resources back in the day?

Does each train car have a thread, that moves it every 100ms, sleeps, wakes, recalculates position and does crash detection, and goes back to sleep?

Or is it one thread that moves every 100ms? What happens if there is too much work to do in each 100ms interval?

sentences:
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:
Is there algorithm for boxcasting or thickray casting? I am not sure what the correct name is called but here is my problem: I have implemented a casting ray function that works as expected. However, because I am using a loose grid structure, (ie, objects that overlap multiple grids are only put into one grid), the ray cast may miss certain objects. What I need, I think is a box casting where I need to get every grid the box hits from its initial position to final position. Does anyone have such algorithm? Or pointing out to a solution to this problem, thanks!

This pic from N tutorials is a nice summary of this problem:

My ray cast implementation only hit the blue cells but as you can see, it may miss certain objects. They are only put into the grid where the x is.

Just to add I will be using this in a heated loop and so I have the additional requirement that this must be done efficiently.

EDIT: this picture illustrates why I think a box casting would work for loose grid: (The box must be bigger than the objects contained in the grid.)

sentences: How to make a market test for the game? I'm making a casual game on iOS platform. But I'm not sure Do the consumers like my game. How can I make a market test for my game?

sentences:
UE4 - Event Tick and getting Forward Vector I'm trying to make a game where my character rotates towards cursor (that works). He can choose between a few weapons (also works). One of the weapons works like a machine gun. My idea was to make a simple solution with:
Event tick -> gate (opened by pulling LBM and closed by releasing it) -> gate (closed after firing and opened after some delay) -> spawning projectile which leads to a sequence that closes / opens the second gate.

It doesn't work perfectly. The projectile spawns with the right scale and location, but the rotation is always pointing straight forward.
If the exactly same blueprint is attached to anything else (straight up to the LMB pull or a timer), it works perfectly. However, doing the LMB pull defeats the whole purpose, as it's not a machine gun any more, and timer... is less then perfect I believe. I liked my solution using gates but it just doesn't want to work.
For example, this bit works with no problem (even though the spawning and rotation code is literally copy pasted):

Does anyone have an idea on how to fix this?

sentences:
"Render" unsigned integer values to texture without clamping to [0,1] I am trying to render to an unsigned integer texture, with a blending function enable, so that in the end, the value in each texel will be the number of objects rendered on the texel.  So I assume I cannot use normalized integers.

For example, if I have a 2x2 texture, and I render [ (0,0) (0,0) (0,1) (1,0) ], the texture result should be, [ 2 1 ; 1 0 ].

I am trying to set up the frameBuffer, but the call to glTexImage2D, causes the GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when I use the formats I assume I need.

// this works
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 768, 0, GL_RGB, GL_UNSIGNED_INT, 0);

// this causes GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
glTexImage2D(GL_TEXTURE_2D,
             0,
             GL_RGB32UI,
             width,
             height,
             0,
             GL_RGB_INTEGER,
             GL_UNSIGNED_INT,
             0 );

Is what I want to do even possible?  If so, which settings do I need to use to accomplish this?

sentences:
How to load multiple 3D models dynamically xna I want to load multiple 3D models .fbx at the same time in my map display.
I can load First Model but when I use ContentBuilder to Load another Model, I Got Error in effect.EnableDefaultLighting ();
This my load function

private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            // Default to the directory which contains our content files.
            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string relativePath = Path.Combine(assemblyLocation, "../../../../Content");
            string contentPath = Path.GetFullPath(relativePath);
            fileDialog.InitialDirectory = contentPath;
            fileDialog.Title = "Load Model";
            fileDialog.Filter = "Model Files (*.fbx;*.x)|*.fbx;*.x|" +
                                "FBX Files (*.fbx)|*.fbx|" +
                                "X Files (*.x)|*.x|" +
                                "All Files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                LoadModel(fileDialog.FileName);
            }
        }
        void LoadModel(string fileName)
        {
            Cursor = Cursors.WaitCursor;
            // Unload any existing model.
            editorDesign1.Model = null;
           // editorDesign1.CurrentModel.Model = null;
            contentManager.Unload();
            // Tell the ContentBuilder what to build.
            contentBuilder.Clear();
            contentBuilder.Add(fileName, "Model", null, "ModelProcessor");
            // Build this new model data.
            string buildError = contentBuilder.Build();
            if (string.IsNullOrEmpty(buildError))
            {
                // If the build succeeded, use the ContentManager to
                // load the temporary .xnb file that we just created.
              editorDesign1.Model = contentManager.Load<Model>("Model");
              // editorDesign1.CurrentModel.Model = contentManager.Load<Model>("Model");
            }
            else
            {
                // If the build failed, display an error message.
                MessageBox.Show(buildError, "Error");
            }

            Cursor = Cursors.Arrow;
        }

and this is my Draw model function

public void DrawModel()
        {
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = Matrix.CreateTranslation(Position) * Matrix.CreateRotationX(Rotation.X) * Matrix.CreateScale(Scale) * Matrix.CreateRotationY(Rotation.Y) * Matrix.CreateRotationZ(Rotation.Z);

                    effect.View = view;
                    effect.Projection = projection;
                }

                mesh.Draw();
            }
        }

The problem is when I create two object from my model class and use ContentBuilder to Load another Model I get an exception AccessViolationException was Unhandled Attempted to read or write protected memory. This is often an indication that other memory is corrupt  and get another exception NullReferenceException was unhandled

Can anyone help me tho solve this problem?

sentences:
Why is my player still moving down when I set its gravity to 0? I'm writing Lode Runner like platformer game. I'm trying to solve player sprite slowly moving down when on ladder by setting player.body.gravity.y = 0. I have arcade physics gravity y set to 900 in game config. But game gravity settings seems to override player.body.gravity settings.

I even log player.body.gravity.y to console. It shows 0 when player is on ladder. But it still slowly moving down.

sentences:
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:
Converting IntPtr to objects (here Raylib Material[]) I'm trying to apply a texture to the material of a Model but I could not figure out how to do it:
so I made a direct translation of the c code taken from examples:
(original from "Raylib [shaders] example - postprocessing shader" line 77)
model.materials[0].maps[MAP_DIFFUSE].texture = texture;

(my c# translation)
m_LP_SpookyTree = LP_SpookyTree.GetModel;
m_LP_SpookyTree.materials[0].maps[MaterialMapType.MAP_ALBEDO].texture = Raylib.LoadTexture("Ressource/Textures/PlaceHolders/mossy_rock_diff_1k.png");

According to the cs file on the repo, the "materials" definition is an Int pointer.
The problem comes from the Intptr, how could I get the material array from it?
thanks for your time.
PS: I've created an issue on Raylib.cs GitHub repo so if I get an answer on one before the other, I'll update accordingly

EDIT 1:
I've tried to change every IntPtr to the object it should actually point to regarding the comments in the source file, compile the lib, and imported it. unfortunately, it broke. so I don't think it's possible.

EDIT 2:
I've found this article talking about IntPtr to objects (vice versa)
https://stackoverflow.com/questions/728105/how-to-convert-an-intptr-back-into-an-object
I've implemented it like so:
public static object pointerToObject(IntPtr pMapping, Type type)
{
    return Marshal.PtrToStructure(pMapping, type);
}

but now I get this error:
System.MissingMethodException : 'No parameterless constructor defined for type 'Raylib_cs.Material[]'.'

PS: The new code:
Material[] materials = (Material[])PointerManipulation.pointerToObject(m_LP_SpookyTree.materials,typeof(Material[]));
MaterialMap[] materialMaps = (MaterialMap[])PointerManipulation.pointerToObject(materials[0].maps, typeof(MaterialMap[]));

materialMaps[(int)Convert.GetTypeCode(MaterialMapType.MAP_ALBEDO)].texture = Raylib.LoadTexture("Ressource/Textures/PlaceHolders/mossy_rock_diff_1k.png");

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:
DX 11 Specular Highlights in Deferred Renderer I am currently implementing a deferred renderer in DX11.1.  Right now I am having a problem that I can't seem to crack with specular highlights when I have multiple light sources.

I keep a vector of lights for each scene and the last light rendered has proper spec, but all lights before it are "bad".  I think the problem is caused by an improper blend state setting, but I'm not sure.  Currently my blend state when rendering lights is

blendDesc.RenderTarget[0].SrcBlend       = D3D11_BLEND_ONE;
blendDesc.RenderTarget[0].DestBlend      = D3D11_BLEND_INV_SRC_ALPHA;
blendDesc.RenderTarget[0].SrcBlendAlpha  = D3D11_BLEND_ONE;
blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_DEST_ALPHA;

blendDesc.RenderTarget[0].BlendOp = blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;

In my G buffer generation I write specular to the G buffer's color map's alpha channel.
 In hlsl...

output.color.a = _specEm.Sample(linearClamp, input.texcoord).a;

Then in the light accumulator

float4 diffuse = _diffuse.Sample(pointClamp, input.texcoord);

// Lighting calculations for diffuse and normal, all good
// ...

float speci = diffuse.a;
float specularLight = speci * pow(saturate(dot(reflectionVector, directionToCamera)), specp);

return float4(diffuseLight.rgb, specularLight);

In this scene there are two lights, the first image shows the specular highlight created by the second light rendered

The second image is of the first light rendered in this scene where you can see the spec "badness" (a dim highlight with a darker spot in the middle), in it you can also see the position of the other light

Never mind the light on the boxes, they aren't fully interacting with light at the moment.

Its worth noting that more lights in the scene will have the same effect, all will have the "bad" spec and the last one will have the "good" spec.

I suspect that I am missing something fundamental about how blend states work and losing some of the color that I am writing into the alpha channel, but if anyone out there can see the problem and suggest a fix, I would appreciate it.

sentences:
where have the shape drawing functions gone in DirectX10? such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx

Is there an equivalent in DX10? If so, how do I use it?

In DX9 you..

Declared:

LPD3DXMESH meshTeapot;

Initialised:

D3DXCreateTeapot(device, &meshTeapot, NULL);

Drew:

meshTeapot->DrawSubset(0);

Released:

meshTeapot->Release();

Is there an equivalent set of methods for drawing primitives? (to be honest the sphere is of more interest to me than the teapot!)

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:
General visual effects to meshes/entities I am trying to add some visual effects to some entities, meshes, or whatever you want to call them as they are looking pretty dull in my game right now.

What I want to achieve is this: http://youtu.be/zox8935PLw0?t=36s (the "texture" gets disintegrated and then goes back to normal, covering the whole mesh.)

Also I would like to know what is the best way to add effects like the one in the video to my game (for example, thunder effects, shattering, etc.) I know that I can do some things with shaders, but I haven't learned them too well and I am still in a beginner level.

I am using Ogre3D, and GLSL for shaders.

Thanks!

Note: this is a screen-shot of my game, I want to apply the effect in the video to my main character):

sentences:
import text strings into Unity editor 3D text objects so that Scene View displays them I am having trouble finding a solution to this problem.  I want to generate the text for TextMesh.text in a custom application and import into the Unity editor so that I can then scale the text to fit.  If anyone could point me in the right direction to simply edit a 3D Text game objects' text mesh.text property from a script so that it is reflected in the scene view in Unity's editor, I would greatly appreciate it!

Best Regards,
Ben

sentences:
MMORPG server-side java architecture I am currently making a MMORPG game, which is turn-based. The client is supposed to run on Android. Now, my friend is doing the graphics, and I have been doing the game classes (player, weaponry, etc.). Now, if the fight is started, the classes can be manipulated by interfaces (actually for my partner, it is like working with pure interfaces, he does not need any access to the implementaton classes).

Now we need to introduce a game server to allow for multiple players. And a few very important questions arise:

1) Shall I copy the game model to the server completely, leaving no classes on the client or is it better to have 2 copies of the model - 1 on the server and 1 on the device and to complete periodic synchronization between those?

2) Which method of connection to choose between the client and the server (client in sight is android phone)? As for the server - I am turning towards java cause I have some experience with it. But now the questions is - is it better to use sockets for this task or I can use REST services, or it is even possible to connect it somehow to Java EE server which is cool from my point of view cause it removes a lot of programming complication? Even though the game is multiplayer, it is turn based, so it does not need to be renewed very often.

3) What about threading? Should every client have his own thread(in case of sockets)?

4) Are there any books on REAL MMORPG server game programming out there???

sentences:
Are references between entities in Entitiy Component System allowed? I've got a player entiy in my game that can pick up weapons when colliding with item entities. The player can hold and use the weapon in their hand (the weapon sprite is rendered relative to the carrier).

I'm wondering how to design weapons and items in an ECS approach. Should the weapon be an entity the whole time so that the player entity has a weapon-component which holds a reference to the weapon-entity?

sentences:
Get speed from vector using box2d and javascript I need to find the speed of an object in a game. The game is made in HTML5 with jquery and jquery.box2d.
For this I can use these methods:

 GetLinearVelocity().x;
 GetLinearVelocity().y;

I'm then trying to calculate the speed from this piece of code, but get some values that doesn't make sense when I console.log it. This is my code:

 var heroVelX = game.currentHero.GetLinearVelocity().x;
 var heroVelY = game.currentHero.GetLinearVelocity().y;

 var speed = Math.sqrt(heroVelX^2 + heroVelY^2);
 console.log(speed);

Some of the values in console.log are numbers, but most of them are NaN (Not-A-Number), which confuses me? Can someone help me solve this?

The goal I want to achieve, is to see when the speed(of object .currenHero) drop below a certain value, so I can excute a new state in the game.

sentences:
How to map changing stances (southpaw/orthodox) to gamepad controls? I am developing a third person hack n slash style game which features a variety of melee and projectile weapons as well as unarmed combat. The player will be able to dual wield any combination of the above weapons eg. a sword and a pistol, or a knife and a bare fist. I'm trying to work out the gamepad controls based on the game mechanics, but I've come to a dilemma regarding the movesets.

Originally I had the left and right triggers mapped as the left and right hand attacks. However, some of the attack moves that I have planned involve the player taking a step forward. Meaning they may have started in orthodox stance (left foot forward) but will end up in southpaw (right foot forward). For some weapons like firearms the stance makes no difference, since the attacks will be the same from either. But for some melee weapons and especially for unarmed combat this is a significant difference. For example, from orthodox stance the left trigger should logically do a jab attack from the front hand, while the right trigger should do a straight punch attack from the back hand. If the player now does a lunging attack in which they take a step forward, they end up with their other foot infront, meaning that now the left trigger cannot do a jab but must perform a straight punch since the left hand is no longer in front.

So the question is how to resolve this without having a controls system that confuses the player. There are a few options I have considered after studying other games, but I am looking to see if a better alternatives exists.

1) Seen in Elder Scrolls, Dark Souls, Tekken:

Use 2 attack buttons but have the player always stay in a single stance. This way they the left and right limbs will always perform the same move. The downside of this is that attacks which would normally leave the player in another stance have to either be avoided or the animation has to include the player returning to their original stance. While this solves the problem it can look unrealistic.

2) Seen in DOA, VF:

Use only 1 attack button, instead of one for each limb. This will mean that the stance of the player is irrelevant since a single button will play the correct attack animation of either the left limb or right limb depending on the stance. While this is more realistic it makes it difficult to have dual wielding weapons with only one button controlling both. For example, consider if a pistol and sword are being dual wielded, the left trigger may swing the sword while the right trigger may fire the pistol; but if both weapons are mapped to only the right trigger what attack should happen? The sword, the pistol, both? Here lies the problem.

3) Seen in MK:

Use 2 attack buttons which refer to the front or back limb, not the left or right limb. This method allows for the player to switch stances, since for example the left trigger may refer to the front hand irrespective of which stance the player is in. In a side scrolling game this may not be a problem, but in a third person game where the camera is behind the player, I am concerned that this type of controls will be confusing. Especially since the convention (correct me if I'm wrong) for dual wielding seems to be that the left and right triggers control the left and right weapons/limbs.

So are these the only options, or is there a better way of mapping the controls for this use case?

sentences:
Crusader Kings 2: How to extract character religion from saved game? I am trying to parse and interpret the Crusader Kings 2 save file. I run into problem when trying to extract character religion.
3185293=
{
    bn="Umar"
    b_d="1543.12.21"
    fat=3160797
    mot=3160268
    att={7 3 4 3 3}
    tr={195 }
    rel="norse_pagan_reformed"
    cul="andalusian_arabic"
    dnt=1000128972
    dna="xvfudvhjgxg"
    prp="ojcf0k00000000000000000000000000000000"
    fer=0.400
    health=5.100
    # ... shortened ...
}

In many cases, trait rel is missing. In the documentation, I found reference that the trait does not appear if government make it unnecessary. Can you please advise how exactly to extract character religion if the trait is missing?

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:
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:
How can I resolve component types in a way that supports adding new types relatively easily? I am trying to build an Entity Component System for an interactive application developed using C++ and OpenGL. My question is quite simple. In my GameObject class I have a collection of Components. I can add and retrieve components.

class GameObject: public Object
{
public:
    GameObject(std::string objectName);
    ~GameObject(void);
    Component * AddComponent(std::string name);
    Component * AddComponent(Component componentType);
    Component * GetComponent (std::string TypeName);
    Component * GetComponent (<Component Type Here>);
private:
    std::map<std::string,Component*> m_components;

};

I will have a collection of components that inherit from the base Components class. So if I have a meshRenderer component and would like to do the following

GameObject * warship  = new GameObject("myLovelyWarship");
MeshRenderer * meshRenderer =  warship->AddComponent(MeshRenderer);

or possibly

MeshRenderer * meshRenderer =  warship->AddComponent("MeshRenderer");

I  could be make a Component Factory like this:

 class ComponentFactory
 {
 public:
     static Component * CreateComponent(const std::string &compTyp)
     {
         if(compTyp == "MeshRenderer")
             return new MeshRenderer;
         if(compTyp == "Collider")
             return new Collider;
         return NULL;
     }
 };

However, I feel like I should not have to keep updating the Component Factory every time I want to create a new custom Component but it is an option. Is there a more proper way to add and retrieve these components? Is standard templates another solution?

sentences:
XNA - Accessing primary View, Project, World matrices from a game component In XNA4, I have an EnemyManager class that takes care of all of the enemies.  When it comes time to draw, however, it needs access to the game's main View, Projection, and World matrices.

I could just pass a reference to my DavesGame object down in there, but that seems like bad design.  I could put them in an interface and expose them as a game service.

I'm leaning towards the latter, but I'm wondering what the correct & elegant way to do it is.

Thanks!
Dave

sentences:
Jump-through & drop-down platform I'm creating platforms in my game where the player can:

1) Jump through them from the bottom and land on top of them

2) While on top of them, drop down through them

I've been able to get #2 working just by disabling the contact using contact->SetEnabled(false) and this has worked fine. I'm mainly having some issues on the best way to handle #1. Here's the basic idea I have, though there's still some things that I need to concretely figure out. (Note: The logic below is very Box2D specific, but should apply to most physics engines):

Add 4 sensor fixtures to the 4 sides of the main fixture that extends a small amount past the main fixture
When the top, left, or right sensor fixtures make contact with a platform, disable the contact by using contact->SetEnabled(false) and set a boolean flag inside the Sprite object indicating that the Player is passing through the platform
When the bottom fixture ends contact with the platform, disable the boolean flag

This would basically make the top, left, and right fixtures act as enablers for the pass through logic and the bottom fixture act as the disabler. So when the player is falling back down from their jump, the bottom fixture will make contact, but won't disable the contact.

This makes sense on paper, but I can think of a few corner-case issues that might arise from this. Before I start plugging down this path, does anyone have any suggestions that might make my plan better or even a completely different way of doing it?

sentences:
Rotating a 4D matrix about the Y axis with an X-Z vector I should mention that I'm pretty new to Matrices and will probably need a layman's answer to my question.

I have a 4D matrix which represents the rotation of an object in 3D space. I have a normalized 2D vector which represents the direction i want the object to be facing by rotating the Y axis.

I need to be able to change the Y axis rotation of the object only, by applying some sort of calculation to the XZ vector i have. What do i need to do to make this work? And if possible, can any answers come with an explanation of the process so that i can do it again on my own in the future!

sentences:
Why do asymmetric specular highlights appear in a scene with only ambient lighting in Unity? I have a scene in Unity (2019.3.0f3 Personal) using the High-Definition Render Pipeline. There are no lights in the scene, and Baked Global Illumination is disabled. The skybox is a GradientSky. By all means, the lighting in the scene should be absolutely uniform, but instead there is a gradient from one side to the other.

This is what the scene looks like:

Though the effect is faint, you can see that the right side of the plane is slightly lighter than the left. The ground shader is HDRP/TesselationLit, and by bringing the Smoothness Remapping to max I can exaggerate this effect, as shown below. This is why I am under the impression the effect is specular in nature.

Interestingly, if I switch the camera to the Isometric mode, the effect disappears:

Finally, the effect appears to occur in world rather than camera space, as shown by the changes in lighting when I rotate my camera in increments of 90 degrees:

What is causing this effect, and how can I disable it?

sentences:
Blender wont export textures (materials) to OGRE3D .mesh i am exporting a model from BLENDER to OGRE3D using the blender2ogre script. the desigre output is a single .mesh file but i know there should be also materials scripts that i should copy to my ogre path. the problem is that blender does not export those files for me it export only 1 mesh file (after i joined all objects) this is the model. in blender it looks fine but in my demo Ogre app it looks like :
i can use a little help here.

sentences:
How to fix this elbow issue when converting to humanoid Good day, how can I fix this? it looks fine in Blender and generic but not when I switch to humanoid. There is no error on rig tab but there are in animation tab under the import message that say "is in between humanoid transforms and has rotation animation that will be discarded" and I can't seem to fix it.
Here are the things I've tried so far:

Put the right bones to the right slots.

Enforce T-pose.

Translation DoF.

Clicked Generate Retargeting and applied it.

sentences:
Automating XNA Performance Testing? I was wondering what peoples approaches or thoughts were on automating performance testing in XNA. Currently I am looking at only working in 2d, but that poses many areas where performance can be improved with different implementations.

An example would be if you had 2 different implementations of spatial partitioning, one may be faster than another but without doing some actual performance testing you wouldn't be able to tell which one for sure (unless you saw the code was blatantly slow in certain parts). You could write a unit test which for a given time frame kept adding/updating/removing entities for both implementations and see how many were made in each timeframe and the higher one would be the faster one (in this given example).

Another higher level example would be if you wanted to see how many entities you can have on the screen roughly without going beneath 60fps. The problem with this is to automate it you would need to use the hidden form trick or some other thing to kick off a mock game and purely test which parts you care about and disable everything else.

I know that this isnt a simple affair really as even if you can automate the tests, really it is up to a human to interpret if the results are performant enough, but as part of a build step you could have it run these tests and publish the results somewhere for comparison.

This way if you go from version 1.1 to 1.2 but have changed a few underlying algorithms you may notice that generally the performance score would have gone up, meaning you have improved your overall performance of the application, and then from 1.2 to 1.3 you may notice that you have then dropped overall performance a bit.

So has anyone automated this sort of thing in their projects, and if so how do you measure your performance comparisons at a high level and what frameworks do you use to test? As providing you have written your code so its testable/mockable for most parts you can just use your tests as a mechanism for getting some performance results...

=== Edit ===

Just for clarity, I am more interested in the best way to make use of automated tests within XNA to track your performance, not play testing or guessing by manually running your game on a machine. This is completely different to seeing if your game is playable on X hardware, it is more about tracking the change in performance as your game engine/framework changes.

As mentioned in one of the comments you could easily test "how many nodes can I insert/remove/update within QuadTreeA within 2 seconds", but you have to physically look at these results every time to see if it has changed, which may be fine and is still better than just relying on playing it to see if you notice any difference between version. However if you were to put an Assert in to notify you of a fail if it goes lower than lets say 5000 in 2 seconds you have a brittle test as it is then contextual to the hardware, not just the implementation. Although that being said these sort of automated tests are only really any use if you are running your tests as some sort of build pipeline i.e:

Checkout -> Run Unit Tests -> Run Integration Tests -> Run Performance Tests -> Package

So then you can easily compare the stats from one build to another on the CI server as a report of some sort, and again this may not mean much to anyone if you are not used to Continuous Integration. The main crux of this question is to see how people manage this between builds and how they find it best to report upon. As I said it can be subjective but as knowledge will be gained from the answers it seems a worthwhile question.

sentences:
Communication between Box2D and libGDX Stage (Scene2D) running in separate threads I'm making a physics based 2D game using libGDX and Box2D. I want to move the execution of the simulation out of render thread. I use immutable messages and the BlockingQueue to pass the information about player actions. The Box2D applies forces and runs a frame of simulation. In the next step I would like to sync back the changes and update Scene2D Actors accordingly. Making an immutable copy of the state of the game world and sending it back using Gdx.app.postRunnable() is one option but it seems inefficient.

Is there any other option?

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: Why would someone chose midpoint displacement over perlin noise for 3D terrain generation? I myself am creating a terrain generation algorithm and would be interested in knowing why others have chosen midpoint displacement over perlin noise. Minecraft is an example where midpoint displacement was preferred. If anyone knows why I would be glad to hear it.

sentences:
GLFW / OpenGL location and size in pixels I'm using GLFW to create a little game. (and by little, I mean: small, nonprofit)

After a while of puzzling, I found out that this draws a texture (from an image, for instance) to the screen:

(the syntax is in Go, but the library is the same as the C/C++ version)

gl.BindTexture(gl.TEXTURE_2D, tex)
gl.Color4f(1, 1, 1, 1)

gl.Begin(gl.QUADS)

gl.Normal3f(0, 0, 0)

gl.TexCoord2f(1, 1)                     // top right
gl.Vertex3f(1, -1, 0)

gl.TexCoord2f(0, 1)                     // bottom right
gl.Vertex3f(-1, -1, 0) // = location

gl.TexCoord2f(0, 0)                     // bottom left
gl.Vertex3f(-1, 1, 0)

gl.TexCoord2f(1, 0)                     // top left
gl.Vertex3f(1, 1, 0)

gl.End()

This draws the texture perfectly. There is just one downside: as my screen is 16:9, the texture also gets rendered/displayed as 16:9. But as this is a square image (32 by 32 pixels), how do I get it to draw just those pixels, instead of defining it relative to the screen ratio? (values between -1 and 1)

My first assumption was that I can compute what the values should be, by comparing it with the actual screen size, but this feels like it's not the way to go.

sentences:
Measuring GPU time from managed code To measure CPU code, I use a Stopwatch. Using a Stopwatch in the Draw method is meaningless for the GPU side of things since the CPU and the GPU run asynchronously.

The questions is simple: Is it possible to measure the total time spent on a chunk of HLSL code? Perhaps as granular as the technique/pass.

sentences:
How can I change my RangeAttribute during in my script? I have an int which I want to be between 0 and an unknown number.  This unknown number is max in the example below.  I want this max number to change when another number changes in the editor.  How can I accomplish this?  This is my best attempt, but it won't let me use an unknown value for my range.

[Range(1, 10)]
public int multiplier;

[Range(0, max)]
public int x;

void OnValidate(){
    max = 10 * multiplier;
}

sentences:
How does OpenGL know which buffer to draw? I have been trying out some OpenGL things and was wondering something:

How does OpenGL know which buffer to draw when glDrawElements is called (since there are three)?

Here's a code snippet (from a tutorial):

    // Use our shader
    glUseProgram(programID);

    glm::vec3 lightPos = glm::vec3(4,4,4);
    glUniform3f(LightID, lightPos.x, lightPos.y, lightPos.z);
    glUniformMatrix4fv(ViewMatrixID, 1, GL_FALSE, &ViewMatrix[0][0]); // This one doesn't change between objects, so this can be done once for all objects that use "programID"

    glm::mat4 ModelMatrix1 = glm::mat4(1.0);
    glm::mat4 MVP1 = ProjectionMatrix * ViewMatrix * ModelMatrix1;

    // Send our transformation to the currently bound shader,
    // in the "MVP" uniform
    glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP1[0][0]);
    glUniformMatrix4fv(ModelMatrixID, 1, GL_FALSE, &ModelMatrix1[0][0]);

    // Bind our texture in Texture Unit 0
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, Texture);
    // Set our "myTextureSampler" sampler to use Texture Unit 0
    glUniform1i(TextureID, 0);

    // 1rst attribute buffer : vertices
    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glVertexAttribPointer(
        0,                  // attribute
        3,                  // size
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        0,                  // stride
        (void*)0            // array buffer offset
    );

    // 2nd attribute buffer : UVs
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
    glVertexAttribPointer(
        1,                                // attribute
        2,                                // size
        GL_FLOAT,                         // type
        GL_FALSE,                         // normalized?
        0,                                // stride
        (void*)0                          // array buffer offset
    );

    // 3rd attribute buffer : normals
    glEnableVertexAttribArray(2);
    glBindBuffer(GL_ARRAY_BUFFER, normalbuffer);
    glVertexAttribPointer(
        2,                                // attribute
        3,                                // size
        GL_FLOAT,                         // type
        GL_FALSE,                         // normalized?
        0,                                // stride
        (void*)0                          // array buffer offset
    );

    // Index buffer
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);

    // Draw the triangles !
    glDrawElements(
        GL_TRIANGLES,      // mode
        indices.size(),    // count
        GL_UNSIGNED_SHORT,   // type
        (void*)0           // element array buffer offset
    );

I have absolutely no idea how it would possibly know that the first buffer is the one that contains the vertices, and the others non-drawable information like UVs.

Can someone help me with this?

Thanks

sentences:
Finding the contact point with SAT The Separating Axis Theorem (SAT) makes it simple to determine the Minimum Translation Vector, i.e., the shortest vector that can separate two colliding objects. However, what I need is the vector that separates the objects along the vector that the penetrating object is moving (i.e. the contact point).

I drew a picture to help clarify. There is one box, moving from the before to the after position. In its after position, it intersects the grey polygon. SAT can easily return the MTV, which is the red vector. I am looking to calculate the blue vector.

My current solution performs a binary search between the before and after positions until the length of the blue vector is known to a certain threshold. It works but it's a very expensive calculation since the collision between shapes needs to be recalculated every loop.

Is there a simpler and/or more efficient way to find the contact point vector?

sentences:
Terrain and Path Architecture I am trying to figure out how to not break the SOLID principles with a collection of classes I am writing.

Currently, I have two stacks of classes that cater for editing and rendering Terrain and Paths.

Terrain -> TerrainChunk -> TerrainTile

Path -> PathChunk -> PathTile

The top level Terrain object exposes methods to add and remove Tiles which are then partitioned into Chunk objects forming part of a partitioned scene graph.

The Chunk objects themselves contain an array of Tiles and if something causes the tile or chunk to become dirty (terrain height is altered or a tile is added/removed) then the chunk “re-draws” itself which is as simple as looping through the tiles and calling Render().

The implementation of both the Terrain and Path stack of classes are largely the same (adding, removing, partitioning into chunks etc) with only the Render() method really doing anything different, i.e.: rendering a simple path or a single terrain tile.

I am quite happy with this setup so far which has proven to be extensible enough for my needs to date. This is working as expected and (surprisingly) I haven't butchered my code enough to worry about breaking any of the SOLID principles. Yet.

However, the need has arisen for the TerrainTile to know about the PathTile and also the PathTile needs  to know about the TerrainTile.

The reason I believe this is true is that I would like to be able to “cut away” the terrain where the path is and also add “tunnels” to the path though the terrain. In order to do this, both terrain and path need to know about each other to determine where the terrain should be drawn or cut away and which paths should have "tunnels" added to them.

Ideally, I would like to implement something similar to this capture from Theme Parkitect although the principle is most likely the same in any other simulation game with terraforming.

I’m not sure how to create the relationships between the two classes however without breaking at least 3 of the SOLID principles.

I could certainly go right at it and brute force this into my current implementation but that’s not very nice and would go against the lean and sane implementation I have strived for thus far.

Can anyone offer up any suggestions as to how I might inform one stack about the changes in another without introducing dependencies or hacking my code to pieces?

Perhaps I am barking up the wrong tree and the approach I have in mind isn't entirely suited for the job, in which case, are there any alternative options I could explore?

Note that I am not asking here about how to create either the terrain or the path tiles themselves but simply, how can I inform each of the appropriate parties of changes to each other without creating cyclical dependencies on each class.

If it matters, I am using Unity and C# but really this problem is both platform and language agnostic.

sentences:
Mesh getting offset on combine because of worldmatrix When I try to combine my mesh, it get offset to an other position, but the collider is still at the same place (because i dont delete and add it again). I saw a fix on internet that is to do:

Matrix4x4 myTransform = transform.worldToLocalMatrix;
combine[i].transform = myTransform*meshFilters[i].transform.localToWorldMatrix;

which worked in one of my script, but I just cant get it to work in this one. How can it be fixed ?

Vector3 cb = Vector3.zero;
Vector3 n = hit.normal;
Vector3 p = hit.point;

if(n == new Vector3(1.0f,0.0f,0.0f) | n == new Vector3(-1.0f,0.0f,0.0f))
{
    cb = new Vector3((n.x*0.5f)+p.x,Mathf.Round(p.y),Mathf.Round(p.z));
}
if(n == new Vector3(0.0f,1.0f,0.0f) | n == new Vector3(0.0f,-1.0f,0.0f))
{
    cb = new Vector3(Mathf.Round(p.x),(n.y*0.5f)+p.y,Mathf.Round(p.z));
}
if(n == new Vector3(0.0f,0.0f,1.0f) | n == new Vector3(0.0f,0.0f,-1.0f))
{
    cb = new Vector3(Mathf.Round(p.x),Mathf.Round(p.y),(n.z*0.5f)+p.z);
}
GameObject cub = Instantiate(cube,cb,Quaternion.identity);
GameObject dupli = Instantiate(hit.collider.gameObject,hit.collider.gameObject.transform.position,Quaternion.identity);
MeshFilter[] meshFilters = new MeshFilter[]{cub.GetComponent<MeshFilter>(),hit.collider.gameObject.GetComponent<MeshFilter>(),dupli.GetComponent<MeshFilter>()};
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
Matrix4x4 myTransform = meshFilters[2].transform.localToWorldMatrix;
combine[0].mesh = meshFilters[0].sharedMesh;
combine[1].mesh = meshFilters[1].sharedMesh;
combine[2].mesh = meshFilters[2].sharedMesh;
combine[0].transform = meshFilters[0].transform.localToWorldMatrix;
combine[1].transform = meshFilters[1].transform.localToWorldMatrix;
combine[2].transform = meshFilters[2].transform.localToWorldMatrix;
meshFilters[2].mesh = new Mesh();
Vector3 sP = meshFilters[2].gameObject.transform.position;
meshFilters[2].gameObject.transform.position = Vector3.zero;
meshFilters[2].mesh.CombineMeshes(combine);
meshFilters[2].gameObject.transform.position = sP;
Destroy(meshFilters[0].gameObject);
Destroy(meshFilters[1].gameObject);

sentences:
Why it isn't possible to get a progress in SceneManager.LoadSceneAsync between 0.0 and 0.9? I am trying to understand why does SceneManager.LoadSceneAsync progress always jumps from 0.0 to 0.9, no matter how big a scene can be.

To try trigger smoother progress of the scene being loaded, I've tried the following:

Generate a large scene from an EditorWindow, containing tens of thousands of objects referencing thousands of assets. Loading this scene didn't produce the intended behavior, rather, it ended up being exactly the same (jumps from 0.0 to 0.9) but with a huge lag at the end since there are many objects.

According this behavior, I am now considering that the supposed asynchronicity in SceneManager.LoadSceneAsync is just about the loading of the scene file itself, not processing its content for being usable by Unity.

Is this correct?

An example on how to load a large scene and report its progress would be appreciated :)

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:
Should Vector3 inherit from Vector2? I'm creating a couple of classes Vector2 (X & Y) and Vector3 (X, Y & Z), but I don't know whether to make Vector3 inherit from Vector2, or whether to re-implement the member variables m_x and m_y again? What are the pros and cons of each side (inheritance vs redefinition).

Edit: I'm using C++ (VS2010).

sentences:
Best way to manage sprite sheets on Android using NME I'm creating a 2D game for mobile touchscreen devices, specifically Android and iOS. I would like to know what is the best way (regarding performance and best practices) to manage sprite sheets.

Should I create different sprite sheets (for ldpi, mdpi and hdpi) and then scale according depending on the screen resolution or there is a better solution?.

I know that maybe the solution that someone could provide me would be platform independant but I'm using the NME framework (http://www.nme.io/), perhaps you know a good solution using this framework.

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:
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:
Box2D crash on collision I've got a really strange problem, that I can't solve whatever I try. So it's the following:
I have 2 body's in Box2D, one, the player is a dynamic body, the other one, an obstacle is a static one. Now everything is fine, I can move my player around and everything, however as soon as he touches the obstacle, my game instantly crashes, no errors or something. I don't add or destroy body's while the game is ticking, so there shouldn't be a problem here ...... has anyone experienced something comparable and got a solution for it ?

Sadly I can't upload code right now as I'm on my phone, but I'll try to add some later

sentences: How do I remove the window border in Godot? I want to show my Godot engine game in a borderless window, but not fullscreen. I want to just have the game view visible on screen with no title bar or window chrome.

sentences:
Marking up 2D polygon perimeter on an image I'm working on a 2D game in JavaScript using the Web canvas. I plan to use AABB proximity detection and then point, line and polygon on polygon collision detection.

Which means I need to define polygon perimeters for each of my potentially colliding objects. I have to come up with a list of pivot-point-relative coordinates for each vertex on the perimeter of the object's sprite.

This is a tedious and laborious task to do manually, and it seems like it's something that lots and lots of game developers must have had to do many many times.

What is a more efficient workflow for marking up collision polygons on an image or sprite?

sentences:
Collision detection in 2D games I am making a basic 2D platformer. I want to get the relative position of one rectangle to another.

This is how I do it right now:

const float offset = 5;
if (x1 <= x2 && x1 + w1 >= x2)
            {
                if (Math.Abs(y1 + h1 - y2) <= offset)
                    return CollisionType.Top;
                else if (Math.Abs(y1 - h2 - y2) <= offset)
                    return CollisionType.Bottom;
                else if ((y1 <= y2 && y1 + h1 >= y2) || (y1 >= y2 && y1 <= y2 + h2))
                    return CollisionType.Left;
            }
            if (x2 <= x1 && x2 + w2 >= x1)
            {
                if (Math.Abs(y1 + h1 - y2) <= offset)
                    return CollisionType.Top;
                else if (Math.Abs(y1 - h2 - y2) <= offset)
                    return CollisionType.Bottom;
                else if ((y1 <= y2 && y1 + h1 >= y2) || (y1 >= y2 && y1 <= y2 + h2))
                    return CollisionType.Right;
            }

            return CollisionType.NoCollision;

Here how this function works (or at least how I suppose it to work):

Using this function, I often have collision bugs, but I cannot understand a global rule of when it happens. I don't think that a bunch of if blocks would solve the problem.

I need a collision detection function that receives two arguments of type Entity (The class can contain any fields or functions, but it must have an X, a Y, a Width and a Height) The function needs to return the relative position of the first rectangle to the second.

What improvements would you suggest to my current function or is there a better system for collision detection in 2D games where one needs to get a relative position instead of a simple true false?

sentences:
Enemy moving towards Player in a 2D setting? i want to apologize if this seems so basic, but I'm having trouble having an Enemy move in my Player's Direction in a 2D Top-Down game.

I already saw a lot of other answers but they all use the .LookAt() and .Forward but i'm not using rotations so i cannot just move them in the direction they are looking at, i just need to move them along X and Y, and i managed to do a pretty horrible workaround :

//I tried getting the difference between player and enemy positions, but this is relative, and slows down the closer it gets to the player.

Vector2 distance = new Vector2(player.position.x - enemy.position.x, player.position.y - enemy.position.y);

enemy.AddForce(distance * walkspeed);

So, how could i make the Enemy move in the direction the Player is, but with a constant speed?

sentences:
Throttling or adding delays between OnTriggerEnter2D calls I have 2 game objects: Explosion and Enemy. At any given point, an enemy can collide with multiple Explosion game objects at the same exact time. This causes a few issues when I'm trying to destroy the Enemy game object.

This is the function that destroys the game object:

bool isDead = false;

public void KillCharacter () {
  if (!isDead) {
    isDead = true;
    Debug.Log ("kill enemy...");
  }
}

If I use OnTriggerEnter2D inside the Enemy script, like so:

void OnTriggerEnter2D (Collider2D other) {
  if (other.gameObject.tag == "Explosion") {
    KillCharacter();
  }
}

In case two explosions spawn on the position of the enemy, Debug.Log inside the KillCharacter function will fire twice, even though I set the isDead bool to true on the first run.

The only solution I found was to call KillCharacter from the Explosion script, like so:

void OnTriggerEnter2D (Collider2D other) {
  if (other.gameObject.tag == "Enemy") {
    other.gameObject.GetComponent<Enemy> ().KillCharacter ();
  }
}

Is there a way to run the OnTriggerEnter2D from the Enemy script, as I originally intended? Or is having the KillCharacter handle all the death logic and calling it from outside good enough?

sentences:
in unity, lightmap comes out blurry on android device as you see, shadow is blurred. (see the tree's shadow)

What settings should I add?

sentences:
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:
Rotate an object with 'Quaternion.Slerp' in world space I'm currently working on a multiplayer skydiving Unity game in which i rotate the players like this:

transform.rotation = Quaternion.Slerp(transform.rotation, desiredRotation, delta);

Now this rotates the player relative to it's own rotation. I know rotation in world space is done by multiplying the quaternion of the desired positon with the quaternion of the current position like this:

localRotation = transform.rotation * desiredRotation
worldRotation = desiredRotation * transform.rotation

But how do i slerp to that position in world space?

Thank you all in advance and have a great day!

sentences:
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:
Random point on a square floor I have a flat 10x10 surface (floor) made out of cubes of 1x1x1.

I am spawning objects from the "sky" and I want them to fall on random points of the surface without exceeding the surface limits.

Is there anything similar to Random.onUnitSphere to handle this case?

sentences:
Store and retrieve different objects on a tile (I hope the title is clear enough, if not feel free to suggest a better one)

I'm trying to make a simple tile-based map for a college project in Java. But I'm stuck on how to literally place things on my map. On the programming side of things, I still haven't got into graphics on this. As of now I have:

A "Robot" class, which implements an "Attackable" and "Spawnable" interface, the robot can attack and moved

A "Obstacle" class, the obstacle too can be attacked, so it implements Attackable, Spawnable, but it also can be pushed by a robot (methods by the class itself).

A "Station", which is nor attacable nor can be pushed, so it only implements Spawnable and other specific methods.

A "GameWorld" class which hold the map (a 2D array of Tiles) and various methods.
A "Tile" class (which is arrayed to create the map). It has a boolean "Occupied" (which doubles as a collision too). Previously it stored just a single Attackable variable, because both Obstacles and Robot can be attacked, so I just tought it would be easy to just store them as such on the map for when I need to attack something, and then use some other reference to Robot instances when I need to move the robots and have a reference to the station in GameWorld in order to use that. But then I remembered that the Obstacles need to be moved too, so it wouldn't really work.

Now I'm thinking about having two maps, basically, an AttackableMap[][] for the attackable object (which would store both robots and the obstacles) and a ObstaclesMap[][] for the obstacles alone (with tiles occupied by robots set as occupied). Which would obviously mean having two tile classes, one to hold each kind of object.

But it feels cheap, I think. It uses a lot of memory and I think it might be hard to render at a later time. But having only one map would mean having to check what kind of object I'm getting and I'd have to do loads of casts and I want to avoid that.

So, I think, there must be a better way to do this. How do other people do it then? So basically my question is... How can I store different "things" on a tilemap in a better way? Is there some technique widely used?

What I've come up with feels rigid, if I wanted to add another kind of object that can be placed on the map (like a mine) I would need to create another map entirely, another tile, write new methods... There must be some flexible (and not too complex) way to have some freedom in this aspect.

sentences:
Real-time Debugging Techniques There's nothing quite like the routine of tweaking a variable, compiling code that takes a few minutes, executing the code, realizing that your tweak was in the wrong direction and repeating the process all over again.

I would like to start interacting with my game logic while a session is in progress. What are some of the ways you've handled doing this?

I would be open to hear solutions for iOS, C/C++ and C#/XNA.

sentences:
How to detect mouse over for UI image in Unity 5? I have an image that I have setup to move around and zoom in and out from. The trouble is the zoom can be done from anywhere in the scene, but I only want it to zoom when the mouse is hovering over the image. I have tried to use OnMouseEnter, OnMouseOver, event triggers, all three of those without a collider, with a collider, with a trigger collider, and all of that on the image itself and on an empty game object. However none of those have worked...So I am absolutely stumped...Could someone help me out here!

Here is my script:

    private float zoom;
    public float zoomSpeed;
    public Image map;

    public float zoomMin;
    public float zoomMax;

    void Update () {
        zoom = (Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime * zoomSpeed);
        map.transform.localScale += new Vector3(map.transform.localScale.x * zoom, map.transform.localScale.y * zoom, 0);
        Vector3 scale = map.transform.localScale;
        scale = new Vector3(Mathf.Clamp(map.transform.localScale.x, zoomMin, zoomMax), Mathf.Clamp(map.transform.localScale.y, zoomMin, zoomMax), 0);
        map.transform.localScale = scale;
    }

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:
White background in icon for Google Search on mobile device We experience an issue with our game icon related to google search on mobile device. Here is a screenshot:

As you can see, our ccon has a white background on a green wall. We are aware that we have to use a 512x512 PNG with alpha channel.

The shown image is a 80x80 JPG which is, I guess, created out of our icon by using some background color. Could it be that we have to set this color somewere in the store or maybe in the app manifest?

Thanks for you help in advance ;)

sentences:
How to correctly implement 'layered lighting' with Box2D-Lights How does one only allow Box2D-Lights to affect one and only one OrthographicCamera.

After researching, I found the following answer. This answer goes into detail about how to prevent one camera from being lit by the RayHandler by blending layers of the FBO object. I'm unsure if this answer will produce the results I require. If it indeed does create the results I require, how can I do so more simply/elegantly.

For example:

1) In this image you can see ambient light is set to:

this.rayHandler.setAmbientLight(new Color(0.1f, 0.1f, 0.1f, 0.25f));

2) There is a point light on the far right with purple colour.

4) There is a star background on a different OrthographicCamera to the other objects.

When looking at this image, you notice that the stars are brighter near the planet due to the point light casting light on the background. However, I require the inverse. The stars should be brighter when light is not drowning them out. Knowing that the star background is on a different OrthographicCamera how can I allow the texture to be completely unaffected by light so the ambient light of the RayHandler does not dim them further away from the planet.

The texture used for the stars contains transparency. The black is created using:

Gdx.gl.glClearColor(0f, 0f, 0f, 1);

Preferably, I would like to be able to simply place cameras into two lists, affected by light and not affected by light. How does I produce the results I require?

I can manage to get the lighting to ignore the star background by rendering it after the RayHandler has been updated and rendered, however this obviously causes the star background to be drawn over the top of everything like so:

After achieving this, I was reminded of the OpenGL depth buffer. I enabled it using Gdx.gl.glEnable(GL20.GL_DEPTH_TEST), I then attempted to change the z coordinate of the spritebatch used in the camera for the star background by using SpriteBatch.getTransformMatrix().idt().translate(0f, 0f, -1f) however after playing with the values of the other sprite batches I can still not get the effect I require.

It is possible that the above method did indeed work, although I am aware that using the depth buffer incorrectly can cause issues with alpha blending? Making it seem like my problem was not fixed because the planet became translucent.

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:
3D Translation using only distance and angles So I'm starting to foray into 3D game programming, but I've hit something of a snag.

I have an object I want to move around.  It should always move either forward or backward relative to its local Z axis, and otherwise change directions by changing its local X and Y rotations.

Now doing this in 2D is no problem.  When I only consider the X-Z plane, the following code works fine:

m_Position.x -= (float)sin(m_Rotation.y * Pi / 180) * Speed;
m_Position.z -= (float)cos(m_Rotation.y * Pi / 180) * Speed;

And when only considering the Y-Z plane, the following works fine:

m_Position.y += (float)sin(m_Rotation.x * Pi / 180) * Speed;
m_Position.z -= (float)cos(m_Rotation.x * Pi / 180) * Speed;

But when combining the two, they don't work.  Now I didn't expect them to work just straight up stuck together like that, since the Z value is getting conflicting signals.  But I'm not sure where to go from here.

I've read a bit about matrix math, and that seems the way to go, but the tutorials I have found are either difficult to follow, or they focus on rotating a point around the origin (or translating if you already have a translation vector, which is the thing I'm looking for).  The clearest one I've found is this, but I'm not sure how to adapt the rotate-around-origin matrix math to the move-in-direction-of-angle matrix math.

My extremely rudimentary understanding of matrix math would suggest that translations Ta and Tb along angles A and B, if A is a rotation around the Y axis and B around the X axis, would be represented as:

Xa = x*sinA + y*0 + z*0 + w*0
Ya = x*0 + y*1 + z*0 + w*0
Za = x*0 + y*0 + z*cosA + w*0
Wa = x*0 + y*0 + z*0 + w*1

Xb = x*1 + y*0 + z*0 + w*0
Yb = x*0 + y*sinB + z*0 + w*0
Zb = x*0 + y*0 + z*cosB + w*0
Wb = x*0 + y*0 + z*0 + w*1

But I don't know whether that's right, and what I have to do with them.  Multiply them together?  Add the resulting vectors?  Am I even close?

Can someone point me in the direction of good resources for learning this sort of thing?

EDIT:  Just to be clear, I have the object's current (X,Y,Z) and its (Roll, Yaw, Pitch).  I want it to move in from the former in the direction defined by the latter.  I know I can use OpenGL to do this transformation on a purely visual level by just rotating first and then translating, but I need to have access to the new (X,Y,Z) for things like collision detection, indexing, etc.

EDIT 2: I've created the following code after finding this, but I'm not 100% sure if it's correct, since there are also issues with my visual rotations at the moment.  It seems to work, at least superficially.  Thoughts?

float X = (float)sin(m_Rotation.y * Pi / 180) * (float)cos(m_Rotation.x * Pi / 180);
float Y = (float)sin(-m_Rotation.x * Pi / 180);
float Z = (float)cos(m_Rotation.y * Pi / 180) * (float)cos(m_Rotation.x * Pi / 180);

sentences:
How can I implement 2D cel shading in XNA? So I was just wondering on how to give a scene I am rendering a hand drawn look (like say Crayon Physics). I don't really want to preprocess the sprites and was thinking of using a shader. Cel shading supplies the effect I want to achieve, but I am only aware of the 3D instances for it.

So I wanted to ask if anyone knew a way to get this effect in 2D, or if cel shading would work just as fine on 2D scenes?

Edit:The reason why i didn't want to do preprocessing ,was that i almost don't have anything to prepossess.I have some material textures ,which are basically just black and white images and using them i create textures from specific vertices ,which represent entities in the game (mostly physics based ones).So i wasn't sure how to processes the textures for the texture mapping to work as i intended.Thanks for the help!

sentences:
How can I test if one point can "see" another point. (XNA) I want to test if my enemy can see the player, however I want this to be pixel-perfect.

I already have all of the solid objects drawing into a separate render state. It should be noted that every solid object is changing and warping all over the place constantly. I cannot check individual walls because a distortion effect is applied to all of them. The walls blend together.

Essentially it would lerp between the enemy's position and the player's position and see if there are any pixels that have an alpha value of greater than 0.
The rotation of the enemy and the player do not matter.

All of my attempts at doing this on the cpu have worked, however they slowed the game down dramatically. All of my attempts at going this on the gpu just didn't work at all.

What is the most efficient way of doing this?
Is there any way to do this in the gpu?

Edit: There is no geometry at all. The walls are completely amorphous.

I did not realize that global variables were constant in hlsl until after I wrote this:

sampler s0;
texture tex;
sampler tex_sampler = sampler_state{Texture = tex;};

float2 screenSize;
float2 from;
float2 to;
float2 impact;
int impacted;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    from /= screenSize;
    to /= screenSize;

    impacted = 0;

    for (float i = 0; i < 1; i += 1.0f / length(to - from))
    {
        float2 test = lerp(from, to, i);

        if ( (tex2D(tex_sampler, test)).a )
        {
            impacted = 1;
            impact = test * screenSize;
            break;
        }
    }

    return tex2D(s0, coords);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

The solid pixels would be passed into the "tex" variable.
I would read the "impacted" and "impact" variables after one pass on a 1x1 texture.
hlsl just doesn't want to let me do this.
Apparently global variables are implicitly constant.
Is there another way of doing this?

on the variable syntax page it says "Global variables are considered const by default (suppress this behavior by supplying the /Gec flag to the compiler)."
How do I add the /Gec flag to the compiler?

I also wrote this, but it slowed the game down:

private bool CanSee(Vector2 from, Vector2 to)
{
    Color[] t = new Color[target_solid_final.Width * target_solid_final.Height];
    target_solid_final.GetData(t);

    for (float i = 0; i < 1; i += 8.0f / (to - from).Length())
    {
        Vector2 test = Vector2.Lerp(from, to, i);
        Point test_p = new Point((int)test.X, (int)test.Y);

        if (viewportRect.Contains(test_p) &&
            t[test_p.X + test_p.Y * target_solid_final.Width].A > 0)
            return false;
    }

    return true;
}

sentences:
Render error in xna DrawPrimitive for Assimp Mesh I am trying to render the vertices of a scene with a cube I exported as an OBJ from Blender. The 8 vertices become 24 when imported into XNA but when I render it I dont see all faces. This is not an issue of missing meshes because I'm pretty sure this is being stored as the first and only mesh. I suspect this is because of the vectors defined in the Assimp Mesh object but I can't seem to find any help for this.

THIS IS SOLVED! The code shows how to render a 3D model using only Assimp and XNA with vertex and index buffers. oScene is the Scene object imported using Assimp. This code only draws faces in a single color without textures.

Here is the relevant code:

   private void SetUpVertices()
    {
        mMesh = oScene.Meshes[0];
        vertices = new VertexPositionColor[mMesh.VertexCount];
        indices = new  short[mMesh.FaceCount*3];

        int i=0;
        foreach (Vector3D mVec in mMesh.Vertices)
        {
            vertices[i] = new VertexPositionColor(new Vector3(mVec.X, mVec.Y, mVec.Z), Color.Red);
            i++;
        }

        int f = 0;
        Face mFace;
        for (i = 0 ; i < mMesh.FaceCount*3 ; i=i+3)
        {
            mFace = mMesh.Faces[f];
            f++;
            indices[i] = (short)mFace.Indices[0];
            indices[i + 1] = (short)mFace.Indices[1];
            indices[i + 2] = (short)mFace.Indices[2];

        }

        vertexBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
        vertexBuffer.SetData(vertices);

        indexBuffer = new IndexBuffer(device, typeof(short), indices.Length, BufferUsage.None);
        indexBuffer.SetData(indices);

    }

    private void SetUpCamera()
    {
        cameraPos = new Vector3(0, 5, 9);
        viewMatrix = Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f);
    }

    protected override void Draw(GameTime gameTime)
    {
        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
        effect = new BasicEffect(GraphicsDevice);
        effect.VertexColorEnabled = true;

        effect.View = viewMatrix;
        effect.Projection = projectionMatrix;
        effect.World = Matrix.Identity;

        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            pass.Apply();
            device.SetVertexBuffer(vertexBuffer);
            device.Indices = indexBuffer;
            device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes[0].VertexCount, 0, mMesh.FaceCount);
        }

        base.Draw(gameTime);
    }

sentences:
How can I create a height-based volumetric fog? Recently, I have been looking for techniques to make volumetric fog on some Y position level of the game world. But all I have found are some fog made by using particle system or built-in engine fog that doesn't really fit what I'm looking for.

In my case, I need a fog that is both efficient and dense. It should be all over the gameworld, but obviously, for performance reasons, it can be rendered only as a part of a camera or shader and look like it's moving though it's just an illusion. I could set a particle system if it's the best choice, attach it to the camera and make it move.

So the main question still stays - how can I implement a volumetric fog that is both dense and performs efficiently?

As a particular engine I'm using, it's Unity.

As an example what I mean, here is the link to a game with the effect I'm looking for: Astromike

sentences: Generate random position within object I have a plate object which is generated somehow (I don't care how), now I want to put another object within this object on random position. Lets say that I want to put random trees on this plate. How can I achieve this in Unity. I had read for bounds but I don't know how to use it to generate position for the tree.

sentences:
How do I implement a 2D camera in JPanel? I'm trying to create a mario-esque game in Java and am at the point of implementing a camera.

Following normalocity's example, I understand the difference between the GameWorld and the Camera that follows that objects within the context of the world.

From a technical perspective,

I have JFrame that adds GamePanel (extends JPanel) and sets its size to 500,500 (that's the window size that I see pop up when I run the program).

Before learning about GameWorlds and such... I was using GamePanel as a generic JPanel to paint my objects and to implement boundary rules, timer, paintComponent, scoring, keyboard input, collision check... All painted objects are placed and shown relative to GamePanel's coordinates/size.

Now I'm trying to implement a Camera...

Is Camera a smaller JPanel added to the GamePanel? How do I make my GamePanel more like a GameWorld with a huge size (10,000 x 10,000 px), and only render everything on that GamePanel through the Camera JPanel?

From the GamePanel, I've tried altering the coordinates of the Camera using arrow keys... the camera coordinates of course change, but the objects painted on the GamePanel do not move with respect to the coordinates of the Camera.

EDIT: I'm using JPanel because that's what I'm familiar with. If you have a better suggestion on game dev in Java, please let me know!

sentences:
How to decompose a 4x4 TRS transformation matrix with negative scale? As the title says I need to decompose 4x4 TRS transformation matrices and extract the proper scale vectors and the proper rotation vectors (or rotation quaternions).
I know how to extract those information when the upper 3x3 matrix determinant is not negative. The problem is that those matrices can have that negative determinant and as far as I could understand, this negative determinant indicates a flip or mirrored transformation.
What do I have to do to extract the proper values for scale and rotation in those cases?

sentences:
coordinate transformation I have two coordinate systems, like so

How can I transform a point on the one of the coordinate system to other ?

Pxyz = M . Px'y'z'    what is M ?

sentences:
What GPU culling techniques are appropriate for voxel spheres other than octrees? I'm creating a dynamic smooth-voxel based world in the shape of a sphere. Right now my current approach is to spherize a cube, generate voxel terrain on each of the six patches, and then use octrees to cull the data further.

Octree's are best served with cubes. Is there a better system for storing/accessing data in a sphere? I've heard some talk of Octree's not being the best way to store voxel data, even for cube worlds. How can this be? What would be better? A Hash Table?  Surely multidimensional arrays wouldn't be faster? Perhaps it's just more of a design decision than performance? As in, maybe someone didn't like chunks popping in so they would rather load individual rows and columns?

If it matters, I'm probably going to keep relevant geometry in GPU memory and stream in the surrounding area over time as the player gets closer to it from main memory. I bring this up because I'm really not sure if GPU memory benefits from any particular structure. All I really know is that the parallel powers of the GPU are, well, unparalleled (I had to). How can I tap into that?

sentences:
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: Does triangle-plane clipping in 3D always produce a triangle? When you clip a triangle against a plane, will you always get a triangle out? Are there perhaps cases where you don't get a triangle out of clipping it against a plane?

sentences:
How can I create a button with an image in libGDX? I am new to LibGDX. I am trying to develop a game for Android (so it will support different screen sizes), but I don't know how to put a button with an image. I tried ImageButton but I can't resize it. I have put TextButtons in my app and it works and resizes fine too.

Any suggestions ?

sentences:
What does tex1D do with a 2d texture? If I call tex1d from my pixel shader on a texture that has been initialized as a texture2d will it treat the data as a one dimensional array and then just take the element at whichever position you specify?

For instance if you have a 10 x 10 texture(that would be a one dimensional array 100 elements in length) and you call tex1d(mySampler, 0.95) will it give you back element 95?

sentences:
Creating runtime mesh colliders for roads in Unreal Engine 4 I want to create several mesh colliders in game at runtime. By mesh colliders I mean "complex collision".

The meshes are for curved roads. The roads will be rendered using hierarchichal instanced static mesh, the visible road meshes will be high poly detailed meshes. For collision purpose I will create simple low poly meshes at runtime and I want collision checks for them.

I also want these meshes to be stored in single actor for easy handling.

Is there any existing class or plugin that does this, or a way to implement it myself? I have checked procedural mesh component and runtime mesh component but they don't seem to have what I want.

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:
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:
Shadow artifacts caused by filtering I'm working on a shadow-mapping implementation for an OpenGLES 2.0 environment (Stage3D in Flash to be exact). This is how my current implementation works:

Render the scene to backbuffer.
Render depth map from the light's point of view.
Render shadows on a texture from the camera's point of view.
(Do blur and other effects to improve the shadow texture, not implemented yet)
Render the shadow texture to the backbuffer with multiply.

Some pictures to help explaining. Note that the bunny is floating in the air on purpose.

Shadows rendered on a texture from the camera's view.

The final scene with shadow texture rendered on top with multiply.

The problem is the unshadowed pixels at the bottom of the bunny. Because the shadow texture is rendered with linear filter, the edge of the shadow loses its sharpness. This is mostly a good thing but not everywhere. I would like to do more filtering effects on the shadows but they would cause even bigger issues.

I haven't encountered this kind of problem in any tutorials or forums so either there is an obvious solution for this or there is something wrong with my approach. The question is, can I solve this somehow using my current approach? Or is there a bigger gap in my method?

sentences:
How does entity communication work? I have two user cases:

How would entity_A send a take-damage message to entity_B?
How would entity_A query entity_B's HP?

Here's what I've encountered so far:

Message queue

entity_A creates a take-damage message and posts it to entity_B's message queue.
entity_A creates a query-hp message and posts it to entity_B.  entity_B in return creates an response-hp message and posts it to entity_A.

Publish/Subscribe

entity_B subscribes to take-damage messages (possibly with some preemptive filtering so only relevant message are delivered).  entity_A produces take-damage message that references entity_B.
entity_A subscribes to update-hp messages (possibly filtered).  Every frame entity_B broadcasts update-hp messages.

Signal/Slots

???
entity_A connects an update-hp slot to entity_B's update-hp signal.

Is there something better? Do I have a correct understanding of how these communication schemes would tie into a game engine's entity system?

sentences:
How do you calculate game map changes, over time, when the user is not online? With a game like "Farmville", there is both processing during gameplay, and when the user is offline (plants are always growing, for example). Many of the game maps elements depend on time.

Is there a trick to make this scale?  How can you possibly calculate 1 million users maps being modified every couple of seconds? Some of these games alert you, when things have changed, so it is not like they calculate everything when you login to the system.

How do you calculate game map changes, over time, when the user is not online?

sentences:
Would a custom mod built for RakNet be automatically usable with Unity? Context: I'm interesting in developing a security module for servers that handle mobile games, and I'd like it to be usable by the most people possible. So I'm trying to decide what server software I want to build it for.

I'm looking at RakNet, and it's appealing because it's available two ways: independently and as part of the networking solution of Unity3D. So it's software that gets used by developers who want to use Unity3D as well as those who don't.

My question: if I create a modification that implements my security system inside RakNet, will that solution be automatically compatible with Unity also?

sentences:
SDL Texture not scaling to the renderQuad I'm building a Space Invaders clone and using a sprite sheet for my invaders, but when I grab the texture from the sprite sheet, it doesn't scale to the renderQuad that I set.
This is the original sprite map - https://imgur.com/YHdc552 (I'm only using the sprites in the left 2 columns)
This is the output - https://imgur.com/jYlcSpr
This loads in the BMP file
bool AnimationManager::loadFromFile()
{
    free();

    SDL_Surface* loadedSurface = SDL_LoadBMP("SpriteSheet.bmp");
    if (loadedSurface == NULL)
    {
        return false;
    }
    else
    {
        spriteSheetW = loadedSurface->w;
        spriteSheetH = loadedSurface->h;
        InvaderSpritemap = loadedSurface;
        loadMedia();
        return InvaderSpritemap != NULL;
    }
}

This blits the surface from the spritesheet, this is then converted into a texture
SDL_Texture* AnimationManager::getTexture(SDL_Renderer* renderer, int health, int invaderType, int animationState)
{
    SDL_Surface* invaderSurface = SDL_CreateRGBSurface(0, 40, 40, 32, 0, 0, 0, 0);
    SDL_Texture* invaderTexture = NULL;

    switch (health)
    {
    case 1:
        SDL_BlitSurface(InvaderSpritemap, &invaderSprites_redHealth[invaderType][animationState], invaderSurface, NULL);
        break;
    case 2:
        SDL_BlitSurface(InvaderSpritemap, &invaderSprites_orangeHealth[invaderType][animationState], invaderSurface, NULL);
        break;
    case 3:
        SDL_BlitSurface(InvaderSpritemap, &invaderSprites_greenHealth[invaderType][animationState], invaderSurface, NULL);
        break;
    }

    invaderTexture = SDL_CreateTextureFromSurface(renderer, invaderSurface);
    return invaderTexture;
}

This draws the invaders to the screen.
void Invader::draw(SDL_Renderer* renderer, SDL_Texture* text)
{
    SDL_Rect renderQuad;
    renderQuad.x = XPos;
    renderQuad.y = YPos;
    renderQuad.w = Width;
    renderQuad.h = Height;

    SDL_RenderCopy(renderer, text, NULL, &renderQuad);
    SDL_RenderPresent(renderer);
}

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:
Aim at moving target (or predicting target's position at time it takes for projectile to hit it) I have a game where I know the location and velocity of my target. I know my own location and the speed of my projectile. I want to determine either

the location of the intersection between my projectile fired and the target, or

the time taken for my projectile to intersect the target

All entities are travelling with constant speed and direction which makes life easier. I have been trying to work out the maths for some time but cannot quite get it right. I know that the predicted location of the target intersecting the projectile will be

Pp = Tp + Tv * t

Where Pp is the predicted position, Tp is the current target position, Tv is the target velocity, and t is time.

I also know that

t = |Pp - Sp| / Bs

where Sp is my (source) position and Fs is the projectile (bullet) speed. But I cannot figure out a way to solve this to get either Pp or t.

I know that all speeds are constant. I am free to aim in any direction and I know that the projectile is faster than the target therefore a hit is guaranteed

Can anyone enlighten me? Thanks

I found a website detailing one method but this doesnt seem to work (http://howlingmoonsoftware.com/wordpress/leading-a-target/). My verification method to determine if it worked was to use the predicted position to determine the time for the target to reach it, and for the projectile to reach it. These should be very similar but in my game they are out by almost a factor of 2.

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 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:
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:
Fastest way to render isometric world with moving entities? I've got an isometric diamond-shaped world.
The world consists of isometric planes like rooms. The walls and floors of the rooms and all obstacles and items in the rooms are isometric entities.
So I have a list with each existing object in the world. Each object has its own coordinates. x, y, and z.
x is from top to right bottom, y is from top to left bottom, z is straight up into the air.
Each object has also an isometric width and height as property.

Now I have to render the world correctly. I'm quite sure the only hard step is to sort each object by its depth, and this isn't that hard when nothing changes in the world. But of course everything changes...
I want to figure out a sorting system which is very fast, so it doesn't do too much unnecessary work. I ended up with multiple articles, saying a pigeonhole sort is the way to go. But is this really the right solution?
And doesn't this cause rendering glitches? I also read that I should use topological sorting. (https://en.wikipedia.org/wiki/Topological_sorting).

sentences:
Unity : orthographic camera and shadow When using an Orthographic Camera, the shadows appear to be of poor quality.

How can I display smooth shadows?

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:
basic Theory that we need to know before start learning game programming Came from Java (and fairly C++) and I am very confident in my programming skill
Now I'm about to move to something more interesting, game programming
The thing is as I am new to this,

I need to know some basic Theory that we need to know before start learning game programming
You know there has to be some foundation of theory that we need to know

as in web Programming, basic Http Protocol, ftp and all those theory
maybe something like Collision Detection, Vector, and all that
you know I don't wanna get too excited about it and then lost at some point and giving up, like most of the newborn

This is purely a hobby so, there's nothing like "I am going to make the next hallo game"
a pretty lame game is sufficient
thank you

EDIT : You're right its too broad and unclear
lol I forgot I'm sorry
I mean Its for developing 3D Game on Desktop, And Android
And No, No Iphone and not web either
And about the game Engine, I can decide myself, but if there are suggestions that'd be okay
If its still unclear you can edit it please to prevent this kinda question asked again

sentences:
Need to programatically muffle game sounds So I work on a multiplayer game that is set in space. There are essentially two environments for players to be in: inside a sealed space station (where there is air and thus sounds) and outside the station in the vacuum of space (where there is no air and no sound to hear).

For a while now, we've had it so that you cannot hear any of our game's sound effects while floating in a space with no air, and while that might be realistic, it's not very fun when the game is completely silent sans background music.

I'd much rather find some way to dynamically distort the sounds on the fly before they are played so that they seem to be muffled or dampened. I have no sort of background in making sounds or doing much of anything with them and all my searches have amounted to nothing; mostly finding things about sound editing programs.

The project is made in a C based language for game programming that is really obscure called Dream Maker or Byond. I can't seem to find any built-in features that are able to solve this problem for me. Any help would be much appreciated.

sentences:
OpenGL ES - jagged edge I need to render roads and some direction marks on top of them. I render roads as triangled geometry, same goes for marks (see picture - road is purple, mark is red, ignore z-fighting).

Problem goes for edge of road. Is too much "jagged" and not straight. Is it result of perspective projection (thats what I believe). And how can it be improved? There is no texture, colors are filled directly in fragment shader.

EDIT:

I have tried solution from duplicite answer, but jagged edges are still there. Even if multisampled EGLConfig is selected.

sentences:
Design patterns for live coding/script reloading I would like to make C++/Lua combo and write scripts for a game with live script reloading. What design patterns should I be aware of so not to cause me unnecessary pain?

For example if I have a simple MUD game with enemies and maps, I can bind a Lua function which would remove all the enemies and recreate them based on the data(which I would modify with Lua script).

That sounds easy, but haven't done so I think there may be some deadends without proper planning.

What are the best design patterns and solutions for live script reloading?

sentences:
Handling increasing numbers of users (server) For this post, we'll assume my game is multiplayer chess as it essentially requires the same functions. User logs in to the server and requests a game - the server provides a simple matching service and once done, they start the game. They get 30 seconds timed by the server per turn with 6 players in each game and however many spectators (probably very limited).

I would like to know how you would scale this.

I've considered two options:

Option 1

1) Main server to handle login / match making (which regardless of user numbers should be a fairly easy task)

2) Start new Node servers for each game that close when the game ends.

I'm not entirely sure how this could be implemented yet. (i.e. would the user connect to the main server still and the requests just be passed to the new server or would the user change connection to the new server and then back again when done? changing connection would reduce the load even further and as the two servers won't require communication between them, should be fairly simple)

Option 2

Have 1 Node server and somehow scale it.

--

Suggestions / input?

I'm planning on hosting on Amazon AWS and am well aware that the chances of my game even warranting this level of detail are probably nil but I'm taking this as a learning opportunity.

Thanks.

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:
Photon disconnected without any error/warning message I'm making online game with Photon and Unity. It was working fine, but suddenly players are disconnected without any warning or errors.

It just happens sometimes fast, sometimes slow, but always happened.

Before user disconnected, it seems it's little laggy and soon player disconnected.

So I changed the log level to all, and saw this message was printed right before player disconnected.

  DisconnectByServerLogic current State: Joined

What is meaning of this? I changed Photon App to new one, but didn't worked. I spent hours to figure out why this is happening, but no progress.

There is only one part that disconnects player, it's event function that invokes user pressed exit game, but it never called and there is no more function that disconnects.

If this causes from my code, I can fix it, but there is no code for disconnect and also there is no information why user keep disconnected.

Only information that I found was just above message but I don't know what that means. Is that mean Photon forcely disconnects player?

I'm stuck here in almost day but I couldn't find any problem in my code.

I'm using Free photon plan, and result of analysis:

4 CCU
1 Rooms Max(I don't know what this means)
15,558 Msg/s per Room Max
895.0 MB Bandwidth
0 Rejected Players

If someone who knows this problem, it will be very appreciate it gimme some advice. Thanks.

sentences: Do I really need to clear the renderer every iteration? Just a quick question about fine-tuning/optimization. If I'm making a 2D platformer with a parallax-scrolling background (meaning no two frames are the same) do I really need to clear my renderer for every iteration? The entire scene will be drawn-over anyways, so if I can get rid of one extra function every iteration, it could help to speed things up a little bit, though I realize that render-clearing is not a very expensive function. By the way, I'm using SDL2.

sentences:
I need to move a sprite from point A to point B. I have objX1, objY1, frames, and X2, Y2 I have a custom sprite class in Unity and I'm trying to make a method in where it moves from one point to another. Instead of using an Enumerator for time, I'm using real time game frames using static void methods inside of classes which inherit from a MainGame.cs script attached to the Main Camera, and this is called inside of MainGame's Update() method.

So what I have in the end are the following values:
SpriteID
OriginalX
OriginalY
MoveToX
MoveToY
CurrentFrames
TotalFrames

I'm not asking anyone to do the work for me, just that if there's a place I could be directed to in where I could find the math necessary to solve the problem that'd be a huge help. I'm not using any vectors here, just the raw math using only those variables. I don't know if someone has found an answer for calculating it based on update frames...

public class Sprite : MainGame {

public static int State = 0;
public static int CurrentFrames = 0;
public static int TotalFrames = 0;

 public static void Move(int SpriteID, int OriginalX, int OriginalY, int MoveToX, int MoveToY, int TotalFrames)
 {
    switch (State) {
    //init
       case 0:
       CurrentFrames = 0;

       State = 1;

       break;

       //run
       case 1:
       if (CurrentFrames < TotalFrames) {
       //do math here

          CurrentFrames++;
       }

       if (CurrentFrames >= TotalFrames) {
          State = 2;
       }
       break;

       //end
       case 2:
          //Reset values here
          //Shut off
          State = 3;
       break;
    }
 }
}

EDIT 10212016 456PM: What I've figured out so far, now...

if (CurrentFrames < TotalFrames) {
    DistanceX = MoveToX - OrigX;
    MoveForwardXFloat = (float)DistanceX / (float)Frames;
    OrigX += (int)MoveForwardXFloat;
}

sentences:
Regarding physics engines and the GPU The rigid body physics engines that use a "bounding box" for collision detection, I am aware of how they are created.

What I want to know is, is there a physics engine that does not use "bounding box" but actually uses something like vertex data to do the physics calculations? What type of physics engine is this called, and does it use the GPU?

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:
Instances in the Unity Profiler Timeline What do Instances mean when you click on an operation in the Timeline section of Unity Profiler?

In this example:

  Total: 11.90 ms (10 Instances)

sentences:
Why one `colorKey` in `ParticleSystem` cannot be changed without a new Gradient? My question is partly a continuation of this question. So, why I can't change just one GradientColorKey this way (without replacing the whole Gradient instance):
ColorOverLifetimeModule colorOverLifetime = _particle.colorOverLifetime;
MinMaxGradient color = colorOverLifetime.color;
color.gradient.colorKeys[1] = new GradientColorKey(new Color(1, 0, 0), 0.5f);
colorOverLifetime.color = color;

colorOverLifetime.color is MinMaxGradient struct, so I copy its value in a variable color.
The colorOverLifetime.color.gradient property is Gradient class and there is no need to copy it.
The colorKeys property is just an array of GradientColorKey struct. So, I assign a new GradientColorKey value to the array element that already exists.
Why shouldn't this work?

sentences:
How to select coordinate position within uv texture in a shader - Unity first of all I'm sorry for asking noob-ish question. This is my fifth day trying to make a shader in Unity.

I'm trying to select an area within my UV image as shown below

and here's how it looks like on the mesh

Basically I'm only selecting the red from the UV and apply it to the mesh. I encountered no problem when trying to select from the RGB, but when i try to use the XYZ for the coordinate position, it turns out that the value of x and r is the same, so is y and g, and z and b.

My question is, how to select by the coordinate position in the UV texture?

Thanks.

here's my code :

    Shader "Custom/ASK RGB" {
    Properties {
        _tex ("Tex", 2D) = "white" {}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _tex;

        struct Input {
            float2 uv2_tex : TEXCOORD1;
            float4 pos : TEXCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // my variable used to store the UV texture mentioned
            half4 tex = tex2D (_tex, IN.uv2_tex.xy);

            // my attempt to use position which doesn't work
            half4 texPos = half4(IN.pos);

            half4 tryUV = tex2D(_tex, IN.uv2_tex.xy);

            tex.a = 1 - tex.b - tex.r - tex.g;

            tryUV.a = tex.r;

            o.Albedo = tryUV.rgb * tryUV.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences: Difference between Unity's Camera.ScreenPointToRay and Camera.ScreenToWorldPoint? What is the difference between Unity's  Camera.ScreenPointToRay and Camera.ScreenToWorldPoint. And where we can use these. I've watched some tutorial and documentation but I didn't get a clear understanding.

sentences: Can I use real cars in my racing game?(Yeah,I know) I know this was asked a million times.I know I can't use real car names or badges,but what about body design? I saw a lot of games with real body designs.My other question is about the engine names:VR6,TFSI,1/2JZ etc.can I use them? And if I can use body designs,does that apply to rims too? My last question is that is it legal to use words like WRC,WTCC,NASCAR,F1,LMP,GT3 etc.?

sentences:
Looking for XNA patterns Hello mature game developers. Im just started with XNA, but i got solid expirence with C#.
I wonder is there any common code patterns for XNA games?

Like should i make classes wich handle draw and update separatly, like draw model and world  data model? Or should i try to put as much code as possible in Game1 ?

Im totaly lost in project structure building. Thx for any answers.

sentences: 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:
Ergonomics studies on choosing keys on a keyboard? I have the following problem:

My game supports multiple powers, that you can use when you want, or even mix them, I currently assigned them to the numbers on the top of the keyboard.

After so much time playtesting, I ended developing high skills in playing my own game, and several of my new tactics involve mixing powers, but I found that I keep pressing incorrect buttons, or that I need to pause, look at the keyboard, and unpause, or I plainly press the wrong button (like, I try to press 5, but press 6 instead).

I already expected this when I made the keybindings, but I don't found how to solve...

How I fix that?

EDIT: The game is a fast-paced action game, or arcade game... (you know, not necessarily on a genre, except it is action, and you aim for high-scores), so I cannot use random keys, I really need to allow the players to press the keys REALLY fast, ANY key that they need to press.

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:
Day/Night - Rotation from a sine wave I recently found this question on stack exchange with a great answer that showed how to condense game time into a sine wave, where 1 = midday and -1 = midnight

Converting time of day into a smooth day/night variable?

I've implemented this fine as far as I can tell but I'm a little confused as to how one would get a clean rotation from this to drive a directional light.

Currently I'm using arc-sine to revert the wave to radians and then converting it to degrees but I feel like this is going against the whole process of getting the sine in the first place. It doesn't actually work correctly anyway because we can't tell what side of the unit circle we're on, at least not with my current setup.

Is there a clean way for me to extract a rotation from this sine value so a sun would rotate smoothly? Thanks!

sentences:
How to detect if a ball will collide with another, and the normal vector of the collision? So I have a 2D game involving balls (circles) colliding. I want to be able to detect if two balls will collide before it happens, and the normal vector of the collision if a collision is going to happen. Take a look at the below picture:

Essentially a normalized vector represented by the red arrow is what I am interested in knowing. How can I figure that out any frame most efficiently, given I know the following:

The blue ball has a current initial velocity
The ball ball is pulled down by a constant gravity
The green ball does not move
The sizes and location of both balls

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:
_BitScanReverse identifier not found I'm developing some additional options for a game (which means I don't have knowledge about whole game's methods, classes etc.).

Anyway, I have been trying to build the project for codes I've developed to test them. I've encountered some DirectX, Windows SDK Version, Compiler problems but managed to solve them. But now I'm encountering some BitScanReverse error.

It says: C3861 '_BitScanReverse': identifier not found

Here is whole code for the error I'm encountering:

#pragma once

#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include <initializer_list>
#include <functional>
#include <iterator>

    #ifdef _MSC_VER // BitScanReverse ERROR 1
        _BitScanReverse(&n, ~code);
    #else
        n = sizeof(long) * 8 - 1 - __builtin_clzl(~code);
    #endif

    code &= ~(-1 << n);
    n = 6 - n;
    ptr++;

    #ifdef _MSC_VER // BitScanReverse ERROR 2
        _BitScanReverse(&n, ucode);
    #else
        n = sizeof(long) * 8 - 1 - __builtin_clzl(ucode);
    #endif

I've downladed source codes through SVN, so whole project is actually working. I just couldn't manage to build it in my local laptop or desktop computer.

By the way, I've tried to build it with Visual Studio 2015 Enterprise (with other errors), Visual Studio 2017 Proffesional and Community Edition (with same errors). And actually this project was developed with Visual Studio 2013 and 2015.

I'm not even good C++ coder so I couldn't figured out the problem.
Does anyone have an idea?

sentences:
How to get projectile direction vector in a 2d grid? I am having trouble figuring out how to trace the path of my projectiles in an Asteroids clone. Currently the ship is locked to the center of the screen and can be rotated a full 360 degrees. I know the angle the ship is pointing at any given time, but I am not sure how to calculate the vector that the projectile should use for its trajectory. I know that I can find the correct vector by subtracting the end point from the start point.. but the issue is that I do not know the end point. Theoretically.. the end point is whenever the projectile touches the edge of the screen or some object. This is the current game code: https://jsfiddle.net/m6sxrk8w/
 just using a hardcoded movement vector of {x:-1, y:-1}. Can anyone give some advice on how to dynamically determine the true vector given the current direction of the ship? There must be some simple math I am missing here...

sentences: How to get more gentle (cloud like) noise? Recently I have started playing around with making terrain with perlin noise. Using this library  I can make A fairly fast. However, it is to squiggly to be desirable. What I want to achieve is B, where you can see more convincing slopes with the softer noise.

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:
How to resolve concurrent ramp collisions in 2d platformer? A bit about the physics engine: Bodies are all rectangles. Bodies are sorted at the beginning of every update loop based on the body-in-motion's horizontal and vertical velocity (to avoid sticky walls/floors). Solid bodies are resolved by testing the body-in-motion's new X with the old Y and adjusting if necessary before testing the new X with the new Y, again adjusting if necessary. Works great.

Ramps (rectangles with a flag set indicating bottom-left, bottom-right, etc) are resolved by calculating the ratio of penetration along the x-axis and setting a new Y accordingly (with some checks to make sure the body-in-motion isn't attacking from the tall or flat side, in which case the ramp is treated as a normal rectangle). This also works great.

Side-by-side ramps, eg. \/ and /\, work fine but things get jittery and unpredictable when a top-down ramp is directly above a bottom-up ramp, eg. < or > or when a bottom-up ramp runs right up to the ceiling/top-down ramp runs right down to the floor.

I've been able to lock it down somewhat by detecting whether the body-in-motion hadFloor when also colliding with a top-down ramp or hadCeiling when also colliding with a bottom-up ramp then resolving by calculating the ratio of penetration along the y-axis and setting the new X accordingly (the opposite of the normal behavior). But as soon as the body-in-motion jumps the hasFloor flag becomes false, the first ramp resolution pushes the body into collision with the second ramp and collision resolution becomes jittery again for a few frames.

I'm sure I'm making this more complicated than it needs to be. Can anyone recommend a good resource that outlines the best way to address this problem? (Please don't recommend I use something like Box2d or Chipmunk. Also, "redesign your levels" isn't an answer; the body-in-motion may at times be riding another body-in-motion, eg. a platform, that pushes it into a ramp so I'd like to be able to resolve this properly.)

Thanks!

sentences:
State machine in C for SDL game I want to create a state machine for menu in my SDL game. So this is my code without the SDL I just want to ask if this is a good way to create it.
here is a code:
#include <stdio.h>
#include <windows.h>
enum states
{
Menu,
Game,
Game_over,
Exit
};

int main()
{
 int game_is_running = 1;
 enum states state = Menu;
 while(game_is_running == 1)
{
  switch(state)
 {
  case Menu:
    state = Game;
    printf("menu screen with play and exit button.\n"); //need to add if
                                                //exit or play is pressed
                     // if exit then exit program if play than you know...
     break;
    case Game:
     state = Game_over;
    printf("after play button is pressed game screen will show up.\n"); //after this i will come back to menu.
    break;
  case Game_over:
    state = Exit;
    printf("screen after game.\n");
    break;
  case Exit:
    printf("turn game off.\n"); //this will be in the if function with a game.
    game_is_running = 0;
    break;
}
 Sleep(1000); // sleep for a second just for test
}
   return 0;
}

sentences:
Changing the texture filtering methodology within the same SpriteBatch Begin/End pair How would I go about using changing the texture filtering method being used within the same SpriteBatch Begin/End pairing?

I have this code so far.

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null);

spriteBatch.Draw(PixelArtTexture, new Vector2(x, y), null, Color.White, 0f, Vector2.Zero, new Vector2(8, 8), SpriteEffects.None, 0f);

spriteBatch.End ();

This draws a pixel art texture using point filtering, however I want to draw another texture using linear filtering, so how would I do that?

sentences:
Libgdx AtlasTmxMapLoader with multiple tilsets I am working on a Libgdx game which loads Tiled maps. The current map I am working on makes use of two tilesets, one for shadow/light and another for terrain and buildings. The general process I do, that has been working fine, is that I receive the sprite sheet from the artist, design the maps, then take the spritesheet file and split it using ImageMagick. From there I take the split images and create an optimized png and atlas file with TexturePacker.

However, this is the first map I have made that makes use of multiple tilesets. The issue I am having is when loading the map with AtlasTmxMapLoader it relies on a single atlas file property in the map. I tried to merge my 2 images into a single atlas/texture (keeping the same names/indexes) but it only seems to render by first tileset tiles.

Perhaps I am missing something simple. What is the correct way to handle multiple tilesets (how exactly should my atlas file be setup)?

sentences:
How to create pixel-perfect text in TextMeshPro with a shadow? Problem
Making the font asset of type Raster creates a pixel-perfect font, but it doesn't have the underlay option inside its material to give it a shadow.
Making it of type SDF (or one of the variants) does, but it's blurred in game view.
See the image for a visual example. The top text uses the SDF variant, whereas the bottom is of Raster type. This is Game View, zoomed in.

Attempted Solution
I considered using Unity's own Text component, which, strangely enough, doesn't blur in Game View (but does in Scene View). However, to give it a shadow, I need to create a 2nd, black Text object to place behind it with a small offset. This is fine, but then I need to match its value to the main Text's, and I can't seem to do that without checking every frame inside Update(), which is wasteful.

sentences:
Farseer: Friend/Foe Collision - cannot push foes but friends we are using Farseer in our project and I try to find a setup to achieve the following quite complicated collision behavior:

Friendly Units can push each other aside. However, the push should be a "soft-push", so that multiple units can squeeze through narrow gaps.
Enemy Units should not be pushed. Ever. Moving units colliding with enemies should stop dead.
Additionally, I have some other type of collider, lets call them "Wall" ;). Neither friends nor foes should ever be able to stand inside a wall.

Whether two objects are considered "enemies" can change dynamically during the game. The state is always symmetric (If Bob is an enemy of Alan, then Alan is always an enemy of Bob) but we have more than two factions (up to 16).

(Basically, its a similar collision behavior like Starcraft, except that friendly units can temporarily squeeze through navmesh gaps.. much like in Age of Empire..)

Actually, I got a quite elaborated solution so far. It has some problems, but kind of gets most of my wishlist done.. Well, most of the time. Here is what I did..

Lets first start with the setup without any walls (because that's what is working better ;):

I have 2 bodies for each unit. One dynamic the other kinematic.
the dynamic body has two equal fixtures. One sensor (to soft-push friends), the other a normal fixture (this is what I apply forces from outside game code).
The kinematic body has one normal fixture. (This body is to dead-stop on enemies)
I hooked a BeforeCollision callback to the normal fixture of the dynamic sensor. This filters out all collisions except with the kinematic body of enemies. This way, the dynamic body can not push enemies.
Another BeforeCollision filter on the kinematic body just excludes collisions with the sensor fixture of our own dynamic body.
Now, after every world update, I run through all the dynamic bodies:

I will copy the new position into the kinematic body.
For each touching contact of the sensor with another dynamic body, I will manually calculate a separating force and apply these to both dynamic bodies.

Everything clear so far? To summarize: Dynamic fixture moved by game code, stops dead colliding with kinematic body of enemies. Sensor register friends and I calculate push-forces by hand. Kinematic body is synched every frame to the dynamic body.

Now the problem: Walls.

I need to enforce that no Body ever ends up inside a wall. More precise, the center point of any body must not be inside any Wall - shape (the circle can and should overlap with the wall, only the center point is interesting).

I tried several ideas to achieve this but running out of steam here. The currently best solution I could come up with:
- The dynamic body gets yet another circle fixture that is extremely small, like 0.001 meter.
- This one has a CCD on and a collision group that only allows collision with walls (which are in their own category)
- Walls are all fixtures of a static body.

This approach works as long as no "teleporting" of units is involved. Lets say Alan is being teleported on a spot overlapping with Bob. Now, Alan's kinematic body will push Bob's dynamic body and vice versa. Everything is fine. But if Bob was standing right next to a wall, Farseer will still move Bob slightly into the wall, since the resolver need to resolve the unmovable kinematic body of Alan and the unmovable wall.

Yet another post-update loop through all bodies that scans all units whether they are inside walls and manually resolve their positions is way beyond our performance limits.

I briefly thought about some solution involving two separate Farseer worlds, but my head starts to spin trying to figure out which body position need to be copied where and when... ^^

I haven't looked into joints yet, but my gut feeling is that they don't really help here. Except with a third body? Do I really need 3 bodies per unit? :(

Any ideas?

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:
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:
Bringing a Box2D, Physics Enabled game Online? Lets say, to simplify the problem of online games a bit, my goal would be to run a near identical simulation on multiple computers in sync. Would sending commands be a good idea?

Now if only sending commands is not good, should all the physics entities be sent every half second or so?

I'm wondering this because my game will essentially be a Box2D fighting game. Players can also spawn items, which must be added to the Box2D world.

What I'm wondering is how much and what kind of information should I send over the server?

Should I simply send key presses, and every half second snap back dynamic object positions to where the server thinks they should be?

Any helpful tips / articles regarding this would be a great help!

Thanks

sentences:
Mafia kill algorithm I'm making an Omerta clone/mafia game and trying to work out a kill algorithm. Just a basic formula to decide how many bullets player A needs to kill player B.

The inputs are: players rank (out of 10), and a players kill skill (out of 100). The algorithm needs to return how many bullets are needed for that player to win.

If you're shooting someone a higher rank, or higher kill skill, it should require more bullets.

Anyone ever done anything like this and can offer some tips?

Example chart:

sentences:
How do I move an existing display object behind another in Corona Lua? If I have two existing display objects in Corona, lets say do1 and do2. Assume do1 is drawn first then do2, so do2 will be on top.

Is there a way to say "put do2 behind do1" in corona Lua? If yes can you give me an example?

sentences:
How can I make a transparent hole with shaperenderer using stencil masking in libgdx? I'm making a 2d game, where I need a resizeable, moveable rectangle outline. I'm trying to use stencil masking to do it by cutting a hole in a solid rectangle, and I thought this would help:

How can I add a transparent overlay to a UI in libGDX?

But all I get is a solid box. Here's my code:

        Gdx.gl.glClear(GL_STENCIL_BUFFER_BIT);
        Gdx.gl.glColorMask(false, false, false, false);
        Gdx.gl.glDepthMask(false);
        Gdx.gl.glEnable(GL20.GL_STENCIL_TEST);
        Gdx.gl.glStencilFunc(GL20.GL_ALWAYS, 0x1, 0xffffffff);
        Gdx.gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

        shapeRenderer.box(cubby.xpos + 5 , cubby.ypos + 5, 0, cubby.size - 10, cubby.size - 10, 0);

        shapeRenderer.end();

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

        Gdx.gl.glColorMask(true, true, true, true);
        Gdx.gl.glDepthMask(true);

        Gdx.gl.glStencilFunc(GL_NOTEQUAL, 0x1, 0xffffffff);
        Gdx.gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

        shapeRenderer.box(cubby.xpos, cubby.ypos,0,cubby.size, cubby.size, 0);

        shapeRenderer.end();

        Gdx.gl.glDisable(GL20.GL_STENCIL_TEST);

sentences:
Fastest way to assign sprites to components in Unity I'm using a sprite atlas and Unity's built-in sprite editor to tease out the individual images. Specifically, I have a single texture containing lots and lots of icons for armor, and I am assigning those to a Sprite[] field of a Component.

However, the process of manually assigning sprites to the component -- via drag and drop -- is tedious. Is there a faster way to do this? Perhaps a way I can bulk assign sprites to a component?

Update: This is the code of the final solution. In short, the easiest thing to do is to put the texture atlas in the /Resources folder and then programmatically access the sprites by name.

private void MergeTextureAtlas(string atlasName, Dictionary<ItemSubType, List<Sprite>> spriteLookup) {
    Sprite[] atlasSprites = Resources.LoadAll<Sprite>(atlasName);
    Assert.IsNotNull(atlasSprites, atlasName);
    Assert.IsTrue(atlasSprites.Length > 0, atlasName);

    int spritesLoaded = 0;
    foreach (ItemSubType itemSubType in Enum.GetValues(typeof(ItemSubType))) {
        string subTypeFriendlyName = ItemSubTypeHelper.GetSubTypeName(itemSubType);
        foreach (Sprite atlasSprite in atlasSprites) {
            if (atlasSprite.name.Contains(subTypeFriendlyName)) {
                if (!spriteLookup.ContainsKey(itemSubType)) {
                    spriteLookup.Add(itemSubType, new List<Sprite>());
                }
                spriteLookup[itemSubType].Add(atlasSprite);
                spritesLoaded++;
            }
        }
    }

    if (spritesLoaded == 0) {
        Debug.LogWarning(String.Format(
            "Found 0 new sprites in texture atlas '{0}'.",
            atlasName));
    }
}

sentences:
Position an object at the center of the screen I need to create a grid of squares such as the grid is centered on the screen. Here is a schema:

I need the two green lengths to be equal, and the two red lengths to be equal.

Here is the method I am using right now to try to generate this pattern (slotGrid is a 2D array, but only its size is revelant right now).

void GenerateLevel(bool[,] slotGrid) {

    // The size of the grid, in the image above this is equal to 2 as it is a 2*2 grid
    // Note that I assume that the grid width and height are equal
    int slotGridSize = slotGrid.GetLength(0);

    // The size of one of the square
    float slotSizePixel = m_Slot.transform.lossyScale.x;

    // The size of the screen
    float screenWidthPixel = Screen.width;
    float screenHeightPixel = Screen.height;
    Debug.Log("Screen size: " + screenWidthPixel + "*" + screenHeightPixel);

    // Position of the upper left square
    float firstSlotX = (screenWidthPixel - (slotGridSize*slotSizePixel)) / 2;
    float firstSlotY = (screenHeightPixel - (slotGridSize*slotSizePixel)) / 2;
    Debug.Log("First slot position: " + firstSlotX + "," + firstSlotY);

    Vector3 newSlotPosition = new Vector3(firstSlotX, firstSlotY, 0);

    // Generate the grid starting from upper left corner
    for (int i = 0; i < slotGridSize; i++) {
        for (int j = 0; j < slotGridSize; j++) {
            Instantiate(m_Slot, newSlotPosition, Quaternion.identity);
            newSlotPosition = new Vector3(newSlotPosition.x + slotSizePixel,
                                          newSlotPosition.y,
                                          0);
        }
        newSlotPosition = new Vector3(firstSlotX, newSlotPosition.y, 0);
    }
}

However, this method is placing the squares in some weird position (i.e far off the screen). I realized this is because I mix pixel size (for the screen width and height) and... Unity scale size I guess (I don't know the proper name) for the square size.

How can I fix this?

sentences: GL_CLAMP_TO_BORDER - OpenGL ES 3 W want to use GL_CLAMP_TO_BORDER in my GL ES 3 app. Based on documentation (https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml), it seems to be supported, however, on iOS this #define is not present. Is it named differently? Maybe some extension?

sentences:
How to manage special state in mecanim? I have a game in which there is a cat that has three states: On Ground, Going Up and Coming down.

This is handled by having 3 states, up,ground and down. Now, there is an additional requirement that the cat picks up a power up and becomes invincible. In this special state, the cat doesn't die if it falls through gaps etc. In this state also, there are same animation states : up, ground and down. However, when the cat is in this special state, it's sprite changes to a starry,shiny sprite.

So now we have two sets of animations : one normal, another power up. How can I manage these two sets?

sentences:
how to get camera width in unity Problem

I have a spawn manager written in c# which spawns my game object, i use screen.width, to set the maximum screen with and -screen.width to set the minimum screen width for the spawning, but my game object spawns way off the screen.

I am using a portrait camera 2:3 instead of free aspect as my camera view, as i want my game to be in portrait mode

how do i make my game object spawn within the camera widths(max and min)?

my code

public class SpawnManager : MonoBehaviour {

    public int maxBalloons = 100;
    public GameObject balloon;
    public float horizontalMin = -Screen.width;
    public float horizontalMax = Screen.width;
    public float verticalMin = -5.0f;
    public float verticalMax = 1.0f;

    private Vector2 originPosition;

    void Start () {

        originPosition = transform.position;
        Spawn ();

    }

    void Spawn()
    {
        for (int i = 0; i < maxBalloons; i++)
        {
            Vector2 randomPosition = originPosition + new Vector2 (Random.Range(horizontalMin, horizontalMax), Random.Range (verticalMin, verticalMax));

            Instantiate(balloon, randomPosition, Quaternion.identity);
            originPosition = randomPosition;
        }
    }

}

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:
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:
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:
Simulating water droplets on a window How do I simulate water droplets realistically falling, gathering, and flowing down a window? For example, see http://www.youtube.com/watch?v=4jaGyv0KRPw. In particular, I want to simulate how smaller droplets merge together to form larger droplets that have enough weight to oppose the surface tension and flow downward, leaving a trail of water.

I'm aware of fluid simulation, but how would it be applied in this situation?

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:
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:
Handling Latency in Multiplayer Shoot-em-ups I had an idea for an architecture, and I was wondering if anyone has implemented something like this or has used AWS or some other service to help?

I thought about using NodeJS + SocketIO to handle a server side for this cooperative shmup (think Raiden or Galaga) we are just starting to work on. We started to think about latency issues.

The solution I came up with was to spin-up/down servers at the mid-point of the 2 users playing with some epsilon value (say 300miles or something). Perhaps the server would allow up to 50 users to play simultaneously and after that it would deny requests, which would then spring up another server. This should cause latency to be about equal for the 2 users playing. Furthermore, if we are matching making users then we always pair the 2 closest users together.

I suppose there are other factors to consider like user skill level, but I think right now we are most concerned about latency since it directly affects gameplay. Actually our game does require fairly precise timing. Also we want users to be able to see each other shoot since cool animations happen when they are in sync with each other.

I suppose this is similar to how a fighting game might operate in terms of timing/precision.

Ideas? Thoughts? How have others approached this problem? Where can I start looking for examples?

sentences:
XNA maximum VertexBuffer size exception I am trying to build content(a text file contains list of triangles vertices) for an XNA application through a custom pipeline importer. It works ok. But when number of triangles gets near 1m(in this case 946612 triangle & 303112 unique vertex) I get this error:

"XNA Framework HiDef profile supports a maximum VertexBuffer size of 67108863, but this VertexBuffer is 68847328."

1- Is this number in bytes or just the number of vertices? I assume bytes which would make it ~1.3m vertex.

2- The VertexBuffer size, Does it refer to the MeshContent Position collection or the GeometryContent VertexContent or the Model.Meshes[i].MeshParts[i].VertexBuffer.VertexCount?

The reason is that the MeshContent Position collection holds unique vertices whereas the other, all of the triangles vertices which might have duplicates. ex. For a simple cube, the Position collection holds 8 vertex and the VertexContent have 36(12 tri*3) vertex which have duplicates. Once the MeshBuilder.FinishMesh() method is called it reduces to 24 vertex. Why 24? And this is exactly the number that Model.Meshes[i].MeshParts[i].VertexBuffer.VertexCount shows at the runtime.

3- Also, does this error regards only one mesh exceeding certain limit in vertex size or the whole Model.Meshes, or could be both?

Any help to understand how these things work is appreciated.

sentences:
How can I traverse a scene graph and hit only nodes in the view frustum? Scene Graph seems to be the most effective way of representing the game world.

The game world usually tends to be as large as the memory and device can handle. In contrast, the screen of the device captures only a fraction of the Game World/Scene Graph.

Ideally, I wish to process(update and render) only the visible game objects/nodes on per-frame basis. My question therefore is, how to traverse the scene graph so, that I will focus only on the game notes that are in the camera frustum?

How to organize data so that I can easily focus only on the scene graph nodes visible to me?
What are techniques to minimize scenegraph traversal time?
Is there such way as more effective traversal, or do I have to traverse whole scene graph on per-frame basis?

sentences:
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:
How to Export Flash Animation Data I'd love for my partner, the artist, to be able to animate using flash movieclips and timelines.  Then I, the programmer, would like to read the raw Flash info and re-program it into my engine of choice (which happens to be Torque2D).  The data I'd want is

the bitmap images that were used in Flash, like the head and body
the links between the images, like where the head connects to the body
the motion data from the flash animation, like move, rotate (at what speed), shear, etc. for the head or arms or whatever.

Is there any way to get this data?

Here's what I know so far.

There are tools like SWFSheet and Spriteloq that convert the entire flash animation into a frame by frame sprite animation (in a sprite sheet).  This would take too much space in my case, so I'd like to avoid that.  Re-animating on the fly would take much less texture memory.
There is a PDF that describes the SWF file format but NOT the individual components like the movieclips.

So anyone know of a library I can use, or how I can learn more about the movieclip components and whatnot?

(more better tags: transform, export, convert)

sentences:
Best API coverage for 2D game? If one were to code a game for most versions of Windows, which API should be used?

I know DirectDraw works from NT4 and up (although DirectDraw is emulated on NT4 with GDI). However, I am told DirectDraw is deprecated in newer versions of Windows?

I could revert to just GDI, but then it is hard to completely eliminate flicker, since there is no double buffering with flipping between buffers.

Should I go for Direct3D or DirectDraw? Or is there some way of completely eliminating flicker in GDI or some other Windows API I am not aware of?

If Direct3D is the answer, which version of it is supported on most platforms?

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:
Pretty Sure I have Support for OpenGL 4, but it's not running. What can I do? Many Game Engines require OpenGL to run.  I have one of those.  I've confirmed that the program and any benchmarks for OpenGL above OpenGL 2 fail to run.

Is there, like, a way to confirm I have dependencies or something to that effect?  Is it installed or is it just a library included in other programs?

Specifically using Ubuntu Linux 17.10, computer specs are fairly low but I've run the Engine on Windows on the same machine before.  Linux should have more up to date graphics drivers, so I'm not sure what the root of the problem might be.

sentences: Ignore specific key press in textbox there is a text box on GUI in my application created using Unity3D. in the textbox user can input only the keys of "A-Z", "0-9" , "enter key" , "." and "," other key press should be ignored (not should print in textbox when typing). how to do this in Unity3D C#

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: 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:
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:
Hide back button bar of android mobile while playing game I just want to hide back button bar of android mobile while playing the game.

I tried to make it close by pressing back button,it getting close but its always visible.
please help..

sentences:
Resource not found: testdata/alphamap.png I started a tutorial for java's slick 2d library, called SlickBlocks which is essentally a tetris clone. The problem is I have followed and typed in the code examples to the dot, yet when I run it I get the exception: Exception in thread "main" java.lang.RuntimeException: Resource not found: testdata/alphamap.png. I just started the tutorial and am up to "Making a cool effect with Image scale".

Any ideas?

Edit:

The error has occured at:

at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
at org.newdawn.slick.Image.<init>(Image.java:196)
at org.newdawn.slick.Image.<init>(Image.java:170)
at org.newdawn.slick.Image.<init>(Image.java:158)
at org.newdawn.slick.Image.<init>(Image.java:136)
at org.newdawn.slick.tests.AlphaMapTest.init(AlphaMapTest.java:33)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at org.newdawn.slick.tests.AlphaMapTest.main(AlphaMapTest.java:79)

Also not that I am not using "alphamap.png"  anywhere in the game, I think It is just referenced by the library itself.

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:
Farseer Physics Samples and Krypton how to reference game I'm sure this is totally simple and yes I am new at this.

I am trying to set up Krypton inside farseer.
1.  create a new Krypton engine in my sub screen aka AdvancedDemo1 : PhysicsGameScreen, IDemoScreen
Via  this.krypton = new KryptonEngine(this, "KryptonEffect");
The problem is the KryptonEngine(this wants reference to Game game, I cant seem to reference it from FarseerPhysicsGame : Game
So how would I do that?

or
2.  I can put it directly in FarsserPhysicsGame but again I cant seem to figure out how to reference FarseerPhysicsGame in AdvancedDemo1.

or
3.  I can put it inside the public FarseerPhysicsGame() and do Componenets.Add(krypton) [which works] HOWEVER I cant figure out how to reference the compoenet once it is added.

You should be able to stop reading here , but for more detail
I simply took the Farseer XNA Samples went into FarseerPhysicsGame.cs and deleted all the screens and menus except AdvancedDemo1 so there is one option and I just click that to load into the advancedDemo1 and thats where I want to put the lights from krypton.

Thanks.

Edit: Figured out 1 solution though I am still curious about others.
Solution 1 I was able to use ScreenManager.Game(not sure why it was there but Ill try to figure it out later)

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:
Handling keyboard input in SDL2 I'm using SDL2 with .NET bindings. Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this:

// class members
private static int _numkeys;
private static IntPtr _keysBuffer;
private static byte[] _keysCurr = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];
private static byte[] _keysPrev = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];

// called once, to get buffer pointer
_keysBuffer = SDL_GetKeyboardState(out _numkeys);

// update keyboard state each frame
var tmp = _keysPrev;
_keysPrev = _keysCurr;
_keysCurr = tmp;
// copy new state
Marshal.Copy(_keysBuffer, _keysCurr, 0, _numkeys);

all is workig as expected mostly, however once in while one of the following behavior occurs:

Physical key is pressed, but no key press is detected. Keypress is detected after key repeat interval.
Physical key is pressed, but no key press is detected. Lasts for infinite amount of time.

For example, I press Right (D), the movement to right starts, shortly after I press Fire (SPACE), movement is stopped, no firing occurs, then after key repeat interval firing starts, but movement to Right is stopped despite key is also still pressed.

Unfortunatelly I have both 1) not discovered 100% reproducible pattern for the bug yet (seems like it happens on burst sequental presses), 2) have no ideas what is the cause.

For now I just want, a fresh view on my code (is it solid?) and maybe some ideas on what to check. Thanks!

sentences:
How do I make an object not appear grey regardless of distance? My moon texture is on a plane 500m away and I would like to know if there is a way to keep displaying the texture:

As opposed to it turning grey as pictured here:
regardless of the distance it is from the camera. Any help is greatly appreciated,
Thanks.

sentences:
Drawing a helix effect in Unreal i want to draw/graph an equation(like sinusoidal signal or any parametric equation) in UE4. I don't know if that is possible. I looked for it but found almost nothing. here is what i found most related and wanted to achieve
https://oliverm-h.blogspot.com/2014/12/ue4-material-graphing-functions.html

the problem is i can't understand how he did it.

Anyone have the idea or any kind of help please?

thanks in advance!!!

sentences:
Resizing the camera view in Phaser 3 just like in Unity I started to work in Phaser 3 with a previous background in programming in Unity and I can't figure out how to zoom the camera view. In Unity, I can change this value, to resize the camera view:

Then, everything in its view becomes bigger or smaller and it does not affect GUI elements, and the camera still fills up the full game window.
In Phaser I was trying to use those methods:
this.cameras.main.setSize(width,height) - it just resizes the camera making it smaller, and everything outside the camera becomes black
this.cameras.main.setViewport(x,y,width,height) - just as above, but x and y ads padding
this.cameras.main.setZoom(3) - the closest effect I want to achieve, but it zooms to the center of the scene, scales GUI elements and messes the camera bounds
I made an illustrative picture which can explain my problems better:

So how can I change the size of the main camera, to fit the game window and not scale the GUI, keeping the camera bounds at the same time?

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:
iPhone Game - Sprites I have made games with cocos2d for the iphone however I am looking to move on from that, is there a good direction you could suggest? If not I was planning on using what the SDK gives me, and so for example to make a sprite, say the player on screen, rather than a CCSprite, what would be best to use? What do I need to go and learn?

Thanks.

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 hard to hack leaderboards Okay, someone tasked me to make a leaderboard for their game. However, the one I have right now is really insecure. All it does is check if someone is in the top 100, and if they are, post the score to the server, where the server will completely trust the client to give a real score.

My question is: How would I make it harder, or better, impossible, to send a fake high score, because right now they can just post a value to an easy-to-find endpoint.

Clarifications: The game is running in an interpreted environment, therefore obfuscation is not practical, and the game has a lot of input (an hour's worth at least), so sending that to the server is also impractical.

sentences:
GLSL custom interpolation filter I'm currently building a fragment shader which is using several textures to render the final pixel color.

The textures are not really textures, they are in fact "input data" to be used in the formula to generate the final color.

The problem I've got is that the texture are getting bi-linear-filtered, and therefore the input data as well. This results in many unwanted side-effects, especially when final rendered texture is "zoomed" compared to original resolution.

Removing the side effect is a complex task, and only result in "average" rendering. I was thinking : well, all my problems seems to come from the "default" bi-linear filtering on these input data. I can't move to GL_NEAREST either, since it would create "blocky" rendering. So i guess the better way to proceed is to be fully in charge of the interpolation.

For this to work, i would need the input data at their "natural" resolution (so that means 4 samples), and a relative position between the sampled points.
Is that possible, and if yes, how ?

[EDIT] Since i started this question, i found this internet entry, which seems to (mostly) answer my needs.
http://www.gamerendering.com/2008/10/05/bilinear-interpolation/

One aspect of the solution worry me though : the dimensions of the texture must be provided in an argument. It seems there is no way to "find this information transparently". Adding an argument into the rendering pipeline is unwelcomed though, since it's not under my responsibility, and translates into adding complexity for others.

sentences:
Textures do not render on ATI graphics cards? I'm rendering textured quads to an orthographic view in XNA through hardware instancing. On Nvidia graphics cards, this all works, tested on 3 machines. On ATI cards, it doesn't work at all, tested on 2 machines.

How come? Culling perhaps?

My orthographic view is set up like this:

Matrix projection = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, -graphicsDevice.Viewport.Height, 0, 0, 1);

And my elements are rendered with the Z-coordinate 0.

Edit:

I just figured out something weird.

If I do not call this spritebatch code above doing my textured quad rendering code, then it won't work on Nvidia cards either. Could that be due to culling information or something like that?

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
        ...
        spriteBatch.End();

Edit 2:

Here's the full code for my instancing call.

    public void DrawTextures()
    {

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, textureEffect);
        while (texturesToDraw.Count > 0)
        {
            TextureJob texture = texturesToDraw.Dequeue();
            spriteBatch.Draw(texture.Texture, texture.DestinationRectangle, texture.TintingColor);
        }
        spriteBatch.End();

#if !NOTEXTUREINSTANCING
        // no work to do
        if (positionInBufferTextured > 0)
        {

            device.BlendState = BlendState.Opaque;

            textureEffect.CurrentTechnique = textureEffect.Techniques["Technique1"];
            textureEffect.Parameters["Texture"].SetValue(darkTexture);
            textureEffect.CurrentTechnique.Passes[0].Apply();

            if ((textureInstanceBuffer == null) ||
                (positionInBufferTextured > textureInstanceBuffer.VertexCount))
            {
                if (textureInstanceBuffer != null)
                    textureInstanceBuffer.Dispose();

                textureInstanceBuffer = new DynamicVertexBuffer(device, texturedInstanceVertexDeclaration, positionInBufferTextured, BufferUsage.WriteOnly);
            }

            if (positionInBufferTextured > 0)
            {
                textureInstanceBuffer.SetData(texturedInstances, 0, positionInBufferTextured, SetDataOptions.Discard);
            }

            device.Indices = textureIndexBuffer;
            device.SetVertexBuffers(textureGeometryBuffer, new VertexBufferBinding(textureInstanceBuffer, 0, 1));

            device.DrawInstancedPrimitives(PrimitiveType.TriangleStrip, 0, 0, textureGeometryBuffer.VertexCount, 0, 2, positionInBufferTextured);

            // now that we've drawn, it's ok to reset positionInBuffer back to zero,
            // and write over any vertices that may have been set previously.
            positionInBufferTextured = 0;

        }
#endif
    }

sentences:
Java game Inventory problem I have a game where you walk around picking up items. They are supposed to go into the next empty slot in your inventory, but when I pick up an item all the empty inventory spots get filled with it.

How can I only have the first empty one be filled by the item that is being picked up:

Here is my code:

for (int i = 0; i < c.toArray().length; i++) {
  c.get(i).tick();

  for (int i1 = 0; i1 < play.items.p.toArray().length;i1++) {
    if (c.get(i).holdingid == 0) {
      // check if the player walks onto the item which means it should
      // be picked up:
      if(play.items.p.get(i1).r.intersects(play.p.r)) {
        // remove the item from the ground:
        play.items.p.get(i1).remove = true;
        // change the empty inventory spots to be filled with the item
        // that has been picked up
        c.get(i).holdingid = play.items.p.get(i1).holdingid;
      }
    }
  }
}

The problem is it fills all the inventory spots how can I make it only fill the first inventory spot.

sentences:
How detect which OpenGL texture formats are natively supported? For example, how detect if my videocard doesn’t support "bgr8" and convert it to another format, such as "rgba8" in software mode.

UPDATE: Sorry for the confusion. This question more about situation when I set internalFormat in glTexImage2D to something like "bgra8" but videodriver internally convert data to another format, like "rgba8".

sentences:
Entity System creating Components Over every entity system I see implemented in C++, or even in Java/C# (e.g. the Artemis framework). I see components not allocated via a new operator (or something similar, e.g. std::make_shared). For example:

entity.addComponent(new Position(32, 4, 5));
entity2.addComponent(new Position(5, 6, 7));
// those two position components that were just created
// may/may not be together in memory

// or even:
// how can you avoid using new here? (in the implementation)
entity.addComponent<Position>(32, 4, 5);

Doesn't this harm performance, as there would be cache misses (since new can allocate data anywhere from the heap)? How would you implement a system in such a way that the components of each type are allocated contiguously in memory, so you avoid cache misses? I mainly want to know how one would do so in C++.

sentences:
What is the proper name for a 2D voxel? I know pixel might be right, but pixel means something different, especially if a "2D voxel" isn't exactly one pixel (it isn't, in my game).

I've also heard "texel," but that seems to refer to a repeating texture, which this isn't. I guess I'm just getting hung up on words, but is there a proper term for this?

(For an example of the thing I'm referring to, look at Terraria.)

sentences:
Problems putting my game in fullscreen on GameMaker All the rooms in my game have the size of 1280x720, so normally my game runs like this:

When I try to enable fullscreen, none of the game's buttons respond to clicks, but the keyboard still works. So in the initial menu I clicked on the button to go to the settings room (image 1) and nothing happened, but when I typed "c" on my keyboard went to the settings room:

OBS - There is a distortion, but not the view in that image (I had to convert image 3 to jpg, because in png it was over 2MB in size).

I've thought about switching to 1920x1080 and hiding the title bar, but I'd really like to do things the "right way".

EDIT 1 - Another way to enable full screen. (It also does not work)

create event:

window_set_fullscreen(true);

EDIT 2 - By doing a few tests I noticed that when it is in full screen, the clicks behave as if it had a ghost room at the top left of the screen. Like this:

That is, I click the right side of the word music (in blue) and the language changes.

OBS - The buttons in my game are mostly sprites that I mapped and added a global left pressed event.

sentences:
Designing a weather system for biomes in a roguelike I'm making a roguelike game similar to dwarf fortress. So far, I have an average temperature map and average yearly precipitation map generated with simplex noise. Now, I'm trying to implement a weather system that seems realistic, as in it rains more often in biomes with higher precipitation rates, but still seems coherent.

Some of my thoughts on designing this system would be to have a weather object for each individual biome, and every time it rains (and the startup) it picks the next time it will rain based on the biomes precipitation rate.

One problem with this approach is that it would always rain within the exact edges of a biome, and I don't think it would look very realistic.

Another option could be to have cloud objects move around the map, and have them pick up water while in biomes with high precipitation rates, and when reaching the max, they rain.

This seems like a good approach to me that could be very realistic, I would just have no idea how to program the movement for the clouds.

Any thoughts on a better approach or how to implement either of these to make them work?

sentences:
Unity 4.3 (2D) Rendering only the parts of a sprite that are within specific bounds I'm working in Unity, using the 2D features to recreate the match-3 style of 10000000 (Ten Million).

I have a parent object (green square) with several children objects (blue rectangles) on top of it, as pictured in the first image. I want to only render the parts of the child objects that are over top of the parent object, as shown in the second image.

I can figure out the size and position of everything just fine, what I'm having trouble with is figuring out how to mask off the parts of the child objects that don't overlap with the parent.

sentences:
2D Tile-based Collision Detection I've been planning an indie game project for a while now. I'll summarise it for you so I can get right to the question.

It's done entirely using the latest version of XNA through Visual Studio. Hoping to put it on 360 and PC, but am only really looking for a PC-oriented solution at this stage.

It's a 2D side-scrolling shooter (think Metroidvania-style, or even Terraria). It will eventually include an in-game map editor with maps being tile-based (16x16). There will be upwards and downwards scrolling. I'm hoping to implement tile layers in the dev map editor (reason for a dev map editor is it's going to be heavily leaning towards a content-focus, so there will be a lot of maps).

Physical tiles will be very simple with only two major types. Block tiles, which are just a solid tile, and angled tiles, which are tiles with an incline that characters can walk on. I'm strongly considering abandoning angled tiles entirely, but not sure yet.

The character/NPC movement will be simple. Moving side-to-side, jumping, falling, flying (with appropriate items/situations), teleporting. All very static, no dynamic physics necessary. Only basic gravity. When a character steps off the edge of a tile, it falls. When it jumps and a tile is above it, it stops short and falls back down. When it reaches a protruding tile/wall, it can't move further unless it jumps over or flies. All the basic stuff.

Projectiles can be affected by gravity as well, and some situations may arise where a projectile may be manipulated mid-flight, but nothing requiring heavy physics. Some projectiles will move characters as well (think a simple "pushing" mechanic).

So here's the question: I'm at the stage where I'm starting to work on movement and collision-detection but I just can't set myself on a way to go about them. I need ways to determine when character, tiles, and projectiles collide. Given what I've said about the style I'm going for and the tile-based system I'm using, can I get some recommendations+links to some tried and true collision detection methods others have used in similar situations, and maybe an example of a game using a similar approach? What I need more than anything else is inspiration.

And just a quick note, I have several years of experience as a programmer, so I'm not a total newbie :)

sentences:
How I get the value from different class i get error , i cant get the value from different class..

public class First1 : MonoBehaviour {
    private List<IFirstListener> listeners = new List<IFirstListener>();
    public int watt;
    void OnTriggerEnter2D(Collider2D theCollider)
    {
        try {
            CharacterA characterA = theCollider.GetComponent<CharacterA>();
            this.watt += characterA.watt;
            for (int i = 0; i < listeners.Count; i++) {
                listeners[i].OnBaterryPluggedIn(this, characterA, characterA.watt);
            }
        }
        catch { /*On error do nothing*/ }
    }

    void OnTriggerExit2D(Collider2D theCollider) {
        try {
            CharacterA characterA = theCollider.GetComponent<CharacterA>();
            this.watt -= characterA.watt;
            if (characterA != null) {
                for (int i = 0; i < listeners.Count; i++) {
                }
                    listeners[i].OnBaterryPluggedOut(this, characterA, characterA.watt);
            }
        }
        catch { /*On error do nothing*/ }
    }

i want to get the value var watt and assign to tott.. (tott = watt)

public class Second2 : MonoBehaviour {
    private List<ISecondListener> listeners = new List<ISecondListener>();
    public int tott;

    public void cek (){
        tott = watt; /* <--- how i can get the value from var watt at class First() to var tott?? */
    }

sentences:
Making the ball go faster makes collision detection impossible I have a simple tennis game like Breakout. I have a ball, and a racquet made from a long rectangle. The ball bounces around the walls, and the game terminates when the ball hits the floor. To prevent this, I have a long racquet I can move horizontally that the ball can hit. Each time the ball hits the racquet, the speed of the ball increases.

The speed increases by adding to the number of pixels for each increment of the ball. This means that after a while (around 50 hits), the steps of the ball become quite long. The ball moves at 50 px per frame. With long steps, the ball might just jump over the racquet, and not detect collision.

To prevent this, I was thinking of incrementing the FPS, instead, and keeping the ball speed fixed. This would probably work, but I don't think changing the FPS is the right solution. How should I go about solving collision detection at higher speeds?

sentences:
2D game world creation (libGdx, java) I'am starting to develop a 2D game with motorbikes.

My Question now is:
When my bike reaches the right edge the world should move. (Like in that game: Game example) My first thought was to implement a camera and to create a huge image for the world. (e.g 4096 x 512).
So I only have to move the camera to solve the problem.

Is that a good solution?!

Thank your.

Regards,
Matthias

sentences: Unity Get corners of camera in world space I'm making a 2D game and i need to get the corners of the camera in world cordinates. Is this possible in unity?

sentences:
Selling Android apps from Android-Market-unsupported countries I am in Latvia (which the Android market doesn't support as a country for selling apps from), and I am thinking about the best way of monetizing my app. So far I've come up with these options:

Pretend I am from a supported country. Get a bank account there, etc.
Use PayPal for in-app purchases. The player gets, say, the first 10 levels for free, but is then asked to pay 0.99$ for the rest of the game. Downside: Players might not feel comfortable entering PayPal details into an app. Android market might not like it either.
Making the app free and earning money through advertising. Let's do some calculation here: Say I get 1M free downloads, each user during his playtime would see 10 banners, so 10m / 1000 * 0.3 is about 33k$ if we use AdMob with their 0.3$ per 1000 impressions. On the other hand, if we use PayPal and in-app purchases, we need a >3% conversion rate to beat this..

What should I do?

Edit: From what I just read all over the net, it looks like advertisers will change their eCPM price a lot without telling you. Using in-app PayPal purchases at least allow you to monitor the cash flow.

sentences:
Drawing text from update method in XNA I am having a problem drawing the "Game Over!" text once the user is on the last tile.

This is what I have:

The Update and drawText methods are in a class named turtle:

public void Update(float scalingFactor, int[,] map, SpriteBatch batch, SpriteFont font)
{
    if (isMovable(mapX, mapY - 1, map))
    {
        position.Y = position.Y - (int)scalingFactor;
        angle = 0.0f;
        Program.form.direction = "";

        if (mapX == 17 && mapY == 1)// This is the last tile(Tested)
        {
            Program.form.BackColor = System.Drawing.Color.Red;
            drawText(batch, font);
        }
    }
}

public void drawText(SpriteBatch spritebatch, SpriteFont spriteFont)
{
    textPosition.X = 200; // a vector2
    textPosition.Y = 200;
    spritebatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    spritebatch.DrawString(spriteFont, "Game Over!!!", textPosition, Color.Red);
    spritebatch.End();
}

This update is in the Game1 class:

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    turtle.Update(scalingFactor, map, spriteBatch, font);

    base.Update(gameTime);
}

I have also added the font content to LoadContent:

font = Content.Load<SpriteFont>("fontType");

What am I doing wrong? Why does the text not want to show on game completion? If I call the turtle.draw() in the main Draw method. The "Game Over" text stays on screen from the beggining. What am I missing?

Thanks

sentences:
Circle physics and collision using vectors This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but I don't know how to apply that to my scenario could someone help?

public void drawballs(Graphics g){
    g.setColor (Color.white);

    //displays circles
    for(int i = 0; i<xlocationofcircles.length-1; i++){
    g.fillOval( (int) xlocationofcircles[i],  (int) (ylocationofcircles[i]) ,16 ,16 );
    ylocationofcircles[i]+=.2; //gravity
    if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen
    ylocationofcircles[i]-=.2;

    //Check distance between circles(i think..)
    float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]);

    if( Math.sqrt(distance) <16)
    ...

sentences: Store custom data against XboxLIVE Gamer in XNA? If I am using Xbox LIVE Gamer Services for a networked XNA game, is there anyway to store custom data against the Gamer or GamerProfile so should they sign-in again even on a different machine I can access it? For example if I want to store their colour choice.

sentences:
Detect collision in Blender I am trying to write a Python function for Blender(2.66) game engine, that permits me to detect collision between two objects.

I tried to read the documentation, but it's very confusing, and I don't understand it.

Someone have an example how to do it?

sentences:
Hemicube algorithm d3d9 or d3d11, float valued colors The hemicube algorithm renders the scene to 5 sides of a half-cube, from the perspective of each polygon.

Assume you place the hemicube around me and render to the 5 sides.  The idea is, we can see exactly how much of each other polygon in the scene I see, and so determine the amount of light I receive from those respective polygons.

The way I did this before was using DWORD colors, and assign a different (integer) color to each poly, called its id.  This allows for 16M colors using DWORDS.  It worked fine with the fixed function pipeline, because I was able to choose D3DDECLTYPE_D3DCOLOR in the vertex declaration, render to texture, and tally up the polygon coverage counts.

Now that I've switched over to shaders, I can't seem to make DWORD colors work anymore.  All that works is 3x 32-bit float-type colors (I am using Cg, so float4's.)

Is there a way to force D3D9 or D3D11 to use integer colors in a shader, and if not, how can I guarantee the colors I choose as "ids" for the respective polygons will end up being distinct colors in the texture I render to?

sentences:
Count number of CCNodes of a certain class on a layer Pretty simple question. I'm working in Objective C (cocos2d) and I'm trying to count the number of a sprites of a certain class are present on the current layer being displayed. For example, I have a class named Seal which is a subclass of of CCNode and in my current layer I want to count how many instances of type Seal are present.

I know how to count the number of children of the layer by doing

int numberChildren = [[self children] count];

which correctly returns the number of children on the layer. But I just want the number of Seals on my layer. How could I do this? Thanks =)

sentences:
How to avoid hard coding in game engines My question isn't a coding question; it applies to all of game engine design in general.

How do you avoid hard coding?

This question is a lot deeper than it seems. Say, if you want to run a game that loads the files necessary for operation, how do you avoid saying something like load specificfile.wad in the engine's code? Also, when the file is loaded, how do you avoid saying load aspecificmap in specificfile.wad?

This question applies to pretty much all of engine design, and as little as possible of the engine should be hard coded. What is the best way to achieve that?

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 check for Shader Model 3 support? Currently I am working on a 3D visualization app. A requirement of my app is that host's graphics card supports Shader Model 3. How can I check for Shader Model 3 support?

I know that these versions are supposed to support these models:

DirectX 8.0 - Shader Model 1.0 & 1.1
DirectX 8.0a - Shader Model 1.3
DirectX 8.1 - Shader Model 1.4
DirectX 9.0 - Shader Model 2.0
DirectX 9.0a - Shader Model 2.0a
DirectX 9.0b - Shader Model 2.0b
DirectX 9.0c - Shader Model 3.0
DirectX 10.0* - Shader Model 4.0
DirectX 10.1* - Shader Model 4.1
DirectX 11.0* - Shader Model 5.0

But some graphic hardware doesn't support Shader Model 3.0 even with the proper DirectX version. So I want to determine it by checking the hardware not just the DirectX version.

sentences:
Cannot distinguish depth in an isometric cube I am having a problem with distinguishing different depths in my new 'game.'
It is a game similar to Minecraft, only it is rendering in isometric format. The problem is, I cannot think of a way to distinguish the different depths.
Screenshots:
Above Ground:

Under Ground:

In the last picture, the player is 2 tiles underground, but it seems as if it's only 1 tile underground.
I'm not sure if this is even possible or not, but if you can think of something, please share it!

sentences:
Non linear scaling to show a sol system In a sol system 2d simulation I have some problems in showing the entire system (ie: eaven planets far away than saturn )
letting distinguibles the nearest planet orbits.

Actualy a use a simple scaling logic like this

    double _x = W / 2.0 + ((x ) / maxW) * W;
    double _y = H / 2.0 + ((y ) / maxH) * H;

where
x is real planet x position (assuming sun at origin (0,0))
y is real planet y position
W is canvas width (i.e 512)
H is canvas height (i.e 512)

maxW and maxH are the system real border (or the portion I decide to simulate) : in the example I put
maxW = maxH = 20.0 * 149597870700.0; (20 times the sun earth distance)

What I ask : there's a methot to calculate a (non linear) scaling that let show a bigger portion of the system but keeping some distance
between objects near the center ?

EDIT: Here what I get if I enlarge the system borders:
maxW = maxH = 60.0 * 149597870700.0; (60 times the sun earth distance(UA) )

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: Do game companies usually provide their artists/modelers with drawing tablets? Or do you have to provide your own? How essential are tablets for game development?

sentences:
How to add friction to Unity HingeJoint? I attach a rigidbody to a HingeJoint in Unity.

It's attached no at the the center of an anchor of a joint.

To stop it from falling I set Use Motor = true, Target Velocity = 0 and apply some force to the motor.

However, this does not help, see video:

http://g.recordit.co/JJ0cmfT1Mb.gif

Here is the sample project: https://drive.google.com/open?id=0B8QGeF3SuAgTNnozX05wTVJGZHc

Screen from sample project to reproduce the issue (there is no code):

How can I apply a friction to a joint to stop rigidbody from moving?

Setting spring with damper or applying a limit is not an option for me, because I need to rotate the rigidbody correctly when I apply enough torque (force) to a motor.
If I switch damper/limit on and off, the rigidbody will move faster when it is rotated in a direction of falling and slower when it is rotated in opposite direction.

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 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:
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:
If you want to script a game engine, do you embed the script in the engine, or the engine in the script? I'm new to scripting and combining languages with each other, so I have a question about something that confuses me. If you want to script a game engine, do you embed the script in the engine, or the engine in the script?

If you embedded the script in the engine, I can't really wrap my head around how that would work. Would you have this big script function you called every time you went through the game loop, passing along the inputs and etc.?

If you embedded the engine in the script, I could see how it would be convenient to just treat the whole engine just like a object in the script, and call a simple function each time you wanted to create something. On the other hand, how would the game loop inside the engine work? Having an extra thread for that seems like it could complicate things.

I haven't really found any good information that deals with scripting game engines. My engine is written in C++, and I am planning to script in Python 2.7.

sentences:
Unity - AudioClip lags when played My AudioClip is lagging when I play it in Unity3d. The AudioClip is supposed to play when you left-click inside the game window.

Steps I've tried for fixing it:

Uncompressing the .wav sound file.
Setting the clip variable of an AudioSource to a clip and then playing the sound, but that's a different story.

How the issue occurs: When I start the game, on the first click it plays fine. But then after a few clicks, it starts slowing down and/or lagging.

This is my code:

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

[RequireComponent(typeof(AudioClip))]
[RequireComponent(typeof(AudioSource))]

public class GameProcess : MonoBehaviour {

    public Canvas Game;
    public AudioClip explosion;
    AudioSource beatBox;
    Transform btn;
    Vector3 canvasMin;
    Vector3 canvasMax;
    Vector3 pointerMin;
    Vector3 pointerMax;
    Vector3 pointerPos;

    void Start () {
        btn = Game.transform.FindChild("Pointer");
        canvasMin = Game.GetComponent<Collider>().bounds.min;
        canvasMax = Game.GetComponent<Collider>().bounds.max;
        pointerMin = btn.GetComponent<Collider>().bounds.min;
        pointerMax = btn.GetComponent<Collider>().bounds.max;
        beatBox = GetComponent<AudioSource>();
    }

    void Update () {
        if (Input.GetMouseButton(0))
        {
            beatBox.PlayOneShot(explosion);
        }
        if (!(pointerMin.x <= canvasMin.x) || !(pointerMin.y <= canvasMin.y))
        {
            if(!(pointerMax.x >= canvasMax.x) || !(pointerMax.y >= canvasMax.y))
            {
                btn.transform.position = Input.mousePosition;
            }else
            {
                btn.transform.position.Set(pointerPos.x - 1, pointerPos.y - 1, 0);
            }
        }else
        {
            btn.transform.position.Set(pointerPos.x + 1, pointerPos.y + 1, 0);
        }
    }
}

sentences:
How do I manually make a .pack file like TexturePacker (without using TexturePacker)? I am using libGDX and apparently the only way I see for creating a UI is with texture packs.

I would say that since a texture pack is nothing more than JSON or XML file and a large png I could manually code a texture pack. How?

sentences:
What is AABBvsAABB Collision detection? Currently studying Game Engineering at university and my lecturer has asked us to implement a collision manager. He asks us to use AABBvsAABB to build it, so then we can add the physics.

My question is and if anyone can answer it as simple as possible (as the notes he uses I am still lost).

What exactly is AABBvsAABB for collision detection?

Any links to sites that explain it or just some basic examples would be appreciated.
EDIT: links or examples that explain it in simple terms, I can't seem to find any :(

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:
Entity component system design. Should ID of entities be continuous? I am implementing an entity-component system. Below is my current implementation in c++.

using ID = std::uint32_t;

class Entity {
public:
    Entity(ID index): index_{index} {
    }

    ID index() const;

private:
    const ID index_;
};

ID Entity::index() const
{
    return index_;
}

class Entity_factory {
public:
    Entity generate();

    void destory(ID id);
private:
    ID count_ = 0;
    std::unordered_set<ID> idle_IDs_;
};

Entity Entity_factory::generate()
{
    if (!idle_IDs_.empty()) {
        const ID id = *idle_IDs_.begin();
        idle_IDs_.erase(idle_IDs_.begin());
        return Entity {id};
    }

    assert(count_ != std::numeric_limits<ID>::max());
    return Entity {count_++};
}

void Entity_factory::destory(ID id)
{
    assert (id < count_);
    idle_IDs_.insert(id);
}

Note I use a hash table to keep track of all "destroyed" ID so I can use it again. This way, all the entity index will be as continuous as possible, so I can store components in a pool and refer them through index without wasting much memory. Another choice I can think is at component pools create a separated "index" array to keep track of entity and store all entity continuous. Which why do you prefer? Or do you have a better solution to this problem?

sentences:
Direct X Vertex Coloring So I've been messing around with directx 9 for the past few days, and I recently bump in a simple problem of vertex coloring. Can someone here with directx9 expirience solve this problem? I would appreciate that. I incuded a video to lay out this unpopular problem.

http://www.youtube.com/watch?v=rhU1vuHKAQU&feature=plcp

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:
Why are my wheels not moving at the same speed as my car? I need help with some wheel rotation I set up for my game. My wheels are moving 3x faster than the acceleration speed of my car. Also, I can't work out why my car is moving so slow and the brakes not working.

Have I set something in the inspector too high? I think that it might have something to do with my wheel script.

Here is a video of my problem www.youtube.com/watch?v=0YI50cJ5X4Q&feature=youtu.be

using System.Collections;
using UnityEngine;

public class Car : MonoBehaviour {
public float maxTorque = 5000f;
public float speed = 5000f;

public Transform centerofMass;

public WheelCollider[] wheelColliders = new WheelCollider[4];
public Transform[] tireMeshes = new Transform[4];

private Rigidbody m_rigidBody;

void Start()
{
    m_rigidBody = GetComponent<Rigidbody>();
    m_rigidBody.centerOfMass = centerofMass.localPosition;
}

void Update()
{
    UpdateMeshesPositions();
}

void FixedUpdate()
{
    float steer = Input.GetAxis ("Horizontal");
    float accelrate = Input.GetAxis ("Vertical");

    float finalAngle = steer * 45f;
    wheelColliders [0].steerAngle = finalAngle;
    wheelColliders [1].steerAngle = finalAngle;

    for (int i = 0; i < 4; i++)
    {
        wheelColliders[i].motorTorque = accelrate * speed * maxTorque;        }
}

void UpdateMeshesPositions()
{
    for(int i = 0; i < 4; i++)
    {
        Quaternion quat;
        Vector3 pos;
        wheelColliders[i].GetWorldPose(out pos, out quat);

        tireMeshes[i].position = pos;
        tireMeshes[i].rotation = quat;
    }
}

}

sentences:
Timers and performance for mobile JS I'm using the Three.js JavaScript library to do some things in WebGL, and I wonder how the graphic aspects of timers are done on mobile.

I was creating numbers with geometries and just replacing them when needed. This was fine on desktop (or so I think, lol). Recently, I've been playing around with mobile and the previous method is far too slow.

sentences:
Do I still owe Epic royalties if I am not enrolled in the Unreal Engine subscription? I have just started using Unreal Engine 4 and I have had a very good experience, though I have left the subscription now.

I've made an Android game with it and I am planning to release it, but I have some doubts about the license. Suppose I post my game on my own website for, say, $%, will I still have to give 5% of my income to Epic? How will they come to know that the game is made in Unreal Engine?

I am very confused in taking this step and I'm not really understanding what they mean by "5% gross revenue."

sentences:
HLSL SetVertexShader Texture2DArray Sample I want to do some texture samples in the vertex shader, but it seems this cannot be done in the same was as when using the Pixel shader.

The code is basically..

Texture2DArray   gTexture;

VS()
{
    gTexture.Sample(samPoint, float3(x, y, z)
}

PS()
{
    gTexture.Sample(samPoint, float3(x, y, z)
}

technique11 main
{
   pass P0
   {
      SetVertexShader(CompileShader(vs_4_0, VS()));
      SetGeometryShader(NULL);
      SetPixelShader(CompileShader(ps_4_0, PS()));
   }
}

The PS() will compile and work fine but I also need to do this sort of thing in VS().

When putting this code in the VS() I get:
Error   X4532   cannot map expression to vs_4_0 instruction set ....

I have done some googling and it looks like you can sample a texture in the VS but I cant get enough detail together to make this work.

Any help on this would be good.

Just for reference:
I am using
DirectX11
VS2015

sentences:
Calculate visible points in grid in 2D game I have a game grid and I need to figure out which game grid points are not behind occupied grid point from players view. The visible points. I'd like to define a visible point first, because it can mean many things and I had to figure it out:

I call a point visible point if lines from refference point's centre to two closest point's corners do not intersect with any occupied point. On image bellow, illustration shows invisible in orange, visible in green.

By this definition, we can make a map like this:

Legend:

 - visible pixel
 - partially visible pixel
 - occupied pixel
 - player

I'm not interested in partially visible pixels, but I need to find out which pixels are visible. I don't know where to start. My only idea was to loop angles, but that doesn't work on larger map, where one iteration skips many actual pixels.
How do I check the visible pixels, or ideally, only the furthest visible pixels, as on this map:

And looping through all pixels must be probably avoided, that would eat up too much performance.

sentences:
How to change the position of a circle in pygame in three stages I will try to explain it as well as I can excuse me if I'll fail. I have the following simple game situation:

I know the coordinates of each point. So each of the green points try to hit the blue one. I know the target of each green point. What I would like is to acquire a nice movement effect so that lets say each green point will change the coordinates in 3 steps before getting to the target. For example: if a point would be at (2,2) and the target is at (8,9) it would change to (3,3), then (6,7) then (8,9). The idea is how to aceive this? Is there some math involved with sin and cos? I don't know if choosing a random number for example between (2,8) and (2,9) for the new x and y coordinates will do it. I don't know if so it follows the correct direction of the point towards the target.
I use pygame, but if you don't know pygame but can help me with how to aceive this effect is cool. Thanks a lot!

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:
Object-oriented Ability System? For my RTS game's ability system, I need an efficient ability system where each ability is its own class that implements certain functions from an inherited abstract base class, Ability. Every ability is identified by a byte ID (which gets sent over the network and interpreted by other players). I want to be able to call an ability's overrided Execute() Method with its ID. Currently, I've been thinking of storing all the abilities in dictionaries with their IDs as their keys but I'm having trouble storing these derived classes, abilities, in the dictionary.

I've also heard of reflection but I'm a bit hesitant because I've heard it's a quite expensive operation. Would it be recommended to use up to 60 reflection processes in one frame or will this cause performance issues?

Note: I'm using C# and Unity3D.

sentences:
Render on texture with alpha 0 for the background colour Sorry if the question is stupid but I am very new to opengl.

I render on a target a scene with a couple of object on a background that is nothing more than the clear colour (which is 0.0,0.0,0.0,0.0).
 When I access the texture again every single pixel has 1 has alpha, how can I make sure the background has 0.0 ?

Thank you

Faye

sentences:
Libgdx create rectangle Scence 2D I want to draw a empty rectangle around my gamescreen, to show "borders" around. I've tried pixmap. Works perfectly fine, but i could not find the option of change stroke width of the rectangle.

I thougt about using texture, but i do not feel it's the best way. Due to there is no artwork into this border. It's just a thick line around the screen.

Remember i want to create the border once and not recreate it everytime i render.

Any suggestions?

sentences: How to make 4 way walking animation in game maker studio 2? So I am trying to make a 4 way movement for my character, and I cant seem to get the walking animations to work for it. The character moves fine, but whenever he moves, the walking animation doesn't play. I figured it was because I made it so when the button was held down, it put it as the sprite for that direction constantly, so it could never get to the next frame. does anyone know how to bypass this? (btw I am using D&D)

sentences:
Prevent character's animation from causing its mesh to interpenetrate itself I'm making a game with a pretty large group of people that respond to things the user does. They all have the same animator attached, but the animations that play differ using a script with a randomizer.

Now all Mixamo stuff is free I'm making some new and different models to put in my game, these models differ in size and shape, just like humans do. My previous setup was pretty much two models with the textures changed, so the animations were acting the same on all models.

This is now no longer the case with the new models. Hands of the models are moving through their leg mesh (see attached image). I fear I'd have to make separate animations for each model but I'd first like to know if there's maybe another way. I tried adding colliders to the leg and hand of each model, but the animation totally ignores those.

Does anyone know of a way to make sure body parts of my models don't go trough eachother? Or do I have to face the facts and make seperate animations for each model?

sentences:
How to limit the speeding up of enemy movement? Is there a way of limiting my speeding my enemy script every time my player collects 10 points. I have a movement script attached to my enemies and every time my player collects 10 points my enemies get faster. I want to put a limit on that so that the movement script (attached to my enemies) doesn't increase all the time even if the player continue to collect 10 more points and onwards. I want the limit to be 40, so even if the player continues to collect another 10 points the movement should stay at 40.

This is my speeding up my enemies script (this is used in my score script):

if (Score % 10 == 0){
    //Increment movespeed variable  from Movement script
    Movement.movespeed += 4;
}

And this is my movement script attached to my enemies:

public static int movespeed = 20;
public Vector3 userDirection = Vector3.right;

//public float lifetime;

void Start ()
{
    //Destroy (gameObject, lifetime);
}

public void Update()
{
    transform.Translate (userDirection * movespeed * Time.deltaTime);
}

How can I limit the movement speed so that it doesn't exceed the upper limit I want?

sentences:
Why not pre-render story parts in a game? When playing games nowadays there are often story related cut-scenes, during which you cannot interact with the game, you can only listen to it or watch it while it plays.

However in a lot of games these story scenes are rendered live with the game engine, and not with pre-rendered videos. I can't seem to understand why the story scenes aren't pre-rendered during game development

My question is:

Why not pre-render a story cut-scene during game development as a video with the highest settings so the user doesn't need to render it on his/her end?

My guess is that game developers don't choose to do this because videos and real-time game rendering need a smooth transition a lot.

sentences:
Can a MonoBehaviour be a private inner class? I want to use a private inner class MonoBehaviour as part of the internal implementation of a class (also a MonoBehaviour). Reduced to the essentials:
public class OuterClass : MonoBehaviour {
  public void SomeMethod(GameObject go) {
    go.AddComponent<InnerClass>();
  }

  private class InnerClass : MonoBehaviour {
  }
}

This appears to be all working absolutely fine, with no errors or warnings. But it also appears to violate the statement in the Unity documentation that:

The class name and file name must be the same to enable the script
component to be attached to a GameObject.

Is this a problematic violation of that rule? If so, what are the problems? I am aware that it means the script is not visible in the Editor, but that's exactly what I want: it should never be added by anything other than its enclosing class.

sentences:
Graphics card settings tampering with my Java game I'm working on a simple 2D side scrolling platform game in java.

It is a canvas with a bufferstrategy which is placed inside a jframe, and that jframe is set as the fullscreenwindow on the graphics device.

Now my computer has a decent nvidia card. In the nvidia control panel on my computer, just looking at the basic settings, if I set the the mode to "Emphasize performance," the game runs as it should and renders properly. The game is not vertical synced.

If I set the mode to "Emphasize quality" or "Let the 3D application decide," the game renders lines a slight distance away from where I intended them, collision detection is also slightly off, and things are overly anti-aliased. The game is now vertical synced.

Now on my crappy laptop, the game runs fine because the card is much less sophisticated. (I think?) However, on my friends computer, he plays with his ATI control center a bit (turns every enhancement off) and then the game runs perfect, but by default its a mess just like with my nvidia card.

TLDR: Is there any way to override the settings on the graphics card or force the settings to be set a certain way from inside Java?

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:
Room lighting in Unity I am trying to make a plain white room in Unity. I used six planes for the walls, but I can't figure out how to get the lighting to not look so harsh and uneven. The top picture is my best attempt using two directional lights, and the bottom picture is the look that I am trying to replicate. It is from a demo scene in the Google VR SDK 1.50 for Unity. It uses only a single point light, but when I turn it off in the scene view, it doesn't change the appearance of the room at all. How can I make my room look more like the Google VR demo?

EDIT: I made a big improvement by changing all my walls to be static so that they receive indirect lighting, and adding a single point light above the roof.

sentences:
How can I set a property for the upper limit for another property's range I have two properties, I would like to set one property as the upper limit of another property, hence making the upper rely on a property. As below:

public int fullLength;

[Range(0, fullLength)]
public int segmentLength;

Is there a way to do this, possibly with a custom editor? If yes, how can it be done?

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:
Detect walls in geometry Is it possible to automatically detect walls in polygon soup?

Of course it's hard to strictly define what a wall is, my slightly vague definition would be:

A wall is a largest possible box (not necessarily axis-aligned) with its entire volume covered by subset of geometry in that polygon set.

Provided set of polygons may contain multiple walls, walls under specific low volume should be ignored, walls may overlap if it's easier for the algorithm,
subset of geometry used to construct a wall may have larger volume than the wall itself, but opposite is not allowed.

sentences:
How do I turn an image into a Box2D physics object? I'm using Box2D for a Game Programming course, and I was wondering if it is possible to choose the best shape and size of shape for the rigidbody/fixture for a sprite based on its transparency.

I've tried to build with the idea of new content being easy to add (all data for enemies, terrain, etc. is stored in XML documents). Because of this, there will not be a new class for every enemy. This makes creating the fixture shapes difficult, since it has to be a generic solution but still map realistically to the sprite when the game is being played. The best solution I've come up with so far is to somehow figure out where the majority of the non transparent pixels are in the sprite and build the shape from that.

Does something like this exist? If not, would it be hard to implement?

sentences:
How do I properly load maps? I'm trying to load my map properly, but it takes some time (after the games has been started) to be how it should. Am I doing something wrong? Why is this happening?

AndroidStudio:

Tiled (map editor):

public class GameScreen extends Screen{
   private TmxMapLoader maploader;
   private TiledMap map;
   private OrthogonalTiledMapRenderer renderer;

   public GameScreen(Game game){
      maploader = new TmxMapLoader();
      map = maploader.load("level1.tmx");
      renderer = new OrthogonalTiledMapRenderer(map, 1);

sentences:
How to efficiently average multiple rotations (quaternions)? So, I'm working on an animation system in C++, and am trying to blend multiple animations together. A slerp is easy on two quaternions, but is it efficient (or accurate) to chain together for more than two quaternions? I would think there'd be a better way.
I did stumble upon this thread outlining an approach in Unity,  but it looks pretty cumbersome, and a lot of it doesn't translate easily into the code base I'm working with.  I have actually implemented the eigenvalue-based approach, but it is very slow. There must be a more efficient way!

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:
Could use some help figuring out bouncy physics material in this PhotonEngine game So I'm trying to prototype a primitive 1v1 fighting game where the goal is to push the opponent off of the platform rather than actually fight. This is working great in a local multiplayer setup using a physics material on the "belly" of the Rigidbody2d players (the circle collider gameobject nested inside of the square gameobject has the bouncy material).

But I'm toying with the idea of making it a network game and it seems the physics material doesn't get communicated too well over the Photon Realtime connections?

Here is a video showing how it seems like sometimes the position is updated but sometimes a player runs into another player and its like a brick wall:

https://imgur.com/QYWH178

Any ideas of what to try or if this is even possible?

A bit about how things are currently setup:
Each player object has the nested collider with a high bounciness material on it. Each player moves via the Rigidbody2D component via

.AddForce(direction * Speed);

I have a Photon View component on the player prefab and a Photon Rigibody 2D View component that is checked to Synchronize Velocity and Angular Velocity, as well as a Photon Transform View component synchronizing Position. Both the transform view and Rigidbody2dView are Observed Components in the Photon View.

I also found a script someone posted where they were manually sending the position/velocity data via OnPhotonSerializeView() I've tried adding that script and making that observable as well, but no luck, but it looks something like this:

 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
        {
            if (stream.IsWriting)
            {
                //We own this player: send the others our data
                stream.SendNext(transform.position);
                stream.SendNext(transform.rotation);
                stream.SendNext(r.velocity);
                stream.SendNext(r.angularVelocity);
            }
            else
            {
                //Network player, receive data
                latestPos = (Vector3)stream.ReceiveNext();
                latestRot = (Quaternion)stream.ReceiveNext();
                velocity = (Vector2)stream.ReceiveNext();
                angularVelocity = (float)stream.ReceiveNext();

                valuesReceived = true;
            }
        }

        // Update is called once per frame
        void Update()
        {
            if (!photonView.IsMine && valuesReceived)
            {
                //Update Object position and Rigidbody parameters
                transform.position = Vector3.Lerp(transform.position, latestPos, Time.deltaTime * 5);
                transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
                r.velocity = velocity;
                r.angularVelocity = angularVelocity;
            }
        }

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:
Calculate impulse need on object to throw i Y meters into the air, with varying mass Say I have an object that has a variable mass. Now I want to apply a vertical impulse (straight up into the air) onto the object, so it always flies up to the same height. How do I calculate this?

So the variables are:

m: mass
Y: height (constant)
If: Impulse force
G: Gravity

The origin is always from a floor, so no mid-air impulses or anything.

(I'm using the Box2D engine, but I think that a solution would be engine independent?)

sentences:
How to find the participation id corresponding to a sender id I am creating a real time multiplayer game in unity 3d using Google Play Game Services. In my function where I deal with the positioning of players based on information that is sent from other players, I get a sender id. The sender id is a long string of characters that does not match any participation ids. My participation ids are just strings such as "Player 1234." I keep the participation ids in an array so I can reference them and compare them to the sender of the information that I am receiving so I know which player it is from.

If the sender id and participation id are two different things, how do I make the connection between the two?

Here is a link to the tutorial I have been following for Google play services in unity:
https://www.raywenderlich.com/87042/creating-cross-platform-multi-player-game-unity-part-2

sentences:
How to save variables into a file unity I've wanted to save progress of my game (i don't have the code , sorry)
without using PlayerPrefs.
If it's possible ; with UnityEngine.

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

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

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

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

sentences:
How 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:
How can I stop Substance's runtime texture caching? Procedural textures with the Substance Engine seem to update very quickly if you turn off caching, modify one exposed variable at a time, modify it frequently, and even then only after you've attempted to modify it 2 or 3 times.

However, I want basically the opposite. For example, units have a "blood" variable that generates blood differently on them as they take damage, as well as a "battle wear" variable that generates scratches and dents, but doesn't revert when they heal.

So to force a variable not to cache, I have to set it to some dummy value, then back to normal, then call RebuildTexturesImmediately.

How can I tell Substance not to cache a variable at runtime, so I can change it once and have the texture regenerate quickly?

sentences:
Unity3D: Rendering images weirdly in GUISkin So i'm trying to make a gui skin in Unity3D and i'm having some problems with the images, what I mean is the images are being rendered all weirdly, not properly and some have lines through them. I have some photos of what is happening.

Background (GUI Box)

Button (GUI Button)

Anyone know why the images are being rendered weirdly and how to fix it? Appreciate any help!

sentences:
2D Rain Creation (and Fluid Dynamics) I am experimenting with weather conditions in a game of mine, and I was impressed by the way Starbound handled the rain. Basically, when rain hits the ground, it's either dispersed horizontally (and absorbed by the ground), or it creates piles of water (when raindrops land inside a hole in the ground).

This video demonstrates this clearly:
http://imgur.com/gallery/CKCGKbG

I know how to make rain fall and check where it hits the ground, but that's where I get stuck. My question is: how could this have been created? And how could one model the water flow so perfectly, without killing performance?

Thanks in advance!

sentences:
How to add a ramp in a flash game? I am a huge novice and this isn't really a programming question, but here I go, say I want to make a game that involves rolling up a ramp like this one:

to move upwards, similar to how it would work in an old Sonic the Hedgehog game or something, how would I go about doing that, where could I find a good recourse to learn this?

sentences:
Webworkers HTML5 for game AI? So I am designing a game like scrabble in which a user has to make words using the letters on the screen. When the there is no possible combination of word that can be made with the letter the game is automatically supposed to tell the user to shuffle. Which changes the present set of alphabets with a new set (odds are very very very low that the new set cannot form a word either.)

So I now its a simple word game, but I am making this on HTML5 Canvas. It hugely resource consuming. And I need to run this even heavier computation on the client machine of whether a new word is possible from the selection on the screen. Ideally I would run a thread were this an app for the native code, and check after every new word created whether new words are possible with the remaining alphabets. Alas on the web browser I am afraid, it will toast the computer, crash the browser and a lot of other horrible things. So I would like to know is there a way that I could make such a computation feasible with all the other actions I am already running!?

Thanks

sentences:
Unity RTS Multiple Selection Approacah I've recently solved the single selection problem but now I want to do multiple selections. I know I need to find two points with the mouse position to draw a box but it just won't work for me.

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            bool dragging = true;
            Debug.Log("Multiselect active");
            MultiSelect(dragging);
        }
    }
    private void MultiSelect(bool dragging)
    {

        mouseDownPoint = Input.mousePosition;
        if (Input.GetMouseButtonUp(0) && dragging)
        {
            mouseUpPoint = Input.mousePosition;
        }
        Debug.Log("First pos: " + mouseDownPoint + " Second pos: " + mouseUpPoint);
        dragging = false;

    }

What is a better way to achieve what I'm trying?
If someone can tell me a way that can also detect any units inside the area that'd be nice too.

sentences:
LibGdx animation sequence In my game the character movement animations work fine
but now I'm trying to do a sequence of programmatic animations,
for an enemy character, and it's proving to be a pain.

I'm just doing it on Android.

I have the enemy character doing a walking animation till
it reaches and end position, then I want it to do a three frame
throw animation.  It's walk animation is fine.

Since I only want to do the throw animation frames once, I tried to use
Animation.PlayMode.NORMAL, and try to use isAnimationFinished().

I also tried to get the frame number using getKeyFrameIndex()
to try to detect when it showed the last frame.

But in both cases, when it reaches the end position, either I just
see a flash of one of the throwing frames, or nothing at all,
and it says it's "finished" with the animation, using one of the above
ways to test it.

objectBatch.draw(
    animation.getKeyFrame(throwingSkeletonObject.fStateTime),
    throwingSkeletonObject.position.x,  // x
    throwingSkeletonObject.position.y,  // y
    1,      // width
    1);     // height

I'm using the fStateTime that was passed into the Object from the
update() of the Object.  For the walking animation I use:

 animation.setPlayMode(Animation.PlayMode.LOOP);

and for the throw animation:

 animation.setPlayMode(Animation.PlayMode.NORMAL);

The frameDuration for the walk animation is 0.7f and for the throw 0.3f.

So what do I need to do to be able to actually see
all the frames of the throw animation, and then be able to
tell when that's "finished", so I can go back to the walk
animation going the other way or whatever?

I've tried lots of different combinations of things, including using
a slower throw frameDuration, and nothing seems to really work.

Eventually I want to try to get the Boss animations going
and those are much more complicated, so I want to get
this fairly simple sequence to work.

UPDATE:

In the update() I'm doing:

throwingSkeletonObject.fStateTime += fDeltaTime;

The game is 2D, and I'm not using scene2D.

UPDATE  SOLVED?:

I wrote a smaller test app in hopes of replicating the problem
but it worked pretty well.  When it did the throw animation I reset the
StateTime back to zero, so as a test, I commented that out so it used the
same StateTime as the walking animation and it only showed one
frame of the throwing animation, so I think that was the problem.
But I'm not sure about the throwing animation "end" test, I'm hoping
that that will also work now.

sentences:
How do I configure the clipping region when drawing with XNA's SpriteBatch? I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500 pixels larger in both height and width. Whenever I draw to a point outside of the physical screen dimensions, it will not draw the object.

I am performing some 3D transforms on the texture so I need the areas outside the screen to be drawn. I have tried setting culling to None and this had no effect.

sentences:
What does a matrix represent? I began learning OpenGL recently and am having problems visualizing what matrices are and their role in computer graphics. Given the template of a 4x4 matrix like this:

I would assume that each matrix like this are the coordinates of a vertex in world space. And several of them put together and shaded give an object?

But why is there a Xx, a Xy and an Xz? I read that its a different axis (up, left, forward) but still can't make heads or tails of the significance.

sentences: Using tex2Dlod to determine the appropriate size of the texture We have a top-down game with fixed camera position. We also use orthographic projection so every model in the game will always be viewed from the very same angle and from the very same distance. The question we want to answer is what size should our textures be for each model. I tried turning off mipmapping and clearly saw that the game does not use the highes mip level when drawing our stuff. I also know that tex2Dlod can be used to specify which mip texture level to use for sampling, so my plan is to gradually change this value to manually specify lower and lower mip levels until I see that decreasing it further reduces the quality of the picture. The problem is I cannot figure out how to set the mip level. The value passed to the tex2Dlod function is float4 and as I understood x and y hold te texture coordinates and w holds the mip level. But it should be set in fractional representation and I cannot know what the step size is. So basically I need to know what number I need to send into the function to gradually switch mip levels.

sentences: Changing the object material without clicking on it How can I change the object material automatically without clicking on it?  The object material should change based on a timer.

sentences:
Unity Occlusion Portals: What and How? (Here I eat my words on Meta about posting Unity questions on Unity Answers... since that site is less responsive than this one.)

Unity provides cell-based Occlusion Culling (via Umbra, I believe). However, a newer feature that it supports is Occlusion Portals.

The question is, if BSP-based occlusion culling is already a feature of Unity, what do portals add, and how?

PS. This question is not "What are portals?" -- I'm aware of the original Quake BSP-style portals -- which is partly why I find the explicit portal concept in Unity odd, since it uses BSP anyway.

sentences:
Monogame / XNA - Multple 2D Cameras (Rectangle) on screen I recently started building a simple 2D roguelike game using Monogame 3.4. I was keen on building the game "engine" myself as I saw it as a fun learning curve. Monogame was pretty much the best option for me to get started as I'm a C# dev by profession.
After getting my sprite to run around on the screen, I figured I probably need a proper level to continue with the more interesting stuff. So I decided to build a level builder for the game.

I've been struggling and digging around tutorials regarding building a 2D Camera.

I used this camera tutorial and I preferred this specific implementation.
My only problem is, currently, I have two Rectangles (Cameras) on my screen.

The Rectangle on the left represents a scrollable panel with all the available sprites but is also a sort of overlay. Underneath it, the level "map" is drawn.
My question is simply, how would I enable my level Rectangle to scroll past the overlay to view the left-hand side of it, which is currently being obscured by the panel.

Relevant code files are here

I would appreciate all the help I can get.
Thanks!

sentences:
How to make a static Material reference? I have a class Edge which may change to multiple colors - materials in this case. I need to switch a Material on MeshRenderer.

In order to do this, I'd need to make multiple prefabs public variables like

class Edge : Mono{

    public Material red, blue, green;

    public void SwitchColor(SomeColorEnum param){
        switch(param)
           // change
           // this.renderer.mat = something;
    }

}

This is a bad solution for this, cause I'd need at least 3 material references in each Edge object. Is there any way to make a material static, assign it from a prefab and then access it statically?

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:
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:
Mesh made in Blender is correct in Unity3D as a rendered mesh, but "empty" as a collider? I created a simple stair "block" in Blender, and it's rendered correctly, but when I tick "Generate Colliders" and try to use it in a Mesh Collider, there is nothing.

(Ps.: I need the real mesh as a collider, not just that generated convex one)

Maybe a good clue is that my other objects' generated colliders are smaller than the rendered meshes themselves. Maybe this one is scaled to zero?

After triangulating:

And via Unity's automatic triangulation: (the original, non triangulated blender model)

sentences:
Why Unity Navmesh codes should be executed first? I'm trying to calculate path using NavMesh.CalculatePath and use rigidbody alongside with it,
how ever if character does not stick to navmesh baked area the calculatePath codes will not work.
I also found that if my path finding codes does not run first the path finding will not work either.
for example:
void Update {   //path finding in this script will work
  PathFinding();
  GetDistance();

}

void Update {   //path finding in this script will NOT work
  GetDistance();
  PathFinding();

}

any help regarding to solving the problem or understanding how Unity navmesh system works will appreciated.

sentences: For 2D tiled maps is all object and NPC data loaded into memory when the map is loaded? I'm creating a text RPG in Java, but I think this applies for a GUI as well with regard to the data structure. Each Level is a tiled map. Each Tile object has an (X,Y) coordinate, and references to adjacent tiles, but my question is with regard to storing object and NPC data on that Tile object. Depending on the size of the map I'm loading, this seems like a lot to load, but if that is the commonly accepted practice then I'll go with it.

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:
UDP + digital signature vs TCP vs other solutions to guarantee message authenticity TCP guarantees message authenticity rather reliably using packet sequence number.
Other option would be going with UDP and using digital signatures to make the message authentic.
What could be my other options (basically are there any I missed)?
Maybe there is some sort of framework which I could use which would allow me to plug into a game engine without writing all authentication logic(each time using tcp i would need that clients login into my system, with udp i would rely on client public signatures inside my db).

TY

sentences:
Vertex data from a buffer I'm using a geometry shader to generate polygons for my voxel terrain (marching cubes).  The data is output into a buffer using the method shown in the article I link to below.

http://msdn.microsoft.com/en-us/library/bb205122%28v=vs.85%29.aspx

Is there any way to somehow extract the vertex data from the buffer, sort of like the inverse operation of this?

struct Vertex
{
    float x, y, z;
    float tu, tv;
}

Vertex[] data = new[] // this is what I want to get
{
    ...
};

DataStream stream = new DataStream(bufferSize, true, true);
stream.Write(data);
stream.Position = 0;
buffer = new Buffer(device, stream, description);

sentences:
Shooting at mouse in unity I'm using unity and trying to get my bullet to shoot at a target. I am clicking the mouse and I'm wanting to fire my bullet in that direction.

I have gotten the coordinates of the mouse click and tried to compute the vector. Then I've tried instantiate the bullet prefab (which has rigidbody component and is in front of the scene) at my position and then fire it in the direction of the mouse.

I can see that my objects being instantiated in my Hierarchy Pane but can't see anything on the screen!

Not sure if I'm doing the vector thing right (newb here), but if I click on Yoshi's head, I'm getting (-2.0, -0.4). Does this sound right?

Code:

void fireBullet(float mousePositionX, float mousePositionY)
    {

        Vector2 position = new Vector2(mousePositionX, mousePositionY);
        position = Camera.main.ScreenToWorldPoint(position);
        GameObject bullet = Instantiate(bulletPrefab, transform.position, Quaternion.identity) as GameObject;
        bullet.transform.LookAt(position);
        Debug.Log(position);
        bullet.rigidbody2D.AddForce(bullet.transform.forward * 1000);
    }

sentences:
Game Maker Studio 2: Why is my variable not being properly changed? Ok, so in my game you have a party of four characters that you control one at a time, each of which can lose health and die independently of each other. All of the player character objects use essentially the exact same code controlling their "deaths", (just with their own object variables and flags that get set and triggered etc.), but for whatever reason identical code does not produce identical results for all of the characters.

In particular, one of the character classes, the Alchemist, absolutely refuses to either set their "dead" flag to True properly, or at the very least the sections of code that are dependent upon "dead" being true do not appear to be acknowledging that it is. I've gone over all its events several times and monitored its behaviors in-game very closely, and everything about its malfunctioning behavior can be traced to the fact that it's completely ignoring the "dead = true;" line in one of its events while still executing the remaining code that follows it. Absolutely nothing else in any of its events sets or modifies this variable outside of its initialization in the Create event; it's just this one line of code that works perfectly for every other character object refuses to do its one job for this object in particular, and everything is falling apart because of it.

Does anyone know why this might be happening? Is there some quirk of proper GML practice that I'm not using?

If it helps, here's the code that gets triggered when a character is made "dead"

else if(wounded and position == 0 and !dead)
{
    dead = true;
    instance_create_layer(x,y,layer,obj_alchemist_corpse);
    death_sort();
}

Everything else is just a series of If statements that are triggered by 'dead' being true, but again, it would appear that one object in particular is executing the code in the above statement without actually setting 'dead' to true, and I would like to know why or why not.

EDIT: Forget what I said about an alchemist; further testing indicates it's just the second character in your party line of four that isn't getting their flag properly set.

sentences: 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:
How to draw non-triangulated mesh? I am working with DirectX (C#/C++).
I am wondering is it possible to do not triangulate meshes and what the difference between cases (in loading and rendering code)? If so, how to do this? I know DrawIndexed requires primitive_topology to be set - which value should I use then?
I always used triangulated mesh before with no problems but it is interesting..

sentences:
Java - simultaneous ground and wall collision I've been working on a Line2D based collision system:

public void update() {
    for (int i = 0; i < lines.size(); i++) {
        line = lines.get(i);
        if (line.line.intersects(player.hitbox))
            playerCollision();
    }
}

public void playerCollision() {
    if (Math.abs(line.angle) <= 45) {
        player.jumped = false;

        if (player.speedY > 0)
            player.speedY = 0;

        // inefficient?
        while (line.line.intersects(player.hitbox)) {
            player.centerY--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

        player.centerY++;
        player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2, player.WIDTH,
                player.HEIGHT);

    } else if (line.angle > 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

    } else if (line.angle < 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX++;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }
    }
}

Overall, it works pretty well. There is, however, one problem I haven't been able to fix. When the player collides on a place where a wall and the ground meet, both the ground and wall collisions are executed, however, only one should be.

The result is that the player is abruptly pushed off a cliff when approaching one, or that the player is abruptly moved up when jumping alongside a cliff.

When approaching a cliff:

After one step to the right:

I've been able to come up with a method to determine which collision should be executed:

if (player.hitbox.getMaxY() - player.speedY > line.line.getY1())
    // execute wall collision only
if (player.hitbox.getMaxY() - player.speedY <= line.line.getY1())
    // execute ground collision only

However, I haven't been able to come up with how to implement this. I can't check all lines for collision first and execute the collision later, as the collision is executed per line. Does anyone know how I can fix my collision system?

P.S. I'm a beginning game developer, so my collision detection system might be bad or inefficient. If there's a better way to do this, that doesn't have the same problems, I'd love to hear about it. Please keep in mind, though, that I'm trying to keep the code simple and efficient.

sentences:
What's the economical design difference for a global auction house or seperate auction traders? I'm playing The Elder Scrolls: Tamriel Unlimited and there we have local auction houses. (Thy don't have auctions, but I keep the term to not get confused in the following text.)

I can see the advantage that guilds (who own these AHs) can set up their own little economy, which is a nice feature.

On the other side I always have to check several guild traders to see which one offers my searched item for the lowest price.

On the forums, people are discussing heavily whether a global auction house should be introduced or not. This may have pros and cons, too, but I'm not too involved in this game design to really set up a mind for that.

Backers argument that an global AH leads to a more regulated market, easier to use and a seller will reach a broader audience (reads: When you put in an item, you can be sure that there may be a buyer.)

On the other hand critics say that this will make only really useful items get a massive increased price and common used items will drop their prices to their normal selling price.

But are these concerns really true? Would the introduction of a global AH really have such a big impact on the game's economy? And if yes, will they more tend to even the prices or really make most of the items useless for selling?

You could also ask vice-versa: If a game already has global AH, what would the impact be if they replaced it with local auction houses?

What is the difference for the game's and players' economy if you introduce a global or local auction house system?

For clarification: I do ask this for the matter of The Elder Scrolls: Tamriel Unlimited. But you can also subject this to other games. (This should be more a theoretical question for a developer's decision.)

sentences:
Changing a rotation and position of the camera smoothly when a button was clicked How can I change a rotation and a position of the camera smoothly when a button is clicked in Unity?

I do not want to use Update function to implement this and I do not have a GameObject or Transform which it should look at, rather I want to tweak everything manually.

I would like to see the approach using C#.

sentences:
Detect when an Oculus headset is stationary/idle using transform.hasChanged I want to know how can I change in unity the thershold of the method below:

  transform.haschanged

At the moment it is so sensitive and it triggers with 0.00001 change in the camera.

We have created an Interactive VR video in unity and we want that everytime the user doesnt use the oculus for 30 seconds, a trailer video starts to play!

We have created the code below but even when the oculus is on the ground, still moves a bit (too sensitive):

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

public class Trailer : MonoBehaviour
{

public int timeOut;

private int timeOutTimer = 0;

private Quaternion gameObjectrotation;
private VideoPlayer videoPlayer;
public float dynamicRange = 100f;

// Use this for initialization
public void Awake()
{
    Vector3 lastPos;
    videoPlayer = GetComponentInParent<VideoPlayer>();
    gameObjectrotation = Camera.main.gameObject.transform.rotation;

    InvokeRepeating("ScreenSaver", 0, 1.0f);
}

public void ScreenSaver()
{

    timeOutTimer++;

    var wMinus = gameObjectrotation.w - dynamicRange;
    var wPlus = gameObjectrotation.w + dynamicRange;
    var xMinus = gameObjectrotation.x - dynamicRange;
    var xPlus = gameObjectrotation.x + dynamicRange;
    var yMinus = gameObjectrotation.y - dynamicRange;
    var yPlus = gameObjectrotation.y + dynamicRange;
    var zMinus = gameObjectrotation.z - dynamicRange;
    var zPlus = gameObjectrotation.z + dynamicRange;

    var cameraW = Camera.main.gameObject.transform.rotation.w;
    var cameraX = Camera.main.gameObject.transform.rotation.x;
    var cameraY = Camera.main.gameObject.transform.rotation.y;
    var cameraZ = Camera.main.gameObject.transform.rotation.z;

    if (cameraW >= wMinus && cameraW <= wPlus && cameraX >= xMinus && cameraX <= xPlus && cameraY >= yMinus && cameraY <= yPlus && cameraZ >= zMinus && cameraZ <= zPlus && timeOutTimer >= timeOut)
    {
        //Show video
        videoPlayer.gameObject.SetActive(true);
        videoPlayer.Play();
    }
    else
    {
        //Hide Video
        videoPlayer.gameObject.SetActive(false);
        videoPlayer.Stop();
        videoPlayer.frame = 1;
    }

    if (cameraW > wPlus || cameraW < wMinus || cameraX > xPlus || cameraX < xMinus || cameraY > yPlus || cameraY < yMinus || cameraZ > zPlus || cameraZ < zMinus)
    {
        timeOutTimer = 0;
    }

    gameObjectrotation = Camera.main.gameObject.transform.rotation;
}
}

Any help would be appreciated!
Cheers

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: How could I format my C# code using Checkstyle? Is there any possible way to check my C# code with Checkstyle in the context of Unity?

sentences: What is the difference between AR, VR and MR? Please explain clearly and in short about the differences and boundaries between AR, VR & MR.

sentences:
Securing HTTP data from a JavaScript game to server Suppose I am doing a JavaScript game, and I wish the game to update the server if the user has successfully completes the game and his outcome.

How should I ensure that the request came from the JavaScript game, and that the data sent has not been tampered with. I am using PHP as the server-side language.

I do understand that no strategies are going to be 100% fool-proof, and any measures taken is more of a deterrence than absolute protection.

On Edit: Let's supposed we're not using server verification of each user's step (as in a traditional MMO). The game could be a mini-game as part of a web game or educational game (space invaders or a real-time game, for example) and requiring a server-side component for each of those games could be tedious.

Example: Supposed, when the game is completed, a request is sent to the server via. AJAX

game_finished.php?user_id=1&outcome=success&score=88

A user could 'fake' the server in believing that the game has been completed correctly by sending that request to game_finished.php. How could this be made more difficult?

sentences:
Float-based screen coordinates, higher mouse precision I wrote 2 weeks ago about problem with motion blur in my engine. When camera moves using keyboard, motion blur is smooth. But when I rotate camera using mouse motion blur is stepping (not sure if I used proper term). Now I rethink my problem and it brings me new questions.

To rotate camera I use mouse delta which is difference between last position and current position. But it is expressed in pixels. Furthermore WinAPI events doesn't have per-pixel precision.

I saw that engines uses it's own screen coordinates which is float-based (http://www.esenthel.com/wiki/index.php?title=Screen_Coordinates). I checked that and I see that even small movement (smaller than 1 pixel) is detected. I believe that this is the solution to my motion blur problem and also with another further problems (for example different size of GUI components on different resolutions).

And here is my question. How can I get such mouse precision? I read about WM_INPUT and dividing delta by mouse DPI, but there are two problems - we can't get mouse DPI using WinAPI and mouse event still return value in pixels.

Where can I find some informations or example of solving this problem?

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 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:
Implementing match-making & community system for multiplayer games These days, games often have multiplayer portals with chat channels & match making system for the multiplayer aspects of the game.

An example would be battle.net, magic the gathering online's chat rooms, halo etc.

Now, for the rest of us indie gamers that probably won't be able to spend much development effort on creating those back-ends from scratch, what options do we have?

I was thinking of something along the line of using IRC as the backbone of the system. From there, implement the "community" aspect, player tracking, game tracking and match making on top of that. It seems to be what the old battle.net (brood war era) used to be.

The question is, is this easy to do? What does it take to run an irc server, and I suppose this also requires writing an IRC client (which seems to have been done a lot these days?)?

If there are other ways as well (say, an open framework for this stuff), let's hear them too.

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:
Collision detection in Pong clone Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked perfectly. So I searched it a bit and I came to the conclusion that it was because in one frame the ball was already through the paddle and in another frame the ball was not or something like this. So thought that if I would manually adjust the position of the ball, like move it a couple of pixels away the moment it hits a paddle or the walls too, this would solve the problem. But now when the ball goes right past a paddle its movement is getting weird and it goes right in the playing field.  for reference also some code if you want to look it . I feel bad for doing the whole collision like these but I couldn't think some other way. Please enlighten me if there are better ways to do it that I can avoid the frame problem I mentioned above. Here is the code that handles the ball's movement :

   void Ball::move(float xLeftPaddle, float yLeftPaddle,float xRightPaddle, float yRightPaddle, Uint32 deltaTicks)
{

    y +=  yVelocity * ( deltaTicks / 1000.f );
    x +=  xVelocity * ( deltaTicks / 1000.f );

    if(   y + BALL_HEIGHT > SCREEN_HEIGHT )
    {
        x = x-1;
        y = y-1;
        yVelocity = -yVelocity;

    }
    else if( y < 0 )
    {
        x = x+1;
        y = y+1;
        yVelocity = -yVelocity ;
    }
    else if(x + BALL_WIDTH >= xRightPaddle && y <= yRightPaddle + PADDLE_HEIGHT && y >=yRightPaddle  )
    {
        x = x-1;
        y = y-1;
        xVelocity = -xVelocity;

    }
    else if( x <= xLeftPaddle + PADDLE_WIDTH && y <= yLeftPaddle + PADDLE_HEIGHT && y >= yLeftPaddle)
    {
        x = x+1;
        y = y+1;

        xVelocity = -xVelocity ;
    }
    else if(x < 0 || x > SCREEN_WIDTH)
    {
        x = SCREEN_WIDTH/2;
        y = SCREEN_HEIGHT/2;
    }

}

sentences:
How to open auto detect LAN connections? After sucessfully creating my first online multiplayer with servers and clients in UDP, I am wondering how LAN connections works. As it is right now, I need to open a server and forward the ports for the server if public. In LAN, they connection is possible but requires the local IP address.

However, if we take Minecraft or Starcraft, the game is able to auto detects servers on your local network.

How are they achieving this ?

sentences:
How to get enemy to follow character using angles? (atan2) I have an enemy and a character to control. I want to get the enemy to follow the character in a straight line. I already found the angle in which the enemy needs to travel.

double angle = Math.atan2(y, x) * 180 / Math.PI;

Now, let's say it return 73.0. What do I do with that number? And what if it's a negative angle.

BTW, I'm using dx(dynamic x) and dy(dynamic y) to control movement.

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:
Calculating correct normal direction from multi-variable function I am working with a plane model which I am offsetting the vertices on the up axis to look like waves by using the function:

Sin(vertex.x * frequency) * amplitude + Cos(vertex.y * frequency) * amplitude

Previously, I did this with a single variable and was able to confirm my normal directions were correct by getting the derivative, taking the tangent direction from that, and getting the perpendicular direction to the tangent in order to get my normal direction. I then just flipped them so they were facing the right way.

Now that I have added in the second, y, variable I have tried to take a similar approach. Where I take the two partial derivatives, get the tangent direction for each, get the normal for each from that, and then add the normals together to get my final normal direction. However, it seems that the results I am getting are different from those of the Unity calculation, which is correct.

Here is an image comparing my results to the correct Unity calculation:

Does anyone know where about I am going wrong in my calculation? I think it may be related to where and when I am normalizing, but I have tested out a bunch of different options and can't seem to get it to look correct and am now questioning if perhaps my method for combining the two normals is wrong. Thanks for any input. Below is a snippet of the code I am using to do this.

offsetAmount = Mathf.Sin(vertices[i].x * _Frequency) * _Amplitude + Mathf.Cos(vertices[i].y * _Frequency) * _Amplitude;

private void DifferentiateNormals()
{
    // Loop through every normal and calculate it manually
    for (int i = 0; i < vertices.Length; i++)
    {
        // The derivative is also an equation for the slope of a tangent line
        float offsetAmountDerivative = Mathf.Cos(_Frequency * vertices[i].x) * (_Frequency * _Amplitude);
        float offsetAmountDerivative2 = Mathf.Sin(_Frequency * vertices[i].y) * -(_Frequency * _Amplitude);

        // Rise / Run => Rise is the derivative function, run is 1
        Vector2 tangent = new Vector2(1, offsetAmountDerivative);
        tangent.Normalize();
        Vector2 tangent2 = new Vector2(1, offsetAmountDerivative2);
        tangent2.Normalize();

        // The perpendicular of tangent direction (x,y) is (y,-x)
        Vector3 normal = new Vector3(tangent.y, 0, -tangent.x);
        normal.Normalize();
        Vector3 normal2 = new Vector3(tangent2.y, 0, -tangent2.x);
        normal2.Normalize();
        // Flip the normals to be the correct direction (up)
        normal = -normal;
        normal2 = -normal2;

        Vector3 finalNormal = normal + normal2;
        //Vector3 finalNormal = new Vector3(_Amplitude * _Frequency * Mathf.Cos(_Frequency * vertices[i].x), -(_Amplitude * _Frequency) * Mathf.Sin(_Frequency * vertices[i].y), -1);
        finalNormal.Normalize();
        //finalNormal = -finalNormal;

        if (direction == ModelUpDirection.Y_Up)
        {
            // Works for Unity Plane
            normals[i] = new Vector3(finalNormal.x, finalNormal.z, 0.0f);
        }
        else if (direction == ModelUpDirection.Z_Up)
        {
            // Works for 100x100 Plane
            normals[i] = new Vector3(finalNormal.x, 0.0f, finalNormal.z);
        }
    }
    mesh.normals = normals;
}

sentences:
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:
Where's Anti-Aliasing in LWRP? In Unity 2019.2 -LWRP (lightweight render pipeline project) the default Game Output(Quality = High) is rendering with jaggies.

Inorder to get a clear render ,while looking for the Anti-Aliasing option it doesn't seem to be under the default location (Edit-Project settings-Quality )for LWRP projects.

Where is the Anti-Aliasing option in LWRP and is there any other way to get a clear game render?

sentences:
Can't work out how matrix is applied to 2D vertices I have a texture, some 2D vertices, and a matrix. The matrix is used to calculate the texture coordinates for each vertex, but the problem is that the matrix comes with absolutely no documentation and I'm having trouble working out how to calculate the texture coords correctly. I have it partially working.

The matrix is in this format:

sx rx tx
ry sy ty

Where s means "scale", r means "rotate", and t means "translate".

If the matrix doesn't contain any rotation (i.e. ry = rx = 0), I can correctly calculate the texture coordinates u and v like this:

u = x/sx - tx
v = y/sy - ty

But I can't figure out how to put rx and ry into the equation and get the correct results. Normal matrix multiplication involves multiplying and adding but this one involves dividing and subtracting, so I know I'm missing something but I don't know what it is.

Here is one of the matrices with rotation:

26.191574096679688   7.0180206298828125  1579
-7.0180206298828125  26.191574096679688  1879

Here is one of the matrices without rotation:

27.115478515625  0                1867
0                27.115478515625  800

sentences:
How do I manage monster tables and item databases in my Android game? To learn more about AI during combat, I made a demo in Unity where a player would fight a creature in an arena. I started here because I plan to implement the system I'm working on in another game. In that game, there are a lot of different creatures a player has to fight.

These creatures have a body part set, a move list, an attribute set and a drop table for that type of creature. Currently I'm managing this by a big static class with drop tables, move tables, monster tables and item tables and so on in them. When a creature gets instantiated it copies monster data from that static class and when it dies items in the referenced drop table are instantiated, copying some data from the item table. Whenever a monster performs a move, the necessary information is looked up in that static class.

I could solve monster data by copying the necessary data into the monsters and then dispose of the class, but that leaves no option for items, which are referenced by ID and need to be looked up frequently. Serializing and deserializing the data wouldn't make sense if I would have to load the entire item table or unit attributes every time every time I access them. Keeping the entire game data loaded all the time doesn't sound like the best way to go about managing my data.

My own system is becoming unmanageable. Because I'm targetting Android, I'm also, to a lesser degree, worried that having such a big static class loaded all the time will become a burden once more features are added to the game. I have read this post but didn't find it of much help.

Which ways are there to improve from the current situation?  How could I handle a frequently used item table/database more efficiently. And on the other side, how could I handle a move table and monster table better? How did NetHack do it, for example?

sentences:
How can I calculate a vertex normal for a hard edge? Here is a picture of a lovely polygon:

Circled is a vertex, and numbered are its adjacent faces.  I have calculated the normals of those faces as such (not yet normalized, 0-indexed):

Vertex 1 normal 0:   0.000000   0.000000    -0.250000
Vertex 1 normal 1:   0.000000   0.000000    -0.250000
Vertex 1 normal 2:  -0.250000   0.000000     0.000000
Vertex 1 normal 3:  -0.250000   0.000000     0.000000
Vertex 1 normal 4:   0.250000   0.000000     0.000000

What I'm wondering is, how can I determine, taken as given that I want this vertex to represent a hard edge, whether its normal should be the normal of 1/2 or 3/4?  My plan after I glanced at the sketch I used to put this together was "Ha!  I'll just use whichever two faces have the same normal!" and now I see that there are two sets of two faces for which this is true.

Is there a rule I can apply based on the face winding, angle of the adjacent edges, moon phase, coin flip, to consistently choose a normal direction for this box?

For the record, all of the other polygons I plan to use will have their normals dictated in Maya, but after encountering this problem, it made me really curious.

sentences:
What kind of shader is this? Cube World uses a pretty good looking shader, I especially like the shading of the characters:

Is this soft shading? I'd like to achieve this effect in Unity 3D Free, but since the free version doesn't support dynamic shadows, guess I have to code it myself, so an article on this or the algorithm would be great.

sentences:
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:
Cave lighting in Unity I have a cave that is inside a mountain (one mesh) that I created in Blender.  I would like to make the cave quite dark inside so that either the player can light it up, or it is lit up with things such as crystals.  Because I have ambient light through the scene, it's proven to be quite awkward to make it dark, and removing the ambient light kinda destroys the look.

I then played around with having a separate material for inside the cave so that I can make it darker, which kinda worked, but then I noticed a big issue with shadows.

The following images is from inside the cave far from the entrance.

The first image is with the default settings for shadow distance (in this case it was 70 in the quality settings).  As you can see in the image, the shadow doesn't fill the cave because of the distance.

Second image is with the shadow distance turned up to make sure the cave is in darkness (not pitch black though, due to ambient lighting), this took the setting from 70 to around 500.

The problem with setting the distance so high, is that it causes artifacts on geometry outside the cave, which look nasty.

What's the best way to make a cave dark (doesn't need to be pitch black) without removing ambient lighting for the whole scene?

I was looking at similar art styles to what I am working on, and Grow Home (Unity) is basically where I am heading.  They have caves which would be acceptable for what I need, but am not sure how they done it.  As far as I know, they have dynamic lighting, as I believe there is a day / night cycle, so I don't think anything is baked.

sentences:
Implementing a homing missile I'm having some trouble implementing a homing missile that satisfies what I'm looking for. I have already tried the Seeking and Arrival behaviours described in this link, but none of them were what I wanted. With Seeking, it winds up orbiting the object indefinitely, and Arrival is simply unavoidable.

I'm aiming for something similar to the missiles of this video and the ones of Super Meat Boy - avoidable missiles that nevertheless do the job. It actually looks like a mix of Seek and Arrival, or maybe even the Path Following behaviour described in the first link.

This is my idealized behaviour, with a user-controlled target:

Can I have some insight on the matter? I know that questions regarding homing missiles have popped up quite often around here, but I feel that I'm missing something basic. The first video has an explanation from its creator in the second answer of this question, I didn't quite grasp it, though.

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:
How can I clear explosions in my function? Hi I have a function to place bombs, and a for loop that places explosions on the tiles where possible.

My problem is that I can't remove the explosions after a while. I've tried everything I can come up with so now I turn here as a last resort.

The function looks like this:

function Bomb(){
var placebomb = false;
    if(placeBomb && player.bombs != 0){
        map[player.Y][player.X].object = 2;
        var bombX = player.X;
        var bombY = player.Y;
        placeBomb = false;
        player.bombs--;
        setTimeout(explode, 3000);
    }
    function explode(){
    var explodeNorth = true;
    var explodeEast = true;
    var explodeSouth = true;
    var explodeWest = true;

    map[bombY][bombX].explosion = 1;
    delete map[bombY][bombX].object;

    for(i=0;i<=player.bombRadius;i++){
        if(explodeNorth && map[bombY-i][bombX]){
            if(!map[bombY-i][bombX].wall){
                if(!map[bombY-i][bombX].object){
                    map[bombY-i][bombX].explosion = 1;
                }
                else
                    var explodeNorth = false;
                    delete map[bombY-i][bombX].object;
                    map[bombY-i][bombX].explosion = 1;
            }
            else
                var explodeNorth = false;
        }

        if(explodeEast && map[bombY][bombX+i]){
            if(!map[bombY][bombX+i].wall){
                if(!map[bombY][bombX+i].object){
                    map[bombY][bombX+i].explosion = 1;
                }
                else
                    var explodeEast = false;
                    delete map[bombY][bombX+i].object;
                    map[bombY][bombX+i].explosion = 1;
            }
            else
                var explodeEast = false;
        }

        if(explodeSouth && map[bombY+i][bombX]){
            if(!map[bombY+i][bombX].wall){
                if(!map[bombY+i][bombX].object){
                    map[bombY+i][bombX].explosion = 1;
                }
                else
                    var explodeSouth = false;
                    delete map[bombY+i][bombX].object;
                    map[bombY+i][bombX].explosion = 1;
            }
            else
                var explodeSouth = false;
        }

        if(explodeWest && map[bombY][bombX-i]){
            if(!map[bombY][bombX-i].wall){
                if(!map[bombY][bombX-i].object){
                    map[bombY][bombX-i].explosion = 1;
                }
                else
                    var explodeWest = false;
                    delete map[bombY][bombX-i].object;
                    map[bombY][bombX-i].explosion = 1;

            }
            else
                var explodeWest = false;
        }

    }
    player.bombs++;
    }
}

If anyone can think of a good way to remove the explosion after a delay please help.

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:
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:
Using collectable items to change a gameobject Unity I’ve been working on a 2D platform side scroller. I’m rather new to Unity and C#.
Basically what I’ve achieved so far is a character which can collect Logs throughout the game and those logs are stored in an inventory (a simple count variable). Those logs can then be used to increase the values of Campfires. This is where the problem starts, I’m trying to figure out how to check the currentValue of the campfire and show a different sprite animation of the fire. (As shown below)

In short:

  Player gathers log (count += 1) -> if ( count > 0 && Player collides
  with (or in range of) Campfire && presses E -> Player is able to use
  log  { call throw_log_animation; count -= 1; currentValue +=25%; call
  new fireAnimation; }

  if Fire = 100% -> Player CANNOT use log. If Fire = 0% -> Game Over.

Collectable items code:

using UnityEngine;
using System.Collections;

public class CollectableItems : MonoBehaviour {

    private int count;
    public GUIText countText;

    // Use this for initialization
    void Start () {
        count = 0;
        setCountText ();
    }

    // OnTriggerEnter 2D
    void OnTriggerEnter2D(Collider2D other) {
        // If gameObject comes in contact with player
        if (other.gameObject.tag == "WoodStumps") {
            other.gameObject.SetActive (false);
            count += 1;
            setCountText ();
        }

        // If player comes in contact with gameObject
        if (other.gameObject.tag == "CampFire") {
            if (count > 0) count -= 1;
            else gameObject.SendMessage("No logs");

            setCountText ();
        }

    }

    void setCountText() {
        countText.text = "Count: " + count.ToString();
    }
}

If anything is unclear, don’t hesitate to ask. I’m looking forward to your solutions and idea’s!

sentences:
Concerning The Minecraft Skybox I was wondering how does the stars in night time in minecraft work, are they point sprites? And are they placed on a texture or just randomly placed on some far away location.

EDIT 1:

OK, well, with the imformation gathered concerning the minecraft skybox I now know that the stars are not directly textured onto a sphere but are individial quads placed some set distance (the radius of the sphere) from the player.

The problem is now I will I go about getting a random position on that sphere (not in it and not too far out of it). And how will I get rotation for it to face the player? One user suggested normalising a random Vector3 then multiplying it by the spheres radius which I think, simply won't work. Also another suggested that I use the formular: "1 = x^2+y^2+z^2", I don't know how I would use this to find a random position on a sphere either.

EDIT 2:

OK, I haven't tested this or anything but from all the imformation gathered from PrinceCharles anwser it should be something like this:

            float x = (float)random.NextDouble() * 2 - 1;
            float y = (float)random.NextDouble() * 2 - 1;
            float z = (float)Math.Sqrt((double)(1f - x * x - y * y));

            Vector3 randomPoint = new Vector3(x, y, z);

            if (randomPoint.Length() != 0)
            {
                randomPoint.Normalize();
                Vector3 pointOnSphere = randomPoint * radius;

                                  // Position     Rotation
                stars.Add(new Star(pointOnSphere, new Vector3(0, 0, 0)));
            }

The reason for the "* 2 - 1" is to give the random a range of -1 to 1. I think that is correct...

EDIT 3:

One side of the map:

The other:

Any ideas?

Thanks :)

sentences:
Game testing using mock input In this post Patrick Hughes suggested, and michael.bartnett was kind to explain a bit how to do that. While it seems rather clear how to implement and use it, I'm still a bit doubt if this useful enough. Does this kind of "testing" is used widely? I mean every change in a game usually change either how input is processed or a response to same input. This makes all recorded input obsolete. Or maybe I'm missing something?

I feel like implementing a unit testing for core parts (see also) of a game are much more useful, despite it also seems much harder to implement.

So the question is, does mocking input is really good at something in game testing?

sentences:
glViewport offset and ortho projection In all tutorials I found about creating projection matrix based on viewport size all of them assumed that left bottom coordinates of viewport will be (0,0).

Now I want to draw to the different parts of the screen and for that purpose I want to switch viewports accordingly:

glViewport(0,0,windowWidth/2, windowHeight/2); //left bottom
glViewport(0,windowHeight/2,windowWidth/2, windowHeight/2);//left top
glViewport(windowWidth/2,0,windowWidth/2, windowHeight/2);//right bottom
glViewport(windowWidth/2, windowHeight/2,windowWidth/2, windowHeight/2);//right top

Now I have a problem with defining my projection matrix. Without having any (x,y) offest I was using this code for calculating my ortho projection matrix:

float m_fWindowSize = 15.0f;

if (m_WindowWidth > m_WindowHeight)
{
    auto viewportAspectRatio = (float)m_WindowWidth / (float)m_WindowHeight;

    m_ProjectionMatrix.m_fLeft = (-1.0f) * m_fWindowSize * viewportAspectRatio;
    m_ProjectionMatrix.m_fRight = m_fWindowSize * viewportAspectRatio;
    m_ProjectionMatrix.m_fBottom = (-1.0f)*m_fWindowSize;
    m_ProjectionMatrix.m_fTop = m_fWindowSize;
    m_ProjectionMatrix.m_fNear = -(10.0f)*m_fWindowSize;
    m_ProjectionMatrix.m_fFar = (10.0f)*m_fWindowSize;

    m_fMoveSpeed = static_cast<GLfloat>(m_fWindowSize * 2 / static_cast<float>(m_WindowHeight));
}
else
{
    auto viewportAspectRatio = (float)m_WindowHeight / (float)m_WindowWidth;

    m_ProjectionMatrix.m_fLeft = (-1.0f)*m_fWindowSize;
    m_ProjectionMatrix.m_fRight = m_fWindowSize;
    m_ProjectionMatrix.m_fBottom = (-1.0f)*m_fWindowSize * viewportAspectRatio;
    m_ProjectionMatrix.m_fTop = m_fWindowSize * viewportAspectRatio;
    m_ProjectionMatrix.m_fNear = -(10.0f)*m_fWindowSize;
    m_ProjectionMatrix.m_fFar = (10.0f)*m_fWindowSize;

    m_fMoveSpeed = static_cast<GLfloat>(m_fWindowSize * 2 / static_cast<float>(m_WindowWidth));
}

And this works fine UNTIL I will add any (x,y) offset to my viewport. The effect is following when using glViewport(0, m_WindowHeight/2,  m_WindowWidth/2, m_WindowHeight/2):

And with glViewport(0, 0,  m_WindowWidth/2, m_WindowHeight/2):

So how I can change projection matrix accordingly to the viewport offset?

sentences:
Image with FadeIn effect blinks when added to scene I am trying to add an image to the scene, but it should just be added to the scene invisible, FadeIn and then be deleted when the effect finishes.

My problem is that the images blink once when they are added to the scene, then they do the intended effect. My best guess is that when they are added they show on the scene for a split second before starting the animation. I though of making them invisible for a split second before activating them, but I am not sure how to code it.

 const bool Sunbeams::add()
{
const CCSize kSceenSize = CCDirector::sharedDirector()->getWinSize();

const int nRayType = random( m_kRays.size());

const CCPoint kPosition( random( static_cast < int >( kSceenSize.width)),
                         0.0f);

const float fDuration = random( m_fDurationVariance) + m_fDurationMin;

CCSprite* pkLightBeam = CCSprite::spriteWithTexture( m_kRays[nRayType]);

if ( !pkLightBeam)
{
    msg::debug( "Sunbeams::add",
                "Failed to create sprite from ray '%d'!\n",
                m_kRays[nRayType]);

    return false;
}

pkLightBeam->setAnchorPoint( CCPointZero);

pkLightBeam->setPosition( kPosition);

m_kActiveBeams.push_back( pkLightBeam);

CCDirector::sharedDirector()->getRunningScene()->addChild( pkLightBeam);

CCActionInterval* pkAction = CCFadeIn::actionWithDuration( fDuration);

CCActionInterval* pkActionBack = pkAction->reverse();

pkLightBeam->runAction( CCSequence::actions( pkAction,
                                             pkActionBack,
                                             0));

return true;
}

sentences:
Camera position and angle different when running inside Unity and when running on Android On Windows, running Unity 4.6.1p5, my simple game with only a cube, camera and light looks like this

but under Android (Gingerbread on a 5 inch Galaxy Player) the cube appears lower down, slightly different angle and smaller (relative to the screen size).  Sorry couldn't get a screenshot with my screenshot app...

Any ideas why please?

sentences:
Which parts to draw in an infinite world? I have an infinite world (from Perlin Noise).

The world is generated in sectors that are that are big cubes (each with a random colour, in the image above; my sectors are 10x10x10).

I'm currently putting the sectors in a hash-table tagged by their top-left-front corner coordinate.  I can loop through all the sectors I've already generated and see if they intersect the frustum.

But how can I compute instead the sectors that I haven't generated but are visible and need generating on-demand?

Even if I have an octree or some other spatial index, I need to compute the sectors that are visible inside the frustum rather than those I've already generated.

sentences: Making entire scene fade to grayscale When the player loses all of their lives, I want the entire game screen to go grayscale, but not stop updating immediately. I'd also prefer it fade to grayscale instead of suddenly lose all color. Everything I've found so far is either about taking a screenshot and making it grayscale, or making a specific texture grayscale. Is there a way to change the entire playing field and all objects within to grayscale without iterating through everything?

sentences:
Making character's skills and abilities as commands, good practice? I am designing for a game that consist of characters who have unique offensive skills and other abilities such as building, repairing, etc. Players can control multiple of such characters.

I'm thinking of putting all of such skills and abilities into individual commands. A static controller would register all of these commands into a static command list. The static list would consist of all the available skills and abilities of all the characters in the game. So when a player selects one of the characters and click on a button on the UI to cast a spell or perform an ability, the View would call the static controller to fetch the desired command from the list and execute it.

What I'm not sure of however if this is a good design given that I'm building my game in Unity. I am thinking I could have made all the skills and abilities as individual components, which would then be attached to the GameObjects representing the characters in the game. Then the UI would need to hold the GameObject of the character and then execute the command.

What would be a better design and practice for a game that I am designing?

sentences:
Quad sphere subdivision algorithm I like to generate some planets like Kerbal Space Program does. By some videos of the developers I know that they use a quadsphere, which consists of six “entities” as a minimum. These are all plane meshes, which get subdivided the closer you get. This allows a ground to orbit level of detail. However, I have some problems understanding this subdivision algorithm:

Since I have six separate meshes, how do I know where I have to subdivide them, if they are all separate?
If I always just subdivide the quad the camera is over and I end up with something like this:

even though I want something like:

.

So how can I ensure a sense full 2:1 subdivision with neighbour quads?

sentences:
Tilemap is sent to back/disappears behind background when I go into play mode or save (video included) screencap of the problem here
I'm sure this has a simple solution but I haven't found it answered yet. I have two tilemaps, one a BG and one a middle layer, and everything works when I paint on the middle layer. It shows up on top of the BG.
But if I save the project or open play mode to test it, the middle layer disappears. Seems like it gets sent behind the BG tilemap but the order of the tilemaps hasn't changed. Also of note is that nothing changes even if I reorder the tilemaps, and the only way I can make the tilemap "reappear" is by ctrl-z undoing my last action. At a loss, any takers?
EDIT: I just realized that my video capture didn't pick up my drop down menus, but I create a new tilemap at the bottom of the hierarchy, put some assets in it, then save the project (stuff disappears) and then undo (stuff reappears).

sentences:
Direct3D 11: Changing fullscreen resolution does not work In my application I can switch back and forth between windowed and fullscreen mode using IDXGISwapChain::SetFullscreenState. When the WM_SIZE is handled, IDXGISwapChain::ResizeBuffers is called in response. This works fine and when entering fullscreen mode DXGI chooses the desktop resolution.

The problem comes when I'm trying to change resolution while remaining in fullscreen. I try to change resolution by using IDXGISwapChain::ResizeTarget. The mode description I'm trying to switch to is aquired by using IDXGIOutput::GetDisplayModeList, so it should be valid. When doing the resize I get the usual blinking that happens when I enter fullscreen, but nothing has changed; the resolution is still the same and there's no WM_SIZE message being generated like in Choosing the DXGI Output and Size.

DXGI best practices also contains alot of information but it didn't help me.

I am using the DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH flag when creating the swap chain and I have also tried using IDXGIFactory::MakeWindowAssociation with the DXGI_MWA_NO_WINDOW_CHANGES and DXGI_MWA_NO_ALT_ENTER flags to no avail.

If I hardcode the swap chain to be created in fullscreen mode using a low resolution I can see the mouse cursor being jagged and larger, and this visual difference is not present when changing resolution.

Am I possibly getting the concepts wrong here? Am I supposed to get a WM_SIZE message after calling ResizeTarget? How are the display mode and back buffer related? I know that when the front buffer size is changed the back buffer should be resized to match in order to do flips instead of blits according to the links, which is why it's recommended to do the resize when the application gets the WM_SIZE message.

In a few of the similar questions I've found there are discussions about it maybe being a bug, but they all just died out with no final answer.

EDIT:
I just tried to manually call OnResize (my method actually calling ResizeBuffers and so forth) after I attempt to change resolution and the following warning shows up in the debugger (not visible before):

  DXGI WARNING: IDXGISwapChain::Present: Fullscreen presentation inefficiencies incurred due to application not using IDXGISwapChain::ResizeBuffers appropriately, specifying a DXGI_MODE_DESC not available in IDXGIOutput::GetDisplayModeList, or not using DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH.DXGI_SWAP_CHAIN_DESC::BufferDesc = { 800, 600, { 60, 1 }, R8G8B8A8_UNORM_SRGB, 0, 0 }; DXGI_SWAP_CHAIN_DESC::SampleDesc = { 1, 0 }; DXGI_SWAP_CHAIN_DESC::Flags = 0; [ MISCELLANEOUS WARNING #98: ]

The new resolution (800x600) seems to be set, but note that the Flags member is 0. Shouldn't it be 0x2? Could that be the reason the resolution doesn't have any effect? The flag is set in the swap chain description right before the swap chain is created so I don't understand how it's changed to 0.

EDIT 2:
In a tiny remark at the bottom of the DXGI_SWAP_CHAIN_FLAG documentation it says that ResizeBuffers can reset or change the flags. I took a look at my code and there it was: flag was set to zero (reading my book I must have accepted it as reusing the old flag or something). I changed it to allow mode switch and voilá, resolution changed and I got my WM_SIZE. I did however get a couple of warnings about presentation inefficiencies but that was expected, and I have plans on how to fix those.

sentences:
Match-3 algorithm to fill empty space left from removing matches I am currently creating a match 3 game.

I am at the point where I have objects dropping down in the column when only one item is removed. So if an item is removed, the above item moves into its old position etc.

The problem I am having now is that when more than one item is removed from a column, the items in that column only drop down to the first item that was removed. Instead of filling in both items that were removed it just drops down to fill in the first one.

So basically, if two(or more) items are removed from a column the second, third, fourth, etc positions are left blank.

The way I am designing my game is I am using units of 1. So each item takes up 1 unit by x and 1 unit by y. This means that I can position the items like in a grid, at 0x1, 0x2, etc.

What kind of algorithm could I use to move multiple items down to fill the empty space?

sentences:
Editing a new list of vector3's without changing the original list? (Unity) I just got Vectrosity for Unity and need to make a line of all the destinations for an object. Issue is that I need to use a single list of vector3's to create the line (as far as I'm aware).

I have a list of vector3's that is the objects queued destinations. I then need to insert the objects current location at index [0] in the list so that the first line point is at the objects location. Issue is that no matter how I try and accomplish this I'm still referencing the original destinations list, and inserting something at [0] on the list for the lines changes the original destinations list as well.

How do I go about creating a single List from a list of vector3's and an extra point without changing the original list that is being referenced? Do I need to clone it?

sentences:
Why do I get this error with FB.LogInWithPublishPermissions? I don't know what's wrong. I know that FB.Login is already deprecated. I don't know what syntax to use.

public class FBholder : MonoBehaviour {
    void Awake(){
        FB.Init (SetInit, OnHideUnity);
    }

    private void SetInit()
    {
        Debug.Log ("FB Init Done");

        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in");
        } else {
            FBlogin ();
        }
    }

    private void OnHideUnity(bool isGameShown)
    {
        if (!isGameShown) {
            Time.timeScale = 0;
        } else {
            Time.timeScale = 1;
        }
    }

    void FBlogin()
    {
        FB.LogInWithPublishPermissions ("user_about_me, user_birthday", AuthCallback);
    }

    void AuthCallback(ILoginResult result)
    {
        if (FB.IsLoggedIn) {
            Debug.Log ("FB Logged in worked");
        } else {
            Debug.Log ("FB Logged in failed");
        }
    }
}

and I'm getting this error

  Assets/FBholder.cs(40,6): error CS1502: The best overloaded method match for `Facebook.Unity.FB.LogInWithPublishPermissions(System.Collections.Generic.IEnumerable, Facebook.Unity.FacebookDelegate)' has some invalid arguments

and this

  Assets/FBholder.cs(40,35): error CS1503: Argument #1' cannot convertstring' expression to type `System.Collections.Generic.IEnumerable'

sentences:
Button mapping of an Xbox 360 controller for windows I can't get a clear answer on the rest of the internet. What are the joystick buttons for left and right triggers?

I'm on Windows, if it matters.

sentences:
Collision with walls in a completely tile based game I am making a tile based game, in which also the player movement is completely snapped to the grid. Imagine sokoban.

I basically have a 2d array for the layout of the level (walls / not walls), and the player can check is there's a wall where he is going.

My question is, when the player is trying to move into a wall, should I:

Let it move into the wall, then later check if it's in a wall and if needed revert it's movement?
Check whether it is going to move into a wall and prevent it beforehand?

I understand the answer may heavily depend on the structure of my code, but I'd still like to hear some opinions about how it was done in the past. What do you think? which of the two is better? (or is there a third option)

sentences: My lighting stays the same when I go indoors? My problem can be seen here notice how the shadows don't change intensity or color when moving indoors to the cave. The only thing that changes is the highlights when I move under the directional light. I was thinking about adding global illumination but I don't think that would work with a toon shader. How can I get my lighting to become darker once I enter indoors e.g a cave. Thanks!

sentences:
How can I get the position of a fixture in Farseer Physics 3.5? I created a body(rectangle). After that, I attached a circle shape to the body.

I need the position(world coodinates) of the circle shape because I want to draw a circle sprite(Texture2D) on that position.

How can I get the world coodinates of the fixture?

Body Rectangle;
Rectangle = BodyFactory.CreateRectangle(world, 1.50f, 0.50f, 1.0f);
Rectangle.BodyType = BodyType.Static;
Rectangle.Position = new Vector2(4.8f, 6.4f);
Rectangle.Rotation = (float)(60 * Math.PI / 180);

CircleShape = new FarseerPhysics.Collision.Shapes.CircleShape(0.5f, 1.0f);
CircleShape.Position = new Vector2(1.0f, 0.0f);
Fixture fixture = Rectangle.CreateFixture(CircleShape, 1.0f);

sentences:
How can I implement framerate-independant updates? Edit:
I fixed the problem by making jumpvelocity the one that is modified and added onto, and yvelocity just equal jumpvelocity * t. This is what I have right now:

if (GUI->Space && grounded){
    jumpvelocity = -185.f * 2  / gravity;
    grounded = false;

}

if(!grounded ){
    if(jumpvelocity < terminaly){
        jumpvelocity += 185.f * t * 4  / gravity;
        yvelocity = jumpvelocity * t;
    }
    else{
        jumpvelocity = terminaly;
        yvelocity = jumpvelocity * t / gravity;
    }
}
else{
    yvelocity = 0.f;
    jumpvelocity = 0.f;
}

Thanks for the help.

I am trying to get my gravity to work. The code I have so far is

if (jumpvelocity < 0){
   yvelocity = jumpvelocity * t *2/gravity;
    jumpvelocity += 185.f*t * 2 / gravity;
}

else if(!grounded ){
    if(yvelocity < terminaly)
        yvelocity += t / gravity;
    else
        yvelocity = terminaly;
}

Gravity scales upwards, the higher making falling and jumping slower. It's default value is 1. Jumpvelocity is set to 185 when the player wishes to jump. My problem is that you fall slower at a slower framerate, but you jump at the same speed as if it was a higher framerate. How would I make it frame independent? T is delta time.

sentences:
As3 Character movement in diffrent directions with labels? I hope you can help me with the following problem:

I made a character in Illustrator. The player sees the character from above.
When you press the left arrow key character.gotoAndStop('left'); the character moves to the left. (Same goes for the right direction with label 'right'
When you release the left or right arrow key (upKey) the character goes back to the label 'up'.

I'm trying to accomplish the following:
When the character is facing down ('down'). the left key should go to the ("facingdownleft") label and on release back to the label ('down'). (Same for the right direction)

stage.addEventListener(KeyboardEvent.KEY_DOWN, downKey);
function downKey(event:KeyboardEvent)
{
 if(event.keyCode==39){
 isRight=true;
 character.gotoAndStop('right');}
 if(event.keyCode==37){
 isLeft=true;
 character.gotoAndStop('left');}
 if(event.keyCode==38){
 isUp=true;
 character.gotoAndStop('up');
 }
 if(event.keyCode==40){
 isDown=true;
 facingdown=true;
 character.gotoAndPlay('down');}
}

if( facingdown == true && isLeft == true)
{
 character.gotoAndPlay('downleft');
}

stage.addEventListener(KeyboardEvent.KEY_UP, upKey);
function upKey(event:KeyboardEvent){
 if(event.keyCode==39){
 isRight=false;
 character.gotoAndPlay('up')}
 if(event.keyCode==37){
 isLeft=false
 character.gotoAndPlay('up')}
 if(event.keyCode==38){
 isUp=false;}
 if(event.keyCode==40){
 isDown=false}
 }

I made a boolean for facingdown and an if statement for downleft:

  if( facingdown == true && isLeft == true)
    {
     character.gotoAndPlay('downleft');
    }

But before I make numerous amounts of if statements again, I would like to know if I'm on the right track and if you can help me accomplish this?
Thank you so much in advance and feel free to ask questions.

sentences:
Simulating elastic ball collisions quickly escalates to disaster I'm trying to learn HTML canvas and was working on a basic physical simulation, where a number of balls are drawn and set in motion, and the program simulates them colliding and bouncing off the walls and each other.

Here's the simulation.

Each ball is initially given a random position, direction, and a constant starting velocity. For simplicity, a ball's mass is simply equal to its radius. The velocity vectors are stored as (x,y) instead of polar coordinates to make the calculations simpler and the simulation faster, but this apparently has unintended consequences.

In the simulation linked above, I'm starting with ten balls, and each ball has an initial velocity magnitude of 3, so the total initial "speed" of the system should be 30 (= 10 * 3).  On each frame, I calculate the total speed of all the balls and read it out in a form field, and with uniform balls of size 10, the total speed seems to stay a few units under 30. The same is true of the min and max radius are decreased so all the balls are size 5, or increased to 20: the total speed stays relatively uniform.

However, interesting things happen when the balls vary in size. If the minRadius is changed to 5 and maxRadius to 15, for example, you'll notice that the total speed of the system starts climbing over time. The bigger the difference, the faster the speed grows out of control.

SO my first guess is that I screwed up the physics, but I can't figure out how. My other guess is that this is caused by accumulating floating point error, but it's interesting that it only grows upwards, and never towards zero. Also, it does seem to have a limit; while it constantly fluctuates, it seems to be capped at some value related to the delta between the minimum and maximum ball size.

My question is really to understand why this is happening?  Did I just screw up something simple, or is something more sinister going on?

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:
Implementing win condition I'm making a turn based game in java for fun, it follows a set game flow pattern contained in a loop. I realized that once a player hits a win condition the game continues playing out the rest of the turn, possibly changing the victor.

Do I need to go back and put if statements everywhere so nothing is executed once a victor is declared? Is there a more elegant solution?

sentences:
Gamma-Correct rendering without floating-point rendertargets When using a gamma-correct pipeline, you have to work with floating-point rendertargets. Otherwise, you will get severe banding due to the insufficient precision of the usual 8-bit-per-channel integer rendertargets.

Is there any way around this? Any good way to implement gamma-correct rendering without using floating-point rendertargets?

This is on desktop PCs using Windows and DirectX.

sentences:
Dealing with multiple licenses I came across an asset with 3 different licenses. The GPL 3.0 license appears to just be a newer version of the GPL 2.0. Can the GPL 2.0 be disregarded if the GPL 3.0 is complied with?

Must all conditions from all 3 licenses be met? For example, the GPL 2.0 mentions printing or displaying an appropriate copyright notice, but this seems to be absent from the CC BY-SA 3.0 license.

sentences:
A* Pathfinding issues, player node is always off so I am using Sebastian Lague's second video on A* pathfinding (https://www.youtube.com/watch?v=nhiFx28e7JY&list=PLFt_AvWsXl0cq5Umv3pMC9SPnKjfp9eGW&index=2), and since he is using a 3d model, and I am using a 2d model, I need to convert some of the values to 2d. It is working fine, but the problem I ran into is that the node that detects the player is always off.

Like in here, the cyan node is the node where my player is supposed to be, and the my cursor is where my player actually is. You can see that it is completely off. I am pretty sure this is because some error is produced while I tried to turn 3d into 2d, but I don't know how. Here is my grid script:

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

public class Grid : MonoBehaviour
{
    public Transform player;
    public LayerMask unwalkableMask;
    public Vector2 gridWorldSize;
    public float nodeRadius;
    Node[,] grid;

    float nodeDiameter;
    int gridSizeX, gridSizeY;

    void Start() {
        nodeDiameter = nodeRadius*2;
        gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter);
        gridSizeY = Mathf.RoundToInt(gridWorldSize.y/nodeDiameter);
        CreateGrid();
    }

    void CreateGrid() {
        grid = new Node[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(worldPoint,nodeRadius,unwalkableMask));
                grid[x,y] = new Node(walkable,worldPoint);
            }
        }
    }

    public Node NodeFromWorldPoint(Vector3 worldPosition) {
        float percentX = (worldPosition.x + gridWorldSize.x/2) / gridWorldSize.x;
        float percentY = (worldPosition.y + gridWorldSize.y/2) / gridWorldSize.y;
        percentX = Mathf.Clamp01(percentX);
        percentY = Mathf.Clamp01(percentY);

        int x = Mathf.RoundToInt((gridSizeX-1) * percentX);
        int y = Mathf.RoundToInt((gridSizeY-1) * percentY);
        return grid[x,y];
    }

    void OnDrawGizmos()
    {
        Gizmos.DrawWireCube(transform.position, new Vector3(gridWorldSize.x, gridWorldSize.y, 1));

        if (grid != null)
        {
            Node playerNode = NodeFromWorldPoint(player.position);

            foreach (Node n in grid) {
                Gizmos.color = (n.walkable)?Color.white:Color.red;
                if (playerNode == n)
                {
                    Gizmos.color = Color.cyan;
                }
                Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
            }
        }
    }
}

And here is my node script:

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

public class Node
{
    public bool walkable;
    public Vector3 worldPosition;

    public Node(bool _walkable, Vector3 _worldPos) {
        walkable = _walkable;
        worldPosition = _worldPos;
    }
}
```

sentences:
How can I make a 2D Sprite bleed/glow colors at a particular spot? I am trying to make a gauge glow over the color it is at.  For example, in the image below, when the needle is pointing at the red, the red is glowing.  When it is pointing at the green, then the green is glowing.  I want to replicate this:

My gauge will be on a gradient, so I cannot just color a particular segment.  (There are no segments.)  I am working with 2D sprites.  I have looked into the Bloom asset as suggested here, but I have been met with nothing but failures.  (Probably because that guide is for 3D.)

How can I take the color at a particular position and make it bleed/glow like in the images above?

sentences:
How can I support more than one resolution/language on WP7/8? I want that my Windows Phone game runs on the following three resolutions: 480x800, 768x1280 and 720x1280. And maybe later on 1920x1080.
But in the XAP file information, it's just written "Resolution(s) WVGA". What can I support more resolutions than just WVGA?
In addition, I want to support more than one language. At the moment, I can just choose English in the Dev Center menu, but I want to support French, Spanish and German too. How can I support French, Spanish and German? I don't know how to add these languages.
I uploaded my XAP file in the Dev Center and it gives me the following informations:

Select a XAP above to view or edit its Store listing and other info.
XAP version number  1.0.0.0
XAP details detected from file
File name WindowsPhoneGame2.xap
File size 167 KB
Supported OS 7.1, 8.0
Resolution(s) WVGA
Language(s) EnglishNorthAmerica
Capabilities ID_CAP_NETWORKING
XAP's Store listing info
A XAP file can contain multiple languages. Select a language to add Store listing info specific for that language.
English
Description for the Store:

sentences:
How do I rotate a single object in HLSL? I have a World with a 3D model of a head in it and that World rotates, like such:

protected override void Update(GameTime gameTime)
{
    //other stuff

    angle += 0.00005f;

    //more other stuff
}

protected override void Draw(GameTime gameTime)
{
    //other stuff
    Matrix rotation = Matrix.CreateRotationY(3 * angle);
    effect.Parameters["World"].SetValue(rotation * Matrix.CreateScale(10.0f));

    // other stuff
}

And then in my Effects file I create a spotlight:

float4 SimplePixelShader(VertexShaderOutput input) : COLOR0
{
    float4 lightDirection = { 1, 1, 1, 0 };
    float theta = 10.0f;
    float phi = 30.0f;
    float4 color;
    float4 lambert = DiffuseColor * 0.2 * max(0, dot(input.Normals, input.lambertLightDir));

    float angle = acos(dot(input.lightDir, normalize(lightDirection)));
    if(angle > radians(phi))
        color = AmbientColor * AmbientIntensity;
    else if(angle < radians(theta))
        color = lambert;
    else
        color = max(AmbientColor * AmbientIntensity, smoothstep(radians(phi), radians(theta), angle) * lambert);

    return color;
}

And naturally this spotlight also rotates with the world. However, I dont want it to rotate. I tried everything, multiplying, adding, subtracting the rotation matrix and/or the angle from the different lightdirections and angles and nothing works.

Now I could rotate just the model and not the world, that would even be a sensible thing to do, but I have no clue how :P So I'm either looking for a good way to rotate the model or a way to 'counter rotate' the spotlight so it seems to stand still.

Edit: my vertexshader:

VertexShaderOutput SimpleVertexShader(VertexShaderInput input)
{
//some other vertexshaderstuff

    float4 lightPoint = {-3, -2, -2, 0};

    output.lightDir = normalize(input.Position3D) - lightPoint;

    output.lambertLightDir = float4(30, 30, 20, 0);

    return output;
}

sentences:
Free Moddable 2d game with good community and tools Disclaimer: I'm okay with making this a community wiki, as I see a lot of benefit in having a place to ask this question and get good answers from people who have experience.

I would like to mod a 2D game. Having never modded a 2D game before (unless you count Starcraft custom maps back in 199x), I am looking for a game/system that has:

A good community: this means I can ask questions if I get stuck and expect a (decent) answer in roughly a day.
Solid tools: I would ideally prefer clicking and creating content over diving into optimized C++ to make changes. The better the tools, the faster you move.
Scripting language: Ideally, access to some scripting language above and beyond the main tools is an ideal middle-ground between high-level puritan tools (SC level editor) and low-level coding.
Free: I'm looking for something I can try out free, or very cheap.

It also goes without mention that I want something current; I'm sure I can mod Super Mario Brothers, Link to the Past, etc. (SNES-era games) but that's pretty worthless to me.

And please don't say "Starcraft (1)" :)

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:
How to change mac opengl version back to mesa A while ago I wanted to use the functionality of opengl 4.5+ on my mac, so I installed mesa with macports, and it worked. Recently, however, I tried to use my code again and it said that these versions of opengl are not supported.

I tried running glxinfo, and it seems to be telling me that my renderer is the default intel provided renderer.

The last time it worked was a reasonably long time ago, and it is likely that the reason for the switch is that when I restarted my computer at some point it switched back to the old version. I don't know exactly when it stopped working.

What I want to figure out is how to switch to the mesa version. I checked with macports and even looked at the files internally, and mesa is installed and updated to version 17.1.6, which is the latest version supported by macports. I can't find anything anywhere on how to change the renderer used by my computer. I think it has something to do with libGL maybe, but I can't find any information on how to change or even view libGL's environment variables.

How can I switch to the mesa renderer?

This is made especially difficult because I can't trust that the information from glxinfo is correct. Both mesa and the default intel renderers have their own versions of glxinfo, which may give information that is different from what the current opengl actually running on the system is. I'm not sure which one I am actually running when I run glxinfo with terminal, or how to find the executable for the mesa version.

EDIT: I have looked a little more, and it seems like I can control which version is used during context creation and API loading, but that requires manually doing those things, which is not something I really want to do. Currently, I have only tested this with JOGL, and I can't find anything on what it uses to create a context. I don't know if glfw will use the mesa version, but glew did install in the directory for the mesa/X version and not the core version that I think JOGL is using. It did work before with JOGL, so clearly there is some system wide default setting that can change this, and I would like to know what that is.

sentences:
Texturing voxel faces separately I am creating a 3D level editor which should be used to generate the very basic layout (level geometry) and a few basic game-logic entities of maps used in my game. So far, I decided to use voxels (i have a fbx untextured model file and do NOT draw this myself via vertices etc. as I already found tutorials on that which are not suitable for me) as the way to create the level geometry and most of this works fine. The next step would be to implement code that allows me to texturize these cubes by specifically applying textures to faces.

Using something like the following Draw method I can apply a Texture2D to the whole voxel (so I am not able to chose the face to which I want to apply the texture) and this works fine for now (though I have sometime issues orienting it, which should not be part of this question)

public void Draw() {
    foreach(ModelMesh mesh in this.Model.Meshes) {
        foreach(ModelMeshPart part in mesh.MeshParts) {
            BasicEffect effect = (BasicEffect)part.Effect;

            effect.World = this.World;
            effect.View = Engine.View;
            effect.Projection = Engine.Projection;

            if(this.Texture != null) {
                // UNLIT textures
                effect.Texture = this.Texture;
                effect.TextureEnabled = true;
            } else
                // LIT placeholder voxel
                effect.EnableDefaultLighting();
        }
        mesh.Draw();
    }
}

I will have about 10 textures which I want to be able to apply programmatically on each face of the voxels - which approach would you suggest me to achieve the desired result?

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:
Collision response using the Minimum Translation Vector I am trying to use the Minimum Translation Vector (MTV) returned from the SAT algorithm for simple collision response. Please see the example below.

By separating the colliding boxes by moving the black box along the MTV, the box is now colliding with the other green box below. Moving the black box along the MTV for the collision with this new box then brings the box back to colliding with the first box, and an infinite cycle of trying to separate the boxes begins.
Am I missing something, or is collision response not possible using the MTV?

sentences:
Game Sprite Editting Help(PNG-XNB) I converted my project's .xnb files to .png files using a program and I can't seem to find a way to transform .png back to .xnb. I don't want to lose the work I've done. How can I change the images back?

P.S. GXView shows an error when I try to save as .xnb

sentences:
Generate a random number of enemies to appear on screen I am currently trying to create 2d shmups. I am trying to:

Generate a random number of enemies to appear on screen
Whatever number is generated will then be added to my List (the list is used to keep track of enemies). to load that number of textures.
I would also like to keep a collection of Vectors to determine the positions the enemies will spawn randomly.

This is what I have done so far:

 List <Enemies> enemies = new List<Enemies>();
 Random rnd = new Random();
 int numberOfEnemies = rnd.Next(1,5); // I would like to generate between 1 and 5.
 if (enemies.count < numberOfEnemies){
     enemies.Add(new Enemy(Content.Load<Texture2D>("alienship");// one of the vectors from the collection of vectors will go here
 }

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:
Simple Java 2D Game : Player Doesn't Move I'm a beginner at java and I'm trying to make a simple 2D game as a practice, and i have a problem here with the player, I've tried a lot to make it move but it didn't work. These are the classes that contain the player.

Game Class :

package game;

import game.input.Controller;
import game.input.KeyInput;
import game.objects.Player;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.Timer;

public class Game extends JPanel implements ActionListener{

  Timer loopTimer;
  //Objects
  Player p;
  Controller c;

  public Game(){
    addKeyListener(new KeyInput(p));
    setFocusable(true);

    loopTimer = new Timer(10, this);
    loopTimer.start();

    p = new Player(300,200);
    c = new Controller();
  }

  public void paint(Graphics g){
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.white);
    g2d.fillRect(0, 0, 640, 480);
    p.draw(g2d);
    c.draw(g2d);
  }

  public void actionPerformed(ActionEvent ee){
    p.update();
    c.update();
    repaint();
  }
}

Player Class :

package game.objects;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;

public class Player extends GlobalPosition {

  private String playerimage = "/images/marioR.png";

  int velX = 0;
  int velY = 0;

  public Player(int x, int y) {
    super(x, y);
  }

  public void draw(Graphics2D g2d){
    g2d.drawImage(getPlayerImage(), x, y, null);
  }

  public Image getPlayerImage(){
    ImageIcon i = new ImageIcon(getClass().getResource(playerimage));
    return i.getImage();
  }

  public void update(){
    x += velX;
    y += velY;

    // Collision with outside
    if(x < 0){
      x = 0;
    }
    if(y < 0){
      y = 0;
    }
    if(x > 640){
      x = 640;
    }
    if(y > 480){
      y = 480;
    }
  }

  public void keyPressed(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = -10;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 10;
    }
    if(c == KeyEvent.VK_UP){
      velY = -10;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 10;
    }
  }

  public void keyReleased(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = 0;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 0;
    }
    if(c == KeyEvent.VK_UP){
      velY = 0;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 0;
    }
  }

  public void keyTyped(KeyEvent e){
  }
}

KeyInput Class :

package game.input;

import game.objects.Player;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KeyInput extends KeyAdapter{

  private final Player p;

  public KeyInput(Player p){
    this.p = p;
  }

  public void keyPressed(KeyEvent e){
    p.keyPressed(e);
  }

  public void keyReleased(KeyEvent e){
    p.keyReleased(e);
  }
}

.

sentences:
Milkshape3D Animation on Windows 7 64-bit when I run Milkshape 3D on my 64-bit Windows 7 machine, certain joints expand when I try to rotate them.

For example, my model's leg has hip, knee, foot and toe joints. So to do a walking animation I would rotate the hip joint, then rotate the knee joint. Then as soon as I start rotating the foot, the foot joint moves away from the knee rather than just rotating around the axis.

These images show what I'm talking about:

I've tried to run Milkshape in comaptibility mode and with the Mesa software OpenGL renderer, but it doesn't work. At the moment my workaround is to run Milkshape in a 32-bit Windows XP virtual machine.

Does anyone know what causes it and how to solve it?

sentences:
XNA Easy Storage XBOX 360 High Scores To followup from a previous query - I need some help with the implementation of easystorage high scores, which is bringing up some errors on the xbox.

I get the prompt screen, a savedevice is selected and a file are all created! However the file remains empty, (I've tried prepopulating but still get errors).

The full portions of the scoring code can be found here: http://pastebin.com/74v897Yt

The current issue in particular is in LoadHighScores() - "There is an error in XML document (0, 0)." under line data = (HighScoreData)serializer.Deserialize(stream);

I'm not sure whether this line is correct either: HighScoreData data = new HighScoreData();

public static HighScoreData LoadHighScores(string container, string filename)
        {
            HighScoreData data = new HighScoreData();

        if (Global.SaveDevice.FileExists(container, filename))
                {
                    Global.SaveDevice.Load(container, filename, stream =>
                            {
                                File.Open(Global.fileName_options, FileMode.OpenOrCreate,
                                         FileAccess.Read);
                                try
                            {
                                            // Read the data from the file
                                        XmlSerializer serializer = new XmlSerializer(typeof(HighScoreData));
                                        data = (HighScoreData)serializer.Deserialize(stream);
                            }
                              finally
                             {
                                    // Close the file

                                stream.Close();
                             //   stream.Dispose();

                             }

                            });

                }

        return (data);
    }

I call: PromptMe(); when the Start button is pressed at the beginning.

I call: if (Global.SaveDevice.IsReady){entries = LoadHighScores(HighScoresContainer, HighScoresFilename);} during the menu screen to try and display the highscore screen.

I call: SaveHighScore(); when game ends.

I've tried altering the struct code to a class but still no luck.
Any help greatly appreciated.

sentences:
Unity3d UnityWebRequest EscapeURL standard does not match Swift url encoding. How to decode it? How should I decode escaped URL by unity in Swift?

I am developing a game with Unity3d. Something MMORPG. With server implemented by me in Swift under Kitura framework
A framework doesn't matter that much. It is more about swift and Unity itself.

Let me describe the problem here.

Unity

UnityWebRequest.EscapeURL("First Last")

Escapes string with encoding used in the application/x-www-form-urlencoded content-type: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
Which produce string First+Last where + maps to " " space.

Swift:

import Foundation

var str = "First+Last"
print(str)
print(str.removingPercentEncoding)

The character used on this string + isn't considered as a percentage encoding in the standard used by swift. It would be if the character escaped as this would be represented by %20.

So my server and client ended up with different string values.
Later on returned from one to the other weren't equal. Which ended up considering them as two different clients.

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:
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 should I manage multiple entities? Before I start making a game, I'm trying to figure out how I will manage things.  One of the first things I'm not sure about is how to manage entities (enemy, player, projectile...)

I'm going to be using either C, C++, Java, or C#

One of the ideas I have is to use one array for projectiles and one for enemies.  Each time I have a new entity, I grow my array. Here is the problem: If player/enemy is firing, that creates a new entity which means the projectile array is growing.

Suppose its projectile #2053, when it hit something, I free it, then in my loop to check which projectiles are to do something, like getting closer to there target, I check if every # of my array to see if its null, if not, check is trajectory. But the problem is that the array will grow each time a new projectile is fired, and I will get a memory problem at the end.

So how should I manage my entities?

I need an awnser that covers both object oriented and procedural, since I mainly do things in C.

sentences:
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:
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:
Unity Animation makes object spawn at x0 y0 z0 I was making an animation for a coin in my game in Unity, and when I was testing the full game, I saw that the coin is spawning at x0 y0 z0 and is doing the animation there.
Then I realized that it was the animation, that increases and decreases y position and y rotation, starting at 0.
So, I need to make the animation, that increases and decreases position y and rotation y, without affecting the actual position, because it will be different the position of the coins each time.
In a while I will upload a screenshot for describing better the problem.
Any clue?

sentences:
How to import animation from MotionBuilder to Unity? I have an animation (https://i.imgur.com/VZcdgHs.mp4) working in MotionBuilder.
I have tried exporting the whole thing as an FBX, and also have tried exporting as a Motion File.
Either way, when I import it into Unity and set up the Mecanim and Animation Controller and set the animation as the "Entry State" animation... My character moves to one pose and then stays frozen.
Does anyone know how to correctly get an animation from MotionBuilder to animate a character in Unity?

sentences:
Determining Player "Forward" in VR EDIT: I've removed some vagueness and replaced it with more of a description of the intended use case.

I'm looking for some suggestions for ways to infer what the player's "forward" vector is in a room-scale 360 experience.
I'm not currently worried about extreme edge cases, especially if it sounds like the user may be intentionally not doing the intended thing, but I am interested in getting a decently accurate forward vector when they could be looking or facing any direction.
I also don't care about "upness" or magnitude of the vector, so it'll end up being projected onto the (Unity's) X/Z plane and normalized.

I'm exploring the idea of punching as a means for locomotion. The player should move in the direction that they punch, which in itself I feel is an easy solve. The problem is, much like the problem of arm-swing movement, it is very hard and unnatural to punch exactly straight forward. People tend to punch at least a little across their body. This causes the player to weave back and forth through the world, like some sort of drunken master.
I don't like the idea of using the headset's forward vector either. I want the player to be able to look around while playing; I feel it is an integral part of the experience to be able to look ahead one punch and plan the next move.

It's also important that sensor set up and room orientation should not be taken into account. I'm looking for something that could work in a large space with 360 tracking.

I've considered:

Grabbing an average position of the hands, getting the vector from the head to this new position. This is where I've spent most of my time, I think. I've tried a weighted average, where hand position gets more or less weight depending on distance from head. In practice, this ends up exacerbating the problem
Grabbing the vector from the head to the dominant hand
Dropping a raycast to the floor and using the hit geometry's forward vector
Getting a complicated IK rig setup, potentially hiding the geometry, and using the rig's hip placement/orientation to infer "forward"

None of these quite feel right to me, although the average-hand-position vector feels the right-est.

Is this a solved problem that I'm just not searching hard enough for? Anybody else have interesting solutions to this problem? Am I being too vague and should really just seek out a solution for a much more specific use-case and be happy with that?

sentences:
Unity remote not recognising my phone? I made a new project with the Android module installed, which works fine as I can build and run it on my phone when connected to my computer via USB, and yet can't get Unity Remote to work. Edit/Project Settings/Editor/Device won't display my phone's name.
I tried several internet solutions I found (such as closing and opening again both Unity and Unity Remote or enabling PTP transfer) and none worked.
Any ideas on what could be going on?

sentences:
Efficient way to implement a lot of singletons I just came upon programming patterns and learned about singleton. I'm in the process of creating my first game and it contains several managers:

I wanted to implement singleton on each of the managers,but the only way I can think is copy pasting the singleton pattern on each awake method script attached to each manager.
Is there a more efficient way to do it rather than pasting the pattern on each awake method?

sentences:
Keep world changes in sync in client/server architecture Imagine having a big room (4000w x 4000h) which contains players and items (world objects). The room is spatially partitioned in a 10 x 10 grid for collision detection and changes in the viewport of the player.

Green rectangle: Item
Red rectangle: Player viewport

At the moment, on the server, every player contains a list of all world objects in his current viewport. When the player changes his position, new items are found in the viewport, compared with his current list of visible objects and the changes are send to the client. His current visible list is updated with the new found objects

HashSet<WorldObject> changes = new HashSet<>(foundObjects);
changes.removeAll(player.getVisibleObjects());

The client maintains a list of all entities that it has seen, renders them in the world and waits for new input.

Now my problem arise when another player picks up an item, it notifies the surrounding players, update the local list of items accordingly and stops rendering the item. This works fine. But players outside the viewport are not notified about these changes, so once they are in the grid, they will still see the item being rendered.

How are these kind of problems commonly solved? Is my approach good?

sentences:
Distributed spawning of units I have a collision detection implemented in my game. Now I have spawning of units in a class Spawn:

public class Spawn {

    private double x;
    private double y;

    private String team;

    private String meta;

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public String getTeam() {
        return team;
    }

    public void setTeam(String team) {
        this.team = team;
    }

    public String getMeta() {
        return meta;
    }

    public void setMeta(String meta) {
        this.meta = meta;
    }

    public void spawn(AbstractActor actor) {
        actor.setPosition(new Point(x, y));

    }
}

and I call spawn() method for every unit. I have multiples spawns btw but that's not important.

However when a unit (AbstractActor) gets spawned, it's spawned on x, y. But when the second unit gets spawned it's spawned on the same location and none of these units can move (because of my collision detection implementation). AbstractActor has Point getPosition(), void setPosition(Point position), double getRadius(), which are maybe required in calculation (notice that I use radius so every unit has CircleCollider).

How would you implement spawning on different places close to the x and y. For now maximum players are 5 for one spawn but mostly 3 will be used.

Btw spawn() gets called at the beginning for every player and then if player dies after some time he respawns so the spawn() function gets called then too.

Thank You in advance for your help.

sentences:
AABB collision detection not detecting in some cases I'm using simple AABBs in a tile based world, and for some reason the algorithm does not detect collisions when moving towards the left and then down. I actually upload a video to YouTube to demonstrate the problem because I can't figure out a good way to explain my problem. Here it is:
AABB collision detection problem

As you can see, the little wireframe tile that moves around is the player, and when I move to the left, and then try to move down on the tiles, the player just slips right through. Detection works when moving to the right. Here's my algorithm to detect collisions:

public static boolean isColliding(AABB a, AABB b) {
    if (Math.abs(a.pos.getX() - b.pos.getX()) < a.size + b.size) {
        if (Math.abs(a.pos.getY() - b.pos.getY()) < a.size + b.size) {
            return true;
        }
    }
    return false;
}

The pos variable in the AABB class is the center of the AABB in question, and the size is half the size. Here's how I move the player:

if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
        move(0, 1, 0, MOVESPEED);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        move(1, 0, MOVESPEED, 0);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
        move(-1, 0, -MOVESPEED, 0);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
        move(0, -1, 0, -MOVESPEED);
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_SPACE) && onGround) {
        onGround = false;
    }

Which references this method:

private void move(float x, float y, float sx, float sy) {
    if (getX() / 32 + x >= 0 && getX() / 32 + x <= world.mx && getY() / 32 + y >= 0 && getY() / 32 + y <= world.my) {
        if (world.tiles[(int) ((int) getX() / 32 + x)][(int) ((int) getY() / 32 + y)] != null) {

            Tile t = world.tiles[(int) ((int) getX() / 32 + x)][(int) ((int) getY() / 32 + y)];
            Vector2f tempPos = new Vector2f((pos.getX() + (pos.getX() + 32)) / 2, (pos.getY() + (pos.getY() + 32)) / 2);
            box.update(new Vector2f(tempPos.getX() + sx, tempPos.getY() + sy), 16);
            t.color = true;

            if (!Collision.isColliding(box, t.getBox())) {
                setPos(getX() + sx, getY() + sy);
            }
        } else {
            setPos(getX() + sx, getY() + sy);
        }
    } else {
        setPos(getX() + sx, getY() + sy);
    }
    glPushMatrix();
    glTranslatef(getX(), getY(), 0);
    glPopMatrix();
}

32 is the tile size and the player size, just for reference. The 'tempPos' vector is just a vector that holds the center of the player's position. AABB is a class that stores a vector and a size variable, and the update method just updates those variables.

I guess my question is either, why is it only working on one axis, or how can I change my move method to be "better"? I've been trying to figure out why this isn't working, and I just can't come up with any ideas because it happens constantly, so it's not that my entities are moving too fast and the algorithm isn't detecting the collisions.

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:
Java Libgdx - Fire bullets This is my project structure!
I am using Java Libgdx

I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot asteroids the bullets come from the spaceship while you move it I want the same thing.
   package com.kovach.gameobjects;

  import java.awt.*;

  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.Texture.TextureFilter;
  import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Bullet {

int x,y;
public static TextureRegion bullet;

public static Texture texture;

public Bullet(int startX, int startY){

    x = startX;
    y = startY;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    bullet = new TextureRegion(texture, 238, 5, 6, 13);
}

public void move(){

    x = x + 2;
    if (x > 700)
        visible =false;

   }

}

Fire method in Man class

   public void fire() {

    Bullet z = new Bullet((left + width), (y + height/2 ));
    bullets.add(z);

}

GameRenderer draw method

    private void drawBullets(){
    ArrayList bullets = Man.getBullets();
    for (int w = 0; w < bullets.size(); w++){
        Bullet m = (Bullet) bullets.get(w);

    }
}

sentences:
In RecastNavigation, how can I make an agent idle after reaching its destination? This question is specifically about dealing with the Recast Navigation library.

I have added an agent with addAgent and set its target with requestMoveTarget.
When agent reaches its destination, it stops, but when being pushed out of the way (by another agent) it will try to return back to its target. Instead,  want it to stop and become idle, so that when other agent walking by push it aside and it wont return back.

I have tried calling resetMoveTarget upon agent.npos being close to agent.targetPos (as if agent has reached its destination), but that seems to break the inner logic of the crowd simulation - the agent would just keep walking in old direction, never stopping.

How do I properly tell an agent to stop and become idle (yet pushable) in RecastNavigation?

sentences:
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: Methods for character design When one begins the character design process, what are good starting points? Are there well known methodologies or systems to help in this process? How does the design process work in game industry, and are there big differences between the approaches different game producers use?

sentences:
GUIText size on 4:3 and 16:9 is different I have a text (guiText) on the screen.

It shows correctly when viewed on 16:9 resolution.

But it scales up when viewed on 4:3 (e.g iPhone4).

I am using following ObjectLabel script to place it on the same position regardless of screen resolution. Which is working fine for 16:9 and 16:10.

Object Label

sentences:
Quaternions - how to limit axis? Is there any possibility to limit quaternions to move only in x & y axis (like in Eulers- yaw and pitch, without rolling)? I's there any equation or something similar to do this?
Some example:
Movement should behave like this: http://360.art.pl/experimental/1/
But when I build my player on quaternions it have no limits and I don't know how to fix it http://360.art.pl/experimental/2/

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: How can I add a glow effect around a pair of wings in Unity without post processing? Basically I want to use post processing and then I found a tutorial to achieve my goal. However, the artist want a pure shader to achieve this, without any C# script hanging in the main camera. Any idea to implement?

sentences:
Where to store persistent player data? I'm working on a 2d game, where the player can take damage and die. And upon death, player object gets destroyed.

However, some attributes of player shouldn't be affected by his death, such as lives, ammo, current weapon and so on. I'm wondering where to store these values.

I'm using c++.

sentences:
Efficient system to reach the "parent" variable I've been stuck doing this in a very inefficient way and really want to know if there's some design pattern that solves this because it seems like a pretty common problem to have.

I have a system where I have a "world" class then that class has a list of town objects then the town has a list of buildings and buildings have a family. It's simple to for example, know what buildings a town has since the towns have all buildings in a list but what I always end up needing is a way for the building to know what town it is in for example. This can be done by giving buildings a town variable to keep that saved but I have to keep making sure that gets set properly for every stage in the chain which makes a mess of the code. It also messed up saving cause it saved a building in the town's building list but when saving the buildings data, had to save the town's data again since the building has that variable, creating a loop.

I've also tried making static methods that can be reached anywhere that say, a building can use and it will search through all towns until it finds where the building belongs, but that seems very inefficient to me and I've heard the same from others.

Lastly I've tried giving all of these things an ID but that still makes them have to search what "parent" has their ID.

Is there some way of doing this a more correct way? I have a hard time finding good search terms for it so I finally decided to just ask for guidance.

sentences:
Which GameObject should I put the animator on? I have a GameObject.  One of its children is an empty GameObject, whose children are the body parts which need to be animated.

Character (root)
--->Body
--->--->Body Parts

Should I put the animator on the root GameObject ("Character")?  Or on the empty child ("Body")?  Does it matter? What benefits would one way offer over the other?  Or is there another approach I should be taking?

This is for 2D sprites/animations.  I am trying to figure this out before making all of the animations to avoid redoing them.

sentences:
Figuring out what object is closer to a certain point? I'm trying to create fog of war, I have the visual effect created but I'm not sure how to deal with the hiding of other players if they're within the fog of war.

So right now the thing I'm trying to do is if another player is hiding behind a wall then not to render that player. I was thinking of doing it by sending a ray in the direction of all the players, and then creating a list of all the obstacles that ray collides with and then trying to figure out if an obstacle was closer than the player in order to predict the distance.

But then I realized I'm not really sure how to figure out if the obstacle is infact closer or not because I have to account for all the dimensions, so I'm kind of stuck. First of all is this approach the correct way to go about it and secondly how would I calculate if the obstacle was infact closer taking into account the X Y and Z.

Thanks

sentences:
How do I programmatically change the areaSize variable of an Area Light object in Unity? I'm trying to change the areaSize property of an Area Light object, but it looks like it isn't exposed in the class, itself.

this.light.areaSize =
    new Vector2(this.areaLightWidthSlider.Value, this.areaLightHeightSlider.Value);

This code results in the error:

  error CS1061: 'UnityEngine.Light' does not contain a definition for 'areaSize' and no extension method 'areaSize' accepting a first argument of type 'UnityEngine.Light' could be found (are you missing a using directive or an assembly reference?)

The documentation  says it exists, as an "editor only" property.

Is there any way to programmatically access and change this property, possibly using reflection or serialized properties?

I am using Unity 4.6, if at all relevant.

sentences:
Texturing a PyOpenGL 3D Cube with PySDL2 So, I've just started learning OpenGL with PySDL2, and I've created a class that will create a cube to the window that I've created with PySDL2. What I'd like to do now, is to figure out a way to texture the cube. I don't believe that the actual texturing part is the problem, but actually loading the image. I've tried to do this with PySDL's image loader, but this causes an error from the OpenGL texture creator. Here is my code to load an texture and bind it to OpenGL:

def LoadTexture(self, filename):
    """Loads a texture for the cube"""
    surface = SDL_LoadBMP(filename)
    #Checks if the loading succeeded
    if surface:
        #Translate the LP_SDL_Surface-pointer got from SDL_LoadBMP() to a real SDL_Surface
        texture_surface = surface.contents
        texture_format = GL.GL_RGBA
        GL_TEXTURE_ID = GL.glGenTextures(1)
        GL.glBindTexture(GL.GL_TEXTURE_2D, GL_TEXTURE_ID)
        GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
        GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, texture_surface.w, texture_surface.h, 0, texture_format, GL.GL_UNSIGNED_BYTE, texture_surface)
        return GL_TEXTURE_ID
    return None

And the error that gives looks like this:

TypeError: ("No array-type handler for type <class 'sdl2.surface.SDL_Surface'> (value: <sdl2.surface.SDL_Surface object at 0x030762B0>) registered", <OpenGL.GL.images.ImageInputConverter object at 0x02EC49F0>)

I'm using Python 3 so using something like PIL won't work for me. Any ideas how to get the texture loaded, preferably with PySDL2?

sentences:
Use floats or doubles when writing mobile games I know for shaders, floats should be used because they are the optimal choice for performance. Doubles are slow and use more memory which isn't ideal for shaders. While floats are less accurate and are prone to float overlflows, the tradeoff for speed is ideal on mobile hardware.

But what about everywhere else in the code base not related to the shader pipeline? I'm writing an engine and use doubles for the delta update tick and try to keep all units relative to that data type so there's lots of places using doubles. Should I be using floats on mobile in the engine as well?

The engine is written in C++ language

sentences:
Spawning projectile: it's there but does not show Here is the code and very simple.
I can see the object in the blue print and has nothing except the object itself.
so all the issue should be on the C++ code.
UCLASS(config=Game)
class APiramidShootingProjectile : public AActor
{
    GENERATED_BODY()

    /** Sphere collision component */
    UPROPERTY(VisibleDefaultsOnly, Category=Projectile)
    class USphereComponent* CollisionComp;

    /** Projectile movement component */
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = "true"))
    class UProjectileMovementComponent* ProjectileMovement;

public:
    APiramidShootingProjectile();

    /** called when projectile hits something */
    UFUNCTION()
    void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

    /** Returns CollisionComp subobject **/
    FORCEINLINE class USphereComponent* GetCollisionComp() const { return CollisionComp; }
    /** Returns ProjectileMovement subobject **/
    FORCEINLINE class UProjectileMovementComponent* GetProjectileMovement() const { return ProjectileMovement; }

};

and the C++ (without the hit portion)
APiramidShootingProjectile::APiramidShootingProjectile()
{
/*  SetRemoteRoleForBackwardsCompat(ROLE_SimulatedProxy);
    bReplicates = true;
    SetReplicatingMovement(true);
    */
    // Use a sphere as a simple collision representation
    CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
    CollisionComp->InitSphereRadius(5.0f);
    CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
    CollisionComp->OnComponentHit.AddDynamic(this, &APiramidShootingProjectile::OnHit);     // set up a notification for when this component hits something blocking

    // Players can't walk on it
    CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
    CollisionComp->CanCharacterStepUpOn = ECB_No;

    // Set as root component
    RootComponent = CollisionComp;

    // Use a ProjectileMovementComponent to govern this projectile's movement
    ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
    ProjectileMovement->UpdatedComponent = CollisionComp;
    ProjectileMovement->InitialSpeed = 3000.f;
    ProjectileMovement->MaxSpeed = 3000.f;
    ProjectileMovement->bRotationFollowsVelocity = true;
    ProjectileMovement->bShouldBounce = true;

    // Die after 3 seconds by default
    InitialLifeSpan = 1000.0f;

    //For Multiplayer
    //bReplicates = true;
}

so here all that should be shown is created, but nothing shows, even so when i aim something the hit function works and works as it should, so really not understanding what its happening.
I am new to this and extremely frustrated so please answer as soon as possible.

sentences:
Remove a body when touched in LibGDX(Box2D) I am using LibGDX to create a new project.

What i am trying to do is, i load bodies from a tmx file into levels which works fine. The bodies also has a sprite with them.

The problem is, is i would like to allow the user to touch certain bodies on the scene. When they touch the body they will be able to delete or remove it from the scene.

Is there anyway i can do this in LibGDX?

sentences:
Cocos2d Box2d contact listener call different method in collided object I have the building object, when it collides with another object I want to call some method inside it.
Building.mm

-(void)printTest
{
    NSLog(@"printTest method work correctly");
}

in my ContactListener I'm trying to call it so:
ContactListener.mm

#import "ContactListener.h"
#import "Building.h"
void ContactListener::BeginContact(b2Contact* contact)
{
    b2Body* bodyA = contact->GetFixtureA()->GetBody();
    b2Body* bodyB = contact->GetFixtureB()->GetBody();

    Building *buildA = (Building *)bodyA->GetUserData();
    Building *buildB = (Building *)bodyB->GetUserData();
    if (buildB.tag == 1) {
        NSLog(@"tag == 1");
    }
    if (buildA.tag == 2) {
        NSLog(@"tag == 2");
        [buildA printTest];
    }
}

NSLog(@"tag == 2"); work correctly, but [buildA printTest]; get error

  Terminating app due to uncaught exception
  'NSInvalidArgumentException', reason: '-[CCSprite printTest]:
  unrecognized selector sent to instance 0x18595f0'

Obviously I'm referring to the wrong object.
How I can get different method and property in contacted objects from contactlistener class?

sentences:
GameMaker project works fine when targeting Windows but not when targeting HTML5 As mentionned in the title, my GameMaker project works fine when targeting Windows.

However, when I build it for HTML5, I got those errors in the Chrome developer console:

Destructive Dark.js?VYNZB=1666826811:7 Uncaught TypeError: Cannot read property '_42' of undefined
    at _Qw1._M [as _L] (Destructive Dark.js?VYNZB=1666826811:7)
    at _Qw1._a4 (Destructive Dark.js?VYNZB=1666826811:1490)
    at _a72._a4 (Destructive Dark.js?VYNZB=1666826811:1380)
    at _lK1 (Destructive Dark.js?VYNZB=1666826811:1155)
    at _9v2 (Destructive Dark.js?VYNZB=1666826811:1742)
    at _Mu2 (Destructive Dark.js?VYNZB=1666826811:1748)
    at _Ju2 (Destructive Dark.js?VYNZB=1666826811:1733)

I suppose this error is not really useful since it seems to come from the obfuscated Javascript... However, I noticed that this error appears on the "Left mouse button released" event on one of my object. The code associated with this event is the following:

/// Select the square or switch its place with the current selected square

game_manager = instance_find(obj_game_manager, 1);

if (game_manager.lock_timer == 0) {
    if (game_manager.selected_square == noone) {
        game_manager.selected_square = self;
        inst = instance_create(x, y, obj_selection);
        inst.depth = -100;
        inst.image_alpha = 0.6;
    }
    else if (game_manager.selected_square == self) {
        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }
    }
    else {
        // Lock interactions
        game_manager.lock_timer = 2;

        // Switch the array cells
        var x_temp = game_manager.selected_square.x_grid;
        var y_temp = game_manager.selected_square.y_grid;
        var color_temp = game_manager.selected_square.color;

        game_manager.grid_array[x_temp, y_temp] = color;
        game_manager.grid_array[x_grid, y_grid] = color_temp;

        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }

        with (game_manager) {
            event_perform(ev_alarm, 0);
        }
    }
}

Not much info sorry, but I have no ideas where this error came from.

sentences:
Arbitrary number of VBO to Vertex Shader I am currently using standard modern OpenGL way to render a mesh via VBO and attributes

    glEnableVertexAttribArray(aVertexPosition);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glVertexAttribPointer(aVertexPosition, 3, GL_FLOAT, GL_FALSE, 0,0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

and in the GLSL code also the standard way to received into as in vec3 aVertexPosition.

However, I wonder if there is anyway to make this for a dynamic amount of VBOs. Let's say my software creates a number of VBOs that depend on the inputs, and I successfully create and allocate memory for all of them, how do I pass all of them to the shader? Does the number need to be constant? If so, what is the best way to do it?

sentences:
How do I go from world coordinates (X/Y) to tile coordinates? So, I've got this game rendered in fake isometric view with the following code for generating the mesh:

_x = x + ( y & 1 > 0 ? 0 : 0.5 );
_y = y * 0.25;

ADD_VERTICES( [
        _x-0.5,  _y,      0,  _uv[0], _uv[3], //B
        _x,      _y+0.25, 0,  _uv[0], _uv[1], //A
        _x+0.5,  _y,      0,  _uv[2], _uv[1], //C

        _x+0.5,  _y,      0,  _uv[2], _uv[1], //C
        _x,      _y-0.25, 0,  _uv[0], _uv[1], //D
        _x-0.5,  _y,      0,  _uv[0], _uv[3], //B
] );

Which creates quads (2 triangles really) with the following corners:

0 0 [0.5, -0.5  -   0, 0,       -   0.5, 0.5    - 1, 0]
1 0 [1.5, -0.5  -   1, 0,       -   1.5, 0.5    - 2, 0]
0 1 [0, 0       -   -0.5, 0.5   -   0, 1        - 0.5, 0.5]
1 1 [1, 0       -   0.5, 0.5    -   1, 1        - 1.5, 0.5]

I can get the world coordinates from the mouse position, how ever, I can't for the life of me figure out how to get from world coordinates back to tile coordinates. What is the algorithm for that? (Or, how can I change the vertices around so that that is easier)

sentences:
Local avoidance together with any-angle types of A* Pathfinding Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do not know exactly how to handle the problem of local avoidance between the NPCs moving at the same time in the same scene.

So, my question is this: what is the best method to implement local avoidance with any-angle path-finding? Just testing for LOS and steering to the tangent of the predicted encounter is a good enough solution or should a specific AI implementation be included within the pathfinding routine?

I would highly appreciate references (academical or not) with state-of-the-art implementations of local avoidance for me to explore the most recent developments in that field.

Many thanks.

sentences:
LibGDX - Rendering things in different classes thanks for your time!

I'm really new to LibGDX (and Java itself).

Which approach should I use to render my different game parts?
I want to show a background, the main character, a bunch of enemies and an HUD. The playable area will be bigger than the screen so the camera has to move following the main character (top view).
Also everything has to be procedurally generated.

For example, I have the code to generate the map (background) but I don't know how to render it if it's in another class (not the core entry point one).
I can think of calling a custom background.draw() method from my main.render() class and pass a batch to draw onto but probably there are better ways.
I've tried to use Stages (scene2D) aswell but I can't get my camera to move (are they mostly made for UI?).

I'd like to be pointed towards the best solution performance-wise since it's gonna be called every frame :P

sentences:
How to communicate to an inventory item which character it's being used on? Currently, I have an Inventory that is a ScriptableObject, which means it's not tied to any specific game object or player character. I just drag it into a MonoBehaviour if I would like expose the data of the inventory.

I have created an InventoryUI, which is a MonoBehaviour attached to a GameObject in my scene, and I assign the Inventory SO to it.

The InventoryUI contains button GameObjects with an InventorySlot script, to which I assign the item each slot is holding.

Everything works fine. When I click on one of the InventorySlot buttons, I'm able to call item methods, such as UseItem.

My problem is if the the item is a potion, for example. How can i add health to the player? Of course I could add reference to the player to the slot. But that will reference player repeatedly over 25 slots.

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: 'Real' AI that learns in games In my work I analyze and design Evolutionary Algorithms (EAs), but for fun I'm learning game design, and, of course application of EAs in games. So I'm wondering if there have been any games where AI actually works as AI, i.e. learns from past solutions to develop new ones. I suspect it should be something like tic-tac-toe or chess.

sentences: 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:
Distance travelled by gameObject and behavior depend on device's performance? The distance travelled by my gameObject and behavior depend on my device's performance. If the device is slow for example, it takes longer to accomplish a specific task, thus travels at a smaller speed, smaller distance etc. and doesn't end up where it's supposed to. How can I fix this?

Here's the code:

variable1 -= variable2 * Time.deltaTime;
transform.position += new Vector3 (13, variable1 * Time.deltaTime, 0);

sentences:
Parsing Sprites from Spritesheet How can I parse a spritesheet consisting of scattered sprites with different sizes, like this example and return the (x, y) and (width, height) values of each sprite?
It is trivial when the spritesheet is split on equal widths and heights, which for this thing I envy Unity for.
After spending some time researching, the best I could find is http://www.spritecow.com/, which is Javascript based and you have to manually click on your sprites to parse a single sprite, moreover it is really slow.

sentences:
Javascript board game: looking for optimization I posted this question on stackoverflow before but received no answers so I decided to post it here and see if someone could suggest me something.
I'm working on a html/javascript game for android. It's a board game which does the following.
It has tiles of different colors and user can place one tile (chosen programatically) on the board. If we get 4 or more tiles of the same color/shape we score some points and these tiles will disappear. The tiles above the removed tiles will replace them and new tiles will be added to the empty places. The image below shows how it works (this is just an example, the real board can have different dimensions):

The Tiles are <img> elements with their ids stored in an array which I use to check for matches and replacement.
It all works pretty well but once the new tiles are added to board I need to examine the whole board to check if new matches are avalable. And I want some advice here, because examining the whole board can be really slow. Is there a way I can do this efficiently?
Here's what I thought about doing:

Given the previous example, I thought about examining only the elements in the red area, i.e. only the elements that have been moved or added. It can be effective if the tiles move vertically, as I'll only have to check the moved/added tiles and it'll give me the new matches. But in case where I remove tiles horizontally it can be problematic, because if these tiles are at the bottom i'll have to examine the whole board and i confront the same problem.
Any advice or suggestion will be appreciated.
Note: I didn't add any code because it simply consists of checking the lines and columns for a given tile and look for matches. But if needed I can provide it.
EDIT: Adding horizontalMatchCheck function that for a given index checks for matches horizontally. It's the same thing for vertical check.
function horizontalMatchCheck(itemId) {
    hArray = new Array();
    if (rightMatch(itemId)) {
        var index = itemId + 1;
        hArray.push(itemId + 1);
        while (rightMatch(index)) {
            hArray.push(index + 1);
            index++;
        }
    }
    if (leftMatch(itemId)) {
        var index = itemId - 1;
        hArray.push(itemId - 1);
        while (leftMatch(index)) {
            hArray.push(index - 1);
            index--;
        }
    }
    //if >=4 matches found I replace the indexes with 5 (because no other tile can have this id) which'll then be removed and shifted.
    if (hArray.length >= 3) {
        hArray.push(itemId);
        for (var i = 0; i < hArray.length; i++) {
            board[hArray[i]] = items.length;
        }
    }
    else
        hArray = new Array();
}

function rightMatch(pos)
      return (!isRight(pos) && board[(pos+1)] == current) ? 1 : 0 ;
function leftMatch(pos)
      return (!isLeft(pos) && board[(pos-1)] == current) ? 1 : 0 ;

sentences:
Computing chance of winning when dealing with fuzzy numbers Computing chance of winning in a one player and one enemy battle when using fixed numbers is quite easy; for example if we have these numbers:

  Player : Attack : 5 - Health : 30 - Attack Interval : 2s
  Enemy : Attack : 10 - Health : 20 - Attack Interval : 5s

When both player and enemy start battling together at the same time you can say for 100% the player will win this battle because it takes the player 8 seconds to kill enemy but enemy needs 15 seconds to win, so it is certain the player would win this battle.

Now considering using not fixed numbers (Attack and Attack Interval are fuzzy), for example for these numbers:

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)50%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

Note: (5>10)10% means for 90% of times when a player attacks it would have 5 hit points and for 10% of times it randomly can be from 5 to 10 point.

Note: (2s>5s)50% means for 50% of times player attack interval is 2s and for 50% of times it randomly can be from 2 to 5 second.

Now this changes choosing the winner for some numbers; either the player or the enemy can win the battle. How can we compute the chance of winning? For example, concluding that the player has 34% of winning in this battle, etc.

UPDATE : I'm creating probability tree for player and enemy for my example with a little change in numbers to get rounded numbers. example is this :

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)70%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

now i achieve two probablity/winTimeNeeded chart like these :

Now how can i get player overall win probability with these chart and numbers?

Update : with @realUser404 solution i can say player have exactly 82.0028% of winning in this example (if player and enemy have exactly the same time we consider this a lost.)
still if some one have better solution I'll be happy hear about it I'll wait til the end of bounty.

sentences:
Get all the gameobjects for a SceneManager scene in Unity I'm using the new SceneManager to load multiple scenes in the same structure adopting the Additive method. I find it extremely useful but I wonder if there is a way to get all the GameObjects for a specific scene. When multiple scenes are loaded I see the GameObjects clearly separated by scene in the hierarchy but I cannot find a way to access the specific hierarchy of a single scene via script. Is that possible?
The findGameObject method I think returns the GameObjects for all the scenes..

sentences:
Why is SCNNode.rotation property a four dimensional vector? I don't understand why SCNNode's rotation property is a SCNVector4 instead of a SCNVector3. The documentation states that:

  The four-component rotation vector specifies the direction of the rotation axis in the first three components and the angle of rotation (in radians) in the fourth. The default rotation is the zero vector, specifying no rotation. Rotation is applied relative to the node’s pivot property.

What's the fourth axis? I tried adding a light (SCNLight) and if I don't specify the value of the 4th float in the vector the light has no effect (the scene is dark). Why? shouldn't a 3-dimensional vector (x,y,z) be enough?

sentences:
Canvas Rotation collision detection on a sprite I am using this code to detect collisions between two rectangular sprites.

intersect: function(other) {
    return this.x < other.x + other.width && other.x < this.x + this.width &&
        this.y < other.y + other.height && other.y < this.y + this.height;
},

My question is how can I account for rotation of the sprite.  This will only work with the

initial rotational position of the sprite.

Can someone point me in the right direction?

Thanks.

sentences:
How to load sprite from JSON? i know how to load text, but idk how to load texture from json..

this my c#:

 public void soalbegin(){
     filepath = System.IO.Path.Combine(Application.streamingAssetsPath, "soal.json");
     StartCoroutine ("Json");
     soaldata = JsonMapper.ToObject(jsonString);

 }

 IEnumerator Json(){
 if(filepath.Contains("://")){
     WWW www = new WWW(filepath);
     yield return www;
     jsonString = www.text;
     }
     else {
     jsonString = System.IO.File.ReadAllText(filepath);
 }

public void OnClick(){
         soalbegin();
 GameObject.Find("Panel/soal/gambar/Text").GetComponentInChildren<Text>().text = soaldata["data"][numbersoal]["soal"].ToString();//this to load text from json

//i need variable to load sprite / texture from link json
}

and this is my json:

 {
 "data":[
 {
     "id":"1",
     "soal":"siapa tokoh ini",
     "gambar":"//1.png",
     "jawaban":[
         "natsu",
         "shank",
         "goku",
         "gildart"
         ]
 }
]}

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: Can I use a song from a YouTube remix in my game? If I found a video with a remake/remix/version of a commercial song (for example, the theme of Super Mario Bros) with a CC BY licence, I can take this video for a commercial purpose like the background music of my game?

sentences:
How does Aspect Ratio and Resolution work in Unity? I am trying to make progress in Unity on understanding how aspect ratios and resolution work. I can't quite wrap my head around the topic. For example, I am trying to make a simple breakout style game, but in order to do that, I need to consider the world units and how each brick would fit into the scene. From what I have read, world units are dependent on screen resolution and aspect ratio. How would I be able to make something like this if mobile games are played on different devices (and ones with notches nonetheless). Also I'd like to know how to achieve this without using the tacky black bars that some games use.
Any information regarding this would be extremely appreciated.

sentences:
MD5Mesh Calculate Vertex Normals I am writing an MD5 3D model loader to display animated models. The vertices and texcoords load in correctly, but the lighting is supposed to be smooth. I calculate per-vertex normals by looping through all triangles, finding the triangle normal, and then adding that to each of the triangle's vertices' normal (follow?). Then, I normalize all the normals. This should work, but md5 declares each vertex with a texcoord, meaning that if I have a single vertex that has different texcoords for each of the faces it's attached to, it declares multiple vertices at the same position. Each of these will end up with its own normal, resulting in flat shading. Should I somehow merge duplicate vertices, or export the model differently, or do something fancy that I haven't thought of?

Thanks!

sentences:
How can I make my LibGDX game persist on android even if it's not the active activity I want my android game using LibGDX to continue keeping track of events in the game, even while it's not the active window.

For example, I have a stat that reduces over time even, if the game is not the active activity. When the stat gets to a certain percentage, I want to push a notification to the android platform.

I found some information to push android notifications. However, I could not find one on how to make a stat persist in the game when a different app or activity is on the main screen.

sentences:
How to set up bloom in Unity Last time I used image effects in Unity it was back when 3.0 was released and for bloom you used the object's alpha to indicate whether it should glow or not. Now in 4.2 I couldn't grasp how to apply the image effect properly. It seemed to put the whole scene to glow and alpha did not affect it.

There was no help from the Unity docs which are pretty much just spec sheets for the effects and no proper tutorials around. This leads to couple of questions:

How do you create something like the screenshots in the Bloom page in the docs? Only the car windows and metal parts glow, but no glow on the concrete.
How do you make a light source like the second image on the above link? I tried different shaders and lights on a gameobject but none of them produced anything like that.
What does the HDR checkbox in the camera actually do?

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:
How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads? So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM.

I don't intend for the scripts themselves to actually handle any data across threads. For the most part, the VMs will very rarely use the heap - as most things will be handled on the stack. The VMs are basically workhorses that drives the logic of the game, while the C++ end handles all of the data.

One of the things I noticed very quickly, is that as I get more scripts, I'm basically increasing my memory usage by a multiple of however many worker threads I am creating. This is because each State needs to load a copy of a script.

Is there a way, and how can I handle this without flooding my memory with 4+ copies of the same script? As in, one state loads in all of the scripts at the start, and puts them in memory. Then all other VMs are able to access those scripts?

sentences:
Projective texturing in DirectX11 I'm trying to implement reflections on flat surfaces and render a simple scene with a reflection. So I'm rendering the scene from the point of view of a camera symmetrical to the reflection plane and then I pass the resulting rendered scene as a shader resource to the shader that renders the quad and I use projectiv texturing by sampling the texture using the quad screen space coordinates mapped to 0 - 1:

Texture2D quadTexture;
SamplerState textureSampler;

struct PS_Input
{
    float4 pos : SV_Position;
    float2 texCoords : TEX_COORDS;
    float4 clipPos : CLIP_POS;
};

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (-input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

I assume that since the y and the v axis are inverted with respect to each other that I need to negate the second texture coordinate (and all the code I saw on the net do so).  But my code only works if I DON'T negate the second coordinate. If I negate the second coordinate the reflection is upside down:

The way I compute the reflected camera is I calculate the symmetric direction vector and use it in XMMatrixLookAtLH(). So when I calculate a new direction vector with a horizontal plane I should get a symmetric direction vector and the same right vector so my image is non mirrored on the horizontal axis. All works well when I don't invert the sign which is strange.

EDIT

I was not considering the fact that when rendering reflection on an horizontal plane, I have to take into account that the image being rendered is upside down with respect to the image I need to render on the surface. Not inverting the second projective texture coordinate has the effect of inverting the image (DirectX's v axis goes downwards, while projective texture coordinate y goes upwards). So when rendering a reflection on an horizontal surface I need not negate the coordinate. I need to negate both when rendering on a vertical surface (I always compute the symmetric camera direction vector and use the same world Up vector to compute the "reflected" view matrix):

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    if (normal.y == 0)
    {
        projectiveCoords.x = -projectiveCoords.x;
        projectiveCoords.y = -projectiveCoords.y;
    }
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

Now I have a new question:
everything is fine if I want to render a reflection on an horizontal plane or a vertical one. How can I render a reflection on an (arbitrarily) incined surface? using the same calculations doesn't work anymore.

sentences:
Windows Phone XAML and XNA Apps with Game Components I am using the Windows Phone Template "Windows Phone XAML and XNA Apps" and targeting Windows Phone 7/8. Most examples show your game inheriting from Microsoft.Xna.Framework.Game and then adding Microsoft.Xna.Framework.GameComponent items to the Components collection. But as my game page inherits from PhoneApplicationPage there isn't a Components collection  or a Game property.

How can I use GameComponent from within PhoneApplicationPage?

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: 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 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:
My Single Pass Gaussian Blur Looks Awful I've based my shader on this single pass shadertoy here:
https://www.shadertoy.com/view/XdfGDH

I applied the same shader and it looks like this:

Scaled up so you can see the faint tears in the texture. They look grid-like and not smooth at all.

When it should be looking like this:

Source image:

Here's my shader. Translated the shadertoy to GLSL 110

#version 110
uniform sampler2D texture;

float normpdf(float x, float sigma)
{
  return 0.39894*exp(-0.5*x*x / (sigma*sigma)) / sigma;
}

void main()
{
  vec3 c = texture2D(texture, gl_TexCoord[0].xy).rgb;

  const int mSize = 11;
  const int kSize = const int((float(mSize) - 1.0) / 2.0);
  float kernel[mSize];
  vec3 final_color = vec3(0.0);

  // Create the kernel
  float sigma = 7.0;
  float Z = 0.0;
  for (int j = 0; j <= kSize; ++j)
  {
    kernel[kSize + j] = kernel[kSize - j] = normpdf(float(j), sigma);
  }

  //get the normalization factor (as the gaussian has been clamped)
  for (int j = 0; j < mSize; ++j)
  {
    Z += kernel[j];
  }

  //read out the texels
  for (int i = -kSize; i <= kSize; ++i)
  {
    for (int j = -kSize; j <= kSize; ++j)
    {
      final_color += kernel[kSize + j] * kernel[kSize + i] * texture2D(texture, (gl_TexCoord[0].xy + vec2(float(i), float(j)))).rgb;
    }
  }

  gl_FragColor = vec4(final_color / (Z*Z), 1.0);
}

sentences:
SDL Surface clipping mask I am creating a GUI for my game, so I use some buttons like
. So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I want it, it is really inefficient, so how can I  upload a single smaller image of the rectangle, a sample of the gradient I want and use SDL_tff to create a surface. Say: I copy the rectangle and the text in an SDL_Surface, it should have two colors (black and white), now make white pixel transparent and black pixels to be replaced with the gradient to create the buttons and place them using SDL_Rects.

sentences:
How to create a scope for a sniper I am developing a first-person shooter/strategy game using the Lightweight Java Game Library, which has support for OpenGL. I would like to create a sniper which I need to magnify the screen and project an image onto the back of the scope.
I have tried using gluPerspective() for zooming in and out, but it just makes the screen go black.
I am thinking about using glReadPixels for grabbing pixel data from the zoomed in image, but I'm not sure what to put in field 'data'. explanation of glreadpixels here I'm also not sure how to get the data from glReadPixels and put it back onto the back of the scope.

EDIT: I'm not doing full screen zooming, I'm showing the image on the back of the scope.

Anyone know how to do this?

sentences:
XNA or SlimDX (DirectX 10) for multitouch rhythm game simulator I'm looking to develop a multitouch rhythm game in C#. It is aimed to be a simulator for an existing arcade game, similar to this: http://www.youtube.com/watch?v=TAiNNpA3wwg So far, I've decided on several requirements for the game that should be present:

1) Unicode text display, without the characters being known beforehand (i.e. the displayed strings are not known at compile time, but entered in by the user).
2) Support for display of all the common image formats (PNG, JPG, BMP, and GIF) and playback of various audio (MP3, WAV, OGG, FLAC) and video formats.
3) Full multitouch support (I'd like to support as many simultaneous inputs as the user's hardware allows). VERY IMPORTANT, MUCH MORE SO THAN THE OTHER TWO.

I had been fiddling with XNA, but I've found drawing arbitrary Unicode text with SpriteFonts difficult (it hates it when you try and load the entire CJK Unified set). In addition, I haven't found an easy way to load certain formats like Ogg Vorbis audio in XNA.

So, with this in mind, I've started looking into using DirectX 10 via SlimDX. However, I'm very lost, and am unsure of how to start with it and if the features I need are even present in it. To top it off, SlimDX documentation seems to be very lacking, especially with me being new to game development. Which one of the two frameworks would be best for my goals?

P.S.: Any references to starting game development with SlimDX (June 2010) would be very helpful as well, especially in relation to Direct2D, which what I'll most likely be using.

sentences:
What is the order-less rendering technique that allows partial transparency? I've seen somewhere rendering technique that allows order-less rendering of partially transparent sprites/objects.

Though I can't remember what the technique is called, so I'm having trouble Googling it.

sentences: Simple bare-bones path-finding routine I have a 2D grid with a number of cells. I need to find a path from one cell to another. There are no obstacles or opponents, and all cells are identical. What is a SUPER SIMPLE routine to calculate the shortest path? I have read about A* and other routines, but they are waaaaaaaay overkill in my case at this point. (Maybe I will need them later, in the future.) Thanks!

sentences:
move along given path relative to the inital position how can I move an object along a path "relative" to its inital position? I want it so if the object is initially positioned "around" the path instead of in the center, it will move along the path keeping that "displacement", as the below images

The blue line is the path and the red line is what the object, in this case the zombie, would follow if it had been initially positioned in the left and right sides of the "blue path", respectively:

Hope you understood. So far I've this

func move_zombie(delta):
    if target == null:
        return

    var target_pos = target.get_position()
    var pos = get_position()
    var dir = (target_pos - pos).normalized()
    var zombie_speed = 200.0
    position += delta * zombie_speed * dir

sentences:
Is it possible to push real-world, real-time data into Unity? I'm pretty new to this, and I'm having trouble figuring out where to even look.  If there's relevant terminology that'll be google-able, that would be a great help.

Suppose I want to have a monitor in-game that displays the output from a camera that's in the same room as the player.  Are there libraries for grabbing and rendering that data?

sentences:
Linear algebra: Are vectors that define a game object considered to be a subspace? In Linear-algebra a subspace is a collection of vectors that when added with each other or scaling would result in another vector in that same subspace.
How does subspaces relate to objects/players within the game world?
An object (player or enemy) in a game itself is just a collection of vertices that can be defined as a collection of vectors right? Does that mean that each object is also a subspace?
If I scale one object to be large enough to overlap/collide with another object does that mean those two objects are still in their own subspaces?

sentences:
How do I go about selecting minimum GPU requirements for a video game a couple years out from release? How does one go about determining a good minimum GPU requirement for a game that development is starting on, that will be published in approximately 2 years?

On one hand, you want as many people as possible to be able to play it, but on the other hand, you want the capabilities to be as high as possible for a better experience. The higher the DX/GL API you can use also means some things will be much better optimized.

My current idea is basically to identify what GPUs of the past have done, over a two year period, and identify the best one at the moment that will more than likely be hitting the bargain bin at the expected release date.

sentences:
Unity Anti-aliased Edge Shader with Variable Thickness (does not require standard shaders or post processing) I'm trying to create a coloring-book effect for an edge shader (not an outline shader) but having some difficulty creating straight line shaders that don't look badly anti-aliased. (Even before getting to the variable thickness on the lines part)

The solutions I've found seem to reference Vectrosity or post-processing stack. Is such a thing as a shader (not post-processing level) edge shader not possible?

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:
What is Serialization? I have been around programming for a while as a hobby, but I did not start seeing this concept until recently. I have google'd "what is serialization" numerous times, but I never actually get any sort of definition, usually just examples of how to do it. I am seeing it around the Ogre forums, the Bullet forums, and every other forum I go to, so I think it is about time I actually understand what it is, and why to use it.

Edit

To clarify, I am looking more for why to use it, especially in the sense of game programming. For example, the Bullet Physics API talks a lot about serializing a mesh, so I want to understand why that is.

Thank you :)

sentences: Polygon Collision Detection Android I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was looking at this tool and it seems like it would be really handy to give me a set of vertices for my images. Does anyone have any ideas about how I should go about implementing this? Basically once I have a list of vertices that form a polygon, how can I detect if polygon A intersects polygon B? I can see that these vertices can be used easily with Box2D but I want to try to do this without Box2D first.

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:
Keeping ratio the same across devices on fixed screen game My game is an Android game using OpenGL ES 2.0 (But this question could apply to any platform).

I have read many questions on here regarding ratio management, and also read many tutorials outside of this site, but I'm still really confused as to how to manage this.

My game is a Fixed screen 2d platformer.  By fixed screen, I mean the player sees the whole screen at once and the screen doesn't scroll.  All action takes place on this one screen (kind of like Bubble Bobble).  Therefore scrolling is not possible as we need to see the whole play area.

On my development device, I've written everything to look perfect, like so:

What I've currently done is when the game is run on other devices, I resize my GLViewport so that I maintain ratio like so:

Obviously, this has it's own problem - namely, it wastes screen real-estate. Now, I would accept this reluctantly, if I couldn't find a better solution, however, Google's documentation states that it's not allowed (of sorts) see: App uses the whole screen in both orientations and does not letterbox to account for orientation changes.

So, finally, I just stretched it out to fit the screen like so:

This takes the whole screen, but frankly looks a little naff as everything is stretched.

Am I out of options?  I see some similar games on the Play Store (ie, fixed screen) and they seem to look identical on different screens (and nothing is stretched) and there doesn't appear to be any extra space, but I have absolutely no idea how they achieve this.  Would love to hear from someone who has dealt with this problem themselves or has any ideas on how best to proceed.

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: Mobile game monetization idea - pay to remove ads? Has anyone tried a free app/game with Apple's iAds with an in-app-purchase to remove the ads?  Just wondering if this works.  A friend mentioned that some apps do this... is this a common and/or "user-friendly" monetization method?  Assume the ads are "tastefully" on the home screen and not in the actual game itself.

sentences:
How can I use voice commands to control my Windows Phone game? Is it possible to use simple voice commands like "run right", "run left", "jump", "stop", "attack", "defend", "finish" to control the player in a Windows Phone 8 game?

How can I implement voice recognition and some voice commands in my game?

sentences:
Creating a static background when using camera transforms in Allegro 5 How can I draw a static bitmap for the background of an Allegro 5 graphics window, if I'm using camera transformations to apply perspective to bitmaps in front of the background so it appears that they're otherwise in a 3D space?

If I try simply drawing a bitmap to the backbuffer without any transforms applied, and then call al_use_transform on a perspective transform when drawing the other objects, the "background" moves along with the transform.

sentences:
Handling random with unique chance in Python Okay, let's say you have a handful of enemies, each with their own 'rarity' to spawn.
For example:

monsterlist = []

snake = 'snake', 60
wolf = 'wolf', 80
antlion = 'antlion', 30

monsterlist.append(snake, wolf, antlion)

Now I want to spawn one at random:

totalchance = 0

for monster in monsterlist:
    totalchance += monster[1] #add each monster's rarity to totalchance
chance = random.randint(0, totalchance)

if chance <= targetlist[0][1]: #chance is <= than first entry's rarity
    #spawn first monster
elif chance <= targetlist[0][1] + targetlist[1][1]: #chance <= second target's rarity
    #spawn second monster
#etc

Assuming you have a large amount of monsters in monsterlist, this is going to take stupid amounts of code just to calculate chance to spawn, I like to assume there's a less annoying way to do this, right?

sentences:
How to return the scene view camera to the default view By the "scene view camera" I don't mean a GameObject with a Camera component, I mean the camera used to draw the Scene window in the Unity editor, controlled by this "Scene Gizmo" widget:

The default view shows an almost isometric perspective, where all three X Y Z axes are visible.
But when I clicked the green Y cone, my view changed to look straight down the Y axis, and I can't seem to return to the 3-axis view.
Clicking the other cones on this widget just switchest to look along the X or Z axis instead, and clicking the cube in the middle or the "Top" label just toggles between orthographic and perspective projection.
How can I get back to the default 3-axis view?

sentences:
How to handle levels in Unity3d I’m making a top-down 2d game in Unity3D for Android-based smartphones. Currently I have two scenes - a preloader and the game itself with all the stuff I need packed into one scene file. Also there is a very simple game-state-manager in my scene.

My question now is: Is it better to script all the levels within one scene-file or should I seperate them into unique scene-files? I’m just asking because basically the levels are very similar to each one - only the background and the sprites are different. Is there a problem with memory management if I use one scene only?

sentences:
How do I stop my timer when I close my game? Background:

I have a background service with a timer. It opens up a new activity when 20 seconds are over.

Currently, my app is using componentCallbacks2 to detect when the user has pressed the home screen, or has left the app, and on detection, I stop the timer, so that the activity doesn't get called.

But, for some reason, componentCallBacks2 does not get called when the user just closes out of the app:

Here you can see the user closing an app. For some reason, my app doesn't stop its processes when the app is closed. And, the timer continues to run. This results in the activity popping up on the users screen after 20 seconds, even though the user isn't in the app.

How can I detect if the app has been closed so that I can stop the timer? I have read on this topic in many other sources, and those sources just say to use the onStop method. I can't do that, because the onStop gets called whenever there is a change in activities

So, where should I stop the timer?

Image source.

sentences: Recording and playing back sounds with LibGDX How do I record a sound to PCM format and replay it from there?

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:
What's an appropriate difficulty scale for weapon efficacy vs difficulty to obtain? I'm writing up a design document for a voxel based adventure game, similar to minecraft, but fixing a lot of fundamentally broken game mechanics, or at least updating those mechanics to be more suited to an adventure game.

I'm considering creating a weapon scale from 1-10, where weapons at 1 are least powerful, and weapons at 10 are most powerful. I was considering making the materials to make the weapon most common for the level 1 weapons, and 10x less common for the most powerful weapon, but if you look at minecraft, diamonds only occur in 0.1% of blocks and they still feel too common, unless you're prone to dying of course.

In keeping with the adventure focus, would it be better to have the higher tiers of weapons only come from monster drops, or from a combination of a rare monster drop and a mineable item, or are there other common game mechanics I could use to have a super powerful weapon that's also hard to get, but worth your time to get?

To state the question another way, for the time investment, should a weapon that's 10x as powerful take 10x as long to obtain, or 20x or higher? Are there any studies that show any correlation between "fun" in how long players will grind for an item and an appropriate time investment scale for obtaining equipment?

sentences:
How to access entites from scripts in an entity-framework? I'm developing on a simple libGDX-based Game and im using the entity-component-system ashley.

For non-generic but custom behaviour (e.g. the Player Movement), I'm using "scripts" instead of reuseable and generic Entity-Systems. Therefore I've got an ScriptComponent and a ScriptSystem which runs init() and update() on all scripts related to an entity.

At some point I want to generate a map, counting game-related-properties etc.
that brings me to the point where I'm confused about how to access those porperties from any script.

In other Engines/Enviroments like Unity3D the GameObjects (the entities) brings functionality to find other entities like FindGameObjectsWithTag(...).

But how can I realise that in ashley? Also should it be possible in an Entity-Framework to access specific entities in general?

Edit: Additional information

Here comes a simple example-usecase. This is very notional example I've just created for that post. I just wanted to demonstrate, that I thing there is a need of an "main Game Object" in a game which also uses a entity-component-framework like ashley. So I thought a correct way is, to let this main-game-object be an entitiy too which holds the main script. But I'm not sure, if this is a good approach.

Here I demonstrate this with having a PlayerScript which just sets the lives for the player accordingly to the difficulty level of the game (maybe set by the player on the main-menu-screen). This PlayerScript is attached to the ScriptComponent of the player entity.

public class PlayerScript extends Script {

 int playerLives;

  public void init() {
     GameEntity entity = getTheEntityByName("game"); // this method doesn't exist
     GameScriptComponent gsc = scriptComponentMapper.get(entity);
     GameScript mainGameScript = gsc.getScriptByName("game");
     if(mainGameScript.getDifficulty == "easy")
     playerLives = 999;
  }
}

sentences:
How to stop several coroutines running on array of game objects In the code below, I am running a coroutine on each element of an array of game objects. How can I stop running the FadeToForEnemy coroutine on each game object?

    IEnumerator EnemyCycle()    {
    while (isRepeating)
    {

        for (int j = 0; j < enemies.Length; j++) {

            Enemy currentEnemy = enemies [j];
            var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
            var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 0f, 1f, currentEnemy.gameObject, false));

        }

        yield return new WaitForSeconds (hdTime);

        for (int j = 0; j < enemies.Length; j++) {

            Enemy currentEnemy = enemies [j];
            var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
            var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 1f, 1f, currentEnemy.gameObject, true));

        yield return new WaitForSeconds (srTime);

        }
    }
}

UPDATE

I tried stopping the coroutines in the following but the cycle of fading in and out just continued.

public void StopEnemyCycles ()  {
    for (int i = 0; i < enemies.Length; i++) {
        enemies [i].StopAllCoroutines ();
    }
    StopCoroutine ("EnemyCycle");

}

Also below is FadeToForEnemy:

    IEnumerator FadeToForEnemy(Material material, float targetOpacity, float duration, GameObject gameObj, bool isEnabled) {

    // Cache the current color of the material, and its initiql opacity.
    Color color = material.color;
    float startOpacity = color.a;

    // Track how many seconds we've been fading.
    float t = 0;
    if (isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }

    while(t < duration) {
        // Step the fade forward one frame.
        t += Time.deltaTime;
        // Turn the time into an interpolation factor between 0 and 1.
        float blend = Mathf.Clamp01(t / duration);

        // Blend to the corresponding opacity between start & target.
        color.a = Mathf.Lerp(startOpacity, targetOpacity, blend);

        // Apply the resulting color to the material.
        material.color = color;

        // Wait one frame, and repeat.
        yield return null;

    }

    if (!isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }
}

I have several groups of enemies, each group fades in and out at the same time.

sentences:
How to properly give Image source for multiple sources? I'm writing a script to change the image on the button based on previous selection.
Another script is giving the CurrentAvatar variable once previous button is pressed.

My problem is i can't seem to load an image for the button using:

AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");

Could someone please enlighten me on the proper code?

All from assets, or is it even possible?

Also looking to have multiple options in if statements, don't know a better method.

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

public class SelectedAvatar : MonoBehaviour {

    Button CurrentHeroSprite;
    static Sprite AvatarSprite;
    public static string CurrentAvatar;

    // Use this for initialization
    void Start () {
        CurrentHeroSprite = GetComponent<Button>();
    }

    // Update is called once per frame
    void Update () {
        if (CurrentAvatar == "Lamor") {
            AvatarSprite = Resources.Load<Sprite>("Assets/Images/FireMonsters/Lamor_Icon");
            CurrentHeroSprite.image.sprite = AvatarSprite;
            Debug.Log ("loaded sprite for Lamor");
        }
        //if etc etc etc
    }
}

sentences:
Client and Server game update speed I am working on a simple two player networked asteroids game using XNA and the Lidgren networking library. For this set up I have a Lidgren server maintaining what I want to be the true state of the game, and the XNA game is the Lidgren client. The client sends key inputs to the server, and the server process the key inputs against game logic, sending back updates. (This seemed like a better idea then sending local positions to the server.) The client also processes the key inputs on its own, so as to not have any visible lag, and then interpolates between the local position and remote position.  Based on what I have been reading this is the correct way to smooth out a networked game. The only thing I don’t get is what value to use as the time deltas.

Currently every message the server sends it also sends a delta-time update with it, which is time between the last update. The client then saves this delta time to use for its local position updates, so they can be using roughly the same time deltas to calculate position updates.

I know the XNA game update gets called 60 times a second, so I set my server to update the game state at the same speed. This will probably only work as long as the game is working on a fixed time step and will probably cause problems if I want to change that in the future. The server sends updates to clients on another thread, which runs at 10 updates per second to cut down on bandwidth.

I do not see noticeable lag in movement and over time if no user input is received the local and remote positions converge on each other as they should.  I am also not currently calculating for any latency as I am trying to go one step at a time.

So my question is should the XNA client be using its current game time to update the local game state and not being using time deltas sent by the server?  If I should be using the clients time delta between updates how do I keep it in-line with how fast the server is updating its game state?

sentences:
How rotate a 3D cube at its center XNA? I try to rotate a 3D cube on itself from its center, not the edge.
Here is my code used.

public rotatemyCube()
{
    ...
    Matrix newTransform = Matrix.CreateScale(scale) * Matrix.CreateRotationY(rotationLoot) * Matrix.CreateTranslation(translation);
    my3Dcube.Transform = newTransform;
    ....

public void updateRotateCube()
{
    rotationLoot += 0.01f;
}

My cube rotate fine, but not from the center. Here is a schematic that explains my problem.

And i need this:

sentences:
2D narrow-phase line intersection with square bounding box for calculating height efficiently I've performed partitioning of my level into broad and narrow phase. I'm down to narrow phase and focusing on the height from the ground.

I want to see what polygon the player is on top of. Since some polygon sectors may be lower than others (this is a birds eye view), I want the player to be stand on top of the highest one. Therefore I thought what I can do is each game tick would be to check which boxes the player intersects, and then find the polygon with the highest 'height' and use that as the base height for the player.

An example would be below:

Is this a viable way of doing it? That this game is 3D, but I only have to do two dimensional calculations for the height which reduces the computation and makes this easier.

The level has been cut up into a BSP tree so the following is a gross misrepresentation of the level, however I don't see any obvious way (immediately) to exploit the BST property to find out the highest sector that the player would be standing in. So far the best way I could think of was to use narrow phase collision detection described above and hope that is extremely fast.

I am looking for speed here, so if you know of any better algorithms or some faster way of doing this, please let me know.

EDIT: The focus of this post is for high level algorithms, of which they can be optimized later on. No actual collision detection code has been made yet.

sentences:
How can I position sprites in a Component-Entity engine? I'm building my first component/entity engine and I'm not so sure about some of my choices. I'm here asking suggestions on my first doubt.

I draw objects with 2 different behaviours:

Position driven by Physics.
Position defined by other logics.

At the moment I've only built the first kind of object adding to some entities a Render component (which contains information about the sprite to draw) and a Physic component which contains body information.
The Rendering system just attaches Render components sprites to the main view and the Physic System takes each entity that owns a Physic component and defines the sprite position for each entity.

Question 1)

Is it a valid choice to access (and modify) Sprites positions directly through the Physic System?

Question 2)

For the second type of object, should I manage the sprite position using a third component which is responsible only for that?

Is it a valid solution or I'm totally wrong?

I'm a bit confused about how to manage logic and positions with this kind of system... It seems a bit overwhelming to create a component for every behaviour that I need to define.

sentences:
No shadow on custom model I have custom low poly model ,the thing is it is not receiving shadows.

Unity's default plane do receive the shadow but not my low poly plane.

Here is image that demonstrate more,

sentences: Unity's default integration method Which method(s) does Unity provide for physical integration? RK4? Verlet? Euler?

sentences:
Framebuffer incomplete attachment I am creating a framebuffer in LWJGL using:
        framebuffer = glGenFramebuffers();
        texture = glGenTextures();
        glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
        glBindTexture(GL_TEXTURE_2D, texture);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
        glDrawBuffers(GL_COLOR_ATTACHMENT0);

But glCheckFramebufferStatus tells me that the attachment is incomplete. What am I doing wrong? I checked several websites and I don't seem to be missing anything...?

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 to simulate an elastic force, using Hinge Joint ? I've a bucket connected to a rope.

I would like that when a ball fall in my bucket , my bucket "bounce"down and up .. like it is connected to an elastic rope.

How can i do that ?

Thanks

sentences:
2D Top Down: Can't follow the path accurately In my game, there are many agents. Agents request a path, then after attaining a path to "goal" they follow the path. However player and many other things in the world can impact their position by pushing them or pulling them.

When agents get pushed and they happen to advance forward closer to "goal", I want them to smartly follow the previously given path.

I have pictures below to enhance your understanding of my situation.

I COULD recalculate path every a few seconds or when agent gets out of path BUT I have DOZENS of these little agents. I don't want to do path finding for DOZENS of agents again, again, again, and again whenever they walk out of the path.

sentences:
Locking global Y rotation component of camera orientation Question:
For research purposes, I'm trying to lock the global camera yaw in VR -- though, the "how" is more of a 3D math question and has little to do with VR. The user is in control of the orientation of the headset, but I want to take control of the global yaw. To illustrate the movement the user is allowed:

What I've tried:
I've a number approaches, but so far each one has ended up distorting the camera's orientation in some way. My most recent attempt sets the euler y component of both global last/current head rotations to any arbitrary, but same, value so delta yaw between them is always 0. But, the result is weird looping behavior in the same global area -- irrespective of where yaw first locked -- while rotating my head in a straight line.

Edit: It appears as the global yaw approaches 180, it flips. With global pitch=0, this happens instantly at 180, but with non-zero values of pitch it starts earlier and the flip happens over time. Here is a clip that illustrates this behavior.
Implementation of this approach (in pseudo-code, as I'm not using a well-known development platform/API):
var lastWorldOrientation = getHMDOrientation();//This method returns world space orientation
var displayedOrientation = lastWorldOrientation;
void Update() {
    var nowWorldOrientation = getHMDOrientation();
    var delta;

    if (lockedYaw) { //null if not locked, else float with value yaw locked to
        var tempLast = lastWorldOrientation;
        var tempNow = nowWorldOrientation;
        tempLast.eulerAngles.y = lockedYaw;
        tempNow.eulerAngles.y = lockedYaw;

        delta = tempLast:toObjectSpace(tempNow);
    } else {
        delta = lastWorldOrientation:toObjectSpace(nowWorldOrientation);
    }

    lastWorldOrientation = nowWorldOrientation;
    displayedOrientation = displayedOrientation * delta;
    camera.rotation = displayedOrientation;
}

While all of my attempts have been manipulating the euler angles of the HMD / camera rotations, I also have the ability to manipulate and read them in quaternion or matrix form. Any ideas why the current approach I'm using experiences the distortion it does, and how I can lock the global yaw of the camera without interfering with the other two axes?

sentences:
enemy behavior with boundary to change direction I'm doing space shooter kind of game, the logic is to reflect the enemy if it hits the boundary. With my logic, sometimes enemy behaves like flickering instead of changing the velocity. It's like trapped in the boundary and checking for if loops.
This is my code for velocity changing:

if(this->enemyPos.x>14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

if(this->enemyPos.x<-14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

How can I get around this? Its going out of boundary and don't know where to go and after sometimes its coming into field. I know whats the problem is, I dont know how to get around this problem.

sentences:
how to use texture atlas I am trying to implement texture atlas.

1) I am using the texturepackerGUI and the result is taking 2 files , one png (whicj contains all the images and one .atlas (and not .pack).

2) Now , I want to use the above instead of every seperate image.

Right now , I use for example:

private void loadTextures() {
bobTexture = new  Texture(Gdx.files.internal("data/images/bob_01.png"));
blockTexture = new Texture(Gdx.files.internal("data/images/block.png"));
    }

I want to use texture atlas , so instead of the above :

TextureAtlas atlas;
atlas = new TextureAtlas(Gdx.files.internal("data/images/bobs"));  //bobs.atlas
Sprite bobsprite = atlas.createSprite("bob-01");
Sprite blocksprite = atlas.createSprite("block");

Now,I must initialize TextureAtlas I think because it gives me error "Syntax error on token ";", , expected".I don't know how.

3) I put TexturePacker2 in the android project (MainActivity) :

  ...
  AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = true;
    cfg.useAccelerometer = false;
    cfg.useCompass = false;
    cfg.useWakelock = true;
    TexturePacker2.process("my-gdx-game-android/assets/images/", "/my-gdx-game-android/assets/data", "bobs.atlas");
 ...

The folders inside TexturePacker are ok syntaxed? Or I must remove the "my-gdx-game-android/assets/"?

Thanks!

sentences:
Drawing a continuous line with onTouchMoved callback i'm trying to draw a continues spline on every onTouchMoved call,
the functionality is supposed to be similar to the line drawing used in the iOS game - flight control.

i'm using it in the following manner:

constructor init:

conPointsArray = new PointArray();
conPointsArray->initWithCapacity(DEF_ARRAY_SIZE);
lineDrawer = DrawNode::create();

the onTouchMoved callback usage:

void line::onTouchMoved(cocos2d::Touch *Touch, cocos2d::Event *Event)
{
conPointsArray->addControlPoint(Touch->getLocation());
lineDrawer->drawCardinalSpline((conPointsArray), 0.5f, 100, Color4F::BLUE);
CCLOG("on touch moved x: %f y %f", Touch->getLocation().x, Touch->getLocation().y);
}

But the app is always crashing in a certain openGL function.

I assumed the reason for it is because the array is constantly changing and openGL is having trouble with it (and the fact i'm always sending the same array which is a bad idea, but just to see how things work), so i moved the drawing call to onTouchEnded, And indeed, The line was drawn, but only (as expected) after the onTouch action has ended.

What is the solution/best practice for this issue?

Cheers.

sentences:
Libgdx: movement of scrolling background is not smooth even at 60fps I'm developing a game and I want to make a sliding background. The background is not scrolling smoothly. I logged the fps, but it was ok. This is my code, I don't know what I'm doing wrong, any ideas?

public class MyGdxGame implements ApplicationListener {
    private OrthographicCamera camera;
    private SpriteBatch batch;
    Texture back;
    float offset =  0f;

    FPSLogger logger = new FPSLogger();
    @Override
    public void create() {
        camera = new OrthographicCamera(320, 480);
        camera.position.set(320 / 2, 480 / 2, 0);
        camera.update();
        batch = new SpriteBatch();
        batch.setProjectionMatrix(camera.combined);
        back= new Texture(Gdx.files.internal("back.png"));
    }

    @Override
    public void dispose() {
        batch.dispose();
    }

    @Override
    public void render() {
        logger.log();
        offset +=  (400f * Gdx.graphics.getDeltaTime());
        offset = offset % 480f;
        batch.begin();
        batch.draw(back, 0, offset);
        batch.draw(back, 0, offset - 480);
        batch.end();
    }

    @Override
    public void resize(int width, int height) {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

I uploaded the code to bring more information, I looked for on internet and a lot of people have the same problem, but I didn't find solution. I have almost finished the game, change the library will be a pity, any can help me? Thanks!
This is the code:
https://www.dropbox.com/sh/t26gt33wcex5izn/AAD8-yBSOztZfHe4wzDPRjjQa

sentences:
OpenGL render to texture causing edge artifacts This is my first post here so any help would be massively appreciated :)

I'm using C++ with SDL and OpenGL 3.3

When rendering directly to screen I get the following result

And when I render to texture I this happens

Anti-aliasing is turned off for both. I'm guessing this has something to do with depth buffer accuracy but I've tried a lot of different methods to improve the result but, no success :( I'm currently using the following code to set up my FBO:

GLuint frameBufferID;
glGenFramebuffers(1, &frameBufferID);
glBindFramebuffer(GL_FRAMEBUFFER, frameBufferID);

glGenTextures(1, &coloursTextureID);

glBindTexture(GL_TEXTURE_2D, coloursTextureID);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,SCREEN_WIDTH,SCREEN_HEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,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_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

//Depth buffer setup

GLuint depthrenderbuffer;
glGenRenderbuffers(1, &depthrenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, SCREEN_WIDTH,SCREEN_HEIGHT);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);

glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, coloursTextureID, 0);

GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, DrawBuffers); //

if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        return false;

Thank you so much for any help :)

sentences:
Average for damage formula (Min-Max Attack - Min-Max Defense) We wanted to create a quick spreadsheet to rapidly adjust enemies' Attack and Defense from players' estimated values of Attack and Defense.

One of the key values to adjust is the "hits until dead", and to derive this we need an average of the damage.

A basic calculation of the damage is done as following. Both players and enemies have minimum and maximum values for attack and defense. Two random values are generated between these and the difference is the damage received. Note that the minimum damage is zero (or miss).

attack = random(attack_min, attack_max);
defense = random(defense_min, defense_max);
damage = max(attack - defense, 0);

When attack_min > defense_max, a simple formula like this can be used to obtain the average damage:

attack_mean = (attack_min + attack_max) / 2;
defense_mean = (defense_min + defense_max) / 2;
damage_mean = attack_mean - defense_mean;

But in the other case, there is a chance of missing, and this formula is not accurate.

Let this be an example where the initial formula works:

attack_min = 10; attack_max = 20;
defense_min = 0; defense_max = 5;

attack_mean = (10 + 20) / 2 = 15;
defense_mean = (0 + 5) / 2 = 2.5;
damage_mean = 15 - 2.5 = 12.5;

And, this is an example where it does not:

attack_min = 10; attack_max = 20;
defense_min = 5; defense_max = 35;

attack_mean = (10 + 20) / 2 = 15;
defense_mean = (5 + 35) / 2 = 20;
damage_mean = 15 - 20 = -5;

There is low chance, but there is damage between 5 and 15! Empirical values suggest an average of around 2.

So, the request is the following: we need a formula that gives us the average damage regardless of whether defense is higher than attack or not. (We need a formula, not a procedure, so RNG is off the table).

Can anyone enlighten us on this? Thank you!!

Thanks to @DMGregory's answer, a reader may find the Excel VBA custom formula below, in case it can suit they.

Function TriangleSum(n)

TriangleSum = WorksheetFunction.Max(n ^ 3 + 3 * n ^ 2 + 2 * n, 0) / 6

End Function

Function GetMeanDamage(attackMin, attackMax, defenseMin, defenseMax)

GetMeanDamage = ( _
                TriangleSum(attackMax - defenseMin) _
                - TriangleSum(attackMax - defenseMax - 1) _
                - TriangleSum(attackMin - defenseMin - 1) _
                + TriangleSum(attackMin - defenseMax - 2) _
            ) / ( _
                (attackMax - attackMin + 1) * (defenseMax - defenseMin + 1) _
            )

End Function

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 can I change the sprites in the NES Double Dragon ROM? I have played a few NES ROMs where people have gone into them and changed the sprites. How did they do this?

I'd like to do this for the Double Dragon ROM. How can I accomplish that?

sentences:
Are the prefabs stored in RAM or in the Hard disk? (Unity3D) I have many prefabs objects (65 MB) in an Unity3D project.

My game use 100 different levels with combinations of the prefab objects.

What is better create 100 scenes or create only one scene where the prefab objects are placed with data from a XML?.

Each Scene load your own prefab objects?

Are the prefab objects loaded in the RAM when the scene is loaded or are stored in the hard disk and then loaded in the RAM when come in the scene?

sentences:
How can I compute the movement of an object along a parabola? I am working on a simple 2D game. In the game, I have a 'robot' that throws a ball towards another robot, in the shape of a parabola. Both 'robots' have the same Y coordinate.

The program knows the positions of the two robots, and it knows the position of the parabola's apex ('vertex') as shown here:

I need the ball to travel along the parabola. This means (correct me if I'm wrong), that at any given time, I need to be able to calculate the Y position of the ball, since I know it's X position.

If so, how can I calculate that Y position at any given time, knowing the information above. Please try to make your answers as clear as possible, since my math knowledge is very basic.

sentences: Which should be faster: 10 flat shaded polygons or 2 with a transparent texture I have particle system, and I want to the individual particles to take the shape of a star.  Which should be faster: Drawing the 10 polygons using a flat shader, or 2 polygons (a square) with a partially transparent texture?

sentences:
Unity - Instantiate 2 copies at same time?? (Asteroids clone) C# I haven't been at my computer learning code or game dev in a few months and am just starting again. I am trying to make a game very similar to Asteroids. In 3d but fixed camera from above so basically disregarding the Y Axis at the moment.

I have everything working fine so far such as the rocket stays in middle and can rotate, and fire weapon. The Asteroids for now all come from the top side of the screen, and have some code to randomise the X location and speeds.

When the laser hits the Asteroid I want it to destroy that Asteroid and create two more that are half the size and with a Rotation added of 45/-45 degrees.

I have the code that I thought would work but it is only creating one more and not two. (note: as you'll see I have tried making tempAsteroid2 and even asteroidPrefab2, before this I just had the one which I tried to instantiate twice).

What am I missing? why does this code not make two more appear upon laser collision??

Any help massively appreciated as always. Many thanks:

public class Asteroid : MonoBehaviour {
float speed;
public GameObject asteroidPrefab, asteroidPrefab2;
public int sizeKey = 2;
// Use this for initialization
void Start () {
    if (sizeKey < 1)
    {
        Destroy(this.gameObject);
    }
    transform.position.Set(transform.position.x, 0f, transform.position.y);
    speed = Random.Range(0.5f, 2f);
}

// Update is called once per frame
void Update () {
    GetComponent<Rigidbody>().transform.Translate(Vector3.forward * speed * Time.deltaTime);
}

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Laser")
    {
        BreakAsteroidInHalf();
        Destroy(other.gameObject);
    }
}

void BreakAsteroidInHalf()
{
    GameObject tempAsteroid = asteroidPrefab;
    tempAsteroid.transform.position = transform.position;
    tempAsteroid.transform.Rotate(0, -45, 0);
    tempAsteroid.transform.localScale *= 0.5f;
    tempAsteroid.GetComponent<Asteroid>().sizeKey -= 1;
    Instantiate(tempAsteroid);
    GameObject tempAsteroid2 = asteroidPrefab2;
    tempAsteroid2.transform.position = transform.position;
    tempAsteroid2.transform.Rotate(0, 45, 0);
    tempAsteroid2.transform.localScale *= 0.5f;
    tempAsteroid2.GetComponent<Asteroid>().sizeKey -= 1;
    Instantiate(tempAsteroid2);
    Destroy(this.gameObject);
    Debug.Log("Asteroid destroyed and replaced by 2 more");

}

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:
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:
Polling events with SDL results in stuttering response when dealing with multiple objects I'm new to SDL programming and I'm not quite sure I got how it handles events.
Given an instance like this defined in "game.c":
static struct {

  SDL_Window* window;
  SDL_Renderer* renderer;
  BinaryTree* objects;

} game = { NULL, NULL, NULL };

(Which of course gets properly initialized)
My game loop is defined in the same file as follows:
void game_run() {

  bool closeRequested = false;

  while(closeRequested == false) {

    SDL_RenderClear(game.renderer);

    binaryTree_startIteration(game.objects);

    while(binaryTree_hasNext(game.objects)) {

      GameObject* gameObject = (GameObject*) binaryTree_getNext(game.objects);

      SDL_Event event;

      while(SDL_PollEvent(&event)) {

        if(event.type == SDL_QUIT) {

          closeRequested = true;
        }
        else {

          if(event.type == SDL_KEYDOWN) {

            gameObject_onKeyPressed(gameObject);

            if(event.key.keysym.scancode == SDL_SCANCODE_UP) {

              gameObject_onUpKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_DOWN) {

              gameObject_onDownKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_LEFT) {

              gameObject_onLeftKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_RIGHT) {

              gameObject_onRightKeyPressed(gameObject);
            }
          }

          if(event.type == SDL_KEYUP) {

            //
          }
        }
      }

      gameObject_onRendering(gameObject);
      SDL_RenderCopy(renderer, gameObject_getTexture(gameObject), NULL, gameObject_getDestination(gameObject));
    }

    SDL_RenderPresent(game.renderer);
  }
}

game.objects contains every object which has to be rendered (via game.renderer) onto the the window (game.window). So, on each frame game.objects gets iterated on and for each element various functions get executed, before its texture is loaded to the renderer.
Of course gameObject_onRightKeyPressed() is called only if the right key was pressed, so if this function is defined as
void gameObject_onRightKeyPressed(GameObject* gameObject) {

  gameObject->destination.x += 1,
}

On each frame that the right key is pressed, gameObject's texture will move by 1 pixel to the right.
This works perfectly if game.objects contains only one element, but if a second element gets added, only the first one will smoothly respond to my input, while the other will move by 1 or 2 pixels just once in a while by keeping the right key pressed. It's like the first element contained in game.objects "steals" the input, so that when the second element's turn comes, there's no input for it to respond to. What did I do wrong?

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:
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: 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:
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:
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:
XNA for multiplayer game? I've made a few games without using XNA and recently started to see some documents and samples around and took an interest on it but i have a few doubts for going into it or not.

What limitations do i have if i am planning to create a mmorpg with XNA for distributing it (if it has a item mall or is paid to play for example) ?
Do i need more accounts to test it (for example to login into my own game 3 players) or XNA does not cost anything at this level (heard something about LIVE Gold Membership plus which is why i am asking this one) ?

sentences:
Set Non-Looping Animation Time to Seconds I have an animation that does not loop.  It plays for the default duration (n seconds), then stops on the last frame.  This is exactly what I want to have happen, but I want it to play for m seconds, not n seconds.  I do not know how long n seconds is.

I have to get it exactly to m seconds, because it is a changing variable.  So estimating will not work.  I need it to match up exactly with another animation.  How can I stretch an animation to last an exact number of seconds?

sentences:
What operations should be multithreaded? I wonder what game operations should be multithreaded, and which should always run on the main thread.

The most expensive operations I could come up with are:

loading a level
loading resources (for each level or at game initialization)
updating game world (weather, liquids, chain reactions, lots of small entities, etc.)
downloading from game server (level files, custom resources, player saves, object states, etc.)
occasional heavy methods (large screenshots, per-pixel calculations, full world update)

Which of those operations should be threaded, and which should not? Which of them can be threaded most effectively by using as many threads as the host supports?

Or is it better to split some of these operations into blocks and execute each frame, bit by bit, without threading, and without causing frame drops?

sentences: Do editor errors affect device performance? Do errors that come up in the Unity editor affect a game's performance on a device (on Android in particular)?  I'm talking about errors that keep coming continuously during Update() such as NullReferenceException  and "Debug.Log".

sentences:
How can I provide access cheat codes or diagnostics for a tap-only mobile game? I'd like to build several cheat-like commands into my game, mainly for debugging problems that could only be reproduced on the end-user's side.

For most games this would be trivial: just listen to a keyboard shortcut or two, but my game is a 'tap-only' mobile game. How can I go about providing access to these sorts of diagnostic commands with such a limited user interface in a way that will remain accessible to end-users but that they'd be unlikely to trigger automatically?

sentences:
Unity 2D: Dealing damage when character is crushed between two solid objects Whats the best approach to dealing damage to a player when they get stuck between two solid objects? For instance, I'm trying to make moving platforms that the player can ordinarily touch. It's only when the player is caught in-between the moving platform and the ceiling, for example, that damage is dealt or the player dies.

So, what would be the best way to approach this? Thanks in advance!

sentences:
Get intersection of vector in the middle of the screen My screen resolution is 640x480 and I have two Vector2 objects located at (10,10) and (600, 320).

How can I connect these two objects and extend the line to encompass the whole screens width, how can I get the Y for the intersection at the center of the width (320)?

sentences: Sprite/Object/Room limits in GameMaker 8.1? I know about GameMaker Studio’s limitations for sprites, objects, rooms, and other assets (https://help.yoyogames.com/hc/en-us/articles/230407528-GameMaker-Studio-2-Trial-Limitations), but I can’t find anything about if there are similar limitations in GameMaker 8.1, which I also have on my computer. What are the limits for sprite, object, background, and room count in the Lite and Standard versions of GameMaker 8.1, if there are any?

sentences: How to edit specific mipmap images in a DDS? I am looking for a way to edit individual mipmaps within a DDS file. To my knowledge, the NVidia Plugin only lets you create the largest image and then computes the smaller ones automatically. However, the problem is that after long tests with the different available algorithms and sharpening strengths I still think that at least the 2nd and 3rd of the smaller mips could look better if created manually. Is there a way to do so?

sentences:
How do I cap rendering of tiles in a 2D game with SDL? I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal number of the type of tile(color, or wall).
I have pretty basic collision detection and it works, I can also detetc continuous presses, which allows me to move pretty much anywhere I want. I also have a moving camera, which follows the object.

The problem is that, the tile based map is bigger than the resolution, thus not all of the map can be displayed on the screen, but it's still rendered. I would like to cap it, but since this is new to me, I pretty much have no idea.

Although I cannot post all the code, as even though I am a newbie and the code pretty basic, it's already quite a few lines, I can post what I tried to do

void set_camera()
{
    //Center the camera over the dot
    camera.x = ( player.box.x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2;
    camera.y = ( player.box.y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2;

    //Keep the camera in bounds.
    if(camera.x < 0 )
    {
        camera.x = 0;
    }
    if(camera.y < 0 )
    {
        camera.y = 0;
    }
    if(camera.x > LEVEL_WIDTH - camera.w )
    {
        camera.x = LEVEL_WIDTH - camera.w;
    }
    if(camera.y > LEVEL_HEIGHT - camera.h )
    {
        camera.y = LEVEL_HEIGHT - camera.h;
    }
}

set_camera() is the function which calculates the camera position based on the player's positions. I won't pretend I know much about it.

Rectangle box = {0,0,0,0};

for(int t = 0; t < TOTAL_TILES; t++)
{
    if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))
        apply_surface(box.x - camera.x, box.y - camera.y, surface, screen, &clips[tiles[t]]);

    box.x += TILE_WIDTH;

    //If we've gone too far
    if(box.x >= LEVEL_WIDTH)
    {
        //Move back
        box.x = 0;

        //Move to the next row
        box.y += TILE_HEIGHT;
    }
}

This is basically my render code. The for loop loops over 192 tiles stored in an int array, each with their own unique value describing the tile type(wall or one of three possible colored tiles).

box is an SDL_Rect containing the current position of the tile, which is calculated on render.

TILE_HEIGHT and TILE_WIDTH are of value 80.

So the cap is determined by

if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))

However, this is just me playing with the values and see what doesn't break it. I pretty much have no idea how to calculate it.

My screen resolution is 1024/768, and the tile map is of size 1280/960.

sentences:
HLSL MipMap sampling in pixel shader Using the Texture2D.Sample function, how does the pixel shader infer the mipmap level to use? Or does it use mipmap level 0? I am using the ps_4_0 shader model. And replacing Sample, with SampleLevel(state, pos, 0.0), does that give same results? In what cases does it give same results?

struct PS_INPUT
{
    float4 pos                   : SV_POSITION;
    float3 tex : TEXCOORD0;   // texture coordinate
};

struct PS_OUTPUT
{
    float4 color                   : SV_Target0;
};

Texture2D tex;

SamplerState state {
    Filter      = MIN_MAG_LINEAR_MIP_POINT;
    AddressU    = CLAMP;
    AddressV    = CLAMP;
};

PS_OUTPUT main(PS_INPUT input) : SV_Target
{
    PS_OUTPUT output;

    output.color = tex.Sample(state, input.pos);

    return output;
}

sentences:
What are the app file size limitations for different smartphone OSes & carriers? I know the iPhone App Store limits how large an app can be in general and there are also limitations with AT&T over the size it can be to transmit over a data plan vs WiFi. I have no idea what, if any, these limits are for Android apps and what I'm finding online is a mix of different numbers.

Does anyone know these numbers definitively? The Android game I'm porting is in the 20-30MB range and we'd like to know if we need to further reduce its size.

sentences:
How can I create a 3D model in Java without using modeling software? I am a lightly experienced game developer and this is my first time trying 3D objects in Java for the first time. I have been recently creating and updating games using AWT, Swing, and Graphics, but I want to delve farther into Java.

I have looked into Java3D, but it's not what I want. I want to use Images and then crop the Image and place the respective textures in their respective places. I already know how to do the cropping and 2D Image editing, but how do I go 3D?

sentences:
Unity: How to take in multiple textures for Image Effect I am trying to write a composite Image Effect shader with a script that works as such:

The camera texture is taken, and stored into two different variables. For examples sake they will be tex1 and tex2.
tex1 is modified by a shader.
Both tex1 and tex2 are taken into another shader, which composes them together. The result is stored as tex.
tex is printed to the screen.

I am not having an issue with the actual content of the shader manipulating the image-- But I do not know how to pass in both textures to one shader as needs to be done in step three. Thanks in advance if anyone can help.

sentences:
Help understanding radar sweep effect in shader code Several days ago I asked about this question: How to construct a propeller clock in Unity? But I don't understand how the answer works.
I have 0 knowledge about shaders, so I picked up a tutorial to understand the math functions, but that still didn't helping much in understanding the code.
I cut off part of the code to check the effect on an image, and I want to understand why the code has this effect.

What is the range of values for the parameters i.uv.y or i.uv.x?

Next I discarded part of the code, simplifying the fragment shader to just:
fixed4 frag (v2f i) : SV_Target
{
    // Simulate the strip of LEDs spinning around very fast.
    float headAngle = _Time.y ;

    // Compute the angle of the pixel we're rendering.
    float angle = atan2(i.uv.y, i.uv.x);

    float difference = frac( angle / (2.0f * 3.141592653589f));

    return difference;
}

And I rendered this on a plane:

According to the documentation, atan2 gives an angle value in between -pi and pi. So the range of angle / (2.0f * 3.141592653589f)) is in between -0.5 and 0.5.
I tested with frac(0.3), frac(0.25), which is the same as return 0.3 or return 0.25 since frac preserves only the decimal number. But why I couldn't generate the same gradient image as the one above? Instead, the plane is all one shade of grey, no matter what number I use.

Next I tried the code float difference = frac(headAngle) and got an image which is constantly varying between dark and bright images like these:

Putting this together:

From the 1st picture, I have an image with a gradient that's dark in the 1st quadrant and bright in the 4th quadrant.

From the 2nd & 3rd pictures, I have all four quadrants at the same brightness, constantly varying between them.

What I don't understand is how the sum of these two pieces of code works. If I combine them like this:
float difference = frac(headAngle + angle / (2.0f * 3.141592653589f));

Shouldn't I get a gradient that stays in one place, like the 1st image, but just changes in brightness like in images 2 & 3?
Instead I get a A brightness gradient that is sweeping in a circle around the plane:

...and I don't understand why.

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:
Does scene2d(libGDX) know when an image is drawn out of the screen? I mean, I want to make a tiled map using scene2d, so in the render method of my game...

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    gameStage.getCamera().position.set(player.getX(), player.getY(), 0);
    gameStage.act(Gdx.graphics.getDeltaTime());
    gameStage.getBatch().begin();
    for(int i=0;i<20;i++)
        for(int j=0;j<20;j++)
            gameStage.getBatch().draw(tile,i*tileSize,j*tileSize,tileSize,tileSize);
    gameStage.getBatch().end();
    gameStage.draw();
}

Does scene2d know if the tile is out of the screen view, so it does not draw it, or do I have to implement code to fix it?

Sorry for my English.

sentences:
Diamond Isometric Tile Picking C# Xna I recently converted the display style of a isometric map from staggered to diamond and I can't figure out the tile picking process.
I'm well aware of the other existing threads regarding this subject and I read all of them but I haven't figured out a solution (my concentration these days is a mess)
I'm using a very basic system which consists of passing through all tiles and pick the one where the mouse points at (something like this Map.Tile.Intersects(mouse.Rect) ) and then with the help of a color map I pick the correct tile.
But I don't like this system because is pretty inefficient compared to some mathematic solutions I saw and didn't understand.
So here is the code I use to create the map :

                int x = 128 * j;
                int y = 64 * i;
                int isoX = (6 * 64) + (x - y);
                int isoY = (x + y) / 2;

128 is the tileWidth , 64 tileHeight and 6 * 64 is the xOffset

And the coordinates are like this :

Can somebody give me some hints or explain what I should do ?
Thank you.

sentences:
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:
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:
8-bit Game: To pre-scale images, or post scale my Cocos2d scene. Which is the better approach? I'm wanting to develop a game with an 8-bit feel. Since this game is mostly for my personal enjoyment, I've set a requirement that I want my game to have an 8-Bit feel to it that is most similar the 8-Bit systems of yore, on a lovely CRT TV.

This is also my first Cocos2d project so I don't know which approach is better.  I'd like the general advice of the community on how to render my game.  I've come up with two possible approaches.  Please advice which is better.

Approach #1

Create images for backgrounds and sprites using the "8-bit" resolution of my game.  After I'm done making an image, I scale it up and I save two variants; the standard sized one and the "@2x" variant.

When I render the game, everything looks very 8-Bit but I will still need to apply mathematics to every animation so that my virtual pixels always shift by 4 or 8 pixels (for retina displays) on the screen when they move.

This approach doesn't sound difficult but it seems like it could become a bit annoying and tedious.

Approach #2

Generate all content in my image designer at the exact resolution of my virtual screen.  When I generate my scenes in Cocos2d, I generate them all with the "virtual resolution".  When the scene is displayed on the iOS screen, I scale the entire scene up to the resolution of the device.

I think this could be the simplest approach since all of my sprite and background movement mathematics can just behave as normal.  However, I'm not sure that this approach is even possible.  Furthermore, I know that within iOS, graphic scaling has an anti-alias affect that gets applied to graphical objects as they scale-up.  Obviously, I'd want to cut this affect off and just use a "nearest neighbor" algorithm to scale-up my scene.

If I can't cut off the scaling anti-aliasing, I don't want to use this method.  However, if I can setup such a rendering system, I think this approach would be best.

So, my question is simple.  Can I use approach #2 and, if so, which approach is really easier to work with in Cocos2d and iOS?

sentences:
Where to find more documentation on Ogre3D? I sucessfully managed to compile Ogre with MSVC2010 and I could dabble with the tutorials.

However, is there a website I am missing where there would be more ressources / infos?

The documention of the lib itself is very scarce and their wiki pages contain very few content, which is mostly outdated. For instance I'm trying to understand how the paging terrain manager works but I wasn't even able to find a single code snippet of a basic example, I don't even know which classes manage this effect.

So what's the best way to learn how to use Ogre? Are there some ressources outside of the main website?

Thanks

sentences:
Client AI calculations vs. Server AI calculations I have been thinking about a game which would have an AI, and the AI would ideally do extensive calculations thinking many turns in advance.
I am curious if there is some way to put most of the burden of the AI calculations on the client while still preventing cheating. Obviously some processing has to be done on the server, but is there a way to find some happy middle?

sentences:
How do I keep a PHP server running forever? I'm making a web game RTS, it's mostly create units, manage resources, attack with army, and level up factories. I have created the basics of the game using Javascript, PHP, and MySQL databases. I use the database to store player credentials and stats, and PHP as a server-side logic (like retrieve the right player and attack with X units). On the client side I use HTML/CSS and javascript.

My problem is that I need to keep adding resources based on the factories level (ex. 10 gold every min, when mine-factory = lvl.1). The only answers that I have found, is to modify the PHP file to run an infinite loop and keep connecting to the database to add those resources 24/7. I think the server also needs to handle attack travel (when units arrive at the enemy castle and the fight is over) and some other logic, but I don't have physical access to the server, and keep connecting to the database to add resources doesn't seem a good idea. I'm willing to make a server using other languages, or use other way to store data that keeps changing, so I can avoid multiple connections to the database. If you know a better way to do it, or something that can put me on tracks I will appreciate it.

sentences:
Rotate camera around point of view I'm trying to rotate the camera around the view point of the camera. So when the user looks at a build the camera rotate around that building. But the camera does not need to have the building to rotate around. So therefore I want a camera that can rotate around his own point of view. So that the camera behave everywhere the same in the game.

How can I achieve this in Unity 5.6?

sentences: What is a good book on physics for game development? I'm looking for a good beginners' book on the subject of physics in game development. Something that focuses on 2D games would be preferable.

sentences:
What is the game design rationale behind forcing MMO players into gameplay styles they do not enjoy? Most MMOs have a varied assortment of content. However, not everyone enjoys particular content styles. There are a lot of PvE players who don't like PvP, and vice versa. There are players who only want to do small group content or large group content, but not the other type. There is always an argument among the playerbase on whether it's a good idea to encourage players to participate in content styles they do not enjoy. The most common argument is that it makes the world feel more alive if there's more to do. However, I personally am of the opinion that forcing players to do content that they do not enjoy, for example through exclusive player power rewards or cosmetic rewards, will make them enjoy the rest of the game less and in turn stop playing sooner.

What is the potential game design rationale for an MMO to force PvE players into PvP and vice versa, or to force players who prefer to play in small groups to do large group content?

sentences:
How common are game engine bugs, and can I claim damages for them? Are game engine bugs (in popular ones like Unreal and Unity, not some unknown ones) common? I know engines like Unreal, Source and Unity3D are well tested and maintained, but, for example, is there any threat like: I create a game, the engine programming is fine, so is everything I do, but I get a bug in the game because of a bug in the engine?

And as most of you guys here are game developers, has any one had such an experience? Also, can I take legal action on the creators of that engine incase I am under loss because of their bug?

sentences:
Libgdx: how to pick a random texture? I'm trying to pick a random texture from a fodler placed in assets and use it but it's giving me errors. I'm doing so in the main game screen class

    final  File dir = new File("img");
    Random rand = new Random();
    File[] files = dir.listFiles();
    File file = files[rand.nextInt(files.length)];
    Image = new Texture(Gdx.files.internal(file.getPath()));

The error is

java.lang.NullPointerException: Attempt to get length of null array

to my knowledge this error should only be there if File[] files = dir.listFiles(); is null, and it isn't, currently two pictures are there. So what's happening?

I tried supplying the full path in the first line to img folder but to no avail. Plus I don't want to supply the full path anyway, it will change  from device to another.

sentences:
How to solve this card game turn requestes clashing issue So I am developing a poker card game using JS +node.js + socket.io.

It is turn-based game. There will be a host and 4 other players.The flow is the players need to make a yes/no choice, then the host need to make a yes/no choice upon players' move, then players will need to make another yes/no choice, then the server will determine who wins.

Put simply,

1:Host set up the hand ----->2: inform all players----> 3:A player make a move(ticking yes or no) --> 4:this move will show up on the host's screen--->5:the host need to make his/her move(ticking yes or no)--->6: the host's move show up on players' screen, they make another yes/no choice----> 7:the server determine who wins.

The issue lies on step 5.

There will be multiple moves waiting for the host to process. Now the current design is all moves are shown by the form of a custom confirm box. It has yes/no button. It works perfect when there is only one host and one player. But when there is more than 2 players, there is a serious clashing problem.

If player A makes a move, it shows on the host's screen, and before the host ticking anything, player B makes a move and then player B's move (confirm box) will replace player A 's confirm box. In this case the host will not be able to process player A's move and the game cannot finalise.

How to get this clashing issue sorted? I hope I am not making this issue sound too complicated but I have been scratching my head.

sentences:
Rotate 2d sprite towards pointer I'm using Crafty.js and am trying to point a sprite towards the mouse pointer.

I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under unit tests). At least it responds that the degree between { 0,0} and {1,1} is 45, which seems right.

However, when I set the sprite rotation to the returned degree, it's just wrong all the time. If I manually set it to 90, 45, etc, it gets the right direction..

I have a jsfiddle that shows what I've done so far.

Any ideas?

sentences:
What's best to use OTF or TTF? What's the most recommended format should I use for fonts, OTF or TTF or another?

In looking for:

Performance/Efficiency with SDL_ttf library
Free/Open-ness [1]

[1] I'm planning to use GPL3 and Open Font License.

sentences:
What tools are available for creating 3D collision and pathfinding data? What is the process of creating geometry data to assist on NPCs movements and such on a 3D world to avoiding having them from going through the ground, etc? Are there specific modelling programs that can create the world and the collision geometry to be used?

The map I made has caves, lakes with deep water, varying terrains heights, mountains, etc.

sentences:
Tank / turret animations I don't know if this question is more of Blender / 3D or gamedev / Unreal question, but I decided to ask here first.
What I want to do is make a character, simple robot. The bottom part rides around on wheels, controlled by keyboard, while the top part is a turret that turns towards player cursor (which works as a crosshair).
I made the model in blender, using only two bones, one for the bottom part and one for the turret. I created 4 poses for aiming each direction.
Then, in Unreal, I created 2D aim offset (as I only need one dimension). And after some coding, it works... almost. When I aim forward, and then to the right, it transitions, nice. Then towards the back, also works. But if I then move to the left, instead of rotating extra 90 degrees, the turrent rotates back forward and then to the left.
How can I fix it? Is there some settings in Unreal that I could use, or should I create the model in blender differently? Is the whole rig / bones solution not gonna work?
TLDR: I want the turret on my robot to rotate infinitely to whatever I aim at.

sentences:
When to use C++ and when to use blueprints? I'm trying to learn how to use the Unreal Engine. I have basic knowledge of C++. Recently I started making a Survival Horror Game as a project that I'm just doing for the learning experience. So far though I've implemented every feature through the Blueprint system.

So my question is for what and when will I use code to improve/make a game in Unreal Engine?

sentences:
OpenGL Blending Format In OpenGL, is there a format for a texture in glTexImage2D that prevents blending, or do you have to disable it using glDisable(GL_BLEND).

Reason for use is that I would like to store additional data in the alpha channel of a texture, but it blends with whatever's behind it.

sentences:
How To Architect My Game To Keep the Same Scene Loaded My Unity game has a large planet GameObject that serves as the map. I want to keep this planet loaded, but still create different levels where enemies and the player are spawned at different locations on the planet, depending on the level. Therefore, the objectives, targets, and vehicle the player must use and accomplish are different at each level, but the map itself is not.

I have had a couple of thoughts. My first idea is to use transforms as locations for where vehicles spawn, and assign a vehicle to each location. Perhaps then each set of locations can be saved as a prefab that represents a level.

One possible solution is to use different scenes for every level, with the main scene containing the planet being kept throughout. I am not sure how the different components can communicate with each other, however.

My difficulty with all this is how to conceptualize how all the elements will work together. Say I make a class called Level, which includes the Objective that must be accomplished to win, the Vehicle the player will use, and the Locations where objects are to spawn, etc. Then I create scripts called Level1, Level2, etc. that inherit from Level and allow custom scripting for each level. However, there is also a state where the menu shows the scene, but no objective is being accomplished. Is that a viable solution? Is there a better solution from experience?

sentences:
Is there a way to set a pallet for colours in an SVG image and change them at runtime for one gameobject? in the latest beta build for unity they introduced the ability to import svg files. What I'd like to know is if there is a way to identify all svg shapes by colour, and then change those colours, as if you were changing a class in CSS.

I suspect that you can go into an svg file, find where the text for colour is found and then change it, but I'm worried it'll change it for any object that use that svg file instead of changing it by gameobject.

The thing I'd like to do here is have customizable characters in a fighting game, where you can go into the menu and change their colours on a slider. so if I can identify like 3 colours in an svg and list them, and then edit those values in runtime or load, I'll have what I need

sentences: What is this tracking circle called as? I don't know what the circle in the image below used for changing directions and movements of a character is called. Can anyone provide me anything related to it? I want to include it in my game.

sentences:
glGenVertexArrays causes crash My code keeps crashing at runtime, I have done some creative debugging and determined that it was the glGenVertexArrays that was causing the crash, I've looked around and come across some answers that told me to enable experimental mode in GLEW but that didn't work, as far as I can tell my graphics card supports it, my opengl version is 3.1. I'm using freeGLUT and GLEW

here's the code, the line in question is 45
http://hastebin.com/rekizejuza.cpp

std::cout << "made it here\r\n";
glGenVertexArrays(1, &meshID);
std::cout << "not here here\r\n";
glBindVertexArray(meshID);

sentences:
Using LibGDX within Android Fragment I want to use LibGDX with Android, but instead of modifying my Activity to extend

  AndroidApplication

I want my to render my graphics inside Android Fragment

The problem is that my class already extends Fragment, so I can't make it extend LibGDX AndroidApplication (Multiple Inheritance)

is there any workaround for this ?

Thanks

sentences:
Why, after calling SetVideoMode as in the following, does nothing appear on my screen? I am trying to create an application that will need to use double buffering (for purpose of vsync). I am using SDL.NET. From what I understood, in order to have double buffering, I have to SetVideoMode with the opengl paremeter set to true.

Here's the code I'm using:

        Video.Initialize();

        Video.GLSetAttribute(OpenGLAttr.DoubleBuffer, 1);
        Video.GLSetAttribute(OpenGLAttr.SwapControl, 1);
        Video.GLSetAttribute(OpenGLAttr.RedSize, 8);
        Video.GLSetAttribute(OpenGLAttr.GreenSize, 8);
        Video.GLSetAttribute(OpenGLAttr.BlueSize, 8);
        Video.GLSetAttribute(OpenGLAttr.DepthSize, 16);

        Video.SetVideoMode(VideoInfo.ScreenWidth, VideoInfo.ScreenHeight, false, true, true, true);

If 4th parameter (bool opengl) is false, it works: a new fullscreen window is created and displayed (but I assume the OpenGLAttr's set above are meaningless in this case).

If 4th parameter is true, nothing happens. A new window gets created (at least, it appears in the list of open windows) but I cannot alt-tab into it and nothing appears on the screen.

What am I doing wrong?

sentences:
Using a rule engine for a text-based web game I have a database table that stores basic player data for the game.

It looks like this:

_________________________________________________________
player_id | player_level | player_class_ref | player_exp
    P1            8              W1            68349518
_________________________________________________________
level | required_exp
  1         100
 ...
  8         80000000
____________________

The game itself is text and browser based.

I decided to use a rule engine to adjust player data when needed.

It executes after every player event - for example, killing a monster or finishing a quest.

The sample rule looks like this

when
    player_exp > closest_level_exp
then
    player_level + 1
    player_exp = abs (closest_level_exp - player_exp)

There might be a lot of similar rules - for example, quest accepting.

So my question is - Is my approach viable for a web and text based game?

I am not sure how such things are usually implemented in games, such rules be hard coded, or they are stored another way?

sentences:
Love2D STI library not drawing map at all (black screen) I'm trying to use a pretty standard map with the Simple Tiled Implementation module for Love2D, but no matter what I try, I can't get it to display anything but a black screen. Here's my current code (keybindings in an effort to see if the map has just been placed offscreen):

local sti = require "sti"
local mapPos = { x = 0, y = 0 }

function love.load()
   map = sti("maps/map1.lua")
end

function love.update(dt)
   if love.keyboard.isDown("w") or love.keyboard.isDown("up") then
      mapPos.y = mapPos.y - 5
   end

   -- Move player down
   if love.keyboard.isDown("s") or love.keyboard.isDown("down") then
      mapPos.y = mapPos.y + 5
   end

   -- Move player left
   if love.keyboard.isDown("a") or love.keyboard.isDown("left") then
      mapPos.x = mapPos.x - 5
   end

   -- Move player right
   if love.keyboard.isDown("d") or love.keyboard.isDown("right") then
      mapPos.x = mapPos.x + 5
   end
   map:update(dt)
end

function love.draw()
   -- Transform world
   love.graphics.translate(-mapPos.x, -mapPos.y)

   -- Draw world
   map:draw()
end

However, even a more basic attempt (copied from the STI tutorial linked from the README on the Github page) doesn't work, again giving a black screen:

-- Include Simple Tiled Implementation into project
local sti = require "sti"

function love.load()
    -- Load map file
    map = sti("map.lua")
end

function love.update(dt)
    -- Update world
    map:update(dt)
end

function love.draw()
    -- Draw world
    map:draw()
end

My directory structure is basically just main.lua, an assets folder, and a maps folder. The maps folder contains the Tiled tile set and the Tiled .tmx maps and the lua exported maps.

I'm on Mac OSX, using Love2D version 0.10.2.

Am I missing something? Thanks.

sentences:
Level playing field: Punish the better player or enhance the worse player? I am making a 1 vs 1 game where each player controls a car with an identical joystick. The objective for the players is to reach a goal destination before the other player.

The players of the game are placed into categories based of the skills controlling the car e.g. Skill level[1,2,3,4,5] with 5 being the highest skill level.

The players will not be intended to jump up and down in skill levels when playing the game. After a given period, e.g. a week, the skill levels will be updated. This will not be shown to the players.

The objective for me is to make every combination of players in the 1 vs 1 setting be a 50/50 win loss chance for the players.

Example: Player 1(Skill level 5) vs player 2(Skill level 1) should each have 50% change reaching the goal destination first.

I have not been able to find any research on whether the best practice is to limit the abilities of the good player or enhance the abilities of the bad player or maybe a combination.

The idea is to have disabled adolescents playing against their able bodied friends or family members. It is therefore not a possibility to not let good players play against bad ones.
Data from field tests have shown that the disabled adolescents perform worse than able bodied consistently due to spasms.

I am looking for input on how to go about with this; research, your experiences, how other games are doing it? Is there any common recommendations for this?

sentences:
How to set indent spacing of a tree in libGDX scene2d? I've been trying to create a customized UI using scene2d library in libGDX. However I am having troubles as I'm trying to set a custom indent spacing on my Tree object.

I have tried to search for the answer but haven't actually found any discussions about this on the internet.

This is the current situation which I am having.

This is how I would prefer it to look like.

All I want is that I could be able to change the size of the margin which is caused by nodes being on different levels. How can I achieve this?

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:
Working with 3D Noise I am using a simplex 2D noise to generate my worlds so far.  This however was never the plan and has the downside that I basically can only generate a heightmap.  Instead I want to aim for floating islands scattered in the sky, but I fail to see how I can utilize 3D noise properly for this.

Based on a simplex 3D noise function I am currently generating noise like this:

float
sc_perlin_noise3_ex(const sc_perlin_t *perlin, float x, float y,
                    float z, int octaves, float persistence,
                    float base_frequency, float base_amp,
                    float lacunarity)
{
    int i;
    float freq = base_frequency;
    float amp = base_amp;
    float max = 1.0f;
    float total = 1.0f;

    for (i = 0; i < octaves; i++) {
        total += sc_perlin_noise3(perlin, x * freq, y * freq, z * freq) * amp;
        max += amp;
        freq *= lacunarity;
        amp *= persistence;
    }
    return total / max;
}

Problems start there: first of all I think I got octaves wrong, at least the outcome is very unpredictable.  Persistence would be a value smaller 1 that removes the effect of the higher octaves.

Secondly however I have a general problem understanding how 3D noise works.  From my understanding a value < -1 could mean air, a value > 1 would be solid and 0 is the thin line between them (the surface).  First of all however I get a lot more values below zero than above zero, so I had to flip those two around.  That seems odd, do I have the math wrong?

The actual problem however is that I cannot locate "islands" properly.  Say I have a container of 256^3 in size and I want to have one large island in there with maybe up to three smaller islands in there I have to ensure that:

no island is cut off at the edges
that I only get two even sized islands in my block
I have some better control of the actual appearance of my island.  For instance it would be nice if it had an actual flat-ish surface where I can put a heighmap on top of that for mountains etc.

Based on that I have the feeling I am on the completely wrong track here.  Can anyone give me some pointers on where to head now?

Generally speaking I would like to have something that looks like this: floating island

sentences:
How to use an overlapping shader so that it uses layers sort from sprite renderer and its transparent Im using the shader from
question
, but once I put it in the game, and my character gets close to it, it will be hidden by the shadow of the tree, which is transparent.
Any way to make the shader transparent and/or maybe use the sprite renderer sort layer system
I have been trying to use stencil configurable shader with no luck
Thank you for your help
Not sure what combination of these should work:

The character is using a normal sprite renderer.

sentences:
Need help accessing booleans from other script Unity3D I'm making an endless runner game where platforms move towards the player so it makes it seem like the player is running across them. I'm trying to make it so that when the player dies, the platforms stop moving. What I have isn't working, when the player dies, the platforms just keep moving as if nothing has happened. Here is the script I have that is attached to the player:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;

 public class CoinColliderScript : MonoBehaviour
 {
     void OnTriggerEnter(Collider target)
     {
         if (target.tag == "Enemy")
         {
         StartCoroutine(Died());
         }
     }

     IEnumerator Died()
     {
         PlatformMover.dead = true;
         gameObject.GetComponentInParent<Animator>().Play("Male Died");
         yield return new WaitForSeconds(0.5f);
         SceneManager.LoadScene("MainMenu");
     }
 }

Here is the script I have that is attached to the platforms:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlatformMover : MonoBehaviour
{
    private Vector3 newPlatPos;

    public float platMoveSpeed;

    public static bool dead;

    public void Start()
    {
        dead = false;
    }

    void Update()
    {
        if (dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
        } else if (!dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - platMoveSpeed);
        }
        transform.position = newPlatPos;
    }
}

New Code:
Attached to platforms:
public class PlatformMover : MonoBehaviour
{
    private Vector3 newPlatPos;

    public float platMoveSpeed;

    void Update()
    {
        if (!CoinColliderScript.Dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - platMoveSpeed * Time.deltaTime);
        }
        transform.position = newPlatPos;
    }
}

Attach to player:
public class CoinColliderScript : MonoBehaviour
{
    private static bool dead = false;
    public static bool Dead
    {
        get => dead;
        set
        {
            dead = value;
            print("'Dead' changed to " + value);
        }
    }

    void OnTriggerEnter(Collider target)
    {
        if (target.tag == "Enemy")
        {
            StartCoroutine(Died());

        }
    }

    IEnumerator Died()
    {
        dead = true;
        gameObject.GetComponentInParent<Animator>().Play("Male Died");
        yield return new WaitForSeconds(0.5f);
        SceneManager.LoadScene("MainMenu");
    }
}

sentences:
Box2D random crash when adding joints I'm currently working on a project which uses Box2D, when the player uses a certain key it should anchor to the ground. For that I use a weld joint, but when I add the joint the game will sometimes crash, it has a 1/10 change to crash.

The error I recieve:

Showing the controller
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 11
at org.jbox2d.dynamics.Island.add(Island.java:577)
at org.jbox2d.dynamics.World.solve(World.java:1073)
at org.jbox2d.dynamics.World.step(World.java:598)

The code for adding the joints:

WeldJointDef def = new WeldJointDef();
def.initialize(body, anchoredObject.body, body.getWorldCenter());
weldJoint = (WeldJoint) world.createJoint(def);

I still get the error if I synchronize it

sentences:
How to split a group of tiles in a grid into separate groups if a break occurs between tiles? I have a grid where objects can be placed down by the player.  Each object that gets placed down is added to a dictionary where the key is the grid position.

Each object that gets placed down either gets added to a new zone, or added to an existing zone if any of the neighbors are in an existing zone.  If there are multiple zones, then it just picks the first one it finds and adds it.

The issue I am struggling with is how to handle splitting up zones if an object is removed from the grid.

In the first image I have 2 zones.

In the second image, I add a new object to the grid, because that tile contains 2 neighbor tiles that are in a zone, it merges the 2 zones into one.

In the third image, I remove an object from the grid, which removes it from the zone, and in this case it creates 2 new zones (but could be more depending on neighbors).  This is where I am struggling to work out the best way to efficiently do this.

I have a grid array that holds all objects placed on the grid.
A zone contains a list of tiles that are in that zone.
Each tile in a zone also gets a zone id.

What would be a fast efficient way of splitting up a zone into multiple zones?

I thought about checking all the tiles in the zone by checking its neighbors, but thought that it could be quite slow, as a zone can grow to be very big over time (zones can auto merge as well).  Also wouldn't there be a chance of an endless loop?

sentences:
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:
Measure a distance point to point in unity3D? I tried to measure a distance point to point on my phone screen by using following code
Vector3 startPoint;
Vector3 endPoint;
public Camera cam;
float distanceX;

void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        Vector3 startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    }

    if (Input.GetMouseButtonUp(0))
    {
        Vector3 endPoint = cam.ScreenToWorldPoint(Input.mousePosition);

        distanceX = Mathf.Abs(startPoint.x - endPoint.x);
        Debug.Log(distanceX);
    }
}

but this code does not give me the correct result and I don't know why..

sentences:
How do I properly change the value of a prefab'd instance variable? I am currently following a tutorial on how to make a 2D platformer in Unity.

The tutorial explains how to make an enemy wave spawner, but it doesn't explain how to make enemies stronger after I have completed a certain amount of waves.

So, to explain: I have an Enemy class, which has an EnemyStats class in it:

public class Enemy : MonoBehaviour
{
    [System.Serializable]
    public class EnemyStats
    {
        public int damage = 20;
        public int maxHealth = 100;

        public int CurrentHealth
        {
            get { return _currentHealth; }
            set { _currentHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        private int _currentHealth;

        public void Init()
        {
            CurrentHealth = maxHealth;
        }
    }

    public EnemyStats stats = new EnemyStats();

    private StatusIndicator statusIndicator;

    void Awake()
    {
        stats.Init();
        statusIndicator = transform.Find("StatusIndicator").GetComponent<StatusIndicator>();

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.CurrentHealth, stats.maxHealth);
        }
    }
}

And in the WaveSpawner class I have the method to spawn the enemy:

private void SpawnEnemy(Enemy enemy)
{
    Transform sp = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];

    if (CurrentWave % 5 == 0)
    {
        enemy.stats.maxHealth += 20;
    }

    Instantiate(enemy.transform, sp.position, sp.rotation);
}

In the WaveSpawner you can set a certain number of waves (let's say 5), and after you complete all of the waves I've set them to repeat.
So after I beat the 5 waves, I want the 5 waves to repeat and the enemies to be stronger (for example to have their max hp increased by 20).

I do that with the line: enemy.stats.maxHealth += 20;

But the problem here is that after this line is executed and I Instantiate the enemy prefab, the prefab changes its value in the inspector. So let's say that the initial value of the prefab was 120, after I beat the 5 enemy waves, the value of the prefab is set to 140. Then, after I reset the game, the initial value of the prefab is 140 and the max health of the first enemies is 140 and not 120.

I have tried to not change the maxHealth variable of the EnemyStats class, but instead to have another variable tempMaxHealth and do the changes on it. This doesn't resolve my problem, as other problems arise and I don't know what to do anymore.

I hope that you have an answer for me, I would be grateful if that's the case.

sentences:
Split up a screen into regions My task: I want to split up a screen into 3 regions for buffs-bar (with picked items), score-info and a game-map. It doesn't matter are regions intersect with each other or not.

For example: I have a screen with width=1; height=1 and the origin of coordinates (0;0) is the left bottom point. I have 3 functions: draw items, draw info, draw map. If I use it without any matrix transformations, it draws fullscreen, because it's vertex coordinates are from 0;0 to 1;1.
(pseudo-code)

drawItems();
drawInfo();
drawMap();

And after that I see only map onto info onto items.

My goal: I have some matrixes for transformation vertexes with 0;0->1;1 coordinates to strict regions. There is only one thing, what I need to do - set matrix before drawing. So my call of drawItems-function is like:
(pseudo-code)

adjustViewMatrixes_andSomethingElse(items.position_of_the_region_there_it_should_be_drawn, items.sizes_of_region_to_draw);
setItemsMatrix();
drawItems(); //the same function with vertex coordinates 0;0->1;1,
             //but it draws in other coordinates,
             //because I have just set the matrix for region

I know only some people will understand me, so there is a picture with regions which I need to make. Every region has 0;0 -> 1;1 inner coordinates.

sentences:
How do I derive an appropriate acceleration value for my game? I am creating a Flappy Bird clone from this tutorial.

I have a question about acceleration in libgdx. The author assigned the bird a constant acceleration vector in the constructor of the bird

        acceleration = new Vector2(0, 460);

and later updated the velocity vector from the accleration vector with

        velocity.add(acceleration.cpy().scl(delta));

I understand generally why acceleration is constant - like the author mentioned, acceleration due to gravity is 9.81m/s^2, meaning that the speed of an object falling will increase by 9.81m/s every second. It seems the author somehow got from 9.81 real world value to 460 in the actual code. How does one go about deriving this value? Is this a standard derivation or something the author just made up?

sentences:
How to get distance from point to line with distinction between side of line? I'm making a 2d racing game. I'm taking the nice standard approach of having a set of points defining the center of the track and detecting whether the car is off the track by detecting its distance from the nearest point. The nicest way I've found of doing this is using the formula:

d = |Am + Bn + C| / sqrt(A^2 + B^2)

Unfortunately, to have proper collision resolution, I need to know which side of the line the car is hitting, but I can't do that with this formula because it only returns positive numbers.

So my question is: is there a formula that will give me positive or negative numbers based on which side of the line the point is on? Can I just get rid of the absolute value in the formula or do I need to do something else?

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:
Why is the sprite so offset from the physics body? I'm trying to make a sprite object that has physics, but once the game runs the physics body is drawn at an unknown offset from the sprite, which varies based on the size of the sprites texture.

Physics Sprite class:

public class PhysicsSprite extends Sprite {
World world;
public Body body;

public PhysicsSprite(Texture texture, World PhysicsWorld, float x, float y){
    super(texture);
    this.world = PhysicsWorld;
    setPosition(x,y);
    setOrigin(getX(),getY());
    InitializeBody();
}

private void InitializeBody(){
    BodyDef bd = new BodyDef();
    bd.position.set((getX())/GameMain.PPM,(getX())/GameMain.PPM);
    bd.type = BodyDef.BodyType.DynamicBody;

    body = world.createBody(bd);

    PolygonShape shape = new PolygonShape();
    shape.setAsBox(getWidth()/2f/GameMain.PPM,getHeight()/2f/GameMain.PPM);

    FixtureDef fd = new FixtureDef();
    fd.density = 1;
    fd.shape = shape;
    Fixture fixture = body.createFixture(fd);

    System.out.println(body);
}

private void updateSprite(){
    setPosition(body.getPosition().x*GameMain.PPM,body.getPosition().y*GameMain.PPM);
    setRotation((float)Math.toDegrees((double) body.getAngle()));
}

@Override
public void draw(Batch batch){
    updateSprite();
    super.draw(batch);
}
}

physics world/rendering scene class:

public class TestLevel implements Screen {
World world = new World(new Vector2(0f,0f),true);

OrthographicCamera camera = new OrthographicCamera(GameMain.WIDTH/GameMain.PPM, GameMain.HEIGHT/GameMain.PPM);
Box2DDebugRenderer debugR = new Box2DDebugRenderer();
PhysicsSprite s;
GameMain game;
SpriteBatch batch;

public TestLevel(GameMain g){
    game = g;
    batch = g.batch;
    s = new PhysicsSprite(new Texture("badlogic.jpg"),world,300,500);
}
@Override
public void show() {

}

@Override
public void render(float delta) {

    Gdx.gl.glClearColor(.4f,0.4f,.4f,1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.begin();
    s.draw(batch);
    batch.end();

    debugR.render(world,camera.combined);
    world.step(Gdx.graphics.getDeltaTime(),6,2);
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}
}

I've followed this tutorial and he mentions the sprite being offset but nothing occurs to him like whats happening here. I've tried to find someone with a similar issue but failed. Can someone help me out?

sentences:
Connecting a model's joint to the joint of another model I am trying to figure out the math behind orientating and translating a model so that a specified point on the model will connect with a specified point on another model. For example, given the following objects and respective "joints":

Where a joint is defined (relative to the model's untransformed position) as something like:

struct Joint
{
    Vector3 position;
    Vector3 normal;
}

I would like a function that can take a base model and a connecting model that modifies the "world" matrix of the connecting model. Something like:

public void ConnectModels(Matrix baseModelWorld, Joint baseJoint, Matrix connectingModelWorld, Joint connectingJoint)
{
    //Code to re-orient and re-position the connecting model's world matrix
    //Note: The joint position/orientation/normal need to be transformed by
    //      the model's current world matrix

    //1. Transform the baseJoint/connectingJoint by the baseModelWorld/connectingModelWorld
    Vector3 baseJointPos = Vector3.Transform(baseJoint.position, baseModelMatrix);
    Vector3 connJointPos = Vector3.Transform(connectingJoint.position, connectingModelMatrix);

    Vector3 baseJointNorm = Vector3.Transform(baseJoint.normal, baseModelMatrix);
    Vector3 connJointNorm = Vector3.Transform(connectingJoint.normal, connectingModelMatrix);

    //2. Orient the connecting model to match (opposite directions) base joint's normal

    //3. Translate the connecting model such that the connecting joint connects
    //        to the base joint.

    //4. ????

    //5. Profit
}

But, I'm not very good at matrix math and I'm not sure what this actually translates to in code (or if this is correct/the best way).
Also, I'm wondering if there is a better way to define a joint (i.e. just a Matrix, would that be possible?). Any help is appreciated!

sentences:
Moving a Polygon based on Camera position I am in the process of implementing TMX Maps (made in Tiled) for my game. In Tiled, I can create polygons, which leaves a  tag, containing the points.

Loading in these points to a Polygon (java.awt.Polygon) isn't a problem. When all points are loaded into a Polygon (which also had an x and y position, which is the origin of the Polygon), and I draw it, it looks perfect.

However, when I was to move it the troubles started. Every tick, I want to set the position of this Polygon according to the x, y position (the origin), and the Camera position, so that when I draw it, it will draw on position.x - Camera.x and position.y - Camera.y. So every tick, I want to set the (x, y) position of the Polygon equal to position - Camera.position.

I thought that this would be as simple as calling the translate(position.x - Camera.x, position.y - Camera.y) function in the polygon every tick, but the problem here is that this function adds a delta, instead of setting the position. Because of this, the Polygon won't stay still when the Camera is still, because it adds this delta, so the Polygon just moves off the screen.

So, the question is really how to set the position of a polygon every tick, instead of adding a delta to it every tick?

sentences:
Car simulation, motor torque and brake torque combine problem I am creating a custom wheel collider in Unity. Every thing is fine now (suspension, collision, friction) except one problem that i cant get my head over for last 3 weeks. So now i have a car (one wheel only), it stand on top of a hill, then i apply a brake torque enough to make it stand still, after that i apply a motor torque that less than max brake torque, my question is how the car behave?. In my opinion, that if sum of motor torque (roll down hill direction) and gravity torque(friction force * radius) greater than the max brake torque will cause the car to roll down hill, and it remain stand still if motor torque (roll up hill direction). I really need help!

So i have mT(motor torque), bT(max brake torque), fT(max ground torque), rT(residual torque)

if (|mT| > |bT|) {

    |rT| = |mT| - |bT|;

    if (|rT| > |fT|) {
        wheel spin up with sign(mT) * (|rT| - |fT|);
        ground force = sign(mT) * |fT| / radius;
    } else {
        wheel roll without slipping;
        ground force = mT / radius;
    }
} else {

    |rT| = |bT| - |mT|;

    if (|rT| > |fT|) {
         wheel slow down to 0 with -sign(omega) * (|rT| - |fT|);
         ground force = -sign(velocity) * |fT| / radius;
     } else {
         wheel roll without slipping;
         ground force = -sign(velocity) * (|bT| - sign(velocity) * mT) / radius;
     }
}

All torque sign are on top.

sentences:
AudioSource.Play() outputs only noise from the sound clip I'm trying to reproduce a sound clip on the AudioSource of a game object by using the .Play method. What i'm trying to do is a card game of sorts, but with each card being a different section of a song of a genre. I combine different cards with different genres and when i press play, the combination should start playing, but now when the play button is pressed, only noise comes out. The code for the start method looks like this:

public class AudioStart : MonoBehaviour
{
    AudioSource thisAudioSource;

    // Start is called before the first frame update
    void Start()
    {
        thisAudioSource = this.GetComponent<AudioSource>();
    }

    // Update is called once per frame
    void Update()
    {
        if (playButton.playPressed) {
            thisAudioSource.Play();
        }
        else {
            thisAudioSource.Stop();
        }

    }
}

The way i'm doing it is by having a button that on click changes a bool to true or false depending if there is sound playing (the truth check on the if statement). The AudioSource outputs to an AudioMixer on a specific group under the master group (which group depends on the slot that the card is dropped in). The AudioStart script is attached to different game objects with a different audio clip each. I've also noticed that when i try to reproduce two cards, only one AudioSource gets played. Any help would be appreciated. Thanks!

sentences:
Rotate object to face player This is probably a simple vector question, but I'm not sure how to do it.

I have an object at vector position (ox,oy). Potentially every update, the user walks around the screen, and will be at position (px,py) at any given moment. How do I make it so that the object is always facing the player? I need to get the angle in degrees.

This is what I've been messing around with, but the direction doesn't immediately point to where the user is located. Instead, it slowly increments in the direction the user is walking in.

 objVec.Normalize();
 playerVec.Normalize();

 obj.Rotation = MathHelper.ToDegrees((float)Math.Acos(Vector2.Dot(objVec, playerVec)));

I might be going about it completely wrong, so any help is appreciated!

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:
List of 3D libraries based on WebGL Is there a up-to-date list of WebGL libraries or articals with comparison?
Until now I heard only three.js and GLGE.

sentences:
How does this hash function work in this perlin noise implementation? In Perlin's implementation of his noise function, he uses an array to hash the input coordinates and later find the gradient vectors. But in Stefan Gustavson's implementation, a strange "permute" function is used:

vec4 permute(vec4 x)
{
  return mod289(((x*34.0)+1.0)*x);
}

vec4 mod289(vec4 x)
{
  return x - floor(x * (1.0 / 289.0)) * 289.0;
}

Then, it is used like this:

vec4 i = permute(permute(ix) + iy);

vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0 ;
vec4 gy = abs(gx) - 0.5 ;
vec4 tx = floor(gx + 0.5);
gx = gx - tx;

I understand that the "*2.0 - 1.0" is for getting gx to the range -1 to +1, but I do not understand the rest of the hashing.
How does this "permute" function work and why does it divided by 41.0?

Thanks.

sentences:
Recursively calculate possible pathway on a grid depending on max walk distance I have a character that is placed on a grid. It has a variable maximum walking distance. Grid fields can be walkable or not walkable. As the character may has to walk around certain not walkable fields to reach his destination his maximum walking distance isn't allways represented by a circle.

See these examples:

Without obstacles, walking distance 7:

With obstacles, walking distance 7:

Note how the obstacles affect the players maximum walking distance

To calculate this i've written this recursive function:

static Vector2Int[] GetWalkableFields (Vector2Int position, int steps) {
    List<Vector2Int> walkableFields = new List<Vector2Int>();

    if (steps > 0) {
        foreach (Vector2Int v in GetNearbyFileds(position)) {
            if (m_mc.IsInBounds(v) && m_mc.IsWalkable(v.x, v.y)) {
                walkableFields.Add(v);
                walkableFields.AddRange(GetWalkableFields(v, steps - 1));
            }
        }
        return walkableFields.ToArray();
    } else {
        Vector2Int[] v = { position };

        return v;
    }
}

And this function, that returns all four neighbour fields of a field:

public static Vector2Int[] GetNearbyFileds(Vector2Int position) {
    Vector2Int[] neighbors = new Vector2Int[4];
    neighbors[0] = new Vector2Int(position.x, position.y - 1);
    neighbors[1] = new Vector2Int(position.x, position.y + 1);
    neighbors[2] = new Vector2Int(position.x - 1, position.y);
    neighbors[3] = new Vector2Int(position.x + 1, position.y);

    return neighbors;
}

The function is called with the players position and maximum walking distance (steps) and get's the four neighbour fields and unless the steps are zero calls itselve for every neighbour field with the maximum walking distance decremented.

As you can see in the screenshots, this works absolutely fine. The problem is, as the calculation not only goes away from the player but, in some recursion paths, goes back and fourht between tiles until stepcount zero is reached without even having traveled one field, that this way of calculating the path is really resource heavy. For a walking distance of 7 there are 27646 possible walkways that all are getting calculated. If a player is able to walk 11 fields the calculation takes a few seconds, if he can walk 12 fields Unity crashes while calculating.

Is there a way to calculate this more efficient?

Thank you in advance.

sentences:
How can I create a copy of an object in Unity? I'm new to unity.

How can I make some copies of my GameObject in Unity by scripting?

I have tried this by the way:

public GameObject stone_3;

void Start ()
{
  for (int i = 0; i < 10; i++)
    Instantiate(stone_3, new Vector3(i * 2.0f, 0, 0), Quaternion.identity);
}

I can't really understand why it's not working.

sentences: Tab between input fields I am new to working with Unity3d, I need to navigate between several inputField, for this I have looked at the solution that is in: tab-between-input-fields, but always the FindSelectableOnUp() or FindSelectableOnDown() returns null, so my next is always null and always ends in: next = Selectable.allSelectables[0];

sentences:
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 motion blur effect? I wanted to know how one would implement this motion blur or fade effect behind the soccer ball  .

Here is what I was thinking . You have the balls current position and you also keep its previous position(couple of sec back). and you draw a "streak" sprite between the 2 points.

I have seen this effect lots of time implemented for projectiles in various 2d games and wanted to know if there is a standard technique.

sentences: How to modify normal vectors with a tranformation matrix Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle normal vectors? If my thoughts are correct I would just need the rotation part of the matrix and apply it to the normal vectors, but how can I do that? Or is it better not to use a matrix for that, but instead allow only direct transformations, one at a time, so I can handle them differently for different vertex attributes?

sentences:
Modelling photo-realistic grass in realtime I see a number of tutorials on how to create good looking grasses when creating 3D renders but can't think how to model it for realtime/use in a game's scenery.

Sure simple models with alpha cutouts can be used to create plants and trees in really awesome scenery but what about a lawn?

Are there any good tricks to achieve this effect?
I tried with a simple 4 sided box and a small texture and the number of objects needed for a decent appearance made Max crawl to a halt.

(I am thinking it may be possible with a shader but that is a whole other area so thought I would just ask about anyones experience with modelling it here)

Thanks!

sentences:
In pixel art, should i keep the same color palette for every sprites? The question may sounds weird (and very noobish but i'am :p) but i can't find any answer. When making pixel art, it is often said that a color palette could be 2, 4, 8, 16 or even 256 colors, through it is not recommended. When it comes to the palette choice, is it for a single sprite (like a character, and another palette for the landscape for example) or for an entire game (and in this case i must stick to the same palette for every sprites) ?

Honnestly i think it is for an entire game, but my mind is stuck with the second question implied by this answer: how could i do everything (characters, trees, rocks, explosions, sky...) with only - let's say - 8 colors ? All my sprites looks flat because of this, i can't find a suitable color to make a nice shading.

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:
"Fading" effect between different screens? I'm not sure what the correct word for it is, but I'm thinking like the fading effects when you move between different screens in Powerpoint or Keynote; that the screen fades black before the new screen is shown instead of instantly change.

The "screens" I'm talking about are actually two pictures, and since it's for an adventure type game I thought it'd be cool if it could be done.

Does anyone know a good way to implement this?

sentences:
Keeping high scores on Unity web player I want the player to be able to save his score when she makes it into top 10 of high scores. Upon success, player will be asked for a name to submit. This does not need to be unique per player. I just want a basic global score board available for everyone who plays the game via web player (from github.io page of the project).
When searched for how to keep high scores, I came across PlayerPrefs.

On Web players, PlayerPrefs are stored in binary files in the following locations:

Mac OS X: ~/Library/Preferences/Unity/WebPlayerPrefs
Windows: %APPDATA%\Unity\WebPlayerPrefs

As far as I understood, the results are kept in local machine and won't be same for everyone.
So it's good for keeping track of your own score, locally.
As a placeholder in the current version of the game, I keep the scores in a local .txt file in the project directory. Can I succeed with this approach and use the github.io server to maintain a global scoreboard or do I necessarily need a database to achieve this goal?

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 can I store and load large 3D environments (terrains or cities)? I am interested in how a large area 3D environment in games like Grand Theft Auto V or Far Cry can be stored (on disk, in what file format) and how that data can be retrieved when it is used in a game. By "the environment" I mean only static objects like terrain with vegetation, city areas with buildings, et cetera. I'm not referring to temporary or moving objects like people or cars. I am not interested in scene rendering.

I guess it may be convenient to shard (horizontally partition) the data by location creating something like "tiles" because it is usually accessed by location and such tiling will help to keep data that is related together (and reads will be faster). Also I guess the data for sure is stored in some (compressed?) 3D format with the respect to tiling. There probably have to be mechanisms that will split one object to two (or more) parts if it does not fit into a single tile.

I have found a somewhat related question (How a 3D game map is stored and handled) but it only briefly answers small part of my question.

sentences:
QuadTree Subdivision Issue I have been working on a level-of-detail program. Right now I have the rough structure down (splitting of quads without condensing of quads). But the problem is that when you try to split certain quads after they are 1/8 the size of the original they sometimes do not split and the quads that should have been placed in that spot are in another place. I think I just need someone else to look at this code, I believe the problem rests in the index of the quads...
Here is the main code:

public Quad(Vector3f v1, Vector3f v2, Vector3f v3, Vector3f v4,float size,int x, int y,boolean has,float pI, float pI2){
    first = v1;
    second = v2;
    third = v3;
    fourth = v4;
    width = size;
    index1 = x;
    index2 = y;
    children = has;
    parentIn1 = pI;
    parentIn2 = pI2;

}
public static ArrayList<Vector3f> makeVerts(Vector3f p, int x, int y, float increment){
    ArrayList<Vector3f> list = new ArrayList<Vector3f>();
    Vector3f back_left = new Vector3f ((float)x*increment, 0 , (float)y*increment).add(p);
    Vector3f front_right = new Vector3f ((float)(x*increment) + increment, 0, (float)(y*increment)+increment).add(p);
    Vector3f front_left = new Vector3f ((float)x*increment, 0 , (float)(y*increment)+increment).add(p);
    Vector3f back_right = new Vector3f((float)(x*increment) + increment, 0, (float)y*increment).add(p);

    list.add(back_left);
    list.add(front_left);
    list.add(front_right);
    list.add(back_right);
    return list;
}

public static void create(Quad quad, int i, int ii){
    quad.children = true;
    i+=quad.parentIn1;
    ii+=quad.parentIn2;
    System.out.println(i+ " "+ii);
    Vector3f parent = new Vector3f(i*quad.width, 0, ii*quad.width);
    //System.out.println(parent + " "+ toString(quad));
    if(quads == null){
        quads = new Quad[2][2];
        for(int x = 0; x<2; x++){
            for(int y = 0; y<2; y++){
                float growth = quad.width/2;
                ArrayList<Vector3f> points = makeVerts(parent,x,y,growth);
                Vector3f p1 = points.get(0);
                Vector3f p2 = points.get(1);
                Vector3f p3 = points.get(2);
                Vector3f p4 = points.get(3);
                quads[x][y] = new Quad(p1,p2,p3,p4,growth, (int) (x+quad.index1),(int)(y+quad.index2),false,quad.index1,quad.index2);
                list.add(quads[x][y]);
        }

    }
}

    }

In addition here is the code that creates the first quad and divides it into four:

Vector3f v1 = new Vector3f(0,0,0);
Vector3f v2 = new Vector3f(0,0,32);
Vector3f v3 = new Vector3f(32,0,32);
Vector3f v4 = new Vector3f(32,0,0);
Quad q = new Quad(v1,v2,v3,v4,32,0,0,false,0,0);
Quad.create(q,0,0);
v.addAll(Quad.getPoints());
Quad.reset();

And the code that divides quads depending on one's distance:

   for(int i = 0; i<Quad.list.size(); i++){
        Quad q = Quad.list.get(i);
        Vector3f center = Quad.getCenter(q);
        float width = q.width;
        float distance = center.distance(cam.getLocation());
    if(width/distance >= .85 && !q.children){
        Quad.reset();
        Quad.create(q,q.index1,q.index2);
        VertexBuffer vb = mesh.getBuffer(Type.Position);
        v.clear();
        v.addAll(Quad.getPoints());
        verts = new Vector3f[v.size()];
        v.toArray(verts);
        vb.updateData(BufferUtils.createFloatBuffer(verts));

parentIn1&2 are the indices of the parent quad. Index1&2 are the indices of the quad. Each time a quad needs to divided the "create" method is run...
Just for an idea of what is happening here is a shot of the actual scene. On this run I zoomed in exactly on the center of the quad and this was the result..

Thanks for any and all help, it is much appreciated.

sentences:
Texture coordinate discontinuity with mipmaps creates seams I just started learning openGL and I am getting this artifact when texturing a sphere with mipmaps. Basically when the fragment samples the edge of my texture, it detects the discontinuity (say from 1 to 0) and picks the smallest mipmap, which creates this ugly seam:

ugly seam http://cdn.imghack.se/images/6bbe0ad0173cac003cd5dddc94bd43c7.png

So I tried to manually override the gradients using textureGrad:

//fragVert is the original vertex from the vertex shader
vec2 ll = vec2((atan(fragVert.y, fragVert.x) / 3.1415926 + 1.0) * 0.5, (asin(fragVert.z) / 3.1415926 + 0.5));
vec2 ll2 = ll;
if (ll.x < 0.01 || ll.x > 0.99)
    ll2.x = .5;
vec4 surfaceColor = textureGrad(material.tex, ll, dFdx(ll2), dFdy(ll2));

Now I get two seams instead of one. How can I get rid of them? And why does the code above generate 2 seams?

2 eams http://cdn.imghack.se/images/44a38ef13cc2cdd801967c9223fdd2d3.png

You can't tell from the two images but the 2 seams are on either side of the original seam.

sentences:
XNA 4.0: Trouble Aligning an Animating Sprite (Texture Origin) I'll try to explain this as best as I can.

I'm trying to build a game where there exists a "Surfer" who is surfing down a rail.
I have a sprite sheet for the surfer however I have been running into animating the surfer for the following reasons:

The source rectangles for each animation are sometimes different
The feet of the surfer are at different locations within each texture animation.

What do I mean by #2?
For instance, I have an animation for the surfer to jump rails.
My spritesheet is built so that my surfer's feet might be positioned on the left side of the texture at the start of the animation and after the jump (iterating through the textures) his feet are now at the right hand side of the texture.

This is causing me problems because in order to align the feet to the rail for each animation I tried to offset the origin of the texture so that it points at his feet.

(The origin is given in the SpriteBatch.Draw call)

However this isn't working :(

Any recommendations on how to properly set this up?

PS: I Hope I explained it well, if not I can edit it and retry.

sentences:
Swept AABB vs Line Segment in 2D I've been trying to get a swept collision detection up and running now for almost a week and I can't for the life of me get it working.

There is a answer on this linked here below:
Swept AABB vs Line Segment 2D
I've translated this into Go which will be running the game server and needs this logic:
func SweepRectLine(rectX, rectY, rectW, rectH, rectHSpeed, rectVSpeed, lineX1, lineY1, lineX2, lineY2 float64) (bool, float64) {
    outVel := [2]float64{}
    // hitNormal := [2]float64{}
    lineNX, lineNY := lineX2-lineX1, lineY2-lineY1
    // lineMinX, lineMaxX, lineMinY, lineMaxY := math.Min(lineX1, lineX2), math.Max(lineX1, lineX2), math.Min(lineY1, lineY2), math.Max(lineY1, lineY2)
    var lineMinX, lineMaxX, lineMinY, lineMaxY float64
    if lineNX > 0 {
        lineMinX, lineMaxX = lineX1, lineX2
    } else {
        lineMinX, lineMaxX = lineX2, lineX1
    }
    if lineNY > 0 {
        lineMinY, lineMaxY = lineY1, lineY2
    } else {
        lineMinY, lineMaxY = lineY2, lineY1
    }
    r := (rectW/2)*math.Abs(lineNX) + (rectH/2)*math.Abs(lineNY) //radius to Line
    boxProj := (lineX1-rectX)*lineNX + (lineY1-rectY)*lineNY
    velProj := rectHSpeed*lineNX + rectVSpeed*lineNY

    if velProj < 0 {
        r *= -1
    }

    hitTime := math.Max((boxProj-r)/velProj, 0)
    outTime := math.Min((boxProj+r)/velProj, 1)
    // log.Println("start", hitTime, outTime)

    rectXMax, rectXMin := rectX+rectW/2, rectX-rectW/2
    if rectHSpeed < 0 { // left
        if rectXMax < lineMinX {
            return false, 0
        }
        hitTime = math.Max((lineMaxX-rectXMin)/rectHSpeed, hitTime)
        outTime = math.Min((lineMinX-rectXMax)/rectHSpeed, outTime)
    } else if rectHSpeed > 0 { // right
        if rectXMin > lineMaxX {
            return false, 0
        }
        hitTime = math.Max((lineMinX-rectXMax)/rectHSpeed, hitTime)
        outTime = math.Min((lineMaxX-rectXMin)/rectHSpeed, outTime)
        // log.Println("right", hitTime, outTime)
    } else {
        if lineMinX > rectXMax || lineMaxX < rectXMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    rectYMax, rectYMin := rectY+rectH/2, rectY-rectH/2
    if rectVSpeed < 0 { // up
        if rectYMax < lineMinY {
            return false, 0
        }
        hitTime = math.Max((lineMaxY-rectYMin)/rectVSpeed, hitTime)
        outTime = math.Min((lineMinY-rectYMax)/rectVSpeed, outTime)
    } else if rectVSpeed > 0 { // down
        if rectYMin > lineMaxY {
            return false, 0
        }
        hitTime = math.Max((lineMinY-rectYMax)/rectVSpeed, hitTime)
        outTime = math.Min((lineMaxY-rectYMin)/rectVSpeed, outTime)
    } else {
        if lineMinY > rectYMax || lineMaxY < rectYMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    outVel[0] = rectHSpeed * hitTime
    outVel[1] = rectVSpeed * hitTime
    return true, hitTime
}

I also put up a Gist with a executable UI here: https://gist.github.com/KidLinus/3f847c46b0e6dc1addac7252d9cb54ab
I can't for the life of me figure out what all class variables stand for. I think that some of them are native to Unity but that's just a guess. I've come so far as to figure out that the extent is half of the width/height in said direction. What the "line.n" stands for is anyones guess, I assume its the direction and have no idea if it's normalized or not.
There are also a couple of dead variables just laying there.

sentences:
How can I create lit-up areas during night-time in a top-down 2D game? I am trying to implement a super simple day/night cycle. It works fine, at 9pm it gets dark, and at 6am it gets bright.

However, I am "creating" darkness by simply setting the alpha of a black Image that covers the entire screen, ie:

if(NightTime){
    Color tempColor = dayNightImg.color;
    tempColor.a = 0.5f;
    dayNightImg.color = tempColor;
    isDark = true;
}

So, in order to create the Illusion of light, I would have to be able to ignore part of this Dark Image, i.e "Light it up", for example in a circle around my character. Is there some way I can do this? Or Is my approach too simple for this effect?

Here is an example of what I want:

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:
Why does my terrain texture fail to load? (OpenGL) I'm currently using a vertex shader and a fragment shader for loading my texture onto the terrain I made.

Here is my vertex shader

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

float scale = 0.5;

out vec2 TexX;
out vec2 TexY;
out vec2 TexZ;
out vec3 blend_weights;

void main()
{
    vec3 blend_weights = abs(aNormal.xyz);
    blend_weights = (blend_weights - 0.2) * 0.7;
    blend_weights = max(blend_weights, 0);
    blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z);

    TexX = aPos.yz * scale;
    TexY = aPos.zx * scale;
    TexZ = aPos.xy * scale;

    gl_Position = projection * view * model * vec4(aPos, 1.0);
}

And here is my fragment shader.

#version 330 core
out vec4 FragColor;

uniform sampler2D terrainTexture;

in vec2 TexX;
in vec2 TexY;
in vec2 TexZ;

in vec3 blend_weights;

void main()
{
    FragColor = texture(terrainTexture, TexX)*blend_weights.x + texture(terrainTexture, TexY)*blend_weights.y + texture(terrainTexture, TexZ)*blend_weights.z;
}

I was trying to implement 3D texture planar projections, based on section 1.5 of this link
https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch01.html

If I just try to implement the texture in a very simple way, it works (which looks terribly stretched on the mountanous terrains, of course). But if I implement it this way, the texture does not load. What could be the possible reason?

Just in case anyone is wondering, the following is my VAO, VBO, EBO configuration

// VAO, VBO configuration
    unsigned int VAO, VBO, EBO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);

    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, positions.size()*sizeof(glm::vec3) + normals.size() * sizeof(glm::vec3) , NULL, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, positions.size() * sizeof(glm::vec3), &positions[0]);
    glBufferSubData(GL_ARRAY_BUFFER, positions.size() * sizeof(glm::vec3), normals.size() * sizeof(glm::vec3), &normals[0]);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(int), &indices[0], GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)(positions.size() * sizeof(glm::vec3)));

This is my draw function

// Inside the render loop
void drawScene(Shader &shader, unsigned int VAO, unsigned int numIndices, unsigned int texture1)    //draw the scene with the parameter data.
{
    glm::mat4 model;
    model = glm::translate(model, glm::vec3(-(int)(gridXNum)/2, 0.0f, -(int)(gridZNum)/2));
    glm::mat4 view = camera.GetViewMatrix();
    glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);

    shader.use();
    shader.setMat4("model", model);
    shader.setMat4("view", view);
    shader.setMat4("projection", projection);
    shader.setFloat("TERRAIN_WIDTH",gridXNum);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture1);

    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLE_STRIP, numIndices, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);
}

However, I really don't think this is the problem because as I said, if I change the shader codes into a really basic one, the texture successfully loads. There is definitely something wrong with my shader program. Any help would be appreciated. Thanks in advance!

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:
Get points on a line between two points I'm making a simple space game in JavaScript, but now I've hit a wall regarding vectors.

The game view is top-down on a 2d grid.  When the user clicks on the grid, the space ship will fly to that spot.

So, if I have two sets of points:

{ x : 100.2, y : 100.6 }; // the ship
{ x : 20.5,  y : 55.95 }; // the clicked coordinates

If the game loop ticks at 60 iterations per second, and the desired ship velocity is 0.05 points per tick (3 points per second), how do I calculate the new set of coordinates for the ship for each tick of the game loop?

p.s. I do not want to account for inertia, or multiple vectors affecting the ship, I just want the ship to stop whatever it is doing (i.e. flying one way) and move to the clicked coordinates at a static speed.

sentences:
Constructing a building in the "Past" scene, and finding a different version of it in the "Future" scene I am trying to create a game where one scene would be the "Past" and one scene would be the "Future". The player can travel through a portal to move between the past and future scenes.
In the past scene, the player makes a wooden house and in the future scene it will be turned into something else.
There can be multiple instances of these buildings in different places in the scene.
So far, I've tried...

Using DontDestroyOnLoad to carry the object through from the past to future when loading between scenes.

Using singletons to avoid duplicating the object multiple times when loading back and forth.
But that has a problem: using singletons causes restricts me to just one instance of the building per scene, and I want to have several.

The reason why I wouldn't want to unload the old object when the scene unloads is because I wanted the player to be able to build in any area available within the scene. Something like the Fallout 4 building mechanics, where you can build in certain areas and keep those buildings, but I want it to become a different prefab in the future scene.
How can I implement a feature like this?

sentences:
Animal Crossing-like Map Data Structure I've been looking closely at how Animal Crossing (for GameCube) creates town maps, and as far as I can tell, it's something like this:

The town is made up of a 5x6 grid of acres. Each acre is 16x16 "tiles" in size.

That's the easier part. As for the actual map generation, it seems to use what I'll call "acre templates." That is, the acres seem to be selected somewhat randomly from a predefined list, with predefined layouts. So there are, for example 2 different layouts of what an acre containing the Museum will look like.

Or if an acre has a river running through it, top-to-bottom, there might be 3-4 different templates of how the river flows through that acre, with optional ponds nearby, etc.

The question is... What is a good suggestion or method for how to organize the data structure to handle all of this?

Another thing to keep in mind is that there's a "second layer" of objects on top of the basic terrain info, such as trees or rocks or inventory objects dropped/buried on/in the ground. How would I store that information in relation to the acre templates?

sentences:
How to add a feel of depth? I have several mountain models drawing in the background.
See actual screenshot here:

At the very back, you see those grey mountains. Although they are so much in background, it still doesn't seem "in the background".

How can I add a feel of depth to those mountains? I would like see them as far far away.

This is how it looks now, thanks to DarenW

sentences:
Why does my collision detection code cause my framerate to drop? I have this code:

foreach (CollisionTiles tile in map.CollisionTiles)
{
  player.CollisionBox(tile);
  foreach (Enemy enemy in enemys)
    enemy.CollisionBox(tile);
}

This is the CollisionBox() function:

public void CollisionBox(CollisionTiles tile)
{
  int x = rectangle.X / Map.Size;
  int y = rectangle.Y / Map.Size;
  int tileX = (int)tile.Position.X;
  int tileY = (int)tile.Position.Y;

  if (tileX >= x - 1 && tileX <= x + 2 && tileY >= y - 1 && tileY <= y + 3)
  {
    Collision(tile.Rectangle, Map.Width, Map.Height);
    tile.Collide = true;
  }
}

These two lines appear to be the problem:

 int x = rectangle.X / Map.Size;
 int y = rectangle.Y / Map.Size;

I guess because it loops through them on every tile...

The Collision() function just check the face's of the two triangles (both player/enemy and the tiles) with these functions:

 public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
 {
   return (r1.Bottom >= r2.Top && r1.Bottom <= r2.Top + (r2.Height / 2));
 }

public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
{
  return (r1.Top >= r2.Bottom - (r2.Height / 2));
}

  public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
  {
  return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
          r1.Bottom >= r2.Top + (r2.Height / 2) &&
          r1.Right >= r2.Left &&
          r1.Right <= r2.Left + (r2.Width / 4));
  }

  public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
  {
    return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
            r1.Bottom >= r2.Top + (r2.Height / 2) &&
            r1.Left >= r2.Right - (r2.Width / 4) &&
            r1.Left <= r2.Right);
  }

When there is more then one monster with the player I get a massive FPSdrop, and it's getting worse when more monsters get added. What should I do to fix that problem?

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:
How do I get the areas enclosed by an arbitrary 2D shape? In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap.

For example:

I want to detect the presence of any game object in the green areas above.

I know how to detect whether a point is within a given polygon, but how do I tell where the polygons (green areas) are from just the points in the line?

sentences: Godot 3.2 atlasTexture not creating any texture atlas When I try to use the new feature of godot that lets you import sprites as an atlasTexture, I dont' get any results.

sentences:
Guidelines for determining what should be a component? Background:

So I'm developing my first 2d C++ fighting game (for learning purposes) and I have a setup where I have 'components' which are really just data holders with maybe some simple utility functions such as GetComp(), AddToComp(), etc. All components get passed to component systems which are just functions which act on certain components (e.g. MovementSystem(PositionComp pos, VelocityComp vel), etc.) which are split up into their respective domains (Graphics, Animation, Physics, etc.). All components are held by 'Fighter' class which acts as the component holder that keeps everything together.

Issue:

The problem I'm having is I'm not sure how I decide what exactly should be made into a component vs what shouldn't. For example, for my animations I have a system which essentially takes a 'spriteComponent' and a 'animationClip' obj like so SetAnimation(spriteComponent sprite, animationClip anim). As it stands, my animationClip class is not considered a component and is not currently attached within my Fighter class, though I guess I could implement it that way. How do I decide what classes/types should be made into components? How is this typically handled in other ECS like systems?

sentences:
Restricting my horizontal slash attack I've been working on making this slash attack for my character in the unity engine. The whole point to this script is to put the damage range in sync with the slashing animation. The slash is completely horizontal and is scripted out make enemies bounce back. I have most of that but what I really need to restrict it on x axis. If I haven't explained it enough let me give you an example of what its doing. When an enemies in front of me but above the area my swing attack shouldn't be able to reach. I use my swing attack and it still does damage anyways. what I need is a way is restrict my hit detection range between two angles rolling around the x axis. I'm sorry if I didn't explain this so well just tell me if I need to make something more clear.

this is the code I've come up with what I've got it doings is it applies damage it can tell if an enemy is in front of it (uses the dot product for that) it can even knock said enemy backwards

void Knockback(){

     Vector3 grenadeOrigin = transform.position; // I'm building this controller using explode for knock back
// and this stuff was based off of a grenade script
     Collider[] colliders = Physics.OverlapSphere (grenadeOrigin, radius);
     foreach (Collider hit in colliders){
         Rigidbody rb = hit.GetComponent<Rigidbody>();
         if (rb){
             Vector3 dir = (rb.transform.position - transform.position).normalized;
             float direction = Vector3.Dot(dir, transform.forward);
             Debug.Log(direction);
             if (direction >0.1){// this is where i tell if something is in front of me
                 rb.AddExplosionForce(power, grenadeOrigin, radius, 0);
                 //This is where we apply force to our enemy and various other rigid bodies
                 hit.gameObject.SendMessage("Damager", Damage, SendMessageOptions.DontRequireReceiver);
                 //This is where we apply damage to the enemy
             }
         }
     }
 }

sentences:
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:
Particle system prefab not instantiated I am trying to instantiate my fire particle system during runtime like this:

GameObject fire, firePrefab;

void Start()
{
    ...
    firePrefab = Resources.Load("FirePrefab") as GameObject;
}

void FixedUpdate()
{
   if (Input.GetKeyDown(KeyCode.V))
   {
       fire = Instantiate(firePrefab, transform.GetChild(3).position, transform.GetChild(3).rotation);
       Destroy(fire, 5.0f);
   }
}

My FirePrefab is just a regular particle system, and the model the above script is attached to looks like this:

  Model

    Default

    Camera

    DroneFire

However, my fire prefab isn't instantiated anywhere when I run the game.

sentences:
Html5 games, what is the standard dimension to use? I am trying to make html5 games to be played on the browser(not offline apps), and I am trying to support the maximum number of platforms, hence I need to know what dimension should I use for the game canvas so that it works in the most number of places.

Also is there anyway to "scale" a large game to fit in the tiny size of iphone(around 320x356px I think). By "scale" I don't mean to actually resize just the canvas, as because that can mess up the coordinate based calculations, and for a large number of objects, re-positioning based on canvas size can be a real hassle.

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:
How do I get a Rigged 3D Model made in blender to display and animate on the iPhone? I have a rigged model in blender of a man walking, I would like to know how to get this to display and animate on the iPhone and if their is a good free game library out their that lets me do it (even if it means saving as another format).

I've tried Cocos3D with no luck as the convertor from collada to Pod is crap (for lack of a better word)

sentences:
Calculating a smooth velocity of interaction touches I have a touch game and it would be beneficial to be able to know the "velocity" of each touch on the screen.  Let me explain.

Right now I am already subtracting current touch position from previous ones to get a dt, however this is not working well. Sometimes the dt will show up as 0 even though the finger is moving.

What would be a good way to measure a smooth velocity of each touch considering that it can release, or touch back down at any moment?

I already have  method to track the position of each finger, I just need a way to get a smooth velocity.

sentences:
How does this point2LineDist() method works? I was browsing Wolf3D JS port and bump into that method :

/**
 * @description calculates distance between a point (x, y) and a line.
 * @memberOf Wolf.Math
 * @param {number} x X coord of point
 * @param {number} y Y coord of point
 * @param {number} a Line angle in degrees
 * @returns {number} Distance
 */
function point2LineDist(x, y, a) {
    return Math.abs( (x * SinTable[a] - y * CosTable[a]) >> 0);
}

I think I understand what it does. It gives shortest distance (green on picture) between a line (from angle) and a (x, y) point.

What is not clear to me is how it works.
I know a little bit of trigonometry, but I am not able to figure out which trigonometry identity or formula it use. The binary shift is (I think) a quick way to convert a float to an int.

sentences:
Game Background graphics blurred edges? Why when using this code for the background for my game do I receive blocks with blurred edges?

public final class State_Play extends State_Template {
    private BufferedImage background;
    private int[] pixelelements;
    private int width,height;

    State_Play(){
        init();
    }

    public void init(){
        width=8; //Configuration.appwidth,
        height=6; //Configuration.appheight
        background=new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        pixelelements=((DataBufferInt) background.getRaster().getDataBuffer()).getData();
        maketuringarray();
    }

    public void maketuringarray(){
       int singlecolor=new Random().nextInt();
       pixelelements[new Random().nextInt(width*height)]=singlecolor | 0xFF000000;
    }

    @Override
    public void update() {
       maketuringarray();
    }

    @Override
    public void render(Graphics g) {
        g.drawImage(background, 0, 0, Configuration.appwidth, Configuration.appheight, null);
    }

Like this

sentences:
How do I avoid obstacles on a predefined path? I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle.

However, I want the soldier to avoid (dynamic) obstacles, without deviating from the path too much.

How can this be done?

sentences:
How to make player stay on a moving object I've made an obstacle course with various moving parts to test out movement of a player. In the obstacle course there is a section where there are multiple cubes moves from side to side, and you have to jump from one to the other. But regardless of their speed, I can't seem to get the player to stay on top of any of the moving cubes. I have no clue how to fix this my only guess would be to use materials, but I can't apply any to the character controller. I appreciate any suggestion that you can give. Also the movement is done as an animation that I created in unity in the animation window.

Thanks, Nova

sentences:
How to animate a bezier curve over a given duration I have created a bezier curve by adding the following script to an empty game object in the inspector. This draws to complete curve at once when I run the code. How can I animate it over a given period of time, say 2 or 3 seconds?

public class BCurve : MonoBehaviour {

LineRenderer lineRenderer;
public Vector3 point0, point1, point2;
int numPoints = 50;
Vector3[] positions = new Vector3[50];

// Use this for initialization
void Start () {
    lineRenderer = gameObject.AddComponent<LineRenderer>();
    lineRenderer.material = new Material (Shader.Find ("Sprites/Default"));
    lineRenderer.startColor = lineRenderer.endColor = Color.white;
    lineRenderer.startWidth = lineRenderer.endWidth = 0.1f;
    lineRenderer.positionCount = numPoints;

    DrawQuadraticCurve ();

}

void DrawQuadraticCurve ()  {
    for (int i = 1; i < numPoints + 1; i++) {
        float t = i / (float)numPoints;
        positions [i - 1] = CalculateLinearBeziearPoint (t, point0, point1, point2);

     }
    lineRenderer.SetPositions(positions);
}

 Vector3 CalculateLinearBeziearPoint (float t, Vector3 p0, Vector3 p1,    Vector3 p2)   {

    float u = 1 - t;
    float tt = t * t;
    float uu = u * u;
    Vector3 p = uu * p0 + 2 * u * t * p1 + tt * p2;

    return p;
}

sentences:
Converting Euler rotation angles from Z up to Y up (Max to OpenGL) I'm working on pulling geometry and it's transformation from a 3DS Max exported FBX (Z-up) to an OpenGL model format (Y-up). The main problem is I intend to keep the transformations as Translation and XYZ rotations.

Right now I pull all position transforms simply going from (x y z) to (x z -y) and everything looks good. However the geometry rotation comes in as Euler angle rotations ( X Y Z ). Rotating these has turned into a nightmare. I know I can get a matrix and just multiply it by the RotX-90 mat but pulling those Eulers back is not reliable.

What seems to almost work is this, and it's what seemed to give correct results most of the time. It jut seems bad for the case ( 92.83, -89.41, 53.53) for example when it looks like it's loosing a 90 deg rotation on X.

Matrix rot90 ( 1,  0, 0, 0,
               0,  0, 1, 0,
               0, -1, 0, 0,
               0,  0, 0, 1);

RotMat = RotX * RotY * RotZ
RotMat = Rot90X * RotMat
Quaternion = Convert from RotMat
NewX = Quaternion.Pitch
NewY = Quaternion.Yaw
NewZ = Quaternion.Roll

I know the god of bit shifting must have some civil way of doing this. Any tips/suggestions would be greatly appreciated.

ps. exporting the FBX with Y up won't work as it just seems to apply a transformation on the root node, not to actually swap vertices y-z positions.

sentences:
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:
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:
Time per turn in a .NET turn-based game? I am developing the server for a browser game, it uses an ASP.NET API for authentication, login and character creation and a websocket for the rest of the game (Microsoft.Web.WebSockets).

While on combat mode, each character will have a fixed amount of time to carry out their actions.

is there a way to keep track of the time on the server or should I create a different server to serve as time master ?

Which method/library should I use to control the time ?

sentences:
What is the proper strategy to manage vertex buffers? I have created a large variety of shaders for my game engine for different use cases. The vertex input for the shaders depend on what I want to do with them. For example, if I want to just render the wireframe of a mesh, I do not need texture coordinates, normals, etc. because I just need basic vertex information. However, when I render animated meshes (I use Skinned Animation), then I need additional information like joint link weights for each vertex.
My question is: What is the best way to manage Vertex Buffers? Do I create a Vertex Buffers for each use case when I create the model and store them for later use, i.e. I select at run-time which of the stored Vertex Buffers to use for rendering? Do I create the Vertex Buffer I need at run-time in each render cycle? What is the best way to do it?
I am using DirectX 11 and C# (using SharpDX as wrapper).

sentences:
How to use a Rigidbody on a game object after animation in Unity? How to use a Rigidbody on a game object after animation in Unity?
I want to play an animation fully controlling the positioning of the elements, i.e. ignoring physics. And after an animation plays till the end I want physics to resume affecting the element.
Right now to get the expected behavior I have to remove the Animator after an animation. I thought that maybe there is a neater way to do what I want, but I did not find it, so decided to ask here.

UPDATE
I just found a better way to achieve what I want. Instead of removing the Animator component I just disable it:
animator.enabled = false;

It feels better. But still I am hoping for a neater solution.

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:
XNA 3D custom shader/effect gives shakey rendering in the distance I am rendering a simple flat plane + texture to use as the floor for a game. I'm rendering it using  a custom effect I've written.

The problem I have is that the ground in the distance gets a bit distorted and shakey when the camera moves forwards and backwards.

If I render the same model + texture using the BasicEffect instead of a custom shader it appears smooth and works correctly.

Here's the XNA code setting up the custom effect:

Matrix worldMatrix = Matrix.CreateScale(0.2f);
_floorEffect.CurrentTechnique = _floorEffect.Techniques["Textured"];
_floorEffect.Parameters["World"].SetValue(worldMatrix);
_floorEffect.Parameters["ViewProjection"].SetValue(camera.view * camera.projection);

_floorEffect.Parameters["diffuseTexture"].SetValue(_diffuseTexture);

foreach (EffectPass pass in _floorEffect.CurrentTechnique.Passes)
{
     pass.Apply();
     device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount);
}

Here's the shader code:

float4x4 World;
float4x4 ViewProjection;
Texture diffuseTexture;

sampler TextureSampler = sampler_state { texture = <diffuseTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = wrap; AddressV = wrap;};

struct TexturedVertexToPixel
{
    float4 position : POSITION0;
    float2 textureCoords : TEXCOORD0;
};

TexturedVertexToPixel TextureVertextShader(float4 inPos : POSITION, float2 inTextureCoords : TEXCOORD0)
{
    TexturedVertexToPixel output;
    float4x4 preWorldViewProjection = mul (World, ViewProjection);
    output.position = mul(inPos, preWorldViewProjection);
    output.textureCoords = inTextureCoords;

    return output;
}

float4 TexturePixelShader(TexturedVertexToPixel input) : COLOR0
{
    return tex2D(TextureSampler, input.textureCoords);
}

technique Textured
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 TextureVertextShader();
        PixelShader = compile ps_2_0 TexturePixelShader();
    }
}

Videos to demonstrate what I mean:

Using the BasicEffect http://www.youtube.com/watch?v=matmrIZH-pU
Using the Custom Shader http://www.youtube.com/watch?v=Fu9P4D-UCTc  (see it clearest in 1080p full screen)

Notice the difference when looking at the ground in the distance.

sentences: Good books for MMORPG design? What is the recommended reading list for a very experienced s/w developer, with no MMORPG experience, who wants to design an MMORPG?

sentences:
Coroutine to move to position passing the movement speed? I'm using this coroutine to move my player to a new position. The problem is that it takes the duration as an argument instead of the speed of the object. Which makes it hard for me to make sure the object always moves at the same speed.

How can I create a coroutine that takes the source position, target position and movement speed to move my character?

This is my current code:

IEnumerator MoveObject(Vector3 source, Vector3 target, float duration)
{
    float startTime = Time.time;
    while(Time.time < startTime + duration)
    {
        player.transform.position = Vector3.Lerp(source, target, (Time.time - startTime) / overTime);
        yield return null;
    }
    player.transform.position = target;
}

sentences:
Large 2D Arrays Causing Garbage Collection I've been working on a game in Java that, for this post's sake, looks like Terraria and has random  world generation. I've been using Vectors to contain my tile/block objects, but recently due to the nature of the calculations I perform on them fairly often, I've switched my system to 2D arrays, using 'chunks.'

Each 2D array (chunk) of blocks is 256x256. That's a lot of data, and considering that's only for one chunk (the player will probably have 30-50 chunks generated by the end of the game), the amount of live objects increases quickly.

Today I started getting lag spikes in-game when I generated about 15 chunks or so. After a few print statements, it was clear that the spikes were pretty inconsistent, and although I have no knowledge of the Java garbage collector, I can only assume it is the culprit.

I read that the more live objects you have (the ones that are still referenced somewhere), the more the GC will lag when it does its thing. Plus, all these blocks are taking up huge blocks of memory which is causing the GC to start in the first place.

I have tried saving the unloaded chunks to a file for later use, but as you can imagine, saving that much data isn't exactly efficient. I'm stumped here.

Does anyone have any suggestions on how to reduce the amount of live objects in-game?

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:
Should I use object references or integral values to store pieces in a chess board? just a general question regarding a checkers project. I built a class hierarchy for the game pieces (that could be extended for chess etc). The hierarchy looks something like

interface GamePiece() {...}
class EmptySquare implements GamePiece {...}
class Pawn implements GamePiece extends EmptySquare {...}
class Queen implements GamePiece extends EmptySquare {...}

I store an object reference in the board[][] array. In the tree search that array is cloned for each recursion (not with doMove() ... call recursion ... undoMove()). I store object refs for the game pieces so I can do something like this for generating the list of moves:

for(sq:Squares)
    sq.getPossibleMoves()
    possibleMoves.addAll(sq.possibleMoves)

I'm not sure how much space this array of references takes up and if that is any good way to it from a performance point of view. It works nicely logically though. Would you do it like that or sacrifice the nicer code for a more compact game board array and the use switch() to call subroutines for each piece to make the move list?

sentences:
Counting multiple touches using Cocos2dx 3.2 I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches:

auto jumpListener = EventListenerTouchAllAtOnce::create();
    jumpListener->onTouchesBegan = [=](const std::vector<Touch*>& touches, Event* event)
    {
        CCLOG("Multi-touch detected %d", touches.size());
        if(touches.size() == 2)
        {
            this->_player->jump();
        }

    };

But even if I'm touching with two fingers, I get that only 1 touch has been made, any suggestions?

sentences: Getting the tile over wich the mouse cursor is Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, so that I can draw a rectangle around that tile, so that I can later do stuff with that tile (e.g. if its stone Ill break it if I click...) I draw the map at an offset so the player is always in the middle of the screen, the upper left corner coordinates Ive called xot and yot, the offsets xOff and yOff, and yea. If anyone knows what math I need to use to get the propper tile x and y.

sentences:
Why do I get errors cs1502 and cs1503 in my Destroy object script? I have a script that lets the player place blocks (like in Minecraft), but I also want to be able to destroy those blocks. I keep getting error messages cs1502 and cs1503.

Could anyone take a look at the script and tell me what is wrong?

using UnityEngine;
using System.Collections;

public class TestForCube : MonoBehaviour {

  Ray ray;
  RaycastHit hit;

  // Use this for initialization
  void Start () {
  }

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

    ray = Camera.main.ScreenPointToRay (Input.mousePosition);

    if (Physics.Raycast (ray, out hit)) {

      if (Input.GetKeyDown (KeyCode.Mouse0)) {

        Vector3 position = hit.transform.position + hit.normal ;
        Quaternion rotation =  Quaternion.FromToRotation( Vector3.up , hit.normal );
        GameObject Placement = GameObject.CreatePrimitive( PrimitiveType.Cube );
        Placement.transform.position = position;
        Placement.transform.rotation = rotation;
      }

      {
        if (Physics.Raycast (ray, out hit)) {
          if (Input.GetKeyDown (KeyCode.Mouse1)) {
            DestroyObject( PrimitiveType.Cube);
          }
        }
      }
    }
  }
}

sentences:
UE4 - storing complex actors in Game Instance I want to make a game where I can hold tools in my hand and inventory. Obviously I want to pass them between levels and maybe even game sessions. Question is, how would I do that?

With simple variables like amount of money or HP, all I do is store a variable in the Game Instance. But what about, for example, a tool that has more data, like the class type, durability, maybe value? Even worse, whole array of them?

The way I use that in game is, there's an actor representing the tool. But even if I store array of those in the game instance, the actors get destroyed while changing level and the array just points empty memory. I could just spawn new ones by using the class type - but that is not enough for me.

My idea is to create something... maybe a struct, that would hold the information and then recreate the inventory item actors according to the data in the struct.

My questions:
What are other ways to do it?
and
Is there something fundamentally wrong with the way I'm storing the items in my inventory now?

sentences:
How can I render an .stl file in XNA or Monogame? How should I go about rendering a .stl file as a 3d model in XNA? The .stl file contains a bunch of triangles that add up to a solid mesh. I have already figured out how to read the contained data. The file firstly contains the amount of facets. The file then consists of groups of data that represent the triangles. For each triangle the is a normal and 3 vectors that represent the 3 corners of the triangle.

My question is how I should go about rendering theses triangles in XNA. I guess I have to use a vertex buffer or something but I have almost no experience with 3D at all. Could someone please help?

sentences:
How to get a large quantity of photographs in an app while being memory efficient?? There have been a lot of word games (apps) lately and some use graphics but others use photographs and I was hoping that someone could explain how these games manage to get so many photos in an app without taking up huge amounts of memory?

The easiest example I can give is an app called '4 pics 1 word' it has over 350 levels and obviously 4 pics on each level and the photos are good quality on retina screens but the memory of the app is less than 40mb, if I have remembered correctly. I was curious as to how this works, is it each photo being optimized in photoshop (save for web and devices) (png or jpeg) or is it something to do with the code or something else?

I know this question is quite broad but any answers, help, links to anything would be greatly appreciated.

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:
Rendering scaled-down card images I have high-quality SVG card images, but they drastically lose their quality when I downsize them. I have tried two ways of rendering cards (using Inkscape and Imagemagics):

1) Render SVG to high-res PNG and resize it then:

inkscape -D --export-png=QS1024.png --export-width=1024 QS.svg
convert QS1024.png -filter Lanczos -sampling-factor 1x1 -resize 71x QS71.png

2) Render SVG to image of proper size at once:

inkscape -D --export-png=QS71.png --export-width=71 QS.svg

Both approaches generate blurry card images, which looks even worse than old Windows cards. What are the best way to generate smaller card images from SVG sources and not to loose their quality a lot?

UPDATE: I am using Inkscape to render SVG -> PNG and ImageMagick then to downsize PNG. I've tried using convert -resize with couple of filters (Lanczos/Mitchell/etc), but result was pretty much the same.

Original:

71x raster:

sentences:
Understanding CGPoints in SpriteKit I am planning to place three cards on a view which I add to the background. However I wanted to combine two of the cards and replace the first card position with the new card position. Is there any way I can do this?

I am trying to read the selected node position by:

CGPoint position = CGPointMake([self nodeAtPoint:touchLocation].position.x, [self nodeAtPoint:touchLocation].position.y);

However what I read is (0,0).

What happened?

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 to fix problems with connecting VsCode to Omnisharp server? I'm using sourcetree for version controlling for Unity. I'm using VsCode version 1.45.1 and when sourctree is running on pc and I open a script on my Unity project, VsCode can't connect to Omnisharp server. What's the problem? I've recently installed Git on my pc.

sentences:
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:
File operation(s) failure on game crash/kill by OS/User in Android My game saves its state after fixed interval on a file in game/app internal storage. When my game is killed or crashed by user or OS respectively, We write current game state on that file. File writing after fix interval is working fine but when game is crashed/killed by OS or user, file writing operation fails. Operation failure results incomplete game state or empty game state i.e. no data written on file at all.
I have tried multiple solutions using android service, In case the service is NON STICKY service is killed with the app. On the other hand if service is STICKY then it is restarted but intent that was attached initially with service is null or new one.

The question is that how can i save my data (could be ~2-3MB) completely on file in internal storage when my game/app is killed by user/OS ?

sentences:
Change Tag of Instantiated Clone In my game there is a bird flying up and a stream of containers (baskets) is moving from right to left of the screen in the bottom. Baskets are being Instantiated on right and get destroyed when they reach the left side of the screen.
 On The left there is an EmptyObject called Destroyer and anything that collides with it get destroyed. I'm not using out of bounds for the objects to get destroyed instead I'm using an EmptyObject with collide.
 And on tap the bird throws an artifact projectile downwards and if it collides with the Basket it changes into another sprite. This is the code for that transform.GetComponent<SpriteRenderer> ().sprite = changedBasket;
 The problem is that user is only allowed to miss 3 baskets losing more than 3 baskets will result in Game Over. So inside my Basket.cs I'm checking that if(target.gameObject.tag == "Deadly") then count it as a chance loose. BUT the changeBasket also act as it's the same basket.The logic that I think will work is to change the tag after the artifact collides with the basket and on that type of tagged object deadly won't work. If I'm write kindly tell me how to implement this in c# of-course. Please note that the object is an Instantiated Clone

sentences:
P2P synchronization: can a player update fields of other players? I know that synchronization is a huge topic, so I have minimized the problem to this example case.

Let's say, Alice and Bob are playing a P2P game, fighting against each other. If Alice hits Bob, how should I do the network component to make Bob's HP decrease?

I can think of two approaches:

Alice perform a Bob.HP--, then send Bob's reduced HP to Bob.
Alice send a "I just hit Bob" signal to Bob. Bob checks it, and reduce its own HP, then send his new HP to everyone including Alice.

I think the second approach is better because I don't think a player in a P2P game should be able to modify other players' private fields. Otherwise cheating would be too easy, right?

My philosophy is that in a P2P game especially, a player's attributes and all attributes of its belonging objects should only be updated by the player himself. However, I can't prove that this is right. Could someone give me some evidence? Thanks :)

sentences:
In a MovementComponent, where should I initialize member variables? I have a MovementComponent derived from CharacterMovementComponent

MovementComponent, attached to a Character, needs a reference to GrappleComponent, stored on the Character.

Where do I perform the GetComponentByClass call to obtain this reference to the GrappleComponent?

If this is the constructor, could I please have some information on how to override the constructor?

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:
Help in understanding atmospheric scattering shading I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site:
Click to visit site
I don't understand this:

As with the lookup table proposed in Nishita et al. 1993, we can get the optical depth for the ray to the sun from any sample point in the atmosphere. All we need is the height of the sample point (x) and the angle from vertical to the sun (y), and we look up (x, y) in the table. This eliminates the need to calculate one of the out-scattering integrals. In addition, the optical depth for the ray to the camera can be figured out in the same way, right? Well, almost. It works the same way when the camera is in space, but not when the camera is in the atmosphere. That's because the sample rays used in the lookup table go from some point at height x all the way to the top of the atmosphere. They don't stop at some point in the middle of the atmosphere, as they would need to when the camera is inside the atmosphere.
Fortunately, the solution to this is very simple. First we do a lookup from sample point P to the camera to get the optical depth of the ray passing through the camera to the top of the atmosphere. Then we do a second lookup for the same ray, but starting at the camera instead of starting at P. This will give us the optical depth for the part of the ray that we don't want, and we can subtract it from the result of the first lookup. Examine the rays starting from the ground vertex (B 1) in Figure 16-3 for a graphical representation of this.

First Question - isn't optical depth dependent on how you see that is, on the viewing angle? If yes, the table just gives me the optical depth of the rays going from land to the top of the atmosphere in a straight line. How to find the optical depth in the case where the ray pierces the atmosphere and goes through it to the camera?
Second Question - What is the vertical angle it is talking about...like, is it the same as the angle with the z-axis as we use in polar coordinates? (I am having a very hard time understanding this angle)
Third Question - The article talks about scattering of the rays going to the sun..shouldn't it be the other way around? like coming from the sun to a point?
Any explanation on the article or on my questions will help a lot.
Thanks in advance!

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: In which software do the professional game developers create 3D Model? I am just thinking about beginning game development in xna c#. However, I don't know (and no tutorial teaches) how do professional game developers create a 3D Model/Scene. How can we create a realistic looking model and what is the hardware configuration needed in machine for using such a software?

sentences:
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:
Multithreading/Optimisation for Random Generation in Gamemaker I have a FurGeneration() script in my game; when run, it randomly generates individual oFur objects in specified areas in the game's single Room. Each has a random depth and one of three sprites, and the script produces the impression of dense, layered fur. I've attached a screenshot.

At the moment, the script is working well, as I am using it on relatively small areas. However, my next challenge is to apply this across the single, 20,000 x 20,000 room of my game to produce a consistent field of fur.

My first attempt at this was to create a background sprite, a simple 1000x1000 grey square with its image_alpha set to 0. These would be generated in rows across the entire space of the room, and then each one would have the FurGeneration() script run on it to generate individual squares of fur flush with each other. I've applied this to one 'row' of my games' Room, and the game really slows down; it doesn't crash, but evidently there are just t0o many calculations going on at once.

My question is: is there a way to multi-thread in Gamemaker? Or does it already multi-thread, meaning that this plan is a foolish one? It would be interesting to hear your thoughts.

sentences:
SceneManager.GetActiveScene(); return -1 when Debugging active scene in editor I'm trying to use the new SceneManagement since Application.LoadLevel is obscelete and I've read that we need to put it like this.

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

public class UI : MonoBehaviour {

    private Scene activeScene = SceneManager.GetActiveScene();

    // Use this for initialization
    void Start () {
        Debug.Log (activeScene.name);
    }

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

    }

    public void restartLevel(){
        SceneManager.LoadScene (activeScene.buildIndex);
    }
}

The Debug.Log show "-1" and it should be "0" and throw this error in console

Scene '' (-1) couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.

The Scene is added in the build setting too by the way.

Seems that it can't return me the good index and even with the activeScene.name, still returns NULL. I miss how Application.LoadLevel was easier and more robust that this new way...

sentences:
Unity 3D Slow car (wheel colliders) My car is moving very slowly even though I apply high amounts of torque to the wheel colliders. The only thing I found to be helpful was to increase the wheel's friction stiffness, but that really messes up the braking and makes the car shake.
The values I use for setting up the car and torque are realistic (1500 kg car, 20 kg wheels, a realistic torque value accounting for gear ratios etc.), so I don't understand the problem.

sentences:
Cannot detect input in void OnCollisionEnter() Code:

void OnCollisionEnter()
{
    if (Input.GetMouseButton(0))
       {
            // do something
       }
}

Of course, this code does not work. What I intend to do: "After collision, if the user is pressing down, do something". How can we write this another way? I can't figure it out.

sentences: Can I make a mirror with Unity Free? If I understand correctly, render textures are a feature of Unity Pro, and that is the best way to create mirrors, TV screens, and so forth. If I am wrong, please tell me. What I would like to know is if there is another, probably less-convenient, way to create a mirror with the free version of Unity. If I need to write a custom script, I would appreciate a basic outline of how to write it. Even better, if you know of a free script package that does this, please tell me.

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:
Exact collision detection for high-detail deformable triangular meshes What robust methods or approaches exist for exact collision detection involving high-detail, deformable geometry?

The kind of mesh I am describing is a surface that is specified as a triangulated polyhedron and looks very similar to this:

For the specific application I am working on, I need to find all the contact points for colliding meshes that undergo subsequent deformation. Possible deformations that may occur during a collisional event:

1) the mesh decomposes, or fragments into smaller (triangulated) meshes

2) the mesh retains integrity but the vertex values of it's surface change

3) both of the above deformations occur

There is no real-time constraint; accuracy rather than performance is the critical factor.

sentences:
How can I get what key was pressed in Unity? Description
I'm working on a chat that will immediately record input when any (compatible) key is pressed, so I need to record the keys pressed and turn them into a string.
Attempted Solutions
1) Listen to every key-press with a script and push it inside a Text component
I like this one most, because the chat is simple enough that I'm better off with a custom Input Field component, and I get all the control I need.
However, I don't know how to get what key was pressed in a frame, short of checking for every single one (and the shift modifier, too). This is inefficient both for me, the developer, and the computer.
2) Automatically focus an Input Field when any key is pressed
Unity has a handy Input.anyKey boolean field that's true whenever any key is pressed, but I need to save that first key press and insert it manually into the Input Field or else it will be lost, as the Input Field only listens for key-presses once it's in focus.
That means I need a way to record key presses, and then we're back to solution #1.

sentences:
Direct3D: should I use MIXED_VERTEXPROCESSING? Yesterday on Youtube I watched a video tutorial about creating Direct3D stuff. On that tutorial there was a part about VERTEXPROCESSING compatibility with older video cards. The guy said that the compatibility can be checked by this code:

D3DDISPLAYMODE         d3ddm;
D3DPRESENT_PARAMETERS  d3dp;
D3DCAPS9               d3dc;
int VP;

d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dc);
if (d3dc.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
    VP = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
    VP = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

//and then:
d3d->CreateDevice(D3DADAPTER_DEFAULT,
                  D3DDEVTYPE_HAL,
                  dxhwnd,
                  VP,
                  &d3dp,
                  &d3ddev);

But hey OpenGL does this stuff automatically so there must be a way to achieve that easier. So today I found that this can be done by D3DCREATE_MIXED_VERTEXPROCESSING. But on some forums I have read that some (most older) video cards can have problems with this mode. So is there any reason why should I or shouldn't use Mixed Vertex Processing instead of using them both but with D3DDEVCAPS?

sentences:
Move camera from wherever camera is to pinned point So, I need to switch/ move/ animate camera from point X (not point A,as I don't know where the camera is at that momemnt) to point B (place where you want your camera to move).

This is for cinematics...like when you press a button in game which does something (opens doors maybe) but you can't see where nor what did you activate, so you show the player with the camera where and what happened.

I tried to animate camera to position, camera just goes crazy.
Then I tried to make an empty object placed at the position where the camera should be and move camera with code to that objects
position.
I tried enabling Camera 2 and disabeling Camera 1 but it just doesn't work.

Enable/ Disable Code:

public var door: DoorAnim;

public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Update(){
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1)){
            Debug.Log("Door 1 built");
            camera1 = GameObject.Find("Camera1");
            camera1.enable = false;
            camera2 = GameObject.Find("Camera2");
            camera2.enable = true;
            door= GameObject.Find("door1");
            door.animation.Play();

    }

sentences:
Bubble shooter falling algorithm To complete this question about the same color search algorithm, I would like to know if someone knows which is the best implementation for making other bubbles fall when they are no longer attached. More precisely, how can I detect islands of isolated bubbles.

My data structure is a NxM matrix.

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:
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 to get all points within a box? What is the fastest way to get all of the points within a bounding box? If I had an ArrayList<Point>, and they weren't mapped to coordinates, would I have to loop through every point to see if it is in those bounds? Is there a faster way?

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:
How to get the normal that points *out* of a polygon In 2D, each vector (x, y) has two normals: (-y, x) and (y, -x), pointing in opposite directions.

Say I have a polygon and for each of it's edges I need to get the normal pointing outwards. In the picture below, the red normals:

For each edge of the shape, how can I decide if I need (-y, x) or (y, -x)?

sentences:
Rendering skybox in first person shooter I am trying to get a skybox rendered correctly in my first person shooter game. I have the skybox cube rendering using GL_TEXTURE_CUBE_MAP. I author the cube with extents of -1 and 1 along X,Y and Z.

However, I can't wrap my head around the camera transformations that I need to apply to get it right. My render loop looks something like this:

mp_Camera->ApplyTransform() :: Takes the current player transformation and inverts it and pushes that on the modelview stack.
Draw GameObjects
Draw Skybox

DrawSkybox does the following:

glEnable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_FALSE);

// draw the cube here with extents

glDisable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_TRUE);

Do I need to translate the skybox by the translation of the camera ? (btw, that didn't help either)

EDIT: I forgot to mention: It looks like a small cube with unit extents. Also, I can strafe in/out of the cube.
Screenshot:

sentences: Calculate the slope of a 3D triangle? I have lots of triangles in 3D space. How do I determine the slope/angle of these triangles with respect to a fixed ground plane? I need pseudo code examples at the very least.

sentences:
Speed, delta time and movement player.vx = scroll_speed * dt

/* Update positions */
player.x += player.vx
player.y += player.vy

I have a delta time in miliseconds, and I was wondering how I can use it properly. I tried the above, but that makes the player go fast when the computer is fast, and the player go slow when the computer is slow. The same thing happens with jumping. The player can jump really high when the computer is faster.

This is sort of unfair, I think, because.

Should I be doing this someway else? Thanks.

sentences:
What are the pros and cons of GameSalad versus Cocos2D? I am currently using the Cocos2D framework for creating my game but I just happened to come across GameSalad and was amazed by this video.

GameSalad claims to allow you to create games without writing a single line of code. So I ask myself, what is the catch? What makes Cocos2D better than GameSalad? What are the pros and cons of GameSalad?

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:
GLSL: Noise via texture I am trying to access a texture in a fragment shader to overlay this texture over a certain area.

varying vec4 v_color;
varying vec2 v_texCoord0;

uniform sampler2D u_sampler2D;
uniform vec4 u_oldcolor;
uniform vec4 u_newcolor;
uniform vec3 u_noise;

void main(){

    vec4 color = texture2D( u_sampler2D , v_texCoord0 ) ;
    float threshold = 0.005f;
    if(color.r <= (u_oldcolor.r + threshold) && color.g <= (u_oldcolor.g + threshold) && color.b <= (u_oldcolor.b + threshold)
    && color.r >= (u_oldcolor.r - threshold) && color.g >= (u_oldcolor.g - threshold) && color.b >= (u_oldcolor.b - threshold)){
        color.rgb = u_newcolor.rgb + vec3(v_texCoord0, 0.1);
    }

    gl_FragColor = color ;

}

For every pixel the shader checks for a certain color and replaces it with a new color+v_texCoord0.

Now I am want to bring in a third component: a noise texture to make it look like this:

I searched the web for a solution but I could not find anything helpful.

My questions:
1.Is this even possible to accomplish via a shader?
2.How to access the texture ?

I hope that my questions are clear and proper for this forum :) .

sentences:
Is There an Easy Way to Convert Python/Pygame code into C#? I am working on a game, sort of like this and I want to convert it to C#, as it is currently written in Python. The reason of this is because I can add features more easily and with less writing in C#, and I do NOT want to write it all again, with all of the glitches and testing having to be redone. Is there any program of internet service that can do so, for free? I don't have extra money to spend on this, which is just for fun. Thanks for all feedback, edits, and suggestions!

Edit: I use Wing IDE 4.1 for my Python coding and the Unity Version of MonoDevelop for C#.

sentences:
Getting the angle between three points? I have three points, A, B and C (stored as Vector2 in Unity).  I am trying to find the angle at point B if there were a line AB and and a line BC.  I know, this should be a simple google search, and I have found several methods but for some reason, they ALL return totally unexpected results with my data set!

I checked to make sure that the three points I pass to compute the angles are indeed the correct (x,y) coordinates, and that same data is used elsewhere in my code without any problems.

Considering that all functions return strange results, it must be that I am not understanding something here...

here is one formula:

Vector2 A = //some vector2.normalized
Vector2 B = //some vector2.normalized
Vector2 C = //some vector2.normalized
float Angle = Mathf.Atan2(B.y - A.y, B.x - A.x) - Mathf.Atan2(B.y - C.y, B.x - C.x);

Here's another that I tried where p0,p1,and p2 and just vector2's:

function findAngle(p0, p1, p2) {
        var a = Math.pow(p1.x - p0.x, 2) + Math.pow(p1.y - p0.y, 2),
            b = Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2),
            c = Math.pow(p2.x - p0.x, 2) + Math.pow(p2.y - p0.y, 2);
        return Math.acos((a + b - c) / Math.sqrt(4 * a * b));
    }

The data is a List of Vector2 control points for creating Bezier curves. I want to calculate the angle between index 0,1,2 then 2,3,4 then 4,5,6 etc. with the middle index as the angle needed.

I understand that both formulas return radians, but converting to degrees returns sometimes 180 for all points even though the points are all different and the angles vary greatly, sometimes 0 (if I switch the points around), and in the case of the atan2 function above, it gives numbers that "look" like angles, but plotting the points, one can see that the angles do not correspond to the visual plots...  I must be doing something very dumb here and I'm not great with math so any hand-holding is much appreciated.

Here's an image of the output:

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:
Convert Mouse Coords into Isometric Tile ID Using GameMaker Language, I'm basing off their Adavnced Examples. How can i convert the current mouse position into a tile position?

The mouse coordinates are 0,0 from top-left

This is the function when it draws. I think this is what needs reversing. I'm tragically bad at Maths, so I'm sorry in advance.

/// DrawLevel()
var xx,yy,destx,desty, base_x,base_y,current_row_x,current_row_y,tile,o,sp, m,h,offy, tileset;

TileRowDX = 68;
TileRowDY = 34;
TileColumnDX = -68;
TileColumnDY = 34;

MapX = 0;
MapY = 0;
MapDrawX = 11;
MapDrawY = 11;

/// Draw the complete isometric level
tileset = global.tiles;

// End point in map drawing (map coordinates)
destx = MapX+MapDrawX;
desty = MapY+MapDrawY;

// Start drawing position - center in the middle of the screen - and just above a little
base_x = surface_get_width(application_surface)/2;
base_y = 150;

// X and Y loop to print all cells.
for( xx=destx-1;xx>=MapX;xx--) {
    current_row_x = base_x;
    current_row_y = base_y;
    for( yy=MapY;yy<desty;yy++)
    {
        // First draw the column of tiles in this cell, bottom to top.
        offy=0;
        for(var h=0;h<global.mapMaxLayers;h++){
            m = Map[h];         // get 2D map grid from level array (Z axis)
            tile = m[# xx,yy];  // get tile from 2D grid (x,y axis)
            if( tile>=0 ){
                // if we have a tile, then draw it.
                draw_sprite(tileset,tile,current_row_x,current_row_y-offy);
            }
            offy+=27;
        }

        // Next, get the object in this cell, and draw it on top.
        // If allowing height for the player, you'd need to add on 27 for each block up.
        o = Objects[# xx,yy];
        if( o!=0 ){
            // Get the object sprite to draw (could also do frames etc)
            sp=o.Sprite;

            // get a 0 to 1 value into the isometric cell.
            var dx = (1.0/15.0) * ((o.x&15));
            var dy = (1.0/15.0) * ((o.y&15));

            // Move to top left of Isometrix grid cell
            var ox = current_row_x - TileRowDX;
            var oy = current_row_y - TileRowDY;

            // Now convert into an isometric offset on X and Y
            ox = ox + (dy*TileRowDX);                   //Y axis first
            oy = oy + (dy*TileRowDY);
            ox = ox - (dx*TileColumnDX);                // now X axis
            oy = oy - (dx*TileColumnDY);

            // and draw this sprite
            draw_sprite(sp,0,ox,oy);

        }

        // Move down and right
        current_row_x += TileRowDX;
        current_row_y += TileRowDY;
    }
    // Back up to top, and move left and down.
    base_x += TileColumnDX;
    base_y += TileColumnDY;

}

I'm sure this is just mostly a mathematics question!

sentences:
creation of a meta-game OK, I feel like this should be on meta, because it is a very meta question, but I thought it would be interesting to discuss here. it is relevant and it might provide a little break from coding.

Using these sites you can essentially get a very good answer to any problem. In fact I think it would be safe to say you can pretty much get people to discuss the best algorithm for any given problem.

I was wondering if it would be interesting to create a whole game this way. you would ask the first question for instance:

What type of game would be the best game to make if the project was going to be worked on by an unknown amount of designers and developers?

The answer would be subjective, but people could discuss and after a time the answer with the most votes could be chosen and the question locked out. This would be the hardest question I suppose, because after that you would get more and more technical and the questions would become more and more like the questions you ask on these forums.

What would be the best class structure for this segments of a game?

What would be the best way of testing for collisions etc..

Do you think it would be possible to create a whole game this way? Sorry if this seems bizarre or annoying, but I think it might be worth a try! Think of this as the zeroth question. What do you think?

sentences: Is there any way to move the sprites inside the sprite editor? I have imported a .png file of a stickman in which I had placed his head, body, two legs, and two hands a bit far apart from each other so that Unity will automatically convert the picture into sprites. Indeed, Unity did convert those body parts into sprites easily but now I have a problem. I made a bone going through the body and another bone going from the body to the head through the transparent area in between the sprites. Also, I have created one bone for each hand and leg and parented them to the bone in the body. The problem is that when I automatically generate geometry then the mesh rendering works completely fine within the body of the stickman, but it doesn't work anywhere else, be it the hands, or the head, or the legs. I can see the mesh only in the body of the stickman and nowhere else. Does this problem arise because the sprites are not connected, or is there any other reason? I am very new to game development, therefore please try to explain it in simple words. Thank You.

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:
How can I render 3D dots at object vertex positions? What is the best way to put a dot on a vertex?

I have a model (a plane for example) consisting of a few thousand vertices. I want to draw a red dot at every vertex's 3D position, just like 3ds Max's vertex selection mode, for example).

I've tried drawing a small line on each vertex location which works fine with few vertices, but it causes performance problems when I have large objects with many vertices. I've also tried doing this with a shader, but I can't get this to work (I want to highlight the selected vertices). I've thought about drawing a small 3D cube at every vertex location, but this seems terribly inefficient.

How can I accomplish this in a way that will scale to large scenes?

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:
rpg 3d open world map & entity loading-streaming Hello I'm a web developer and recently I started reading about game development.
I followed some tutorials regarding c++ and openGL (whatever I could find online because as you know not many up to date openGL tutorials exist.)

I keep wondering in a case of a rpg game with a huge real world(map) and entities(enemies what so ever) how could it be implemented. Meaning you cant load a huge map and the entities all at once obviously... I was thinking of subdividing the map into blocks and each block to even smaller ones so that each block contains (5x5) 25 sub-blocks.

A map could be consisted of many blocks such as the following one which has 25 sub-blocks:

P = Players current sub-block
O = sarounding sub-blocks
X = sub-blocks not yet loaded

Entities will be loaded only for the players current sub-block. Keep in mind that P is not just the player is a mesh a piece of map not very big and not as small as the player is.

X X X X X
X O O O X
X O P O X
X O O O X
X X X X X

And I'm wondering is this a good approach?
I suppose each sub-block has to be a different mesh apparently and then stitch them up together?

CASE 2:

What if I stored the map into 1 big height map or a set of height maps and generate the mesh from that. According to the player's position copy the required image height and width where player is always at the center of it and rearrange the data in the vbo?

I'm sorry if this is a silly question but I simply don't now how to approach this and I can't find any references.Also keep in mind that on such a map animations will also happen.

I would really appreciate it if someone could give some references or explain the architecture for a game such as this.

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:
does glBindAttribLocation silently ignore names not found in a shader? Does glBindAttribLocation silently ignore names that are not found? For example, in a shader:

// Some vertex shader
in vec3 position;
in vec3 normal;
// ...

And in some set up code:

// While setting up shader
GLuint program = glCreateProgram();
glBindAttribLocation(program, 0, "position");
glBindAttribLocation(program, 1, "normal");
glBindAttribLocation(program, 2, "color"); // What about this one?
glLinkProgram(program);

sentences:
Play audio clip from where it left I spent some time playing with AudioSource.time & AudioSource.timeSamples and read some posts about them. So I get that due to audio compression I can't rely on .time for accuracy so I need to use .timeSamples. Yet, when I printed some output of how .timeSamples work coudn't understand the idea behind it at all. I simply made a 30 sec audio loop and with first play it starts from 7526 and 2nd time 38 and every next time it loops, starts and ends with different timeSample values. Why?

What I simply want to achieve is the thing I wrote in the header and also to be able to play the sound at for example the 5th or 10th or any second without losing the accuracy from the compression for android or ios. How can I do that?

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:
Gfx.WaitForPresent performance issue I am making a 2D mobile game and it runs really well (60 fps) on my phone. However, in some cases the performance goes down drastically to the point where it runs at 20 fps or even less. It happens at random times so I can't pinpoint what is causing this. During the performance decrease Gfx.WaitForPresent appears in my profiler which eats a lot of power. I am aware that this might be because of Vsync being turned on, but I have it disabled, along with shadows, AA and everything else that absolutely kills mobile performance. What else can be the problem? My game relies heavily on good performance for gameplay so this needs to be resolved ASAP.

Edit: I also noticed that the GPU stays at 0 ms which is really odd as well.

sentences:
What to do to UV coordinates, when swapping Z/Y coordinates (axis) of the geometry? In my Maxscript exporter I have the ability to flip the Z/Y axis by simply swapping the Z and Y co-ordinates.

When swapping the axis this way, what is the correct thing to do to the UV coordinates? (e.g. do I need to swap the U or V, or invert one or both?)

Thanks!

sentences:
Object outlining, stencil is not working WebGL I can't seem to figure out my problem with stencil buffer in object outlining algo.

function init() {
   ...
   gl.enable(gl.STENCIL_TEST);
   gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE);
   ...
}

var mscaled = [];     // scaled model matrix of a cube
function render() {
   gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);

    gl.stencilFunc(gl.ALWAYS, 1, 0xFF);
    gl.stencilMask(0xFF);
     // use program1
     // set attrib pointers
     // bind cube's ebo buffer
     gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);

     gl.stencilFunc(gl.NOTEQUAL, 1, 0xFF);
     gl.stencilMask(0x00);

      // set scaled model matrix
      mat4.fromRotationTranslationScale(mscaled, cube.rotation, cube.translation, vec3.fromValues(1.1, 1.1, 1.1));

      // use program2
      // set attrib pointers
      // bind cube's ebo buffer
      gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);
}

And it just draws the whole second cube on top of the first, like there's no stencil test. I've tested with up-scale and down-scale.

the red cube should be the outliner. In the first image it is scaled up - but WebGL draws it just on top of the first one, in the second image it is scaled down - ideally it shouldn't been even drawn due to stencil test (of course, depth test is disabled in the case of a second image)

sentences:
SDL_SetColorKey in SDL c++ removes most of the white pixels but there is a border around my character I have drawn all of the images of my sprite in paint. Is there a way to remove all white pixels?

bool Game::loadFromFile(std::string path)
{
    free();

    SDL_Texture* newTexture = NULL;
    SDL_Surface* loadedSurface = IMG_Load(path.c_str());

    if(loadedSurface == NULL)
    {
        printf("Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
    }

    else
    {
        //Color key image
        Uint32 colorKey = SDL_MapRGB(loadedSurface->format, 255, 255, 255);
        SDL_SetColorKey(loadedSurface, SDL_TRUE, colorKey);

        //Create texture from surface pixels
        newTexture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);

        if(newTexture == NULL)
        {
            printf("Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
        }

        else
        {
            //Get image dimensions
            mWidth = loadedSurface->w;
            mHeight = loadedSurface->h;
        }

        //Get rid of old loaded surface
        SDL_FreeSurface(loadedSurface);
    }

    //Return success
    mTexture = newTexture;
    return mTexture != NULL;
}

void Game::free()
{
    //Free texture if it exists
    if(mTexture != NULL)
    {
        SDL_DestroyTexture(mTexture);
        mTexture = NULL;
        mWidth = 0;
        mHeight = 0;
    }
}

void Game::render(int x, int y, SDL_Rect* clip)
{
    //Set rendering space and render to screen
    SDL_Rect renderQuad = {x, y, mWidth, mHeight};

    //Set clip rendering dimensions
    if(clip != NULL)
    {
        renderQuad.w = clip->w;
        renderQuad.h = clip->h;
    }

    //Render to screen
    SDL_RenderCopy(gRenderer, mTexture, clip, &renderQuad);
}

int Game::getWidth()
{
    return mWidth;
}

int Game::getHeight()
{
    return mHeight;
}

bool Game::Initialize()
{
    bool success = true;

    if(SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
        success = false;
    }

    else
    {
        if(!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"))
        {
            printf("Warning: Linear texture filtering not enabled!");
        }

        gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);

        if(gWindow == NULL)
        {
            printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
            success = false;
        }

        else
        {
            gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
            sBackground = SDL_LoadBMP("BackgroundLeft.bmp");
            tBackground = SDL_CreateTextureFromSurface(gRenderer, sBackground);

            if(gRenderer == NULL)
            {
                printf("Renderer could not be created! SDL Error: %s\n", SDL_GetError());
                success = false;
            }

            else
            {
                SDL_SetRenderDrawColor(gRenderer, 255, 0, 255, 0xFF);

                int imgFlags = IMG_INIT_PNG;

                if(!(IMG_Init(imgFlags) & imgFlags))
                {
                    printf("SDL_image could not initialize! SDL_mage Error: %s\n", IMG_GetError());
                    success = false;
                }
            }
        }
    }

    return success;
}

sentences:
Drawing Farseer Fixtures Is there any way how to draw a Polygon / Fixture from Farseer Physics with XNA?
As I deform these polygons at runtime I can't take any texture from my Content folder, the texture must be generated at runtime too.

sentences: AndEngine player, background and camera I'm developing a 2D shooter using AndEngine. At the moment I'm trying to make the camera follow the player. As I've understood the common approach is to use the SmoothCamera zooming it and setting the chased entity. The problem is that the camera follows the player WITH background moving also (RepeatingSpriteBackground), so it looks like the player doesn't move at all though the actual position changes. So I don't really get how to make the camera follow the player and have the background not moving. Thanks in advance.

sentences:
Zooming versus panning in a 3D FPS fly camera Imagine you have a strategy game, and it's rendered in openGL, in 3D. You have an overview of the map and the camera is currently looking at the direction of the ground at some angle (but is not limited to this angle). Like the standard view in the CIV games.

You now do one of the two actions:

A) You move the camera along its line of sight towards the ground (forward).
B) You scale the whole scene by a factor >1.

If I understand these actions correctly, both situations should have exactly the same visual result, zooming in. The player shouldn't really be able to tell which of the two has happened.

My questions is, firstly, am I right to assume this?

If no, what is the observable difference?
If yes, which mechanic should be used?

Note that I am thinking about this in regards of use in a level editor.

Thinking about it a little further, the difference should become visible if player moves the camera after the action - the camera in the scaled version would move at an apparently slower speed, right?

Would there be any other side effects? Which behavior would be expected by the player/user?

If you assume an FPS fly camera (one that yaws and tilts, but does not roll), is there any scenario where the scaling method would be preferred?

sentences:
LibGDX - managing zoom Zooming an OrtographicCamera effectively changes the amount of world units that can be shown in the camera window. Should thus the camera viewport dimensions be correspondingly updated upon zoom? For example,

...
camera.zoom -= 0.01;
camera.viewportWidth *= camera.zoom;
camera.viewportHeight *= camera.zoom;
camera.update();
...

EDIT: Here's the full code:

private float CAMERA_WIDTH = 50;
private float CAMERA_HEIGHT = 50;
camera = new OrthographicCamera(CAMERA_WIDTH,CAMERA_HEIGHT);
camera.position.set(CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2, 0);
camera.update();
// prints 1.0, 50.0, 50.0   --> OK
System.out.println(camera.zoom + ", " + camera.viewportWidth + ", " + camera.viewportHeight);
...

camera.zoom += 0.1;
camera.update();
// prints 1.1, 50.0, 50.0   --> NOT Ok
System.out.println(camera.zoom + ", " + camera.viewportWidth + ", " + camera.viewportHeight);
...

Executive summary: if you need the zoomed camera viewportWidth and viewportHeight, maintain them as separate variables. They must not be changed in the camera otherwise zoom calculation messes up (obviously, since the zoom is relative to the values the camera was created with, so the original values are always needed). If you absolutely want or need to reassign camera.viewportWidth and camera.viewportHeight, you have to reset camera.zoom to 1 immediately after.

sentences:
How can I make water appear darker with depth, like in Minecraft? In Minecraft when you look at water the deeper you view the darker it gets.  Does anyone know how to code something like that?

Minecraft with effect

similar game without effect

sentences:
Is there any game-oriented virtual machine out there? I'm investigating about virtual machines and their use in Games.

I'm looking for something cross-platform (at least win/mac/linux, mobile and consoles are a nice to have but not mandatory) and it would be nice if it could be binded to the usual things that you need for a game, like a graphics and sound lib. If it had any sort of automatic garbage collection, it would be nice, too. And since I want to use it for games, it should be fast and not very memory-consuming.

So far I've found:

Parrot VM
The Lua Virtual Machine (pdf)
V8

I'm leaving the Java Virtual Machine and .net VM out of this list since I feel they are a bit too big for my purposes - but I'm far from an expert on these things. If you think I should include them, please put your reasons below.

Am I missing any important one?

PS: I think this should be a community wiki, but I don't seem to be able to mark it as one.

EDIT: My final objective is creating a scripting language for game development. I've no problem with interpreters (have implemented a couple in the past) but this time I'd like to translate the Abstract Syntax Tree of my language to a VM, for efficiency mostly.

sentences:
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 would one generate a Navigation Grid for a 3D world? I am attempting to find a solution to this problem. I'm trying to build a navigation mesh in the format of a grid of vertices locked to x, y floored coordinates in the shape of squares for 3D space. But I'm having problems trying to figure out a way to go about it.

I tried looking into the Recast library. It's a pretty robust method, but it apparently slows down with larger maps and open space. I also don't know how they generate vertices and edges for the world space with the height map.

My next thought was to do what Unreal Engine 3 used to do.

https://udn.epicgames.com/Three/NavigationMeshReference.html

Which was to use raycasts to generate the mesh. I couldn't figure out how to have the raycasts stop.

So... my next option was box, possibly a box cast. Create a subdivided volume with a size that's a power of 2. Align the box to the grid, and shoot rectangular prisms downwards as a ray. If it lands on a piece of geometry that's part of the ground and the rectangle is not being intersected, leave a square there. And continue down until the bounds of the volume is reached. To check if edges need to be linked, I suppose I could check to see if the slope between two pairs of vertices is within the walkable slope, merge them if this is true.

My main problems are... this doesn't seem to be very optimal. Without thinking of it, at estimation the process is O(N^3) for a multilayered level. Which can get pretty nasty.

And the last bit is for automatically creating rectangular groups of these squares. I'm not entirely sure how to do this. The Unreal implementation separates them by slopes. However, I'm trying to keep the grid format. So that's not entirely necessary. The trouble still remains on creating large rectangular tiles to split up the path finding process into a per tile basis. The tiles can't be too large, nor too small.

So the questions are...

What would be an efficient way to generate this girded navmesh? And what would be a good way to create the tiles?

sentences:
Constant buffer not updating I'm trying to rotate models independently of each other however I cannot for the life of my figure out how. I have gotten to the stage of writing this:

std::vector<int>::size_type st = Models.size();
if (!Models.empty())
{
    for (unsigned x = 0; x < st; x++)
    {
        D3DXMATRIX matRotate;

        D3DXMatrixRotationY(&matRotate, D3DXToRadian((x + 1) * 60));

        cBuffer[x].Final = matRotate * matView * matProjection;
        cBuffer[x].Rotation = matRotate;

        devcon->UpdateSubresource(pCBuffer, 0, NULL, &cBuffer[x], 0, 0);

        devcon->VSSetShader(pVS, 0, 0);
        devcon->VSSetConstantBuffers(0, 1, &pCBuffer);
        devcon->PSSetShader(pPS, 0, 0);

        Models.at(x)->Render(devcon);
    }
}
swapchain->Present(0, 0);

but this only updates for the first assignment of rotation. Why isn't it rotating and how do I make it? Thanks in advance.

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:
Game mechanics patterns database? Do you know http://tvtropes.org ?

It's a kind of wiki/database with scenaristic tropes, patterns that you can find in tones of stories, in tv shows, games, books, etc.

Each trope/pattern have a (funny) name and there are references to where it appears, and the other way arround : each book/game/etc. have a list of tropes that it contains.

I'm looking for an equivalent but for game mechanics patterns, something like "Death is definitive", "Perfect physical control (no inertia)", "Excell table gameplay", etc.

I think it would be really useful. I can't find an equivalent for game mechanics (tvtrope is oriented to scenario, not game mechanics).

Do you know any?

sentences:
Calculate size of hexagonal map libgdx I have a staggered hexagonal map created with "tiled" map editor and I want to calculate the height of this map in pixels, the example map below should be MAP_WIDTH_IN_PX = 1056 and MAP_HEIGHT_IN_PX = 303;

MAP_WIDTH = map.getProperties().get("width",Integer.class); //16 tiles
MAP_HEIGHT = map.getProperties().get("height",Integer.class); //5 tiles
TILE_WIDTH = map.getProperties().get("tilewidth",Integer.class); //64px
TILE_HEIGHT = map.getProperties().get("tileheight",Integer.class); //84px
TILE_SIDE_LENGTH = 27; //this value is set in the map editor

MAP_HEIGHT_IN_PX = ?;
MAP_WIDTH_IN_PX = MAP_WIDTH * TILE_WIDTH + TILE_WIDTH * 0.5f;

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:
Spawning entities in groups on a 2d tile-based map I have a 2d game that generates an "infinite" map of tiles based on a "noise" height map. Each time a new "chunk" of 16x16 tiles is loaded, I have code that randomly chooses a "creature" to spawn into the game. Whether or not a creature will spawn on the tile is random, and which creature type is weighted/random.

However, I'd like to take this to the next level and design a creature that can spawn in groups.

I have a few choices:

Spawn additional entities in a random set of surrounding tiles. Multi-chunk groups are impossible unless I write code to base spawns off of what already exists next to it.
Create a new noise/height-map value that I then use to spawn entities with.

There are pros/cons to each, but I'm hoping someone with more experience can suggest which is better, or a third choice.

sentences:
Rotate about a skybox I'm a beginner with OpenGl so please discount my ignorance. I've managed to create a skybox (with a texture mapped cube) and would like to rotate the view (eye) around the center of the box, so I can admire the view :). By changing the X/Y coordinates of eye/camera in GLM.LookAt() I'm able to see most of the faces of the skybox but I'm not able to see the top and bottom faces though I'm sure that they are rendered. In any case what's the best way to rotate around the skybox? What I want to do is exactly shown in this video

Thanks!

EDIT: Sorry for the lack of relevant information.

I'm using OpenGL version 3.3.
Not using immediate mode. Everything is via shaders and VBO/VAO
I have already setup the projection, view and model matrices which I pass to the vertex shader, and obviously have the texture loading also working as I can render the skybox. At the moment i've set the projection and model matrices to Identity for simplicity.
I'm deriving the view matrix from GLM.LookAt(), So initially i thought that to rotate around the view box, I'd just have to change the viewMatrix
I'm working on C# using SharpGL
To draw the skybox, I've set up a VAO to draw a cube with vertices in the range (-1,-1,-1) and (1,1,1). Then I load 6 textures for each cube face to 6 Texture Units. During the rendering I draw the cube and update the texture for each face using a sampler variable. All of this seems to be working OK. I verified this my scaling down the size of the cube and checking if all 6 faces were being rendered properly by rotating the ModelMatrix

I suspect one problem is that I'm not positioning the camera in the center of the cube. At the moment it seems to be viewing the cube from outside. I'm still trying to grasp the usage of GLM.LookAt().

This is how I'm rendering the skybox at the moment. And I can see the front face of the cube, but how do I go about placing the camera in the center of the box and rotating it?

 viewMatrix = mat4.identity();
 projectionMatrix = mat4.identity();
 modelMatrix = mat4.identity();
 viewMatrix = glm.lookAt(new vec3(0f, 0f, 1f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f));

        shaderProgram.Bind(GL);
        shaderProgram.SetUniformMatrix4(GL, "projectionMatrix", projectionMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "viewMatrix", viewMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "modelMatrix", modelMatrix.to_array());

skyBox.renderSkybox(GL);

EDIT #2
I managed to figure out my error. I was trying to look at the Top and Bottom faces by doing
viewMatrix = glm.lookAt(new vec3(0f,-1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); and
viewMatrix = glm.lookAt(new vec3(0f, 1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); which was giving me a blank screen. The reason being that (0,1,0) is collinear with my up-vector and LookAt() couldn't generate the viewMatrix in this case. Changing the UpVector makes it OK!

sentences:
How can I properly rotate a 2D vector in the "flipped" XNA client space? In my 2d XNA game, because SpriteBatch treats world space as client space and has positive Y axis down and negative up, I've built my game's world space with that coordinate system too. However, I've hit a snag when I try to rotate a position around the origin using a matrix.

var p1 = new Vector2(95f, 40f);

var m = Matrix.CreateRotationZ(MathHelper.ToRadians(90));

var p2 = Vector2.TransformNormal(p1, m);

This results in p2.X == -40 and p2.Y == 95. If there's an object that is positioned relative to another object and that other object rotates, the child object gets swung around the parent object in the opposite direction because the matrix works in the positive Y axis up and negative down coordinate system.

What's the best way to account for this? Negate the Y value before and after transforming?

EDIT: To get more detailed I am trying to do a transformation like this, where child rotates with parent:

I though I would be able to multiply the matrices from the child object up through each of its parents' transform matrices in order to get its final world position, scale, and rotation that can be passed to SpriteBatch.Draw. Unfortunately the combined translations and rotations don't work out properly with the inverted Y axis.

sentences:
2D Map Editor Tiles Palette - Best suited Java Elements to use? I'm making a 2D RTS Map Editor and here came the moment to make a Palette which is just a popup frame showing tiles to be clicked on and then applied on the map.

I'm wondering which Java Elements to use for this palette?
At the moment I have set a JFrame which will contain Jlabels which have their Icon set as some ImageIcon (which are the tiles of my game).
(I have a List<ImageIcon> tiles which contains every tiles)

mainFrame.setLayout(new GridLayout(tiles.size() / 2, 2, 5,5));
    JLabel tilePanel;

    for (int i = 0; i < tiles.size() ; i++) {
        tilePanel = new JLabel();
        tilePanel.setIcon(tiles.get(i));
        mainFrame.add(tilePanel);
    }

Here's what I have:

However, I want to be able to click on these JLabels to be selected and so that I can use a function like getSelectedTile in my main JFrame to place them on the Map. But adding a mouseListener/Event to each and every JLabel doesn't seem right.

My questions are:

Am I going the right way? If so, how should listen to my JLabels to know which tile is selected.
What SHOULD I use if this isn't the way to go?

Thanks in advance! All suggestions will be taken into consideration :)

sentences:
Things not appearing in front of canvas (follow up) Follow up/related question to: Things disappear in front of Canvas

I'm having a very similar problem, where things are not appearing in front of my canvas. This time a particle system. I have tried the suggestions outlined in my previous questions (which worked then) but this time none of them will work:

You can see that the particle system is on top of the children and also I have added a canvas and overwritten sorting (the two suggestions in my previous post) yet the particles are not visible in front of the canvas.

sentences:
Technique to find a mesh intersecting with a primitive solid without using colliders? For what it's worth I'm using Unity3d, but I believe the problem is more general.

There are hundreds if not thousands of meshes with hundreds of vertices each.
There is one sphere that can be intersecting any of those meshes and is constantly moving.

Are AABB colliders approximating the mesh's volume the best way to go about this? Or is there a more specific technique that can be used here?

(A limitation I have is that my colliders need to be rotated, so they're each stored in a game object, so the number of game objects becomes absurdly large for my meshes(tens of thousands) which is slowing down my game.)

I have a couple of properties unique to my situation I believe might allow me to ditch colliders:

I don't care about the meshes colliding with each other. Just the one sphere.
I only need to know that the intersection exists, I don't care about the point of the intersection or any other metadata. Just a boolean of the intersection occuring and what mesh it happened with.
I don't need to know the exact moment/frame when the intersection occurs. If I can find out an intersection occurred within 100-200ms/20-30 frames of it happening it'll be fine.

sentences:
Determining if a point is perpendicular to a line I am trying to walk a line that is intersecting a mesh, and given the point on the line I need to see what vertices may be perpendicular to it. My initial idea was to attempt a dot product between the line's direction vector and the direction vector from the point on the line to the mesh's vertex, and then only accept values that were near 0. This resulted in a collection of vertices behind the point on my line. Playing with the threshold values for the dot product check do not seem to help either. Any ideas?

Code

//actual_pos = position of the vertex
//trav_in_soace = point along the line
//m_fireDir = normalized direction vector of the line

Vector3 dir_to_point = actual_pos - trav_in_space;
dir_to_point.Normalize();

float dot_accept = DotProduct(m_fireDir, dir_to_point);
if (dot_accept > max_threshold || dot_accept < min_threshold)
    continue;

Picture with threshold values near 0.5

This is best result I can get and it is still really inaccurate. The orange verts are the points on the purple line, the red and blue are what should be the desired vertices.

sentences: What is the purpose of these purple images in these sprite files of Super Mario Maker? I was looking at the Wii U's Super Mario Maker Sprites and noted that all of them have purple images that each correspond to one of the animation frames (see below). What could they have been used for? Why not simply using the finished colored ones?

sentences:
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:
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 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:
What's wrong with using a static class to load and expose all of my assets? What are the pitfalls associated with loading and storing all references to all of your content/assets within a single static class?

I've been trying to ask myself why I would want to instantiate an assets bank and can not think of a good reason to do so.

I have made a static class which enumerates through my game assets and adds each one to a dictionary which I can access (safely exposed, of course) anywhere like so:

var tex = Assets.Image("folder\\easyaspie");
spriteBatch.DrawString(Assets.Font("font2"), new Vector2(100, 100), Color.White);

... you get the picture.

I appreciate that this gets much more complicated when you have so many assets that having them all loaded at once is not a good idea. However, there is nothing to stop you from including selective loading of assets in your static class, as well as having static methods to change the contents of the 'reference banks'.

What do you think?

Edit:

My examples are pretty shallow, I recognise it's not a good idea to attempt to grab the reference of an asset mid-draw and is much better stored locally.

sentences:
Where can I find affordable legal advice for game software related inquiries? I am working on simulation middleware which is applicable for game engine implementations.

What I would like to do is to make it freely available for use for all non-commercial purposes, while at the same time imposing some percentage of royalty on revenue (above a certain threshold) that is derived from my work. Something very similar to Epic's UDK licensing model.

To facilitate the use of my software, I plan to offer binaries (static libs) for several platforms, as well as obfuscated source code which I will freely distribute, in addition to documentation of the API. I simply want to impose the restriction that if you try to make money from it, I get a cut eventually.

I'm wondering if there are online forums and such where I am likely to find people who are willing to assist me in terms of learning what sort of things I have to do to get things down on the right kinds of documents. So far a site like this seems to be the most promising.

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:
Crash when creating RenderTargetViews for Cubemap I want to create a cubemap and I want to render to it and later sample from it for reflections.
However, It crashes when I try to create the faces for the cubemap.
Here is my code:
RenderTargetCube::RenderTargetCube(ID3D11Device* device, int resolution, DXGI_FORMAT format) {

    D3D11_TEXTURE2D_DESC desc = {};
    desc.Width = resolution;
    desc.Height = resolution;
    desc.MipLevels = 1;
    desc.ArraySize = 6;
    desc.Format = format;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.Usage = D3D11_USAGE_DEFAULT;
    desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;

    HRESULT res = device->CreateTexture2D(&desc, NULL, &Texture);
    throwIfFailed(res);

    D3D11_RENDER_TARGET_VIEW_DESC viewDesc = {};
    viewDesc.Format = desc.Format;
    viewDesc.Texture2DArray.ArraySize = 6;
    viewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
    for (int i = 0; i < 6; i++) {
        viewDesc.Texture2DArray.FirstArraySlice = D3D11CalcSubresource(0, i, 1);
        res = device->CreateRenderTargetView(Texture.Get(), &viewDesc, RenderTargetView[i].GetAddressOf()); // crash here
        throwIfFailed(res);

    }

and here is the message I receive:

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: The Dimensions of the View are invalid due to at least one of the following conditions. MipSlice (value = 0) must be between 0 and MipLevels-1 of the Texture Resource, 0, inclusively. FirstArraySlice (value = 1) must be between 0 and ArraySize-1 of the Texture Resource, 5, inclusively. With the current FirstArraySlice, ArraySize (value = 6) must be between 1 and 5, inclusively, or -1 to default to all slices from FirstArraySlice, in order that the View fit on the Texture. [ STATE_CREATION ERROR #137: CREATERENDERTARGETVIEW_INVALIDDIMENSIONS]

I dont quite understand the error message, especially the last part about ArraySize, why does it want it to be between 1 and 5 and not 0 to 5?

sentences:
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:
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:
Multi-textured Terrain? How would I accomplish multi-textured terrain? I need to know how to write the HLSL shader for it. The world already UV maps itself and I can get it to do 1 texture at a time. But I want more than 1 texture being displayed on my screen.

Here is my vertex declaration.

D3DVERTEXELEMENT9 Decl[] =
    {
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_POSITION,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            1
        },
        D3DDECL_END()
    };

I am also using D3DFVF_XYZ and D3DFVF_TEX2

My variables for for each vertex are X, Y, Z, U1, V1, W1, U2, V2, W2

sentences:
When learning, nothing is better than practice A little introduction:

I'm 25, and going to this private french school, CreaJeux, which begins in october. I will be learning mostly game programming, something I wanted to do a long time ago, since the day I wondered how were 3d graphics working on my playstation, when I was 14 or so.

I'm very eager and impatient to begin, and I can't think on anything else (I'm bored), I feel like I'm wasting my time doing nothing, and I wanted to just practice on something during my spare-time, whatever it is.

I'm not a beginner in C/C++, I know how to program, but I didn't make a lot of stuff excepy a little tetris-like with pygame: I just want to make something in 3D, even if it awful and plain ugly, non-accelerated or whatever.

Isn't there anything else than open source 3D engines like irrlicht, panda3d or ogre3d to start something ? Isn't there some game dedicated to modding or dedicated to educate begginners ? Or some projects or practices for begginners like me ? Even simple and ugly 3D seems hard to come by...

sentences:
How do I eliminate black bar artifacts in AndEngine/TMX plugin? I used AndEngine gles1 along with the tmx plugin to generate my background maps.  The image width is not fit to my virtual device, so I increased the tmx image size. Here is my code for the camera width and Camera Height:

CAMERA_HEIGHT = 320;
final DisplayMetrics displayMetrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
float aspectRatio = (float) displayMetrics.widthPixels / (float) displayMetrics.heightPixels;
CAMERA_WIDTH = Math.round(aspectRatio * CAMERA_HEIGHT);

But it shows me black bars as follows:

sentences:
How can I detect and hide faces inside an object when combining two or more meshes? I am trying to make a game where the player can make vehicles out of parts. To apply proper physics to the vehicles, like drag and buoyancy, I would like to get the outer hull of the various parts placed in arbitrary positions, scalings, and rotations. The hull will most likely be concave, not convex.
How can I detect which faces (or parts of faces) would be on the interior of the vehicle so I can ignore them? Or alternatively, which faces are not on the interior of the vehicle and therefore make up the outer hull?
Some use cases that I am trying to handle are:

Two cubes placed right next to each other, like in a grid.

Two cubes placed next to each other, but of different sizes

A cube and a sphere (or other shape) overlapping each other.

One method that I have tried but not yet got to work is to voxelize the parts using raycasting or SDFs and then using marching cubes or dual contouring to make the hull mesh. That has issues when there are sharp angles and it can create a lot of triangles, a lot more than the original mesh. Are there other methods that I should try?
Can binary space partitioning (BSP) or a k-d tree be used for this or is that the wrong approach?
I am working in Unity / C#, but can translate from other languages.

sentences: Who know how to implement the 2D bone animation showed in the game? I wonder how do they implement the bone animation in the flash game http://www.foddy.net/athletics.swf Do you know any study materials which I can start to learn 2D bone system from? I just implemented a avatar system by compose multiple bitmaps in each frame(similar with maple story), but some guys tell me that, a bone system can save more art resources, so I want to learn some thing about that.

sentences:
How do I pass arguments to an XNA Game executable? How do for example make it possible to pass an argument to the .exe file and read it in my XNA Game?

Examples:

Enable Editor:

game.exe -devmode

Set Resolution:

game.exe -width 1280 -height 720

and in the game check the arguments before starting the game.  I searched for this earlier and thought about it again but found nothing about it.

sentences: Will changing app name in iOS app store affect/reset app ranking? I want to change the name of my app but was wondering if that would change/affect/reset the ranking it already has. Anyone know?

sentences:
How to fill with empty space with retangles I have a 'square' class with the representation of its limits from the variables x1, y1 and x2, y1 these variables define points 1 and 3 of the same, in this case the coordinates would be (0,0), (10, - 10):

From this drawing I want to insert rectangular areas, also defined through x1, y1, x2, y2 coordinates, within that area. In this example case I will use the following values (input):
area1 = (0,0)(3,-3),
area2 =  (4,-2)(6,-4),
area3 =  (8,-1)(10,-4),
area4 =  (1,-5)(6,-7),
area5 =  (7,-6)(9,-9)

How to obtain a function from there that returns the rectangles (coordinates) of the largest possible areas within the remaining empty areas and not occupied within the main square, as shown in the visual representation?

Notice, the output of the function in this case should be:
outputArea1 = (3,0)(8,-2),
outputArea2 = (8,0)(10,-1),
outputArea3 = (3,0)(4,-3),
outputArea4 = (6,-2)(8,-4),
outputArea5 = (6,-4)(10,-6),
outputArea6 = (0,-5)(1,-7),
outputArea7 = (6,-6)(7,-7),
outputArea8 = (9,-6)(10,-10),
outputArea9 = (0,-7)(7,-10),
outputArea10 = (7, -7)(9,-9),
outputArea11 = (7,-8)(9,-10)
The following code demonstrates the implementation without the requested function:
class Retangle {

borderLimitX1 = 0;
borderLimitX2 = 10;
borderLimitY1 = 0;
borderLimitX2 = -10;

static void Main() {

    List < Retangle > areas = new List < Retangle > ();

    ///areas.Add(x1,x2,y1,y2)

    areas.Add(0, 0, 3, -3);
    areas.Add(4, -2, 6, -4);
    areas.Add(8, -1, 10, -4);
    areas.Add(1, -5, 6, -7);
    areas.Add(7, -6, 9, -9);

    List < Retangle > remainingAreas = CalculateRemainingAreas(areas);

}

List < Retangle > CalculateRemainingAreas(List < Retangle > originalAreas) {

    List < Retangle > remainingAreas = new List < Retangle > ();

    ///// --> Algorithm to calculate Remaining Areas   <-- ///

    return remainingAreas;
}
}

  internal class Retangle {
int x1,
y1;
int x2,
y2;

Retangle(int x1, int y1, int x2, int y2) {
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
}

}

sentences:
Synchronization between game logic thread and rendering thread How does one separate game logic and rendering? I know there seem to already be questions on here asking exactly that but the answers are not satisfactory to me.

From what I understand so far the point of separating them into different threads is so that game logic can start running for the next tick immediately instead of waiting for the next vsync where rendering finally returns from the swapbuffer call its been blocking on.

But specifically what data structures are used to prevent race conditions between the game logic thread and the rendering thread. Presumably the rendering thread needs access to various variables to figure out what to draw, but game logic could be updating these same variables.

Is there a de facto standard technique for handling this problem. Maybe like copy the data needed by the rendering thread after every execution of the game logic. Whatever the solution is will the overhead of synchronization or whatever be less than just running everything single threaded?

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:
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:
"exception at 0x53C227FF (msvcr110d.dll)" with SOIL library I'm creating a game in C++ using OpenGL, and decided to go with the SOIL library for image loading, as I have used it in the past to great effect. The problem is, in my newest game, trying to load an image with SOIL throws the following runtime error:

This error points to this part:

// SOIL.c
int query_NPOT_capability( void )
{
/*  check for the capability    */
if( has_NPOT_capability == SOIL_CAPABILITY_UNKNOWN )
{
    /*  we haven't yet checked for the capability, do so    */
    if(
        (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),
            "GL_ARB_texture_non_power_of_two" ) )
        ) //############ it points here ############//
    {
        /*  not there, flag the failure */
        has_NPOT_capability = SOIL_CAPABILITY_NONE;
    } else
    {
        /*  it's there! */
        has_NPOT_capability = SOIL_CAPABILITY_PRESENT;
    }
}
/*  let the user know if we can do non-power-of-two textures or not */
return has_NPOT_capability;
}

Since it points to the line where SOIL tries to access the OpenGL extensions, I think that for some reason SOIL is trying to load the texture before an OpenGL context is created. The problem is, I've gone through the entire solution, and there is only one place where SOIL has to load a texture, and it happens long after the OpenGL context is created.

This is the part where it loads the texture...

   //Init glfw
if (!glfwInit())
{
    fprintf(stderr, "GLFW Initialization has failed!\n");
    exit(EXIT_FAILURE);
}
printf("GLFW Initialized.\n");

//Process the command line arguments
processCmdArgs(argc, argv);

//Create the window
glfwWindowHint(GLFW_SAMPLES, g_aaSamples);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
g_mainWindow = glfwCreateWindow(g_screenWidth, g_screenHeight, "Voxel Shipyard", g_fullScreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
if (!g_mainWindow)
{
    fprintf(stderr, "Could not create GLFW window!\n");
    closeOGL();
    exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(g_mainWindow);
printf("Window and OpenGL rendering context created.\n");

//Create the internal rendering components
prepareScreen();

//Init glew
glewExperimental = GL_TRUE;
int err = glewInit();
if (err != GLEW_OK)
{
    fprintf(stderr, "GLEW initialization failed!\n");
    fprintf(stderr, "%s\n", glewGetErrorString(err));
    closeOGL();
    exit(EXIT_FAILURE);
}
printf("GLEW initialized.\n"); <-- Sucessfully creates an OpenGL context

//Initialize the app
g_app = new App();
g_app->PreInit();
g_app->Init();
g_app->PostInit(); <-- Loads the texture (after the context is created)

...and debug printing to the console CONFIRMS that the OpenGL context was created before the texture loading was attempted.

So my question is if anyone is familiar with this specific error, or knows if there is a specific instance as to why SOIL would think OpenGL isn't initialized yet.

sentences:
What does `FPSManager.lastticks` stand for in SDL_gfx? I'm having trouble finding documentation on SDL_gfx, and I can't figure this out. I've managed to use SDL_gfx to automatically cap the framerate, and I it's working a lot better than my manual attempt (combining SDL_Delay and SDL_Getticks).

Now I've been trying to learn more about it, and I stumbled onto something.
Here's the whole struct:

typedef struct {
             Uint32 framecount;
             float rateticks;
             Uint32 lastticks;
             Uint32 rate;
     } FPSmanager;

Most variables in this struct are pretty straightforward, but I have no idea of what lastticks stands for. Does anyone know?

sentences:
Calculating the winding and normal when programatically adding triangles to a mesh I'm writing a program that takes a 2D planar polygon and extrudes it to a 3D mesh with a given height. I identify triangle edges that are borders of the polygon and now I'm trying to automatically compute the two triangles required for the extrusion of the border. However, I'm stuck at how to compute the correct winding and normals

My start situation is this: I have the two coordinates of the edge (marked in white) and the normal of the original triangle (marked in orange)

Using this information I'm trying to compute two triangles which should result in:

The 4 vertices are easy to compute (just the two vertices of the edge and two more at a different height). The normal should be perpendicular to the original normal but to do that I need a second reference point. It doesn't seem to be as simple as using the centroid of the triangle.

The triangle winding confuses me. I need a counter-clockwise winding and I guess I could determine which vertices to use based on the normal but how is not immediately apparent to me.

sentences:
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:
Commonizing cycle time across different browsers for HTML5 Is there a good (accepted) method for "fixing" the cycle time within an HTML5 canvas game implementation?

The game that I have been working on runs far quicker in Google Chrome than in other browsers such as Firefox, Opera, or IE9.  To be honest, it kind of reminds me of running a game from the early 90's on a brand new machine.

sentences:
Implementing unlockable items on Android I know this would be a beginners question (some of you might think) but I would like to know different approaches for this.

I have a game with lets say 20 unlockable items, at the main menu I have a button where the user can go to an activity and view the unlockable items. So I would like for it to have a "Locked image" and under it a text telling you what the item is and maybe how to unlock it.

What is the best way of going about this?

And then when the item is unlocked during the game, maybe put a variable in the shared preference and check at the beginning of the activity with the unlockabled items.

Let me know what you guys think. Thanks.

sentences:
Why does adding a value to list makes list not editable in unity inspector I am adding elements from the first list to another similar list, but it makes first not editable in the Unity Inspector. Whenever I try to change values from the inspector it makes them again 0. While If I comment list.Add() I can change values in the inspector.

[Serializable]
public class Characterz
{
  public string Name;
  public int Age;
  public float Gold;
}

public class Actor: MonoBehaviour
{
     public List<Characterz> kings=  new List<Characterz>();

    public List<Characterz> Actors = new List<Characterz>();

     void Start()
     {
        for (int y = 0; y < 30; y++)
         {
             Actors.Add(new Characterz());
             if (y < 4)
             {

                 //I need to comment following line to change Actors
                // list value in editor
                 kings.Add(Actors[y]);
             }

         }
      }

}

sentences:
LibGDX: Problems with Button Listener in a Dialog I'm developing a game where the player has an inventory, and you can find chests in the map with items which you can collect, so I created a class that extends from Dialog to show both item lists, player's inventory and chest's inventory, just like this:

private class InventoryDialog extends Dialog{
    public InventoryDialog(boolean isPlayerInventory, Inventory inventory) {
        super(isPlayerInventory? "Inventory":"Chest", mySkin);

        final List inventoryList = new List(mySkin);
        inventoryList.setItems(inventory.getItems());
        ScrollPane pane = new ScrollPane(inventoryList,mySkin);
        getContentTable().add(pane).size(myDimensions);
        button("Back");

        if(isPlayerInventory){
            button("Use").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().useItemAt(inventoryList.getSelectedIndex());

                }});
        }else{
            button("Get").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().add(inventory.remove(inventoryList.getSelectedIndex()));
                }});}

    }

}

So they will use or get the item only if they click that button.

My problem is that the get/use listener is always invoked even if the clicked button is the "Back" button, what am I doing wrong? :/

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:
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:
One big spritesheet vs many smaller spritesheets? I have my 2D character animations which are stored in spritesheets. I have individual sprite sheet for every animation. For example, if my character have animations for idle, run and jump, I have 3 different spritesheets.

Is it good way for managing 2D animations or it's better to store all animations in one big spritesheet? I noticed that many old games animations are stored in one big spritesheet - is it the best way?

sentences:
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:
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 do I use the morpher modifier in 3dsmax to morph into several targets simultaneously? I have a 3D-Face from Facegen here including all necessary phenomes' positions. But these targets are separated into upper, lower teeth, sock and eyes. How do I combine them for the face to morph into each facial position at once?

sentences:
Problem modifying GameObject in list of GameObjects Unity So I've been working on a little project that involves Valve's "Portal" style portals, the type where you can seamlessly see what's on the other side and walk through. I've run into a problem when it comes to teleporting an object to it's new location upon hitting the portal. I have a List<GameObject> that contains all the objects that are in close enough range to feasibly travel through the portal, but when I try to modify the transform.position of one of these GameObjects, nothing happens, no error messages.
So I've been going through my script line by line and writing little dummy functions to test different parts of it to see where the problem lies, and everything seems to work up until I index the list and try to modify a value, nothing happens. So was thinking that perhaps the List doesn't actually contain a reference to the GameObject in the scene, but simply a copy of the GameObject's data at the time it was passed into the list. So I checked this by making the list public so that I see it in the inspector, and when I click on an item in the list it highlights that same GameObject in the hierarchy, which suggests it is actually a reference. See bellow...

I am at a loss as to what's happening here and would really appreciate if anyone could offer a suggestion, Here is the dummy function where I try to arbitrarily modify the GameObject data from the List...
        if (Input.GetKeyDown("k"))
        {
            for (int i = 0; i < trackedTravelersObjects.Count; i++)
            {
                trackedTravelersObjects[i].transform.position += new Vector3(0, 30, 0);
                Debug.Log("K");
            }
        }

You'll notice a Debug.Log("k"), this is just to check that the code is actually being called, which it is.
Thanks.

sentences: C++ - Lua Preventing malicious lua code Im working on a "game" that uses lua for scripting and i plan on making it very mod-able. However, malicious code can be written without much difficulty in lua... So how can i go about stopping that? I could block certain functions, but that wouldn't be nice for the modders and those who really want to will find another way.

sentences: Getting angle from current position and next position I am using pathfinding to move a train along rails, but I need the train to rotate. I have the next intended position and the current position at my disposal, how would I go about this? Pseudocode will do as an answer since I am using a specialized programming language for the engine that I use.

sentences:
How do I make a sprite appear to sway with the wind? I'm trying to find a method to simulate the effects of wind on various sprites in a side-view 2D scene. What relatively simple technique could I use for this?

What I have in mind is to give these sprites a "spring" effect that I could hand a force that rotates them in a specific direction and eventually degrade the force and bring the sprite back to its "resting" rotation over time with a little bit of rebound/wobble/sway... I don't understand how I can mathematically create the elastic/spring effect using rotation, taking into account things like mass, resistance, or stiffness. How would I go about doing this in code?  It doesn't have to be super realistic.

I'm hoping to set up a global wind variable that gets applied to sprites starting on one side of the screen and making its way to the other to look like a gust of wind passed through. I should be able to accomplish this once I have a method for applying a wind force to a single sprite.

How can I do this?

sentences:
Checkerboard like rendering does not save performance I have a simple scene in Unity with a camera and a quad facing the camera filling the whole viewrect.
The quad has a material with the following shader:
Shader "Skip"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                float4 screenPos : TEXCOORD0;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.screenPos = ComputeScreenPos(o.vertex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                int2 screenUV = (i.screenPos.xy / i.screenPos.w) *_ScreenParams;
                bool skip = (screenUV.x + screenUV.y) % 2 == 0;
                if (skip) {
                    return fixed4(1,0,0,1);
                }else{
                    fixed4 clr = fixed4(0,0,1,1);
                    for (int i = 0; i < 10000; i++)
                    {
                        clr += i % 2 -0.5;
                    }
                    return clr;
                }
            }
            ENDCG
        }
    }
}

The shader returns simple color for an even pixel and runs an expensive computation for an odd pixel.
There is no performance difference between running the expensive operation on all the pixels and running it on just half the pixels.
bool skip = (screenUV.x + screenUV.y) % 2 == 0; // ~13fps
bool skip = true; // ~2300fps
bool skip = false; // ~13fps

Why is there no improvement in performance?

sentences:
Recognize pattern in 3D building environment I'm currently developing 3rd person building game (as bacheleor thesis). I need to recognize constructed patterns co I can mark corresponding structure as some building (so player can start using that building).

I have folowing rules:

3 types of building blocks (all based on cube) (and in future there will be more types)
any block can be scaled up to k multiple in each axis (k = 20)
blocks can be rotated by any axis (but stays in 3D grid)

  Problem definition:
  4 cubes of base size (1,1,1) in a grid 2x2 should be equivalent to 1
  box size (2,2,1), so all possible variants (mainly different in rotation) could be evaluated as valid pattern construction.

I expect that my patterns will be up to 30x30x30 multiple of base size.

For example, I'd like to recognize structure like this: (currently placed in level by hand)

Size is 21x21x22 and it is constructed from multiple objects.

As a limitation, I will border pattern search from exact point (lets say control console for that structure). Current limitation constant is around 50x50x50 multiple of base cube. (Limit is subject to change based on answers here.)

I searched over 20hrs and result was only papers to recognize 3D structure from 2D image or recognize exact structure in 2D.

  My problem is that with growing K( each X,Y,Z) there is exponencially growing number of structures, which should be accepted as correct pattern construction.

  Question: What algorithm (+ heurestic) should I use?

EDIT: following 3 images contains visualization of structures, that are considered as correct variant of pattern at image 4, thus they should be found and accepted.

All together has same final shape (and has same material at same places). I simplified the problem only to 2D shape, but extending in 3D space is obvious.

Thank you for all answers / comments.

sentences:
Should recoil be an animation or script? Should recoil for a rapid fire gun be be done through an animation or a script? I want the recoil to increase as I continuously fire, like a lot of FPS games do.
I was initially considering achieving this through a script in unity that rotates the gun slightly each time I fire, but I realized that since I plan to have most rapid fire guns be 2 handed weapons, at some point, the left hand won't be on the weapon.
However, since I also want the recoil to increase as I fire, I'm not sure how I can achieve this in an animation.
How is recoil typically done? Input on this would be very much appreciated.

sentences:
Internationalization (i18n) in Flash games? Is there an easy way? I want to internationalize some texts in a flash (not flex) game I'm working on and I can not find an easy way to achieve that... I have found some libraries and other solutions, but I expected something a lot easier (it is really easy with other technologies).

Do you have experience in this? How do you do it?

sentences:
XNA 4: RenderTarget2D textures getting transparent on fullscreen I'm generating a Texture2D object using RenderTarget2D as in the following code

public static Texture2D GetTextTexture(string text, Vector2 position, SpriteFont font, Color foreColor, Color backColor, Texture2D background=null)
{
            int width = (int)font.MeasureString(text).X;
            int height = (int)font.MeasureString(text).Y;

            GraphicsDevice device = Settings.game.GraphicsDevice;
            SpriteBatch spriteBatch = Settings.game.spriteBatch;

            RenderTarget2D renderTarget = new RenderTarget2D(device, width,
            height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8,
            device.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents);

            device.SetRenderTarget(renderTarget);
                device.Clear(backColor);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
                if (background != null) spriteBatch.Draw(background, new Rectangle(0, 0, 70, 70), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
                spriteBatch.DrawString(font, text, position, foreColor, 0, new Vector2(0), 0.8f, SpriteEffects.None, 0);
                spriteBatch.End();
            device.SetRenderTarget(null);
            ResetGraphicsDeviceSettings();
            return (Texture2D)renderTarget;
}

It's working all fine. But when I ToggleFullScreen() (and vice-versa), the previous textures are getting transparent. However, the new textures after that are being generated correctly.

What can be the reason for this?

sentences:
XNA: weird collision behaviour I'm reading the book "Learining XNA 4.0", and I'm in the object oriented disgn part. I'm having a weird problem with the collision of 2 rectangles.

I have a list of automateSprite and a Player class both derived from the class Sprite. in the update method im checking if player and the aotomatedSprite rectangles are touching each other, now when I go over the list I have a string called touching that represent the collision.

My problem is the variable touching only changes if the player Sprite touches the last automateSprite in the list.

The code that the book offers for testing is to do Game.Exit() if any collision was found. that work on every automatedSprite in the list, but when I change it to my simple test, it acts like I only check the last item from a list of 4 automatedSprite.

Here is the code:

string touching = "";
public override void Update(GameTime gameTime)
{
    // TODO: Add your update code here
    player.Update(gameTime, Game.Window.ClientBounds);

    foreach (Sprite sprite in spriteList)
    {
        sprite.Update(gameTime, Game.Window.ClientBounds);
        if (sprite.collisionRect.Intersects(player.collisionRect))
            touching = "touching";
        else
            touching = "not touching";
    }

    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

    spriteBatch.DrawString(font, touching, Vector2.Zero, Color.Red);

    player.Draw(gameTime, spriteBatch);
    foreach (Sprite sprite in spriteList)
    {
        sprite.Draw(gameTime, spriteBatch);

    }

    spriteBatch.End();
    base.Draw(gameTime);
}

(sorry for my English)

sentences:
Camera LookAt position with fixed screen position I have a perspective "lookAt-type" camera. I'm trying to compute specific focus point of the camera, which should be placed in the middle of the screen: I also have a custom 3d point in world space, margin values in screen space and camera's tilt as inputs. I want to compute lookAt point, & camera distance with restriction, that input world space point has to be visible in the middle of the free screen space area (not affected by margin values) and it has to have a given tilt.

I'm able to compute this in 2D, but I'm lost in 3D. Any idea how to achieve this? Here's a sketch of the problem, red and blue area's are margin values of 0.5f in both x and y direction.

sentences:
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:
Can I use fictional city/country names from public domain/fiction etc. in a potentially monetized browser game? I'm currently developing a browser game with a focus on economy, trading and industry. For that I'm building a fictional world with countries and cities. To avoid political drama within the games player interactions, I'd like to avoid using real countries that currently exist/are recognized. I tried to come up with several fictional country names, but I'm reaching the limitations of my creativity where they are still OK-sounding...
My questions are now...

Can I use fictional countries e.g. from movies/comics etc (e.g. Sokovia from the Marvel universe)? Maybe with slight adjustments?
Can I use older country or empire names (e.g. Babylonia)? Maybe also with slight adjustments.
Can I use city names from the real world? I need a lot of them, so coming up with thousands brings me to my limit and there may probably be overlaps without me knowing. Based on the following question that should be fine, also since they have nothing to do with the real-life equivalents. Do I need licensing to use real city names in my game?
What about using planet or galaxy names which are public domain (or how are they protected, if at all)?

I found some generators in the internet which are helpful to a certain degree, but I'd rather write my own to be honest.
Since the game might be monetized, are there any licensing issues involved? I'm pretty new to this from a legal perspective.

Another thing are the fictional company names the users can choose. I guess I can set certain restrictions there to exclude real world companies and provide a "report" button for real companies to request the removal/change to be on the safe side.

Thanks in advance

PS: Since I also needed flags, I already found a nice generator, in case someone is interested:
https://www.reddit.com/r/vexillology/comments/4ha19q/flagmaker_20/?st=jb6e4qyk&sh=c1544079

sentences:
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:
How can I fine-tune my movement values in a 2D block-based platformer? I'm wondering how I can refine player movement/physics values, such as speed and jump height, to make it all work, while allowing the games to be fair and challenging. Is it simply trial and error, or is there a more standardized solution?

The levels in games like Super Mario or Geometry Dash are built on uniformly sized blocks, so the movement values need to work with these blocks. For example, if Mario can only jump 5 blocks high, the developers need to ensure that no obstacle is greater than 5 blocks tall (unless Mario has some special ability, but I'm not talking about that), or the player will be stuck.

Similarly, if the developers know that Mario can only jump 6.5 blocks horizontally, a blockless pit should be, at most, 6 blocks long. Knowing these relationships would allow one to create beatable levels, and even dynamically generate obstacles for the player to traverse.

I already have a character controller that can set my movement values easily, but I'm struggling to figure out a good way to make my movement and block sizes work together. Specifically, I'm concerned about making my game too easy or hard. How do I know when I've struck a proper balance?

sentences:
How can I simulate these two droplet? Below is a two droplet merging together,in 2d.
I want to simulate the behavior when I exert combination force(through mouse or fling force on touch screen) on one of them to
make them to be a larger droplet.
I suppose there exists some kind of function by the distance of these two droplet's center,when the distance is closer,one becomes smaller,the other one becomes larger.
What kind of model should I build? Particles or geometry circles or sth else?

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:
Unity3D profiler isn't helping. How to debug increased memory? Using Instruments or Xcode, my iOS game uses around 115 MB memory when the menu scene is loaded. After doing battles and other things within the game and reloading the menu, the memory usage is up to 170 MB.

The real problem is that Unity's profiler doesn't tell me anything: there are a few MB of extra system libraries and a few MB of extra Texture2D assets, but there's no explanation for the big increase. Adding more Resources.UnloadUnusedAssets() and GC.Collect() doesn't help.

How can I investigate this? (Note: it reaches a steady state. The memory doesn't continue to rise after a certain point.)

sentences:
Referencing individual cells of a tilemap and changing texture I have a tilemap and am trying to proceduraly generate islands on it by changing the texture of the tiles and marking it as land ( I want to do this without texture atlas for now). How do you change the texture of an individual tile and how do you mark the tile to distinguish it from other tiles within map as land . I have tried to do this but for some reason even though I reference an individual tile all tiles are changing textures.

private static TiledMapTileLayer baseLayer;
private static TextureRegion landTextureReg;
private static Texture landTexture;
private static TiledMapTile landTile;

public static TiledMap generateMap(){
landTexture = new Texture(Gdx.files.internal("hex_land_trans.png"));
landTextureReg = new TextureRegion(landTexture);
TiledMap map = new TmxMapLoader().load("ocean_hex_map.tmx");
baseLayer = (TiledMapTileLayer)map.getLayers().get(0);
baseLayer.getCell(1, 1).getTile().setTextureRegion(landTextureReg);
return map;
}

sentences:
How to learn game development when i understand the concepts but don`t know how to implement? I have a basic level of programming knowledge, gained trough high-school classes and personal interest and also understand certain game design patterns like game loops, collision detection etc.

My problem is, i don`t understand how to get started with making games without falling in a gap, between tutorials that just cover the basics, that i already know and understand and tutorials that are to complicated for me.

For example, today i got a little gameloop and implemented a graphical output. Than, when i tried to implement a buffer i failed, because i simply didn`t understood where to put it in my existing system.

What would you recommend someone in my situation ? Should i start from zero or are there other certain techniques for learning ?

sentences:
Inventory View Screen Looking to create an inventory screen in Unity, and trying to think of the best way to do it.

My current line of thinking is having a few rows of squares for inventory items that are drag and droppable onto a paperdoll, a la Diablo.  When dragging and dropping on the items, it would update a 3D model of your current playable object with the items.

The menu itself would be easy enough to do with a simple square and a hierarchy of game objects for the items, each responding to mouse hovering over.

The problem I am trying to figure out is being able to render the 3D model on the side.  Granted, this is a nice to have, and not necessarily a need, but browsing the documentation, the only way I can think of accomplishing this is using a render to texture which requires Unity Pro with a separate camera completely out of bounds of the current space.

Anyone have suggestions on how to accomplish this?

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:
Directly pass from transform feedback buffer to fragment shader I am building terrain using a lod algorithm and deferred cascaded shadowmaps. The tessellated terrain is about 6,000,000 triangles. I tried this using 2 methods.

1st method: Both the deferred shadow program and the drawing program use tessellation shaders to tessellate the terrain. The tessellation stage for each program is exactly the same.

2nd method: I have 3 programs. The first program tessellates the terrain and stores it on the GPU using transform feedback. The second program uses the transform feedback buffer to render to shadow depth buffer. The third program uses the transform feedback buffer to draws the scene. This way I avoid tessellating the terrain twice.

To my surprise, the 2nd method was actually much slower until I started using the separation of the tessellation phase to tessellate the terrain less frequently. Now the methods are about the same fps, but in the 2nd method the terrain mesh is being updated less frequently.

Shouldnt the 2nd method be faster even if I tessellate every frame like the first method? The only thing I can think of is that the passthrough vertex shaders for the shadow and main program both have to copy 6,000,000*3 vertices even though they are just passthrough shaders. In the first method, the data would be passed right from tessellation shader to the fragment shader. So...

Does a passthrough vertex shader use the transform feedback buffer data directly, or does it copy every single vertice (even though it's the same), and use the copied data?

...
{
    out_position = in_position;
    out_normal = in_normal;
    out_uv = in_uv;
}

Is there any way I can speed this up?

Thanks in advance :)

Edit:

I should note that the example is for the shadow  program, the geometry shader applies different mvp matrices, culls, and asigns layers.

In the main program, I use
    gl_Position=mvp*in_position;
to allow gl to cull back facing triangles, but the normals and uvs are still passthrough.

sentences:
Using angle_difference to calculate shortest turn to target [Gamemaker] I've tried, but I cannot understand angle_difference.

I have an object, oTurretDetTurret, which turns to face its Target, which lies at the angle DirectionOfTarget from it.

It does this by updating its direction thus:

direction = direction + SpinDirection

SpinDirection can be either +3 or -3, meaning it can turn in either direction at a rate of 3 degrees per step.

What determines the direction it turns in is the angle between its current direction and the `DirectionToTarget. I want the turret to turn in the direction with the shortest number of degrees to travel.

I've been using this:

if angle_difference(direction, DirectionToTarget) > 0 {
direction = direction + 3
} else if angle_difference(direction, DirectionToTarget <= 0 {
direction = direction - 3
}

However, in game this just means that the turret faces the opposite direction to its target at all times, oscillating back and forth slightly.

In my understanding, angle_difference returns the smaller of the two angles between two directions.

For example, if the turret's direction is 300 degrees and the DirectionToTarget is 90 degrees, angle_difference should return +150, the smaller of the two angles, and thus my above code should move the turret counter-clockwise towards 90 degrees.

Can anybody help me?

sentences:
Calculating the latitude & longitude of a raycast hit point on a sphere I am working on a game where you look at a sphere and get the latitude and longitude of the position.

I get the position on the globe with a raycast along the direction the user is looking. Using this I pass the position and the radius into a method to get the correct latitude and longitude.

Problem

I don't believe my math is correct on this one and I am having some trouble figuring it out.

Code

void Update () {

    if (Physics.Raycast(transform.position, direction: transform.forward, hitInfo: out hit, maxDistance: range))
    {
        Vector3 pointHit = hit.point;
        radius = earth.GetComponent<SphereCollider>().radius;
        //radius = earth.GetComponentInChildren<Renderer>().bounds.extents.magnitude;
        FromVector3(pointHit, radius);
    }
}

public void FromVector3(Vector3 position, float sphereRadius)
{
    float lat = (float)(Math.Acos(position.y / sphereRadius));
    float lon = (float)Math.Atan(position.x / position.z);

    //convert from radians to degrees
    lat *= Mathf.Rad2Deg;
    lon *= Mathf.Rad2Deg;

    Debug.Log(lat + ", " + lon);
}

Output

My Output for latitude ranges from 89 to 90 and doesn't change very much

My Output for longitude ranges from -11 to 11

sentences:
AI pathfinding in mostly-free space I'm working in an action/strategy proyect. Consider it a RTS game. The game is in 2D (with LibGDX), and I have a lot of soldiers moving along. Now I have to implement the AI. Let me say some things about my current design:

The map has been constructed with tiles. However, I want to allow the soldiers to move in every direction -so using the tiles as graph for A* is not a good idea.
The obstacles are given by collision rectangles. Maps will have a lot of free space, and collision rectangles don't fit the tiles -that makes even worse the election of A* with tiles.
Waypoints, for the same reason, are not a good idea. I would need a very big net and soldiers would move in strange ways, as pointed out here: http://www.ai-blog.net/archives/000152.html
I've taken a look to the LibGDX-AI library. I would like to make soldiers follow the captain or use some kind of formation. Looks like this library is a good choice to make that.

Some things I know:

I also have read about potential/vector fields and navigation mesh. The fields look interesting, but I'm not sure of how to implement them for my case. They could be good for pahtfinding, but some soldier have to follow the captain and move in formation.
I think nav meshes won't solve my problem. As I've said, I have a lot of free space, and soldiers can move whatever they want, so the question "how to move the soldier inside the mesh?" remains.

QUESTIONS:

How to make a free-space AI pathfinding which avoid my collision rectangles?
How to make this compatible with formations like following the player across the map?
Is there any way to use LibGDX-AI to do this?

sentences:
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:
Should I include 3rd party libraries in my Plugin? I'm using Firebase services in a custom plugin that will be released later,
Should I include all 3rd party libraries like Firebase on the final plugin package or is there another way to handle this in unity ?

sentences:
Make a 2d top down game with round map Currently, I am making a top down game using Unity. Here is the problem that I’m trying to solve: The player in my game is always centered on the screen, and the since the map is rounded, the agents controlled by AI must acts and be shown base on the distance of the round map. Here is the sketch for the better explanation.

I want to ask for a good way to design and implementing the above task.

And here is my approach for this task:

I split the map into 4 areas (could be smaller and more in number).
Each of the 4 areas will have its corresponding area outside of the map area (The outside map areas are trigger boxes).
When the area that is covered by the main camera has its parts out of the map area, these outside parts will active the trigger boxes that are overlapped by them.
When a trigger box is activated, all the agents in its corresponding area inside the map will be moved temporally to the trigger box area. This can be done just by adding the difference between the trigger area position and the inside map area that the agent is staying to the agent’s position.
When the area that is covered by the main camera no longer overlap the trigger box, all the agent will move back to its corresponding position inside the map. This process is done by reversing the moving out process.

Here is the sketch for this.

And the flawless come when there are agents with the flocking or forming formation behavior that requires the agents to have connections with others. When an agent is moved out of it actual position, the other agents in the formation will lose their connection with the moved agent (Like the distance between them suddenly becomes large). I think that this could be somehow solved by storing the actual position of the agent and marking it as moved, but it may be too computational cost, or having too many cases.

I tried to think of a different approach, that the map border is a circle, and to show the round view is just needed to take the symmetric through the center of the map. However, the circular border shows a bad animation when the agents try to move through the border.
(I don't have enough reputation attach image about the flocking behavior problem and the circular approach, so you have to imagine it)

If you can solve the problems that I mentioned above or have a different approach, please show me. Thank you.

sentences:
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:
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:
Should device tilt give my object a starting speed or acceleration? I'm developing a game for iPhones, which have a body placed in the bottom center of the sreen, and I want to move that body in horizontal axis by player tilting his device in y axis.

Everything okay with that, but I want the body to move in a physical-credible manner.

I have a formula for a velocity of the body:

V[current] = V[previous_step] + acceleration * dt;

I don't understand (totally) a couple of things:

If user tilt a device, and we have a float value aTiltVector, that changes through -1 to 1, and gives us a magnitude and direction of a tilt, should I add this vector at beginning as an acceleration, or startup velocity? Should I add this value to the velocity of the body or its acceleration?
How should my body stop? If we give an initial velocity and acceleration, how should it stop if no other force is impacting our body? It would roll down to the edge of the screen then.
How do you typically achieve that behavior?

sentences:
Unity Giving following error : NullReferenceException: Object reference not set to an instance of an object im going to probably look really stupid and i will be no means admit this is my code however i cant seems to get it to work so i was wondering you you might be able to?

I'm getting the following error when trying to break a block with the left click button in unity:
"NullReferenceException: Object reference not set to an instance of an object
Player.Update () (at Assets/Scripts/Player.cs:67)"

the code that is causing the error is below:

if (Input.GetMouseButtonDown(0))
        {
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(mousePos, Vector2.zero);
            if (hit.collider.gameObject != null)
            {
                Destroy(hit.collider.gameObject);
            }
            else
            {
                Debug.Log("hit nothing");
            }
        }

i've searched around for other ways to do this and after many itterations i cant seem to get it working still so i have come to the forms.

Sorry line 67 is: Camera.main.ScreenToWorldPoint(Input.mousePosition);

i know it looks simular to other questions however i have looked at the link that was attached to this being a duplicate and i cant see anything in there that will help me so i am still stuck with the same issue.

sentences:
How to achieve hologram projection effect with head tracking I want to recreate this:
http://www.youtube.com/watch?v=9xMSGmjOZIg&feature=related

I can take care of tracking the user's head, and in one of the comments I believe the author says that he used a vertex shader to do the work, but what logic do you use to move the vertices to get this effect?

sentences:
Threads slowing down application and not working properly I'm making a software renderer which does per-polygon rasterization using a floating point digital differential analyzer algorithm. My idea was to create two threads for rasterization and have them work like so: one thread draws each even scanline in a polygon and the other thread draws each odd scanline, and they both start working at the same time, but the main application waits for both of them to finish and then pauses them before continuing with other computations.

As this is the first time I'm making a threaded application, I'm not sure if the following method for thread synchronization is correct:

First of all, I use two global variables to control the two threads, if a global variable is set to 1, that means the thread can start working, otherwise it must not work. This is checked by the thread running an infinite loop and if it detects that the global variable has changed its value, it does its job and then sets the variable back to 0 again. The main program also uses an empty while to check when both variables become 0 after setting them to 1.

Second, each thread is assigned a global structure which contains information about the triangle that is about to be rasterized. The structures are filled in by the main program before setting the global variables to 1.

My dilemma is that, while this process works under some conditions, it slows down the program considerably, and also it fails to run properly when compiled for Release in Visual Studio, or when compiled with any sort of -O optimization with gcc (i.e. nothing on screen, even SEGFAULTs). The program isn't much faster by default without threads, which you can see for yourself by commenting out the #define THREADS directive, but if I apply optimizations, it becomes much faster (especially with gcc -Ofast -march=native).

N.B. It might not compile with gcc because of fscanf_s calls, but you can replace those with the usual fscanf, if you wish to use gcc.

Because there is a lot of code, too much for here or pastebin, I created a git repository where you can view it.

My questions are:

Why does adding these two threads slow down my application?
Why doesn't it work when compiling for Release or with optimizations?
Can I speed up the application with threads?
If so, how?

Thanks in advance.

sentences:
Is JavaScript viable for serious multiplatform 2D game development? Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn this into a career.

I would like to develop strategy games like "Stronghold" and "Age of Empires".

The problem is that my language of choice is JavaScript.

sentences:
Google Leaderboards, Reducing the Score of a Player I am making a strategy game similar to chess for Android.

I'll be using the Google Leaderboards for rankings.

I want to implement a sort of ranking system, that the player can actually lose score, similar to the one in www.chess.com.

But, from the docs of submitScore():

"The score is ignored if it is worse than a previously submitted score for the same player."

I don't understand how can I implement such a system with Google Leaderboards.. sorry if I'm missing something obvious here.

sentences: Google Admob GDPR compliance - Unity I have created a unity game that uses admob to show only rewarded video ads and there are no banner/interstitial ads in my game. Is it mandatory to take user consent (for EU countries) for showing the rewarded ads and if so how do I go about implementing it. I followed some online tutorials to implement admob ads but there was no mention of gdpr in any of those. Can someone please help?

sentences:
Universal App: Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED) I have problem with creating xaml control. I write new project in VS 2015 in universal app.
this is my code:

<ItemsControl Grid.Row="1" ItemsSource="{Binding Path=TechnologyList}">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                    <RowDefinition Height="10*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                    <ColumnDefinition Width="14*"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemContainerStyle>
        <Style TargetType="Control">
            <Setter Property="Grid.Column" Value="{Binding Level}" />
            <Setter Property="Grid.Row" Value="{Binding Row}" />
        </Style>
    </ItemsControl.ItemContainerStyle>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Button Content="{Binding Name}"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

in line
I get error: Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)

Can anyone help me ?

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:
How to decide whether to use a physics engine for a platformer I'm planning on creating a 2D platformer and doing some research to make sure that when I get started, I avoid making some poor decisions. Something I've seen come up multiple times is that I should consider writing my own physics for a 2D game instead of using the physics provided by an engine. For example, in this question, multiple answerers tell the OP to write their own character controller logic instead of using the physics built into Unity.

Why is this advice common? What benefit would I gain by writing my own physics code? And how do I decide whether writing my own physics is appropriate for my game?

sentences:
(UE4) Simulate physics breaks timeline animation I'm using timelines to animate my boat object, which does not have any limbs.  So all I need to accomplish is rotation and a little movement.

However, when the player dies, I need the boat to sink using simulate physics.
When I turn simulate physics on, the timelines stop animating the boat.

The nodes I'm using are GetActorTransform and SetActorRotation

sentences:
How should I position and move objects in my 3D world in relation to terrain I'm drawing a heightfield as a piece of 3D terrain using the fairly 'dumb' method of drawing triangles, like everyone does when learning this sort of thing. There's no fancy LOD, scenegraphs or other things, it's deliberately simple and low poly because that's the look of the game. A section of X,Y height data is turned into a mesh of triangles and drawn on the screen.

I now want to scroll the heightfield in the Z axis (not the X or Y, I just want to move 'forwards' through it).

I have a player object with a 'camera' attached to it. When the player wants to go 'forwards' should I

keep the player at the same Z position and scroll the terrain towards the viewer to simulate movement
actually move the player in the Z axis and draw the relevant bit of terrain under them (because the camera is 'attached' to the player it looks like they stay in the middle of the screen, and the gameworld and gameplay will limit how far the player can go forwards)

I'm doing the first one at the moment and it works well... until I want to interact with the terrain or place stationary objects on it at specific points. It seems a bit backwards since all the 'moving' objects stay still, and all the stationary objects need to be moved towards the viewer at the same rate as the terrain is. Also the maths to translate the terrain's scrolled amount and the player's pretend location is somewhat complex.

sentences:
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:
Why does physics not behave consistently in Unity? I'm making a game in which AI players throw a ball.

In the screenshot, you can see the arena which is separated by a net in the middle. Each side of the arena has 6 players belonging to one of 2 teams. Right now, one of the players on the right side has the ball (the top-right player). He is going to throw the ball to the left side.

According to my code, the ball should always land on the same place, because the player always applies the same force to the ball. However, I have noticed that the ball doesn't always land in the same place. I have marked where I've seen the ball land with several red circles.

Interestingly, on my main PC, the ball almost always lands on the right-most circle. It rarely lands on the other circles, although that does happen. On 3 other PCs I've tested this game on, however, the ball most often lands on the legs of the top-left player, sometimes on his head or behind him, but never on the right-most circle (in front of him).

My game relies heavily on physics. The AI is supposed to calculate how to throw the ball to get it to land on a very specific location, as well as guess where it'll land depending on the ball's position and movements. If the physics don't behave consistently on all machines all the time, how is the AI supposed to calculate all of this accurately?

Here is the code in charge of throwing:

private IEnumerator Serve()
{
    var ball = GameObject.Find("Ball").GetComponent<BallController>();
    if (ball.ServingPlayer != this)
        yield break;

    yield return new WaitForSeconds(3);

    Vector3 shootDirection = transform.forward.normalized;
    var q = Quaternion.AngleAxis(-45, transform.right);

    ball.RigidBody.AddForce(q * shootDirection * 20f, ForceMode.VelocityChange);
}

As you can see, the ball is always thrown "forward" (facing the net) at a 45° upward angle, using a normalized vector and a constant speed (20f).

Before each throw, the position of the players is reset to the exact same location (and rotation) they are seen on the screenshot.

player.transform.localEulerAngles = new Vector3(0, playerRotation, 0);
player.transform.position = startingposition + posOffset;

In this case, playerRotation is either 90f or -90f depending on which side the player is on, startingposition is their "horizontal" position (relative to the net), and posOffset is their "vertical" position.

The ball has its velocity and angular velocity reset, but not its rotation (since it's a sphere, its rotation shouldn't influence anything). Its position is also set to a fixed location relative to whichever player has to serve the ball.

rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
transform.position = ServingPlayer.ServingPosition;

Here, rb is the ball's RigidBody.

Finally, I am not influencing the ball's movement in any way. I simply apply a force to it when serving, which happens only once. 3 seconds after the ball lands, the match is reset and everything repeats.

The flow is basically like this (pseudocode):

Start()

ResetCourt()
StartCoroutine(Players[0].Serve())
event BallLanded()
wait for 3 seconds

// repeat starting with ResetCourt()

I really need the ball's trajectory to be reproducible every single time on every possible machine. Obviously I'm doing something wrong here, but what?

sentences: How do I add a text area to my 3D android world i am learning 3d game development on android , i was wondering is it possible to add text areas or any thing that allows a user to enter a text in a 3d world ? and how ?

sentences:
Why do 3D animations have framerates As far as I'm aware, all 3D animation software (Maya, Blender...) has framerates. That is, keyframes can only be placed on discrete points in time. Why is that? Why can't animation keyframes be placed at any point in time?
The animations are interpolated in the game engine anyway, the game framerate is rarely the same as the animation framerate and even then, somethimes the game's frames land inbetween the animation's frames and we see the interpolated animation anyway.

sentences: How to save the 3D surface to bitmap in Flash 11 Stage3D I have been using Stage3D to create some 3D app in Flash. One of the items on my list is the ability to take a screen shot. Flash makes it easy to grab the stage content, but I can't find a way to grab the stage3D content. In DX I just used D3DXSaveSurfaceToFile. Anyone know of a way to do it in as3 and flash 11?

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: How do I save my game with highscores and player positioning in LibGDX? So I have a game that needs to save high scores for the number of waves, what guns the player has, positioning of the player and the zombies, and so on. I saw something about SharedPreferences but have no clue how to use them. Can someone point me to the right direction or willing to tell me how to use them correctly?

sentences:
bump mapping with 2 normal maps I was wondering if its actually possible to do bump mapping with 2 normal maps... I have tried doing it this way however I get a function overload on max and dot.

uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;
uniform sampler2D  refTex;

varying mediump vec2  TexCoord;
varying mediump float vTime;

void main()
{
    mediump vec4 wave = texture2D(n_mapTex, TexCoord - vTime);
    mediump vec4 wave2 = texture2D(n_mapTex2, TexCoord + vTime);
    mediump vec4 bump = mix(wave2, wave, 0.5);
    //this extracts the normals from the combined normal maps
    mediump vec4 normal = normalize(bump.xyzw * 2.0 - 1.0);
    //determines light position
    mediump vec3 lightPos = normalize(vec3(0.0, 1.0, 3.0));

    mediump float diffuse = max(dot(normal, lightPos),0.0);
    gl_FragColor = mix(texture2D(refTex, TexCoord), bump, 0.5);
}

sentences:
Can I Debug.Log() on Android without all the callstack spam? I get this:

I/Unity   ( 1908): Serialized file length: 754 bytes.
I/Unity   ( 1908): UnityEngine.Debug:Internal_Log(Int32, String, Object)
I/Unity   ( 1908): UnityEngine.Debug:Log(Object)
I/Unity   ( 1908): SerializeTest:Test() (at Z:\Pong\Devel2010\Src\UnityGames\BhvrDemo\BinarySerialization\Assets\Script\SerializeTest.cs:64)
I/Unity   ( 1908): UnityEngine.Events.InvokableCall:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.InvokableCallList:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEventBase:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEvent:Invoke()
I/Unity   ( 1908): UnityEngine.UI.Button:Press() (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:36)
I/Unity   ( 1908): UnityEngine.UI.Button:OnPointerClick(PointerEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:45)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\EventSystem\ExecuteEvents.cs:52)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at C:\BuildAgent\work\d63dfc6385190b6

but I would like this:

I/Unity   ( 1908): Serialized file length: 754 bytes.

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:
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: 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: Can all DirectX11 games be deployed to Xbox One? If I program a game with DirectX 11 and C++ and make my own implementation can I deploy it on an Xbox one to test it? Otherwise, what do I need to do so?

sentences:
Different types of cubes I'm looking into making 4 types of cubes; grass, stone, dirt, and empty. I have a cube class that is just for storing the location of the cube.

    public Cube(GraphicsDevice Device, Vector3 Position, Texture2D Texture)

I want the Texture2D to be changed to something like CubeType. In my cube class, I have a grass and stone class which both inherit cube, but I don't know how to make that work for what I want.

    public class Grass : Cube
    {
        public Grass()
        {
            isMineable = false;
        }
    }

    public class Stone : Cube
    {
        public Stone()
        {
            isMineable = false;
        }
    }

The only thing that makes each cube differ from each other is the texture and if theyre mineable or not.
What's the easiest way to implement what I want? I guess one way of doing it is just adding another parameter to Cube(bool isMineable), but for learning purposes I want to see if there's a better way to do it.

sentences:
Make a child sprite match the layer ordering of its parent I have my project settings set up to order the sprites' visual layering based on their y position.
If I add a sword as a child to my character, the sword won't have the same order as the parent so things can look like
Sword --> enemy--> player

instead of
enemy --> sword --> player

(because I want the sword to be in front of the character)
I thought of setting the pivot point of the sword sprite so when nested inside the parent sprite, it would be around the same height as the player's pivot point so they would have the same order. I feel like this wouldn't be the best solution because when I will animate the sword to attack, I wont be able to rotate it around the position I want.....unless I make it the child of an empty object?
How can I solve this issue?

sentences:
Isometric game engine in JavaScript/HTML5 Is anybody aware of any stable-ish (ie out of alpha) isometric drawing engines for JavaScript/HTML5?  I have done some Google searches and found a few, but they were mostly in alpha/invite-only status.

Is there anything mature enough to be used in a production environment?  Or should I simply roll my own implementation for now and wait for the rest of the world to catch up?

sentences:
XBox controller in while loop I have a while loop that goes for ever. The goal is if I press A button, a message should be printed out showing this button has been pressed A has been pressed. I've done the loop and connecting XBox controller but the problem is that the message is printed out many times if I press the button one time. My question is why the message is being shown many times while I just press the button one time? Should I make some kind of sleep?

Edit:
This is the part of the code

while(true)
    {
        if(Player->IsConnected())
        {
            if( Player->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_A )
                std::cout << " A button has been pressed ..." << std::endl;
        }
        else
        {
            std::cout << "\nERROR: Connect XBox Controller ... \n";
            std::cout << "Press Any Key To Exit.";
            std::cin.get();
            break;
        }
    }

The result when I only press once.

Press A to be printed out ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...

sentences:
How can I generate my puzzle game's result tables? I have a pattern game and it is almost done however I am stuck on the last part.

I have a screen with 25 blocks (in a table format 5x5) and the user clicks on it to turn over the blocks, I need to see if the user has turned over a line of blocks.

So I created a bunch of options and I am trying to compare it to the table of the current system (1 = not turned over and 0 = turned over). But the problem is my table looks like

local level1o1 ={ 0,0,0,0,0,
                  0,1,1,1,1,
                  1,1,0,1,0,
                  1,1,1,1,1,
                  1,0,1,1,1 }

And when I do the compare it doesn't say it is the same because of the other random 0's in the table. I don't want to make every single possible result table, so any ideas of how I could do this?

Compare function

-- Table Compare
local function deepcompare(t1,t2,ignore_mt)
    local ty1 = type(t1)
    local ty2 = type(t2)
    if ty1 ~= ty2 then return false end
    -- non-table types can be directly compared
    if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end
    -- as well as tables which have the metamethod __eq
    local mt = getmetatable(t1)
    if not ignore_mt and mt and mt.__eq then return t1 == t2 end
    for k1,v1 in pairs(t1) do
        local v2 = t2[k1]
        if v2 == nil or not deepcompare(v1,v2) then return false end
    end
    for k2,v2 in pairs(t2) do
        local v1 = t1[k2]
        if v1 == nil or not deepcompare(v1,v2) then return false end
    end
    return true
end

Example list of possible answers

local level1o1 ={ 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 }

local level1o2 ={ 0,1,1,1,1,
                 1,0,1,1,1,
                 1,1,0,1,1,
                 1,1,1,0,1,
                 1,1,1,1,0 }

.. etc

sentences:
Convert integer to float while also dividing down the scale, without data loss I'm working on a game, and my intent is to avoid use of floating point for unit positions. To that end, I'm using 32-bit integers for all positions, with a millimeter scale.
However, for rendering, I know the GPU expects everything to be float, so I need to convert from millimeter-scale integer to meter-scale float. Sounds simple, but I'd like to know the most efficient way to perform these two conversions at the same time without losing something along the way.
I know I can convert my 32-bit integer to a double and know that it will all fit, before dividing by 1000 to get meters and converting the result to a float:
int i = 1234567890;
double d = i / 1000.0;
f = (float)d;

But I wonder if that's taking more steps than is necessary. The only other option I can think of is to do something like:
int i = 1234567890;
float f = (i % 1000) / 1000.0f;
f += i / 1000;

But that requires multiple divides and more steps than using a double.
Is there perhaps another existing method of performing this sort of conversion? Or are these my only real options?

sentences:
Game window systems and internal frames I don't know if this is a valid question, but: What kind of window manager do games use which have internal frames (Frames inside frames)? Does this differ between the programming languages (Are e.g. in Java the AWT/Swing libraries used to manage these and other graphical elements, such as buttons,or is this to restrictive (speed, graphical possibilities?))

A special example would be EVE Online, where the client can use the ingame windows like on a normal desktop.

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:
Game Engine Entity/Component with Services Architecture I'm currently working on my first game engine and decided to use the entity/component model with services.

Background:
My GameEngine class is an Entity and has multiple services that are Components, like the RenderService and the PhysicsService. Other Entities in my game have components that communicate with services, like the RenderComponent and the PhysicsComponent.

Question: How do I get these components to communicate with their respective services?

Note: I have thought about having a call to the respective service create the components, but I would like to hear about other solutions you guys have. I'm open to adding/removing classes and changing my whole architecture. It is my first attempt, so I'm willing to take advice and learn. Time is not the concern.

Let me know if you need more information.

Thank you in advance.

sentences:
2D Tile Based Collision Detection There are a lot of topics about this and it seems each one addresses a different problem, this topic does the same.

I was looking into tile collision detection and found this where David Gouveia explains a great way to get around the person's problem by separating the two axis. So I implemented the solution and it all worked perfectly from all the testes I through at it. Then I implemented more advanced platforming physics and the collision detection broke down. Unfortunately I have not been able to get it to work again which is where you guys come in :)!

I will present the code first:

    public void Update(GameTime gameTime) {
        if(Input.GetKeyDown(Keys.A)) {
            velocity.X -= moveAcceleration;
        }
        else if(Input.GetKeyDown(Keys.D)) {
            velocity.X += moveAcceleration;
        }

        if(Input.GetKeyDown(Keys.Space)) {
            if((onGround && isPressable) || (!onGround && airTime <= maxAirTime && isPressable)) {
                onGround = false;
                airTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
                velocity.Y = initialJumpVelocity * (1.0f - (float)Math.Pow(airTime / maxAirTime, Math.PI));
            }
        }
        else if(Input.GetKeyReleased(Keys.Space)) {
            isPressable = false;
        }

        if(onGround) {
            velocity.X *= groundDrag;
            velocity.Y = 0.0f;
        }
        else {
            velocity.X *= airDrag;
            velocity.Y += gravityAcceleration;
        }

        velocity.Y = MathHelper.Clamp(velocity.Y, -maxFallSpeed, maxFallSpeed);
        velocity.X = MathHelper.Clamp(velocity.X, -maxMoveSpeed, maxMoveSpeed);

        position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
        position = new Vector2((float)Math.Round(position.X), (float)Math.Round(position.Y));

        if(Math.Round(velocity.X) != 0.0f) {
            HandleCollisions2(Direction.Horizontal);
        }
        if(Math.Round(velocity.Y) != 0.0f) {
            HandleCollisions2(Direction.Vertical);
        }
    }

private void HandleCollisions2(Direction direction) {
    int topTile = (int)Math.Floor((float)Bounds.Top / Tile.PixelTileSize);
    int bottomTile = (int)Math.Ceiling((float)Bounds.Bottom / Tile.PixelTileSize) - 1;
    int leftTile = (int)Math.Floor((float)Bounds.Left / Tile.PixelTileSize);
    int rightTile = (int)Math.Ceiling((float)Bounds.Right / Tile.PixelTileSize) - 1;

    for(int x = leftTile; x <= rightTile; x++) {
        for(int y = topTile; y <= bottomTile; y++) {
            Rectangle tileBounds = new Rectangle(x * Tile.PixelTileSize, y * Tile.PixelTileSize, Tile.PixelTileSize, Tile.PixelTileSize);
            Vector2 depth;

            if(Tile.IsSolid(x, y) && Intersects(tileBounds, direction, out depth)) {
                if(direction == Direction.Horizontal) {
                    position.X += depth.X;
                }
                else {
                    onGround = true;
                    isPressable = true;
                    airTime = 0.0f;
                    position.Y += depth.Y;
                }
            }
        }
    }
}

From the code you can see when velocity.X is not equal to zero the HandleCollisions() Method is called along the horizontal axis and likewise for the vertical axis. When velocity.X is not equal to zero and velocity.Y is equal to zero it works fine. When velocity.Y is not equal to zero and velocity.X is equal to zero everything also works fine. However when both axis are not equal to zero that's when it doesn't work and I don't know why. I basically teleport to the left side of a tile when both axis are not equal to zero and there is a air block next to me.

Hopefully someone can see the problem with this because I sure don't as far as I'm aware nothing has even changed from what I'm doing to what the linked post's solution is doing.

Thanks.

sentences:
Switching from OpenGL ES 1.0 to 2.0 I have been developing an Android app using OpenGL 1.0 for quite some time using a naive approach to rendering, basically making a call to glColor4f(...) and glDrawArrays(...) with FloatBuffers each frame.  I am hitting a point where graphics is becoming a huge bottleneck as I add more UI elements and the number of draw calls increases.

So I'm now looking for the best way to group all of these calls into one (or two or three) draw calls.  It looks like the cleanest, most efficient and canonical way to do this is to use VBO objects, available from OpenGL ES 2.0 on.  However, this would require a HUGE refactoring on my part to switch my whole graphics backend from ES 1.0 to ES 2.0.  I am not sure if this is a good decision, or if there are acceptable ways to group my drawing calls in 1.0 that would work fine for relatively simple 2D data (squares, rounded rectangle TRIANGLE_FANs, etc.), or if it really might be worth biting the bullet and making the switch.  I might also mention that I have a HEAVY reliance on translation and scaling that is so convenient with the fixed pipeline of ES 1.0.

Looking around, I am surprised to find almost NO people in my position, talking about the tradeoffs and complexity at hand for such a switch.  Any thought?

sentences:
How do I draw these tiles without them overlapping? I want to make a map that is tiled, and I want to start the map with all grass.

I use this tile:

When I display this tile and place another next to it I get the following result:

How do I get it to be "flat?"

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:
Sprite rotation LibGDX I'am using the current mouse position to aim the player sprite, but I am not getting the best results. I want my sprite to have the direction pointed wherever my cursor is in the screen.

Here's my code:
My update method

public void update(float dt){
    time += dt;
    float yInput = (Gdx.graphics.getHeight() - Gdx.input.getY());
    vec.set(Gdx.input.getX() - position.x, yInput - position.y).nor();
    //position is a Vector2 update sprite coordinates
    position.x += vec.x * 15f;
    position.y += vec.y * 15f;
}

and here's my draw method

public void draw(){
    batch.begin();
    sprite.setPosition(position.x - sprite.getWidth()/2, position.y - sprite.getHeight()/2);

    float xInput = Gdx.input.getX();
    float yInput = (Gdx.graphics.getHeight() - Gdx.input.getY());

    float angle = MathUtils.radiansToDegrees * MathUtils.atan2(yInput - position.y, xInput - position.x);

    if(angle < 0){
        angle += 360;
    }
    sprite.rotate(angle);

    sprite.draw(batch);
    batch.end();
}

So what's wrong? why I get bad results?

sentences:
How do you add AdMob to LibGDX game? Im currently trying to implements AdMob into my libgdx game, but it seems that all tutorials are deprecated.

For example in the offical libgdx wiki the google play services get imported into eclipse, but google split the google play services up. Also I need to implement Firebase to the game (u need to now), but it doesnt say anything about that either. I also looked at the offical tutorials for Android Studio, but doing it in LibGDX doesnt seem to work (Cant resolve AdView).

All help is appreciated, thanks.

sentences:
Unity3D: default parameters in C# script Accordingly to this thread, it seems that default parameters aren't supported by C# script in Unity3D environment.

Declaring an optional parameter in a C# scirpt makes Mono Ide complaint about it:

void Foo(int first, int second = 10) // this line is marked as wrong inside Mono IDE

Anyway if I ignore the error message of Mono and run the script in Unity, it works without notify any error inside Unity Console.

Could anyone clarify a little bit this issue?
Particularly:

Are default parameters allowed inside C# scripts?
If yes, are they supported by all platforms?
Why Mono complains about them if the actually works?

sentences: Algorithm for generating levels for shooting game I have a shooting game made in Java. It's based on time, i.e you have to shoot the objects before the time runs out. Everything is working fine, except that I'm trying to implement an algorithm to generate levels. I implemented one that increases the number of game objects and increase their speed, but I don't know how to give the player an appropriate time based on these factors to provide an appropriate challenge for the player.

sentences:
Java Game Optimizing I'm trying to optimize my game. I've got object Handler that goes trought all objects and then render and tick them. If I have lot of objects in game game lags or don't start. Could you please help me? public class Handler {

public LinkedList<GameObject> object = new LinkedList<GameObject>();

private GameObject tempObject;

private Camera cam;

public Handler(Camera cam) {
    this.cam = cam;
}

public void tick() {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.tick(object);

    }

}

public void render(Graphics g) {

    for (int i = 0; i < object.size(); i++) {
        tempObject = object.get(i);

        tempObject.render(g);

    }

}

sentences:
How can I find an optimum set of colors for 10 players? I want to give each of 10 players a unique identifying color. Is there an optimum set of colors for this? How do I create one?

Every set I've come up with contains colors that are too similar.

Update: I was asked below what this is for (fair question). Now I can tell you - Windwardopolis and the colors worked great.

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:
How do I get a Metal texture ID to render to it with Ogre? I looked in the documentation, but I don't know how to get the texture ID.

void* texPtr = SixDegreesSDK_GetBackgroundTexture();
            if (texPtr != nil) {
                id<MTLTexture> mtlTexture = (__bridge id<MTLTexture>)texPtr;

                id<MTLDevice> device = [mtlTexture device];
                // !!! Not fond of creating a new command queue for every texture
                id<MTLCommandQueue> commandQueue = [device newCommandQueue];
                id<MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
                id<MTLBlitCommandEncoder> blitEncoder = [commandBuffer blitCommandEncoder];

                NSUInteger textureWidth = mtlTexture.width;
                NSUInteger textureHeight = mtlTexture.height;
                NSUInteger rowbytes = mtlTexture.bufferBytesPerRow;
                MTLPixelFormat  pixFormat = mtlTexture.pixelFormat;
                CVPixelBufferRef _CVPixelBuffer = NULL;
                NSDictionary* cvBufferProperties = @{
                                                     (__bridge NSString*)kCVPixelBufferOpenGLCompatibilityKey : @YES,
                                                     (__bridge NSString*)kCVPixelBufferMetalCompatibilityKey : @YES,
                                                     };
                CVReturn cvret = CVPixelBufferCreate(kCFAllocatorDefault,
                                                     textureWidth, textureHeight,
                                                     kCVPixelFormatType_32RGBA,
                                                     (__bridge CFDictionaryRef)cvBufferProperties,
                                                     &_CVPixelBuffer);
                const IOSurfaceRef surface  = CVPixelBufferGetIOSurface(_CVPixelBuffer);             // available in ios11 sdk, ios4 runtime

                MTLTextureDescriptor* textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixFormat
                                                                                width:textureWidth
                                                                                height:textureHeight
                                                                                mipmapped:NO];
                id<MTLTexture> metalTexture = [device newTextureWithDescriptor:textureDescriptor
                                                                          ioSurface:surface
                                                                              plane:0];

                MTLRegion region = MTLRegionMake2D(0, 0, textureWidth, textureHeight);

                [blitEncoder copyFromTexture:mtlTexture
                                 sourceSlice:0
                                 sourceLevel:0
                                sourceOrigin:region.origin
                                  sourceSize:region.size
                                   toTexture:metalTexture
                            destinationSlice:0
                            destinationLevel:0
                           destinationOrigin:region.origin];

                [blitEncoder endEncoding];
                [commandBuffer commit];
                [self.mEAGLContext texImageIOSurface:surface target:GL_TEXTURE_2D internalFormat:GL_RGBA width:textureWidth height:textureHeight format:GL_RGBA type:GL_UNSIGNED_BYTE plane:0];

sentences:
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:
What is the intended usage of the Sprite class in LibGDX I am making a small game in LibGDX and it all works, sprites are moving etc. The drawing is mainly done in the render() method of a Screen, using Batch.draw(TextureRegion). So far so good.

But now I would like my sprites to rotate. There are Batch draw methods for rotation (I think), but I noticed a bunch of useful methods in tne Sprite class. Problem is I do not know how to use them without making the rest of the program ugly.

I could have a Sprite as a member of each "game object", but that makes direct dependency of the game model on drawing mechanism, specifically LibGDX. Besides I can see problems with serialization and duplicate parameters (Sprite x,y vs model x,y etc) and unnecessary overhead.

Or I could subclass Sprite, which would probably be orders of magnitude messier.

Is there a common way of clearly separating the model part and rendering part of  a small game? And how is Sprite typically used?

sentences:
How to change from 60FPS to 30FPS while keeping things smooth? Here is my current game loop:

final int ticksPerSecond = 60;
final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;

while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){
        updateLogic();
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

On most devices I've tested my game on (this is an Android game BTW) it runs quite nice.

As you can see, I'm using a fixed time-step (defined as my ticks per second).

If I reduce my Ticks Per Second to 30, everything runs at the same speed but is nowhere near as smooth.  I keep hearing people say that 30fps should be OK for mobile games and everything should run great at 30 fps, but that's just not my experience.

Would be grateful if someone could give me some pointers on how to achieve this.

sentences: 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:
How to create laser redirection? Think portal 2, where a laser can go through a cube, and depending on the rotation of that cube, it will redirect it. Examples:

Here is my barely functioning code. It works for one cube, I'm able to get the original (source) laser to hit any 'redirect' cube, then I'm able to cast a line renderer and change the rotation.

Problem comes when I try to use the redirect laser to hit another redirect cube, I can't figure out how to make this code work for multiple cubes hitting off each other.

using UnityEngine;
using System.Collections;

public class outLaser : MonoBehaviour
{
    public sourceLaser1 reference; //referring to another class that has the original (source) laser

    LineRenderer redirectLaser;
    RaycastHit redirectHit;

    void Awake()
    {
        redirectLaser = GetComponent<LineRenderer>();

    }

    void Update()
    {
        if(reference.sourceHit.collider.gameObject == transform.parent.gameObject)
        {
            if(Physics.Raycast(transform.position, -transform.forward, out redirectHit, Mathf.Infinity))
            {
                redirectLaser.enabled = true;
                redirectLaser.SetPosition(0, transform.position);
                redirectLaser.SetPosition(1, redirectHit.point);
            }
        }
        else
        {
            redirectLaser.enabled = false;
        }
    }
}

Tried many different solutions, all with no avail.

Here's what it looks like:

EDIT: I've gotten this far

    if(reference.sourceHit.collider.gameObject == transform.parent.gameObject)
    {
        if(Physics.Raycast(transform.position, -transform.forward, out redirectHit, Mathf.Infinity))
        {
            redirectLaser.enabled = true;
            redirectLaser.SetPosition(0, transform.position);
            redirectLaser.SetPosition(1, redirectHit.point);

            //Logic that allows redirect cube to accept redirect raycasts
            cubeThatsHit = redirectHit.collider.gameObject;

            if(cubeThatsHit.gameObject.tag == "Redirect")       //if the cube that is hit is a redirect cube, do this
            {
                   //This is where I need the logic
            }
        }
    }
    else
    {
        redirectLaser.enabled = false;
    }

sentences:
How do I convert my matrix from OpenGL to Marmalade? I am using a third party rendering API, Marmalade, on top of OpenGL code and I cannot get my matrices correct. One of the API's authors states this:

  We're right handed by default, and we treat y as up by convention. Since IwGx's coordinate system has (0,0) as the top left, you typically need a 180 degree rotation around Z in your view matrix. I think the viewer does this by default.

In my OpenGL app I have access to the view and projection matrices separately. How can I convert them to fit the criteria used by my third party rendering API?

I don't understand what they mean to rotate 180 degrees around Z, is that in the view matrix itself or something in the camera before making the view matrix. Any code would be helpful, thanks.

sentences:
Managing Game Entity coordinates In my Game I'm currently have "Scene Coordinates" which are the X,Y coordinates relative to a Game Scene.

In that Scene there are Game Entities, let's say there's a GameEntity A in x=100.0, y=100.0 ( scene coordinates )

Which is the best way to have "Entity Coordinates" so that from GameEntity A point of view, he's standing at x=0.0, y=0.0 with OpenGL transformations?

In that way if I apply something like

glRotatef(angle, 0, 0, 1)

The entity will rotate around it's own origin and not the scene "global" origin.

sentences:
Use ramp and steps meshes as actual ramp in unreal engine 4.26 Is it possible to use a ramp mesh as an actual ramp in UE4? It seems that the system create a rectangle box around the ramp o the character does not climb the ramp, it is over it like on a box.
I know that we can use landscape ramp's generator, but it's one more step that could be avoid.
thanks guys!

sentences:
Ienumerator is not working as expected So I'm trying to get my miner drone to mine from the resource by using an Ienumerator but the miner either leaves with more than the capacity or it leaves and it has taken more than the amount of resources available.

So in short, the miner is to head to the resource, when its within the trigger, it needs to take the minerAmount over the miningSpeed amount of time.

Please help.

private void OnTriggerStay(Collider other)
{
    MinableResource mr;
    if (other.CompareTag("Resource"))
    {
        Debug.Log("Within Range of Resource");
        mr = other.GetComponent<MinableResource>();

        if (minerCurrentCapacity < minerMaxCapacity)
        {
            StartCoroutine(MineResource(other));
        }
        else if (minerCurrentCapacity >= minerMaxCapacity)
        {
            minerFull = true;
            Move(storagePos);
        }
    }
}

IEnumerator MineResource(Collider _other)
{
    if (minerFull)
        yield break;

    yield return new WaitForSeconds(miningSpeed);
    Mining(_other);
}

private void Mining(Collider _other)
{
    Debug.Log("Mining");

    MinableResource mr;
    mr = _other.GetComponent<MinableResource>();

    minerCurrentCapacity += miningAmount;
    mr.resources -= miningAmount;

}

sentences:
How do you properly implement level boundaries in a physics room? I have an issue with creating a proper boundary in GameMaker Studio when using a physics enabled room.

My room has a gravity of 0, as it is in Space. My player object has the default values, but a friction of 10 with a box shaped collision shape. I also use View0 on a 1280x720 room with a 1280x720 view. That is to be able to do screen shakes and other neat effects.

I really struggle with containing my player object properly to the room. When I use a collision with view0_boundary and add

phy_position_x = phy_position_previousx;
phy_position_y = phy_position_previousy;

then my ship would get stuck at the screen borders very frequently.

I also tried adding some sprites that block the player off the room and created a sprite, 1280x720 and spawned them at the borders. I gave my player empty events for them and set their density to 0, making them static. However, this resulted in the same problem, I got stuck in them.

I need a smooth solution for this, obviously, to have a fun experience. I have this problem quite for a while, so please help me understanding how to do this properly.

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:
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:
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:
How to use Moving Average to avoid lucky streaks in RNG I spent the last week reading about Luck Mitigation and what a dev can do to avoid extreme cases where the player's psychology will be messed up.

I came up to this question How do I avoid “too” lucky / unlucky streaks in random number generation?, plus some others outside GameDev site. To illustrate my question, let's have this simple game example.

We have a turned base fighting game, like BiteFight. Two characters have their attributes and the match outcome is based entirely to those attributes.

In specific:

Player 1: Str: 10 Def: 15 Agl: 20

Player 2: Str: 12 Def: 20 Agl: 15

The process is simple:

If rnd() * P1_Agl >= rnd() * P2_Agl:
    P1 will attack
else:
    P1 will attack

Then with the same way in case of Player 1 is attacking

If rnd() * P1_Str >= rnd()* P2_Def:
    reduce life points from P2

Repeat the same unlimited times until one of players' life reach zero.

Solutions I found:

Instead of 1 rnd() call, use x-times rnd() and get the average. Something like ( rnd() + rnd() + rnd() ) / 3. This will move the results closer to 0.5 and make the whole process less "random". However, it is still possible enough to have streaks of lucky or unlucky events.
Keep track of the results and if you have x-times the same result then hard-code the other. For example, if on the above, P1 won the Agility test 3 times in the row, then the 4th time will always go to P2. What I didn't like on this are the predictability. Users might understand that behavior through time. But the most important is what would happen if P1 uses an item that changes his attributes on the 4th step? When you hard-code the outcome, the result would be based on different attributes.
I read many times the suggestion to use a Moving Average or a Cumulative Moving Average on the rnd() to guess if their is a streak of lucky results. For example, if Player 1 keeps getting rnd() above 0.9, it is a lucky streak. I wrote a script to calculate those two and here is an example for CMA and MA

Cumulative Moving Average

0 : Random number:  0.348  CMA:  0.348
1 : Random number:  0.74  CMA:  0.544
2 : Random number:  0.967  CMA:  0.685
3 : Random number:  0.578  CMA:  0.659
4 : Random number:  0.932  CMA:  0.713
5 : Random number:  0.134  CMA:  0.617
6 : Random number:  0.397  CMA:  0.585
7 : Random number:  0.537  CMA:  0.579
8 : Random number:  0.861  CMA:  0.611
9 : Random number:  0.893  CMA:  0.639

Moving Average

0 : Random number:  0.295 Moving Average:  0.098
1 : Random number:  0.866 Moving Average:  0.354
2 : Random number:  0.768 Moving Average:  0.492
3 : Random number:  0.888 Moving Average:  0.624
4 : Random number:  0.94 Moving Average:  0.729
5 : Random number:  0.325 Moving Average:  0.595
6 : Random number:  0.823 Moving Average:  0.671
7 : Random number:  0.208 Moving Average:  0.517
8 : Random number:  0.743 Moving Average:  0.592
9 : Random number:  0.038 Moving Average:  0.407

So, I end up to my 2 questions

1) Even if I read many times the suggestion of Moving Average, no-one mentioned how exactly you use it. So, my guess is that each time, you compare the rnd() with the moving average and based on that you take some actions. But what exactly you can do?

2) In the above example, you can see that we have two comparisons. One for Agility and one for Strength. Should one use two different Moving Averages to "identify" lucky streaks for each case, or it should be one for every case that RNG comes to the game?

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:
World space UI stretched too much instead of billboard in unity I am scaling my world space UI element as my camera go far away from UI using this code snippet:

public class ZoomNamePlace : MonoBehaviour
{
    //public CameraController camContrller;
    public int Zoom_Factor;

    void LateUpdate()
    {
        Zoom();
    }

    void Zoom()
    {
        float size = (Camera.main.transform.position - transform.position).magnitude;
    }

}

It is working fine and my UI scale according to the distance of Camera and UI. Now i want to rotate/billboard my world space UI to the camera and here is my script:

public class Billboard : MonoBehaviour
{

    //Orient the camera after all movement is completed this frame to avoid jittering
    void LateUpdate()
    {
        Camera m_Camera = Camera.main;

        transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.forward,
            m_Camera.transform.rotation * Vector3.up);
    }
}

But the problem is instead of billboard my UI shape stretched too much maybe due to my canvas scale set to 0.01.

sentences:
OpenGL flickerinng near the edges I am trying to simulate particles moving around the scene with OpenCL for computation and OpenGL for rendering with GLUT. There is no OpenCL-OpenGL interop yet, so the drawing is done in the older fixed pipeline way. Whenever circles get close to the edges, they start to flicker. The drawing should draw a part of the circle on the top of the scene and a part on the bottom.

The effect is the following:

The balls you see on the bottom should be one part on the bottom and one part on the top. Wrapping around the scene, so to say, but they constantly flicker.

The code for drawing them is:

void
Scene::drawCircle(GLuint index){
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glTranslatef(pos.at(2*index),pos.at(2*index+1),  0.0f);

    glBegin(GL_TRIANGLE_FAN);
    GLfloat incr = (2.0 * M_PI) / (GLfloat) slices;
    glColor3f(0.8f, 0.255f, 0.26f);
    glVertex2f(0.0f, 0.0f);
    glColor3f(1.0f, 0.0f, 0.0f);
    for(GLint i = 0; i <=slices; ++i){
        GLfloat x = radius * sin((GLfloat) i * incr);
        GLfloat y = radius * cos((GLfloat) i * incr);

        glVertex2f(x, y);
    }
    glEnd();
}

If it helps, this is the reshape method:

 void
 Scene::reshape(GLint width, GLint height){
     if(0 == height) height = 1; //Prevent division by zero

     glViewport(0, 0, width, height);

     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();

     gluOrtho2D(xmin, xmax, ymin, ymax);
     std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << std::endl;
 }

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:
UGUI scripts stop my project from building Unity 2019.2.21

I am trying to build out my project to Android and I am getting the following error messages:

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Toggle.cs(121,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\DefaultControls.cs(152,13): error CS0103: The name 'Undo' does not exist in the current context

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\GraphicRebuildTracker.cs(24,32): error CS0117: 'CanvasRenderer' does not contain a definition for 'onRequestRebuild'

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs(159,25): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Slider.cs(380,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Scrollbar.cs(168,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Selectable.cs(771,48): error CS0234: The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\InputField.cs(2458,43): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

I tried updating Unity(from 2019.2.12 to current).
Deleting some csproj files, and different settings in the Project settings/Player.
The problematic code is in an #if UNITY_EDITOR statement, and not meant to execute at all on builds, I guess.

#if UNITY_EDITOR
        protected override void OnValidate()
        {
            base.OnValidate();

            if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying)
                CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this);
        }

#endif // if UNITY_EDITOR

sentences:
Problem when scaling game screen in Libgdx Currently, I'm able to scale the screen by applying this bit of code onto an OrthographicCamera

Camera.setToOrtho(true, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

But something quite strange is happening with this solution, take a look at this picture of my game below

Seems fine right? But upon further investigation, many components are rendered off by one pixels, and the tiles all are.

Take a closer look

I circled a couple of the errors. Note that the shadow of the warrior I circled appears fine for the other warriors. Also keep in mind that everything is rendered at pixel-perfect precision when I disable the scaling.

I actually thought of a possible source for the problem as I'm writing this but I decided to still post this because I would assume somebody else might run into the same issue.

sentences:
OpenGL large tile map rendering I want to be able to have a big tilemap (e.g. like Terraria, or an infinite procedural generated one), with only a handful of tiles on my screen.

This means that I have a texture atlas (i.e. spritesheet) which contains the textures for the tiles. For the sake of simplicity, let's assume that I have a huge internal 2D array, containing the tileIDs and a lookup tablel/hasmap for the UV coords for each tile type. All the tiles have the same dimension (the texture AND the onscreen tiles). I know a couple of methods to render such a 2D grid/tilemap, but I don't know which one of them is a solid foundation for a game which heavily relies on modifiable tiles.

Additionally, I want to be able to dynamically change the tilesize (i.e. zooming in/out), modifying the tiles/tilemap (e.g. destroying, building) and fast loading (fast paced player actions).

Using a single draw call. I create a VBO with all the quads to fill the screen (multiple overlapping vertices, because each quad needs a different texture) and have a persistent buffer to modify the texture buffer object. As soon as the camera moves, I update the UV coordinates in the TBO.
I can use attributeless rendering. I make a glDrawArrays call on an empty VAO, and use gl_VertexID%6 and gl_VertexID/6 to get the vertex ID and the tileID. To map the UV coordinates, I pass a TBO, which is updated at every camera move. I don't know how expensive this calculation is for the GPU.
Hoping on the train of attributeless rendering, I can pass a uniform or create a const array to hold the UV offsets of every tile type, and only pass at every camera move the updated tile type IDs to the shader (with a uniform?). With gl_VertexID/6 I know which index holds the current tiles type information, and then with this type, I can access my constant array to lookup the UV coordinates.
Either using triangle strips, or indices to reduce the vertex count, and use provoking vertices to correctly map the UV coordinates (this can be combined with attributeless rendering). The vertices are all fixed for the window, and only the textures change. Here, once again, I have to map the TBO to a persistent buffer and update it at every camera move.
Every tile gets a separate draw call (thus a separate VBO, IBO, TBO) and I can therefore render only the tiles which are seen by the camera. Because of the low amount of onscreen tiles, those separate draw calls shouldn't be too expensive.
I put the whole map at the start of the game in the VAO and TBO, and modify the indices buffer, to only render the onscreen tiles (the IBO only holds enough indices to render the onscreen quads). My problem here is that I send too much data to the GPU every frame, and I have a really bad cache locality, because the information has to be accessed from different parts of the buffer objects.
There might also be a way to use a geometric shader, although I have never used one.

My concrete question is, is there a "state of the art" method to render big tilemaps, is any of my above mentioned ideas a good solution, and, does it really matter which option I use?

Thank you!

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:
Avoiding GC when rebuilding Mesh.uv and Mesh.vertices Since unity will not allow users to iterate over mesh.uv and mesh.vertices, I am stuck having to use GC intensive calls when applying an array of uvs and vertices to a mesh. I run into high GC allocation because every time I rebuild a mesh, the uv and vert arrays will be a different size due to the mesh being modified. In turn, this results in having to resize or create new uv/vert array and that is where the garbage collection comes in to be a problem when the old array or list is discarded as well as when applied to the mesh.

Example 1 - List:
For example, building a List UVList for a mesh that is built frequently will require calls of UVList.Add(Vert), this creates garbage for the GC whenever the List is resized with List.Add because when the list is resized, it creates a new copy and the old copy goes into GC. Also, to apply this list to a mesh.uv requires the call UVList.ToArray(); which is a nasty call that creates huge GC if you have a long list of vertices because again, to convert to array, that array after it is copied mesh.uv = UVList.ToArray() the UVList array created goes to GC.

Example 2 Array:
I've instead tried using fixed array sizes but then learned that you cannot iterate over vertices or uv array of a mesh. For example, using a for loop to directly apply a vertices array to mesh.vertices will result in no mesh showing (i.e. for(i = 0; ...){ mesh.uv[i] = uvArray[i];} )

If I cannot do this, then I run into the same problem as example 1, because the only way is to create new array every time you want to update your mesh that has diff uv/vert length. Resizing array requires creating a new copy of it, and then you have the same issue with GC.

I tried reading through this example of someone else dealing with Unity GC when frequently updating meshes http://gamasutra.com/blogs/RobertZubek/20150504/242572/C_memory_and_performance_tips_for_Unity.php

He doesn't really explain his helper method in applying the UVs to the mesh and when trying from his example, it also results in GC.

I guess my question is, how can I frequently update a mesh with diff uv/vert array size without running into GC Alloc slowing down my project?

sentences:
How should I store battle effects? I have battle effects that can be anywhere from 50-150 frames (running at 60fps). I need to be able to draw each frame of the battle effect as an additive layer onto my game.

A frame could look something like these:

What is the best way to store these and render these for performance and memory considerations?

Here is a sample battle animation. Warning it is a 1920x2720 texture:

http://i.imgur.com/pTf9TkY.png

sentences:
OpenGL - question about glColorPointer So, I'm just starting out with LWJGL, and my current task is to render two colored cubes on the screen. I can render them, however, I'm looking for some advice on the most efficient way to specify the colors. Currently, I'm doing this:

// specify vertices and colors
vertexData.put(new float[] { -0.5f, -0.5f, 0, 0.5f, -0.5f, 0, -0.5f,  0.5f, 0, 0.5f,  0.5f,  0, // 1st cube vertices
                             -1.0f, -2.5f, 0,    0, -2.5f, 0, -1.0f, -1.5f, 0,    0, -1.5f,  0 }); // 2nd cube vertices
colorData.put(new float[] { 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, // colors for 1st cube
                            1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1 } ); // colors for 2nd

In the render loop:

glVertexPointer(vertexBufSize, GL_FLOAT, 0, 0L);
glColorPointer(colorBufSize, GL_FLOAT, 0, 0L);
...
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // 1st cube
glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); // 2nd cube

This works, but I can't help but think that since I'm specifying the exact same color values for both cubes, I'm wasting memory. I was hoping to just have one set of vertex colors that could be applied to each cube that gets drawn. Can it be done? If so, what is the best way to do it?

Thanks

sentences:
AABB for a tile based world I'm on my way with a tiled based game. I have correctly implemented scrolling, position handling etc.

I have (before) had a simple collision system that is a really bad one, and now I'm going to switch from simple x and y checks to AABB.

The real problem isn't really about AABB itself, since I've made a simple application demonstrating the technique - it works like intended. This is for singular, independent objects that is static.

Since I know the technique and how to resolve collisions correctly I wanna apply this AABB technique to my tile world. It is now the real problem (or question?) arises.

Since the world is built on tiles and the world's objects is built together to a world, how would I implement the AABB? Before it was only for single static objects, now for a whole world. Is it possible to create a single world static object or are there any better idea out there?

Should I create a single box for every single tile in the world? It doesn't sound well, but how should I fight this problem down?

Any help is appreciated!

Comments to Nick's answer:

  Considering what you've said about how you previously had a "simple collision system that was a really bad one", I assume you want the latter.

That's correct. The previous collision system made my character get stuck in tiles and it wasn't working properly.

  So you can see how it will haphazardly overlay your four tiles. Your AABB for the object then is a rect with x=7, y=10, w=12, h=15. Let's say this is your only obstacle in the world.

I understand, I think. Does this necessarily mean I have to create a single AABB for every tile?

  You can see that due to his width and height, he now overlaps the top left of your obstacle at {7,10}. So resolve the collision. That's all there is to it.

Yep, that part I understand. For now, the world is built from a single 2D array, but is it really efficient to create an AABB for every obstacle?

Oh, I think it does not really matter if I only loop through the obstacles and tiles in the area where the player is..

sentences:
Difference between Update method and FixedUpdate in Unity? i am starting to learn Unity3d and one of the confusion i get is difference between Update() and FixedUpdate().

I am following Lynda Unity 2D game development tutorial there, the instructor uses Update method, the player has RigidBody2D component and Box collider, he uses the Update method to translate the player, but when i do same in Update the player doesn't move but when i do it in FixedUpdate, everything works. He is giving tutorial from Unity 4.3 and i am taking the course in Unity 4.6.

Where should i use Update and FixedUpdate?

sentences:
Reference counting with resource handles I have implemented a resource handle and resource cache class.  The handle stores an integer id.  The cache stores a vector of objects e.g., Textures.  The handle id acts as an index into the cache asset vector.
I then have a third class which provides methods to get the object(Texture) associated with a given handle.  The class also stores a map of filename, handle for previously loaded objects.
I am trying to add reference counting to the system.  At the moment I store a std::size_t* ref_count in Resource_handle and have the following constructor/destructor/assignment operators:
Resource_handle() : id(0), verifier(0), ref_count(new std::size_t(1)) {}

Resource_handle(const Resource_handle<T>& handle)
: id(handle.id), verifier(handle.verifier), ref_count(handle.ref_count) { ++*ref_count; }

template<typename T>
Resource_handle<T>& Resource_handle<T>::operator=(const Resource_handle<T>& rhs)
{
    ++*rhs.ref_count;
    if (--*ref_count == 0) {
        delete ref_count;
        // reset handle
    }
    id = rhs.id;
    verifier = rhs.verifier;
    return *this;
}

template<typename T>
Resource_handle<T>::~Resource_handle() // reference handling 515 C++ Primer
{
    if (--*ref_count == 0) {
        delete ref_count;
        // unload resource in handle
        // reset handle?
        reset();
    }
}

The above code is not complete but I have two problems I'm aware of so far.

The objects in the Resource_cache vector are not allocated on the heap and Resource_handle has no pointer to them to delete them.

The reference count ref_count is actually counting copies of a particular handle rather than of objects in the cache vector.

How can I resolve these two issues?  I'm wondering if the reference handling should be done in the cache class instead?  However the cache would have no knowledge of how many handles refer to a particular object in its object vector.
Many thanks.
Edit: I did consider std::shared_ptr<T> however research lead me to using handles for the ability to reload resources, easier serialisation and the more lightweight approach.

sentences:
Image drawing then blackscreen on AVD using cordova I have an issue on my android JS based game, the game displays well for 1 second then total blackscreen.

    window.requestAnimFrame = (function(){
      return  window.requestAnimationFrame       ||
              window.webkitRequestAnimationFrame ||
              window.mozRequestAnimationFrame    ||
              window.oRequestAnimationFrame      ||
              window.msRequestAnimationFrame     ||
              function(/* function */ callback, /* DOMElement */ element){
                window.setTimeout(callback, 1000 / 60);
              };
    })();

    (function() {
        var game = {
            canvas : document.getElementById('canvas'),
            frameWidth : 1280,
            frameHeight : 720
        };
        game.context = game.canvas.getContext('2d'),
        game.canvas.setAttribute('height', game.frameHeight);
        game.canvas.setAttribute('width', game.frameWidth);
        game.screens = {
            splash : new Image()
        }
        game.screens.splash.src = "src/img/splash.jpg";
        render(game);
    }());

    function render(game){
        game.context.drawImage(game.screens.splash, 0, 0, 1260, 720, 0, 0, 1260, 720);
        requestAnimFrame(function(){render(game)});
    }

The game works well on CocoonJS, I don't have any build error with Cordova. I tried to draw a rectangle instead of the image and it works.

I'm really sure it's a drawImage() issue.

sentences:
What is the correct way to draw layered Sprites in modern OpenGL? So what do I mean by layered sprites? Layered Sprites are Sprites that consist of multiple layers, e.g. you have sprite sheets for the basic Body, the Head, Clothes, Weapons, etc.

Well now I wanted to know how you would draw this in the most efficient way; right now the idea is to use vertex buffer objects (VBOs), but I heard that it is expensive to change the textures in a VBO...

So what would be the correct way to draw them? My idea right now would be to draw the Map tiles first (with a texture atlas), then I would draw all the basic bodys, then the heads, then clothes, and then the weapons. Would that be the best way or is there a more efficient way?

I also thought of using vertex arrays instead of VBOs, but as far as I know they are deprecated...

sentences:
Widget button hover event works but not click This is my first time making a widget and I'm trying to make a super simple one, just a button. However, when I attach the widget to an actor and try to press it, it doesn't register any click events but it does register hover events and responds to those.
I have my widget blueprint which looks like this:

I then have the mouse events set up like so:

In my scene I just attached a widget component to an empty actor:

And lastly I added a WidgetInteraction component to my player:

Now when I hit play and test it out, I get the hovered message but I can never get the click message when I click on the button and I'm not sure why.

sentences:
Unity3d High level literature Is there any high level literature for mid professional programmers for Unity?
There are a lot of tutorials for beginners, but I can't find anything about main API, pipeline or engine architecture. Recommend, please!

sentences:
XNA: Why use Xact when I can use Content.Load? I have to add sound to a game and I found that you can use xact. That's fine, however why not just use Content.Load?

Besides the tweaking of the sound, are there any other advantages to using Xact?

sentences:
Mandelbrot set not displaying properly I am trying to render mandelbrot set using glsl. I'm not sure why its not rendering the correct shape. Does the mandelbrot calculation require values to be within a  range for the (x,y) [ or (real, imag) ] ?
Here is a screenshot:

I render a quad as follows:

float w2 = 6;
float h2 = 5;
glBegin(GL_QUADS);

glVertex3f(-w2, h2, 0.0);
glVertex3f(-w2, -h2, 0.0);

glVertex3f(w2, -h2, 0.0);
glVertex3f(w2, h2, 0.0);

glEnd();

My vertex shader:

varying vec3 Position;

void main(void)
{
    Position = gl_Vertex.xyz;

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

My fragment shader (where all the meat is):

uniform float MAXITERATIONS;

varying vec3 Position;

void main (void)
{
   float zoom = 1.0;
   float centerX = 0.0;
   float centerY = 0.0;

   float real = Position.x * zoom + centerX;
   float imag = Position.y * zoom + centerY;

   float r2 = 0.0;
   float iter;

   for(iter = 0.0; iter < MAXITERATIONS && r2 < 4.0; ++iter)
   {
    float tempreal = real;

    real = (tempreal * tempreal) + (imag * imag);
    imag = 2.0 * real * imag;

    r2 = (real * real) + (imag * imag);
   }

   vec3 color;

   if(r2 < 4.0)
    color = vec3(1.0);
   else
    color = vec3( iter / MAXITERATIONS );

gl_FragColor = vec4(color, 1.0);
}

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:
Rotate meshes with different pivots, equality If I have multiple equal meshes but with different pivots and I make a rotation on the first, is there a way to replicate this rotation to all meshes using a rotation Matrix?
For example, if I have a cube, one with it's pivot in the center and another with the pivot outside of the mesh, how can I rotate the first one 90 degrees on the X axis and use it's rotation Matrix to have the second model rotate on itself and not on his pivot?
Assuming that when I pass on the rotation matrix to other meshes I can't pass the vector of the pivot, is this possible?

sentences:
2D Platform Game Jumping I'm currently writing a game in XNA for fun which uses C#.  I have got my sprites loaded and when the character moves right he looks like he is running right and when he moves left he looks like he is running left.

I been looking everywhere for a good coding example for how to create a jumping ability.  I have read all the physics stuff that I can stand and it doesn't help when I can't figure out how to use say space bar to jump yet can't keep them from using space just jump again until they land.

sentences:
How Can I Monetize With Startapp A Libgdx Game Made With Aide I have created a libGDX game with the AIDE IDE Android app. The game is working fine so I will be uploading it to the Play Store to make money.

I'd like to use Startapp ads, how would I integrate it?
I Will Using Aide Premium

sentences: Oculus DK2 won't display Unity 5 I am having a problem with my game showing on my Oculus. I checked mark "Virtual Reality Supported" in Player settings. When I run the exe, I right click to use the option to play on Rift, but it just plays on my Desktop(and it plays fine on its own). The Oculus Configurations Utility shows that my Oculus is "ready," but it doesn't detect to run on the Oculus. I haven't used my Oculus in awhile and use to having the direct to rift option and extended mode, so it's pretty foreign to me- so help is appreciated.

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 can I implement fast, accurate 2D collision detection? I'm well aware of how to detect if two or more 2D objects collide but I'm interested in how to decide whether to check for a collision. In previous projects, I just had every object check against every other object (I know, O(n^2) level of stupidity) and it created a less than fluid gameplay.

Various forums hail the greatness of Quadtrees, B-Trees, and any other kind of tree or structure you can think of.

What is the most efficient structure for determining whether a collision should be checked?

sentences: How can I let a player post their score to Facebook at the end of the game? I have an HTML5 game on my site, and at the end, I want the user to have the option of posting their score to their Facebook wall. Is there an easy way to ask to post something to Facebook?

sentences:
Rotation of Rectangle along Y-axis transformed to parallelogram After the rotation of a rectangular view along the Y-axis, about its center, transformed into parallelogram, how do I get the rotated parallelogram coordinates?

By Y-axis, I mean perpendicular to the device screen.

Rotated rectangle:

Original rectangle:

Not using the openGl, ViewProperty animator is used!

sentences: How to make inventory pause screens in Gamemaker? I'm making a game in Game Maker, and I want to know how to make it so you can pause into an inventory screen and then go back to the same position you were in (also the same room) after you press a back button. It would also be great if all the dead enemies were dead and the alive ones were at the same position also.

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 do I ensure proper date formatting? I'm trying to load a date in the form of a string. As there is always 4 possible date formats (x.x.xxxx, x.xx.xxxx, xx.x.xxxx, xx.xx.xxxx (day month year)) I had to take this into account and it is especially hard with the strings length of 8 as it is either xx.x or x.xx.

So I came up with this:

public void setDate(String CompleteDate, boolean loadOrNew){
  Date = CompleteDate;
  if(loadOrNew){
    int totalLength = Date.length();
    String sday = null;
    String smonth = null;
    String syear = null;
    if(totalLength == 9){
      sday = String.valueOf(Date.toCharArray(), 0, 2);
      smonth = String.valueOf(Date.toCharArray(), 3, 2);
      syear = String.valueOf(Date.toCharArray(), 6, 4);
    }else if(totalLength == 8){
      sday = String.valueOf(Date.toCharArray(), 0, 2);
      if(sday.contains(".")){
        smonth = String.valueOf(Date.toCharArray(), 2, 2);
      }else{
        smonth = String.valueOf(Date.toCharArray(),3, 1);
      }
      syear = String.valueOf(Date.toCharArray(), 5, 3);
    }else if(totalLength == 7){
      sday = String.valueOf(Date.toCharArray(), 0, 1);
      smonth = String.valueOf(Date.toCharArray(), 2, 1);
      syear = String.valueOf(Date.toCharArray(), 4, 4);
    }else{
      Toast.makeText(c, "Critical date format error occurred. Error G205", Toast.LENGTH_LONG).show();
    }
    sday.replace(".", "");
    smonth.replace(".", "");
    syear.replace(".", "");
    this.day = Integer.parseInt(sday);
    this.year = Integer.parseInt(syear);
    this.month = Integer.parseInt(smonth);
  }
  date.setText("Date: " + CompleteDate);
}

However it isn't correct as I get NumberFormatException with "1."

This means I somewhere messed up and the removing of the "." doesn't work. So I need help improving this so it works.

NOTE:

Some of this is android-specific, e.g. the Toast class and TextView class, but everything else is in standard Java.

date and Date isn't the same. Date is the String, date is the TextView(android).

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 to implement a pannini projection in opengl? I have read about the pannini projection, which involves (I think) projecting a scene onto a cyclinder instead of a rectangle.

How can I implement this projection in a vertex shader?

Blinky is using lenses and globes, but I don't think it's what I am looking for. The lua script for the pannini projection is not commented https://github.com/shaunlebron/blinky/blob/master/game/lua-scripts/lenses/panini.lua

As explained on http://tksharpless.net/vedutismo/Pannini/ the projection works (if I understand it well), by projecting geometry on a cylinder, and then unrolling that cylinder on screen.

sentences:
Increasing speed of circle over time as linear with Box2d Assume that there is a circle and it can be moved by using keyboard arrows.Is required that increasing speed over time like increasing car speed. For example; max speed is 25 and time to reach max speed shall be 5 sec. Over 5 sec the speed will reach to max speed. Does Box2d handle that situation?.
I tried setting linear valocity but it seems to make the circle have constant speed instead of increased speed over time.

Thank You!

Note: I'm using Box2DWeb Javascript port of Box2D.

sentences:
What is the most common art creation process? I am a developer and when I think about the creation of art assets I am a little lost. My idea is to create concept art first to get my thoughts into real images and after that start creating the backgrounds, sprites, menus, etc.

It sounds simple written like this and I expect lots of inner work, but is there a more formal way to do it? or at least something like a standard procedure?

sentences:
In-app purchases: Restore unlocked items on new device I am building a mobile game for Android / iOS with support for in-app purchases. Our game also supports unlock codes (aka promo codes). A user can enter an unlock code in our app to unlock one or more IAP items for free. We want to ensure, that if a user changes his device, we is able to restore all IAP items and unlocked items.

As the promo code feature provided on app stores is either quite limited in functionality or not available at all, we've decided to build our own backend to manage unlock codes. If a user enters an unlock code, we register this in our backend.

So, when a user re-installs the app, we need to talk to two systems to get the full list of purchased/unlocked items:

Talk to app stores to fetch list of purchased items
Talk to our own backend to fetch list of unlocked items

To make sure that the user gets his unlocked items even after an app-reinstall on a different device, we need to have an identifier which is not based on the device but rather on a user account. Unity does not provide access to Apple ID / Google ID, so my question is, how to accomplish this in a good way?

At the moment, the only possible solution I see is this:

Users must register with us (e.g. email and password). We store the list of unlocked items in our own backend. In case of an app reinstall on a new device, the user must login to our backend and unlocked items become available again.

Are there any better solutions to this?

sentences:
Algorithm for fitting geometrical 2d shapes like in the android game Six! (or Tetris)? In the game Six!, there's a perfectly rectangular tower of geometrical 2d shapes, that you destroy on tap to reach the ground with your player. The easy way would be to design the levels by hand. However, I wondered how to do this with an algorithm, so that you save a lot of time? Any idea?

I use the Godot Engine 3.0, fyi.

sentences:
Populating NPC's Outside Of Loop This was my original question:
Populating Sprites
I used the following code to spawn Enemy Sprites in my game. I have 2 types that I was using and it would display one then remove it and display the other. It did this repeatedly(Imagine someone playing with a light switch and you have what is happening with the NPCs. EnemyType1 is Off and EnemyType2 is On.).Also It does not apply the current level number meaning, it does not spawn the number of enemies for the level. The number of enemies I want to spawn is the exact number of the level.  I used other types of random methods( nextBoolean(), nextInt(), nextFloat() ). I showed the code to my friend and he told me that I would need to spawn them outside of my loop, but he did not know how to. So now I am trying to see if anyone on stack could help me. What I am trying to do is this:

NPC's = Enemies

I have 2 types of NPC's that I want to use. The number of Enemies that are spawned are equal to the the current level number. I want to be able to spawn how ever many is needed for that level and have it to where which Enemy that will spawn is random, so you don't know if you will get EnemyType1 or EnemyType2 or a Mix. Ex: Level 1, only 1 Enemy spawns, the type is random. Level 2, only 2 Enemies spawn, the type is random. Level 3, only 3 enemies spawn, the type is random. etc.

Thanks In Advance.

sentences:
2D simulating light sources (subtract a texture from an other) I want to simulate a night and day cycle with SFML (plain 2D, no shadows). What I want is to get a smooth transition from day to night, and during night having some lights "on".

So the approach I've thought is adding a black layer on top and change its transparency with time, that gives the effect I'm looking for. For adding lights I can crop out circles out of that layer

sf::CircleShape lightCircle(200);
lightCircle.setFillColor(sf::Color(255, 255, 255, 1));

sf::RenderTexture renderTexture;
renderTexture.create(/* view size */);

while (window.isOpen()) {
  // ...

  // update light
  renderTexture.clear(sf::Color::Black);
  renderTexture.draw(lightCircle, sf::BlendNone);
  renderTexture.display();

  // draw
  window.clear();
  window.draw(sf::Sprite(renderTexture.getTexture()));
  window.display();
}

Now, what I would like to do is use my own image instead of a CircleShape. Say a circle or a cone with fading borders, some more realistic than just a circle. Like

I have tried with sf::Image and createMaskFromColor but I'm not able to handle the fading edges.

How can I get that?

Am I in the right path or is there a simpler approach?

sentences:
How to correctly pass multiple light structures to shader stage? I'm having some problems when passing multiple light structures to a shader stage. I'm using an array of point lights that is updated each frame.

This is my code for creating the buffer

D3D11_BUFFER_DESC lbDesc;
lbDesc.ByteWidth            = sizeof( PointLightData ) * NUM_LIGHTS;
lbDesc.Usage                = D3D11_USAGE_DYNAMIC;
lbDesc.BindFlags            = D3D11_BIND_CONSTANT_BUFFER;
lbDesc.CPUAccessFlags       = D3D11_CPU_ACCESS_WRITE;
lbDesc.MiscFlags            = 0;
lbDesc.StructureByteStride  = 0;

hr = mDevice->CreateBuffer( &lbDesc, nullptr, &mLightBuffer );

And this is how I update it

D3D11_MAPPED_SUBRESOURCE mappedResource;
hr = mDeviceContext->Map( mLightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource );

if( SUCCEEDED( hr ) )
{
    memcpy( mappedResource.pData, &mPointLightData[0], sizeof(PointLightData) * NUM_LIGHTS );
    mDeviceContext->Unmap( mLightBuffer, 0 );
}

mPointLightData is declared like this

mPointLightData = new PointLightData[NUM_LIGHTS];

In my shader I declare the light

struct PointLight
{
    float4  positionAndRadius;
    float4  ambient;
    float4  diffuse;
    float4  specular;
    float3  attenuation;
};

cbuffer CB_LIGHT : register(b1)
{
    PointLight  pointLight[2];
};

I can only access the first light object in the buffer successfully. Rendering the second light results in a pitch black scene.

However, if I change the starting address at the mapping stage from &mPointLightData[0]  to  &mPointLightData[1] the second light works but obviously not the first.

So my guess is that I'm doing simething wrong at either the mapping stage or at the creation of the buffer..

Any suggestions? Thank you!

sentences:
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:
Playing a sound once pygame I'm trying to play background music and the music keeps on starting. I tried to use music.busy, but I can't figure it out. I want it to check if sound/music is playing, then I want it to print "music is playing". If a sound/music isn't playing I want it to start up a new song and loop it.

def musica():
    if pygame.mixer.music.get_busy() == True:
        print("music is playing")
    if pygame.mixer.music.get_busy() == False:
        music.play(loops=-1)

sentences:
Scrambling word into least recognizable form My goal is to present the player with a scrambled word that should be reordered back into the original form:

OELHL --> HELLO

I want a scrambling algorithm that takes any given word(>3or4 letters, may contain spaces) and turns it into the least recognizable form.

While randomly moving every letter around certainly works, I noticed that not all shuffles are equal, some are more recognizable than others. I am posting this question in case someone knows of a better algorithm (maybe based on linguistics) that ~~guarantees least recognizable form.

sentences:
updating 2d array to contain chunk of larger 2d array - for 2d tile map What i need help with is how can i get a chunk of a large 2d char array and update it so i am only drawing enough tiles to cover the screen?

Currently, i load all the chars from a text file and store them in an array. I then create a smaller array:char[][] toDraw = new char[height][width] which gets the first height*width area of chars from the larger array like this:

  public void filterMap() {
    for(int i = 0; i < height; i++) {
        for(int j = 0; j < width; j++) {
            toDraw[i][j] = MapLoader.mapData[i][j];
        }
    }
}

I then draw the map using this drawMap method:

public void drawMap(Canvas canvas) {
    for(int i = 0; i < height; i++) {
        for(int j = 0; j < width; j++) {
            if(getBitmap(toDraw[i][j]) != null) {
            canvas.drawBitmap(getBitmap(toDraw[i][j]), x + (j*tileSize), y + (i*tileSize), null);
            }
        }
    }
}

note the int x and y are what i increment to move the map, getBitmap(char c) returns a Bitmap from a char, MapLoader.mapData is the 2d array that the text file loads into.

I have tried a few ways of using an offset in the toDraw arrays index to scroll the data relevant to the x,y location but they have been buggy/failed.

So, does anybody have a link to how things like this can be done (I have tried but have found none that help) or could someone with experience in 2d games please tell/show me how this should be done.

Currently my code will get a area from the larger array and draw it to the screen, the only problem is updating the data in the toDraw array. thanks.

The game is made for android but is not included in tags because i dont feel it is relevant to the problem

sentences:
Geometry Shader and Stream Output with Directx11 I am having trouble trying to send verticies generated in the Geometry Shader to Stream Output. What I am trying to accomplish is to generate verticies from the Geometry Shader and store them to a vertex buffer so that I can use the vertex buffer to draw later.

I read that I have to use the CreateGeometryShaderWithStreamOutput function to create a Geometry Shader that can send verticies to Stream Output instead of the rasterization stage.

This is how I am trying to use it:

    device->CreateGeometryShaderWithStreamOutput(this->mGSBlobSO->GetBufferPointer(), this->mGSBlobSO->GetBufferSize(), so_decl, 1, &stride, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &this->mGeometryShaderSO)

I am getting an E_INVALIDARG at this line. I am specifying D3D11_SO_NO_RASTERIZED_STREAM because I think this means that I do not want to send data to the rasterizer but I am not sure. When I replace D3D11_SO_NO_RASTERIZED_STREAM with a 0, I do not get this runtime error, but I do not get the result I want.

How can I setup the geometry shader to store vertices to a vertex buffer in Stream Output?

sentences:
Unity Lighting Problems I've got a problem with the settings of lighting in my unity scene.

The objects have got "dark sides" and it doesn't look natural.

You can see the screenshots and my light settings here:

The screenshot that shows the problem

sentences:
UE4 Blueprint Multiplayer Spawning Issue I'm attempting to copy/modify the MultiplayerShootout project's multiplayer functionality for my own project. I'm running into issues when Player 2 joins a running session though. Finding it very hard to debug multiplayer stuff because you have to run it in standalone and toggling breakpoints doesn't seem to be illustrating any issues.
Here's the issue:
https://youtu.be/270p4YS36Pw
The first player to search for a game hosts a game, then the OnPostLogin in the GameMode fires and calls the ClientPostLogin event in the PlayerController, then the PlayerController calls the RespawnPlayer event inside the GameMode which spawns and possesses the character. The second player finds a session and joins it, but the server is not spawning a character for them on the other PlayerStart.
The logic is very much similar to the MultiplayerShootout, but I have modified it in the following ways:
The 1v1 button searches for sessions, and if it can't find any it will automatically host a session.
The ClientPostLogin event on the PlayerController and the RespawnPlayer event on the GameMode accepts a Selected Character (Actor class) variable. This is so I can get the player to select their character before they matchmake and pass it through to the PlayerController and then GameMode for spawning purposes. Would really appreciate some help on this, been stuck on it for a while.
Here's some of the blueprint scripting to make sense of it:

OnPostLogin event in the GameMode

ClientPostLogin in the PlayerController

RespawnPlayer event in the GameMode

1v1 button released event in the PlayScreen Widget

HostGame event in the GameInstance

JoinGame event in the GameInstance
Edit: I'm using UEngine version 4.24.3

sentences: GL_EXT_draw_instanced vs VBO's I'm having trouble understanding the benefit of the newer GL_EXT_draw_instanced over traditional VBO's.  Don't both keep geometry cached on the gpu for faster redrawing?  VBO's seem much more flexible.

sentences:
Mixing sprite drawing with 3D primitive drawing in XNA? In my game, I have a base Note class, and various subclasses of Note. In addition, I have a NoteCollection class which contains a collection of these Note objects and draws them to the screen. Normally, I'd just do something like this in NoteCollection:

public override Draw(GameTime gametime) {
    ...
    spriteBatch.Begin(...);
    foreach(Note n in notes)
        n.Draw(gameTime);
    spriteBatch.End();
    ...
}

However, some of these Note subclasses also need to draw 3D primitives in their Draw() methods. I imagine setting vertex buffers in the middle of a SpriteBatch Begin()/End() block isn't a good idea (I've tried it, anyways). What would be nice would be a SpriteBatch.Pause() method that would save the state of the SpriteBatch, and then you could resume drawing your sprites with, say, a SpriteBatch.Resume(). But alas, there's no much methods.

In short, is there any way to go about this? I'd rather not call SpriteBatch.End()/Begin() from each Note.Draw(), as it'd be really slow and I wouldn't necessarily know what parameters the original outside Begin() was called with.

EDIT: Even though I'm using 3D primitives, my game is still in 2D. All of the Z-coordinates of my vertices are 0.

sentences:
WebGL game won't go into fullscreen mode on iOS devices I have built my game and hosted it on itch.io. it works well on PC browsers and on the mobile Android browser.
The problem appears when I try to launch it on an iOS phone: the game won't go into full screen (it's supposed to go into it automatically). I added a button that's supposed to switch to full screen but it doesn't respond (the button does work on PC and Android though).

sentences:
Sending RPC calls from server to client inside Unity In my game inside Unity, I have two scenes setup. One for the main server ( acts like authoritative server ) and the other scene for my client. The game starts once my client connects to the server.

Now I am able to send RPC function calls from my scripts in my client scene to the server but I am not able to do it the other way around.

** Further edit to my code after comments **
*********** This is my client side script attached to GameObject CursorDetection inside Scene2 *****

 using UnityEngine;
    using System.Collections;

    // ON THE CLIENT SIDE
    public class CursorDetectionScript : MonoBehaviour {

        private bool hasGameStarted = false;
        void Update()
        {
           if (Input.GetMouseButtonDown(0))
           {
              networkView.RPC("mouseDown", RPCMode.Server,true);
           }
        }

        [RPC]
        public void mouseDown(bool isMouseDown)
        {

        }

    }

**** On the server side script inside scene1 *******

private void OnPlayerConnected(NetworkPlayer player)
{
    Debug.Log(" PLAYER CONNECTED " +player);
    networkView.RPC("AddNetworkPlayer", RPCMode.AllBuffered, player);
}

[RPC]
public void AddNetworkPlayer(NetworkPlayer player)
{
    playersList.Add(player);
    Debug.Log(" FIRST PLAYER IS " + playersList[0]);
}

 if(startGame)
 {
    networkView.RPC("SendMessageToClient1", RPCMode.AllBuffered, playersList[0]);
 }

[RPC]
public void mouseDown(bool isMouseDown, NetworkMessageInfo sender)
{
    isMouseDown = true;
    Debug.Log("CAN PLACE PANELS NOW" + " VIEW IS " + sender.sender.guid);
}

**** back on the client side script inside scene2 I called the SendMessageToClient1 function call *******

[RPC]
public void SendMessageToClient1()
{
    Debug.Log(" INSIDE CLIENT 1 ");
}

sentences:
How to tell right from left: Finding the vector pointing towards the right side of a character? We have two vectors:

Pointing from the floor to a 3d character's head.
Pointing from the character towards where it's facing.

How do I find the vector point from the character towards the right?

The vector has to be orthogonal with the other two but also face in right direction and not to the left.

This is very similar to the question: Determining if something is on the right or left side of an object?
But I just want the math to computer the third vector from the first two.

sentences:
How do I set up a beta channel for my Steam game? I have a released game on Steam. I'm working on a new version, but before releasing it to the public, I want to be able to test it with my friends on Steam, through a beta channel that can be accessed through this menu:

Can I do this, and how?

sentences:
How to physically move a rigid body up the stairs? When an object is controlled by a CharacterController, it is easy to make it climb ramps with a certain slope, or climb steps with a certain height.

When the object is controlled by a RigidBody instead, it can still climb ramps naturally - I just use AddForce and it walks on ramps just like on any other surface. I do not have to add any special logic for a ramp. However, it does not climb stairs. Is there a natural "physical" way to make the RigidBody climb stairs, without explicitly checking that there are stairs ahead?

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:
Investigation stage before starting a game I was thinking about how to organize the stage about getting informed about whatever game is needed to develop, what would others do.

For example, if I wanted to develop a game about car racing, I should figure out all the factors during the race, from the car factor to the pilots, etc., environmental factors like weather, circuit conditions, etc.

How does one manage this stage?

Thanks.

sentences:
How to render specific FBO Texture attachment (assume attachment1) with 2 attached Create FBO & its textures like normal.

// FBO & Texture
glGenFramebuffers(1, &mFbo);
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
glGenTextures(2, mTexture);

for(int i=0; i<2; i++)
{
    // Init texture
    glBindTexture(GL_TEXTURE_2D, mTexture[i]);
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, SCREEN_W, SCREEN_H, \
        0, GL_RGBA, GL_UNSIGNED_BYTE, 0 );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glBindTexture( GL_TEXTURE_2D, 0 );

    // attach to FBO
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_TEXTURE_2D, \
        mTexture[i], 0);
}
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glUseProgram(0);

Bind FBO and render it inside draw loop.

// Preparing FBO texture.
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

GLuint at0[1] =  {GL_COLOR_ATTACHMENT0};
GLuint at1[1] = {GL_COLOR_ATTACHMENT0+1};

glDrawBuffers(1, at0);
// Filled texture attachment0 less white (transparency = 0.5f)
GUtils::VideoDriver::GetInstance()->DrawFillRect(glm::vec2(0,0), \
        SCREEN_W, SCREEN_H, glm::vec4(glm::vec3(1.0f/(1)), 0.5f));

glDrawBuffers(1, at1);
// Filled texture attachment0+1 white.
GUtils::VideoDriver::GetInstance()->DrawFillRect(glm::vec2(0,0), \
        SCREEN_W, SCREEN_H, glm::vec4(glm::vec3(1.0f/(1)), 1.0f));

glBindFramebuffer(GL_FRAMEBUFFER, 0);

After all things I did above:

texture attachment0 (mTexture[0]) will be filled in less white.
texture attachment1 (mTexture[1]) will be filled in white.

Right?

I cannot understand when render FBO texture:

glBindTexture(GL_TEXTURE_2D, mTexture[index]);
glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0 );
glBindTexture(GL_TEXTURE_2D, 0);

mTexture[0] , screen = white. (It must be less White)
mTexture[1] , screen = black. (It must be White)

Firstly, Did i do a right way to render attached FBO texture or am I misunderstood fbo attachment?

Lastly, How can I fix this?

sentences:
DirectX 11, using Tessellation & Geometry shader in a single pass Before all, sorry for my poor english !

With DirectX 11, i'm trying to create a random map full with GPU.

Using Hull shader stage, I'm managing LOD with tessellation.

Using Domain shader stage, I'm generating the map (based on perlin noise).

Now my goal, is to compute normals in the geometry shader (normal on vertex).
For that, I must use vertex adjency, like geometry is capable of.

But here is the problem... For tessellation, my primitives must be
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST.

But for geometry shader with 6 vertex (triangle primitive and adjency), I must use :
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ.

Think I'm missing something... It must be possible to tessellate and use the results in the geometry shader...
However, it's working with 3 points, but I cannot use the 3 others (they are 0.0, 0.0, 0.0)....

Thank you in advance for any help ;)

sentences:
How should I access frame buttons from a controller in an MVC approach? I'm developing an italian card game using the mvc pattern. I have the class GameFrame that contains the view. The user's card are buttons (JButton objects). I have 3 controllers:

GameController: to control the game in general. Contains the game loop.
HumanPlayerController: to control the user input
ComputerPlayerController: contains the AI of the computer
PlayerController: is an interface with the makeTurn() method. It's implemented by HumanP.C. and ComputerP.C.

HumanPlayerController implements ActionListener too. But what is the right way to access to the GameFrame buttons? I need it for understand which card was chosen.

GameFrame and HumanPlayerController are in different packages. Should i make the JButtons public?

sentences:
Point to using vSyncCount higher than 1? Is there a point to using QualitySettings.vSyncCount higher than 1?

From my understanding it sets the framerate to fractions of the screen refreshrate (i.e: FPS = refreshrate/vSyncCount). So 1 is standard VSync and 2 to 4 make no difference compared to 1 for eliminating tearing and only artificially limit framerate.

The only use for this that I can think of is for reducing power-draw for battery-driven devices like phones. Am I missing something?

sentences:
How to align text dynamically inside a rectangle with Phaser JS I am just starting to learn the Phaser JS framework with my first game. I did not managed to find a way how i can align text inside a rectangle element dynamically without specific coordinates. Here is what i have

pointH11L1 = game.add.text(0, 0, '20');
pointH11L1.stroke = "#000";
pointH11L1.strokeThickness = 4;
pointH11L1.font = 'oswaldbold';
pointH11L1.fontSize = 22;
pointH11L1.fill = '#999999';
//pointH11L1.alignIn(graphicsRectH12L2, Phaser.CENTER);
graphicsRectH12L2.addChild(pointH11L1);
pointH11L1.x = pointH11L1.width / 2 - 6;
pointH11L1.y = -2.5;

//graphicsRectH12L2 is the  rectangle inside which i need to align.

var graphicsRectH12L2 = this.game.add.graphics(950, 405);
    graphicsRectH12L2.beginFill(0xffcd00, 1);
    graphicsRectH12L2.drawRect(0, 0, 44, 29);
    graphicsRectH12L2.endFill(0xffcd00, 1);
    group.add(graphicsRectH12L2);

sentences:
Why would an ambient occlusion (AO) shader's performance be dependent on light direction? One of my favourite games recently implemented ambient occlusion as a graphics feature, which appears to perform very well in most circumstances - except during sunrise and sunset. As someone who is getting into shader programming, I'm intrigued by this.

My understanding of AO is that you precompute the diffuse shading for a range of incident vectors, then use that information to produce a correct shadowing scale for real-time use by enumerating over all the lights and computing how their position in relation to the object compares to each of the incident vectors, essentially interpolating across the closest values. Since the occlusion is pre-computed against a model, taking complex shapes and self-occlusion into account, you don't need to raytrace and the performance is much better.

So here's where I get lost - since the diffuse map is precomputed, and you're just comparing light positions to those maps for all objects within the screen space, why would performance suffer for cases where the ambient light (the sun) is close to the horizon? It seems like this shouldn't matter - surely the performance of such a shader scales against vertices, not the angle of the light?

The game uses the latest version of Unity (they just bumped up a minor release) but I don't know if they use the built-in Unity SSAO shader. Performance hit is major - 28fps at 1440p during "day" hours, dropping to 12-14fps during sunrise/set. This only occurs when AO is enabled.

I'm not interested in finding a solution - I'm sure they'll fix it sooner or later - I'd just like to get a better idea of how AO performance scales, what its pain-points are, and why this kind of behaviour might appear.

sentences:
Does C# have a future in games development? I recently learned that the MMO Minecraft is powered by Java from a recent interview on CVG.co.uk on a possible collaboration between two former and now competing colleagues. In the interview he bluntly said that the founder of Minecraft is a Java coder and he is a C or C++ coder so they are incompatible with each other. So collaborating on future projects will be difficult.

This got me thinking, If Java could do that? What does the future hold for MS very popular C# language and .Net platform as far as games or mainstream games development is concerned?

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:
How Lots of ComputeBuffers at Once Affect Performance Unity How will lots ComputeBuffer instances affect performance? And why?
I know that I should call ComputeBuffer.Release() on every ComputeBuffer I create, but will it affect performance if I were to have lots of open ComputeBuffers at once? and by "lots" I mean hundreds to thousands.
It of course goes without saying that all of those ComputeBuffers will be released at some point, possibly at the same time.

sentences:
Prevent navmesh blocking I'm writing a tower defense game in Unity, inspired by Desktop Tower Defense.

Creeps spawn on one side of the screen, and if they make it to the opposite side, the player takes damage.  The board starts out unobstructed, and the player builds towers that shoot at creeps while also blocking their path.  They can funnel creeps along a path by strategic placement of towers.

I have a terrain GameObject with a NavMesh, each creep has a NavMeshAgent, and each tower has a NavMeshObstacle.  This works fine, the creeps go toward the goal and avoid the towers.

The problem is that the player is not allowed to block off all of the paths to the goal.  If placing a tower would leave no routes open to the goal, it is not valid to place a tower there.  I can detect this after the tower is placed, but I want to warn the player and prevent the placement from happening at all.

I also don't want to even briefly block the path to the goal by temporarily placing a NavMeshObstacle in an invalid position, because it might be exploitable by players by repeatedly attempting to place a tower there.

How can I predict whether placing a NavMeshObstacle will completely block a route between two paths, while NavMeshAgents are actively traversing the NavMesh?

sentences:
How can I add an IsTrigger propriety from code? Unity I made an gameobject in my script and i made it a rigidbody, and added it a boxcollider, but I dont know how to tell the program to make it a trigger. Here's my code until now:

multi = new GameObject();
                multi.AddComponent<Transform>();
                multi.transform.position = new Vector2(1f, 1f);
                multi.AddComponent<Rigidbody2D>();
                multi.AddComponent<BoxCollider2D>();

sentences:
Is Java AWT suitable for 2d game rendering? [Reposting this question from stackoverflow, as it was pointed out that it fits better here.]

I'm currently porting my 2D game engine to Java. I looked at some of the game libraries pointed at here on stackoverflow. However, the ones I looked at were rather simplistic and didn't even state if they supported things like alpha transparency, so I decided to port my C++ renderer for which I had already written out the logic.

This renderer is a pure software renderer which uses tiling to avoid needless re-rendering. I optimized its scrolling performance by creating an "offscreen buffer" a little larger than my output pane, and blitting this offscreen buffer onto my output on every frame. This way, I could avoid redrawing tiles needlessly just because I scrolled a pixel on the map.

I used Java's AWT to implement it, using a large BufferedImage for the offscreen buffer. The CPU usage is okay(around twice of what I had in C++), but there's an odd problem with continuous scrolling, where every second or so, the renderer will lag out for around 0.2 seconds.

Since there's nothing in my own code that would occur in these periods, and since the spikes disappear if I don't draw my offscreen buffer onto the main view, I can only conclude that Java is doing some internal optimization of its own. However, I'm not sure what it does, nor do I know which of my own optimizations I would have to remove to get rid of the spikes. Also, it might be that java AWT wasn't made with continuous, high FPS scrolling in mind, and that's entirely unusable for this purpose.

Is there some way for me to get rid of these spikes?

sentences:
Unity 2d sprite repeated as background I'm a web developer with over 12 years of experience and I'm moving my first steps in game development in the latest days. Specifically I'm playing with Unity and trying to understand how it works and how can I realize a 2d platform game. Currently I created a character that can be controlled with the keyboard (it moves to right, left and can jump), so far it seems more easy than I was expecting and despite I never used C# before I'm already quite comfortable. My first big concerning is about sprites and how can I create combined sprites or use an image as a repeated background.
For example, let's imagine that I have a png of a brick and that I want to use it to create a wall, that can be of a variable width and height. How can I achieve that? With html/css I would simply create a class like this:

.wall {
    background: url(brick.png);
}

and by applying that class to any html element it will render a repeated background by adapting it to its container no matter how large or tall is it. In unity/C# what should I do?

So far I tried to create a new material and applied it to a cube object but the result is that the image gets stretched and sucks.
I saw some example that creates N sprites programmatically by adding them one after another, but I wonder about the performance implications of this technique... for example if I have to repeat the brick 100 times I have to create 100 objects, it seems unfeasible to me!
What I want to achieve is the most flexible, simple and performant way to create "shapes" with repeated background.

sentences:
Why is the mana regenerating too fast? So I got this weird problem with regeneration - I decided to create a mana bar which is going down every time when character attack. When the bar is less than integer 100, it should regenerate 1 points per 9 seconds and then stop. The problem is that instead of it, mana regenerate rapidly after chosen time and then, with every attack it regenerate so fast, that is basically staying in same place.

        ////MANA REGENERATION
        currentTime += gameTime.ElapsedGameTime.Milliseconds;
        if (max_mana>=0 && max_mana <= 100 &&currentTime >= 9000)
        {
            max_mana += 1;
        }

that's the parameters for the mana:

in Initialize:

   //PLAYER MANA RECTANGLE

    Texture2D manabar;
    Vector2 posManaBar;
    Rectangle recManaBar;
    //REGENERATION TIME FOR MANA

    int max_mana;
    float currentTime = 0;

In drawGameplay:

        //PLAYER MANA
        spriteBatch.Draw(backBar, posManaBar, recBackBar, Color.Gray);
        spriteBatch.Draw(manabar, posManaBar, recManaBar, Color.Blue);
        recManaBar.Width = max_mana;

sentences:
When is an intro too long for game logos? After doing some searching and finding no answers, I decided it would be okay to ask here.

In indie or big company games, when they show their logo or have an animation for that company logo, what is the average display time for it and how often do they have themes or sounds with that splash screen?

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:
How to build a "traffic AI"? A project I am working on right now features a lot of "traffic" in the sense of cars moving along roads, aircraft moving aroun an apron etc.

As of now the available paths are precalculated, so nodes are generated automatically for crossings which themselves are interconnected by edges. When a character/agent spawns into the world it starts at some node and finds a path to a target node by means of a simply A* algorithm. The agent follows the path and ultimately reaches its destination. No problem so far.

Now I need to enable the agents to avoid collisions and to handle complex traffic situations. Since I'm new to the field of AI I looked up several papers/articles on steering behavior but found them to be too low-level. My problem consists less of the actual collision avoidance (which is rather simple in this case because the agents follow strictly defined paths) but of situations like one agent leaving a dead-end while another one wants to enter exactly the same one. Or two agents meeting at a bottleneck which only allows one agent to pass at a time but both need to pass it (according to the optimal route found before) and they need to find a way to let the other one pass first. So basically the main aspect of the problem would be predicting traffic movement to avoid dead-locks.

Difficult to describe, but I guess you get what I mean. Do you have any recommendations for me on where to start looking? Any papers, sample projects or similar things that could get me started?

I appreciate your help!

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:
Spawning random objects at random positions in the 3D world My main character can move horizontally and not vertically. It can move from x = -4 to 4 and z = -4 to 4 (a square area). I don't want objects to spawn where my character can move but every where else.
I wrote the following script. According to me it should have worked perfectly fine. But, I can't figure out why the objects are still spawning in the perimeter where the main character is present.

public class SpawnGameObjects : MonoBehaviour
{
    public float secondsBetweenSpawning = 0.1f;
    public float xMinRange = -25.0f;
    public float xMaxRange = 25.0f;
    public float yMinRange = -5.0f;
    public float yMaxRange = 0.0f;
    public float zMinRange = -25.0f;
    public float zMaxRange = 25.0f;
    public GameObject[] spawnObjects; // what prefabs to spawn

    private float nextSpawnTime;

    void Start ()
    {
        // determine when to spawn the next object
        nextSpawnTime = Time.time+secondsBetweenSpawning;
    }

    void Update ()
    {
        // exit if there is a game manager and the game is over
        if (GameManager.gm) {
            if (GameManager.gm.gameIsOver)
                return;
        }

        // if time to spawn a new game object
        if (Time.time  >= nextSpawnTime) {
            // Spawn the game object through function below
            MakeThingToSpawn ();

            // determine the next time to spawn the object
            nextSpawnTime = Time.time+secondsBetweenSpawning;
        }
    }

    void MakeThingToSpawn ()
    {
        Vector3 spawnPosition;

        // get a random position between the specified ranges
        spawnPosition.x = Random.Range (xMinRange, xMaxRange);
        spawnPosition.y = Random.Range (yMinRange, yMaxRange);
        spawnPosition.z = Random.Range (zMinRange, zMaxRange);
        if ((spawnPosition.z < 4 && spawnPosition.z > -4) || (spawnPosition.x < 4 && spawnPosition.x > -4))
        {
            MakeThingToSpawn ();
        }

        // determine which object to spawn
        int objectToSpawn = Random.Range (0, spawnObjects.Length);

        // actually spawn the game object
        GameObject spawnedObject = Instantiate (spawnObjects [objectToSpawn], spawnPosition, transform.rotation) as GameObject;

        // make the parent the spawner so hierarchy doesn't get super messy
        spawnedObject.transform.parent = gameObject.transform;
    }
}

sentences:
GUI.Button inside GUI.Window not responding I am trying to do some GUI work with unity but am having some issues.

I call a window with this code:

fortuneRect = GUI.Window(0, fortuneRect, fortuneWindow, "Your future");

and inside the window I have a button

if(GUI.Button(new Rect(10, 10, 150, 20), "save fortune")){
       Debug.Log("save fortune button press");
       writeToFile("Button pressed!", "fortune.txt");
       Debug.Log("After save fortune button press");
    }

but the button doesn't fire any of its events on click. I tried commenting out the writeToFile but even with only Debugs in the body it doesn't fire.

sentences:
Using DirectWrite to write text on a IDirect3DTexture9 I'm trying to write text using the DirectWrite API on a IDirect3DTexture9. I've heard that people were capable of doing this but I do not see directly how I can glue these two APIs together.

It seems I need a IDXGISurface to create a valid ID2D1RenderTarget (with which I can draw the text). I can get this by creating a surface for the Window. But I think the idea is that I use the IDirect3DTexture9 as a surface for the render target so that I can use whatever is drawn on it in my application.

I can get the underlying IDirect3DSurface9 from the IDrect3DTexture9 but then I have to convert it somehow to a IDXGISurface and this is where I'm stuck. Does anybody have a clue?

sentences:
How do I pause a single bone with spine? I'm using spine along with SFML. I have a character that is always animated. When he shots, I set  an animation that affects only his arm. The arm goes up, but I need to stop this animation in the last frame while he keeps shooting.

I use this to make him walk

AnimationState_setAnimationByName(drawable->state, 0, "walk", true);

And this to make him shot

AnimationState_setAnimationByName(drawable->state, 1, "rshot", false);

I can't find a way in Spine c runtime to make this.

I could resolve this if I find a way to update manually tracks 0 and 1, instead of the full animation.

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: How can I deploy a Xbox 360 game onto a disc? I'm making some games for Windows now since about 3 years using the Microsoft XNA Framework and C#. Now I finally came to buy myself a Xbox 360 and now I want to deploy some games I converted to Xbox 360 onto a CD to give it away to my friends. What tools would I need and how can I do this?

sentences:
How do we enable the swapping of function definitions, at runtime? I am developing a cross-platform game-engine with a friend, using C++, OpenGL 2 and 4, and some other low level API provided by the platform. Recently, we had an idea to adapt function definition at runtime. For example, Machine 1 provides only OpenGL 2; the engine will see that, and use only OpenGL 2 functions. Machine 2 provides OpenGl 4 ,as well, so the engine will use OpenGL 4, instead.

Our problem with this is the implementation, and how we should approach it. On first thought, we decided to use function pointers, but after trying for a bit, it led us into problems with the code. The code was hard to understand, and hard to both fix and extend. The second approach we thought about was to replace the .DLL (Windows) or .SO (Linux) file (or hot swapping). So far, we can not implement a working, stable build.

How do we enable the swapping of function definitions, at runtime?

sentences:
Conservation of energy of a bouncy ball in Unity3d My problem is that in the project I have a ball with a physicMaterial where:

Dynamic Friction and Static Friction both are 0
Bounciness = 1
Friction Combine is set to Multiply
Bounce Combine is set to Maximum

This ball has a rigid body attached in which:

mass = 1
drag  and angular drag both are 0
useGravity = true

There are some cubes which create a boundary for the ball to bounce inside.
The ball bounces in a closed boundary. The problem is overtime its top velocity keeps on increasing and after sometime it gets out of the boundary.

I want the velocity of this ball to NOT exceed a provided maxVelocity. Here i am sharing my project through google drive  bounceProblem.unitypackage

sentences:
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:
How can I change the acceleration of an object to arrive at a particular time? I'm trying to write some code to change an acceleration factor so a ball will arrive at a destination in a desired time.

The problem is I don't know time (t) but I do know I want it to arrive at (t - x) where I can feed the value of x.

The ball has an initial velocity so the equations of motion I imagine to use is:

s = ut + 0.5at^2

I have the distance (s), the starting velocity (u) and the current acceleration (a).

Ultimately, I want to be able to get a new acceleration value (a) that will make the ball arrive, for example, 100ms later than it's intention with the current (a) value.

Any pointers, much appreciated! (I'm using javascript).

sentences:
Game Asset Storage - Graphics, 3D Models, Sounds I've recently started completing games and accumulating "assets" -- graphics, sound effects, textures, 3D models, etc. that I can build on and reuse from game to game.

Is there a great, free place I can store an unlimited amount of this content? Ideally, I would like to categorize my content (by game) and tag it (eg. icons, characters, sound-effects, soundscapes). Unlimited storage is key, because I want everything stored in one place.

Also, most of my content is strange file formats; graphics are vector done in Flash (.FLA), or in GIMP (.XCF); I don't know what 3D model formats I'll use. Sounds will be .MP3.

Where can I store this stuff?

Edit: Not quite 100% dupe, but quite similar to Assets Management, database or versioning system?

sentences:
What's the best practice to have NPC enemies taking cover in an FPS game? My question is about the data structure (and logical way to use this structure) behind this type of comportment of NPC enemy : How does he computes the place where he can take cover when the player is shooting at him ?

It can be in a FPS-like, or a "board game" view game...

sentences:
Transparency fog performance Old games use Distance Fog to limit the draw distance and decrease the number of polygons drawn.

This is usually done by lerping the color to the fog color.
But what if this color is full transparency and the resulting color is alphablended with the underlying image?
Is Alpha blending in this case more performance heavy?

I am talking about an effect like this:

sentences:
How to run code as an instance you just created in GML Alright, I'm looking how to create an instance, and then run a chunk of code on the instance I just created, and not have that code run on any other duplicate instances.

Noob question, I know. Please help though?

sentences:
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:
Space Invaders-type game: Keeping the enemies aligned with each other as they turn around? OK, so here's the lowdown of the problem I'm trying to solve.

I'm developing a game in PyGame that's a cross between Space Invaders and Columns.  I'm trying to make the motion of the enemies similar to that of the aliens in Space Invaders; that is, they're all clustered in a grid, and if even one hits the side of the screen, the entire formation moves down and turns around.  However, the motion of these aliens is continuous (as continuous as a monitor can be, anyway), not on a discrete grid like in the original.

The enemies are instances of an Enemy class, and in turn they're held by a 2D array in a enemysquadron module (which, if you don't use Python, is in this case essentially a singleton due to the way Python modules work).

Inside the Enemy class I have a class-scope velocity vector that is reversed every time an Enemy object touches the edge of the screen.  This won't do, though, because as time goes on the enemies just become disorganized and jumbled (i.e. not in a grid as planned).  I haven't implemented the Enemies going downward yet, so let's not worry about that right now.

Any tips?

sentences:
Large Mesh at a far distance So I am trying to do something like KSP, where I have a ground to orbit Level of Detail with the planets. And from theirBuilding a new Universe Video I know they are using scaled space, and local space, where (as i assume) The whole planet is divided in smaller quads. This is all fine but from my understanding They are all still in the same unity scene and rendered( if they’re not invisible( isn’t that automatically decided by the cpu/gpu?)). But now to my question. Even if such a Quad just has 16x16 Vertices, it’s still up thousand if not millions of units away from the scene origin and you and the camera(I know there are two cameras for near and far) Wouldn’t this quad produce a lot of lag and be really inefficient? Or is this not a problem for unity. Generally how far can I put things in unity?

Please also note that I know about the the trick where they move everything back to the origin if the ship passes 6000 units, to reduce the jittering.

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:
FullSerializer Update serialized property name Currently we have some ScriptableObjects that are referenced by their name. This comes with some issues as names may change and also they don't have to be unique. We would like to switch to UUIDs.
using FullSerializer;

[System.Serializable]
[fsObject(Converter = typeof(CharacterDataConverter))]
public class CharacterData
{
  public CharacterSO player;
  public CharacterSO mentor;
}

The mentor field is currently serialized as mentorName. With the changes the serialized field name would be mentorUid. This is handled by the CharacterDataConverter, but this has to be updated all the time when CharacterData class changes and is often forgotten.
Much simpler would be to use fsProperty:
using FullSerializer;

[System.Serializable]
public class CharacterData
{
  [fsProperty(Converter = typeof(PlayerConverter)]
  public CharacterSO player;
  [fsProperty(Converter= typeof(CharacterSOConverter), Name="mentorName")]
  public CharacterSO mentor;
}

But this can handle only either mentorName or mentorUid.
Is there another solution? Maybe using versioning?

sentences:
Coordinate system for a strategy game I am working on a personal project of developing a simple 3D strategy game. I am working on my own game engine (let's assume that I have to have my own) and I have one theoretical question. How to develop a suitable coordinate system, which would be scalable and provide the best versability?

I am deciding between a X,Y coordinate system (different units cover different space - simply rectangle shaped) and a hexagonal system (bigger units take more hexagons).

I am working here with a simple concept of three different units of three different sizes for every player (maybe even buildings) and collision detection with conflict resolution. Thanks.

sentences:
How do I separate physics from framerate? Skyrim (Creation Engine / Gamebryo) is a prime example of a game that has its physics tied to the framerate for which it has been heavily criticized, because if you disable vsync / have a > 60 HZ monitor the physics will glitch, characters will fly into the air, and the screen will flicker while you are put into a swimming position. This problem can be solved by using a framerate limiting mod. But I want my game to run at any framerate, any refresh rate, just fine. How can I do that? Sorry if this isn't a game development question necessarily, it's more of a game engine question.

I looked and saw similar questions asked but they were very old and new tech / new programming techniques might have allowed better ways to do it since 2008.

sentences:
How do I import a Spine animation project into DragonBones when DB cannot read the atlas file? I found 2 interesting Spine projects that I would like to import into DragonBones, but their texture atlas is in .atlas format, which cannot be read by DragonBones.  I don't know how to convert .atlas files to .json files that DragonBones understands.

How should I proceed?

sentences:
Finding all hexagonal grid coordinates inside cover arc I got a turret that points at the corner of hexagon (point A). It can shoot in cover arc that's shown here:

I need to check if my target lies within this cover arc.
From this tutorial: Hexagonal Grids I know how to get a hexgrid coordinate of my target by cliking on it.

How can I get coordinates of all the hexes in cover arc (not only red hexes but all that lie within CA)?

sentences:
Libgdx: setting windows's icon When I export my game as runnable .jar file with custom window's icon - it doesn't run. It runs only in debug mode and when I try to launch .jar with the console it says that it cannot load icon file.

Picture of my problem:

sentences:
Tangent on generated sphere I have difficulties understanding the tangent/bitangent concept for normal mapping, or rather the calculations of them.

I draw a sphere which is generated with the code in the OpenGL redbook http://www.glprogramming.com/red/chapter05.html. I use cube mapping to texture the sphere.

Now, pretty much everything in the web links to http://www.terathon.com/code/tangent.html. But in that algorithm, they use the texture coords u and v, which I don't have like this because my texture mapping is 3D...

Any pointers to how I can compute the tangents and bitangents with this setup?

Also, aren't the tangents just vectors orthogonal to the normal of a point on the sphere? To me it seems there could be an easier way..

Edit:
As far as I understand I need those values to be able to "apply" the normal from the normal map to the point on the sphere. (I'm not sure what the correct mathematical terminologies are here). In other words, to deviate the normals of any point on the sphere based on the normal map. I calculated the normals as point_on_surface - center_of_sphere (which, in modelspace, when the center is (0,0,0), is just point_on_surface)

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:
Help with converting an XML into a 2D level (Actionscript 3.0) I'm making a little platformer and wanted to use Ogmo to create my level. I've gotten everything to work except the level that my code generates is not the same as what I see in Ogmo. I've checked the array and it fits with the level in Ogmo, but when I loop through it with my code I get the wrong thing. I've included my code for creating the level as well as an image of what I get and what I'm supposed to get.

EDIT: I tried to add it, but I couldn't get it to display properly

Also, if any of you know of better level editors please let me know.

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("Level1.oel"));
        function LoadXML(e:Event):void
        {
            levelXML = new XML(e.target.data);
            xmlFilter = levelXML.*
            for each (var levelTest:XML in levelXML.*)
            {
                crack = levelTest;
            }
            levelArray = crack.split('');
            trace(levelArray);
            count = 0;
            for(i = 0; i <= 23; i++)
            {
                for(j = 0; j <= 35; j++)
                {
                    if(levelArray[i*36+j] == 1)
                    {
                        block = new Platform;
                        s.addChild(block);
                        block.x = j*20;
                        block.y = i*20;
                        count++;
                        trace(i);
                        trace(block.x);
                        trace(j);
                        trace(block.y);
                    }
                }
            }
            trace(count);

sentences:
Weird member of float4 structure in the HLSL I have encountered a weird x.wwww component of the float4 x vector in a HLSL code. I haven't seen such a member or member function of float4 structures in HLSL, so please tell me what is the meaning of that. It is in the code of this pixel shader:

float4 PSConstantColor( PS_PARTICLE_INPUT input ) : SV_TARGET
{
   // Sample particle texture
   float4 vColor = g_baseTexture.Sample( g_samLinear, input.Tex ).wwww;

   // Clip fully transparent pixels
   clip( vColor.a - 1.0/255.0 );

   // Return color
   return vColor;
}

At first I thought it should be the w component replicated to all the members of the float4 vColor vector, but it does not make sense for the color value, does it?

sentences:
What is an appropriate level of granularity for component-based architecture? I'm working on a game with a component-based architecture. An Entity owns a set of Component instances, each of which has a set of Slot instances with which to store, send, and receive values. Factory functions such as Player produce entities with the required components and slot connections.

I'm trying to determine the best level of granularity for components. For example, right now Position, Velocity, and Acceleration are all separate components, connected in series. Velocity and Acceleration could easily be rewritten into a uniform Delta component, or Position, Velocity, and Acceleration could be combined alongside such components as Friction and Gravity into a monolithic Physics component.

Should a component have the smallest responsibility possible (at the cost of lots of interconnectivity) or should related components be combined into monolithic ones (at the cost of flexibility)? I'm leaning toward the former, but I could use a second opinion.

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:
How to create a texture SRV with different sRGB format from a render target in DX11? Is it possible to bind a texture with a different format as render target and as shader resource view?
Specifically with a different _SRGB suffix. My goal is to render a shader into an R8G8B8A8_UNORM texture but read the render target in another shader as R8G8B8A8_UNORM_SRGB, or the other way around. Basically controlling on the read and write side whether automatic sRGB conversion should happen. There is no window or swap chain involved.
So far, I get an invalid args exception when I try to create a texture view with a different format. I am using the Stride game engine set to Directx 11 graphics API, which uses SharpDX.

sentences: Why do games use tick rates in their networking and servers instead of an event system? Why do most games limit themselves with a tick rate in their networking? Isn't it better to make something like an even system where for example client A does something then the client sends related info to the server, and same for the server when something happens on it it sends a packet to the client, instead of using a tick rate and sending information only at some specific frequency. Is it cheaper/faster to send more data in a single packet or? And the same question goes for server tick rates, some servers limit themselves on specific tick rate frequencies, why do they do that? Why not just make a loop and run each tick after each other instead of having a gap between them or risking one tick to take longer than it should and causing bugs? What's the benefit of the tick rate approach for servers and for networking?

sentences:
Move objects in array with positions array I am trying to get a line of spheres to move around but all i get is the first sphere to move and get the rest to follow as one instead of building a sort of a train of spheres. Any idea how to alter the code to get it right?
In the code bellow i get the first pbject in listBalls to move nicely along the Bezier curve but the rest move as one and overlap with the first sphere too.
    void Update()
{

    t += Time.deltaTime * 0.2f;
    ballPosition = Mathf.Pow(1 - t, 3) * p0 + 3 * Mathf.Pow(1 - t, 2) * t * p1 + 3 * (1 - t) * Mathf.Pow(t, 2) * p2 + Mathf.Pow(t, 3) * p3;
    positions.Add(ballPosition);
    listBalls[0].transform.position = positions[j];
    for (i = 1; i < listBalls.Count; i++)
    {
        Transform ball = listBalls[i].transform;
        Transform nextBall = listBalls[i - 1].transform;
        if ((ball.position - nextBall.position).magnitude > 1f)
        {
            ball.position = positions[j];
        }
    }
    j++;

Feels like it should be something easy, setting the N-1 balls to same position as the first ball must be wrong. I tried setting them at positions[j-2] but it didn't work either.
Edit:
the Spheres should start rolling left to right one after the other eventually all 10 should be on the screen and when they reach P3 they should restarting the rolling.

listBalls is the List with 10 spheres
positions is the List with 50 Vector3 positions along the curve.

[![enter code here][2]][2]

sentences:
Where to implement textures for tiles? So I just learned the basics of Java and was ready to try to create a protoype game in the style of Civ. So a tile&turn based game.

I created an enum for the different tiles:

public enum TerrainTile{

 WATER(1), GRASSLAND(1), HILL(2), FORREST(2), BLANK(99);

private final int id;
private final int moveCost;
private boolean hidden = true;

private TerrainTile(int moveCost) {
    this.id = this.ordinal();
    this.moveCost = moveCost;
}

I made a JFrame:

public class MainFrame extends JFrame {

private MapPanel pnlMap;

public MainFrame(Terrain map) {

    setTitle("MyGame");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    getContentPane().setPreferredSize(new Dimension(500, 500));

    pnlMap = new MapPanel(map);
    pnlMap.setPreferredSize(new Dimension(500, 500));
    add(pnlMap);

    pack();
    setLocationRelativeTo(null);

}

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {

            BufferedImage mapImg = null;
            try {
                mapImg = ImageIO.read(MainFrame.class.getClassLoader().getResourceAsStream("frames/resources/map2.png"));
            } catch (IOException e) {
                e.printStackTrace();
            }

            Terrain map = new Terrain(mapImg);
            System.out.println("Terrain created:");
            map.printTerrain();

            JFrame frame = new MainFrame(map);
            frame.setVisible(true);

        }

And a JPanel for the map:

public class MapPanel extends JPanel {

private final Terrain map;

public MapPanel(Terrain map) {
    this.map = map;
}

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

}

when I wasn't sure where to save the textures for the tiles.
Should I just read out the array of the map and do a switch statement to define inside the MapPanel class which texture to draw or should the textures better be implemented inside the enum?

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:
Getting the real fragment depth in GLSL I am trying to write a simple GLSL shader that just renders the real (not normalized) depth of a fragment as a floating point value.

So far, I've figured out how to get the depth of a vertex, and just interpolate across the fragments, but I'm starting to realize that this is not going to give me the correct depth of each fragment, is it?

Here's what I have so far:

Vertex shader:

uniform mat4 world;
uniform mat4 view;
uniform mat4 projection;
attribute vec3 position;
attribute vec3 color;
varying float distToCamera;
void main()
{
    vec4 cs_position =  view * world * vec4(position, 1.0);
    distToCamera = -cs_position.z;
    gl_Position = projection * cs_position;
}

Fragment shader:

varying float distToCamera;

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

sentences: Godot: how to use _draw to draw textures at an angle So simple question that I just can't find an answer to, how do I use Godot's _draw function to draw textures rotated at an angle (more specifically how do I get them turned completely 90° onto their side).

sentences: Basic collision issues in gamemaker studio I'm really new to the game design world so I'm sorry if this question is stupid, but here it goes! I have 3 objects, a square that the player controls, a wall that the square should collide with and be unable to pass, and a floor that the square should be unable to pass through. I have tried playing around with the Solid and the Use Physics characteristics when I create the objects but I cannot get them to collide properly. Any ideas would be appreciated. Could you please help me out?

sentences:
LWJGL GL_QUADS texture artifact I managed to get working LWJGL in Java, and I loaded a test image (tv test card), but I keep getting weird artifacts outside the image.

Code:

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(10, 10);
glTexCoord2f(1, 0);
glVertex2i(500, 10);
glTexCoord2f(1, 1);
glVertex2i(500, 500);
glTexCoord2f(0, 1);
glVertex2i(10, 500);
glEnd();

What could be the cause?

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:
How to create a material that blends textures in Blender to Unity workflow I'm new to Blender and Unity and trying to figure out the best way to create a material that will use either vertex colors or a texture map to interpolate between other textures on a single mesh.  This is the sort of effect you might use when you want to have a big grassy terrain mesh with a dirt path running down the middle of it and patches of rock here and there - and instead of modeling each of those as separate pieces, you create a single shader that takes a grass, dirt and rock texture map and uses a fourth blending map to decide which to sample from.

I come from a Maya background which provides an HLSL material shader that makes this straight forward.  It's not as clear to me how to do this in Blender, and in particular the best way to set it up so that it imports into Unity cleanly.  I suspect that setting up the shader using Blender's cycles shading network won't create anything Unity can recognize.  Blender also has the Open Shading language, but again I'm unsure how well this will work with Unity.

I could also bake all my textures, but this strikes me as wasteful of memory and bandwidth.

I have experience with both HLSL and GLSL.  Is trying to do this with custom shaders the best way to do about things?  What's the best way to set things up so that both Blender and Unity are happy?

sentences: Issue in using Set Integer (by ref) in Unreal Engine 4.16 blueprint I am trying to set the value of an integer by reference in a macro created in my blueprint script. The macro does a simple conditional check of an integer and increments it if it is less than a max value. I was using one of the maze generating tutorials and the function throws a failed to resolve term Value passed into Target error. I am not sure why it cannot deduce the type of Value. The original tutorial was made in UE 4.6, so could it be due to updates made in UE 4.16? I have attached a screenshot of my blueprint.

sentences:
How can I edit .qvm (Quake Virtual Machine) files? I was browsing through how to mod a game (Urban Terror, a Quake 3 mod). I found that it can be done by editing .qvm files in the game. Under the file named zpak000.pk3. That file contains other files named

ui.qvm
qagame.qvm
cgame.qvm

But I can't find a way in which I can edit these files.

sentences:
Unity Shader blending colors and color values above 1 I have source images where each pixel is one of exactly 4 colors:

red = (1,0,0)
green = (0,1,0)
blue = (0,0,1)
black = (0,0,0)

I'm trying to modify Unity's default sprite shader to use those colors (besides black) as a key to change to other colors. For example, any pixel that's red should become _RedColor. My first attempt was:

fixed4 _RedColor;
fixed4 _BlueColor;
fixed4 _GreenColor;

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    fixed4 modColor;
    modColor.rgb = _RedColor.rgb*step(1, c.r);
    modColor.rgb = _BlueColor.rgb*step(1, c.b);
    modColor.rgb = _GreenColor.rgb*step(1, c.g);

    modColor.rgb *= c.a;
    return modColor;
}

This worked. The problem was it was very jagged. In exporting the image and being compressed in Unity I think some pixels had multiple colors but the shader simply would set the color to the last matching color.

So I tried to modify it to not reset the color if the next color matches, but instead blend between any colors present in the pixel weighted by their contribution. Here was my second attempt:

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    float total = c.r + c.b + c.g;

    // we set the total to 1 if it's 0 so that we don't divide by zero when the color is black
    total += step(total, 0);

    c.rgb = _RedColor.rgb*c.r + _BlueColor.rgb*c.b + _GreenColor.rgb*c.g;
    c.rgb /= total;

    c.rgb *= a;
    return c;
}

This also worked and the jaggedness went away everywhere except the border of black and nonblack colors. So then I tried getting rid of the total and it was perfect:

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    c.rgb = _RedColor.rgb*c.r + _BlueColor.rgb*c.b + _GreenColor.rgb*c.g;

    c.rgb *= c.a;
    return c;
}

It's perfectly blended between any of the pixels. But I don't get why. I was dividing by the total so that the color values wouldn't go above 1 and it would blend between them. For example if a pixel had both red and blue present it would be adding the 50% of _RedColor's rgb value and 50% of the _BlueColor's rgb value. So when I didn't divide by the total it appears nothing changed besides blending between black and other colors.

This implies to me that I never had any pixels that actually had more than one nonzero color component to them (or else I could/would be getting white colors at those pixels). But if that's the case, why did switching from the first step function approach to a blend approach even do anything?

This is my first foray into shaders so it's entirely possible I'm doing something terribly, but I just want to wrap my head around what's going on and why. So I definitely appreciate any help/ideas.

sentences:
C++ create array of multiple types I tried to create an array Entity[] with elements Human and Zomby.

Entity ent[5];
ent[0].set("human");
ent[1].set("human");
ent[2].set("human");
ent[3].set("human");
ent[4].set("zomby");

or

Entity ent[5];
ent[0] = new Human();
ent[1] = new Human();
ent[2] = new Human();
ent[3] = new Zomby();
ent[4] = new Zomby();
delete[] ent;

They are in different classes because Human and Zomby need different ai functions. They are in the same array to compare them, like this:

for (int a = 0; a < entL; a++)
{
    for (int b = 0; b < entL; b++)
    {
        ent[a].ai( ent[b] ); // process ai interaction with other entities
    }
}

Is there a way for an array to have multiple types,
or is there a better way to handle objects? Here's my example code:

class Entity // base class
{
public:
    float x, y;
};

class Human : public Entity // sub-class
{
public:
    void ai(Entity &n){}
};
class Zomby : public Entity // sub-class
{
public:
    void ai(Entity &n) {}
};

int main(int argc, char **argv)
{
    // create entities in one container
    const int entL = 5;
    Entity ent[entL];
    ent[0] = new Human();
    ent[1] = new Human();
    ent[2] = new Zomby();
    ent[3] = new Zomby();
    ent[4] = new Zomby();

    // inside game while-loop
    for (int a = 0; a < entL; a++)
    {
        for (int b = 0; b < entL; b++)
        {
            ent[a].ai( ent[b] );
        }
    }

    delete[] ent;

    system("PAUSE");
    return 0;
}

RESOLVED

I can make variants of functions in sub-classes like ai using virtual and override.

class Entity // base class
{
public:
    Position pos;
    virtual void ai(Position& other) { }

};

class Human : public Entity // sub-class
{
public:
    virtual void ai(Position& other) override {
        // human-specific AI code
    }
};

class Zomby : public Entity // sub-class
{
public:
    virtual void ai(Position& other) override {
        // zomby-specific AI code
    }
};

Entity* ent[5];
ent[0] = new Human (); // set sub-class elements
ent[1] = new Zomby ();
ent[2] = new Zomby ();
ent[3] = new Zomby ();
ent[4] = new Zomby ();

ent[0]->ai(ent[1]->pos); // call human.ai() passing zomby.pos

delete[]* ent;

Now, an array-pointer of a base-class can store elements of sub-classes.

sentences:
Why this simple SFML app produce such high CPU usage? I written the following SFML.NET app.
It  draw a single 128x128 sprite on the screen.

RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
window.SetVerticalSyncEnabled(true);

Texture texture = new Texture("test.jpg");
Sprite sprite = new Sprite(texture);

// Start the game loop
while (window.IsOpen())
{
    window.DispatchEvents();
    window.Clear();
    window.Draw(sprite);
    window.Display();
}

Since VSync is enabled, the number of FPS is capped to 60. I expect the program to use very little CPU, but under task manager it show me that is use about 50%  (two cores fully actually). Also it seems it use about 30% kernel time and the rest is user time.

The exact same application in SDL (just drawing a single sprite) use about 0% (regardless SDL_RENDERER_ACCELERATED is used or not).

EDIT : surprisingly, if I let the app run for a given amount of time (let's say 10-20 seconds, the CPU usage fall down to 0%). I manage to repeat this several times. That is really strange.

sentences:
Unity: Is type casting every frame too expensive? I have a state machine that controls my enemy AI. Each AI has a target which may be a Player, an obstacle, a shell, or even a Vector2 position.

I'm trying to abstract my "target" member, and my first thought was to use GameObject, then downcast to whichever type I need for different enemies. Examples below:

class StateController: MonoBehavior {
    GameObject target;
    FireAction action;

    Update() {
        action.Fire(this);
    }
}

class FireAction: ScriptableObject {
    public abstract void Fire(StateController c);
}

//Examples of different fire scripts:
class FireAtPlayer: FireAction {
    public override void Fire(StateController c) {
        Player p = c.target as Player;
        //--use properties of Player object--
    }
}

class FireAtPoint: FireAction {
    public override void Fire(StateController c) {
        GameObject t = c.target as Player;
        //--use properties of GameObject object--
    }
}

As you can see, my Fire methods would cast the target object at every call to Update. Will this negatively affect my game's performance? Note that I know for a fact what type of object the target is, so I'm not guessing when I'm casting. Thank you in advance of your help!

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:
Creating the Vertices and Triangle Indices for Voxel Generated Mesh I am running into a problem with a compute shader I am writing to generate the vertices and triangle indices for a voxel generated mesh.
Currently, I am creating an AppendStructuredBuffer of triangle structs which just have the three vertices of a triangle and reading from the AppendStructuredBuffer to the CPU. When read to the CPU, I then read from the buffer and set it in a RWStructuredBuffer in the GPU. Following that, I run a compute shader kernel to parse the triangle buffer.
Obviously if I can do this all on the GPU I should since reading and writing between the CPU and GPU is expensive.
When trying to put it all in one kernel I run into problems however. Each voxel has a range of possible triangles (0-5) that can form in it. Because of that, I can't simply use the dispatch ID to put it in a RWStructuredBuffer (at least I don't think so). That's why using an AppendStructuredBuffer seems natural; it allows for the variable amount of triangles.
After getting the array of triangle vertices and array of triangle vertex indices, I bring them back to the CPU and set them to a mesh and render it. In the future I want to use a geometry shader to render the mesh since that is most likely more efficient, but I'm trying to take this one step at a time, and geometry shaders are a whole 'nother beast I know nothing about.

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:
SpriteRenderer batching issue, with Z-Position and Order in Layer I have two sprites (they look the same but with different colors):

I want them to be positioned like on the image above, so there's a feel like blue is standing on the green one.
There are two ways to achieve that:

Blue block with Order in layer 1, Green block with Order in layer 0
Blue block with lower Z coordinate, so it's physically in front of the green one.

Both of the concepts appear to break batching between these two objects. They're on the same atlas (I've tested it by setting the same Z position and Sorting Order and batching works).

How can I achieve batching here?

sentences:
3D space indexing for nearest neighbor searching I am developing a CAD-like application where the user can draw (digitize) new geometries (points, polylines & polygons). While digitizing, I want the user to be able to (optionally) snap the points of the new shape onto points or lines of existing geometries. I have already written the snapping algorithm that computes a ray from the mouse position and finds a line segment between the ray and the closest geometry (point or line segment). My scene is totally static but may contain too many shapes, which makes brute force searching inefficient.

What would be a good way to index the existing geometries so that I could quickly filter most of them out and consider a smaller set (the ones roughly within distance X) in my snapping algorithm?

I was thinking of doing something similar to what OpenGL (I am using DirectX 9 in my app) provides with the GL_SELECT option, i.e. render my geometries on a bitmap, each one coded with a different color. However I am a bit worried since I will have to use a second device with a hidden window to achieve this.

Is there a 3D space partitioning data structure that I can use, which can efficiently compute the nearest neighbour to a ray?

sentences:
Monogame - How to correct “brightness-additivity” while using Alpha-Blend-State When using

GraphicsDevice.BlendState = BlendState.AlphaBlend;

in monogame

following happens:

Is there any avaible method to keep the color brightness everywhere the same regardless of an overlap?

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:
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:
Sprite character/item less than tile size I am starting to work on a 2d top down tile-map game for fun and learning purposes. I have read some great answers here re tile-map size vs character sprite size, pixel density, ppu, screen resolution etc.

A standard route is to set a constant PPU and do characters as 2 tiles (vertically usually). We went with 32x32 pixels for the tile and 32x64 for the character.

Unfortunately, our artist didn't draw the character to fill out that space on the extremes (the feet and head do not touch the vertical edges and there is also space between the character and the horizontal edges) and when Unity slices the sprite-sheet we get smaller characters of 28x53.

I imagine this is a problem for keeping the consistency I outlined above with the tile size.

Is this a problem? If so, are the solutions to this to either change the tile size to 28x28 or ensure that the sprite design actually fills the tile space (that is, touching edges of the 32x64 area)? Must one draw items as always filling out the full tile size or can one make, say potions, in a 32x32 tile but only take up say 12x16?

sentences: What size should i use for my game design? i am currently working on a android game by using libgdx and i am designing graphics with ps for it. I want my game looks the same quality for different screen sizes but i dont know in which size should i design my graphics. For example if i design the graphics 200x200 size and for a bigger screen i should make it bigger by resizing with code. But this will demage the graphic which is something i dont want. What i think is to make a much bigger graphic then shrink for ever screen sizes. is that right approach to do? Or there is a better way. And also if this approach what size should i use for portrait game. Like 800 width is good? Thanks for ur answers.

sentences:
Box2D platformer movement. Should i mess with velocity? I have a platformer game in which I implemented the movement using a wheel attached to the hero. For jumping I use this:

player.body.applyLinearImpulse(new Vec2(0, 30000000), player.body.getPosition());

The problem is that the xVelocity doesn't remain the same during the jump so it isn't looking natural. Is there any way to modify only the x velocity of the body so that before jumping I store it in a variable and after jumping I apply it to the body?

I hope you understand what I am trying to say.

sentences:
Optimizing hierarchical transform I'm transforming objects in 3D space by transforming each vector with the object's 4x4 transform matrix. In order to achieve hierarchical transform, I transform the child by its own matrix, and then the child by the parent matrix. This becomes costly because objects deeper in the display tree have to be transformed by all the parent objects.

Is there a faster way to transform vertices to achieve hierarchical transform?

sentences: How to use the box2d contact listener in android (java port)? I don't have any idea about the box2d collision detection in android. I googled and got results that suggest to use the contact listener but I don't know how to use it in android java.

sentences:
DX12 - how to update part of a buffer? I'm just getting started in DX12 after a bit of time in Vulkan, I am trying to update a part of a dynamically indexed buffer I'm using to hold mesh transforms.
I'm using the MSFT MiniEngine examples which include wrappers for upload buffers, and am not sure if I can use them to update an existing buffer, or if they're supposed to be the main resource used in place of the "GpuBuffer" in the same engine.
Any specific insight into the use of those classes would be really useful, but more generally, is it possible to update part of a buffer, or will I have to upload a copy of the whole thing?
Obviously a simple example would be brilliant if anyone has one..

sentences:
Pathfinding and collision avoidance on mobile Currently I'm developing a Diablo like game for mobile platform(iphone5+).

A simple A* search will find the path, but collision avoidance still needs to be taken into consideration.

There will be about 50 monsters active at the same time, so performance is very important.

I found some methods that might work.

NavMesh + RVO

The recast/detour library works well on the pathfinding part, but its crowd simulation quickly reach the limit(more than 5ms for 30 agents).

Another library RVO2 seems fine(less than 2ms for 50 agents), but the library has some license issues.
Flow Fields + Physics Engine

Many RTS games use this method, but it seems that a physics engine is required to resolve  collisions. If many agents don't share a common goal, this method might cost more than traditional A* pathfinding.
Steering Behaviors + Physics Engine

Steering Behaviors includes many concepts, I think simple avoidance behavior might work(just turn left/right if there is something in front) , but the method still requires a physics engine to work together.

I'm still not sure which one to use, maybe there exists other pathfinding and collision avoidance methods.

P.S. Halo:Spartan Strike uses Havok AI(based on RVO?), but I didn't see many enemies in that game,
so I wonder whether the first method(NavMesh + RVO) will works well on mobile platform.

sentences:
How to render a curved horizon when rendering terrain far away For games with long view distance, it might look at bit weird when you fly high above the ground and the horizon is all flat.

So, how can I make a crumb/bend effect, when I fly high above the surface? Can this be done in the shaders?

If you're not sure what I mean, heres a picture:

A more clear example, though it might be captured with fish eye.

What would this best way to do this? I believe you could rotate and move (using transformationMatrix) all vertices a tiny little bit according to how far they are from the camera. But would this even create the desired effect, and would it be too resource extensive? Or maybe you know a whole another way to do it.

sentences:
Algorithm to make entities closely follow one another? I have a group of entities that I want to follow a leader very closely. A good example would be how the player's soldiers move in Cannon Fodder.

Any suggestions for achieving movement like this?

sentences:
Trouble with assigning a model's own mesh to a mesh collider in Unity I'm trying to use a mesh collider on the player's avatar, rather than the box collider.

I've added the mesh collider to the game object (which also has a rigid body) and selected the "convex" checkbox.  However, the player still falls through all geometry, including Unity primitives, terrain, and other models.

In the mesh collider's property box, there's a value for "Mesh", which I have set to "None (Mesh)".  I was led to believe this defaults to the model's own mesh, but now I'm not certain.  If I change the value to something else from the "select mesh" list, like the cube, the collisions work.  When I click over to Select Mesh --> Scene, the list is empty.  I'm assuming I need to add the model's mesh to the list, but I can't find any documentation about that.

sentences: 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:
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:
Cost to licence characters or ships for a game I am producing a game pitch document for a university game design class, and I am looking for examples of licencing cost for using characters or ships from other IP holders in a game. For example:

cost of using an X-Wing in a game, licencing from Lucas
cost of using the Enterprise in a game, licencing from Paramount
cost of using the Space Shuttle (if any), licencing from Nasa

EDIT

The closest information I can find is from an article about Nights of the Old Republic, but isn't nearly specific enough for my needs:

  What Kotick means by Lucas being the principal beneficiary of the
  success of The Old Republic is that there are most likely clauses in
  the license agreement that give percentages, points, or another
  denomination of revenue out to Lucas and his people just for the Star
  Wars name, and that amount is presumed to be a great deal of money.
  Kotick is saying that because the cost of the license is so
  prohibitive, as he has personally had experience with in his position
  as CEO of Activision Blizzard, that EA will not be able to be
  profitable because of the hemorrhaging of money to the licensor.

EDIT 2

Another vague source stating that FOX uses a "five-figure rule" (assuming between $10,000 -> $99,000)

  It seems FOX, like most studios, will not license individuals to
  create new works based upon their products. They will only commission
  individuals of their choosing if they elect to branch out into
  expanded product lines related to those licenses. Alternately, they
  are open to making the licencing available to large corporations with
  access to global markets, but only if those corporations agree to what
  Ms Friedman called a "five-figure guarantee". Presumably this means
  that the corporation seeking the licensing must agree to pay a
  5-figure sum for that license, and be confident that their product
  will sell enough volume to recoup that fee, and to produce sufficient
  profits to make the acquisition worth their while.

sentences:
Adjusting view matrix when glViewPort & resizing I have an issue when my window resizes.

I have a simple MVP shader like this

gl_Position = projection * view * model * vec4(in_Position, 1.0);

to render a map in my game scene. The map is extremely simple that it simply offers a lane's vertex. And what I need to do is drawing it inside the window.

So I set up my MVP matrix individually, the "view" and "model" matrix remains the same because all I want to do is drawing a static map. "perspective" is the only matrix need to change since I want to have a zoom feature that I can zoom in/out by changing fovy. "perspective" is updated by calling

glm::perspective(glm::radians(fovy), (float)width/height, near, far)

and my view matrix is calculated by

glm::lookAt(camera_pos, camera_pos + camera_front, camera_up)

However, when I resize the viewport, I find everything changed. I mean by default, the resolution gonna drop when my window goes larger if I didn't do anything(like updating the glViewPort()). But the behavior I wanna achieve is like

"I could see more part of the map when I made my window size larger".

Therefore I believe that I should keep my viewport resolution same (glViewPort(0, 0, screen_width, screen_height)). And updating perspective matrix by changing the ratio when new window's width and height comes in. Then the final step is to update the camera's position to update view matrix. However I stuck here for a while coz I don't know how to adjust it. I believe this is a common issue but I cannot even find a source talking about it.

Do I think it the wrong way? Do I need to change Camera's position to update my view matrix to achieve the resize behavior?

Platform: Ubuntu 16.04, OpenGL3.3 , C++14

sentences:
Keeping score server side to prevent cheating For my Unity WebGL game, I'm looking into storing the score of users in a database to make a highscore table (it's not a multiplayer game). Because client side code can always be "hacked", the advice most people give is: "keep the score server side so you can validate it".
But I don't quite understand how that would work. I could of course publish the score to the server using an Ajax call, and even hash it, but even then the cheater could just simply look at the hash method and use the same Ajax to upload a different score.

I'm assuming I should get a game server or something then? But again: no idea on how to start... I'm really just scratching the surface here.

So I'm basically looking for any sort of information on how to change my "regular", client side, WebGL Unity game to a game where I keep the score securely at server side so that the highscore table is valid.

I don't mind spending some money on both a server/assets that simplify the task. As I said, I'm just interested in implementing this feature, I don't need to become a game server wizard.

Note: even with server side scores, there's probably a way to cheat. There most likely always is, but at least it would be more secure than just inserting the final score into the database...

sentences:
Velocity control of the player, why doesn't this work? I have the following code inside a while True loop:

if abs(playerx) < MAXSPEED:
    if moveLeft:
        playerx -= 1
    if moveRight:
        playerx += 1

if abs(playery) < MAXSPEED:
    if moveDown:
        playery += 1
    if moveUp:
        playery -= 1

if moveLeft == False and abs(playerx) > 0:
    playerx += 1
if moveRight == False and abs(playerx) > 0:
    playerx -= 1
if moveUp == False and abs(playery) > 0:
    playery += 1
if moveDown == False and abs(playery) > 0:
    playery -= 1

player.x += playerx
player.y += playery

if player.left < 0 or player.right > 1000:
    player.x -= playerx
if player.top < 0 or player.bottom > 600:
    player.y -= playery

The intended result is that while an arrow key is pressed, playerx or playery increments by one at every iteration until it reaches MAXSPEED and stays at MAXSPEED. And that when the player stops pressing that arrow key, his speed decreases until it reaches 0.

To me, this code explicitly says that...

But what actually happens is that playerx or playery keeps incrementing regardless of MAXSPEED and continues moving even after the player stops pressing the arrow key.

I keep rereading but I'm completely baffled by this weird behavior. Any insights? Thanks.

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:
How to keep the ball on zigzag movement? I recently make a zig-zag movement it works perfectly but after the ball hit the collider or obstacle the ball is changing their direction like just forward, not zig-zag anymore I've tried to update the velocity after collide but it's same, also I have tried to constant the magnitude but that's not what I want
here my script
public float magnitude;
    public float forwardSpeed;
    public float horizontalSpeed;

    private Vector2 horizontalAxis;
    private Vector2 negationVector;

    public Rigidbody2D rb2d;
    public m_GameManager _GameManager;

    public bool isOver = false;

    private void Awake()
    {

        horizontalAxis = Vector2.right;
        negationVector = new Vector2(-1f, 0);
    }

    private void Start()
    {
        _GameManager = FindObjectOfType<m_GameManager>();
        UpdateVelocity();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            ReverseHorizontalVector();
            UpdateVelocity();
        }
    }

    private void ReverseHorizontalVector()
    {
        horizontalAxis *= negationVector;
    }

    private void UpdateVelocity()
    {
        Vector2 velocity = GetCompositeVelocity();
        rb2d.velocity = velocity;
    }

    private Vector2 GetCompositeVelocity()
    {
        Vector2 forward = Vector2.up * forwardSpeed;
        Vector2 horizontal = horizontalAxis * horizontalSpeed;
        Vector2 composite = (forward + horizontal);

        return Vector2.ClampMagnitude(composite, magnitude);
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        UpdateVelocity();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Goal"))
        {
            _GameManager.IncreaseScore();
        }
        if (collision.gameObject.CompareTag("L") || collision.gameObject.CompareTag("R") || collision.gameObject.CompareTag("Death")
            || collision.gameObject.CompareTag("Player"))
        {
            StartCoroutine(_GameManager.waitAfterDeath());
            isOver = true;
        }
    }

like I said before the ball zig zag but after colliding the movement change like that.

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: How to find an object which is added to a scene only when game starts? I'm looking for some advice how to find an object which is added to scene only when the game starts? Before start it isn't in Scene hierarchy. It's prefab.

sentences:
MacOS Mojave makes SDL2 unaccessible I have some code that worked with no issues on MacOS Sierra, but when I update to Mojave, my compiler always says that it can't find SDL2.

Here's the error:

20:24:40 **** Incremental Build of configuration Debug for project Causality ****
make all
Building file: ../src/engine/SE.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/engine/SE.d" -MT"src/engine/SE.o" -o "src/engine/SE.o" "../src/engine/SE.cpp"
In file included from ../src/engine/SE.cpp:1:
../src/engine/SE.h:6:10: fatal error: 'SDL2/SDL_events.h' file not found
#include <SDL2/SDL_events.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/engine/SE.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

20:24:42 Build Failed. 2 errors, 0 warnings. (took 1s.304ms)

I'm using SDL 2.0.9

My project structure is this:

src
|main.cpp
|engine
 |SE.h
 |SE.cpp
 |SE_Audio.h
 |SE_Audio.cpp
 |SE_Graphics.h
 |SE_Graphics.cpp
 |SE_Input.h
 |SE_Input.cpp
 |SE_Structs.h

I'm including the libraries with -framework SDL2 -framework Cocoa -framework SDL2_image

I'm using the exact same settings that I used before and that worked in MacOS Sierra. Please tell me what more details you need before down-voting

sentences:
How to mitigate speed effects on moving platforms? I am implementing horizontal moving platforms in my 2D platformer.

The way it's implemented currently, when my player lands on a moving platform, he is reparented to it so that his position updates in line with the moving platform.

The player is moved perfectly in sync with the platform, which has a constant velocity. The player's acceleration and velocity are not altered in any way to achieve this movement. It's free because the player is now a child of the platform.

Because I use local position in all of my player's movement code, my player is still free to move left and right relative to the moving platform.

This works really well.

I notice, however, that when my player runs along the platform in the same direction as it's moving, there is a sense of moving fast. When he runs against the platform, there is a sense of sluggishness.

I know that relative to the platform my player is moving at the same velocity in both directions, but because he traverses more global distance than normal when moving with the platform, there is a sense of speed, and because he traverses less global distance than normal when moving against the platform, there is a sense of sluggishness.

I believe the sense of speed and sluggishness are like psychological illusions. If my player stands on my moving platforms, it takes the same amount of time for him to traverse them from left to right as right to left, so I know that local velocity with respect to the platforms is working. It's more of just a psychological effect I'm trying to mitigate, I think.

So my question is: Are there any ways of mitigating these effects? How do you deal with this problem?

I am working in Godot, but would prefer an engine-neutral explanation of ways to avoid this effect.

It may or may not be relevant, but I have a smoothly scrolling camera which lerps to my player's position, as well as parallax backgrounds.

sentences:
Creating a 2d look sprite sheet and textures out of 3d models I'm trying to make a 2d game (rpg top down), and I've got no 2d artists help me out making 2d characters and textures, but I have one who can make 3d stuff (using Blender and 3d Max), I was wondering if there's a way to make these 3d models look 2d so I can capture some poses to make a sprite sheet.

Is it possible to make 3d models look 2d?

Edit: Here are examples

Sly Crooper (Playstation 2 Game)
http://static.gamesradar.com/images/mb/GamesRadar/us/Features/2009/02/Sneaky%20History%20of%20Stealth%20Games/Screens/slycooper3--article_image.jpg

Legend Of Zelda Wind Waker:
http://www.zeldadungeon.net/images/News/Folder/10-05-06/Screen1-Large.jpg

I wish for sucha similar art.

sentences: How does Vector3.MoveTowards work in Unity? What I mean is that I don't understand what each part does, like in the example in the API, it didn't give much on what did what! I kinda need this for an aim script in a shooter game I'm working on. Any help will be good, but a direct answer would be great!

sentences:
Should game services be global? (XNA) If one wants to use services, they can use the ones built in to XNA (Game.Services) and pass around the Game object to everything that needs to either query for a service or add a service.

Alternatively, one can create their own game services class and make it static to avoid having to pass around Game everywhere.

Instead of just passing Game to everything, just to query the services (a code smell already in my opinion, just pass the services) seems a bit silly to me. Instead of passing it everywhere, why not just make a public static GameServices class?

What are the advantages and disadvantages of each approach? Which do you normally opt for?

sentences:
Find grandchildren with specific tag I have an empty object that contains multiple children each containing their own child objects. I want to get a list of all the objects containing a specific tag but i don't know the depth of each child object.
The following solution only returns the children that have the tag.

foreach (Transform child in city)
        {
            if (child.CompareTag("Zone"))
                buildings.Add(child);
        }

sentences:
For deferred rendering and SSAO, what coordinate system are the normals actually in? So, I'm following the very helpful LearnOpenGL online tutorials, and I'm working on implementing SSAO. I don't have a deferred rendering pipeline, but I need to collect normals during my depth pass so that I can sample them for the SSAO effect.  I'm following this tutorial: https://learnopengl.com/Advanced-Lighting/SSAO, and referencing this one when needed: https://learnopengl.com/Advanced-Lighting/Deferred-Shading.
However, neither of these tutorials really explain what's going on with the normals. What is the normalMatrix being used in the shader?
mat3 normalMatrix = transpose(inverse(mat3(view * model)));
Normal = normalMatrix * (invertedNormals ? -aNormal : aNormal);

I'm not worried about the invertexNormals conditional, that's probably just something weird the author added for handling different conventions, but what the heck is going on with that normalMatrix? Why would we invert the view * model matrix? If we're starting with aNormal in object space (whether it's coming directly from a vertex buffer or from a normal map TBN calculation), I can't for the life of me figure out what coordinate system that resulting normal is going to end up in!
So, long story short, what coordinate frame should my normals be in if I'm to use them for SSAO? World space? View Space? Clip space? None of the above? If it's some weird coordinate system, can somebody help me get there? I'm probably more confused than I should be.

sentences:
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:
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:
Multiple Textures in Shader? I have this (pseudo) code:

unsigned int TextureLoc = glGetUniformLocation(programID, "objectTexture");
for(int i = 0; i < object->texturesCount; i++)
{
    glActivateTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, object->textures[i]->textureID);
    glUniform1i(TextureLoc, 0);
}

And Fragment Shader code:

in vec2 UV;
out vec3 color;
uniform sampler2D objectTexture;
void main()
{
    color = texture2D(objectTexture, UV).rgb;
}

My example is that of a house model that composes a single object, but the house walls are of Texture#1 and the roof is of Texture#2.

At first I coded that each object had it's own material/textures, but then I noticed it's a waste of memory if I'm using the same texture in multiple places, so now I have a list of objects and a list of textures.
An object can have n textures.

1. How can I get a "new" in GLSL for dynamic textures count? Some objects might have 1, some might have 10, etc... How can I control that?

2.  I have an array specifying which textureID each triangle in the object uses, but how can I use this information to properly draw the object? I send the array in the glEnableVertexAttribArray(int) function, but how can I know which texture I'm supposed to use when I'm in the shader code?

Another option I thought of was to divide all objects into smaller objects if they don't have the same texture, but I'm not sure what's the best approach to this.

sentences:
how to script a match 3 game without waiting for matches to finish I have developed a full match 3 game without the ability of making another move until all cascading is finished.

I was stuck trying to figure out how to do it with the ability of making moves even if the previous moves have not finished yet. I can't figure out the programing logic behind it, I tried different approaches with no luck so far, the results came up messy.

Can any one help.

Thanks in advance.

sentences:
how to work more efficient with UI elements im working on a mobile android game that has many levels and same UI. for every level i have to assign the object and function of every button in every scene level.

is there more effiecient way that there will be no need to assign all functions in every scene?

thank you for helping

sentences:
Draw a square given 2 corners I am at the moment trying to come up with a simple method to extract some data points, given two corners.

A***************
****************
***************B

I tried to illustrate my situation above.
Given corner A and B (x,y,z) how do generate the (x,y,z) coordinate for all the * in the square?

sentences:
How do I go from a simple html5 tic tac toe game to an online 2 player game? I've been working on an online 2 player Tic Tac Toe solution for blackberries. both old and new. And so far I have html5 code that has a 3 x 3 layout that switches between x and o for the game mechanics. I believe I'm still missing a check for win function but my question is about the server side of this game. I'm not sure how to go about learning what exactly I want. how do you take what I have now, and make this into a functioning online game?

I've been told WAMP is a good solution, as well as IIS. and its all really over my head, so i'm hoping to get a little more clarity as far as what I should focus on to bring this game to life.

sentences:
Is it safe to set Lua Table data from multiple C++ threads? As the title states. I'm curious if it's safe to set data in different Lua tables that exist in the same lua state. From multiple C++ threads.

I'm asking this because my current system actually has a separating between Lua's data, and C++'s data, with Lua driving the majority of the game's update and loop - and C++ handling lower level details such as math, rendering, resources, and physics.

After the physics update, I have to waste time in having an entire phase for Lua to update it's own internals for Serialization and grabbing references.

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: Shortest path from BitmapSource to DX11 Texture2D Does anyone know a way to get from (WPF) System.Windows.Media.Imaging.BitmapSource to a DX11 Texture2D without going to System.Drawing.Bitmap? I'm trying to strip out all System.Drawing references as this code it for WPF only.

sentences:
Making various shapes equally difficult to tap I'm developing a game where the player quickly has to tap/click on various shapes such as squares, circles, triangles, stars and so on. I'm now struggling with the following task: I'm searching for a normalized size for each shape, so that every shape is equally difficult to hit. E.g. given a circle with a radius r, how do I find the length l of the corresponding square?

At first glance I thought: Easy. Just make all shapes share the same area A. So, in the example above, l = sqrt(pi). http://en.wikipedia.org/wiki/Squaring_the_circle

But on second thought, this does not seem to be the best metric. Imagine a star with many long, thin, pointy arms or a very long but thin line. Even if they have the same area as a circle or square, they are still more difficult to hit.

So, what might be a better approach? Maybe something involving the "form factor" (circumference squared divided by area C²/A)?

sentences:
How do you have rigged clothing animate with a base model? How do you have rigged clothing animate with a base model?
Or how can you coalesce multiple skinned mesh renderers or have them all be controlled by just one?
Or, do you just have multiple animators for each SkinnedMeshRenderer (and there would be quite a number, for a character with a complex outfit that is modular)?

Have not been able to get it to work from the only thing I can find online (surprised there aren't more tutorials on this) https://forum.unity.com/threads/tutorial-how-to-make-clothes-animate-along-with-character.475253/
I've applied the method by looping through the SkinnedMeshRenderers present in the clothing assigned when a character root is loaded in ApplyClothing(clothing,root). Clothing and character have the same bone structure, as the clothing is custom modeled to the character model and rig.
I get a few unable to map L/R_Knee Ankle Foot errors, but I have removed the break. I've tried rotating several other joints in the root character but the clothing is still not deforming with the joints.
    void ApplyClothing(GameObject clothing,Transform root)
    {
        GameObject g = Instantiate(clothing);
        g.transform.parent = root;
        g.transform.localPosition = Vector3.zero;

        BoneSyncer(clothing, root);
    }

    void BoneSyncer(GameObject clothing,Transform root)
    {
        SkinnedMeshRenderer[] smrclothing = clothing.GetComponentsInChildren<SkinnedMeshRenderer>();

        for(int i = 0; i < smrclothing.Length; i++)
        {
            SkinnedMeshRenderer[] rootsmrs = root.GetComponentsInChildren<SkinnedMeshRenderer>();
            SkinnedMeshRenderer rootsmr = null;
            for(int j = 0; j < rootsmrs.Length; j++)
            {
                if (!rootsmrs[i].name.ToLower().Contains("haircut"))
                {
                    rootsmr = rootsmrs[i];
                }
            }

           if(rootsmr!=null) BoneSyncer(smrclothing[i], rootsmr);
        }
    }

    void BoneSyncer(SkinnedMeshRenderer clothingmeshrenderer, SkinnedMeshRenderer targetmeshrenderer)
    {
        Dictionary<string, Transform> boneMap = new Dictionary<string, Transform>();
        foreach (Transform bone in targetmeshrenderer.bones)
            boneMap[bone.gameObject.name] = bone;

        Transform[] newBones = new Transform[clothingmeshrenderer.bones.Length];
        for (int i = 0; i < clothingmeshrenderer.bones.Length; ++i)
        {
            GameObject bone = clothingmeshrenderer.bones[i].gameObject;
            if (!boneMap.TryGetValue(bone.name, out newBones[i]))
            {
                Debug.Log("Unable to map bone \"" + bone.name + "\" to target skeleton.");
                //break;
            }
        }
        clothingmeshrenderer.bones = newBones;
    }

```

sentences:
How can use a 3D map with 2D characters (Unity)? I tried to search something about it but I can't find any complete or well-explained tutorials about how to use a 3D map with 2D characters and items, like Ragnarok or Final Fantasy Tactics.

If there is no tutorials about this topic, are there any recommendations for studying the subject? I've already developed some games using XNA, but only 2D games, I've never tried to use 3D models, nor have I used Unity to develop games.

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:
How to normalize the direction to check if the player is able to move? I have a room with 4 walls along the x and z axis respectively. My player, who is in first person (therefore the camera), should have collision detection with these walls. I'm relatively new to this so please bare with me. I believe the way to do this is to calculate the direction and distance to the wall from the camera and then normalize the directions. However, I can only get this far before I don't know what to do. I think you should work out the angle and direction your facing?

Here _dx and _dz is the small buffer in front of the camera.

float CalcDirection(float Cam_x, float Cam_z, float Wall_x, float Wall_z)
{
    //Calculate direction and distance to obstacle.
    float ob_dirx = Cam_x + _dx - Wall_x;
    float ob_dirz = Cam_z + _dz - Wall_z;
    float ob_dist = sqrt(ob_dirx*ob_dirx + ob_dirz*ob_dirz);

    //Normalise directions
    float ob_norm = sqrt(ob_dirx*ob_dirx + ob_dirz*ob_dirz);
    ob_dirx = (ob_dirx)/ob_norm;
    ob_dirz = (ob_dirz)/ob_norm;

Can anyone explain in layman's terms how I work out the angle?

sentences:
"Industry Standard" JSON formats for game assets This question is inspired by my venture into the Phaser game engine but seems to apply to any engine that uses JSON for its asset format.

Phaser relies on PhysicsEditor to export and create the JSON data for its physics bodies and TexturePacker for its sprite atlases. When I learned this I found some free alternatives that look like they might do the job.

So here's the problem. These JSON creators claim their output works for a slew of different engines, but how can I be certain of that when there can't possibly be such universal collaboration between the creators of these engines? It's especially dubious considering I can't find a standard anywhere. I don't want to rely on a solution only to encounter a glitch I don't understand. I want certainty.

After a lot of searching I finally found this thread, in which a couple of posters also expressed these frustrations. The final post appears to come from the horse's mouth, explaining that there's some "industry standard" that everyone uses, but the poster doesn't seem to know where the industry standard comes from either.

So I'd really like to know, is this specification actually documented anywhere? Does it have an origin or did it just... accrete?

If there's no good answer to this question, can I at least trust the claims of, say, Physics Body Editor and Shoebox, that their exports will work anywhere?

sentences:
Where is the source of XNA lighting? Talking BasicEffects,
where is the source of the three directional lights?

When I write this:

effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0, 0); // a red light
effect.DirectionalLight0.Direction = new Vector3(1, 0, 0);

What does it mean for the direction? From where is it directing?

sentences: How to check if grounded with rigidbody Does anyone have a better way to make an object with a rigidbody check for ground and then jump, right now I wrote a script where a raycast is cast downwards and it checks for distance but then I discovered that a player can still jump when close to the ground and when I decrease the distance amount on raycast then the jumping works a few times (5 or 6) and then stops working, so I had to increase the distance a bit and add a delay so the player can't jump for some time after a jump. But I think there might be a better way of doing it. So does anyone have suggestions on how can I improve my script or what other method I can use to make a character with a rigidbody to check if grounded and jump?

sentences:
How do I store multiple bullets' coordinates? My game is a 2D game(or tries to be) in pure C using SDL(no OpenGL at all). No specific goal in it, it's pretty much boilerplate code.

I decided I want to make my character/player shoot "something", whether you'd call it a bullet or not is up to you.
But even before writing any code, I already saw my first hurdle. You see, in reality when you shoot a bullet it's pretty fast, you'd normally hit a target by the time you shoot again, in my game I want the bullets to be slow so that two or three or more can be displayed on the screen. This is where the problem starts. I have written some pseudo-code to illustrate my problem.

Basically, when I shoot a bullet, I increment a total bullet counter, then the sprite would appear and every few MS I would update the animation and check for collision. When I have multiple bullets which I store in a structure array, I would loop through all of them to check their collision, or if they went out of the screen's view. When one fits either condition, I will remove it from the screen and (free it) from the structure array and that index will point to invalid memory. Basically, my pseudo-code tries to illustrate the problem.

http://pastebin.com/9Y40GgT4

This is my interpretation of how it should be done. I am assuming there are other ways. Hopefully we can avoid the "Why C and not C++ discussion at this time".

sentences:
Getting and Setting Rotation in XNA around the Center of my Model with XNA Alright, so I'm currently debating how I want to do this.  Basically this is what I'm trying to accomplish.

I've created a system to allow me to make my environment a little bit easier.  I'm currently setting up a way to edit my models that I'll be rendering a bit easier.  Currently I'm displaying their properties in a .NET Property Grid like so:

As you can see, I want to be able to rotate my model via 3 separate values.  One represents the rotation around the X axis, one for the Y axis, and one for the Z axis.  I'll be specifying the amounts in degrees (and converting to radians when necessary).  I also want to have it rotate around the center of the object.

Here are the things I have to think about:

How to I unbiased rotate my model (considering I can only rotate one axis at a time via Matrix.CreateRotation[X/Y/Z](angle)
How to make sure it rotates around the center
Extract these three angles back out from a Matrix
How to properly rotate them so that it handles it all intuitively

What do you guys think?

sentences:
Surface normal to screen angle I've been struggling to get this working. I simply wish to take a surface normal and convert it to a screen angle.

As an example, assuming we're working with the highlighted surface on the sphere below, where the arrow is the normal, the 2D angle would obviously be PI/4 radians.

Here's one of the many things I've tried to no avail:

float4 A = v.vertex;
float4 B = v.vertex + float4(v.normal, 0.0);

A = mul(MVP, A);
B = mul(MVP, B);

A.xy /= A.w;
B.xy /= B.w;

o.theta = atan2(B.y - A.y, B.x - A.x);

I'm finally at my wit's end. Thanks for any and all help.

sentences:
Make a 2D character stop moving and going back when encounter an obstacle I am using a 2d character who is sliding infinite ( huge incrementation of the X or Y value ) when moving.
He can only move up, down, left, right inside a virtual grid, made of multiple squares.

Now I want to add obstacle to stop his sliding and make him go back to the center of the previous square

The obstacles can be of different size and are located in the center of a square, so the collision occurs with the obstacle and NOT when the character enter the square containing this object !

How can I manage to stop the incrementation of X or Y when colliding ? And get the previous value of X or Y for which the character was on the center of the square just before the one containing the obstacle.

Thank you everybody !

I am not certain to have the good reasoning.
Actually I was thinking about something like that :

Lets say each square is 5 * 5 and each square center is at X + 5 from the previous square center and X - 5 from the next.
I was thinking about a loop which is moving the character from + 5 on the X axis and checking if there is a collision. If yes, the character goes back to the previous square center, if not, the loop keep going.

So assuming that my character is in ( 0 ; 0 ) coordinates and the obstacle is in ( 20 ; 0 ) coordinates ( but not filling the square ), my character will be in ( 5 ; 0), then ( 10 ; 0 ), then ( 15 ; 0 ), then it will collide with the object in ( 18 ; 0 ) ( because the object dont match exactly with the square size, considering the fact that on object can be 3*3 and just drop on a 5*5 square ), and the character will go back to ( 15 ; 0 ).

With this reasoning :

is the movement of my character going to be smooth ( like a slide ) or is it going to be square by square ?
if checking the collision BEFORE moving, is my character going to move from ( 15 ; 0 ) to ( 18 ; 0 ) and bounce back to ( 15 ; 0 ) or is it just going to  stay in ( 15 ; 0 ) ?

because I would like to have my character to move smoothly AND bouncing back when colliding !

Thank you

sentences: Understanding Tensors I don't seem to be able to visualize tensors. I am reading The Morgan Kauffman Game Physics Engine Development and he uses tensors to represent aerodynamics but he doesn't explain them so I am not really able to visualize them.

sentences:
Maintaining relative location of objects across different screen resolutions I'm developing a very simple interactive HTML5 game, in which I need to show a room having multiple objects like a cupboard, table, fan etc.

How can I display all of the objects together, so that they remain at same place, on all screen resolutions?

sentences:
Why does Mathf.Log(x) return infinity in this case? I'm facing an unexpected behavior due to computational limits, I guess.

I have a function Log(x) which, for some high value in the Fibonacci series n 187 = 5.38·10^38 returns Infinity.

Is there a way I could follow to avoid this and always have computed numbers?

sentences:
What is Minecraft's database? I was wondering, what kind of database does Minecraft use? Is it a relational database, maybe something common like MySQL? Do we even know what he's using?

And maybe even a better question, SHOULD he be doing it that way? What type of database should be used?

sentences:
btRigidBody world transform and scale issue When I create a collision shape for rigid body (in this case box) I use vertices positions and scale from the opengl matrix, the code looks this way:

glm::vec3 boxDim = getBoxDim(verticesPositions, scale);
collisionShape_.reset(new btBoxShape(btVector3(boxDim.x, boxDim.y, boxDim.z)));

When a simulation step is done I need to update opengl matrix for the object. I calculate a new model matrix this way:

btTransform transform = rigidBody->getWorldTransform();
float openglMatrix[16];
transform.getOpenGLMatrix(openglMatrix);

glm::mat4 newModelMatrix = glm::make_mat4(openglMatrix);
newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());

My code works but I wonder if there is any possibility to have already scale in the transform returned by getWorldTransform. Then I can ommit this line of the code:

newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());

sentences:
ScriptableObject's custom objects begin reset to default? I'm using ScriptableObjects as a way to serialize objects that I work with in an editor script. I save them as assets using AssetDatabase.CreateAsset and get them
resetted
It is saving correctly native c# class objects like strings, primitives and arrays of primitives.
The problem is that my ScriptableObject also contains objects of custom classes and structs of my code. These custom objects are being set to default() (ie. value types being set to 0 and reference types to null) every time the code is recompiled and when the editor is restarted (while the primitive variables still have the right saved value). Even with blittable structs the problem persists.
Is that expected?
Edit with some code to contextualize:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct MeshHeader
{
    public int numBones;
    public int numVerts;
}

public class MyClass
{
    public string s1 { get; set; }
    public string s2 { get; set; }
}

public class MySO : ScriptableObject
{
    public int myInt; // OK
    public int[] myArr; // OK

    // These 2 variables will have their value reset after any recompilation of the code
    public MeshHeader meshHeader; // This will become 0;0
    public MyClass myClass; // This will become null

    public static void SaveMySO(MeshHeader h, MyClass c)
    {
        var mySO = ScriptableObject.CreateInstance<MySO>();
        mySO.myInt = 10;
        mySO.myArr = new int[2] { 9, 8 };
        mySO.meshHeader = h;
        mySO.myClass = c;

        AssetDatabase.CreateAsset(mySO, "Assets/foo.asset");
    }

    public static MySO LoadMySO()
    {
        return AssetDatabase.LoadAssetAtPath<MySO>("Assets/foo.asset");
    }
}

When I call MySO.SaveMySO it will save the ScriptableObject. However if I run MySO.LoadMySO after any code recompilation between these two calls, it will have both meshHeader and myClass values set to default, which will be 0 and null respectively while still holding the right values for myInt and myArr.

sentences:
Flickering GUI on Android New version of Unity is causing rather weird problems on Galaxy S device. The GUI starts to flicker, tear and disappear altogether at random in different screens. But this only happens on the second launch. The first launch after full uninstall works perfectly.

Normal(first launch):

Screenshot of the flickering(after first launch)

There are no errors in LogCat that clarifies the problem and this does not affect functionality of the app, only the GUI goes bananas. This happens on other Galaxy S devices too, not just mine. This also happens in my other projects, one which is smaller and one which is larger. But on other devices like Galaxy S2 and Motorola Xoom, there are no issues.

What could be the issue here?

P.S I have contacted Unity support, but have not heard from them

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:
OpenGL texture on sphere I want to create a rolling, textured ball in OpenGL ES 1.0 for Android. With this function I can create a sphere:

public Ball(GL10 gl, float radius)
{
    ByteBuffer bb = ByteBuffer.allocateDirect(40000);
    bb.order(ByteOrder.nativeOrder());

    sphereVertex = bb.asFloatBuffer();
    points = build();
}

private int build()
{
    double dTheta = STEP * Math.PI / 180;
    double dPhi = dTheta;

    int points = 0;

    for(double phi = -(Math.PI/2); phi <= Math.PI/2; phi+=dPhi)
    {
        for(double theta = 0.0; theta <= (Math.PI * 2); theta+=dTheta)
        {
            sphereVertex.put((float) (raduis * Math.sin(phi) * Math.cos(theta)));
            sphereVertex.put((float) (raduis * Math.sin(phi) * Math.sin(theta)));
            sphereVertex.put((float) (raduis * Math.cos(phi)));

            points++;
        }
    }

    sphereVertex.position(0);
    return points;
}

public void draw()
{
    texture.bind();

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, sphereVertex);

    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}

My problem now is that I want to use this texture for the sphere but then only a black ball is created (of course because the top right corner s black). I use this texture coordinates because I want to use the whole texture:

0|0    0|1    1|1    1|0

That's what I learned from texturing a triangle. Is that incorrect if I want to use it with a sphere? What do I have to do to use the texture correctly?

sentences:
Entity System and rendering Okey, what I know so far;
The entity contains a component(data-storage) which holds information like;
 - Texture/sprite
 - Shader
 - etc

And then I have a renderer system which draws all this. But what I don't understand is how the renderer should be designed. Should I have one component for each "visual type". One component without shader, one with shader, etc?

Just need some input on whats the "correct way" to do this. Tips and pitfalls to watch out for.

sentences:
What would be a good game making engine supporting Vector images? I want to create a simple platforming game, in which you are a square in a wonderful world. I would like this game to be able to be played in browsers. Basically I am searching for something similar to "Flixel", but with the following features:

Support Vector Graphics
Allow zooming/rotating objects without producing huge amounts of lag as soon as you are using more objects. (Because I want to rotate the map around the player) So in other words, preferably zoom the viewport/camera instead of the objects themselves.

Does an engine like that exist?

sentences:
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:
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:
Optimizing models & improving performance I've created a map editor for a game I've been developing. The maps (planets) are made using a form of meta ball editing. Basically, in the end the Marching Cubes algorithm is used to get my final model.

Here's an example:

In the game however, when planets are or a largish size, as you would expect, I start having quite a lot of lag. So what I was wondering, is are there any good libraries out there that could be used to remove clusters or triangles that are basically flat and turn them into a single triangle?

I'm not after simply reducing the count, I want the same amount of detail, but to merge triangles where their normal is practically the same.

Also curious, as to how you would go about having more/less detail as you approach/leave areas of a planet. Obviously chunks isn't the easiest method when the world's a sphere.

The project is in C#.

sentences:
OpenGL & SDL textures... game shuts down I'm going to create a game in C++ with SDL & openGL but adding textures won't work.
the code is in some different classes.
here's the main file

//==============================================================================
#include "ZOMBOX.h"

//==============================================================================
ZOMBOX::ZOMBOX() {

    isRunning = true;
}

//------------------------------------------------------------------------------
int ZOMBOX::Execute() {
    Init();

    bool mainloop = false;

    SDL_Event event;

    //Create an texture
    unsigned int Ball_texture = 0;
    //Load the image into the texture using the function
    Ball_texture = loadTexture("Smile.png");
    std::cout << "OpenGL is running\n";

    while(isRunning) {
        while(SDL_PollEvent(&event)) {
            Event(&event);
        }
        if(mainloop == false){
            std::cout << "Main loop has started\n";
            mainloop = true;
        }
        Logic();
        Render();
        }

    //Clear();

    SDL_Quit();

    return 0;
}

//==============================================================================
int main(int argc, char* argv[]) {
    ZOMBOX theApp;

    return theApp.Execute();
}

//==============================================================================

Ok, now the rendering;

//==============================================================================
    #include "ZOMBOX.h"

//==============================================================================
void ZOMBOX::Render() {

    extern float ballX;
    extern float ballY;
    extern float ballWH;
    extern int vellX;
    extern int vellY;
    extern unsigned int Ball_texture;
    Ball_texture = loadTexture("Smile.png");

    //RENDERING to the screen
    //Enable textures when we are going to blend an texture
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix(); //Start rendering phase
    glOrtho(0,800,600,0,-1,1); //Set the matrix
    glColor4ub(0,0,0,255); //White color
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, Ball_texture);

    glBegin(GL_QUADS); //Start drawing the pad
    //We set the corners of the texture using glTexCoord2d
    glTexCoord2d(0,0); glVertex2f(ballX,ballY); //Upper-left corner
    glTexCoord2d(1,0); glVertex2f(ballX+ballWH,ballY); //Upper-right corner
    glTexCoord2d(1,1); glVertex2f(ballX+ballWH,ballY+ballWH); //Down-right corner
    glTexCoord2d(0,1); glVertex2f(ballX,ballY+ballWH); //Down-left corner
    glEnd(); //End drawing
    //Disable textures when we are done using them
    glDisable(GL_TEXTURE_2D);

    glPopMatrix(); //End rendering phase
    SDL_GL_SwapBuffers();

    SDL_Delay(1);
}

//==============================================================================

i know the comments are not right but i understand it...

now the texture; here's the fault i think

//==============================================================================
#include "ZOMBOX.h"
//==============================================================================
//Function for loading an image into an texture
GLuint ZOMBOX::loadTexture( const std::string &fileName )
{
    SDL_Surface* image = IMG_Load( fileName.c_str() );

    SDL_DisplayFormatAlpha(image);

    unsigned object(0);

    glGenTextures(1, &object);

    glBindTexture(GL_TEXTURE_2D, object);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_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_RGBA, image->w, image->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);

    //Free surface
    SDL_FreeSurface(image);

return object;
}
//==============================================================================

I use variables you cant see but that's no problem thus they are not nessecary(i think).

Sorry for my bad English im just a dutch highschool student.

sentences:
error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression' When I build my project, which references the System.IO.Compression namespace, the build succeeds without issue inside Visual Studio.

However, inside the Unity editor, I see the following error:

error CS1069: The type name 'ZipArchive' could not be found in the namespace 'System.IO.Compression'. This type has been forwarded to assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly.

I added a csc.rsp file inside my Assets folder, with the following line:

-r:System.IO.Compression.FileSystem.dll

Unfortunately, that did not resolve the issue.

Here are the properties of the System.IO.Compression DLL that I reference inside Visual Studio:

How can I fix this error?

sentences:
Maintaining/Updating Large Amount of Player States I am developing a fighting game to practice my skills in Java and I would like to know what would be the best approach for figuring out how to easily expand the amount of states a player can have without fiddling with a large amount of code. With a small amount of states such as, inAir, isHurt, isRunning, I can hard code all the conditions I need. Things like 'jumping' can only occur when '!inAir', etc. However, for my project there are a large amount of states I do not know how to organize. Here is a small diagram I redrew:

My approach is to make an enumeration called State and do a switch case between them. I am not sure if this is a good way of doing this and I am trying to learn a better method if there are any.

sentences:
Diagonal Movement with Pygame Rect Class I have been using pygame and have been struggling to understand how to implement vectors and the pygame rect class to make an image move diagonally on the screen at the correct speed.I know it must be normalised else it moves at 2x the correct speed.I don't know how to implement vectors with pygame.rect.x and pygame.rect.y

This is the code I have so far

class Player(pygame.sprite.Sprite):

def __init__(self, location, *groups):
    super(Player, self).__init__(*groups)
    self.image = pygame.image.load('player.png')
    self.rect = pygame.rect.Rect(location, self.image.get_size())

    # movement in the X direction; positive is right, negative is left
    self.direction = 1
def update(self, dt, game):

    # take a copy of the current position of the player before movement for
    # use in movement collision response
    last = self.rect.copy()
    clock = pygame.time.Clock()

    # handle the player movement keys
    key = pygame.key.get_pressed()
    if key[pygame.K_LEFT]:
        self.rect.x -= 300 * dt
        self.direction = -1
    if key[pygame.K_RIGHT]:
        self.rect.x += 300 * dt
        self.direction = 1
    if key[pygame.K_UP]:
        self.rect.y -= 300 * dt
    if key[pygame.K_DOWN]:
        self.rect.y += 300 * dt

Thanks

sentences:
Texture not carrying over to game correctly? I have created my map for my game using 3DS Max. I have then applied textures to the map within 3DS Max, where the textures all show correctly. I export the map as a .fbx file to use within an XNA project.

However as you can see from the below screenshot, the textures are not displayed correctly in XNA.

Does anyone know why this is happening?

I am using the Autodesk FBX content importer and the Model - XNA Framework Content Processor.

As you can see my model which was created in the same way has the textures displayed correctly, it is only doing it to my map.

sentences:
How do I tell if an object is currently colliding with another object? I can't figure out how to tell if a GameObject is currently colliding with another in Unity. I've looked online and can't find any tutorials or answers that work.

Also, what's the difference between a Collision and a Collider w.r.t. Unity?

My dilemma:

I have a third person controller set up and want it to wall jump. I already have an isGrounded function, I just need to test if I'm hitting anything other than the floor. Otherwise I want it to wall jump backwards.

I've already tried:

if (this.OnCollisionEnter){
     ...
}

if (Collider.OnCollisionEnter){
     ...
}

But it did not work. I now tried:

function OnCollisionStay(){
   Debug.Log("Collision");
}

I checked my logs, console and still can't find anything.

sentences:
How should I interpret these DirectX Caps Viewer values? Briefly asking - what do the nodes mean and what the difference is between them in DirectX Caps Viewer?

DXGI Devices
Direct3D9 Devices
DirectDraw Devices

The most interesting for me is 1 vs 2. In the Direct3D9 Devices under HAL node I can see that my GeForce 8800GT supports PixelShaderVersion 3.0. However, under DXGI Devices I have DX 10, DX 10.1 and DX 11 having Shader model 4.0 (actually why DX 11? My card is not compatible with DX 11).

I am implementing a DX 11 application (including d3d11.h) with shaders compiled in 4.0 version, so I can clearly see that 4.0 is supported.

What is the difference between 1 and 2? Could you give me some theory behind the nodes?

sentences:
Qt opengl glTexImage2D in a widget I was doing an OpenGL display, where I render in an opengl context (GLUT).

But now I would like to integrate it into a big project that does not use the Qt OpenGL API at all (QGLWidget, QOpenGLWidget, …).

So I would have to display on QWidget for example using the function glTexImage2D () because it can take a Qimage input ((GLvoid *) Qimage.bits ())

sentences:
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:
How to fix Corner Collision with SAT algorithm? I am making a platformer game, my way of handling collision works most of the times, but when I jump on a platform's corner I get pushed away, it probably happens because my function returns right or left respectively and not bottom collision. Is there anyway to modify this function to work, or is there another algorithm that works better?

public static string RectangleCollision(Rectangle r1, Rectangle r2) {
    string result;

    float w = 0.5f * (r1.Width + r2.Width);
    float h = 0.5f * (r1.Height + r2.Height);
    float dx = r1.Center.X - r2.Center.X;
    float dy = r1.Center.Y - r2.Center.Y;

    if (Math.Abs(dx) <= w && Math.Abs(dy) <= h) {

        // Collision
        float wy = w * dy;
        float hx = h * dx;

        if (wy > hx) {
            if (wy > -hx) {
                // Collision on top
                result = "top";
            } else {
                // On left
                result = "left";
            }
        } else {
            if (wy > -hx) {
                // on right
                result = "right";
            } else {
                // on bottom
                result = "bottom";
            }
        }

     } else {
         result = "false";
     }

     return result;
}
```

sentences:
Libgdx - IsometricTiledMapRenderer and light shading I am wondering if there is any way to simulate light shading in Libgdx using an IsometricTiledMapRenderer.

Here is my code to draw an isometric map, it's able to be moved around with the mouse and you can zoom in and out with the mouse scroll wheel.

package com.iso.game.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Buttons;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.IsometricTiledMapRenderer;
import com.iso.game.Main;

public class GameScreen extends AbstractScreen
{
    private TiledMap map;
    private IsometricTiledMapRenderer renderer;
    private OrthographicCamera camera;

    public GameScreen(Main game)
    {
        super(game);
    }

    public void load()
    {
        map = new TmxMapLoader().load("map.tmx");
        renderer = new IsometricTiledMapRenderer(map);

        renderer.getSpriteBatch().setShader(null);

        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
    }

    public void render(float delta)
    {
        Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        camera.update();

        renderer.setView(camera);
        renderer.render();
    }

    public boolean scrolled(int amount)
    {
        camera.zoom += 0.1 * amount;
        // Don't go below the map
        if (camera.zoom < 0.01)
            camera.zoom = (float) 0.01;
        return false;
    }

    public boolean pan(float x, float y, float deltaX, float deltaY)
    {
        camera.position.add(camera.zoom * -deltaX, camera.zoom * deltaY, 0);
        return false;
    }

    public boolean touchDown(int screenX, int screenY, int pointer, int button)
    {
        if (button == Buttons.MIDDLE)
            camera.zoom = 1;
        return false;
    }

    public void resize(int width, int height)
    {
        camera.viewportWidth = width;
        camera.viewportHeight = height;
    }

    public void dispose()
    {
        map.dispose();
        renderer.dispose();
    }
}

And here is an image of what this code looks like (Note, this class is not the entirety of my code. If you need to rest for some reason please let me know).

Can anyone give me an example on how to simulate lighting with this map? Such as a point light that spreads out and looks isometric, perhaps choosing some tiles as objects that block or distort light. I have no idea how to get started and I couldn't really find anything useful online.

Thank you for your help in advance.

sentences:
Sensor based vs. AABB based collision I'm trying to write a simple collision system, which will probably be primarily used for 2D platformers, and I've been planning out an AABB system for a few weeks now, which will work seamlessly with my grid data structure optimization. I picked AABB because I want a simple system, but I also want it to be perfect.

Now, I've been hearing a lot lately about a different method to handle collision, using sensors, which are placed in the important parts of the entity. I understand it's a good way to handle slopes, better than AABB collision.

The thing is, I can't find a basic explanation of how it works, let alone a comparison of it and the AABB method. If someone could explain it to me, or point me to a good tutorial, I'd very much appreciate it, and also a comparison of the advantages and disadvantages of the two techniques would be nice.

sentences:
Unity 2D Cinemachine weird behavior for non rectangular confiner I have been trying to emulate a sort of Megaman X4 way of following the player around platforming levels, where the camera is confined to certain boundaries of such levels.

However, all the tutorials and guides out there only show rectangular or square-shaped confiners for the virtual cameras, and not odd shapes like an L shaped confiner, when using a weirdly shaped confiner the camera just tends to snap from one position to another and the game ends up feeling bad when that happens.

I have tried solving this problem by using dolly tracks, which work nicely... But I end up having tons of virtual cameras to change to on sections that are weirdly shaped since the camera ends up also suddenly snapping on to weird positions on sharp turns and it also tends to get way off track, even when the settings of the virtual camera are configured to have very little damping and if there's no damping the camera just stutters all the time.

Is there a way to have this kind of behavior to confine a virtual camera to oddly shaped level boundaries?

sentences:
Importing World of Warcraft models into Unity I'm following some tutorials to create a simple game with Unity in order to learn, and I would like to enhance my learning experience by adding World of Warcraft models. Don't worry, this is all just for learning and won't see public eyes in any way.
I downloaded a model viewer and I can export textures and animation from WoW with it, but when importing into Unity I'm having some problems.

Which extension should I export the model to, and what is the process I should follow in order to have an object with a model I just exported?

I'm really new to Unity, so any help would be great!

sentences: Unity 2D extendable rope I need the player to be able to drag a game object that is connected to a rope, and for the rope to extend with it. I have purchased Ultimate Rope Editor, but it looks like it was meant for Unity 3D, and I can't get it to work. Any solutions, or am i out of luck?

sentences:
Corgi Engine - Character glitches with "jump" animation on top of a ladder I'm new to Corgi Engine and Unity in general. I have an issue that I could find a way to resolve.
I'm using CorgiEngine's "RetroLadder" prefab and extended "Rectangle" character with custom animations from "MinimalLevel":

The problem is that when character finishes climbing the ladder, for a very short amount of time, jump animation appears. As in my case jump animation is very different from idle animation, this feels like an unpleasant glitch to me, so that's why I want to fix it. You can see it on the GIF below (at first I jump near the ladder to show how animation looks and then start climbing the ladder and on the top jump glitches) -

I checked some other demos (e.g. RetroVania, which uses some ladders there) and they also have this "glitch" with Corgi demo character, but as the character's idle and jump animations are not very different, it doesn't seem wrong (GIF below) -

I suspect that this glitch happens because "CharacterLadder.cs" script disables gravity during ladder climbing and then enables it back which triggers fall of the character -

Do you think it's possible to workaround it somehow?
Thanks!

sentences:
2D Coordinate Based Game I want to make a game for Android that has a 10x10 Grid Plane as UI.In this game users going to touch on a grid and tihs grid will be painted.

My question is how do I understand which gird or tile was clicked ? I thought maybe I will make this grid on a coordinate system so that if the user touchs a point on the gamescreen aapp will take this point and will find out in which coordinate interval is in.

Like so:

I touched -> [-2.68,3.85]
The grid -> [-3,4] will be painted.

How do I do this in Android Studio?

sentences:
How do I create a camera for a strategy game? How do I make a camera for a strategy game? Think something in the style of Warcraft 3, so you can lower the camera angel and view the world in a somewhat 3D format. Do I need to have some coordinate system where you put every single unit, building, etc., in it and then use an algorithm for the camera to render everything between certain coordinates?

Edit: To clearify the question abit more. How do you render the graphics for a strategy game when the map of the game is bigger then what the players camera view is?

sentences:
How to Create a Blast of Liquid in Unity I am making a small cartoon-ish fighting game, and one of the weapons is a Hot Coffee Sprayer, which is a shotgun style weapon.  How do I create a thick blast of dark liquid to come from it, with a solid appearance like the repulsion gel in Portal 2?

If its too complex, just tell me how make the gun launch a handful individual drops at once rather than a horizontal wall of coffee.

I am not amazing in Unity or C# but I learn easily and I understand the fundamentals of programming very well.  I'm skilled in Python.

sentences:
Performance issues with visibility detection and object transparency I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks behind them. By itself this is not a huge issue, but I'm having trouble determining which walls should be transparent exactly.

I can't use a circle or square mask. There are a lot of cases where the wall piece at the same (relative) position has different visibility depending on the surrounding area.

With the help of a friend I came up with this algorithm:

Create a grid around the player that contains a lot of "visibility points" (my game is semi tile-based so I create one point for every tile on the grid) - the size of the square's side is close to the radius where I make objects transparent. I found 6x6 to be a good value, so that's 36 visibility points total.
For every visibility point on the grid, check if that point is in the player's line of sight.
For every visibility point that is in the LOS, cast a ray from the camera to that point and mark all objects the ray hits as transparent.

This algorithm works - not perfectly, but only requires some tuning - however this is very slow. As you can see, it requries 36 ray casts minimum, but most of the time 60-70 depending on the position. That's simply too much for the CPU.

Is there a better way to do this?

I'm using Unity 3D but I'm not looking for an engine-specific solution.

sentences:
TypeError: R[o5R.F6s] is not a function in changing states in phaser box2d i build my game using phaser.2.4.3.min.js and phaser.2.2.2.box2d.min.js
When trying to change states this error is being raised TypeError: R[o5R.F6s] is not a function and i can't seem to figure out the problem

PS : i took The source code of box2d plugin from the example folder in phaser , and i did not purchase the full plugin yet i was just testing it .

is there anyway to fix this issue ?

here is the game code : http://jsfiddle.net/fbdtq1tg/5/

and here where the error is raised :

SetGameOver: function () {
            this.game.state.start("TheGame");
        }

sentences:
What do you need to know in C++ before starting to program with DirectX I was wondering what do you need to know in C++ before starting to program with DirectX?

I have only been programming in C++ (more for 2D games using SDL and learning the basics) for just over a year, I was wondering what kind of concepts and methods should someone be knowledgeable with or at least have seen before, before attempting to learn how to use Direct X?

sentences:
Strange if-else branching behavior in a fragment shader In my fragment shader I have passed an uniform int uLightType variable, which indicates what type of light is in usage right now. The problem is that if-else branching does not work correctly - the fragment shader performs instructions in every if statement block.

if (uLightType == 1) { // Spotlight light type
    vec3 depthTextureCoord = vDepthPosition.xyz / vDepthPosition.w;
    shadowDepth = unpack(texture2D(uDepthMapSampler, depthTextureCoord.xy));
}
else if (uLightType == 2) { // Omni-directional light type
    shadowDepth = unpack(textureCube(uDepthCubemapSampler, -lightVec));
}

In the case when uLightType equals 1, unless I comment out the content of the second if block, it assigns an another value to shadowDepth.

Also while uLightType equals 1, when I remove the second 'if' block and change == to != like in the sample code below, nothing happens (which means that uLightType really equals 1).

if (uLightType != 1) { // Spotlight light type
    vec3 depthTextureCoord = vDepthPosition.xyz / vDepthPosition.w;
    shadowDepth = unpack(texture2D(uDepthMapSampler, depthTextureCoord.xy));
}

Also, when I manually create an int variable (which is not an uniform) like this: var lightType = 1; and replace uLightType with it in the if-else branch, everything works fine, so I guess it have something to do with the fact that uLightType is the uniform.

sentences:
How to implement a button when the player is in the trigger I have implemented this code and it works but i wanna make this work only if i enter the trigger and press the UI button. Right now it is changing scene automatically so, i want to press the button and then change scene. I know how to do this for PC game but not on Android game. I hope you can give me a hand.

Script

public class ButtonScript : MonoBehaviour {

    //public Button btn;
    private bool door = false;
    public bool hasCollided = false;

    public void Update () {

        if(door == true){
            SceneManager.LoadScene("InventoryScene");
            //SceneManager.LoadScene ("Scene1AToBathW");
            //Application.LoadLevel("Courtyard1F");
            //gameObject.transform.position = new Vector3(x,y,z);
        }

    }

    public void OnTriggerEnter(Collider other){
        if(other.tag == "Player"){
            //btn.gameObject.Setactive(true);
            door = true;
            hasCollided = true;
        }
    }

    public void OnTriggerExit(Collider other){
        if(other.tag == "Player"){
            //btn.gameObject.Setactive(true);
            door = false;
            hasCollided = false;
        }

    }

}

sentences: How to calculate the Forward, Up, Right vectors using the rotation angles? As the title says, I have the pitch and the yaw of an object, How do i use them to calculate the forward, up, right vectors (like the ones in unity), I've searched everywhere and only could find the forward vector.

sentences:
UnrealEngine how to create pirate boat tutorial I fount an Unity tutorial how to crate pirate boat, but I still can't find any sources (links, videos) how to create it using UE.

Kind of this. So when you use character controller it can jump, run and etc, but with a boat you should smoothly running trough the waves with some bouncing effects. So I try to find tutorial that describe how to create this pirate boat. So the question not about model, so I can even use a cube that I can move through waves.

sentences:
entity component - get object from entity system without knowing it's ID Ive been building a game using a Entity Component system, but im having a bit of an issue finding a specific object in my entity system without knowing the Entity's Id.

My game is organized in Layers, with each layer owning its own set of systems, such as Entity System, Render System, Collision etc.

Right now, the game has two layers. The Game layer, which encapsulates all game objects and their data, and a Hud layer, which houses all the UI controls. (Pause, restart etc).

What I want to be able to do is, once a specific thing happens in the game layer, such as an enemy dying, I want to be able to communicate to the Hud layer to tell a button to appear or disable itself etc. The problem is, I have no way of finding that button because I have no Id to query for the button in the Hud layers entity system and the reference to the button gets lost after I create the button when the game starts up.

Ive looked into implementing a message queue type of thing, or using some sort of publish/subscribe pattern, but still the issue is how I can communicate that change to an object who's Id I dont know.

One solution I thought about is giving all UI Elements unique names. That way whenever I need to do a change in the UI, I can query the Hud Layer Entity System for an entity with that name, and get its reference back. But then that entirely ruins an entity having a unique Id, because it now relies on using a name for identification.

Is there any way I can get around this?

sentences: What programming language were PS1 games written in? Is there any common language that is used to create Play Station 1 Games? Or how can I find out what programming language is used for one of those games?

sentences:
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:
TopDown 2d player control Whats the usual way to control a player in a top down game? We have to look in the direction of the mouse cause the player hold a torch.

My first try was:

to to make it absolute like W move to screen top, A left, D right, S bottom... But it feels a kind of strange.
second try was to make it relative to the player. So W is always straight forward, A and D is moving sideway and S is backwards. But i heard of my tester thats very hard.

So whats the better / right way for the movement in a top down game in that you can move in a another direction as you look?

sentences:
How to move object on local space not object space in unity I am watching this (game dev, space parenting & rotation)
Sebastian Lague video and found that there are three spaces actually (not two) and these are world space, local space and object space.

World space: The static space (0,0,0)
Object space: related to the object space
Local Space: related to the parent of the object

I am amazed that i didn't find the distinction between these two spaces(local and object) on official unity forms but actually it exists. My question is that why there is no Space.Local? I found that there are Space. Self and Space.World.
Space.Self is refer to object space. I can move my object to object space using this

    void Update () {
        transform.Translate(new Vector3(0,0,1) * Time.deltaTime * 2,Space.Self);
    }

And i can move my object to world space using this

void Update () {
    transform.Translate(new Vector3(0,0,1) * Time.deltaTime * 2,Space.World);
}

but there is no support for local space that i could move the object to local space (means move the object related to its parent object). There is a fair distinction between Local and Object space but unity didn't consider it i guess or i am wrong.

sentences:
How to ensure that a 3D coordinate at Z=1 act like a 2D coordinate (using perspective projection) Possible Duplicate:
  OpenGL ES 2.0: Mixing 2D with 3D

The title probably is not that clear but please help me out here. I am going to write a (mostly) 2D game using OpenGL ES 2.0 so if I have a vertex at (5,10,1) I want it to be drawn at the (5,10) pixel on the screen. But I can't use orthogonal projection because I'll still use some few real 3D objects on it to give a cool effect, and I want to preserve the perspective distortion on their vertices with Z > 1.

How should I set up my view/projection matrices to achieve this?

note: I am so sorry if this sounds like a noob question, but please take in account that I am a noob myself...

sentences:
What is actually drawn when glDrawArrays and glDrawElements are called? In my journey out of immediate mode I've come across a snag that I haven't been able to find a decent answer for in any tutorial or API, namely: Which data structures are actually invoked when I make a call to a glDraw* function in OpenGL3.3+?

For example, if I want to draw two 3D models and I've put their vertex data in two different VBO's, does invoking glDrawArrays draw everything set under the current VAO? Or does it only draw the currently bound VBO sampling from the currently bound texture?

I basically understand VAO's and VBO's conceptually but its down to implementation that I'm running into problems, it's a big jump to go from the "stability" of immediate mode to the a-synchronicity of modern OpenGL.

sentences:
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 convert a cube map to an equirectangular projection? I have a cube map texture showing a surrounding area, which I want to pass to a program that only works with latitude/longitude maps.

How can I do this?

In other words, I need to turn this:

…into this (I think it's additionally rotated -90° over the x axis):

sentences:
Portal frustum culling Our Levels consists of rooms.
Each room has an arbitrary number of portals into other rooms.
We frustum cull rooms by testing whether all portal vertices (a portal consists of a single quad) are outside of the frustum this is done recursively until no room is found.
This however has one flaw. if a portal is visibly occluded, it is still taken into account because it is within the frustum.

Is there an easy way to cull the rooms which are in the frustum but occluded?
I had Hardware occlusion culling in mind, but I am not sure whether this is too overkill.

sentences:
How 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 do I mix 3D skeletal animations? I'm trying to create a 3D-model skeletal animation system for C++/Open GL. I would like to be able to mix animations by allowing animations to only affect specific bones.

My game has ride-able creatures, which affect the players legs to animate him sitting. But while he is sitting, the items he is holding must control his arms, independent of the legs.

I almost feel like hand-coding the bone rotations would be easiest, even if it means low animation quality.

How can I make this work?
Are particular model file formats better-suited for this?

sentences:
unsmooth blending with deferred shading and light volumes So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending
glCullFace(GL_FRONT);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);

(while in the single light pass i just added the light values to the rgb color)

Else both light calculations are the same.
Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition.
I guess the problem is the blending equation, but i can't find a solution.
The resulting color of the light volume shader looks like this
//d is the normal/light direction equation
//sp is the specular value
//att is the attenuation
//diff is the material color
color = vec4(diff * light_color * (d + sp) * att, 0.0);

The described values should be right.

sentences:
Best way to blend colors in tile lighting? (XNA) I have made a color, decent, recursive, fast tile lighting system in my game. It does everything I need except one thing: different colors are not blended at all:

Here is my color blend code:

return (new Color(
       (byte)MathHelper.Clamp(color.R / factor, 0, 255),
       (byte)MathHelper.Clamp(color.G / factor, 0, 255),
       (byte)MathHelper.Clamp(color.B / factor, 0, 255)));

As you can see it does not take the already in place color into account. color is the color of the previous light, which is weakened by the above code by factor. If I wanted to blend using the color already in place, I would use the variable blend.

Here is an example of a blend that I tried that failed, using blend:

return (new Color(
       (byte)MathHelper.Clamp(((color.R + blend.R) / 2) / factor, 0, 255),
       (byte)MathHelper.Clamp(((color.G + blend.G) / 2) / factor, 0, 255),
       (byte)MathHelper.Clamp(((color.B + blend.B) / 2) / factor, 0, 255)));

This color blend produces inaccurate and strange results. I need a blend that is accurate, like the first example, that blends the two colors together.

What is the best way to do this?

Update:
I noticed that the reason simply adding them together and the above isn't working is because the light was spreading onto itself and blending with itself. I am going to try and prevent this by writing the light spread onto one array, a temporary one, not using blend at all, only using the first method. After each light is finished with the recursion process I'll draw it to the main one using a custom pixel shader that will blend the light together properly. This may or may not solve my problem.

sentences:
Game Over not appearing in third room (GameMaker Studio 2 Trial) This is my first StackExchange post, so forgive me if I make a silly mistake.

Getting to the point, I've made a simple Mario-esque platformer where whenever you die, game over text is printed to the middle of wherever you are on the screen. Dying is an Instance Destroy event triggered by various objects, while the Draw GUI event is triggered by a separate object placed in each room.

The third and final "level" room is where text doesn't appear no matter where you die. I've made multiple attempts to fix this, but nothing appears. I believe part of it involves the room's layout; the other levels were simple "go to the right" styled rooms. The third room goes vertically and is much taller.

The issue also likely involves the camera. I'm using viewport[0]. Room properties are as follows:

Room settings - Width: 3000, Height: 3000
Clear Viewport Background: ON
Camera - X Pos: 0, Y Pos: 2250, Width: 1080, Height: 768
Viewport - X Pos: 0, Y Pos: 0, Width: 1080, Height: 768
Following object: obj_playercube (player object) (Hor. border: 400, Vert. border: 400, Hor. speed: 200, Vert. speed: 200)

This is the code for obj_gameover's Draw GUI event:

draw_set_font(fnt_dead);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_color(c_white);

// (x, y) coordinates of the center of the view

var center_x = view_xview[0] + view_wview[0]/2;

var center_y = view_yview[0] + view_hview[0]/2;

if (!instance_exists(obj_playercube))

{

    draw_text(center_x, center_y, "Game Over\n Press Enter to restart from current room.");
    show_debug_message("Game over has printed");

}

I'm sure it's a matter of adding more variables to account for the room's differing properties compared to the others. I'll try to figure it out myself in the meantime.

sentences:
Getting different x and y coordinates for touched location on a zoomed view I'm using Cocos2d for developing a game. I need to be able to pan and zoom when necessary, so for this reason I've added CCLayerPanZoom extension to my project. Recently I've noticed a problem with zoomed layers. The thing is if I touch on a zoom-panable layer before doing zooming or panning I get correct x,y coordinates. But if I zoom the layer, the touched location coordinates are different than the earlier ones. Here's how I get the touch location:

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch=[touches anyObject];
    CGPoint touchedLocation=[touch locationInView:touch.view];
    touchedLocation=[[CCDirector sharedDirector] convertToGL:startPoint];
}

You might ask how I determine whether the two points are different before and after zooming. I have a sprite located on a predetermined point in the view. When I touch the sprite I log the position of both the sprite and the touchedLocation. Before zooming these points are almost the same, only a few units of difference in x and y. But after zooming they're totally different points and I guess this difference is directly proportional with the zoom scale. I don't want to ask how to have the touched location the same before and after zooming, I rather want to ask what I should do in this case.

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:
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:
Help retrieving/sending data to/from a server on iOS (C#, Mono, .Net) I'm sorry in advance if this is a silly question.

I'm currently working on getting something running where I can grab information from a server.  My goal is to make the data I'm retrieving (or sending, for that matter) as small as possible -- both for speed and bandwidth.

To make matters more complicated, I'll be needing two sets of data:

Global: Something that doesn't house a lot of data, but needs to be synced every time.  (News, status, etc.)

Personal: The user's data. (Points, scores, etc.)  This isn't a lot of data either, but I thought that a database would be ideal for this.  Doesn't this then mean that I'd have to retrieve the whole database, and then filter it?  (i.e. transmitting too much data)

The server would be as small as possible (for cost), so it should only house data, and not do any (or almost any) of the work itself, so it would essentially just be storing the files.

Is a database the best way to go about this?  Should I use two databases (global, personal)?

Would SQL be best for this?  Or could I use REST and just grab the data I need (not the whole file)?

I'm sorry if this seems like a lot.  I've been googling for a few days now, and I'm unsure of what I should do.  If this is unclear, please say so and I'll try to clear things up.  If it's too broad, I will narrow it down more.

EDIT: Thanks for the answers thus far, but they aren't quite what I'm looking for.  So, I'll go into more detail.

I'm thinking of using Amazon for the server, mainly because it's pay-as-you-need and scalable.  Furthermore, I've found this article which is specific to MonoTouch, but I'm still not sure what's easiest.  I will not have a ton of data, so if I can grab either a small file, or query a database, that would be great.  I'm all for using third-party libraries, if it's possible, but mainly I'm not sure how I should do what I want to do.

Sorry for being so thick.  Obviously I can understand it better with example code, but it's not a requirement for an answer.  (And I want to make it explicitly clear that I'm not asking for hand-outs.)

sentences:
Is the STL efficient enough for mobile devices? When it comes to mobile game development on iOS and Android NDK, some developers write their own C++ containers, while others claim that STL is more than adequate for mobile game development (For example, the author of iPhone 3D Programming uses STL rather than Objective-C in his examples. His defense is that STL is no slower than Objective-C).

Then there are also mobile developers who abandon C++ entirely and develop games entirely (or mostly) in the C language (C89/C90).

What are the benefits and drawbacks of each approach?

sentences: Accessing motor object of a surface motor I would like to make a door closer for a door. The door should open normally, but when the person passes through close slowly. I've made an standard door on hinges, but then made one of them a motor and thought to control it when the person passes the door. However, I can't find the motor object on that part which owns the motor-surface. How can I do this properly?

sentences:
Scaling issues with Open GL viewport / scissor box (Trying to draw outside of viewport) In my game I am currently scaling the viewport so it retains the ratio of my development device like so:

width = (int) Math.min(deviceWidth, deviceHeight * 1.702127659574468); //1.702127659574468 is the ratio of my development device
height = (int) Math.min(deviceHeight, deviceWidth / 1.702127659574468);

GLES20.glViewport(offsetX, offsetY, width, height);

//Set the ratio of the display
ratio = (float) width / height;

Matrix.orthoM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);

This then displays the viewport with black bars at the top and bottom of the screen while retaining the correct ratio.  Therefore everything appears nice and even.

I want, however to now draw outside of the viewport in order to make things look better on devices that letterbox.

I'm setting my sprite's width and height like so:

sprite.width = (int) (width*0.078125);
sprite.height = (int) (height*0.1329787234042553);

This results in a 'square' quad (on my dev device the width is 2560 and the height is 1504, so the results in this case are:

Width = 200;
Height = 200;

On another device, this also therefore results in a perfectly square sprite.  So far, all is good and all works great.

Scissoring

I tried, now to set the vieweport to the full size of the device's screen and create a 'scissor box' using GLScissor like so:

width = (int) Math.min(deviceWidth, deviceHeight * 1.702127659574468); //1.702127659574468 is the ratio of my development device
height = (int) Math.min(deviceHeight, deviceWidth / 1.702127659574468);

GLES20.glViewport(0, 0, deviceWidth, deviceHeight);

//Set the ratio of the display
ratio = (float) width / height;

Matrix.orthoM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);

And then drawing like so: (Psuedo)

DrawOutsideScissorBox();

GLES20.glScissor(offsetX, offsetY, width, height);  //Using the scaled width and height
GLES20.glEnable(GL_SCISSOR_TEST);

DrawOtherStuff();

GLES20.glDisable(GL_SCISSOR_TEST);

This does work (in so far as I can now draw outside of the 'game area'). I'm sizing my objects using the Scaled width and height (and not the device's actual width and height just as I was before) and they are 'square' as far as their pixels go (so, if I log the width and height  it would be for example 20 x 20, or 40 x 40), but they are still appearing 'stretched' vertically.

Why is this?  How can I make sure that the sprite's that are displayed are in proportion as they were when I was scaling my viewport?  What am I missing?  Or am I wrong in my thinking?  How can I draw in the 'black bars' left by letterboxing?!

sentences:
MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt.

What I have so far is:
- randomly generated tile set with items on SOME tiles
- one creature spawner that spawns up to 5 creatures which can be controlled by the player
- the ability for creatures to pick up items and bring them back to the spawn and store them for later use

What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt.

If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you.

thanks for reading!

I have my draw method like this:

GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

spriteBatch.Begin(SpriteSortMode.BackToFront,
          null, null, null, null, null,
          camera.GetTransformation());

worldEntity.Draw(spriteBatch);

guiManager.DrawGUI(spriteBatch);

spriteBatch.End();

base.Draw(gameTime);

for the world entity...
its draw method systematically goes through each tile in the world and calls its draw method.
the tile draws itself using

Vector2 topLeftOfSprite = new Vector2(this.X, this.Y);
Color tintColor = Color.White;
spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor);

and then proceeds to call the draw method of any items on it.

creatures and items have very similar draw methods.

the gui also draws itself in a similar fashion.

what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?

sentences:
How do I 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:
How do I duplicate a Box2d simulation, mid-simulation? I want to serialize the state mid-game, send it over the network to an identical computer (same CPU, same OS, same binary), load it there, and have the two games run in tandem doing the exact same simulation, without one of them drifting off and going haywire.

In short: I want pop-in, pop-out networking support on my HIGHLY physics-intensive game, where sending object coordinates every few seconds is impossible, due to having thousands of objects, and many clients.

I tried this with Box2D, and saving an object's location/velocity/etc wasn't enough... there's internal state that's not accessible through any public methods.

My current workaround is to force EVERY client to save its entire worldstate and reload it from scratch, whenever a new player connects... but this is obviously bad practice, because it hangs the game for everyone whenever someone new connects. However, it works, with zero desynchronization.

So, anyone know of any other techniques that can help me? Or should I just kiss my project goodbye?

sentences:
Any idea to be able to make the character still continue the game until no heart left I am newbie I am making a 2d game in unity 3d my code for the character game over is this.. I can get the heart less one heart if game over but turn back to five again I just want to decrease heart whenever character die until it loss all the five heart

and my code for the heart is this...

function Start () {
    coins = PlayerPrefs.GetInt("Coin");
    moveSpeed=10;
    anim=GetComponent(Animator);
    MainCode.Hearts = 5;
}

function Update () {

    transform.rotation.z=0;
    if(Input.GetKey(KeyCode.UpArrow)){
         transform.position.y+=moveSpeed*Time.deltaTime;
    }

    if(transform.position.y<-5) {
         Application.LoadLevel(Application.loadedLevel);
         MainCode.Hearts -=1;
    }
    if (MainCode.Hearts <= 0){
         GameOver();
    }

}

var image : GUITexture;
var Image_01 : Texture2D;
var Image_02 : Texture2D;
var Image_03 : Texture2D;
var Image_04 : Texture2D;
var Image_05 : Texture2D;
var Image_06 : Texture2D;

function Update {
    if(MainCode.Hearts == 5){
         image.texture= Image_01;
    }
    if(MainCode.Hearts == 4){
        image.texture= Image_02;
    }
    if(MainCode.Hearts == 3){
        image.texture= Image_03;
    }
    if(MainCode.Hearts == 2){
         image.texture= Image_04;
    }
    if(MainCode.Hearts == 1){
        image.texture= Image_05;
    }
}

however its not working properly any help would be really much appreciated thank you in advance

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:
Most efficient 3d depth sorting for isometric 3d in AS3? I am not using the built in 3d MovieClips, and I am storing the 3d location my way.

I have read a few different articles on sorting depths, but most of them seem in efficient.

I had a really efficient way to do it in AS2, but it was really hacky, and I am guessing there are more efficient ways that do not rely on possibly unreliable hacks.

What is the most efficient way to sort display depths using AS3 with Z depths I already have?

sentences:
Textures rotated 90 degrees when importing a .glb file I have a simple box, textured with bricks, in Blender:

I export this scene as glTF 2.0 and import into Godot. Here's the result:

As you can see, the bricks are rotated 90 degrees for some reason. Why, and how can I make it right?

sentences:
HLSL weird matrix behaviour I have some problems using an int 3x3 matrix as the convolution filter to do edge detection. (I know int matrices are not very meaningful since there is only float on the gpu)

Here is the code:

   float2 stepSizeX = (1.0/512.0,  0.0);
   float2 stepSizeY = (0.0, 1.0/512.0);

   for(int y = -1; y <= 1; y++)
   {
      for(int x = -1; x <= 1; x++)
      {
        float4 c = tex2D(origSampler, TexCoord + stepSizeX * x + stepSizeY * y);
        endColorX.rgb += c.rgb * theMatrix[x+1][y+1];
      }
   }

The matrix is set to:

-1 -2 -1
0 0 0
1 2 1

..in the application, but it seems the values in the HLSL shader are different, though I can't figure out how and why?

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:
Unity and Apple TV Remote control sensitivity I'm developing a game for Apple TV and I'm responding to the swipe gesture using

if (Input.GetKeyUp(KeyCode.Joystick1Button4)){
   DoSomething();
}

But the problem is that this is too sensitive, and triggers when the player didn't intentionally swipe. Is there any way to set the sensitivity?

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:
Loading chunks of the terrain relative to the player's position I'm making a small voxel-based multiplayer WebGL game with a Node.JS server which handles player positions and sends terrain chunk data to the clients. This is an example of how I'm currently sending the chunks:

var viewDistance = 6;

for (var x = playerPosX - viewDistance; x < playerPosX + viewDistance; x++)
for (var z = playerPosZ - viewDistance; z < playerPosZ + viewDistance; z++)
for (var y = playerPosY - viewDistance; y < playerPosY + viewDistance; y++) {
    client.send( getChunk(x, y, z) );
}

This simply loads and sends the chunks within the view distance, however I'm looking for a way to prioritize sending the chunks nearest to the player first. Obviously it's no good loading chunks that are far away before loading the one the player is standing on.

Assuming playerPosX, playerPosZ and playerPosY store the positions of the player and client.send( getChunk(x, y, z) ) will send the chunk, does any one have any ideas how I would do this? Thanks.

sentences:
Smoothly move between bodies I'm not sure if the title is correct (please comment if it is not). I have a sprite (rectangle body), and I'm applying force on it to make it move from left to right and then go backward. The platform consists of a few rectangle blocks of same size, lined up, with no distance between them . What they form is a perfectly straight line. The platform can be flat or sloped.

What I want

The sprite moves smoothly forward and backward on the platform.

What actually happens

The sprite is sometimes clogged at the point it moves from one block to another, even there is no space between blocks at all. Also sometimes at that point a collision is registered.

I have tried to search and found something called "internal corners", but have no clue how to fix this problem. Is there a way to get around? Thanks!

sentences:
Facebook Scores API Global and Daily Rank on Unity I need to implement 4 types of leaderboards on my Unity game:

All Time/Daily
Global/Friends

I'm using Scores API from Facebook and I achieved All Time Friends Leaderboards. I'm taking a look at the Scores API documentation and I'm not seeing Daily nor Global rank anywhere.

Is it possible? If yes, how?

sentences: Why is the standard on displaying missing textures is via a black and purple checkerboard? In many different games, such as Minecraft and TF2, the default texture is a black and purple checkerboard. Even games that don't use that exact texture incorporate elements of it. Borderlands 2 uses a white and purple checkerboard, and Skyrim uses a solid purple texture. Why is the black and purple checkerboard so prevalent as a default texture?

sentences:
Road / river generation on 2d grid map This is a newbie question, but here it goes:

My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of tiles. Instead, they should have a certain level of randomness (turns).

Is there a standard algorithm for this kind of thing?

Cheers!

UPDATE:

This is the result of playing with weights on the grid, and applying a shortest path algorithm (Bellman-Ford) using the jgrapht library. I went with Donutz' answer after all.

http://pastebin.com/AGQGK5ik

sentences:
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: 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:
Single handler vs multiple handlers for the Command Pattern I'll be soon implementing for the first time a Command pattern to catch general events about the world of the game I'm developing

Since I haven't found much info about this particular issue, I'm asking if it makes more sense to have a single 'catch-all' class which will eventually process any type of event or to offload events to different types of Queue

e.g. player related Commands will be offloaded to the Player class, enemies related commands will be offloaded to the Enemies class, and world/terrain related commands (such as chunk creation) will be handled by WorldGen

Normally, this would break the idea of having a 'receiver' object as a constructor parameter of an instance of a Command, but does having just a single 'catch-all' class more maintainable than partitioning the command handlers?

Is it maintainable in a convoluted game to have just a single catch-all class to execute every type of Command? Wouldn't it be easier to optimize the usage of more threads by having different command handlers?

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:
Skeletal animation 3d models I'm building a skeletal animation system. My goal is to make it as efficient as I can.

Is there a place where I can download some 3d models (preferably from real games) So I could see if my system animates them efficiently?

The current model I'm testing on has 12500 faces overall and 57 bones. My FPS drops from 60 when there are 10~ animated instances of it running. I don't know if it's okay or bad.

Any other help and tips for benchmarking my system will be highly appreciated.

sentences:
Is it possible to tilt the canvas and have entities react to it I will try and explain this as simple as I can, let me know if you need more details and I'll edit the text.

Imagine a simple gravity-enabled 2D-game with a ball inside a room where the objective is to prevent the ball from hitting the walls of the room while the room itself is tilting from side to side. As a player you can control the ball left or right. The game is over when the ball hits one of the walls.

I have been trying to think of a way to have the ball (entity) react to the tilt of the room (canvas), specifically how to manage the acceleration, velocity and movement of the entity in respect to the tilt, but I haven't been able to find a suitable plugin or solution to this. Has anyone tried implementing this? How do you handle acceleration, velocity and movement, and would you implement the tilt in the canvas, a room entity or something else?

sentences:
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:
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:
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:
Minecraft Forge 1.8 Custom Recipe Manager, need help sorry for asking this question. Some of you will probably find it very easy but I just can't figure out how to do it.

I want to write a custom Recipe Manager. It has to check the recipes. Therefor I create an ArrayList<Item[]> recipes = new ArrayList();

The Item Array store 4 items(3 inputs and one output):Item[] items = {Item1, Item2, Item3, Item4};

I want to get a function that does this:

I give it a Item and it gives me an ArrayList containing all the Item[]s containing that Item as the 0th index and a Boolean that is true when there is any Item[] containing the Item.
Then I give (if needed to another function) an second Item. It returns me a new ArrayList containing all of the previous Item[]s that containe the Item and a Boolean similiar to 1 but for the 1th index.
Analog to 2. (I think you get what I mean).

The 3 points have to be handled in another method call.
Thank you very much in advance
Nova

sentences:
Dynamic Shapes and dynamic animations I saw this video: Video
And now I am curious about the following: How can you achieve dynamic forms like they are shown in this video.
What I mean is: Do you need to have some "base" models which can be just linked together? Or is it possible to generate these 3D models "on the fly"?

If yes: How could that be done?
And: Is something like that as well possible in 2D?

And: How can you do animations, like (some) in the video? Because it seems as if the body parts of the creatures work together more or less correctly. As well here is the question: Would this be possible in 2D?

sentences: Why isn't occlusion culling working correctly? Occlusion culling doesn't seem to be behaving the way I was expecting. I've set the yellow wall as static and have baked an occlusion map using the occlusion window in unity. However when visualising the occlusion - the red cylinder behind the wall is still visible despite not being seen in the camera preview. Any clue what I'm doing wrong?

sentences:
How to position/transform vertices for 2D UI in shaders? I am building a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have gl_Position output like:

gl_Position = projection * view * model * vec4(position, 1);

I would like to draw some 2D UI on top of all the 3D draw calls. I am having a hard time understanding how to do this.

Let's say I wanted to draw a HUD player life bar that is fixed to the bottom left corner of the screen. I can imagine drawing a quad. and maybe applying a texture to it. I would have 4 vertices for the quad to feed to the shader. How would I change the gl_Position calculation to handle drawing only to 2D screen space? Would I update the transformation to only apply the projection matrix?

gl_Position = projection * vec4(position, 0, 1);

How to determine the local coordinates of the quad verts? When the screen scales or resolution varies, How to ensure the quad stays positioned to the lower bottom screen? How to ensure the quad dimensions stay the same ratio?

sentences: In Godot browser game, is it possible to let the player download a file? I have a Godot game exported to the browser. I want to let the player export some data and let it save the data as a file on their PC, as if they were downloading a file from the Web. Is it possible for me to do that?

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:
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:
Checking if Body is surrounded by other Bodies I'm trying to make a game like Rampart as practice. I have gotten to the point where I want to check if the castle is surrounded by walls and decide whether to fill in the area and continue the game, but I have no idea how to do this. I have thought about ray-casting from the castle but it wouldn't work if there was a bend in the walls.

So any help or suggestions would be great!

sentences:
How should I configure firewall for online game server? I'm complete newbie on game server work.
As I know, online (massively multiplay) game server should keep some TCP or UDP connection from the user. As I (=newbie) guess, maybe huge count of socket port should be opened. So how should I configure firewall for game server? Or should I use some other special method to security?  Any advise will be appreciated.

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: How is a 3d perlin noise function used to generate terrain? I can wrap my head around using a 2d perlin noise function to generate the height value but I don't understand why a 3d perlin noise function would be used. In Notch's blog, http://notch.tumblr.com/post/3746989361/terrain-generation-part-1, he mentioned using a 3d perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x,y, and z values doesn't that imply you already have the height?

sentences:
Interpolating bent textrues I am currently making a pressure heat map that will be overlaid on a bent shape (let's say cylinder). I am using a 2d texture that is mapped to the object. The pressure points are also mapped to the texture matrix. As there are only few pressure points giving values, I am interpolating the pressure for the rest of the texture, however, there is an issue...

As you can see because the texture data is in 2d array the interpolation does not account for the place where it connects.
Is there an algorithm that would help account the borders of the matrix being connected?

sentences:
What are some good (retro) symbols for magic/mana/energy? Much like a heart is used a lot for health and lives in old retro games...

...what would be a good icon to use for Energy, Mana and/or Magic points?

sentences:
Apply portion of texture atlas I'm trying to write a shader that only maps a portion of a large texture to my sprite and I'm getting a strange behaviour with my current code.
This is what I have right now:

Texture atlas example (256x256px):

EDIT
I've changed both shaders and I get the following output right now (first image), but I need to zoom the texture so I only render the highlighted portion of the second image, how should I modify the shaders to achieve that?
 ->

These are my current shaders:
Vertex:

uniform mat4 uMVPMatrix;
attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec2 vTextureCoord;
varying vec2 vTextureCoordOffset;
void main() {
    // offset and texSize will be defined as attributes later.
    // They're defined here for test purposes only
    vec2 offset = vec2(128.0, 64.0);
    vec2 texSize = vec2(256.0, 256.0);

    float u = offset.x / texSize.x;
    float v = offset.y / texSize.y;
    vTextureCoordOffset = vec2(u, v);
    vTextureCoord = aTextureCoord;
    gl_Position = uMVPMatrix * aPosition;
}

Fragment:

precision mediump float;
uniform sampler2D sTexture;
varying vec2 vTextureCoord;
varying vec2 vTextureCoordOffset;
void main() {
    gl_FragColor = texture2D(sTexture, fract(vTextureCoord) + vTextureCoordOffset);
}

SOLVED
I solved it changing the fragment shader to:

gl_FragColor = texture2D(sTexture, fract(vTextureCoord) * vZoom + vTextureCoordOffset);

vZoom is calculated in the vertex shader:

vZoom = subTextureSize / texSize;

sentences:
A 2D Camera Follow Script That Does Not Rotate? I am attempting to make a 2D racing game. So far I have a player car (sprite) and a main camera.

I would like to know how to make the main camera follow the player car while still showing signs of movement (I don't want the positions to match exactly in the middle of the screen).

My Player Car has a Rigidbody2D and a MoveCar script

using UnityEngine;
using System.Collections;

public class MoveCar : MonoBehaviour {

    public float speed = 10f;
    public float gravity = 0f;

    void CarMove ()
    {
        if(Input.GetKey(KeyCode.RightArrow))
        {
            transform.Translate(Vector2.right * speed * Time.deltaTime);
        }
    }

    // Update is called once per frame
    void Update ()
    {
        CarMove();
    }
}

Then there is my Main Camera, its projection is switched to Orthographic and has default settings as well as a FollowCar script:

using UnityEngine;
using System.Collections;

public class FollowCar : MonoBehaviour {

    public Transform player;

    public GameObject other;
    public Rigidbody2D rb = other.GetComponent<Rigidbody2D>;

    void Update()
    {
        transform.Translate(Vector2.right * .5f * Time.deltaTime);
        Vector2.MoveTowards( Vector2 , Vector2 player,
    }
}

I would like to know where to go next or if I'm even going in the right direction. I have no idea how to utilize the MoveTowards() function.

sentences:
Position Unity UGUI ScrollRect Content Position from Script I have a map in my game the user can interact with. I am using Unity UGUI ScrollRect to let the user move the map on the screen. Only one area of the map is visible at a time and you can scroll it to get to the desired level (just like in King games). The content of this map system is an Image and level buttons which are all children of the map image.

I want my ScrollRect to point to the current active level when the map loads. For example, if I am on level 30 then on loading the map level the content of the ScrollRect should be on the portion of the map where level 30 is.

I can't find anything regarding managing ScrollRect's content position

sentences:
Infinite loop of prerendered 3d graphic I have a game where I want a never ending pathway for the character to walk along. So in my 3d modeling tool I created a path like this:

now I want to loop that model over and over in my prerendered 2d game for the character to walk on (most of the other game elements are in 2d). The problem is that simply overlaying one image on top of another results in the tiles facing opposite directions. Here's another picture I slapped together so you'll get the idea. In the final game the outer border of the pathway won't separate the two paths.

as you can see, the tile pattern looks unnatural, like one pathway segment is a mirror of the other. How can I change the lens/render the model differently so that it can become a seamlessly looping 2d texture?? Can it be done using only the camera view, without a "quadrilateral reshape" or falsely stretching the back end of the platform in my 3d modeler?

sentences:
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:
How to allow other games to communicate with my Lua scripts? I am planning some small games that will all rely on a single system of Lua scripts to manage some unified data about:

Some achievements that are common to each game.
The player's progress in completing the achievements.

Players would need to have these three parts on their system to play:

This small set of three unifying Lua scripts.
A single data file containing a list of challenges and the status of the player's progress in completing each.
At least one of the small games.

The three Lua scripts manage the player's progress data file:

One script tells the game which challenge the player needs to complete next.
Another script updates the data file with information about the player's progress.
A final script calculates statistical information about the player's progress. A game can check use this script and decide which of this information it will show to the players.

So far, I am having the games execute the Lua scripts and using stdout to communicate information between the games and Lua scripts placed in a bin directory, which seems to work well on Linux, but I need a solution that works equally on Windows, OS X, and mobile devices and that will not be a challenge for players to install. Is this a more preferred method?

Other developers using different programming languages should be able to easily connect their games to this system.
Everything is stored locally, nothing uses the Internet.

sentences:
Modify the effect of a card being played I'm trying to recreate a simple card game. Each played card has an action (draw extra cards, peek at draw stack, eliminate an opponent card, etc). Once played, it goes on a stack, and the card effect is executed in order.

Cards added by effects are added at the end of this stack as well, and executed once it is their turn.

Each player also has a different unique influence on exactly one type of cards that changes the effect (enhances it like draw 4 instead of 2 or taking cards instead of trashing them to graveyard).

So far a card has a simple interface with value, type and doAction. While I could on each card do a check if a player influence would take effect, this seems like a hard coded noodle salad and makes it difficult to add new cards or influences. And more than once influence can take effect on the same card (for example, one effect could be steal 2 instead of 1 and the second effect, you can steal only a certain type of card from a second influence instead of free choice)

I'm looking for a way to react on a method call (played card that gets executed) and change it accordingly. I'm investigating using delegates for this purpose.

sentences: How can I implement foot pedal of a car in unity? I trying to create 2-D car game in unity for mobile where player controls acceleration by sliding the pedal in touch screen.Mine idea of implementation is using UI slider. Is there any other good I can use? Please suggest me any other implementation if any available.I'm new to this field.

sentences:
car crash android game I'd like to make a simple 2d car crashing game, where the player would drive his car into moving traffic and try to cause as much damage as possible in each level (some Burnout games had a mode like this).

The physics part of the game is the most important, I can worry about graphics later. Would engine like emini or box2d work for this kind of game? Would Android devices have enough power to handle this? For example if there were about 20 cars colliding, along with some buildings, it would be nice if I could get 20 fps.

sentences: How is the Unreal rendering pipeline implimented? I know this seems like a very broad question, but i am just interested in getting to know how the Unreal engine's rendering pipeline looks like, specially how it handles meterials, different types of lighting, and post processing. I know that Unreal4 uses differred shading, but how does it handle things like translucency, reflections, etc. I do not have access to the source code, that's why I asked this question here. You could even direct me to the source of the rendering part if available.

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:
Using an object as a model to avoid too many parameters - XNA/C# I have 3 classes(Skill,Projectile and Status),Skill has Projectile and Projectile has Status, all of them need to read information from a txt and to avoid open it everytime I want to create an object I want to read all the txt on Skill and pass the information Projectile need as arguments and then on Projectile create Status passing the information needed as arguments too

As Projectile going to create a lot of Status objects it need to receive Projectile's informations and Status's informations from Skill, to avoid too many parameters can I create a Status object on Skill and pass it to Projectile and everytime I need to create another status I use the first one as a model?

As example:

 public class Skill
{
  String skillName,projectileName,statusName;
  int    skillNumber,projectileNumber,statusNumber;
  public Skill(){
      //Code to read txt and fill variables

      //What is happening
      Projectile projec = new Projectile(projectileName,statusName,projectileNumber,statusNumber);

      //To avoid above
      Status status = new Status(statusName,statusNumber);
      Projectile projec = new Projectile(projectileName,projectileNumber,status);

  }
}

And then at Projectile

public class Projectile
{
  //Constructor,variables and methods

  //Method that create Status
   public void Update(){
         if(hitEntity){
          //this status was received from Skills
          Status tempStatus = new Status(status.statusName,status.statusNumber);
          }
   }
}

sentences:
UV Texture coordinates out of [0,1] (WebGL) I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format.
I recently found some models, their texture coordinates of which are out of the typical [0,1] range and i really don't know how to handle them (in code).

I know of course this is a known issue, texture coordinates can be outside of [0,1] and the solution is to use GL_REPEAT wrap mode.

But this is no solution to me since i have a lot of non-powered-by-2 textures and i need to use CLAMP_TO_EDGE wrap mode (the solution to non-pow-2 textures).

I tried to bypass this issue by coding, so to convert [0-,1+] ranges into [0,1] but with not much of success (although somewhat). Here's what i did:
I looped "vt" entries (from my parser) and the cases i'm checking are these (pseudo):

U,V = texture coordinates as they come from file

if (U<0) {
   U = U + Math.abs( Math.floor(U) );
}
if (U>1) {
   U = U - Math.floor(U);
}
if (V>=0) {
   V = Math.ceil(V) - V;
}
if (V<0) {
   V = Math.abs( Math.floor(V) - V );
}

The above fragment will take a U,V of unknown range and will convert it into [0,1], taking also care the WebGL texture coordination system (0,0 buttom-left for WebGL but 0,1 for Wavefront, the 3rd case above)

The numbers are calculated correctly but the result is not the expected and i'm afraid there is a misunderstanding by my side on how the GL_REPEAT mode works.

So my question(s)

Can this be solved by code, so i can use CLAMP_TO_EDGE?
In case there's no way, is there any program than can take a model of REPEAT-ed coordinates and produce one in [0,1] range? I'm already using Blender but could not find a setting for this in exporter.

sentences:
What are standard methods for organizing game code? Grouping by standard "kinds" of methods? I've made a few games, and am getting faster and better organized each time. I'm well out of the "just make it work" phase and working on methodology and readability. I need some tips on code organization though.

I don't mean patterns - I'm having great success with MVC - but the organization of methods inside the classes themselves. I've noticed that methods in my state models can usually be grouped into four categories: (1)constructor/destructor, (2)data access (3)actions (4)events.

My controllers usually have c/d and input methods. My views usually have c/d, view updaters, and event listeners.

I feel like I'm reinventing the wheel though; someone must have spelled out "these are the common types of methods" somewhere before, right? Storage has Create, Read, Update and Delete (CRUD), so what are the equivalents for objects?

EDIT:
Found some cocoa-specific advice here:
http://www.mactech.com/articles/mactech/Vol.21/21.07/StyleForCocoa/

and some generic advice here:
https://stackoverflow.com/questions/73045/whats-the-best-way-to-organize-code/73081#73081

I'm going to use that as a foundation, modified for game-specific stuff. More info still appreciated if you have any.

sentences:
How to Make Snaky Inchworm Motion With Armature Staying Upright I have a series of connected bones in a straight line. I want to be able to rotate each bone vertically and/or horizontally so that it can slither and arch randomly kinda like a snake mixed with an inchworm. When I do this, however, the axes get entirely botched. If I rotate one bone horizontally (i.e. on Y), then vertically (i.e. on X), then back horizontally the the other way, the bone is now rotated on the third axis (i.e. Z). This is further compounded when all the bones are trying to do the same thing. How can I keep these pieces "upright" while doing all these random rotations?

Edit:
I think it comes down to this concept. If transform.right = (0.9, 0.2, -0.4) and transform.forward is (-0.3, -0.2, -0.9), how do I calculate how much I should rotate about transform.forward to make transform.right = (x, 0, z) from (0.9, 0.2, -0.4)?

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:
Using collision.contacts to determine if on a floor I'm trying to make my own first-person character (because I get lost in the sea that is Unity's FP character script), and am trying to make it so it detects when it is standing on a floor. I tried using a playerController, but I've found rigidbody is just more malleable.

Anyways, so I think how you'd do it is finding the direction of the contact, and if it isn't straight down, then to keep onGround as false. I'm just not entirely sure the scripting behind this, and several searches have turned up nothing.

Several offered using mutliple colliders, but I would prefer to keep the number of objects, colliders or otherwise, at a minimum, considering there will be a large number of them in the scene as is. I also want something that's easily manipulable so that I can add extra features like climbing up a wall or the like, and I think that measuring the angle to the center is about as simple and easily manipulated as it gets.

sentences:
Programmatically change combination of sprites I am a total newby to unity and cannot figure out how to achieve the following:

I want to show a picture composed of different sprites. E.g., a pen with four binary features: the pencolor (black or silver), the penshape (ballpen or normalpen), an ornament (blue or orange), and the tintcolor (blue or black).

My goal:

A function taking a numerical vector as input to specify which of the features/attributes of the pen to show.

0,0,0,0 = a black ballpen with blue ornaments and blue
tint.
1,1,1,1 = a  a silver normal pen with orange
ornaments and black tint.
... and all combinations in between.

One constraint: I need to be able to change how many features there are, and how many values they take.

The sprites are stored in a sprite with mode "multiple" and I use unity to create the layers.

What I did so far:

1) Define an object holding the feature sprites

To enable changing how many features and feature values there are I created a structure. It has flexible length specifying the number of features. Each feature is sprite array specifying the number and source of the featuer values.

// New object class holding all visual feature sprites in hierarchical vectors
[Serializable]
public struct Feature
{
    public string Name;
    public Sprite[] FeatureValues;
}

public Feature[] Features;

This allows me to specify how many features, how many different sprites per feature, and to drag and drop the respective sprites onto the associated elements of the Features structure.

2) Defined a Prefab for the Pen

With the help of this post on displaying multiple sprites I created a prefab with as many layers as there are features of the pen

3. And now ... ?

Based on the first comment I created Sprite Renderers for all sub-elements of the Pen object.

The Pen object is a prefab.

Can anyone help me how to change the values of the sprite?

I am trying this: Based on the link mentioned above I create a new class for Pen objects with some sprite renderers

public class Pen : MonoBehaviour {

public SpriteRenderer Tintcolor;
public SpriteRenderer Casecolor;
public SpriteRenderer Ringcolor;
public SpriteRenderer Shape;

public void setTintcolor (Sprite featureImage)
{
    Tintcolor.sprite = featureImage;
}
public void setCasecolor (Sprite featureImage)
{
    Casecolor.sprite = featureImage;
}
public void setRingcolor (Sprite featureImage)
{
    Ringcolor.sprite = featureImage;
}
public void setShape (Sprite featureImage)
{
    Shape.sprite = featureImage;
}

}

Then I write a function to change the value of the sprite renderer.

// featureCombination is the vector holding the feature values to be displayed
public void ShowFeatureCombination(int[] featureCombination)
{
    Pen newPen = Instantiate(penPrefab) as Pen; // new Pen object

    newPen.setTintcolor(Features[0].FeatureValues[featureCombination[0]]);
    newPen.setCasecolor(Features[1].FeatureValues[featureCombination[1]]);
    newPen.setRingcolor(Features[2].FeatureValues[featureCombination[2]]);
    newPen.setShape    (Features[3].FeatureValues[featureCombination[3]]);
}

This does not work so far.

And it requires to manually specify the spriteRenderers, which i need to have automatically done based on the number of different features that I enter in the Feature structure.

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:
What is a fragment in 3D graphics programming? What is a fragment in a fragment shader? Wikipedia says that:

  In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment survives to become a pixel (depth, alpha, stencil, scissor, window ID, etc.)

So is it textures, vertices or something else?

sentences:
How can I tell what a rectangle intersects with? I understand XNA's Rectangle class is rather limited, but surely there is a way to tell what a Rectangle is intersecting with?

If I had Rectangle boundingBox = new Rectangle(stuff here); how would I retrieve what is currently (if there is anything) intersecting boundingBox? Is there any easy method to detect if anything is intersecting it instead of testing with two individual rectangles with boundingBox.intersects()? Similarly, if this is possible, how would I retrieve what rectangle it is colliding with?

If there isn't any easy way of doing it, how would you go about implementing this if you had loads of possible rectangles you want to hit-test?

sentences:
How to program destructibles? I'm thinking about programming a 2d simulation of a spaceship that takes damage depending on where the projectile came from (e.g. from behind - engine, from the front - lasers, sides - hull, etc.). When a given part is below a certain durability factor it explodes into physics simulated particles. What is a good way of storing such particles (ship built out of parts, parts built out of particles, e.g. 6px triangles) taking into consideration the following:

different parts have different shapes,
it might be needed to add more parts in the future,
possibility of avoiding a pixel-perfect projectile-to-part collision detection,
the spaceship should be affected by physics but particles shouldn't unless exploding.

sentences:
Texture coordinates projection I have some classic texture coordinates and as a normal behaviour they follow the mesh's transformations.

I am trying to use the same texture coordinates behaviour but without being affected by the mesh rotation transformation. The results would be a sort of texture coordinates projection.

I don't know if my explanations are well explained but how could I achieve such effect.

Thanks a lot.

sentences:
Difference between unity scripting backend IL2CPP and Mono2x IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following platforms:

Android AppleTV, iOS*, Nintendo 3DS, Nintendo Switch, Playstation 4
Playstation Vita, WebGL* ,Windows Store, Xbox One

I have a project(unity 5.2) which has switched for Android deployment. I tried to switch my scripting backed from Mono2x to IL2CPP and its showing me that

  IL2CPP on Andriod is experimental and unsupported

So, my simple question is that if it is still not supported then why the option has included, what is the fundamental difference between IL2CPP and Mono2x. Why I switched to IL2CPP scripting backend ? what are its pros and cons?

I have also checked in unity 5.5.2 there is not IL2CPP option in windows platform deployment.

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:
OpenGL - How come drawing sprites takes so much performance I'm wondering how drawing simple geometry with textures can eat up so much performance (below 60fps)? Even my good graphics card (GTX 960) can "only" draw up to 1000 sprites smoothly. The textures I'm using are all power of 2 textures and don't exceed a size of 512x512. I'm even filtering with GL_NEAREST only.
The sprites themself are random generated in size. So there are no 1000 fullscreen quads, which would be no real use case.

I'm drawing my sprites batched, meaning I have one dynamic vertex buffer and a static index buffer. I update the vertex buffer every frame with glBufferSubData once and then draw everything with ``glDrawElements`. I have about 5 different textures which I bind once per frame resulting in 5 draw calls. For rendering I'm using only one shader which is bound once the application starts.
So I have 5 texture bindings, 5 draw calls, and one vertex buffer update per frame which is not really that much.

Here is an example with one texture:

val shaderProgram = ShaderProgram("assets/default.vert", "assets/default.frag")
val texture = Texture("assets/logo.png")
val sprite = BufferSprite(texture)
val batch = BufferSpriteBatch()

val projView = Matrix4f().identity().ortho2D(0f, 640f, 0f, 480f)

fun setup() {
    glEnable(GL_TEXTURE)
    //glColorMask(true, true, true, true)
    //glDepthMask(false)

    glUseProgram(shaderProgram.program)
    texture.bind()

    batch.begin()
        for(i in 1..1000)
            batch.draw(sprite)
    batch.update()
}

fun render() {
    glClear(GL_COLOR_BUFFER_BIT)

    stackPush().use { stack ->
        val mat = stack.mallocFloat(16)
        projView.get(mat)
        val loc = glGetUniformLocation(shaderProgram.program, "u_projView")
        glUniformMatrix4fv(loc, false, mat)

        batch.flush()
    }

}

The batch.draw() method puts the sprites vertex data in a cpu side buffer and batch.update() uploads everything to the gpu with glBufferSubData.
And setting up the spritebatch looks as follows:

glBindBuffer(GL_ARRAY_BUFFER, tmpVbo)
            glBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW)
            glEnableVertexAttribArray(0)
            glEnableVertexAttribArray(1)
            glEnableVertexAttribArray(2)
            glVertexAttribPointer(0, 2, GL_FLOAT, false, 24 * sizeof(Float), 0)
            glVertexAttribPointer(1, 4, GL_FLOAT, false, 24 * sizeof(Float), 2.toLong() * sizeof(Float))
            glVertexAttribPointer(2, 2, GL_FLOAT, false, 24 * sizeof(Float), 6.toLong() * sizeof(Float))

            glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tmpEbo)
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW)

I was profiling my program first, but updating the vertex buffers and all the geometry takes about 10% of the total time per frame. But swapping the buffers takes up the rest of the 90% frame time.

So I'm asking, how can such big AAA games render their scenes with millions of vertices, if drawing pixels is such a time consuming task? I know that their is a lot of optimizations in the code, but still.

sentences:
How to measure packet latency? In the context of lag compensation, one needs to know when the command is instantiated on the client (this can be named as "command execution time" as well). AFAIK, there can be 2 methods for this:

Client sends a timestamp with the command.
Client doesn't send any timestamps, but server does a smart thing to calculate the command's instantiation time.

About #1:

Is this safe in terms of cheating?

About #2:

According to Valve's paper, command execution time is as following:

  Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

This means, server must know the packet latency.

Another paper from Valve confirms this and says:

  Before executing a player's current user command, the server:

  Computes a fairly accurate latency for the player
  ...

How can the server compute "fairly accurate latency for the player"?

Most naive and easiest approach would be sending pings regularly (less frequent than game commands and updates though) to find out an average of the latency and use it. Busy network traffic, latency fluctuation and naiveness of this method makes me feel there must be a more elegant way.

EDIT: Would UDP vs TCP change anything in this context?

sentences:
hexagon tiles to square tiled map in a previous question asked here:how-to-create-a-hexagon-world-map @Tim Holt has provided code that does the job that i'm wanted to do, the only difference I would like is to have it as squares rather than hex. Is this easy to convert, or is there a better way?
thank you.

sentences:
Diamond shaped selection on a staggered iso map I have a staggered isometric tile map and want to do a selection that aligns with the diamond shape of the tiles.

This is what I mean:

So I got two points on screen and their map cell coordinates. How do I iterate over all tiles that are within the selection?

What I got to help with this is a method that gets the neighboring tiles.

sentences: How to display a GUI Texture for a certain amount of time Is it possible to make a gui Texture display for a certain amount of Time.

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:
Unity-Help with RaycastHit2D.hit.normal I'm working on a little pong clone and trying to implement collisions using triggers.

I have a ball which OnTriggerEnter sends out a raycast from the ball's position towards its velocity. I then take the .normal of the raycast hit and use that to figure out bounce angle.

most of the time this is working, but in a few cases (I can't quite figure out the common element between them) It doesn't work and gives a completely wrong number.

Video example, https://webmshare.com/xAe7X

Full code,

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

public class BallScript : MonoBehaviour {
    public Vector2 velocity;
    public float angularVelocity;
    private Vector2 collisionNormal;

    void FixedUpdate(){
        transform.Translate (velocity.x, velocity.y, 0);
        Debug.DrawRay ((Vector2)transform.position - velocity * 2, velocity * 5,Color.red);
    }

    void OnTriggerEnter2D(Collider2D other) {
        FindCollisionNormal ();
        ReflectVelocity ();
    }

    public void FindCollisionNormal(){
        RaycastHit2D[] hits = Physics2D.RaycastAll ( (Vector2)transform.position - velocity * 2, velocity * 5);
        foreach (RaycastHit2D hit in hits) {
            if (hit.collider.GetType () == typeof(BoxCollider2D)) {
                collisionNormal = hit.normal;
                collisionNormal = new Vector2 (collisionNormal.y, collisionNormal.x);
            }
        }
    }

    public void ReflectVelocity(){
        print (collisionNormal);
        velocity = -velocity + 2 * (Vector2.Dot (velocity, collisionNormal) * collisionNormal);
    }
}

sentences:
Attach the UIButton to Component Via Script (C# Unity) I want to attach the UI to the MC_Streaming Option Script via Code .

What i wanted here is that this live_onOff will go to the Livestream(MC_Streaming Option) without dragging it . And i don't know where to start.

PS: The MC_Streaming Option script is being attached only when the program run

MC_StreamingOption mcStreamingOption = gameObject.AddComponent<MC_StreamingOption>();

sentences:
Breakout Collision: Detecting the side of collision I am writing a breakout clone (my first game) and am totally stuck as to how I figure out which side of the brick was hit.

I have a collision detection method that looks like this:

DetectCollision(Object a, Object b)

   x = distance(a.x, b.x);
   y = distance(a.y, b.y);

   if (x is smaller than the combined width &  y is smaller is than combined height {
       return true;
   }
return false;

This works totally fine, but I need to know the side of the collision, and location relative to the center in order to respond properly.

I've spent the past few days snooping around but am lost.

sentences:
How can I detect that the mouse is over a button so that I can display some UI text? I have a scene, where a panel containing 24 buttons. I need to show some piece of text when hover a mouse cursor over the button. For example, for detecting clicks, I'm using onClick event trigger, but I can't find anything related to something like a onHover event. I have Googled and read the docs, but could not find anything. Can anybody help me with that?

Code:

var button = panel.GetChild(0).GetComponent<Button>();

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:
XNA - Am I screwing up the LoadContent for Texture2D? I've read forum threads and questions and I done just about everything. I need to know what am I  screwing up here.

Here's the code in the constructor.

Content.RootDirectory = "GameStateContent";
//Content.RootDirectory = "Content";

And this is in the LoadContent method

 menu = this.Content.Load<Texture2D>("mainmenu");

And here's the image screen shot of the folder structure.
http://i.stack.imgur.com/HnndE.png

Any helps on this?

Thanks.

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:
What file types should I exclude from my game's source control repository? I have started working on a personal project using Unity with a friend and we've set up our own source control system.

I am aware of the fact that there are many types of files, namely those that are generated locally when you build (for example, Visual Studio files) and those that are specific to your particular machine that should not be added to source control, but I'm not exactly sure what these file types are.

I don't want to exclude any generated files I should be including, such as .meta files.

Would someone be able to list all, or at least all of the common file types that should not be added to version control, specifically for a Unity project?

sentences:
iOS with cocos2d to MVC or not to MVC? I am working with cocos2d.

All my objects are declared on the CCLayer that I'm using, I have the logic of the game there and all the CCSprites.

Should I put the CCSprite for the player and all it's related properties (HP, Velocity, etc) in a Player object and then have that player object in my CCLayer?

But then how to add the CCSprite of the player to the CCLayer? Should I put in the CCLayer this?:

[self addChild:[PlayerObject playerSprite]];

Or should I create a controller?

sentences: Can I do iPhone game dev on iPod touch? I do not want a mobile phone, but are there any issues I'd run into by developing games on an iPod for iPhone?

sentences:
How can I add holes to a sprite? I'd like to find a way to add holes caused by a 'bomb' to my floor sprite, a bit like what is in this game here.

Basically there is a sprite (the green floor) and another sprite (the bomb) that falls on top of the green floor and the bomb then explodes. Once exploded part of the green floor sprite is gone. The player (red ball) can then move the sprite inside the new cavity that was created in the green floor sprite.

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:
Increasing mass in ineleastic collision by orders of magnitude resultsin little change in velocity When increasing my rocketMass from 10 to 1000 or to a 1000 or bringing my shipMass down to 1, I notice very little increase in how far the ship's final inertia is. I'm expecting that increasing from 10 to 1000 will be visibly about 100 times faster.. but it's not. If I multiply the hypotenuse at the end, that does make the bouncing incredibly faster.

Am I misunderstanding physics or is this a calculation error?

handleCollision(r) {
    var angle = r.r * Math.PI / 180.0;
    var rr = this.r * Math.PI / 180;

    var rocketVector = {'x' : r.power * Math.cos(angle), 'y' : r.power * Math.sin(angle)};
    var inertiaVector = {'x' : this.magnitude * Math.cos(rr), 'y' : this.magnitude * Math.sin(rr)};

    var rMass = 100;
    var shipMass = 1;

    var x = (rMass * rocketVector.x) + (shipMass * inertiaVector.x);
    var y = (rMass * rocketVector.y) + (shipMass * inertiaVector.y);
    var xDividedByMass = x / (rMass + shipMass);
    var yDividedByMass = y / (rMass + shipMass);

    var yRadians = (yDividedByMass * Math.PI / 180);
    var xRadians = (xDividedByMass * Math.PI / 180);
    var theta = Math.atan( yRadians / xRadians);

    theta = theta * 180 / Math.PI;
    console.log(theta);

    var hypotenuse = Math.sqrt((xDividedByMass * xDividedByMass) + (yDividedByMass * yDividedByMass));

    if (x < 0) {
        theta -= 180;
    }

    this.r = theta;
    if (this.r < 0) {
        this.r += 360;
    } else if (this.r > 360) {
        this.r -= 360;
    }
}

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:
Basic Character Controller Not Working Properly in Unity I've been trying to setup a simple mouse camera which I had all the code working fine, except when I move with wasd and move my mouse to turn the camera simultaneously the input freezes up and gets stuck repeatedly inputting whatever the last input was. I've tested the simplest way to replicate the issue and it doesn't even need a camera for the issue to come up. If anyone would like to test and try to replicate the issue these are the steps its super fast and simple.

create new project(basic PC 3D project)

create a plane, and a cube

Add a basic character controller script to the cube (this time I used the official Unity code to be sure it's not an issue with code)

and that's it, that's actually all that was needed to create the issue for me. And to explain to anyone who may want to test it the issue is as follows: when you use wasd keys normally, everything works fine and the controls are responsive. However if you hold down one of the wasd keys while also moving your mouse (just wiggling the mouse should suffice) suddenly things will lock up and the cube will keep moving for a bit even after you let go of the respective wasd keys. In general if you hold a direction while simultaneously wiggling the mouse for a longer period of time, it will extend the amount of time the cube keeps moving after you let go of the direction. And this was done on Unity version 2020.1.16f1
If anyone has any idea what the issue may be its really appreciated.

sentences:
Voxel river flow simulation I am making a Voxel game and I'd like to add rivers that can be redirected. So I thought that if a player replaces a river block or digs up a block next to a river block the river would repath itself to the sea. The rivers path would have a direction and a speed in that direction.

The rivers path would be determined by these rules:
If the river can go down in its direction it will and then pick up speed.
or if it has a speed under 2 and it can go sideways and down it will and keep its direction. Otherwise it will keep going in its direction until blocked, where it will pick a new direction. If the river can't go anywhere it will fill up the layer its on like a bathtub and go up.
Repeat until it reaches the ocean.

However I can't figure out how you can know what to fill. The data would be stored in some sort of height map. 1 = same level, 0 = down a level, 2 = up a level

For example:

222222
211112
211112
211112
211112
222222

I can tell that the 2s completely surround the 1s meaning that all the 1s should get filled with water if the river goes up. But how can a computer tell?

sentences:
Where is better to do shaders, vfx, uv-mapping and coloring? Well i understand that 3DS-Max is mainly for modeling and Unity is mainly for programming and logic, but where is it better to do shaders, vfx, uv-mapping/painting and coloring?

for example i worked a little bit in Blender and it has modifiers, but also Unity has materials and similar stuff.

What let's say "imade a model in 3ds max, now where should i do the art and texturing, should i continue with 3ds or should i do it in blender? OR it doesn't matter where?"

sentences:
How to create walls and rooms with Pixi I'm a JS dev but pretty new to Pixi and 2D developemnt so please bear with me as I explain this.

I want to write a simulator for short path finding (for evacuation purposes). I decided to use Pixi.js for this since it seems capable of doing everything I need to do. I followed this tutorial to try to learn how Pixi works and if its right for this.

The tutorial didn't seem to answer many questions I have and I still have some confusion. Before I dive into writing the code, I want to know how wall detection in Pixi acheived.

Take the below map for example:
It is a 800 x 800 png file (where everything but the blue is transparent[no grid lines]) that i can load into Pixi as a Sprite. I created it in Tiled editor. So it can be exported as a tilemap, JSON, CSV etc. When I export it as JSON, here is the file contents: https://pastebin.com/zGh1XmR7

The blue boxes represent walls.
I want to load in other various sprite objects so that it will look like this:

The people in the simulations cannot cross the blue walls and they cannot cross the pink circles (they represent danger zones). I intend to use easystar.js to find the shortest path to exits for the people sprites in the map.

So my question is this, how does Pixi recognise the blue walls? Is it something I have to do when creating the tileset png? Like something defined in the JSON file for the tileset atlas? Maybe SVG? Or is there a pixi function to do this?
Is this the best approach to doing this and is Pixi even the best way to do this?

I'm looking for a tried and tested solution or a pointer in the right direction.

sentences:
Can't interact with anything in UI canvas, although it was working previously I'm working on a menu with several buttons and input fields. For a while everything was working fine, but suddenly every button and input field is not reacting to being clicked on, as if everything's been disabled.

This problem is only occurring in one of my scenes. My canvas has a graphic raycaster and my buttons have methods attached to them.

sentences:
Nothing drawn in Window, not even the clear color A few years ago I have followed RasterTek's Direct3D11 tutorials to create a simple application in C++. I'm not trying to convert this very simple sample to C# using SharpDX.

I've got the Window (which I create natively, exactly as in the tutorial) and message loop all set-up. Everything seems to be working. If I make the window's background gray I even see it being gray for a split second, before DirectX takes ownership of it and makes the Window contents black.

So it seems I've done something right, but not everything. Nothing is rendered to the window, not even the clear color. I've compared my code multiple times to my own C++ implementation (which works) and the tutorial's code, but there seems to be a bug in my implementation. Its probably related to how SharpDx wraps the Direct3D library. Maybe I've missed something?

Below are (what I believe to be) the bare essentials. Anyone spot the error? (Or alternatively anyone who can direct me to a good starters tutorial which covers the nuances of SharpDx?)

    private readonly SwapChain SwapChain; private readonly RenderTargetView RenderTargetView; private readonly Texture2D DepthStencilBuffer;
    private readonly DepthStencilState DepthStencilState; private readonly DepthStencilView DepthStencilView; private readonly RasterizerState RasterState;

    private readonly D3D11.Device Device;private readonly DeviceContext DeviceContext;

    public D3DObject(int screenWidth, int screenHeight, IntPtr hwnd)
    {
        // Set up the swap chain
        var swapChainDescription = new SwapChainDescription()
        {
            BufferCount = 1,
            Flags = SwapChainFlags.None,
            IsWindowed = true,
            ModeDescription = new ModeDescription(screenWidth, screenHeight, new Rational(0, 1), Format.R8G8B8A8_UNorm),
            OutputHandle = hwnd,
            SampleDescription = new SampleDescription(1, 0),
            SwapEffect = SwapEffect.Discard,
            Usage = Usage.RenderTargetOutput,
        };

        D3D11.Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, swapChainDescription, out this.Device, out this.SwapChain);
        this.DeviceContext = new DeviceContext(this.Device);

        // Get the backbuffer from the swap chain
        var backBuffer = this.SwapChain.GetBackBuffer<D3D11.Resource>(0);

        // Create a view of this backbuffer
        this.RenderTargetView = new RenderTargetView(this.Device, backBuffer);

        // Set the render target on the window
        this.DeviceContext.OutputMerger.SetRenderTargets(this.RenderTargetView);

        // Set-up the rasterizer
        var rasterizerStateDescription = new RasterizerStateDescription()
        {
            CullMode = CullMode.Back,
            DepthBias = 0,
            DepthBiasClamp = 0.0f,
            FillMode = FillMode.Solid,
            IsAntialiasedLineEnabled = false,
            IsDepthClipEnabled = true,
            IsFrontCounterClockwise = false,
            IsMultisampleEnabled = false,
            IsScissorEnabled = false,
            SlopeScaledDepthBias = 0.0f
        };

        this.RasterState = new RasterizerState(this.Device, rasterizerStateDescription);

        this.DeviceContext.Rasterizer.State = this.RasterState;
        this.DeviceContext.Rasterizer.SetViewport(0, 0, screenWidth, screenHeight);
    }

    // Called at the start of rendering
    public void BeginScene(Color4 color) // Color is CornFlowerBlue: {Alpha:1 Red:0,3921569 Green:0,5843138 Blue:0,9294118}
    {
        this.DeviceContext.ClearRenderTargetView(this.RenderTargetView, color);
    }

    // Note: nothing is rendered in between

    // Called at the end of rendering
    public void EndScene()
    {
        this.SwapChain.Present(0, PresentFlags.None);
    }

Note: I create the device with the DebugFlag, but I also see no debug overlay.

sentences:
Error compiling Unity after porting to mac I used BitBucket to move my project from a PC to a Mac, now I can't compile in my Mac, as I get the following error:

Error building Player: Win32Exception: ApplicationName='/Users/josephtripp/Library/Android/sdk/tools/aapt', CommandLine='package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/josephtripp/Library/Android/sdk/platforms/android-22/android.jar" -F bin/resources.ap_ --extra-packages com.everyplay.Everyplay:com.unity3d.ads.android -S "/Users/josephtripp/sens-rebooted/Temp/StagingArea/android-libraries/everyplay/res" -S "/Users/josephtripp/sens-rebooted/Temp/StagingArea/android-libraries/unityads/res"', CurrentDirectory='Temp/StagingArea'

Any help would be of great use.

sentences:
Default with SDL_RendererFlip Horizontal (SDL, C ++) When I execute my sprite sheet animation and apply renderer_flip_horizontal, a line appears in the sprite.

Without the flip render, everything works fine.

Example image:

Note: The sprites are correctly aligned. The flip is by sprite (not to the full sheet).
I also use SDL_Renderer SetLogicalSize(256, 224), and the size of the window is 800 x 600.

Could you explain why this happens?

Thanks in advance.

sentences:
What language or platform is used to develop apps for Google+? Does anyone know what language or platform is used to develop apps for Google+?

I'm hoping Python, but I know google has a lot of other mediums they could use for this. I'm fine with hearsay as I know the game portion of google+ is pretty new.

sentences:
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:
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:
How to calculate the inverse of a 4*4 opengl transform matrix I am transforming my camera like any other object. I would like to set the view model matrix to the inverse of this so that I can draw the rest of the objects relative to the camera.

How do i calculate the inverse transformation?

I construct this matrix from a quaternion and a position vector, if it is easier to find the inverse of these then feel free to post.

sentences: Triangle Texture Packing Problem I'm trying to create a texture atlas where each triangle face is laid separately from each other (i.e. it is not typical mesh parameterization). In order to do this, I would have to pack the triangles into a 2D texture image. Can someone suggest a good algorithm to do this efficiently, both timely and spatially?

sentences:
Percentage of object inside a moving rect The idea is that I want to get a percentage of the position of Rect2 in relation to Rect1. In the picture, it would be about 75/80%. Rect2 never leaves Rect1. I move Rect1 around all the time, so it should work regardless of Rect1's position.

I had something like this, but it didn't work as intended:
((Rect2.X + Rect1.X) / (Rect1.Width + Rect1.X)) * 100

Rect1.X would work as an offset so the calculation would "ignore" the moving around of Rect1. Or that was the idea...

sentences:
How do I add custom data to a ListView widget in Unreal? I have a UserWidget object with a ListView in it.
How do I add objects add and custom data to them, such as names?

sentences: Want to create live-voice chat between players either in unity or unreal engine I would like to create a real-time voice chat in either in unreal or unity between the players.I would like to associate and apply this voice-chat depend on username. I am saying "or" for the application because I want it to create in easiest(less programming) way. Do you know what class or script I should use? I have a limited budget so I am looking for a in-house or cheap way solution of building it.What would be the easiest way of starting this project?

sentences:
Can sampling an input texture in shader return values updated in same pass? In my hlsl, (I am using Direct2D helpers which I guess just call tex2D), can D2DSampleInputAtOffset() return a pixel value that was only updated in that same pass of the shader? Or will it always return the value the sample had before the shader has processed any pixel? e.g.:

#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_COMPLEX
#include "d2d1effecthelpers.hlsli"

D2D_PS_ENTRY(main)
{
    float4 color = D2DGetInput(0);

    float4 above = D2DSampleInputAtOffset(0, float2(0, -1));
    // will above be the value in the sample before drawing with this shader?
}

Further is there a specific sequence in which pixels are processed by my shader, e.g. left to right, top to bottom?

sentences:
XNA draw 3d graphics in 2d game I am programming a simple pool game in XNA. I am using Farseer for simple 2d physics but I want to use 3d graphics. My problem is I can't get the rendering to work.

I have one model for the ball and one for the table, both exported from Cinema 4D into .fbx. I am able to load them and even display them, but not on the correct position. Farseer is using standart coordinate system (X+ to the right, Y+ down) and I need to somehow convert the position from farseer and display the models on the right place on the screen and with the correct size (this should be easy to achieve using scale matrix).

I need help finding what my projection, view, and world matrices I should use?

sentences: Get Tile Location On Screen (Java Slick and Tiled2D) I want to create a rectangle around each tile that's blocked value = true. How can I find the X and Y (on screen) coords of the each individual Tile?

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:
Object of arrays or array of objects? I'm making a management sim game, something along the lines of Roller Coaster Tycoon. I want to know what the best way to structure my world objects is so to maximise performance.

Let's say I have 5,000 people in my game I could:

Make an object and store them in an array like so;

class person() {
    this.x = 0;
    this.y = 0;
    this.thirst = 15;
    this.hunger = 15;
    // etc.. add methods:
    public findPath(int destX, int destY) {
    // and so on
    }

    people = new person[5000];

for (int = 0; i < 5000; i++) {
    people[i] = new person;
    }

Or should I make an object of people that contains many byte arrays representing attributes of people like so:

class people() {
    this.hunger = new byte[5000]
    this.thirst = new byte[5000]

    getThirst(int i) {
        return this.thirst[i]
        }

 // and so on....

Or am I totally off the mark?

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:
How does one go about building Alien Swarm? Valve just released Alien Swarm on steam, along with all the source code. I would love to build a version of it on my own machine and play a little bit with the code.

Has anyone here tried to build it yet? Is it easy enough to just build and run it?

Thanks.

sentences:
iOS Facebook SDK, Games Start Playing post im trying to implement a method in my native iOS game the publish a story on face book such as this photo

most games that is integrated with facebook share stories like this in the activity section on the timeline

any good example especially for iOS 6

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:
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: Is there a way to make a game using lwjgl work on android? I'm working on a platformer and I'd like to make an android version. Do I need to rewrite everything for android, or can I use something to make the lwjgl code work with android?

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:
Chess Artificial intelligence with python and pygame I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links?
Thanks

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:
Game Architecture doubt on variable access Im having a hard time figuring out a solution to a problem that seems it should be easy to answer but since i cant come up with a good solution I bid your knowledge:

In my game i have a state manager which deals with either the game is at the menu state, level1 state, level2 state, etc etc, every different screen condition is a state that is, and in my level state i created a base level class so i can extend the level1, level2, etc levels.

In the base level class, it is where i declare my common level variables, like Player, the Tilemap, the array of enemies (mobs), the CollisionManager etc. (this might be what i am doing wrong...) and i wanna add explosions to the game, which will occur at least when i shoot explosive barrels (and the barrels really arent the problem because since they are created in the beggining of the level, i can just add an array of barrels and set the argument of the barrel to receive the array of explosions pointer so the barrel just adds a new explosion when the time comes) and when explosive bullets hit the wall.

Now my problem is specially the bullets, because explosive bullets are created by the mobs which might use a rocket launcher (including the player) and i dont really think sending the array of explosions to every mob that might shoot explosive bullets is good architecture, so my question is how i solve this problem or even better how i improve my architecture in a whole to avoid problems like these.

P.S. As a side note regarding how the mobs shoot bullets, every mob has a Weapon, which is a class that extends in the several weapons the game might have, from pistols to lasers and flamethrowers, which are all functional and working lovely. This means, though, that if id send the explosions array to the mob that will use rocket launcher, i would then have to send that pointer to the weapon, and from weapon to every bullet that the weapon spawns, so the bullets are the ones adding the explosions to the array when the time comes. This train-like passing of the array is what is bugging me and what i strive for a solution.

P.S.S. Although every advice is very appreciated, answers telling me to use Aggregation of Components Architecture are, at the moment, "ignored" because im trying to correctly use the traditional Hierarchical approach for this game, i might use component architecture in a future game though, it seems pretty neat : )

sentences:
Unity - SerializedObject.ApplyModifiedProperties() using relavant property setting method The problem I have is this.
I have an editor script, at the end of OnInspectorGUI() I want to apply all the changes with the serialized object.
The simplest way to show my problem is thus:

[SerializeField]
private bool _property;
public bool property
{
    get { return _property; }
    set
    {
        _property = value;
        //do some amazing stuff
    }
}

public override void OnInspectorGUI()
{
    serializedObject.Update();
    prop = serializedObject.FindProperty("_property");
    //blah blah blah
    serializedObject.ApplyModifiedProperties();
}

But in order to do my special amazing code represented by the comment 'do some amazing stuff', I have to copy and paste the code or do away with the gets & sets entirely, opting instead for some kind of post-update, all-in-one refresh function.
Ideally, I want to tell SerializedObject, 'Hey, don't do _property = value, do property = value instead!'
Pretty sure that's not possible though, so what should I do instead?

sentences:
GLSL uniform array with size set by another uniform Will the follwing GLSL code work?

#version 330

uniform int size;
uniform float[size];

void main() {
  //do something
}

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:
Is it legal to use Creative Commons art in a commercial game? I would like to know if the following situation would be legal.

Let's say I take some pictures on wikipedia, that are licensed under CC-BY-SA license.
Then I would like to photoshop them, and use it as art in a (perhaps commercial) game.

According to the Creative Commons licence, it is legal to use the content "for any purpose, even commercially".
So I was thinking about creating a web page where I would attribute each picture to the original creator, and publish the photoshoped picture under the same license (even if it would be almost useless for anyone).

Would it be legal?  Or would I need to publish the entire game under creative commons license?

sentences:
How can i get a value from object in tmx file in Cocos2d x 3.x? I want to set my sprite in x coordinate based on an object in TMX map file,
this is my code:

tileMap = cocos2d::TMXTiledMap::create("ground.tmx");
ground = tileMap->layerNamed("ground");
this->addChild(tileMap);

TMXObjectGroup *objects = tileMap->objectGroupNamed("objects");
Dictionary *sign = (Dictionary*)objects->objectNamed("sign");

How can i get a value of object in tmx file in Cocos2d x ?

sentences:
VBO and gl*Pointer management practises? I'm aware it's not a simple yes/no question and for the moment I can't tell if it can be simply answered, or is it a topic for a long discussion which is not suitable for our Q&A format.

I want to do some VBO management in order to reduce calls to GL.

I have 4 VBOs for all meshes:

one for static draws
one for dynamic draws
one for stream draws
one for indices

I want these four to handle my whole scene - this is going to reduce calls to glBindBuffer.

My mesh object consists respectively of static part, dynamic part and stream part, each of the part is specified by vertex specificator that is created at runtime, just by pushing back attribute objects containing size/type/offset to a member vector.

Based on the vertex specificators you can fill the parts with interleaved data, you don't have to do this for all the parts though. As I read here, separating vertex parts with different usage modes is good as it allows you to update all the dynamic/stream data at once without ever touching the static data. For example, doing particle simulation I may not be necessarily interested in streaming texture coordinates - changing vertex positions may be enough.

What's going to happen next:

sort all mesh objects by the vertex specificator of its static part
upload all the meshes' static parts' vertex data in obtained order to the static VBO
sort all mesh objects by the vertex specificator of its dynamic part
upload all the meshes' dynamic parts' vertex data in obtained order to the dynamic VBO

... and so on.

In short, static/dynamic/stream chunks (each in one of the 3 VBO's to which it belongs) with the same vertex types will be next to each other, and this is going to reduce calls to glVertexAttribPointer. Here I will need to smartly organize meshes that may want to use various parts, and then implement kind of lazy binds, probably if mesh needs to call glPointer for two different VBOs (separate static and stream parts for example), check if one of them is not already bound and call corresponding glPointer first.

Of course, each of the big batch obtained that way will then be sorted inside on the level of draw calls to reduce switches of shaders, textures and so on.

In short, this is my idea:

Although such a case may be uncommon, it's just to illustrate what should my mesh organizer be able to deal with.

Well, now it's only a plan and I haven't yet implemented it but..

How do the modern, high performance engines do their VBO and gl*Pointer state management? Is there something wrong with my concept, or am I totally misguided? Google results for VBO management and similiar tend to give me topics where people are asking for help because their programs crash, or just usage examples that tell nothing about optimizing my rendering procedures on VBO level but just "avoid redundant calls to GL", or some actual one-line tips (like glBufferData with NULL). So what I've described above is what I've concluded myself using those informations and I'm not sure if I am even on the right path.

Could somebody show me some good and actually proven practises managing VBOs in big 3D scenes, or maybe guide me a bit if I am actually reasoning right ?

sentences:
What are the responsibilities of a game engine, and which of these things need to especially be efficient? Possible Duplicate:
  What should a game engine do?

What are the usual responsibilities of a game engine, and which of these things especially need to be efficient (performance-wise)?

Can I get a break-down of the purposes that a game engine is used to serve, and how it differs from a game itself? I'm a newb, so some intuitive things may need to be explained.... Thanks! :)

sentences:
HLSL: Pack 4 values into 32 bit float I can't find any useful information on packing 4 values into a 32 bit float in HLSL.

Ideally, what I want to be able to do in HLSL is:

float4 values = ... // Some values where each component is between 0 and 1.
float packedValues = pack32R(values);
float4 values2 = unpack32R(packedValues);

I realize that there will be precision limitations, and performance tradeoffs between different precisions in different methods. I'm just wondering what ideas are out there.

sentences:
Many sources of movement in an entity system I'm fairly new to the idea of entity systems, having read a bunch of stuff (most usefully, this great blog and this answer).

Though I'm having a little trouble understanding how something as simple as being able to manipualate the position of an object by an undefined number of sources.

That is, I have my entity, which has a position component. I then have some event in the game which tells this entity to move a given distance, in a given time.

These events can happen at any time, and will have different values for position and time. The result is that they'd be compounded together.

In a traditional OO solution, I'd have some sort of MoveBy class, that contains the distance/time, and an array of those inside my game object class. Each frame, I'd iterate through all the MoveBy, and apply it to the position. If a MoveBy has reached its finish time, remove it from the array.

With the entity system, I'm a little confused as how I should replicate this sort of behavior.

If there were just one of these at a time, instead of being able to compound them together, it'd be fairly straightforward (I believe) and look something like this:

PositionComponent containing x, y

MoveByComponent containing x, y, time

Entity which has both a PositionComponent and a MoveByComponent

MoveBySystem that looks for an entity with both these components, and adds the value of MoveByComponent to the PositionComponent. When the time is reached, it removes the component from that entity.

I'm a bit confused as to how I'd do the same thing with many move by's.

My initial thoughts are that I would have:

PositionComponent, MoveByComponent the same as above

MoveByCollectionComponent which contains an array of MoveByComponents

MoveByCollectionSystem that looks for an entity with a PositionComponent and a MoveByCollectionComponent, iterating through the MoveByComponents inside it, applying/removing as necessary.

I guess this is a more general problem, of having many of the same component, and wanting a corresponding system to act on each one. My entities contain their components inside a hash of component type -> component, so strictly have only 1 component of a particular type per entity.

Is this the right way to be looking at this?
Should an entity only ever have one component of a given type at all times?

sentences:
How can I send different contoller input to the different player avatars? My apologies in advance for the vague question, since I don't understand the problem well enough to ask in finer detail.

I want to create a multi-player Unity application using the Oculus SDK. Let's say there are two players in the scene, A and B. The problem is this: When player A presses a button using his index finger, the hand avatar for player B also displays a moving index finger. In short, hand movements for one player are also observed for the other. Controller inputs are also read without any ability to distinguish whether they originate from player A or B.

What are the possible approaches for eliminating this problem, if it is mandatory that I continue using Oculus SDK?

sentences:
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:
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:
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 can I programatically determine if I can create a hardware D3D device? I have a D3D 11 application to which I would like to add support for software rendering. This is because in some circumstances it will be run on over remote desktop or on machines without GPUs. From the research I have done, it seems like my best bet is WARP.

It was surprisingly simple to change the app to use WARP:

hr = D3D11CreateDevice(
    NULL,
    D3D_DRIVER_TYPE_WARP, // was D3D_DRIVER_TYPE_HARDWARE
    NULL,
    creationFlag,
    featureLevels,
    ARRAYSIZE(featureLevels),
    D3D11_SDK_VERSION,
    &mDevice,
    &mFeatureLevel,
    &mDeviceContext
    );

It runs nicely. Where I'm struggling is determining when to set the driver type to WARP instead of hardware. Is there a function I can call that will tell me if hardware support is available on the system?

I'm using D3D 11 with the 9_1 feature level.

sentences:
Which unit test framework for c++ based games? Which combination of testing tools do you feel is best?
Given the framework / library of your choice you might consider:

suitability for TDD
ease of use / productivity
dealing with mock objects
setup with continuous integration
error reporting

Note: While this is potentially a generic question like the one on SO I would argue that game development is usually bound to a specific work flow which influences the choice for testing. For a higher-level perspective, see question Automated testing of games.

sentences:
Why is my Texture becoming slower when it approaches it's destination? I have a texture drawn on screen. Whenever I click on the viewport it remembers its destination and starts moving towards it, until it is there. This is the code I am using therefore:

//Check if destination was reached
if ((currentDestination - position).Length() <= movementSpeed)
{
     // Stop moving
     position = currentDestination;
     playerState = PlayerState.Idle;
     reachedDestination = true;
}

// If destination is not reached
if(!reachedDestination)
{
    Vector2 direction = (currentDestination - position); // gives the direction needed to travel from position to target
    angle = (float)(Math.Atan2(direction.Y, direction.X) + MathHelper.PiOver2);

    direction.Normalize(); // we need it as a unit vector

    position += direction * movementSpeed;
    // The Y coordinate stays the same in this case
    position.Y = 455;
}

It does work, but the closer the texture is to the destination, the slower it gets. Why is that?

sentences:
Is Godot's NavMesh viable for dynamic pathfinding (e.g. avoiding moving enemies)? I am a novice (read: low-budget) designer looking at moving from Pygame to a real engine, and between Unity and Godot it looks like the latter has a much better 2D engine [1, 2, 3]. I would be happy to support Godot's open-source model except that, as far as I can tell, its built-in navigation mesh is purely static--i.e. it can't update its path to account for dynamic obstacles [4, 5]--while Unity's pathfinding system can [6].

So my question is: Am I "stuck" with Unity? Or is there functionality that I haven't yet been able to find? Or, alternatively, is GDScript significantly faster than Python such that basic algorithms like fixed-grid A* would do the job?

Edit: By "stuck" with Unity I don't mean that it's a bad option or that there aren't good options; I mean, 'if I need good pathfinding, do I have to give up on Godot and use what would otherwise be a second-choice engine?'

sentences:
How do I get my polygons to be lighted by either side? Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene.

The problem that I am having is that when I make a light and have my SR(screenrenderable) near it, it does not light up unless the face of the SR is facing the light...

I am wondering if there is a way to maybe set the material or code(which would be harder) so the SR is lit up whether the vertices of the polygon are facing the light or not. I feel it is possible but the main obstacle is how I would go about doing this.

sentences:
I'm making a board game: who should manage the player move if the board has specific locations for the players? I know this is very specific question but imagine I have a board with spaces (like Monopoly) and a player that must go from one space to another after the dice are thrown.

So my workflow:

Player roll dice
After the player rolled dice

(from player class) space = board.getNextSpaceFromPlayer(player)
Move the player each step until it reach the destination

board.movePlayerToNextSpace(player);
OR
player.moveToSpace(space);

But how exactly do I move the player?

The board must move the player or the player move itself?

I'm trying hard to reflect how the things are in the real world but I find very hard to do so in this context.

Thanks for your help.

sentences:
How can I provide a mechanism for users to increase the gameplay speed? I am developing a tower-defense game and I want to permit user to change game engine speed ,for example rotation speed of towers,rockets speed ,enemies moving speed ,counters and etc proportionally.
Is it any way to increase/decrease speed of game engine or any other way similar to it?

sentences: XNA Silverlight 5 3D Model Position I am use to XNA and starting to learn XNA for Silverlight 5. My Question is that in XNA when you create a Model and load it using content.load you are able to access the models Position, scale etc.. In Silverlight XNA these options are not available. It would be possible  to change the Models position using World Translate, but I need the models position for collision detectection using boundingSphere Any Advice??

sentences:
Maximum range of projectile fired at given force and elevation I've gone over this again and again, and my result is obviously wrong when viewed in-action. Here's the initial formula I converted (first one):

http://en.wikipedia.org/wiki/Range_of_a_projectile

and here's my C# code:

float CalculateMaximumRange() {
    float g = Physics.gravity.y;
    float y = origin.position.y;
    float v = projectileSpeed;
    float a = 45;

    float vSin = v * Mathf.Sin(a);
    float vCos = v * Mathf.Cos(a);

    float sqrt = Mathf.Sqrt(vSin * vSin + 2 * g * y);

    return Mathf.Abs((vCos / g) * (vSin + sqrt));
}

Does anyone see what I did wrong?

sentences:
Can OpenAL be used with Python? I'm from a background of using OpenAL with other languages; and I'm on a project that benefits very much from Python. I remember PyAL, but it hasn't been updated since 2013 and my computer can't even find a copy of the package to download. I'm also aware of such relative-fringe packages as alpy and python-openal; but I'm hesitant to pick them up if they are also unmaintained. (Can't be sure yet.)

Is there a library that provides a Python binding to OpenAL? Or do I simply need to either write my own or make due with one of the other, non-3D-sound, packages? If getting it is more complicated than pip, how would I go about doing so?

Thanks.

sentences:
Crafty - How to get the id of the collision element? As the topic says, I want to know how to get the ID of an active colliding entity.

My Player Entity is called with

Crafty.e("Player")

Please notice, that I do not want the ID of my Player Entity.
I want the ID of the Collision element

sentences:
How to find two perpendicular lines given a single plane Hey guys, i was wondering how i would go about finding the perpendicular lines relative to a surface normal.

For instance say i have (0,0,1) the expected output would be (1,0,0) and (0,1,0). What would be the best way of achieving this?

I realize that i will be using the cross product, but that requires two vectors, how do i get my first perpendicular line?

Thanks!

sentences:
What is causing this problem with my object rotation? I'm having an issue here with rotation in OpenGL. Before I changed my rendering function the rotation I had for my object worked fine, but now it seems to be messed up.

I changed my rendering function because I wanted to be able to clip the image (render frames of the image), whereas before I was just rendering things on a 1 object, 1 image basis.

The rendering is fine, just the rotation to clarify that. Here's my current rendering code:

void DrawRotateAdv(int x, int y, int width, int height, float sourceX, float sourceY, float imageWidth, float imageHeight,
    GLuint texture, float angle, bool blendFlag)
{
    glTranslatef((GLfloat) x + (width / 2),  (GLfloat) y + (height / 2), 0.0);
    glRotatef(angle, 0.0, 0.0, 1.0);

    if (blendFlag)
    {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    glBindTexture(GL_TEXTURE_2D, texture);
    float texscaleX = 1.0f / (float)(imageWidth / width);
    float texscaleY = 1.0f / (float)(imageHeight / height);
    sourceX = sourceX / (float)imageWidth;
    sourceY = sourceY / (float)imageHeight;

    glBegin(GL_QUADS);

    // Top-left vertex (corner)
    glTexCoord2f(sourceX, sourceY);
    glVertex2i( (-width / 2), (-height / 2));

    //Bottom-left vertex (corner)
    glTexCoord2f(sourceX, sourceY + texscaleY);
    glVertex2i( (width / 2), (-height / 2));

    //Bottom-right vertex (corner)
    glTexCoord2f(sourceX + texscaleX, sourceY + texscaleY);
    glVertex2i( (width / 2), (height / 2));

    //Top-right vertex (corner)
    glTexCoord2f( sourceX + texscaleX, sourceY);
    glVertex2i( (-width / 2) , (height / 2));

    glEnd();
    glLoadIdentity();
}

I think that perhaps my translation is wrong? Unsure though, guess that's a stab in the dark on my part. As for the getting the angle:

     angle = atan2((cEnemy->position.y - (float)position.y), cEnemy->position.x -        (float)position.x) / 3.14159265f * 180;

But I don't think that's the issue, like I said it worked before-hand perfectly. Screenshot of the output:

sentences:
What does a Vector3 state? I'm really stucked. I couldn't understand what does Vector3 state.
When I look Unity Vector3 documentation it says

Representation of 3D vectors and points.

According to this sentence, a Vector3 can state a point or a vector in space.
But When I go into other documentation about Vector3 it really confused me.
For example When I look Vector3 Constructor documentation it says

Creates a new vector with given x, y, z components.

So that means Vector3 states a vector.
But When I look Debug.DrawLine(Vector3 startpoint, Vector3 endpoint)
it says startpoint and lookpoint are points in world space.
So according to this, Vector3 is a point not a vector
I can increase the examples.
For example when I go into transform.position documentation it says,

The world space position of the Transform.

So it says Vector3 is a position(that means point. I think you can't state a position with Vector)
But when we try to change a position of gameobject with transform.position we again use Vector3
and that state a vector.Because you can't change position of a gameobject with point. You could use Vector
So, what does a Vector3 state ?

sentences:
Changing the current state of an entity in the middle of an update step or wait for the end? Let's say that I use a behaviour component that holds a function call to be called every update step assigned to an entity. Inside that function call I'm changing the active state for the entity to activated or deactivated, something like this:

void fun_update() {
 this_entity->set_active(true);
 if (this_entity->is_active()) { // This should return true or false?
  ....
 }
}

What would be more correct? To change the state for the current update iteration or wait for the end of the current update step to update the state of the entities?

I know that, unity3d for example, changes the current state, but when coding my own engine I find easier to update it at the end.

sentences: Find asset labels at runtime Unity allows me to add multiple labels to my assets in the editor (the little blue luggage tag in the corner of the inspector). I can use the Asset Database to find all assets with a certain tag from the editor, but can I do the same thing at runtime? Maybe if the assets are in the resources folder?

sentences:
Unity Player Movement Problem I want to make a little game in Unity, where the player (a ball) jumps up and down and you have to maneuver it through (flappy bird like) obstacles.

My problem is, after I added a simple movement script:

float speed 10f;
Vector3 move = new Vector3(Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical"), 0);
transform.position = move * speed * time.deltatime;

The ball is stuck and can only be moved a little,before returning to its start position.

My question is how i can fix that? I didnt find any solution

sentences:
How can I 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:
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 cause the latest touch event to interrupt a prior event in Cocos2D? In Cocos2D for iPhone, I want the latest touch event to interrupt another and ignore the last touch. Let me know if I need to elaborate more, but basically my game consists of a lot of finger dragging, and if the player ever switched fingers, there may be some overlap, and for the way things are setup, it may detect it as a new touch.

I think I have things almost on the right track, but my third touch does not work correctly. For instance:

Touch A begins and held
Touch B begins and held
Touch A let go
Touch A begins and held <-This should
interrupt Touch B

In my delegate I put [glView setMultipleTouchEnabled:YES]; because I believe I need multiple touches enabled.

In my CCLayer class with my added map and sprite I am using targeted touch delegate (i.e. ccTouchBegan NOT ccTouchesBegan, etc)

I am accessing a touch object with touch = [[[event allTouches] allObjects] objectAtIndex:0];, however I don't have much understanding what index is considered the latest touch or even a process to always get the latest touch.

sentences:
Should I use Panels or Frames? Hi I am creating my first game in NetBeans using Java, the game is going to be an RPG that will look a bit look Undertale on the surface in that there will be a menu, then a load game section and then will go onto a world where you can walk around.

I've used a JFrame and then a JPanel on top of that to contain the initial menu screen. Should I use another JPanel over the menu screen when I press load game or new game to go to those screens, or should I make a new JFrame altogether?

If you think like how Minecraft has a load game button which sends you to a screen that shows you all the games you can load up, would that be a new JPanel or a new JFrame?

sentences:
Simulation step size in a physics engine I am trying to integrate a physics engine (Bullet) into my game engine, but I immediately found that I do not know how big should I make the simulation step. I think of 2 options:

Use a fixed step size of 1/60. This way I have consistent simulation. Bullet allows making multiple steps when this time is exceeded. I think this is good for consistent simulation but I think it has a big flaw and that is that position of objects will not update when my framerate is higher than 60FPS. Right now I have around 1000 FPS but it will drop significantly to around 150 I expect because I use simple materials and not many objects plus the simulation time is not included yet. Is it possible to interpolate between steps so that 2 frames are always different but check for collisions only when 1/60 of a second passed?

Update physics every frame but when frame time is longer than 1/60 then use substeps. This way I should be able to get more precision but it would lower framerate because the step is performed more than 60 times per second. I definitely get the new position of the object in every frame.

Which is a better approach and why? Is there a standardized way to go about it?
I know that when slow-motion footage of CSGO is taken in every frame the position of the object change but the tick rate is just 64. Which would not update the position in every one of the 240 frames monitors can handle and duplicate frames would be created. I know that animation can be sampled at any point in time but not the position of the objects. How is that achieved?

sentences:
How to make rigid body move smoothly on uneven platform? Right now I'm using Rigidbody2d for the game character along with polygon collider 2D(2d platform game).

I'm beginner hope I'm using correct components.

And transform to move character from left to right.

Character.transform.Translate(Vector2.right * speed * Time.deltaTime);

And upward(jump).

Character.transform.Translate(Vector2.up * speed * Time.deltaTime);

When the game character moves on slopes there's lot of friction and bounciness and rotation and its worse when jumping from slopes.

sentences:
How can I create an array of GameObjects? I need to add one assest multiple times in my scene similar to the blender array tool and I was wondering what is the best way to do this because adding each asset individually and setting there locations doesn't seem like the best way to do it. I need to:

Create multiple sprites quickly
Be able to set the distance between the sprites
Set the number of sprites

How can I do this in the editor preferably without any plugins?

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:
Unity ECS: Issues with rotation Posting this here because I spent several days trying to figure out why I couldn't rotate my entities the way I wanted to in Unity.
For a little bit of background, I'm creating a flight dynamics model using Unity's Entities package. Part of this project involves providing keyboard input to a system in order to manipulate the motion of an aircraft--a very basic simulator.
I encountered an issue when I tried rotating my aircraft entity using the Rotation.Euler() method. In fact, just about every approach I saw on every forum I visited could not provide the answer I was looking for. My keyboard input logic manipulated the bank angle (roll), alpha (pitch), and yaw, and I was trying to set an absolute angle for my entity based on those values. It seemed that I was unable to set the rotation values the way I would in the inspector panel, since rotating the entity one direction would make rotating it along another axis unpredictable.
Such is the nature of quaternions.
Thus, I found a solution to my issue, involving a simple helper function that converts a float3 array of rotation values (one for each axis) to a quaternion. I'll be posting the code and explanation in the answer below.
EDIT: In the previous iteration of my code, this is what I had tried in order to update my entity's rotation:
Vector3 temp = transform.rotation.eulerAngles;
temp.x = -90.0f + state.bank;
temp.y = 0.0f;
temp.z = state.alpha;

Entities.ForEach((ref Translation translation, ref Rotation rotation, ref AircraftData aircraftData) => {
            translation.Value = position;
            rotation.Value = Quaternion.Euler(temp);
        }).Schedule();

All other code within the answer below was the same (minus the new quaternion calculations).

sentences:
Spherical coordinate from cartesian coordinate I am implementing a type for Ogre 3D rendering engine to provide spherical coordinates.
So far everything is working fine, until I try to build spherical coordinates from a cartesian vector.
Here is the code I am trying right now, but it's not working correctly (changing phi and theta result in only half a sphere).

/** @return a relative spherical coordinate from a cartesian vector. */
        static SphereVector from_cartesian( const Ogre::Vector3& cartesian )
        {
            using namespace Ogre;
            SphereVector result;
            result.radius = cartesian.length();
            result.phi    = cartesian.x   > Real(0) || cartesian.x   < Real(0) ? Math::ATan( cartesian.z / cartesian.x )   : Radian( Math::HALF_PI );
            result.theta  = result.radius > Real(0) || result.radius < Real(0) ? Math::ACos( cartesian.y / result.radius ) : Radian( 0 );
            return result;
        }

Here is the version currently in the repository:

static SphereVector from_cartesian( const Ogre::Vector3& cartesian )
                {
                        using namespace Ogre;
                        SphereVector result;
                        result.radius = cartesian.length();
                        result.phi    = cartesian.x   > Real(0) || cartesian.x   < Real(0) ? Math::ATan( cartesian.z / cartesian.x )   : Math::ATan( 0 );
                        result.theta  = result.radius > Real(0) || result.radius < Real(0) ? Math::ACos( cartesian.y / result.radius ) : Math::ACos( 0 );
                        return result;
                }

I have been searching for the right algorithm and I think I'm close but I can't figure out it correctly yet.
My maths skills are not so good so I'm having trouble understanding what I'm doing wrong.

Any idea how it should be done?

sentences:
How to take input from featured mobile phone in cocos creator? I am beginner to cocos creator and I came to know cocos has Keyboard,DeviceMotion and Mouse input event but I want to know how to take input from featured mobile phone having number pad?

Will it be similar as taking input from keyboard as number or there is something else.

sentences: can't instantiate different objects I'm trying to instantiate different prefabs at once. But couldn't figure out how. I tried to use Random.Range method but didn't worked for me. It instantiates only one of the prefabs. I want it to instantiate all of the prefabs.

sentences:
What advantages does multisampling have over supersampling? I never really fully understood this, or found an article which explained all the steps in a friendly way.

I'll start with what I do know already (which I hope do not contain misconceptions). I'm pretty sure allocating a multi-sampled frame buffer requires as many times the memory (of a regular buffer) as the number of samples (N). This makes sense because each pixel may be sampled up to N times.

During rasterization, the GPU generates a fragment for the MS frame buffer by testing if each sample is inside of the geometry being drawn. This is what provides edge anti-aliasing. Each sample produces a fragment.

I'm unsure about what occurs when all samples of a pixel are inside the geometry. How many fragments are generated? Is this configurable? What if I want to sample the "inside" pixels 4 times, and the edge pixels 16 times? This would require a 16x MS frame buffer.

Are there other differences? It seems like if the fragment shader is run once on each sample then we are left with something not much different from basic supersampling with the exception of jittered sample locations.

Actually, I'm also a bit unsure about what a frogment really is. It seems like a fragment shader gets (can get) executed more than once per pixel in a multi sampled scene, however this doesn't seem to necessarily mean that a fragment is more related to the sample than the pixel. Is a fragment best thought of as a sample, a pixel, or something else?

sentences:
Can A* path finding cost functions allow for path following shapes? Recently I begun developing a game prototype which could create procedural generated dungeons using a collection of room types. To ensure the hallway paths between these rooms would always be connected I implemented a A* path finding algorithm following along the tile map of randomly placed rooms.

The problem with doing this however is I was not necessarily trying to find the shortest path between rooms which in most cases would be a diagonal. Since being thematically a 'dungeon' I wanted them to twist and turn at 90 degree angles. By using a Manhattan distance for the heuristic I managed to get the intended shape but I've ended up with one final problem which I come to you kind people to help me with :).

Though now using 90 degree angles to move the path, its saves doing the run till the end of path(See picture below). This makes the whole thing at a distance feel cramped in places instead of using all the space effectively. Seeing how simply changing the heuristic from distance to Manhattan distance has made a difference my question is, is there a cost function I could implement that would give the desired results of this non conventional path? Any answers would be appreciated, thank you.

Note: The algorithm also has access to the normal direction of the start and end goals.

sentences:
Check if body is on the ground In my game I have an quite irregular terrain at the bottom and a round ball which can be controlled by the keyboard. Is there any way to check, if the ball is currently on the terrain? This is very important to know because the ball should only be able to be controlled when it is on the ground.

I tried to use the OnCollision event of the ball body, but it only gets fired on the first occurrence.... For my problem a continuous type of collision-detection is needed.

sentences:
Efficiency of the SpriteBatch Does SpriteBatch in XNA draw to the screen only when a sprite would appear on the screen?

Say I have 5 identical sprites placed exactly on top of each other, is SpriteBatch able to determine that it only needs to draw one?

Also, say I have a large map that I've tiled off the screen in every direction.  Does SpriteBatch handle that it does not need to draw these sprites that are off the screen.

(Note: Yes my code should handle this, I am just curious)

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:
Photon Unity Network with Socket IO Ambiguities When trying to use Socket.IO along with PUN I get multiple errors similar to the one below:

The call is ambiguous between the following methods or properties: ``WebSocketSharp.Ext.SubArray<byte>(this byte[], int, int)' and ``WebSocketSharp.Ext.SubArray<byte>(this byte[], int, int)'

I searched a lot and couldn't find any other class with the same name/namespace that could lead to this ambiguity. Please help.

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:
Check if is object in camera field and not covered by other object I know how to check if object is in camera view but how I can check if that object is cover by something elese? In my case I want to turn on or off some effect when I look at light. At this moment my code is straight forward, I have created interface for lightable object with method

public bool isVisibleByCam(Camera cam) {
    if (GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(cam), gameObject.GetComponent<Collider>().bounds)) {
        return true;
    }
    return false;
}

I hope there is better way than checking every object in camera view and comparing distnace between camera.

sentences:
How to calculate faces involved in collision (Separating Axis Theorem) I have a game engine created in javascript (https://jsfiddle.net/4gqsq8wf/) which uses collision detection via the Separating Axis Theorem. Currently, it does not have any means of resolving velocity upon the impact of multiple objects. Many posts have stated on this site that the post-collision velocity of an object is simply the angle of reflection. (For example: https://stackoverflow.com/questions/573084/how-to-calculate-bounce-angle) However, this requires knowing the angles of the surfaces contacting each other. I don't know how to figure out these, as the function I wrote only calculates the Minimum Translation Vector; how would I find the polygon faces involved in a collision?

Layman's terms would be appreciated.

Edit: Would this be the collision normal?

sentences:
Why does this 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:
Camera that follows a target with sub-pixel movement As the title says, I have a character that moves at sub pixel movement (no, I can't change this, because this sub pixel movement happens when I normalize the vector during diagonal movements, otherwise it would move faster) and the camera follows it.
The problem as you can see from this video, is that the textures of the various tiles kinda go crazy: https://files.catbox.moe/ve6t0h.webm

This is my camera:

   CameraPos = target.Position + Movement;
        Matrix mPosition = Matrix.CreateTranslation(-CameraPos.X, -CameraPos.Y, 0);

        CameraOffset = CenterOfScreen - target.Origin;
        Matrix mOffset = Matrix.CreateTranslation((CameraOffset.X / Game1.Scale.X), (CameraOffset.Y / Game1.Scale.Y), 0);

        var zoom = Matrix.CreateScale(new Vector3(Game1.Scale.X, Game1.Scale.Y, 1));

        Transform = mPosition * mOffset * zoom;

target.Position is the Position of my character, it can be sub-pixel.
Movement is the movement of the mouse in relation to my character, also can be sub-pixel.

The Sampler.State I'm using is PointClamp, I really don't want to use the linear one, I don't want blurriness.

I've already tried truncating/rounding the position values in the camera, but the result is a very annoyingly shaky camera which I don't want.

Please help, this is driving me crazy.

sentences:
Fatal error in Game Maker: variable not set before reading it I have been following the tutorial videos on game maker, and I am at the part where he explains how to get the bullet under the character. I thought I did everything right. He then tested the game, and it worked. But when I played, and tried to shoot, this message appeared:

#

FATAL ERROR in
action number 1
of  Step Event0
for object obj_player:

Variable obj_player.layer_bullet(100002, -2147483648) not set before reading it.
 at gml_Object_obj_player_Step_0 (line 30) -        instance_create_layer(x, y, layer_bullet, obj_bullet);

#

sentences:
Rotate a rigid body not around its centre of mass I have a rigid body (a boat) whose centre of mass is towards the front of the object. However, this makes the rotation look strange as the rudder that is turning the object is at the back of the boat so the rotation would be around that point.

How can I rotate the object from the a separate point (using forces) without changing the centre of mass?

Applying a force at a location still causes the object to rotate around the centre. In real life, you need to pin down the point that you want to rotate around, forcing the object to rotate around that point.

This would suggest using constraints but I can't figure out how that would work. You sort of need the rotation point to act as a hinge, but when I apply a suitable constraint, but that would just block the rotation rather than convert it into a rotation around the new point.

I want to resolve this using physics driven operations in Unreal Engine 4.

I don't want to move the Centre of Mass, admittedly for not a particularly good reason, but this still feels like a valid question even if that was an option - what if you want to rotate around two different points.

sentences:
Mapping rectangular texture on trapezoid-like shape I have a problem with rendering rectangular textures on non-rectangular surfaces. While googling, I found a thread with person having a pretty similar problem: http://www.gamedev.net/topic/419296-skewedsheared-texture-mapping-in-opengl/

But in my case, I cannot be sure about surface's exact properties. It's not regular trapezoid, it can be slightly bent. Which means, that I cannot just calculate correct texture matrix, or at least I don't know how.

I've tried to render triangle fan-like shape, but it just changed the characteristics of final distortion.

sentences:
Raycasting against my plane does not detect collisions in Unity I'm trying to keep the camera above a plane which acts as the ground, so I wrote this bit of code:

RaycastHit hit;
if (!Physics.Raycast (transform.position, new Vector3 (0, -50, 0), out hit, 5)) {
    transform.position = new Vector3 (0, 20, 0);
    Debug.Log ("No ground found when raycasting down!");
    Debug.DrawRay (transform.position, new Vector3 (0, -50, 0), Color.red, 0, true);
} else {
    if (hit.distance <= 1) {
        transform.position = new Vector3 (transform.position.x, 1, transform.position.z);
    }
}

The camera is clearly over the plane on position 0, 20, 0 while the plane is at 1, 1, 1, with scale 50, 1, 50, but it never detects a hit. The ray drawn by DrawRay() does intersect the plane.

The plane is oriented upwards, but just to be sure I tried raycasting from below as well, without success.

I have also tried replacing the mesh collider with a box collider using size 10, 1, 10 (I'm not sure why, this seems to be the same size as my scaled plane) and 10, 10, 10. Neither worked.

What Am I missing?

sentences:
How do you design a record/replay system for a frequently changing game? I'm working in a free MMORPG and I have a problem.

I'm (with other people) developing a video recording system for the game. The idea is basically: we record all the packages sent & received with timestamps, plus some local data from the client, and then dump it in a file. For playing the video, we just emulate everything that's on the file. We also have an option to export the video to avi with ffmpeg.

The problem is: when we change between versions of the game, it is hard to maintain backwards compatibility for the video (commands added / removed, function changes, etc). Is there a good way to handle this problem? instead of having a bunch of different players and choose the right one for each version of the video file?

It would be helpful to know how does other games handle this situation.

Thanks for the help, sorry for my english.

sentences:
What level of use can I give to these third person IP based art assets? I'm making my first game (2D), and while details are irrelevant it compromises lots of spaceships in and out of the screen. They are not the main character or controllable by any means (I don't know if it makes any difference).

For the sake of variety and fun, I decided to re-create some iconic spaceships of various known series. They would compromise a small portion of the overall, less than one percent. Their addition would go in the lines of 'easter eggs' or rare sights, just to warm the fans hearts with lovely memories and enrage the ultrafans brains with conflicting date frames and galaxies far far away mixing with milky way lore.

I will implement them on the developer version of the videogame, as I assume private use is as free as air (I really make the game I'd like to play, and hell if I won't be the one that has most fun). I could implement them as an option for the public version if I was sure it was completely safe.

But considering the scenario in which I finish the game and want to fully release it.
This are some of the assets, as example: they are external designs, but I painted them pixel by pixel and generally have some little discrepancies with the canon, besides having one dimension less than they have in most of the original commercial products.

My question is:
Under what conditions can I publish them?
I would'nt claim them as original or own designs, but I am the maker(and thus, the owner) of the art asset nontheless. The fact that they are so low resolution could allow me to use them as parody work?
What if I don't want to make any money of it, and just publish the game without charge?

The simple truth is that I don't really want any problem with anybody. Nor I consider this to end up beeing of any help to my economy. But it would be nice to know if I can distribute it, and what options does it have of helping prevent starvation of one guy. Like, putting a donations button in the same web I use to distribute it, while clearly stating that the development of the game is unrelated to the donations it recives (web without ads, I know that would be considered commercial).

Thank you for your time.
(Non-native speaker, feel free to cry blood)

sentences:
How does atan2 work when getting angle of a vector? I know that atan2 gives me the absolute angle of any vector. But it doesn't give a value from 0 to 360 degrees. Instead, it gives a value (if I'm not mistaken), between 0 and 180, or between 0 and -180. For example, instead of giving angle 270, it will say -90.

This is a little confusing for me. Let me try to describe how I think this works, and please tell me if I'm correct. Actually, I'll draw it.

Is this correct? I'm having a little trouble understanding this. Thanks

sentences:
How to create walking animations in Gamemaker 8 We are learning how to use Gamemaker 8.1 in my game design class, and I wanted to experiment with it, and try to make my own game.
I have run into a problem when trying to animate an object walking.
I've looked all over google for how to animate the walking, but the only tutorials I can use what looks like a different kind of Gamemaker where you code everything.

To specify, I am using the version of Gamemaker where you drag and drop different actions into events. You can add code, but I would prefer not to use it.

I would like to know a way to either import a sprite sheet or a gif and have a walking animation play while the character is moving whenever you use the arrow keys.

sentences:
Phaser 3 - How to make 2 object merging after collision (Like Claw Machine) I'm new in Phaser 3. I use Matter.js for physics.
I want to create something like Claw Machine :

I have a claw (top) and prize (bottom)
The claw will take a prize from bottom
When claw hit the prize, i want the prize drag by claw.

Right now i use :

Matter.js for prize
Arcade for claw

I confuse how to do it. Any idea?

sentences:
In Maya- how can I merge mulitple primitive cubes together into one parent item? (And is this actually needed for using in unity etc)? Im trying to make some 3d models in Maya and then put them into Unity as characters which I can give rigidbody to etc. (Im new to Unity and 3d modelling software, but i have a small amount of programming experience in LWJGL,  LibGDX  and XNA).

I'm focusing on making some assets out of blocks. To give a kind of 2.5D feel to a platform game.

I have made the following image but as you'll see its just a bunch of cubes. I think i need this to be turned into a single piece (but im not sure if 100% necessary or not). Of course, I will be adding animation to this by way of moving the blocks about for different frames of animation.

As I said, im very new to this so I may be doing things completely wrong.

Heres the image:

What i need is to be able to refer to this as one piece with its own transform position, scale etc that I can adjust. Currently if I select it all and try to change the scale it only changes on of the cubes scale even when all are selected.

Also once I've created this and want to add it to my game in unity, will each cube get a rigidbody when i add it or will the whole item get it as standard?

Thanks for any help

sentences:
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:
Smoothing long paths with splines What is the best way to smooth a long path with splines?
I first implemented a Bezier curve but then realised that I would have to join a lot of them.

I used A* on a weighted grid so I can't use Theta or other any angle algorithms stuff.

I basically would like to achieve the light blue path on the following picture (credit to Amit), but on much longer paths:

How do game programmers do?

sentences:
Java - Lemmings - How to detect mouse over lemming My first post on gamedev :) And my first go at game dev :D

To ease me in, I'm starting with a lemmings clone.

I have my lemmings moving about and already have a MouseAdapter for moving around the map with the mouse.

In order to detect when the mouse is over a lemming I thought the easiest way
would be to override the mouseMoved method. This would iterator over the lemmings and check if the mouse coords are in the lemmings rectangle. Is the normal way to do this?

I realised this wouldn't work for a lemming walking under/past the mouse cursor.

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:
Limit Color Pallete Using Shader (Unity) Basically, what I want to do is take a primary input image texture (which is a render texture in-game) and a secondary pallete texture (contains X number of colors, and is X by 1 pixels in size). What I want to do is replace all of the pixels in the image with the most similar color in the color pallete texture. I made a stab at producing the effect, but at the moment, it only seems to return the first color in the pallete. Below is my (nonfunctional) version. I'm new to shaders, so sorry for the potentially very sloppy/basic shader code.

Shader "Custom/Limiter" {
Properties
{
    _MainTex ("Texture", 2D) = "white" {}
    _PalTex ("Pallete", 2D) = "white" {}
}
SubShader
{
    // No culling or depth
    Cull Off ZWrite Off ZTest Always

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

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = v.uv;
            return o;
        }

        sampler2D _MainTex;
        sampler2D _PalTex;

        fixed4 frag (v2f i) : SV_Target
        {
            float4 baseCol = tex2D(_MainTex, i.uv);
            float4 palCol = tex2D(_PalTex, 0);
            float palDiff = 1000;

            for (int p = 0; p < 37; p++) {
                float baseColDiff = abs(tex2D(_PalTex, p).r - baseCol.r) + abs(tex2D(_PalTex, p).g - baseCol.g) + abs(tex2D(_PalTex, p).b - baseCol.b);
                palDiff = min(palDiff, baseColDiff);
                palCol = (abs(palDiff - baseColDiff) < 0.001) ? tex2D(_PalTex, p) : palCol;
            }

            return palCol;
        }
        ENDCG
    }
}
}

Any help would be greatly appreciated! I feel like it's a relatively simple problem to solve, but I couldn't find any examples of existing shaders like it, or any resources describing it.

Edit: This shader works... sort of. It has been picking the nearest color, but it has only been picking two yellow colors out of the pallete. I tried removing those colors, and it then chose to use only an orange. I don't know if this will help anyone, but I thought it was at least mildly interesting.

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:
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:
How to subscribe to an event fired from any Instance/Object of type X? I'm currently working on a small game engine and I'm kinda stuck on finding the right pattern to subscribe to an event fired from any instance of type X. To understand what I'm trying to achieve, here are some code snippets:

 public class FireEffect : BaseEffect
 {
   public FireEffect(BaseAbility effectOwner)
   {
    this.Owner = effectOwner; // each effect belong to an ability
    this.Name = "Fire";
   }
   //apply effect on target
   public override void CalculateEffect(Unit target)
   {
    // set the event here (to get the target as argument for the event)
    this.Event = new EventDispatcher(this.Owner, new EffectEventArgs(target));
    this.Event.DispatchMyEvent(); // rise/dispatch this effect event
    base.CalculateEffect(target); // do stuffs like burn ..damage etc
  }
}

and let,s say we have two Units: a "dragon" with FireBall ability (contain FireEffect) and a "Shaolin" with a passiveAbility (contain WindEffect)

 public class PassiveAbility : BaseAbility
 {
   public PassiveAbility(Unit caster)
   {
    this.Name = "WindFury";
    this.Caster = caster; // ability caster (owner)
    this.EffectList = new List<BaseEffect>(); // effects that an ability possess
    this.EffectList.Add(new WindEffect(this));
    this.initListeners(); // subscribe to events (aka add listeners)
   }

   // apply all effects that this ability has on the selected target
   public override void DoAbility(Unit target)
   {
     foreach (BaseEffect eff in this.EffectList)
    {
        eff.CalculateEffect(target);
    }
   }
   // THE MAIN PROBLEM :
   public override void initListeners(){}

  //call this method if FireEffect.Event was rised
  public void CallBack(object sender, EffectEventArgs e)
  {
   BaseAbility ab = (BaseAbility)sender;
   this.DoEffect(ab.UnitCaster); // hit the unit caster back (revenge)
  }
}

How to subscribe via PassiveAbility.initListeners() to an event fired from any instance of type FireEffect (an ability that use fireEffect)?

In other words: when our dragon throws an ability with a FireEffect (like fireBall) on our friend "Shaolin", he should react to it using WindEffect via PassiveAbility.

Notice please that we can have so many dragons and Shaolins in this game or simulation and any passive holder (unit) should only react to the attacker (unit) etc.

Many thanks in advance for your support and contribution.

sentences:
What is a correct step by step logic of exporting scene with baked occlusion for loading it at runtime? I wonder what is a correct step by step logic of exporting scene with baked occlusion (Culling data) for loading that scene at runtime (on fly from the internet for example))?

So currently my plan looks like this:

I create prefabs
Place them onto my scene (into Hierarchy) (say create 20 buffolows and some hourses and some buildings)
Create empty prefab and drag all my scene objects from hierarchy onto it
Export prefab

So generally I put all my scene objects into one large prefab and export it but it seems that all objects that were marked as static get this property turned off when loading them at runtime and so no Frustum Culling, and no Occlusion culling happens.

So I wonder what is a correct way of exporting Scene + Objects + Occlusion (and other culing) data for future load of such scene at runtime?

I wonder about current 3.5.2 Pro and future 4 Pro versions of U3D.

sentences:
Storing rigid body collision shapes in local or world coordinates I'm writing the beginnings of a lightweight 2d rigid body engine (in javascript, as a hobby project), and i'm debating whether to store collision shapes in local or in (updated as needed) world coordinates.

Most physics engines out there (e.g. box2d, bullet, dyn4j, chipmunk, PhysicsJS) and indeed most treatments of the subject store the collision shape(s) of a rigid body in local coordinates. Since the body is rigid, these local coordinates never have to be updated.

However, when performing collision detection, the shapes have to be transformed into world coordinates (or into the local coordinates of another body) - and even if most collisions can be discarded with some kind of broadphase culling, shapes that have moved still have to be transformed when updating bounding boxes/volumes (unless one uses some orientable or rotation invariant bounding box/volume).

In the worst case, in some of the above implementations, the shapes seem to be transformed multiple times each time-step (computing AABBs + multiple collision tests).

Would there not be a possible performance benefit in storing the shapes in world coordinates (and updating them when needed) instead, and why is it that no one seems to use this approach? There is at least a benefit for static bodies.

sentences:
How to Sync the Location After Getting Up from Ragdoll? I am currently working on multiplayer fighting game and my game will have an anim->ragdoll when the player is knocked out and be able to getting up from it. My problem now is ragdoll is making my character to jitter so I have to disable Replication Movement during ragdoll and enabling it again after getting up from the ragdoll.
My problem now is I am having problem when the character is getting up after ragdoll, as soon I enabling Replication Movement again, the character is snapped back at the initial position before the ragdoll, even though I have set the character location and stuff.

Here is the bp that I set up the location and stuff

This is how I enabling back the replication movement after Getting Up anim is complete and this is where the problem exist.

I tried to set the location back to the current meshlocation that I recorded during the ragdoll mode which is run on tick but still the problem persist. Any ideas or suggestion for another approach to handle this? Thanks!

sentences:
Collision Detection Tips I need collision detection for my 3D racing game but it isn't going well right now. I think I understand the concept of testing boxes and generating a response, however implementation part is a nightmare for me. OpenGL makes everything more complicated than it has to be.

How can I use a shape that is constructed with glVertex*? Should I create the bounding boxes with some Vector3D class?

sentences:
Will setInterval give me Delay? I am setting up a JavaScript Server for my Game.

Am I understanding this correctly:

If I use setInterval to call a function every second, and takes 2 seconds to process. Then I am going to "stack up" requests indefinetly the Client will become more and more out of sync?

If I use setTimeout, and specify 1 second.  Then the function will run (again, lets say 2 seconds) and then start the timeout. And not stack up requests.

Edit:
I am doing Pathfinding and sending it to the Client.
Thank you for all the help people. I think using the Callback is the best option for this.

sentences:
Implementing online connectivity and multiplayer/PVP for a newbie Background

I'm a noob programmer looking to create a simple turn based mobile game as a side project. I've pretty much got the game logic down and am left with implementing the online multiplayer/PVP portion.

More specifically, i'm looking to implementing a system when the player clicks play and will be matched with an opponent in a 1 v 1 format, without any lobbies etc etc.

I'm currently trying to develop my game in android studio(i'm new) but am also open to unity if it makes the development easier.(I have no experience in Unity).

What i want to know

From what i understand,i need to create and host my own server for the multiplayer to run(i.e matching of player to opponent). Do i also need the server to run the game itself or am i able to connect the player to the opponent and simply record the result of the game to my server/database?

Also, how would i go about creating and running/hosting the server? I heard nodeJS is a good choice for writing the server.

End Goal

I just wanna publish my game onto the app store, IOS store, etc.

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:
Loading a heavy scene behind some loading screen in unity Is there a way to load a heavy built scene behind a loading screen in unity to not make the game look like stuck loading the scene rather show the player some loading bar that would help the player think some background process is happening.
any sites or vidoes that describe about this would be a great help! Thanks!

sentences:
Visual Glitch When Drawing Rects I have the following code:

import pygame,random

pygame.init()
screen=pygame.display.set_mode((480,360))

map=[]
for y in range(32):
    row=[]
    for x in range(32):
        row.append(random.randint(0,2))
    map.append(row)

camera=[0,0]
running=True

while running:
    screen.fill((255,255,255))
    for y in range(32):
        for x in range(32):
            tile_position_x = (x*16)-camera[0]
            tile_position_y = (y*16)-camera[1]
            pygame.draw.rect(screen,(255,0,0),(tile_position_x,tile_position_y,tile_position_x+16,tile_position_y+16))
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running=False
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                camera[1]-=10
            elif event.key == pygame.K_DOWN:
                camera[1]+=10
            elif event.key == pygame.K_LEFT:
                camera[0]-=10
            elif event.key == pygame.K_RIGHT:
                camera[0]+=10

pygame.quit()

When running this I find that when you scroll a few pixels in any direction the screen looks like this:

Notice the long unsightly white line on the left side. Why is that there? I've read and reread all of my code and it doesn't make any sense why these problems are happening. My only explanation would be that there is some kind of rounding problem going on in my code. But I haven't found any.

sentences:
How do you handle entity parent-child relationship in Ashley ECS? In the below code example, is a parent-child relationship of an entities. Now every child should follow its parent position, and the child could be re-positioned anywhere.

Entity character; // character is a parent
Entity weapon; // weapon is a child of character

Entity gun; // gun is a parent
Entity bullet; // bullet is a parent
Entity bulletShadow; // shadow is a child of bullet

My own solution is to have an OwnershipComponent which has a Entity owner attribute, but there's a doubt in my mind that the components should only have a data. An Entity is a collection of data, if I  pass this data to components this could lead to over-killing of iteration. So I've changed my mind to use its attribute int flags, this could now be use as an id to reference to child-parent relationship.

public class OwnershipComponent implements {
    public int ownerId;
}

// Entity Manager class

public void create() {
    Entity character = createCharacter();
    createWeapon(0, 0, character.flags);
}

public void createWeapon(float x, float y, int ownerId) {
    Entity weapon = engine.createEntity();
    weapon.flags = // generated unique ID from the weapon category

    OwnershipComponent ownership = engine.createComponent(OwnershipComponent);
    ownership.ownerId = ownerId;

    weapon.add(ownership);
}

public Entity getEntityById(int id) {
    return ...
}

I could access now the parent entity by id and transform its child position relatively.

// Ownership System

public void processEntity(Entity entity, float deltaTime) {
    OwnershipComponent ownership = Mapper.ownership.get(entity);
    Entity parent = EntityManager.getEntityById(ownership.ownerId);
}

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:
AlphaToCoverage + Alpha Blending = Artifacts I'm experiencing a strange problem using OpenGL SampleAlphaToCoverage mode. There are rendering artifacts when using alpha-blending on pixels that have been rendered using alpha-to-coverage - and I can't explain why.

Here's the basic setup:

Render the world. Some batches of vertices are rendered using alpha-to-coverage. Blending is never enabled at this stage.
Disable depth testing an render a screen overlay. At this point I'm using alpha blending. Alpha-to-coverage is never enabled at this stage.

I'm using alpha-to-coverage on the airplanes glass window. This is what the scene looks like:

Everything works as expected so far. However, as soon the screen overlays alpha blending is drawn at a screen location where alpha-to-coverage has been previously active, I'm getting this:

Note that there is no error as long as blending affects different pixels than alpha-to-coverage!

I also tested the following cases:

Use alpha-to-coverage for the overlay instead of alpha blending: No artifacts.
Clear the entire screen before rendering the screen overlay: No artifacts.
Clear all buffers except the color buffer: Artifacts
Clear only the color buffer: No artifacts

The screen overlay item in question consists of a single textured Quad. The texture is 256x256.

You can download the test application at http://www.fetzenet.de/atc_error.zip
Camera controls are WASD + Mouse (Hold left or right button)

Does anyone have a clue whats going on here? Also, can anyone reproduce this behavior?

sentences: global transform to local transform? If an object is attached to another one and you need to set its position, rotation and scale in global space, what do you do to get the local versions of these values, knowing the same values for the "parent" object?

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:
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:
HLSL postprocessing for day to night (DTN) I am trying to implement a "day-to-night"-filter (as commonly used in cinema) for a 2D game (XNA) by using a full screen HLSL pixel shader. The aim is to transform any bright and colorful image into a dark and bluish night version of that image somewhat like:

Conceptually, my ideas would be to:

Decrease brightness
Merge blueish tinted greyscale version of image with original image
Increase contrast

The current shader I came up with is:

// Look up the color of the original pixel
float3 colorOriginal = tex2D(TextureSampler, texCoord);

// Get corresponding greyscale value (adjusted to human vision)
float greyscale = dot(colorOriginal, float3(0.3, 0.59, 0.11));

// Merge and tint
color.rgb = lerp(colorOriginal, colorOriginal * float3(pow(greyscale,6), pow(greyscale,6), pow(greyscale,3)), timeFactor);

The result is still not completely satisfying. How could I improve this?

sentences:
How can I create a cross-fade between two quads? I have two quads, and I would like to have each one of them on the screen for 5 seconds, then fade to the next one. How could this be done?

My code:

package net.makerimages.Unacrawl.stateSys;

import net.makerimages.Unacrawl.graphics.TextureManager;

import static org.lwjgl.opengl.GL11.*;
/**
 * Created by Makerimages on 12.01.14.
 */
public class LogoState extends GameState
{
@Override
public void render() {
    TextureManager.bigLogo.bind();

    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(0, 0);
    glTexCoord2f(1, 0);
    glVertex2f(0 + TextureManager.bigLogo.getTextureWidth(), 0);
    glTexCoord2f(1, 1);
    glVertex2f(0 + TextureManager.bigLogo.getTextureWidth(), 0 + TextureManager.bigLogo.getTextureHeight());
    glTexCoord2f(0, 1);
    glVertex2f(0, 0 + TextureManager.bigLogo.getTextureHeight());
    glEnd();

    TextureManager.makerLogo.bind();

    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(0, 0);
    glTexCoord2f(1, 0);
    glVertex2f(0 + TextureManager.makerLogo.getTextureWidth(), 0);
    glTexCoord2f(1, 1);
    glVertex2f(0 + TextureManager.makerLogo.getTextureWidth(), 0 + TextureManager.makerLogo.getTextureHeight());
    glTexCoord2f(0, 1);
    glVertex2f(0, 0 + TextureManager.makerLogo.getTextureHeight());
    glEnd();
}
}

sentences:
How to arrange child objects in a grid i have a gameobject that have a group of plane meshes that created randomly as child every one of this planes have a "2f" offset in x axis between every plane

what i wanna do is i wanna make the parent object arrangement the child objects on rows and columns even if one of this child deleted during the game or added so if i have 8 planes mesh it should look like that 2 rows and 4 columns like that but i don't know how to do that ?

i know how to get child objects and making offset but i do't know how to get the format like that in the image

i wanna to arrangement the planes meshes that i can acces from this for loop

 void Update(){
          Transform[] children = new Transform[transform.childCount];

                 //Debug.Log(transform.childCount);
                     for (int i=0; i<transform.childCount; i++) {
                         children[i]=transform.GetChild(i);

                     }
      }

sentences:
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:
OpenGl: Error, The loaded object takes the same colors and style of the Texture? I'm new to OpenGl Faced this problem:

Draw function:

void Renderer::Draw()
{

    glUseProgram(programID);
    shader.UseProgram();

    mat4 view = mat4(mat3(myCamera->GetViewMatrix()));
    glm::mat4 VP = myCamera->GetProjectionMatrix()*myCamera->GetViewMatrix();
    shader.BindVPMatrix(&VP[0][0]);

    glm::mat4 VP2 = myCamera->GetProjectionMatrix() * myCamera->GetViewMatrix() * floorM;
    model13D->Render(&shader, scale(100.0f, 100.0f, 100.0f)); // scaling the skybox

    t2->Bind();
    model3D->Render(&shader, scale(2.0f, 2.0f, 2.0f)); //scaling aircraft

    glUniformMatrix4fv(VPID, 1, GL_FALSE, &VP2[0][0]);

    mySquare->Draw();

}

The code of loaded:

    shader.LoadProgram();
    model3D = new Model3D();
    model3D->LoadFromFile("data/models/obj/Galaxy/galaxy.obj", true);
    model3D->Initialize();
    myCamera->SetPerspectiveProjection(90.0f, 4.0f / 3.0f, 0.1f, 10000000.0f);

    model13D = new Model3D();
    model13D->LoadFromFile("data/models/obj/skybox/Skybox.obj", true);
    model13D->Initialize();
    // Projection matrix :
    //shader.LoadProgram();

    // View matrix :
    myCamera->Reset(
        +0.0f, +0.0f, 5.0f,// Camera Position
        +0.0f, +0.0f, +0.0f,// Look at Point
        +0.0f, +1.0f, +0.0f // Up Vector
        );
    //////////////////////////////////////////////////////////////////////////
    std::string Images_names[6];

    Images_names[0] = "right.png";
    Images_names[1] = "left.png";
    Images_names[2] = "top.png";
    Images_names[3] = "bottom.png";
    Images_names[4] = "back.png";
    Images_names[5] = "front.png";
    t = new Texture(Images_names, 0);
    t2 = new Texture("arrakisday_dn.tga", 1);

sentences:
How do i retrieve individual Tile Information from a tilebased procedural World fast? I am concerned about performance with my current setup; as I want to expand on it i need to figure out if I might need to change it.

Current Setup:
The Game/Prototype is similar to Dwarf Fortress or Rimworld. The world i have is tile based and procedural. It is made up of chunks(16x16). All chunks are connected not via coordinates but via pointers (chunk on the east, chunk in the north, chunk in the south and so on). Each chunk segment (or block/ tile) holds an entity(which can be the player, the human or a plant).
Lets say one Entity (for a example a human) walks towards the edge of the chunk and wants to know what is the tile next to him. Then i will have to look at min 8 tiles next to him. Due to the chunks only being accessible through neighbors, I have to always check wether the position relative to the entity is in a new chunk and how many chunks i have to iterate through to get to the position asked for. It is quiet the hassle and i can imagine it becomes a big performance problem once i want to do pathfinding.

Now some Questions:
How do games like Factorio handle this type of data gathering. In an Array i could easily figure out where to look. How do i retrieve individual Tile Information from a tilebased procedural World fast? Should i use coordinates or relative Positions(like i do now)?

sentences:
Painting terrain with a selection circle I don't mean putting a circle under a unit like done in an RTS, that's fairly simply done with a scenegraph(-like structure). What I'm referring to is selection circles for things like Area of Effects that are painted on the terrain.

It seems relatively simple until I think about it.

Here are some images for reference:

http://i.stack.imgur.com/iXWXB.jpg
http://im.tech2.in.com/images/2009/jan/img_116282_initialthreat_640x360.jpg

The first image gets the idea across, but not the full scope. Basically, the floor is painted with a decal detailing the region that will be affected by the spell.

The second image gets it across much better, it's not just a flat painted circle, it wraps along the mesh.

At first I figured to use some sort of object selection, and then in the vertex shader draw the texture on the correct vertices based on... some criteria that I'm still working out. Most likely based on distance and angle from the intersection point. The difficulty seems to come in that the methods wrap onto objects that seem to be completely different meshes.

I can't find an image that shows it (and don't play WoW anymore so I can't take a screenshot), but say you have a terrain mesh and a house on top of it and I select a point very close to the house's wall. Instead of continuing on the terrain mesh, the selection circle will go as far along the terrain mesh as it can, and then wrap up onto the wall of the house. It also ignores certain objects (players, etc), but that's pretty easy to ignore with correct collision tags/callbacks.

It's not so much that I can't think of a way to do this, but all the ways I can think of would probably lag your game out or turn your processor into slag. Somehow I have to:

Draw a texture
With no breaks
Wrapping on multiple objects according to the terrain
Centered at a given point
Completely dynamically (so no pre-baking it into a bunch of dummy textures)
Quickly enough to be computed every frame

Is there a standard method for this? Am I just overthinking it?

My best guess is rather than do one ray cast and selecting that point as the "center" I do a bunch of casts and in each case select the nearest vertex and bind the appropriate UV coord to that vertex, but it seems messy and potentially performance heavy to select that many vertices that way at the CPU frame-by-frame level. Especially since ray casts in general are expensive, even with a good physics engine.

It also doesn't seem particularly portable to anything other than a selection circle. A similar case would be like drawing the movement arrow over the terrain in Total War games, a thick arrow is drawn between the unit and its destination (see here: http://webguyunlimited.com/pixelperfectgaming/wp-content/gallery/total_war_shogun_2_rise_of_the_samurai/total_war_rots_screenshot_014.jpg ), this would seem to be a very similar technique to the AOE selection circle, but the ray cast method I mentioned wouldn't really work for it. There are, of course, numerous other examples too (such as trajectory markers).

sentences:
Taking cube from camera space to clip space, error in my math? watching Ken Joy's Computer Graphics lectures on youtube. One thing I'm confused about is after he gets the cube from the camera space to clip space, from my calculations the cube doesn't look like that. I expected the cube to look like that pink parallelogram in my picture, if we assume the Z of the front-face of the cube to be -4/3 and the back-face to be -2 then the Ws come out to be 4/3 and 2 respectively. So can someone explain how after multiplying by the viewing matrix, the cube comes out to look like how Ken has it.

Ken's view matrix:

After view matrix has been applied:

What I think the side of the cube should look like(the pink parallelogram) after view matrix has been applied:

my reasoning is, after the perspective divide by W, the blue and green vectors should get truncated to create that pink parallelogram. So I'm struggling to understand this. Thanks in advance.

sentences:
Determine when to start modding a game I have not modded a single game in my life, but I really, really want to start. I'm a 3D animator (make no money from this, just a serious hobby) and a budding Object Orientated programmer (make all my money from my own web applications, I'm not a millionaire but I live comfortably and have bags of time on my hands) so I feel like I will be able to make some incredible mods.

Fallout is my favourite game series of all time, has a vibrant modding community, its open-world style means the sky's the limit (and occasionally further!), there are excellent modding tools available (such as the GECK), and Bethesda has an excellent attitude towards licencing (unlike those nazis over at EA), so I'm one-hundred percent sure that's what I want to mod.

However I have no idea what modding a game is like, and while the only way to find this out is by modding, what I'd really like to know is how do I determine when is the right time to mod? My heart wants to download the GECK (the fallout editor) right now and get stuck in, but I'm being sensible and writing this question.

The last fallout game (New Vegas) is nearly half a decade old (2010) and Fallout 4 is lurking in the future somewhere. I want to dive in modding new vegas, but where will I be when fallout 4 comes out? Will there be only a slight learning curve and then all the skills I've learned will be utilized to start modding really quickly in Fallout 4?

Or, in between games, are modders simply left in purgatory regarding future releases? Could I become a Fallout 3/NV mod ninja, and then have to learn everything again come Fallout 4? Or do companies such as Bethesda make an active effort to keep everything consistent?

I feel 3D engines are like web frameworks such as Zend and Rails. Basically, I've put all my eggs in Rails and have never looked back. I'm sure that as the web changes, Rails will change with it. I spend every moment of my professional life with Rails as I'm confident it will never die and I will be able to build on my existing skills until I retire. This attitude means I can really throw myself at projects, go the extra mile and learn new skills. However, will I not be able to do this with modding? Will there always be lurking doubt that come the next game, everything I've learned will be useless? Will every new game hit me with a learning curve?

Also (and this would me awesome if true but I kind of doubt it), are moden games similar
enough that if I'm a Fallout ninja, the learning curve wouldn't be too crazy if I then wanted to mod Crysis or Portal or even a non-fps like Civ5?

sentences:
How would I go about creating dynamic weapons using EC architecture? I currently have a weapon component that contains common functionality across weapons  (mainly guns).

class Weapon : Component
{
    float fireRate;
    float reloadTime;

    void Reload() // Implements reload logic since it is common across all guns
}

The main thing that differentiates guns is firing (some deal splash damage, some fire in a cone, etc.)

The problem I am facing is how to implement the unique firing functionality? Should I make a ConeDamage component, a LinearShot component? If so how will it work?

Keep in mind I am using an EC architecture not ECS.

sentences: Can I put a Creative Commons license on my game? Title says all, I would like to publish my game under a Creative Commons license. What licenses can I use for a game if any?

sentences:
How can I better implement A star algorithm with a very large set of nodes? I'm making a game with nodejs in which many enemies must converge on the player as the player moves around a relatively open space (right now it is an open field with few obstacles, but eventually there may be some small buildings in the field with 1 or 2 rooms).  It's a multiplayer game using websockets, so the server needs to keep track of enemies and players.

I found this javascript A* library which I've modified to be used on the server as a nodejs module.  The library utilizes a Binary Heap to track the nodes for the algorithm, so it should be pretty fast (and indeed, with a small grid, say 100x100 it is lightning fast).

The problem is that my game is not really tile-based.  As the player moves around the map, he is moving on a more or less 1-to-1 per-pixel coordinate system (the player can move in 8 directions, 1 or 2 pixels at a time).

In preliminary tests, on an 800x600 field, the path-finding can take anywhere from 400 to 1000 ms.  Multiply that by 10 enemies and the game starts to get pretty choppy.

I have already set it up so that each enemy will only do a path-finding call once per second or even as slow as once every 2 seconds (they have to keep updating their path because the players can move freely).  But even with this long interval, there are noticeable lag spikes or chops every couple of seconds as the enemies update their paths.

I'm willing to approach the problem of path-finding differently, if there's another option.  I'm assuming that the real problem is the enormous grid (800x600).  It also occurs to me that maybe the large arrays are to blame, as I've read that V8 has trouble with large arrays.

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:
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:
Any good pattern for managing user input in XNA I'm doing some experimentation on XNA, and unlike past experiences with XNA, I wanna do stuff right.

Are there any good patterns for managing user input?

Like... how do I manage what components get the input?

Is there anything like that? I feel like doing the normal - checking for state of a button and if-ing for every thing you need... It can't be that there isn't something more clever and well designed to do that.

I feel that the wheel has already been invented here, I just can't find it.

sentences:
How can one replicate the 'Quake Disruptor' of Wipeout XL/2097? Following my previous question, I am wondering how one can achieve the same effect under Unity?

The effect in action

https://youtu.be/kzmmLeCwL0g?t=790

Description of the effect

When you fire the Quake Disruptor weapon, it creates a sine wave that mimics an earth quake, it happens over the next track sections forward to the player ship as you can see on the small video. This results in instant-damage and slowdown to the ships that are caught in the quake.

Technical challenges

Deforming the mesh

The function for generating a quake-like wave to apply to each section of the track mesh is easy, e.g. a Gaussian filter will probably be good enough:

https://www.desmos.com/calculator/goasdepcmv

Applying the deformation to mesh

This is where it starts to get trickier, a track is made out of sections that have few faces, each face being nothing more than a quad.

Here you can see three sections and their faces (wall, track, track, wall):

The challenge in here is how to apply the deformation and yet being able to check collisions against the track (remember that we can't use a mesh collider since it'll be updated in real-time).

I first thought that subdividing the mesh using tessellation would be needed to apply smooth deformations, hence my previous question. However, if you look closely at the video they simply move either edge of faces according to where they're against the 'quake' function being applied to the track mesh.

Here's a link to a video with the best quality, around 13 mins 10 secs:

https://archive.org/details/PSX_Longplay_243_Wipeout_2097

We're getting closer but we still need to be able to check for collisions.

Being able to still collide against the track

This is the big question mark, since we cannot update a mesh collider in real-time as it's a CPU hog, I really have no idea on how to address this part of the problem.

This also leads to another problem, since we cannot use a mesh collider, how are physics are going to be handled, by writing a physics system from scratch ?

Question

How can such effect be achieved under Unity, if possible at all?

PS You will want to remember that the PS1 had a 33Mhz CPU and certainly no mesh collider like the one we can find in Unity, yet they achieved to do it. For sure there is a trick involved but I couldn't figure it out.

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:
How is Handles.DrawSelectionFrame supposed to be used? The Handles class has a function Handles.DrawSelectionFrame(). Here's the useless official documentation for this function:

Draw a camera facing selection frame.

When I call this function, nothing is displayed. Other handles seem to work fine.
    void OnDrawGizmos() { //results are same in OnSceneGUI in an Editor
        Handles.color = Color.red;
        Handles.DrawLine(transform.position, transform.position + Vector3.up * 100)); //shows up
        Handles.Label(transform.position, "Hello World"); //shows up
        int i = -1;
        //is the size in world units? pixels? the documentation doesn't say
        for (float size = .5f; size  < 1000; size  *= 2) {
            //nothing shows up
            Handles.DrawSelectionFrame(i, transform.position, Quaternion.identity, size, EventType.MouseMove);
            i++;
        }
    }

How is this function supposed to be used?

sentences:
Cheap way to soften contactpoint of character with ground The view of my game is always semi topdown. I'm trying to make the contactpoint between characters and the floorplane more grounded without rendering hundreds of sprites.

One thing that I think could work well is to just hide some pixels of every object that is i.e. 2 cms above the floor.

See GIF below of an example I did in Photoshop:

Things that I'm thinking about:

check the z depth before rendering - if it's very close, then randomly don't render the pixel
randomly writing "wrong" depth buffer values for the ground plane
a small layer 2cm over the groundplane that writes z values only - draw this before the character

As I'm still in the research phase, I'd like to also explore other possibilities.

Is there already a well established way to do this?

sentences: How do I protect sending scores from HTML5 games to my server On backend I am using java. I have a game in HTML5; when user completes it I sends an Ajax call to save the score to database. Now, someone can easily use tools like Fiddler and firebug to modify this ajax request and send a much better score to the server. How do I make sure that user cannot manipulate scores !

sentences:
For PC game development with Visual Studio, how do AAA developers reconcile their dozens-of-GB games with VS's 4 GB memory limits? As far as I understand it, Visual Studio is the de-facto standard for Windows development in C# and C++, but it is limited by the fact that it's a 32-bit application and thus only has access to 4 GB of RAM for loading projects (Microsoft wrote a blog post 10 years ago explaining(?) why there is no 64-bit version). AAA games, however, are dozens of GB large, and even after factoring out the assets (which VS doesn't load), still amount to quite a bit of executable code.

Are AAA developers able to work within those limits for PC development, or do they use other IDEs that have 64-bit versions?

(I am aware that Visual Studio often uses out-of-process facilities for actually building and running projects, but the IDE itself is 32-bit and a lot of its functions, such as CodeLens, run in process).

sentences:
Generate Random Integers I am trying to make a dice rolling game. I want to generate a random integer in the range of the number of dice I have multiplied by the number of sides the dice has. For example, if two dice were played with three sides, then there could be any number between 2 and 6.

Here is my code; when I put in, for example one dice and two sides, it prints numbers upwards of 13. The problem is that it doesn't create an integer between the amount of sides and dice.

condition = "Start"
while condition == "Start":
Dice = int(input("Please select number of dice you would like to use (atleast 1)"))
Sides = int(input("Please select number of sides on dice you would like to use (atleast 2)"))
if Dice <= 0 and Sides <= 1:
    condition = "Start"
elif Dice >= 1 and Sides >= 2:
    print("You have selected", Dice," dice and", Sides,"Sides")
    condition = "play"
    Roll1 = 0
    Roll2 = 0
    Score1 = 0
    Score2 = 0
while condition == "play":
        Roll1 += randint(Dice,Sides)
        Roll2 += randint(Dice,Sides)
        print (name1,"'s Roll", Roll1)
        print (name2,"'s Roll", Roll2)

sentences:
What kind of design or structure should I use to implement movement between an over-world map and a menu system? I'm making a simple text-based RPG, where the player is the owner of five creatures that battle other teams for loot, experience and glory. I am using Python, and a curses emulator. I have a static ASCII over-world map. My character, represented by a glyph, can move about this static map. There are locations all over the map that the character can visit, that break down into two categories:

Towns, which are a series of menus that will allow the player to buy equipment for his team, hire new recruits or do other things.
Arenas, where the player's team will have a "battle" interface with actions he can perform, messages about the fight, etc. Later, I may include an ASCII representation of the fight; but for now, just screens of information, with action prompts, will be displayed.

What kind of design or structure should I use to implement movement between an over-world map and a menu system?

Right now, the game goes through a master loop that waits for keyboard input, and then moves the player about the screen. Upon keyboard input, the player  coordinates are checked against a list of location objects, and if the player coordinates match a locations coordinates, then... I am not sure.

I'm not sure if I should call a separate function, to initiate either a menu or combat mode, or if I should create some kind of new GameMode object that contains a method for drawing the screen and printing the necessary info. If I go that way, I am not sure how to pass my players team data into this object.

My main concern is passing around the program flow into all of these objects. Should I be calling straight functions for different parts of my game, and objects to represent "things" within my game? I was reading about the MVC pattern, and how this kind of problem might benefit from decoupling the GUI from the game logic and user input, but I have no idea how this applies to my game.

sentences:
Unity directional light for a day night cycle on a hex sphere So I am trying to create a Day Night cycle on a sphere but it doesn't work the way I want it to.
As the model is hex tiled, you see the edges of the hex tiles also lit up like below. I am using a directional light source for the same.

I don't want the above effect. I want it to ignore the edges and just be a straight line instead. Something like below

Is there a way inside Unity that I could achieve this effect just using the lights?

sentences:
How can I serialize lists to JSON on mobile? I'm having difficulties serializing lists with the built in JsonUtility. I eventually figured out this just isn't possible with its limited capabilities.
As much as I'd like to use Newtonsoft, I cannot use that either because this is a mobile game, and from what I understand it doesn't work on Android or iOS.
Does anyone have any suggestions for how I can serialize my lists on mobile? I don't want to have to use hacky solutions to get these lists in and out of JSON.

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:
How do I get a relative rotation between two positions? For example, I have two objects: a & b.

a's position is 12, 16, -2 and b's position is 14, 16, -3

I need to know how to find a relative rotation between them.

By relative rotation I mean this: a's pitch and yaw so a is looking at b.

I have no helping methods like lookingAt() etc. I only know a's x,y,z,yaw,pitch and b's x,y,z.

Any help?

sentences:
Why has my refractive water shader become reflective So I was making a water shader in unity and well it looked fine in the scene view but as soon as I went into the game view the refraction texture basically flipped up 180 degrees and made it look like the water was reflective. The problem with this is that it breaks the transparency of the shader.

Scene View (how it should look):

Game View (how it does look):

Shader: (I can't post more than 2 images)

Part of the shader:

float4 Lerp2=lerp(Tex2D2,float4( 0.0, 0.0, 0.0, 0.0 ),_Refraction.xxxx);
float4 Subtract0=Lerp2 - _RefractionCorrection.xxxx;
float4 Add2=((IN.screenPos.xy/IN.screenPos.w).xyxy) + Subtract0;
float4 Tex2D0=tex2D(_GrabTexture,Add2.xy);

sentences:
What is the "Unity" way to approach tech design for a 2D game like this? So I come from C++ land where I've always done every little thing myself. Now I'm getting into Unity and C# and I'm ironically overwhelmed with the domain. I'm starting off with this simple little 2D game and I'm wondering... if someone can point me to the correct tools that would lead to a successful implementation of this game. Here is a quick mock up I did in paint:

These are the parts of Unity I've investigated:

Tilemap
Canvas
GridLayout
Prefabs
GameObjects (these seem fundamental to Unity, heh).

After researching these topics, and playing around a bit, here are my initial questions:
How do you approach Canvases in Unity? I could see this being split into 5 separate Canvases, one for each local body of UI. Or 1 Canvas for the game board, and 1 canvas that contains a single overlay with all of the other UI components. But then how do those components typically get positioned? Is it common practice to place by absolute coordinates?
I guess I'm getting hung up on.. how do I place my canvas for the game board in that position relative to all the other UI elements? I'm a C++ application developer so if I'm doing UI at all I'm used to layout systems. I'm not sure how common that is in this ecosystem.
Should I even use TileMap for this? It doesn't seem like I need that kind of power. My grid is finite and fits on screen. My gut reaction is that I should just instantiate a bunch of colored squares at first. But I'm not really sure the best approach to that either. GridLayout on a canvas? Absolute coords? TileMap?
What other tools should I be looking at? By tools I mean Unity concepts I didn't mention above. My initial thought is to just have a backing data structure that holds all the data for the grid, and then I just render... prefabs? based on that data? Maybe I just want someone to tell me I'm on the right track or "no you're doing it totally wrong use this other thing", heh.

sentences:
Unity: Game objects in scene load incrementally and not at the same time I am using Unity in my Android app. When the app opens, I show the user data in the Unity scene. User data contains texts and images.

In order to load this data in the scene, I make a lot of
UnityPlayer.UnitySendMessage(GameObject,Function,Params)
calls to many C# scripts in Unity from Android. Each of these calls performs a specific task like loading an image, creating a text, applying the text font etc.

Problem is that the loading of this data right now looks incremental (if that's the right word). So the text is visible first and after a fraction of a second the image shows. Some text effects show later. This looks ugly.

How can I make all the UI elements load at the same time even if it takes some time? Is there a way to freeze the scene before each game object is ready to be drawn?

sentences:
Change Shader on This Material Via Code? How do I change this material to have the Toon/ Lit Outline shader via code at the Start of the scene?

Here is my code that I have as of now, that does not work:

 using UnityEngine;
 using System.Collections;

 public class MainMenuManager : MonoBehaviour
 {
     public Material hatMaterial;    //This is my character's hat shader - I set this in the Inspector

     private Shader toonShader;    //This is the Toon Shader with an Outline

     void Start ()
     {
         toonShader = GetComponent<Shader> ();

         toonShader = Shader.Find ("Toon/Lit Outline");

         hatMaterial = GetComponent<Material> ();

         hatMaterial.shader = toonShader;
     }
 }

sentences:
What are common methods for organizing game objects? I'm in the early stages of developing a game in C++.

As of currently, I've defined a base GameObject class that is the base class for any interactive item in my map (e.g. enemies, loot, projectiles, etc.). When these items are created, I want to give them to an ObjectManager class. The ObjectManager class is responsible for iterating over each object and calling abstract methods like "update" or "render".

Originally, I planned on storing all objects (or references to the objects) in a single container. I would then iterate over this container.

However, I'm starting to have second thoughts about whether or not this is a good idea. I've come up with two reasons why this might be a bad idea:

1.) Regarding object collision, it makes sense to only perform calculations between certain objects on whether or not they've collided. For example, I would want to determine if the main character has collided with a loot item. However, I would never to want to calculate if a loot item has collided with another loot item (at least in my case).

2.) Object pools. Referencing this article, it has come to my attention that continuously allocating/de-allocating memory is expensive. Because of this, it is a common technique to use object pools that request memory upfront and then manage that memory without actually deleting it. One of the comments made in the article is that the objects that exist within the pool must all be the same size (or each pool slot must be big enough to accommodate the largest object).

Both of these examples make me think having a single container that houses all GameObject is a bad idea.

Instead, it seems like it would make more sense to have different containers for each type GameObject type. For example, it would make sense to have a container for enemies, loot, projectiles, etc. This way I would have more control in iterating/comparing only on objects that make sense for certain object types (e.g. don't try to calculate collisions between two loot items).

The problem I'm facing however is that I don't know how to break up these containers. Should all projectiles go in a single container? However, what if I later decide to create a "fire projectile" that performs some kind of "burn" logic. Would this require a new container to then to iterate over all fire projectiles? Essentially, I don't know how granular my containers should be.

I haven't come across any reference material on this topic. Any advice would be appreciated.

sentences:
Game is darker on build I've been recently doing test builds of my game. In Unity, I worked on baking the lighting to ensure everything looked fine. However, upon building, the game level becomes far darker and much of the lighting and baking is ineffective.

Here is how the scene looks in the editor:

And here is how it looks in the built game:

It's much darker than intended.

Here are my lighting settings which I've baked in Unity's Editor. These settings and lightmap parameters were designed to, at least in the editor, provide decent quality while making light bake times relatively quick. However, I've noticed that newer Unity's Lighting settings are way different now, so perhaps something is amiss here?

I've been at my wits end trying to figure this out for the past while, but I can't figure out why this is happening or how to fix it. Any ideas?

sentences:
How can I improve the seemingly capped framerate of my flash game? I used to be sure that all Flash games are capped to 30fps as Edmund McMillen's  The Binding of Isaac runs at that frame rate. N v2.0 (Flash Player 11) runs at 60fps.
Why do games developed in Flash seem to have capped frame rate?
What are the limits on the fps when developing in Flash?

sentences:
Problems making my basketball bounce around horizontally This is probably a very easy question, but I can't seem to understand why it's not working.

I want the basketball to bounce horizontally when it touches the borders on the right and left, but when it bounces on the right, it seems to go just a little bit further than it should.

Any suggestions?

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    basketballPosition.X += ballSpeed;
    if (basketballPosition.X > Window.ClientBounds.Width - basketball.Width || basketballPosition.X < 0)
    {
        ballSpeed *= -1;
    }

    base.Update(gameTime);
}

And my Draw method:

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

        spriteBatch.Begin();

        spriteBatch.Draw(basketball,
                         basketballPosition,
                         null,
                         Color.White,
                         0,
                         Vector2.Zero,
                         1.5f,
                         SpriteEffects.None,
                         0);

        spriteBatch.End();

        base.Draw(gameTime);
    }

Edit The problem was I was using a scale of 1.5f for drawing the image. Can someone explain how I would get the true border of the image if I were using scale? It seems the border stay as the original size, but the texture is drawn to whatever scale I choose.

sentences:
How should a hive AI distribute tasks between worker drones? I've been studying AI design—things like behavior trees and FSMs. They make sense from the perspective of deciding a specific entity's goal and action.

However, the AI in my game is very hive-like; multiple drones share the same knowledge and desires. What a particular drone can do is unimportant, as each can do any task. Instead, it's a question of which drone would be the best choice for a particular task, given the list of tasks to be done.

For example: The AI decides it wants a particular resource type gathered. Different resource types are available at various locations across the map. Which drone should it send to gather the resource? All are capable, but some might be further away from the resource. Some might already be gathering a different resource. Some might be performing tasks that the player is actively waiting on, or that strongly affect the player's success.

To decide, the AI would need to evaluate various factors and continually re-evaluate as the game progresses, without stepping on it's own toes and continually reassigning jobs to the same drones.

Is there a field of AI suited to this sort of task distribution that I can look into?

sentences:
How to deal with cheat avoidance and trusted client issue I hope not to be off-topic here.

At the moment I'm dealing with networking programming for the game I'm working on and I found different possible scenarios.

I started to build code using a Platform as a Service such as Photon Unity Network which offers a quite simple system to sync players through its cloud.

The problem is that by using the cloud you must have at least a trusted client in order to prevent cheating from players.

I wish I could learn what is best to deal with this problem considering that opting for a client/server structure would be the best but I'm a bit worried about rental/purchase pricing. Is there a cheap way to have a working game server?

sentences:
Alternative to world/terrain editing with jmonkey I have been studying Java for almost a year and have been trying to develop a game using jMonkey. I have tried Unity before but since I only know Java I decided to go with jMonkey.

My problem is that the terrain/world edit in jMonkey is buggy. When I make changes to the terrain I sometimes can not save. Many others seem to have the same problem too.

I would also prefer drag n drog exactly like Unity has, but jMonkey doesn't seem to have that.

Is there any other way I can create the terrain/world (with drag n drop like Unity) and then import into jMonkey? What are the alternatives?

sentences:
Load a specific sprite by name from a SpriteSheet with Resources.Load I want to avoid loading all the sprites from a sprite sheet into a dictionary. Is there a way to access the specific sprite inside the sheet. Right now I'm using this code :

 prefabImage.sprite = Resources.Load<Sprite>(spritePath+spriteName);

But this loads a single sprite. Can I change spritePath to somehow point inside the sprite sheet?

sentences:
How to make legacy animations run in Unity in unscaled time? (Pause game related) I'm relatively new to Unity, and I've been having a very difficult time getting the legacy animations to run in unscaled time.  I need to pause my game, and as soon as it pauses, I need to have my boxes for the pause screen come in from the side.  This sort of works if I use an IEnumerator, but I have to hard-code exactly how long it will take for the animation to come in (.333f seconds) and the game will not pause until the animation fully shifts in.

The major problem with this is that I need to use more moving animations while the game is paused that will be called using the onClick() methods in the pause game's buttons.  Think of my pause menu as somewhat like an old-school RPG's menu like Final Fantasy but with moving GUI animations.
Now, I know that unscaled time is the key to solving this issue, but every explanation I've found online seems to involve the Animator which refuses to work with the legacy? animations.  Either that, or the code they're using makes little sense to me because it may be above my level of comprehension.  Here is what I have as it stands (*note that I have some deltaTime and _lastframetime code but I have no idea how to make use of it):

// Update is called once per frame
void Update () {
    deltaTime = Time.realtimeSinceStartup - _lastframetime;
    _lastframetime = Time.realtimeSinceStartup;

    //Press T or Tab to pause the game
    if (Input.GetKeyDown(KeyCode.T) || Input.GetKeyDown(KeyCode.Tab)) {
        //If not currently paused, then stop time and show the GUI
        if (!pauseGame) {
            Debug.Log("Tab/T properly pressed to pause game.");
            pauseGame = true;
            showGUI = true;
            StartCoroutine(Wait(.333f)); //IEnumerator Wait, then stops
        }else if (pauseGame){
            Debug.Log("Tab/T properly pressed to UNpause game.");
            Time.timeScale = 1;
            pauseGame = false;
            showGUI = false;
        }

        //If we are to show the GUI, play the start animation; otherwise, the exit one
        if (showGUI == true) {
            //startMenuCanvas.animation.
            startMenuCanvas.animation.Play ("pause_menu_anim1");
        } else {
            startMenuCanvas.animation.Play ("pause_menu_anim1_exit");
        }
    }
}

IEnumerator Wait(float seconds){
    Debug.Log ("Waited for " + seconds + " seconds.");
    yield return new WaitForSeconds(seconds);
    Time.timeScale = 0;
}

Ideally, I want to remove the IEnumerator and be able to call the Play animations using unscaled time.  Is there any simple way to do this that I am missing?

sentences: Getting and playing AudioClips by string name Is there anyway I can get an audioclip by the name it has in the assets folder? Or will I always have to make a reference to it by dragging and dropping the clip on a SoundClip in the inspector?

sentences:
Can you use a standard multi-thread if only reading unity objects? First of all I know about coroutines and how to use them (they're awesome).

A friend of mine was telling me about the way the he implemented his saving system in a game he was working on, after asking him what he was using I found out that he is using system.threading and not coroutines to save data.

I know that Unity isn't thread safe but apparently he has had no issues with saving which leads me to wonder if it is ok to use normal threads as long as you're only reading data and no pre-existing data is modified in the gameworld? would this affect the game at all (other than some moving objects being slightly ahead of where they should be because of the time it took to get to that object and save it)?

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:
Is OpenGL appropriate for 2D games? I have been teaching myself the OpenGL library for a while now, and want to start making a game. However, for an easier introduction, I want to start with something 2D, such as a top down Pokemon-style game.

Is this a good plan, or is OpenGL made specifically for 3D?

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:
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:
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:
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: 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:
What does 'Discretizing Space' mean in the context of paper prototyping I was browsing some lecture slides by Eric Anderson for his Cornell course CS 4154 (Analytics-driven Game Design). In a series of slides he mentions discretizing space as a way of paper prototyping action games. As an example he illustrates  with a screen shot of Super Mario with a grid overlay (shown below). Unfortunately the slides do not expound on how this technique is used.

How is discretizing space used to prototype platform games or action games generally?

sentences:
Full screen blackout using allegro in codeblocks I'm very interested in game programming and I'm taking my first steps alone. So I installed allegro. Although Dev-C++ didn't work, Code::Blocks compiled successfully. I started out with this basic program:

#include <allegro.h>

int main(){

    allegro_init();
    install_keyboard();
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);

    readkey();

    return 0;

}
END_OF_MAIN();

The problem comes in when I try to run it. It opens the little window as always, but rapidly blacks out my whole screen. I press any key and it takes me back to the little window telling me that it finished, which means the program worked. But I try any other program with allegro, like:

#include <allegro.h>

int x = 10;
int y = 10;

int main(){

    allegro_init();
    install_keyboard();
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);

    while ( !key[KEY_ESC] ){

        clear_keybuf();

        acquire_screen();

        textout_ex( screen, font, " ", x, y, makecol( 0, 0, 0), makecol( 0, 0, 0) );

        if (key[KEY_UP]) --y;
        else if (key[KEY_DOWN]) ++y;
        else if (key[KEY_RIGHT]) ++x;
        else if (key[KEY_LEFT]) --x;

        textout_ex( screen, font, "@", x, y, makecol( 255, 0, 0), makecol( 0, 0, 0) );

        release_screen();

        rest(50);

    }

    return 0;

}
END_OF_MAIN();

And the same thing happens over and over again! Is there something I'm doing wrong?

sentences:
How to calculate final force vector for the SKSpriteNode I am creating space game which has an effect similar to black hole's gravitational effect. Wherever the spaceship is going, the black hole will attract it, summing up all the vectors together.

I know SKFieldNode has a method customFieldWithEvaluationBlock: that allows to calculate everything myself, but might it be another way to do that?

I have tried almost every type in SKFieldNode, but nothing helped.

There are some side effects that don't suit me (i.e. If I use an electric or magnetic field, the object repels from the black hole)
Moreover, moving with SKAction (i.e. for the spaceship) doesn't allow me to sum all movement vectors together (I cant do
- (void)moveTo:duration: actions simultaneously, even with grouping the actions)

What can you advice me? !

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:
Sprite with alpha Blending in 3D world I'm working on a game in a 3D world with elements 2D only (Like Don't starve game) for Android and IOS.

Currently, I've managed "Sprite" without alpha blending, I've just put a condition in the pixel shader to test if pixel alpha channel is null:

if ( texture.a < 0.5 ) discard;

Everything working here. (On old devies like an HTC desire mobile, this condition destroy framerate but it's another problem :/)

But recently, I've tried to had another Sprite with AlphaBlending activated:

glCheck( glEnable(GL_BLEND) );
glCheck( glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) );
glCheck( glDisable(GL_DEPTH_TEST) );

My sprite transparency is ok but it is now in front of everything in the scene. (Probably due to glDisable(GL_DEPTH_TEST)).

How can I handle depth with alpha blending activated?

EDIT:
A video to show the problem: http://www.youtube.com/watch?v=W0gpBekEwW8&feature=youtu.be

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:
Verlet rope between two moving points connected with a spring joint? I'm connecting two moving rigidbodies using a spring joint in Unity. Between them, a rope will be rendered using a line renderer and I want it to move realistically as the joints move, without physics.
I've read about verlet integration, but only found examples where one point moves, and the other one is calculated, for example a guy with a grappling gun, swinging back and forth.
Here's the current implementation with spring joints.

The second image shows a nice and smooth verlet rope with a line renderer. It's a little too lenient, but looks good. As this doesn't use physics, it doesn't let me move the object or affect the ship, for example if it was stuck on something.

How do I make an elastic rope like the second image, between the spring joints, without the physics engine?

sentences:
Define a circle from a point on its circumference and an angle I'm working on a 2D, top-down driving game with some basic AI vehicles.
The AI Vehicles move along a bidirected graph of positions. Each vehicle has a current position (from the graph) and a target position, but instead of linearly interpolating directly between the positions, the vehicles each have a maximum steering angle, and so must steer their way to the next point.

The vehicle is defined geometrically as follows:

The vehicle itself is a rectangle, comprising a center point (O), a width and a height.
The vehicle has both a front (F) and rear (R)
'axis' from which the wheels are extruded.
The vehicle is steered from the front axis, by an angle defined as (a). The vehicle's
The current heading is (A).
The current steering heading is (B).
The desired target is (T).

The vehicle's heading is only changed when both the steering angle is set and there is some forward motion (i.e. the vehicle cannot turn when standing still).

As long as the target T is sufficiently far enough away, over time the vehicles can be correctly steered towards the targets.

The problem is, when the target is defined too close to the front axis, the vehicle can never reach the target, as the turning arc is too large (they drive around the target indefinitely).

I think the solution is to first detect if the target is 'too close', and if so, the vehicle needs to reverse a little first, and then begin driving forwards again. I think this would be achivable by defining a circle adjacent to the vehicle to detect if the target point can be reached based on the maximum turning angle and current position - but I don't know how to create such a circle. Something like:

How can I create a circle (the origin and radius) from the current vehicle position and max turn angle?
Is there a different, potentially better solution?

Thanks a lot

edit
The following is how I update the position of the vehicle. In a nutshell, the positions of the front and rear wheels are first calculated, and their positions are independently updated. Then the new position of the car is worked out from there. I cut a little for brevity, but it should be enough to see how it works:

private void updateVehicle(BaseVehicle pCar) {

    final float lAccelerationAmt = 30;
    final float lWheelBase = 32;

    pCar.speed += lAccelerationAmt ;

    // Extrude front and rear axels
    pCar.frontWheels.x = pCar.x + lWheelBase / 2 * cos(pCar.rotation);
    pCar.frontWheels.y = pCar.y + lWheelBase / 2 * sin(pCar.rotation);

    pCar.rearWheels.x = pCar.x - lWheelBase / 2 * cos(pCar.rotation);
    pCar.rearWheels.y = pCar.y - lWheelBase / 2 * sin(pCar.rotation);

    // Move the vehicle
    pCar.rearWheels.x += pCar.speed * delta * cos(pCar.rotation);
    pCar.rearWheels.y += pCar.speed * delta * sin(pCar.rotation);

    pCar.frontWheels.x += pCar.speed * delta * cos(pCar.rotation + pCar.steerAngle);
    pCar.frontWheels.y += pCar.speed * delta * sin(pCar.rotation + pCar.steerAngle);

    // Extrapolate the new car location
    pCar.x = (pCar.frontWheels.x + pCar.rearWheels.x) / 2;
    pCar.y = (pCar.frontWheels.y + pCar.rearWheels.y) / 2;

    // update the vehicle heading
    pCar.rotation = atan2(pCar.frontWheels.y - pCar.rearWheels.y, pCar.frontWheels.x - pCar.rearWheels.x);

}

sentences:
Hotkeys to toggle draw-view in Unity Using Unity (2109.1.3f1) is there a way to switch the scene view's Shading Mode/Draw Mode from Wireframe to Shaded?
(eg. press 4 for Wireframe, 5 for Shaded)

I've looked in the Shortcuts Editor, but "Wireframe" doesn't appear in any list of commands, and I don't see anything under the Scene Visibilty or Scene View Categories that look appropriate either.

The docs only describe how to toggle this through the Scene view control bar, but it seems silly that it wouldn't be possible to map that operation to a key combination.

sentences:
Online Multiplayer - cheating w/ delta time movement I'm making a multiplayer game with basic linear movement and interpolation. I've read gabriel's article about client-side prediction and server reconciliation and have tried applying it to my own. My server is supposed to be authoritative, but I am worried clients can still exploit the system.

The system works like this:

the client sends timestamped input to the server at 60hz
the server runs at 30hz. Each tick it applies all the input since last tick and uses a time delta calculated from the client side input packets to determine movement (e.g. entity.x += message.delta * speed). The server then sends a timestamped state back to all clients.
the client receives a timed state from the server and applies the "authoritative" positions.

My concern is with step #2. Because player movement relies on the client's delta time, I'm afraid they can cheat by sending a "fake delta time" to the server and additionaly spam input messages quicker to make them move faster in-game. If I remove the delta time altogether, the game will appear "jumpy". How can I resolve this issue?

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:
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:
Curved Meters and Gauges I'm wondering how people here on GameDev stack exchange would handle curved meter GUI elements for things such as life bars or energy bars.

My thought on the matter was that you could use a shader with a cutoff value and an image which has one channel dedicated to masking the image (alpha) and one that also has a gradient which I compare to a uniform float to determine whether or not the fragment should be fully transparent.

However, I've been running into some strange behavior when writing this shader. Specifically, the shader's output has a weird artifact where the cutoff begins that looks almost like ripped paper -- the line that indicates the end of the meter has a sloppy contour.

This image has some distortion effect going on with the pixels where the lifebar is supposed to end via the cutoff uniform. There's definitely got to be a better way of doing this same thing in a more tactful way. Shader code is below:

   CGPROGRAM
   #pragma vertex vert
   #pragma fragment frag

        sampler2D _MainTex;
        float4 _Color;
        float _Cutoff;

        struct Vert_IN {
            float4 loc : POSITION;
            float4 texcoords : TEXCOORD0;
        };

        struct Frag_IN
        {
            float4 pos : SV_POSITION;
            float4 uv : TEXCOORD0;
        };

        Frag_IN vert( Vert_IN input )
        {
            Frag_IN output;
            output.uv = input.texcoords;
            output.pos = mul( UNITY_MATRIX_MVP, input.loc );
            return output;
        }

        float4 frag( Frag_IN input ) : COLOR
        {
            float4 value = _Color;
            float4 valueFromMask = tex2D( _MainTex, input.uv.xy );

            value.w = valueFromMask.w;
            float desiredTransparency = step( valueFromMask.x, _Cutoff );
            value.w = min( value.w, desiredTransparency );

            return value;
        }

        ENDCG

(Again, the red channel of this image is actually a gradient mask used to determine where the cutoff point should be. Other channels were going to be used for something else (like special scrolling patterns or what not) )

Example of the asset used in the shader:

I'm assuming there's probably something I'm missing when using the step function that could help ease the fade-dropoff in order to make a better looking end result?

What do you think is a good method for making curved meter GUI elements? Is there something wrong with the shader code presented above that causes this strange page tearing artifact?

sentences:
Add singleton to an existing gameobject in Unity via script I did notice that if I assign scripts that generate singleton classes (for my managers), to an empty game object, everything works fine.

Now I would like to start the scene with the empty game object, attach the main game manager singleton, and in the game manager singleton I would like to attach to it the other manager singleton classes.

Although I am not sure how you actually do so. Do you run addComponent to the main game manager, and they will be attached to the existing gameobject?

The gameobject that I use for the main gamemanager is set to not be destroyed on load; the doubt is if I should run addComponent on the scripts, or create a reference from the gamemanager script and instantiate it from there.

I did look for examples on the subject, but the only thing that I found is the reference to add a script to a game object; and I am not sure if that's actually what is supposed to be done.

sentences: Cause a projectile to wait at the position initially fired for a second before flying off I want to have a projectile that the character fires stay in the same place for a second or two before flying off in the direction of the mouse at the initial time of fire. The character can move away from the projectile after firing it, and the projectile wont move till after the time has passed.

sentences:
Object-oriented Snake game design I'm going to make a snake remake with SDL library and right now I'm thinking heavily about the object-oriented design.

I can imagine that I will have classes like GameEngine, Snake, Board and Food, but the interesting part is - how shall they interact between each other? How shall the game logic be designed?

For example, let's imagine here are some of the possibilities:

Every class except of GameEngine will hold only it's data (position of snake, food, etc.). All the game logic will be done in engine's Update() function. Therefore this function will be very big and every other part of the program fairly small.
GameEngine will only call appropriate functions of every object with the reference to Board and these individual functions will take care about the game logic.
something other

So I would like to know your opinion - what approach do you think is the best? I'm not aiming at low number of lines the game will have, but at the quality and "modularity" of the game object design.

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:
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:
Unity error converting quaternion to euler rotation When I try to run my game in unity, it comes up with the error:

No appropriate version of 'UnityEngine.Quaternion.Euler' for the argument list '(UnityEngine.Quaternion)' was found.

When using the update code in (written in javascript):

transform.Rotate(Quaternion.Euler(transform.rotation * Quaternion.Inverse(GameObject.Find("Main Camera").transform.rotation)));

Any help would be appreciated.

sentences:
Best practices for labeling game versions? Does anyone know if there's a best practice for labeling game versions.

I'm not sure if there's a standard name for it other than versioning but what I mean is basically:

1.0
1.1
1.2
1.3.1 beta

sentences:
Blender assets management and workflow for Unity project I'm trying to decide how to manage my 3D assets, and even how I should construct a world for my game.

I should maybe explain, my game is basically a single explorable world set in a school. It's quite large. Every room and building enterable (possibly transitionless), and a large outdoor area (sports field, playground, etc.)
I plan to make much of it modular (walls, floors, etc.)
The world is somewhat tiled. I've create several different blocks for walls (Straight, cornered, T shaped, cross shaped, door, etc.) which I can place sequentially to create rooms and buildings.
I have some blocks lined up in a row in Blender. Now I'm wondering what to do with these pieces...

Issue 1)

Should I use Unity to place my assets to create my world, or do I create another blender file with all my assets linked?
I'm tending towards the latter because I feel I can do a lot more within Blender, but it doesn't appear very easy.
However in order for the game to function I'd imagine I'd have to cut up my world into pieces.
Problematically I'd also like to use Unity's terrain tool, so if I'm creating a single world object in Blender I'm not sure how I'd do this.

Issue 2)

I'm not very experienced in 3D game development, I've mainly worked with Flash up until recently.
In Flash, you can create movieclips which nest other movieclips. Preferablly I'd like a system as close to this as possible within Blender or Unity.

So for instance, I'd like to have a 3D asset of a table.
Without affecting the original asset, I want to place objects on the table like books and whatnot, and then control this as a single instance called 'Table with books', maybe duplicate it elsewhere, if I change the position of the books on one it should update all other instances.

In Blender, I use alt+D to duplicate an object and link it to the original, however it's very easy to duplicate an object without selecting it's children and creating a variety of differently childrened duplicates, which in a vast world which is hard to keep track of, would become a massive headache to deal with.
I can just imagine spending hours upon hours correcting a single silly mistake I produced and repeated without noticing for several days.

Within Blender I've tried making each wall object it's own group, however they're all in one file and have different xyz positions. I don't want to separate them into dfferent files, in order to create seamless walls I need to have them all in one place. When I create a group instance with shift+A, the origin is of the original group object's xyz position:

I know there's an offset option in the groups panel where I could set it to -2,4,0 to counteract this but I don't like this at all. If I move 10 original grouped objects I have to update each of their offsets! I suppose I could create an empty axis for each wall object, but this also seems an odd way of doing things.

Issue 3)

Walls are 2 sided objects, the design of one could be different on either side, one could be pink on one side with a skirting board, the other side could be exposed brick work. How would I do this?
Lets say I use Unity to position all my assets (which I'm now assuming is probably the right way), ideally I'd like to select a load of walls faces and change their design with a combo box of styles and a color picker in the inspector (a script would be necessary obviously).

Sorry, that's a lot of questions for a single post, I hope someone can point me in the right direction.

sentences:
Grid of buttons in Unity - button bounds are stretching beyond their visuals, capturing clicks meant for other buttons I am using unity UI for the first time and trying to create a level selection menu just like Angry Birds.

I had successfully created the dynamic level selection menu. It was all good in the inspector but when I build and run it, something strange happens: when I click on the first button of the first row, instead of that button, the last button of that row got clicked.

I searched and found that the image was not stretching (because of preserve aspect property checked) but the bounds were stretching with the resolution so the bounds were overlaping and the wrong button was getting clicked.

There is a panel which is child of the canvas gameObject.
Buttons are child of panel gameObject.
Panel's anchors are set to stretch the canvas.
Buttons' anchors are set to stretch the panel.

Here is the code to create menu dynamically.

public class UITest : MonoBehaviour
{

    public Button button;
    public RectTransform parent;

    void Start()
    {
        SetupButtons();
    }

    void SetupButtons()
    {
        float x = -155;
        float y = 55;

        for(int i=1; i<15; i++)
        {
            var I = i;
            var btn = Instantiate(button) as Button;
            var btnRect = btn.GetComponent<RectTransform>();

            float width = btnRect.rect.width/5;
            float height = btnRect.rect.height/5;

            btn.transform.SetParent(parent, false);
            btnRect.anchoredPosition = new Vector2(x, y);
            btn.onClick.AddListener(() => Temp(btn, I));

            if(i%5 == 0)
            {
                y += (height);
                x = -155f;
            }

            else
            {
                x += -width;
            }

            //Debug.Log(width +", " + height);
        }
    }

    void Temp(Button btn, int i)
    {
        //Debug.Log("Clicked: " + i);
        Debug.Log(btn.GetComponent<RectTransform>().anchoredPosition + " " + btn.GetComponent<RectTransform>().rect);
    }
}

Here are some screenshots to better understand the problem.

I hope you guys have understood the problem please help me solve the problem.

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:
How do I make a rainbow hue shift over time on text? What I'm trying to do is make a Text object have an animation that allows for the hue of the color to go all the way up and loop back around, so it creates a cool rainbow thing.
I've looked on google for a solution but the solution I found only worked in older versions of Unity, which were used back in 2015.  What I found
Any help would be appreciated!

sentences:
Does my conditional statement contain a syntax error? C++ I am not entirely new to coding, but I am new to C++. I receive the error below often, but find that it comes due to some sort of syntax error (using a minus sign instead of an equal sign, or misspelling a variable name I've already declared elsewhere), but I can't seem to find what's wrong with my most recent error:

And here's the code itself:

void ARCCharacter::Raycast()
{
  FHitResult* HitResult = new FHitResult();
  FVector StartTrace = FirstPersonCameraComponent->GetForwardVector();
  FVector EndTrace = (StartTrace* 5000.f) + StartTrace;
  FCollisionQueryParams* CQP = new FCollisionQueryParams();

  if(GetWorld()->LineTraceSingleByChannel(*HitResult, StartTrace, EndTrace, ECC_Visibility, *CQP))
  {

    DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255, 0, 0) true);

    if(HitResult->GetActor() != NULL)
    {
        HitResult->GetActor()->Destroy();
    }

 }

}

Also, I'm following along with a tutorial, so I'm not sure where my code diverges from the teacher's: link. I'm using XCode to work with C++ in the UE4 editor, and while I'm sure there's a simple solution to this problem, I'd like to learn about common errors beginners may encounter so I can understand the language.

sentences:
Large gap between the grabbed game object and controller When i grab a gameobject, there is a gap between them. I have tried changing the scale of the colliders, tool handle position from global to pivot but nothing worked for me. Should i reset the pivot points of model in 3D modeller and reimport it again or is there another way to solve this?

I have attached few screenshot related to the problem

sentences:
Is it possible to somehow change the collider points to match sprites during the animation in Unity? Is it possible to somehow change the collider points to match sprites during the animation in Unity?
I am using the Unity built in animtion recording feature. I would like to change the points of some of my colliders as animation goes, while at the same time I am changing the respective sprites. I was not able to find any solutions so far.
Any ideas how I could do that?
I have a few attempts to overcome the problem.

Create a few game objects with the different preset points for the colliders. The solution will work. But it is crazy hard to develop and maintain resources wise. I will have to spend an immense amount of time creating a separate game object with a collider for each frame. And also the maintenance will be very lame. Because I will need to add a wrapper around all the places where I access collider. So that the wrapper would return the currently enabled collider.

I can buy the 2DColliderGen. But I do not want to spend money on that. And also it is not completely what I am looking for, because even with it I will have significant difficulties developing my animations, maintaining my game and extending it.

sentences:
What's a viable way to get public properties from child objects? I have a GameObject (RoomOrganizer in the picture below) with a "RoomManager" script, and one or more child objects, each with a 'HasParallelagram' component attached, likeso:

I've also got the following in the aforementioned "RoomManager"

void Awake ()
{
    Rect tempRect;
    HasParallelogram tempsc;

    foreach (Transform child in transform)
    {
        try
        {
            tempsc = child.GetComponent<HasParallelogram>();
            tempRect = tempsc.myRect;

            blockedZoneList.Add(new Parallelogram(tempRect));
            Debug.Log(tempRect.ToString());
        }
        catch( System.NullReferenceException)
        {
            Debug.Log("Null Reference Caught");
        }
    }
}

HasParallelgram is an empty script with a public Rect set in the editor and nothing else.

Unfortunately, attempting to assign tempRect = tempsc.myRect causes a null pointer at run time.

I've done some more digging, and the reason for the null pointer is relatively simple - the RoomManager script gets woken ("Awake") before the HasParallelagram script gets instantiated ("Start").

It's an issue of timing - I need to wait until all objects have been instantiated before calling the RoomManager. Does Unity support a means of doing that?

What's the proper way to get a child's component?

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:
Missing colors in Collada export from Blender I've noticed something strange in a Collada DAE export from Blender. I've assigned Diffuse BDSF colors to 4 faces of a cube as shown here:

http://www.4shared.com/photo/_hM04zywba/blendcube.html

It renders fine in Blender but after exporting to the following DAE file the diffuse and ambient color's RGB values stay the same for all materials. Shouldn't each material block in DAE have different values? Do I need to do something more in Blender to save the material info?

http://www.4shared.com/file/KdzuIwWGce/matcube.html

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 to express and verify euler rotation limits in Unity I need to find a way to set min and max angles for each Euler component and check whether transform.localEulerAngles falls within those limits.

My current code looks like this:

class JointLimit : MonoBehaviour
{
    [SerializeField]
    [Range(-180f, 180f)]
    private float minX = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxX = 180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float minY = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxY = 180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float minZ = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxZ = 180f;

    public float Error
    {
        get
        {
            Vector3 localEuler = transform.localEulerAngles;
            Vector3 signedLocalEuler = new Vector3(Mathf.DeltaAngle(localEuler.x, 0), Mathf.DeltaAngle(localEuler.y, 0), Mathf.DeltaAngle(localEuler.z, 0));

            float error = 0;
            error += Mathf.Max(0, minX - signedLocalEuler.x);
            error += Mathf.Max(0, signedLocalEuler.x - maxX);
            error += Mathf.Max(0, minY - signedLocalEuler.y);
            error += Mathf.Max(0, signedLocalEuler.y - maxY);
            error += Mathf.Max(0, minZ - signedLocalEuler.z);
            error += Mathf.Max(0, signedLocalEuler.z - maxZ);
            return error;
        }
    }
}

This basically checks whether the Euler components fall within the specified range and sums the exceeding angles up to an error.

The problem is that Unity internally stores rotations as Quaternions and that there can be several euler representations for a single Quaternion, like Euler 123f, 17f, 235f and Euler 57f, 197f, 55f are the same thing.

Is there any way I can bring an Euler representation into some kind of normalized form that allows me to reliably check it against my limits?

sentences:
Find out hit child with RaycastHit Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):

RaycastHit2D newSelectedObject = Physics2D.Raycast(cameraVector, Vector2.zero);

Now I'd like to find out if the head, body or feet was hit. How can I do that?

sentences:
Difference between the terms Material & Effect I'm making an effect system right now (I think, because it may be a material system... or both!). The effects system follows the common (e.g. COLLADA, DirectX) effect framework abstraction of Effects have Techniques, Techniques have Passes, Passes have States & Shader Programs.

An effect, according to COLLADA, defines the equations necessary for the visual appearance of geometry and screen-space image processing. Keeping with the abstraction, effects contain techniques.

Each effect can contain one or many techniques (i.e. ways to generate the effect), each of which describes a different method for rendering that effect. The technique could be relate to quality (e.g. high precision, high LOD, etc.), or in-game-situation (e.g. night/day, power-up-mode, etc.). Techniques hold a description of the textures, samplers, shaders, parameters, & passes necessary for rendering this effect using one method.

Some algorithms require several passes to render the effect. Pipeline descriptions are broken into an ordered collection of Pass objects. A pass provides a static declaration of all the render states, shaders, & settings for "one rendering pipeline" (i.e. one pass).

Meshes usually contain a series of materials that define the model. According to the COLLADA spec (again), a material instantiates an effect, fills its parameters with values, & selects a technique. But I see material defined differently in other places, such as just the Lambert, Blinn, Phong "material types/shaded surfaces", or as Metal, Plastic, Wood, etc.

In game dev forums, people often talk about implementing a "material/effect system". Is the material not an instance of an effect? Ergo, if I had effect objects, stored in a collection, & each effect instance object with there own parameter setting, then there is no need for the concept of a material... Or am I interpreting it wrong?

Please help by contributing your interpretations as I want to be clear on a distinction (if any), & don't want to miss out on the concept of a material if it should be implemented to follow the abstraction of the DirectX FX framework & COLLADA definitions closely.

sentences:
Collision, triggering, and range detection in an RTS. What are the optimal solutions for unit spatial awareness? I've finally ran into the problem of multiple triggers and collisions within my 2D RTS. Up till now I've been using unities sphere colliders as a way of simulating spatial awareness. To trigger when objects have entered and exited a specific area around a unit or building so that they can be appropriately targeted.

This became a performance problem when I started having hundreds of colldiers overlapping each other. Since the units are aware of projectiles as well as other units/buildings, this becomes very expensive very fast. I've found that I can only manage to have a couple hundred projectiles and about 100 colliders within close proximity of each other before the game slows to a crawl just from PhysX. (hundreds of projectiles entering and exiting 100 collliders all the time)

I did some research and found spatial partitioning mentioned all over the place. Is this a solution to the problem I am currently presented with? Are there other solutions for objects to have spatial awareness of potentially hundreds of other objects at a time without bringing my CPU to it's knees?

sentences:
Unity 5 - Manually zooming/scaling in and out of an image with a text layer while still retaining text sharpness when zoomed? I have a section in my scene where I have an image on a layer, as a child of this layer I have a load of text objects.
I need the ability to zoom in and out of the image (it's a technical drawing, so necessary to zoom in and out), so I have set up a simple Scale of the image itself (via Playmaker) and applied the zoom in to a button and the zoom out to another button.
When zoomed out, the image Scale is set to the default 1 and when zoomed in it goes to Scale 3.
It works perfectly.
I have also added a 'Scroll Rect' to the parent canvas, this enables me to click and scroll around the image when it is zoomed in - this also works perfectly.

However the main problem I have is that while the image looks fine zoomed in (the original image is a large size, so looks fine even when scaled up to Scale 3) - the text does not look good when scaled.
It is essentially just 'zooming' in on the text and therefore the bigger it gets, the worse it looks.

Text is set to 'Best Fit' - it has to be this way due to the fact I have dynamic translations on the text, so the text needs to stay within its specified area and shrink if necessary.

Ideally I would like the text size to scale in line with the image scale  - ie. if the text is size 10 when zoomed out, then it should be size 30 when zoomed x3 (as opposed to a scaled size 10) - is this possible?
The text must stay in the exact same position relative to the image, as text is placed at specific points on the drawing.
The text also needs to be able to be scrolled in exact line with the image (hence why I have it as a child of it, so it follows nicely).

Canvas is set to 'Screen Space - Overlay' with 'Scale with Screen Size' and 'height' at 1 (works perfectly across the game like this).

Screenshots attached...

Canvas

Text

Any help would be appreciated.

Thanks in advance

Unity 5.3.5
PC/Mac Standalone only

sentences:
How to animate the sprite along with action in Cocos2d? Cocos2d-android - I have an animation which has 5 Frames they are close cropped images. Now I want Sprite to do animation as well as Move in X direction.i.e. I have a player running which gets collided with obstacle and falls down .. Now I want sprite to run animation as well as moveBy in -ve x direction

gameOverAnimation =CCSprite.sprite("gmovr00")
gameOverAnimation.setAnchorPoint(0, 0);
gameOverAnimation.setPosition(340.0f, 200.0f);
addChild(gameOverAnimation,10);
CCIntervalAction action1 = CCAnimate.action(mEndAnimation, false);
action1.setDuration(1.0f);
CCIntervalAction delay = CCDelayTime.action(0.68f);
CCMoveBy actionBy = CCMoveBy.action(1.0f, CGPoint.ccp(-340,0));
CCIntervalAction seq1 = CCSpawn.actions(action1,actionBy);
//CCSpawn spawn = CCSpawn.actions(action1, actionBy);
                CCSequence sequence1 = CCSequence.actions(seq1,CCCallFuncN.action(this,"gameOver"));
                gameOverAnimation.runAction(sequence1);

Above code makes animation run first then moved in y direction

Thanks for the help..
And can some one explaing me the concept of time with frame Animation or good example ?

sentences: What would be a good Facebook credits price point for a puzzle game on Facebook? I have a successful puzzle game and I'm thinking about doing a new version and bringing that new version to FB, and selling it using FB credits. Does anyone have ideas on what the FB credits price point should be? I have some idea, and obviously I know what some of the virtual goods price points are, but I'm curious what peoples views would be on a price point for an entire game, and if the availability of free facebook credits could hurt sells etc.

sentences:
Market as a single game or as a studio? I'm creating an RPG with a theme of a hero that must restore peace to a world fallen to evil forces. It serves as an educational tool.

I'm creating a promotional website for it and using other online social tools for marketing.

I only have one focus: to make this game as great as possible for people to learn. I've seen some companies that market themselves as their product name, like DuoLingo, and some that market as the studio, such as Strawberry Games.

I don't have a game studio and have simply been marketing (FB page, website URL, etc) as the game's name, Lexicana's Destiny.

Does it really matter which way I market it? If so, why?

sentences:
How do I lock drawn lines to be orthogonal to an existing one? I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to be orthogonal, as opposed to being free-drawn?

I can detect the swipe's direction with atan2 and the difference of X and Y, but I am having trouble determining the pivot points of the line. How can I determine when the line should make a turn?

You can see what I am trying to accomplish in this video of Volfied gameplay.

sentences:
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:
Insert 3d text to the front face of a cube GameObject I want to add a text to a cube in Unity.

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

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

var countdown : int = 200;

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

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

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

My last failed try was to use the below lines:

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

Any ideas?

sentences:
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:
Why does the Texture placement of my CCSprite slightly shift when changing it's location? So I've been seeing this issue for a while now. When using a delta method to change the location of a CCSprite, the placement of texture of my sprite slightly moves into the direction where I'm headed, while the physicsbody stays the same. This is really noticeable, since I'm using CCActionFollow to center this sprite in the view at all times. The code is displayed below. Is this normal behaviour, or am I perhaps overlooking something really obvious? Thanks!

- (void) move:(CCTime)delta toPosition:(CGPoint)point
{
OverworldScene * parentScene = (OverworldScene *)self.parent.parent.parent; //Go over physics node
OverworldLayer * parentLayer = (OverworldLayer *)self.parent.parent; //Go over physics node

//meewind of tegenwind?
float angleWind = parentScene.compass.rotation;
float angleShip = self.rotation;
float difference;
float windFactor;

if (angleWind > angleShip)
{difference = angleWind - angleShip;}
else{difference = angleShip - angleWind;}

if (difference > 180)
{difference = 360 - difference;}

//Incorporate wind power...
if (difference > 90)
{   //Tegenwind
    windFactor = 1-((((90- (180 - difference))/90))*(parentLayer.windPower/12));
}
else
{   //Meewind
    windFactor = 1+((((90-difference)/90))*(parentLayer.windPower/12));
}

if (windFactor < 0.4){windFactor = 0.4;}

//point is the current position of the user's sprite
//a, b and c are the right triangle sides lengths formed by the caser sprite and the user's sprite positions
float a = ABS(self.position.y - point.y);
float b = ABS(self.position.x - point.x);
float c = sqrt(pow(a, 2) + pow(b, 2));

//angle of the hypotenuse
float beta_rad = asin(b/c);

//velocity in pixels per second (used to be 60)
c = 60 * self.velocityFactor * windFactor;    //Now accounts for windfactor!
parentScene.speedLabel.string = [NSString stringWithFormat:@"Speed %.1f knots", self.velocityFactor * (60*windFactor)/8];

//x-axis velocity component
float x = c * sin(beta_rad);
//y-axis velocity component
float y = c * cos(beta_rad);

//adjustments based on position of the this (chaser) sprite and the user's sprite, if chaser is on the right or below the user's sprite it is needed to reverse the velocity vector component x and y
if (self.position.x > point.x) x *= -1;
if (self.position.y > point.y) y *= -1;

//final velocity vector
CGPoint velocityVector = CGPointMake(x, y);
CGPoint newPosition = ccpAdd(self.position, ccpMult(velocityVector, delta));

//NSLog(@"Updating position: %@", NSStringFromCGPoint(newPosition));

//Only update in case new position is in bounds
if (newPosition.x < 0 || newPosition.x > parentLayer.contentSize.width)
{
    newPosition = CGPointMake(self.position.x, newPosition.y);
}

if (newPosition.y < 0 || newPosition.y > parentLayer.contentSize.height)
{
    newPosition = CGPointMake(newPosition.x, self.position.y);
}

self.position = newPosition;

}

sentences:
What are the drawbacks of this messaging system implementation? So I've just been thinking about component and messaging systems recently for simple C# XNA games and came up with this. How extensible would this implementation be and what are the drawbacks? Example below:

Score

class Score
{
    public int PlayerScore { get; set; }

    public Score()
    {
        EnemySpaceship.Death += new EventHandler<SpaceshipDeathEventArgs>(Spaceship_Death);
    }

    private void Spaceship_Death(object sender, SpaceshipDeathEventArgs e)
    {
        PlayerScore += e.Points;
    }
}

EnemySpaceship

class EnemySpaceship
{
    public static event EventHandler<SpaceshipDeathEventArgs> Death;

    public void Kill()
    {
        OnDeath();
    }

    protected virtual void OnDeath()
    {
        if (Death != null)
        {
            Death(this, new SpaceshipDeathEventArgs(50));
        }
    }
}

SpaceshipDeathEventArgs

class SpaceshipDeathEventArgs : EventArgs
{
    public int Points { get; private set; }

    internal SpaceshipDeathEventArgs(int points)
    {
        Points = points;
    }
}

Basically, the idea uses the built in events system in C#. When something interesting happens to an object, it raises a static event. Then, anything else in the game that wants to know when that happens subscribes to that static event and does something in response. In this case, the Score class subscribes to the static Death event of a Spaceship and when it dies, it uses the EventArgs to adjust the score accordingly.

Would this kind of architecture start to crumble and get quite confusing as the development of the game progressed? Thanks for reading.

sentences:
Different types of smooth object movement In a game I have a specific object and two positions the object will move from and to.
I already have the function for calculating current position in specific time.

It works like this:

Inputting 0 will move the object to Position 1.

Inputting 1 will move the object to Position 2.

Inputting 0.5 will move the object in the middle of the two positions.

etc...

(In the examples below, time is varying from 0 to 1)
When I want to start the object slowly and stop it when it is moving fast, I use:

MoveObject(sin(time * 90))

When I want to start the object fast and stop it as it is getting slower, I use:

MoveObject(1 - cos(time * 90))

Without the effects, it's:

MoveObject(time)

How do I make the object start moving slowly, move fast in the center of two positions and then get slower while reaching the second position?

sentences:
How to decide sprite size for isometric tile textures? When I draw these textures on screen, I put them in a sprite and specify a width and height to draw the sprites in like this:
new Sprite({
  width: 10,
  height: 10,
  texture: greenTileTexture
});

This draws the sprite at size 10x10 on screen. Let's say I want to have tile size of 10. I use this:
// This is the size of the textures as in png.
let textureWidth = greenTileTexture.width;
let textureHeight = greenTileTexture.height;
let textureRatio = textureWidth / textureHeight;

// This is the size that draws on screen.
let spriteWidth = 10;
let spriteHeight = 10 / textureRatio;

Now for the 3x2 tile I don't know what the width should be since it takes more tiles.
I want to draw isometric tiles with arbitrary tile sizes. For example above picture there are 1x1 and 3x2 sized tiles.
The textures have arbitrary height because of decoration. a is the tile's height b is texture's height c is tile's width.
I can't figure out what the sprite size should be when I lay these out on screen.
Maybe I should have exact tile sizes cover the whole texture without decorations (a == b). But still what the sprite size should be?

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:
Get object length and width divided by two? I have googled and found a script for the following task; Make the camera move to touched position. However, this script will jump to x and y positions on an object, while i would like for it to move to the middle of the object, and then only be able to jump to others.

using UnityEngine;
using System.Collections;

public class TapToMove : MonoBehaviour
{
    // flag to check if the user has tapped / clicked.
    // Set to true on click. Reset to false on reaching destination
    private bool flagTouchCoords = false;
    // destination point
    private Vector3 cameraDestination;
    // alter this to change the speed of the movement of player / gameobject
    public float duration = 100.0f;
    // vertical position of the gameobject
    private float yAxis;

    void Start()
    {
        // save the y axis value of gameobject
        yAxis = gameObject.transform.position.z;
    }

    // Update is called once per frame
    void Update()
    {
        // check if the screen is touched / clicked
        if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        || (Input.GetMouseButtonDown(0)))
        {
            // declare a variable of RaycastHit struct
            RaycastHit hit;
            // Create a Ray on the tapped / clicked position
            Ray ray;
            // for unity editor
            #if UNITY_EDITOR
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            // for touch device
            #elif (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8)
            ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
            #endif

            // Check if the ray hits any collider
            if (Physics.Raycast(ray, out hit))
            {
                // set a flag to indicate to move the gameobject
                flagTouchCoords = true;
                // save the click / tap position
                cameraDestination = hit.point;
                // as we do not want to change the y axis value based on touch position, reset it to original y axis value
                cameraDestination.z = yAxis;
                Debug.Log(cameraDestination);
            }
        }

        // check if the flag for movement is true and the current gameobject position is not same as the clicked / tapped position
        if (flagTouchCoords
        && !Mathf.Approximately(gameObject.transform.position.magnitude, cameraDestination.magnitude))
        {
            // && !(V3Equal(transform.position, endPoint))){
            // move the gameobject to the desired position
            gameObject.transform.position =
                Vector3.Lerp(gameObject.transform.position,
                             cameraDestination,
                             1 / (duration * (Vector3.Distance(gameObject.transform.position, cameraDestination))));
        }
    }
}

So this is how the game looks. The script moves correctly, but will jump at different positions when it hits the collider on the lily pads. I could reduce the collider, but I feel like there should be an easy way to get length and width of a collider, and reduce it by /2 to make the camera move directly in the middle.

Anyone care to help? Thanks in advance. :)

sentences:
Programmatically Modifying Images to Create Morning, Sunrise/Sunset and Night-Time Modes I'm using RPG-Maker-XP-like sprites (any 2D adventure/RPG style sprites). I would like to tint them so that they look different at different times of day.

Times of the day are the set of:

Daytime (normal)
Early morning (bluish?)
Sunrise and Sunset (orangish?)
Night time (dark)

What do I need to do to tint them, and make them look good, during different times of the day? Are there any "known" formulas for any of these times, like "delete the green blue component and tint heavily red+green for a sunrise effect"?

Ideally, I have just the original sprites, with no additional information or images (like spot-highlights or shadows separated out).

Finally, I'm using Silverlight/FlatRedBall for this, so I do have access to per-pixel information, as well as RGB tinting (adding, subtracting, multiplying, etc.)

sentences:
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: Creating map files for a 3D game I've created plenty of 2D games and now that I've gotten my hands dirty working with 3D in opengl I want to start a game. The issue is I don't know how I can store all the map data. Not only the terrain but the textures and objects in the world, lighting, what's intractable etc. it seems that it'll get way to big if I don't have an efficient system for storing and loading maps. So what methods or articles can you guys suggest on this?

sentences:
How do I run an APK in a device from the Unity IDE without rebuilding the binary? I know that the button Build creates the APK in my disk.

And the button Build and Run creates it and sends it to a real device if connected via USB.

Question:

Is there any way to "Run" from the Unity IDE an APK in a physical device without having to re-build it (provided you properly built it a few minutes ago, for example?)

sentences:
Rotation of objects from different axes in Flash AS3 In my game, I have made 4 lines with different colors to form a square but the colored lines are different objects. I want to rotate the lines in a way that the lines will still form a square. Eg:

But I'm only able to rotate them on the central axis, so, it forms a cross:

The code for leftPressed is:

if(leftPressed)
{
black.rotation -= 90;
blue.rotation -= 90;
yellow.rotation -= 90;
red.rotation -= 90;
}

So, I need to know how to rotate objects on different axes.

sentences:
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 can I rumble/vibrate my controller with libGDX? The com.badlogic.gdx.controllers.Controllers API only supports getting the input data (which works fine).

Is there a way to make my controller rumble/vibrate, possibly using some other classes?

I tried using the org.lwjgl.input.Controllers class, which supports this, but the controllers don't get indexed there and I can not access them.

sentences:
From 3d rotation, snap to nearest 90 directions I have a 4x4 transformation matrix, made only from successive rotations and translations, and I'd like to "snap" my object to the "nearest" of the 24 orthogonal (multiples of 90 degree) rotations.

I'm not sure how to think of the problem. Round each element of the upper 3x3 matrix to -1, 0, and +1 (cutting at .707)? I am pretty sure that would be too good to be true. Another possibility would be to convert to axis-and-rotation or quaternion, but would that make it simpler somehow? I'm not fluent in those manipulations.

Any guidance most welcome!

sentences:
How do I find a point given an angle and distance to it? I'm working on a school project creating a tank team in the programming game Robocode. (It's a tank battle game with self-programmed bots, in Java).

I'm programming a scout bot that scans, finds enemies and reports them to the commander bot. I only have the distance and angle to the scanned enemy bot. How can I find its X,Y-position using only these known variables?

Here's a diagram:

sentences:
Clay Jam continuous path/tap I saw this game Clay Jam, that the user can create a path in the sand. The path is a continuous one, and it can varies from a single point to curves.

How one can develop smooth and continuous paths?

sentences:
How to do in Godot 2D: game screen in one viewport and minimap in another. Different sprites on each The second day I google the tutorials, but nothing comes of it. All tutorials link to splitscreen demo, but it is made under the second Godot and does not work in the third.

The problem is this: I want to render the world in the main viewport and its simplified view on the minimap in another viewport using two different cameras.

In the main viewport the main AnimatedSprite node of objects should be rendered, and on the minimap there are only additional Sprite node of objects with their schematic view.

Tried to do:

Node2D
-ViewportContainer
--ViewportMain
--- Camera2D
--- World
----Player
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
----OtherObjects
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
-ViewportContainer
--ViewportMinimap
--- Camera2D

In code I assign main viewport's world to minimap's viewport:

$ ViewportMinimap.world = $ ViewportMain.world

For the main AnimatedSprite I set Light Layer #1, for the sketchy Sprite I set Light Layer #2.

And it does not work.

Firstly, nothing is displayed on the minimap. I don’t understand how to make it work. How to tell minimap's viewport to use the world from main viewport?

Secondly, I can’t find anywhere how to set the camera which Light Layer it has to display (in the three-dimensional Camera there is a Cull Layer parameter, but I don’t see it here).

Will this approach hit performance?

How to correctly implement minimap without need to modify it when you add new object to game?

How to correctly replace scenes when player moves from one to another if it child of the Viewport?

sentences:
Is it more efficient to encode rotation in a spritesheet or rotate at runtime? I'm developing a game with JavaScript and HTML5 and I'm wondering about the performance implications of sprite rotations. There are two ways that I know to rotate a sprite:

Rotate the actual sprite based on its rotational speed and velocity, as it travels along it's trajectory.
Pre-compute the rotations and store them as frames within the sprite sheet to give the illusion that it's spinning when it isn't.

On one hand, I can see how rotating some sprites in a spritesheet would be efficient because it's one image that is loaded, split into frames, and re-used.  But on the other hand, I'm not sure the calculations involved for rotating the sprite based on its velocity and rotational speed are really anything for current browsers (on computers and mobile devices) to worry about.

In my game, the canvas area is 800 x 600, and the game is using 32 x 32 sprites for everything. The "map" isn't tile-based. Of the two options above, which would be more efficient for runtime performance?

sentences:
How do you exactly implement a Semi-Implicit Euler type of movement in a 2D platformer? So I've been following along Sebastian Lague's 2D platformer tutorial, and to understand exactly how
the physics of how a jump is done, I dug into the subject and noticed a lot of people, from GafferonGames and Kyle Pittman, all mention using Semi-Implicit Euler in making an accurate jump.

Now my problem is: How do you exactly implement this type of integration scheme in a game?

Specifically a platformer. A comment on the tutorial I was following said that the code below uses the Explicit Euler type of integration. Though I'm not exactly sure myself on whether or not this is true; another tutorial I found on the topic, specifically Jorge Rodriguez's Math for Game Developers  uses the Semi-Implicit Euler integration to make a spaceship simulator, but the code used was C++ and I only have some limited C# and I was not able to fully understand parts of the code that went into implementing the integration.

  Specifically:

          auto v = [vn, gravity](Vector x, float h) -> Vector
            {
                return vn + gravity(x) * h;
            };

            auto a = [xn, gravity](Vector v, float h) -> Vector
            {
                return gravity(xn) + gravity(xn + v*h) * h;
            };

from what I understand, this function returns a Vector2, but I don't know if the auto = a [xn, gravity] is supposed to be about declaring a variable or what, or how the -> vector bit fits in the whole code.

All in all, I need help, I'm still pretty new to programming and general and these small nuances confuse me. Any help is greatly appreciated, Thank you.

This is the code for the Platformer Character controller I followed from Sebastian Lague.

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

[RequireComponent (typeof(EntityController2D))]
public class PlayerController : MonoBehaviour
{
    EntityController2D playerController;

    #region Y-Velocity Fields
    public float jumpDisplacementDeltaTime = 0.75f;
    public float jumpHeight = 6.0f;

    float gravity;
    float jumpVelocity;

    #endregion

    float moveSpeed = 6.0f;

    Vector2 velocity;

    public void Start()
    {
        playerController = GetComponent<EntityController2D>();

        gravity = -(2 * jumpHeight) / Mathf.Pow(jumpDisplacementDeltaTime, 2);
        jumpVelocity = Mathf.Abs(gravity) * jumpDisplacementDeltaTime;

        print ($"Gravity: {gravity}");
    }

    // Update is called once per frame

    public void Update()
    {
        Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (playerController.collisions.below || playerController.collisions.above)
            {
            velocity.y = 0;
            }

        if (Input.GetKeyDown(KeyCode.Space) && playerController.collisions.below)
            {
            velocity.y = jumpVelocity;
            }

        velocity.x = input.x * moveSpeed;
        velocity.y += gravity * Time.deltaTime;
        playerController.Move(velocity * Time.deltaTime);
    }
}

sentences:
Advice regarding Unity hosted content I'm currently trying to build a mobile application that, for the purposes of trying to keep small in size, I would like to have store much of its content Online and be downloaded to the users mobile when the application requires it.

Ideally I'd like to do so not just as a means to reduce the applications original size, but also to allow new assets to be introduced over time (such as new objects and textures) without the user having to reinstall the application or download a new update.

I am at the moment researching into the use of Unitys Addressible Assets for these purposes, and am currently trying to test and implement this idea on a small scale using assets stored using Google Cloud storage.

If possible however I would like to to ask whether anyone here has any experience with storing and accessing assets on an external server, and if so, might they have any advice as to whether or not this could be a feasible solution for these purposes?

Any help would be really appreciated, as this is an area that is completely new to me.

Thanks in advance.

sentences:
When do I save the buffer data to the database? My entire game is server side and I use nodejs with mysql.

When players connect or join a game, their player data (Items, Stash, Quests, etc) all get stored into the memory buffer.

For example, if a player joins a game and there are 40 items on the floor and he decides to pick them all up, it's easier just to add that to their Inventory object instead of using a insert statement each time. Then, when that user disconnects I can save all that data respectively. (Now that I think of it, that query would run 40 insertion rows..)

That's the problem I have though, do I save the data during the looting process or wait until the player disconnects and run a db update to save their memory buffer (only the changed buffer) to the database?

The Issue I have with that is, if a player picks up over 40 items in the game, that's going to be a lot of sql insertions when they disconnect..

Imagine them finding a ton of items from mobs and having a huge amount of new updated buffer data that needs to be stored.. (after they disconnect), that would be a dreadful update. Especially if they stored hundreds of items in their stash or whatnot. Hmmm.

sentences:
How to write AI bots that can autoplay a shoot 'em up game? In a shoot 'em up game I want to have AI bots that can take up the player's slot and play the game (such as in this video). However they should come with different flavors (varying competency and playstyles). The problem is the related maths and AI programming are very new to me. Where should I start?

Suggestions for existing sample code/libraries/tools, reading materials or advice on architecture/algorithms are all welcome. Thanks in advance!

sentences:
Unity: How to get a GameObject programmatically? I have created a prefab.
In Unity Scene editor, I dragged the prefab into the scene and named it PrefabA (this is a GameObject instance of the Prefab).

Now, I need to update the PrefabA position.
How can I access the GameObject "PrefabA" during runtime via script?

GameObject prefab =  GameObject.Find("Canvas/PrefabA").GetComponent<GameObject>();

The code above throws Object reference not set to an instance of an object.

sentences:
Unity3D CrossPlatformInput StandardAsset Multitouch I have a small game I am working on, and I am trying to add touch support to it.  Before I try to add that into the real game I wanted to do a test run on a small project.  The project consists of a capsule to be the player, and the application accepts movement from a on screen joystick, and accepts a button click from a UI button.  The button triggers the attack, and the joystick triggers the movement.

Both of these controls work as designed but they will not work together, meaning I can do one or the other.  I was hoping to use the standard asset as to not re-invent the wheel for speed...

below is the code that "Should" be triggering when both controls are used, just as a note this same code works when I use mouse and keyboard together so this is something to do with the mobile stuff..

using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;

public class PlayerController : MonoBehaviour
{
    public float playerSpeed = 10f;
    Transform weapon;

    // Use this for initialization
    void Start ()
    {
        weapon = transform.FindChild("Weapon");
    }

    // Update is called once per frame
    void Update ()
    {
        DirectionalMovements();
        ButtonPresses();
    }

    void ButtonPresses()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))
        {
            weapon.GetComponent<Sword>().AttackOne();
        }
    }

    void DirectionalMovements()
    {
        float moveVertical = CrossPlatformInputManager.GetAxis("Vertical") * playerSpeed * Time.deltaTime;
        float moveHorizontal = CrossPlatformInputManager.GetAxis("Horizontal") * playerSpeed * Time.deltaTime;

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        transform.Translate(movement, Space.World);

        if (movement != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement.normalized), playerSpeed);
        }
    }
}

Any thoughts would be greatly appreciated.. I just do not see why both controls are not picked up here.

sentences: Do we really need quaternions? In UE4 I rotate without them I want to experience gimbal lock to be able to understand how it happens. In lots of videos it shows that when you rotate along one axis, other axis is also being rotated and you obtain gimbal lock. For example, as you can see in this video, https://www.youtube.com/watch?v=zc8b2Jo7mno the axis are hierarchical. But I don't see the same in UE4. When you rotate in Editor it always rotates around world coordinate system and you cannot obtain a lock. If I can rotate around world (fixed) coordinate system, why shouldn't we always use that and instead use quaternions? Or I miss something?  See all the videos that explain gimbal lock. They always rotate around one axis, while rotating other axis with it too. Why? And at this point, as I cannot obtain the lock, I think quaternions are useless if you rotate around world coordinate system and have 0 problem.

sentences:
Unity 2D collision detector not working I'm making a 2D sidescrolling game in Unity where the player shoots at obstacles while running. But nothing I try seems to get the collision detection to work. This is the obstacle script:

void onCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "circle")
                    Destroy (gameObject);
    }

the circle tag refers to the projectile being shot at the obstacle

sentences:
GPU Gems Chapter 1, update normal Had plans to follow GPU Gems to gain knowledge in Shaders - but my journey came to an abrupt end.

float Wave(x, y, t){
  float w = 2 / _Wavelength;
  float phase = _Speed * w;
  return float(_Amplitude * sin(dot(_Direction.xz, float2(x, y)) * w + t * phase);
}

...
o.vertex.y += Wave(v.vertex.x, v.vertex.z, _Time.y);

Offsetting the vertices was no issue, but then I met partial derivatives to solve the normal for each vertex. Starting at equation 4a to equation 7.

I assumed looking at equation 7 that one didn't have to fully grasp derivatives seeing as the last step

Equation 7:
$$\sum(w_i * D_i \cdot x * A_i * cos(D_i \cdot (x, y) * w_i + t * \varphi_i))$$

So I tried to update the normal (well actually color, but just to visualize) using this function;

float3 normal(float x, float y, float t){
  float w = 2 / _Wavelength;
  float phase = _Speed * w;
  return float3(
    w * dot(_Direction.xz, float2(x, 0)) * _Amplitude * cos(dot(_Direction.xz, float2(x, y)) * w + t * phase),
    1,
    w * dot(_Direction.xz, float2(0, y)) * _Amplitude * cos(dot(_Direction.xz, float2(x, y)) * w + t * phase)
  )
}

...
o.color.xyz = normalize(normal(v.vertex.x, v.vertex.z, _Time.y));

It does however not seem to display what I would describe as good normals for the wave surface. So obviously I'm doing something wrong.

Ignoring the green channel here using the full code pasted below.

Would expect the colors to blend more smoothly and uniformly. Seeing I only got one wave this far.

What I am wondering is how to get the normals one would expect or if this is the expected result following the math (or rather what I could make of it) in GPU Gems.

Note: I am attemping this in Unity, so I did adapt what I assumed to be Z-up to Y-up from the GPU Gem book.

Paste to current code

GPU Gems Chapter 1

sentences:
Unity3d vector and matrix operations I have the following three vectors:

posA: (1,2,3)
normal:   (0,1,0)
offset:   (2,3,1)

I want to get the vector representing the position which is offset in the direction of the normal from posA.

I know how to do this by cheating (not using matrix operations):

Vector3 result = new Vector3(posA.x + normal.x*offset.x
                             posA.y + normal.y*offset.y,
                             posA.z + normal.z*offset.z);

I know how to do this mathematically
Note: [] indicates a column vector, {} indicates a row vector

result = [1,2,3] + {2,3,1}*{[0,0,0],[0,1,0],[0,0,0]}

What I don't know is which is better to use and if it's the latter how do I do this in unity? I only know of 4x4 matrices in unity. I don't like the first option because you are instantiating a new vector instead of just modifying the original. Suggestions?

Note: by asking which is better, I am asking for a quantifiable reason, not just a preference.

sentences:
Unity 5.5 and Parse 1.7.0 on iOS 64-bit We are using Unity 5.5 and Parse 1.7.0 (and Firebase for notifications) which doesn't have "Parse.Unity.dll" and while on Editor everything is working fine but when we build using "IL2CPP" on iOS; while running on device the game produces an error of "MissingMethodException: No constructor found for Parse.Common.Internal.FlexibleListWrapper`2".

I think it's because of stripping, I've tried to include "Parse.Core" and "Parse.Common" in "link.xml" but still same error while I was looking for solutions I found that there's a file "Parse.Unity.dll" that should have been in the project from the start but when I try to include it in our project another error but this time in Unity Editor that says "System.Threading.Tasks.Task is defined multiple times" and that's because -I think- the new Parse.Unity.dll and Unity.Task.dll from Firebase, if I try to delete that firebase Dll another error appears....

Please any help is appreciated :(

We have to build with il2cpp to upload on the App store, Android version works fine.

sentences:
Reading data from files in Unity on Android I have successfully read in and written level data using .dat files on unity PC builds, but compiling for android stops me from being able to read in information from the resources folder. I was under the impression that when it's compiled the resources folder was still accessible? I could create a .dat file in the persistent data path but that means hard coding the information only to serialize it, rather than the data originating from the .dat file itself. How can I include this data within the apk without hard coding it?

Here is my code, working on PC:

    Stream file = File.Open("Assets/Resources/levelData.dat", FileMode.Open);

    levelData = (LevelDataFile)bf.Deserialize(file);

    file.Close();

Edit: for context, the level data is very simple as this is just a puzzle game, and each level will just have a few starting positions and obstacles etc, and there will be 100+ levels, hence I'm not doing a scene per level.

sentences:
Coroutine not working (Unity) I made this code because I needed an image to display a couple seconds after an enemy spawns, but for some reason I can't make it work.

There's no error in the console, but it doesn't display the image and I don't know what to do. Here's my script (it's attached to the enemy prefab)

 public class enemyAttack : MonoBehaviour {

 public float time = 5f;
 private IEnumerator coroutine;
 public Image image;
 private float t = 5f;

 void Start ()
 {
     //image.gameObject.SetActive (false);
     image.enabled = false;
     coroutine = nombredeCorutina (time, image);
     StartCoroutine (coroutine);
 }

 private IEnumerator nombredeCorutina (float t, Image im)
 {

     image.enabled = true;
     //im.gameObject.SetActive (true);
     yield return new WaitForSeconds (t);

     coroutine = nombredeCorutina (time, im);
     StartCoroutine (coroutine);
 }
}

sentences:
Programming strategy to handle big programming project in Unity3d Almost three months ago! We started a big Tough project and still it is continue almost done, some bugs, some logic issues and some redundancies in code. Its a Unity3d Project. Every models/animation/environment are all completed nicely then, it came to the programmers(us).

Now, after writing too many codes, some ill logics, bugs I have learn so many things and I don't want to share. Its is scatters in my mind strongly disagree with lead/teammates but anyhow it is continue.
 But the next big thing I want to ask you that how do we handle a big project(programming side)?
     What are the best right suitable pattern to program in Unity3d using C#. How experience programmer do this work? how do they start to code?
     What I did wrong or notice wrong is the list given below:

 1. Did not do paper work enoguh i.e., algorithm writing

 2. change code abruptly

 3. write code abruptly

 4. without plannig code

 5. things make dependent

Guide me the right thing so that next time it should keep in mind and we don't made any mess.

Answer require from experience Developers, consider myself as your junior and you are giving me instruction.

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:
ShaderBytecode Compiler one technique multiple passes I have an effect code with a basic structure like

technique TechniqueName {
    pass FirstPass {
        Profile = fx_4_0
        VertexShader = RenderFirstVS
        GeometryShader = null
        PixelShader = RenderFirstPS
    }
    pass SecondPass {
        Profile = fx_4_0
        VetrexShader = RenderSecondVS
        GeometryShader = null
        PixelShader = RenderSecondPS
    }
    pass ThirdPass {
        Profile = fx_4_0
        VertexShader = RenderThirdVS
        GeometryShader = null
        PixelShader = RenderThirdPS
    }
}

Now I tried to compile this with

using (BinaryReader reader = new BinaryReader(stream)) {
    CompilationResult result = ShaderBytecode.Compile(reader.ReadBytes((int)stream.Length), "fx_4_0");
    if (result.HasErrors) {
        throw new Exception(result.Message, new Exception(result.ResultCode.ToString()));
    }
    Data = result.Bytecode.Data;
}

stream is new MemoryStream(Encoding.Default.GetBytes(effectContent)).
The Data-Property (byte[]) is about 1 KiB large but if I try to load it via

context.InputAssembler.InputLayout = new InputLayout(device, effect.Data, someElements)

it crashes with following exception D3D11 ERROR: ID3D11Device::CreateInputLayout: Input Signature in bytecode could not be parsed.  Data may be corrupt or in an unrecognizable format. [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE]

Any idea how I can fix this or why the error is thrown? I do not want to use multiple shaders because I reuse many parameters I do not want to reassign in a deferred shading setup.

sentences: 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:
Fullscreen FPS slowdown in Linux I've got a homemade game engine that supports both Windows and Linux using Win32 and Xlib, respectively. By default, the engine will create the window and then switch it into fullscreen mode. When running in Linux, the main game loop updates with a very low framerate (2-7 FPS) that slowly keeps ticking downwards. If I alt-tab out and then alt-tab back in, the game will shoot up to and stay at a consistent 60 FPS.

Since my time since last tick (dt) keeps increasing during this time, my thought is it has something to do with the game not being properly registered as "fullscreen" when it's initially opened, leading the CPU scheduler to not give it full priority. That being said, that's entirely speculation. Does anyone have any idea what the cause of this could be? I can provide code samples if requested.

System info:
Linux Mint 17 Cinnamon 64-bit
Intel Core i7 @ 3.40GHz x 4
8GB DDR3 RAM
Nvidia GeForce GTX 680 with proprietary driver

Edit
My update loop is as follows:

while (gameIsRunning) {
    auto currentTime = std::chrono::steady_clock::now();
    auto dt = std::chrono::duration<float>{currentTime - lastFrame};
    if (dt >= engine->getFrameInterval()) { // getFrameInterval returns (1 / the target framerate) in seconds; in this case, 1/60s
        if (dt >= engine->getFrameInterval() * 2) {
            lastFrame = currentTime;
        } else {
            lastFrame += std::chrono::duration_cast<decltype(currentTime - lastFrame)>(engine->getFrameInterval());
        }

        // input, update, draw...
    }
}

After fooling around with it a bit, this creates a situation where the framerate will jump back up to 60FPS, tick down until it hits about 30FPS, and then jump back up to near 60FPS before ticking down again.

sentences:
How can I render a font in C with OpenGL? What I tried:
I was testing some things in order to render text with stb_truetype.h and OpenGL in C.
I took as a reference the example that appears here.
Basically, this example, loads a .ttf file and returns the raw information in bytes, that can be used to generate a texture in OpenGL.
I adapted the example, mentioned before, into modern OpenGL, because, the example uses OpenGL deprecated functions, like glVertex2f. The only thing I get to output on screen was this kind of noise of strange colors:

The code I use:
texture_t fnt_texture;
GLuint fnt_shader;

unsigned char ttf_buffer[1 << 20];
unsigned char temp_bitmap[512 * 512];

stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs

#define FONT_VS\
    "#version 330 core\n"\
    "layout(location = 0) in vec3 m_Position;"\
    "layout(location = 1) in vec2 m_TexCoords;"\
    "out vec2 TexCoords;\n"\
    "void main() {\n"\
    "TexCoords = m_TexCoords;\n"\
    "gl_Position = vec4(m_Position, 1.0);\n"\
    "}\n"\

#define FONT_FS\
    "#version 330 core\n"\
    "in vec2 TexCoords;\n"\
    "uniform sampler2D Texture;\n"\
    "void main() {\n"\
    "gl_FragColor = texture(Texture, TexCoords);\n"\
    "}\n"\

void font_init(void)
{
    fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
    stbtt_BakeFontBitmap(ttf_buffer, 0, 32.0, temp_bitmap, 512, 512, 32, 96, cdata); // no guarantee this fits!

    glGenTextures(1, &fnt_texture[3]); // My texture type, is an array that saves the texture on the 3rd position.
    glBindTexture(GL_TEXTURE_2D, fnt_texture[3]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp_bitmap);
    glGenerateMipmap(GL_TEXTURE_2D);

    // can free temp_bitmap at this point
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glBindTexture(GL_TEXTURE_2D, 0);

    fnt_shader = shader_init(FONT_VS, FONT_FS);
}

void font_render(model_t model)
{
    shader_bind(fnt_shader);
    texture_bind(fnt_texture, 0);

    model_begin(model);
    model_draw(model, GL_TRIANGLES); // The model (vao, vbo, ibo) is rendering the whole buffer, not individual glyphs
    model_end();

    texture_unbind();
    shader_unbind();
}

Can someone tell me what I'm doing wrong, and, how I'm suposed to render correctly text, with modern OpenGL, with textures and buffers, in order to read the .ttf file and create the necessary information with stb_truetype.h and, then, render the text?

sentences:
How can I maneuver an AI pirate ship for a sea battle? I'm trying to picture in my head what would be required to make an AI controlled enemy do the following in a top down pirate sailing game:

Approach the player ship
Bring player in line with port / starboard guns
Keep guns trained on player
Be able to manoeuvre around obstacles
Not cheat acceleration to achieve the above

When I first started thinking about the idea it was quite simple, but the more I think about it, the more complex the requirements become; with the major problem being the AI calculating perfectly the curve required to come up along side the player, or to better yet, make a pass along their bow / stern before coming along side without needing to let them quickly speed up / slow down to achieve this.

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:
Where can I find free or buy "next-gen" 3D Assets? Usually I buy 3D Assets from sites like turbosquid.com or similar.

My problem is that I have lately implemented glow, normal maps, specular (and specular power) maps and reflection maps and I can't find any models that use those techniques.

So where can I find / buy "next gen" assets (at least models/items with a normal map)?

I have checked for similar posts but those I found are about either free only or 2D or 'ordinary' 3D so I hope this is not a duplicate.

sentences:
Missing references in built bundles The following is a copy of our post in Unity Forum (https://forum.unity.com/threads/missing-references-in-built-bundles.1103689/)
Hello,
We have a bundle for our scenes and another one to store our prefabs (actually we have around 10 bundles but let's keep it simple). In every scene we have unpacked prefab instances. We have no problem in playmode using the AssetDatabase but once we use built addressables some unpacked prefab instances in our scenes are broken. Sprites and / or scripts are missing in a inconsistent way; in some scenes those objects are fine and sometime they are not. This comes along multiple warning messages "The referenced script (Unknown) on this Behaviour is missing! ".
Note that the issue also happens when we fully deploy our player.
Unity version : 20193.3.13
Addressables version : 1.16.1

Solution 1 : We tried to remove addressable prefabs (A,B,C in the diagram) from their bundle since we don't really have to instantiate them at runtime for now and it worked.
Solution 2 : We also tried to put scenes and prefabs into the same bundle and it worked too.
Solution 3 : Switch to 1.18.2 and 1.15.1 version of addressable package and it didn't work.
Solution 4 : Finally we tried to use the Duplicate Bundles Dependencies analyzer multiple times in order to have no more issues of this type and it didn't work.
Questions 1: As far as we understand, when addressable groups are built, Unity computes all dependencies and build them inside the bundle along the orignal assets (in my diagram "Scenes" bundles is packed with D'). What we don't understand is why having our prefabs in a separated bundle break references link in the scenes. Our guess is that Unity doesn't know which version of those dependencies to use (the one in the scene bundle or the one in the prefab bundle) and somehow fails to load them properly.
Question 2 : Is splitting our content is a good approach, we did it mostly for visibility but it appears to be more a problem in the long term, what are your guidelines regarding this matter ?
Question 3 : Why Duplicate Bundle Dependency rule has to be processed multiple times to properly fix every issue ? We think that running this rule creates duplication issues itself but we can't really tell..
Thanks.

sentences:
How do I make a Java gave without a JFrame? I am working on an arcade-like game, and so far, I have been using JFrame. All the action occurs in the JFrame basically.

However, I've noticed that a lot of games that you install on a computer don't have a frame. When you play them on Windows, the game covers the entire screen (the start bar disappears and you can't access any other application on your computer).

I'd like to do that for my game. Is it possible to do so with Java? If so, how would I do this?

sentences:
Multiplayer game server headerless (Unreal/Unity) vs Custom Maps I've been pondering about different approaches that a multiplayer game server can be managed and programmed.

For instance some of the big engines like UE4 & Unity provide a 'build' flag that can enable them to run headless meaning it'll just be the calculations that are enabled for that mode and will handle a ton of the game state sync, object references, hit detection, cool downs etc..But what I'm wondering is if this is the best approach? From my current understanding for each game running there would need to be a new instance of the headless game.exe running that will then create new connections for users into the game, sync up the players and start. This sounds very resource heavy (I might be overthinking it).

EDIT:
In the case of custom game server what would be a good approach into integrating the map data so that UE4 client map can be simulated on the back-end?

I can think of a simple solution looking at it from a 2D prospective, since it's just X,Y we can create a bitmap/grid of position that are available, where walls are etc via simple tile tools that can be easily mapped 1:1 to the client and use that information. However when it comes to 3D I don't see a solution on how to have a 3D map, collision detection and physics simulation.

sentences:
Alternative to 2D array in a tiled-map structure After searching for a long time, I'm surprised this question was not asked yet. In a 2D, tiled-map game, how do you handle the map ? I'd be glad to have your point of view in any languages, though I'm more interested in C++ implementations.

A 2D array, a 2D vector, a class handling a linked-list with ad hoc computing to handle coordinates, a boost::matrix... ? What solution do you use and why ?

sentences:
Can 2D Rigidbodies detect collisions with 3D Box colliders? I would like to know if Rigidbody2D's can detect collisions with 3D Box colliders and/or normal rigidbodies.

I seem to have a problem where my 2D Colliders don't detect collision with my 3D Cubes. :/

sentences:
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:
Does libgdx implement the game loop for you? Initially, I assumed that the developer has to implement the game loop because libgdx is a library - not an engine. But then I found out that Graphics has getDeltaTime() and getRawDeltaTime() so I assume that the game loop is already implemented.

If it is implemented, could someone explain what method libgdx uses? I'm mainly referring to this article. My guess is that it uses a semi-fixed time step? If that's the case, then why might getDeltaTime() "be smoothed over n frames?" How exactly is getDeltaTime() smoothed?

If the game loop is not implemented, what is the purpose of getDeltaTime() when you have getRawDeltaTime()?

sentences:
Kinematics of a die roll? I'm working on a simple 3D game. In the game, sometimes the players have to roll die (a D8 to be exact). I wish to represent the rolling die with a 3D model, and I'd like to animate it in 3D space as if it was really rolled.

Can anyone help me describe the way the die spins around in real life?

PS: I'm working on this in WPF, using Storyboards and Rotation3DAnimationUsingKeyFrames

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:
Determine the stride of a DirectX Texture2D line? Is there a way to determine, or preferably calculate/predict, the the stride of a line of a DirectX 11 Texture2D resource when using SharpDX?

(E.g. Can we say the stride of a line is always a power of 2?)

sentences:
How should I control leveling up in a knowledge/skill testing game? I have developed a game that  tests the knowledge and skills in a series of short quiz-like games.
Players have to move from Level 1 to Level 16 (with Level 4, 8 and 12 as major milestones~BANDS). The Difficulty level of game/questions increases at each level.
The level progression is currently based on 'POINTS'. Points in turn are based on Correct responses, faster responses, Wins, Completion etc.
Points continue to increase for a user irrespective of Win / Loss (the duration of completing the levels varies)
The challenge I foresee is 'every user can progress to Level 16' if he keeps on playing the game long enough (irrespective of whether he has acquired the skill/knowledge for the next level).

I am looking for a simple to understand progression rule(s) that would make lower-skilled players remain longer in that BAND before progressing to the next level and BAND. What are some best practices in Level progression that I can refer to for overcoming this issue.

Thanks,

sentences:
Cubemaps turn black OpenGL GLSL Java LWJGL Recently I tried to add cubemaps to my 3D-rendering engine. The objects with a cubemap now turn completely black.
This is how I load my cubemap:

public static int loadCubeMap(String filename)
{
    int id = GL11.glGenTextures();

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, id);

    for(int i = 0; i < CUBEMAP_NAMES.length; i++)
    {
        TextureData data = decodeTextureFile(CUBEMAPS_LOCATION + filename + "/" + CUBEMAP_NAMES[i]);
        GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    }
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    return id;
}

TextureData class only contains: int width, height and a ByteBuffer buffer

private static TextureData decodeTextureFile(String fileName)
{
    int width = 0;
    int height = 0;
    ByteBuffer buffer = null;
    try
    {
        FileInputStream in = new FileInputStream(TEXTURES_LOCATION + fileName + ".png");
        PNGDecoder decoder = new PNGDecoder(in);
        width = decoder.getWidth();
        height = decoder.getHeight();
        buffer = ByteBuffer.allocateDirect(4 * width * height);
        decoder.decode(buffer, width * 4, Format.RGBA);
        buffer.flip();
        in.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return new TextureData(width, height, buffer);
}

This is how I load the cubemap to the samplerCube cubemap[i] in the fragment shader:

public void loadCubeMap(int id, CubeMap cubemap, int cubemapid)
{
    if(cubemap != null)
    {
        super.loadTexture(location_cubemaps[cubemapid], cubemap.id, id, GL13.GL_TEXTURE_CUBE_MAP);
        super.loadFloat(location_cubemap_intensity[id], cubemap.intensity);
    }else
    {
        super.loadFloat(location_cubemap_intensity[id], 0.0f);
    }
}

in super class:

protected void loadTexture(int location, int texture, int i, int texturetype)
{
    loadInt(location, i+1);
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + i);
    GL11.glBindTexture(texturetype, texture);
}

And this is my fragment shader:

#version 400 core

  in vec4 color;
  in vec2 texCoord0;
  in vec3 surface_normal;
  in vec3 to_light_vector;
  in vec3 world_position_out;
  out vec4 out_Color;

  uniform sampler2D sampler0;

  uniform samplerCube cubemap[3];

  uniform vec3 lightColor;

  uniform float cubemap_intensity[3];

  uniform int hasTexture;

  void main(void)
   {
      vec3 unitNormal = normalize(surface_normal);
   vec3 unitLight  = normalize(to_light_vector);

   float nDot1 = dot(unitNormal, unitLight);
   float brightness = max(nDot1, 0.02);

   vec3 diffuse = color.xyz * brightness * lightColor * color.xyz;
   vec4 textureColor = texture(sampler0, texCoord0.xy);
   if(textureColor.a < 0.5)
       discard;
   vec4 shadedTextureColor = brightness * vec4(lightColor, 1) * textureColor;
    vec4 coloredShadedTexture = mix(vec4(diffuse, 1), shadedTextureColor, textureColor.a * hasTexture);

   vec4 reflectionColor = texture(cubemap[0], world_position_out);
   vec4 refractionColor;
   vec4 cubemapColor;

   out_Color = reflectionColor;
  }

sentences:
Where can I find info on grid based algorithms for stateless AI? There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once.

For my testing purposes, I'm creating a "typical stateless AI", as described in this article, and now I need to implement the following functions for a 2D square based game board:

-(void)runAway;
-(void)attackPlayer;
-(void)moveTowardsPlayer;
-(void)tacticalMoveAwayFromPlayer;
-(void)waitOrStationaryAction;

For example, I can run my own run away function like this:

-(void)runAway
{
    DLog(@"runAway");
    [self debugMessage];

    int bestTileIndex = 0;
    int largestDistance = 0;
    int distance = 0;
    if(validMoves.count>0)
    {

        for(NSNumber* tileNumber in validMoves)
        {
            distance = [self distanceToTargetFromTile:tileNumber.intValue];
            if(distance >largestDistance)
            {
                largestDistance = distance;
                bestTileIndex = tileNumber.intValue;
            }
        }
    }
    //move to best tile

}

but this method only checks the distance from 1 target, which may not be the best if there are multiple enemies on the game board.

Where can I find good/efficient implementations of algorithms for searching a 2D grid for these functions? For example finding a point that is furthest away from multiple opponents and is accessible within a certain number of moves.

Other functions that come to mind is picking the best/weakest target, moving towards a specific target while accounting for variable terrain cost, etc

I'm certain someone has already done this before.

sentences:
How would I implement a level for a vertical shooter game I've been working in my free time on a vertical shooter similar to Xenon 2 Megablast. It's a tribute of sorts to the game that destroyed a considerable part of my childhood.

I've got the basic stuff in place - weapons, enemies, collision detection and a scrolling background. Now, I want to design the levels.

I want to create some kind of an engine which can render a level based on some kind of (say) textual description so that I can easily create levels. Are there any articles or links to how platformer/vertical shooter levels can be stored as files and loaded by the game engine? I'm not looking for completely solutions but ideas and starting points so that I can try to do it myself.

Specifically, how would you store the level of a platformer game like Prince of Persia or a shooter like Xenon 2?

sentences:
Using MVC with a retained mode renderer I am using a retained mode renderer similar to the display lists in Flash. In other words, I have a scene graph data structure called the Stage to which I add the graphical primitives I would like to see rendered, such as images, animations, text. For simplicity I'll refer to them as Sprites.

Now I'm implementing an architecture which is becoming very similar to MVC, but I feel that that instead of having to create View classes, that the sprites already behave pretty much like Views (except for not being explicitly connected to the Model). And since the Model is only changed through the Controller, I could simply update the view together with the Model in the controller, as in the example below:

Example 1

class Controller
{
    Model model;
    Sprite view;
    void TeleportTo(Vector2 position) { model.Position = view.Position = position; }
}

The alternative, I think, would be to create View classes that wrap the sprites, make the model observable, and make the view react to changes on the model. This seems like a lot of extra work and boilerplate code, and I'm not seeing the benefits if I'm just going to have one view per controller.

Example 2

class Controller
{
    Model model;
    View view;
    void TeleportTo(Vector2 position) { model.Position = position; }
}

class View
{
    Model model;
    Sprite sprite;
    View() { model.PropertyChanged += UpdateView; }
    void UpdateView() { sprite.Position = model.Position; }
}

So, how is MVC or more specifically, the View, usually implemented when using a retained-mode renderer? And is there any reason why I shouldn't stick with example 1?

sentences:
UENUM definition in header file I am trying to define a simple enumeration in a header file as per the example published here. My header file consists of the following:

#pragma once

#include "CoreMinimal.h"

UENUM()
enum class MyEnum : int32
{
    MyField1,
    MyField2,
    MyField3
};

If I remove UENUM(), the compiler doesn't complain; however, when I add it, I get multiple errors.

expected a ';'
expected a '{'
identifier "MyField1" is undefined
identifier "MyField2" is undefined
identifier "MyField3" is undefined

This all seems odd considering I'm doing exactly what the article says to do and other websites suggest doing the same thing.

Here's what it looks like in my editor:

What I've tried

Changing enum class to simply enum.
Not explicitly specifying an underlying type.
Defining the enum elsewhere (for instance, in one of my classes; but when you add UENUM() there, it tells you you can't define it there).

I am new to both C++ and UE4 so it could be silly or trivial. Either way, I'm having a hard time understanding why something so simple won't compile.

sentences:
2D Finding an algorithm to check pizza toppings positions Using unity 3D I am creating a 2D pizza game and I am stuck at finding an algorithm to solve this problem which is Detecting if the pizza is half and half taking into consideration that the user can put the toppings in all rotations shown in the picture and lot more possible distributions.
I used Physics2D.OverlapAreaAll to get position of ingredients on the pizza and I tried getting the sumX and sumY of coordinates of all topping A and sumX and sumY of all topping B and adding A.sumX + B.sumX and A.sumY + B.sumY and if the 2 totals are between 0 and 1 then A and B are on opposite sides but the bad distribution of toppings in the second pic is also accepted by my algorithm. The toppings must be spread like in the 1st pic
I need some easier way to detect the correct distribution of ingredients maybe using collisions or something.
if (sumX > -ErrLvl && sumX < ErrLvl && sumY > -ErrLvl && sumY < ErrLvl)
            {
                Debug.Log("APPROVED HALF-HALF PIZZA");
            }
            else
                Debug.Log("BAD HALF-HALF PIZZA");

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:
Instantiated object can't be parented I'm writing a script (in C#) which, on mouse down, will spawn a gun and parent it to a game object. But for some reason the gun is instantiated just fine, but it doesn't parent. I have an empty game object called "Hands" and I'm trying to have the gun become a child and be moved to the position of "Hands".

To test what was going on I made two scripts, one which would parent the object upon pressing P, while the other script would just instantiate the item on mouse down. It worked, I first spawned the gun with mouse down, and then pressed P and it was parented. So my only guess is that you can't instantiate and parent in the same script all at the same time.

I have absolutely no clue what's going on, so I really appreciate any help I can get.

This is my code:

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

public class GiveWeapon : MonoBehaviour {

  public GameObject Weapon;
  public GameObject Hands;

  void OnMouseDown ()
  {
    Instantiate(Weapon);
    Hands = GameObject.Find ("Hands");
    Weapon.transform.parent = Hands.transform;
    Weapon.transform.position = Hands.transform.position;
  }
}

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:
Cocos2d-x Finding if a CCPoint is inside a sprite rect I'm afraid that I'm missing something. This is what I've done:

I've made a scene using layers (Gimp), then I've exported the layers
with the image size, that way I thought would be more easy to add
the images and have the offsets in the right way.
I made a spritesheet with TexturePacker, trimming the images.

Then I have in the plist file something like:

<dict>
   <key>frame</key>
   <string>{{1028,360},{326,382}}</string>
   <key>offset</key>
   <string>{-316,110}</string>
   <key>rotated</key>
   <false/>
   <key>sourceColorRect</key>
   <string>{{33,83},{326,382}}</string>
   <key>sourceSize</key>
   <string>{1024,768}</string>
</dict>

Then in my code I've made a CCSprite:

granero = CCSprite::createWithSpriteFrameName("04_Granero.png");
capaGrafica->addChild(granero);
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, false);

And the ccTouchBegan:

bool Escena00::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
    // This point has the touch location info
    CCPoint touchPoint = CCPoint(touch->getLocationInView().x, touch->getLocationInView().y);

    // Now I want to set a rect, where a little house in the screen is located
    CCRect *graneroRect = new CCRect(granero->getOffsetPosition().x, granero->getOffsetPosition().y,granero->getTextureRect().size.width,granero->getTextureRect().size.height);

    if (graneroRect->containsPoint(touchPoint))
    {
        CCLog("The little house in the left was touched");
    }

    return true;
}

If you take a look now to the plist extract that I've posted you'll read the "sourceColorRect" key. Those coords are the right numbers that I need to use to create my CCRect (33,83, 326, 382). With those numbers I've been able to correctly get the touch over the little house.
However, I don't want to use those numbers with a "hard way".
Using granero->getOffsetPositionX(), I get the "33" number, and using the "getTextureRect()" I can get the third and fourth numbers (size of the rect).
The big issue is the getOffsetPositionY(), or any "y" coordinate. I can't read the "83" number. How can I solve this? Or what am I doing wrong?

Thanks a lot in advance.

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: Different kinds of collision detection in Android Are there any other ways to detect collision between two objects besides the bounding rectangle method and downloading another class to put into Android?

sentences:
Can't access core/assets in a Desktop-Only Libgdx Project I'm trying to use libgdx to set up a little quiz application for Desktop.

So I used the setup.jar to create a project and everything went fine (using Eclipse).

The problem is following:

Whenever I try to access the assets in core/assets, as you should do:
Gdx.files.internal(filePath)

I always get a NullPointerException:

java.io.FileNotFoundException: PATH\QuizApplication\desktop\questions.xml (The system cannot find the file specified)

My assets Folder in the desktop project is linked to the core project, and inside Eclipse, I can see the right contents. As you can see from the Exception, the application tries to read the desktop project instead of the core project.

In build.gradle in the desktop project, the link to the core assets folder is there too:

project.ext.assetsDir = new File("../core/assets");

Does anyone know how I might fix this problem, so that I can access the core/assets folder?

sentences:
Stuck in an infinite recursion in Minesweeper I am trying to build a simple minesweeper game. The game gets stuck in an infinite recursion whenever a user clicks on a tile which is not a mine...

I have used the following function code for the click event..

When a user clicks on a tile which is not a mine, its adjacent tiles are to be checked for a mine and the process repeats.... I have used a recursive function which disables the tiles for which adjacent tile is not a mine...

  protected void set_text_of_button(Button btn)
  {
      //all these objects specify the location of adjacent tiles
      Block Top, Top_Left, Top_Right, Left, Right, Bottom, Bottom_Left, Bottom_Right;

      //code to specify the location of adjacent tiles...

      //if adjacent tile is a mine then display the total number of tiles....
      //recursive function should end in this if part..

      else
      {
      //recursive calls for all the adjacent tiles..

              if (Top != null && !Top.Mine)
                  set_text_of_button(Top.btn);         //recursive call
              if (Top_Left != null && !Top_Left.Mine)
                  set_text_of_button(Top_Left.btn);
              if (Top_Right != null && !Top_Right.Mine)
                  set_text_of_button(Top_Right.btn);
              if (Left != null && !Left.Mine)
                  set_text_of_button(Left.btn);
              if (Right != null && !Right.Mine)
                  set_text_of_button(Right.btn);
              if (Bottom.btn != null)
                  set_text_of_button(Bottom.btn);
              if (Bottom_Left.btn != null)
                  set_text_of_button(Bottom_Left.btn);
              if (Bottom_Right.btn != null)
                  set_text_of_button(Bottom_Right.btn);

      }
  }

can the following code be implemented or is there a better algorithm to perform the task...

sentences:
LIBGDX fadeout, hide and remove action not triggered I try to execute an sequence of actions, but fadeout and following are not working for me. I can see the actor moving to the desired point, but after that it just stays there.

My code. personActor is an Actor of a list in my mainactor:

    SequenceAction sequence = new SequenceAction();
    sequence.addAction(Actions.moveTo(0, 300));
    sequence.addAction(Actions.moveTo(1000, 300,3f));
    sequence.addAction(Actions.fadeOut(0.5f));
    sequence.addAction(Actions.hide());
    sequence.addAction(Actions.removeActor());

    personActor.addAction(sequence);

The main actor loops through the list of childactors:

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    for(PersonActor personActor : personenActors){
        personActor.draw(batch,parentAlpha);
    }
}

Do someone see, whats wrong here ?

sentences:
Not sure how to deal with overlapping UI As shown above, that is the issue I am faced with, tbh I am unsure how to fix it, I have tried and its coming to a point where I am drawing blank. I am quite newbie when it comes to this.

So what I have now is multiple canvas each one displaying the name of the part that it is linked to and when the part moves so does the UI with it, the problem I have is that some parts dont move and therefore creating the issue of UI clustering together, so I need to move the UI rather than the parts.

What I have tried is OnTriggerEnter and adding a box collider/rigidbody to the canvas and tried to move the UI when they collided but I couldnt get that to work, probably down to me.

if (gameObject.tag == "car")
    {

        //get the gameObjects name that canvas is attached to
        canvasName.text = gameObject.name;

        newPos = mainCam.ScreenToWorldPoint(this.transform.position);

        //set the position of the UI
        newPos.x = transform.position.x;
        newPos.y = transform.position.y + 7f;
        newPos.z = transform.position.z;

        //canvas position
        if (_canvas != null)
        {
            _canvas.transform.position = newPos;

        }

That is the code that I am using to attach the UI to the part. I was hoping to try something along the lines, but then again I am clueless.

if collision is detected, newPos.y = newPos + 2f; etc...

So any help would be appreciated. Apologies if that was explained bad.

sentences:
Ledge grab and climb in Unity3D I just started on a new project. In this project one of the main gameplay mechanics is that you can grab a ledge on certain points in a level and hang on to it.

Now my question, since I've been wrestling with this for quite a while now. How could I actually implement this? I have tried it with animations, but it's just really ugly since the player will snap to a certain point where the animation starts.

sentences:
Rendering an isometric tilemap I have a tile which is 512x256 pixels and I'm trying to render it in an isometric fashion.

I have this helper function:

Pos cartToIso(Pos p) {
    xa := p.x - p.y;
    ya := (p.x + p.y) / 2;
    return new Pos(xa, ya);
}

And to render I do this:

// note this is smaller than the image since
// it's being scaled down
const tileWidth = 256;
const tileHeight = tileWidth / 2;

for (int y = 0; y < 32; y++) {
    for (int x = 0; x < 32; x++) {
        int ya = y * tileWidth;
        int xa = x * tileHeight;
        Pos p = cartToIso(xa, ya);

        drawImage(grassTile, p.x, p.y, tileWidth, tileHeight);
    }
}

This nearly works but there is a big black gap around the tiles. It's fixed when
I change the rendering to this:

// note this is smaller than the image since
// it's being scaled down
const tileWidth = 256;
const tileHeight = tileWidth / 2;

for (int y = 0; y < 32; y++) {
    for (int x = 0; x < 32; x++) {
        int ya = y * tileHeight; // <- here!
        int xa = x * tileHeight;
        Pos p = cartToIso(xa, ya);

        drawImage(grassTile, p.x, p.y, tileWidth, tileHeight);
    }
}

But why? This seems to be counter-intuitive compared to what the
isometric 2d tutorials I have read have said.

Is there a flaw to my rendering logic?

sentences:
Profiling the GPU of a tablet We are working on a tablet game in Unity Pro (for the first time). Unity's profiler works great for probing the CPU, but the tablet's GPU isn't supported in the profiler, so we have no idea where the rendering bottlenecks are.

Are there any other means of profiling the GPU of an android tablet? (We are working with a Samsung galaxy tab 2 10.1 ) How do other mobile devs do this?

We are basically looking for any ways of getting info from the gpu as we're running the game. Benchmarking software wouldn't help; we don't need benchmark scores.

Cheers!

sentences: XNA Why is Texture.GetData one dimensional? This is question has been really killing me. In XNA when you want to convert an image to color data using Texture.GetData, it only lets you make it a one dimensional array instead of a 2D one. This makes it much more difficult to work with. Is there a specific reason it's like that?

sentences:
Develop a Wii U game without official dev kit I was looking for unity for Wii U game development. But it seems that I need the approval of Nintendo to have the software (and special hardware) (ref: https://wiiu-developers.nintendo.com).

Is there a way to have the software and to replace the hard with an emulator ?

I just want to make a game for fun, I can't afford the official SDK (Rumors says it about $5000)

If it is possible, I would love to have some ressources (I couldn't find anything...)

Thanks :-)

sentences: Java Libgdx: How do you add cells to a TiledMap? I'm trying to make a Side-Scrolling game that will allow you to place/remove tiles. I'm using the TileMap Editor to render the custom Tilemap but is there any way to add tiles? I have it where I can remove the tiles with .setTile(null) but is there anyway to get the properties from a tile in the TileMap Editor so that it can get the Texture/Tile to use so it can place the tile?!

sentences:
Separation of world state and animation in a turn based game How do you handle the separation of animation from the world state within a turn based game? I'm working on a 2D grid based game currently. The below code is simplified to better explain.

When an actor moves, I want to pause the flow of turns while the creature animates and moves to the new position. Otherwise, the screen could lag significantly behind the world state, which would cause weird visual appearance. I also want to have animations that don't block the flow of the game - a particle effect could unfold over multiple turns without affecting gameplay.

What I've done is introduce two types of animations, which I call blocking animations and non-blocking animations. When the player wants to move, the code that gets executed is

class Actor {
    void move(PositionInfo oldPosition, PositionInfo newPosition) {
        if(isValidMove(oldPosition, newPosition) {
             getGame().pushBlockingAnimation(new MoveAnimation(this, oldPosition, newPosition, ....));
             player.setPosition(newPosition);
        }
    }
}

Then the main update loop does:

class Game {
    void update(float dt) {
        updateNonBlockingAnimations(dt); //Effects like particle explosions, damage numbers, etc. Things that don't block the flow of turns.
        if(!mBlockingAnimations.empty()) {
            mBlockingAnimations.get(0).update(dt);
        } else {
             //.. handle the next turn. This is where new animations will be enqueued..//
        }
        cleanUpAnimations(); // remove finished animations
    }
}

...where the animation updates the screen position of the Actor.

One other idea I am implementing is to have a concurrent blocking animation, where multiple blocking animations would be updated simultaneously, but the next turn wouldn't happen until all of them were done.

Does this seem like a sane way to do things? Does anyone have any suggestions, or even references to how other similar games do such a thing.

sentences:
PlaySoundAtLocation plays sound after some delay I’m developing the Pong game to learn Unreal Engine 4.26 using C++.
I use this code in the class’ constructor to load the sound:
static ConstructorHelpers::FObjectFinder<USoundWave> HitSoundAsset(TEXT("/Game/Effects/pong-paddle.pong-paddle"));
    if (HitSoundAsset.Succeeded())
        HitSound = HitSoundAsset.Object;

And in OnHit event this code:
void APaddle::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
    if ((OtherActor != nullptr) && (OtherActor != this) && (OtherComp != nullptr))
    {
        if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Paddle has been hit by: %s"), *OtherActor->GetName()));

        if (ABall* Ball = Cast<ABall>(OtherActor))
        {
            PlayHitSound();
        }
    }
}

And finally:
void APaddle::PlayHitSound()
{
    if (HitSound != nullptr)
    {
        UGameplayStatics::PlaySoundAtLocation(this, HitSound, GetActorLocation());
    }
}

But it sounds after the ball has bounced.
The sound starts at 0 and it hasn’t any silent.

Is there any way to play it immediately?

sentences:
Why is the SFML shape not being displayed when I make it a member of the Game class instead of a local function variable? I created a window successfully in SFML using a Game class which hold all of the key components of the game. I then tried to start rendering shapes on the screen. When I first rendered the shapes, I was creating local copies inside of the render function. Of course, that doesn't allow me to do much and it isn't good organization of code, so I moved the main shape of the game I have in mind to the Game class. Now the shape doesn't show up at all. The application doesn't crash but it just doesn't show the shape. I feel like this might have something to do with the scope of the shape, but I just can't make sense of it. I looked at "The white square problem" on SFMLs site but I do not feel like this relates since the shape is a member of the class (which I thought meant it shouldn't go out of scope until the instance of the class does). I'm using g++ and am on a iMac running El Capitan if that helps any. Any help at all is greatly appreciated! Please help me understand this if you can!

p.s. Feel free to comment on any part of my code that isn't even directly related to the question but rather should just be improved.

Main.cpp

#include "Game.hpp"

int main(int argc, char** argv)
{
    Game game;

    game.setup();

    while (game.isRunning())
    {
        game.events();
        game.update();
        game.render();
    }

    game.cleanup();

    return 0;
}

Game.hpp

#ifndef GAME_H
#define GAME_H

#include <SFML/Graphics.hpp>

class Game
{

private:
    enum GameState
    {
        GAME_STATE_RUNNING,
        GAME_STATE_CLOSING
    };

    sf::RenderWindow window;
    GameState state;
    sf::CircleShape leader;

public:
    Game();
    ~Game();

    void setup();
    bool isRunning();
    void events();
    void update();
    void render();
    void cleanup();

};

#endif

Game.cpp

#include <SFML/Graphics.hpp>

#include "Game.hpp"

Game::Game()
{
}

Game::~Game()
{
}

void Game::setup()
{
    this->window.create(sf::VideoMode(1000, 750), "Follo");

    this->leader.setFillColor(sf::Color::Black);
    this->leader.setPosition(100, 100);

    this->state = GAME_STATE_RUNNING;
}

void Game::events()
{
    sf::Event event;

    while (this->window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
        {
            this->state = GAME_STATE_CLOSING;
        }
    }
}

bool Game::isRunning()
{
    return this->state != GAME_STATE_CLOSING;
}

void Game::update()
{
}

void Game::render()
{
    this->window.clear(sf::Color(203, 209, 219, 255));
    this->window.draw(this->leader);
    this->window.display();
}

void Game::cleanup()
{
}

Makefile

COMPILE         = g++ -c
LINK            = g++ -o
FLAGS           = -g -Wall -O2
O_FILES         = Main.o Game.o
LIB_PATH        = /usr/local/lib
INCLUDE_PATH    = /usr/local/include
LIBS            = -lsfml-graphics -lsfml-window -lsfml-system
EXE_NAME        = Follo

program: build
    ./$(EXE_NAME)

build: $(O_FILES)
    $(LINK) $(EXE_NAME) $(O_FILES) -L$(LIB_PATH) $(LIBS)

Main.o: Main.cpp
    $(COMPILE) $(FLAGS) Main.cpp

Game.o: Game.cpp Game.hpp
    $(COMPILE) $(FLAGS) Game.cpp

sentences:
Handling AI with ECS in a turn based roguelike I am trying to implement the Entity Component System pattern to use in a roguelike game. Right now, I have 3 systems. Input, AI, and Action. The input system basically is just a system used by the player to get input from the keyboard. The AI system is for the NPCs. The action system processes anything with an Action component, which is used to describe either a move, an attack, an item usage, basically anything that advances the game time.

However, I am having trouble with implementing the correct behaviors. It is clear that the player should have a turn, getting his input. If the input is invalid, he repeats his turn, again and again until he makes a turn that passes time. Then the enemies should get their move from the AI system, and initiate it. So what the behavior should be like is this:

while(!input.passesTime())
    input.getInput()
    draw()
action.do(Player)
for all Entities with AI
    AI.think(Entity)
    action.do(Entity)
draw()

Notice how everything is intertwined and doesn't really make sense as a single (or multiple) system. How can I design this better? Note especially that I need to update the screen everytime, even with invalid inputs since they may write something out (e.g. "Nothing interesting happens").

After some thinking it seems clear that the renderer should also be a system, but this doesn't really clear up the requirements.

sentences:
FXC: Error X3501: 'main': entrypoint not found I am trying to compile a vertex shader using VS2013, but every time I try, FXC returns the following error:

Error error X3501: 'main': entrypoint not found

I've reduced the vertex shader to its simplest form and yet I'm still getting the same result:
DefaultVS.hlsl
#include "Include.hlsl"

cbuffer CameraTransform {
    float4x4 ViewProjMat;
};

VS_OUT main(VS_IN input) {
    VS_OUT result;

    result.Position = mul(input.Position, mul(input.WorldMat, ViewProjMat));

    return result;
}

Include.hlsl
struct VS_IN {
    float4 Position : POSITION;
    float4x4 WorldMat : INSTANCE_TRANSFORM;
};

struct VS_OUT {
    float4 Position : SV_POSITION;
};

And the properties of both files:

/Zi /E"main" /Od /Fo"Path\To\Output\DefaultVS.cso" /vs"_5_0" /nologo
/Zi /Od /Fo"Path\To\Output\Include.cso" /nologo

sentences:
glGenVertexArray crash my program Hi I started today to make an OpenGL program, I made the shader class, mesh class and texture class. When I tried to test it, it stopped working. After a little debug with Visual Studio(thanks Microsoft for this useful tool). It showed me that my problem is:

glGenVertexArrays(1, &m_vao);

I use glew. I searched on internet, and I found that glewExperimental needs to be GL_TRUE, so I init it like this:

glewExperimental = GL_TRUE;
GLenum error = glewInit();
if (error != GLEW_OK)
    std::cerr << "Glew: " << glewGetErrorString(error);

nothing changed.

Error given by Visual Studio:

Exception thrown at 0x00000000 in DirtyCraft.exe: 0xC0000005: Access violation executing location 0x00000000. occurred

I do use Glew 2.0.0, 32-bits, SDL2.

If you need any additional information, feel free to request them.

sentences:
How do collision meshes work in games like Zelda on the N64? I was recently reading about the technology of Ocarina of Time/Majoras Mask and discovered that world collision is done using a single triangle mesh (vertices, normals, etc) for an entire area. There are also no signs of preprocessed spatial partitioning methods in that data structure.

What algorithms exist for performing character collision on a similar arbitrary triangle mesh fast enough to run on a platform like the N64?

Quake is a contemporary game with a similar feature that came to mind. I understand Quake brush collision works by subdividing an AABB with planes. If a point is in the AABB and behind all the planes there is a collision. However, this method only works using a bunch of individual convex objects to make up a collision scene.

Zelda data structure details Here:

http://wiki.spinout182.com/w/Zelda_64:_Collision_Format
http://zeldaspeedruns.com/oot/generalknowledge/zelda-64-engine

EDIT - I don't need to know the real method used by the real game, Zelda is an example. I am looking for a method of achieving a similar effect under similar hardware constraints.

sentences:
How can I use a camera matrix with different resolutions? I created a little jump'n'run game. The character(Mario) is always the center of the viewport. The game is running correctly if I use the resolution 800x480 pixel. But when I use another resolution(for example 1280x768), the sprites in the viewport look completely different to the sprites in the 800x480 viewport. I want that the viewport(and the sprites in the viewport) looks always the same, on every single resolution.

How can I do that? Should I change something on my camera matrix parameters or what should I change so that the viewport and the proportions of the sprites look always the same?

I use Monogame to run the game on different Windows Phone devices.

My camera class:

 public class Camera
{
    public Vector2 Cameraposition;

    public Camera(Vector2 cameraposition)
    {
        Cameraposition = cameraposition;
    }

    public void Update(GameTime gameTime, Vector2 CamPosition)
    {
        Cameraposition = CamPosition;
    }

    public Matrix GetMatrix()
    {
        return new Matrix(1, 0, 0, 0, 0, 1, 0, 0, Cameraposition.X, Cameraposition.Y, 1, 0, -Cameraposition.X, -Cameraposition.Y, 0, 1);
    }
}

In Game1:

//I use the camera in Game1 like this:
//At the beginning(in LoadContent):
Vector2 cameraposition = new Vector2(PlayerStartpos.X - GraphicsDevice.Viewport.Width / 2, PlayerStartpos.Y - GraphicsDevice.Viewport.Height / 2);
camera = new Camera(cameraposition);

//Updating the camera position
 protected override void Update(GameTime gameTime)
    {
        player.Update(gameTime);
        Newcameraposition = new Vector2(player.Playerposition.X - GraphicsDevice.Viewport.Width / 2, player.Playerposition.Y - GraphicsDevice.Viewport.Height / 2);
        camera.Update(gameTime, Newcameraposition);

        base.Update(gameTime);
    }

//Drawing:
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone, null, camera.GetMatrix());
 ...

sentences:
Handling input in ECS for multiple characters I've been reading into Entity-Component-Systems, and they seem rather handy. However, I don't quite understand how input should be handled and after googling and looking thru GDSE posts, I've become even more confused. I see plenty of explanations, but no examples of how to incorporate things like an intent system.

Originally, I planned on polling for keyboard events and passing those events onto a controller. This controller would have a vector of callback functions, which could be rebound to different keys on the fly.
But then I realized it doesn't translate well into a game with multiple characters, each with their own set of actions - like a fighting game, or the Megaman X games that allow you to switch between characters.

I thought that if I were to make these callback functions rather generic, so that they just change the state of the character, then have a System that consumes states for different characters to apply different results to the action (IE, the "jump" button would set the currently controlled character's state to JUMPING. But maybe Character 1 jumps faster than Character 2, but Character 2 jumps higher). But that doesn't seem like a wise idea, because now I have a system for every state that each character could possibly have. It smells really bad, basically. And to have a character unsubscribe from one "State System" and resubscribe to another just gives me the feeling that I am not doing something right, but I am at a loss.

How should I handle input that can differ slightly from character to character? I feel like I am on the right track with having the states handle input, but I don't think that each state should have it's own system. A state should be generic and operate on many entities, not just a single instance of one!

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:
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:
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:
Creating a Static function inside my class to handle small housekeeping tasks I have used Unity 3D for quite some time, and a lot of my game programming experience originates from using UnityEngine.

Writing in XNA, I am setting up a nested list of objects. Each object will be an instance of a class, GameObject. At the point of creation, I will have to perform some administration on each element, to sort through them and allow correct operation.

My understanding is that if I have the administration function inside the class, each instance will contain the instructions to perform the task, effectively having N times the same instructions. I have seen some functions instead use the static identifier, in UnityEngine. My understanding is that each instance will instead reference the same copy of the instructions, tidying everything up a bit better.

From what research I have done, all I can find supports that creating static functions inside instantiated instances of a class is impossible. However, I have functions inside UnityEngine that are static, and linked to instantiated copy's of a single class.

My question is: How do I contain a static function inside my class, to perform routine administration function? I am wanting it to be able to crunch numbers derived from the instance calling it, in order to set up other fields within the instance. Would I have to send a ref type of that field, to ensure I am editing the exact instance of it, or do I have a keyword that automatically points to the instance calling the function?

sentences:
Detect Collision on Child Object I've created an obstacle prefab. The Prefab has following hierarchy.

The player must die if he collides with Enemy. But It detects collision with parent object. I am also uploading the screen shot of property of enemy(Child Object) and Parent Object.

What should I change to let player collide with Child Object (Enemy).

sentences:
Which Database (RDBMS vs NoSQL vs BOTH) to use for a Realtime Multiplayer Game? I'm working on a realtime multiplayer game that will require a database (for features such as player profiles, friends, unlocks, news, etc.) This is a standard PC game (not browser-based) and will use a client-server architecture. I am new to using databases, and have done some research over the past few days when I stumbled upon the heated debate: RDBMS vs NoSQL. Currently I am leaning towards NoSQL but after reading about the uses for each (RDBMS and NoSQL), I'm tempted to use both. I know that may seem strange, but let me explain my situation:

My team has a shared webhosting package that offers unlimited mySQL storage and bandwidth, the only caveat being that we can only have 25 connections open at one time (shared hosting rule). I am intending on using this for my website (a typical usage no doubt) in order to post news updates, support community features (like comments, uploading fan art, etc.) and the like. That's all fine and good - but! this is where things get interesting... I want to display this same information that is posted on my website, in-game. This means using mySQL for both my website and my game. In addition to news posts and the like, I plan on using it in-game for things like chat and a server list. I am concerned about that 25-connection-rule mostly.

Which leads me to ask Question #1: Will this work and is there a better alternative?

Now besides this, I have read about how well NoSQL performs and is suited for realtime games (I could be wrong, I've walked through a huge RDBMS vs NoSQL flame war to get here and probably am burned). Basically, I would like to use MongoDB for all of my game object data.

And again, it will be helpful if I provide some context: I have found a host (MongoLab) which offers a 240MB MongoDB package for free, which I intend on using until it's necessary to upgrade. Given 240MB, I've calculated that I will be able to store roughly 60,000 players (if each player is roughly 4KB and we ignore other things that might be stored). The storage space, and having to pay for more in the future (should our game be successful) is not a problem. The only reason I currently intend on using MongoDB for all of my game object data is because of how often this game object data will be accessed (such as whenever a player is killed, picks up an item, fires a gun, etc.) I also like the straight forward schema-free documents (which make it easier to map game object data). I should note that, at one time, there will only ever be one server writing to a player's profile in the database (the server the player is in).

I intend on using the same MongoDB in my website, to display player profile information (I'm not concerned with complete consistency, some delay from in-game updates is fine).
Which leads me to my second question, Question #2: Is this a good idea or is there something better I should do?

The game will have a start up experience similar to this:

Client logs in (MongoDB)
Client is at in-game home page w/ chat rooms (MySQL)
Client goes to server list (MySQL)
Client connects to a server and plays in it
Server communicates updates for all players (MongoDB)

This is just the way I imagined it would work.  Does this look good to you, or do you have suggestions on how this plan can be improved?

sentences:
HTML5 Canvas 2D lighting and normal maps How using the HTML5 Canvas can I create a 2D game with light sources and also add an extra depth using normal maps.  I have never really done lighting in 2D before and I'm not sure where to start.
Something like this:

or

(source: wholehog-games.com)

sentences:
Simulating an aging population Introduction:

The main idea is to "classify population as they age". Let me further explain it with an example:

Example:

There are 50k population (we are not going to care about if male or female for now). Inside these number there are kids [0 - 16], fertile[16 - 40], non-fertile [40 - 100].

Question

Which would be a nice implementation to represent an evolving population data that is better or at least not too resource intensive as my example below?

My Idea

(Pseudo code)

Population[] // Array
   Age [0 -> 5] //Array
       a pop obj that stores data
   Age [5 -> 10]
       pop obj
   .
   .
   .
   Age[95 - 100]
      pop obj

This would be the structure and each tick happens this calculation:

FertilePop.count * fertility rate * (some other stuff) = numberOfBirths

where numberOfBirths are added to the Age[0-5].obj.count

and the rest of Age[rang] are subtracted a number and added onto the next Age[rang] until Age[95 - 100] where they "die of old age".

Notes:

This is purely background data and i am asking for a better solution/implementation that could be less complex, more dynamic and learn from it.

I expect to be able to do a graph plot so the user sees the pop evolution.

I took my interest in the matter from this link here to a population simulator.

https://niko.roorda.nu/computer-programs/popsim-population-simulation/

Thanks for your interest in this question.

sentences:
How to 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:
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:
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:
Tiled - Possible to create a terrain from this specific tileset? I'm really new to Tiled and I can't get the hang of creating terrains.

I have these really nice 2D assets I would like to use but I can't get the terrains to work. I'm trying to create a dirt path terrain brush from the below tileset.

I've checked countless tutorials but nothing works. I'm starting to think these just aren't compatible with Tiled.

Could someone tell me if it's meant to be possible?

I've added a watermark to the tile image below as these are commercial assets.

Thanks!

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:
Loading a Texture2D Array in DirectX11 How does one create a Texture2D Array in DirectX11? The texture I am trying to create is not multisampled, and I want only one mip level. I can't find a working example of a Texture2D Array. I have a buffer of 2D images that I want to use as a Texture2DArray in a shader.

The following code snippet works when sTexDesc.ArraySize=1 (as a Texture2D). With sTexDesc.ArraySize=2 the subsequent call to CreateTexture2D crashes with this Access violation inside DirectX:

  Unhandled exception at 0x000007fef5d6771a in test.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.

With larger values of ArraySize CreateTexture2D returns E_INVALIDARG. ubImageStorage contains valid data. As a Texture2D I can add multiples of the slice offset to this buffer address when assigning pSysMem and read each slice from a shader. What am I missing? I have tried all combinations of bind and usage flags and various values for MipLevels with no success.

D3D11_TEXTURE2D_DESC sTexDesc;
sTexDesc.Width = 1024;
sTexDesc.Height = 1024;
sTexDesc.MipLevels = 1;
sTexDesc.ArraySize = 2;
sTexDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sTexDesc.SampleDesc.Count = 1;
sTexDesc.SampleDesc.Quality = 0;
sTexDesc.Usage = D3D11_USAGE_IMMUTABLE;
sTexDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
sTexDesc.CPUAccessFlags = 0;
sTexDesc.MiscFlags = 0;

D3D11_SUBRESOURCE_DATA sSubData;
sSubData.pSysMem = ubImageStorage;
sSubData.SysMemPitch = (UINT) (1024 * 4);
sSubData.SysMemSlicePitch = (UINT) (1024 * 1024 * 4);

ID3D11Texture2D* pTexture;

hr = m_pd3dDevice->CreateTexture2D(&sTexDesc,&sSubData,&pTexture);

Here are the relevant pages from MSDN:
ID3D11Device::CreateTexture2D Method
D3D11_TEXTURE2D_DESC Structure

sentences:
Scaling HUD and Camera I wanted to display an HUD, similar to the strategic games' one (like in DotA 2, Warcraft III, Starcraft II or Age of Empires). I didn't really know how to do it, so I managed to create a Texture Object and placed it in front of the scene. The image attached is the HUD itself, with some transparent "holes" in which I placed the cameras. I don't know if this description explains well what I'm trying to say, so I made this screenshot:

The HUD is just a png image with a greater z-index. The image has three "holes": one for the gameboard, one for the dice, and one for the spells you can see on the right. The holes are filled with the cameras, so we can see the objects beyond the transparency. Everything looks quite nice.

But if I change aspect ratio (which was Free Aspect), my layout gets completely screwed up.

Notice that the HUD borders are not fully displayed; the spells on the right are misplaced, and so are the dice.

I managed to get the free aspect resolution, it is 1440x720, a perfect 2:1. But, even if I change my resolution to 800x400, things are not getting better.

I've read something about pillarboxing and letterboxing, but I'm not sure that those techniques will help me with this issue. Is there something I can do to resize my objects and my cameras dynamically to fit the screen for every resolution like in the first screenshot?

Of course, if you have any other solutions for the HUD, I'll be glad to learn!

sentences:
How can I boost cache performance when storing objects in a scene with managed languages? So, for reasons that I won't go into (has to do with my team more so than a good objective reason, unfortunately), I'm building a soft game engine in C# on top of SharpDX. C++ wasn't an option. I can't store objects contiguously in C# when it comes to reference types like classes, so I'm thinking about taking a data-oriented-design approach to storing objects in my scene. Thus, my scene looks a bit like this right now (all of the fields are structs because I can store them by value type, and thus contiguously):

public delegate void UpdateMethod (ref ModelData md, ref Transform t, ...)

class Scene
{
    ModelData[] models;
    Transform[] transforms;
    //...some other fields here
    UpdateMethod[] updateMethods; //delegate array

    void UpdateAll()
    {
         for (int i = 0; i < NUM_GAME_OBJECTS; i++)
        {
            if (updateMethods[i]!= null)
            {
                updateMethods[i](ref models[i], ref transforms[i], ...);
            }
        }
    }
}

The idea being that I can now store the objects contiguously as opposed to just an array of contiguous references to the data if I made each component a class.

Is this even a viable technique, or am I abusing the DOD paradigm? I'm storing all of my objects like this, not just my dynamic ones. Perhaps I could split it up into two sets of arrays for dynamic and non-dynamic, so I'm not tempting branch-predictor slow-downs on the if statement for UpdateAll()?

Will an approach like this create more issues than it attempts to solve? I will note that, while updating occurs here, I outsource the actual carrying out of the component functionality to other systems. For example, an input subsystem determines keys pressed, so an object could check in its unique update method denoted by the delegate; the update doesn't do everything, just behavior specific to that bundle of game object data.

This seems analogous to operating over columns in a row-major language, in that I'm killing performance gain of data locality; am I correct in concluding it would it be beneficial to wrap all of these fields into some GameObjectData wrapper struct, and just store those in an array?

sentences:
What version of OpenGL should I code for, given compatibility and performance considerations? When the OpenGL spec is updated, they only ever add features. So in theory, the latest and greatest hardware with support for the Core and Compatibility profiles should run super old OpenGL1.1 code just fine. This has turned out to be true. I've spent 12 months learning OpenGL1.1 and have a fair grasp on it.

I had a read of a few chapters of one of those fancy new OpenGL4.2 books. Almost all of the features that I rely on have been deprecated (like Display Lists), which lets me assume that there are better ways of doing all these things.

Lets consider that 1.1 is likely to be supported, in full, by ALL modern hardware. 1.1 was released in 1992. I'm not coding the hard way just to support 20 year old PCs. :-p I think its reasonable to assume most gamers are running hardware that bottoms out at about 5-year old mid range.

I think the newer methods are designed to universally be either one of two things: better performing, or easier to code. I read somewhere that its never both though! XD

What version of OpenGL is most widely supported by ~5ish year old hardware? What version makes most sense to use, given these considerations?

sentences:
NPOT texture and video memory usage I read in this QA that NPOT will take memory as much as next POT sized texture. It means it doesn't give any benefit than POT texture with proper management. (maybe even worse because NPOT should be slower!)

Is this true? Does NPOT texture take and waste same memory like POT texture? I am considering NPOT texture for post-processing, so if it doesn't give memory space benefit, using of NPOT texture is meaningless to me.

Maybe answer can be different for each platforms. I am targeting mobile devices. Such as iPhone or Androids. Does NPOT texture takes same amount of memory on mobile GPUs?

sentences:
How to modify VBO data I am learning LWJGL so i can start working on my game. In order to learn LWJGL I got the  idea to implement the map builder so I can get comfortable with graphics programming. Now, for the map creation tool I need to draw new elements or draw the old one's with different coordinates.

Let me explain this:

My game will be a 2D scroller. The map will be consisting of multiple rectangles ( 2 strip triangles). When I click my left-mouse button i want to start the rectangle and when I release it I want to stop the rectangle bottom-right at that position.

As I want to use VBOs I want to know how to modify data inside the VBO based on user input.
Should i have a copy of a vertex array and then add the whole array to the VBO at each user input? How is usually implemented the VBO update?

sentences:
stop previous audio from playing when starting a new one I created a dialogue system with audio it works perfectly fine unless you start skipping the voice lines so then it all becomes a mess with all of the voice lines overlapping is there a way to make it so when you go to the next audio line the previous one stops playing?
Example of what is happening
as you can see in the video you can switch the text just fine and it doesn't show the previous one but for the audio, it just transforms into a jumbled mess, is there a way to fix this or to at least make it so people cant go to the next line until they finish hearing the current one?
DialogueManager Script:
public class DialogueManager : MonoBehaviour
{
public Door1Animation doorAnimation;

public Text nameText;
public Text dialogueText;
public Text changeText;

public AudioManager Sound;

public Animator textBoxAnimation;

public Queue<string> sentences;

public Queue<string> voiceLines;

void Start()
{
    sentences = new Queue<string>();
    voiceLines = new Queue<string>();
}

public void StartDialogue (Dialogue dialogue)
{
    textBoxAnimation.SetBool("Open", true);

    changeText.text = ("Aperte R para continuar");

    nameText.text = dialogue.name;

    sentences.Clear();

    voiceLines.Clear();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();

    foreach (string voiceLine in dialogue.voiceLines)
    {
        voiceLines.Enqueue(voiceLine);
    }

    PlayNextLine();
}

public void DisplayNextSentence()
{
    if (sentences.Count == 1)
    {
        changeText.text = ("Aperte R para fechar");
    }

    if (sentences.Count == 0)
    {
        EndDialogue();
        return;
    }

    string sentence = sentences.Dequeue();
    dialogueText.text = sentence;
}

public void PlayNextLine()
{
    if (voiceLines.Count == 0)
    {
        return;
    }

    string voiceLine = voiceLines.Dequeue();
    Sound.Play(voiceLine);
}

public void EndDialogue()
{
    Debug.Log("End of conversation");
    doorAnimation.openDoor = true;
    textBoxAnimation.SetBool("Open", false);
}
}

AudioManager Script:
using UnityEngine.Audio;
using System;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
public Sound[] sounds;

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;

        s.source.loop = s.loop;

    }

}

private void Start()
{
    Play("BackgroundMusic");
}

public void Play (string name)
{
    Sound s = Array.Find(sounds, sound => sound.name == name);
    s.source.Play();
}
}

Just the part of the interaction code so you can go to the next line/audio:
    public void Update()
{
    if (Input.GetKeyDown(KeyCode.E))
    {

        PersonInteract();
        buttonInteract();

    }

    if (Input.GetKeyDown(KeyCode.R))
    {
        FindObjectOfType<DialogueManager>().DisplayNextSentence();
        FindObjectOfType<DialogueManager>().PlayNextLine();
    }
}

Inspector view of the dialogue manager:

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:
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:
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:
How to reference the right object in Unity So, I'm developing this small 2D project where I have a sphere that detects if objects get close to it from three different directions.

I have successfully found a way to detect if an object touches my line if the object is referenced to a certain LayerMask, in this case the walls.

So, basically I'm doing this:

var layerMask = 1 << 10; //wall layer
float left = 0f, middle = 0f, right = 0f;

Debug.DrawLine (leftStart.position, leftEnd.position, Color.green);
Debug.DrawLine (middleStart.position, middleEnd.position, Color.green);
Debug.DrawLine (rightStart.position, rightEnd.position, Color.green);

leftSpot = Physics2D.Linecast(leftStart.position, leftEnd.position, layerMask);
middleSpot = Physics2D.Linecast(middleStart.position, middleEnd.position, layerMask);
rightSpot = Physics2D.Linecast(rightStart.position, rightEnd.position, layerMask);

Now, what I would like to do is reference the right wall (Horizontal or vertical) and calculate the distance between the wall and my sphere with:

Vector2.Distance(transform.position, wall1.position);

How can I get the reference to the correct wall to do this?

Thank you

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:
Calculating t value to use with Hermite interpolation I'm developing an FPS in Unity using Photon for networking. The Photon-provided interpolation is very basic so I decided to roll out my own using the Hermite spline.

It works good and is significantly better than the provided interpolation.
However, I was wondering what's the correct way to choose the t value. In a perfect world, it should be incremented by deltaTime*timeBetweenPositionUpdates. However, that doesn't work since even if the tickRate is set to 10 for example, sometimes the client sends it at 9.5, and then at 10.2 and so on and so forth. This means that we can't have a constant increment rate for the t value since it'll either lag behind or move too fast and we'll run out of buffered frames.
What I decided to do is to send the time between frame updates as well and interpolate using that. But, this also isn't perfect by any stretch of the imagination and the receiving client will soon lag very much behind.

What I'm doing now is using a multiplier on the t value such that if there is more frames in the buffer than we want to have then it'll speed the interpolation up, and if there's less than how many we want in the buffer then it'll slow the interpolation down. This works pretty well, but it's a hack I believe.

Is there a better way, or a proper way to do this?

sentences:
LibGDX: Shader files in assets - Access is Denied I stored the glsl files in android -> assets -> shaders directory, but when I run the app, an error is displayed:

Error:Gradle: Execution failed for task ':android:mergeDebugAssets'.
Error: java.io.FileNotFoundException: ...android\assets\shaders (Access is denied)

But the problem goes away if I put those files in assets root folder. Can I not store shader files in asset subdirectories? Using Gdx v1.9.3.

EDIT: The issue is not there when running on Desktop, but only on Android. Didn't check others.

UPDATE: Apparently the issue got resolved today. I didn't make any changes but it's working now!

sentences:
Are there many games involving the manipulation of water? I'm in the very, very early brainstorming stages of a game which centers around the manipulation of water and the terrain around it. (i.e., changing the water's state between solid, liquid, gas; building up or tearing down hills to control its flow; and so forth.)  I'm not yet sure if it should be a puzzle game, a platformer, or what.

Usually, when brainstorming a game, I try to find games with similar mechanics to see what is done well, poorly, etc.  But this time, I'm having trouble thinking of any games that use the flow of water as a primary mechanic.  (Pipe Dream is about all that comes to mind.)

So, I'm asking around...  does anyone know of any games where controlling water is a major aspect?  Is there much reference material (of any kind) on the subject of water as a gameplay mechanic?  Or any ideas where to look?

Thanks

sentences:
Can I legally remove the default Unity splash screen by removing it from the APK? While using Unity I export an Android game as an APK. When the APK is run, the first thing that is displayed is the Unity splash screen. I worked out that I could replaced that image by opening the APK like a zip file, looking for the splash screen image  (App.apk/assests/bin/Data/splash.png) and replacing it with any image I wanted.

Is it legal to publish Unity-powered Android game apps with modified splash screens like this? I remember that some games on PS3, 360 and Wii have been created with Unity but don't display a Unity splash screen when run on their respective consoles.

sentences:
Copyright infringement in game title I'm a wanna-be indie developer, and I am working on my first flash game. But, before I even start with the code, I want to know this: When determining the title of my game, how can I decide if it is copyrighted or not?

For example, at first I thought about "Into the Void" for the title. When I Googled it, I found out that it is a name of a song by Black Sabbath. Is it okay if I use this title, or is it copyright infringement?

sentences:
Android OpenGL and non premultiplied textures As I understand it; by default all bitmaps will will get the alpha channel premultiplied in Android if loaded using BitmapFactory.

My setup:
I have a 32bit bitmap(.bmp) where the alpha channel has a gloss map and the rgb is a specular map.

Issue:
I found out that I can load the bitmap without being premultiplied using the bitmap option:

opts.inPremultiplied = false;

Result:
When I render the alpha channel of the texture like this in the shader:

gl_FragColor.rgb = vec3(texture.a);

The resulting mesh is all white and not shades of gray as expected.

I upload the texture with this method:

GLUtils.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image, 0);

I have also tried using this approach

GLES20.glteximage

as well with the same result although I might have done something wrong there.

Can anyone spot where I have gone wrong or what else I need to do?

sentences:
Two player platformer game - gameover issue I'm creating a two player platformer game but facing issues when one of the player dies. So far I have created two players and added the following script to both. The issue I'm facing is that once any of the players hits an obstacle, the dying animation and the gameover screen just keep on repeating. I think this is because I have the code to check if the player is dead in the update function of the gamemanager script. I would like the game to stop as soon as any player hits an obstacle and then the gameover screen should pop up.

public class Player: MonoBehaviour {

public Rigidbody2D myRigidbody { get; set; }

public float jumpForce = 2.0f;

[SerializeField]
public Animator animator;

public bool isDead = true;

public GameManager gameManager;

public bool IsDead
{
    get
    {
        return isDead;
    }
}

void Start () {
    myRigidbody = GetComponent<Rigidbody2D>();
}

void Update () {

        if (Input.GetMouseButtonDown(0) && !IsDead)
        {
           jump = true;
           animator.SetBool("jump", true);
        }else
        {
           animator.SetBool("jump", false);
        }
}

public void OnTriggerEnter2D(Collider2D collision)
{
    if (!isDead && collision.tag == "Obstacle")
    {
        StartCoroutine(Die());
    }

}

public IEnumerator Die()
{
    isDead = true;
    animator.SetBool("Die", true);
    yield return new WaitForSeconds(2);
    gameManager.GameOver();

}

public void Jump()
{
    myRigidbody.AddForce(jumpForce* Vector2.up, ForceMode2D.Impulse);
}

This is the gamemanager script:

public enum GameStates { Start, InGame, GameOver};

[SerializeField]
private Player player;

[SerializeField]
private Player player1;

public GameObject startPanel, ingamePanel, gameoverPanel;

void Update () {

    if(player.IsDead )
    {
        StartCoroutine(player.Die());
        GameOver();

    }

    if (player1.IsDead)
    {
        StartCoroutine(player1.Die());
        GameOver();
    }
}

public void GameOver()
{
    UpdateUI(GameStates.GameOver);
}

sentences:
Faster way to do multi texture blending(HLSL, triplanar texturing and overhang mapping) Right now I'm doing a lot of lerping to blend my textures based on height(under water, mid ground and height ground), normal.y >= 0.0 for the under side of the terrain, fractal blend map for a marble effect and then triplanar mapping for the slopes.

It looks good and runs ok and I'm getting just the right blending effect where I need but I'm just thinking that all the lerping could be bad?

I end up with this in my terrain shader:

//Find the blend value for the blend zones
float IsLowGround = saturate(max(distance(min(input.WSPosition.y, 350), 350) / 300, 0));
float IsHeighGround = saturate(max(distance(min(input.WSPosition.y, 1500), 1500) / 1250, 0));

//Find the flip value
float3 flip = saturate(float3(normal.x < 0.0, normal.y >= 0.0, normal.z < 0.0));

//triplanar
float3 blend_weights = max((abs(normal) - 0.2) * 0.5f, 0.0f);
blend_weights = pow(blend_weights,2.0f);
float total = (blend_weights.x + blend_weights.y + blend_weights.z);
blend_weights /= total;
float2 coord1 = float2(input.WSPosition.zy / 750);
float2 coord2 = float2(input.WSPosition.zx / 150);
float2 coord3 = float2(input.WSPosition.xy /700);

//Marble blend maps
float Blend = BlendMap.Sample(colorSampler, input.WSPosition.xz / 2500).r; // flat blend
float Blend2 = BlendMap.Sample(colorSampler, input.WSPosition.zy / 6000).r;   //slope blend

//Color and Normal blending

//Slope Color With Marble
Color += lerp(ColorMap.Sample(colorSampler, coord1) * blend_weights.x, ColorMap6.Sample(colorSampler, coord1 * 3) * blend_weights.x,Blend2);
Color += lerp(ColorMap2.Sample(colorSampler, coord3) * blend_weights.z, ColorMap6.Sample(colorSampler, coord3 * 3) * blend_weights.z, Blend2);

//Slope Normal with marble
NormalM += lerp(NormalMap.Sample(colorSampler, coord1).rgb * blend_weights.x, NormalMap6.Sample(colorSampler, coord1 * 3).rgb * blend_weights.x, Blend2);
NormalM += lerp(NormalMap2.Sample(colorSampler, coord3).rgb * blend_weights.z, NormalMap6.Sample(colorSampler, coord3 * 3).rgb * blend_weights.z, Blend2);

//Height based Color Blending with marble eg. (mid -> height) -> marble
float4 GroundColor = lerp(lerp(ColorMap5.Sample(colorSampler, coord2 / 1.5) * blend_weights.y, ColorMap1.Sample(colorSampler, coord2) * blend_weights.y, IsHeighGround), ColorMap7.Sample(colorSampler, coord2) * blend_weights.y, Blend);

 //Height based Normal Blending with marble eg. (mid -> height) -> marble
float3 GroundNormal = lerp(lerp(NormalMap5.Sample(colorSampler, coord2 / 1.5).rgb * blend_weights.y, NormalMap1.Sample(colorSampler, coord2).rgb * blend_weights.y, IsHeighGround), NormalMap7.Sample(colorSampler, coord2).rgb * blend_weights.y, Blend);

 //Last Color Blending with underside flip eg. (underwater -> Ground) -> flip
Color += lerp(ColorMap4.Sample(colorSampler, coord2 / 2) * blend_weights.y, lerp(GroundColor, ColorMap3.Sample(colorSampler, coord2 * 1.2) * blend_weights.y, IsLowGround), flip.y);

 //Last Normal Blending with underside flip eg. (underwater -> Ground) -> flip
NormalM += lerp(NormalMap4.Sample(colorSampler, coord2 / 2).rgb * blend_weights.y, lerp(GroundNormal, NormalMap3.Sample(colorSampler, coord2 * 1.2).rgb * blend_weights.y, IsLowGround), flip.y);

Here is what it looks like when rendered:

sentences:
How can I simulate objects floating on water without a physics engine? In my game the water movement is done in a shader using Gerstner equations. The water movement looks realistic enough for a school project but I encounter serious problem when I wanted to do sailing on waves (similar to this). I managed to do collision with land by calculating quad's vertices and normals beneath ship, however same method can not be applied to water because XZ are displaced and Y is calculated in a shader :(

How to approach this problem ?
Is it possible to retrieve transformed grid from shader?
Unfortunately no external physics libraries can be used.

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:
Is it possible to animate the texture of a model? Below is how far I've got. I just made a simple block with user primitives to test it. But I haven't found a way to crop the spritesheet.

textureLava = frames[activeFrame];

This line is how I want it but off course this doesn't work. Is there a way to crop this spritesheet or is there another way to animate the texture of a model?

public void CreateFrames()
{
    for (int i = 0; i < 64; i++)
    {
        frames.Add(new Rectangle(WIDTH + i, i, WIDTH, HEIGHT));
    }
}

public override void Update(GameTime gameTime)
{
    if (System.Environment.TickCount - lastFrameTime > TIME_BETWEEN_FRAMES)
    {
        activeFrame++;
        lastFrameTime = System.Environment.TickCount;

        if (activeFrame > 15)
        {
            activeFrame = 0;
        }
    }

    textureLava = frames[activeFrame]; --> DOESN'T WORK

    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    effect.TextureEnabled = true;
    effect.World = Matrix.Identity;
    effect.View = Camera.ActiveCamera.View;
    effect.Projection = Camera.ActiveCamera.Projection;

    effect.Texture = textureLava;

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        GraphicsDevice.SetVertexBuffer(vertexBuffer);

        GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 10);
    }
}

sentences:
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:
How to hide objects behind an invisible plane? I am using Unity 2019.1.4f1 (personal) in regular 3D mode. I want to make a material for a plane that will cause everything behind that plane to be invisible.

I want a character who steps through a doorway to appear to disappear into "hammerspace" when he passes the door frame. I will post pictures in a minute.

Blender concept (note how space after the doorframe is successfully occluded):

Unity WIP (note how path after doorway is not yet occluded):

sentences:
Unity3D: 'Physics' does not contain a definition for 'Raycast' I'm a complete beginner in Unity 3D, and I'm following a video training. In the video the instructor uses the following code to open a door using raycast:

using UnityEngine;
using System.Collections;

public class HelloRaycasting : MonoBehaviour {

    bool doorClosed = true;

    // Use this for initialization
    void Start () {

    }

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

        Vector3 backward = new Vector3 ( 0, 0, -1);
        Vector3 origin = this.gameObject.transform.position;

        if (Physics.Raycast( origin, backward, 1f) && doorClosed) {
            doorClosed = false;
            GameObject.Find ("Left_Quad").transform.Translate ( new Vector3(-.8f, 0, 0));
            GameObject.Find ("Right_Quad").transform.Translate ( new Vector3(.8f, 0, 0));
        }
    }
}

It works just fine for him. But when I try to run this on my computer I get this error:

  Assets/HelloRaycasting.cs(20,29): error CS0117: 'Physics' does not
  contain a definition for 'Raycast'

In the end I'm not able to access none of the properties and methods of the Physics class.

I'm using Unity 5.3.2f1 (64-bit). What am I doing wrong?

sentences:
How to correctly create bullet rigid from custom .mesh in Ogre? Being new to 3d programming and bullet physics in particular, I am wondering how a 3d model or the mesh generated out of it effects the accuracy of bullet physics simulation.

I have written a small Ogre 3d application in C++, including/using bullet for physics. In a small scene I add a plane as ground and three boxes (simple blender objects that come with Ogre) that have their initial position a bit over that ground. So after starting the application those three boxes fall down until they hit the ground plane, where they move a bit, depending on their initial height and rotation, until they come to a halt.

Watching that scene the bullet physics simulation looks very accurate and realistic, also the boxes seem to touch the ground very exactly.

Ok, then I have created a box model in Sketchup 8 and exported it to an Ogre .mesh file. Then I use this model instead for those three boxes in my scene. The C++ code itself is not changed at all (except that I load the new .mesh file for the boxes).

However, even though on the screen those new box models look exactly as the original ones, their movement is not correct any more. They fall to the ground plane fine, but then they move very weird, it looks not as realistic as before. Even worse, after they have stopped their movement those three boxes now "float" a bit over the ground plane, they do not touch it. I can also see their shadow now below the box on the plane, so they are really not touching the ground plane.

TL;DR: Scene with three boxes, falling down to the ground, simulated by bullet. That works fine with default Ogre (blender) .mesh files for the boxes. But with custom Sketchup models (.mesh files) instead for the boxes, but the same code, the bullet simulation does not work correctly any more.

My question is: how does the mesh of a model impact the accuracy of bullet?
And: what can I do to solve that issue with my custom Sketchup models?

PS: I load the .mesh file and convert it to a bullet rigid body as following:

m_pSceneMgr->createEntity("Cube1", "Cube.mesh");
...
BtOgre::StaticMeshToShapeConverter converter(m_pSceneMgr->getEntity("Cube1"));
btCollisionShape* colShape = converter.createBox();

sentences:
Add points to a prefab in Unity I have a prefab that looks like this:

I have created a couple of 'points' in the Hierarchy using 'Create Element' and I would like to attach them to the prefab, however drag and drop over doesn't work. Why is that?

sentences:
Dealing with multiple prerequisites in goal orientated action planning using A* I'm currently having difficulty reasoning about how multiple prerequisites are satisfied using the A* algorithm during planning.

Assuming the following actions (with prerequisites in brackets):

Get Material

Make Gloves (need material)

Get Iron

Make Axe (needs iron)

And the following goal (prerequisites in brackets):

Chop Tree (needs gloves, needs axe)

Now, assuming I am doing a backward search from the goal, as I understand it, I would start considering actions that have effects that directly correspond to the prerequisites of the node (this is where I think I'm going wrong).

The problem with that is, the first 2 actions to consider are Make Gloves and Make Axe. However, for this goal to be satisfied they both need to be done. If I only build my graph by linking effects to prerequisites, I only consider each of those actions once, and only choose one.

I.e. if I arbitrarily choose Make Axe that leads me to Get Iron, I don't have anything making me reconsider Make Gloves as Get Iron has no prerequisites.

For the actions and goal I had above there are many routes to solving it, below I have highlighted one to illustrate my point. As you can see, in this case I would need Get Iron to be done after Make Gloves even though their effects/prerequisites don't match in any way.

Can someone tell me where I'm going wrong in my thinking?

sentences:
Angle object only in the X axis I'm trying to code a turret to angle towards a target, where I have one part of the turret only rotating on the left/right, and I want to animate another part to only angle up/down. I've got the left/right (RotateTowardsTarget) working, but I can't get the up/down (AngleTowardsTarget) to work, it seems to also rotate the object as well as angle it.

turretXRotation is a child of turretYRotation. These objects form the top of a gun turret, so the base will rotate, and the gun barrel will angle towards the target

/// <summary>
/// Orient the turret weapon towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void OrientWeaponsTowards(Vector3 lookPosition)
{
    RotateTowardsTarget(lookPosition);
    AngleTowardsTarget(lookPosition);
}

/// <summary>
/// Rotate towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void RotateTowardsTarget(Vector3 lookPosition)
{
    // Determine which direction to rotate towards
    Vector3 targetDirection = lookPosition - transform.position;

    // The step size is equal to speed times frame time.
    float singleStep = weaponRotationSpeed * Time.deltaTime;

    // Rotate the forward vector towards the target direction by one step
    Vector3 newDirection = Vector3.RotateTowards(
        turretYRotation.transform.forward,
        targetDirection,
        singleStep,
        0.0f
    );

    // Draw a ray pointing at our target in
    //Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);

    newDirection.y = 0;
    // Calculate a rotation a step closer to the target and applies rotation to this object
    turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);
}

/// <summary>
/// Angle towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void AngleTowardsTarget(Vector3 lookPosition)
{
    // Determine which direction to rotate towards
    Vector3 targetDirection = lookPosition - turretXRotation.transform.position;

    // The step size is equal to speed times frame time.
    float singleStep = weaponRotationSpeed * Time.deltaTime;

    // Rotate the forward vector towards the target direction by one step
    Vector3 newDirection = Vector3.RotateTowards(
        turretXRotation.transform.forward,
        targetDirection,
        singleStep,
        0.0f
    );

    // Draw a ray pointing at our target in
    //Debug.DrawRay(turretXRotation.transform.position, newDirection, Color.red, 3);

    // Calculate a rotation a step closer to the target and applies rotation to this object
    turretXRotation.transform.rotation = Quaternion.LookRotation(newDirection);
}

Does anyone know how I can just make the `turretXRotation` only change it's X value to aim towards the target? I've tried similar stuff to the rotating, by zeroing out some of the x/y/z coords, but I can't seem to crack it.

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:
Game Development In C Only. Is it possible? I am a first year college student in India and want to make a small game as a this semester project.

I am quite good at C and am learning it rapidly but I wanted to ask if developing a game entirely in C (no C++ or C#) I'd love to use these but for college projects, we have strict requirements of using only C.

What I am looking for is a simple top view driving game. It won't have anything fancy and even the visual things will be powered by simple characters. For example, user controlled car can be represented by ▓ and edges of road by series of |'s.
What do you think?

sentences:
How to stop movement when an action key is pressed even if movement key is pressed I'm making a 2d side-scrolling fighting game in game maker:studio and I want to make a code that when the player attacks he stops moving.
I've tried some options:

keyboard_check(ord("D"));

both this and

keyboard_check_pressed(ord("D"));
x += 0

I also tried

hspeed = 0

I also tried adding these to my left and right key events:

if (sprite_index = spr_atk_right)
 {
 x -=4 for right key event or x += 4 for left key event
 }

I have a right key and left key event with the simple code
x += 4 for the right key and x -= 4 for the left key. I was hoping the second set of codes would cancel it out but neither worked.

sentences:
SpriteBatch Draw Using Floats with the Destination Rectangle So I created a nice little isometric tile engine and I have it so that when you scroll with the mouse it changes a variable called scale. Scale is a float and gets passed through the spritebatch.draw() function. I apply scale to all of the math I do when generating the positions of the tiles.

The problem I am having is Rectangle will not accept float numbers so when I make my Dest Rectangle for the spritebatch.draw() I can not use the numbers I need to because they are now floats.

I tried using vector4 instead of rectangle but the spritebatch.draw was throwing an exception saying it was expecting Rectangle not Vector4.

Is it possible to draw the dest rect using floats instead of ints?

Btw the scale is all working properly however since I am casting the floats to ints any scale that should have a decimal gets truncated and I end up with spaces between my tiles.

sentences:
Separate parts of a game engine I'm pretty new in developing videogames. By now I only used SDL with C/C++ to create games. I'm currently learning OpenGL and I realized that to be fluid and easy to maintain the code must be logically separated. Since I want to use OpenGLES on iOS and Android I was wondering how the engine must be imagined in a technical way, some questions came up:

Do I have to separate input/update functions from draw functions in different threads?
Is there only one proper way to think a game engine/loop?
What kind of assets should I use to create a 3D game using openGl ES to get better performance?

EDIT: I figured that I had more questions lacking of answers reading the links DMGregory refered me to. I'll keep reading it till I fully understand it and than ask for the good questions. Thanks a lot.

sentences:
How can I increase the tileset limit in RPG Maker VX? In RPG Maker VX, the default setup allows you to have five tilesets for the map layout.
Is there a way I can increase this limit?

I know it's possible to make "fake" tiles by using events overlaid on the real tiles to show different images. However, this is a huge hassle to setup, and isn't a very clean way of creating the game; I'm hoping there is another way.

sentences: Assistance with bomb throwing mechanics akin to Zelda 2D Does anyone have a good algorithm for managing the carrying and throwing of bombs? I've attempted to find a tutorial and can't find anything that covers the subject matter. I'm just looking for a very high-level algorithm; the coding I can handle.

sentences:
Trying to create a UE4 blueprint or script to recognize set shapes I'm currently developing an indie game using Unreal Engine 4 and I've stopped developing it within the last week because I have hit a massive roadblock..

I am trying to figure out how to create a blueprint (or c++ script if necessary) that can have a library of different shapes such as an L (2x1 blocks) in any order which would fit within a 5x5x5 (x,y,z) crafting grid in the game world. See the screenshot with the L shape near the green arrows as a sort of gun object to configure and craft from blocks so long as it matches that particular shape. It's almost like minecraft's crafting system but instead of in the menu this one is on a platform in the game world.

I've tried researching and looking at stuff on youtube and google searching like blueprinting, grid systems, shape systems, crafting systems, building systems, arrays, and now I am thinking maybe I have to use c++ instead just to try to figure out how to make it happen.

Does anyone with more experience on this stuff have any advice or better ideas on how I can create this? Any help to point me in the right direction is greatly appreciated, thanks in advance!

sentences:
Noisy edges, smoothing out edges between faces via fragment shader I have a generated terrain, with hexagonal geometry, as per screenshot below:

I then generate biomes, but as you can see the borders between them are really ugly and straight. To hide that hexagonal origin, I would need to smooth out the borders between biomes. This is how it looks now in wireframe with real tringular faces:

What I'm aiming for is something more like this:

Each vertex has attibute that holds the biome type, I can also add special attributes to the vertices on the edge between two biomes, but I just don't seem to be able to figure out how to pull this off in shader code, obviously noise is involved here, but how do I make it continous across multiple faces and entire border of multiple biomes?

I'm rendering with WebGL using THREE.js

sentences:
Is SDL2 alone capable of dynamic (or deferred) lighting? I'm talking about JUST SDL2, not OpenGL or DirectX.
Would drawing deferred lighting bulk the CPU up and how would it be done?

sentences:
Best source for sound effects? What is a good source for sound effects for use in an indie game production (C#, XNA)?

The sounds do not need to be free.
They, however, should have a clear licence for commercial use.
The website should allow for searching, browsing and preview (or better: pre-listening).

I already had a look at http://www.1soundfx.com but their collection is not too large. I am specifically looking for sound effects. No music and no ways to make my own sounds.

All help is greatly appreciated!

sentences:
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:
How do I implement Breakout's "multiball" powerup? I'm just starting out and making a breakout clone as my first game. I'm implementing all kinds of powerups, but I'm stuck on multiball. The powerup adds additional bouncing balls to the game.

So far, I've implemented powerups by just adding them to the Ball class as states. This is easy for increasing speed, making the ball sticky, changing sprites and such. When the ball is in one state it behaves in only one way.

Now, how do multiple balls fit into this? I suppose having more balls is more of a function of the game itself than the Ball, so it seems logical to make it a game state instead of a ball state. How would I do this?

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:
Turning a 2D character to face left or right So far I know of the following ways to turn a 2D character to face the other direction (in my case the char can only walk left or right):

Mirror the right walk animation and use that as a separate state in the animation controller.
Simply set a 180 rotation on the game object that hold all of my characters parts when he turns the other way.
Create a transition animation by blending (I don't know if it's called exactly like this) the left oriented sprite and the right one.
Orient the sprite based on its movement direction using this code:

void OrientChar()
{
    Vector3 moveDirection = gameObject.transform.position - _origPos;
    if(moveDirection != Vector3.zero)
    {
        float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
        gameObject.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }
}

1 and 2 will create a rather abrupt change and might not look smooth. How do I make them or is it possible to make them smooth?

For number 3 I have a very basic idea on how to do it. Can I do it directly Unity?

sentences:
How does Halo draw projectiles? I am trying to draw projectiles and doing billboarding.  A projectile consists of a bill-boarded "particle" and a "tracer".  When I billboard a projectile, it cannot be seen when the player's viewing direction is parallel to the projectile axis.

How does Halo or other games solve this problem, so that projectiles can be seen from behind.

sentences:
Why does my terrain turn white when I get close to it? When I zoom in on my terrain it goes white:

The further in I zoom, the greater the whiteness becomes. Is this normal? Is this to speed up rendering or something? Can I turn it off?

I'm also getting these error messages in the console over and over again:

  rc.right != m_GfxWindow->GetWidth() || rc.bottom != m_GfxWindow->GetHeight()

and

  GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly.

Does this bear any correlation on the issue?

Update I create virtual desktops to flit between using the program Deskpot. Turning this program off and restarting has stopped the above errors appearing in the console. However, I still get white terrain when I zoom in. Not a single error message.

I've restarted my computer to no avail.

I have an Asus NVidia GeForce GTX 760 2GB DDR5 Direct CU II OC Edition Graphics Card. Any known issues?

Update I don't think it's fog...

sentences:
Approaching syncing between client and server, in a Tower Defense game I am currently working on a Multiplayer TD, players can join games, and place towers on a map, so far so good.

This is how the game works as of today, when a new game is created, the server initialise a master game, basicly all logic happens here, it tell clients what to visualize. But this being my first MP game, i need some advice about how to keep players in sync with the server game, my questions could be.
"What to do, if a player looses contact to the server for several seconds, therefore getting out of sync"
"What to do, if a player plays with a poor internet connection, and having a latency jumping from 400ms to 3000ms"

I thought of sending data to each client 4 times every seconds, containing information for all entities on the board. This data i would then compare to the client data, and overrule entities that is out of sync, there would then be a tolerate value, so the users would't experience changes on the board, because of small game delays.

However i can imagine this would be a lot of work, and i wanted to ask if there was a smarter solution, i've looked at some post around the net, but could't find any which would apply for my game, feel free to throw links my way.

sentences:
Decoupling AI from game logic Imagine a game with different types of characters or "actors" which can perform actions like walking and shooting. They are implemented using the state pattern to reduce the amount of coupling: each actor has a current state which can be one of the different possible state objects like DefaultState, ReloadingState or StunnedState which determine what happens when its methods like Reload(), Shoot() or Walk(direction) are called. Every frame the current state object updates the actor and returns the next state.

This works great for the player who doesn't need to know anything about the internals. However, an AI controller needs to know its character's current state to make intelligent decisions. For example, in the DefaultState the AI character would walk towards the nearest enemy while in StunnedState it would flee. It seems like every state should have its own AI routine, but how should this be implemented while trying to keep this logic separate from the actor class? The AI could query the actor for its current state and decide its actions based on that, but that would result in a bloated and messy if-else block. The State class shouldn't know anything about the AI so it cannot be in charge of changing the AI's state either. How can I implement an AI which chooses different actions based on the actor's current state while maintaining loose coupling?

sentences:
Should I cull off-screen objects in SDL2 My game will have a large number of objects moving offscreen at any given time, can i just render them all with SDL_RenderCopy even though they are off screen or should I only render them if they are on-screen? I will probably have many hundreds or throusands of objects loaded at a time. My dev machine is quite overpowered for what I'm trying to do but I am conserned that I just won't notice a preformance drop that may affect players with less powerful computers.

So, will checking if each object is on screen before drawing increase performance/lower CPU load, or can I safely let SDL handle this with clipping?

sentences:
Does concurrency inherently introduce "randomness" into a game? When a game is implemented with concurrency (as most games are), does this necessarily, by its very nature, introduce an element of randomness into the game that is outside of the players' control?

Note that when I use the word "random", I'm not meaning to launch into a philosophical debate about the deterministic nature of the system.  I understand that concurrency is deterministic in the sense that the operating system decides which processes to allow time on the CPU and in what order (or the JVM controls which Thread's turn it is to execute, etc).  But my understanding of this is that there is no way to control or predict whether one thread's next command will execute before or after another.

The reason I'm asking is because this seems like a fundamental difficulty for game development where a game is supposedly designed around a player's skill.  Consider a game like League of Legends.  Assume that two players are battling it out.  It's a very close contest between the two and it's coming down to the wire -- so much so that whoever gets their last attack off will be the one to kill the other and win the game for their team.

If the players are implemented using concurrency and the situation really was like this, is it essentially out of the players' hands at this point?  Is the outcome of this match all up to whatever system is arbitrarily deciding which player's thread/process will execute next?  If not, what am I misunderstanding about concurrency?  If so, is there any way around this problem so that a game of skill can always be a game of skill, especially in those most crucial moments?

sentences:
Cross-browser cross-platform web support for immersive/non-casual games I have heard of many plugins/browser technologies that are useful for games, but I didn't dive into any of them yet because I've assumed that omni-support wasn't quite there.  By omni-support, I mean all browsers and all OSs.

Since we've recently had many new game-specific plugins pop up (e.g. Unity), new web standards pop up (e.g. WebGL), and existing standards gain better support in IE (e.g. SVG), I'm wondering if this has changed.

There are three fundamental requirements I see to making immersive games:

Solid mid-to-low level video/audio support (2D and 3D are both interesting)
Mouse capture
Full screen

Are there technologies out there that support all three of these, that are cross-platform and cross-browser (including all the big browsers)?

Standardized solutions are preferrable, but plugin-based solutions are okay, as long as they support free or very cheap development.

Edit

I realize I posed my question as "are there any such technologies".  I'm actually interested in all such technologies.  If there is only one, it may still be useful to list other technologies, what they lack, and when they might get there.

sentences:
Alternatives to storing all my entities in an SQL database I've been trying to build my entity system based on pure SQL data storage as explained in this post series. The idea is that every entity or component is stored in an SQL table. I created my framework to manage that, only to realize that many SQL queries took more than 10ms, which is unsuitable for use in a game loop.

I first thought the delay was I/O-bound, so I created an in-memory MySQL cluster. This was better, but still not real-time enough for a game loop.

Has anyone built an SQL-based entity system? If so, how did you manage to keep query times manageable?

If an SQL database isn't feasible for performance issues, what data structure could I use to retain the entity system idea and the possibilities of direct SQL requests on components?

I've heard of many MMOs running on SQL. Do they use it for only part of the data or a full entity system? How to separate database-stored and classical memory-stored structures in that case?

Edit for clarification: Yes, all game data is stored in the database. If say I run my physics system it will first get data from SQL, then do its stuff, then insert the updated data back to the database.

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:
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:
Buttons only trigger right/left movement once, not continually I have a Unity mobile project where I am trying to use right/left movement using two UI buttons situated accordingly.  The issue is that it only moves the player to the right/to the left one time, not continually when the player is holding the button down.
I'd like the player to be able to hold down a certain button and have the character move constantly in that direction until the button is released.  I've tried making the void into a Coroutine, but nothing working works.
Here is my code.  (rightCallable and leftCallable are attached to the buttons).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playerController : MonoBehaviour
{
    public GameObject player;
    public float speed = 1000f;
    public GameObject left;

    //this is so the player may also use the A and D keys if they want, and it works fine.
    public void Update()
    {
        var movement = Input.GetAxis("Horizontal");
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
    }

    //Below is what isn't working
    public void rightCallable ()
    {
        StartCoroutine("moveRight");
    }

    public void leftCallable ()
    {
        StartCoroutine("moveLeft");
    }

    IEnumerator moveRight()
    {
        var movement = 1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
    }
    IEnumerator moveLeft ()
    {
        var movement = -1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
     }
 }

sentences: Is it possible for a particle to have an infinite lifespan in SceneKit? I'm trying to do an experiment where the user creates particles when they touch the screen, and then the particles just stay in place, only dying in collision. I'm wondering if it would be possible to do this in a way where the particles have an infinite lifespan? I feel like I've done this in Unity before, but never in SceneKit.

sentences:
Is there a turn-based strategy game that allows building AI from scratch? I'm very interested in programming Artificial Intelligence for a turn-based game as a project. However, I'm looking for a (somewhat modern) game and can't really find one i'm interested in.

Particularly, i'm looking at the Civilization francise. I'd love to be able to program the AI of Civilization V for instance. However, as of now, you can only slightly modify the settings of the AI: http://forums.civfanatics.com/threads/artificial-unintelligence.536193/.

Is there any game, which has been released at least in the  last 10 years, that allows programming of the AI to (nearly) ground level?

sentences:
XNA HLSL Shader Glow I have googled this to death, and I still don't quite understand it.

I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by sampling the pixels from a texture, however I've always been curious about how you can make it more advanced so that you could do things like set the glow distance and stuff. If I recall from back when I was creating something like this in a similar project, there was always a limit as to how much I could sample before the computer couldn't handle it, hence limiting the glow distance. I wanted to know if there was a more sophisticated way of doing it, one that would have no glow distance limit? And I'm not referring to lighting ground textures either, the idea I have in my head is to have a set of vertices that all join together to create a LineList (for this example lets say they create a cube), so you have very thin lines creating a shape, and then you can set a glow on this object that has no limit to its distance, kinda like how Photoshop works I guess.

Thanks

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 libraries/engines should I use? I have some pretty decent general programming skills and elementary C/C++ skills. I am a complete noob in game/graphics programming and I would like to start.

I want to gradually learn, starting off by something like Pong, and gradually making more difficult stuff for learning. My ultimate goal is to make some COD:BO zombies clone (I love this game).

So what libraries/engines can you guys recommend, first to even start drawing stuff on the screen, and later more sophisticated stuff for getting a FPS going.

sentences:
Costs/profit of/when starting an indie company In short, I want to start a game company. I do not have much coding experience (just basic understanding and ability to write basic programs), any graphics design experience, any audio mixing experience, or whatever else technical. However, I do have a lot of ideas, great analytical skills and a very logical approach to life. I do not have any friends who are even remotely technical (or creative in regards to games for that matter).

So now that we've cleared that up, my question is this: how much, minimally, would it cost me to start such a company? I know that a game could be developed in under half a year, which means it would have to operate for half a year prior, and that's assuming that the people working on the first project do their jobs good, don't leave game breaking bugs, a bunch of minor bugs, etc.. So how much would it cost me, and what would be the likely profit in half a year? I'm looking at minimal costs here, as to do it, I would have to sell my current apartment and buy a new, smaller one, pay taxes, and likely move to US/CA/UK to be closer to technologically advanced people (and be able to speak the language of course).

EDIT: I'm looking at a small project for starters, not a huge AAA title.

sentences:
How to deal with player inquiries (good, bad, and everything in between)? I understand someone previously posted about dealing with bad suggestions from players. But I'd like to ask about dealing with inquiries in general.

When a game becomes popular, it's inevitable for you to receive heaps of emails from players (can be complaint about bugs, errors in purchases, etc). How do you usually handle these? Do you outsource these kind of things or do you try to answer the mails on your own during your free time? Or maybe create an online community like a forum?

sentences:
How can I use IntelliJ to make Minecraft mods? I'm starting out creating Minecraft mods with my son.

I've seen one YouTube tutorial which sets up project with Eclipse.

Since I don't like Eclipse much, I ask: how would I setup IntelliJ or Android Studio(if feasible) to develop Minecraft mods?

My son specifically want to create roller coaster mods.

sentences: 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 to change variable position within shader - Unity I recently learned how to write shader in Unity and I'm trying to move the texture within one of my variable.

this is the texture I used on the model.

I separated the texture into two shapes, which is texRound and texStar based on position. What I'm trying to do is to move the star texture stored in texStar variable without affecting the position of texRound.

What comes to my mind right now is to use something like this code below, but it doesn't work as the texStar variable only save the color value without the position.

(texStar.x + posModifier).a = texUV.r;

What should I do to access the position of the texStar variable?
Thank you so much in advance.

Here's my full code:

Shader "Custom/ASK RGB" {
    Properties {
        _UV ("UV", 2D) = "white" {}

        // variable I intend to use as modifier value to change the y position of the star texture
        _modifier ("Modifier" , float) = 0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _UV;

        struct Input {
            float2 uv2_UV : texCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // variable used to store the UV texRoundture mentioned
            half4 texUV = tex2D (_UV, IN.uv2_UV.xy);

            // variables used to store the round texture and the star texture
            half4 texRound;
            half4 texStar;

            if (IN.uv2_UV.x > 0.7)
            {
                if (IN.uv2_UV.y > 0.5)
                {
                    texRound.a = texUV.r;
                    texStar.a = 0;
                }

                else
                {
                    texRound.a = 0;
                    texStar.a = texUV.r;
                }
            }
            else
            {
                texRound.a = 0;
                texStar.a = 0;
            }

            texRound.rgb = texUV.rgb;
            texStar.rgb = texUV.rgb;

            o.Albedo =  texRound.rgb * texRound.a + texStar.rgb * texStar.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Converting 3D coordinates to 2D and back? I'm wondering if there is a simple way to convert 3D coordinates to 2D coordinates. Also, if it's possible, to convert in the reverse direction.

I'm using OpenGL(GLUT) in my C++ project.

I am also using SFML for the 2D information (sprites text etc.)

I found out that I can use gluProject(), but I have no idea how to use this.

I'm asking for a simple example of using gluProject() or another example to convert 3D coordinates (such as from the player) to 2D coordinates.

If I can't get the simple process I'm confident that I can figure out the rest.

sentences:
Render on other render targets starting from one already rendered on I have to perform a double pass convolution on a texture that is actually the color attachment of another render target, and store it in the color attachment of ANOTHER render target.  This must be done multiple time, but using the same texture as starting point

What I do now is (a bit abstracted, but what I have abstract is guaranteed to work singularly)

renderOnRT(firstTarget); // This is working.

for each other RT currRT{
    glBindFramebuffer(GL_FRAMEBUFFER, currRT.frameBufferID);
    programX.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, firstTarget.colorAttachmentID);
    programX.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, firstTarget.depthAttachmentID);
    programX.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID); // quadBuffID is a VBO for a screen aligned quad. It is fine.
    programX.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS,0,4);

    programY.use();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, currRT.colorAttachmentID); // The second pass is done on the previous pass
    programY.setUniform1i("colourTexture",0);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, currRT.depthAttachmentID);
    programY.setUniform1i("depthTexture",1);
    glBindBuffer(GL_ARRAY_BUFFER, quadBuffID);
    programY.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
    glDrawArrays(GL_QUADS, 0, 4);
}

The problem is that I end up with black textures and not the wanted result.

The GLSL programs program(X,Y) works fine, already tested on single targets.

Is there something stupid I am missing?

Even an hint is much appreciated, thanks!

sentences:
Can you create a game on an anime/serie/saga already existing? I had kind of an "illumination" by watching a TV serie, and got the urge desire to make it in a game the way I want it. I of course don't intend to make money out of it. So I was curious to know, would I be in a trouble if I made a game, mostly a demo about the first two episodes of the TV serie, on it without asking for any money. Won't the original developper (if by chance hear about it), get me in a court or something ?
(of course in the credits or something i would say that the original serie came from them)
PS : if they don't, then my second question is : Am i allowed to ask for donation, help or something to continue making a sequel, or a full game from that demo ?

sentences:
Camera stops moving forwards near World-Center So basically this is a problem I've been having since forever. I implemented a Camera System, it works fine but somewhere around the center (0, 0, 0) of the world it doesn't work. Actually it works, but it always moves back at the position I was before. Like, if I'm at (1, 0, 0), walking forward will make me stay at (1, 0, 0), while moving backwards will not. The weird thing is that as said before it only happens there and if I'm moving forwards, backwards, left and right work perfectly!

That's how I do my Walking:

XMVECTOR D = XMVectorReplicate(d);
XMVECTOR L = XMLoadFloat3(&m_LookDirection);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMStoreFloat3(&m_Pos, XMVectorMultiplyAdd(D, L, P));

My Strafing (Left to Right) is basically the same thing.
I update my ViewMatrix like that:

XMVECTOR R = XMLoadFloat3(&m_Right);
XMVECTOR U = XMLoadFloat3(&m_Up);
XMVECTOR L = XMLoadFloat3(&m_Look);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMVECTOR WU = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

//Compute wuv vectors for camera space
XMVECTOR w = XMVector3Normalize(XMVectorSubtract(L, P));
XMVECTOR u = XMVector3Normalize(XMVector3Cross(WU, w));
XMVECTOR v = XMVector3Cross(w, u);

XMStoreFloat3(&m_LookDirection, w);
XMStoreFloat3(&m_Right, u);
XMStoreFloat3(&m_Up, v);

Then I fill in the ViewMatrix but that's unimportant.

Hope someone knows that basic mistake I'm doing!

Thanks

sentences:
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:
How to create polygonal or elliptical colliders by python tkinter? I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries.
My problem is colliders. I need to detect collisions of game objects. First I used a circle collider (it's easy). But using only circles in a game is not good, so I decided to use polygonal or elliptical colliders, but I don't know how to do it without external libraries such as pygame. Could anyone help me?

My question shorter:

How to detect polygons' or ellipses' collisions in python tkinter canvas using only standard libraries?

P.S. And how to detect collisions of an inclined rectangle?

sentences:
Libgdx OrthographicCamera culling problem with zooming When I set zoom on an orthographic camera to anything above 1 I get a strange black border on the bottom of the screen.

I suspect that this might be some sort of culling problem. I use a viewport to control the game resolution, and no matter the size the borders are there.

The camera is set on a direction (-1,-1,-1) basicaly isometric. Also it is positioned well above to origin at (1113,1113,-1113). Far plane at 7777 near at 0.00001f. The ground plane is at 0,0,0 laying in the xz axis, with an other plane on top of it sligtly off to the left and with a 45 degrees on its axis to face the camera.

Here is an image of the problem:

Posting code wont really help here since I only use defaults almost everywhere, but if you need it just tell.

sentences:
Considerations of using online portal for game testing and feedback I am working on a fairly simple indie game. I wanted to get some live feedback before taking the game all the way to completion. I am able to release a beta version with stripped down graphics, and was thinking of putting this on an online game portal like Kongregate. If the game is popular I will carry on and make a more advanced version to release on the various app stores.

My question is, are there any pitfalls to think about regarding the above? How far along should the final game be before releasing the demo? Here are my thoughts so far:

Pro:

Good way to test and get feedback
Some revenue if portal features royalties

Con:

Possibility for game to get cloned/ripped off
Smaller audience for final game if they played the online version

sentences:
Referencing in unity Background: We have two people in the team, one of which is a UI designer and the other is the Unity3d developer. The designer makes the 3d models in Maya and sends them to developer so that he can add interaction.

Issue: Once the developer starts putting the functionality on top of the model, we lose a lot of flexibility in terms of UI development. Specifically- any change in the textures/colours of the walls requires him to hook up the action scripts from scratch for the new model.

Question: Is there something like 'referencing' in unity3d so that we can keep improving the functionality and the aesthetics in parallel?

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:
XNA 3rd Person Camera - pitch reverses when facing backwards? I have a 3rd person camera which rotates around the Y axis fine (yaw) and when I am facing forward (0, 0, -1) moving the mouse up moves the camera up and down great. But the more I turn the player and camera the the less the camera moves up and down until I get to 90 degrees where it almost stay still and at 180 it moving the mouse up moves the camera down!

Any ideas? How should I be calculating camera pitch? The player only yaws - it does not roll or pitch. The camera yaws and pitches. The cameras update method looks like:

    public void Update(Vector3 playerPos, float pitch, float yaw)
    {
        Matrix rotation     = Matrix.CreateRotationY(yaw) * Matrix.CreateRotationX(pitch);
        Vector3 newOffset   = Vector3.Transform(offsetAmount, rotation);

        cameraPos   = playerPos + newOffset;
        View        = Matrix.CreateLookAt(cameraPos, playerPos, Vector3.Up);
        Projection  = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Constants.AspectRatio, Constants.NearClip, Constants.FarClip);
    }

sentences:
How can I resolve collisions at different speeds, depending on the direction? I have, for all intents and purposes, a Triangle class that objects in my scene can collide with (In actuality, the right side of a parallelogram).

My collision detection and resolution code works fine for the purposes of preventing a gameobject from entering into the space of the Triangle, instead directing the movement along the edge.

The trouble is, the maximum speed along the x and y axis is not equivalent in my game, and moving along the Y axis (up or down) should take twice as long as an equivalent distance along the X axis (left or right).

Unfortunately, these speeds apply to the collision resolution too, and movement along the blue path above progresses twice as fast. What can I do in my collision resolution to make sure that the speedlimit for Y axis movement is obeyed in the latter case?

Collision Resolution for this case below (vecInput and velocity are the position and velocity vectors of the game object):

// y = mx+c
// solve for y. M = 2, x = input's x coord, c = rightYIntercept
lowY =  2*vecInput.x + parag.rightYIntercept ;

...

else
{
    // y = mx+c
    // vecInput.y = 2(x) + RightYIntercept
    // (vecInput.y - RightYIntercept) / 2 = x;

    //if velocity.Y (positive) greater than velocity.X (negative)
    //pushing from bottom, so push right.
    if(velocity.y > -1*velocity.x)
    {
            //change the input vector's x position to match the
            //y position on the shape's edge. Formula for line: Y = MX+C
            // M is 2, C is rightYIntercept, y is the input y, solve for X.
        vecInput = new Vector2((vecInput.y - parag.rightYIntercept)/2, vecInput.y);
        Debug.Log("adjusted rightwards");
    }
    else
    {
        vecInput = new Vector2( vecInput.x, lowY);
            Debug.Log("adjusted downwards");
    }
}

sentences:
How 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:
Unity 5: Downloading Standard Assets won't work I am watching a tutorial on using Unity 5 to make a simple RPG. I need to download Standard Assets. I download Standard Assets from the Asset Store and it wants me to import it into my project. I'm like, 'Fair enough.'
So, in the middle of importing, it crashes and tells me to send a report to Unity, so I do.
I delete it from both my project and Unity itself and try again. IT FAILS.
What is wrong?

sentences:
Java Slick2d Delta ( time ) In Java slick2d , i started printing out Delta which is supposed to be the time and it prints out is 16 or 17  forever, so how does this help me if i want to tell an object when it needs to do something, example : IF (createdtime + 60miliseconds < delta )

60miliseconds after its creation , do something

sentences:
Rotating a square rendered on a Bitmap I'm writing a Software Renderer for fun/learning. Basically, it's just a giant array of integers which contain hexadecimal values (representing colour) that are rendered to the screen....

int screenWidth = 16;
int screenHeight = 16;
int[] pixels = new int[screenWidth * screenHeight];
Arrays.fill(pixels, 0xffff00ff);

Something like that, the above should render a pink screen (255, 0, 255). So my problem is I've written a method that will fill a rectangle...

public void fillRect(int x0, int y0, int x1, int y1) {
    x0 += xOffs; // apply offset to each vertex
    y0 += yOffs;
    x1 += xOffs;
    y1 += yOffs;

    if (x0 < 0) x0 = 0;
    if (y0 < 0) y0 = 0;
    if (x1 >= width) x1 = width - 1;
    if (y1 >= height) y1 = height - 1;
    for (int y = y0; y <= y1; y++) {
        for (int x = x0; x <= x1; x++) {
            components[x + y * width] = 0xDEADBEEF;
        }
    }
}

And it works fine, although I want to try and rotate the quad by 90 degrees, then render it to the bitmap. So I tried this....

public void fill(int x0, int y0, int x1, int y1) {
    final int theta = 90;
    x0 = (int) (x0 * Math.cos(theta) - x0 * Math.sin(theta));
    x1 = (int) (x1 * Math.cos(theta) - x1 * Math.sin(theta));
    y0 = (int) (y0 * Math.sin(theta) + y0 * Math.cos(theta));
    y1 = (int) (y1 * Math.sin(theta) + y1 * Math.cos(theta));

    x0 += xOffs; // apply offset to each vertex
    y0 += yOffs;
    x1 += xOffs;
    y1 += yOffs;

    if (x0 < 0) x0 = 0;
    if (y0 < 0) y0 = 0;
    if (x1 >= width) x1 = width - 1;
    if (y1 >= height) y1 = height - 1;
    for (int y = y0; y <= y1; y++) {
        for (int x = x0; x <= x1; x++) {
            components[x + y * width] = hex;
        }
    }
}

Although it doesn't work, nothing is shown on the Window. Any ideas? I have a feeling after the rotation, the entire method is wrong. Any help would be great :)

sentences:
How do I perform collision resolution for rigid bodies of varying volume? I am currently trying to develop a small physics engine for my games. I have created bounding volumes for different rigid bodies. However, I am having problems handling collision resolution, more specifically with determining the direction to apply the impulse to the objects and their changes in velocities.

How do I perform collision resolution for rigid bodies of varying volume? Is there a general solution for resolving collision between all rigid bodies like sphere, AABB or OBB, or do I have to specifically arrive at a solution for each scenario?

sentences:
Main camera transform.forward becomes up and down when looking from above The camera script is a 3rd person orbit camera, when I look straight it does what it supposed to do which is walk in the direction the camera is pointing, but when the camera is looking down from above the player, the camera's forward is now up. This means when I press W to go forwards I go into the ground and when I press S it goes upwards.

Here is my movement script:

    private void FixedUpdate()
    {
    float x = Input.GetAxisRaw("Horizontal");
    float z = Input.GetAxisRaw("Vertical");

    Vector3 moveDirection = Vector3.zero;
    moveDirection += Camera.main.transform.right;
    moveDirection += Camera.main.transform.forward;
    moveDirection.y = 0;
    // Rotation
    if (x != 0 || z != 0)
    {
        anim.SetBool("Walking", true);
        if (x != 0)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(moveDirection), 0.4f);
        }
        else
        {
            transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, Camera.main.transform.localEulerAngles.y, transform.localEulerAngles.z);
        }

    }
    else
    {
        anim.SetBool("Walking", false);
    }
    // Moving
    if (Input.GetKey(KeyCode.LeftShift) && !idle)
    {
        anim.SetBool("Running", true);
        rb.position += z * Camera.main.transform.forward * Time.deltaTime * runSpeed;
        rb.position += x * Camera.main.transform.right * Time.deltaTime * runSpeed;
    }
    else
    {
        anim.SetBool("Running", false);

        rb.position += z * Camera.main.transform.forward * Time.deltaTime * moveSpeed;
        rb.position += x * Camera.main.transform.right * Time.deltaTime * moveSpeed;
    }
}

while I'm asking, the movement script gets doubled when two keys are pressed, how do I fix it while keeping the same functionality of my current movement script?

sentences:
Is it worth it, to try and prevent cheaters? Perhaps one of the biggest issues that plague FPS-games are cheaters.

If you use a server-authoritative model, you will prevent some level of cheating. But why do this if people can still aimbot?

sentences:
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:
Trouble getting shadow maps working I am trying to implement shadow maps in my game following this tutorial. For some reason, the light is not being occluded.

In the above screenshot, the big white sprite in the foreground is a rendering of what the occlusion map looks like. In the background, you can see the result does not produce any shadows. It's hard to see, but in the top left it shows the shadow map.

Enlarged version of the shadow map:

The occlusion map and the shadow map seem to be generating correctly, so it must be an issue with how I'm taking it into account when rendering the light. Here is the fragment shader for the light:

#version 330

uniform sampler2D uDiffuseTexture;
uniform sampler2D uNormalsTexture;
uniform sampler2D uShadowMap;

uniform vec4 uLightColor;
uniform float uConstAtten;
uniform float uLinearAtten;
uniform float uQuadradicAtten;
uniform float uColorIntensity;

uniform vec4 uAmbientColor;

in vec2 TexCoords;
in vec2 GeomSize;

out vec4 FragColor;

float sample(vec2 coord, float r) {
    return step(r, texture2D(uShadowMap, coord).r);
}

float occluded() {
   float PI = 3.14;

   vec2 normalized = TexCoords.st * 2.0 - 1.0;
   float theta = atan(normalized.y, normalized.x);
   float r = length(normalized);
   float coord = (theta + PI) / (2.0 * PI);

   vec2 tc = vec2(coord, 0.0);
   float center = sample(tc, r);

   float sum = 0.0;

   float blur = (1.0 / GeomSize.x) * smoothstep(0.0, 1.0, r);

   sum += sample(vec2(tc.x - 4.0*blur, tc.y), r) * 0.05;
   sum += sample(vec2(tc.x - 3.0*blur, tc.y), r) * 0.09;
   sum += sample(vec2(tc.x - 2.0*blur, tc.y), r) * 0.12;
   sum += sample(vec2(tc.x - 1.0*blur, tc.y), r) * 0.15;

   sum += center * 0.16;

   sum += sample(vec2(tc.x + 1.0*blur, tc.y), r) * 0.15;
   sum += sample(vec2(tc.x + 2.0*blur, tc.y), r) * 0.12;
   sum += sample(vec2(tc.x + 3.0*blur, tc.y), r) * 0.09;
   sum += sample(vec2(tc.x + 4.0*blur, tc.y), r) * 0.05;

   return sum + smoothstep(1.0, 0.0, r);
}

float calcAttenuation(float distance) {
    float linearAtten = uLinearAtten * distance;
    float quadAtten = uQuadradicAtten * distance * distance;

    float attenuation = 1.0 / (uConstAtten + linearAtten + quadAtten);

    return attenuation;
}

vec3 calcFragPosition(void) {
    return vec3(TexCoords*GeomSize, 0.0);
}

vec3 calcLightPosition(void) {
    return vec3(GeomSize/2.0, 1.0);
}

float calcDistance(vec3 fragPos, vec3 lightPos) {
    return length(fragPos - lightPos);
}

vec3 calcLightDirection(vec3 fragPos, vec3 lightPos) {
    return normalize(lightPos - fragPos);
}

vec4 calcFinalLight(vec2 worldUV, vec3 lightDir, float attenuation) {
    float diffuseFactor = dot(normalize(texture2D(uNormalsTexture, worldUV).rgb), lightDir);

    vec4 diffuse = vec4(0.0);
    vec4 lightColor = uLightColor * uColorIntensity;

    if(diffuseFactor > 0.0) {
        diffuse = vec4(texture2D(uDiffuseTexture, worldUV.xy).rgb, 1.0);
        diffuse *= diffuseFactor;
        lightColor *= diffuseFactor;
    } else {
        discard;
    }

    return (uAmbientColor + diffuse + lightColor) * attenuation;
}

void main(void) {
    vec3 fragPosition = calcFragPosition();
    vec3 lightPosition = calcLightPosition();

    float distance = calcDistance(fragPosition, lightPosition);
    float attenuation = calcAttenuation(distance);

    vec2 worldPos = gl_FragCoord.xy / vec2(1024, 768);
    vec3 lightDir = calcLightDirection(fragPosition, lightPosition);

    lightDir = (lightDir*0.5)+0.5;

    float atten = calcAttenuation(distance);
    FragColor = calcFinalLight(worldPos, lightDir, atten) * vec4(vec3(1.0),
    occluded());
}

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:
Disable buffer swapping in LibGDX Is there a way to disable buffer swapping in LibGDX every time the "render" call of ApplicationListener returns? I mean - I'm looking on some way to be able to tell the framework if I want the buffers swapped each frame.

The Application interface doesn't expose any such method, neither it is possible using static Gdx.graphics reference.

Side note: please refrain from answers saying I shouldn't or something in this flavor - I know what I need and why I need it.

sentences:
Refer to a gameobject on start So I want my script to set the initial position of an object depending on the size of the screen and whatever. How do I refer to the gameobject? I know you can modify stuff like their location if the user clicks on it, but how do I refer to the gameobject right when the program starts?

Also, would it be better to have the object already exist and then move it to the right location on start, or instantiate it in the right location on start? How would I do either of these things?

sentences:
Java- Trig based movement I have been trying to create a smooth movement technique that would allow me to move in all directions, not just the 8 cardinal directions.
I have tried to use this doing trig, and while the coordinates are being calculated correctly, drawing anything onto graphics requires me to use integers. Because of the rounding, the movement is reduced to the 8 cardinal directions again. How can I get around the draw methods only using integers?

I calculate the movement by taking the current x position, and adding the product of the speed and sin/cos of the angle of movement

public void moveForward(Block b) {

        b.x += speed * Math.sin(angle);

        b.y += speed * Math.cos(angle);
}

Here is the Block class:

import java.awt.Graphics;

public class Block {
int x, y;
public Map() {
    x=0;
    y=0;
}

public void Draw(Graphics g) {
    g.drawRect(x,y,100,100);
}

And this is the panel class that draws the movement:

import java.awt.Graphics;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JPanel;
import javax.swing.KeyStroke;

public class Panel extends JPanel{
Block block;
Movement movement = new Movement(0);
boolean mforward,mback,rright,rleft;

public Panel() {
    block = new Block();
    setKeyBinds();
    game.start();
}

Thread game = new Thread(){
    public void run(){
        while(true){
        if(mforward)
            movement.moveForward(block);
        if(mback)
            movement.moveBack(block);
        if(rright)
            movement.addangle(1);
        if(rleft)
            movement.addangle(-1);
        repaint();
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {}
        }
    }
};

public void paintComponent(Graphics g){
    super.paintComponent(g);
    block.Draw(g);
    movement.Draw(g);
}

//Following code is for setting up keymapping

private void setKeyBinds() {
    getInputMap().put(KeyStroke.getKeyStroke("UP"), "MOVEUP");
    getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "MOVEDOWN");
    getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "MOVELEFT");
    getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "MOVERIGHT");
    getInputMap().put(KeyStroke.getKeyStroke("released UP"), "STOPUP");
    getInputMap().put(KeyStroke.getKeyStroke("released DOWN"), "STOPDOWN");
    getInputMap().put(KeyStroke.getKeyStroke("released LEFT"), "STOPLEFT");
    getInputMap().put(KeyStroke.getKeyStroke("released RIGHT"), "STOPRIGHT");
    getActionMap().put("MOVEUP", moveforward);
    getActionMap().put("MOVEDOWN", moveback);
    getActionMap().put("MOVELEFT", rotateleft);
    getActionMap().put("MOVERIGHT", rotateright);
    getActionMap().put("STOPUP", stopup);
    getActionMap().put("STOPDOWN", stopdown);
    getActionMap().put("STOPLEFT", stopleft);
    getActionMap().put("STOPRIGHT", stopright);
}
AbstractAction moveforward = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        mforward=true;
    }

};
AbstractAction moveback = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        mback=true;
    }

};
AbstractAction rotateleft  = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        rleft=true;
    }

};
AbstractAction rotateright = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
    rright=true;
    }

};
AbstractAction stopup = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
mforward=false;
    }

};
AbstractAction stopdown = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        mback=false;
    }

};
AbstractAction stopleft = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        rleft=false;
    }

};
AbstractAction stopright = new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent arg0) {
        rright=false;
    }

};

}

sentences:
Efficient way to store “item” objects in a simple game I am developing a simple text-based game from scratch in Java. In this game, the user is able to collect items and store them in an inventory.
My question is: how should I organize the internal structure of my game so that I can load these items in an efficient way?
I need to be able to create fresh instances of an item whenever the user acquires an item of that type, or when instantiating any feature in the game that contains items. In order to do so, I feel like I need some sort of "master list" of all items that I can just copy out of by indexing into the correct location in the list.
I've come up with two potential solutions:

Hard-code this entire giant list into a data structure within my game

Somehow load these items from an XML file at startup and then populate the "master list" of items on the fly

Pros of option 1:

Relatively easy
No IO time
Allows me maximum efficiency in designing the actual item objects

Cons of option 1:

Hard to maintain
Bloats source code
Very tedious to implement

Pros of option 2:

Easy to add/remove/modify items
Allows the user to customize the game if they want to

Cons of option 2:

Requires that I design my objects much more carefully so that they can be built on the fly and stored

Requires that I perform a deep copy from the master list each time I need a new copy of a specific item

I have to write an "item-builder" that is capable of translating the XML input into an actual item object in memory.

Neither of these ideas feels very good to me. Is there something obvious I've missed?

sentences:
Mouse Cursor Scaleform 4 / AS3 I just solved my issue

in my object (on the stage) I forgot to name the element

I'm trying to make workin a custom mouse cursor on my Scaleform menu.
I have follow some tutorials but nothing good...

Right now I have tried the Matt Doyle's AS :

import scaleform.gfx.Extensions;
Extensions.enabled = true;

Mouse.hide();
var mCursor:MovieClip;
mCursor.mouseEnabled = false;
mCursor.tabEnabled = false;

function handleMouseMove( e:MouseEvent ):void
{
    mCursor.x = e.stageX;
    mCursor.y = e.stageY;
}

stage.addEventListener( MouseEvent.MOUSE_MOVE, handleMouseMove, false, 0, true );

but i'm little confused on how declare the cursor
should I add it on the stage, or can I use some addChild() to have it on the screen

for information mCursor is also the name of the cursor movieClip in my library

sentences:
Packing jar files into library jar files This question is not about packing a simple jar file (e.g. lwjgl) into a runnable jar file. I know how to do this using JarSplice. So if I have a game which uses JInput, I will pack my game jar and jinput.jar using JarSplice and enter the natives in the process. The problem arises when I want to create a custom library that uses JInput, and then pack that into my games. See, the whole idea of writing a game library is that I don't ever have to even copy code like the wrapper I wrote for JInput Controller, and I always have a definitive version inside a library jar. Basically what I want to do is create a jar file of my library, pack jinput.jar into it using JarSplice, possibly with the natives as well, and then when I want to export a jar of my game, I either export it automatically through Eclipse with the library jar, or, if that doesn't work, use JarSplice.

I've tried several solutions, and nothing works. When I try to pack the game jar and the library jar using JarSplice, I get an error saying that there's either duplicate .project or .classpath. When I try to export my game through Eclipse with the library jar, it won't run (which is to be expected), but then, if I try to attach the natives with JarSplice, it doesn't give me any errors but the jar doesn't run.

I'm not expecting anyone to solve this, but if anyone has an idea, something that will allow me to never look at the Gamepad code ever again, that would be awesome. I don't care if I have to package my library jar using JarSplice 5 times, and then do the same with the game jar, as long as it works. Otherwise I'll just have to copy the Gamepad class into every project alongside the library jar. :(

Edit: to clear things up, here's what I'm trying to do-
JInput has a class Controller, for controller input.
My_Library has a class Gamepad, which is a wrapper for JInput's Controller.
My_Game should be packed with My_Library so that it can access My_Library's different utilities, including Gamepad (for example, the class Player in My_Game has a field Gamepad for the player to pass gamepad input).
If I can't pack them all into one fat jar, I guess it's OK, as long as I'll be able to place Gamepad in My_Library and access it from My_Game.

sentences:
Logic behind a cubic reflection I'm creating a cube in WebGL made of mirros that have to reflect the object inside of it.

At the moment I'm stuck because I don't understand the correct logic to implement to achieve the result.
I tried put a camera in every face of the cube in order to have a cubemap to apply. The problems come when I try to rotate the cube: I'm not able to make the cameras follow the rotation.

What's the correct logic to implement?

These images could give the idea of what I'm trying to do:

sentences:
Playing movies with OpenGL in Java I am trying to play a movie file into an OpenGL texture in a Java application. I am using JOGL and have a basic OpenGL scene, but I have no idea how to play a movie into a texture.

The only thing I could find was this:

http://paulo.ragonha.me/blog/2008/08/java-movie-playback-jogl-fobs4jmf.html

It is quite old and uses JOGL 1.1 and Fobs4JMF, which is no longer maintained. I managed to get it to build in eclipse but it wasn't able to read my movie clip. I could probably convert the movie clip to an older codec to see if that works, but I would rather have a modern solution.

I am a professional game developer, so the OpenGL part is no problem, but I am new to Java (coming from a C++ background).

Is there any modern library that wraps this functionality in an easy to use package?

sentences:
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 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:
Allow code after a bugged line to continue without use of try and catch My problem is with C# in unity, but I think the problem can be applied to all coding languages.

For example I have a start function/event that may initiate many things. Some lines of code may issue a bug but I want to allow new lines of code run after that without having to encapsulate every line of code with try and catch. Is there any common solution for this that I'm missing?

sentences:
Should developers make their games easier with new versions? It seems that the game Angry Birds is becoming gradually easier with new versions. Maybe so people get the illusion of progress and satisfaction of breaking new records?

I would like to know if gradual small modifications of games to enhance the sense of improvement and learning by users is known/common/standard practice in game developing. (I don't mean to say that there is anything wrong with such a practice.)

sentences:
Recommend a way to draw thousands of particles (liquid) per frame in Unity3d I'm writing a plugin for this library for Unity3d.
I have it working and now I am looking for an efficient way to draw the particles.
My 1st test just uses sprites and runs fine on my laptop but I doubt it will be so good on a mobile device.

Is there a cheap way of simply drawing lots of particles to the screen each frame?
The library generates an array of all the particle positions which updates in FixedUpdate() so I can just draw everything in that array each frame.

I'm thinking maybe somehting in the Graphics namespace would handy here, like maybe Graphics.DrawTexture

Also I might consider doing some kind of metaballs like pass over the particles to make them look more liquid like.

sentences:
Unreal Engine 4.18 - Knife (Weapon) collides with character capsule collision I have a character and he has a knife in his hand. When Run / Walk action happens hands move and so does knife, its collision collides with character's capsule collision and causes issue in movement.

More info:
Component Hierarchy looks like

sentences:
Rotating object along bezier curve: not rotating enough? I tried to follow the instructions from the threads on the forum (Cocos2d rotating sprite while moving with CCBezierBy) with Unity, in order to rotate my object as it moves along a bezier curve. But it does not rotate enough, the angle is too low, it goes up to 6 instead of 90 for example, as you can see on this image (the y eulerAngle is at 6, I would expect it to be around 90 with this curve) :

EDIT: here is the solution :

Vector3 v3 = newPos - oldPos;
v3.y = 0.0f;
transform.rotation = Quaternion.LookRotation(v3);

Here is the code (in c# with Unity) : (I am comparing x and z to get the angle, and adding the angle to eulerAngles.y so that it rotates around the y axis)

void Update () {
        if ( Input.GetKey("d") ) start = true;
        if ( start ){
            myTime = Time.time;
            start = false;
        }
        float theTime = (Time.time - myTime) *0.5f;
        if ( theTime < 1 ) {
            car.position = Spline.Interp( myArray, theTime );//creates the bezier curve
            counterBezier += Time.deltaTime;

            //compare 2 positions after 0.1f
            if ( counterBezier > 0.1f ){
                counterBezier = 0;
                cbDone = false;
                newpos = car.position;
                float angle = Mathf.Atan2(newpos.z - oldpos.z, newpos.x - oldpos.x);
                angle += car.eulerAngles.y;
                car.eulerAngles = new Vector3(0,angle,0);
            }
            else if ( counterBezier > 0 && !cbDone ){
                oldpos = car.position;
                cbDone = true;
            }

Thanks

sentences:
Pub/Sub or message passing in multiplayer server backend? For my masters thesis I'm going to develop a scalable multiplayer server for locationbased games. It's going to be a "service oriented architecture" e.g. one dedicated service for positions, one for the database, login etc. However 1..n frontend services for the clients to connect to. Scalability will be tested with simulated clients on some other machines. However, I'm still undecided on how my services will talk to each other.

On the one hand, there is publish/subscribe. And even there are different ways to implement it, using Multicast or let each subscriber subscribe directly with the publisher. The good thing with pub/sub is, that each message will be sent to every service that is interested, e.g. the Logger-Service receives a position update as well as the position service. I can also have some "shadow" services that keep in sync in case the major services crashes. Depending on the implementation pub/sub feels like flooding my internal network with messages. And flooding is never a good idea.

Then there is message passing. When the Frontend-Service receives a message, it finds out what type of message it is, finds the service that deals with this type and forwards the message to it. But there has to be a service discovery first, which requires some multicast or service directory.

There are pros and cons for each type. In an article on high scalability I read that Playfish uses the message passing method. But using pub/sub sound appealing too. Maybe someone can tell me which way is better.

Edit:
I have to admit it isn't so clear what I'm asking.
Imagine one frontend service receives a "position update" message from one of the clients. With a pub/sub system, I think about calling something like this: Network.publish(Topic,Message) or Network.publish(PositionUpdateType, Message).
Using a message passing system I might call: Network.send(PositionManager, Message).
I think pub/sub seems to be like "fire and forget", where the message passing is some kind of "direct" connection. My question is: Which one is better suited for the job or should I even use a combination of both?

sentences:
Algorithm for Circle with fixed radius to cover most points I'm in need of an algorithm to find the best spot for a circle with a fixed radius r to cover as many points as possible on a 2D grid, preferably O(n).

Currently I tried 2 different approaches:

The averaging Method
The 'Heat-Map' Method

On the averaging Method I calc the center of all points and then I check how many points are in range (r) of that center, if the number is as high as the given points it returns the spot, else the furthest point is removed from the list and the steps repeat.

+: Very fast
-: Often inaccurate

On the Heat-Map method I generate possible circle center points around all points. If a point is already created I increase it's count by 1. The point with the highest count and lowest total distance to the points in range (r) is the center.

+: Perfect center (depending on scale)
-: Slow (depending on scale)

About scale: map is huge 10000x10000, a circle with radius 400 would contain thousands of possible centers, so I scale all points to the same system with roundings.
The higher the scale, the less points and faster algorithm but more inaccurate center. But still more accurate than 1. Method.

Do you guys know any other algorithms/ways/Tipps/Performance Boosters?

Edit: maybe minimum enclosing circle + removing furthest Point Till MEC.radius <= Radius...

Edit2: or connect all points with lines and check for most intersections, just came to my mind

Edit: Here's an image with Algorithm #2

Another Image of Algorithm #2

sentences:
When saving data locally for a mobile game, how to protect it? I am designing a mobile (iOS/Android) game and I try to save data (such as levels, coins, status) in local files.

In this way, I am concerning a case that someone can just copy these files and give them to a friend, so the friend can have achieve certain levels and all the coins held in the data files right away.

Instead of saving the data in a server, is there any way to prevent this happen?

I am thinking to encrypt the data with a key that is unique for a device. Is this a good idea or it might cause some other problem?

sentences:
Projective texturing and falloff I quite understand how projective texturing works. I implemented successfully a shader for that following nvidia doc.

The major problem I'm facing is that with that implementation the projector frustum is used only to determine the texture coordinate in projective space, but it doesn't clip anything outside the projective frustum volume.

In other words, if I have a projector pointing toward a object, the texture will be projected on it even if the object is outside its frustum.
In addition when projector is almost parallell to the projected object, the texture stretching is too evident and I would like to fade it out.

Now, I'm trying to understand how Unity handles their built-in projectors. I found this example.
Here's vertex and fragment relevant code:

v2f vert (float4 vertex : POSITION)
{
  v2f o;
  o.pos = mul (UNITY_MATRIX_MVP, vertex);
  o.uvShadow = mul (_Projector, vertex);
  o.uvFalloff = mul (_ProjectorClip, vertex);
  return o;
}

fixed4 frag (v2f i) : SV_Target
{
  fixed4 texS = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
  texS.rgb *= _Color.rgb;
  texS.a = 1.0-texS.a;

  fixed4 texF = tex2Dproj (_FalloffTex, UNITY_PROJ_COORD(i.uvFalloff));
  fixed4 res = texS * texF.a;
  return res;
}

I think that _Projector matrix is a classical matrix to transform vertices coordinates into projector space. (In fact the fragment just use the transformed coordinates to sample the projected texture).

What I'm really missing is how Unity construct _ProjectionClip matrix. The transformed vertex coordinates are used to sample the falloff texture (that I think it is what I really need).

Does anyone know how the _ProjectionClip is constructed? Or how to achieve a similar effect?

Note:
I did something similar for calculating spotlights falloff, but there I used a single matrix multiplication in the vertex shader to transform vertices into lightspace, and the squared distance in the fragment shader to calculate texture coords for a lookup into the attenuation texture.

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:
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:
opengl matrix multiplication Can someone provide some type of example of multiplying a 4x4 matrix without using loops?

typedef struct matrix4
{
    data[16];
} m4;

can someone provide a sample of how you you'd multiply two of these in the opengl column major way?

sentences:
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:
Intersecting Triangle and BoundingBox in 3D environment I am trying to check if a triangle is intersecting a BoundingBox in a 3D space with libgdx, but I am unable to find anything that can help me with that.

I tried using a Plane but it is not precise enough and I would like to avoid using Bullet.

Is there any existing code that I can use to deal with this ?

sentences:
How can I correctly instantiate an octree in UE4? I tried to create a simple Octree like this:
(I looked at the FMeshTriOctree source code since no question in answers.unrealengine.com helped me)

// My FVertex class is slightly more complexe, but let's say it's something like this:
class FVertex : public FVector
{
      int32 ID;
}

struct FVertexOctreeSemantics
{
        enum { MaxElementsPerLeaf = 16 };
        enum { MinInclusiveElementsPerNode = 7 };
        enum { MaxNodeDepth = 12 };

        typedef TInlineAllocator<MaxElementsPerLeaf> ElementAllocator;

        FORCEINLINE static FBoxCenterAndExtent GetBoundingBox(const PBS::FVertex* Vertex)
        {
            return FBoxCenterAndExtent(Vertex->GetBoundingBox());
        }

        FORCEINLINE static bool AreElementsEqual(const PBS::FVertex* A, const PBS::FVertex* B)
        {
            return A==B;
        }

        /** Ignored for this implementation */
        FORCEINLINE static void SetElementId(const PBS::FVertex* Element, FOctreeElementId Id){}
};

typedef TOctree<PBS::FVertex*, FVertexOctreeSemantics> FVOctree;

But when I instanciate my octree it returns:

Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.9\Engine\Source\Runtime\Core\Private\Misc\CoreMisc.cpp] [Line: 975]
The TOctree() constructor is for internal usage only for hot-reload purposes. Please do NOT use it.

What can I do?

sentences: How can i calculate that normal lays in same part of plane with point? I.e. n0 for A and n1 for B. Plane divided by plane CD.

sentences:
How do I test for intersection between a ray and a cone? I decided that writing a ray-tracer in my game was a brilliant idea, and so now I am looking for code to use for ray to primitive intersection tests. I have based my effort on this very nimble yet complete code. It works well but only supports sphere primitives. I have added plane, disk and ring (in that order) because they are easy. Next I am thinking about adding box and cone.

But while sphere and plane intersection tests are really simple cone seems really difficult.

I have yet to find a simple and easy to adapt java implementation of a ray cone intersection test. I am in this to get a ray-tracer up and working quickly without learning too much math underway, so is does anyone have a java snippet lying around that performs a trivial ray cone intersection test suitable for a small ray-tracer?

sentences:
Using crittercism with Unity I want to use crittercism with my Unity project. In Unity I am developing a game for iOS and Android platform. I did enough Google searching to come to the conclusion that Unity doesn't support this by itself and there aren't much tools out there to help me.

Can someone suggest a way to do it?

If not, is it possible for me to get access to the editor logs of Unity programmatically so that I can send these logs to my server directly. (I'll however still need to know when a crash occurs.)

I was thinking of a "hack". Please tell me if it is doable. On building the project, Unity creates an xcode project for iOS. I was thinking of opening the xcode project itself and putting the relevant commands to send the logs to crittercism, in case a crash occurs. However I am not able to think of a way to do this with Android.

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:
Help with legalese for an HTML5 contest This contest looks pretty interesting but I'm having some concerns about the wording in the rules:

Once submitted, a prize winning Submission becomes the exclusive property of Sponsor and will not be acknowledged or returned.
You expressly agree that by entering into the Contest any rights you may own in respect to a prize winning Submission shall be transferred to Sponsor by means of this Agreement. You shall be obliged to perform any measures necessary in order to vest any intellectual property rights in the name of Sponsor in case required by any law or regulation. In such case, Entrant shall – at Sponsor’s first request – execute any deed or transfer or such other document as required in that effect. For the avoidance of doubt, Sponsor shall have the exclusive right to make any kind of sequels, spinoffs, changes and translating the prize winning Submission in any language , all in relation to the exploitation of the prize winning Submission on any kind of media now known or hereinafter developed, without territorial or time limitations. The responsibility to implement localizations made by Sponsor in up to 19 languages will be that of the developer.

So it sounds like they get full IP rights, but I can't read this law stuff. Anybody have any insight? Much appreciated!

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:
Placing units on isometric map (2D) I'm making a map editor for further RTS game (2D), something like the first StarCraft Editor. Terrain tiles will be a rhombuses. So I'll probably just make an 2D array with intigers, that corresponds proper tiles. Then, after creating the terrain, you'd probably like to add some units and structures to map (especially if you're making a scenario). I'm not sure how do I check if the unit can be placed somewhere. I decided to make units almost independent from terrain tiles like in StarCraft (1), so the units are not placed in any grid.
I'll give a simple image:

As you can see, those green tiles represent a passable area (grass, let's say), and a blue one impassable (for example water). That stickman in a box is our unit. You can place it only in green area. That means the box can't go outside the green rhombuses.

I have some ideas how to achieve this, but I'm not sure which one would be the most optimal.

1) Since I work in Unity, I could add a collider to every tile. That will be very simple to do and will probably have terrible optimalisation in maps 256x256.

2) Math. I can calculate if any of those boxes crosses tile's borders. If so, I'll have to check if all those tiles are passable. It won't be that easy to programme (well, for me at least) and... yeah, here comes my dillema. Am I right that it would have much better optimalisation? Is it worth the effort?

What about saving this map? I can easily save the array with tiles, but how can I do it with units? Just save their positions or is there a better way to do it?

EDIT: I've tested the first idea (I've written script to create 256x256 map - that will be probably the biggest, and to move a camera). The map generates quite long (comparing to tiles without collider), but after that there isn't much difference in performance (it doesn't mean it won't cause problems when I add more features than moving a camera ;)). I can also attach colliders only to impassable tiles, not all. This should improve the performance even more. Still not sure if that's a good idea.

EDIT 2: I've just realised how bad my idea was. Let me visualise this:

So if you consider not the whole rectangle, but only a circle, it's not only easier to implement, but also more reasonable. You can now convert rhombus' vertices' position from isometric to cartesian like Bálint said:

CartX = ( 2 * IsoY + IsoX) / 2
CartY = ( 2 * IsoY - IsoX) / 2

You can also do it with circle's center point. Radius is equal to half of square (rhombus) side length OR sqrt(2) * square side length (when square is inscribed in circle).

So now I have a square grid and a circle. How can I check if all squares that this circle lays on are passable? What's the most optimal way to do it?

sentences:
How can I make that also the yradius values will change when the flag is true? In this part when I'm changing the xradius slider it's also changing the yradius slider at the same time and same value. But I can't change the yradius when trying to change it's slider. I want to be able either change the xradius or yradius when the flag is true. Both will change to the same values but I want to be able to change also the yradius so it will change the xradius.

if (changeBothRadius)
        {
            yradius = xradius;
            xradius = yradius;
        }

I tried to add the xradius = yradius; but it's not working only when changing the xraiuds it's working.

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;
    [Range(1, 50)]
    public float xradius = 5;
    [Range(1, 50)]
    public float yradius = 5;
    public bool changeBothRadius = false;
    [Range(0.1f, 2)]
    public float lineThickness = 0.1f;
    public bool minimumRadius = false;

    private LineRenderer line;
    private List<float> radiusList = new List<float>();

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = segments + 1;
        line.useWorldSpace = false;
        CreatePoints();
    }

    void Update()
    {
        line.startWidth = lineThickness;
        line.endWidth = lineThickness;
        CreatePoints();
    }

    void CreatePoints()
    {
        if (changeBothRadius)
        {
            yradius = xradius;
            xradius = yradius;
        }

        float x;
        float z;

        float angle = 20;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xradius;
            z = Mathf.Cos(Mathf.Deg2Rad * angle) * yradius;

            line.SetPosition(i, new Vector3(x, 0, z));

            angle += (360f / segments + 1);
        }
    }
}

sentences:
Is There a Way To Keep Precision When Transforming GameObjects I've seen this issue before, but it's never been a particular issue for me until today.  I have each "room" of a dungeon created with a class script that contains details of that room.  During the process of building the dungeon, rooms may be mirrored or rotated.  When I rotate the y-axis, it updates properly the first time, going from 0 to 180, but if I mirror it back and forth, it begins to get very small variances away from true 0 and 180.  Over time, this could impact some things.  The code I'm using to do this is:

    public void RoomMirror()
    {
        transform.Rotate(0, (transform.localRotation.y==180) ? 0.0000f : 180.0000f, 0);
        Mirror = !Mirror;
        Swap(ref _east, ref _west);
    }

I added the four places in the float to try to overcome this issue, but it doesn't seem to be making any difference.  Thanks!

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:
Destructible Terrain like worms I have to develop a game with a dynamic destruction of the map, I searched the internet and even looked at some questions regarding this topic on this Website, but they did not help me much out.

I made the map with tiled and used box2d to make collision between the game objects. As a game engine we have to use Libgdx, but I dont know how to start as I had never develeped a game before, can someone give me any tipps how I could start?

with regards,

sentences:
Powers of 2 textures in Android 2d games? I've read a lot about the importance of using powers of 2 png's for textures when using OpenGL ES. However, how does this relate to Google's own documentation regarding the resizing of graphics for the various screen density's. I will explain:

Let's say I have a 256 x 256 texture that I use for in the XHDPI folder for use on Extra High Density screens. Using Google's own recommended scaling factors, I would scale this by 75% to use in my HDPI folder, it would then become 185 by 185 which isn't a power of 2?

Could someone clear this up for me?

As noted, I'm asking specifically with regards to 2D sprites using quads.

sentences:
Play two different audio sources depended on code behind How can I play two different audio clips in Unity depended on the code behind? Into my object I've added two audio sources namely 'Player GunShot' and 'outOfAmmo'.

Into the same object I've also added a C# script whit this code:

public currentBullets = 1;

private AudioSource gunAudio;
private AudioSource outOfAmmo;

void Awake()
{
    gunAudio = GetComponent<AudioSource>();
    outOfAmmo = GetComponent<AudioSource>();
}

void Update()
{
    if (currentBullets == 0)
    {
        outOfAmmo.Play();
    }
    else
    {
        gunAudio.Play();
    }
}

Can this code give any problems because in the Awake methode? I've not defined with audio source the variable must be. So which source go he take to play?

sentences: How to make Djikstra algorithm remember path? I understand how dijkstra algorithm works but I don't know how I should figure out path. How can I get nodes that are on the shortest path?

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:
Rotating between two coordinate frames I have two coordinate frames, A and B. I want to create the rotation matrix RAB which takes you from A to B. A is a right-handed system, and B is a left-handed system. Furthermore, after moving from a right- to a left-handed system, there is a further rotation. These two coordinate frames are illustrated in the image below.

As can be seen, it appears that the axes in B are simply the negative of the axes in A. So, my first attempt was to simply make these negative in the rotation matrix:

RAB = [-1 0 0, 0 -1 0, 0 0 -1]

(sorry -- I don't know how to write matrices properly here...)

However, after working through some examples, this did not work out.

Please could somebody answer either (or both!) these questions?

(a) Why does my above solution not hold?
(b) what is the correct rotation matrix RAB?

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:
If an AI is sure it is going to lose, what can it do to make the game fun for the player? For context, I am contributing to a sequential turn based strategy game. I have an idea how to improve it but I feel I need some input to help me evaluate and improve it. We currently have a really dumb AI that just follows a rough set of rules each turn. I'm considering to upgrade it to a basic search based AI to not be guaranteed to win every time I play it.
There are many reason why an AI could be behind the curve. These include that is wasn't able to grow its economy well due to bad luck with map generation, that its economy was disrupted early by an enemy raid while the defending army was out of reach, that the starter army was defeated early and resources had to be invested to replace it instead of economic upgrades or more importantly there being a big awesome deciding battle with all units involved and it lost. A search based AI will be able to know when it is obvious that it is growing slower than it should, can't recover and it is now impossible to win due to runaway success. Such a runaway success is often boring to play especially if it happened 3 times in a row.
Assume there is no meta game where multiple players can gang up on the strongest one. I am open to nudge the game rules in the AI's favor if this happens. However rubber banding can give the player the impression that they are punished for playing well, the AI drags out a game into an almost stalemate or even wins unfairly.
The problem I'm trying to solve is not that the AI is losing but that the AI rolling over and dying is not fun or interesting.
It is even worse. If the player is sufficiently good he will experience that every time.
In some theories of literature, after the conclusion seems forgone and the tension is falling a new small conflict that is relevant enough or something else that justifies further elaboration and excitement.

My idea is to have a library of endgame scenarios, a handful of which end up with player loosing unless he plays really well, most pose a small challenge that the player is entirely able to deal with and some are a "I roll over, just kill me already, please".
Are you aware of anyone trying something like this before?
If someone tried this in a strategy game or even outside of strategy games before I would like to learn from them.
Can you spot some obvious problems with this idea? I already considered the AI misjudging the impossibility of winning. However, I might be to enamored with my idea to spot different problems.
How can I make sure that this still feels fair? It is easy for the AI to get some extra resources however if a player is losing I am afraid that he would feel cheapened if he got some extra money and units.
How do I help the player having fun or at-least variety when they are losing? I really have no ideas for this.

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:
Character progression through leveling, skills or items? I'm working on a design for an RPG game, and I'm having some doubts about the skill and level system. I'm going for a more casual, explorative gaming experience and so thought about lowering the game complexity by simplifying character progression. But I'm having trouble deciding between the following:

Progression through leveling, no complex skill progression, leveling increases base stats.
Progression through skills, no leveling or base stat changes, skills progress through usage.
Progression through items, more focus on stat-changing items, items confer skills, no leveling.

However, I'm uncertain what the effects on gameplay might be in the end. So, my question is this:

What would be the effects of choosing one of the above alternatives over the others?
(Particularly with regards to the style and feel of the gameplay)

My take on it is that the first sacrifices more frequent rewards and customization in favor of a simpler gameplay; the second sacrifices explicit customization and player control in favor of more frequent rewards and a somewhat simpler gameplay; while the third sacrifices  inventory simplicity and a player metric in favor of player control, customization and progression simplicity.

Addendum: I'm not really limiting myself to the above three, they are just the ones I liked most and am primarily interested in.

sentences:
Which files of addressable assets should be committed to Git? I would like to keep my Git repository as small as possible and exclude any automatically generated files. The developers can re-build their Unity Addressable Assets themselves. Any developer should be able to build the final project and the final result should contain the same assets packed in the same way.

I noticed that Unity generates the following files and folders:

Which of these files are important settings that should be included and which files are safe to exclude from a Git repository?

sentences:
How to automatically delete an object in Unity? I am new to unity and the other day I was wondering that it would be useful if I could instantiate some objects in my game scene and, as they get instantiated, make it so that they get automatically deleted after a period of time.

I thought about automatically adding a Destroy script to them so that they could be deleted after a period of time using:

Destroy(Gameobject, time);

I'm not sure that's what I need, and if it is I don't know how I'd go about it.

How could I make it so that my objects get automatically deleted after some time, in the context that I'll have a lot of them?

sentences:
Force new players to play tutorial? We have released our new game to a closed alpha group. It's a browser-based MMO RTS, however some aspects of the game are slightly different from the "standards" you'd expect to see in traditional RTS' due to it being persistent, browser-based etc. For this reason, we have a new player tutorial which helps players through some aspects of the game that differ from the "norm", such as the way you acquire territory and the way you move large groups of units.

I think that every game I've played has had a "skip tutorial" option during the tutorial, so we put that option in as well. However, this has now caused us a dilemma: looking at the player stats in our database, there is an almost perfect correlation between those players who have played through the tutorial and have progressed through the game, and those who haven't. Basically, if you don't play the tutorial, you pretty much don't know what to do next and stop playing the game after not doing anything meaningful for a few minutes.

I'm really torn here between "best practice" / user experience (which probably dictates that players should have an option to not play the tutorial), and clear evidence which shows that if players don't play the tutorial, they likely will quit the game early.

Is it reasonable in this situation to "force" players to play the tutorial? I.e., don't give them a "skip tutorial" option? Could we dress it up as "missions", where the first 10 or so missions are compulsory to progress, but actually those "missions" are simply the current tutorial steps?

sentences:
Restrict the rotation of the camera using button I've been trying to limit the Y-axis of the camera rotation but I'm out of depth until now. I'd looked up many tutorials and I found the clamping method, but I seem can't get it to work on my code, and all the tutorials I found is using them in Update(), while I'm using a button to rotate the camera. Here's the code:

public void RotateLeft()
{
    cameraY = Mathf.Clamp(cameraY, minAngle, maxAngle);
    if(cameraY >= minAngle)
    {
        Camera.main.transform.Rotate(0,-cameraY,0);
    }
}
public void RotateRight()
{
    cameraY = Mathf.Clamp(cameraY, minAngle, maxAngle);
    if(cameraY <= maxAngle)
    {
        Camera.main.transform.Rotate(0,cameraY,0);
    }
}

Does clamping works outside an Update()? What am I missing?

Thank you in advance.

sentences:
How can I store a large amount of items in a space-efficient manner? How can I store a large amount of items inside my game?

Are each of the items default data be loaded from a file into an item class and then stored in a giant array/list/dictionary?

For a point of reference, I'm talking about something like Skyrim where there are hundreds of items that the player is able to touch and pickup. And at any point the player can debug and add an item to their inventory.

I feel like the game would store everything is some kind of list but I also feel like this could consume a lot of memory, but maybe I am overthinking the size of each individual items data.

sentences:
Best practice for organizing/storing character/monster data in an RPG? Synopsis: Attempting to build a cross-platform RPG app in Adobe Flash Builder and am trying to figure out the best class hierarchy and the best way to store the static data used to build each of the individual "hero" and "monster" types. My programming experience, particularly in AS3, is embarrassingly small.

My ultra-alpha method is to include a "_class" object in the constructor for each instance. The _class, in turn, is a static Object pulled from a class created specifically for that purpose, so things look something like this:

// Character.as
package
{
  public class Character extends Sprite
  {
    public var _strength:int;
    // etc.
    public function Character(_class:Object)
    {
      _strength = _class._strength;
      // etc.
    }
  }
}

// MonsterClasses.as
package
{
  public final class MonsterClasses extends Object
  {
    public static const Monster1:Object={
      _strength:50,
      // etc.
    }
    // etc.
  }
}

// Some other class in which characters/monsters are created.
// Create a new instance of Character
var myMonster = new Character(MonsterClasses.Monster1);

Another option I've toyed with is the idea of making each character class/monster type its own subclass of Character, but I'm not sure if it would be efficient or even make sense considering that these classes would only be used to store variables and would add no new methods. On the other hand, it would make creating instances as simple as var myMonster = new Monster1; and potentially cut down on the overhead of having to read a class containing the data for, at a conservative preliminary estimate, over 150 monsters just to fish out the one monster I want (assuming, and I really have no idea, that such a thing might cause any kind of slowdown in execution).

But long story short, I want a system that's both efficient at compile time and easy to work with during coding. Should I stick with what I've got or try a different method?

As a subquestion, I'm also assuming here that the best way to store data that will be bundled with the final game and not read externally is simply to declare everything in AS3. Seems to me that if I used, say, XML or JSON I'd have to use the associated AS3 classes and methods to pull in the data, parse it, and convert it to AS3 object(s) anyway, so it would be inefficient. Right?

sentences:
Tessellation won't render I am starting to work with tessellation and have some problems right in the beginning. I try to render a quad made of two triangles with tessellation, but nothing appears on the screen. But as soon as I remove the tessellation shaders and change GL_PATCHES to GL_TRIANGLESagain, it starts working again, without tessellation obviously.

So here is my code to setup the tessellation shaders:

glPatchParameteri(GL_PATCH_VERTICES, 3);
shaderID = glCreateProgram();
{
    vertex = GraphicsUtilities::loadShader("D:\\vert.glsl", GL_VERTEX_SHADER);
    glAttachShader(shaderID, vertex);

    fragment = GraphicsUtilities::loadShader("D:\\frag.glsl", GL_FRAGMENT_SHADER);
    glAttachShader(shaderID, fragment);

    tcs = GraphicsUtilities::loadShader("D:\\tcs.glsl", GL_TESS_CONTROL_SHADER);
    glAttachShader(shaderID, tcs);

    tes = GraphicsUtilities::loadShader("D:\\tes.glsl", GL_TESS_EVALUATION_SHADER);
    glAttachShader(shaderID, tes);
}
glLinkProgram(shaderID);

This is the vertex shader:

   #version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;
layout(location=2) in vec3 vertNormal;

void main(void){
    gl_Position = vertPosition;
}

The TCS:

#version 400
layout (vertices = 3) out;

void main()
{
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;

    gl_TessLevelOuter[0] = 3.0;
    gl_TessLevelOuter[1] = 3.0;
    gl_TessLevelOuter[2] = 3.0;
    gl_TessLevelInner[0] = 3.0;
}

And the TES:

#version 400
layout(triangles, equal_spacing, cw) in;

void main()
{
    gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
                   gl_TessCoord.y * gl_in[1].gl_Position +
                   gl_TessCoord.z * gl_in[2].gl_Position);
}

And this is how I draw the quad:

glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glUseProgram(shaderID);
glBindVertexArray(quad->getVboID());

glDrawElements(GL_PATCHES, 6, GL_UNSIGNED_INT, (GLvoid*)0);

glBindVertexArray(0);

glUseProgram(0);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

I tried using in and out variables instead of gl_in/out, but that doesn't work either. I also tried it without the TCS.
I was also using Apitrace to look up any errors, but nothing. The function loadShader() looks for compile errors.
So what could cause this problem? I really have no idea how to debug this thing any further.

sentences:
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:
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 do I find the circumcenter of a triangle in 3D? I want to find the circumcenter of a triangle.  Wolfram only shows how to find the circumcircle of a triangle in R2. How can I find the circumcenter of a triangle in R3?

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:
Why are my colliders offset on my isometric map? I'm building an isometric environment in Unity and having some trouble with my colliders aligning with what shows in the scene editor to the reality in gameplay.

There is nothing in the collider component to indicate that it should have any offset, or that there is anything at play other than the default settings.  This goes for all types of 2D colliders I should add.  I did try a 3D collider just out of curiosity, and nothing happens at all.  This has been my experience with multiple objects, not only the one I've highlighted in the picture below.

I'm using the Adventure Creator add-on if that makes any difference.

sentences:
Why aren't my pieces rotating on my chess board in Java? I am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All my pieces and squares are JLabels and are in a JLayeredPane, with pieces being in top layer. All the squares are part of a JLabel array named labels and same for white and black pieces.

WinitialLocation and BinitialLocation are Point Arrays for initial positions of white and black pieces.

But running the following code in mouseReleased() event of the pieces, only the piece which we moved changes place, the rest remain at their position.

Can anybody help me, Please?

void reLocate() {
     for(int i = 0; i < 6; i++ )
     {
        for(int j=0, n=labels.length; j<n;j++)
        {
            if(labels[j].getLocation().equals(WinitialLocation[i]))
               wPieces[i].setLocation(labels[63-j].getLocation());

            if(labels[j].getLocation().equals(BinitialLocation[i]))
               bPieces[i].setLocation(labels[63-j].getLocation());
        }

        layer.moveToFront(wPieces[i]);
        layer.moveToFront(bPieces[i]);
    }
}

sentences:
What is the name of the phenomenom where faces get stretched to the middle of the screen? I'm trying to make my own 3D view in java without the use of any imported libraries. It has been going really well for me except for the fact that if I'm positioned in a certain way some of my edges get stretched to the middle of the screen. a reference image:

The gun render's completely fine in the front part, but when I'm looking at it from this angle it looks like some of my edges get stretched to my viewto point. I want to google information on what other people have done to fix it, but I have no idea what this phenomenom is named.

I'm not looking for an answer on how to fix it, but on the name of the phenomenom because I'm trying to learn as much as possible by myself.

I'm pretty sure this is a wellknown problem and I just can't remember the name of it.

sentences:
Minimum Hardware for iPhone Dev So I'm planning to get into iPhone dev (2D games). I understand that my only real option is to get a Mac. I'll probably go the MonoTouch route.

I'm not sure what hardware to buy; I just want the minimum that'll be "good enough" to develop with. Some posts recommend a Mac Mini, although it seems on the more expensive side; even on the iPhone front, I'm not sure what to look for.

Also, I may skip on the iPhone until I'm ready to launch my first game, since I can get away with the MonoTouch evaluation version. (Albeit that it's probably not the best idea.)

sentences:
How people get their game ideas? One thing that always stop me when I want to start making a game is having no idea what to do. How do people get ideas for their game ? I mean realistic ideas for people who are alone with the minimum ressources (no money for assets, blender and unity). I will never stop being impressed by all new concept, mecanics or crazy ideas of game indie developpers come-up with, like making game out of random everyday objects. I wish I was able to do that.
Do developpers get their inspiration by looking at other games and trying to mix them or change the concept ? Do they look outside trying to come up with what they wish was a game ? Or do they simply walk around and try to imagine a game with whatever they see or reallife situations or concept ?

sentences:
Separating UI and logic in Objective-C at iOS based Games How to separate UI and logic in Objective-C based mobile games?

To develop games, I use Cocos2d library.

I need a good reference to separate my UI code from game logic code.

sentences:
Scripting engine for XNA Say I'm making this big game in C# with XNA.

What options do I have to include a scripting feature to my code base?

sentences:
In AGK2 Basic, how would I attach a camera to the player charater? I've started making a game in AppGameKit and I'm using Tier 1/AGK2 Basic. I'm trying to make a sort of endless runner. I've made it so that the player stays still and the rest of the world moves around them to create the illusion that the player is what is running forward. I then use a global variable to control all movement relative to the player.

There must be a better way to do this, though. Like if I were to attach a camera to my player character. How would I do something like that?

sentences:
Bounding Volumes for Empty Space I'm creating an Android game that relies heavily on collision detection for a couple of players (at least up to 4). I researched hierarchical structures that could speed up the process. Because I have worked with hierarchies of axis aligned bounding boxes for ray tracing in uni, the sweep and prune algorithm is currently my favorite choice.
However, I had the idea to use bounding boxes not only for the obstacles in a level, but also some boxes containing as much of the free space in the scene as possible. If the player's character stays within one of those during his movement between two frames no further intersection tests should be necessary. Could this approach reduce the number of intersection checks where a player's character intersects one or more axis aligned boxes but not the objects within?
I highly doubt I am the first person who thought of this, yet I didn't find something like it online. So, is there a good reason not to do this?
My best guess for why it isn't done is that there is no good rule to find applicable bounding boxes for empty spaces in between. But if they are precomputed before the game I don't see this as a problem.
Maybe they could be bounding spheres instead. Those could be grown from an obstacle's surface until it touches obstacles in at least three points, like so:

Any advice would be greatly appreciated

sentences:
Is there a way to turn collision detection system off completely in Unity? My world setup is 2D Top-Down. All collisions are disabled from the collision matrix.

There are no collisions in the scene as I wanted, but as I perceive, Unity is still trying to calculate collisions in the background. So I'm experiencing serious frame rate drops because of Physics2D.Simulate when I have about 2k colliders moving over each other on the scene.

I followed the suggestions about colliders and rigidbodies on the API exactly (so I know the stuff about not to move static colliders without rigidbody, that's not the case here), but I somehow can't manage to tell Unity that I don't want her to calculate "possible" collisions.

I only want colliders for Raycast2D, OverlapCircle and making movements a bit realistic.

Thanks in advance for all suggestions.

sentences: Where to store shaders I have an OpenGL renderer which has a Scene member variable. The Scene object can contain N SceneObjects. I use these SceneObjects for storing the vertex position and any transforms. My question is, where should shaders be stored in this arrangement? I guess they need to be in a central location because multiple objects can use the same shader. But then each object needs access to the shader because it needs to set attributes into the shader. Does anyone have any advice?

sentences:
How to use TEnumAsByte Unreal 4.22 The problem

I am attempting to use a TEnumAsByte in one of my class headers:

I get compilation errors:

Code sample

I have included everything relevant to the member variable I am trying to create:

Header File:

#pragma region Engine Includes

#include <Containers/EnumAsByte.h>

#pragma endregion

UCLASS( Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class PLATFORMER_API UGrappleAbilityComponent : public UActorComponent
{
    GENERATED_BODY()

protected:
    // Begin AActor Interface //

    /** Called when play starts */
    virtual void BeginPlay() override;

    // End AActor Interface //

public:
    /** Determines what type of debug draw is used for the continuous grapple scanning */
    UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Grapple Scan", meta = (AdvancedDisplay, DisplayName = "Grapple Cont Scan Debug Draw Type"))
        TEnumAsByte<EDrawDebugTrace::Type> m_GrappleScanDebugDraw;
}

Source File:

UGrappleAbilityComponent::UGrappleAbilityComponent()
{
    PrimaryComponentTick.bCanEverTick = true;

    // Give an initial value to the debug draw mode for the continuous grapple scanning.
    m_GrappleScanDebugDraw = EDrawDebugTrace::None;
}

...

void UGrappleAbilityComponent::GrappleScanContinuous(FHitResult & OutHit)
{
    // Only scan if the player is not attached and their airbrake is not active
    if (!m_GrappleHook->IsAttached() && !m_OwnerCharacter->IsAirbrakeActive()) {

        // Increment the trace lerp value.  -   Then wrap the Trace lerp value back around to 0.
        m_GrappleScanTraceLerp += 0.1f;         if (m_GrappleScanTraceLerp > 1.f) { m_GrappleScanTraceLerp = 0.f; }

        // Calculate the proposed end point of the grapple.
        FVector EndPoint = m_StartPoint + m_StartPointDirection * m_GrappleCastDistance;
        float zOffset = FMath::Lerp(m_GrappleContScanLowHeight, m_GrappleContScanHighHeight, m_GrappleScanTraceLerp);
        EndPoint.Z += zOffset;

        // Perform the box traces.
        UKismetSystemLibrary::BoxTraceSingle(GetWorld(),
            m_StartPoint, EndPoint, m_GrappleContScanHalfSize, FRotator::ZeroRotator,
            UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_GameTraceChannel5),
            false, {}, m_GrappleScanDebugDraw.GetValue(), OutHit, true);
    }
}

Additional Info

The compilation errors relating to the BoxTraceSingle call are irrelevant as they only occur due to the compilation errors with the TEnumAsByte. Aside from the .GetValue() call. Removing this still causes similar compilation errors however.

I can confirm this as, by looking at Epic's engine code, they use TEnumAsByte in exactly the way I have done here, aside from the .GetValue() call.

What the hell is going on here?

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:
Player jitter when positioned at large coordinate values I am trying to make a simple top down scrolling shooter using Unity3D comprising of the following elements:

1) Top down orthographic camera: points at 65 degrees towards the ground. At a height of 1000 units. Size 100.

2) Spaceship: Moves around based on the up/down/left/right keyboard commands. Each press moves the ship 1/100 of the screenwidth in distance. I keep its position in screen coordinates and use a ray cast to project it to a height of 500 units off the ground in the camera space using the following code:

Ray ray = mainCamera.camera.ScreenPointToRay(screenLocation);
Plane plane = new Plane(new Vector3(10, 500, 0),
    new Vector3(0, 500, 10),
    new Vector3(-10, 500, 0));
float enter;
plane.Raycast(ray, out enter);
transform.position = ray.origin + ray.direction * enter;

3) A camera scroll component that moves the camera forward by 0.75 units every frame.

When I play the game the spaceship is controlled in screen space and its world coordinates are calculated relative to the scrolling camera. The camera starts at y: 1000, z:0 and z is incremented by 0.75 (scroll per frame).

The problem I am running into is that after a while, the player ship begins jittering. The jittering gets worse the longer the game goes on. The jittering is noticeable around the time z becomes 4200 which gives me about 1m30s game time at 60fps before the jittering starts. The levels I want to create would only be less than 20 mins which would mean that I need a max Z value of 2700 assuming my Z started at -2700 and finished at +2700.

I realised this must be caused by the limitations of floating point precision so I started playing around with the numbers to see what I could do to solve this.

I found that modifying the height of the camera to 50 and the ship to height 25 whilst keeping the orthographic camera size at 100 allowed me to set the distance to around 32,000 with no jittering. I didn't fully understand why this worked as the values of the ship transform and camera transform were still truncated to 2 decimal places at the extreme distance of 32,000. Scaling the camera size to 5 brought back the original problem. This 'fix' seemed mighty hacky to me though as it pretty much screws up the scale of objects in the game and only looks 'normal' because of the orthographic perspective. I don't know how well this would play with other things I plan to add to the game.

I have 3 options at this point:

1) Continue to find a way to get it to work with the limit of 20 minutes and using a virtual camera that tracks around the world coordinate frame. This would be great if it works as I could easily use the editor to add enemies at correct positions e.t.c.

2) Make it so that when it reaches a z limit, the camera resets to z = 0 and all objects in the scene revert back relative to the camera shift. The downside to this I guess is that I would need to figure out how to get the objects to shift back correctly when the limit is reached and also it would be trickier to use unity's editor to do enemy placement e.t.c.

3) Keep the camera at position z=0 and scroll the world backwards towards the camera. This seems like the ideal thing to do as I could place objects and scripts in unity world space and when the game runs, these elements could shift back every frame. I don't know how to achieve this at the moment however. I thought of using a parent object that moves back by 0.75 every frame. Enemies would be children of this object and the player camera would not be a child but be at the same place all the time. However I think this would still cause problems as maybe enemies placed far out in the z direction might jitter as they moved around. Is this concern legitimate?

I am wondering if anyone has any better ideas to solve my problem or understands why changing the height scale seems to temporarily fix the problem?

sentences:
Why are the "professional" versions of console SDKs closed to the public? Why are the "professional" versions of console SDKs closed to the public? For example the Xbox Development Kit is available only to certain registered developers. The PS3 has some similar arrangement. Even the pricing is undisclosed.

What is the reason for this secrecy? Also, what additional features do these "professional" SDKs have, in comparison with the free SDKs (like XNA)?

sentences:
How can I support component-to-object communication safely and with cache-friendly component storage? I'm making a game that uses component-based game objects, and I am having a hard time implementing a way for each component to communicate with its game object.  Rather than explain everything at once, I will explain each part of relevant sample code:

class GameObjectManager {
    public:
        //Updates all the game objects
        void update(Time dt);

        //Sends a message to all game objects
        void sendMessage(Message m);

    private:
        //Vector of all the game objects
        std::vector<GameObject> gameObjects;

        //vectors of the different types of components
        std::vector<InputComponent> input;
        std::vector<PhysicsComponent> ai;
        ...
        std::vector<RenderComponent> render;
}

The GameObjectManager holds all the game objects and their components.  It is also responsible for updating the game objects.  It does this by updating the component vectors in a specific order.  I use vectors instead of arrays so that there is virtually no limit to the number of game objects that can exist at once.

class GameObject {
    public:
        //Sends a message to the components in this game object
        void sendMessage(Message m);

    private:
        //id to keep track of components in the manager
        const int id;

        //Pointers to components in the game object manager
        std::vector<Component*> components;
}

The GameObject class knows what its components are and can send messages to them.

class Component {
    public:
        //Receives messages and acts accordingly
        virtual void handleMessage(Message m) = 0;

        virtual void update(Time dt) = 0;

    protected:
        //Calls GameObject's sendMessage
        void sendMessageToObject(Message m);

        //Calls GameObjectManager's sendMessage
        void sendMessageToWorld(Message m);
}

The Component class is pure virtual so that classes for the different types of components can implement how to handle messages and update.  It also is able to send messages.

Now the problem arises on how the components can call the sendMessage functions in GameObject and GameObjectManager.  I came up with two possible solutions:

Give Component a pointer to its GameObject.

However, since the game objects are in a vector, the pointers could quickly become invalidated (The same could be said of the vector in GameObject, but hopefully the solution to this problem can also solve that one).  I could put the game objects in an array, but then I would have to pass in an arbitrary number for the size, which could easily be unnecessarily high and waste memory.

Give Component a pointer to the GameObjectManager.

However, I do not want components to be able to call the manager's update function.  I am the only person working on this project, but I do not want to get in the habit of writing potentially dangerous code.

How can I resolve this problem while keeping my code safe and cache friendly?

sentences: SDL2 Rendering based on frames Is it possible to render a particular object on the screen for a certain number of frames without having to delay the rendering? Thanks

sentences:
Is it worthwhile to use particle pools in managed languages? I was going to implement an object pool for my particle system in Java, then I found this on Wikipedia. To rephrase, it says that object pools aren't worth using in managed languages like Java and C#, because allocations take just tens of operations as compared to hundreds in unmanaged languages like C++.

But as we all know, every instruction may hurt game performance. For example, a pool of clients in an MMO: the clients won't enter and exit the pool too fast. But particles may get renewed tens of times in a second.

The question is: is it worth it to use an object pool for particles (specifically, those that die and get recreated fast) in a managed language?

sentences:
In Unity, rotating character spine keep going back to original rotation this is the code for rotating spine in my character model:

Transform spine;
float horzMovement;

void Awake() {
    spine = transform.Find("Character/Healthmale/Root/pelvis/spine_01");
}

void Update() {
    horzMovement = Input.GetAxis("Mouse Y");
}

void LateUpdate() {
    spine.localRotation = Quaternion.Euler(
        spine.localEulerAngles.x + horzMovement,
        spine.localEulerAngles.y,
        spine.localEulerAngles.z
    );

    print(horzMovement + " / " + spine.localRotation.eulerAngles.x + "    " + Time.time);
}

Code is quite simple, I'm just rotating "X" axis from y mouse movement. The problem is when running this code, it seems work but it keeps rotating back to the original rotation.

This is the log that I printed into the console. Note that spine's original x rotation is about 27.62928.

0 / 27.69298    4.510662
0 / 27.69298    4.527147
-0.1 / 16.33139    4.543715    // minus movement detected
-0.1 / 16.3314    4.560284
-0.1 / 16.33139    4.57685
-0.1 / 16.33139    4.593714
-0.1 / 16.3314    4.609998
-0.1 / 16.33139    4.626548
-0.1 / 16.33139    4.643115    // but it seems not much changed, why?
-0.15 / 10.51222    4.659858
-0.15 / 10.51222    4.676248
-0.15 / 10.51222    4.692952
0 / 27.69298    4.759083       // this is when I stopped the mouse. It's reset.
0 / 27.69298    4.775648

As you see the above log, first time, it prints 27.692.. and it's original x rotation of spine.

Next, I moved my mouse so the "horzMovement" value was updated to minus, and it updates x localRotation also.

But when I stopped move mouse, it just return to initial x rotation 27.69298!

There is no code or functionality to "rotating back" to original rotation of spine. I don't know why this is happening. Wham am I missing?

Any advice will very appreciate it!!

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: Move Camera Freely Around Object While Looking at It I've got a 3D model loaded (a planet) and I have a camera that I want to allow the user to move freely around it. I have no problem getting the camera to orbit the planet around either the x or y axis. My problem is when I try to move the camera on a different axis I have no idea how to go about doing it. I am using OpenGL on Android with the libGDX library. I want the camera to orbit the planet in the direction that the user swipes their finger on the screen.

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:
How to achieve rendering at huge distances? These days I was reading some information about the upcoming GTA V technology, in particular, how it is able to truly render all buildings you can see without a draw distance cap or any faking.

Since I will soon be prototyping a big city environment, I wanted some advice on this topic. We're talking about a really big city, with simple geometry but fully lit and shadowed. My doubt comes in particular to the projection matrix, which imposes a maximum draw distance (the zFar parameter).

Now, at the same time, I read everywhere that zFar should be as small as possible for better rendering results, in particular related to depth buffer issues etc, because of the floating point issues.

So, assuming my computer can render this big city in a stable framerate, how should I approach the problem of rendering parts of the city which I can see REALLY far away, fully lit and shadowed? Shadow maps also seem to have problems with low depth buffer precision..

Thanks

sentences:
IK bones stretching vertices to ground during animation (UE4, 3DS Max, using default skeleton) I modified the 3rd person example skeletal mesh to a simplistic model in 3DS Max 2016 student edition, by deleting all but one faces and building thereon, thus leaving the hierarchy just as it is needed to re-import to UE4 without any changes and without touching the skin modifier.

In Unreal, the problem appears upon animation, where a vertex from each hand, and one from each foot, is stretched to the ground, and in Persona I see that it's the ik_hand_l and ik_hand_gun bones, as well as the two IKs of the feet, though due to overlapping names I can't make out the entire bone name.

Another issue I successfully dealt with was the model flickering, as suggested I deleted the physics asset and that was corrected, it seems to be a frequent problem so I don't think it's particularly related.

Here is the related post in the Unreal Engine forums with an image of the problem.

sentences:
How to combine steering forces? I am trying to understand how to implement and combine steering vectors for autonomous agents as described by Craig Reynolds.

My understanding is that each steering force should be calculated separately and then all of the steering forces should be added together and then applied.

I understand that each steering force is equal to the desired velocity for a particular behavior, minus the agent's current velocity.

I am trying to combine two basic behaviors: Seek and Flee. Below are two diagrams to illustrate my issue.

I have an agent that is Seeking a target directly ahead of it, and fleeing from a target below it. When the target is at rest (current velocity = 0), the steering forces for each behavior are equal to their respective desired velocities:

vSteer = vDesired - currentVelocity = vDesired - 0 = vDesired

And the combined steering force points up and to the right, in blue. This is roughly what I would expect.

However, if the agent is moving, we get a completely different result. For the sake of simplicity, say the agent is already moving at top speed in the direction of the target. So the agent's current velocity is equal to its desired seek velocity.

When the agent's current velocity is equal to the desired seek velocity, then the seek steering force is 0 (vSteer = current - desired = desired - desired = 0). The flee steering force then is equal to the desired flee velocity minus the current velocity, which produces a vector that points BACKWARD! And since the seek steering force is zero, the total steering force equals the flee steering force.

I noticed this issue while trying to implement a separation force, which is essentially the situation illustrated in the diagrams but with the red X representing a neighboring agent. The net effect is that agents maintain separation, but move at about half speed, with a seek steering force pointing forward, a flee steering force pointing backward and away from the neighbor, that largely end up cancelling each other out.

It really doesn't seem like any component of the flee force should be pointing backwards here. What am I misunderstanding?

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:
Frame Buffer couldn't be constructed: incomplete attachment error on nexus 7 So I am running into an issue where I cannot load my game onto the nexus 7 because of the error stated previously. I read online that this is because the device can't use the Format class or something like that but I find this funny because I ran the game on the device with the framebuffer earlier without any problems. The game runs perfectly fine on the nexus 5.

EDIT

Code breaks here in the initialization process.

buffer = new FrameBuffer(Format.RGBA8888, (int) gameWidth, (int) gameHeight, false);

Here is a part of the stacktrace

java.lang.IllegalStateException: frame buffer couldn't be contructed: incomplete attachment.
at com.badlogic.gdx.graphics.glutils.Framebuffer.build(FrameBuffer.java:171)

Here is the Framebuffer:171 code

if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");

sentences:
Problem displaying model I downloaded the FBX of this free model:

http://www.turbosquid.com/FullPreview/Index.cfm/ID/485548

Yet when i try and display it in my project

foreach (ModelMesh mesh in player.Meshes)
{
    foreach (BasicEffect beffect in mesh.Effects)
    {
        beffect.View = view;
        beffect.Projection = projection;
        beffect.EnableDefaultLighting();
    }
    mesh.Draw();
}

I end up with the teeth of the model way out from the body, and the eyes expanded so large they stick out the sides of the model.

Could someone tell me what i am doing wrong? Or is the model the issue?

sentences:
example of texture mapping in pyglet Using pyglet, I am trying to create a UVSphere mesh, and on its surface I would like to display a mercator-projection map. In researching examples of pyglet texture mapping, I have found:

Nehe tutorial 6 in pyglet. However this uses immediate mode, and shows the entire texture on each cube face.
pyglet_obj_test, which looks like it includes texture maps. However instead of showing the chosen texture, it shows an even color.
stackoverflow question, which looks like there was an answer with a solution. However the referenced gists showing working code have disappeared.
Another implementation, referenced in the pyglet google group

Are there any simple examples of a working mesh + texture map in pyglet?

Edit: I found out the pyglet_obj_test code is looking for lines in the .obj file starting with vt in order to create texture mapping coordinates. However the Wavefront exporter in Blender apparently has no option to export this information. I exported the same mesh with each of the other available types:

COLLADA (.dae)
Stanford (.ply)
Stl (.stl)
3D Studio (.3ds)
Autodesk FBX (.fbx)
X3D Extensible 3D (.x3d)

Perhaps there's a pyglet importer for one of these formats...

Edit 2: I clearly have a poor understanding of the wavefront format. It seems vt lines are not necessary. What I was missing is full f maps.

For instance, to simplify things way down, I created a 3d mesh that was actually a single square, with a texture mapped onto it. In Blender it shows the square with distorted texture, but the built-in wavefront exporter produces a single line of texture mapping f 2//1 1//1 3//1 4//1. These should apparently instead be something like f 2/0/1 1/0/1 3/0/1 4/0/1 (note there should be a number between the two slashes).

Apparently Blender only does a full (proper?) export of these lines if a texture is UV mapped. Applying a texture without a UV Map renders properly in Blender, but I guess the wavefront exporter doesn't properly handle it. Perhaps it's time for me to submit a Blender bug report...

sentences:
Player doesn't jumps in Box2D implementation Well, i'm trying to learn andEngine. I was able to successfully implement the move functionality for the player. Now, i'm trying to make the player jump using Box2D. I referred few online tutorials to do this but i am not able to make the player jump. Here's my code:

public class MyActivity extends BaseGameActivity {
@Override
    public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)
            throws Exception {
         scene = new Scene();
        final float centerX = (CAMERA_WIDTH - back.getWidth()) / 2;
        final float centerY = (CAMERA_HEIGHT - this.back.getHeight()) / 2;

        Sprite backgr = new Sprite(centerX, centerY, back,
                this.getVertexBufferObjectManager());
         rcs1 = new Sprite(85, 250, rc1,
                this.getVertexBufferObjectManager());
         rcs2 = new Sprite(195, 240, rc2,
                this.getVertexBufferObjectManager());
         rcs3 = new Sprite(295, 250, rc3,
                this.getVertexBufferObjectManager());

        ans = new AnimatedSprite(86, 245, ttr,
                this.getVertexBufferObjectManager()) {
            @Override
            protected void onManagedUpdate(float pSecondsElapsed) {
                this.setPosition(pX, pY);
                super.onManagedUpdate(pSecondsElapsed);

            }
        };
        pw = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH),
                false);
        final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(2f,0f, 0.9f);
        body = PhysicsFactory.createBoxBody(pw, ans, BodyType.DynamicBody,
                PhysicsFactory.createFixtureDef(0, 0, 0));
        bodyr1 = PhysicsFactory.createBoxBody(pw, rcs1, BodyType.StaticBody,
                objectFixtureDef);
        bodyr2 = PhysicsFactory.createBoxBody(pw, rcs2, BodyType.StaticBody,
                objectFixtureDef);
        bodyr3 = PhysicsFactory.createBoxBody(pw, rcs3, BodyType.StaticBody,
                objectFixtureDef);

        pw.registerPhysicsConnector(new PhysicsConnector(ans, body, true, true));
        scene.attachChild(backgr);
        scene.attachChild(rcs1);
        scene.attachChild(rcs2);
        scene.attachChild(rcs3);
        scene.attachChild(ans);
        pw.setContactListener(this);
        scene.registerUpdateHandler(pw);
        pOnCreateSceneCallback.onCreateSceneFinished(scene);

    }
private void jump() {

            body.setLinearVelocity(new Vector2(body.getLinearVelocity().x, 12));
                }
}

Please Help!

sentences:
Changing coordinates of the object with velocity preservation In Doodle jump, if a player jumps over one side of the screen he appears on another side with preserved velocity and other physical parameters.

I made two trigger colliders on the sides of the screen with OnTriggerEnter2D method.

private void OnTriggerEnter2D(Collider2D collision)
{
    collision.transform.position = new Vector3(collision.transform.position.x * -0.95f,
        collision.transform.position.y, collision.transform.position.z);
}

If I multiply collision.transform.position.x by -1f then on collision some glitching occurs. It gets stuck for a second. I believe this happens because when player is moved to the other side there is another collision detected and he is thrown back. Is there a more elegant way of handling this instead of multiplying by 0.95f?

Final solution:

[Tooltip("Controls where is the edge of the level where player is trasfered on the opposite side of the level.")]
[SerializeField]
private float xAxisMovementConstraints;

private void DetectBoundryCross()
{
    if (transform.position.x < (-xAxisMovementConstraints))
    {
        transform.position = new Vector2(transform.position.x + (xAxisMovementConstraints * 2f),
            transform.position.y);
    }
    else if (transform.position.x > xAxisMovementConstraints)
    {
        transform.position = new Vector2(transform.position.x - xAxisMovementConstraints * 2f,
            transform.position.y);
    }
}

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:
Efficiently rendering to 3D texture I have an existing depth texture and some other color textures, and want to process the information in them by rendering to a 3D texture (based on the depth contained in the depth texture, i.e. a point at (x/y) in the depth texture will be rendered to (x/y/texture(depth,uv)) in the 3D texture).

Simply doing one manual draw call for each slice of the 3D texture (via glFramebufferTextureLayer) is terribly slow, since I don't know beforehand to what slice of the 3D texture a given texel from one of the color textures or the depth texture belongs. This means the entire process is effectively

for each slice
  for each texel in depth texture
      process color textures and render to slice

So I have to sample the depth texture completely per each slice, and I also have to go through the processing (at least until to discard;) for all texels in it.

It would be much faster if I could rearrange the process to

for each texel in depth texture
   figure out what slice it should end up in
       process color textures and render to slice

Is this possible? If so, how?

What I'm actually trying to do: the color textures contain lighting information (as seen from light view, it's a reflective shadow map). I want to accumulate that information in the 3D texture and then later use it to light the scene. More specifically I'm trying to implement Cryteks Light Propagation Volumes algorithm.

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:
Make non-sprite render in front of sprite How do I make the non-sprite (BasicSpellProjectile) render in front of the sprite (Tower 2)?

Note: The camera is located at z=-10.

The z positioning apparently doesn't do anything, and I am unable to set the sorting layer/order of the non-sprite as there isn't one such option.

sentences:
submeshes and dynamic batching doesnt work as expected I'm duplicating one object with submeshes frequently, and assigning a random material from five materials to each submesh. There is batching happening, but it's not quite as efficient as I would have expected (details here).
Note objects are all less 900 vertices no light maps and ... All are dynamic batching ready

So if dynamic batching works there must be only 5 draw calls right but there isn't there is really much more than 5

sentences:
How can I extract the Geometry from a j3o file? I created a blender file and then converted it into the j3o file.
The only way to load the 3d structure in the game is through a Spacial object:

Spatial towerModel = assetManager.loadModel("Textures/tower.j3o");

Initially the tower in the scene was composed by a simple Geometry:

new Geometry("Tower." + index, new Box(X_SIZE, Y_SIZE, Z_SIZE));

To substitute this implementation with a proper 3d tower I need to use the Gemetry object from the 3jo.

How can I extract the Geometry from the j3o file?

sentences:
How to create a random, warped 2D grid? How do you create a random grid where the lines aren't orthogonal (and cells aren't a perfect square), but are warped?
Here's an example of what I mean:

(Credit: screenshot taken from a video by Silvarret about the game Townscaper.)
Lines curve. Sometimes many cells come together in a single point. Yet, it still looks like a grid and the cells are clearly visible and roughly equal in size and shape.
I have absolutely no clue how to go about something like this. How is this achieved? Is there an algorithm for this? How would you detect the cell over which the mouse hovers?

sentences:
How to display consistent background image Drawing a large background is relatively slow in PyGame.
In order to avoid drawing BG every frame, you could draw it once, then do nothing.

However, if something is overdrawn onto the surface and keeps moving, you will need to redraw the background in order to "erase" the color pixels left by moving object; otherwise, you will have "traces" of the moving object.

I have a moving object in my PyGame. However, I do not want to "clear the color buffer" by redrawing the background image. Redrawing the background image every frame is slow.

My solution :

I will "clear" only required portions (where the "traces" of moving object are left)  of the "buffer" by redrawing portions of background.

Is there any other better way to have a consistent background?

sentences:
How to change FoV in vertex shader? Is it possible to change the Field of View vertex shader? I zoom my camera by changing the FoV value. However this will cause the skybox also be zoomed and this is not what I wanted. Is it possible to change the FoV value of the projection matrix in vertex shader?

Specifically, I pass the projection matrix by uniform to a glsl shader. I want to change the FoV value of the projection matrix (to make a new projection matrix) in the vertex shader of the skybox.

sentences:
Drawing on an image before drawing on screen in XNA using VB.NET I'm programming a game in XNA, using VB.NET. I want to create an intro to the game that zooms in/out the whole screen and scaling each image to accomplish this is cumbersome at best. I like to be able to draw a lot of .PNG's (or parts of them) onto a whole image, to then be able to manipulate (scale, turn etc) that whole image, before drawing it with the spriteBatch. The examples I can find use something like:

dim bitmap as New Bitmap

or

dim image as New Image

but these codes highlights the "Bitmap" or "Image" as red, and I cannot use them. I'd be thankful for any help on this issue!

please note: I'm new to this, and self taught, so I prefer concrete examples if possible.

sentences:
What algorithm to use for random terrain? (Please note, I am aware that the generation is not truly random and relies on mathematical equations, and that my language of choice is C++)

So I've been learning programming for a while now and I'm looking to make a top down 2D game. I want this game to generate random terrain pretty much like Dwarf Fortress but with sprites, however for this question let's just say that there just ASCII characters. I want it to generate mountains,  rivers, inland lakes etc. I know of algorithms but have not been able to find a list of them all. The ones i know of are:

Perlin Noise,
Diamond Square,
Midpoint Displacement
and some other minor ones.

However I don't know which one to use and struggle to find a good article on any of them. Is there one right for the job, or does it just come down to personal opinion? And if you can find a list of all the algorithms and maybe a good article on one it would really help. Thanks!

sentences:
SDL Parallax Scrolling along two axis I'm trying to implement Parallax scrolling in two dimensions using SDL, but I've run into an issue using SDL_BlitSurface() to blit my layer images to the screen buffer.
The images I'm using for this are borrowed from http://en.wikipedia.org/wiki/Parallax_scrolling, and I was able to get it working fine just scrolling along the X axis, using the following code:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);
        layer->x_offset %= buffer->w;
        int draw_x = layer->x_offset - layer->image->w;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w) {
            blitrect.x = draw_x;
            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);
            draw_x += layer->image->w;
        }
    }
}

This works.

Now, I've tried to adapt this into two dimensions. Here's the draw method I'm using now:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);

        //resize offset so as not to overflow ints or whatever
        layer->x_offset %= buffer->w;
        layer->y_offset %= buffer->h;

        int draw_x = layer->x_offset - layer->image->w;
        int draw_y = layer->y_offset - layer->image->h;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w && draw_y <= buffer->h) {

            blitrect.x = draw_x;
            blitrect.y = draw_y;

            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);

            if(draw_x <= buffer->w)
                draw_x += layer->image->w;
            if(draw_y <= buffer->h)
                draw_y += layer->image->h;
        }
    }
}

I've added the logic for blitting a layer that's moving in the vertical axis, but when I tested it, this just doesn't play nice. Areas of the screen end up not being blitted, which causes a lovely un-drawn effect:

Link to image as I can't post them directly (new user): SDL blitting bug example

Just to be clear, the images themselves are pushed around in another method. The front two layers are moving along the horizontal axis with varying velocity, and the background is moving vertically with a fixed velocity and horizontal with a variable velocity, but that's largely irrelevant as it's my blit function which is bugged.

It looks like I'm not re-drawing the area of the screen that has the repeating image on it, but I'm lost as to how to go about this.

sentences:
Is it possible to have concurrent collision detection where every entity acts at exactly the same time? There are many algorithms that can be used for collision detection. In many cases we check for an overlap in coordinates of an entity.

If we make a triangle a,b and c. We have 2 entities at a and b heading for a collision at c but each of them are moving at exactly the same time, what kind of algorithm could work?

It seems more like a chess game where you would have to predict every move that the other entity would have to make, if they swerve to the left to avoid a collision will they also run the chance to collide. Is it possible or is it too complex? Would it work for thousands and millions of entities in the same search space?

sentences:
Node representations in a navigation mesh There are different ways to represent nodes in a navigation mesh. It's either along triangle centroid, along triangle vertices or along edge midpoints.

As I understand if you choose triangle centroid or edge midpoints as nodes, the path isn't going to be optimal, but you can use a funnel algorithm to optimize it.

If you choose triangle vertices as nodes however, I understand you can find the more optimal path from get-go. But you will get a "wall hugging" issue. Which you can solve by using some algorithm I unfortunately forgot the name of.

What is the preferred or most optimal option?

sentences:
How to project spherical coordinates to canvas I have objects with coordinates in a spherical coordinate system (altitude alt and azmiuth az). I want to project those to my canvas with a given size (128 x 128 pixels²) and resolution (about 6 px/°).

The canvas looks at the sphere from the inside and can be rotated in alt, az and around its normal. The canvas normal direction is known in the same coordinate system as the objects, and the view is centered around that canvas' center.

How do I find an object's x and y position on the canvas? I know this is almost the same as an orthogonal (or similar) map projection, but the examples I found all have a view fixed at alt = 0. That's not what I have here, and I'm having difficulties figuring this out.

I can not use any ready-made projection tools, as I'm programming an embedded system. The existing questions here at gamedev seem to be centered around frameworks that provide such functionality.

As DMGregory pointed out, I need a simple perspective projection matrix for a gnomonic projection. Wikipedia also has an article about perspective (camera) projection, I'll try to implement that and see if it does what I need.

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:
how to load normals for a model from texture2d? I know i can do this through custom shaders, but i want to know is it possible to set it through xna itself. As for each effect i have pick normals from a texture2d, i want to change normals of model.

I have done this much, but i don't know how to go further??

  foreach (ModelMesh mesh in Home.Model.Meshes)
       {
           if (mesh.Name == meshName)
           {
               foreach (ModelMeshPart part in mesh.MeshParts)
               {
                   VertexPositionNormalTexture[] normals = new VertexPositionNormalTexture[part.VertexBuffer.VertexCount];
                   part.VertexBuffer.GetData<VertexPositionNormalTexture>(normals);

                   Color[] data = new Color[normalMap.Height * normalMap.Width];
                   normalMap.GetData<Color>(data);
               }
           }

       }

Thank you

sentences:
How to fix pink tiles when there is a problem with the Shader? Because of some dumb mistake I did fifth time, I had to repaint my level in my 2D game.
The problem is that the tiles I use from the Tile Palette turn into pink because of some shader error. I came to this conclusion after a long time of browsing through the forums.

I am 100% sure that this will happen again, because I don't know what causes this behavior. So, prevention is not an option for me.
What is the solution?

By @DMGregory's suggestion, I was able to recreate this dumb behavior of mine in an empty project.
What I do is dragging and dropping a tileset onto a tile palette which I am using, and then overwriting the current tile palette. Then, the former assets are lost (I guess?) leaving me with pink tiles.

Attached picture is one of my levels created using Tile Palette. How do I take this back? I don't want to repaint my level everytime I do whatever that causes this behavior.

sentences: How to properly copy/paste object between folder? I'm new to unity and found some simple task can't be done here. For example in projects tab, i want to copy/paste a script from script folder to other folder. I should be able to simply select the script, press ctrl C , go to target folder , press ctrl V to paste but nothing happen. So for now , i have to duplicate it then move it to new folder then rename it. But why can't i do simply copy and paste ?

sentences:
2D Smooth Turning in a Tile-Based Game I am working on a 2D top-view grid-based game. A ball that rolls on the grid made up of different tiles. The tiles interact with the ball in a variety of ways.

I am having difficulty cleanly implementing the turning tile. The image below represents a single tile in the grid, which turns the ball by a right angle.

If the ball rolls in from the bottom, it smoothly changes direction and rolls to the right. If it rolls in from the right, it is turned smoothly to the bottom. If the ball rolls in from top or left, its trajectory remains unchanged by the tile.

The tile shouldn't change the magnitude of the velocity of the ball - only change its direction.

The ball has Velocity and Position vectors, and the tile has Position and Dimension vectors.

I have already implemented this, but the code is messy and buggy. What is an elegant way to achieve this, preferably by modification of the ball's Velocity vector by a formula?

sentences:
Rigging Skinning of human skeleton skin mesh scanned by MRI I have successfully developed a system in Qt/C++ for human musculoskeletal mocap simulations. I can run asf, amc, bvh motion capture files and can visualize the joint transformations. I even simulated the static rigid bones of MRI scanned meshes.

31 mesh bones were extracted from MRI data and each bone is assigned to *.asf skeleton bone id/name and parent and child relationship is created. I have absolute and relative transformations of each bone and the bone mesh vertices positions are also known.

Now there is a skin mesh over the skeleton bones. I want to do rigging/skinning of that skin mesh with the bone transformation. If a bone transforms, its skin mesh should be transforming too. Literature study tells us that, assign each vertex of its bone and assign some weight to each vertex, sum up all and multiple with the bone's transformation matrix, etc. etc. and find the new position of a vertex.

I have pretty much experience to play with meshes and transformations, I can do that. But here I do not get the concept, first of all, how can we assign vertex to its specific bone? because human skin is a continues with Only One Shell, do we assign by computing the offset/minimum distance from bone to skin? Second question is how do we compute weight for each vertex? Because this mesh is not exported from MAYA or some 3D softwares, where each vertex is assigned with a weight value, but this is a static rigid mesh with no precomputed information. Third question comes to mind that how can we know that this specific vertex should be transforming with the transformation of Foot for example? How do we know that this vertex is a Foot vertex?

I want to have some concepts about the methodology, please guide me.

Thanks.

sentences:
What are the main requirements to port a game to Linux Steam for Linux is out today and I was surprised to see many games already being sold, which made me wonder what are going to be the difficulties for all those games to be ported to Linux. I broke this though into 3 questions:

Is it a matter of basically make the game run in OpenGL?
Are there any engines that build to Linux?
Did Valve have any hand on the development of some framework/toolset/OpenGL to make porting easier?

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:
State Changes in a Component Based Architecture I'm currently working on a game and using the naive component based architecture thingie (Entities are a bag of components, entity.Update() calls Update on each updateable component),
while the addition of new features is really simple, it makes a few things really difficult: a) multithreading / currency b) networking c) unit testing.

Multithreading / Concurrency is difficult because I basically have to
do poor mans concurrency  (running the entity updates in separate
threads while locking only stuff that crashes (like lists) and
ignoring the staleness of read state (some states are already
updated, others aren't))
Networking: There are no explicit state changes that I could
efficiently push over the net.
Unit testing: All updates may or may not conflict, so automated
testing is at least awkward.

I was thinking about these issues a bit and would like your input on these changes / idea:

Switch from the naive cba to a cba with sub systems that work on
lists of components
Make all state changes explicit
Combine 1 and 2 :p

Example world update:

statePostProcessing.Wait() // ensure that post processing has finished
Apply(postProcessedState)

state = new StateBag()

Concurrently(
 () => LifeCycleSubSystem.Update(state), // populates the state bag
 () => MovementSubSystem.Update(state), // populates the state bag
  ....
})

statePostProcessing = Future(() => PostProcess(state))
statePostProcessing.Start()
// Tick is finished, the post processing happens in the background

So basically the changes are (consistently) based on the data for the last tick; the post processing can a) generate network packages and b) fix conflicts / remove useless changes (example: entity has been destroyed -> ignore movement etc.).

EDIT: To clarify the granularity of the state changes:
If I save these post processed state bags and apply them to an empty world, I see exactly what has happened in the game these state bags originated from -> "Free" replay capability.

EDIT2: I guess I should have used the term Event instead of State Change and point out that I kind of want to use the Event Sourcing pattern

sentences:
Keeping a Character Controller grounded? I've got a character that makes use of isGrounded() to determine whether I can jump, whether my air-jump is reset, and the amount of friction to be applied. I've run into a common problem, isGrounded() is fluctuating every frame returning true and false randomly resulting in jagged movement.

The standard suggestion is to constantly apply gravity. Unfortunately, aside from any other more nuanced issues that this could result in, this only works for me if I apply so much gravity that I am no longer able to climb up slopes. I need a way to keep the character grounded without applying large amounts of gravity every frame.

sentences:
Running Unity Build through Command line I recently developed a game in unity and would like to build it to a standalone application using the command line. Is there a way to do that?

Specifically, without opening the Unity Editor how can I use the command line to build my project to a standalone application?

I am using Linux.

sentences: 2d Tower Defense - Projectile Prediction For my map, it's very curvy and the node sizes aren't consistent. I have everything finished so that projectiles will actually fly at an enemy, however if a projectile is going too slow it will miss. I am wondering if I should just go the easy route, and just make the projectile homing, or if I could get help here on where to start. The enemy is changing directions, and moving around, although never changes speed.

sentences:
How to scale our multiplayer support, similar to Among Us We are a small team with the goal of creating our first multiplayer game, and we want to support multiplayer that can rapidly scale up as Among Us has successfully done.
We don't have a huge budget and we are struggling to find an appropriate way to implement multiplayer, including peer to peer (although it would be exhausting to combat cheating and make a smooth experience). Our game has no more, no less than 50 players in a very tight space.
As an example, we're looking at the indie game Among Us. They went from such a small game with barely any players, to maintaining well over 3 million CCU (concurrent users). How can we achieve similar scalability?

sentences:
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:
How much does game development mathematics change over time? This question is mainly aimed at this book, Essential Mathematics for Games and Interactive Applications, Second Edition which I have seen highly recommended all around the internet, so I'm sure there are people on here who own a copy.

What I want to know specifically is if any of the information would be out dated since the book was released on June 2, 2008?

Also interested to see how the mathematics behind game development has changed over time.

sentences:
Interactions between camera and procedural terrain QUESTION REWORKED

I need to update every frame camera position along a surface with hills and drops.
In this picture you can see a particle of the surface terrain (just one triangle) and a sphere representing the camera. It is set in a certain point of the surface and has a velocity in the XZ plane.

What I want to do is check the plane sloping and modify the velocity in order to move smoothly on the surface without "entering" in it like if it was a ladder

How should I proceed? I can easily ccess informations like vertex coordinates, surface normale (in that particular triangle) and I think whatever you thinkcould be of help but since I have difficulties in painting on a paper what should I expect I don't know how to approach this problem.

Can someone help me?

sentences:
How can I toggle enabled on a specific script within an object in Unity? I have the CarController script inside my car GameObject. I need to set it to disabled at the start so the countdown timer can start the race.

I thought I knew how to do it but once again I have failed :/

Any ideas why this doesn't work??

void TogglePlayerEnabled(bool b)
{
    playerCar.GetComponent<CarController>().enabled = b;
}
void ToggleAiCarEnabled(bool b)
{
    aiCar.GetComponent<CarController>().enabled = b;
}

If I use a print line saying "Toggled" or something, that appears in console as expected. But the CarController script seems like it stays active as both me, and the AI car can just drive whilst the countdown is happening still.

Here's the full class:

public class GameManagerControl : MonoBehaviour {

public GameObject playerCar;
public GameObject aiCar;

public int sceneChangeZValue;

private string countdown = "";
private bool showCountdown = true;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    // TODO: This will change the scene when the track ends.
    //if (player.transform.position.z >= sceneChangeZValue)
    //      {

    //          SceneManager.LoadScene("race_track_lake");
    //      }

    if (showCountdown)
    {
        StartCoroutine(GetReady());
    }

}

// call this function to display countdown
IEnumerator GetReady()
{
    countdown = "3";
    TogglePlayerEnabled(false);
    ToggleAiCarEnabled(false);
    yield return new WaitForSeconds(1.5f);

    countdown = "2";

    yield return new WaitForSeconds(1.5f);

    countdown = "1";

    yield return new WaitForSeconds(1.5f);

    countdown = "GO";
    TogglePlayerEnabled(true);
    ToggleAiCarEnabled(true);
    yield return new WaitForSeconds(1.5f);

    showCountdown = false;
    countdown = "";
}

// GUI
void OnGUI()
{
    if (showCountdown)
    {
        GUI.color = Color.red;
        GUI.Box(new Rect(Screen.width / 2 - 100, 50, 200, 175), "GET READY");

        // display countdown
        GUI.color = Color.white;
        GUI.Box(new Rect(Screen.width / 2 - 90, 75, 180, 140), countdown);
    }
}

sentences:
How do I apply skeletal animation from a .x (Direct X) file? Using the .x format to export a model from Blender, I can load a mesh, armature and animation. I have no problems generating the mesh and viewing models in game. Additionally, I have animations and the armature properly loaded into appropriate data structures.

My problem is properly applying the animation to the models. I have the framework for applying the models and the code for selecting animations and stepping through frames.

From what I understand, the AnimationKeys inside the AnimationSet supplies the transformations to transform the bind pose to the pose in the animated frame. As small example:

Animation {
  {Armature_001_Bone}
  AnimationKey {
    2; //Position
    121; //number of frames
    0;3;     0.000000, 0.000000, 0.000000;;,
    1;3;     0.000000, 0.000000, 0.005524;;,
    2;3;     0.000000, 0.000000, 0.022217;;,
    ...
  }
  AnimationKey {
    0; //Quaternion Rotation
    121;
    0;4;   -0.707107, 0.707107, 0.000000, 0.000000;;,
    1;4;   -0.697332, 0.697332, 0.015710, 0.015710;;,
    2;4;   -0.684805, 0.684805, 0.035442, 0.035442;;,
    ...
  }
  AnimationKey {
    1; //Scale
    121;
    0;3;     1.000000, 1.000000, 1.000000;;,
    1;3;     1.000000, 1.000000, 1.000000;;,
    2;3;     1.000000, 1.000000, 1.000000;;,
    ...
  }
}

So, to apply frame 2, I would take the position, rotation and scale from frame 2, create a transformation matrix (call it Transform_A) from them and apply that matrix the vertices controlled by Armature_001_Bone at their weights. So I'd stuff TransformA into my shader and transform the vertex. Something like:

vertexPos = vertexPos * bones[ int(bfs_BoneIndices.x) ] * bfs_BoneWeights.x;

Where bfs_BoneIndices and bfs_BoneWeights are values specific to the current vertex.

When loading in the mesh vertices, I transform them by the rootTransform and the meshTransform. This ensures they're oriented and scaled correctly for viewing the bind pose.

The problem is when I create that transformation matrix (using the position, rotation and scale from the animation), it doesn't properly transform the vertex. There's likely more to it than just using the animation data. I also tried applying the bone transform hierarchies, still no dice. Basically I end up with some twisted models. It should also be noted that I'm working in openGL, so any matrix transposes that might need to be applied should be considered.

What data do I need and how do I combine it for applying .x animations to models?

I've made some mock ups of what this looks like, in case that's useful.

First I wanted to just test the translation, this is a bobbing head, what it looks like in Blender:

http://i.stack.imgur.com/NAc4B.gif

And what it looks like in game (don't mind the colors):

http://i.stack.imgur.com/nj2du.gif

Then for just rotation, the animation was the head rotating 360 degrees around the vertical axis. This is what that looks like in game:

http://i.stack.imgur.com/gVyUW.gif

Note, there should be no tilt, only rotation like a merry-go-round.

Update

I have the translation part of the animation working. But it feels kind of hacky and I don't see how to apply it to the rotation.

The translation works by taking these steps:

Take the position from the animation frame and swap the y and z values
Translate the transformation matrix by the altered position
Transpose the transformation matrix
Apply the transformation matrix to the vertices

So that's how it can work, but how is it supposed to work generally for position, scale and rotation?

sentences:
iOS Game that Runs Continuously in Background I'm trying to understand the most logical way of creating an iOS game that runs continuously in the background.

For example.. you have tower and enemy waves. The game has endless enemy waves even when the game exits. When you open the game again, it will retrieve the data that occurred when the app was closed.

I assume a database on a server would be the best solution. The values continuously increment on the server. The game connects to the server and retrieves the specific user's updated game data.

sentences:
Unity Animation Tracking Background

I've recently reached a bottle neck in my game's code that forced me to completely decouple the logic/networking from the graphics. Thanks to the nature of my board game, I was able to build the following architecture:

Logic update loop:

+--> wait for event -> process event -> dispatch graphic events --+
|                                                                 |
+-----------------------------------------------------------------+

Graphics update loop:

+--> wait for event -> process event -> wait for animation --+
|                                                            |
+------------------------------------------------------------+

Question

From the previous design, tracking animation timing and knowing when they end is crucial, since that marks the end of the third phase in the graphics loop, allowing us to proceed to the next phase.

I'm using Unity, and I am not sure how to go about this. I am using Unity's animation system as well as LeanTween to perform animations on the 2D NGUI level as well as the 3d game scene level.

Proposed Solutions

Solutions that have occurred to me so far are:

Callbacks

Pass on a callback, and make the animation system trigger that callback when the animation finishes. This has proven to be high maintenance and redundant, as I have to manage passing data back and forth maintaining the overall animation state somehow (if multiple animations were triggered).

Global Monitor

Animations register under a global monitor, and I can emit a signal when the monitor becomes empty, triggering the end of the animations phase. I must make sure animations are registered immediately at the beginning of the animation phase, which I should be able to do. I should also maintain a list of animation IDs or a simple "anonymous" counter, which animations increment and decrement. Kinda like manual memory management. I might do this.

Any of those seem viable? Am I overlooking details about this system? Any better alternatives come to mind?

sentences:
Using name of real products in games My friend and I are creating a Computer Tycoon game. We're using graphics cards and other real CPUs in the game. So can we use names like GeForce_210 in the game without issues?

Also, if the above doesn't work, can we just change a little bit in the name like LeForce and will that work?

sentences:
How would you handle different aspect ratios in a 2d platformer? A long time ago, 4:3 was pretty much the only apect ratio you would find on a PC. Today the most common one is 16:10, but most new monitors (especially laptops) are 16:9

I'm writing a 2D platformer, and I can't decide how I should handle all the different ratios.

Here are some ideas:

4:3 gets more content, widescreens are cut on top and bottom
16:9 gets more content, the others are cut left and right
The game is in 16:9 with black horizontal bars for other ARs
The game is in 4:3 with black vertical bars for other ARs

sentences:
Reduce render time for a tiled map in ThreeJS I'm working on a WebGL game using Three.js, its been a few days and I found my first issue, render time on big maps.

The game runs great, there are even some AI mobs that run around randomly like crazy, the problem comes when the game has to display many tiles at once (being many around 900 (30x30) on my Computer), if I zoom in the game runs at 60 solid FPS, here's the game demo so you can watch it in action.

http://kuxtal.oruga.biz/

You can move around with the classic WASD or arrow keys and zoom in and out with the MouseWheel.

Right now I'm creating a map like this (The project's code name is Kuxtal):

I have a singleton called Kuxtal, from which all the magic happens, I create a Kuxtal.Instance, which holds the renderer, scene, camera, and some functions to work with them.

Then I create a Kuxtal.Map, to which I pass the width & height as parameters and it runs:

for (var i = 0; i < this.width; i++) { // map.width
    for (var j = 0; j < this.height; j++) { // map.height
        var type = Math.ceil(Math.random() * 3); // 1-Grass 2-Dirt 3-Something else
        var tile = new Kuxtal.Tile(type, i, j);

        this.tiles.push(tile);
    }
}

This is my Kuxtal.Tile Class:

Kuxtal.Tile = function(type, x, z) {
    this.type = type;
    this.x = x;
    this.y = Math.random(); // A random elevation between 0 and 1 les me see the grid and looks nice
    this.z = z;

    this.sprite = new THREE.Mesh(new THREE.CubeGeometry(Kuxtal.TILE_SIZE, 1, Kuxtal.TILE_SIZE), new THREE.MeshPhongMaterial({color: 0xFFFFFF, map: Kuxtal.getTexture("grass")}));
    this.sprite.position.set(SELF.x * Kuxtal.TILE_SIZE, SELF.y, SELF.z * Kuxtal.TILE_SIZE);
    this.sprite.receiveShadow = true;= THREE.RepeatWrapping;
}

And the tiles are added to the scene on this Kuxtal.Instance.loadMap(map) function:

map.tiles.forEach(function(tile) {
    SELF.scene.add(tile.sprite);
});

Any suggestions on how to improve the performance?

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:
Creating teams 2v2, 3v3, etc I'm figuring out how to create games with teams. The problem is that there will be games 1v1, 2v2, and so on as well as free for all. What would be the most efficient way to do this in Unity C#?

I'm thinking of making a Dictionary with players' instances and every player has an index for a team. For example, we have 2v2 game, two players have teamIndex 1 and the other two have teamIndex 2. Is this the right way to do it, or there is a better way?

Thank you!

sentences:
Search app store for similar games on pc I want to search the app store for similar games so I can see how much competition there will be for any apps I am thinking of designing.

Knowing how many clones/similar games there are plus there prices and success rate would go a long way in deciding which ideas to take forward.

Is there anyway to do this easily on a pc (I do not have an iPhone)

sentences:
Building a Plattformer - How to determine if a player is allowed to jump? I'm building a simple Plattformer Jump n' Run Style game. I do not use tiles - instead i've geometrical shapes for my level entities (and the player is one too). I finished my collision detection code and everything works fine so far.

Next, I wanted to implement jumping. Just checking if the player hits the appropriate key and add some upwards velocity. Works fine. But it works even if the player is in-air, which is not what I want. ;-)

So, I have to check if the player stands on something. My first idea was to check if there was a collision in the last frame and mark the player as "able to jump", but this would even trigger if the player hits a wall in-air. As my math skills aren't that good, i ask for help - even hints would do how to implement this.

Thanks!

sentences:
Generate plane with script missing triangles I am trying to do a simple script to generate a plane from a script by creating a new mesh. After trying it, it seems like some of the triangles aren't showing up. I checked if they were in the list by making it publci and they are in it, so I dont understand why the last triangles aren't showing while the others are.
int size = 4;
Mesh meshy;
public List<Vector3> vert = new List<Vector3>();
public List<Vector2> uv = new List<Vector2>();
public List<int> tri = new List<int>();
void Start()
{
    vert = new List<Vector3>();
    tri = new List<int>();
    meshy = new Mesh();
    for (int x = 0; x < size; x++)
    {
        for(int z = 0; z < size; z++)
        {
            vert.Add(new Vector3(x, 0, z));
        }
    }
    meshy.vertices = vert.ToArray();
    for (int i = 0; i < ((size-1)*(size-1));i++)
    {
        tri.Add(i);
        tri.Add(i+1);
        tri.Add(i+size);
        tri.Add(i + size +1);
        tri.Add(i + 1 +(size - 1));
        tri.Add(i + 1);
    }
    meshy.triangles = tri.ToArray();
    for(int i = 0; i < ((size - 1) * (size - 1)); i++)
    {
        uv.Add(new Vector2(0, 0));
        uv.Add(new Vector2(1, 0));
        uv.Add(new Vector2(0, 1));
        uv.Add(new Vector2(1, 1));
    }
    meshy.uv = uv.ToArray();
    GetComponent<MeshFilter>().mesh = meshy;
}

sentences:
Attach component of other Object to a variable within Unity Inspector This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it:

Actually all I want to do is attach the MeshRenderer Component of this Object

to a variable of a script on another Object like

Problem: As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore.

I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent<MeshRenderer> but I wondered if this can be done directly, too.

sentences:
Simulating the effects of  wind I am developing a mobile game for Android. It is a 3D jumping game (like ski jump) where wind plays a important role so i need to simulate it. How could I achieve this?

The game uses libgdx for rendering and a port of Bullet physics engine for physics. To simulate the jump I have 2 spheres which are placed at the start and at the end of the player and gravity is applied to them (they role down the hill and jump at the end). I use them to calculate the angle and the position of the player. If a button is pressed some extra y speed is applied to them (to simulate the jump before the end of the jumping ramp).

But now I have to add wind to it. How is this usually done? Which collision box/method should I use? The way I understand it I only have to apply some force with direction to the player while in mid air. How can I do this in Bullet?

sentences:
How to load/unload chunks data where view port is currently focused on? I have a 2D tile based engine with infinite procedural chunk generation.
But I can't invent an algorithm, that will fill only chunk tiles on view port (and destroy old). Pls help
ViewPort size can changing on the fly (2 - 100)
I can't load all chunks completely, because I need to analyze the tiles in the visibility zone

class Map {
  public List<Chunk> { get; set; }
  public int viewPortWidth = 2 ... 100;
  public int viewPortHeight = viewPortWidth;
  public Vector2Int playerPosition { get; set; }
}

class Chunk {
  Tile[] Tiles { get; set; }
  public int chunkWidth = 16;
  public int chunkHeight = chunkWidth;

  public Chunk(int _leftX, int _bottomY)
  {
    for (int y = 0; y < chunkHeight; y++)
    {
        for (int x = 0; x < chunkWidth; x++)
        {
            randomNumberGenerator.InitState(x + _leftX, y + _bottomY);
            chunk[x, y] = randomNumberGenerator.Range(100);
            Tiles.Add[chunk[x, y]];
        }
     }
}

sentences:
Will DirectCompute run this HLSL code I found a sample about how to run a HLSL code with DirectCompute.

https://code.msdn.microsoft.com/windowsdesktop/DirectCompute-Basic-Win32-7d5a7408

This is the HLSL script I want to run

https://github.com/zachsaw/MPDN_Extensions/blob/master/Extensions/RenderScripts/SuperRes/SuperResEx.hlsl

It doesn't seem the same as the BasicCompute sample. First, the main function's name is called "main" instead of "CSMain". Second, it uses data types like float2, float3 and float4 while BasicCompute uses standard data types. So, is it the same or something else?

Will DirectCompute run this script or it has to be done through other means?

sentences:
One-way platform collision I hate asking questions that are specific to my own code like this, but I've run into a pesky roadblock and could use some help getting around it. I'm coding floating platforms into my game that will allow a player to jump onto them from underneath, but then will not allow players to fall through them once they are on top, which require some custom collision detection code. The code I have written so far isn't working, the character passes through it on the way up, and on the way down, stops for a moment on the platform, and then falls right through it. Here is the code to handle collisions with floating platforms:

protected void HandleFloatingPlatforms(Vector2 moveAmount)
    {
        //if character is traveling downward.
        if (moveAmount.Y > 0)
        {
            Rectangle afterMoveRect = collisionRectangle;
            afterMoveRect.Offset((int)moveAmount.X, (int)moveAmount.Y);
            foreach (World_Objects.GameObject platform in gameplayScreen.Entities)
            {
                if (platform is World_Objects.Inanimate_Objects.FloatingPlatform)
                {
                    //wideProximityArea is just a rectangle surrounding the collision
                    //box of an entity to check for nearby entities.
                    if (wideProximityArea.Intersects(platform.CollisionRectangle) ||
                        wideProximityArea.Contains(platform.CollisionRectangle))
                    {
                        if (afterMoveRect.Intersects(platform.CollisionRectangle))
                        {
                            //This, in my mind would denote that after the character is moved, its feet have fallen below the top of the platform, but before he had moved its feet were above it...
                            if (collisionRectangle.Bottom <= platform.CollisionRectangle.Top)
                            {
                                if (afterMoveRect.Bottom > platform.CollisionRectangle.Top)
                                {
                                    //And then after detecting that he has fallen through the platform, reposition him on top of it...
                                    worldLocation.Y = platform.CollisionRectangle.Y - frameHeight;
                                    hasCollidedVertically = true;

                                }
                            }
                        }
                    }
                }
            }
        }
    }

In case you are curious, the parameter moveAmount is found through this code:

elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

        float totalX = 0;
        float totalY = 0;

        foreach (Vector2 vector in velocities)
        {
            totalX += vector.X;
            totalY += vector.Y;
        }

        velocities.Clear();

        velocity.X = totalX;
        velocity.Y = totalY;

        velocity.Y = Math.Min(velocity.Y, 1000);

        Vector2 moveAmount = velocity * elapsed;

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:
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:
Blender - baking normal map - weird colors I have a metal drum mesh, and when I bake its normal map, I get the weird colors (see attached pic). I'm talking about the horizontal gradient shift of color. There's no deformation like that on my mesh, how come the colors are like that? I've tried various spaces (camera, world, etc) but it's still bad (though the horizonal gradient changes with each one). Also tangent space returns a blocky blue color all over.

Can someone please tell me how to get a good normal map out of my mesh?

=== UPDATE

Solved, thank you very much Luke B. There's still the question of scaling one of the two overlapping versions a bit (the low res one for example) in order to get really good results, but that's how it's supposed to be done.

=== UPDATE 2

After further following the advices of Luke B, I've used multiresolution modifier on my low-res mesh, and baked from there. It looks much better than before, the color artifacting are down to a minimum, really, with some corrections in GIMP it's quite usable:

sentences:
Why are dungeons so often created subtractively rather than additively? I'm having difficult deciding on how to procedurally generate a dungeon floor. The way I've been doing it so far is like so:

Populate list of Rooms with random height and width.
Place first room in list at (0, 0).
Add room to a temporary list of rooms that have been successfully placed.
Place next room adjacent to a room randomly chosen from the aforementioned temporary list
Keep repeating previous step until room is successfully placed then move onto the next room.
Repeat the two previous steps until all rooms have been placed.

After that the doorways between the rooms are created and various steps are taken to assure collision is working properly but my question is this: Why does it appear to be common practice to first create a large area of cells that all are 'filled in' and to then 'carve out' rooms and corridors rather than to generate dungeons my way? I'm not saying my way is better, I would be happy for someone to tell me what I'm doing wrong and why I should be doing it differently. I just find my way easier for managing the various rooms and cells within my dungeon. It also means I don't have a bunch of 'useless' cells on the other side of the dungeon walls doing nothing but hogging processing power - that's something I never understood.

I just want to a way of generating a dungeon which balances efficiency and design.

sentences: Can a material be created from a gameobject in Unity? I am trying to manually create snowflakes in unity, after I created a snowflake in the unity scene, is it possible to create a material out of it?

sentences:
How to connect two Iphone/ipod/ipads for gameplay over local wifi network? I would like to add the option to play against another person over my wifi network in my pong game. How do I make this happen?

Also, I would like to know how to be able to have 4 players at the same time like I would if I make a monopoly type game or something similar.

I'm a newbee so please point me in the right direction or show me some code I can use for this and study.
Thanks guys
David

sentences:
Collision with User Input and Object I am curious on how to handle collision detection involving a moving target and user input. Basing myself in the mobile space, I get events from a set framework, but I do wonder about the amount of lag involved.

Say the object moves faster and faster, then position of the input and the object is very important. What I want to know is what is the best design for handling user input and then also the best way to make sure to accurately work out when the input point collides with the object, keeping threads in mind?

sentences:
How to calculate max region/area of 2d circles? I have some 2d circles on a plane, each has its own minRadius and maxRadius. When two circles collides, both of them will shrink their radius, so the actual radius of a circle is in range [minRadius, maxRadius].

I need to calculate the max possible radius of each circle. See below image for an example.

Currently, I use the following algorithm to calculate the radius of each circle.
I try to increase each circle's radius a little each steps, then check and solve if there is any collisions.

foreach c in circles: c.radius = c.minRadius;

for (int i = 0; i < 10000; ++i)
{
  foreach c in circles: c.radius = c.radius + 1
  foreach c in circles: calculate_radius(c)
}

function calculate_radius(c)
  collides = find_all_circles_which_radius_is_overlap_with_c()

  foreach x in collides {
    x.radius -= somevalue;
    c.radius -= somevalue;
  }
end

For now, the result looks fine, but the algorithm costs too much time.

So I wonder if there exists other ways to solve it?

=======================================================

@wondra counterexample(maybe)

The image below illustrates the problem.

From my understanding of your algorithm, the final radius of circle A is 1.6, the calculation sequence is (BC, AB, AD)

But if using my algorithm(increase radius by a small amount each step), the final radius of circle A is 1.5.

I don't think recalculate the dist matrix after each selection will solve the problem, as stated in my question, each circle may have its own minRadius and max Radius.

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:
OpenGL self-test in a mobile game I've made an Android game that uses no/custom game engine. It renders using OpenGL ES 2.0 and optionally uses some extensions for optimization or extra effects. Over the time I have dealt with various issues in OpenGL drivers, I had to implement workarounds or disable usage of some features on some devices. I am still getting reports from users that something does not render correctly on their device, but in most cases I have no way to debug it as it is happening on some strange device that I don't have. I am using AWS device farm for testing and all the devices there render the game correctly...

So I have come with an idea to implement some kind of self-test. It would run shortly after the first start and render off-screen some samples that test the shaders and features I use. The images would be compared to how they are supposed to look like. (I know the comparison must have some tolerance.) If it detects a mismatch, it could send me screenshots and detailed information about the OpenGL environment. Possibly it could even self-heal by disabling some features and trying again.

Was something like that already done in a (mobile) game?

Are there any caveats I should be aware of?

sentences:
Do UV coordinates need correction for moving object? The image above is a static capture of a dynamic OpenGL project I created in which I wrapped a NASA albedo, i.e., sans clouds, image on an OpenGL generated sphere.  In so doing, I also generated the UV coordinates associated with each vertex position.

This was an incremental learning effort in which I had already applied model matrix corrections to the vertex positions for the rotating and translating (orbiting) "Earth".

I was surprised to find that I did not have to apply a model matrix correction to the UV coordinates.

I have tentatively concluded that once the jpg image coordinates are associated with the corresponding vertex positions with the UV coordinates in the range of [0, 1], they are fixed and need no further correction.

Does that sound correct, or is there more to the situation?

sentences:
Efficient container(s) for units in an 2D RTS game As the title says, I'm toying around with developing a 2D space RTS game. All of my units are spaceships that basically just shoot at one another, but they have to do a variety of other things as well: they have to "discover" (notify, draw, etc) other ships and planets not owned by the owner of this ship and within the arbitrary range of the ship's "scanners" (since they would otherwise be hidden), and if the ship is told to fire on an enemy ship, it needs to find the closest enemy (and fly to it if out of shooting range), and then shoot it obviously.

I've been wondering what efficient data containers could I use for the ships if there is going to be a large number of ships (100s to maybe 1000s) and why them? Also to note, is that ships must be distinguished by their owner (I may go to war with one player, so I obviously do not want my ships to search for ships of other players), where ownership will probably be represented by some integer (1 = player 1, 2 = player 2, etc) or maybe the unique pointer/memory address of a "player" object (0x4ff = player 1, 0x5ea = player 2, etc) or some other simple identifier.

I initially thought about using an array of vectors (C++), with the index of the array representing the player and each vector being the ships belonging to that player; then take all ships belonging to whatever player you are at war with and place them into a priority queue, whose root would be the enemy ship closest to a specific (friendly) ship and decide if its in range or not, but this seemed far too slow and memory-expensive, and didn't really address how to scan for ships/planets.

I then read up a few related posts about quadtrees and this lead me to other such tree data structures, like R-trees, that are also used for optimal spatial queries, but I do not quite understand exactly how they work and whether or not they would be best for me, so here we are.

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:
Card flip animation in a prefab. How to flip with local position? I'm making a simple card game, with some cards laying on the table. I want to flip the card when it's clicked, so I thought I'd use an animation to do it (lift card up in the air, rotate it and lower it back down). It works as I want with one card, but when I save it as a prefab and instantiate another one next to it, the card (obviously) moves to the same position as the prefab (as the animation stores global position I guess).

Is there any way to make animations in local space, or is there any other way I should do the flip?

sentences:
"lerp" returning value (Shader)? I don't understand the lerp example in this code :

if(dot(WorldNormalVector(IN, o.Normal), _SnowDirection.xyz)>=lerp(1,-1,_Snow))
                o.Albedo = _SnowColor.rgb;
            else

(Snow is in the range 0..1)

The article says :
We then compare the dot value with a lerp - if our Snow level is 0 (no snow) this returns 1 and if the Snow level is 1 it will return -1 (the entire rock is covered).  It's quite normal to only vary the snow level between 0..0.5 when we use this shader so that we only have snow on surfaces that actually face the snow direction.

Why does it return 1 (with Snow at 0) and -1 (with Snow at 1) ?

(source: http://unitygems.com/noobs-guide-shaders-2/ )

Thanks

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:
Path tables or real time searching for AI? What is the more common practice in commercial games; path lookup tables or real time searches?

I've read that in many games path lookup tables are pre-calculated and baked into each map, so to speak, then steering behaviour is used to handle dynamic obstacles.

or is it better practice to use optimised hierarchical A* searches? I understand the pro's and cons of each, I'm just curious as to what is most often used in the industry.

sentences: 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 do I view a Source engine (Left 4 Dead 2) VTF? I used to use Source a lot, but it's been a long time. Now I want to look up some Left 4 Dead 2 textures for reference (Hard Rain's water particles, mainly), but the tools I used to use don't seem to have the same functionality as they used to, are broken or are new and seemingly broken.

I literally just want to look at VTFs I've exported from VPK's with GCFScape in the manner of a normal image viewer, as if they were .pngs instead of VTFs.

This seems like the best candidate, but I couldn't get it to open a viewer. Perhaps you can provide some documentation? Hammer might have been a useful texture inspector for me, except its thumbnails are restricted to 512x512 or lower viewing size.

Can anybody help me view these images in a vaguely straight-forward non-console GUI-ish manner? Like I used to be able to? Thank you in advance. =)

sentences:
User interaction and Component based architecture I'm working at my first game and I've decided to build a simple component based engine.
I found really useful to work in that way but I still miss some fundamentals probably.

Let say that I have a super simple game like this:
A spaceship that moves where user touches/clicks the screen. Before moving the ship the user has to select it by a touch/click over the spaceship sprite and to deselect it the user has to touch/click wherever outside the sprite.

To build something like that I'd use this structure:

Spaceship Entity
     |_____________ Movable Component  (contains coordinates)
     |_____________ Drawable Component (contains a sprite)

Rendering system:
     - Check for every entities with drawable and movable component and draw
       the sprite at the coordinate defined by movable component

Or something similar..

At this point I would like to add an input manager. But err... I really don't know which is the best way to attach an Input Manager in this structure! Do you think it's a good idea to create something like a Selectable component and then create a Input System?
The problem is that probably it would be useful to keep track of the selected object in other systems too and I suppose that this part could be managed outside the Component system.

So my question is how to deal with a behaviour that is so important and generic like user interaction in a Component based architecture. Have you had experience with this problem? Which solutions did you choose?

Edit:
And in general I suppose that is a valid idea to keep track of the current selected object. Using a component based architecture how can I manage shared information?

sentences:
How to convert pixel coordinates to GL coordinates in 2D space? I know that if you want to display a sprite on screen (in 2D) you can use glOrtho and essentially make 1 gl unit equal to 1 pixel, so when I plot out the vertices for say a 128x128 image (on a quad), I can define the vertices as -64/64, -64-64, etc and then when I map my texture coords to that quad, the image is displayed at a 1:1 ratio.

However, lets say I wanted to not use glOrtho and wanted to have a perspective view, so I can combine 2D sprites with 3D models and whatnot? I'm at a loss on how to convert/set up the coordinates for the planes/quads I want to draw images to, in a way that will match the resolution of the image. That is, define coordinates or convert them in such a way so that when a 2D sprite is right at the near plane, that sprite is mapped as 128x128 pixels on the screen.

sentences:
Bullet physics weird behavior. Jittering and drifting with btBoxShape I'm dropping a simple box onto a plane from 100 units and my solution using Bullet Physics is giving me some weird behavior. The dimensions of the box are {2, 4, 1}.

When the box hits the ground it jiggles up and down, drifts off to the side, and finally settles by sinking 1.5 units into the ground.

When I reduce the fall height to about 5 units the box doesn't sink into the ground, and the sideways drift is less pronounced.

When I declare a btSphereShape instead of a btBoxShape the problems go away. It should be noted that I'm developing for iOS with Objective-C file that interphases my code with Bullet.

Here's my code:

- (void)setUpPhysicsWorld { //This sets up the physics world and plane shape:

    collisionConfiguration = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfiguration);
    broadphase = new btDbvtBroadphase();
    solver = new btSequentialImpulseConstraintSolver;
    dynamicWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 0, 0));
    btStaticPlaneShape *planeShape = new btStaticPlaneShape(btVector3(0, 1, 0), 0);
    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(0.0, motion, planeShape);
    btRigidBody *planeRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(planeRigidBody);
    [self addBlock];

}

- (void)addBlock {

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 5, 0));

    /* Actual declaration of the box shape. For some reason, when I change this
    to a btSphereShape, all the problems go away. */
    btBoxShape *boxShape = new btBoxShape(btVector3(1, 2, 0.5));
    btVector3 inertia(0, 0, 0);
    boxShape->calculateLocalInertia(1.0, inertia);

    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(1.0, motion, boxShape, inertia);
    blockRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(blockRigidBody);

}

- (GLKVector3)getBLockLocation {

    dynamicWorld->stepSimulation(1/60.f, 10, 1/300.0);

    btTransform trans;
    blockRigidBody->getMotionState()->getWorldTransform(trans);

    return GLKVector3Make(trans.getOrigin().getX(), trans.getOrigin().getY(), trans.getOrigin().getZ());

}

Can anyone tell me what's wrong here?

sentences:
OpenGL ES 2.0 gluUnProject I've spent more time than I should trying to get my ray picking program working. I'm pretty convinced my math is solid with respect to line plane intersection, but I believe the problem lies with the changing of the mouse screen touch into 3D world space.

Heres my code:

    public void passTouchEvents(MotionEvent e){

        int[] viewport = {0,0,viewportWidth,viewportHeight};
        float x = e.getX(), y = viewportHeight - e.getY();

        float[] pos1 = new float[4];
        float[] pos2 = new float[4];
        GLU.gluUnProject(   x, y, 0.0f,
                            mViewMatrix, 0,
                            mProjectionMatrix, 0,
                            viewport, 0,
                            pos1, 0);

        GLU.gluUnProject(   x, y, 1.0f,
                            mViewMatrix, 0,
                            mProjectionMatrix, 0,
                            viewport, 0,
                            pos2, 0);
    }

Just as a reference I've tried transforming the coordinates 0,0,0 and got an offset.  It would be appreciated if you would answer using OpenGL ES 2.0 code.

sentences:
How do I test for intersection of a ray and part of a capped cone / cone frustum? The formulas to calculate the intersection between a ray and a capped cone / cone frustum are already widely known (see http://lousodrome.net/blog/light/2017/01/03/intersection-of-a-ray-and-a-cone/ or How do I test for intersection between a ray and a cone?)
However, I have to test for the intersection between a ray and part of a capped cone.
That means instead of having a surface doing a full revolution, it's just one quarter of it, for example.

The aforementioned formulas can handle a capped cone, but they are not suitable to determine the "revolution intersection angle".
What would be the best way to solve this problem?

My idea is to first take the standard formula to intersect with the full cone and then use the parametric representation of the cone (see https://de.wikipedia.org/wiki/Kegel_(Geometrie)#Analytische_Beschreibung parametric representation is only on the German page), solve a linear equation system and then applying the inverse trigonometric functions to get the t parameter...
I'm also thinking about some inequality tricks or applying the tangent function, but had no luck so far...

sentences:
What is an efficient 2D line-segment-versus-triangle intersection test? In a 2D plane, I have a line segment (P0 and P1) and a triangle, defined by three points (t0, t1 and t2).

My goal is to test, as efficiently as possible ( in terms of computational time), whether the line touches, or cuts through, or overlaps with one of the edge of the triangle.

Everything is in 2D, so I can't expect the usual ray-triangle intersection test (3D version) to work.

Edit: Same question is asked on math.SE, but I think asking here is also appropriate  as this is as much mathematics as game development, and the approach may be different also.

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:
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:
Why am I getting errors like these when trying to build my app I am currently trying to build and publish my app to the universal windows platform halfway through the process of doing so, during the validation process I got stopped with these errors. The 1st one I am clueless to what I can even do and the second one I don't know why is happening. Please help.

First error:

  Supported API test  FAILED

  Supported APIs

  Error Found: The supported APIs test detected the following errors:

  API D3D12GetDebugInterface in d3d12.dll is not supported for this application type. UnityPlayer.dll calls this API.

  Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements.
  How to fix: Review the error messages to identify the API that is not part of the Windows SDK for Windows Store apps. Please note, apps that are built in a debug configuration or without .NET Native enabled (where applicable) can fail this test as these environments may pull in unsupported APIs. Retest your app in a release configuration, and with .NET Native enabled if applicable. See the link below for more information:
  Alternatives to Windows APIs in Windows Store apps.

Second error:

  App resources  FAILED

  Branding

  Error Found: The branding validation test encountered the following errors:

  Image file SplashScreen.scale-200.png is a default image.

  Impact if not fixed: Windows Store apps are expected to be complete and fully functional. Apps using the default images e.g. from templates or SDK samples present a poor user experience and cannot be easily identified in the store catalog.
  How to fix: Replace default images with something more distinct and representative of your app.

Here is the full output for further details:

1.1.1.0
App Architecture: x64
Kit Version: 10.0.16299.15
OS Version:  Microsoft Windows 10 Pro (10.0.16299.0)
OS Architecture:  x64

Deployment and launch tests
PASSED
Bytecode generation
PASSED
Background tasks cancelation handler
PASSED
Platform version launch
PASSED
App launch
PASSED
Crashes and hangs
Package compliance test
PASSED
Application count
PASSED
App manifest
PASSED
Bundle manifest
PASSED
Package size
PASSED
Restricted namespace
Windows security features test
PASSED
Binary analyzer
PASSED
Banned file analyzer
PASSED
Private code signing
... (error 1 above)
App manifest resources tests
PASSED
... (error 2 above)
Debug configuration test
PASSED
Debug configuration
File encoding test
PASSED
UTF-8 file encoding
App Capabilities test
PASSED
Special use capabilities
Windows Runtime metadata validation
PASSED
ExclusiveTo attribute
PASSED
Type location
PASSED
Type name case-sensitivity
PASSED
Type name correctness
PASSED
General metadata correctness
PASSED
Properties
Package sanity test
PASSED
Platform appropriate files
PASSED
Supported directory structure check
Resource Usage Test
PASSED
WinJS background task

**

sentences:
Random 100x100 map using all levels from 1 to 100 I'm developing a game where players walk though a 100x100 grid of different rooms.
Each room has a level associated with it starting from lvl 1 to lvl 100.
The map is divided into 10x10 areas and in the middle of each area there's a 2x2 "castle" which players must conquer in order to access next levels castles (so if players start off at lvl 1 they need to conquer the lvl 1 castle before being able to enter lvl 2 castles).
Each room in a castle (2x2 area in the middle of each 10x10 area) has the same level and there must be a castle for each level from 1 to 100.
As for now I was generating the whole map "statically" and use the matrix blur to interpolate room levels between castles.
What I would like to achieve is having a seeded function f(x,y) that returns the level of the room at position (x,y) without pre-defining the matrix.
I checked out Perlin Noise functions, but it doesn't guarantee each level between 1 and 100 is taken nor the right position of the "castles".

The image above is the starting point of the game map, lower levels of green represent lower room levels, the blue squares in the center are the castles. This image is then blurred preserving just the castles level.
Players can move around the map and will meet harder challenges in higher level rooms. The goal is reaching level 100 by spotting and conquering each castle in sequence.

sentences:
How 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:
Using Event Driven Programming in games, when is it beneficial? I am doing a refresher on ActionScript 3.

Other than using rudimentary tools like, Event.ENTER_FRAME and using events to receive input from the user's mouse and keyboard, I find that I rarely use events and prefer to use public functions.

I am starting to reconsider this approach. From what I have learned thus far, the event system works this way:

Each dispatcher can listen to itself during the target phase. Each display object on the stage, can listen to it's children before the target phase, during Capture or after the target phase, during bubbling.

I would like to see an example of good use of the Event class for
game programming. Have you used Event driven programming in a game
and have a good example you could share?
A lot of times I want to pass a message to a 'sibling' so I could
have their methods listen to the stage or the parent object. Is that
the best way to communicate between objects that are not parents of
the dispatcher they want to listen to?
I would like to know if events are better performance wise than public functions.
Are there cases where using events can result in superior performance than avoiding events and sticking to function calls?

sentences:
How to play sound in WebGL build in Unity? I have a project that works fine when I build for windows, but doesn't work when I switch platform to WebGL. The [SerializeField] AudioClip variables in the inspector are all 'missing', even after I check 'override for WebGL' convert to AAC. And when I try to link any audio file to an AudioClip within a WebGL build in the inspector, it doesn't seem to work.
How do I get sound to play within WebGL?
To recreate the problem:

Switch platform to WebGL.
Create a new Script in any recent unity version, then add a [SerializeField] AudioClip x.
Put that script on a new gameobject and try to link an audio asset to it (default import settings, however don't forget to check 'override for WebGL' to AAC, otherwise you will get compiler errors when you switch platform).

sentences:
Opengl in 500 lines barycentric calculation question https://github.com/ssloy/tinyrenderer/wiki/Lesson-2-Triangle-rasterization-and-back-face-culling
I cannot figure out how we go from uAB-vector + vAC-vector + PA-vector = 0 to the linear system with those subscripts x and y? Is there another way of explaining how we take three vectors, split them into x and y type vectors, and produce a cross-product that can be used to find the barycentric coords (u, v, w)?
Also, I am not sure why there is a division by the z component of the cross product in last line of the barycentric function. Maybe the answer to my first question will make this more obvious.
Below is a picture of the section of the tutorial where I am stuck. Link to full page is above.

sentences:
Best way to play footstep-sounds of character? I am developing an XNA-Game, which is pretty much a runner game (side-scrolling).

Now I am in the middle of adding sounds to my game. And as it turns out, I am having quite some problems with the footstep-playback.

The following is in C#, but I am quite sure that anyone will understand it:

 public static void StartStepTimer()
 {
     _stepTimer = new DispatcherTimer();
     _stepTimer.Interval += TimeSpan.FromMilliseconds(500);
     _stepTimer.Tick += _stepTimer_Tick;
     _stepTimer.Start();

     _step = _content.Load<SoundEffect>("Sound\\World\\Summer_1");
     _stepInstance = _step.CreateInstance();
     _stepInstance.Volume = 0.4f;

 }

  private static void _stepTimer_Tick(object sender, EventArgs e)
  {
      _stepInstance.Play();
  }

As you can see, I am playing the footstep based on a timer. I am using this method, since the gamespeed gets higher during gametime (I can change the interval in that case).

But this method isn't really working. The playback lags.
I thought of making a prerendered 10s soundfile and looping that in gametime, but than the playback won't fit when the gamespeed rises.

Any suggestions?

sentences:
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:
GLSL - Efficient Point inside Box Check I'm attempting to improve the performance of a shader that changes the colour of a region of the world that is inside a "zone".

I am using a deferred lighting system, so the colour and world-space position of each pixel on the screen are stored in two separate textures, gColor and gPosition.

The zonePos uniform stores the two corners of each zone.
The zoneColor uniform stores the colour of each zone.
The totalZones uniform stores the amount of zones in the current game.

Here is the fragment shader:

out vec4 FragColor;

in vec2 texCoords;

layout (binding = 0) uniform sampler2D gColor;
layout (binding = 1) uniform sampler2D gPosition;

uniform vec3 zonePos[10];
uniform vec3 zoneColor[5];
uniform int totalZones;

void main()
{
    vec3 FragPos = texture(gPosition, texCoords).rgb;
    vec3 Albedo = texture(gColor, texCoords).rgb;

    vec3 j;
    vec3 k;

    for (int i = totalZones; i > 0; i--)
    {
        j = zonePos[i * 2];
        k = zonePos[i * 2 + 1];

        if (FragPos.x >= j.x && FragPos.x <= k.x &&
            FragPos.y >= j.y && FragPos.y <= k.y &&
            FragPos.z >= j.z && FragPos.z <= k.z)
                Albedo += zoneColor[i];
    }

    FragColor = vec4(Albedo, 1.0);
}

The changes I have made so far are:

Using j and k, rather than accessing zonePos 6 times in the if statement
Looping down from totalZones to 0, as a comparison against 0 is faster

Any suggestions are greatly appreciated.

sentences:
AI Pathfinding Algorithms I am looking to create a special kind of pathfinding system. At this point, the geometry is still flexible, but this pathfinding is integral to the project.

The goals I have are this:

I will have a number of entities seeking paths.
Each entity will have a memory of certain paths.
The memory will be based on landmarks. Landmarks will be objects or
entities on the map that can be or have been seen by the entity.
When an entity generates a path, it's only doing it based on what it
can see, and what it has memory of.  Anything else has to be
guessed, it can't use unknown information.
The system has to be able to handle a updating paths for a lot of
entities at once, but it never has to find the best path, especially
not on the first try.
It doesn't need to find a path to it's destination in a single
frame, just be able to make progress, and reach the target eventually if possible.
Entities might be able to share partial or full path information.

I'm thinking this is best served by some modified D* algorithm, but I was wondering if anyone had any other suggestions for something to do this, or challenges that I'd expect to face.

One thing I'm cognizant of for instance is that if I'm using landmarks to confirm the path, that I'll be able to quickly look up nearby landmarks.  If I have thousands of landmarks in a list and need to iterate through them and calculate distance to the player this is going to cause trouble.  If I'm going to define regions, like a convex hull, I might be able to share that calculation across entities when they need it since I might be able to say anyone inside this poly should be able to see everything within this poly.

sentences:
Rendering without VAO's & VBO's? I am trying to port a demo I found on PositionBasedDynamics . It has a generic function which does the rendering and on their example works but they don't generate/bind any Vertex Array Object or Vertex Buffer Object even though they use Core OpenGL and shaders.

The function is this:

template<class PositionData>
void Visualization::drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color, GLuint text)
{
    // draw mesh
    const unsigned int *faces = mesh.getFaces().data();
    const unsigned int nFaces = mesh.numFaces();
    const Vector3r *vertexNormals = mesh.getVertexNormals().data();
    const Vector2r *uvs = mesh.getUVs().data();

    std::cout << nFaces << std::endl;

    glBindTexture(GL_TEXTURE_2D, text);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_REAL, GL_FALSE, 0, &pd.getPosition(offset)[0]);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_REAL, GL_FALSE, 0, &uvs[0][0]);
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 3, GL_REAL, GL_FALSE, 0, &vertexNormals[0][0]);

    glDrawElements(GL_TRIANGLES, (GLsizei)3 * mesh.numFaces(), GL_UNSIGNED_INT, mesh.getFaces().data());

    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);

    glBindTexture(GL_TEXTURE_2D, 0);
}

I did the same thing and it render's a white screen . I used RenderDoc to check what's going on and it show's these: https://puu.sh/rM1wB/80620ade8d.png .

How can they get it to work while i can't?

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: What is the "TangentsW" attribute inside the FBX file format for? sometimes it is -1, sometimes is +1. Do I need it for the rendering of the normal maps?

sentences:
Why doesn't the Camera.pixel(Height/Width) match the Canvas size? I am making an app that has a custom viewport Rect like so:

When I check the sizes of this viewport rectangle in pixels with Camera.pixelHeight; Camera.pixelWidth, I get the following values: 743px, 770px.

This looks correct.

Now when I check my canvas in the Editor, I see the following values for the width and height:

Now I have a script that gets the width and height of the canvas. This is correct: I get again the 743px and 770px. But when I position my UI element, it is outside because the positioning refers back the the incorrect values displayed in the canvas rectangle transform properties.

What is happening here and how do it make the canvas use the correct values?

sentences:
I'm getting empty errors Unity 2019.2.14f1 Windows 10 A week ago I was editing a script in my Unity Project with VSCode(I normally work in Visual Studio) and saved it. As soon as I saved it 4 blank errors popped up. Since then I've tried everything to get rid of them but to little avail. Please, help me.

I've already done a lot of searching and the main thing that comes up is to switch my scripting runtime to .Net 3.5. But in Unity 2019.2.14f1 the version I'm using this is no longer supported. They are also talking about Windows 7 but I'm on Windows 10.

https://forum.unity.com/threads/four-blank-errors-in-each-new-project.599980/

I tried to delete the meta of all script files but that did not help. I've tried to uninstall everything of Unity, and I mean everything. I uninstalled and deleted all Unity versions, the hub, and all app/roaming data. The reinstalled Unity. I made an empty project and the error was gone until I made 1 new script and the error reappeared.

Only when I have no scripts in my project the error disappears.

What do I do now? Any suggestions?

sentences: Can't move bone on blender. "Location" transform grayed out I'm trying to move a bone on Blender. I can't do anything with it at all. I've searched through the menus and noticed the Location transform is grayed out.

sentences:
Blender: calculation of elevation and rotation angle from plane I have a generic plane (any location, any rotation around every axis) with its normal axis passing by the center. Then I have a generic point and I need to find the elevation and the rotation angle from the normal of the plane (as described before).

I need a solution that uses bones and constraints (drivers if necessary).

Note: to make it easy to understand. I am a little man standing over the plane. I want to know the pitch and the yaw (taking the upper edge center as the North) I need to apply to my head to look to the generic point.

Thanks in advance. Let me know if it is too difficult to understand :)

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:
How to convert png images to True Type Font? I'm doing a clone of Colonization and I'm trying to use the same font type as the original game. I'm able to get the pixels from the original font files (.ff) using the application from this thread https://forums.civfanatics.com/threads/colonization-picture-viewer.256665/page-2 but the outcome is a PNG file.

The question is how I can convert this PNG file to a True Type Font that I can load on my MonoGame application? Is there a way to do that? Do I have to consider using one texture per letter rather than a font type? If this has sense, how can I set different font sizes using textures?

sentences:
Animating feet seperately from the body I have a character and I would like to animate a walking animation for it. However i get the following result when I animate it:

(ignore the green lines/ markers/ sound) As you can see the foot animation is also being applied to the character with predictably bad results. I currently have one animation which applies to the entire character which the foot is a part of. This animation has two layers and can be seen here:

The real problem I am having is how does one get an animation to only apply to a section of the character? I know this can be accomplished with avatar masks but i believe those are only for 3d animations/projects (this is 2d) but if you can get this to work with 2d animations please explain.

The animation that I am using just changes positions, and rotations which is unfortunately applying to the entire object. It also should change the sprite of the feet however this is not taking effect. Ignore the fact that there is only one foot, the other was disabled but exhibits the same behaviour as is seen in the shown foot.

This is a 2d project.

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:
Load individual sprite from a sprite sheet and make it a FlxSprite I'm using flixel and flixer power tools which contains a FlxButtonPlus class that allows me to load 2 FlxSprite as each button state, the problem is that FlxSprite requires a Class a its source but I would like to have a single spritesheet for all my buttons and call each one from there, rather than having a bunch of pngs for every button and every state.

Any idea on how to do that?

sentences:
LibGDX: Its there any way to calculate the speed of a repeated scrolling background? I'm trying to calculate the scrolling speed of an background, I'm doing something like this on the background class:

private Texture texture = new Texture(Gdx.files.internal("backgound.png"));
private Sprite sprite;

private float scrollTimer = 0.0f;
private static float scrollFactor = 0.2f;

public Background() {
    texture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
    int width = texture.getWidth();
    int height = texture.getHeight();
    sprite = new Sprite(texture, 0, 0, width, height);
    sprite.setSize(1280, 320);

}

@Override
public void act(float delta) {
    updateScrollFactor();
    scrollTimer += delta * scrollFactor;

    if (scrollTimer > 1.0f) {
        scrollTimer = 0.0f;
    }

    sprite.setU(scrollTimer);
    sprite.setU2(scrollTimer + 2);
}

@Override
public void draw(Batch batch, float alpha) {
    sprite.draw(batch, alpha);
}

private void updateScrollFactor() {
    //Increase scroll factor when the game score being higher.
}

public static float getScrollFactor() {
    return scrollFactor;
}

And in another class I'm trying to calculate the speed of this background above because I need the same speed to apply in the entity of mentioned class, that is described below:

private Texture texture;
private Sprite sprite;

public Item(String textureName) {
    texture = new Texture(Gdx.files.internal(textureName));
    int width = texture.getWidth();
    int height = texture.getHeight();
    sprite = new Sprite(texture, 0, 0, width, height);
    sprite.setSize(30f, 50f);
    //Sets initial position, the entity will be scrolled from the screen width to zero
    sprite.setPosition(Gdx.app.getWidth() - 10, 10);
}

@Override
public void act(float delta) {
    scrollTimer = delta * Background.getScrollFactor();

    if (scrollTimer > 1.0f) {
        scrollTimer = 0.0f;
    }

    float x = sprite.getX();
    if (x + sprite.getWidth() > 0) {
        sprite.setX(x - Gdx.graphics.getWidth() * scrollTimer);
    } else {
        //sets to initial position when the entity vanish thru the window left side.
        sprite.setX(Gdx.graphics.getWidth() - 10);
    }
}

@Override
public void draw(Batch batch, float alpha) {
    sprite.draw(batch, alpha);
}

}

The case is the entity don't run sync with background but i need this separated from the background because it is a clickable entity.

Thoughts?

sentences:
Monogame resizing GraphicsDeviceControl in WindowsForms? I'm currently working on a custom Map editor using Windows Forms.

I have a class inheriting from GraphicsDeviceControl (called MapDisplay) that I'm using so that I may use spritebatch to draw the map onto the form. I have this map display control inside of a split panel on my form, and it adjusts its size depending on the size of the map that's loaded. Currently I use mapDisplay.Width and mapDisplay.Height to change it's size, then use mapDisplay.Invalidate() so it redraws.

The problem comes when the width or height of the map display gets above a certain amount, it goes blue and stops working. How do I stop this from happening?

Cheers!

sentences:
Minecraft - How do I check if someone has a clear inventory How do I check if a player has a clear inventory?
I'm making a PvP arena plugin but I need it so when someone types /pvp join, it checks if they have a clear inventory. If they do have a clear inventory, it lets them join, if they don't, it asks them to.

I tried this but it's not reliable as there are more slots:

if(p.getInventory().getArmorContents() == null
    && p.getInventory().getItemInHand() == null
    && p.getInventory().getItemInHand() == null) {

Then I tried this but it did not work:

if (p.getInventory().getContents().length == 0) {

sentences:
MonoGame EffectPass.Apply() doesn't work Currently I'm doing the following:

spriteBatch.Begin(effect: effect);

// Draw stuff normally

effect.Parameters["flag"].SetValue(true);
effect.CurrentTechnique.Passes[0].Apply();

// Draw stuff with flag

effect.Parameters["flag"].SetValue(false);
effect.CurrentTechnique.Passes[0].Apply();

// Draw stuff normally

But this doesn't work. The flag stays false even after I apply the changes.

sentences:
requestAnimationFrame handles game ticks weird when tab isn't viewed So i have the game logic and render in the callback for requestAnimationFrame, and somehow the ticks run very weird.

In fact, the rendering happens alright.
But the ticks seem to skip an if, to be specific.

The questionable code moves the entity a few pixels until an amount of pixels is traveled.

When the tab isn't viewed the movement happens, and gets rendered correctly, but when going back to the tab i see that the movement went way to far and to make it more dubious, the entity travels back to its actual target position.

It feels a bit like the frames get rendered with the tick-function using kind of a state, like the variables keep the same value while the tab isn't viewed, and when viewing the tab again all the frames get played back reverse until the movement should actually stop.

Is there any reason for this and maybe a solution, too?

sentences: Which game portals support Silverlight games? I have been looking for strong game portals that support Silverlight.  Which ones are currently available?

sentences:
fastest way to check for surrounding tiles I'm working on a tile map where each type of tiles has 12 states with 12 different sprites associated with it, what I'm trying to say is that whenever I place a tile let's say a road tile, that tile should adjust itself automatically according to the 4 tiles surrounding it, so for example if the tile above it is a road tile and the tile below it is also a road tile, it should automatically adjust itself into a vertical road tile... there is 12 states a tile can have:
1-closed(not surrounded by any similar tile)
2-horizontal(similar tiles up and down)
3-vertical(similar tiles right and left)
4-open from up and left(similar tiles to the left and above)
5-open from left and down(...)
6-open from down and right(...)
7-open from right and up(...)
8-open from up & left & down(3 similar tiles up, left and down)
9-open from left & down & right(...)
10-open from down & right & up(...)
11-open from right & up & left(...)
12-open from all 4 directions(all surrounding tiles are similar)
the problem is that I don't know how to check for surrounding tiles and choose the right tile state without having a huge mess of if statements and performance waste, and I don't have enough experience with algorithms and data structures to figure it out myself.
how can check all 12 states the fastest way possible ?
thanks!

sentences:
Communication between objects in games? I want to make a simple game where I have some characters fighting on a plane (level). I find the trickiest part as figuring out who should do what here.

I want my terrain to have friction (so you could play on ice).

I also want fairly customizable characters.

At first I was thinking of a mediator pattern where the game gathers information about the current player state and modifies them based on that, but I do not think this offers enough flexibility.

I was thinking more along the lines of each player / character does have some logic.

The Input from the game gives it the command the player pressed, then the character would load the correct animation for this.

As for friction and whatnot, I was thinking that the world would somehow need to multiply the player's velocity vector by its coefficient of friction. Because I don't think the player needs to know about the level (and preferably the level does not know about characters)

It's in these little design aspects that I get a bit confused.

Is this a good design? What could be improved / changed / added given what I want to do?

Thanks

sentences:
Coordinate spaces and transformation matrices I'm trying to get an object from object space, into projected space using these intermediate matrices:

The first matrix (I) is the one that transforms from object space into inertial space, but since my object is not rotated or translated in any way inside the object space, this matrix is the 4x4 identity matrix.

The second matrix (W) is the one that transforms from inertial space into world space, which is just a scale transform matrix of factor a = 14.1 on all coordinates, since the inertial space origin coincides with the world space origin.

    /a 0 0 0\
W = |0 a 0 0|
    |0 0 a 0|
    \0 0 0 1/

The third matrix (C) is the one that transforms from world space, into camera space. This matrix is a translation matrix with a translation of (0, 0, 10), because I want the camera to be located behind the object, so the object must be positioned 10 units into the z axis.

    /1 0 0  0\
C = |0 1 0  0|
    |0 0 1 10|
    \0 0 0  1/

And finally, the fourth matrix is the projection matrix (P). Bearing in mind that the eye is at the origin of the world space and the projection plane is defined by z = 1, the projection matrix is:

    /1 0 0   0\
P = |0 1 0   0|
    |0 0 1   0|
    \0 0 1/d 0/

where d is the distance from the eye to the projection plane, so d = 1.

I'm multiplying them like this: (((P x C) x W) x I) x V, where V is the vertex' coordinates in column vector form:

    /x\
V = |y|
    |z|
    \1/

After I get the result, I divide x and y coordinates by w to get the actual screen coordinates.

Apparenly, I'm doing something wrong or missing something completely here, because it's not rendering properly. Here's a picture of what is supposed to be the bottom side of the Stanford Dragon:

Also, I should add that this is a software renderer so no DirectX or OpenGL stuff here.

sentences:
How to change mute/unmute button? I'm saving music in libgdx preference, the following code works perfectly but if you enter the settings again you'd see the initial button up regardless if the sound is muted or not.

TextureAtlas buttonsAtlas = new TextureAtlas("ui/dialogButtons.pack");
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.checked = skin.getDrawable("muteMusic.up");
button.addListener(new InputListener() {
 public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
  return true;
 }
 public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
  setMusicplaying(!musicplaying);
  if (getMusicplaying() == false)
   playMusic.stop();
  else playMusic.play();
 }
});

I tried to do this, it works perfecly but doesn't switch the button, when the user is clicking on it, it only switches when the user closes the dialog

if (getMusicplaying() == true) {
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.down = skin.getDrawable("muteMusic.up");}
if (getMusicplaying() == false) {
  textButtonStyle.up = skin.getDrawable("muteMusic.up");
  textButtonStyle.down = skin.getDrawable("music.down");}

sentences:
Handling player and AI in a component based structure dynamically? I'm trying to find a way to allow both input and AI to call actions of an actor in a component based structure for a 2d turn based game. The actions make use of the components. To keep the system flexible I don't want to statically set what actions the actor has in the actor class.

Right now I have action classes who have ids and I'm using maps to hold the actions and allow the input and AI to execute actions by calling a function in the actor class. Now I've run into all sorts of issues like it not working well with using different parameter types or amounts and other things. So is there a better way to do what I try to achieve?

This is my actor class that holds a map with actions that take two ints:

class Actor
{
    friend Scene; /* allows the scene to move the acotr */

public:
    Actor();
    ~Actor();

    int getCellX() { return m_CellX; }
    int getCellY() { return m_CellY; }

    void addComponent(Component* component);

    void addAction(PositionAction*);

    bool executeAction(string, int, int);

private:
    int m_CellX = 0;
    int m_CellY = 0;

    map<string, Component*> m_Components;

    map<string, PositionAction*> m_PositionActions;
    map<string, TargetableActorAction*> m_TargetableActorActions;
};

This shows the hierarchy of the action class:

class Action
{
public:
    Action();
    ~Action();

    virtual string getID() = 0; /* used to identify the action in the map */
};

class PositionAction : public Action
{
public:
    PositionAction();
    ~PositionAction();

    virtual bool execute(int, int) = 0;
};

class MoveAction : public PositionAction
{
public:
    MoveAction(MoveComponent&);
    ~MoveAction();

    bool execute(int, int);

    string getID() { return "move"; }

private:
    MoveComponent& m_MoveComponent;
};

And this is what the move action does:

MoveAction::MoveAction(MoveComponent& moveComponent) : m_MoveComponent(moveComponent)
{
}

MoveAction::~MoveAction()
{
}

bool MoveAction::execute(int dX, int dY)
{
    /* will check whether some conditions hold */

    /* move the actor, returns false if failed */
    bool sucess = m_MoveComponent.move(dX, dY);

    return sucess;
}

This creates the player actor with a move component and the move action.

Actor* player = new Actor();

MoveComponent* moveComponent = new MoveComponent(scene);

player->addComponent(moveComponent);
player->addAction(new MoveAction(*moveComponent));

return player;

And you can execute an action like this:

actor.executeAction("move", 1, 0);

sentences:
ECS: Movement system I'm a game developer enthusiast. I've decided to implement a game, however I'm pretty confused about all the movement mechanics (kinematics). Here goes a couple questions:
Velocity x acceleration x speed:

How do you apply acceleration/deceleration to your movement?
When moving (player input), do we either increase the velocity vector or the acceleration/speed value, or actually both? How does it really work?
How do you apply object weight to the movement?
How do you apply friction & gravity to the movement (should be applied to both axis, as this is going to be a 2D top-down view)?

Questions might be quite simple and/or stupid, but I'm just beginning (and also re-studying physics).

sentences:
How change LOD in geometry? I'm looking for a simple algorithm for LOD, for changing geometry vertexes and decreasing frame time. I've created an octree, but now I want model or terrain vertex modify algorithm, not for increase (looking on tessellation later) but for decrease.

I want something like this:

Questions:

Can the same algorithm apply to both model and terrain correctly?
Do indexes need to be modified?
Must I use octree or simple check distance between camera and object for desired effect?
Is a new value of indexcount for the DrawIndexed function needed?

Code:

     //m_LOD == 10 in the beginning
     //m_RawVerts - array of 3d Vector filled with values from vertex buffer.

     void DecreaseLOD()
     {
         m_LOD--;
         if(m_LOD<1)m_LOD=1;
         RebuildGeometry();
     }

     void IncreaseLOD()
     {
         m_LOD++;
         if(m_LOD>10)m_LOD=10;
         RebuildGeometry();
     }

     void RebuildGeometry()
     {
         void* vertexRawData = new byte[m_VertexBufferSize];
         void* indexRawData = new DWORD[m_IndexCount];
         auto context = mp_D3D->mp_Context;

         D3D11_MAPPED_SUBRESOURCE data;
         ZeroMemory(&data,sizeof(D3D11_MAPPED_SUBRESOURCE));

         context->Map(mp_VertexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(vertexRawData,data.pData,m_VertexBufferSize);
         context->Unmap(mp_VertexBuffer->mp_buffer,0);

         context->Map(mp_IndexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(indexRawData,data.pData,m_IndexBufferSize);
         context->Unmap(mp_IndexBuffer->mp_buffer,0);

         DWORD* dwI = (DWORD*)indexRawData;

         int sz = (m_VertexStride/sizeof(float));//size of vertex element

         //algorithm must be here.
         std::vector<Vector3d> vertices;
         int i = 0;
         for(int j = 0; j < m_VertexCount; j++)
         {
             float x1 = (((float*)vertexRawData)[0+i]);
             float y1 = (((float*)vertexRawData)[1+i]);
             float z1 = (((float*)vertexRawData)[2+i]);
             Vector3d lv = Vector3d(x1,y1,z1);

             //my useless attempts
             if(j+m_LOD+1<m_RawVerts.size())
             {
                 float v1 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD]]);
                 float v2 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD+1]]);

                 if(v1>v2)
                     lv = m_RawVerts[dwI[j+1]];
                 else
                     if(v2<v1)
                         lv = m_RawVerts[dwI[j+2]];
             }

             (((float*)vertexRawData)[0+i]) = lv.x;
             (((float*)vertexRawData)[1+i]) = lv.y;
             (((float*)vertexRawData)[2+i]) = lv.z;

             i+=sz;//pass others vertex format values without change
         }

         for(int j = 0; j < m_IndexCount; j++)
         {
             //indices ?
         }

         //set vertexes to device
         UpdateVertexes(vertexRawData,mp_VertexBuffer->getSize());

         delete[] vertexRawData;
         delete[] indexRawData;
     }

sentences:
LibGDX - Move camera not working I'm starting with LibGDX and I loving it so far, but I have found some troubles and I'm getting a little frustrated. I've searched a lot for a solution and tried many things, but nothing seems to work. What I want to accomplish is basically a 2d map with a rts-like camera, in other words, a map/world bigger than the viewport where I can move the camera freely. The problem is I can't make the camera move, and I'm not even sure if my world is bigger than my viewport. How can I get these two things done? I'm sure I'm doing something wrong, but I can't figure what it is. Any help would be really appreciated.

These are my classes:

GameMain

public class GameMain extends Game {

private SpriteBatch batch;

@Override
public void create () {
    batch = new SpriteBatch();
    ScreenManager.getInstance().initialize(this);
    ScreenManager.getInstance().showScreen(ScreenEnum.WORLD);
}

@Override
public void render () {
    super.render();
}

public SpriteBatch getBatch() {
    return this.batch;
}
}

AbstractScreen

public abstract class AbstractScreen extends Stage implements Screen {
protected AbstractScreen() {
    super(new ScreenViewport(new OrthographicCamera()));
}

// Subclasses must load actors in this method
public abstract void buildStage();

@Override
public void render(float delta) {
    // Clear screen
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Calling to Stage methods
    super.act(delta);
    super.draw();
}

@Override
public void show() {
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    getViewport().update(width, height, true);
}

@Override public void hide() {}
@Override public void pause() {}
@Override public void resume() {}
}

ScreenEnum

public enum ScreenEnum {

WORLD {
    public AbstractScreen getScreen(GameMain game, Object... params) {
        return new WorldScreen(game);
    }
};

public abstract AbstractScreen getScreen(GameMain game, Object... params);
}

ScreenManager

public class ScreenManager {

// Singleton: unique instance
private static ScreenManager instance;

// Reference to game
private GameMain game;

// Singleton: private constructor
private ScreenManager() {
    super();
}

// Singleton: retrieve instance
public static ScreenManager getInstance() {
    if (instance == null) {
        instance = new ScreenManager();
    }
    return instance;
}

// Initialization with the game class
public void initialize(GameMain game) {
    this.game = game;
}

// Show in the game the screen which enum type is received
public void showScreen(ScreenEnum screenEnum, Object... params) {

    // Get current screen to dispose it
    Screen currentScreen = game.getScreen();

    // Show new screen
    AbstractScreen newScreen = screenEnum.getScreen(game, params);
    newScreen.buildStage();
    game.setScreen(newScreen);

    // Dispose previous screen
    if (currentScreen != null) {
        currentScreen.dispose();
    }
}
}

WorldScreen

public class WorldScreen extends AbstractScreen {

private GameMain game;
private Texture map;

public WorldScreen(GameMain game) {
    this.game = game;
    map = new Texture("sprites/maps/map.jpg");
}

@Override
public void buildStage() {

}

@Override
public void show() {

}

@Override
public void render(float delta) {
    super.render(delta);

    game.getBatch().begin();
    game.getBatch().draw(map, 0, 0);
    game.getBatch().end();
    this.getCamera().translate(+500, +500, 0);
    this.getCamera().update();
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}
}

I debugged the camera and it's changing its value position, but it's not being reflected in the screen.

Also, is there a way to prevent the map texture from being scaled when resizing?

sentences:
How to play a video and run content at the same time Alright, so I have a video loaded, and other game content.

Earlier this morning, when I was just learning how to actually play a video, I magically happened to get the video running in the background, and also keep everything else drawn above it. I was thrilled and thought I will easily manage to do the rest.

Now that I'm almost done, I have several videos that I want to draw. I made a loop that will only run one time as an intro, and then after it stops, it sequences one of the other videos, but the thing is, this next video is drawn above everything else, while the rest of my game content, is "under" the Rectangle where the video Texture is running, can anyone help me on how to get a Rectangle variable "behind" everything? almost as a background? Thanks a lot!

sentences:
How to calculate a direction vector for camera? I have a vector that describes change in movement, and I have a 3d-vector, m_rot, that describes a rotation given to an object.
I want to calculate a direction vector using both this data.
How to achieve that?

I tried to multiply the components of a direction vector onto sin and cos of m_rot values, but that gave me nothing.

direction.x = direction.x * ::cosf(m_rot.x);
direction.y = direction.y * ::sinf(m_rot.y);
this->camera_world_pos += direction;

But after that my camera still walks into a simple directions, and not a direction that it looks at.

sentences:
Procedural Geometry Generation I have recently been looking into SceneKit for OS X and noticed that there are several factory methods to create geometric shapes such as:

Box, Capsule, Cone, Cylinder, Plane, Pyramid, Sphere, Torus and Tube.

I am interested in adding such primitive shapes to my renderer but am struggling to find any reasonable source from which I can gather an understanding of procedural generation. There are several resources which detail the theory, but lack the appropriate source code to back it up.

SceneKit provides factory methods which allow for dynamically setting the attributes of such shapes. In the case of the Box, you can provide integer values for the number of width, height and depth segments which each face should be divided into.

I understand the theory but lack the knowledge to begin subdividing geometry faces to achieve the desired effect.

The vertices for each shape are most likely quite easy to generate in simple loops. What stumps me is knowing how to create the faces, or rather the appropriate texture coordinates for each face. Normals can be calculated per face so I'm fairly confident I could achieve what I want, it's just knowing where to start.

Can anyone provide any details on procedural geometry? What I really need is some source code to glean some information from. I have searched high and low for tutorials but have so far come up with only a few reasonable sites or blogs. Any good books, tutorials, blogs or research papers would be appreciated.

Edit based on comments

I should have clarified that I know how to create vertices for basic shapes, most of these can probably be achieved by simple loops. What I don't comprehend is how to create faces from the generated array of vertices. How do I create a triangle strip, or triangles, from a seemingly unordered array of vertices?

I assume that once I get past this point, I can create the normals from each face. Whilst I haven't delved into this yet, I have seen a lot of references to this and am sure it will be easy enough to implement.

Ideally, i'd like to be able to generate geometry from a given set of properties such as the way that SceneKit provides. Given SceneKit has done it, and you can do similar things in Blender and Maya etc, I assume i'm not trying to implement the impossible.

The final aspect would be applying textures. Again, this isn't something I have implemented but have read up on and am aware of the requirements.

The main problem here is that I know what I want to achieve but am struggling to decipher how to implement for the aforementioned primitives. I was hopeful that I would be able to find some semblance of knowledge by way of source code but I really haven't come across anything suitable so far.

sentences:
Modeling RTS game logic using ECS So I've been trying to make a simple RTS engine for some time and I always hit a wall because of increasing, inflexible and complicated hierarchy trees. I've ultimately found out that an ECS is a good pattern in order to avoid such pitfalls.
For many scenarios I can envision how all things would be coupled, but there are some edge cases I can not manage to figure out.
Let's say we have a simple ECS, which lets us add entities, add/remove components from entities and a system which queries for a set of components and updates all entities which have the respective components attached to themselves.

Scenario 1 - [Single-Player] Should the player be an entity?
Having the player as an entity would mean having a system just for one entity that holds a PlayerComponent...

Scenario 2 - Tech tree and updates to tech trees?

Tech tree cannot be an entity since you want buildings to have their own tech tree, so it must be a component then.
Tech tree is a component, but then you want the player to be able to research a tech from a tree.
So the UI must represent this action as an event which you send to a supposed TechSystem.
In the end this means you iterate through all the entities which have TechTreeComponent, to get the one you need, instead of just updating directly through a reference or an ID.
This could be solved by having a SelectionSystem which holds a state of selected items, but systems cannot have state...

I probably need a way to send a targeted event towards just one entity or inter-system communication, although the second one can get messy quite fast if I choose to add multithreading or priority to systems. If anyone can provide some pointers and how to optimize the architecture for such cases I would appreciate it.

sentences:
How can I make a chest that can be opened and shut in SteamVR? I'm working in Unity with SteamVR for a school project. I'm trying to have a chest that can be opened and shut. I tried using a hinge joint but it would break if the attached body was static which is what I want.
I'm now trying to use a circular drive which works better but the lid to the box will move away from the intended position when colliding with the body of the box which is set to static and kinematic.
I can fix this by setting the lid to kinematic but it won't collide with the body anymore. Both the lid and body are properly colliding with the hand and with a sphere I added to help test collisions.
I'm assuming the issue is that two kinematic objects can't collide with each other but I don't know how else to approach this.

sentences:
How do I implement references or relations for entities within a serialized savegame? I have a 2D tile based RPG for which I'm developing save game function. In particular, I'm trying to save this structure:

A caster can have multiple buffs that he maintains. Each buff can have multiple effects applied to players or monsters. The pattern has links both ways (caster has buff, buff knows who cast it)

If I serialize caster, buffs and effects, how can i restore the relationship:
caster - buff - effect - target?

Would I need to implement something like unique identifiers for monster, buffs and players and then link them all together once the save game is loaded?

sentences:
How do I size my map in blender so it will be the right size in unity? I am working on a fps game but I cant get the size right of my map in blender, every time I export it to a .fbx file (unity won't work if it is a .blend file) it is a super small plane floor in unity the player controller is 10 as big as the map.
I don't know what to do.

sentences:
Puzzled about game mods I'm new to game development. I was thinking of different ways to create a game. I discovered Unity3d as much preferred indie game engine and yet so powerful. Then I read about game mods, which I found pretty exciting too. So, I now have two questions.

Are Mod creation Software/SDKs developed by the same company which made the original game? Are there any custom made (recent) mod sdk? Is it even possible to make one like that?
Is it possible to port a model from one mod sdk (say, Halflife) to another mod sdk (say, Skyrim)?

sentences: why is my mesh black in blender even though the color is set to white I set my mesh black then wanted to set it back to white but can't. How do i do it ?

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:
RGB values from image into a one dimension array in c# I was wondering if there is a was a way to read rgb values from an image into a one dimensional array in C#. If it doesnt make sense, in java I would do something like this.

int[] pixels;
BufferedImage image = getClass().getResourceAsStream("asdfghjkl.png");

int w = image.getWidth();
int h = image.getHeight();

pixels = new int[w * h];
image.getRGB(0, 0, w, h, pixels, 0, w) ;

So any help would be great, or if you can point me in the right direction, that'd be great

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:
Best way make static GameObject clickable 2D I've built a turn based battle combat game (like pokemon) but i'm stuck between a rock and a hard place.

Asfar as i understod UI elements should be inside Canvas, while Players, Enemies, Items and etc... Should not be inside a canvas. Correct me if i'm wrong.

I've tried different ways how to handle this situation. Such as make Enemy as a button, but seems not to fire. Since i think it has to be inside a canvas. Also make enemy which have animations as button, may not be a good idea?

Update event, to check if the mouse is down and mouse position is converted with screentoworldpoint and see if the positions matches with the enemy position.

Update event, to check if the mouse is down and rayCast see if we colide with something. But i dont feel like this is neccesary since the enemy does not move. So the position is always the same.

Also if it's possible to take into consideration that every enemy is different size. But this is a minor detail, i would like firstly tackle the best way handle onClick event without the extra overhead.

I would appericate any feedback on my dilemma.

sentences:
Voxel traversal intersection float position I have a 3D grid of cubes, and using the algorithm from this paper http://www.cs.yorku.ca/~amana/research/grid.pdf I've been able to get the integer coordinates of the first tile intersected by a random line.

My question is, is there any simple way to get the intersection floating point position? I've been able to get the normal, but not the position...

sentences:
Recognising when a user is clicking below a particular sprite I have a game, built using pixi.js, where I want to run some code every time the user presses below a certain sprite. I am handling the press event using hammer.js. The problem is that the y attribute of the sprite and the y attribute of the user’s touch event don’t  match what I can see on my screen.

As, an example, consider the code below:

if (touchPointer.clientY > this.children.marker1.position.y) {
  console.log("******* Clicked Below the Line ********: ");}
else{
  console.log("******* Clicked Above the Line ********: ");}

The problem I have is that, when I click slightly above the sprite, the first section of code will run (which prints “Clicked Below the Sprit”), even though on the screen, I can clearly see the pointer is above the sprite.
I am guessing, what’s going on is that the y positions for the pointer and the sprite are being calculated differently, but I don’t know how to go about ensuring they’re calculated consistently, so I can properly compare sprites against the pointer. Any suggestions?

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

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

sentences:
How to do pixel per pixel modeling in unity3d? So generally I want to have api like pixels.addPixel3D(new Pixel3D(0xFF0000, 100, 100,100)); (color, position) where pixels is some abstraction on 3d sceen objet.So to say point cloud. It would have grate use in deep space/stars modeling... I want to set each pixel by hand (having no image base or any automatic thing)... So point is modeling something like

Or look at alive flash analog here

How to do such thing in unity?

sentences:
'Binary XML' for game data? I'm working on a level editing tool that saves its data as XML.

This is ideal during development, as it's painless to make small changes to the data format, and it works nicely with tree-like data.

The downside, though, is that the XML files are rather bloated, mostly due to duplication of tag and attribute names. Also due to numeric data taking significantly more space than using native datatypes. A small level could easily end up as 1Mb+. I want to get these sizes down significantly, especially if the system is to be used for a game on the iPhone or other devices with relatively limited memory.

The optimal solution, for memory and performance, would be to convert the XML to a binary level format. But I don't want to do this. I want to keep the format fairly flexible. XML makes it very easy to add new attributes to objects, and give them a default value if an old version of the data is loaded.  So I want to keep with the hierarchy of nodes, with attributes as name-value pairs.

But I need to store this in a more compact format - to remove the massive duplication of tag/attribute names. Maybe also to give attributes native types, so, for example floating-point data is stored as 4 bytes per float, not as a text string.

Google/Wikipedia reveal that 'binary XML' is hardly a new problem - it's been solved a number of times already. Has anyone here got experience with any of the existing systems/standards? - are any ideal for games use - with a free, lightweight and cross-platform parser/loader library (C/C++) available?

Or should I reinvent this wheel myself?

Or am I better off forgetting the ideal, and just compressing my raw .xml data (it should pack well with zip-like compression), and just taking the memory/performance hit on-load?

sentences:
3D Planetary gravity so i am making a thing in javascript and i want to have planetary gravity in my "universe".

But when i use an equation to calculate the acceleration by gravity i get one number. That is how fast the object accelerates in the direction of the other object, but how do i convert a speed in one direction to a speed in the X, Y and Z axis?

sentences:
How to load additive scenes to the master client, per player, in unity using photon? I have already successfully created a multiplayer scene where multiple users can join, however there are some issues like unity not allowing multiple sound listeners per scene. In order to alleviate this problem (hopefully) I would like to load an additive scene that connects to the master client. In the additive scenes will contain the other players. How can I achieve this using photon PUN2?

In normal unity non multiplayer it is a easy as SceneManager.LoadScene(sceneName,LoadSceneMode.Additive); With that code a new scene adds on to the scene already at play as a new scene. I wish to do so with photon PUN2 somehow, where the master client loads his scene and other players join the game using their own scenes. Currently the other players are loading into the scene with a simple instantiation of their prefabs PhotonNetwork.Instantiateand this is giving me errors such as the one stated above (multiple sound listeners)

Please help

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:
Godot Mono cannot find .NET framework 4.7 I cannot get anything to compile in Godot Mono using C#.  It keeps giving me the following error:

  The reference assemblies for framework ".NETFramework,Version=v4.7" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\Users\my_name\Desktop\GODOT\Projects\test\Test.csproj]

I have installed the SDK found here which did not fix the problem.  Maybe I need to explicitly direct Godot to it, but I can't find any option to do so.  Can someone please point me in the right direction?

sentences:
How to tune the collision handling to respond differently depending on the collided objects? I'm making a collision handler for a Java game engine. I made an interface called Collidable. I have a method called onCollision which takes the parameter of my Engine Game Object.

public void onCollision(engine.objects.Object obj) {

}

I want to know how I can redo this so that I can give individual instructions for each Collidable object's onCollision method for how to collide with a Wall object or an Enemy object without having to write another method that has the parameters Wall and Enemy so that my engine is flexible.

How can I do this?

sentences:
PyGame - Top down shooter mechanics I'm currently developing a game for some school work using the PyGame library for Python. I'm almost done with most of the game's core mechanics, but have gotten hung up on the shooting mechanics. My current code is too long to post fully, but I'll put excerpts of it and explain what I have so far.

all_sprites_list = pygame.sprite.Group()

bullets = []
bullet_list = pygame.sprite.Group()
bullet_speed = 10

class Bullet(pygame.sprite.Sprite):
def __init__(self):
    super().__init__()

    self.image = pygame.Surface([4,10])
    self.image.fill(red)
    self.rect = self.image.get_rect()

def update(self):
    if self.rect.x > chx:
        self.rect.x -= bullet_speed
    elif self.rect.x < chx:
        self.rect.x += bullet_speed
    if self.rect.y > chy:
        self.rect.y -= bullet_speed
    elif self.rect.y < chy:
        self.rect.y += bullet_speed

This code shows the class I have for my bullets and their movement. The problems with this right now are that A) the bullets get stuck around the crosshair position, of which the chx and chy variables show the x and y position of the mouse.

    if event.type == pygame.MOUSEBUTTONDOWN:
        bullet = Bullet()
        if weapon == "hg" and hg_move == True:
            bullet.rect.x = hgrect.x
            bullet.rect.y = hgrect.y
            all_sprites_list.add(bullet)
            bullet_list.add(bullet)

This code shows an example of one of the firing commands later in the main game loop. hg, hg_move, and hgrect.x/y are all variables used for the movement of the character depending on the type of weapon he is holding.

Some of the main issues are seemingly caused by the fact that I can't find a way store a static value of the likes of the crosshair positions, or to keep the bullets going on a trajectory until they leave the screen or hit an object.

Any help would be greatly appreciated!

sentences:
AssetBundle not working properly I am using Unity 5.0.1.  I have created the asset bundle of a sprite by selecting the name "img.unity3D" from the dropdown and then running the script :

BuildPipeline.BuildAssetBundles ("AssetBundles");

It successfully creates the "img.unity3D" file and "img.unity3D.manifest" file for that sprite in AssetBundles directory.

Now, I am uploading the "img.unity3D" to my server and trying to download it through :

 WWW www = WWW.LoadFromCacheOrDownload(URL, 0);

as I need to save the image on the local storage also.  When I am trying to get the main asset from the asset bundle and casting it as sprite, its returning null.

AssetBundle imageBundle = www.assetBundle;
testSprite.GetComponent<Image>().sprite = imageBundle.mainAsset as Sprite;

But, it doesn't seem to work.

Am I uploading the right file "img.unity3d" or I also need to upload .manifest file on to the server.
Is there any thing that I am missing, because I tried uploading only sprite and tried to download it, I was able to cast that to a sprite but not the case with assetbundle.

Sorry for such a long post...!!!

sentences:
How to coordinate sprites, player's position and collisions in a Bomberman-like 2D game? I'm programming a Bomberman in Java (my first game) and I'm having problems with the player's sprites and position in the map. I'm using a 2D integer array to represent:

Unbreakable blocks
Explodable brick walls
Free spaces
Player itself (not sure if this is correct)

By now I could correctly place every background tile (40*40 each) iterating the array. Bomberman's sprites are MAX 40*40 (sometimes a little smaller). My question is, how can I correctly handle the collisions with walls? I already tried to do it, but that solution was very horribly buggy.

Thanks in advance.

sentences:
Unity ads - not showing on phone I'm trying to implement unity rewarded ads. They work fine in the editor. However when I run it on my phone, the ads don't show up. Nothing happens when I click on the show ads button. I have a very simple project. There is a button that has the ShowRewardedVideo() function assigned and an admanager script. Not sure what's going wrong. Can someone please help?
Here is the admanager script:
 string gameId = "123456";
 bool testM = true;
 string reward = "rewardedVideo";

 void Start()
  {
    Advertisement.AddListener(this);
    Advertisement.Initialize(gameId, testM);
  }

 public void ShowRewardedVideo()
  {
    if (Advertisement.IsReady(reward))
    {
        Advertisement.Show(reward);
    }
  }

 public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
  {
    if (showResult == ShowResult.Finished)
    {
        Debug.Log("got reward");
    }
    else if (showResult == ShowResult.Skipped)
    {
        // Do not reward the user for skipping the ad.
    }
    else if (showResult == ShowResult.Failed)
    {
        Debug.LogWarning("The ad did not finish due to an error.");
    }
  }

 public void OnUnityAdsReady(string placementId)
  {
    if (placementId == reward)
    {

    }
  }

 public void OnUnityAdsDidError(string message)
  {
    // Log the error.
  }

 public void OnUnityAdsDidStart(string placementId)
  {
    // Optional actions to take when the end-users triggers an ad.
  }

// When the object that subscribes to ad events is destroyed, remove the listener:
 public void OnDestroy()
  {
    Advertisement.RemoveListener(this);
  }
}

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:
Visually coding rpg dialog trees I am currently using XML to create my dialog trees in my rpg, but doing this by hand for hundreds of different discussions can get very tedious very fast. I was wondering if there is any way I can implement a flow chart/udk kismet like system of visually coding these diolog trees. I still want the end result to be the XML because I already wrote the parsing and other logic around the XML.

EDIT: to give an idea of what I am looking for, here is an example. This was shown to me when I asked this on reddit and it is basically what I am looking for but it is limiting . Really what I am looking for is any dialog software that is already in use for games or software that is graph/flowchart like and can be modified to suit my needs.

sentences:
How to achieve single animation for different charcters? I've been playing a game called Marvel Contesnt of Champions for android. In that game two opponent fights with each other in most 2D view but the game is developed in 3D. Each character has their own special move which dynamically interacts with opponent. So how does they achieve single animation for different characters?

By single animation I mean, for example, I'm playing with X character and he uses his special move on Y character and in that animation X character grabs character Y's neck and smashes him on the ground. Now, I'm fighting Z character with X character and in the special move he smashes Z character same way he smashed Y character. Is it like a common skeletal movements that are just changing their clothes(textures) ?

I'm pretty sure it's not pre-animated thing cause there are like more than 50 characters. I'm currently working in Blender and getting my character design right but this question was bugging me for a while and I thought there could be no better place other than here to clarify my confusion.

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:
OpenGL Texture Mapping distorts image So, I'm just trying to draw a texture to two triangles that are the same size as the viewport, but it breaks up the image and distorts it. I have tried resizing the image file and everything, but nothing seems to work. Below is the code that maps the texture and draws the triangles.

 public void Render()
    {
        Texture texture = _textureManager.Get("splash");
        Gl.glEnable(Gl.GL_TEXTURE_2D);
        Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture.Id);

        double height = 720;
        double width = 1280;

        double x = 0;
        double y = 0;
        double z = 0;

        float topUV = 0;
        float bottomUV = 1;
        float leftUV = 0;
        float rightUV = 1;

        Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
        Gl.glBegin(Gl.GL_TRIANGLES);
        {
            Gl.glTexCoord2d(leftUV, topUV);
            Gl.glVertex3d(x - width, y + height, z);
            Gl.glTexCoord2d(rightUV, topUV);
            Gl.glVertex3d(x + width, y + height, z);
            Gl.glTexCoord2d(leftUV, bottomUV);
            Gl.glVertex3d(x - width, y - height, z);

            Gl.glTexCoord2d(rightUV, topUV);
            Gl.glVertex3d(x + width, y + height, z);
            Gl.glTexCoord2d(rightUV, bottomUV);
            Gl.glVertex3d(x + width, y - height, z);
            Gl.glTexCoord2d(leftUV, bottomUV);
            Gl.glVertex3d(x - width, y - height, z);
        }
        Gl.glEnd();

    }

Here is the original image:

And here's the result:

The image is 1920 x 1080, and the viewport is 1280 x 720, but I'm not too sure that matters because I have tried resizing the image and nothing seems to work.

edit: this is a cross-post from stack overflow (I asked it here as well because nobody seemed to have an answer): https://stackoverflow.com/questions/26723470/opengl-texture-mapping-distorts-image

sentences: Using a smaller off-screen buffer for rendering I am seeing this in most of the game codes I read and tutorial videos I watch. When using double buffering in rendering, they use a smaller sized off-screen buffer, then just scale it up when drawing onto the screen. Why is this so? Is there any advantages and/or disadvantages when using this technique?

sentences:
Calculate land center on grid I have a grid based game. The main map is 2d array with land ids, something like this (here are 2 lands on the map, one formed where the 1's are and one formed by where the 2's are):

[ 1 , 2 , 2 ]
[ 1 , 1 , 2 ]
[ 1 , 2 , 2 ]

I want to draw buildings on the center of each land. But how is better to calculate the center? Just calculating mean(X),mean(Y) does not work - lands can bee narrow or have dumbbell shape.

sentences:
Is this the correct way to detect ray-sphere intersection? I have this java function that should return a true or false for any sphere passed to it if they intersect. However it seems to end being true a lot of the time when it shouldn't and false sometimes when it should be true.

It is possible however that i am passing incorrect data to the function. This was done with jPCT so the object SimpleVector is a vector with 3 variables.

public Boolean sphereIntersect(SimpleVector rayOrigin,SimpleVector rayDirection, SimpleVector sphereOrigin, float sphereRadius )
{
        SimpleVector Q = new SimpleVector(sphereOrigin);
        Q.sub(rayOrigin);

          float c = sphereOrigin.length();
          float v = Q.calcDot(rayDirection);
          float d = sphereRadius*sphereRadius - (c*c - v*v);

          if (d < 0.0){
              System.out.println("False");
          return false;
          }
          System.out.println("True");
          return true;

}

sentences:
What heuristics are used in NavMeshes? What heuristics do programmers use in A* pathfinding for NavMeshes?

NavMesh = Navigation Mesh, its a type of pathfinding that uses meshes instead of waypoints.

sentences:
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:
Generated Perlin noise is not coherent (sharp edges) I'm having a bit of trouble implementing Perlin Noise, I've included an example the problem below. I've tried debugging but everything appears to be working correctly, and I can't figure out what's causing the sharp edges in the output.

Below is a snippet of the code that I'm using to generate the noise (sorry about lack of comments, most should be self-explanatory though).

inline int ffloor(float i)
{
    return (i >= 0 ? (int)i : (int)i-1);
}

inline float dot(float x, float y, Vector grad)
{
    return (x * grad.x + y * grad.y);
}

inline float lerp(float t, float a, float b)
{
    return a + t * (b - a);
}

inline float scurve(float t)
{
    return (t*t*t*(t*(6*t -15) + 10));
}

inline Vector getVec(int x, int y)
{
    unsigned char a = permutations[x & 255];
    unsigned char b = permutations[y & 255];
    unsigned char val = permutations[(a + b) & 255];
    return gradients[val];
}

float noise2(float xPos, float yPos)
{
    float x0 = ffloor(xPos);
    float x1 = x0 + 1.0f;
    float y0 = ffloor(yPos);
    float y1 = y0 + 1.0f;

    float fracX = xPos - x0;
    float fracY = yPos - y0;

    float n00 = dot(fracX, fracY, getVec(x0, y0));
    float n01 = dot(fracX, fracY - 1.0f, getVec(x0, y1));
    float n10 = dot(fracX - 1.0f, fracY, getVec(x1, y0));
    float n11 = dot(fracX - 1.0f, fracY - 1.0f, getVec(x1, y1));

    float sx = scurve(fracX);
    float sy = scurve(fracY);

    float avgX0 = lerp(sx, n00, n11);
    float avgX1 = lerp(sx, n01, n11);

    return lerp(sy, avgX0, avgX1);
}

void init(void)
{
    int i, j, k;
    float step = 6.24f / 256;
    float val = 0.0f;

    for (i = 0; i < 255; i++)
    {
        permutations[i] = rand() & 255;

        gradients[i].x = (float)sin(val);
        gradients[i].y = (float)cos(val);
        val += step;
    }

}

To generate the noise map I'm calling init and then iteratively calling the noise2 function with coordinates that have been scaled to the size of the map I want (so xPos and yPos are always between 0 and 1).

sentences:
C# invoke stops unity I'm making a game where in needs to randomly generate objects on a plane, so I setup a code to spawn Food, but whenever I run the code Unity uses up all my computers memory and 40% cpu.  I have a fairly good computer and have no issue with anything else in the project.  The code has worked when I called it in FixedUpdate but as soon as I try and call it in an invoke it just breaks everything.  I have only started working with unity for less than 24 hours so I don't really know what could be wrong, since I didn't get any errors or warnings.

using System.Collections;
using UnityEngine;

public class SpawnFood : MonoBehaviour
{
public Rigidbody Food;
public float x;
public float y;
public float z;
public Vector3 pos;
public float spawnTime;

void FixedUpdate()
{
    Start:
    Invoke("FoodSpawn", spawnTime);
    goto Start;
}

void FoodSpawn()
{
    x = (UnityEngine.Random.Range(-110f, 110f));
    z = (UnityEngine.Random.Range(0.50f, 0.51f));
    y = (UnityEngine.Random.Range(-50f, 51f));
    Vector3 pos = new Vector3(x, z, y);
    Instantiate(Food, pos, Quaternion.identity);
}

}

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:
Reversing translational dependency of Sprite on Mouse instantaneously at runtime without causing the sprite to jump Help me think through a logical way to implement the desired effect.

Goal: (I'm using Adobe Animate CC 2017 targeting AIR for Desktop)

Move a sprite using a controller (mouse on a PC for instance) with a 1:2 ratio.
Have an event trigger a function that causes this relationship to become a -1:2 ratio (and another one to switch it back to 1:2)

My First Thought Experiment (represented in pseudo code)

sprite.x = mouse.x * 2 - stageWidth / 2 - sprite.width / 2 (works fine, 1:2 ratio)
function reverseRatio():void{ sprite.x = stageWidth - (mouse.x * 2 - stageWidth / 2 - sprite.width / 2) - sprite.width (also works fine, but with a catch*)

The "catch" is that the sprite, when triggered to reverse ratios, jumps to the reverse side of the display window.  What I'd like to accomplish is somehow have the motion of the sprite tied to the motion of the mouse, but what I have accomplished is the position of the sprite is dependent on the position of the mouse.  And since when this event is triggered, the mouse does not move, the sprite suddenly does (which I'm guessing would get bad reviews during play testing, although the very saddistic gamer may actual enjoy trying to master this effect!)

So it seems I need to do just that, link the motion of the mouse and sprite, instead of the position.  This also seems to have a "catch" though.

Here's another thought experiment using this motion dependency method.

You move the controller toward the right of the display window with a motion dependency to the Sprite of 1:2 (mouse:sprite). *By motion I mean use the delta or change in x position by recording the position in one frame and using the difference in the next frame to determine how much the Sprite translates.*
The Sprite goes to the far right of the window as well (actually getting there before the mouse does because of the imbalanced ratio).
The event is triggered that negates the relationship to -1:2 (mouse:sprite).
The sprite does not jump to the far left side of the window because its motion is dependent on the motion of the controller, which isn't being moved.
Now the controller moves further to the right
This should have the effect of moving the sprite to the left, which it does, but by the time the sprite moves back to the left half way across the screen, the controller has left the window and thus can no longer influence the sprite (my application pauses when the mouse leaves, because my target framework doesn't support mouse input from outside the display window).

So because these two methods have these "catches" I have to choose between the sprite jumping across the screen or only being able to move the sprite halfway back when this event is triggered.  I think this means I need to really rethink my whole methodology.  Any thoughts on a slick way to achieve this effect?  It seems impossible to me without having my PC physically move the location of the mouse cursor (which, if I could do that, would totally work!).

Thoughts? Questions?

in the bottom picture, the event has been triggered, but the sprite can't respond to the movement of the cursor, becasue it is already to the far right.  I could manually move the cursor to the far left, at which point things would work fine, but the goal is for this to be instantaneous reversal of the relationship.

edit

If I were to port this to iOS, I think I could use the accelerometer to control the Sprite which effect could be instantaneously reversed without a cursor running out of real-estate. Right? What about using a finger drag to control the Sprite? Would I run into the same problems as the mouse on a desktop? Just musing here.

update

I have an idea (just to give you an idea of the kind of ideas i am open to for suggestions). My idea is give a visual cue as to where the Sprite would "jump" to when the correlation gets reversed. I am imagining a ghost image, or an outline, or a Sprite with raster lines through it to indicate that it is an inactive version. Then when the correlation switches, the feint one becomes solid and vice versa.

sentences:
Event-/Input system with SFML: Cannot move diagonally in 2D I am a beginner in anything with game development. I written a small prototype in which i can move a square around with the arrow keys. For that i use SFML.

At the moment i experiment around with my Event System: First, to keep things simple, i was polling for the arrow keys using sf::Keyboard::isKeyPressed(), which works fine for this small kind of "game"

// in handleUserInput():
if(Keyboard::isKeyPressed(Keyboard::Left))
{
        player_.moveLeft();
}

// in player the player class:
void moveLeft()
{
    velocity.x = -x_speed; // sf::Vector2f
}

// in my player-class update() method:
void update()
{
// Out of bounds check and so on...
shape.move(velocity);
velocity.x = 0;
velocity.y = 0;
}

With this i was able to move horizontally, vertically and diagonally.

Then i moved to create my "real" EventSystem based on callbacks.
It wraps around sf::Window::pollEvent(). E.g. i register a callback method for the event type sf::Event::EventType::KeyPressed. So i changed my code to first register for the movement keys

event_system_.registerCallback(sf::Event::KeyPressed, [&] (const sf::Event& event)
    {
        switch(event.key.code)
        {
        case sf::Keyboard::Left:
            log->info() << "Moving Left";
            player_.moveLeft();
            break;
        case sf::Keyboard::Right:
            log->info() << "Moving Right";
            player_.moveRight();
            break;
        case sf::Keyboard::Up:
            log->info() << "Moving Up";
            player_.moveUp();
            break;
        case sf::Keyboard::Down:
            log->info() << "Moving Down";
            player_.moveDown();
            break;
        case sf::Keyboard::Escape:
            window_.close();
            break;
        }
    });

The problem i encountered was, that i couldn't move diagonally anymore.
After adding the loggin parts i found out, that when i keep two arrow keys pressed the only event that gets fired over and over again was the key pressed latest (e.g. i try to press Left & Down and pressed the Down-Key slightly later the Down-Event would be captured over and over again and the Left-Event only once).

After that i changed my code not to reset the velocity in my player's update-method and also registered for sf::Event::KeyReleased so that it would reset the x/y-part of the velocity when the corresponding key was released.

event_system_.registerCallback(sf::Event::KeyReleased, [&] (const sf::Event& event)
    {
        switch(event.key.code)
        {
        case sf::Keyboard::Left:
        case sf::Keyboard::Right:
            log->info() << "Stopped moving horizontally";
            player_.velocity.x = 0;
            break;
        case sf::Keyboard::Up:
        case sf::Keyboard::Down:
            log->info() << "Stopped moving vertically";
            player_.velocity.y = 0;
            break;
        }
    });

But somehow this does not seem right to me (But it wouldn't seem right to me to poll for every single possible input manually - So i think events is the things to take). Could anyone give me a hint what i am doing wrong and how to do it better?

Kind Regards

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: Unity3d saving with prefabs: Bad Idea? I am developing for Android.In my game data is in objects which aren't derived from MonoBehaviour.So I am using binary serializer and taking references from the gameobject.It works, but I have too many variables to save most of variables are in script attached to gameobject Gamemanager So I made a prefab of gameobject of Gamemanager and saved it using prefabutility and load it again It works but Can someone tells me whether this is right approach or not, please??

sentences:
Incorrect click event when resize on libGdx I want to use scene2D, in libGDX, to detect click on object.

I have this simple Game sample :

Stage stage;

@Override
public void create()
{
    this.stage = new Stage(1280, 720, true);
    MyActor actor = new MyActor();

    Gdx.input.setInputProcessor(stage);

    actor.setTexture(new TextureRegion(new Texture(Gdx.files.internal("plateau.jpg"))));
    actor.setScale(0.1f);

    stage.addActor(actor);

    actor.addListener(new InputListener()
    {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
        {
            System.out.println("down"+Math.random());
            return true;
        }
    });
}

@Override
public void render()
{
    stage.act();
    stage.draw();
}

MyActor is a simple class extending Actor with a rendertexture.
The Event is working fine at start.
But when resizing the frame, while the Actor is streched as wanted, the coordinates of the click are not updated and thus misplaced.

How to make the stage using the new size of the items as base to the event ?

Thanks.

sentences:
Architecture for extremely modular game? I'm developing a modular game in Unity 5.6. Each module has very little overlap in assets with the others. I'm concerned about having a bloated repository after a few months of development, and since I'm using Bitbucket (a free account) I'm limited in my repo size, but not in my number of repos. So instead of having one huge folder for my game I'm considering having a launcher project and scene that loads builds from a folder in /Assets. Each module would be its own project, and I would just drop its build into the launcher's folder.

My question is, is this a reasonable approach to building a highly modular game? Hopefully I'll be continuing development for quite a while, and I want to make sure the project is as lightweight and extendable as possible. Or am I overthinking this, and should I just use one big repo?

sentences:
Drop in quality of rendering of texture Platform: Android OpenGL ES 2.0

I'm drawing a texture on to a square using OpenGL ES2.0.
The texture scrolls infinitely in vertical direction.

The rendering quality drops very rapidly after a few frames and the texture quality is deteriorated.

Screenshot #1

Screenshot #2

How to correct this issue?

sentences:
How can I predict player-to-projectile collisions in Box2D? I'm making a real time shooting game with Box2D as the physics engine. The gameplay is mostly about trajectory, like Angry Birds. I want to make a slow motion effect and move camera to the player when he's killed, but the effect should start when the stone is still in the air, before the collision actually happens.

The magnitude of damage is only calculated at collision, based on impulse. Because it's a real-time game, the player must be able to move their character's physics body without lag.

How can I predict their death? Is it even possible? I could raycast, but what if another object moves to block its path?

sentences:
Unity highlight/outline mesh edges/border (make them visible) Let's say I create a cube using mesh triangles similar to the graph below. I would like to make those 12 edges visible in play mode so user/player can see them too (but without the diagonals).
What would be the best way to approach this problem in unity? Hundreds of cubes will be created in run time using mesh/triangles and the vertices position (vector3 value) will change at some point, so I am wondering if there's a way that allows those edges to change/move along when the mesh/triangles change and the edges still remain visible the whole time.
The desired outcome should be similar to the shaded wireframe in the scene view. Any help would be appreciated.

sentences:
Performing movement per game tick Assume we have a player on a map, whereby the grid is represented as a floating point.

When a player is moving, they have an x and y velocity.

How to do you properly apply their movement each gametic?

By that I mean: do you keep nudging the player forward by one map unit and repeat that by the velocity? Where is that fine line where I say "we don't go any smaller movements than this like 0.5, or 0.25, etc"

Further, is there a way to optimize this to be able to make movement fast computationally? I thought of having some kind of blocks where you can quickly check if you'd intersect anything and make some optimizations, but I have no idea if this is good, bad, or how it should be done.

Update: Suppose you have a projectile traveling 100 map units North, and it would collide with an object 50 map units North of it. In the period of one world 'ticking', would you just halt it in a dead on collision (assuming the line is impassible), or would you detect a collision and then do something after it since that remaining 100 map unit velocity (like maybe if it's on an angle then cancel its Northward momentum and continue trying to move it to the East/West.

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:
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:
How to calculate suitable attack speed I'm developing an RPG and am stuck trying to create a formula for attack speed, using four stats and a base speed.

Basically, I'm trying to get an outcome where the encumbrance (basically weight and ease of handling in a single stat) of armor and weapon along with the players´ strength and agility will effect the attack speed.

So - for example: A player with a heavy armor and a 2-handed maul might end up with 0.35 attacks per second, while an unarmored dagger-wielding player should have around 2.5 or even 3 (which would be the maximum speed).

Weapons and armor have an encumbrance stat. Players have agility and strength.

In order to make it more realistic, I'm trying to integrate the following into the formula:

The penalty from the total encumbrance of all items should have a smaller impact on the attack speed than the encumbrance of the weapon
The penalty from the weapon encumbrance should depend on both agility and strength
There should be a maximum attack speed (around 3 attacks per second)
Higher agility should result in higher attack speed
Higher strength should lessen the overall encumbrance penalty

I'm not yet sure if the ranges or min/max stats are needed for the formula, but currently player stats will range between 1-10 and encumbrance (per item) from 1-10 as well.

I've given this a couple of hours of thought but I feel that my math skills might simply not be up to par.

Here's the current state of my attempt (non-functional): https://docs.google.com/spreadsheets/d/1S_NOsJp-FegY7ruR6EZTqWRxuP6gDnZJr9LYw8ETZKQ/edit#gid=0

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:
Shoot a bullet towards cursor - top down 2d I am making a 2D topdown shooter game, in which the player's movement is controlled with WASD and gun with the mouse. I'm having a hard time figuring out how to update the position of the bullet as it moves towards the cursor.

I have the player's X and Y coords, and the cursor's X and Y coords. I need to be able to update the bullet's X and Y coords each frame based on its trajectory.

sentences:
Blurring part of the screen - optimisation I develop 3d menu and sometimes I need to blur only part of the screen. I use a forward rendering. I create a frame buffer object with 3 color attachments. Rendering looks like this:

bind fbo
render objects which  are blurred to the first texture
bind the first texture
perform vertical blur and save a result in the second texture
bind the second texture
perform horizontal blur and save a result in the third texture
unbind fbo (render to the default fbo)
bind the thrid texture
render the third texture
render objects which are not blurred

I can use subroutines to reduce overhead during switching shaders. I also found the following article . Do you have any other ideas how to optimize above rendering ?

sentences:
Determining how much of a tile is intersected by a ray to help calculate lighting and deal with shadow issues I'm currently using the following steps for my lighting system

Calculate all the tiles along the perimeter based on the radius of the light
Cast a ray from the center of the light to each perimeter tile
The ray cast returns which cells it intersects
Each cell is lit based on their distance from the source (light attenuation)
If a cell is determined to be opaque then the subsequent cells are not lit (hard shadow)

The problem is that in some cases this makes the shadowing looks a bit odd and gives a Peter Pan type of effect where the shadow is not attached to the shadow caster (opaque cell).

For example:

The culprit is highlighted here:

If we take a look at the ray causing the issue we can see that it hardly intersects the cells behind the opaque object but they are still counted as being lit:

The method used for ray traversal is a typical Bresenham line drawing algorithm:

    while (true)
    {
        // Do not return cells outside the map bounds
        if (x0 < 0 || x0 >= width || y0 < 0 || y0 >= height)
            break;

        // Add the current cell to the list
        cells.Add(GetCell(x0, y0));

        if (MathExt.AlmostEquals(maxX, maxY, 0.01f))
        {
            // Cannot travel any further in this direction so this is the last cell
            if (x0 == x1 || y0 == y1)
                break;

            maxX += deltaX;
            maxY += deltaY;
            x0 += stepX;
            y0 += stepY;
        }
        else if (maxX < maxY)
        {
            // Cannot travel any further in this direction so this is the last cell
            if (x0 == x1)
                break;

            maxX += deltaX;
            x0 += stepX;
        }
        else
        {
            // Cannot travel any further in this direction so this is the last cell
            if (y0 == y1)
                break;

            maxY += deltaY;
            y0 += stepY;
        }
    }

My current line of thinking is to calculate how much of the cell is intersected by the ray and use that to influence the contribution of the lighting, alongside the attenuation.

Therefore, my question is how do I calculate how much of the cell is intersected by the ray?

Alternatively, can anyone suggest a more suitable solution for this issue?

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:
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:
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:
Strange collision in Breakout My Breakout game works fine so far, but I struggle with the collision detection... Well... just with the collision from the ball with the brick...
Here's the relevant code:

List<Brick> removeList = new ArrayList<>();
for (Brick b : bricks) {
    if (ball.intersects(b)) {
        float x = b.getX();
        float y = b.getY();
        float width = b.getWidth();
        float height = b.getHeigth();

        Line2D.Float left = new Line2D.Float(x, y, x, y + height);
        Line2D.Float right = new Line2D.Float(x + width, y, x + width, y + height);
        Line2D.Float top = new Line2D.Float(x, y, x + width, y);
        Line2D.Float bottom = new Line2D.Float(x, y + height, x + width, y + height);
        Rectangle2D bounds = ball.getShape().getBounds2D();

        if (bounds.intersectsLine(left)) {
            ball.setVelocityX(-ball.getVelocityX());
            ball.setX(b.getX() - ball.getWidth());
        } else if (bounds.intersectsLine(right)) {
            ball.setVelocityX(-ball.getVelocityX());
            ball.setX(b.getX() + b.getWidth());
        } else if (bounds.intersectsLine(top)) {
            ball.setVelocityY(-ball.getVelocityY());
            ball.setY(b.getY() - ball.getHeigth());
        } else if (bounds.intersectsLine(bottom)) {
            ball.setVelocityY(-ball.getVelocityY());
            ball.setY(b.getY() + b.getHeigth());
        }
        removeList.add(b);
    }
}
bricks.removeAll(removeList);
objects.removeAll(removeList);

I thought it would work like this, but sometimes the ball does the wrong collision e.g. when the ball comes from down and it hits the brick near the edge it would collide like it hit from the left!

Is something wrong with my code? Maybe it is the wrong approach?

EDIT
Like you can see in the code above I'll get the borders left, right, top and bottom from the x and y coordinates.
After that I check which border was intersected by the ball and determine from which side the brick was hit.

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:
Passing multiple Vertex Attributes in GLSL 130 (note this question is closely related  to this one however I didn't fully understand the accepted answer)

To support videocards in laptops I have to rewrite my GLSL 330 shaders to GLSL 130. I'm trying to do this but somehow I don't get vertex attributes to work properly.

My 330 shaders look like this:

#version 330
layout(location = 0) in vec4 position;
layout(location = 3) in vec4 color;

smooth out vec4 theColor;
void main()
{
    gl_Position = position;
    theColor = color;
}

Now this explicit layout is not allowed in GLSL 130 so I referenced this page to see what the default layouts for some values would be. As you can see position should be the 0th vertex attribute and color should be the 3rd vertex attribute. Because this is a test case I had already configured my explicit layouts in the same way, which worked, so I now simply rewrote my shader to this and expected it to work:

#version 130
smooth out vec4 theColor;
void main()
{
    gl_Position = gl_Vertex;
    theColor = gl_Color;
}

However this doesn't work, the value of gl_Color is always (1,1,1,1). So how should I pass multiple vertex attributes to my GLSL 130 shaders?

For reference, this is how I set my vertex buffer object and attributes (I've just adapted this tutorial to JAVA+JOGL)

gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vertex_buffer_id);
gl.glEnableVertexAttribArray(0);
gl.glEnableVertexAttribArray(3);
gl.glVertexAttribPointer(0, 4 , GL3.GL_FLOAT, false, 0, 0);
gl.glVertexAttribPointer(3, 4, GL3.GL_FLOAT, false, 0, 4*4*4);

gl.glDrawArrays(GL3.GL_TRIANGLE_STRIP, 0, 4);

gl.glDisableVertexAttribArray(0);
gl.glDisableVertexAttribArray(3);

EDIT
I solved the problem by querying for the layout locations of position an color using glGetAttribLocation however I still don't understand why the 'hardcoded' values like gl_Color didn't work, can't I upload data in there as normal? Shouldn't they be used?

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:
What is the format of DXGI_FORMAT_D24_UNORM_S8_UINT? I'm trying to read the values in a depth texture of type DXGI_FORMAT_D24_UNORM_S8_UINT.

I know this means "24 bits for depth, 8 bits for stencil" "A 32-bit z-buffer format that supports 24 bits for depth and 8 bits for stencil.", but how do you interpret those 24 bits?

It's clearly not going to be a 32-bit int, and it's not going to be a 32-bit float.  If it is an integer value, how "far away" is a value of "1" in the depth texture?

sentences:
UV mapping issues while loading collada model exported with Sketchup I load collada models, exported via Google Sketchup, into my Three.js (v63) scene with the Three.js collada loader.

The models are loaded, but with some, textures aren't well mapped, like in the following picture :

My first question is how to detect this kind of problems and then, is there a way to leverage the exported UVs from sketchup to correctly map the textures ?

The model from the sceenshot comes from : http://sketchup.google.com/3dwarehouse/details?mid=557d5f1b5a076bdcf53b1b21212345ca&prevstart=0

sentences:
Delaying a Foreach loop half a second I have created a game that has a ghost that mimics the movement of the player after 10 seconds. The movements are stored in a list and i use a foreach loop to go through the commands. The ghost mimics the movements but it does the movements way too fast, in split second from spawn time it catches up to my current movement. How do i slow down the foreach so that it only does a command every half a second? I don't know how else to do it.
Please help

this is what i tried :
The foreach runs inside the update method

DateTime dt = DateTime.Now;

        foreach ( string commandDirection in ghostMovements )
        {
            int mapX = ( int )( ghostPostition.X / scalingFactor );
            int mapY = ( int )( ghostPostition.Y / scalingFactor );

            // If the dt is the same as current time
            if ( dt == DateTime.Now )
            {
                if ( commandDirection == "left" )
                {
                    switch ( ghostDirection )
                    {
                        case ghostFacingUp:
                            angle = 1.6f;
                            ghostDirection = ghostFacingRight;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );// add half a second to dt
                            break;

                        case ghostFacingRight:
                            angle = 3.15f;
                            ghostDirection = ghostFacingDown;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;

                        case ghostFacingDown:
                            angle = -1.6f;
                            ghostDirection = ghostFacingLeft;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;

                        case ghostFacingLeft:
                            angle = 0.0f;
                            ghostDirection = ghostFacingUp;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;
                    }
                }
            }
        }

sentences:
How do I detect a given sprite's bounds automatically using Java? Background

I have the following png file that contains the player sprite.

As with any png file, the non-colored pixels are transparent.

(Width: 16px; Height: 16px)

Currently, I can erect a rectangle (collision-bounds), using java.awt.Rectangle around the image using the image's width and height, as seen below.

I would like to crop the image so that the width and height are changed to the edges of the colored portion of the image, much like what is shown below.

This will allow for more accurate collision-detection between entities or objects in a game.

I want to construct a method that handles this modification dynamically, as seen below.

//Method calculates how far in from [top, bottom, left and right]
//the [non-zero] or [transparent] pixel-data of an image are
//in order to construct a new image that starts at the edges
//of the colored portion of the image.
public BufferedImage adjustImage(BufferedImage image)
{
    BufferedImage result = null;

    return result;
}

Problem

However, I am uncertain as to the algorithm to use to achieve the result above.

Can anyone give a step-by-step on how to detect these bounds and how to implement such a fuction as described above?

sentences:
How can I generate spheres equal between the waypoints? public void duplicateObject(UnityEngine.GameObject original, int howmany)
    {
        howmany++;
        for (int i = 0; i < waypoints.Count - 1; i++)
        {
            for (int j = 1; j < howmany; j++)
            {
                Vector3 position = waypoints[i].transform.position + j * (waypoints[i + 1].transform.position - waypoints[i].transform.position) / howmany;
                UnityEngine.GameObject go = Instantiate(original, new Vector3(position.x, 0, position.z), Quaternion.identity);
                go.transform.localScale = lightsScale;
                objects.Add(go);
            }
        }
    }

For example howmany value is 21.
If I have two waypoints it's fine it will create 21 spheres between the two waypoints.

But if I have 3 waypoints it's creating 42 spheres but it should create 21 since howmany is still 21. And it also position the spheres between waypoint 1 and 2 and then from waypoint 2 to 3.

But I want that it will create 7 spheres between waypoints 1 and 2 and 7 spheres between waypoints 2 and 3 and last 7 spheres between waypoints 3 and 1.

sentences: What software can I use to animate my character in Unity3D? I am new in game development and I want to know what software can help me to create good animations for my 3rd person character.

sentences:
How to synchronize the ball in a network pong game? I’m developing a multiplayer network pong game, my first game ever. The current state is, I’ve running the physic engine with the same configurations on the server and the clients. The own paddle movement is predicted and get just confirmed by the authoritative server. Is a difference detected between them, I correct the position at the client by interpolation. The opponent paddle is also interpolated 200ms to 100ms in the past, because the server is broadcasting snapshots every 100ms to each client.

So far it works very well, but now I have to simulate the ball and have a problem to understanding the procedure.

I’ve read Valve’s (and many other) articles about fast-paced multiplayer several times and understood their approach. Maybe I can compare my ball with their bullets, but their advantage is, the bullets are not visible. When I have to display the ball, and see my paddle in the present, the opponent in the past and the server is somewhere between it, how can I synchronize the ball over all instances and ensure, that it got ever hit by the paddle even if the paddle is fast moving? Currently my ball’s position is simply set by a server update, so it can happen, that the ball bounces back, even if the paddle is some pixel away (because of a delayed server position).

Until now I’ve got no synced clock over all instances. I’m sending a client step index with each update to the server. If the server did his job, he sends the snapshot with the last step index of each client back to the clients. Now I’m looking for the stored position at the returned step index and compare them. Do I need a common clock to sync the ball?

EDIT:
I've tried to sync a common clock for the server and all clients with a timestamp. But I think it's better to use an own stepping instead of a timestamp (so I don't need to calculate with the ping and so on - and the timestamp will never be exact). The physics are running 60 times per second and now I use this for keeping them synchronized. Is that a good way?

When the ball gets calculated by each client, the angle after bouncing can differ because of the different position of the paddles (the opponent is 200ms in the past). When the server is sending his ball position, velocity and angle (because he knows the position of each paddle and is authoritative), the ball could be in a very different position because of the different angles after bouncing (because the clients receive the server data after 100ms). How is it possible to interpolate such a huge difference?

I posted this question some days ago at stackoverflow, but got no answer yet. Maybe this is the better place for this question.

sentences:
Placing sprites properly to form an object I'm working with XNA in Visual Studio, and I'm trying to draw this sprite:
https://i.imgur.com/Dy5nSuG.png

Only using this sprite:
https://i.imgur.com/6T8TeTQ.png

My current attempt relies on a matrix boolean, which then gets drawn in a foreach loop:

//Variable
 bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } };

//Loop
 foreach (bool b in centerPiece)
            {
                if (b == true)
                {
                    spriteBatch.Draw(squareTex, screenView(), null, Color.White, 0f, IMGCenter(), 1f, SpriteEffects.None, 0f);
                }
            }

While this draws all 5 squares, it doesn't place them as desired (because of they're all being drawn in the screenView() method placement(The center of the screen):

public Vector2 screenView()
        {
            Viewport viewport = GraphicsDevice.Viewport;
            Vector2 screenCenter = new Vector2(viewport.Width / 2f, viewport.Height / 2f);
            return screenCenter;
        }

How do I modify my loop to place the squares correctly, and/or do I need to change my implementation completely to achieve my desired goal?

Note: I need to both be able to access the object as a whole, and also access each individual square, in each individual object.

sentences: How do I get HDRP render enabled so that the shader graph will work I'm using Unity 2019.2.17 personal, and I imported the shader graph package and created a pbr shader graph.  I get a warning: the render pipeline is not compatible with the master node.  I assume it means I need to be using HDRP or LWDRP.  I can't figure out how to enable HDRP.  How do i do this?

sentences:
Round position to center of current grid position The title may not make sense, nor may the question - I'll try nevertheless.
I'm attempting to make a game similar to The Powder Toy.
Essentially, this is a physics simulation game, where the users create various structures using the provided materials.
As of now, I've created the grid, and given the user the ability to draw with grey cells (or, Stone).
Of course, this may seem like what I would want - however, all the cells are stored in a two dimensional array. When the user clicks on the screen, the program round the x and y of the cursor to the grid, and adds to the array like that.
What I want to happen is for the cell to change in the place of the cursor, instead of rounding it to the nearest cell.
I've attempted to explain it in this image:

In this image, the green large dots are the mouse position, and the place at which the arrows are pointing are examples of where the cell could be.
Green represents what I want to happen but in most cases doesn't, and red is what does happen, but what I don't want.

Here's part of my function to set the cells:

public void handleInput () {
    if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
        mouse_x = Gdx.input.getX();
        mouse_y = Gdx.input.getY();

        rou_mouse = new Vector2(round2px(mouse_x), round2px(mouse_y));

        set_px (rou_mouse, new Element_stone());
}

Where set_px sets a certain item, this is used to draw to the screen.
I hope this is enough information, but if you would need anymore to solve it, I'd be happy to update the post to include more code.

Oh, and I should probable mention I'm using LibGDX.

sentences:
Rule based procedural terrain generation How one generates procedural terrain is pretty straight forward. But once you setup your terrain you don't really have a fine level of control where which details will go.

One solution I can think of is to store rules as functions, i.e. Square, circle, etc., which will override rules in the area. For example, in mountains terrain we could place a function which will make them flat or terraced.

What I have trouble figuring out is how to store those functions (assuming terrains can be in principle infinite or at least planetary scale). Should they be placed within existing coordinate system, or stored locally to terrain ?

I seen something like that done in Star Wars Galaxies, but it's really hard to find any details about implementation of system.

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:
How do i set conditions for an IF statement as the game progress through "difficulty"? This is code that I wanted to put in my IF statement
    public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;

//Spawn Positions
Vector2 SpawnPosition;
float nextSpawnTime;

void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        randX = Random.Range(-5.6f, 5.6f);
        randY = 5.57f;
        SpawnPosition = new Vector2(randX, randY);
        Instantiate(fallingRockPrefab, SpawnPosition, Quaternion.identity);

    }

}

This is the code from my "Difficulty.GetDifficultyPercent"
    public static class Difficulty{
static float secondsToMaxDifficulty = 30;

public static float GetDifficultyPercent()
{
    return Mathf.Clamp01(Time.timeSinceLevelLoad / secondsToMaxDifficulty);
}}

I'm planning to make a certain event happen when my game bypass a certain stage of a difficulty as it progress but I just don't know what to put it as.
My guess is this,
if(Time.time > Difficulty(25))
but didn't work.

sentences:
How do I correctly use GetComponent to get the rigidbodies of each element in an array of colliders? I was trying to implement an AddExplosionForce-script that was shown in a Unity live training session a few years back. It has out of date calls to rigidbodies because it uses the old gameobject.rigidbody way of accessing them. I tried doing the standard process of

declare a rigidbody,
link it to a GetComponent<>, and
act on the rigidbody through the resulting variable.

However, as shown below, the rigidbodies I need to interact with are used in a foreach loop that goes through an array of colliders. How do I access the rigidbody of each collider in the array as it is used? (and if that is the wrong approach, please let me know). Will using GetComponent in that way harm performance?

Here is the original script from the video, w/ minor comments. I have left out my botched attempt at fixing it for the sake of brevity.

public class MassExplosionScriptOriginal : MonoBehaviour
{
    public float force;
    public float radius;

    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100))
            {
                Collider[] colliders = Physics.OverlapSphere(hit.point, radius);
                // overlap sphere collects all the colliders that it overlaps
                // with/touches. From  the point you click (hit.point), create a sphere of the
                // given radius (radius),collect all the colliders from the objects overlapped,
                // and then return them with the array colliders.

                foreach (Collider c in colliders) // declare a variable to hold a //collider
                {
                    if (c.rigidbody == null) continue;
                    // the if statement clause says that, if the collider touched //has no rigidbody, then skip it and continue on.

                    c.rigidbody.AddExplosionForce(force, hit.point, radius, 1, ForceMode.Impulse);
                    // Whenever you click, this script will collect all the
                    // colliders and then apply the explosive force to them. It works on everything
                }
            }
        }
    }
}

sentences:
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:
How can I incorporate physics into a procedurally generated world from a geometry shader? Essentially I want to remove the need for generating coherent noise from the CPU to the GPU. From there, I also want to generate the terrain for a three dimensional world using this noise as densities in voxel points. After this, I want to take those densities and polygonize (generate vertices) them representing the world's terrain.

This is fine and all. But, I also want to dynamically deform the world in real-time. Once I get to this point, I have a problem trying to get the vertices back to the CPU to do things like collision detection and all of the game computations that I want to involve on the CPU and not the GPU.

So the question is: how can I get a subset of the vertices back to the CPU for dealing with collisions among other things?

And one more question: is there an easy way to take a set of vertices and generate indices from them on the GPU?

I'm confused as well as to what kinds of shaders I should be using for these different things. I hear of people using a pixel shader for gathering densities and then using a geometry shader for dealing with the terrain generation from the vertices and then somehow incorporating a vertex shader to do the dynamic deformations.

I'm using C# 4.0, .NET 4.0, and XNA Game Studio 4.0.

sentences:
How to implement efficient Fog of War? I've asked a question how to implement Fog Of War(FOW) with shaders. Well I've got this working. I use the vertex color to identify the alpha of a single vertex.

I guess the most of you know what the FOW of Age of Empires was like, anyway I'll shortly explain it:

You have a map. Everything is unexplored(solid black / 100% transparency) at the beginning. When your NPC's / other game units explore the world (by moving around mostly) they unshadow the map. That means. Everything in a specific radius (viewrange) around a NPC is visible (0%transparency). Anything that is out of viewrange but already explored is visible but shadowed (50% transparency).

So yeah, AoE had relatively huge maps. Requirements was something around 100mhz etc. So it should be relatively easy to implement something to solve this problem - actually.

Okay. I'm currently adding planes above my world and set the color per vertex. Why do I use many planes ? Unity has a vertex limit of 65.000 per mesh. According to the size of my tiles and the size of my map I need more than one plane. So I actually need a lot of planes. This is obviously pita for my FPS.

Well so my question is, what are simple (in sense of performance) techniques to implement a FOW shader?

Okay some simplified code what I'm doin so far:

// Setup
for (int x = 0; x < (Map.Dimension/planeSize); x++) {
    for (int z = 0; z < (Map.Dimension/planeSize); z++) {
         CreateMeshAt(x*planeSize, 3, z*planeSize)
    }
}

// Explore (is called from NPCs when walking for example)
for (int x = ((int) from.x - radius); x < from.x + radius; x ++) {
    for (int z = ((int) from.z - radius); z < from.z + radius; z ++) {
        if (from.Distance(x, 1, z) > radius) continue;
        _transparency[x/tileSize, z/tileSize] = 0.5f;
    }
}

// Update
foreach(GameObject plane in planes){
    foreach(Vector3 vertex in vertices){
       Vector3 worldPos = GetWorldPos(vertex);
       vertex.Color = new Color(0,0,0, _transparency[worldPos.x/tileSize, worldPos.z/tileSize]);
    }
}

My shader just sets the transparency of the vertex now, which comes from the vertex color channel

sentences:
Why might a Projectile hitting a KActor only call HitWall, and not ProcessTouch? I have a Projectile subclass that seems to work fine. It travels, does Explode(), etc. But when it hits one of our KActors, I get a HitWall event but not a ProcessTouch event.

So my question is, why would a colliding actor trigger HitWall, but not ProcessTouch?

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:
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 should you structure your graphics system around your logic system? C++ & Cocos2d-x, but I think the issue is language-independent.

I just recently finished up writing the foundational logic for my game. The way I've decided to keep my logic and my graphics decoupled is by simply having two base objects: LogicBody and GraphicsBody. Any object that needs to show up in the game needs to be comprised of both. So far, so good.

However, I am struggling with the initialization and interaction framework. I'll explain:

1) How should I make sure the logic body and graphics body stay together (in hopes of maintaining code readability).

Should they? Take the case of object Monster. It will need a logic body and a graphics body. But should both of these be contained in one overarching Monster class? Won't accessing either internal structure become unnecessarily verbose (i.e. Monster->getGraphicsBody() every time). However, this makes initialization easy:

Monster::init();

Alternatively, it is possible to initialize both logic and graphics separately:

Logic::init(); Graphics::init();

How can I then keep them abreast/aware of each other though? This will create clutter too, as I will likely need to call setters on each at initialization to make sure they reference each other:

Logic::setGraphicPtr(); Graphics::setLogicPtr();

2) What is the appropriate way to change graphics: polling, logic-driven, or both?

In the simplest of cases, updating graphics is as easy as polling direction, isMoving, health, etc. However, let's say that I want to play a particular animation when the Monster gets hit. The easiest way seems to be to call the "getHitAnimation" of the graphics body from within the logic body at the time of being hit. The alternative is to poll, but it seems that a certain point you will be polling twenty different variables, which has the potential to make the graphics implementation indecipherable without reference to the logic class anyways.

3) Should a logic body have reference to its graphics body at all?

I understand how clean it would be to simply have the graphics body reference the logic body for rendering purposes, in which case the logic body has no business with the graphics body. But what about the case where logic body A has met logic body B, and graphics bodies A and B need to interact. How do I let graphics bodies A and B know where to look for another?

I want to know the best way to implement these parallel systems with the least amount of coupling. Pseudo code welcomed.

sentences:
How to calculate Pong ball's expected position perfectly (taking wall bounces into account) I'm writing a Pong clone where the player has to type a word in order to move the paddle. Because of this, I need a way to calculate the position of the ball immediately after it hits the CPU's paddle. For each letter the player types correctly, the paddle will move a little bit so that when the player finishes the word, the paddle is waiting for the ball to come. It needs to be very accurate, and relatively fast.

I was considering just simulating a much faster ball and figuring out where it will end up (the time it arrives is not important, but the position is). I'm worried that I'll run into problems down the line when the game speed starts ratcheting up, and the actual ball is going as fast as the simulated one. This normally wouldn't be an issue, but the way the whole typing thing works kinda relies on it.

The tough part of just using an equation to find the ball's position is the existence of walls. An equation would be preferable to a quick simulation/extrapolation but I fail to see how it would be done.

Thanks so much for any insight.

sentences:
Reloading scene in Unity gives weird result I am making an infinite racing game where you fly an airplane while trying to avoid obstacles. I recently finished my menu that comes up when you die. When I press the restart button that simply reloads the current scene like this:
SceneManager.LoadScene(1);
it gives me a weird result. The obstacles starts generating at about the same position as you died previously. I never get this problem when I start the game with the Unity play button. The only thing I could think off was player prefs. It should not affect the generation of obstacles but tried anyway to use:
PlayerPrefs.DeleteAll();
before reloading the scene, but that did not work. What could be causing this strange problem?

sentences:
Unity access method from separate script I'm learning Unity3D and I'm practising accessing game object scripts from other objects. For the most part I've got it down, but I've run into a weird issue causing a NullPointerException.

I've set up a GameObject, with the following script attached to it:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
public Player[] players;

// Use this for initialization
void Start () {
    players [0].currentPosition = 0;
    players [1].currentPosition = 1;
    players [2].currentPosition = 2;
}

// Update is called once per frame
void Update () {
    foreach(Player p in players)
    {
        if(p.mFormationType == Player.FORMATIONTYPE.ATTACK)
            p.transform.position = p.attackPositions[p.currentPosition];
        else
            p.transform.position = p.defensivePositions[p.currentPosition];
    }
}

public void swapPositions(Player selected)
{
    Debug.Log (selected.currentPosition);
    if(selected == null)
        Debug.Log("Balls - " + selected.gameObject);

    if(selected.currentPosition != 0)
    {
        int previousPos = selected.currentPosition;

        players[0].GetComponent<Player>().currentPosition = previousPos;
        selected.currentPosition = 0;
    }
}
}

And I've set the Player objects within the UI. I then later attempt to do this when I click on one of the Player objects:

void OnMouseOver()
{
    if(this.currentPosition == 0)
        return;

    if(Input.GetMouseButtonDown(0))
    {
        PlayerController pc = this.controller.GetComponent<PlayerController> ();
        pc.swapPositions (this);
    }
}

But it results in an NPE within the swapPositions method in the PlayerController class, when it attempts to access players[...]

I've stepped through and at the start of the PlayerController script they're all there and set up perfectly, but later on, they're null.

Can anyone explain why this is happening please?

Thanks in advance.

sentences:
Unitys [SerializeField] and parallel inheritance I have the following:

public class Item
{
    [SerializeField]ItemData _data;

    public ItemData data { get { return _data; } }
}

public class Weapon : Item
{
    [SerializeField]WeaponData _data;

    public WeaponData data { get { return _data; } }
}

public class ItemData : ScriptableObject { }
public class WeaponData : ItemData { }

It seems like a pretty common setup to me, data is separated from logic classes - and I can use single scriptable objects to define stats for alot of items.

However, Unity gives me this error message:

  The same field name is serialized multiple times in the class or its
  parent class. This is not supported:

I understand what's going wrong, but I don't get how to work around it, I want the data objects to inherit so I don't need to keep two (or more, further into inheritance) separate data objects per weapon.

I also need the item inheritance for inventory/merchant list management.
Using hiding screws up the serialization of the baseclass, which means I can't create default items - not feasible.

The issue is the same when using public instead of [SerializeField].

Any pointers?

sentences:
OpenAL seems to ignore sound attentuation/orientation for long sounds I don't know how else to describe it in the title, sorry.

My sound engine currently works perfectly with listener positioning and sound positioning to create the attentuation and panning effects.  At least, for short sounds.

I converted an .mp3 to .wav to test out playing a song from a specific point, but suddenly OpenAL ignores that the sound and the listener are not at the same place and just plays the song at full volume right in the center.

Has anyone ever had this problem before?  If so, just what is the problem?

EDIT:
If it helps, the song is stereo and the sounds are mono, all at 16 bits per sample.

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:
Doing an SNES Mode 7 (affine transform) effect in pygame Is there such a thing as a short answer on how to do a Mode 7 / mario kart type effect in pygame?

I have googled extensively, all the docs I can come up with are dozens of pages in other languages (asm, c) with lots of strange-looking equations and such.

Ideally, I would like to find something explained more in English than in mathematical terms.

I can use PIL or pygame to manipulate the image/texture, or whatever else is necessary.

I would really like to achieve a mode 7 effect in pygame, but I seem close to my wit's end. Help would be greatly appreciated. Any and all resources or explanations you can provide would be fantastic, even if they're not as simple as I'd like them to be.

If I can figure it out, I'll write a definitive how to do mode 7 for newbies page.

edit: mode 7 doc: http://www.coranac.com/tonc/text/mode7.htm

sentences:
Question about creating a sprite based 2-D Side Scroller with scaling/zooming I'm just wondering if anyone can offer any advice on how best to go about creating a 2-D game with zooming/scaling features akin to the early Samurai Showdown games. In this case it would be a side scroller a la Metal Slug, the zooming would come in as more enemy sprites entered the screen, or when facing a large sized boss. A feature that would be both cosmetic as well as functional to the game.

I've done some reading and noticed a few suggestions that included drawing different sized sprites, a standard size and zoomed out size.

Any thoughts?

Thanks for your time.

sentences:
Importing .anim files created using the Unity Animation controls Our artist created some .anim files using the built-in Unity Mecanim system (where you use keyframes and drag various body parts to construct the animation).

However, now we're trying to export them from her Unity program into mine so that I can incorporate them into the scene. The problem is that they're simply appearing as blank files.

Here, the files are importing and everything looks fine aside from the controller:

However, once it's imported, it just shows up as a blank/unrecognized file:

She's exporting everything as a .unitypackage and I'm importing the .unitypackage, but it doesn't work for some reason.

In addition, she was able to create a new project on her computer and import the package fine. Any ideas why mine is funking up?

sentences: What's the minimum viable product to present a game to a publisher? I am currently working on a puzzle game. I am aiming in the future to ask a publisher to publish it. What do you think could be the minimum viable product to reach before sending it. I am talking about the completeness of the work (number of levels, graphic details etc)

sentences:
Map scrolling around the world I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to make it like in the civilizations games that you can scroll around the world. But I am kind of stuck on how to implement that. I had the idea of checking if a tile was rendered and if there is still space to the left render next sibling and so on, but this would turn out into long loops. My map array (2d) holds all the tiles and every tile has a member which holds all the siblings. How would you solve this?

This is a screenshot from the example. You can check it out on http://civ.minerjs.com. The code is also available to browse on the site using developer tools. Thanks for reading!

sentences:
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:
Process Purchase Event get called on each App launch - iOS At present when I launch the app, each time ProcessPurchase event get called in iPhone device. Though upto now I have not pressed any purchase related buttons.

Yes I have setup subscription purchase within my app and before I have purchased subscription in sandbox environment two to three times but now their time period is expired.

Here you have debug log for actual event happening:

As per my past experience, ProcessPurchase event require to call only two times when a user purchase something or at restore purchase time.

So why its get called each application launch that I can't able to understand!!!

Please give some help in this so I can complete my Unity IAP related thing.

Source Code :
https://pastebin.com/bNpXsjHg

sentences:
Unity Photon multiplayer :: check distance between two players How to get distance between two player in a photon multiplayer game. Condition is both the player is moving.
I have tried something like this, in my player control script:

if (photonView.isMine)
pos1 = rigidBody.position;
else
pos2 = rigidBody.position;
Distance= Vector3.Distance(pos1-pos2)

But its not working. For a player the pos2 is always (0,0).
Please help.

sentences: Object detection in bitmap JavaScript canvas I want to detect clicks on canvas elements which are drawn using paths. So far I have stored element paths in a JavaScript data structure and then check the coordinates of hits which match the element's coordinates. Rendering each element path and checking the hits would be inefficient when there are a lot of elements. I believe there must be an algorithm for this kind of coordinate search, can anyone help me with this?

sentences:
Unity UI Input Field suddenly malfunctioned I'm using Unity 5.0.1f1, and my UI Input Fields are not working as they are supposed to.

I have an Input Field that is placed in a Panel and inside a Canvas.
It has a Text component in which I can set text that the Input Field will display.
When I change value of this Text component, the changes are not reflected on the Input Field, it seems to be reset to the value of Input Field (Script) \ Text of the Input Field.

If I enter Play mode, I can input text normally but when I build and run on my Android phone, I cannot input anything.

Has anyone encountered this problem? How can I solve this?

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:
rotating a sprite around a non-fixed center I'm trying to get this character to spin in a circle to aim at the cursor. It all works pretty well, but I can't get the image to rotate around its center. Only around its corner. I've been trying to find a solution be using some crazy trig stuff, but I'm not getting anywhere.

public void draw(Graphics g, double inter)
{
BufferedImage im;
Graphics2D g2d = (Graphics2D)g;
GImage gImage;

gImage = GImages.getImage(p.sprite);
im = gImage.imageFile;
AffineTransform at = new AffineTransform();
at.translate((p.xcord+((float)p.width/2))+(p.xspd*inter), (p.ycord+((float)p.height/2))+(p.yspd*inter));
at.rotate(p.angle+(Math.PI/2));
at.scale((double)gImage.xsize/im.getWidth(), (double)gImage.ysize/im.getHeight());
//at.translate(-(float)p.width/2, -(float)p.height/2);
g2d.drawImage(im, at, null);
g2d.setColor(Color.BLUE);
g2d.drawRect((int)p.xcord,(int)p.ycord,1,1);
//g.setColor(Color.BLACK);
//g.drawString(p.suh, (int)(p.xcord+(p.xspd*inter)), (int)(p.ycord+(p.yspd*inter)));
}

p is my sprite object, the cords make up the point of the corner of the image.
The sprite moves around the screen, so I can't use a fixed point method as far as I know.
If anyone has any suggestions to make this work.

sentences:
What technical questions do you need to be prepared to answer before presenting an idea to venture capitalists? A friend and I are planning on pitching an idea to venture capitalists in a few weeks at SIEGE 2010. He is handling the business plan side of things and all those related questions so I only need technical questions here. What types of things should I be prepared to answer about our project?

For reference its an economic game for mobile platforms(targeting android to start with).

EDIT-CLARIFICATION: I am aware that they may be more interested in non-technical questions, but my friend is handling that end. I am mainly concerned with technical questions as he should be able to field most of the rest.

sentences:
What happens when Time.time gets very large in Unity? As it is said here :

Time.time

The time at the beginning of this frame (Read Only). This is the time in seconds since the start of the game.

And as I know the time is stored in float. So, my question is what will happen when the value of time becomes very large? Can it overflow? Will it lose precision and cause bugs? Will the game just crash or what?

sentences:
Game Design: Colour units per team or per unit type? In an RTS game where the units are viewed from the top so that they appear relatively small on the screen:

What would be the best game design?

Colour the units per team, for example: enemy is always red, player's units is always blue
Colour the units per ability, for example: the "destroyer" is always red, the "collector" is always green, the "interceptor" is always blue, etc. This will only work with the assumption that the teams would never have the same units and that there are only a small number of different types of units per game.
A combination of 1 & 2 so that the enemy is always represented by warm colours and the friendly units with cold colours. Different unit types are represented by different shades of a colour.

If I choose (1) I am concerned that the player might get confused which unit is which and for example try to attack with the wrong unit type.

If I choose (2) I am concerned that the player might be overwhelmed with too many colours and will not be able to easily tell the enemy from the friendly units.

If I choose (3) I am concerned that it might confuse the players: e.g. say the "destroyer" was light red (enemy) in one game and the next game the player switches sides so that the "destroyer" turns light blue (friendly), the player might not recognize the unit as a "destroyer".

sentences:
Projecting a moon texture to the background I want to display a 2d moon image to the background. I have a normalized direction for the center location of my moon texture. I also have the normalized view direction from the camera for each pixel. I'm working in HLSL and I need to find the uv for the texture. How can I do this without the texture being distorted. I tried a variety of spherical uv mapping equations but none of them worked.
This post works but only if d is (0,0,1) in a right handed Y up coordinate system:
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?
It seems like you have to rotate the up righting right vectors with moon's location but how?

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:
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:
How do I draw a sprite on top of a video in Andengine? I'm playing a video in Andengine on

@Override
protected void onSetContentView() {}

However, when I place a sprite on the screen at some point in time, it is placed behind that video view. I want it to appear in front of it.

My attempt:

Entity foregroundLayer= new Entity();
foregroundLayer.attachChild(drag1);
scene.attachChild(foregroundLayer);

Setting setZIndex also didn't work

Here's a screenshot:

The world icon is half outside and half behind. It should be on top.

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:
How can I get a background image and game objects to fill black areas of letterbox or pillarbox? I have used the Aspect Ratio Enforcer to force my game's aspect ratio to remain as 9:16. I need to prevent some game objects and the backgrounds from being affected by the enforced aspect ratio to cover the black areas that result from other aspect ratios.
How can I prevent some game objects and background images from getting affecting by the Aspect Ratio Enforcer?

sentences:
How do I reconstruct depth in deferred rendering using an orthographic projection? I've been trying to get my world space position of my pixel but I'm missing something.

I'm using a orthographic view for a 2.5d game. My depth is linear and this is my code.

    float3 lightPos  = lightPosition;
    float2 texCoord = PostProjToScreen(PSIn.lightPosition)+halfPixel;

    float depth = tex2D(depthMap, texCoord);

    float4 position;

    position.x = texCoord.x *2-1;
    position.y = (1-texCoord.y)*2-1;
    position.z = depth.r;
    position.w = 1;
    position = mul(position, inViewProjection);
    //position.xyz/=position.w; // I comment it but even without it it doesn't work

    float4 normal = (tex2D(normalMap, texCoord)-.5f) * 2;
    normal = normalize(normal);

    float3 lightDirection = normalize(lightPos-position);
    float att = saturate(1.0f - length(lightDirection) /attenuation);
    float lightning = saturate (dot(normal, lightDirection));

    lightning*= brightness;
    return float4(lightColor* lightning*att, 1);

I'm using a sphere but it's not working the way I want. I reproject the texture properly onto the sphere but the light coordinates in the pixel shader seems to be stuck at zero even if I move the light volume update properly.

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:
Why is my sprite leaving copies as it moves in Monogame? I am pretty new to Monogame, and I'm trying to draw a character sprite and move it using keyboard. Instead of moving to different positions, it leaves a track of copies along the way.

I have 2 game states; one is the menu, and the other one is the level, where the sprite is called to draw.

Why is my sprite leaving copies as it moves in Monogame?

Player.cs

class Player : Entity
{
    private float velocity;
    private int hp;
    public Texture2D texture;
    public Rectangle hitbox;
    public Vector2 pos;
    KeyboardState oldState;

    public void Init(ContentManager content)
    {
        texture = content.Load<Texture2D>("char");
        hitbox.Width = texture.Width;
        hitbox.Height = texture.Height;
        velocity = 150f;
        pos.X = 100;
        pos.Y = 100;
    }

    public void Update(float delta)
    {
        KeyboardState newState = Keyboard.GetState();

        if (newState.IsKeyDown(Keys.D))
            pos.X += 100 * delta;
        if (newState.IsKeyDown(Keys.A))
            pos.X -= 100 * delta;

        oldState = newState;
    }

    public void Draw(SpriteBatch sb)
    {
        sb.Begin();
        sb.Draw(texture, pos, Color.White);
        sb.End();
    }
}

Level1.cs

class Level1 : State
{
    private Texture2D background;
    public Player player;

    public void Init(ContentManager content)
    {
        //background = content.Load<Texture2D>("Level1/bg");
        player = new Player();
        player.Init(content);
    }

    public void Update(float delta)
    {
        player.Update(delta);
    }

    public void Draw(SpriteBatch sb, GraphicsDeviceManager graphics)
    {
        player.Draw(sb);
    }
}

Game1.cs

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    State CurrentState;
    KeyboardState oldState;

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

    void SetState(State state)
    {
        GraphicsDevice.Clear(Color.White);
        CurrentState = state;
        CurrentState.Init(Content);
    }

    protected override void Initialize()
    {
        SetState(new MenuState());
        graphics.PreferredBackBufferWidth = 1920;
        graphics.PreferredBackBufferHeight = 1080;
        graphics.IsFullScreen = true;
        graphics.ApplyChanges();
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
    }

    protected override void Update(GameTime gameTime)
    {
        KeyboardState newState = Keyboard.GetState();

        var delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

        CurrentState.Update(delta);

        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.F)
            && oldState.IsKeyUp(Keys.F)))
        {
            SetState(new Level1());
        }

        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.Escape)
            && oldState.IsKeyUp(Keys.Escape)))
        {
            this.Exit();
        }

        if (CurrentState is Level1 && (newState.IsKeyDown(Keys.Escape)
            && oldState.IsKeyUp(Keys.Escape)))
        {
            this.Exit();
        }

        base.Update(gameTime);
        oldState = newState;
    }

    protected override void Draw(GameTime gameTime)
    {
        CurrentState.Draw(spriteBatch, graphics);
    }
}

sentences:
Unity3D - GameObject as a static function Newbie Unity3D/C# developer here.
I've tried learning Unity3D during my May/June college vacation and came across a problem:Code 1:

CameraObj returnVoid;

void Start ()
{
    returnVoid = GameObject.Find ("Main Camera").GetComponent<CameraObj> ();
    returnVoid.ComponentType ();
}

Code 2:

GameObject returnDirectLight;

void Start ()
{
    returnDirectLight = GameObject.Find ("Directional Light");
    Debug.Log (returnDirectLight.GetComponent<DRLight>().directionString);
}

CameraObj is my custom component.
As far as I know, GetComponent is actually a public method. I understand the logic behind Code 2. What I fail to understand is Code 1. How does GetComponent become a static function here? Does it become abstract in my CameraObj class?

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: Follow a path in Unity I want to know how I can make this game object follow the specified path in unity

sentences:
Realistic Trajectory of a Projectile When simulating an airplane and a missile, to get them moving in the air we apply a force in one direction. Now an airplane has wings that keeps it afloat while a missile can have fins to stabilize it. In both cases when the force is no longer strong enough, the velocity reduces and the projectiles are bound to succumb to gravity. When that happens, the projectiles naturally don't fall directly to the ground disregarding rotation and other spins based on air resistance and whatever momentum there is left.

My question is, to simulate such behavior how would the Bullet, Nvidia PhysX and Havok physics libraries compare against each other especially with emphasis to the following?

Gravitational pull and momentum acting on the projectiles.
Air resistance acting on the projectiles.
Both 1 and 2 above's behavior can be based on varied levels of a central forward force applied on the projectiles.

sentences:
What is the better form of movement for a vehicle that the player is inside of? I am using unreal engine 4 to make this. Basically I have a submarine that the player can move around in and can control the submarines movement within an ocean. However I don't know the best way to implement movement of that submarine. I thought of several ideas. The first one being just moving the whole submarine model and all the objects inside of it within the terrain. However I am worried about moveable objects within the submarine glitching out because of this.

Another idea I had was setting a basic cube that is about the same size as the whole submarine model as a sort of "dummy" submarine that moves around the terrain and its movement is controlled by the controls inside of the actual submarine. However with this idea I don't know how having two areas loaded would work (the contents and models within the actual submarine and the terrain around the dummy one). Is it possible to have two loaded areas in an level at once? How can I implement it?

sentences:
How Can I Fix Where The Tile Spawns? I am making a 3D game in Unity and C#. I want to spawn another tile when the player is at the end of the current tile. But when I spawn the next tile it doesn't spawn at the right place(just after the current tile). How can I fix this?

Thanks

Old Code:

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

public class Terrain : MonoBehaviour
{
    public List<GameObject> objs = new List<GameObject>();
    public GameObject terrain;
    public GameObject player;
    private float z = 4130.875f;
    private float safeZone = 260.0f;
    private float tileLength = 260.0f;
    private int animTilesCount = 2;
    void Start()
    {
        for (int i = 0; i < animTilesCount; i++)
        {
            spawnTile();
        }
    }
    void Update()
    {
        if (player.transform.position.z - safeZone >= (z - objs.Count * tileLength))
        {
            spawnTile();
            DeleteTile();
        }
    }

    public void spawnTile()
    {
        GameObject go;
        go = Instantiate(terrain) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * z;
        Debug.Log(z);
        Debug.Log(Vector3.forward * z);
        Debug.Log(go.transform.position);
        go.transform.rotation = terrain.transform.rotation;
        objs.Add(go);
        z += tileLength;
    }

    public void DeleteTile()
    {
        Destroy(objs[0]);
        objs.RemoveAt(0);
    }
}

That's the position of the current tile.

The correct position for the next tiles would be (6.103516e-05, 3.051758e-05, z).
They have to spawn after the current tile.

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:
OpenGL - What steps to take to correctly set up an Uniform Block Array I have managed to get uniform blocks to work, but I seem to make something wrong when trying to setup an array of uniform blocks.

Assume this glsl:

layout(std140, binding=1) uniform LightingBlock
{
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 factors;
    float shininess;
} lighting[3];

What's the exact procedure to bind this? What I am doing (and what works for a single block, not an array):

GenBuffer...
BindBuffer...
BindBufferRange(UNIFORM_BUFFER, 1, buffer_id, 0, size_in_bytes)
index = GetProgramResourceIndex(program_id, UNIFORM_BLOCK, "LightingBlock")
UniformBlockBinding(program_id, index, 1);

I read that I should replace the LightningBlock with lighting[0], [1] etc, but this only returns invalid indices. So my current attempt looks like this:

GenBuffer...
BindBuffer...
binding = 1
for(int i = 0; i < 3; ++i)
{
    BindBufferRange(UNIFORM_BUFFER, binding + i, buffer_id, 0, size_in_bytes)
    index = GetProgramResourceIndex(program_id, UNIFORM_BLOCK, "lighting[" + str(i) + "]")
    UniformBlockBinding(program_id, index, binding+i);
}

What am I doing wrong? How to do this correctly?

sentences:
With Monogame is it possible to await SoundEffect or SoundEffectInstance before playing another SoundEffect or Song? I am trying to do some proof of concept work using Monogame, mostly for my own knowledge.  One thing I am having trouble with, however, is timing sounds effects and background music to my liking.

So in my scenario I would like to play a series of SoundEffect objects when the game first loads, and when those effects have finished, play a Song in the background until the game is finished.  When either the player or computer meets victory conditions the game will end, which involves stopping the background Song, playing a win/lose SoundEffect, and loading the end screen.

Here's where I started:

var open0 = Content.Load<SoundEffect>("Open0");
var open1 = Content.Load<SoundEffect>("Open1");
open0.Play();
open1.Play();
bgMusic = Content.Load<Song>("BGTrack");
MediaPlayer.Play(bgMusic);
MediaPlayer.IsRepeating = true;
MediaPlayer.Volume = 0.25f;

This approach ends up just playing all three items simultaneously.  Its more noise than good game experience.

I also tried moving the Play() method calls into an async method and using await on the threads, but of course Play() doesn't return Task so that didn't work. Likewise, SoundEffectInstance and DynamicSoundEffectInstance don't seem to offer any kind of awaitable method calls, unless I'm missing them.

I also tried wrapping subsequent calls in a while loop, using the SoundEffectInstance.State property as my logic control:

var open0 = Content.Load<SoundEffect>("Open0");
var open1 = Content.Load<SoundEffect>("Open1");
SoundEffectInstance open0Instance = open0.CreateInstance();
SoundEffectInstance open1Instance = open1.CreateInstance();

open0Instance.Play();
while (open0Instance.State != SoundState.Playing)
    open1Instance.Play();

while (open0Instance.State != SoundState.Playing &&
        open1Instance.State != SoundState.Playing)
{
    bgMusic = Content.Load<Song>("BGTrack");
    MediaPlayer.Play(bgMusic);
    MediaPlayer.IsRepeating = true;
    MediaPlayer.Volume = 0.25f;
}

Ugly code, but I was trying to figure out what would work...and this didn't.  The first sound played and nothing else, so I'm guessing the State property doesn't implement INotifyPropertyChanged (although I'm not even sure that's relevant outside of MVVM now that I think about it).

The sounds at the end of the game are not giving me trouble because I can simply stop the MediaPlayer and play my closing Effect:

MediaPlayer.Stop();
gameObjects.PlayerWinEffect.Play(1.0f, 0.0f, 0.0f);

So is there a way to control SoundEffect and MediaPlayer timing more explicitly?

sentences:
Simulating sun 3d direction At the moment I got the following to simulate the suns direction:

void Sun::Update()
{
    if (!mIsMoving)
        return;

    const auto now = Clock::now();
    const auto timeDiff = now - mTimeStart;
    const float count = std::chrono::duration_cast<Intervall>(timeDiff).count();

    assert(mNightDayRatio <= 1.0f);
    if (count >= 0.5f + 0.5f * mNightDayRatio)
        mTimeStart = now;

    const float angle = count * glm::two_pi<float>() - glm::pi<float>();

    mDirLight.mLightDirection = Vec3(glm::cos(angle), glm::sin(angle), glm::sin(angle));
}

The problem is at the extremes the shadows from the sun (a directional light) become really "distorted"/"too long". I don't need a terribly complex solution just something that gives somewhat realistic sun direction over time.

Any ideas?

sentences:
Simplest way to generate a random path What's the simplest way to generate a random "path" for a level in a game? I don't know what search terms I should use to read more. I've looked into maze generation but thats not quite right.

The end result should look like this:

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

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

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

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

In render method

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

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

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

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

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

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

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

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

sentences:
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:
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:
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:
Paddle will not *continue* to move, pong game, XNA I'm making a pong game, and my paddles no longer continue to move after holding down the left thumbstick or dpad down. It simply moves once with each press. I think it is because I'm not checking for a LastKeyPressed anymore now that I've begun to use a new input class, which uses arrays to check for which controller is being uses, and that's not what I was using before.

I've got to store the previous state, but I'm not sure of how to o that with these arrays.

// From my input class:

  public Input()
    {
        // Get input state
        CurrentKeyboardState = new KeyboardState[MaxInputs];
        CurrentGamePadState = new GamePadState[MaxInputs];

        // Preserving last states to check for isKeyUp events
        LastKeyboardState = new KeyboardState[MaxInputs];
        LastGamePadState = new GamePadState[MaxInputs];
}

    /// <summary>
    /// Helper for checking if a button was newly pressed during this update.
    /// The controllingPlayer parameter specifies which player to read input for.
    /// If this is null, it will accept input from any player. When a button press
    /// is detected, the output playerIndex reports which player pressed it.
    /// </summary>
    public bool IsNewButtonPress(Buttons button, PlayerIndex? controllingPlayer, out PlayerIndex playerIndex)
    {
        if (controllingPlayer.HasValue)
        {
            // Read input from the specified player.
            playerIndex = controllingPlayer.Value;

            var i = (int)playerIndex;

            return CurrentGamePadState[i].IsButtonDown(button) && LastGamePadState[i].IsButtonUp(button);
        }
        else
        {
            // Accept input from any player.
            return IsNewButtonPress(button, PlayerIndex.One, out playerIndex)
                    || IsNewButtonPress(button, PlayerIndex.Two, out playerIndex)
                    || IsNewButtonPress(button, PlayerIndex.Three, out playerIndex)
                    || IsNewButtonPress(button, PlayerIndex.Four, out playerIndex);
        }
    }

    // Tells the left paddle to move down
    public bool LeftDown(PlayerIndex? controllingPlayer)
    {
        PlayerIndex playerIndex;

        return IsNewKeyPress(Keys.Down, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.DPadDown, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.LeftThumbstickDown, controllingPlayer, out playerIndex);
    }

    // Tells the left paddle to move up
    public bool LeftUp(PlayerIndex? controllingPlayer)
    {
        PlayerIndex playerIndex;

        return IsNewKeyPress(Keys.Up, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.DPadUp, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.LeftThumbstickUp, controllingPlayer, out playerIndex);
    }

// And now from my Gameplay class:

public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
........
input.Update();
            // Controls movement of the bats
            if (rightBat.GetType() != typeof(AIBat))
            {
                if (input.LeftDown(ControllingPlayer))
                {
                    leftBat.MoveDown();
                }
                else if (input.LeftUp(ControllingPlayer))
                {
                    leftBat.MoveUp();
                }

                if (input.RightDown(ControllingPlayer))
                {
                    rightBat.MoveDown();
                }
                else if (input.RightUp(ControllingPlayer))
                {
                    rightBat.MoveUp();
                }

// From my bat class, so that you see what the MoveUp and MoveDown functions do:

    public Vector2 GetPosition()
    {
        return position;
    }

    public void MoveUp()
    {
        SetPosition(position + new Vector2(0, -moveSpeed));
    }

    public void MoveDown()
    {
        SetPosition(position + new Vector2(0, moveSpeed));
    }

sentences:
Use of synthetic vs. natural sounds in modern large games Wondering generally how sounds are created for a large game such as Halo or Mario. Obviously 8-bit games probably used synthetic sounds (like regular Mario), and modern games have prerecorded voices in them. But I'm wondering sort of how much natural sounding synthetic sounds are used in a large game. In reading about documentaries and movies, a lot of the time they have microphones and go around in nature (or have a sound studio) and record "natural" sounds. Also, some of the iPhone sounds like the bell and whatnot sound like real sounds, though not sure if they were programmatically generated / synthetic.

More specifically, wondering what an example of a game is that uses synthetic sounds (that sound realistic) extensively. I would like to learn what is possible with synthetic sounds as opposed to natural sounds, to see how realistic they can be. Then from there I might be interested in looking into how those realistic synthetic sounds are made.

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:
How Use loop's in cocos2d-x I've for loop which work well on Windows

double speed = 35;

    for(int i=0; i<60 ;i++){

        speed += 0.3;
        Sleep (1000); // sleep 1000 mili seonds

     }

But it responds an error on cocos2d-x.what should i do in cocos2d-x.
In my code i want to increase my speed to N unit every X second.

auto Action = MoveBy::create(3  *   visibleSize.width,Point(-visibleSize.width * speed, 0));

My way is right or should I do something else

sentences: Running multiple game servers on single host I want to use a vps/dedicated server for game hosting. I expect hosting a lot of servers on that. For the connection, should I assign a unique port for every server or change IPs for every server. And how would these 2 options impact on the game, if I had multiple vps/dedicated servers.

sentences: Implementing Positional Sound I am trying to put 3Dish audio in a game I'm developing, and I'm unsure how to do positional sound. I want to be able to adjust the volume of the audio's channels depending on how far it is and the orientation.

sentences:
Pygame 2D Scrolling Map I have currently a pygame program that stores tiles in a 2d list like

[[1,1,1]
 [1,1,1]
 [1,1,1]]

where the 1 is a tile object. I have the character centered in the middle of the screen, and I am trying to find the best way to make it so the 'camera' scrolls along with the character. I suppose I could have it so that it only draws the tiles that are in the current window range, but I feel like this will cause problems later. My goal is to have the an entire map, say 100x100 tiles that are drawn but only a small section is shown. So the enemies I generate would still be walking around the map, and things would be going normally except I can only see a small part of it. Is there a way I can take advantage of surfaces in pygame to do this more effectively?

Some relevant code.

def drawMap(self, screen):
    for y in range(self.height):
        for x in range(self.width):
            self._mapData[y][x].draw(screen, x*48,y*48)

This is in the TileMap class and each index is a Tile object, which has a draw method. My initial idea was to change both the range() calls to draw only the area of the map I want to but then I don't know how to account for enemies off the screen because they are defined by their x and y location relative to the TileMap I create.

I am thinking there is maybe something I can do with a larger pygame surface object that I do not realize so I figured I would ask this here.

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:
Unity UI making it responsive I am attempting to create a simple Jeopardy game using the UI features of Unity:

However as im trying to change the size of the screen it does not seem that my UI is responsive:

Here is it in 16:9:

Here it is in 600x900

My Question is. is there a way to make it responsive?

Is it even nessary to do so in unity or am i thinking way to much web based? :)

Hope someone is able to help me and guide me abit

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: Automated performance testing I'm wondering if there's anyway of automatically testing the performance of my game on multiple configurations because I know a game runs well on my computer but how do I know how well my game performs over a variety of hardware? Do I just simply have to rely on player feedback?

sentences:
How do you break apart art into components for animation? I am a programmer and brand new to the game world, trying to get a sense of what it would take to draw simple characters like you'd see in Don't Starve or indie games like that.

I have seen in their forums images of the characters all broken up into pieces, and found Spriter for windows, and eventually Spine 2D for mac which looks amazing. They have many tutorials that show taking a set of images, applying them to a skeleton, and animating them.

My question is, what is the workflow for creating the characters so you end up with all of these character parts, which you can then use in a skeletal animation?

Do you open up photoshop or some image editor, and just start drawing a foot or an eye?
Or do you draw the whole character first, and then methodically go through and break it apart into individual images?
If so, what is your workflow for doing that? In some of these broken apart images (like the above), many of the pieces overlap in some way.
So it's like, if you draw a complete arm, and then break it up into a hand, a forearm, and an upper arm, in the process of breaking it apart, you would have a technique for somehow closing off the ends where you made the cut, so it is "ideal" for animating. Is there a technique for this?

This is probably a really basic question.. I have been learning to draw by hand and wonder what things you want to pay attention to if you were preparing them for a game.

sentences:
Android collision detection of a 3d object based on a 2d projection I am writing a game for android. We have an orthographic view setup, but the characters (ships, projectiles, etc). The enemies / characters will be able to rotate about the x axis. The problem is that I want to do the collision detection as if it were in 2d using sprites, meaning that if i have a ship with a top down view of

---------
--------------
-----------------
--------------
---------

it might rotate to look like

-----
--------------
---

and i want to do all of the collisions based off of the appearance of a top down view. I was originally thinking of using glReadPixels, until I read that was unbelievably slow. Then I was thinking about using pre-rendered bitmaps, but that seems like a pain and not very great since some of our ships won't be 'normal' enough to just say "Have a bitmap for every 45 degrees of rotation about the X". Does anyone have any suggestions?

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:
Why is my model flickering when translating I have several models here. When they stand still during gameTime, there's no flickering.
But as soon as I move them across the x-axis, they flicker on some places.

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

    Matrix[] transforms = new Matrix[myModel.Bones.Count];
    myModel.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in myModel.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index] *
                Matrix.CreateRotationY(modelRotation)
                * Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition,
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio,
                1.0f, 10000.0f);
        }
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Why is that happening and what could I do to prevent it?

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

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

void Update()
{

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

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

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

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

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

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

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

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

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

Help would be really appreciated

sentences:
Why does this code not update my object's position? I am trying to move the object in my frame in Time.deltaTime. I have not taken care the speed yet  but the problem is, the object is almost at position (0,0) after I have multiplied the x & y axis with Time.deltaTime. I want it to appear randomly on the screen in a given range. The update function is given below:

function Update ()
{

  var x = Random.Range(-4.37,4.34) * Time.deltaTime;

  var y = Random.Range(4.45,-4.66) * Time.deltaTime;

  var velocity = Vector3(x, y, 0);

  transform.position = velocity;

}

sentences:
How to use RSSetScissorRects with multiple rects? I try this and work only first rect.

D3D11_RECT rc[2];
rc[0] = {0, 0, 16, 16};
rc[1] = {32, 32, 64, 64};

m_d3d11DevCon->RSSetScissorRects( 2, rc );

sentences:
Space invader barrier implementation algorithm I've been struggling with implementing the space invader bullet to barriers. I wanted right now to blast a circle around, when the bullet hits the barrier and modifies the circle. As shown in the video, the algorithm looks wrong, http://youtu.be/VMBczCsP3J4
I have tried my best to debug it, but I've failed.

here is the algorithm:

// if there is intersection
    if (IntersectsWith((*it)->BoundingRect, barrierRect))
    {
        // subtract (*it) bullet position from barrrier's rect
        int normX = (*it)->Position.x - barrierRect.x;
        int normY = (*it)->Position.y - barrierRect.y;

        // barrier image pixels
        uint32* ptr = (uint32*)pixels;
        // height of the barrier
        int y = 31;

        for (int i = 0; i < 31; i++)
        {
            int pixelOffset = y + normX * 51;
            int color = ptr[pixelOffset];
            // look up the color if its not black, it should be green
            if (color != 0xFF000000)
            {
                // delete the bullet
                Bullet *bullet = *it;
                it = ship->Bullets->erase(it);
                delete bullet;
                ship->Canfire = true;
                isCollision = true;

                // blast a circle around that bullet hit position
                int radius = 9;
                for (int y = -radius; y <= radius; y++)
                {
                    for (int x = -radius; x <= radius; x++)
                    {
                        if (x*x + y*y <= radius*radius)
                        {
                            int j = x + normX;
                            int i = y + normY;
                            int pixelOffset = j + i * 51;
                            ptr[pixelOffset] = 0xff000000;
                        }
                    }
                }
                break;
            }
            // go up
            y--;
        }

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:
3D open source physics engine suitable for mobile platforms (Android and iOS) I have made some research and found that bullet, ode, newton and some others are open source physics engines that should be portable enough (but I have never tried to comile/use anyone of them on phones). I am writing my games for mobile platforms in C++, so the engine should be C or C++. I need a fast engine, since mobile platforms have limited resources. I need a free engine. A good design would be nice to have too.

What engine is best suited for my task?
What I really would like to hear from you is your direct experience.

Documentation and support (for example, forum or an IRC channel) is a really important aspect to take into consideration.

sentences: How to avoid ai hands or any body part going inside wall or ground? (Unreal Engine4) Whenever my character get killed near wall his hands or any body part its goes through the wall making it look like half of the hands front of wall and another half through back. but i dont like it.. i want it look like modern game where if i killed him near wall it should be realistic where his body part should change posistion according to it. like lifiting his hand because he cant put his hands through wall and also i made a little mistake in my death animation making the hands below the ground so whenever he get killed his hands go through ground.. so how to make this work?

sentences: Unity - Cube edges are jagged I am new to Unity. I have a basic setup following Brackeys tutorial. When in game mode, I see the red cube having jagged edges. I tried increasing the antialiasing in Unity to 8x but it did not work. I also tried turning on antialiasing in my Nvidia control panel. But the issue still persists.

sentences:
How can I animate a colour change over hue/saturation/value instead of RGB in Blender? If I create a keyframe for a colour in Blender (I'm using 2.6) it always seems to traverse the RGB values for the animation, even if I set the colour using HSV values.

I do this by setting the colour, using HSV, then pressing i over it.

How can I animate the HSV values rather than the RGB values?

sentences:
Problem with rendering multiple textures from same image (LWJGL 3) I have started with LWJGL3 and trying to built game engine. I'm stuck on generating terrains.
I have one image that contains two textures.

So now for example I want to generate terrain with only texture 2, so my texture coordinates looks something like this :
textures :
(0.6f,0f)
(0.9f,1f)
.....

Everything is fine if terrain is not long, but if I stretch terrain on z-axis, terrain is using texture 1.
As you can see on image.
I just can't understand why is doing that ?

sentences:
How to differentiate between instantiated objects in Unity? I'm currently trying to solve a way to go about the following problem before I start writing any code (the old fashioned pen and paper way) but I'm not sure how I could achieve the following.

I'm going to have an object with a Collider attached to it in my scene. As my instantiated enemies pass through this Collider they will be added to an ArrayList which lets the object in question keep track of the enemies. The problem I can't figure out is how to determine which object is which.

I will have a script attached to my main camera which will be responsible for spawning the enemy units, I'll be using a while loop in sudo code it would look something like this.

public Transform; (Attach the prefab in the inspector)

Somefunction() {

int i = 0;
arraylist goes here;

while (i < 10) {
arraylist[i] = Newly instantiated object.

}
}

My object with the collider will then have something like the following:

OnTriggerEnter() {
get specific object somehow
add to arraylist
}

I can't use the tag function because all the objects will have the same tag, the only thing I assume will be different is the position of the object in the spawn array (ie: arraylist[1] arraylist[2] etc.)

If I created a public accessor method on the trigger object could I call this method to return a string name or something special that identifies the object uniquely compared to the rest of the objects in the scene or does Unity already do this somehow natively?

sentences:
How to save an arbitrarily large image to a file in XNA? I have built a level editor for an XNA-based Megaman clone I am working on and one of the features I would like to implement is the ability to save a full-resolution map of the entire level (like this one). My problem is that the levels can be arbitrarily large and XNA has a texture size limit of 4028x4028. I don't need to use the texture for anything in the editor itself, only to save it to disk.

I have stored the image data in an array using game.GraphicsDevice.GetBackBufferData, but I am having trouble finding a way to store this to disk in a readable format (preferably PNG). Everything I've found online says to use the Texture2D.SetData and Texture2D.SaveAsPng methods, but those calls are restricted to the 4028x4028 max texture size.

Any suggestions?

Note: I do realize that the example map I linked above was likely created by hand and while I could certainly output multiple full-resolution images of each screen and put them together by hand in Photoshop, I would like the process to be available directly in the editor if possible.

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:
What is grid in Unity and how can I implement it? I'm a beginner. I need to place a grid on my map in Unity and would like to access it to place a simple object on mouse click. How can I achieve this ?

I am unable to understand the grid functionality, should I have to write code for a 2D array or is there something in Unity that I can access, and what is basically the grid like something when I click my background image ?

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:
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:
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:
How to make an articulated mob in Minecraft? I am attempting to make a sea serpent, and I want to know how to make it be able to turn in any place, or at each 'segment', somewhat like the snakes in mocreatures. I know how to make mobs in general, rendering and modelling, as well as AI, so it's just this single element.

I am using Forge if that helps.

sentences:
iOS: OpenGL ES 2.0 render texture with glScissor performance I have drawn image with OpenGL and will redraw tile of its texture (non filled area).

Which case will work faster?

Set glViewport with full texture's rect, draw full texture and use glScissor with updated area's rect.
Set glViewport with updated area's rect and draw tile of texture with calculating its texture coordinates.

I've found in Apple's documentation, that scissor test is called after fragment shader. Does this mean, that fragment shader will work with pixels of full texture? How slower will it be rendered than case 2?

SOLVED:
I've viewed pipeline scheme of OpenGL ES 2.0 here. Scissor test is done before fragment shading and allow to optimise rendering.

sentences:
Proper use of texture units I'm a beginner using OpenGL v3.3 on C# with SharpGL. I have a simple scene with a Skybox and some OBJ Models. Both the skybox and models have multiple textures. Currently what I do is that I load all the textures used in the scene into different texture units at once program launch and then while rendering each element in the scene I just change a uniform variable to reflect the correct texture unit and render the vertices. Doing this could get me into trouble if there are more textures in my scene than texture units on the GPU, so I'm not sure if this is the right approach.

I would like to know what the standard practice for such a scenario. Do you just (re)load the texture for each element into say fixed texture unit 0 on every draw call or what?

sentences:
d3d11 black texture when manually creating from image (Rust) I am trying to create a ID3D11Texture2D from a RgbaImage loaded from a .jpg. The below code produces no errors. However, the texture is black when it is actually rendered. I know the standard way to load textures is through the DirectXTex library, but I was having issues linking with it and can't find any premade Rust bindings.

Should the below code/settings work to create a working ID3D11Texture2D?
Is there a way to view the contents of a ID3D11Texture2D in order to debug?
Are there DirectXTex bindings for Rust?

fn load_resource_from_file(device: &Device, path: &Path) -> error::Result<Texture> {
    unsafe {
        let image = Reader::open(path)?.decode()?.to_rgba();

        let mut sample_desc = dxgitype::DXGI_SAMPLE_DESC::default();
        sample_desc.Count = 1;
        sample_desc.Quality = 0;

        let mut desc = d3d11::D3D11_TEXTURE2D_DESC::default();
        desc.Width = image.width();
        desc.Height = image.height();
        desc.MipLevels = 1;
        desc.ArraySize = 1;
        desc.Format = dxgiformat::DXGI_FORMAT_R8G8B8A8_UINT;
        desc.Usage = d3d11::D3D11_USAGE_DEFAULT;
        desc.SampleDesc = sample_desc;
        desc.BindFlags = d3d11::D3D11_BIND_SHADER_RESOURCE;
        desc.CPUAccessFlags = 0;
        desc.MiscFlags = 0;

        let mut data = d3d11::D3D11_SUBRESOURCE_DATA::default();
        data.SysMemPitch = (image.sample_layout().width_stride * mem::size_of::<Rgba<u8>>()) as u32;
        let buffer: Vec<u8> = image.into_raw();
        data.pSysMem = buffer.as_ptr() as *const _;
        data.SysMemSlicePitch = buffer.len() as u32;

        let mut texture = ptr::null_mut();
        device.as_ref().CreateTexture2D(
            &desc,
            &data,
            &mut texture,
        ).result()?;
        let texture = NonNull::new(texture).ok_or(null_ptr_err!())?;

        drop(buffer);

        let mut resource_view = ptr::null_mut();
        device.as_ref().CreateShaderResourceView(
            &**texture.as_ref() as *const d3d11::ID3D11Resource as *mut _,
            ptr::null(),
            &mut resource_view,
        ).result()?;
        let resource_view = NonNull::new(resource_view).ok_or(null_ptr_err!())?;

        Ok( Texture(Arc::new(TextureInner {
            texture,
            resource_view,
        })))
    }
}

sentences:
How do I switch between the game screen and score screen without redrawing everything? I'm working on a multiplayer game in Libgdx and  want to display the scores of say, the top 10 players on the map. The player should be able to checking the scores at any point during the game and return to the game screen (with themselves in the same location they were at earlier), much like pressing Tab during a game of Counter Strike displays the scores.

Changing the screen to the score screen is simple enough using setscreen, but how can I return to the previous view without calling a setscreen on the game screen and rendering everything all over again?

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:
Detecting image curve to move a truck on this surface I have an image background in surface view

I want to move something according to black surface.But i can not do this using height of this image as it return same height.and one more thing bitmap.getPixel is also not working.and my background is moving.So what is the way to achieve this feat

sentences:
Accessing a database with a php script from Unity mobile game So I am attempting to keep track of some user data in my game that I am creating in Unity 3d. I am using Unity's WWW class to do this. I am following this tutorial: http://wiki.unity3d.com/index.php?title=Server_Side_Highscores

I am not sure why but I keep getting a 404 error even though the file is on the server. I am using godaddy to host my website and I have the php script that I am trying to access in there so that it can use it to query the database. I am using "http://www.mysite/myscript.php?" followed by the values that I want to push to the database, as the tutorial shows to do.

No matter what I do I end up with a 404 and it doesn't make any sense as I know that it is there in the path I am attempting to connect to. If I type out the path to the php file in a browser it will take me to a page that gives an error about the hash not existing (since I am not passing one unless it is in my game) so I know that the file is there.

3/18/16

Here is my php script to add the values to the database.

<?php
    $server = "MyServersIP";
    $user = "MyUser";
    $pass = "MyPassword";
    $db = "MyDB";

    $conn = mysql_connect($server, $user, $pass);

    mysql_select_db($db);

    $Username = mysql_real_escape_string($_GET['Username'], $db);
    $Fuel = mysql_real_escape_string($_GET['Fuel'], $db);
    $IAPCar1 = mysql_real_escape_string($_GET['IAPCar1'], $db);
    $IAPCar2 = mysql_real_escape_string($_GET['IAPCar2'], $db);
    $Score = mysql_real_escape_string($_GET['Score'], $db);
    $Level = mysql_real_escape_string($_GET['Level'], $db);
    $Wins = mysql_real_escape_string($_GET['Wins'], $db);
    $Losses = mysql_real_escape_string($_GET['Losses'], $db);
    $Ads = mysql_real_escape_string($_GET['Ads'], $db);
    $LicensePlate = mysql_real_escape_string($_GET['LicensePlate'], $db);
    $hash = $_GET['hash'];

    $secretKey = "mySecretKey";

    $real_hash = md5($Username . $Fuel . $IAPCar1 . $IAPCar2 . $Score .     $Level . $Wins . $Losses .
    $Ads . $LicensePlate . $hash);
    if ($real_hash == $hash)
    {
        $query = "INSERT INTO Player values (NULL, '$Username', '$Fuel', '$IAPCar1', '$IAPCar2',
        '$Score', '$Level', '$Wins', '$Losses', '$Ads', '$LicensePlate');";
        $result = mysql_query($query);
    }

    mysql_close($conn);
?>

Here is the code I use to call the php script:

public string setValues = "http://www.mysite.com/Set_Values.php?";
private string secretKey = "SecretKeyFromThePhpScript";
public void SetValues(string username, int fuel, bool iapCar1, bool iapCar2, int score,
    int level, int wins, int losses, bool ads, string licensePlate, bool firstTime)
{
    string hash = Md5Sum(string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}", username, fuel, iapCar1, iapCar2,
        score, level, wins, losses, ads, licensePlate, secretKey));
    string url = string.Format("{0}username={1}&fuel={2}&IAPCar1={3}&IAPCar2={4}&Score={5}&Level={6}" +
        "&Wins={7}&Losses={8}&Ads={9}&LicensePlate={10}&FirstTime={11}&hash={12}", setValues, username, fuel, iapCar1, iapCar2,
        score, level, wins, losses, ads, licensePlate, firstTime, secretKey);

    WWW www = new WWW(url);
}

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:
Making an auto patcher I'm currently in the last phases of an original release for my upcoming risk game - I'm looking at making a patching system to autopatch the game.

My current concept for it is-

1: Player opens the game

2: Game checks valid serial key

3: If valid, game checks latest version

4: If newer, game prompts opening of auto patcher

5: If opened, patcher downloads version list, with all version

6: Patcher loops through list to find all newer patches and downloads all version files with links to patch data

7: Patcher checks with the website for each file, checking if downloading all patches is smaller than downloading the latest version of the file: if smaller, downloads patches; if bigger, downloads latest file

8: If smaller patch file, patcher incrementally alters file with each patch applied by each small patch file, from oldest to newest. If larger, patcher simple overwrites the file

9: Patcher asks exit/launch game so players can enjoy the game

Does this sounds like a sane way to do the patcher or will it come back and bite me later on?

sentences:
2D Map Chunks - Individual Files? I have a 2D map of 500 x 500 tiles, split into chunks of 256 x 256.

I'm saving each chunk as a separate file, and I have them loading in as the player moves around. This means however there's over 1024 chunk files currently- and more to come when I increase the map.

Is this normal practice? I have no stutters when the game streams map loads or anything.

sentences: Unity Loading Image? I have a quastion about loading screen in unity. I don't want to make a scene between to levels [Main Menu > Loading Scene > Game level]. I want to use Canvas "Image"that run at the start of the game level and then disappear after few seconds [Main Menu > Game level]. Is this good idea ?

sentences: How to create wrap-around pathfinding? I've created a planet and obstacle grid and want to move units through this grid using A* or any other algorithm. The only problem is wrapping. I need a simple example of how to handle this unusual pathfinding requirement. I prefer C#/XNA rather than C++.

sentences:
Overlap2d + LibGdx load large map I've been wondering if it's possible to load a large map made with Overlap2d before I get started with my project.

A large map for me is something equivalent to a map from recent open-world RPGs like The Wichter 3, but in 2d.

The map is drawn in advanced (it's not procedurally generated), and the game will be for Android devices so I thought a large map should be loaded in chunks.

Is it possible to load a large map mad with Overlap2d in LibGDX?

sentences:
How do I calculate consistent frame timings at 60fps? I'm writing an HTML canvas game that uses requestAnimationFrame and therefore runs at 60fps, although this is more of a question about failing arithmetic than about JavaScript.

If I measure the time since the last frame in order to update my sprite positions correctly, I get a slight jitter in the movements. This is because the times are accurate to the millisecond, and 1/60s does not neatly fall on millisecond boundaries.

What I end up seeing are timings like this:

16, 17, 17, 16, 17, 17, 16, 17, 17, 16

(In reality I get more 16s than 17s because of time spent outside of the timed region of code, but you get the idea).

This timing difference means that on each frame that updates on a perfect 1/60 monitor refresh rate, I advance my sprites at an imperfect rate.

My solution is to lie about my timing. I'd like to round my timings to the nearest multiple of 1/60s, expressed in ms.

E.g. If I get around 16ms timings, I'd like to report 16. If I get around about 33ms timings (1 dropped frame), I'd like to report 33.

Is there a magical formula that will do this?

sentences:
Finding line of best fit demarcating national borders Per title, what algorithms are available for defining borders for states (or other entities) based on certain nodes in the world (eg. cities or armies) with varying weights?

For example, there are three non-equidistant city-states and a bunch of military vehicles of varying strength nearby representing each city-states' military power. I would like to be able to draw a border that accounts for the fact city-state A has a huge great army on their outskirts, projecting their power outward.

Ideally the optimal algorithm would be able to calculate a series of connected lines with a high level of precision for multiple states and a large number of nodes (let's say three dozen, for the sake of argument). Speed isn't too much of a factor, since the results would be cached and I'd need to apply a function to 'curve' it anyway.

sentences:
Creating a master server for Unity game (Unity 2017) I have a basic FPS game made in Unity. I am using the Unity NetworkManager, NetworkManagerUI and NetworkIdentity components that came with Unity.

The game is working fine on my local network when I make one pc a client-host and other a client.
It is also working great using the 'Mulitplayer' service that is free with Unity (for up to 20 max over all games/projects etc, and is supposed to be only for testing I believe)

I'm 99% sure it is possible to run a 'server version' of my app on a pc in my home, and make this into a dedicated master server, but I cannot find much at all from Unity officially regarding this (It seems to always point me to just extending my deal with them to get more players into the server they provide, for which the costs are 1000x more than the budget I have for the game)

Before Unity were offering these pricey services, there was info such as this: https://unity3d.com/master-server

But it says that is only compatible with Unity 3.x

I've asked this question 2-3 times already on the Unity Answers site, and there are no answers at all. I've also browsed it for similar questions and all those seem to be unanswered or way out-of-date.

As I stated last time I ask this, I know thatt Rust game is made with Unity. In past, I downloaded (officially from Facepunch, the devs of Rust) the 'Rust Dedicated Server' application, which I ran on my desktop PC (with fibre network connection) and then I was hosting a server in game. The server ran smooth as silk, so for my game I dont think i would need an actual modern server machine or direct internet connection (otherwise, how did Rust manage it??)

So as I say, I have the network functionality all up-n-running. But the last piece of the puzzle is that I'm using Unity's Mulitplayer Service, and this only allows 20 max concurrent players. This isn't quite enough, as I'd like to have at least 50 if possible. Also I would end up running 10-20 of these so that there is a choice of 'rooms'. Ideally I would be able to let people download and run their own just like Rust.

Before I got to this stage, I was trying to make one user become the Client-Host, but I couldn't figure out how the other clients would be able to tell what is the IP address for the host.

Please can anybody help me, I feel like I've gotten the majority of the way there but now I can't get any further by myself.

Many thanks!

sentences:
removing triangle artifacts from overlapping height maps OpenGL I have two 100x100 height maps that I am drawing using a triangle mesh. One represents the land height, and the other represents (water + land) height.

I currently draw both meshes on top of each other, and I make the water mesh transparent when the water level is 0.

But where the land meets the water there are lots of artifacts.

I believe the cause is the water mesh is >= the height of the land mesh so at the edges the water mesh height goes from being > land mesh height to == , the visible slope is actually the water mesh slope and not the land mesh slope.

That said, I don't know any good way to fix it.

Note: water level may not be flat so replacing the water mesh with a plane wont work

sentences:
2d side scroller slope physics and collisions In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes and stairs handled along different points on the y-axis to give the appearance of still moving in a straight line?

For instance in the above picture would you set collision masks where the green lines are? Then imagine the characters are the red and blue lines respectively, how would you handle them in effect being moved “down” by gravity when in fact there isn’t really any gravity? For the top line I assumed when it hit the green line, rather then stopping or bouncing back on the x-axis you’d just nudge them down and continue the x movement?

I understand how this could be completed in 3D but I’m perplexed how this would’ve been achieved in purely 2d environments. Or maybe I’m imagining slopes/stairs in these old games...

I’m working in SpriteKit, so any ideas specific to that would be great but just understanding how this was accomplished theoretically in the first instance would be great.

Thanks

edit - after some thinking I don't think my 'collision' theory would work going down the slope for the blue line as it wouldn't be colliding unless it came off it's "straight" path, and also the problem would be reversed when going 'up' the slope.

so for instance in the above image where the characters are moving up the slope the other way I'm curious how this would have been handled? My thoughts now are, would the darker grey area with the "1" on it, actually be an entire entity itself or a collision mask? You'd then work out based on the characters "Y entry" point on to it (either at the top or the bottom) and based on their direction, where their 'Y' point should then be?

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:
Calculating delta time I'm trying to calculate deltaTime, but it's not correct.

What's wrong in my code?

//declared outside
private long timeSinceStart = System.nanoTime() / 1000;
private long oldTimeSinceStart = 0;
public static long deltaTime = 1;

while(running)
  timeSinceStart = System.nanoTime() / 1000;
  deltaTime = timeSinceStart - oldTimeSinceStart;
  oldTimeSinceStart = timeSinceStart;

sentences:
Object reference not set to an instance of the object; using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {

    public CharacterController2D controller;

    public float runSpeed = 40f;

    private float horizontalMove = 0f;

    // Update is called once per frame
    void Update () {
        horizontalMove = Input.GetAxisRaw("Horizontal")*runSpeed;
    }

    void FixedUpdate(){
        controller.Move(horizontalMove*Time.fixedDeltaTime,false,false);//error is somewhere here
    }
}

Though all the classes are defines it throws the error
please help!!!!!

sentences:
GameObject with Audio File called with FindGameObjectWithTag returns "Object reference not set to an instance of an object" I'm puzzled with this error because in a different file (see below), I'm doing exact same process to an object to enable/disable and works fine. But this new object throws the error, the object has a Script calling an audio file.
Enabling manually the Object, and playing the game the audio is fine. I hit the check box to disable it and I get the error "Object reference ..."
This audio object is attached to another GameObject which is the character of the game.

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

    [RequireComponent(typeof(BoxCollider2D))]
    public class carController : MonoBehaviour {

        public float carSpeed;
        public float maxPos = 4.17f;

        Vector3 position;

        public ParticleHit pr;
        public AudioManager cr;
        public Blast cb;

                audioObj = GameObject.FindGameObjectWithTag("policeAuTag");
                audioObj.SetActive (true);
                cr.carSound.Play ();

What am I doing wrong.?
I have closed and reopened unity but nothing. I have changed the tag name but same error.

I have tried also "FindWithTag" and doesn't work.

What is causing the code to throw errors?

sentences:
How to rotate a parent object while rotating a child object to a certain angle using coroutines I have a semicircle like game object which I made by putting two arcs in an empty game object (SCircle) and rotating the 15° (for left arc) and -15° (for right arc) as seen below.

SCircle has an Orientation enum  with two valuesLeft (rotates SCircle to 45°) and Right (rotates SCircle to -45°) as seen in the image below.

I use the following coroutine to move SCircle between orientations.

IEnumerator RotateLeftOrRight(Vector3 byAngles, float inTime)
{
    Quaternion fromAngle = gameObject.transform.rotation ;
    Quaternion toAngle = Quaternion.Euler (transform.eulerAngles);

    if (circOrientation == Orientation.Left) {
        toAngle = Quaternion.Euler (gameObject.transform.eulerAngles - byAngles);
        circOrientation = Orientation.Right;

    }
    else if (circOrientation == Orientation.Right) {

        toAngle = Quaternion.Euler (gameObject.transform.eulerAngles + byAngles);
        circOrientation = Orientation.Left;
    }

    for(float t = 0f ; t <= 1f ; t += Time.deltaTime/inTime)
    {
        gameObject.transform.rotation = Quaternion.Lerp(fromAngle, toAngle, t) ;
        yield return null ;

        gameObject.transform.rotation = Quaternion.Lerp(fromAngle, toAngle, 1);
    }

}

I also used a very similar coroutine to move the individual arcs by 30° (in opposite directions) from say, Orientation Left, as seen below:

Since SCircle Coroutine is activated by a mouse click, I have the case where the individual arcs coroutine is run and before it is complete the parent SCircle coroutine is also run. In this case the arcs end up moving from Left to A, which is not the behavior I need. I would want the behavior of them ending up at B when moving from the Left. Likewise, from B, when the SCircle coroutine is run while the arcs coroutine is in progress the orientation will return to the Left.

Please note that the blue arrow represents the movement of the left Arc, the red represents the right Arc and the black represents movement of SCircle - the parent object.

How can I achieve the behavior from Left to B and from B back to Left?

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:
How to prevent object from moving when it's mesh/collider is being updated? So I a made a script that lets the player grab a vertex, move it, and then update the mesh. To help prevent the player from trying to clip it through other objects I made it so the mesh/collider is constantly being updated. It works however there is an issue where it keeps falling into itself. So I tried updating the constraints to prevent this but it doesn't seem to help anything.

Visualization...

With the mesh being updated after the LMB is released: http://gifyu.com/images/withnocollisionprevetnion.gif (SE doesn't like non-imgur links apparently and they are too big for imgur).

With the mesh being updated in real time: http://gifyu.com/images/withcollisionprevetnion.gif

Also here is a gif showing how constraints on the RB don't solve the problem
 (I've tried freezing on different axes but those still cause issues too): http://gifyu.com/images/constprob.gif

So basically what can I do to prevent the object from moving when it's mesh/collider is being updated?

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

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

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

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

sentences:
Positioning of the game object after scaling the game background i'm creating a game using Corona SDK i have a map and with ball and some other object moving on this map
and i'm using the ultimate config.lua file for scaling background based on device screen resolution
my problem is that i want to arrange some object on this map but for device resolution i have created specific assets for ex android device with aspect ratio lower than 1.72 so in this assets the map is stretched horizontally or it's became wider than other assets
so in this case when i want to arrange an object on top of this map the result is
that my object didn't set in the right place and that because the map is became shorter than is other design for more explaining 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 didn't set on the map
i tried to convert my pixels to inches using device DPI but it's still the same

sorry for my poor english
and thanks for help

sentences: Jumping with a player Matrix My players position is stored in a world matrix and I want to make him jump. Can I do this just by creating a translation from the matrix? I want the player to be able to jump while moving in a direction also. I've looked on google but didn't find any tutorials on jumping with a matrix

sentences:
Clipping Sprite Sheets with Variable Placement I was looking at some sprite sheets at sprite sheet database. I noticed that some of the sprite sheets had several different objects placed together in one file. Some of the sprites, such as movement animations were placed next to each other so that they were of the same height. However, sometimes next to them are larger sprite objects that take up a different amount of space.

These sprite sheets have no apparent information such as cell width and height. It seems like you would have to clip them through trial and error. Is there some sort of algorithm to figure out how to clip them without external sprite grid information?

http://sdb.drshnaps.com/display.php?object=7604

sentences:
In Theory, how much gain should I expect from instancing in OpenGL for small scene with large meshs? I am trying to implement one-pass stereo rendering in OpenGL for a VR application that I am building. I am implementing this through instancing, so I make one render call glDrawElementsInstanced with count=2 and do clipping in the vertex shader but I am not seeing that much gain in performance.

My scene has just 2 massive meshes (rendered two times (2 instances), one for each eye totaling around 3.5m triangles for each eye or ~7m per frame). Obviously I can reduce the triangle count by doing some decimation but my question here is,

In theory, should I expect a significant gain in performance by using instancing in this scenario even though the number of draw calls and state changes in the entirety of my application is around 15 per frame For each pass and 30 per frame?

Or to Rephrase the question, Does OpenGL instancing improve performance mainly by reducing state changes or by making less calls to glDraw*?

sentences:
Check collision between instantiated objects? I am using a script to instantiate multiple objects having rigidbody with different velocities at different positions. I want to destroy two or more objects when they collide, but I'm not getting anything inside:

void OnCollisionEnter(Collision collision){}

The details of the object I'm instantiating. http://i.imgur.com/rLnOM.png

The script is attached to an empty GameObject and Instantiated GameObject is stored in a array of GameObjects:

 Block[0] = Instantiate(boxPiece) as GameObject;

where boxPiece is the Object I want to instantiate.
And I'm checking for collisions in this very same script.

sentences:
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:
Changing background images frequently within a specific time range with Cocos2D I am working on a game development project for Android. We use the Cocos2d framework. I have to design a page which contains two background images, I need to switch these images repeatedly within 1sec. How can I do this? How can I use CCTransitionScene in my Java code and change these images repeatedly?

Thanks in advance.

sentences:
Direct3D11 HLSL ConstantBuffer Driver Stopped Responding I have a simple HLSL shader with a few constant buffers, 1 of them holding an array of Light structs which causes my display driver to crash when the array size goes over 3.

Does anybody have an idea what causes my display driver to crash when MAX_LIGHTS is higher than 3? I don't believe I am exceeding the maximum allowed number of elements right? Which is supposed to be somewhere near 4096 elements). I also don't think I have set up my constant buffer wrong. It is a multiple of 16.

(I have excluded the other 3 constant buffers because these are not so interesting. They only contain world/view/proj matrices.)

I don't mind posting more code, if required.

#define MAX_LIGHTS 4 // Black Geometry / Crash
//#define MAX_LIGHTS 3 // Properly Shaded & Textured Geometry / No Crash

struct Light {

    // 16
    float4 lightPosition;

    // 32
    float4 lightDirection;

    // 48
    float4 lightColor;

    // 52
    float lightRange;

    // 56
    float lightIntensity;

    // 60
    float lightIsEnabled;

    // 64
    uint lightType;
};

cbuffer CBLights : register(b3) {
    Light lights[MAX_LIGHTS];
    uint numLights;
    float cbLightsPadding1;
    float cbLightsPadding2;
    float cbLightsPadding3;
};

sentences:
One framebuffer for each light vs unique framebuffer per light Currently I have two ideas how to implement my lighting system:

1) Use one framebuffer per light source

no need to switch texture attachments of framebuffer
may be faster
bigger memory usage

2) Use one framebuffer for every light source

some time may be wasted on attaching new textures to framebuffer
less memory usage

So could you please tell me which way is better and why? Or I'm totally wrong on my thoughts and there is no difference at all?

sentences:
Most efficient way to generate 2D portraits I am not sure if this is a fitting question for gamedev, or if it is too art related. I am currently trying, to create 2D character protraits for my game.

At first I tried to draw them and even though it helped polishing my drawing skills the end result either required way too much time or it simply looked like it was created by a grade school kid.

So I am currently looking into some tools which from which people like me who are not out of the art-world might benefit. Especially tools which can create a 3D head+hair, so that I can render them.
I have tried several 3D generation tools such as makehead and makehuman to create the basic head-shape.

But I have to admit I am not well versed in what other options are available/what has the best quality/etc.

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:
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:
Correct use of VAO's in OpenGL ES2 for iOS? I'm migrating to OpenGL ES2 for one of my iOS projects, and I'm having trouble to get any geometry to render successfully.  Here's where I'm setting up the VAO rendering:

void bindVAO(int vertexCount, struct Vertex* vertexData, GLushort* indexData, GLuint* vaoId, GLuint* indexId){

//generate the VAO & bind
glGenVertexArraysOES(1, vaoId);
glBindVertexArrayOES(*vaoId);

GLuint positionBufferId;

//generate the VBO & bind
glGenBuffers(1, &positionBufferId);
glBindBuffer(GL_ARRAY_BUFFER, positionBufferId);

//populate the buffer data
glBufferData(GL_ARRAY_BUFFER, vertexCount, vertexData, GL_STATIC_DRAW);

//size of verte position
GLsizei posTypeSize = sizeof(kPositionVertexType);

glVertexAttribPointer(kVertexPositionAttributeLocation, kVertexSize, kPositionVertexTypeEnum, GL_FALSE, sizeof(struct Vertex),  (void*)offsetof(struct Vertex, position));
glEnableVertexAttribArray(kVertexPositionAttributeLocation);

//create & bind index information
glGenBuffers(1, indexId);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *indexId);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, vertexCount, indexData, GL_STATIC_DRAW);

//restore default state
glBindVertexArrayOES(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}

And here's the rendering step:

//bind the frame buffer for drawing
glBindFramebuffer(GL_FRAMEBUFFER, outputFrameBuffer);

glClear(GL_COLOR_BUFFER_BIT);

//use the shader program
glUseProgram(program);

glClearColor(0.4, 0.5, 0.6, 0.5);

float aspect = fabsf(320.0 / 480.0);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f);

GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.0f);

GLKMatrix4 mvpMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);

//glUniformMatrix4fv(projectionMatrixUniformLocation, 1, GL_FALSE, projectionMatrix.m);
glUniformMatrix4fv(modelViewMatrixUniformLocation, 1, GL_FALSE, mvpMatrix.m);

glBindVertexArrayOES(vaoId);
glDrawElements(GL_TRIANGLE_FAN, kVertexCount, GL_FLOAT, &indexId);

//bind the color buffer
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderBuffer);
[context presentRenderbuffer:GL_RENDERBUFFER];

The screen is rendering the color passed to glClearColor correctly, but not the shape passed into bindVAO.  Is my VAO being built correctly?  Thanks!

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:
How to achieve "Perfect Imbalance" I've heard the term "perfect imbalance" thrown around a lot, which seems to imply that it is okay for different game options to be strictly superior to others as long as the 'better' options require more player skill to use.

What strategies does one employ, generally, to achieve this? And am I even understanding the principle correctly?

sentences:
Move Background in AndEngine for a Racing Game I am new to game development and AndEngine. I have small query about racing game. I am going to develop a bike racing game. For bike racing game we will move the background or the player. I am tried with andengine autoparallax background. But I didn't got the correct answer.

I need to do a background  like these screenshots in SpeedMoto.

Can anyone help me to set the background.

sentences:
Stuck the ball in the board (pingpong game) this game isn't completed yet, i've created the part where the ball hits the board, but there's problem in playing and that's the ball stucking in the board. For a better comprehension and understaning i've attached a image down below , plz watch it and lemme know of your take on this bug.

    public partial class PingPong : Form
{
    public PingPong()
    {
        InitializeComponent();
        timer1.Enabled = true;
        timer1.Interval = 30;
    }

    int mx = 5;
    int my = 5;
    private void timer1_Tick(object sender, EventArgs e)
    {

        if (ball.Bounds.IntersectsWith(boardCenter.Bounds))
        {
            mx = mx * -1;
            my = my * 1;
        }
        else if (ball.Location.Y >= this.ClientSize.Height - ball.Height)
        {
            mx = mx * 1;
            my = my * -1;
        }
        else if (ball.Location.Y <= 0)
        {
            mx = mx *1;
            my = my * -1;
        }

        else if (ball.Location.X >= this.ClientSize.Width - ball.Width)
        {
            mx = mx * -1;
            my = my * 1;
        }

        ball.Location = new Point(ball.Location.X + mx, ball.Location.Y + my);

    }

    private void PingPong_KeyDown(object sender, KeyEventArgs e)
    {

        if (e.KeyCode == Keys.Up)
        {
            boardCenter.Location = new Point(boardCenter.Location.X, boardCenter.Location.Y - 4);

        }
        else if (e.KeyCode == Keys.Down)
        {
            boardCenter.Location = new Point(boardCenter.Location.X, boardCenter.Location.Y + 4);
        }

    }

}

sentences:
How do I apply 2 rotations about different points to a single primitive using OpenGL I'm working on a 2D top-down shooter game that has a rotation feature like Realm Of The Mad God such that if you press e the camera rotates around the character in a clockwise direction and q rotates the camera around the character in a counterclockwise direction.  I have this working with my floors and walls by translating to the character, doing the screen rotation, and drawing everything with the character as the origin.  The problem arises when I shoot projectiles which need to both rotate around the character and rotate around themselves (shooting uses the mouse cursor so I can shoot at any angle).  For example, if the screen is not rotated and I'm shooting rectangular projectiles, I want them to face in the direction I'm shooting (rotation around themselves).  However if I only do this rotation, when I then rotate the screen the projectiles will always shoot at the same position because my cursor position does not change.  Therefore I need to also either rotate the projectiles around the character or rotate the mouse cursor position to get the correct position (which would then totally screw up all of the collision detection).  Likewise if I only do the screen rotation on projectiles, the rectangles will always be facing the same way and they would only look correct if I were shooting straight up or straight down.

So my question is, how can I perform 2 rotations on a primitive around 2 different points?  The only way I can think of is to translate to the character and do the screen rotation, then somehow calculate the translation required to move back to the middle of the projectile (seeing as how my axes are now rotated) and do its rotation.  Or am I thinking about this in the wrong way and there is a different solution to accomplishing this effect?

sentences:
Correct way to integrate scaled axis angular velocity into a quaternion Across my travels on the internet I have came across two different ways of integrating a scaled axis angular velocity into a quaternion.

The first way converts the angular velocity into an axis angle quaternion like so

Quaternion q = new Quaternion(vector.normalised(), vector.getLength());

Where the constructor looks like:

float sinHalfAngle = (float) Math.sin(angle / 2);
float cosHalfAngle = (float) Math.cos(angle / 2);

this.x = axis.x * sinHalfAngle;
this.y = axis.y * sinHalfAngle;
this.z = axis.z * sinHalfAngle;
this.w = cosHalfAngle;

And then multiplies the existing quaternion by that new quaternion

this.rotateSelf(q);

The second approach also converts the velocity into a quaternion, but uses a different method:

Quaternion change = Quaternion.mul(
    new Quaternion(x * 0.5f, y * 0.5f, z * 0.5f, 0),
    this
);

It then adds the quaternions together, scaled by delta T:

this.w += change.w * scale;
this.x += change.x * scale;
this.y += change.y * scale;
this.z += change.z * scale;

Both approaches produce a rotation, however the first approach rotates the object much faster than the second. I was wondering which is the 'more' correct way, or if they are just different methods used for different units perhaps? (ie: degrees vs radians?)

Thanks very much if you can help.

sentences:
Best way to transition between multiple Cocostudio defined scenes I'm designing a game that has to switch between multiple game scenes. Each scene has been created in cocostudio and is imported into the code as a json file as:

var obj = ccs.load(res.Symbols_json);
this.addChild(obj.node);

This works fine, however when I have to transition to some other scene and then back to the original scene I experience several different issues.

If I create a new instance of the scene I return to as:

returnToScene: function () {
  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

PNG files are not loaded properly and transparency is shown as solid white. If I however keep the old instance of the scene as:

returnToScene: function () {
  if (this.startScene == null)  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

then I have to manually reload all animations from the json file and all particle systems gets destroyed (as in they are still present but are not updated).

Have anyone else experienced anything similar? I've considered using pushScene and popScene instead of runScene but as far as I can tell it seems to be an outdated way of performing scene transitions.

sentences:
How do you decide when your feature list is long enough? I know a bit about this question but I find that there are quite a lot of diverse opinions on the subject?

I know from a players perspective that more options is almost always good. But on the other hand if it has multi-player more means higher complexity (meta game) both for the developers as well as players.

On development complexity and time constraints always go hand in hand. Another would be  resource and platform constraints. Possible economic ramifications of holding back for later is sometimes a reason as well.

So from people experience here aside from the above when should features be cut or be for later release?

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: 2-D character not falling to the ground I am very new to Game Development and I am making a game with a simple Ragdoll which has a body, a head, and 2 limbs(hands). The head and the limbs are hinged to the body and I have kept the Ragdoll above a cube to be used as the ground on which the Ragdoll falls. Till now, I haven't added any scripts for movement or anything, I just want my Ragdoll to fall on the cube below it properly. But when I click play, the Ragdoll just starts to float above its original position. When I move it through the editor away from the cube(ground), it does fall down. It's like the cube is opposing the downward acceleration of the Ragdoll. The Ragdoll won't land on the cube. All the bodies have Rigid body and collider scripts. The Ragdoll also doesn't disassemble, it manages to keep itself together. Can someone please tell me what I am doing wrong. I researched about this but I have found no solution. I am using the free version of Unity.

sentences:
Can i release a game in steam with free assets? I'm making a game with unity, and i'm planing release the game in steam as FREE. I'm using free assets from unity asset store, and also i'm using free assets models from another sites. I always see if the 3d models are free. I'm no using models like Batman, that have rights from DC. But for example i use a model of door or a stair.

My question is, can i publish my game in steam, or another place, without care about someone someone processing me because i use his 3d models, that is free?

sentences: What is the class name in Unity's AddComponent? Unity's AddComponent() method has an optional parameter of a string.  This string is the className.  What is the class name?  What is it used for?  I could not find any documentation on this.

sentences:
Game Map Implementation I want to know how I can create a virtual town or city (like skyrim towns or gta4 liberty city)

Should I create something on paper and copy coordinates? (Building1 floor corner coordinates are these, ceiling coordinates are these, 2nd floor coordinates are these etc, and then road1 coordinates are these...) And then apply texture on these things? Start with just 1 building and extend it in time?

But this seems like a ton of work. For simplicity if we assume that there are 5 buildings on a road, this is like 90 vertices. And if I decide to make a house wider, then many things will be affected and I have to find new coordinates for every house corners. How did the developers of GTA 4 do it for example?

I would like to know an appropiate method to create a static virtual map where the player can move into houses and interacts with objects in it. Please note that these buildings are not cosmetic only. I should be able to place objects in houses such as tables and the player should be able to jump on it etc.

Thank you, I will vote when I have the reputation.

sentences:
Directx 12 Vertex buffer/shader question Is there a way to process individual vertex that get pumped into the vertex shader.

I have a cube and pyramid.

I want to multiply a different worldviewproj matrix for the cube. So the first 8 vertex should be a differtent matrix.

Is is possible to do such a thing in the vertex shader?

sentences:
Direct3D shader compilation fails with constant buffers I've been particularly annoyed by a 'bug' for a couple days involving D3DCompile and vertex shaders with constant buffers. I'm assuming the bug is my fault (missing flag or small nuance of the poorly documented API).

During my asset compile process I compile this vertex shader:

cbuffer Frame : register(b0) {
  float4x4 model_view_proj;
  float4x4 inv_model;
  float4x4 inv_view;
  float4x4 inv_projection;
};

struct VS_INPUT {
  float3 position  : POSITION;
  float2 tex_coord : TEXCOORD0;
  float3 normal    : NORMAL;
  float3 binormal  : BINORMAL;
};

struct VS_OUTPUT {
  float4 position  : POSITION;
  float2 tex_coord : TEXCOORD0;
};

VS_OUTPUT vs_main( VS_INPUT IN )
{
  VS_OUTPUT OUT;
  OUT.position = mul(IN.position, Frame.model_view_proj);
  OUT.tex_coord = IN.tex_coord;
  return OUT;
}

With this code:

const D3D_SHADER_MACRO defines[] = {
  { "VERTEX_SHADER", "1" },
  { "D3D11",         "1" },
  { NULL, NULL },
};

D3DCompile(
  src, src_len,
  path,
  &defines[0],
  &include,
  "vs_main",
  "vs_4_0",
  D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY |
  D3DCOMPILE_OPTIMIZATION_LEVEL0 |
  D3DCOMPILE_PACK_MATRIX_ROW_MAJOR, 0,
  &blob,
  &error_msg_blob
)

I have verified (by stepping through) that my ID3DInclude implementation works and all input data is correct. However, I receive a E_FAIL with an associated error message:

error X3004: undeclared identifier 'Frame'

What gives?

sentences:
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:
Unity Unable to blend 2D Light renderers I've followed the documentation on Unity regarding 2D lighting. It said to turn on Alpha blending in the options. But this is how it turns out:
If Alpha blending is off:

If Alpha blending is on:

I'm not entirely sure why it's turning black. These are my settings for the 2D light:

I've checked my layers, specifically the tile map floor, and it's on the Default layer.

I just want my lights to blend well.

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:
Making use of the Android GPU debugging tools I tried following the manual to install the Android GPU debugging tools for android Studio 2.0. Unfortunately it has not been very successful.
I have been following the instructions of the official documentation which are still for version 1 of the gpu debugging tools here: http://tools.android.com/tech-docs/gpu-profiler
It also isn't that helpful otherwise.

I am using an arm based emulator for testing since the abi specific folders specified in the manual are for arm abi's only.
Also the red button above the gpu monitor that is used to start the debugging tools is grayed out for me and it tells me that the gpu debugging tools are not installed when I hover over it.

Are there any extra steps I need to follow to get it to work?

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:
Ray casting fails when it shouldn't I have two objects that should collide. My player should stand on a ship. The position where my player stands, is exactly on the edge of two adjacent triangles (in the ship's model). To Check for collision, I'm using ray picking. I cast a ray from the player's hips downwards. This intersection tells me if the player should be falling (no collision), or if there is a floor under his feet (collision).
In some occasions, the ray is fired exactly between two triangles, causing the ray to not collide, causing the player to fall through the floor.

I've solved this in my "RayIntersectsTriangle" function by slightly increasing the triangle's size. It feels hacky, and like it's bad practice.

I realise I could also solve this by casting multiple rays from the player downwards, and check if at least one collides. But obviously, this consumes more operations, and also feels like it should not be the way to do it.

FYI: The RayIntersectsTriangle function definitely works, no question. I'm just wondering if floating point precision is messing this up.

Is there a way to make sure that a raycast can never pass between two triangles in a mesh due to floating point errors, or should I make a workaround like I did?

sentences:
Recommended RPG game that can be used to learn game Modding? I would like to learn game development via game modding. RPG/MMORPG is one of my favorite genres. Could someone recommend me a good and recent ( I would like to play the game as well) game to learn game modding. Something with the likes of Neverwinternights 2.

Thank you very much for the responses. Appreciate it.

sentences:
Can i tell if a Vertex Tree is a solid shape? if a Vertex looks like this:

struct vertex {
    vec3 point;
    vertex [] connected;
};

Can I tell if this makes a solid shape with no holes? (e.g a sphere or a cube, NOT a sphere with a side missing for example)

(if i can see the back of a face from outside of the shape then it is not solid)

sentences:
Keypress Left is called twice in Update when key is pressed only once I have a piece of code that is changing the position of player when left key is pressed. It is inside of Update() function. I know, Update is called multiple times, but since I have an ifstatement to check if left arrow is pressed, it should update only once. I have tested using print statement that once pressed, it gets called twice.

Problem:
Position updated twice when key is pressed only once.

Below given is the structure of my code:

void Update()
{
    if (Input.GetKeyDown (KeyCode.LeftArrow))
    {
        print ("PRESSEEEEEEEEEEEEEEEEEEDDDDDDDDDDDDDD");
    }
}

How can I fix this?

sentences:
Prevent camera from moving through walls (no engine or framework) I'm building a fairly basic 3D first-person puzzle game. The only objects for which collisions matter are walls, and all walls are at convenient 90 degree angles aligned with the coordinate axes.

Unfortunately, I cannot consistently prevent the camera from moving through walls. There is no off-the-shelf game engine or framework involved, so I have to implement all this from scratch.

Currently, my algorithm (in GLSL-ish psuedo code) looks something like this:

void update_position(seconds){
    vec3 ray = Raycast(position, speed, map.grid);
    float xmax = max(ray.x-.01,0);
    float ymax = max(ray.y-.01,0);
    float zmax = max(ray.z-.01,0);

    float dx = speed.x * seconds;
    float dy = speed.y * seconds;
    float dz = speed.z * seconds;

    if(abs(dx) > xmax){
        dx = (dx > 0 ? xmax : -xmax);
        speed.x = 0;
    }
    if(abs(dy) > ymax){
        dy = (dy > 0 ? ymax : -ymax);
        speed.y = 0;
    }
    if(abs(dz) > zmax){
        dz = (dz > 0 ? zmax : -zmax);
        speed.z = 0;
    }

    position.x += dx;
    position.y += dy;
    position.z += dz;
}

In prose: I cast a ray from the player's/camera's current position along the speed vector, which extends until it hits wall. (The Raycast function is used elsewhere, so I already know it works correctly.) I then define the maximum distance the player is permitted to move in each dimension to be slightly less than the component of the ray in that dimension (so that we never end up exactly on a wall). I then compute a provisional set of deltas to add to the current position based on the speed and the time since the last frame (in fractional seconds), and check to see if any of them exceed the maximum allowed magnitude which would take the player through the wall. If they do, I clamp the magnitude of the offending component to its max value, and set the component of speed in that direction to 0; so, the player should end up just barely outside the wall, and sliding along it.

This usually works pretty well if you happen to run straight into a wall, but it fails frequently but unpredictably (as in, sometimes it doesn't fail) near corners, and especially near three-way corners (where two walls and a ceiling or floor come together).

So, what is wrong with this algorithm, and how do I fix it?

sentences:
Google Play downloads never update So I published an app about 3 weeks ago and it still says 10 downloads, but I have google analytics in the app and it says my app has nearly 1000 downloads. After 2 days my app said 10 downloads and it has never updated since then.

Has this ever happened to any of you? I have heard of a few days to a week of delay but 3 weeks is ridiculous. It should have updated by now.

sentences:
How can I easily create cloud texture maps? I am making 3d planets in my game; these will be viewed as "globes". Some of them will need cloud layers. I looked at various Blender tutorials for creating "earth", and for their cloud layers they use earth cloud maps from NASA.

However I will be creating a fictional universe with many procedurally-generated planets. So I would like to use many variations.

I'm hoping there's a way to procedurally generate cloud maps such as the NASA link. I will also need to create gas giants, so I will also need other kinds of cloud texture maps.

If that is too difficult, I could fall back to creating several variations of cloud maps. For example, 3 for earth-like, 3 for gas giants, etc.

So how do I statically create or programmatically generate such cloud maps?

sentences:
Filling up the empty blocks when the player touches the safe zone again! using cocos2d Hi guys i am stuck with filling up the data of all the blocks which are empty like the ones in the image.
 As you can see there i have a pacman like object where i will be moving around.

But when you are in the empty space where there are no Blue boxes available i should be able to add new blocks in the path of my pacman and when it touches  any other blue boxes like in the below case if my pacman touches the top row of the blue box i should be able to fill all the empty boxed inside the border of the path created by pacman.

For now i am using a 2d bool array to store all the filled boxed info like if there is a box inside i am making that cell in an array as true.

But how to fill the area with blue boxes after player finishes his path ?

Any help would be great thank you.

More info about this problem is here:
filling the empty spaces in a certain region in a grid using c++   Same problem

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: How can I use Unity Assets made by Unity in a commercial project? I know you can't use starter and training etc.. assets made by Unity for commercial purposes, but according to this every Unity asset made by Unity is restricted for commercial use. So that means I can't use Post Processing Stack? That would be disappointing.

sentences:
Is single/double frame allocator suitable only for POD datas? Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data.

size_t freeTilesSize = 10;
int* freeTiles = _allocator.allocate<int>(freeTilesSize);

The stack doesn´t save any conditional stuff about the memory it creates(it cares only about the size of the chunk so it knows the new header offset). I see this a good for using with POD data structures or classes with default destructor, however, is it usable also for bigger entities with some behavior at the destruction? At this moment, my function rewind only sets the header ptr to the start of the allocated block so it doesn´t call any destructors.

Am i doing something wrong? What was your approach?

sentences: LWJGL3 Input for single press of keyboard I am making a game with lwjgl and GLFW and am having a hard time figuring out how to check for a single press on the keyboard.

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:
Draw coloured transparent polygons on top of texture in modern opengl I am trying to render an image in the viewPort using symmetry_create = 1
and binding texture to it.

 static const GLfloat vertices[] = {
//vertexdata
        -symmetry_create,
        symmetry_create,
        0.0f,
        //uv
        0.0f, 1.0f,
        symmetry_create,
        symmetry_create,
        0.0f,
        //uv
        1.0f, 1.0f,
        symmetry_create,
        -symmetry_create,
        0.0f,
        //uv
        1.0f, 0.0f,
        -symmetry_create,
        -symmetry_create,
        0.0f,
        //uv
        0.0f, 0.0f};

My vertex shader looks like

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 texCoord;

out vec2 TexCoord;
void main()
{
    gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
    TexCoord = texCoord;
}

And fragment shader looks like

#version 330 core

in vec2 TexCoord;
out vec4 frag_color;

uniform sampler2D myTexture;
void main()
{
    frag_color = texture(myTexture, TexCoord);
}

I have setup my vao, vbo and indices correctly and thus I am getting the result as expected (ie: A provided image on the display screen).

Now I would like to draw 'n' number of transparent polygons on the image generated.For each polygon, I have thought of achieving using mouse cursor positions and clicks and render using glDrawArrays(GL_TRIANGLE_FAN, 0, n);.

If I use the same vertex and fragment shaders my result now is black opaque polygons on top of the image.
How to achieve transparency and color in the polygons. Do I need to another set of shaders(vertex and frag)?

sentences:
Methods to 'cull check' polys in OpenGL A quick search through the web suggests there's quite a few methods of potentially detecting back-culled faces on the CPU.

The purpose of the check is to evaluate whether to performing other operations such as tessellations is reasonable by dynamically altering the LOD of visible polys based on the number of polys on the screen.

What would your suggestions be for implementing this? Speed isn't necessarily the greatest concern - for this prototype mathematical simplicity is more important. Code snippets welcome :-)

Edit: It seems obvious to me to calculate the dot product based on the camera's viewing vector in world-space against the surface normal vector - but I'm asking this question because I'm intrigued as to why everyone and their (programming genius) dog seems to have an alternative method of handling this.

sentences:
OpenGL ES 2.0: Converting GL_TRIANGLES into GL_TRIANGLE_STRIP I export my 3D geometry from a 3D authoring application. It is possible to export the vertex coordinates as full triangle arrays.

On ther other hand, triangle strips are more efficient for the OpengGL to render. This is especially true for OpenGL ES, which is very sensitive for performance.

Is it therefore possible to convert GL_TRIANGLES arrays into GL_TRIANGLE_STRIP, please?

Could anybody provide me with working algorithm? Thank you.

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:
How to detect GLSL warnings? After compiling a shader with glCompileShader, I can call glGetShaderiv with GL_COMPILE_STATUS to check if the shader compiled successfully. I can also call glGetShaderInfoLog to get information about possible errors, warnings or other info. The information log returned by this function is unspecified.

In a tool where users can write their own shaders, I would like to print all errors and warnings from the compilation, but nothing if no warnings or errors were found. The problem is that the GL_COMPILE_STATUS returns only false if the compilation failed and true otherwise. If no problems were found, some drivers return empty info log from glGetShaderInfoLog, but some drivers can return something else such as "No errors.", which I do not want to print to the user. How is this problem generally solved?

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:
Draw a line along one continuous edge of a curved mesh I have a rectangular mesh, but the mesh is curved:

I want to draw a line along one side of this curvy mesh.

Currently I can easily draw line along a side of a flat rectangular mesh by getting the mesh's min and max bounds. But what should I do to draw a curved line along the border of mesh from one of its side edges.?

sentences:
Why does my GLSL 1.20 shader not work with an OpenGL 4.0 driver? I'm just starting out with OpenGL on Linux. In order to write future-proof code, I explicitly wrote code for OpenGL 4.0 Core Profile in the first place, thus the shaders are GLSL 4.0.

That worked fine on a recent notebook with an AMD graphics card using the fglrx driver, which supports OpenGL 4.0. I then tried to run this code on another box with an Intel card, whose driver only supports OpenGL 2.1. That failed, obviously.

I then rewrote the shaders in GLSL 1.20, without changing the C++ code at all. Now it works on the Intel box, but on the AMD notebook, it displays nothing (except for glClearColor).

That confuses me. The code checks glGetError() periodically, so an error in the shader compilation would have been caught.

My only idea would have been that I accidentally created a GL 4 core context (instead of a compatibility context) on the AMD box, but the context is created by SDL 1.2, which (says the documentation) can create compatiblity contexts only.

Can anyone see what the problem is, or give hints on how to debug this? For reference, I'm attaching all shaders. (They're pretty trivial; as I said, I'm just starting.)

#version 120 (vertex shader)
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
attribute vec4 in_Color;
attribute vec4 in_Position;
varying vec4 pass_Color;
void main(void) {
    gl_Position = (ProjectionMatrix * ViewMatrix * ModelMatrix) * in_Position;
    pass_Color = in_Color;
}

#version 400 (vertex shader)
layout(location=0) in vec4 in_Position;
layout(location=1) in vec4 in_Color;
out vec4 ex_Color;
uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
void main(void) {
    gl_Position = (ProjectionMatrix * ViewMatrix * ModelMatrix) * in_Position;
    ex_Color = in_Color;
}

#version 120 (fragment shader)
varying vec4 pass_Color;
void main(void) {
    gl_FragColor = pass_Color;
}

#version 400 (fragment shader)
in vec4 ex_Color;
out vec4 out_Color;
void main(void) {
    out_Color = ex_Color;
}

sentences:
Dividing properties between RigidBody and Collider I am currently making a physics engine in Rust.

The 2 main data structures concerning collision detection are:

RigidBody: Physics-related aspects of the body. Contains a reference to a Collider structure.
Collider: Shape and structural-related aspects

However, I am unsure as to which data structure should store the instance fields:

mass (or inverse mass)
inertia (or inverse inertia)
angle of orientation
restitution

The reason for this absolute segregation is that during collision detection, only references to the concerning Colliders will be passed.

Could someone please advise me on the matter?

sentences:
Javelin throw projectile motion I am trying to simulate throw of javelin using projectile motion. The basic physics of projectile motion of a point was used to position the javelin. For the rotation part, I just assumed that the javelin must be tanget to the projectile path as shown below.

But, if the launch angle was extremely huge, we can see that the projectile range will be extremely small. Now, lets assume, the height of projectile was big, the projectile motion will look as shown below.

The animation looks unnatural because the stick rotates really fast because the curve is extremely steep.

So, I am sure the javelin is not always tangent to the path(of Centre of Gravity of the javelin).

So I thought maybe I need to calculate torque on the javelin. I've also tried this approach but the javelin is extremely shaky. My steps were:

$$torque = r \times \vec{F}$$
$$\vec{F} = mg + ma$$
$$ a = \frac{dv}{dt} $$ v is the
velocity of the centre of javelin at any point of time of projectile motion. We integrate the equation to find the change in torque.
$$d\vec{Torque} = r \times d\vec{force}$$
$$d\vec{Torque} = Id\vec{\omega}$$
Now, we obtain the change in angular velocity, which is then integrated to obtain the orientation of javelin.

I must have messed up somewhere because the integration is not working. Its extremely shaky and it works in some cases where launch angle is small, but fails when launch angle is huge.

So can anybody give me some pointers?

sentences: Unity, interior poly always missing in clothing I've modeled interior polygons but for some reason they do not show up in Unity. I've tried changing import settings for normals to both calculate and import... How do you have a tshirt's interior poly show up?

sentences:
How 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:
Unity, changing gravity game & stopping character when he hit a wall I am currently working on a 2d puzzle game in the unity engine. One of the aspect of this game is the possibility to rotate the level of 90°. It also rotate the gravity.

The main character is not directly controlled by the player, but instead falls when the level is rotated.

When the main character hits a wall, he should stop to moving. If I do not stop it, it kind of blinks and shakes against the wall.

To stop it I detect collision and depending on the current rotation state, the player will stop at "vertical" or "horizontal" tags when a OnCollisonEnter occurs. I must do that because when the player falls on his relative ground, he must not stop like if he had touched a wall.

My problem is the 'side' of platform, or the 'top' of wall, they use the same tag and thus do not give the correct tag to my character. I tried to put a very small invisible box on top/side of elements but the collision occurs nevertheless. It seems when the player falls and hit something he go through a bit before being replaced at correct position by unity.

Is there a way :

1 ) to not stop my character but to make it appear immobile on screen

2 ) To detect a "I cannot move anymore" collision other than by using collision?

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:
libGDX: Why doesn't Gdx.input.isKeyJustPressed() work? I'm trying to use the method Gdx.input.isKeyJustPressed() to check if the Android BACK button was just pressed. I don't want to use the Gdx.input.isKeyPressed method to avoid multiple calls. Here is my code:

public void handleInput() {
    if(Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
         // show previous screen...
    }
}

public void update(float dt) {
    handleInput();
}

But unfortunately this doesn't work. Any ideas?

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: Tools for editing 2D sprite-based game levels What are good free and widely used tools for editing 2D sprite-based game levels? I'm looking for one that allows exporting data to a custom format. One that I know of is Blender — a 3D tool, primarily, but can be used for 2D art as well — which also supports Python scripts for exporting data.

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:
Function Not Storing New Value of Variables? I'm currently building a small-scope RPG and running into an issue with modifying variables.  My goal is to alter my character's stats when I run a procedure to change their equipment.  My code is as follows:
public class Player: MonoBehaviour   {
    //Base stat variables
        public static int PAtk = 12;
        public static int PDef = 6;
    //Battle-exclusive stats.  Will have equipment added onto them.
        public static int Attack = PAtk;
        public static int Defense = PDef;
    //Equipment variables.
        public string weapon;
        public string armor;

    private void Awake()
    {
        //Get equipment
        EquipWeapon("Bronze Sword");
        EquipArmor("Bronze Armor");
    }

void EquipWeapon(string WeaponName)
    {
        weapon = WeaponName;
        EquipmentManager.GetComponent<Equipment>().EquipStatIncrease(PAtk, Attack, PDef, Defense, WeaponName);
    }
void EquipArmor(string ArmorName)
    {
        armor = ArmorName;
        EquipmentManager.GetComponent<Equipment>().EquipStatIncrease(PAtk, Attack, PDef, Defense, ArmorName);
    }
}

public class Equipment: MonoBehaviour  {
    //Create dictionary to give each weapon a key ID.  This will be used for calling items in another array.
        Dictionary<string, int> WeaponDictionary = new Dictionary<string, int>();
    //Create weapon array for stats.
    public int[,] WeaponStats;

    // Start is called before the first frame update
    void Awake()
    {   //Declare weapon IDs
            WeaponDictionary.Add("Bronze Sword", 0);
            WeaponDictionary.Add("Bronze Armor", 1);
        //Declare stat array
        //Table: ID, Atk, Def
        WeaponStats = new int[,]
        {
            {0,4,0},
            {1,0,4}
        };
    }

    public void EquipStatIncrease(int BaseAtk, int BattleAtk, int BaseDef, int BattleDef, string Equipment)
    {
        BattleAtk = BaseAtk + WeaponStats[WeaponDictionary[Equipment], 1];
        Debug.Log(BattleAtk + "Battle Power");
        BattleDef = BaseDef + WeaponStats[WeaponDictionary[Equipment], 2];
        Debug.Log(BattleDef + "Battle Defense");
    }
}

The general gist of it is once EquipWeapon or EquipArmor is ran, the equipment variables in the Player class will be updated.  Afterwards, another function in the Equipment class will be ran with variables from the Player class passed over, in order to be modified by the WeaponStats array.
The Debug logs in EquipStatIncrease show me that I am getting the desired results.  However, the Attack parameter that is being placed into the function is not being permanently modified.  During the first execution of the EquipStatIncrease method, I will get a result of 16 BattleAtk and 6 BattleDef, due to the weapon being equipped.  However, once it's run a second time to equip the armor, I'm shown a result of 12 BattleAtk and 10 BattleDef, even though BattleAtk should have stayed at 16.  This leads me to believe that the variables I'm trying to transform are not being modified, and I'm not sure what to do about this.  In the EquipStatIncrease parameters, BattleAtk gives the message Parameter 'BattleAtk' can be removed if it is not part of a shipped public API; its initial value is never used  However, I don't know what action to take to resolve this.
I'm aware of being able to use an int function instead of void, but unless I'm missing something, that only works if I'm trying to change one variable.  If I want to have an equipment object that affects 2 different stats at once(ex. a weapon that increases BattleAtk and BattleDef), then I don't see how an int function would work.

sentences: In HaxeFlixel, how do I avoid hard-coding dialogue? I'm planning to develop a visual novel in Haxe Flixel and wanted to know if there is a easier way to add dialogue than to hardcode them in every square. I don't know if I can import a txt file with the dialogues or something like that so I can simple change the txt file instead of have to check the code for every typo.

sentences:
Formula Racing Physics in curves (under-steer, over-steer) I have a working physics code for a -let's say-  WipeOut-style vehicle [well, closest approximation]. Some time next year I would like to do a formula game but am struggling to get to tweak my code to behave anywhere near the way the formula (say, like in F1 GP game that ran on 100 MHz Pentiums) behaves in curves.
Visually, think 3D engine and a 3D track (with hills/valleys - but still a track (not a generic heightmap)).
Since the target HW is below 100 MHz and code is written in ASM, we can't use any off-the-shelf physics engines, but it must be written from scratch (initial prototyping will be done in C++ for max productivity and understanding of limitations of the physics component).
Now, I don't have any issue with the following (already working):

non-linear acceleration (e.g. each gear range has different constants/behavior)
hill-based acceleration/decceleration (how steep hill is)
car gets lighter over time (less gas in the tank), affecting acceleration
each parameter can have an additional modifier (linear, non-linear) applied to it over the time

My greatest issue is I can't seem to get the thing to over-steer / under-steer in curves.
I want to allow the player to choose several different levels of physics - from Arcade, through gradually more realistic features, to a full-blown (as far as manageable by me) physics (like in F1GP game). So far, I have these racing physics modes implemented:

Arcade racing (kinda like in Lotus/Outrun)
gear-specific non-linear acceleration (each formula has different characteristics)
hill-based speed-up/down (steepness)
speed-based drag in curves (how quickly car reacts to turning)
tire temperature gradually rising (affecting all physics ranges, modifiers and constants)

Through trial&error I found a way how to get the car to turn faster/slower based on current speed. It works pretty well, but it won't realistically skid the car away from the track (like F1GP does).
Also, nowhere in the code, I actually use any vectors. It's all just constants, valid ranges, and type of applied modifier (none/speed-up/down, linear/non-linear) that we use on the desired variable, as that's the fastest possible way on given platform (all these values fit into available CPU's registers, unlike vectors that have to be read from slow RAM).
So, how does one actually get the car to under-steer/over-steer in curves ? What's the actual physics here ? Rigid Body ? I believe it should be perfectly possible to emulate this feature via 2D vectors (car direction + speed) ?

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:
I need advice on creating animal 3D walk cycles in XNA I want to purchase a number of 3D models from TurboSquid and animate them in an XNA game.

I wrote a lot of games from 1985-1999 and have recently become involved with XNA. Now I would like to port one of my old games to the XBOX. I do have a background in 3D animation; but that was years ago.

What is the current method for animating a walk cycle with a 3D model and using it inside XNA?

Is there a book, software or a tutorial that you can recommend?

Thanks in advance and sorry for such a broad and currently naive question.

sentences:
Scripting a sophisticated RTS AI with Lua I'm planning to develop a somewhat sophisticated RTS AI (eg see BWAPI).  have experience programming, but none in game development, so it seems easiest to start by scripting the AI of an existing game I've played, Warhammer 40k: Dawn of War (2004). As far as I can tell, the game AI is scripted with some variant of Lua (by the file extension .ai or .scar). The online documentation is sparse and the community isn't active anymore.

I'd like to get some idea of the difficulty of this undertaking. Is it practical with a scripting language like Lua to develop a RTS AI that includes FSMs, decision trees, case-based reasoning, and transposition tables?

If someone has any experience scripting Dawn of War, that would also help.

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:
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: What are the best resources on multi-threaded game or game engine design and development? What are the best resources on multi-threaded game or game engine design and development? As this is obviously where computers are headed, I intend to study this topic and I'd like to know what resources and examples are out there.

sentences:
XNA: Check if the sound is playing Quick question:

I have a SoundEffect instance, and I would like to know if it is playing at the moment or not. But there's neither a method, nor a property that would allow to check it...

So, is there a way to know it?

sentences: Find out triangles that are not occluded from a camera view? For a project i need to find out triangles that are directly seen by the camera / user. Triangles that are occluded by other triangles should be ignored. There may be 200 thousand triangles in a model, so raycasting on a CPU is no possibility due to performance. Is there something build in to unity or opengl that can do this? If not how would you approach this problem? Many 3d editing software use techniques, e. g. to select or slice only triangles that are visible.

sentences:
Why does this work in the fragment shader but not in the vertex shader? I'm doing some model view and projection transforms in the vertex shader and I want to determine whether the current vertex will end up on the viewport or not.

After searching a bit I found that after the projection transform the coordinates have not been "normalized". So the criteria for a vertex (after the transforms) to appear in the final viewport is the following:

$$-w<x<w$$  $$-w<y<w$$ $$0<z<w$$

where w is the 4th coordinate of the vertex after the transforms

Performing this check I had a great amount of vertices passing the test without being in the viewport and this caused many sorts of problems in whatever I was trying to implement.

However, passing the vertices in their local coordinates to the fragment shader and then doing the exact same process with the transforms and the tests everything worked out fine.

Why?

sentences:
How can I make an animation using arrays? I want to take an array of sprites, for example

sf::Sprite animation[3] = { stepLeft, inMiddle, stepRight };

and construct an animation by looping them. Is this possible? How do I go about it?

sentences: Hide movieclip parts that are out of bounds I'm making a game where one takes a picture of their face to use on a character.  I have them zoom in on the picture, but the bitmapdata extends out of its movieclip.  How do I assign bounds to my bitmapdata?

sentences:
Sizing a Box2D ground object I am developing a platformer game using SDL2 for graphics and Box2D for physics.
I am currently designing my levels and would like to know if it is better to make the static part of each level (ie: ground) one big (500+ units wide) polygon or to break each level up into multiple tiles just a few units wide.

The Box2D manual says that I should keep my objects small to avoid bugs in the floating point code but having a single large ground object seems like a resonable way of reducing the number of objects in the simulation.

So, can I make my ground object one large 500+ unit polygon or should I break it up into many smaller 1-2 unit polygons.

sentences: Batching in Java (software rendering) I've watched some tutorials on java game development and when they start using spritesheets all they do is get a subimage out of the spritesheet and create a new BufferedImage out of that. Does java do some sort of batching behind the scene when drawing the images like some engines and libraries do? Is it even possible to batch in java, and if so how would I go about doing it?

sentences:
Which one have to use Canvas or Open GL for 2D game in Android I am compleatly new to android gaming.I want to develop a 2D game with some physics in it.I want to know which one i have to use Open GL or Canvas and the reason for selection I want to include a physics engine i dont know anything about that too It will be very help full if anyone can share any idea's and suggections.
Advanced thanks to all ...

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: Gameobject stops moving or gets stuck when colliding with another GameObject I'm currently making a brick breaker style game. My issue comes when the ball is launched off the pad it gets stuck in between two blocks. I have all the blocks on a "Foreground" layer with an "Order in Layer" set to 0. The Ball is on the "Foreground" with an "Order in Layer" set to 1. But the ball will get stuck and quit moving. I've tried changing the orders of the players and it didn't help. Any thoughts?

sentences:
"Unfortunately game has stopped" error on Android device In Unity 2018.4.3f1, I am able to build my APK successfully, but when I try to launch it on my mobile device, it shows: "Unfortunately game has stopped".

I don't know the problem is. Here are the project settings I'm using:

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:
Multiple Input.GetKeyDown happens in low frame rate There is a code that needs to be invoke each time user pressed specific button in my game. So I used Input.GetKeyDown to achieve that, but some reason, that code invokes multiple times even I keep pressing the button.

After some tests, I figured out this happens a lot when the game has low frame late. In a very laggy moment, GetKeyDown returns true very many times.

void Update() {
    if(Input.GetKeyDown(KeyCode.RightArrow)) {
        print("Pressed");
    }
}

I saw a similar issue in here but couldn't find any related information.
https://forum.unity.com/threads/problems-with-input-at-low-framerates.16828/

My game is a very input sensitive game, so my code when the user each time pressed a specific button always invoke when they pressed.

I checked my keyboard is something wrong, but there was no problem with my keyboard.

Why does this happen? According to the Unity doc, it said:

  Returns true during the frame the user starts pressing down the key identified by name

If I used wrong way, then how do I check each time user pressed a button?

Using Unity 2019.1.0f2.

sentences:
Unity Project Settings: What is the difference between "Graphics -> SRP settings" and "Quality -> Rendering -> URP Asset" As the title says, I am a bit confused about the aspect that the URP asset is referenced from two different settings:

"Project Settings -> Graphics -> SRP settings"
"Project Settings -> Quality -> Rendering -> URP Asset"

In a blank URP Project, "Project Settings -> Graphics -> SRP settings" references the HighQuality URP asset, and "Project Settings -> Quality -> Rendering -> URP Asset" has three different tiers, all of which reference their respective URP assed (i.e., either LowQuality, MediumQuality, or HighQuality.
Switching from one quality tier to another applies the respective URP asset, i.e., if I switch the quality tier to Low, the LowQuality URP asset is applied, even though the HighQuality is still set in "Project Settings -> Graphics -> SRP settings".
So now the question: Why do I have to set a URP asset in "Project Settings -> Graphics -> SRP settings" if it seems that it is overridden by the URP asset defined in the quality tab?

sentences:
ScreenToWorldPoint returning wrong position even when given Z plane I have a NavMeshAgent placed on a character model. When I log agent.transform.position I get (4.5, 0.1, 4.5) which is correct (this is a 2.5d game and movement happens along the x and z axes).

I am trying to set up a script so that when I click a location on the screen, the character will turn to face that location.

The problem I'm facing is that the coordinates returned by Camera.ScreenToWorldPoint are not correct:

Vector3 mousePos = Input.mousePosition;
mousePos.z = Camera.main.nearClipPlane;
Vector3 targetPos = Camera.main.ScreenToWorldPoint(mousePos);

Debug.Log(agent.transform.position)
// Logs: (4.5, 0.1, 4.5)

Debug.Log(targetPos)
// Logs: (0.1, 16.7, 0.7)

In this example, I'm clicking on the same place as the agent but the targetPos is not nearly the same.

The y-axis  of targetPos is static (the same no matter where I click), which seems correct. However the values for x and z are not correct. How do I get the correct coordinates for a click?

edit I have this workaround, but I want to know how to solve the original question still:

RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100, rotateTargets))
{
    Vector3 targetPos = hit.point;
    targetPos.y = agent.transform.position.y;
    Vector3 direction = (targetPos - agent.transform.position).normalized;
    Quaternion rotation = Quaternion.LookRotation(direction);
    agent.transform.rotation = rotation;
    agent.updateRotation = false;
    return true;
}

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:
Sprite detached from the screen but contact is still made Well, i'm facing a strange problem with my code. I'm trying to remove a sprite named ice when either of player, enemy or the ground comes in contact with the ice. The contact is made successfully and the ice is hidden after the contact but due to some reasons the player,enemy and the ground still comes in contact with the ice. I want the ice object to be completely removed from the scene when contact is made. I'm using the below code:

public void beginContact(Contact contact) {
    // TODO Auto-generated method stub
    Fixture x1 = contact.getFixtureA();
    Fixture x2 = contact.getFixtureB();

if (x1.getBody().getUserData().equals("player")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    Log.i("Contact Made", "CN");
    detachChild(gb);
    gb.setVisible(false);
    score = score + 1;
    scoreText.setText("Score: " + score);
}
if (x1.getBody().getUserData().equals("ground")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}
if (x1.getBody().getUserData().equals("enemy")
        && x2.getBody().getUserData().equals("ice") && gb.isVisible()==true) {
    detachChild(gb);
    gb.setVisible(false);

}

}

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

just something like

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

sentences:
2D physics without "rebound" I'm trying to get my 2D top down shooter to use -some- physics.
I want the player and enemies not be able to exist in the same position, in other words, use collisions.
My first attempt was to use a CharacterController, but I could not get my other game objects to collide with my player, even though I had a RigidBody2D and a BoxCollider2D on them. Obviously, due to using a CharacterController, I was not able to add these components on my player.
Going one step back, I removed the CharacterController, and rather opted to go the Rigidbody2D route. This worked partially. I now get collisions on my player when he walks into other gameobjects (with RB2D and BC2D on them), but there seems to be a "rebound" anomaly occurring; my player moves around after collision.
I've tried playing around with the settings on the RigidBody2D on the player, but it does not seem to have any effect.
This is my PlayerMovement script :
void Update()
{
    HandleRotation();
    HandleMovement();
}

void HandleRotation()
{
    var mousePos = Input.mousePosition;
    mousePos.z = 5.23f;

    var objectPos = Camera.main.WorldToScreenPoint(transform.position);
    mousePos.x -= objectPos.x;
    mousePos.y -= objectPos.y;

    float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg;
    transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
}

void HandleMovement()
{
    float horizontal = Input.GetAxisRaw(Constants.Axis.Horizontal);
    float vertical = Input.GetAxisRaw(Constants.Axis.Vertical);

    Vector3 direction = new Vector3(horizontal, vertical, 0f).normalized;

    if (direction.magnitude >= 0.1f)
    {
        var speed = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            ? mobileController.runningSpeed
            : mobileController.walkingSpeed;
        var moveVector = (direction * speed) + transform.position;
        mobileController.rigidbody2d.MovePosition(moveVector);

        var camPosition = new Vector3(mobileController.transform.position.x, mobileController.transform.position.y, -10);
        cam.position = camPosition;

    }
}

The settings on my Player :

I would like my player to stop dead in his tracks when colliding with another RigidBody2D. Is this possible? And if so, how would I go about doing that?

sentences:
OpenGL Mapped Memory Shader Source Is there any way to get a pointer to a newly created shader object's source? I'd like to load a shader directly from file in to my shader object instead of loading to an intermediary variable and then using glShaderSource().

I haven't been able to find any information regarding this, only regarding buffers.

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

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

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

Render loop

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

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

    engine.PostRender();
}

UpdateUniformBuffer

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

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

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

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

Draw function

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

sentences:
How do I find the contour points of a png? In my game, I need a way to produce convex polygons from pngs of objects.

For example, a maple leaf would result like this:

Essentially right now, the way my algorithm works is by putting all pixels that have an alpha of 255 in a list. I then create a convex hull from this list, and finally optimize the hull with a graph algorithm. The part I'm trying to optimize is the first part. I'd like a way to have the outline / border pixels of the shape rather than all pixels of the shape.

What sort of algorithm could do this?

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:
What is the easiest way to find a child? using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

    // Start is called before the first frame update
    void Start()
    {
        int counter = 0;

        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        for (int i = 0; i < imagesToLoad.Length; i++)
        {
            var go = Instantiate(saveSlotPrefab);
            go.transform.SetParent(slots);

            Texture2D thisTexture = new Texture2D(100, 100); //NOW INSIDE THE FOR LOOP
            string fileName = imagesToLoad[i];
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;

            go.GetComponent<RawImage>().texture = thisTexture;

            // Here to assign the fileName to the go(saveSlotPrefab) Text child

            counter++;
        }
    }

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

    }
}

This screenshot show example of fileName content :

And this screenshot show the part of the file name I want to extract and assign to the text :

And this screenshot show how the prefab/s are built the Text I want to assign to the file name part is the second child of the prefab. This prefab is the prefabs I'm Instantiating (saveSlotPrefab)

sentences:
What is the formula for the collision of two "stretched spheres"? In Smash Bros Melee, hitboxes aren't perfect spheres or boxes. They are, instead, a shape that looks like a continuous line of consecutive spheres:

I.e., the geometry can represented as:

Hitbox : (fromPos : V3, fromRad : V3, toPos : V3, toRad : V3)

Of course, one could emulate that by creating several spheres in a row, but it will probably not be the most efficient solution. So, what is a formula to test the collision of two of those hitboxes?

sentences:
How to develop custom Unity graphics? Processing is a Java library for working with computer graphics, providing methods by which to draw primitive objects, custom meshes, etc., as well as mathematical methods (such as Simple Harmonic Motion) by which to animate and control them.

p5.js is an equivalent library for JavaScript and working with graphics on the web. You also have openFramworks which is similar but for C++.

How can you achieve similar graphics capabilities in the Unity Game Engine?

Suppose, for example, I wanted to build a game like Duet. I can imagine how I might go about creating those graphics in Processing or p5.js, but not in Unity and C#. How can you have that kind of creative freedom to build and draw in Unity?

Thanks.

sentences:
Box2d jetski on water At the moment I am trying to code a 2d game in java, where a jetski is riding on water. If you press on the screen the jetski should dive down and jump back up on release. How do I have to do this in Box2d? My idea was to put a rectangular body as the water and an other one as the jetski. Since I am new to box2d I don't really know how I should bring this into code.
I hope one of you can help.

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:
Move Player on Mouse click in update loop I'm trying to move my player when clicking the right button on the mouse. The problem is that my player is just standing and "shaking" in the top left corner.

Any idea?

package game;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;

public class Player {
    private Rectangle playerRec;
    float x, y;
    PlayerJLabel playerJLabel;
    int worldX = 800;
    int worldY = 600;
    int targetX, targetY;

    public Player(int posX, int posY, int size){
        playerRec = new Rectangle(posX, posY, size, size);
        x = posX;
        y = posY;

        playerJLabel = new PlayerJLabel();
        playerJLabel.setBounds(0, 0, 800, 600);

        Game.screen.add(playerJLabel);
    }

    public void update(float timeSinceLastFrame){

        if (Mouse.isMouse(MouseEvent.BUTTON3)) {
            targetX = Mouse.getX();
            targetY = Mouse.getY();
        }

        if ((targetX != 0 && targetX != x) && (targetY != 0 && targetY != y)) {
            float dx = (float) (targetX-x);
            float dy = (float) (targetY-y);

            // normalize
            float length = (float) Math.sqrt(dx*dx+dy*dy);
            dx/=length;
            dy/=length;

            // add speed
            x = dx * timeSinceLastFrame * 300;
            y = dy * timeSinceLastFrame * 300;

            // Move the player
            playerRec.x = (int) x;
            playerRec.y = (int) y;

        }

    }

    private Rectangle getRec(){
        return playerRec;
    }

    public class PlayerJLabel extends JLabel{
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.RED);
            g.fillRect(getRec().x, getRec().y, getRec().width, getRec().height);
        }
    }

}

Edit: I have a GameState method which calls the player update() method and a repaint() method which repains the whole scene.

GameState update method:

@Override
public void update(float lastFrame) {
    player.update(lastFrame);
}

Game repaint method:

public void repaint() {
            // screen is a JFrame Object
    screen.repaint();
}

Main class

package game;

public class Main {

    public static void main(String[] args) {
        Game game = new Game("Mein erstes Spiel", 800, 600);

        long lastFrame = System.nanoTime();

        while(game.isRunning()) {
            long thisFrame = System.nanoTime();
            float timeSinceLastFrame = ((float)(thisFrame-lastFrame))/100000f;
            lastFrame=thisFrame;

            game.nextState();
            game.update(timeSinceLastFrame);
            game.repaint();
        }

    }

}

Update 2:

I updated my code to:

        // Move the player
        x = playerRec.x += (int) (dx * timeSinceLastFrame * 500);
        y = playerRec.y += (int) (dy * timeSinceLastFrame * 500);

My player is moving, but not at the same speed and not very smooth: http://screencast.com/t/pv5M9Un4QhFR

sentences:
Passing strings padded with white space into a byte[] I am using Google Play services for a real time multiplayer game in Unity 3d. When sending the data in a byte[] in the multiplayer update I have to pad certain entries going into the byte[] with white space so all entries are a certain length. I am having a problem where they don't have the white spaces anymore when I get the strings back from the byte[].

For example I have a string called username that is set to "test name " with 6 white spaces on the end in order to take up 15 bytes.

I add the string to the byte[] like so:

updateMessage.AddRange(System.Text.Encoding.ASCII.GetBytes(username));

Then to get the part back out I use this code:

string username = System.Text.Encoding.ASCII.GetString(data, 38, 15);

38 is the index where the username string should start and it should be 15 bytes long. It actually ends up going into the next string I have stored because it doesn't have the white spaces anymore.

Is there a way to make sure the white spaces stay in the string so that I keep the padding after pulling it from the byte[]?

sentences:
How to decompose sprite sheet I have a lot of spritesheets that are poorly formatted that I want to decompose, or split out into many small images, one for each sprite.
If I can do that, I can use my custom texture packer tool to build my game assets with.

My development tools are XNA and C# targetting Windows.
How can I decompose the images?

sentences:
Making a game for multiple platforms I am making a game with web, iphone, and android front-ends.  I want to make them all able to interact well through the back-end so that any user can play with any user.

To do this I've decided to make an "API" or really just a Ruby on Rails back-end (with the rails-api gem).  Which option fits best:

1. Back-end First

Process would be building entire back-end functionality, one feature at a time until it is complete (can always expand missing features later).  Can test it using different types of tests.

2. Back-end alongside one platform (web)

Process would be building one feature in the back-end, then using it in the front-end to make sure it works.  Would be easy to build with web because most Rails projects already have views.

3. Back-end alongside each platform

Same as option 2, but building the feature in each platform before moving on to the next one.  Would allow fixes for cross-platform problems as you go along, being able to narrow it down precisely.

Essentially I know possible ways to go about it, but have never made an API or cross-platform game

sentences:
Can't load png in texture I created new project in libgdx without Android, specified for Eclipse. I added testcar.png to assests in core project, refreshed core and desktop projects,

new Texture(Gdx.files.absolute("C:\\TestGame\\desktop\\bin\\testcar.png"));
new Texture(Gdx.files.internal("testcar.png"));

gives

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException:

Couldn't load file: C:/TestGame/desktop/bin/testcar.png
    at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:148)
    at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
    at com.badlogic.gdx.graphics.Texture.(Texture.java:100)
    at com.badlogic.gdx.graphics.Texture.(Texture.java:92)
    at com.mygdx.screens.MainMenuScreen.show(MainMenuScreen.java:33)

but both those constructors work with jpg or gif(same folder as png) without any problem.

What i do wrong ? Is it bug?

sentences:
Approximating particles with with nebula I have a 2d galaxy where each star is rendered a particle:

I'd like to approximate it with nebula, so that instead of seeing lots of tiny dots from afar, users will see lots smooth light in the area. Something like this:

I'm more interested in technology-agnostic solution which accurately resembles underlying particles. E.g. how would one approach this problem from math/physics standpoint?

But if you have hints how to do it in a specific technology - those are welcome too! I don't even know how to approach it. The final thing is implemented with WebGL.

sentences:
Translate camera position toward camera orientation I have a camera position (Vec3) and camera horizontal/vertical angle. Now I want to translate my camera position toward the current camera orientation - what is the best way to do that? I am sure it's simple but the logic escapes me.

(I am using GLM math lib btw)

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:
OpenGL gradient banding on Samsung Galaxy S2 Android phone I've got a live wallpaper out on the market which uses OpenGL to render some basic shapes and a flat plane.  The simple lighting creates a gradient effect across the plane, which looks fine on most devices.  The Samsung Galaxy S2 series seems to have some trouble rendering the gradient, though, as you can see in this screen shot:

The color banding looks awful, especially compared to this screen shot from an Incredible:

I'm using a 565 EGL config in both cases, so I believe this is just a display issue with the GS2 devices.  Can anyone confirm this suspicion?

Is there any solution to the banding?

sentences:
What's the most memory efficient way to load a tiled map? Currently I am working on a simple 2D platformer and I want to load a tiled map.

What I've started working on is loading the tiles using a text file. My first question is simple: is a text file the best way to load a map, and in what cases would different types of files be preferred?

I'm reading the file using a buffered reader. First of all I'm getting it to check the size of the map, then I'm using a second loop to create a byte array of that size. This is my code:

    try {
        BufferedReader findSize = new BufferedReader(new FileReader(filePath));
        String line;
        while ((line = findSize.readLine()) != null) {
            if(!line.startsWith("#")) {
                String[] values = line.split("\\s");
                if(values.length > rowSize)
                    rowSize = values.length;
                columnSize++;
            }
        }
        grid = new short[rowSize][columnSize];
        findSize.close();
    } catch(Exception e) {
        e.getMessage();
    }

    BufferedReader readTiles;
    try {
        readTiles = new BufferedReader(new FileReader(filePath));
        String line;
        short rowNum = -1;
        while ((line = readTiles.readLine()) != null) {
            if(!line.startsWith("#")) {
                rowNum++;
                String[] values = line.split("\\s");
                short y = 0;
                for(String v : values) {
                    grid[y][rowNum] = Byte.parseByte(v);
                    y++;
                }
            }
        }
        readTiles.close();
        initializeMap();
    } catch (Exception e) {
        e.getMessage();
    }

My second question is to ask whether this is the best way to do it. I've done some research and found that BufferedReader is faster than using the scanner, but I'm not exactly sure how I could shorten my code, and if it would be possible to create the array while checking its size. One way I've thought about doing it is through a list, but I'm not sure if this would be more efficient or even possible.

My third question concerns displaying the map. What would be the best way to do this? Should I create an array of BufferedImages and then assign each number in the current array to an index in that array?

sentences:
Communication between Photon Cloud game and web server I am creating a multiplayer game using Photon Cloud (Photon Unity Network). For storage of player data (profile, inventory, achievments) I use web server (asp.net mvc & sql server). How to organize the communication between the game client and the web server? I see two ways:

Use WWW class and send requests direct to web server:

var www = new WWW("http://mygame.com/api/user.get?id=1");
// Each time creates a new connection to the web server

Use Photon Cloud Webhooks and send requests through Photon servers:

PhotonNetwork.WebRpc("user.get?id=1");
// Photon Servers play a Proxy or Relay role between client and web server

— http://doc.photonengine.com/en/realtime/current/reference/webrpc

Which way do you recommend? The first way is simple but each time creates a new connection to the web server. The second way use one persistent connection between client and Photon server but there is a delay between connecting the Photon server to the web server.

sentences:
Apply a special effect to a scene area My 2D game has a second camera on the scene that renders an upside down image of the scene and distorts it, giving the effect of water reflection. I render this camera first, and on top of it I render the main camera.

This is working correctly as expected, however, I want to improve it's performance by performing this process in small sections of the scene instead of the whole screen. I created a trigger to detect which items should be turned upside down and rendered.

How can I turn these items and distort them as I did with the whole scene, but only to the GameObjects detected inside the trigger?

Note: I can't assign them to a layer since the layer is already in use.

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:
Intel GPU running faster than Nvidia GTX 1060 My app in its current state renders only 2 triangles to the screen using OpenGL.
I am using std::chrono::steady_clock for frame counting.

With Intel graphics, I hit 1000fps and with my GTX 1060(6GB) I am getting an absurd frame rate of 480fps.

I have used the Nvidia Optimus Enablement method to force renders on my GPU(reference: http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf)

Why could this be happening? My shaders are under 60 lines of code, there seems to be nothing that is lagging my GPU from my CPU performance.

sentences:
Cannot define Public Transform Target On Unity C# Getting UnityError Saying

  "UnassignedReferenceException: The variable target of Movement_Script has not been assigned

Which is line 5 "public Transform target"

I've tried a lot of things... I can't define it.

using UnityEngine;
using System.Collections;

public class Movement_Script : MonoBehaviour {
  public Transform target;
  public float speed = 1;

  void Update () {

    if(Input.GetKeyDown("up"))
    {
      float step = speed * Time.deltaTime;
      transform.position = Vector3.MoveTowards(transform.position, target.position, step);
    }
    if(Input.GetKeyDown("right"))
    {
      float step = speed * Time.deltaTime * 10;
        transform.position = Vector3.MoveTowards(transform.position, target.position, step);
        transform.Rotate(Time.deltaTime,0 ,-90);
    }
  }
}

sentences: Slick2D: Initializing graphics object before game loop I'm using the Slick2D Java game library and I want to set the scale of the graphics object that gets passed to the render method in my game loop.  I'd like to do this outside the render method, so that I would only have to call the setScale() method once.  I am implementing my game as StateBasedGame, so I'd to like to initialize my graphics object in my StateBasedGame class.  Where would be the appropriate place to do this?

sentences: Using coroutines and texture array for talking animation? I was thinking of having random textures from a texture array being chosen every 0.5 seconds through a coroutine to imitate talking if something like talking=true. Not sure how I could set this up and such so I appreciate any help!

sentences:
Split tile based map file into multiple files I have a gigantic map file (1440x1080) that I wish to split into smaller files (45x45) for faster client reading.  I plan to split offline (when running DEV server) so I am not too worried about speed.  Picture the below as my source file:

5, 5, 5, 4, 5, 6, 5... 5
...
5, 6, 2, 44, 5, 66, 5... 5

I am getting the file to be slightly off towards the end - having trouble doing the math I suppose.  I am totally open to changing the code, but here is what I had so far:

int filesAcross = mapWidth / 45;
int acrossCount = 0;
int filesDown = mapHeight / 45;
int downCount = 0;
int totalFileCount = filesAcross * filesDown;

//create a bunch of stringbuilder holders to split the large file into
StringBuilder[] sbGroundLayerHolders = new StringBuilder[totalFileCount];
for (int kk = 0; kk < totalFileCount; kk++) {
    sbGroundLayerHolders[kk] = new StringBuilder();
}

int countt = 0;
while(scanner.hasNext()){
    int fileCounter = (acrossCount / 45) + ((downCount / 45) * filesAcross);
    //  LOGGER.info("fileCounter: " + fileCounter + "   acrossCount: " + acrossCount +
    //"   downCount: " + downCount + "   countt: " + countt);
    try {
        sbGroundLayerHolders[fileCounter].append(scanner.nextShort());
        sbGroundLayerHolders[fileCounter].append(",");
        acrossCount++;

        countt++;
    } catch (InputMismatchException e){
        scanner.nextLine();
        downCount++;
        acrossCount = 0;

        countt++;
    } catch (ArrayIndexOutOfBoundsException e){
        LOGGER.fatal("Array Out of Bounds on ground Layer - count:" + countt, e);
        System.exit(1);
    }
}

//write array contents into files
for (int kk = 0; kk < totalFileCount; kk++) {
    String s = sbGroundLayerHolders[kk].toString();
    s = s.substring(0, s.length() - 1);
    String[] sSplit = s.split(",");

    StringBuilder q = new StringBuilder();
    for (int jj = 0; jj < sSplit.length; jj++) {
        q.append(sSplit[jj]);

        if (((jj+1) % 45) == 0 && jj != 0) {
            q.append(System.lineSeparator());
        } else {
            q.append(",");
        }
    }

    LOGGER.info("map string(" + kk + "): " + q);
    //createFileLocally(folderPath, filename, text);
}

Here is a sample image of what I want to do (smaller scale).  Start with the big grid 6x6 and split into files 2x2.

sentences:
Create a Texture2D from larger image I am having trouble with the basic logic of this solution:
Xna: Splitting one large texture into an array of smaller textures
in respect to my specific problem (specifically, I'm looking at the second answer.)

How can I use my source rectangle that I already use for drawing to create a new Texture2D?

spriteBatch.Draw(CurrentMap.CollisionSet, currentMap.CellScreenRectangle(x, y),
      CurrentMap.TileSourceRectangle(currentMap.MapCells[x, y].TileDepths[4]),
      Color.FromNonPremultiplied(0,0,0, 45), 0.0f, Vector2.Zero, SpriteEffects.None, 0.91f);

I know I want a method that I started so:

//In Update Method of say the player's character.

Texture2D CollisionTexture = ExtractTexture(MapManager.CurrentMap.CollisionSet, MapManager.TileWidth, MapManager.TileHeight);

// In MapManager Class who knows everything about tiles that make up a level.
    public Texture2D ExtractTexture(Texture2D original, int partWidth, int partheight, MapTile mapCell)
            {
                var dataPerPart = partWidth * partheight;
                Color[] originalPixelData = new Color[original.Width * original.Height];
                original.GetData<Color>(originalPixelData);
                Color[] newTextureData = new Color[dataPerPart];
                original.GetData<Color>(0, CurrentMap.TileSourceRectangle(mapCell.TileDepths[4]), originalPixelData,  0, originalPixelData.Count());
                Texture2D outTexture = new Texture2D(original.GraphicsDevice, partWidth, partheight);
            }

I think the problem is I'm just not understanding the overload of Texture2D.GetData<>

Part of my concern is creating an array of the whole texture in the first place.  Can I target the original texture and create an array of colors for copying based on what I already get from the method TileSourceRecatangle(int)?

sentences:
SFML Animation class as a strategy or an inheritance everybody.
I need to add animations to my game.
And I have a question.

I found AnimatedSprite class on SFML Github which is an inheritance, but in my project, I am using a lot of elements made with strategy pattern,
for example movement behavior, jumping behavior, fighting behavior, etc.
I just try to avoid inheritance because it makes class inflexible.

But this time in contrast to other classes Animation class has a lot of methods
that can be used at runtime. I mean Play(), Stop(), Pause(), and more.
If I use this as a strategy I would have to give access to this object.

What do you think?
Maybe I just need to use another design pattern?

sentences:
Unreal Engine 4 HierarchicalInstancedStaticMesh (HISM) not distance culling What I'm trying to do:
I am trying to programmatically spawn a lot of HierarchicalInstancedStaticMesh on a very very large ProceduralMeshComponent (PMC) (very simplified for the sake of this question).
I generate the "ground" PMC in chunks during run time, and then spawn instances at points on the mesh.

An initial n amount of these  are generated before the player spawns. Additional chunks spawn by calculating values with a separate thread and then spawning them from the original thread. All I am doing in the separate thread is calculating vectors essentially

I have an actor with just a HISM component at the root.

Cull start and end distance is set to 5000
Mesh material has Dithered LOD Transition set to true

What is happening:
The culling on the HISM is simply not working.

Sometimes It won't even show up to begin with
When it does show up, it doesn't cull no matter how far away the camera gets (spectator)
Sometimes it will cull correctly on the initially spawned chunks, but not on the chunks that were generated and spawned after the player spawned

The weirdest part, is that I am also spawning an HISM of a different mesh in exactly the same manner, and it is culling perfectly (though admittedly there are far FAR fewer instances)
Example code:
Here is an example of what I am trying to do. The Terrain actor is placed in the world, the HISM is referenced in a public variable, and this code runs in BeginPlay (and Tick, for subsequent chunks)
Terrain.H:
// The Actor with the HISM as the root component
UPROPERTY(Category = "hism", BlueprintReadWrite, EditAnywhere) TSubclassOf<AActor> FoliageInstance;

Terrain.cpp:
auto spawner = World->SpawnActor<AActor>(FoliageInstance, FVector(0, 0, 0), FRotator::ZeroRotator);

// Another class I wrote that just calculates a ton of vectors
TArray<FVector> spawnPoints = OtherClass.GetATonOfRandomVectors();

// Add an instance for each of the spawn points
for (auto& spawn: spawnPoints)
{
    FRotator grassRotation = FRotator(rand() % 5, rand() % 360, rand() % 5);
    FTransform grassTransform = FTransform(grassRotation, spawn);

    if (spawner != nullptr)
    {
        auto instance = Cast<UHierarchicalInstancedStaticMeshComponent>(spawner->GetRootComponent());
        instance ->AddInstance(grassTransform);
    }
}

sentences:
Peer-to-peer Multiplayer Game I built a casual game where the user answer the right word in random question. Now I want to make this game multiplayer (4 players) working on smartphones and tablets (Androird & iOS) where all the players are clients but one of them is Host/Client who receives the in-game answers to check who won and answer-back to the other three players (Clients) with the score.

However, I'm confused about HLAPI, LLAPI, dedicate server, PUN, Standalone, Local, LAN... I'm a mess right now. What should I choose? having on mind I only send/receive strings, and the game should work with and without Wi-Fi connection.

sentences:
Unity Network Animations Not Smooth I am attempting to learn Unity Networking using the new UNET framework. I have a functioning rudimentary 3rd person setup in which a host and a client can connect to localhost:7777. Animations are working across both client and host. However, some of the animations are not smooth. I am using the ThirdPersonAnimationController and the Ethan model that come with Unity. The animations from running to turning left or right and from running to stopping are quite jittery. However, they are not jittery when viewing the screen in which the controls are being input.

I am using the NetworkManager and my Player prefab has a NetworkAnimator.
I'm calling my movements in the Update function of my Player script:

void Update()
{
    param = anim.parameters;
    if (!isLocalPlayer)
        return;

    float move = Input.GetAxis("Vertical");
    anim.SetFloat("Forward", move);

    float moveTurn = Input.GetAxis("Horizontal");
    anim.SetFloat("Turn", moveTurn);

    Camera.main.transform.position = new Vector3(transform.position.x, 2, transform.position.z - 2.5f);

}

public override void PreStartClient()
{
    GetComponent<NetworkAnimator>().SetParameterAutoSend(0, true);
    GetComponent<NetworkAnimator>().SetParameterAutoSend(1, true);
    GetComponent<NetworkAnimator>().SetParameterAutoSend(4, true);
}

public override void OnStartLocalPlayer()
{
    // good for initializing things only for the local player: cameras, input, etc...
    GetComponent<NetworkAnimator>().SetParameterAutoSend(0, true);
    GetComponent<NetworkAnimator>().SetParameterAutoSend(1, true);
    GetComponent<NetworkAnimator>().SetParameterAutoSend(4, true);

}

Is there a way to improve the animation across the network? Any suggestions would be very helpful. Thanks.

sentences:
How can I notify my AI systems that a target has died? I am currently building a game focusing on AI for my university and this is my first time writing such a complex AI system.

Naturally, I ran into a little logic problem: In the game, the AI uses a hierarchical finite state machine and certain states have a pointer to a character as target for their logic (e.g. attack state has a target character to attack). Additionally, multiple characters might target this one character at the same time.

Now if that character dies, how should I go about telling the AI that the target is no longer valid? I can't just delete the character object, since that would result in invalid pointers and access violations, of course.

I thought about using an event system, where the characters are notified about the death, but how would I know, when all characters removed their reference, changed their state etc. and I could finally delete the object?

Would I have to resort to using smart pointers here? Or is there another good solution?

sentences:
Cheap ways to do scaling ops in shader? I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about how to reduce the amount of data uploaded to the GPU. For my terrain, which uses discrete / grid-based vertex positions in x and z, it's pretty clear that I can replace my vec3s (floats, really) with shorts, halving the per-vertex position attribute cost from 12 bytes each to 6 bytes. Considering I've got little enough other vertex data, and an enormous amount of terrain data to push into the world, it's a major gain.

Currently in my code, one unit in GLSL shaders is equal to 1m in the world. I like that scale. If I move over to using shorts, though, I won't be able to use the same scale, as I would then have a very blocky world where every step in height is an entire metre.

So I see these potential solutions to scale the positional data correctly once it arrives at the vertex shader stage:

Use 10:1 scaling, i.e. 1 short unit = 1 decimetre in CPU-side code. Do a division by 10 in the vertex shader to scale incoming decimetre values back to metres. Arbirary (non-PoT) divisions tend to be slow, however.
Use (some-power-of-two):1 scaling (eg. 8:1), which enables the use of a  bitshift (eg. val >> 3) to do the division... not sure how performant this is in shaders, though. Not as intuitive to read values, but possibly quite a bit faster than div by a non-PoT value.
Use a texture as lookup table to convert the value from decimetres to metres. I've heard that this is really fast.

Or whatever solutions others can offer to achieve the same results -- minimal vertex data with sensible scaling.

sentences:
Create a seemless grid-based polygonal tileset The aesthetics I am going for is demonstrated by many simulation games such as Simcity. But I am looking at this particular example: Polygonal Planet Project by Oskar Stålberg.

I understand the concept: when the player places or upgrades a tile, the game looks at adjacent tiles to figure out which tile should be used. And in most cases, a tile would be self-contained, so I just need to design all possible variant of such tile.

And I have some experience on procedural generation in 3D, so coding isn't the main problem for me.

What I am wondering, are:

Does this type of continuous 3D tilesets have a name? I tried to google some examples/tutorials but failed to find the appropriate keyword.
Are there tools to make the process of creating tile variants easier?
Is there a preferable process to create such tileset? Do I start by creating structures then divide them into repeatable patterns, or should I start with basic tiles and find way to create smooth transition between them?

That's probably too much to answer in detail, but I would like some pointers on this topic (more about asset design than programming I suppose). Thx!

sentences:
Unity build error: "Could not find file...build.asm.js " I made a WebGL game and the first few times it built well, then I continued working on it a bit and when I build it it gives me an error (and does not generate the build files), error: FileNotFoundException:

  Could not find file "C:\Users\Public\Documents\Unity Projects\Infinite
  Side Scroller\Temp\StagingArea\Data\Native\build.asm.js".

Heres the full error message:

  FileNotFoundException: Could not find file "C:\Users\Public\Documents\Unity Projects\Infinite Side Scroller\Temp\StagingArea\Data\Native\build.asm.js".
  System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:305)
  System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
  (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  System.IO.File.OpenRead (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:363)
  System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamReader.cs:167)
  System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding)
  (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string,System.Text.Encoding)
  System.IO.File.ReadAllText (System.String path, System.Text.Encoding encoding) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:587)
  System.IO.File.ReadAllText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:582)
  UnityEditor.WebGL.CodeAnalysisUtils.ReplaceDuplicates (System.String builtCodePath, Int32 interations) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/CodeAnalysisUtils.cs:145)
  UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:589)
  UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)
  UnityEditor.HostView:OnGUI()

What is the problem? And how can I fix it?

Feel free to ask me for more information?

Thanks in advance for the help!

sentences:
How to parse & "pack" network commands? I'm currently creating a game which should be multiplayer (client-server-client), but I'm stuck.

I have been doing crazy things like building a text chain like

string networkMessage = userHash+" "+userX+" "+userY+" "+userRotation;

but it looks crazy and parsing is also bad

string[] pieces = networkMessage.Split(' ');
string userHash = pieces[0];
int userX = pieces[1];
int userY = pieces[2];
float userRotation = pieces[3];

So, what is the best way to pack my network commands & parse them on the second side?

Yeah, ehm.. I'm using TCP & StreamReader/StreamWriter

PS: yes, I know that giving client a possibility to set their coordinates is cheating risk and I'll change it later, so server will be more authorative

sentences: XNA Texture2D storage question Are Texture2D objects stored on the graphics card or on system memory? I am thinking that the backbuffer is located on the graphics card (by default) and that the textures are on the system memory. I am using a spritebatch class that writes the textures to the backbuffer which are then rendered when the Present() function is called. Is this how XNA does it or am I completetly off?

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:
How do you move a sprite in sub-pixel increments? Pixels are either on or off. The minimum amount you can move a sprite is a single pixel. So how you make the sprite move slower than 1 pixel per frame?

The way I did it was to add the speed to a variable and test if it had reached 1 (or -1). If it did, then I would move the sprite and reset the variable to 0, like so:

update(dt):
    temp_dx += speed * dt
    temp_dy += speed * dt

    if (temp_dx > 1)
        move sprite
        reset temp_dx to 0
    if (tempy_dy > 1)
        move sprite
        reset temp_dy to 0

I disliked this approach because it feels silly and the sprite's movement looks very jerky. So in what way would you implement sub-pixel movement?

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:
Best free advertising for Facebook strategy game I have written a game for Facebook. I think the game is fun to play, although the graphic presentation is primitive since I am not a graphic artist/web designer

I am the only Facebook user playing the game at this time. It does not appear to appeal to FB's demographic audience who seem to prefer less complex and less challenging games. Does anyone have any ideas on how I could get the word out about my game to the proper audience while spending very little or no money?

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:
Orbital rotation equation I am developing a space sandbox (3D). Now I am working on an asteroid belt around a planet. I have an Asteroid class and an AsteroidBelt class that has a collection of the Asteroid instances. Each Asteroid object is placed randomly during initialization.

Asteroid class:

Matrix4 transform;
double angle;
float x, y, z;
Vector3 initPosition;

public Asteroid(ModelObject object, Texture diffuseTex){

    initPosition = new Vector3(
            MathUtils.random(-Settings.RingsDepth, Settings.RingsDepth), //x
            MathUtils.random(-.5f, .5f), //y
            MathUtils.random(-Settings.RingsDepth, Settings.RingsDepth)); //z
}

public void update(Camera camera){

    angle += Settings.RingsRotationalSpeed;
    if(angle>360) angle=0;
    if(angle<0) angle = 360;

    double angleRad = angle * MathUtils.degreesToRadians;

    x = (float) (Math.sin(angleRad) * Settings.RingsRadius  + initPosition.x);
    y = initPosition.y;
    z = (float) (Math.cos(angleRad) * Settings.RingsRadius + initPosition.z);

    transform.idt();
    transform.translate(x, y, z);
}

The code above works correctly, but it doesn't allow to rotate the asteroid belt around a planet. How to modify x, y, and z to rotate the asteroid belt around a planet freely? I hope the illustration below will clarify my problem:

Now the asteroid belt looks like below:

But I need to rotate it from -90 to 90 degrees by X and Y axis:

Any help will be appreciated!

sentences:
Representing realistic population What's the best way to represent a realistic population number (e.g USA:317,569,000) in game?

For example, Civilization your city has 1 Citizen. Obviously, a city can't just have one person in a city but Civ seems to do a good job at representing citizens that way.

What I'm after is to represent 300+ million in an easy to swallow number to a player.

I have a calculation which states that, in theory, to have 300+ people you would need 79 million 4 person dwellings. (I understand this may not be totally accurate, but it works for my needs)

It seems tedious to have the player do that with a couple of methods I've thought about.

So my question then is I need some way to make the game and the player aware that the player's city has 100,000 people in it without making the player create 25,000 dwellings.

Update 1:

As @Patrick M states, in Civ you only have to build one of a building type.

Much like dwellings, it doesn't make sense to force the player to build one police station/1000 people.

I have a formula that calculates the theoretical population limits of an area and I want to constrain the player to this limit. (Players have a reason for wanting larger regions)

However, I don't want the player to instantly have 10,000 citizens simply because he built a "house/neighborhood".

I want to represent real world constraints and requirements without the super micro management that would be present in forcing the player to build 2,500 dwellings (to get the 10k)

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:
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:
Adding Shader Model 3.0 support to my Direct3D9 app So far, we've only used pixel shaders because we never needed to do any custom processing at the vertex shader level. However, the 3.0 model shader forces you to define a vertex shader. And that's where I get lost.

That's because our pixel shaders have this signature:

sampler2D Texture0;

struct PixelShaderInput{
        float2 TexCoord : TEXCOORD0;
        float4 Color : COLOR;
};
struct PixelShaderOutput {
    float4 color : COLOR0;
};
PixelShaderOutput PixelShaderFirstPass( PixelShaderInput input ) {
        //Magic happens here
        //We use the tex2D function to sample Texture0
}

From what I've read about vertex shaders, the vertex shader output is the pixel shader input. So I added this:

struct VertexShaderInput{
    float4 Position : POSITION;
}

PixelShaderInput MyVertexShader( VertexShaderInput input  ){
     //At a loss here...
}

I don't know how to map the vertex shader input to the pixel shader input. All examples I found on the web just have the vertex shader return a float4, which is what their pixel shader expects.

sentences:
Unity: Unable to rearrange "Sorting Layer" for 2D game Since yesterday I got a bit into game development with Unity (i've never done game development before), and I am currently making a small 2D game. I am attempting to rearrange the various layers in the "Sorting Layers" list. According to Unity's own official tutorial, you can simply drag & drop the layers around to rearrange them. However, when I click on one of the layers, I can not drag it anywhere.

Can someone help me out?

sentences:
Graphics messed up when I try to reskin the game in Android Studio I need a little help. I'm new in Android Studio, I have a game where I want to reskin the design. First of all when I install it on my phone with the original files the game run perfectly without problems. When I try to reskin the photos in my assets folder, I save it, build it in APK file, I install the game and then the graphics is messed up. Here is screenshot of the game after the reskin.
Sorry for my bad English...

sentences:
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: How do I use playerprefs to make ui slider keep the sound settings? I have not use playerprefs before, I want to know how to keep the change of the audio when the player change it throughout the game.

sentences:
Averaging normals, or tangents I am using a library to load an obj but it doest compute the tangets for each vertex, which I need for normal mapping and pom. I computed my tangets, and bitangents, everything appears to be fine, but I read that I need to average tangents if the vertices are the same (same position, uv, normal).

So for example if there is a vertex v that has the same pos,uv & norms as vertex v1 and v2, then the tangent for vertex v, v1, and v2 is normalize(v.t + v1.t + v2.t)?

I want to make sure I have the correct understanding before implementing.

sentences:
Render two images to an SDL_window I want to create a menu for an SDL game, so I load an Image to an SDL_Window as the background, then I try to load the next image which will be a button but it doesn't display the button to the window, it just displays the background.

I'm a newbie so perhaps it is an obvious mistake.

Here's what I got:

#include <stdio.h>
#define SDL_MAIN_HANDLED
#include "SDL.h"

int main(int argc, char *argv[])
{
    int a = 1;
    SDL_Event event;

    SDL_Window* window;
    SDL_Surface* background_surface;
    SDL_Texture* background_texture;
    SDL_Renderer* background_renderer;
    SDL_Surface* button_surface;
    SDL_Texture* button_texture;
    SDL_Renderer* button_renderer;

    SDL_Rect button_pos;
    button_pos.h = 65;
    button_pos.w = 320;
    button_pos.x = 0;
    button_pos.y = 0;

    SDL_Init(SDL_INIT_VIDEO);
    window = SDL_CreateWindow(
        "Cosmic Racing",
        SDL_WINDOWPOS_CENTERED,
        SDL_WINDOWPOS_CENTERED,
        320,
        568,
        SDL_WINDOW_OPENGL
    );
    background_renderer = SDL_CreateRenderer(window, -1, 0);
    background_surface = SDL_LoadBMP("Background.bmp");
    background_texture = SDL_CreateTextureFromSurface(background_renderer, background_surface);
    SDL_RenderCopy(background_renderer, background_texture, NULL, NULL);
    SDL_RenderPresent(background_renderer);

    button_renderer = SDL_CreateRenderer(window, -1, 0);
    button_surface = SDL_LoadBMP("Play.bmp");
    button_texture = SDL_CreateTextureFromSurface(button_renderer, button_surface);
    SDL_RenderCopy(button_renderer, button_texture, &button_pos, NULL);
    SDL_RenderPresent(button_renderer);

    while(a)
    {
        SDL_PollEvent(&event);
        if(event.type == SDL_QUIT)
        {
            a = 0;
        }
    }

    SDL_DestroyTexture(button_texture);
    SDL_FreeSurface(button_surface);
    SDL_DestroyRenderer(button_renderer);
    SDL_DestroyTexture(background_texture);
    SDL_FreeSurface(background_surface);
    SDL_DestroyRenderer(background_renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

BTW if you find additional mistakes please tell me. Thank you ;)

sentences:
Android Game Development problem with Speed = Distance / Time I have been coding speed for an object. I have made it so the object will move from one end of the screen to another at a speed depending on the screen size, at the monemt I have made it so it will take one second to pass the screen. So i have worked out the speed in code but when I go to assign the speed it tells me to force close and i do not understand why. Here is the code:

MainGame Code:

@Override
protected void onDraw(Canvas canvas) {
    setBlockSpeed(getWidth());
}

private int blockSpeed;
 private void setBlockSpeed(int screenWidth){
Log.d(TAG, "screenWidth " + screenWidth);
 blockSpeed = screenWidth / 100; // 100 is the FPS.. i want it to take 1 second to pass the screen
 Math.round(blockSpeed); // to make it a whole number
 block.speed = blockSpeed; // this is line 318!! if i put eg block.speed = 8; it still tells me to force close
 }

Block.java Code:

public int speed;

public void draw(Canvas canvas) {
    canvas.drawBitmap(bitmap, x - (bitmap.getWidth() / 2), y - (bitmap.getHeight() / 2), null);
    if(dontmove == 0){
        this.x -= speed; // if it was eg this.x -= 18; it would not have an error

    }
}

The exception

06-08 13:22:34.315: E/AndroidRuntime(2801): FATAL EXCEPTION: Thread-11
06-08 13:22:34.315: E/AndroidRuntime(2801): java.lang.NullPointerException
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainGame.setBlockSpeed(MainGame.java:318)
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainGame.onDraw(MainGame.java:351)
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainThread.run(MainThread.java:64)

sentences:
Should texture regions sizes be power of two? Is it advisable for my individual texture regions inside this texture to be power of two, or that won't make any difference?

I've read on several places that it's recommended to use power of two sized textures (e.g. Should I use textures not sized to a power of 2?).

sentences:
Line at edge of transparent texture on XNA mesh I have a mesh that is computer generated with a texture on top of it with transparancy on one side. The SamplerState is set to LinearWrap because I would like the texture to wrap. The problem I have is that this transparent edge has some weird aliasing. This does not occur when I set the SamplerState to LinearClamp.

I found that when letting the U coordinate go from 0.1 to 0.9 this does not happen. Probably on the transparent side it interpolates U coordinate 1 with U coordinate 0.

What could be the solution to prevent aside from not letting the U coordinate go all the way to 1?

sentences:
Why have a publisher on Steam now, when you can self-publish and the Greenlighting process is the same? I can't find a definitive answer to whether putting up your game on Steam via a publisher helps somehow, other than bringing some popularity due to publisher's other games/apps. It seems that Greenlight procedure doesn't change or speed up if you have a publisher, or decide to publish yourself (at least according to Steam itself, officially, but who knows what goes on behind the scenes).

The general sentiment on the internet seems to be that you should "cut out the middleman" and save your money that would otherwise go elsewhere, for almost nothing.

People are comparing the Steam publisher to other game, music and video publishers (networks), saying they exist to help distribute your product by making physical copies (optical discs, usb drives, third-party stores), but this doesn't seem to apply to Steam, as there's nothing physical involved.

There's also a matter of advertisement, community management and posting news, updates, etc to create more visibility, which you can also manage on your own, if you wish.

So besides that, are there any important benefits to having a publisher on Steam?

sentences:
How to connect a skeleton to an animator at the parent I have two different meshes with similar armatures. And the parent contains the Animator Component with a universal avatar and animation controller.
The animations doesn't apply when the bones are not the imminent child of the Animator. Is there a way to get this working?

sentences:
When should I set a texture as a shader resource in order to read it? I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth texture and the shader resource view per frame, or just once when attaching?

this.depthStencilShaderResourceVariable = this.effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthTextureShaderResourceView);

sentences:
Given its direction, and another vector that begins at the same point, how can I find the magnitude of that vector using only vector math? I've solved this using the law of sines, but I was wondering if there's a way to do this with just vector math.
Here's a diagram that will hopefully help illustrate what I'm trying to do:

Given vector a and the direction of b, how can I find the magnitude of b? Both vectors share a common origin point. The white line is just supposed to show that both vectors will extend to the same position on either the x or y axis.

sentences:
Box2d stopping the movement of an object I am in the process of making a game and I need an object to move only when the buttons are pressed. I have a method that begins the movement, and so far I am ending the movement of an object by having destroying the body of the object. The problem that I have is that every subsequent time that I try and move the ship the program crashes.

Here is my code.

Initializer method that contains the shipBody and its definition.

-(id) init
{
    if( (self=[super init])) {

        CGSize s = [CCDirector sharedDirector].winSize;

        //create spaceShip sprite and add it to the layer
        _ship = [CCSprite spriteWithFile:@"theShip.gif" ];
        _ship.position = ccp(s.width/2, 1.25*_ship.contentSize.height);
        [self addChild:_ship];

        //create the world
        b2Vec2 gravity = b2Vec2_zero;
        _world = new b2World(gravity);

        //create ship body
        b2BodyDef shipBodyDef;
        shipBodyDef.type = b2_dynamicBody;
        shipBodyDef.position.Set((s.width/2)/PTM_RATIO, (1.25*_ship.contentSize.height)/PTM_RATIO);
        shipBodyDef.userData = _ship;

        if(_shipBody == NULL){
        _shipBody =_world->CreateBody(&shipBodyDef);
        }

        //create ship shape
        b2PolygonShape shipShape;
        shipShape.SetAsBox(_ship.contentSize.width/PTM_RATIO/2, _ship.contentSize.height/PTM_RATIO/2);

        //create Ship definition and add to body
        b2FixtureDef ShipShapeDef;
        ShipShapeDef.shape = &shipShape;
        ShipShapeDef.density = 3;
        ShipShapeDef.friction =0;
        ShipShapeDef.restitution =0;
        _shipFixture = _shipBody->CreateFixture(&ShipShapeDef);

        ......
}

When the paddle is pressed and movement happens logic. THis is related to the problem since this is how movement of a sprite is achieved in the first place.

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    //Set up a way for touches to be turned into locations onscreen
    NSSet *allTouches = [event allTouches];
    UITouch *touch = [allTouches anyObject];
    CGPoint location = [touch locationInView:[touch view]];
    location = [[CCDirector sharedDirector] convertToGL:location ];

    //check to see if Left Paddle is being pressed
    if (CGRectContainsPoint([_paddle1 boundingBox], location)){
        b2Vec2 force = b2Vec2(-5,0);
        _shipBody->ApplyLinearImpulse(force, _shipBody ->GetPosition());
        }
    if (CGRectContainsPoint([_paddle2 boundingBox], location)){
        b2Vec2 force = b2Vec2(5,0);
        _shipBody->ApplyLinearImpulse(force, _shipBody->GetPosition());
    }
}

Logic for when touches stop. This is the problem area since destroying the shipBody stops all future movement as well.

-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    _world->DestroyBody(_shipBody);
 }
 @end

sentences:
How to convert non-discreate data for discreate pathfinding? I have a list of entities that looks like [{x,y,width,height}, {x,y,width,height}, ...]. This list is non-discreate, It doesn't follow a grid. entities can be positioned at floats like x:2.345

Most path finding solutions I've found like A* expect a discrete grid to perform the calculations.

I've looked at Theta* as a solution it supports non-discreate pathfinding on a navigation mesh.

Either way I need to convert this entity data into a Grid or Navigation Mesh. This is probably a common task but new for me. I'm doing this in Javascript and would appreciate any examples in that language.

also some entities will be moving in realtime and will effect future path generation of other entities.

sentences:
Detecting a click on a tile I'm making a simple tile-map system in LWJGL, and I'm trying to figure out how to detect if the mouse is clicking inside of a tile. So far no matter where I click it's always the same tile that is shown.

Code:

int blockWidth = 100;
int blockHeight = 100;

List<Tile> tiles = new ArrayList<Tile>();

private void addTiles(){
    for(int i = 0; i < ((Display.getHeight() / blockHeight) * (Display.getWidth() / blockWidth)); i++)
        tiles.add(new Tile(10,10,blockWidth,blockHeight, i));
}

//...

if(Mouse.isButtonDown(0)){
            System.out.println("Mouse clicked at (" + Mouse.getX() + ", " + Mouse.getY() + ")");
            for(Tile tile : tiles){
                if(tile.inBounds(Mouse.getX(), Mouse.getY())){
                    tile.highlight();
                    System.out.println("Box clicked at (" + Mouse.getX() + ", " + Mouse.getY() + ").");
                    break;
                }
            }
}

the inBounds method:

public boolean inBounds(int x, int y){
    Rectangle bounds = new Rectangle();
    bounds.setBounds(x, y, width, height);
    if(bounds.intersects(x,y,1,1)){
        System.out.println("Tile " + num + " clicked. X/Y val is (" + this.x + "," + this.y + ")");
        return true;
    }else{
        return false;
    }

}

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:
Splitting up duties for a card game server I'm working on a game where players connect to a game server and to a lobby to play a card game against others.

I have a pretty good idea how to code it and such, I'm just not sure regarding a few details.

The game will have multiple lobbies, so although all lobbies run from the same exe and server, the player is bound to a specific lobby.

When the player connects to a lobby, I need to:

-Tell all the players in the lobby about it

-Send that player their list of online friends

-Send that player the list of all players online (in that lobby)

-Send that player the list of all current games and who's playing in each game (This info is all displayed in a ListBox).

Once that player is connected, I need to ensure that while they were receiving that information, if anyone else joined, or any games ended / started etc, that they dont miss any of those messages.

In a single-threaded world, I'd find this pretty simple, but I fear this would mean horrible lag or something every time someone joins. (I could be wrong though).

I'm wondering in general what would be an ideal way to tackle this problem such that it minimizes slow downs for other players. What I mean is, the whole server should not halt for 3 seconds while a user joins.

I guess with a message system it is not too bad since the server can get work done while it waits for the reply. But how robust is such a message system? Login / Authentication be on its own thread, and then it sends a message to the lobby thread which would handle any lobby related transactions. Should each game be in its own thread or should I loop through each active game and process them iteratively?

In addition, each game has a private chat between the 4 players. Each lobby has a chat that only players in the lobby and not in a game can see.

I was also wondering if I should incrementally update the lobby for players in a game or send them a full update when they finish a game.

If anyone could lead me in the right direction for any or all of these questions I would really appreciate it.

I'm coding this in C++ with a network library called ENet, but I'm not looking for any code, but maybe psudocode.

Thanks

sentences:
How to fight against memory editing cheat software? What is the best way to protect run-time memory from such software?

We just published an online game (written on AS3, Flash, published on a social network), and pretty much all of the players got max_int money just using a simple memory editor ("ArtMoney").

sentences:
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:
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:
Cocos2dx - Touch not recognized on Android I'm having trouble with a touch listener not picking up touch events on android, but doing fine in windows (mouse input). I've got a Node listening for touches (not a Layer), but from what I've been seeing around it seems having it on a Layer isn't a requirement anymore?

Setup

void DodgePlayerController::setupPlayerInput()
{
    CCLOG("DodgePlayerController::setupPlayerInput()");
    if (myPawn)
    {
        Pellet* myPellet = dynamic_cast<Pellet*>(myPawn);
        if (myPellet)
        {
            CCLOG("DodgePlayerController::setupPlayerInput() !!2!!");
            //setup the player input and events (should build some sort of player controller)
            auto listener = EventListenerTouchAllAtOnce::create();
            listener->onTouchesBegan = CC_CALLBACK_2(Pellet::setTargetPosition, myPellet);
            listener->onTouchesMoved = CC_CALLBACK_2(Pellet::setTargetPosition, myPellet);
            listener->onTouchesEnded = CC_CALLBACK_2(Pellet::clearTargetPosition, myPellet);
            listener->onTouchesCancelled = CC_CALLBACK_2(Pellet::clearTargetPosition, myPellet);

            auto dispatcher = getEventDispatcher();
            dispatcher->addEventListenerWithSceneGraphPriority(listener, this);
        }
    }
}

When logging on Android, I'm getting through both CCLOG messages correctly (I have a 'disablePlayerInput()' which isn't being called, so the listener shouldn't be removed). This all works fine in the windows application, but when I load it in Android the touches aren't picked up (Pellet::setTargetPosition also has a log message which doesn't get thrown in android).

Anyone know what I might be missing?

sentences: 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:
Sphere-Sphere intersection and Circle-Sphere intersection I have code for circle-circle intersection. But I need to expand it to 3-D.
How do I calculate:

Radius and center of the intersection circle of two spheres
Points of the intersection of a sphere and a circle?

Given two spheres (sc0,sr0) and (sc1,sr1), I need to calculate a circle of intersection whose center is ci and whose radius is ri.
Moreover, given a sphere (sc0,sr0) and a circle (cc0, cr0), I need to calulate the two intersection points (pi0, pi1)
I have checked this link and this link, but I could not understand the logic behind them and how to code them.

I tried ProGAL library for sphere-sphere-sphere intersection, but the resulting coordinates are rounded. I need precise results.

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 to rotate an object around world aligned axes? I have a Vector3 which has an euler angle for each axis.

Usually, when I want to create a rotation matrix I will use functions such as D3DXMatrixRotationX passing the respective angle from my rotation vector above and multiply the matrices (ZXY) to create the overall rotation matrix which is used to form the complete object transformation matrix.

However, this method will produce a set of rotations in object space. That is, passing a vector of (90, 0, 90) into my method will create a rotation in world space effectively of (90, 90, 0).

Is there a way to always ensure each component of my rotation vector results in a rotation around the respective world space aligned axes?

EDIT:

This is an animation of what is currently happening - I want a way to rotate around the blue axes, not the red.

EDIT 2:

Just to note I am not looking for a solution involving Euler angles, but simply a way in which I can represent a transformation of multiple rotations around the world axes.

sentences:
Keyboard input conflict in wall jump I'm trying to make a Megaman-style wall jump in my 2D platform game with JavaScript.

The character can do A,B,C motions when it sticks the wall:

My problem is that when I trying to jump off the wall(motion C), it goes to motion A or B first, C was not happened. I think the keyboard input was conflict but I have no idea how to handle it.

Here is my current code:

if(key['right'] && key['jump']) {//it doesn't work
    //jump off the wall
} else if(key['right']) {
    //leave the wall
} else if(key['left']) {
    //stick the wall
} else {//release all keys
    //falling down
}

Please, Any help would be appreciated.

sentences: Is SVG a viable technology choice for web-based game? I have started to read up about the web technology available for doing web-based game with only Javascript, but I have no where got feedback about SVG with HTML5. Is is a viable choice ? Does it performs well compared to other technique like Canvas, DOM & CSS Transformation, etc.

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 does a game without loading times work? We're talking about an expansive game that is not divided in levels or checkpoints. A 3D adventure, for example.

sentences:
Converting an XNA game from WINDOWS to XBOX I have an XNA game for WINDOWS which I want to work on XBOX also.

I've designed the game so that when I want to connect it to an XBOX, all I have to do is supply a different input class,

And I would do that by checking with the preprocessor macros and checking if it's windows or xbox.

But then, when I tried to do Create a copy of this project for XBOX in VisualStudio, it created several new projects (the real XNA project and some of it's dependencies), and it complained about things not working for C# 3.0 and that I should use C# 4.0 instead, which I didn't find out how to do either.

What's the correct way to make both WINDOWS and XBOX versions of an XNA game?

And also, how do I really run the game on XBOX? I haven't found a good tutorial on how I do that... also I don't have an XboxLive membership so if there's a hacky way to do that, it's better

sentences:
Problems with collisions (using vector of instances) I wrote a for loop to check every instance of the class Wall, only the the last instance in the vector properly works

hybrid.h
 void reactTo(Player* other)
 {
     if (react)
     {
         if ((other->back<front && other->front > front) && (other->y > foot && other->y < head))
         {
             other->goAhead[0] = false;
         }
         else
         {
             other->goAhead[0] = true;

             if ((other->front >= back) && other->back < back && other->y > foot && other->y < head)
             {
                 other->goAhead[1] = false;
             }
             else
             {
                 other->goAhead[1] = true;
             }
         }
     }
     if (other->foot <= head && other->head >= head && other->x > back && other->x < front)
     {
         other->goAhead[2] = false;
     }
     else
     {
         other->goAhead[2] = true;
         if ((other->head >= foot) && other->foot < foot && foot && other->x > back && other->x < front)
         {
             other->goAhead[3] = false;
         }
         else
         {
             other->goAhead[3] = true;
         }
     }
     if (other->front > back && other->back <= front && other->head < head && other->foot > foot)
     {
         R = 0;
     }
     else
     {
         R = 1;
     }
 }

source.cpp
#include"hybrid/hybrid.h"

int main()
{
   setWindowSize(1500, 600);

   makeSequenceWall();//push back 5 Wall constructor

   Player p(300, 300,30,30,0.5,0,1,0);
   //------------
   slWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "HYBRID", false);
   while (!slShouldClose())
   {
               //----------
       p.move();
       p.render();//render the player

       for (int i = 0; i != 5; i++)//check the collision
       {
           wallSeq.at(i).reactTo(&p);
       }

       for (itr = wallSeq.begin(); itr != wallSeq.end();itr++)//render the wall
       {
           itr->render();
       }

       slRender();

   }
   slClose();
   return 0;
}

```

sentences:
3DS Max 2015 - Viewport issues when using sub-object selection box I'm fairly new to using 3DS Max (2015), and have encountered an issue that I can't figure out.

Whenever I'm using the selection tools (Vertices, Edges, Polys, etc) and drag out a marquee/selection box, it has a regular tendency of either forcing a strange wireframe view, or actually sending the whole viewport grey.

This is immediately fixed once I release the marquee, however it does interfere with my ability to select and manipulate objects, as I'm forced to select by memory. It tends to happen in 'spurts', and then doesn't happen for a few more minutes, so it would seem that it's not a setting issue or the like, as it doesn't happen consistently.

I have discussed the issue with someone who is familiar with the software, and he believes that it is a memory/performance thing, and isn't necessarily a bug. If this is the case, is there any way of disabling the feature?

I have attached images demonstrating the issue below:

Working image. This is the view for both the images below it; pan or zoom doesn't change at all.
Greyed out viewport. This is the most common change that happens, and restricts any sort of view of the object (or any other object).
WireframeThis happens reasonably regularly, though not as much as the completely greyed out view. I can handle this view if necessary, though wold still appreciate the ability to disable the 'feature' altogether.

I can confirm that none of the objects are in isolation mode, although it does happen under that mode too (for what it's worth). It also happens in all

My system specs are:

Processor: Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz
Graphics: NVIDIA GeForce GTX 880M - 8GBVRAM
RAM: 32GB
OS: Windows 8.1 x64

I hope that I have provided enough information, and please let me know if you need more.

I tried asking this over on the Graphic Design SE, but was shot down when finding out that the community seems to have agreed NOT to answer any questions relating to 3D modelling, so I really hope this is a place I can ask! If not, please give me somewhere to go, because I'm running out of options. :/

Thanks in advance.

sentences:
Java single Array best choice for accessing pixels for manipulation? I am just watching this tutorial https://www.youtube.com/watch?v=HwUnMy_pR6A and the guy (who seems to be pretty competent) is using a single array to store and access the pixels of his to-be-rendered image.

I was wondering if this really is the best way to do this. The alternative of Multi-Array does have one pointer more, but Arrays do have an O(1) for accessing each index and calculating the index in a single array seems to take one addition and one multiplication operation per pixel.

And if Multi-Arrays really are bad, can't you use something with Hashing to avoid those addition and multiplication operations?

EDIT: here is his code...

public class Screen {
private int width, height;
public int[] pixels;

public Screen(int width, int height) {
    this.width = width;
    this.height = height;

    // creating array the size of one index/int for every pixel
    // single array has better performance than multi-array
    pixels = new int[width * height];
}

public void render() {
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            pixels[x + y * width] = 0xff00ff;
        }
    }
}
}

sentences:
Deferred shadow mapping Question:

What am i doing wrong in the CalcShadowFactor method? It looks like the depth check is not working correctly.

Body:

I'm using deferred rendering in my engine and i have generated the following shadow map:

Which is draw by the following fragment:

void main()
{
    gl_FragColor = vec4(texture(gColorMap, TexCoord0).x);

}

The position texture is generated like this:

WorldPos0      = (gWorld * vec4(Position, 1.0)).xyz;

Where gWorld is the transformation of the object being draw(translation * rotation* scale)

Finally, in the light pass, i want to generate the shadow produced from this spotlight with the following code:

float CalcShadowFactor(vec3 WorldPos)
{
    vec4 ShadowCoord = gLightWVP  * vec4(WorldPos,1);
    ShadowCoord /= ShadowCoord.w;
    vec2 UVCoords;
    UVCoords.x = 0.5 * ShadowCoord.x + 0.5;
    UVCoords.y = 0.5 * ShadowCoord.y + 0.5;
    float z = 0.5 * ShadowCoord.z + 0.5;
    float Depth = texture(gShadowMap, UVCoords).x;
    if (Depth < z + 0.00001)
        return 0;
    else
        return 1.0;
}

It returns a float which multiplicates the color output. I know, im just returning 0 to set the color to complete transparent, it is intensional. The variables used were:

gLightWVP: It is the ProjectionView of the camare set at the light:

Projection * LightCameraRotation * LightCameraTranslation
WorldPos: It is the position got from the Position Texture:

vec3 WorldPos = texture2D( gPositionMap, TextCoord0 ).xyz;
gShadowMap: It is the shadow map texture sampler.

This is what is displayed(notice how the spotlight looks at the first image):

The engine passes are:

Shadow pass: Render the scene for every light using a alternative camera which is placed in their position with their orientation. It generates the shadow maps for every light. Currently i just have one shadow map for that spot light.
Render pass: It renders all the scene using the main camera. It generates the position map, normal map, diffuse map and a specular map.
Light pass: It uses all the textures generated to place the illumination. Here is where the shadow map is being checked for generate the shadows.

EDIT: I'll also leave here the shadow map texture definition.

glGenTextures(1, &m_shadowMap);
glBindTexture(GL_TEXTURE_2D, m_shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, WindowWidth, WindowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_shadowMap, 0);

sentences:
Detecting overlap with Phaser P2 physics In a 2D platformer, I'd like to implement a ladder. I have collision working between the player and ground tiles. Now I would like to be able to detect when the player walks through a ladder tile (which can be one of three tile indices). When the player is overlapping a ladder and up is being pressed, the climbing state would be set.

Ideally, I'd like to get a callback when this happens. It seems that the overlap method from Arcade physics is not available in P2. What is there instead to implement overlap detection?

sentences:
Having to check collisions twice per game tic I have vertically moving elevators (3 solid tiles wide) and static solid tiles.  Each are separate entities and therefore have their own respective collision routines (to check for, and resolve, collisions with the main character)

I check my vertical collisions after characters vertical movements and then horizontal collisions after horizontal movements.

The problem is that I want my platform to kill the player if it squashes him from the top, and also if he's on a moving platform (that is moving up) that squashes him into a solid block.

Correct behaviour, player on solid blocks being squashed from above by decending elevator

Here is what happens.  Gravity pushes character into solid block, solid block collision routine corrects characters position and sits him on the solid block which pushes him into the moving elevator, elevator routine then checks for collision and kills player.

This assumes I am checking solid blocks first, then elevator collisions.

However, if it's the other way around, this happens....

Incorrect behaviour, player on accending elevator gets pushed into solid blocks above

Player is on an elevator moving up, gravity pushes him into the elevator, solid block CD routine detects no collision, no action taken.  Elevator CD routine detects character has been pushed into elevator by gravity, corrects this by moving character up and sitting him on the elevator and pushes him into the solid blocks above, however the solid block vertical routine has now already run for this tic, so the game continues and the next solid block collision that is encountered is the horizontal routine.  This detects a collision and moves the character out of the collision to the left or right of the block which looks odd to say the least (character should get killed here).

The only way I've managed to get this working correctly is by running the solid block CD, then the elevator CD, then the solid block CD again straight after.  This is clearly wasteful but I can't figure out how else to do this.

Any help would be appreciated.

sentences:
Detect when a bullet rigidbody is on ground I have a rigidbody that is on top of a plane or another rigidbody. How do I check if said rigidbody is on top of it?

I tried to check the Y-part of the velocity but it is never 0, it is always a small value.

What would be the best way to detect this?

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 to move while a timer is going in an event I'm trying to make a switch activated gate and this is what I have setup so far "picture #1"

but what happens when the timer is going on, I cannot move.
so what I'm trying to do is go through the gate "while the gate is open" but have a timer to reset the gate to close.

sentences:
Textures are not drawn separatley I am trying to draw different textures of balloons and I want them to appear in different times about half second between each one, and move in the world. first balloons are rendered but after about half second the other balloons are rendered next to the previous ones, not in the initial place: this is code:

private Ballons ballons;
    private Ballons ballons2;
    private Ballons ballons3;
    private Ballons ballons4;

    private Texture background;
    public Celebration(Fruits game, float level)
    {
        this.game=game;
        this.level=level;
        gamecam=new OrthographicCamera();
        gameport=new StretchViewport(820/Fruits.PPM,580/Fruits.PPM,gamecam);
        stage=new Stage(gameport,((Fruits) game).batch);
        background=new Texture("Wining.jpg");
        gamecam.position.set(gameport.getWorldWidth()/2f,gameport.getWorldHeight()/2f,0);
        temp=0;
        counter=400;
        world=new World(new Vector2(0,0.5f),true);
        b2dr=new Box2DDebugRenderer();
        ballons=new Ballons(world,this,1,140);
        ballons4=new Ballons(world,this,2,290);
        ballons3=new Ballons(world,this,3,480);
        ballons2=new Ballons(world,this,4,650);

    }

    @Override
    public void show() {

    }
    public void handleinput(float dt)
    {
        if(Gdx.input.isTouched())
            game.setScreen(new GlobalWorld(game, 1));
    }
    public void update(float dt)
    {
        handleinput(dt);
        world.step(1 /60f, 6, 2);
        //player.update(dt);
        gamecam.update();
//        renderer.setView(gamecam);
        ballons.update(dt);
        ballons2.update(dt);
        ballons3.update(dt);
        ballons4.update(dt);
    }

    @Override
    public void render(float delta) {
        float level;
        update(delta);
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        counter--;
        b2dr.render(world, gamecam.combined);
        game.batch.setProjectionMatrix(gamecam.combined);

        game.batch.begin();

        game.batch.draw(background, 0, 0, gameport.getWorldWidth(), gameport.getWorldHeight());
        if (counter < 200) {
            ballons.draw(game.batch);
            ballons2.draw(game.batch);

        }
        if (counter < 100) {
            ballons3.draw(game.batch);
            ballons4.draw(game.batch);

        }
        game.batch.end();

    }

    @Override
    public void resize(int width, int height) {
        gameport.update(width, height);

    }

}

sentences:
Fixed Function vs Programmable Pipeline performance with many batches In OpenGL 2.0 I can easily make 10,000 draw calls per frame (with state changes in between each call).  However, if i try to do this in either OpenGL ES 2.0 or DirectX9 with shaders, my peformance is 1Hz.  Is there an inherent different between fixed function and programmable pipeline rendering that requires programmable pipeline to require much fewer draw calls per frame, or is it more likely that I'm just doing something stupid in my code? I thought that most fixed function pipelines were implemented in shaders nowadays anyway, so if it is the case that I have to batch, then how does the fixed function implementation get away with not batching if its really using shaders?

Any "official" resources you could point me to would be great.

sentences:
Should I change velocity or apply force to implement a jump in Unity? I have started making a basic platformer game just for fun. Its going to be the style of the original Super Mario Bros game, but with 3d assets.

My problem is that I'm using a rigidbody and using code I have always used to make my player object jump. It seems really slow. I am using a capsule object, the standard size (which is 2 units height). I have played about with the mass, ive tried 1 and 40. And other than having to increase the 'jumpForce' value accordingly, it seems to have not changed the jump speed at all.

So I'm hoping there is a way to tweak the flight of the jump whilst still using the Rigidbody component, and if so how please?

If not, I think I'm able to write my own code to make the gravity etc, but this seems stupid since Unity is a well established game framework I expect other people have also needed to change it and I'm sure there is a way I just don't know about.

Hope someone can help me.

Many thanks!

PS (Here is the basic code I have to make the character jump):
PPS: It's not super-slow , like being in space. (I've had that problem in LibGDX where my objects scales were all wrong. But this time I have just the standard sized Capsule (1x2 units) and the platform is about 4 units above the ground. He jumps ok, but I'd like to make him jump really-fast like mario can

 public class PlayerController : MonoBehaviour {
     Rigidbody rb;
     Vector3 faceRight = new Vector3(0, 90, 0);
     Vector3 faceLeft = new Vector3(0, -90, 0);
     float halfHeight;

     float speed = Constants.speed;
     float jumpForce = Constants.jumpForce;

     private bool IsGrounded()
     {
         return Physics.Raycast(transform.position, Vector3.down, halfHeight + 0.1f);
     }

     void Start () {
         halfHeight = GetComponent<Collider>().bounds.extents.y;
         rb = GetComponent<Rigidbody>();
         rb.transform.Rotate(0, 90, 0); // make the capsule face right at start.
     }

     void Update () {
         HandleKeys();
     }

     void HandleKeys()
     {
         if (Input.GetKey(KeyCode.A))
         {
             if (rb.transform.eulerAngles != faceLeft)
                 rb.transform.eulerAngles = faceLeft;

             rb.transform.Translate(Vector3.forward * speed * Time.deltaTime);
         }
         if (Input.GetKey(KeyCode.D))
         {
             if (rb.transform.eulerAngles != faceRight)
                 rb.transform.eulerAngles = faceRight;

             rb.transform.Translate(Vector3.forward * speed * Time.deltaTime);
         }
         if (Input.GetKeyDown(KeyCode.Space) && IsGrounded())
         {
             rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
         }
     }
 }

sentences:
How can I build Minecraft-style light propagation without recursive functions? This question is more about expanding on an answer posted for an old but similar question.

Part of the answer says this:

  You simply fill the sunlight from the top to the bottom, every layer
  is gathering light from neighbor voxels in the previous layer with
  attenuation. Very fast - single pass, no lists, no data structures, no
  recursion.

I actually am having an easier time understanding how you would flood fill light for point lights. But doing so for sunlight, in one pass with no recursions, I still can't understand how it is done step by step.

Specific questions I would like to know about this:

Do you compare lighting of neighbor voxels only to the 4 cardinal directions, or do you check the up and down neighbors too?

If you don't store data structures for the lighting algorithm, how do you check for voxels that are already visited?

If there was a diagram explaining a step by step process of a single-pass light propagation that would be helpful. It seems like it would be easier on performance than casting several rays from each voxel to see if it hits light.

sentences:
Where is Light in Game view Very Basic Question.when i run the the game the game Mode is Too dark as shown below in the picture. please suggest me some Setting how to globally switch on built in light while Running the game in game mode.

Thanks.

sentences:
problem adding bumpmap to textured gluSphere in JOGL I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well.
The bumpmap resides in "res/planet/earth/earthbump1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth

    earthGluSphere = glu.gluNewQuadric();

    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture

    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;

    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties
    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_NEAREST);

    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T);
}

How would I add the bumpmap as well to the same gluSphere?

sentences:
Astar heuristics closing in on an answer before searching around to find nodes with lower movement costs I am having some trouble with my A* path finding. everything works fine and the path is always found. However, my game is a open map space strategy game. There are no walls etc to navigate around. Now, the movement cost along the navgrid is the same unless the agent chooses to navigate thro a 'jump gate' (in which case the cost is 100 times cheaper. almost always the better option).

I have a problem where the heuristics will narrow in directly towards the answer rather than searching around for a better solution. If my heuristics function always returns 0, then I always get the correct route, however with no heuristics I need to search the entire map and this makes it far too slow.

As you can see, the top agent ignores the jump gate and flies directly towards the destination, completely ignoring the gate way. The bottom agent opts to use the gate way (only because its heuristics was causing it to search in a north-west pattern anyway.

What are some possible solutions?

sentences:
Box 2D Collision Question I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic.

The whole Scenario is explained below:
I have 3 balls in total. I want to balls to remain in their places and the third ball to be able to move. When the third ball hits the other two balls then they should move according to the speed and direction from which they were hit.
My gravity of the world is 0 because I only want z-axis gravity.

I would also like some one to point me towards some good tutorials regarding Box 2D basics which is language independent.

I hope I have explained my scenario well.

Thanks for the help in advance.

sentences:
How to rotate camera centered around the camera's position? Currently I am using gluLook at like so:

gluLookAt(position.x, position.y, position.z,
          viewPoint.x, viewPoint.y, viewPoint.z,
          upVector.x, upVector.y, upVector.z);

with the above, don't know if you need more information, how could I change it so that the camera acts like its rotating around itself, instead rotating around its viewpoint. You can see the current code at https://github.com/dchhetri/OpenGL-City/blob/master/opengl_camera.cpp, that class was adapted from codecolony.com.

sentences:
taking a static animation and making it move unity3d Say you have an animation of a bird flapping its wing.

Some animations actually moves the Avatar either forward, backwards or to the side.

My question is, is it possible to take that flapping animation and change the animation to make it move forward within the unity editor?

Please note that i am not an animator which means that i do not have the skills to edit the animation in a 3rd party program. So this question revolves around what you can do in Unity3d

sentences:
AI and shapes in 2D Grid I'm working on a grid- and turn-based strategy rpg. My problem is concerning finding best position for my AI to use a skill. But lets start at the beginning.

My plan is to make each skill an action for my AI. It checks for each action how effective it would be, chooses the best and does it.

Each skill has a usage and a affect area that can be circular or shapes like

[
 [1,1,1,1,1],
 [0,1,1,1,0],
 [0,0,1,0,0]
]

which can be used in 4 directions.

The most simple solution would be to just check the affect area for each position and direction of the movable and usage area. But as these checks can get quite intensive I want to minimize them as far as possible.

One approach would be to combine the circular movement area with the skills usage and affect areas and find all target entities in it. So I have a list of all entities that could be targeted by the skill. The next step would be to group these entities by the skills affect area to rate it higher when the skill hits multiple targets. And as the new position and direction should get into that rating as well I have to check all possible positions for each group.
And I've no idea on how to effectively do that.

1) Does this AI approach makes sense?

2) Is there a better way to define such grid-shapes and apply them to the checks later on?

3) Any ideas on how to group the targets by the skills usage area or minimize the positions and directions to check by the knowledge of where the target entities are?

Thanks for reading!

EDIT: After this is not going to get answered I have to ask another question: Am I bad in asking for help? In the 10 year's I'm developing now there were like five times were I really couldn't get further without a tip. But unless which way I try to ask for help (in the internet, asking the few developers I know or someone outside of the industry for understanding problems) I've never got any. To be fair I'm only coming with real problems after being stuck for days. But as I see the internet full of perfectly answered questions I begin to think: Is that my fault? What makes this question not worthy for an answer?

sentences:
Is there a benefit to applying forces to my camera? I have implemented a camera system and a rudimentary physics system. I now have a decision to make regarding steering the camera:

Option 1 - Update the camera movement directly.

eg. position (0, 0, 0) + Key 'W' => position (0, 0, 1)

Option 2 - Apply a force to the camera and let my physic's integration sort it out.

eg. position (0, 0, 0) + Key 'W' + force (0, 0, 0.2) => ...?

How should I implement camera movement?

sentences: how do game implement customization of characters I am looking to create a game a rpg. I want to add customization of character so that each players char is unique. How do i do it?

sentences:
Most efficient way of communication between "unfamiliar" game objects? Title could look vague, so here's what I actually mean.

Three groups of people are walking in the city. These are Guards, Thieves and Citizens.
Something has happened in the city, Thief have stolen a pocket from a Citizen, the Guard walking around was close enough to see the crime, so now he's chasing Thief.

So here's the question, how that chain would work from execution perspective?
We can imagine there is a some kind of StateCheckingObject placed in the world. When Thief steals a pocket, it's class (or Citizen's class ) would broadcast a message to the StateCheckingObject. After StateCheckingObject is aware of crime it would broadcast message to the Guards walking around making them aware of crime.

Well, broadcasting stuff doesn't look complex, that could be a simple event dispatcher. But how would Thieves, Citizens and Guards hold a reference to StateCheckingObject? And what StateCheckingObject should even look like? Should it somewhere in the level? Should other object access it when spawned with GetAllObjectOfClass(StateCheckingObject)? That could be a heavy task for system since iterating over all level objects is not very efficient.

The issue looks pretty similar to GTA where events are broadcaster to nearby police cars when crime is happening, but what would make a broadcast?

Edit: lilotop suggested a trigger box solution and I've realised I haven't explained the idea why I would want to make state checking system.

Some actions happening in the world should be stored somewhere. I.E. after Citizen got robbed StateChecker would get aware of it and store bool CitizenGotRobbed.
That boolean would later be used in maybe some kind of dialogue adding new branch to guard dialogue.

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:
Position vs Destination Rectangle I'm new to programming, and I finally delved into XNA/MonoGame for wanting to practice coding game logic.

I'd like to know what the difference is between a Position (Vector2) and a Destination Rectangle (Rectangle), when it comes to positioning a sprite.

sentences:
Generate a range of number with X being returned most of the time I am attempting to write a RNG which returns a normal-like curve. For example, say I define X to be 4, I would like to generate a range of numbers from 1 to 8, but with 4 being returned most of the time (say 60%).

How can I accomplish this in a way I can easily define X, and the range of the numbers?

sentences:
How do I implement a fixed delta time step with a SDL_Delay(15ms) precision So I am using SDL2.0 for making a Game Engine.
Where I am having a problem is using SDL_Delay().

SDL_Delay's minimum delay time is 15ms, I've tried everything, and my FPS is Stuck at 64 because of this. I have seen another post about this but it does not seem to answer the question with SDL_Delay.

I can turn on VSYNC, and I Get a fixed 60FPS, Please explain what the SDL Library is doing that I cannot implement Myself?

This is very weird, I dont think I need to post my code for this, the code is not wrong,
Its the SDL_Delay(), wether it be SDL_Delay(1) or SDL_Delay(15) , it will always delay for 15ms, does anyone know a way of fixing this so I can still use SDL_Delay.

I have seen on SDL Documentation they say this is expected, because of OS Scheduling.

Then I read OS Scheduling does this to save power consumption...
I have High Performance turned on my computer, not Power Saver.

Does anyone know a workaround for this? I am very hardheaded and do not want to use VSYNC.

Or I might just have to. LOL Thanks in advance!!

Edit: https://wiki.libsdl.org/SDL_Delay

sentences:
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:
How to fix the character flip when using an orthographic camera in libGDX I used an orthographic camera to follow the character (player), but the problem is that my character is flipped.  There are no tutorials on how to fix this.  Please help as fast as possible.

Here is my create method:

public void create () {

    batch = new SpriteBatch();
    float width=Gdx.graphics.getWidth();
    float height=Gdx.graphics.getHeight();
    camera=new OrthographicCamera();
    camera.setToOrtho(false,width,height);
    camera.update();
    tiledMap= new TmxMapLoader().load("assets\\untitled.tmx");
    tiledMapRenderer=new OrthogonalTiledMapRenderer(tiledMap);
    player=new Player(new Vector2(0,0));
    sr= new ShapeRenderer();

}

Here is my render method:
public void render () {

    Gdx.gl.glClearColor(0, 0, 0.2f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA,GL20.GL_ONE_MINUS_SRC_ALPHA);
    player.update();
    camera.position.set(player.getPosition().x,player.getPosition().y,0);
    camera.update();
    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();
    sr.begin(ShapeRenderer.ShapeType.Line);
    sr.setColor(Color.BLUE);
    sr.rect(player.getPosition().x,player.getPosition().y,player.getCurrentFrame().getRegionWidth(),player.getCurrentFrame().getRegionHeight());

    sr.end();
    batch.begin();

    batch.draw(player.getCurrentFrame(),player.getPosition().x, player.getPosition().y);
    batch.setProjectionMatrix(camera.combined);
    batch.end();
}

sentences:
Loading and drawing materials using Lib3ds Hey all, i'm currently using Lib3ds to load models into my C++/OpenGL project. So far, i've been follow the model loading tutorial found here.

The tutorial gives a good example of how to draw the vertices and normals using VBO's, but so far i've been lost as how to do the same thing with materials.

Could i get an explanation/example of how to both load and draw materials of my meshes using Lib3ds and OpenGL?

sentences:
Should I use secure WebSockets for a game? Is SSL necessary for a web game? I'm using Node.js with socket.io.

Without it, when using unsecured networks someone on the LAN could change commands being sent to the server and "take over" a player. But this could only happen on unsecured shared networks, so it doesn't sound too bad. Or is it?

And lets ignore the authentication phase for a moment and assume this part is secured, are there any other reasons why I should use SSL on the sockets?

sentences:
animation control problem I have a list of .FBX object.When I drag that .FBX into scene its corresponding inspector Animation component(fig 1) appears but when I drag some other .FBX object into the scene the Animator component(fig 2) is getting added to the scene.Please see the image attached

Issues Found :
1)fig (1) - When we click on the object and write code to display animation

void OnMouseEnter()
{
 animation.Play("DropBothFork01");
}

The above code is working
But if we consider fig(2) the code is not working even though adding a animation component.

What will be the issue?Why for each .fbx object when drag into scene the animation and animator component varries.Could you please help me out solving it.

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:
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:
Keeping user's attention with tycoon style games I'm developing a tycoon game, and with most games in the "genre", some in game things just take time. Making money, waiting for things to happen, etc. For mobile gaming (ios, android), how do I keep this entertaining. Without talking specifically about my game, there are day cycles / things that happen at certain points (can I be more general?...)

There's different possibilites, and some I've seen have either a fast-forward button or something in order to not make it boring. (I'm talking about a tycoon game with a little bit of stuff to do; you can't constantly be busy like sim city or something). Do I just have notifications generated at certain times to tell the user a "day is over" or a "power up is attained"? Or would that get too annoying?

I'm open to any ideas on how to keep users interested, but it's really not a game that you can constantly play for hours. Not enough stuff to do, doesn't require that much micro-management.

sentences:
How do I determine the draw order of isometric 2D objects occupying multiple tiles? My current sorting method works only for objects that occupy 1 tile and fails for multi-tile objects. For examle, the bed in the above picture occupies 1×2 tiles, and the sorting fails.

Also that bed picture is 1 whole image that covers 2 tiles.

How can I change my sort method to accomodate this?

sentences:
How to "hide" an adventure game in an RPG I have a shakey idea for a game, and I need help fleshing out what mechanics could make this work.

I want to make a game that, on the surface, is a fun little exploration/dungeon crawler/rpg-lite sort of game. There's some story, a large map, and basic quests to go off to various dungeons and defeat all the monsters that are threatening the kingdom.

The idea is that a player can play through, and defeat the game by just going and defeating the monsters everywhere, and that should be a rewarding enough way to play the game.

However, I don't want that to be the only way to play the game. What if the monsters attacking the kingdom from a nearby "dungeon" are just misunderstood, or are being provoked? What if they could instead be made into allies?

For each set of set of monsters threatening the kingdom, I want the player to either be able to just go and kill them all, or find some other solution, but for killing all the monsters to be the only obvious thing to do.

The idea being that finding a different solution should feel very rewarding, or a suggestion that there are other solutions should come late in the game and provide motivation for the player to replay the game.

My question is: What sort of game mechanics could be used to provide an alternative way of progressing through the game while not making it obvious that the alternative exists? I think if a dialog tree open up with the first monster you met in each dungeon, it would telegraph the idea that there's an alternative solution. So how could there be a dungeon of monsters that you can wade into and immediately start fighting, while at the same time there being a non-violent solution?

sentences:
How should I update object movement on Client in a lockstep game? I have a game that I am implementing a lockstep system for multiplayer on an RTS game. Now the server sends update packets at a higher frequency than the clients with new data.

What I'm stuck on understanding about lockstep systems is how does this tie in with the movement of the units. Should I only move the objects when a new update packet is received?

sentences:
Tangent to a circle through a point I'm trying to figure out how to calculate the following angle:

I know center (p1) and radius (r) of a circle. Given a point p3 I want to calculate the angle a such as the tangent (tan) of the circle at point p4, points in p3 direction.

Here's a figure:

Doesn anyone know how to do that?

sentences:
How to merge two objects in Blender What I've Done

I created a Cube object with Subdivision Surface modifier in order
to model a spehere.
I created a cuboid object looking like a angled, longish baton.

What I Want to Do
I want to merge these two objects. So I want to have got just one object - a (cube locking like a) sphere with a baton sticking out on one side. It should look a bit like a head with a throat attached at the bottom.
How I Want to Do It

I don't want to apply the Subdivision Surface modifier - I want to be
able to edit my object later on nicely.
I don't want to have any space between the baton and the sphere. It should be coherent.
It should be possible without any bad artifices. Everything should be nice.

My Question
How can I merge these two objects nicely? Thanks. - I hope it's clear what I want to describe.

sentences: Drawing text in SlimDX with Directx 11? How can I draw text to the screen in directx 11 with slimdx?  In SlimDX.Direct3D10 there's a font class which can be used but there's no font class in SlimDX.Direct3D11.

sentences:
How to use ref in an enumerator i have this enumerator that loads a folders images asynchronously and i would like to be able ta pass the array as a parameter, but when i try to do it even though i get no error the array (source) does not get populated.
private IEnumerator GetTextureFromPath(string _dirname) // here it would be ,Texture2D _source
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname, "*.jpg");
        source = new Texture2D[fileNames.Length]; // this source array would be referenced in the params.
        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));
        int index = 0;
        foreach (var fileName in fileNames)
        {
            UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture("file://" + fileName);
            while (!webRequest.isDone)
            {
                yield return webRequest.SendWebRequest();
            }
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                Debug.Log(webRequest.error);
            }
            else
            {
                source[index] =  LoadTextureFromPath(fileName);
                source[index].name = fileName;
                index++;
                Debug.Log("Ends server comm");
                Debug.Log("FileNames :" + " " + fileName);
            }
        }
    }

what this function does is get all files from a directory and populate a texture2d array with each image. now this call happens on game load so since i have 4 more arrays (source1 , source2 etc) i would like the array to be in the parameters so i can tell the script as to which array to populate from that directory
it seems its due to it being asynchronous and an enumerator. Because i made the function into a void one with the texture as a ref and it worked.
public void LoadTextureArray(string _dirname, ref Texture2D[] arr)
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname + "/", "*.jpg");
        arr = new Texture2D[fileNames.Length];

        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));

        //Debug.Log(string.Join("\n", fileNames));

        int index = 0;
        foreach (var fileName in fileNames)
        {
            arr[index] = LoadTextureFromPath(fileName);
            arr[index].name = fileName;
            index++;
        }
    }

So my take on this is i need to be able to use ref into the enumerator but that is not possible from what it seems since if i do put it as a parameter i get this error. or if there is another way to be able to pass the texture array from the function call! Thank you!
iterators cannot have ref in or out parameters
```

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:
Downscaling texture via mipmap Copied from Computer Graphics SE.

I am implementing a post-processing effect in my DirectX 11 pet renderer. The post-processing pass is implemented by rendering a full-screen quad covered with texture containing original rendered image, which works as it should, but I have problems with downscaling the texture.

The non-processed testing scene looks like this (three very bright emmissive spheres):

I see no problem at this stage, but when I run the first post-processing pass, which just down-scales the image by the factor of 8 using the texture sampler, the result is very flickery (up-scaled for clarity):

I expected a mipmap would solve or at least reduce the flickering, but it didn't change a thing. What am I doing wrong?

RenderDoc Update

After investigating the issue using RenderDoc I found that the mipmap is being generated successfully and it's third level looks like this:

However, the output of the down-scaling pass looks like this:

As if the sampler didn't use the mipmap at all. Don't get distracted by coloured object instead almost white ones. I lowered the sphere brightness a bit while investigating the bug.

Even if I choose the mipmap level explicitly

float4 vColor = s0.SampleLevel(LinearSampler, Input.Tex, 3);

it changes nothing :-/

RenderDoc also says "LOD Clamp 0-0" for the used sampler. What is it? Couldn't this be the problem?

DirectX details

Samplers

D3D11_SAMPLER_DESC descSampler;
ZeroMemory(&descSampler, sizeof(descSampler));
descSampler.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
mDevice->CreateSamplerState(&descSampler, &mSamplerStateLinear);

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
hr = mDevice->CreateSamplerState(&descSampler, &mSamplerStatePoint);

...are set right before rendering the screen quad

ID3D11SamplerState* aSamplers[] = { mSamplerStatePoint, mSamplerStateLinear };
mImmediateContext->PSSetSamplers(0, 2, aSamplers);

...and used within the down-scaling PS shader

SamplerState PointSampler  : register (s0);
SamplerState LinearSampler : register (s1);

Texture2D s0 : register(t0);

float4 Pass1PS(QUAD_VS_OUTPUT Input) : SV_TARGET
{
    return s0.Sample(LinearSampler, Input.Tex);
}

Texture

D3D11_TEXTURE2D_DESC descTex;
ZeroMemory(&descTex, sizeof(D3D11_TEXTURE2D_DESC));
descTex.ArraySize = 1;
descTex.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
descTex.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
descTex.Usage = D3D11_USAGE_DEFAULT;
descTex.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
descTex.Width  = width;
descTex.Height = height;
descTex.MipLevels = 0;
descTex.SampleDesc.Count = 1;
device->CreateTexture2D(&descTex, nullptr, &tex);

...it's render target view

D3D11_RENDER_TARGET_VIEW_DESC descRTV;
descRTV.Format = descTex.Format;
descRTV.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
descRTV.Texture2D.MipSlice = 0;
device->CreateRenderTargetView(tex, &descRTV, &rtv);

...it's shader resource view

D3D11_SHADER_RESOURCE_VIEW_DESC descSRV;
ZeroMemory(&descSRV, sizeof(D3D11_SHADER_RESOURCE_VIEW_DESC));
descSRV.Format = descTex.Format;
descSRV.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
descSRV.Texture2D.MipLevels = (UINT)-1;
descSRV.Texture2D.MostDetailedMip = 0;
device->CreateShaderResourceView(tex, &descSRV, &srv);

Explicit generation of mipmap is called after the scene was rendered into the texture and another texture was set as a render target.

ID3D11RenderTargetView* aRTViews[1] = { mPass1Buff.GetRTV() };
mImmediateContext->OMSetRenderTargets(1, aRTViews, nullptr);

mImmediateContext->GenerateMips(mPass0Buff.GetSRV());

ID3D11ShaderResourceView* aSRViews[1] = { mPass0Buff.GetSRV() };
mImmediateContext->PSSetShaderResources(0, 1, aSRViews);

The code is compiled in debug and the D3D device was created with D3D11_CREATE_DEVICE_DEBUG flag and I get no runtime errors on the console.

sentences:
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 do I take 2D ballistic trajectory planning and apply it to 3D? I am currently using this formula

speed = sqrt((gravity.y*target.x^2)/(2*cos^2(angle)*(target.y - target.x*tan(angle)))

provided by DMGregory as an answer for my question here to determine the speed of a trajectory given an angle and start/end points. So now I need to be able to apply this to a 3D scenario. How would I go about doing that?

sentences:
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:
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:
When would a mesh collider be better than primitive colliders I have been reading through the Unity Manual and have come across some interesting information about mesh colliders and primitive colliders. It got me wondering if using many primitive colliders would be better than using a mesh collider for say a character object?

I was also wondering if there was any information on exactly how inefficient a mesh collider is to say having 20 box or cylinder colliders on a character mesh. I am guessing that the number of polygons on the mesh would be a factor but it would be interesting to see some raw comparisons between how this efficiency scales per polygon (or per 100 polys or some unit of measurement)

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: How do I create a message box that fires a callback on button press? I need to create a message box with an "OK"-button. When the user touches the button, it should execute a callback. I'm new to this and couldn't find any articles in the docs.

sentences:
Platformer movement and collisions I'm working on a platformer but I'm stuck at the player movement and collisions.
Right now I'm not including the grid at all in the movement, but it's time I do it. I've read this article on how to do it. But there's no real code examples just theory.
I like the second example and that's the one I'm going for. I want the movement to be smooth, and the player should be able to run in between squares from my map array.
This means I have to get tile information from the array, and according to that allow/forbid my player to move in that direction. And that's where I'm stuck.
My array is a bunch of 1's and 0's right now. I know how to calculate a hitbox around the player, but how do I compare that to the array in an efficiant way?
UPDATE: I've been playing around with this for a while now, and the only thing I came up with is using player X and Y which is in pixels, dividing by tile size, and getting a rough estimate on the map. Then I make it an AABB by adding its width and height to get the corners.
This showed to be very unreliable though, and I would really need some help on how to structure this.

sentences: Keeping Android Screen bright during Game I have a game that uses the accelerometer to move a guy back and forth on the screen.  After a few seconds the screen goes dim.  Is there any way to keep it alive and bright during the game activity?

sentences: What is physically correct lighting all about? I can't find anything comprehensive using Google. I'm wondering what the core concepts of physically correct lighting are, and where I could read up on it. What's physically correct lighting all about? Is Phong illumination generally physically incorrect?

sentences:
Rotation pitch/yaw reverse problems when picking a tile (2.5D) Set-up: 3D world, isometric sprite rendering (4 fixed angles).
This transform matrix is used as camera:

 _transform =
            Matrix.CreateRotationZ(Roll) *
            Matrix.CreateRotationX(Pitch) *
            Matrix.CreateTranslation(new Vector3(-cameraPosition.X , -cameraPosition.Y, -cameraPosition.Z))* //this matrix controls camera position
            Matrix.CreateScale(new Vector3(_zoomScale)) * //scale representing zoom level. This one applies to the textures too
            Matrix.CreateScale(new Vector3(_textureScale)) * //world scale to fit current texture pixel size.
            Matrix.CreateTranslation(new Vector3((_port.screenWidth / 2) - TileOffset, _port.screenHeight / 2, 0)) //offset for having focus in center of screen instead of top left corner + little offset so it will be a tile center
            ;

Roll=-45, Pitch=60. Result:

I've hoped to find a quick picking solution in the inverse matrix:

_inverseTransform =
           Matrix.CreateTranslation(new Vector3(-(_port.screenWidth / 2) + TileOffset, -_port.screenHeight / 2, 0))*
            Matrix.CreateScale(new Vector3(1/_textureScale)) *
            Matrix.CreateScale(new Vector3(1/_zoomScale)) *
            Matrix.CreateTranslation(new Vector3(cameraPosition.X, cameraPosition.Y, cameraPosition.Z))*
            Matrix.CreateRotationX(-Pitch)*
            Matrix.CreateRotationZ(-Roll)
            ;

It doesn't work as expected.
If i remove rotation from matrix build, everything works. The interesting part is if i leave roll component only, everything works too.
I've tried transposed matrices, inverted matrices, rotating on -angle, FromPitchYawRoll matrix (inverted/transposed/-angles). Every time roll works, pitch and yaw aren't.
Pitch only/yaw only can't be inverted too.

It's probably something basic in the matrix math/rotation principles, but i'm failing to grasp it. Any help would be appreciated.

--code removed, not relevant to the case--

Some gifs for better understanding.
Current implementation do this:

If we switch the pitch off, inverse matrix work as intended (white dots mark real tiles grid. Graphical tiles aren't rotated, of course.)

EDIT:
After some matrix calculations i've realised simple thing. Let's point the mouse on the tile (0,2). If i dump all transformations but pitch by several degrees, then tile (0,2) will be drawed somewhere on (0, 1.25).

But if i'll apply inverted (or transposed, or "rotate by -value") matrix to the mouse position (0,2), i'll get same (0, 1.25), which means that the mouse is pointing at (0,1) tile. While it should point at (0, 3). And i don't know how to invert this correctly.

I've also discovered this. But, as you can see in the first answer, knight666 is using scale instead of pitch rotation.

sentences:
Moving two objects proportionally I'm trying to move two objects away from each other at a proportional distance, but on different scales. I'm not quite sure how to do this. Object A can go from position 0.1 to 1. Object B has no limits. If object B is decreasing, then Object A should be decreasing at rate R. Likewise, if Object B is increasing, then Object A increases at rate R. How can I tie these two Object positions together so that in an update loop, they automatically update their positions?

I tried using:

ObjA.Pos.X +=  0.001f * ObjB.VelocityY; //0.001f is the rate

This works but there's an error each time it runs. ObjA starts off at its max position 1 but then the next time it will stop at 0.97, 0.94, 0.91 etc.. This is due to the 0.001f rate I put in. Is there a way to control the rate, yet not end up with the rounding error?

EDIT - To clarify the scenario:
The user can provide a force to  Object B in a vertical motion (2D game). Gravity will bring the object back down once the user lets go of the up/down button. As the object moves up or down, I want object A to move left and right on the X axis. Maximum distance to the right can be '1', and to the left can be '0.1'. Therefore, if the user keeps holding up forever,object A will still only be at 0.1.

  Object A at max 1 = Object B at position 4.5 (this is the starting
  position)

  Object A at min 0.1 = object B at position +/- 9.9

Obejct B does take the game time into account.

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:
Creating an update "Tick" on tiles for simulating growth of plants In my 2D tile based platformer I have added plants to be able to farm such as the simplest, grass, to other things like corn. Now each of these speacial tiles must be updated to show how much it has grown (Simple states such as 0 = New, 1 = Mature, 2=Blooming)

My question is, what would be the best way to do this?

So far I belive I could:

Update every tile every few seconds, and if a random chance is met, make it grow
Choose a few tiles every frame to update (minecraft does this, same thing in 3D basicly)
???

Now the timeframe for the updates would be something like, a flower blooms every game day (10 minutes in real life), grass spreads every in game hour, etc

Thanks for your help, I think I could do this, I'd just like a little advice if any of these are the right path.

sentences:
Collision/Intersection of (2D) Ray to Line Segment Given a ray (r0, r1) and a line segment (a, b), I need to calculate the normal of the line segment based on the direction of the ray. For example, in the following picture:

The correct normal given the ray (from picture) and segment should be normal n1. Here is the algorithm I am using to calculate the point of intersection:

public static Vector2? lineSegmentIntersection(Vector2 r0, Vector2 r1, Vector2 a, Vector2 b)
{
    Vector2 s1, s2;
    s1 = r1 - r0;
    s2 = b - a;

    float s, t;
    s = (-s1.Y * (r0.X - a.X) + s1.X * (r0.Y - a.Y)) / (-s2.X * s1.Y + s1.X * s2.Y);
    t = (s2.X * (r0.Y - a.Y) - s2.Y * (r0.X - a.X)) / (-s2.X * s1.Y + s1.X * s2.Y);

    if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
    {
        // Collision detected
        // Return the point of intersection
        return new Vector2(r0.X + (t * s1.X), r0.Y + (t * s1.Y));
    }

    return null; // No collision
}

Ideally, I would like to modify this algorithm to calculate the proper normal. Further, I know how to calculate the normals n0 and n1:

norm0 = new Vector2((b.Y - a.Y), -(b.X - a.X));
norm1 = new Vector2(-(b.Y - a.Y), (b.X - a.X));

What do I do next to determine which of those two normals to choose? I get the feeling this is fairly simple and I've been looking at it for too long...

sentences:
How to add a logo to a captured image? I have a plane which contain a WebCamTexture and a button to capture the image

script to capture the image

void CaptureAndSave () {
    Debug.Log (Camera_panel_script.webCameraTexture);
    Texture2D snap = new Texture2D(Camera_panel_script.webCameraTexture.width, Camera_panel_script.webCameraTexture.height);
    snap.SetPixels(Camera_panel_script.webCameraTexture.GetPixels());
    snap.Apply();
    Debug.Log (Application.persistentDataPath.ToString());
    System.IO.File.WriteAllBytes(
        Application.persistentDataPath+"/my_image.png",
        snap.EncodeToPNG()
        );
}

this is the resulted image

how can i modify my code to add the image logo to my resulted picture ? so the captured image would look like this :

EDIT:
i tried to do a code to change the pixels in the of the webcameTexture like this :

public static Texture2D CombineTextures(GameObject obj, Texture2D background, Texture2D TodrawLogo)
{
    Vector3 v = obj.transform.position;// obj is TodrawLogo gameobject
    int width = TodrawLogo.width;
    int height = TodrawLogo.height;
    for (int x =(int)v.x; x < width; x++){
        background.SetPixel(x,(int)v.y,TodrawLogo.GetPixel(x,(int)v.y));
    }
    background.Apply();
    return background;
}

but i am out of luck also

sentences:
How do I convert a 2D movement (from mouse) to a displacement along a 3d axis? I'm making a small 3D scene editor (that only allow to modify objects positions).

Each object is draw with a 3d X/Y/Z axis :

How it works : user choose an axis (X, Y or Z) by left clicking on it, then, while holding left click, he move the mouse (to move object in the axis direction)
.
picking is already ok, but i'd like to know how much the object should be translated for the selected axis, depending 2D mouse movement.

For the example, on this picture, selecting X axis and moving mouse left-right should give a bigger displacement than moving it up-down (almost zero for this one)

It must be really simple but i cannot figure it out.

Input should be : mouse displacement since first left click(2D vector), selected axis vector (3d vector), modelview / projection matrix.

Output : amount (float or double)

sentences: Getting grid coordinates of cells bordering a square region I have a board that is 4x4 ( the blue cells) with the origin (0 , 0) being in the bottom left for example, how can I get the coords which are adjacent to the board (the red cells) to store them in an array?

sentences:
Dragging UI element lags behind the cursor Have been at this for 2 days straight trying different ways to solve this, and I can't.

I'm simply dragging around a UI panel using PointerDown and Drag events.  I set the transform.localPosition inside the Drag handler.  It works as expected, only problem is, the UI element seems to lag behind the cursor.

I created a GIF to show the issue in a build version to rule out the Editor.

Not sure how well you can see the issue, but the faster you move the cursor the worse it is.

Any ideas of what the issue is and how can I solve it?

Thanks

sentences:
How to render images/textures in shape/polygon form? I'm working with SFML right now, and upon finishing the tutorials I still do not know how to give a shape a texture or image -- not just a solid color/outline.

The only thing I know can take an image is a sprite, but thats way to simple, as it only allows you to render rectangular images in a rectangluar way!

What are the techniques for rendering images onto shapes, and only inside the shape? It would be great if some of you could provide some resources or SFML-specific stuff!

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 to draw a curved line in Box2d? I need to draw a curved line, I have searched the Internet but found nothing that would suit my needs.

I used b2ChainShape but it's not completely what I need.

How can I draw a curved line with Box2d?

sentences: Move object forward according to rotation How do I make an object (like a bullet) go forward according to its rotation in vanilla nodejs (my game server language)?  For example, if an object's rotation is 0 degrees, then it goes straight up.

sentences:
Where to start when building a 3D terrain editor? I'm looking to build (for start) a simple tool, that could raise, lower, smooth and texture the terrain.

So, what are the things I have to go through in order to make such terrain editor?

And maybe there are valuable resources available on subject?

Yes, forgot to mentioned, that I'm interested in a 3D terrain editor.

sentences:
Determining whether a large building should be split into multiple scenes This is about designing a first person retro game in Unity3d. In this game the player would walk around inside a large maze-like building that has corridors on 10-15 different floors.

Each floor has a corridor that is set up as a square that surrounds all other corridors (which are set more or less randomly, like a maze) on that particular floor. The length of each side of this surrounding corridor is about 100 steps.

So, considering that this building would have about 10-15 floors constructed like this, the question I wanted to ask is whether it can be included as a single scene?

Or does the answer to this depend also on other factors such as the type of game assets and target devices?

sentences:
Artifacts when draw particles with some alpha I want to draw in my game some particles. But when I draw one particle above another particle, alpha channel from this above "clear" previous drawed particle.
I set in OpenGL blend in this way:

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

My fragment shader for particle is very simple:

precision highp float;
precision highp int;
uniform sampler2D u_maps[2];
varying vec2 v_texture;
uniform float opaque;
uniform vec3 colorize;
void main()
{
    vec4 texColor = texture2D(u_maps[0], v_texture);
    gl_FragColor.rgb = texColor.rgb * colorize.rgb;

    gl_FragColor.a = texColor.a * opaque;
}

I attach screenshot from this:

Do you know what I made wrong ?

I use OpenGL ES 2.0.

sentences:
Increase blitting speed? I'm working on a 2d sidescroller in PyGame. For each map we use one texture (this is the actual size of the texture):

Then we load the image with this code:

sprite = pygame.image.load("Maps/MapTesting.png")
sprite.convert()
sprite = pygame.transform.scale(sprite,
              (sprite.get_width()*6, sprite.get_height()*6))

As you can see, the texture gets blown up 6 times to create the actual map texture. On average this texture is about 4500x800. This texture has to be blitted to the screen every frame, because the whole screen is dirty (thanks to the side scrolling). We do that using this code:

screen.blit(sprite, (0, 0),
(cameraposx, cameraposy, windowheight, windowwidth))

And it works. The problem is is that it's quite slow: I get a meager 40 FPS on a low-decent PC, and that's without any of the actual AI/objects going on, while we're aiming for 60 FPS. How can we speed this up?

Note that the above code is sanitized and taken out of context. The full code can be found here: https://github.com/nightcracker/PyGG2

And last but not least, while the above image might look like 8-bit, there are elements in the game which require more bit-depth.

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:
Gravity Simulation failing at short distances I have a 2D space simulation with gravity acting on three bodies (e.g. sun and 2x planets). The simulation seems pretty stable with RK4 (was unstable with Euler). The problem arises if the orbit of one of the planets get VERY close to the sun (or other planet), it is liable to shoot off towards alpha-centuri.

I think the problem is due to the  asymmetric nature of numerical integration in this situation; if a planet is VERY close to a sun in one time step, it will experience huge acceleration and end up (next update) on the far side of the sun, much further away with much weaker gravity (1/r^2), which won't counteract the huge acceleration experienced in the previous update.

Implementing RK4 had improved the situation over Euler, but not eliminated  the problem. The game I am working on requires bodies to fly very close to other bodies and still behave correctly.

Any potential solutions?

Edit

One the the answerers, @Thelvyn suggested using fixed elliptical orbits, but that is not an option here as the planets can interact gravitationally. Also, yes I am using a fixed timestep.

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:
Text independent of screen resolution in Unity? I have the following code that depends on the resolution of the user's display:

void OnGUI()
{
    GUI.Label(new Rect(432, 525, 9000, 9000), ("Hello!"));
}

And of course, the location of the text changes in devices with different resolutions. How can I make the text independent of screen resolution in Unity?

sentences:
Deleting fewest Navmesh Obstacles when no valid path is found So I'm building a Tower Defence, with mazing (i.e. the player can place towers to make the mobs take a longer route to there destination.)

I'm using Unity's Navmesh system. Each Enemy unit has a Navmesh Agent component. And each Tower has a Navmesh Obstacle component.

The Path-finding is working Perfectly. However (as expected) when the play completely blocks off all routes to the Agent's Destination, the agent simply moves to the spot closest to the destination that it can get to and sits there.

What i need, is to detect when that happens... Some kindof NoValidRoute() or something, I haven't been able to dig anything up in the Unity documentation or from google Searches.

Once i have that, I need to determin which Navmesh Obstacles need to be destroyed to open the shortest route possible with the fewest number of Obstacles destroyed. (i.e. if a path can be opened with only 1 tower destroyed which tower would give me the shortest route.)

I'm finding a serious lack of any information on this subject.. as far as i can tell no one has even tried to do this, or asked for help doing something like this. (at least not with Unity's Nevmesh.) I think A* is a little(and by little i Mean LOTS) outside of my skill to implement at present.

Thanks In advance

sentences:
Blending vs Texture Sampling Lets say I want to blend two textures together:

A texture containing the result of the SSAO calculation.
A texture containing the rendered scene.

I could do it in two ways:

Use a shader that samples both the SSAO and scene textures, blends them together and outputs the final color to a render target.
Render to the texture containing the scene and use a blending mode to blend the SSAO texture on top of it. Only the SSAO texture will be sampled inside the shader.

Is it possible to give a general answer about which version is faster, or is it highly hardware dependent?

sentences:
C++ Database vs Reading Files Ive been programing a C++ game/server for the past year.  I have been using MYSQL for character logins, items, monsters, etc, etc. (im on windows).  My question is, what are some of the databases that some big time developers use.  IE. Battle.net, Diablo II, Diablo III, mythos, hellgate , etc, etc, etc.  Do they have their own database they built?  Or do they use an existing framework for logins, and character transfers.

I do know that in diablo II, they use character files to to transfer characters into the game world.  But what about the login into battle.net.

Would it be wiser for me to stick with MYSQL, or is there something out there faster and more stable, or should I create a login type of system that looks through a file to see if you provided the correct password.

Can't wait to get some replies.  Thanks!

PS.  Currently the framework is much like battle.net, where you login into a lobby, create, and join games.  The game server/lobby server are different servers too.  So im just wondering about the lobby server for logins because I'm expecting several hundred thousand connections/logins.

sentences:
Large scale iterative design Typically in game development, linear development (waterfall model) is riddled with obstacles that drain the programmer's sanity (game turned out horrid, can't redesign). Enter iterative design. Iterative design allows for prototyping of various possibilities in the play space. Unfortunately, it has a major catch. As soon as a project increases in size, iterations become tediously long killing off the main advantage: rapid results.

How can one shorten design iterations for large scale projects?

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:
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:
Boolean change when clicking the left mouse button (not working) I want to change a boolean when I click the left mouse button, but it doesn't work as expected. I use this method:

if (m.LeftButton == ButtonState.Released && m_Old.LeftButton == ButtonState.Pressed)
{
   if (second)
   {
      second = false; // Boolean changes
   } else
   {
      second = true; // Boolean changes
   }
}

I need a way to tell the code that I only want one change. When I click the left mousebutton, the second boolean changes constantly. The reason for this is that the code keeps executing until m_Old (the old mousestate) is updated. (m & m_Old must be different for this code to run)

An example (when I click the left mouse button once| these are the results for the second boolean):

My mouse update code:

// Mouse stuff
oldMouse = mouse;
mouse = Mouse.GetState();

sentences:
Sort Polygons in order - not working? I'm fairly new to programming in a 3d world.

I'm trying to create a canvas where all the objects are drawn in order of furthest-to-closest and from bottom to top - so they don't overlap each other, but there are problems.

As you can see, some of the objects are overlapping each other. None of the objects in the screen will be moving so I was wondering: is there an algorithm available to sort the objects in the correct order?
At the moment I have them sorting in the Z axis ascending, then X descending and Y descending.

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: How does Speed in Animator Window in Unity work? If speed 1 is considered normal playback, is it by a second? So animation play once in a second? If I have my animator speed set as 100, would it make the speed become 0.06 then ?

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:
removing box2d objects before collision occurs I am having a problem with a collision detection between the character and items, both created as box2d objects.
What I am trying to do is to delete the item or remove item from the collision method before character hits item and bounces away. Thus, I want to detect when the item and character collided to gain item effects.

Current sources are as below :

mWorld.setContactListener( new ContactListener() {
        @Override
        public void endContact(Contact contact) {
        }
        @Override
        public void beginContact(Contact contact) {
            Body bodyA = contact.getFixtureA().getBody() ;
            Body bodyB = contact.getFixtureB().getBody() ;

            Box2DUserData dataA = (Box2DUserData) bodyA.getUserData() ;
            Box2DUserData dataB = (Box2DUserData) bodyB.getUserData() ;

            if( dataA.id == Box2DUserData.ID_ITEM ) {
                //mWorld.destroyBody(bodyA);
                //bodyA.setTransform(new Vector2( 0, 0 ), 0 ) ;
                bodyA.setActive(false );
            }
            else if( dataB.id == Box2DUserData.ID_ITEM ) {
                //bodyB.getWorld().destroyBody(bodyB);
                //bodyB.setTransform(new Vector2( 0, 0 ), 0 ) ;
                //mWorld.destroyBody(bodyB);
                bodyB.setActive(false );
            }
        }
    });

This source works okay, but the bodies are removed after collision detection. So I can get the character walk through items, after the character bumped in item and stopped for a frame or so.

I am not sure if I am supposed to use World.setContactListener or another method, it would be grateful if someone could give me the right method or another way to detect collision and the way to remove body from collision method before it actually collides.

Thanks

sentences:
Sprite UV returning wrong values in script in newer Unity versions I'm recreating in Unity 2019.4 an old project I have done few years ago in Unity 5.4.0. This project consists of a tiled map editor using unity editor scripts which reads baked data files containing all information needed for each tile (like height, texture id and texture rotation) and creates the tiled mesh on the fly for a given map to be edited in unity.
I have a single sprite (mode: multiple) containing all tiles textures that I read when creating the terrain mesh to set the correct UV for each vertex of the mesh depending on the texture id of a given tile.
In my old project using Unity 5.4.0 I can just call a tile sub sprite uv property to set in the mesh uv and it works just fine. The problem is that in Unity 2019.4 the uv property of the exact same asset (the big sprite with multiple sub sprites) returns weird values.
I compared the output of the uv property used in each tile on both projects and the values are slightly different. The difference is just the order how the elements are ordered in the uv array.
Lastly I noticed the sprite is showing additional options in Unity 2019. I have played with the options in Unity 2019 but couldn't notice any difference in the problem. I'll link the images showing the options in both Unity 5 and Unity 2019 bellow (respectively):

Does anyone have any idea or suggestion to understand why this is happening? I tried to search for this topic but couldn't find anyone with a similar problem.
EDIT: the multiple sprite is being generated and imported with the tool TexturePacker.

sentences:
Can I create an 2D texture array with different sizes for each textures? I'm making a 2D game engine, and I need a way to batch all textures into one so I only make one glBindTexture call throughout a scene. I am trying to use 2D texture arrays, but they only support textures of the same size.

Do I have to conform to this, or is there a workaround?

sentences:
How does cube mapping work? Based on my reading of cube mapping tutorials so far, my understanding is that you need a direction vector, and from the direction vector we can determine the point of intersection with one of the six planes.

Is the direction vector the player's view direction?  Besides that, I do not understand how having only one ray will give us the texture to fill the whole screen.

Furthermore, what if we are looking at one of the edge of the cube?  Now we have to sample texture from two faces?

Can someone please explain what am I missing here?

sentences:
How to do an anti sway bar for a car in Unity 5? I have researched some examples of anti roll bars for Unity but they are all for unity 4 and bellow so they do not work in unity 5. Can someone please assist me in making an anti roll bar script in C# for Unity 5?

Here is the best example I could find (I don't know how to convert it for unity 5):

using System.Collections;

public class AntiRollBar : MonoBehaviour {

  var WheelL : WheelCollider;
  var WheelR : WheelCollider;
  var AntiRoll = 5000.0;

  // Use this for initialization
  void Start () {

  }

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

    var hit : WheelHit;
    var travelL = 1.0;
    var travelR = 1.0;

    var groundedL = WheelL.GetGroundHit(hit);
    if (groundedL)
      travelL = (-WheelL.transform.InverseTransformPoint(hit.point).y - WheelL.radius) / WheelL.suspensionDistance;

    var groundedR = WheelR.GetGroundHit(hit);
    if (groundedR)
      travelR = (-WheelR.transform.InverseTransformPoint(hit.point).y - WheelR.radius) / WheelR.suspensionDistance;

    var antiRollForce = (travelL - travelR) * AntiRoll;

    if (groundedL)
      rigidbody.AddForceAtPosition(WheelL.transform.up * -antiRollForce,
                                   WheelL.transform.position);
    if (groundedR)
      rigidbody.AddForceAtPosition(WheelR.transform.up * antiRollForce,
                                   WheelR.transform.position);
  }
}

sentences:
Best approach for Event driven UI Had an idea for a modification to a game, however the core functionality heavily involves UI, and the API for the mod is event based.

The player will have there own custom data object, so I know one option could be

onClickEvent {
if Player doing X task { player.doX}
if Player doing Y task { player.doY }
}

on ScrollEvent {
if Player doing X task { player.setXValue}
}

I have a feeling this is not the best approach, so my question is what is the best approach to an event driven UI?

sentences:
Draw a perfect circle in UI This is the problem I have. I have created a shader that draws circle. But depending on the distance from the camera thickness changes.

Is it possible to keep thickness constant?

sentences:
How to mark a variable as prefab independent? I am making a game that has a symmetrical level design. Each player own a portion of the map and each portion is the same. As such, I placed the portion as a prefab so that when I apply the prefab, every other portion gets changed as well.

On the prefab there is a script. This script contains a variable called playerId. I dont want this variable to change to prefab default when I apply the prefab. Is there an attribute tag I can use to do this? As far as I am aware, Unity's transform.position doesnt get affected by the prefab defaults.

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:
HTML5 Canvas - Drawing with Floats I'm trying to implement a game where you have car moving along a line in HTML5 Canvas. Using a little bit of trigonometrie I managed to get the right x and y coordinates to add to the coordinates of my image each frame to get to the end of the "line".
Now the problem is, the image I use for the car starts to stutter in the process of rendering. The problem has to be the values I'm adding. (first I thought the problem would be the render loop but when using the render loop from paul irish the same problem occurs)
My question is, how can I use floats in context.drawImage(img,...) smoothly?

What I tried was rounding the values where the image should move to (e.g. context.drawImage(img, Math.round(car.x), Math.round(car.y))) but this doesn't work also.

simple code example to demonstrate the issue: (using a simpler loop, but like I said, the problem isn't the loop)

How it looks:

Here is the whole thing:

var canvas = document.getElementById("canvasID");
var context = canvas.getContext("2d");

var car = new Car(20,10);
var carImg = new Image();

carImg.src = "https://i.stack.imgur.com/L2XQW.png";
function Car(x,y)
{
  this.x = x;
  this.y = y;
}
Car.prototype.advancePosition = function(x,y)
{
   this.x = lerp(car.x, car.x + x, 1);
   this.y = lerp(car.y, car.y + y, 1);
}
 function update()
 {
   car.advancePosition(0.91,0.4);
 }
function lerp (start, end, amt){
  return (1-amt)*start+amt*end
}
function render()
{
  context.beginPath();
  context.clearRect(0,0, canvas.width, canvas.height);
  context.drawImage(carImg, car.x, car.y);
  context.closePath();
}

window.requestAnimFrame = (function(callback) {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame ||                    window.mozRequestAnimationFrame|| window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
        function(callback) {
          window.setTimeout(callback, 1000 / 100);
        };
      })();

(function mainLoop(){
  requestAnimFrame(mainLoop);
  render();
  update();
})();
#canvasID
{
    z-index: 1;
    background: #eee;
    display: block;
    vertical-align: middle;
    margin: 0 auto;
    z-index: 1;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    position: absolute;
    -webkit-transform:translateZ(1);
}
<html>
  <head>
    <meta charset = "utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="style.css">
    <title>test</title>
  </head>
  <body>
    <div class = "canvas_wrapper">
      <canvas id="canvasID" width="500" height="450">Canvas not supported, please update your browser</canvas>
   </div>
    <script src="main.js"></script>
  </body>

</html>

I would be happy if someone could help me out

Thanks

edit: Tried the suggestions from the comments but nothing worked.

sentences:
Continuous weighted random distribution, biased toward one end I am currently contributing to a particle system for our game and developing some emitter shapes.

My uniform random distribution along a line or along a rectangular area works fine - no problem.

But now I would like to have something like a 1 dimensional gradient in this distribution.
This would mean for example lower values are more common than higher values.

I don't know what would be appropriate mathematical terms for this problem, so my search skills are rather useless with this one. I need something that is computationally simple, as the particle system needs to be efficient.

sentences:
Cartesian Coordinates & Layout The way cartesian coordinations are presented and used is kinda confusing.

When working with 2D the vertical axis is Y, though when working with 3D the vertical axis is Z and Y becomes the "depth" axis.

Basically I'm thinking the correct way, and best way would be to use the layout of axis.

Though Blender (3D modelling program) and other program, a lot games, present the axis in the "weird order" (my opinion)

Also if you read on Wikipedia about cartesian coordinates, your are presented with that layout of axis.

Wikipedia Cartesian Coordinates

Is there any specific or logical reason for this "flip" of axis?

sentences:
NxWheelShape Tilt with Vision(Havok) Engine and PhysX 2.8.x A vehicle I am working on has front wheels that can tilt(lean) left and right as well as turn left and right. The turning was pretty easy, but there seems to be nothing on how to set a WheelShapes tilt and I'm wondering if anyone here has experience with this and can point me in the right direction?

I see there is a SetRotationMatrix() but it also says that it bypasses physics module and will lead to unpredictable results so I was looking into a Vision Engine function that allows me to set a Rotation Delta by passing in a yaw, pitch and roll but that doesn't affect the WheelShape itself, only the 3D Wheel Model and I don't think thats what i want anyway.

I only mention the Vision Engine in case anyone is familiar with both but the PhysX stuff is mostly untouched by the engine. Any suggestions?

sentences:
Error compiling irrlicht android using ndk in Mac I'm new to irrlicht and I have started with irrlicht android port. I have made the following changes to android.mk file:

LOCAL_CFLAGS := -O3 -DANDROID_NDK -DDISABLE_IMPORTGL -I./../include/ -I./include/ -I/documents/karthik/android/android-ndk-r9/platforms/android-18/arch-arm/usr/include

LOCAL_LDLIBS := -L/documents/karthik/android/android-ndk-r9/platforms/android-14/arch-arm/usr/lib/libGLESv1_CM.so -ldl -llog -L/documents/karthik/android/android-ndk-r9/platforms/android-14/arch-arm/usr/lib/libGLESv1_CM.so

I have tried compiling irrlicht android using ndk-build in terminal.It showed the following errors at first:

In static member function 'static void irr::os::Printer::log(const c8*, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(wchar_t const*, irr::ELOG_LEVEL)':
 error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(const c8*, const c8*, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
In static member function 'static void irr::os::Printer::log(const c8*, const path&, irr::ELOG_LEVEL)':
error: format not a string literal and no format arguments [-Werror=format-security]
make: *** [obj/local/armeabi/objs/irrlicht/os.o] Error 1

and then I googled that and made changes in os.cpp file as follows:

Changed the code,

__android_log_print(ANDROID_LOG_INFO, "log", message);

to

__android_log_print(ANDROID_LOG_INFO, "log","%s", message);

This change solved that issue, and then I got another error:

In file included from jni/importgl.cpp:55:0:
jni/importgl.h:37:22: fatal error: GLES/egl.h: No such file or directory

Again I changed GLES/egl.h to EGL/egl.h and solved that issue, got:

fatal error: irrlicht.h: No such file or directory

I even solved this , atlast I'm here with this error:

error: 'EglDisplay' was not declared in this scope
error: 'EglSurface' was not declared in this scope
error: 'EglWindow' was not declared in this scope
error: 'EglContext' was not declared in this scope

sentences:
What is the best (or a good) approach to "code" difficult level I've to decide how to code enemy spawn: quantity and time.
What's a good approach to do that ?

Maybe a class like this ?

class Level {
   int   levelNr ;
   int   soldierQty; // number of enemy soldier
   int   aircraftQty; // number of aircraft
   float maxTimeToComplete;
   ...
   ...
}

Then, in main code

   Level[100] levels;

   levels[0].levelNr = 1;
   levels[0].soldierQty = 5;
   levels[0].aircraftQty = 3;
   levels[0].maxTimeToComplete = 10; // 10 seconds
   levels[1].levelNr = 2;
   etc etc etc

Is it a good approach ?
Is there a different way I haven't thought ?

Thanks

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 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:
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:
How to create a view looking down the sight of the gun I am in the midst of creating an FPS game using XNA.  I am using the camera class from the First Person camera demo from dhpoware.com, and everything is working great.  What I'd like to implement is the ability to press the right mouse click and then the view changes so that you look down the gun, like the following image:

I have searched and searched but haven't found anything that will help me out, or at least point me in the right direction.  Can anyone help?

sentences:
Framerate drop from 160 to 56-59 when upgrading Unity to 2020 I just updated to Unity 2020.2 from Unity 2019.4. I use Ubuntu 2020.10. Everything is super fast but the framerate is less than 60 FPS, precisely between  56 and 59 FPS, for all my Android project. With Unity 2019.4, it was more than 160 FPS. Even Unity Sample scene has this framerate.
Is this bug on my laptop or a configuration set by Unity? How can I edit it to get my previous framerate?

sentences:
Smooth pixels while rotating sprite I just started with andengine, so this maybe gonna be silly question.
How to make my sprites more smooth while I rotate them? Or maybe it because this is screenshot from tablet?

Thanks JohnEye it works:

Just need to change my BitmapTextureAtlas from:

BitmapTextureAtlas carAtlas = new BitmapTextureAtlas(this.getTextureManager(),100, 63);

to:

BitmapTextureAtlas carAtlas = new BitmapTextureAtlas(this.getTextureManager(),100, 63, TextureOptions.BILINEAR);

sentences:
Do game studios look at personal projects when hiring? I am 17 and I have spent the past 5 years making games for fun. But now I am faced with college and it might be time to get serious about this hobby.

So do Game Studios want to see personal games or 3d models in resumes, or will they only care about professional level work? To a lesser extent my question is also when would a company hire a high school student and why?

As always with these sites I feel like i'm walking on eggshells, so if this is posted in the wrong place, or if i'm breaking any rules please tell me.

sentences:
Heightmap generation I want to implement something like this to create a heightmap: 'Place a group of coordinates evenly across a map, and give them height values within a certain range. Repeatedly create coordinates between all of those coordinates, setting their height by deriving a value that was a mean value of all the surrounding coordinates.'

However, I'm not sure how I would go about it - I'm not sure how I could code the part where I place the coordinates in between the existing coordinates. Can anyone give any help/advice?

sentences:
Getting Into Game Development After a bit of research (And a bit of experimenting) I found that coding is quite fun. I've always wanted to try game development, but never really found a place to start. As well as this, this is my first time using Stack Exchange, so if this post is horrendously misplaced, I apologise. I don't want to go into professional game development, as I'm only 13, but I would like to try it. As I said before, I did try some programming (In Java), so I know the very basics of code-Java at least-so this is my question:
How would I go about building a simple platformer? I don't want fancy graphics, or multiple states. All I want to try is the code a simple engine that can use collisions and take keyboard input, and have a single level that can be changed within the code (By that I just mean drawing different sized rectangles). That is it.
How would I go about this, in the simplest way possible? Any help would be appreciated! :D

sentences:
Best way to detect if vec3 is between vec3(x) and vec3(y) in glsl As titled

I am sampling from a texture and if the color is somehow gray [vec3(.8), vec3(.9)] and an uniform is 1 I need to substitute that color with another one

I am not a glsl veteran but I am pretty sure there is a more elegant and compact (without mentioning faster) way than this:

vec3 textureColor = texture(texture0, oUV);

if(settings.w == 1 && textureColor.r > .8 && textureColor.r < .9
                    && textureColor.g > .8 && textureColor.g < .9
                    && textureColor.b > .8 && textureColor.b < .9)

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:
Get Cartesian coordinates from isometric coordinates Coordenadas: X:140 Y:279
Coor Isometricas:128/69
X: 2  Y: 1.
CoordenadasConversas: 69:214.

CoordenadasConversas should be equal to Coordenadas.

CoordenadasConversas does not work.
The function I use is CoordenadaAIsometrico() - see below.

I applied the formula to convert from isometric to Cartesian, but it does not seem to work.

float cartesianX = (2.0f * isometricY + isometricX) * 0.5f;
float cartesianY = (2.0f * isometricY - isometricX) * 0.5f;

function Isometrico(){

    ctx.save();

    ctx.translate(0, 300);

    ctx.scale(1, 0.5);

    var radianes=-45 * Math.PI /180;

    ctx.rotate(radianes);
}

function CorIsometrico(xI,yI){

    yI=yI-300;

    yI=yI*2;
    var angle = ((-45 * Math.PI /180) * -1)
    var x2 = xI;

    var y2 = yI;
    var cos = Math.cos(angle);
    var sin = Math.sin(angle);

    var xI2 = Math.floor(x2 * cos - y2 * sin);
    var yI2 = Math.floor(x2 * sin + y2 * cos);

    console.log("Coor Isometricas:" + xI2  + "/"+  + yI2 );

    CoordenadaAIsometrico(xI2,yI2);
}

function CoordenadaAIsometrico(Xc,Yc){

    var Xcc = (2 * Yc + Xc) * 0.5;

    var Ycc = (2 * Yc - Xc) * 0.5;

    //Xc=Xc-50;
    //Yc=Yc+300;

    console.log("CoordenadasConversas: " + Xcc + ":" +  Ycc);
}

sentences:
How to create a separate bin folder? I am now creating a 64 bit and 32 bit executable of my game.

How could I achieve so that the executable and dlls lie in a separate folder without changing all the path variables in the game?

To clarify I want to have a folder structure like this:

Game

Bin

exe
dll, so, etc.

Data

textures and everything else.

My current is:

Game

exes
dlls
data

So my path variables use something like: ./data/ ....

How could I move my exes so they would find all dlls and data, so I wouldn't need to replicate the data folder for each version and have them nicely separated?

I am mainly looking for answers for Windows, but I am also interested in Unix solutions.

sentences:
Testing Unity 2D Physics I am looking to push the 2D physics in Unity to the extent where when so much is going on that there becomes noticeable lag in a game. This is for testing purposes, so that when so much is going on that a button can be pressed to reduce the amount of physics objects on screen then see what affect that has. So in my small 2D demo I have placed alot of barrels on the map, all of which have physics on them, player bumps into them and they move. I have went to the extent of placing alot of them on the map (864 to be exact), bumping into them I still don't see any effect on the gameplay. Other things I have tried, besides adding alot in, is increasing the mass of the barrels, changing their linear and angluar drag and making them bouncy.

Is there anything I can do besides adding alot more in?
Thanks!

sentences:
How can I make this tile map correctly? I'm having the following problem creating this hexa tiled map.

this is what I wanted :

[EDIT]
Ok I've Managed to do this:

const float scaleX = ((float)tileWidth) / 10000,
    scaleY = ((float)tileHeight ) / 10000;
    const float hexagon_r = scaleY / 2;
    const float hexagon_dx = hexagon_r * cosf(30*3.14f / 180.0);
    const float hexagon_dy = hexagon_r * sinf(30*3.14f / 180.0);
    const float hexagon_gx = 2.0*hexagon_dx;
    const float hexagon_gy = 2.0*hexagon_dx*sinf(60*3.14f / 180.0);
    Vector2 auxPos;
    auxPos.x = 0;
    auxPos.y = 0;
    float j = 0;
    for (unsigned int y = 0; y < layer->layerHeight; y++, j += hexagon_gx * 2)
    {
        auxPos.y = y * (hexagon_gy * -2 );
        auxPos.x = j;
        for (unsigned int x = 0; x < layer->layerWidth; x++)
        {

            auxPos.x += hexagon_gx * 2;

            float angle =90 * 3.14f / 180;

            auxPos.y += hexagon_gy * 2;

            SetData(stack->vData, stack->vCounter + 0, auxPos.x + ((-scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 1, auxPos.y + ((-scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 2, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 3, auxPos.x + ((scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 4, auxPos.y + ((scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 5, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 6, auxPos.x + ((scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 7, auxPos.y + ((scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 8, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 9, auxPos.x + ((-scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 10, auxPos.y + ((-scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 11, layer->layerDepth);
        }
    }

can't seem to make this work...

sentences:
Is Google App Engine suitable for a real-time but single player game? I'm in the planning stage of a new project. Without going into details, this is a real-time 2D game with some basic construction aspects, combat, and a large procedurally generated world.

Because of the design of the game, it really makes most sense for it to run directly in a browser with all of a player's progress stored on the server. Basically each player will have their own persistent 2D map which they can modify, and I want them to be able to access it from any computer. It's not multiplayer.

Imagine a real-time 2D action and building game that could be played completely offline, except it saves your progress to a server so it can be accessed from anywhere.

This will be my first foray into making an online game or web application, so I'm wanting it to be as painless as possible. Would GAE work well for a game like this? I've been told that GAE is simply not appropriate for a real-time game; however, this has always been said in the context of a multiplayer game, not a single player game.

I should also note that it would be acceptable for the game to have an ordinary save option and to only save data to the server when this option is used by the player. Since that means the player would lose progress if he just closed the tab or browser window without saving, it could be accompanied with a 5 minute autosave.

sentences:
How to achieve 'forward' movement (into the screen) using Cocos2D? I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world (left, right, up, down) via gyroscope control. I plan to only use 2D sprites and no 3D models.

My first attempt was to increase the scale of layers to make it appear as if the player was moving toward the objects but I'm not sure how to make it seem as if the player is passing around the objects (instead of running into them).

If there are extensions that I should take a look at (like Cocos3D), please let me know. Thanks for the help!

sentences:
2D game physics, doing it right I have a ball that you can make jump,

I have a sneaking suspicion I'm doing this wrong. It works now, to the extend that gravity pulls the object down toward the ground, but I'm having trouble manipulating the speed of the object.

What this is, is a ball jumping and falling towards the ground.

I have another function called "jump" that just adds a value to it's yVel

I can increase gravity, and it falls faster.

I can increase the jSpeed speed, and it'll rise up longer, but not faster

But I can't get it to do everything faster. It just looks painfully slow, which may or may not be because of my emulator running at 11 fps, on average.

Is it just my emulator, or is it something on my end?

float time = elapsedTime/1000F;
 if (speed < maxSpeed){
            speed = speed + accel;
            }
            if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
            mVelY += (speed);
            }

            if (!(mY + height >= Panel.mHeight)){
            mVelY = mVelY  + gravity ;}

            mX  =  (float) (mX +(mVelX * time));
            mY =  (float) (mY + (mVelY * time));

sentences:
Touch Coordinate in onManageUpdate method I want to get touch coordinate in onManageUpdate() method. So how to perform that one?

Because onSceneTouchEvent method simulation is some what slow so I could not able to get each coordinate in move event. So to achieve each coordinate in move event I want this functionality.

So someone please help me in this.

sentences:
My app crash using OpenAL but only in Release Mode I'm building up a complete game engine so, basically, it integrate a sound system. The problem is that a line make me crash in my code. The strange thig is that my app crash ONLY when I compile using Release mode, in Debug Mode it run just fine.

I'm using MSVC 16.XX (I don't know exact version, but it is the latest at the time I am asking this question)

(language used is c++)

void PSound::GetDevice()
{
    const ALchar* DeviceList = alcGetString(NULL, ALC_DEVICE_SPECIFIER); //This Line make app crash

    if(DeviceList) {
        while(strlen(DeviceList) > 0) {
            Devices.push_back(DeviceList);
            DeviceList += strlen(DeviceList) + 1;
        }
    }
}

sentences:
Unity: Animate Sprite Shape Sprite? Is it possible to animate a sprite shape?  I don't see the Sprite Shape Profile in the animator properties, so I was just wondering if there's another way to do that.
To clarify:
Our game is 2D animated by hand, and one level has conveyor belts that span the level.  We can animate it normally, but that will end up taking more video memory than if we were able to animate the conveyors as tiled sprite shapes.  It may not end up being worth the effort to save the memory, but I figured it was worth a shot.  Because the sprites span the level, they end up taking up lots of space in a sprite atlas.

sentences:
Align spawned particle system I am working on a game in which tanks can shoot at each other. I intend to spawn a spark particle system (particles emit to Z) when a bullet hits a surface. I want to align the Z axis of the newly spawned particle system to be

a) in a 90 degree angle to surface that has been hit
b) in a reflective angle from the original trajectory

I know that I can "fake it" by setting particle Z to World 90 degrees, however then it will do so on any angled surface, while I would like to have the particle system dynamically orient itself in a 90 degree angle away from the surface that has been hit/ or reflect into the direction away from the incoming bullet.

hope you can help me, getting quite frustrated.

sentences:
Arrow key control on winforms RichTextBox I am making a faux console using winforms for the game I am working on. Right now I am moving a '0' across the screen using the arrow keys.

In order to provide fine grain formatting on the text, I am using a richTextBox for the console display. The background for this box is black.

Problem: If the richTextBox is set to Enabled = false I can use the arrow keys without a problem but the box background color is grey and will not change. If I set it to read-only, when using the arrow keys it will just move the cursor and my arrow key events will not fire.

I am fine with setting the text to read-only and getting my black control color. So my question would be, is there a way to set the control to read-only and still allow for my arrow key events (and not move the cursor)?

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: gradient coloring of an object I have an object(FBX format) in my project, it's a line drawn in 3D max. I want to color the line in XNA so that the color starts from a specific RGB color in both the start and end points of the line and finish in a specific RGB color.(e.x., from (255,255,255) to (128,128,128). Something like gradient coloring of an object. I need to do that programmatically, since later in my code I have to change these two specific colors a lot.

sentences:
Can't render to FBO using a shader I've added functionality so that I can render to a framebuffer (for post-processing and stuff).  I can successfully render to my framebuffer and then render that framebuffer, but anything with a shader does not render to my framebuffer.  Rendering with the same shader worked before I added the framebuffer step.

Here's how I create my framebuffer:

// create the color texture
colorBuffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, colorBuffer);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

// create the depth texture
depthBuffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, depthBuffer);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Depth24Stencil8, width, height, 0, PixelFormat.DepthStencil, PixelType.UnsignedInt, IntPtr.Zero);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

// create the fbo
GL.GenFramebuffers(1, out fbo);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, fbo);
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, colorBuffer, 0);
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthStencilAttachment, TextureTarget.Texture2D, depthBuffer, 0);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);

And this is my shader code:

// VERTEX SHADER
#version 330

uniform mat4 world;
uniform mat3 worldIT;
uniform mat4 view;
uniform mat4 projection;
uniform mat4 textureTransformation;

in vec3 rPosition;
in vec3 rNormal;
in vec2 rTexCoord;
in vec3 rColor;

out vec3 vWorldPosition;
out vec3 vNormal;
out vec2 vTexCoord;
out vec3 vColor;

void main(void)
{
    vec4 tempWorld = world * vec4(rPosition, 1.0f);
    gl_Position = projection * view * tempWorld;

    vWorldPosition = tempWorld.xyz;
    mat3 normalSpace = mat3(world);
    vNormal = normalize(normalSpace * rNormal);
    vTexCoord = (textureTransformation * vec4(rTexCoord, 0.0f, 1.0f)).xy;
    vColor = rColor;
}

// FRAGMENT SHADER
#version 330

uniform sampler2D colorMap;

in vec3 vWorldPosition;
in vec3 vNormal;
in vec2 vTexCoord;
in vec3 vColor;

out vec4 fColor;

const vec3 ambientLight = vec3(0.1f, 0.1f, 0.1f);
const vec3 lightDir = vec3(0.0f, -1.0f, 1.0f);
const vec3 lightColor = vec3(1.0f, 1.0f, 1.0f);

void main(void)
{
    vec4 texel = texture(colorMap, vTexCoord);

    vec3 n = normalize(vNormal);
    vec3 l = normalize(lightDir);
    float nDotL = max(dot(n, l), 0.0f);

    vec4 diffuse = vec4((ambientLight + nDotL * lightColor) * vColor, 1.0f) * texel;

    vec4 specular = vec4(0.0f, 0.0f, 0.0f, 0.0f);

    fColor = diffuse + specular;
}

EDIT:
It seems to be that, for some odd reason, my shader stopped outputting at all when I added the framebuffer support.

sentences:
Pipe connection game algorithm - Java/Andengine I am creating a game based on Pipe Dream/Pipe Mania using java/andengine for android. I have a square grid of tiles each representing a type of pipe. The player needs to swap tiles to connect the pipes from point A to B.

How do I determine if the pipes are connected to starting point A? How do I then find how far a connected path goes? How do I determine if the path connects point A to point B? How do I handle the switching of tiles which may be in the middle of the path?

This functionality will be almost the same as the pipe mini game in the first Bioshock game.

I am looking for advice on how to go about tackling this problem.

sentences:
What to consider legally when cloning an old game? Possible Duplicate:
  How closely can a game resemble another game without legal problems

I'm going to make a game in the form of a 100% free Android phone app that will be basically a clone of an old arcade style NES game, but with a few modifications to make it better. Now the game I am inspired by was released in 1985, so I'm not exactly shitting bricks about being sued, but I just thought I'd ask on here first about what kind of legal considerations developers go through when copying others' games.

sentences:
How to skip the sky in lighting shaders? I recently implemented a sky in my deferred rendered game. It is a procedurally calculated sphere with a texture applied to it. Unfortunately all lighting shaders (light sources, ambient occlusion) are applied to that sky dome geometry as well.

Therefore the sky is completely dark without a huge light source in the level. And if there is one, the edges between triangles of that sphere are darkened by the ambient occlusion shader.

My quick and dirty fix was to read the depth texture to determine whether the lighting effect should be applied or not. For example, the view distance is 1000.0f and every pixel with a depth higher than 900.0f isn't shaded anymore. That works partly since every pixel of the sky is between 900.0f and 1000.0f.

But there are some issues with this approach. For example level geometry further away than 900.0f isn't shaded, too. Moreover the depth values come from projecting the scene on a plane, the screen. That means that the distance to the sky, which is equally in all directions from the players world position, differs over the image. Sky seen on the sides of the screen is nearer than sky pixels seen in the center of the screen. That effect varies with the field of view setting. The issue with that is that for every field of view setting I would need different depth thresholds for shading.

Is there a common way to not, or differently, shade some pixels of the image? In my case, I would need to not shader sky pixels. If I could determine which pixel is from the sky, I could store that in a buffer and read from that in lighting shaders to skip those pixels. But I have no idea how to approach this.

sentences:
How can I enable/disable a script that is attached to a character, only once? With only once, I mean once false and once true. The reason I want to enable and disable the script is that I don't want to disable the player controller and then after some point re-enable that controller again.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float speed;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;
            var firstpc = fpc.GetComponent<FirstPersonController>();

            if (fpc.transform.rotation != Quaternion.Euler(0, 0, 0))
            {
                firstpc.enabled = false;
                fpc.transform.rotation = Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
            }
            if (fpc.transform.rotation == Quaternion.Euler(0,0,0))
            {
                firstpc.enabled = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

This script is not attached to the FirstPersonController. That is why I added the global variable fpc.

I'm getting the script that is already attached to the fpc. I called it firstpc and the script name is: FirstPersonController

FirstPersonController gives the player a control over the fpc with the mouse camera. I want to disable the script until fpc.transform.rotation == Quaternion.Euler(0,0,0) and then enabled the script again to use.

The problem is that it's all the time getting over and over again to the line:

firstpc.enabled = false;

Then it's getting also to the line:

firstpc.enabled = true;

But since it's getting to the false all the time it's stuck between both states.

The script here in my question is attached to the Plane in the hierarchy.
And the script I want to enable/disable is attached to the FPSController.

In my script that is attached to the Plane, fpc is the FPSController and firstpc is the script FirstPersonController that attached to the fpc.

sentences:
How do you do tile-based movement in Phaser? I'm looking to make 2D game that is very similar in movement to Pokemon Red or Blue (player must move a full tile in any direction, the ground moves smoothly beneath the player as they walk). I've got my hands on Tiled in order to make my maps, and I've got a player sprite that I can display over the map, but I can't seem to find a way to restrict the player to moving the way I want.

I feel like there should be some parameter for Arcade physics to make the movement the way I want, but I'm not finding it. Abandoning Arcade physics and manually changing the X/Y of the player with a loop kinda works, but can be very slow and laggy, making me think I'd need to look into the Time and Tween parts of Phaser to actually implement it correctly.

So did I miss something with Arcade Physics to do this? Or do I need a really good tutorial on Tween to manually code this myself?

sentences:
Google street view racing game? How would one create a map for gaming using Google street view? Are there any programs for doing this? The cars, people and objects could be edited out and replaced with digital copies if the same objects for that area. Originally I was thinking GTA Local but would require a much more work.

3D game with Pre-rendered background

https://law.stackexchange.com/questions/37810/do-objects-in-the-public-view-need-licencing

sentences:
Determine if a set of tiles on a grid forms an enclosed shape Given a set of tiles on a grid, I want to determine:

If the tiles make an enclosed figure
If the tiles make an enclosed figure when you count the sides of the board as an edge of the figure
If either of the previous two statements are true, which additional tiles fall inside the enclosed figure the initial tiles form.

The player will begin by pressing down on one tile, then dragging their finger to other tiles to create a chain of same-colored tiles. I will check as I go to see if the next tile is valid. Ex. If the player begins on a red tile, their only next valid move is to an adjacent red tile (diagonals do count). When the user lifts their finger, I need to be able to check for the 3 items above.

So my initial thought was that, since I was checking for the validity of the chain each time I went, when the player lifted their finger I could check if the first and last tiles were adjacent. (I already know they're the same color.) If they were adjacent I had a hunch that I'd made an enclosed figure, and I was going to come here to try and see if I was missing something big, and to get some kind of logical/mathematical proof that my hunch was correct (or an example proving it incorrect.)

But that's when I thought of item number 2: I also have to account for chains which use an edge of the board as a side of the enclosed figure. In that case, the first and last items in the chain would not be adjacent, but I would still have an enclosed figure. So now I'm back to square one, a bit.

What can I do with this chain of grid coordinates to figure out if they make an enclosed figure or not? And once I do know I have an enclosed figure, what's the best way to get an additional list of all tiles that fall inside its bounds?

Above I've drawn pictures of what I expect the 4 possible results of this test can be.

The chain does not make an enclosed figure.
The chain does make an enclosed figure.
If you count the sides of the board as an edge (or more than one edge) of the figure, the chain does make an enclosed figure.
The chain does make an enclosed figure, but there are extra data points (validly selected by the user as part of the chain) which are not a part of the figure that is created.

Case 4 is the trickiest, because you'd have to extract the "extra" chain links to find the enclosed figure and the pieces that fall inside it (but not around the "unenclosed" area).

So... Anyone have an idea of a good way to solve this, or just a starting point for me? I'm kind of going in circles at this point and could use another set of eyes.

sentences:
1D Perlin Noise Game in Unity I'm working on a 2D side-scrolling game in the Unity engine. I am using the 1-Dimensional Perlin Noise function and using pseudo-code. I can't use two links so I'll provide a link to imgur with the images and the links in numerical order. First link in imgur links to the pseudo-code/implementation of perlin noise I am using.
My implementation so far is showing good results.
Here is a picture:

This image uses the values:

Persistance = 0.7

Octaves = 4
From the first article I linked, it states:

Now, you'll want several different random number generators, so I
suggest making several copies of the above code, but use slightly
different numbers. Those big scarey looking numbers are all prime
numbers, so you could just use some other prime numbers of a similar
size.

This block of text is referring to this part of code which is an Integer-noise function:
  float Noise (int x)
    {
        x = (x << 13) ^ x;
        return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
    }

Another site I found the author adjusts the Integer-noise function from discrete to continuous (allowing the range not to be limited). I've made this change although I am not sure if my implementation of both links I've provided is entirely correct. The results are promising but when you change these variables values to:

Persistence = 1

Octaves = 8

the terrain starts to have little gaps at the bottom like so:

I am not quite sure how to fix this, I know lowering the persistence provides smoother results resolving this issue but that makes the terrain's amplitude rather low for a side-scrolling platformer.
Here is the complete code:
    void Start ()
    {
        objectArray = new GameObject[width, height];

        for (int i = 0; i < width; i++) {

            float x = PerlinNoise_1D (i, persistances, octaves);

            for (int j = 0; j < height; j++){
                objectArray[i,j] = (GameObject)Instantiate (gameobject, new Vector3 (i, j + x, 0), Quaternion.identity);
            }
        }

    }

float Noise(int x){
    x = (x << 13) ^ x;
    return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
}

float CoherentNoise  (int x)
{
    int intX = (int)(Mathf.Floor(x));
    float n0 = Noise (intX);
    float n1 = Noise (intX + 1);
    float weight = x - Mathf.Floor (x);
    float noise = Mathf.Lerp (n0, n1, weight);
    return noise;
}

float SmoothedNoise (int x)
{
    return CoherentNoise (x) / 2 + CoherentNoise (x - 1) / 4 + CoherentNoise (x + 1) / 4;
}

float InterpolatedNoise (float x)
{

    int integer_X = (int)x;
    float fractional_X = x - integer_X;

    float v1 = SmoothedNoise (integer_X);
    float v2 = SmoothedNoise (integer_X + 1);

    return Cosine_Interpolate (v1, v2, fractional_X);
}

float Cosine_Interpolate (float a, float b, float x)
{
    float ft = x * (float)Mathf.PI;
    float f = (float) ((1 - Mathf.Cos ((ft))) * .5);

    return  a * (1 - f) + b * f;
}

float PerlinNoise_1D (float x, float persistance, int octaves)
{

    float total = 0;
    float p = persistance;
    int n = octaves - 1;

    for (int i = 0; i <= n; i++) {

        float frequency = (float)Mathf.Pow (2, i);
        float amplitude = Mathf.Pow (p, i);

        total +=  InterpolatedNoise (x * frequency) * amplitude;
    }

    return total;

}

Thank you for your help and time.

sentences:
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:
I want to develop basic level GameRanger link game lobby I want to develop basic level GameRanger link game lobby.

I am using Winform, C# Framework 4.0.
currently i am exploring below code
https://www.codeproject.com/Articles/14050/A-game-lobby-system-in-C?msg=5449482#xx5449482xx

But getting error to load gametypes/bridge.dll

desktop app GUI

sentences:
Why is my 2D mouse aim not working properly? I'm trying to program 2D mouse aim, where the arms and the gun in the arms rotates to point at the mouse. But for some reason, the arms and gun rotate and do not follow the mouse position.

The each of the arms and the guns are separate node that are parented to an orbit node that is located on at the shoulder of the arms.

The following code is script that is attached and running on the orbit.

    var mousePos = get_viewport().get_mouse_pos();
    var dir = get_pos();
    var angle = (atan2(dir.x,dir.y))+(2*PI);
    var arm_gun_dir = gravGun_Ref.get_pos()-get_pos();
    var arm_gun_angle = (atan2(arm_gun_dir.x,arm_gun_dir.y))+(2*PI);
    set_rot(angle-(PI/2));

Here is a GIF of the result of this setup:

Here is an image showing where the positions of the upper arm and the gun.

sentences:
rotation matrix problems - opengl and own types In an effort to learn things deeper I'm writing my own mathematics for the first time instead of using libraries. As far as I can tell my matrix multiplication is correct, and translation and scaling work fine. I am however, struggling to debug the rotations. I've tried pretty much everything I can think to check and it still won't function as expected. If I set the angle to zero then as expected the Model matrix will not be effected. Changing to 1.0f will explode, the only value which results in expected behaviours seems to be zero... I haven't written a view matrix yet and I've been trying to debug this with the projection(orthographic) matrix on and off. Below is code with some notes.

Matrices are linear arrays of 16 values. i32 is an int, f32 is float, internal is static.

inline m4x4 operator*(m4x4 a, m4x4 b){
  //TODO redo this with simd
  m4x4 Result = {};

  for (i32 Row = 0; Row <= 3; ++Row)
  {
    for (i32 Col = 0; Col <= 3; ++Col)
    {
      for (i32 n = 0; n <= 3; ++n)
      {
        Result.c[(Row * 4) + Col] += a.c[(Row * 4) + n] * b.c[4 * n + Col];
      }
    }
  }

  return (Result); }

inline m4x4 GetRotationZ(f32 angle) {
  m4x4 Result;
  f32 c = Cos(angle);
  f32 s = Sin(angle);

  Result =  { c, s, 0, 0,
         -s, c, 0, 0,
         0, 0, 1, 0,
         0, 0, 0, 1 };

    return (Result); }

inline m4x4 RotateZ(m4x4 m, f32 angle) {
  m4x4 Rotation = GetRotationZ(angle);
  m4x4 Result = Rotation * m;

  return (Result); }

internal void DrawSprite(sprite Sprite, v2 Position, v2 Size, f32 RotationAngle, v3 Colour) {
  glUseProgram(Sprite.ShaderProgram);
  glBindVertexArray(Sprite.VAO);

#if 0
  Position = v2{400, 300};
  Size = v2{100.0f, 100.0f};
  RotationAngle = 0.0f;
#endif

#if 0
  m4x4 Projection = Orthographic(0.0f, 800.0f, 0.0f, 600.0f, -1.0f, 1.0f);
  u32 ProjectionUniformID = glGetUniformLocation(GlobalSprite.ShaderProgram, "Projection");
  glUniformMatrix4fv(ProjectionUniformID, 1, GL_TRUE, &Projection.c[0]);
#endif

  m4x4 Model = IdentityMatrix();
  Position.x = Position.x * 0.01f;
  Position.y = Position.y * 0.01f;
  Model = Translate(Model, V3(Position, 0.0f));

  Model = Translate(Model, v3{0.5f * Size.x, 0.5f * Size.y, 0.0f});
  //Model = RotateZ(Model, RotationAngle);
  Model = RotateZ(Model, 45.0f);
  Model = Translate(Model, v3{-0.5f * Size.x, -0.5f * Size.y, 0.0f});
  Size = v2{0.25, 0.25};
  Model = Scale(Model, V3(Size, 1.0f));

  u32 ModelUniformID = glGetUniformLocation(Sprite.ShaderProgram, "Model");
  glUniformMatrix4fv(ModelUniformID, 1, GL_TRUE, &Model.c[0]);
  glDrawArrays(GL_TRIANGLES, 0, 6); }

Next the shader source

char *VertexShaderSource = R"(
  #version 330 core
  layout (location = 0) in vec4 PositionAndTextureCoords;
  uniform mat4 Model;
  uniform mat4 Projection;

  out vec2 TexCoords;
  void main()
  {
     TexCoords = vec2(PositionAndTextureCoords.zw);
     //gl_Position = vec4(PositionAndTextureCoords.xy, 0.0f, 1.0f);
     //gl_Position = Model * vec4(PositionAndTextureCoords.xy, 0.0f, 1.0f);
     //gl_Position = Projection * Model * vec4(PositionAndTextureCoords.xy, 0.0f, 1.0f);
     gl_Position = Model * vec4(PositionAndTextureCoords.xy, 0.0f, 1.0f);
  }
)";

char *FragmentShaderSource = R"(
   #version 330 core
   in vec2 TexCoords;
   uniform sampler2D Texture;

   out vec4 FragColour;
   void main()
   {
     FragColour = texture(Texture, TexCoords);
   }
)";

I've stepped through the debugger, I've checked every line of code again and again, I've worked through a few matrices by hand and still I don't know whats going wrong. It should be something so very trivial yet I can't seem to find the bug...

Below are pictures demonstrating the difference between 0.0f and 1.0f, as of this state of the code it not only skews and rotates incorrectly, but its scaling is well off as well.

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:
Marketing a browser game with a specific audience My issue is that I have extensively developed an online browser game, but mainly the marketing and independent developer guides tailor to action packed executable games. My game also tailors to a specific audience that is not typically on the indie gaming promotional websites. Namely those interested in Politics, Economy, Law, and/or Sociology.

(My first issue) I wanted to know if there are any suggestions, ideas, or references to any resources that may bring marketing value to my gaming community pre and post-launch? I have began development on my beta campaign already to include some crowd funding websites (mostly for promotion), a press kit, advertisements, and the like. However I would greatly appreciate more resources for the development and launch, namely for the target audience.

(My second issue) Many of the marketing strategies for games depend on a video, game photos, etc. While I can take photos of the screen, there are not too many things I can do for a video except add some stock footage and dress it up by explaining game mechanics and showing some photos of the game. Would that contribute to the game or is it just a waste of time? (Feel free to suggest any ideas for this as well if you are willing).

Thank you for your assistance!

sentences:
Clan, guild, team, faction or group? I don't know if this is the right question for Stackexchange because it is based on opinion, so excuse me if it's not.

I'm currently developing a mobile leisure game in a cartoon style where players build and expand their kingdom, in a medieval setting. Users can be part of a group to help each other, trade goods, communicate together,  and support each other when attacked. The game is NOT a fight game only. Developing and maintaining your city and the citizens is an important aspect, socializing with other players is key, and the target audience are both men and women.

I'm really confused how I should name such groups where you can be part of. Clans, guilds, teams, groups or factions: all of them are possible. When should I use which name? And what would fit my situation the best? It's really important to let users feel they are part of a group. Not just a fighting group, but a group both men and women feel attracted to. A fraction for example would not be the best I think.

I realize this heavily depends on opinions. Buy are there any sources that could help me? What do you feel attracted to? What fits my situation the best?

sentences:
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: How to store NPC movement data? In my 2D tile-based game, I have NPCs that move around on a fixed path. I am putting the information about the NPCs in a .plist file that is loaded on startup. The thing is, I'm not sure how to format the data specifying the path that the NPC moves on. What I was thinking was to have an origin property, a horizontalMovement property, and a verticalMovement property, so when the starts at its origin, then walks right the number of tiles specified by horizontalMovement, then walks the number of tiles down specified in verticalMovement, etc. However, this doesn't seem like the best approach. Is there a better way to store the movement data?

sentences:
opengl storing multiple indices into indices buffer After parsing collada files I found out that we have to load two(or more) indices each pointing to say a vertex or normal etc.
like this (
3 0 2 0 0 0
)

Is there a way to load (and use)these indices to indices buffer(ELEMENT_ARRAY_BUFFER) like this (vnvnvn...)
; where v is vertex pointer, n is normal pointer from the above. with vertices loaded to VBO1 like (vvvv...) and in VBO2 like (nnnn...). So that we dont have to repeat the normals in VBO2.
VBO like (vnvnvn...) is also ok.
(and not something like this https://stackoverflow.com/questions/11148567/rendering-meshes-with-multiple-indices), I'm not trying to use multiple indices buffer. I'm trying to put all the given indices into one index buffer and use them alternately.

(If I wasnt clear i will try for more clarification.)

sentences: What compilers are used in game development? I was kinda wondering what compilers are used in game development, since the game development industry always tries to squeeze every inch of performance out their software, using, among other, (sometimes very aggresive) compiler optimizations and the big boys in compiler technology (llvm, gcc), that excel in such kind optimizations are out of the game in the *Windows operating System*.

sentences:
Why the MoveTowards make the transform moving nonstop? In the Update in the else part, I'm trying to move the transform up from its current position on the exit more up by offset.
When the flag bool exit is true I want the transform to move up more by the offset for example if the offset is 7 then move up on the Y more 7. but it's moving up non-stop.
I tried to like this with exitPosition variable for storing at exit: but still, it's moving up non-stop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Testing : MonoBehaviour
{
    public float speed;
    public float offset;

    private bool exited = false;
    private Vector3 exitPosition;

    private void Start()
    {
        Debug.Log("Position : " + transform.position);
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "Cube")
        {
            Debug.Log("Exited !");
        }

        exitPosition = new Vector3(transform.position.x,
                transform.position.y + offset, transform.position.z);

        exited = true;
    }

    private void Update()
    {
        if (!exited)
        {
            transform.position += Vector3.up * speed * Time.deltaTime;
        }
        else
        {
            transform.position = Vector3.MoveTowards(transform.position, exitPosition, speed * Time.deltaTime);
        }
    }
}

sentences:
How to block the player from moving left and right from two empty game objects? I made the game space shooter in that game my spaceship move left and right but its not stop in right and left corner. When its move to left its go out of the screen. how i stop/block in the left and right screen edges.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    public float speedMove = 3;
    public float bonusTime;
    private Rigidbody rb;
   private float _limit = 3;

    // 1 for right and -1 for left.
    private float _direction = 1;

    // You can call it as speed
    private float _speed = 0.01f;

    private bool toLeft = false;
    private bool toRight = false;

    public GameObject shield;
    public GUIText bonustimeText;

    private bool counting = true;
    private float counter;

    private Weapon[] addWeapons;

    public Sprite strongShip;
    public Sprite normalSprite;
    public Sprite shieldSprite;

    private SpriteRenderer sRender;
    private Weapon weaponScript;

    void Start () {

        counter = bonusTime;
        rb = GetComponent<Rigidbody>();

        sRender = GetComponent<SpriteRenderer> ();
        addWeapons = GetComponentsInChildren<Weapon> ();
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }

        weaponScript = GetComponent<Weapon>();
        weaponScript.enabled = true;
    }

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

        transform.position = Vector3.MoveTowards (transform.position,new Vector3 (transform.position.x + _direction, transform.position.y, transform.position.z),_speed);

        if (Input.GetMouseButtonDown (0))
            _direction *= -1;

    }

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "StrongMode") {
            Destroy (coll.gameObject);
            counting = true;
            StrongMode();
            Invoke ("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "ShieldMode") {
            Destroy (coll.gameObject);
            counting = true;
            ShieldMode();
            Invoke("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "Life") {
            GUIHealth gui = GameObject.Find ("GUI").GetComponent<GUIHealth> ();
            gui.AddHealth();
            SendMessage("AddHp");
            SoundHelper.instanceSound.PickUpSound();
            Destroy(coll.gameObject);
        }

        if (coll.gameObject.tag == "Enemy") {
            SendMessage("Dead");
        }
    }

    void Downgrade()
    {
        SoundHelper.instanceSound.BonusDownSound ();
        counting = false;
        bonustimeText.text = "";
        counter = bonusTime;

        sRender.sprite = normalSprite;
        weaponScript.enabled = true;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }
        weaponScript.enabled = true;
        shield.SetActive (false);
    }

    void StrongMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = strongShip;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = true;
        }
        weaponScript.enabled = false;
    }

    void ShieldMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = shieldSprite;
        shield.SetActive (true);
    }

//  void OnDestroy()
//  {
//      bonustimeText.text = "";
//  }
}

sentences:
Getting isometric grid coordinates from standard X,Y coordinates I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y),  instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform.

For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584)

So the question really is what formula gets (20,21) from (640,584)?

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:
How do I know my VRAM upload is ready to be used? Previosuly in Direct3D 9 and 11, if I wanted to update a resource in a Default heap, for example, a Vertex Buffer, I would lock the memory of the buffer, copy the data to the returned pointer, and then unlock the buffer. It is my understanding that unlocking the buffer committed the data to VRAM, and I could be certain that the buffer would be ready to be used by any draw commands.

With Direct3D 12, we now have the concept of upload heaps, and instead of locking the buffer each time I want to modify it, I can just get a mapped pointer to the VRAM area with ID3DResource::Map(). This is pretty cool, because I understand that in most cases, the write is performed with write combining, so I don't have to wait until the entire data is committed to VRAM to keep on doing work on the CPU.

Now the question is, how can I ensure that when I execute a GPU command that references that memory, the memory is already committed, and the GPU can safely read it?

sentences: In a client server first person shooter how does the server keep track of each player's hit boxes? Do all the clients send a transformation matrix for each of the hit boxes which make up the character?

sentences:
How to prevent OnCollisionEnter2D calling a function again and again? My current code makes a ball keep jumping whenever it hits the ground. But when it hits a vertical ground it keeps calling the jump function again and again. That is because OnCollisionEnter2D makes the isGrounded bool true as long as it is in touch with a vertical collider. I tried several ways for example this didn't work for me:

void FixedUpdate()
{

    if(isGrounded == true){
    Verticaljump();
    isGrounded = false;
    }
}
void OnCollisionEnter2D(Collision2D collision) {
    if(collision.gameObject.CompareTag("H-Ground")){
        isGrounded = true;
    }
}

As shown in the picture the OncollisionEnter2D starts and keep adding force on y-axis.Is there any way I can call a function only once even if the gameObject keeps colliding with a surface.

OnCollisionExit2D also does not work. So how can I call a function only once as it collides with ground and even if it keeps colliding with the ground?

sentences:
Are there any pathfinding algorithms that would handle different movement types? I'm developing a bot for a BattleTech board game simulator http://en.wikipedia.org/wiki/BattleTech, it is turn based.

The board is divided into hexagons, each one has a different terrain type and elevation. You drive a robot which moves over them, to destroy other robots.

I only know Dijkstra and A* pathfinding algorithms, but the problem is that there are 3 types of movements: walk, run and jump several hexagons (each of them have their own rules). Walk and run are almost the same.

The best path could be a combination or each movement type. Here is an example of map http://megamek.info/sites/default/files/isometric_view.png

Do you know a good algorithm for this complex pathfinding or a way to combine A* results for each movement type?

sentences:
Extra sprite spawning when the enemies are redrawn SFML I am making a game in sfml and at the moment when all of the enemies die. They are set to respawn however when this is happening they are respawning with one extra sprite than before.

The code for loading in the sprites is

unsigned int orcNumber = 5;
for (int i = 0; i < orcNumber; i++)
{
    SpriteVector.push_back(ogreSprite);
    SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
}

The code for removing the enemies if they are offscreen or shot is similar to below using erase.

for (unsigned j = 0; j < SpriteVector.size(); j++)
{
    if (this->SpriteVector[j].getPosition().x < 0 - 80 )
    {
        //this succesfully removes the object from the vector
        SpriteVector.erase(SpriteVector.begin() + j);
        std::cout << "Container size..." << SpriteVector.size() << "\n";
    }
}

The statement for redrawing them is:

unsigned int orcNumberRespawn = 5;
if (SpriteVector.size() <= 1)
{
    for (int i = 0; i < orcNumberRespawn; i++)
    {
        SpriteVector.push_back(ogreSprite);
        SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
    }
}

window.draw(SpriteVector[i]);

Can anyone identify why when the sprites need to be redrawn it draws with + 1 sprite everytime?

sentences:
Clamp joystick rotation in Unity I'm trying to create a mobile joystick using this free package from Unity. Here is the code for rotation which seems to be working fine. I just want to clamp the rotation to +90 or -90 degress. I have tried using the mathf.clamp function but the plane(player) completes a full rotation.

public Joystick joystick;
float rotateVertical;
float rotateHorizontal;

float minClamp = -90.0f;
float maxClamp = 90f;

void Update()
{
    rotateVertical = Mathf.Clamp(joystick.Vertical * 1f, minClamp, maxClamp);

    rotateHorizontal = Mathf.Clamp(joystick.Horizontal * -1f, minClamp, maxClamp);

    transform.Rotate(rotateVertical, 0, rotateHorizontal);
}

If I change the value of minClamp to 0, then the plane doesn't rotate on the negative x axis but is still  able to complete a full rotation on the positive x axis. Can someone please help me?

sentences:
How can I handle invulnerability in an entity system? I currently have an entity component system with messaging. The messages are delivered to each subscriber, but each subscriber gets their own copy, basically meaning that altering a message doesn't affect any other subscriber. While this works fine for now, I was wondering how I would add an invulnerable state.

I have a combat system that solves combat. It takes a combat event (an intent to attack something) and emits a resolved combat event. This event contains information of who attacked whom and what kind of damage they took. It also has a bool which gives the status of whether or not the defending entity is alive after the attack. It also controls the the HP and deletes the entity if it was killed.

I do not have a problem breaking down this system. A system that calculates damage, a system that applies the damage, and a system that kills the entity. But where do I add my invulnerability? If I simply make it a component, then it has to be handled by the system that applies damage. What if I want to add something else later? I have to build up and up the damage system and it has to handle all the little edge cases and intricacies. What if I want to add an attack that goes through invulnerability?

Clearly this is an exponential nightmare, which is exactly what I hoped to avoid with an ECS. How should I handle invulnerability?

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:
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:
Monogame/Android: Using content from PCL I'm quite new to Monogame and PCL, but I hope someone can help me with my question.

I have a Monogame/Android project with references a PCL which targets .NET 4.5, iOS and Android.
The PCL has content files suchs as SpriteFont and Texture2D. They are set to "Content", "Always copy" and are .xnb files.
The problem is when I start my Android game I get a "asset not found" exception for the content in the PCL. When I launch my Windows game it works all fine.

To begin with, can I have content files in a PCL and is that good practice?

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:
Creating 3D water on Unity for iOS/Android I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling waves into breaking waves (see picture). For now, I am not going to show the shoreline onscreen so I don’t need to render breaking waves interacting with the shoreline; I only need breaking waves on the open ocean.

I’ve tried three different approaches so far and I’ve only had success with rolling waves using approach 1. Breaking waves have been impossible so far with all three approaches.

Approach 1: Mesh deformation

I can create smooth rolling waves using the Sine and Gerstner equations.
Since I can’t use these equations for breaking waves, I tried to implement them by using this free plugin whose output is similar to this paid mesh deformation plugin. But there are 2 problems with this plugin approach:

Problem 1: There is no smooth transition between rolling waves generated by approach 1a and the breaking waves generated by the Deform plugin

Problem 2: The output of the plugin does not look similar to real breaking ocean waves in three different ways:

i. No smooth blending with the ocean surface

ii. A large depression is created below the crest

iii. The entire wave is the same height (rather than with more realistic variations)

I considered using vertex shaders but this approach seems similar to mesh deformation.

Approach 2: Fluid dynamics + metaballs

To render an ocean I will need thousands of particles which will be too expensive in terms of performance (especially for mobile devices).

Approach 3: Using mesh files

I can create breaking waves using some 3D software like in this post but then I can’t modify the ocean in real-time. It will be more like a pre-rendered simulation.

To summarize, I am looking for an approach where I can vary ocean waves’ amplitude for a smooth transition between rolling waves and breaking waves.

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: Should input be per-frame or per-update? I'm implementing a GUI system to look around a 2D tile-based world. At the moment, I'm updating it every time the mouse moves (which happens to be per frame, since that's when it polls for events). However, I'm wondering if implementing it per-update (by taking all input events, averaging them out, then deferring them for processing until the next update) would be better. I figure it would make the GUI feel more consistent but at the cost that it may not be as responsive (since I can't interpolate the movement without the controls feeling "sticky"). In terms of creative a better interface, which should I go with? What do games normally go with?

sentences:
How does XNA/MonoGame project 3d to 2d? I am trying to figure out how XNA is actually projecting a 3d world space coordinate to screen space.

I decompiled the MonoGame framework and copied the CreateLookAt und CreatePerspectiveFieldOfView methods of Matrix and multiplied thereafter  3 vectors like XNA does:

First multiply each position with world, then multiply resultig new vector4 with view and then the new resulting vector4 finally by projection.

      public static Vector2<T> Project(Vector3<T> source, Matrix4x4<T> world, Matrix4x4<T> view, Matrix4x4<T> projection, int width, int height)
    {
        Vector4<T> worldPosition = world * new Vector4<T>(source.X.ParseToNumeric<T>(), source.Y.ParseToNumeric<T>(), source.Z.ParseToNumeric<T>(), 1);
        Vector4<T> viewPosition = view * worldPosition;
        Vector4<T> position = projection * viewPosition;

        var X = position.X.ParseToNumeric<T>();
        var Y = position.Y.ParseToNumeric<T>();
        var Z = position.Z.ParseToNumeric<T>();

        return new Vector2<T>((X / Z) + width / 2, (Y / Z) + height / 2);

    }

Because (0,0,0) would be the center of the screen I added to the corresponding X and Y coordinates width and height divided by 2. Just because it made sense I divided finally the xy components by z.

The result is sobering:

I used following matrices:

      basicEffect.World = Matrix.Identity;
        basicEffect.View = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000.0f);

And these points:

            vertices[0] = new VertexPositionColor(new Vector3(0, 0, 2), Color.Red);
        vertices[1] = new VertexPositionColor(new Vector3(1, 0, 2), Color.Red);
        vertices[2] = new VertexPositionColor(new Vector3(0, 1, 2), Color.Red);

Do you know why this happens?

sentences:
2D Game has very bad lag because of one script? I am making somewhat of a flappy bird clone (mostly for practice) and everything works fine, but it is just really slow with a low FPS of 13 and a max FPS of 28. Why would this be?

So I ran a check with the unity profiler and it turns out that my MoveLeft script which I am using to reuse my obstacles is taking up 73% of the CPU. I have it attached to each of my 6 prefabs, which include 2 long obstacles and a token (to collect) in middle each. The game works by moving the prefabs along the camera, then moving them back after they pass the camera.

Here is the script:

using UnityEngine;
using System.Collections;

public class MoveLeft : MonoBehaviour
{

    [SerializeField]
    private float _speed = 5f;
    // Update is called once per frame
    void Update()
    {
         transform.Translate(Vector3.left * Time.deltaTime * _speed);
         if (transform.position.x < -15)
         {
             float randomYPosition = UnityEngine.Random.Range(-3, 3);
             transform.position = new Vector3(15, randomYPosition, 0);
         }
     }
}

I really want to fix the lag. What can I do? I am sure this is the script causing it, but without this script my game does not work. Thank you! All help is appreciated!

Hierarchy (objects that I am moving with MoveLeft script. Script only attached to tree parents)

And a scene view that displays colliders found in prefabs

Profiler with information regarding my MoveLeft script

sentences:
XNA 2D: How to load/unload specific content by level I'm writing a 2D room-based* platformer using XNA, and I'm trying to figure out the best way to load resources based on what the current map requires. Basically, I need to (want to) dispose of the loaded tileset/textures and load just the ones the next map requests at every transition (ideally, I'll check if they're actually different first), without killing off the more universal textures (player sprites, etc.).

I've seen a few forum posts saying the best way to do this is to create a second instance of ContentManager, but they never go into detail on how to do this correctly.

Currently, my XML map files each contain strings with the filenames of all necessary assets. I was planning on having my XmlReader method load the textures as their names were read, but then I realized I knew neither how to instantiate the second ContentManager, nor where to instantiate it--i.e., should it be in the MapFactory class that's loading the map, or in the static LevelManager that's calling the MapFactory (passing the new ContentManager as a parameter to the MapFactory, along with the name of the desired map)?

Alternatively, is there a simpler/cleaner way to do this? I'm more concerned with the code being easily comprehensible than efficient right now, as this is my first attempt at this kind of game.

*Ex. Castlevania, Metroid, but simpler (for now). I'd like to implement constant streaming eventually (chunks loaded as they are approached), but I want to get this part down first.

UPDATE: Instantiated the second ContentManager using this.Services inside the Game class (it was the only way I could find to get access to Game.Services, which is what everywhere online says to use in the ContentManager constructor). Should have thought of that sooner. For anyone confused by this in the future, the full line of code is:

ContentManager myContent = new ContentManager(this.Services, "myContent")

sentences:
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 schedule 'events' inside a game? Within a game I want to schedule 'events', like a resource is running out, some storage is full, or a person is born. I see two ways of achieving this:

Check on all the parameters every fixed time interval. At that given time, the number of persons are adjusted, the resources are calculated...
Calculate the time at which something happens and use a database to store all these events. Create a 'scheduler' which sleeps until the first event happens, and do something. However, if one piece of data changes, all the other items also changes and need to be recalculated.

Is there a general approach how to solve this problem in game design? I hope my question is somewhat clear...

sentences:
XNA Game arhitecture, sharing vertices between objects I'm practicing primitives rendering in XNA and I want to create something like pipe or tunnel.
I have base class called PipeSegment from which I inherit classes like RotatingSegment and NormalSegment (and whatever I imagine).
To combine this segments I have created class called Pipe, which have List of PipeSegment objects.This is what I have so far :

It's ok, except the fact that I'm generating way more vertices than necessary.
For each segment I'm generating 36 vertices for 'front side', and 36 for 'back side'.

Illustration :

Now, my question.
How can I optimize this, how to generate less vertices ?
Is there any way to 'share' vertices between Segments to preserve my current code structure and is my code structure suitable for this ?

Thanks

sentences:
Color bands over tile when scaling texture in shader I want to have tiles with different sprites on the back.
Initally I thought I will mix two textures together and then apply mixed texture to game object. I thought that should be easy, but google returned discussion about shaders and their superiority.

After reading about shaders  I decided to use shaders instead.

Also I am using rather big sprites and I am scaling them down in shader.
Kind of want to be sure that tiles look good on big screens also.

Also to be sure that game works on smaller screens - I change camera distance when game does not fit in the screen.

Everything is working nice when tile is "near". But when tile is far away it starts to show artifacts over all surface of tile.
It appears that scaling is done not pixel by pixel but in some chunks.

Modified shader code (I commented out mainTex because it does not change anything from "bug" perspective):

Shader "Custom/TwoTextureShader3"

{

    Properties{
        _Color("Color", Color) = (1,1,1,1)
        _MainTex("Main Texture Color (RGB)", 2D) = "white" {}
        _MainTex2("Overlay Texture Color (RGB) Alpha (A)", 2D) = "white" {}
        _Glossiness("Smoothness", Range(0,1)) = 1
        _Metallic("Metallic", Range(0,1)) = 0.2
        _OffsX("Offset X", Range(-2, 2)) = 0
        _OffsY("Offset Y", Range(-2, 2)) = 0
        _Scale("Scale", Range(0, 10)) = 1
    }
        SubShader{
            Tags { "RenderType" = "Transparent"}

            LOD 200
            CGPROGRAM
            // Physically based Standard lighting model, and enable shadows on all light types

            #pragma surface surf Standard alpha fullforwardshadows

            // Use shader model 3.0 target, to get nicer looking lighting
            #pragma target 3.0

            sampler2D _MainTex;
            sampler2D _MainTex2;

            fixed _OffsX;
            fixed _OffsY;
            fixed _Scale;

            struct Input {
                float2 uv_MainTex;
                float2 _MainTex2;
            };

            half _Glossiness;
            half _Metallic;
            fixed4 _Color;

            void surf(Input IN, inout SurfaceOutputStandard o) {

                float4 mainTex = tex2D(_MainTex, IN.uv_MainTex);

                fixed2 offsetUV = fixed2(_OffsX, _OffsY);
                float4 overlayTex = tex2D(_MainTex2, IN.uv_MainTex * _Scale + offsetUV);

                half3 mainTexVisible = mainTex.rgb * (1 - overlayTex.a);
                half3 overlayTexVisible = overlayTex.rgb * (overlayTex.a);

                float3 finalColor = (mainTexVisible + overlayTexVisible) * _Color;

                //o.Albedo = finalColor.rgb;
                o.Albedo = overlayTex.rgb;

                o.Metallic = _Metallic;
                o.Smoothness = _Glossiness;
                o.Alpha = max(mainTex.a,overlayTex.a);
                //o.Alpha = 1;
            }
            ENDCG
        }
            FallBack "Diffuse"
}

Tiles looks good when they are near

Tiles looks awfull when they are far away

Currently I am thinking about using two Meshes for single tile, so that game never hints about what is on the back of the tile even when graphics hardware really want to.

sentences:
How can I communicate changes to a 2D tile-based world state in a P2P context? Suppose two players in a game want to build a city together on a blank tile-based game world simultaneously in a peer-to-peer connected context.

When a player clicks on a tile it changes the state (or tile ID) of that tile, which is saved into a text file for later reading by the renderer.

For example, in the image below a player has modified some tiles from "empty" (1) to "road" (2):

What method should I employ to transmit these changes to connected peer-to-peer clients?

sentences:
Java Game not rendering properly Hello I have a game that you can play(duh). When you start the game a loading screen pops up and on the loading screen I display an image of an eye I drew. In paint.net they eye looks perfect but in game it dose not.

Here is the image in paint.net:

Here is the image in game:

I don't understand why the image is all messed up as much. Please help me! Thx.

sentences:
boost/geometry replacement in Java/for the JVM (Destructable Box2D terrain) I'd like to reimplement https://github.com/seemk/DestructibleBox2D in Java. The main problem is finding an adequate replacement for the boost/geometry library.

Any ideas?

sentences:
Knowledge of a Language vs. Games in Portfolio How important is the knowledge of a language versus the games that you have developed in your portfolio?

To be more specific. Personally, I dislike C++ for several reason(mainly due to it's complexity, and pointers, and I prefer D as my language of choice thus far. Due to this, I've written two games in D instead of C++ that are my personal projects. Am I wasting my time with D? Should I start using C++ again?

For reference, I have 6 months of experience in C++. It's the first language I learned. I have messed around with SDL/SFML and a bit of Direct3D with C++ as well.

Even though I like D, i'd rather not waste my time learning it, if it in no way will help me get a job in the gaming industry.

sentences:
GameObject scope over RPC call Debugging my code I faced some unexpected behavior.

I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player.

Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player")

What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call.

I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform.

My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations.

Any clue about this?

sentences: What is "ROAM" related to terrain rendering? I saw it mentioned on this question, but no one explained what it is.

sentences:
Stronger Hack-proof MMO Game Comparison: Game Client Based Vs. Via Web Browser I was wondering. I observed most of any MMO that are hack-prone area. Hacks used one-hit kills, stealing accounts, instant level up, aimbots (mostly MMOFPS), and questionable wallers (also in MMOFPS). These hackers might affect the fairness and excitement of the gamers which lead to doubts, abuse kickers (mostly in MMOFPS*, and misunderstandings. Even in MMORPG referred to hacks for instant money for purchase items. I saw these examples via Wikipedia.

This leads me to my question:

Which kind of MMO game platform or model would be best for making MMO games whilst reducing the possibility of hacking?

For example I could make an MMO game for the web browser (by website or via Facebook) or making an MMO game using installers/clients that fetches for patches and graphics that could run only through program via computer. What will help with preventing hacking and how?

In the case of making an installer/client based MMO games, are there anti-hack programs or techniques you can recommend in MMO context?

sentences:
Can't call GameCenter in my Unity game for iOS I'm trying to integrate Game Center into my Unity 5 project and facings troubles. It seems that authentification is OK when the game starts on iOS device, a notification appears, but leaderboard button does not work, nothing happens when I tap GC button. I assigned the initiation of "ShowLeaderboard()" to GC button. Please, take a look at the script I use below. Hope to find a resolution for my issue. Thank you in advance.

using UnityEngine;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
using System.Collections;

public class GameCenter : MonoBehaviour {

    public string leaderboardID = "mygameleaderboard";

    void Start () {
        AuthenticateToGameCenter();
    }

    private bool isAuthenticatedToGameCenter;
    public static void  AuthenticateToGameCenter() {
        #if UNITY_IPHONE
        Social.localUser.Authenticate(success => {
        if (success) {
            Debug.Log("Authentication successful");
        } else {
            Debug.Log("Authentication failed");
            }
        });
        #endif
    }

    public static void ReportScore(long score, string leaderboardID) {
        #if UNITY_IPHONE
        Debug.Log("Reporting score " + score + " on leaderboard " + leaderboardID);
        Social.ReportScore(score, leaderboardID, success => {
            if (success) {
            Debug.Log("Reported score successfully");
            } else {
                Debug.Log("Failed to report score");
                }
            });
        #endif
    }

    //call to show leaderboard
    public static void ShowLeaderboard() {
        #if UNITY_IPHONE
        Social.ShowLeaderboardUI();
        #endif
    }
}

sentences: Load character animation on button press - Unity3D I am new to Unity3D and I am going to develop a  simple animation application. There is a human character and there are three button Eg:- "jump", "down" , "roll", I want to bind the animation files with the human character once the player presses the corresponding button. I need your help to know that what are the steps that I need to follow...let me know if anyone has good reference, thank you very much...

sentences:
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:
What is the workflow of modeling 3D rooms? I'm always struggling with creating flexible, reusable rooms for my underground-set games. When creating reusable rooms I have encountered the following problems:

Size - levels can have wildly different sizes and separate objects for all of the sizes seems repetitive and unnecessary
Holes in the room - i.e. windows, doors. There may be rooms with exactly the same size but different placement of doors, windows, etc... that only multiplies the amount of possible combinations

Possible solutions:

Not creating whole rooms but creating separate walls, floors, roofs so I can mix and match in the engine later?

Those parts would still require different sizes, unless I am to put 1 object per square meter or similar

Creating flexible Blender model so I can quickly change it export different variations of the room?

Thanks for any ideas, opinions, experiences

sentences:
How can I compute a "steepness" value for height map cells? Here's a question related to height map generation. From a 2D height map I want to produce a second map, I guess you can call it sort of a derivative map, which shows the "steepness" of all the discrete values of the map. I plan to use it to quickly determine what kinds of objects can be placed on different locations.

In practice you would have many areas where rise/run is a fractional value, since many places do not have 45 degree angle slopes. But running through the pixels of the height map in any direction, the value differences are all integer values.

So what I planned to do in order to represent smooth slopes of varying degrees is, iterate through the pixels row by row, and find the lengths of all the distances where height does not change, and for every change in height, divide that by the length of the distance. Do the same thing column by column and then average the two results for each pixel. I do have to wonder how accurate this is in situations where a lower elevation is surrounded by two walls/plateaus since the rise/run is technically infinity, as it represents a completely vertical climb.

Is this a reasonable way for calculating steepness? I haven't found any resources on how to produce a 2D array of steepness values from height maps, just things on topographic (real-life maps) with the basic rise/run formula.

sentences:
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:
How to change/modify or animate an existing OpenGL object on Android? I maybe know understand it all a little bit better so i thoug i make a new shorter question to eventually get an answer.

Get back or delete an existing OpenGL object, then change it and draw at new. How?

So if and Admin reads this post, he can feel free to delete it.

I'm working on OpenGL since a Week, so i'm new to the most stuff.
(also my englisch isn't the best. Hop you can understand the most anyway)

So i'm working on an Tamagotchi App for a school project and want to make it with OpenGL.
I allready came this far:

But now i want to animate things.
My mind told me that it shoud be possible to change or modify an existing OpenGL object.
In my situation there are 3 opjekts:

Body
Eyes
Mouth

For example her is my code from the mouth:

public class GLMouth {

private int points = 1000;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;
private FloatBuffer vertBuff2;

public GLMouth(){

    vertices = new float[points * 2];
    for(int i=0; i<= (points+3); i+=3)
    {
      double rad = (Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff=bBuff.asFloatBuffer();
    vertBuff.put(vertices);
    vertBuff.position(0);

    vertices = new float[points * 2];
    for(int i=0; i< (points+3); i+=3)
    {
      double rad = -(Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff2=bBuff.asFloatBuffer();
    vertBuff2.put(vertices);
    vertBuff2.position(0);

}

public void draw(GL10 gl){

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 0.15f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 1.0f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff2);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

}

}

In my renderer i just creat a mouth object and then draw it with mouth.draw.

So i thought i have allready drawn the mouth and now i can cange for example the gl.glScalef(1.8f, 0.15f, 1.0f); from that existing mouth to zero with some time in between to let it look like the mouth is closing.

But how can i do that?
I don't find anything with google, mostly because i don't know what i have to look up.
If i understand OpenGL right, than it will just draw new mouths over the original.

edit
Or it is a question about where is the opjekt? Can i save it an take it back (delete it etc) and draw it new with other properties.

sentences:
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:
Problems implementing a 3rd person static camera in Unity3d I am building a space game that I would like to be controlled in third person.

Basically I would like the camera and the ship to remain tied together and remain the same distance from each other but for the camera to remain in the same position relative to the ship from the world perspective. This position of the camera relative to the ship can only be altered by mouse movement and not by ship movements.

Example of the functionality required would be:

User can rotate the the ship on the x, y, z axis and the camera can observe these rotations
User can position the camera on the right side of the ship using mouse movements and activate thrusters to observe the ship in the center of the screen and the background objects passing
User can fly ship into an asteroid and observe rigidbody collider cause the ship to bounce back and start to rotate violently in a direction but the camera will remain stable and at a constant distance to the ship

Explanation from technical sense:

The camera must remain at (0,0,-100) from the ship in world coordinates and this position only changed using mouse movement using local position
Putting camera and ship in the same player object allows to control local coordinate to (0,0,-100) but from world perspective the positing of the camera to ship actually changes

Currently the main problem is that I can only either have the camera stuck in a constant position relative to the ship (cannot change perspective with mouse) OR I can change perspective with mouse but the rigitbody physics get applied to camera (if I hit an asteroid the camera rotates with the ship)

I also tried to use a dummy camera to track mouse movements and to just add it to the constant camera but when the ship rotated very quickly it wasn't very accurate.

Any suggestions for what I could use in order to get accurate response?

sentences:
What is the optimal way to store customisation options? I am trying to understand the most optimal way of storing customisation options within a game, or to be precise, to store all the possible customisation options for multiple different objects.

For example, assuming we are making a game about tanks and their customisation, there will be several available tanks that the player can choose from and each of the tanks will have multiple different parts available; some parts will be shared across a few tanks, while some will be specific to a tank.

I was thinking about a relational database, but I do not know web development, so I was initially thinking to have a table with all the tanks and a table with all the parts, then create a linking table between the two and load the available parts based on the chosen tank; but I'm not sure if that would work, or if it would be the most optimal way of doing this.

I tried looking for an answer, but I'm not getting any good results. People mention using files, and then parsing the data, but I'm not sure how that will work on a large scale; multiple tanks with hundreds of customisation options.

What is the most optimal way to to do this? If at all relevant, I am using Unity 5.

sentences:
Separate game clocks/intervals in XNA I am making a real time strategy game in XNA. I have separated the Client (rendering, input, sound) code from the Sim (game logic).

I want to have features like replaying and fast forwarding. Also, I would like to give the Sim longer time intervals in its Update to finish its work without having to always implement time slicing to prevent frame rate stuttering.
I imagine I can do this when the two systems become decoupled and have their own update frequency.

So, how can I run the Client and Sim at two different update intervals? How should I code it?

Currently I am running with FixedTimeStep = false and using ElapsedGameTime in Update() computations. Can I create new GameTime instances to leverage this existing code..?

sentences:
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:
GLSL - Rewriting shaders from #330 to #130 I recently created a game (LD21) that uses a geometry shader to convert points into textured triangles/culling. Since I was under the impression that the support for #330 was widespread I only wrote #330 shaders, but it seems that a lot of not so old hardware only support #130 (according to GLView)
Now, since I'm only familiar with the #330 core functionality I am having trouble rewriting my shaders to #130. The fragment shader was quite trivial to rewrite, but I've only managed to get my vertex and geometry shader down to #150.
So, is it possible to rewrite the shaders, or would it require a lot of changes in my rendering engine?
Geometry shader
#version 150
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
uniform mat4 oMatrix;
in VertexData
{
    vec4 position;
    vec4 texcoord;
    vec4 size;
} vert;

out vec2 gTexCoord;

void main()
{
    if(vert.position.x>-4f && vert.position.x<4f && vert.position.y>-2f && vert.position.y<2f)
    {
        gTexCoord=vec2(vert.texcoord.z,vert.texcoord.y);
        gl_Position = vert.position + vec4(vert.size.x,vert.size.y,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.x,vert.texcoord.y);
        gl_Position = vert.position + vec4(0.0,vert.size.y,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.z,vert.texcoord.w);
        gl_Position = vert.position + vec4(vert.size.x,0.0,0,0);
        EmitVertex();

        gTexCoord=vec2(vert.texcoord.x,vert.texcoord.w);
        gl_Position = vert.position;
        EmitVertex();

        EndPrimitive();
    }
}

Vertex shader
#version 150
#extension GL_ARB_explicit_attrib_location : enable

layout (location = 0) in vec2 position;
layout (location = 1) in vec4 textureCoord;
layout (location = 2) in vec2 size;
uniform mat4 oMatrix;
uniform vec2 offset;
out VertexData
{
    vec4 position;
    vec4 texcoord;
    vec4 size;
} outData;

void main()
{
    outData.position = oMatrix * vec4(position.x+offset.x,position.y+offset.y,0,1);
    outData.texcoord = textureCoord;
    outData.size = oMatrix * vec4(size.x,size.y,0,0);
}

sentences: Do I need to learn C++ to use Open GL? Do I need to learn C++ to use Open GL?

sentences: How can I spawn and drag 2d object from a Canvas button? I want to create and drag an object from canvas button to scene. How can I do this?

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:
Where to put Entity Death Events in a Component/System Design Entities in my game are nothing more than a collection of components, tied together with an entityID. I have (near) data-only components, and systems that work on the data.

One of these components is HitPoints. It is one of the few components that has a little bit more than just data: it houses a Dying event that triggers from the HitPointsSystem when the hitpoints go below 0. One of the event listeners is my user interface, while an entity is selected, it listens to the current selection's Dying event. On-death, the entity is dis-selected. Having entities selected draws little circles around the selection. It works great... Right up until I have an entity without HitPoints that can still die.

I have a Missile in my game which does not have HitPoints, but it can be selected, and it can die. When a Missile is selected, my user interface recognizes that it does not have HitPoints, and therefore also does not have a Dying event, which later causes the draw loop to attempt to draw a "selected" and dead Missile, causing a crash.

You might guess that you could just add HitPoints to the Missile and everything would be fine, but my AI targeting system looks for enemy HitPoints because those are the only things it can damage. I don't want missiles to be targeted, and I don't want to add a special rule either.

So... if all entities can die (or be deleted), where do I place the Dying event? Should I be making a new component? Either a component for all things that can die (almost everything), or a component for AI targets? Or is there a better place to put an event like this?

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:
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:
Cube Translation Looks All Wrong I'm making a very simple cube in OpenTK and it seemed to be going fine until I tried to move it around. Moving it along the X Axis seems to elongate the cube, not the result I hoped for.

My Vertex Shader

#version 330

in vec3 vPosition;
in  vec3 vColor;
out vec4 color;
uniform mat4 modelview;
void
main()
{
    gl_Position = modelview * vec4(vPosition, 1.0);
    color = vec4( vColor, 1.0);
}

My Fragment Shader

#version 330

in vec4 color;
out vec4 outputColor;

void
main()
{
    outputColor = color;
}

How I make modelview

    Matrix4 c = Matrix4.LookAt(Game.camera.Position, new Vector3(Game.camera.X + 1f, 0, Game.camera.Z + 0f), new Vector3(0, 1, 0)) * Matrix4.CreatePerspectiveFieldOfView(
    (float)(0.5 * Math.PI),
    (float)1366 / 768,
    0.1f,
    1000.0f); * Matrix4.CreateTranslation(Origin);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);

What I'm doing here is adding 0.01 to Origin.X while moving the camera the opposite direction.

Does anyone know why it produces this result? Thanks in advance for your help.

EDIT: Multiplied matrices by perspective * view * model

This weird line seems to blink in and out as I move the camera around.

EDIT 2: Matrix Printout

(0, 0.9999995, 0.001019571, 0.001019367)
(0, 0.001019367, -1.0002, -0.9999995)
(0.5622255, 0, 0, 0)
(1207.66, -0.9999995, 980.9957, 980.9995)

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 to use caching to increase render performance? First of all I am going to cover the basic design of my 2d tile-based engine written with SDL in C++, then I will point out what I am up to and where I need some hints.

Concept of my engine
My engine uses the concept of GameScreens which are stored on a stack in the main game class. The main methods of a screen are usually LoadContent, Render, Update and InitMultithreading. (I use the last one because I am using v8 as a JavaScript bridge to the engine.
The main game loop then renders the top screen on the stack (if there is one; otherwise, it exits the game) - actually it calls the render methods, but stores all items to be rendered in a list. After gathering all this information the methods like SDL_BlitSurface are called by my GameUIRenderer which draws the enqueued content and then draws some overlay. The code looks like this:
while(Game is running) {
    Handle input
    if(Screens on stack == 0) exit

    Update timer etc.
    Clear the screen

    Peek the screen on the stack and collect information on what to render

    Actually render the enqueue screen stuff and some overlay etc.

    Flip the screen
}

The GameUIRenderer uses as hinted a std::vector<std::shared_ptr<ImageToRender>> to hold all necessary information described by this class:
class ImageToRender {
private:
    SDL_Surface* image;
    int x, y, w, h, xOffset, yOffset;
};

This bunch of attributes is usually needed if I have a texture atlas with all tiles in one SDL_Surface and then the engine should crop one specific area and draw this to the screen.
The GameUIRenderer::Render() method then just iterates over all elements and renders them something like this:
std::for_each(
    this->m_vImageVector.begin(),
    this->m_vImageVector.end(),
    [this](std::shared_ptr<ImageToRender> pCurrentImage) {
        SDL_Rect rc = { pCurrentImage->x, pCurrentImage->y, 0, 0 };
        // For the sake of simplicity ignore offsets...
        SDL_Rect srcRect = { 0, 0, pCurrentImage->w, pCurrentImage->h };
        SDL_BlitSurface(pCurrentImage->pImage, &srcRect, g_pFramework->GetScreen(), &rc);
    }
);
this->m_vImageVector.clear();

Current ideas which need to be reviewed
The specified approach works really good and IMHO it is really has a good structure, however the performance could be definitely increased. I would like to know what do you suggest, how to implement efficient caching of surfaces etc so that there is no need to redraw the same scene over and over again?
The map itself would be almost static, only when the player moves, we would need to move the map. Furthermore animated entities would either require updates of the whole map or updates of only the specific areas the entities are currently moving in. My first approaches were to include a flag IsTainted which should be used by the GameUIRenderer to decide whether to redraw everything or use cached version (or to not render anything so that we do not have to Clear the screen and let the last frame persist). However this seems to be quite messy if I have to manually handle in my Render method of the screen class if something has changed or not.

Edit: Possible optimizations I was reminded of
I have been rendering every frame all tiles of the map one by one which became... yeah quite some heavy work to do for both CPU and GPU. Currently I am working on drawing all layers into one surface for each layer which holds all static tiles. In my current test it is much easier to draw n surfaces (where n is the number of layers) rather than about n*3600 small 16x16 tiles.
Though I am not thinking right now of culling this could be worth some thoughts. However I have to find out how to efficiently render entities, like items to interact with (signs, doors, ...) and NPCs which actually can walk on their own - but that is another problem and not really linked to this one.

sentences:
Asset Library Class or passing Asset's through constructors I am at the point of designing UI-Logic and I was wondering what a good way to pass asset information to these objects would be.

What I was trying as of yet was passing assets to the objects representing UI-elements through their constructors, leading to code where I pass between 1 to 10 assets (like "button idle" "button being hovered" and "button active" etc.) to the objects or having to create "metaclasses" that define the "look and feel" of these objects that need to be passed to the ui-elements to handle the rendering.

A way I thought of handling this in a "dirty" way was to create a singleton "asset database" that is globally accessible. As every button need's it's own callback function on click it can also get it's own rendering function from where the button can pick it's assets from the accessible assets.

What is a common way to handle this?

sentences:
How can multiple clients be out of sync if they use the same RNG seed? I have been working on a client-server architecture to enable LAN play for my open source game, Aigilas. In its current state, players stay synced in all running instances of the game but enemies and particle animations are out of sync.

What I cannot understand is how players are the only entities staying synced. I run the clients in lockstep, requiring the latest input states from each client to be announced before taking a turn in the game world. When the game world is built, I seed the random number generator (RNG) with a seed determined by the server. This seed appears to affect the RNG as expected; each client has the same procedurally generated game world and players start in all clients at the appropriate locations.

Particle animations and AI are chosen based on player positions and the RNG. How is it possible for them to become out of sync when the players are always in sync?  To the best of my observations of both the game screen and the logs, players never go out of sync with respect to their positions. That leads me to believe that the RNG in C# is not acting deterministically across all clients.

The basic workflow for the game's client<->server communications are as follows:

Server starts
Client starts and gets RNG seed from server
Client tells server when keys are pressed/depressed by a user
Once a game has started, server tells all clients the current state of each player's keyboards
Once an update has been received from the server, one turn of the game is simulated
Repeat step 4

If there are any specific questions targeting a specific portion of the code, then I am happy link to the appropriate page on GitHub.

sentences:
How can I add a sprite to gameobject to make the gameobject highlight? When I'm running the game and then moving the mouse cursor over the menu it's highlighting it with some blue color: In the screenshot the OPTIONS is highlight.

Now I want to use the same highlight sprite to highlight the word THE in white at the top in the screenshot but to make it highlight all the time without the mouse cursor.

I have New Text in the Hierarchy and in the Assets I have Select and Select is the sprite I want to highlight with the word THE:

I tried to add a Sprite Renderer component to the New Text but the New Text have already a Mesh Renderer so I can't add the Sprite Renderer.

sentences:
How can I make all the objects to move between the waypoints? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MovementSpeedController : MonoBehaviour
{
    public List<Transform> objectsToMove = new List<Transform>();
    public List<Vector3> positions = new List<Vector3>();
    public int amountOfPositions = 30;
    public int minRandRange, maxRandRange;
    public bool randomPositions = false;
    public bool generateNewPositions = false;
    public float duration = 5f;
    public bool pingPong = false;

    private void Start()
    {
        if (generateNewPositions || (positions.Count == 0 && amountOfPositions > 0))
            GeneratePositions();

        StartCoroutine(MoveBetweenPositions(duration));
    }

    private void GeneratePositions()
    {
        for (int i = 0; i < amountOfPositions; i++)
        {
            if (randomPositions)
            {
                var randPosX = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosY = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosZ = UnityEngine.Random.Range(minRandRange, maxRandRange);
                positions.Add(new Vector3(randPosX, randPosY, randPosZ));
            }
            else
            {
                positions.Add(new Vector3(i, i, i));
            }
        }
    }

    IEnumerator MoveBetweenPositions(float duration)
    {
        for (int i = 0; i < positions.Count; i++)
        {
            float time = 0;
            Vector3 startPosition = objectsToMove[0].position;

            while (time < duration)
            {
                objectsToMove[0].position = Vector3.Lerp(startPosition, positions[i], time / duration);
                time += Time.deltaTime;
                yield return null;
            }

            objectsToMove[0].position = positions[i];
        }
    }
}

Now only the first object in objectsToMove is moving between the waypoints but I need all of the elements of objectsToMove to move between the waypoints. If I try this:
objectsToMove[i].position = Vector3.Lerp(startPosition, positions[i], time / duration);

I will let out of bound index exception because the size of objectsToMove is not the same the size of positions[i]

sentences:
Does AddForce continue to add force indefinitely? Does the AddForce method continue add velocity to an object forever? Does it need to be limited by another line of code?

Sorry if it is too broad or too simple; I am completely new to programming and Unity, as well as 3D development.

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:
How do I draw a name above monsters head? My player HUD works perfect, but when I move, the monster name moves with me instead of getting attached to the monster.
Player has a HUD and I'm using Scene2D.ui to pull it off and works great.
I use unit scale, that's why I got 2 camera. One for UI stuff and other for game.
 public void update(float deltaTime) {
    // update creatures
    world.getPlayer().onThink(deltaTime);
    for (Monster monster : world.getMonsters()) {
        monster.onThink(deltaTime);
    }

    // update camera to the player
    camera.position.set(world.getPlayer().getPosition(), 0);
    camera.update();
}

@Override
public void render(float deltaTime) {
    // clear screen
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // seprate update logic
    update(deltaTime);

    // set camera to what we see
    worldRenderer.renderer.setView(camera);
    worldRenderer.renderer.render();

    // draw world
    game.spriteBatch.setProjectionMatrix(camera.combined);
    worldRenderer.render();

    // monster UI
    game.spriteBatch.setProjectionMatrix(uiCam.combined);
    for (Monster monster : world.getMonsters()) {
        uiCam.project(uiPosition.set(monster.getPosition().x, monster.getPosition().y, 0));
    }

    game.spriteBatch.begin();
    Assets.font.draw(game.spriteBatch, "Firefox", uiPosition.x / 2, uiPosition.y / 2);
    game.spriteBatch.end();

    // Player Hud
    game.spriteBatch.setProjectionMatrix(hud.stage.getCamera().combined);
    hud.stage.draw();
}

I'll appricate all kind of suggestions! If i could use Scene2D.ui for monsters aswell, would be great.
Cheers.

sentences:
When to use Euler vs Axis angles vs Quaternions? I understand the theory behind each but I was wondering if people could share their experiences in when one would use one over the other

For instance, if you were implementing a chase camera, a FPS-style mouse look or writing some kinematic routine, what would be the factors you consider to go with one type over the other and when might you need to convert from one form of representation to the other?

Are there certain things that only one system can do that the others can't? (eg smooth interpolation with quaternions)

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:
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 do I implement a programming system in my game that is both accessible, powerful, and fast to code in? I'm currently working on a space-based sandbox game which will heavily feature the ability to custom program your systems. I want to implement this in a way that is both

accessible,
powerful (bare minimum would be turing-completeness)
fast to code in.

Text-based languages generally only satisfy the latter two requirements, and while it's not to difficult to design a visual language which satisfies the first two, visual languages are a pain to program in due to requiring extensive mouse use. While there are some very accessible text-based languages, I want complete non-programmers to be able to ease themselves into programming.

sentences:
Most efficient implementation for a Sokoban board? I am making a Sokoban solver in C++ and I was wondering what would be the most efficient implementation for the board, as to say the least memory consuming possible and the quickest operations possible.

I have heard about bit boards but I'm not sure it would be better than a classic 2D array. This is what a Sokoban grid look like :

The player is the greend sqaure, walls are red and static, boxes are blue and goals are the empty blue squares.

EDIT : The purpose is too be as efficient as possible when creating/storing the tree of possibilites for a sokoban level.

EDIT 2 : What I am looking to store is sokoban boards, as to say a grid that has multiple elements : one player, multiple static walls, moveable boxes, static goals (cell to put the box in). I run out of RAM - I have 8Go - on reasonable size levels (+50 moves). The sequence of moves the player has made is also stored with basic integers, like 1 for up, 2 for right etc.

sentences:
Random, Infinite Terrain Generation I'm trying to generate random terrain for my game (In Unity3D, C#). All I need is water and grass. No height to it (no mountains or hills.) I'd preferably like to do it by placing individual cubes. On top of that the terrain needs to be infinite.

I've searched every where for even a hint on how to do it, but everything I found had either height to it, didn't use individual cubes (edited the terrain as a whole), or wasn't infinite.

Any help would be much appreciated! :)

EDIT: I'm looking for something somewhat similar to a game called Factorio. Here's a screenshot: http://i.ytimg.com/vi/Uns15OfPWbo/maxresdefault.jpg As you can see there is a big body of water, and a ton of land. I want to create something that randomly does that every time (random bodies of water and random land shapes). Something like Minecraft without all the height.

I've heard about something called Perlin noise, but because of a lack of tutorials and documentation, I can't figure out for the life of me on how to use it to generate random terrain.

sentences:
Using Box2D for range detection? I have two entities. One has a sword, one has a bow and arrow. When the bow entity is 100 units away, he needs to begin attacking. Likewise, when the sword entity is 10 units away, he needs to begin attacking.

My idea is to create an actual physical body for collision detection and a range body (or fixture?) for range detection. However, I don't want the range body to start pushing and affecting other entities. I simply want to detect when one entity's range body collides with another entity's physical body.

Is this the right thing to do and how can I do this with Box2D?

sentences:
smooth shading vs flat shading, what's the difference in the models? I'm loading the exact same model with Assimp, except one is exported from Blender, shaded smoothly, and the other was exported from Blender, shaded flatly. Here is my results from loading both into my game:

The Flat drawn model has 1968 vertices and the Smooth drawn model only has 671, why is this happening, I don't understand why there would be less vertices when it's shaded smoothly...?

sentences:
Generating multiple instances of one opengl object with random coordinates Sorry if the question is dumb but my brain just cannot solve it for some reason..

So I've made one opengl object public static Square ball = new Square(75,75);

And I am trying to make it so that every so often a new ball appears on the screen

public void Loop(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
    long timeSinceStart = SystemClock.uptimeMillis();
    long deltaTime = timeSinceStart - oldTimeSinceStart;
    oldTimeSinceStart = timeSinceStart;
    if(deltaTime >= 15) {
        RandBall(gl);
    }}

code for RandBall()

   `public void RandBall(GL10 gl) {
     gl.glPushMatrix();
         gl.glTranslatef(rand.nextInt((1280 - 0) + 1) + 0,
                         rand.nextInt((720 - 0) + 1) + 0, 0);
         getBall().draw(gl);
     gl.glPopMatrix();
}`

but when I run the code it draws only one object and constantly changes its coordinates. How do I make it so that it draws multiple objects with different random coordinates? The solution is probably going to be an easy one but I just can't see it :/

sentences:
How does the stateTimer parameter is initialized in this method getKeyFrame(stateTimer)? I have been following the tutorial https://www.youtube.com/watch?v=1fJrhgc0RRw&list=PLZm85UZQLd2SXQzsF-a0-pPF6IWDDdrXt&index=11

I an not able to understand what is stateTimer in getframe method and how is that initialized?

sentences:
Loading non-skeletal animation to opengl via assimp I'm a newbie in assimp and openGL. I'm trying to import .fbx or .dae formatted file to openGL via assimp.
Importing skeletal animation was kind of easy. Lots of introductions and sample projects helped me to run several files properly.
But, in case of none skeletal animation(does it named 'vertex animation'?), which has no bone, I can't find any of source, instructions, including assimp tutorials.
Or, I'm not sure it is even possible, maybe assimp doesn't support this kind of animation.
Is there any recommendable project for non skeletal animation? Any single comment, will be helpful.
Thanks.

sentences:
How to detect a touch on transparent area of an image in a (libgdx) stage? Can some one please help to detect a touch on an image which I am using as an actor in a stage. The image is actually a long diagnol brush which has plenty of transparent area. The problem is when I touche the transparent area of the brush image it is also triggering the clicklistener of the image. I need the click listener should only be called when the finger actually touched the visible image not the area which is empty.

I am using libgdx-0.9.4 libraries. Here is my simple piece of code.

import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ClickListener;

Image brushImg = new Image(ImageCache.getTexture("brush"));
brushImg.width = mStage.width()*0.75f;
brushImg.height = mStage.height()*0.75f;

brushImg.setClickListener(new ClickListener() {

@Override
public void click(Actor actor, float x, float y) {
    SoundFactory.play("brush");
}

sentences:
Trying to run sample AndEngine gles2 code in the simulator throws "java.lang.IllegalArgumentException: No EGLConfig found!", how can I fix this? I tried to run a small sample game code in the emulator but it crashed. My LogCat is given here. Can you help me resolve the issue.

02-23 15:18:50.543: D/AndEngine(636): MainActivity.onCreate @(Thread: 'main')
02-23 15:18:50.633: D/dalvikvm(636): Trying to load lib /data/data/com.example.gamegles2demo/lib/libandengine.so 0x40513d70
02-23 15:18:50.633: D/dalvikvm(636): Added shared lib /data/data/com.example.gamegles2demo/lib/libandengine.so 0x40513d70
02-23 15:18:50.633: D/dalvikvm(636): No JNI_OnLoad found in /data/data/com.example.gamegles2demo/lib/libandengine.so 0x40513d70, skipping init
02-23 15:18:50.903: D/AndEngine(636): MainActivity.onResume @(Thread: 'main')
02-23 15:18:50.953: D/AndEngine(636): MainActivity.onPause @(Thread: 'main')
02-23 15:18:50.953: D/AndEngine(636): MainActivity.onDestroy @(Thread: 'main')
02-23 15:18:50.983: D/AndEngine(636): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
02-23 15:18:50.983: D/AndEngine(636): org.andengine.engine.Engine$EngineDestroyedException
02-23 15:18:50.983: D/AndEngine(636):   at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:574)
02-23 15:18:50.983: D/AndEngine(636):   at org.andengine.engine.Engine.onTickUpdate(Engine.java:560)
02-23 15:18:50.983: D/AndEngine(636):   at org.andengine.engine.Engine$UpdateThread.run(Engine.java:820)
02-23 15:18:50.983: D/AndEngine(636): MainActivity.onDestroyResources @(Thread: 'main')
02-23 15:18:50.994: D/AndEngine(636): MainActivity.onGameDestroyed @(Thread: 'main')
02-23 15:18:51.073: D/AndEngine(636): MainActivity.onCreate @(Thread: 'main')
02-23 15:18:51.093: D/AndEngine(636): MainActivity.onResume @(Thread: 'main')
02-23 15:18:51.643: D/libEGL(636): egl.cfg not found, using default config
02-23 15:18:51.653: D/libEGL(636): loaded /system/lib/egl/libGLES_android.so
02-23 15:18:51.803: W/dalvikvm(636): threadid=10: thread exiting with uncaught
exception (group=0x40015560)
02-23 15:18:51.803: E/AndroidRuntime(636): FATAL EXCEPTION: GLThread 13
02-23 15:18:51.803: E/AndroidRuntime(636): java.lang.IllegalArgumentException: No EGLConfig found!
02-23 15:18:51.803: E/AndroidRuntime(636):  at org.andengine.opengl.view.ConfigChooser.chooseConfig(ConfigChooser.java:183)
02-23 15:18:51.803: E/AndroidRuntime(636):  at org.andengine.opengl.view.ConfigChooser.chooseConfig(ConfigChooser.java:157)
02-23 15:18:51.803: E/AndroidRuntime(636):  at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:919)
02-23 15:18:51.803: E/AndroidRuntime(636):  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1264)
02-23 15:18:51.803: E/AndroidRuntime(636):  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
02-23 15:18:52.294: D/AndEngine(636): MainActivity.onPause @(Thread: 'main')
02-23 15:18:54.404: D/AndEngine(636): MainActivity.onDestroy @(Thread: 'main')
02-23 15:18:54.464: D/AndEngine(636): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
02-23 15:18:54.464: D/AndEngine(636): org.andengine.engine.Engine$EngineDestroyedException
02-23 15:18:54.464: D/AndEngine(636):   at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:574)
02-23 15:18:54.464: D/AndEngine(636):   at org.andengine.engine.Engine.onTickUpdate(Engine.java:560)
02-23 15:18:54.464: D/AndEngine(636):   at org.andengine.engine.Engine$UpdateThread.run(Engine.java:820)
02-23 15:18:54.494: D/AndEngine(636): MainActivity.onDestroyResources @(Thread: 'main')
02-23 15:18:54.494: D/AndEngine(636): MainActivity.onGameDestroyed @(Thread: 'main')

sentences:
Repeating a mesh instead of stretching it I would like to put acoustic foam into a case object:

To do that, I have created a foam object:

Now I'm having a really hard time to cover the case in Unity with this object:

I have to adjust multiple foam objects absolutely exactely besides each other. This is really time taking.

I was thinking that it would be great that if I could use scaling, and instead of scretching, Unity would repeat the object.

Is that perhaps somehow possible?

Thank you very much!

sentences:
Tweaking Heightmap Generation For Hexagon Grids Currently I'm working on a little project just for a bit of fun.  It is a C++, WinAPI application using OpenGL.

I hope it will turn into a RTS Game played on a hexagon grid and when I get the basic game engine done, I have plans to expand it further.

At the moment my application consists of a VBO that holds vertex and heightmap information.  The heightmap is generated using a midpoint displacement algorithm (diamond-square).

In order to implement a hexagon grid I went with the idea explained here.  It shifts down odd rows of a normal grid to allow relatively easy rendering of hexagons without too many further complications (I hope).

After a few days it is beginning to come together and I've added mouse picking, which is implemented by rendering each hex in the grid in a unique colour, and then sampling a given mouse position within this FBO to identify the ID of the selected cell (visible in the top right of the screenshot below).

In the next stage of my project I would like to look at generating more 'playable' terrains.  To me this means that the shape of each hexagon should be more regular than those seen in the image above.

So finally coming to my point, is there:

A way of smoothing or adjusting the vertices in my current method that would bring all point of a hexagon onto one plane (coplanar).
A better approach to procedural terrain generation that would allow for better control of this sort of thing.
A way to represent my vertex information in a different way that allows for this.

To be clear, I am not trying to achieve a flat hex grid with raised edges or platforms (as seen below).

I would like all the geometry to join and lead into the next bit.

I'm hope to achieve something similar to what I have now (relatively nice undulating hills & terrain) but with more controllable plateaus.  This gives me the flexibility of cording off areas (unplayable tiles) later on, where I can add higher detail meshes if needed.

Any feedback is welcome, I'm using this as a learning exercise so please - all comments welcome!

sentences:
What's the best type of Movement/collision detection for high-Speed games? Before I begin I'd just like to make it clear that I am not familiar with many programming/development terms, so if anyone can link articles to any terms used it would greatly help things move along:

I'm currently working on a game that plays similar to Sonic Mania. Obviously, when the player is moving they can reach really high speeds, but this brings up a problem with my collision detection.

What's essentially happening on the backend is that the player is moving too fast to collide with the enemy; With the way I have my movement set up, (Essentially Player.xposition += Player.xvelocity) the player "Teleports" Through the enemy instead of hitting it. I tried the workaround shown below to get this working, but so far it only works if I'm willing to mele enemies from 50ft away:

    public boolean touches(Entity e) {
        float ex = e.pos.x;
        float ey = e.pos.y;
        float ewidth = e.getWidth();
        float eheight = e.getHeight();
        float tx = this.pos.x;
        float ty = this.pos.y;
        Boolean xtouches= false, ytouches = false;

        for(int i = 0; i<= this.getXvel(); i++) {
//runs through all numbers up to the velocity of the player to see if they will collide in this frame
        if(ex > tx) {
            if (ex+ewidth <= (tx+i) -this.getWidth()) {
                xtouches = true;
                break;
            }else xtouches = false;
        }else if (ex < tx) {
            if (ex-ewidth >= (tx+i) +this.getWidth()){
                xtouches = true;
                break;
            }else xtouches = false;
        }else xtouches = true;
    }
        for(int i = 0; i<= this.getYvel(); i++) {
        if(ey > ty) {
            if (ey+eheight <= (ty+i) -this.getHeight()) {
                ytouches = true;
                break;
            }
            else ytouches = false;
        }else if (ey < ty) {
            if (ey-eheight >= (ty+i) +this.getHeight()){
                ytouches = true;
                break;
            }
            else ytouches = false;
        }else ytouches = true;
        }
        return (xtouches && ytouches);
    }

I've tried looking up different algorithms for hit detection online, but what I found is the same as what I have (without the for loops), and I don't know how else to change my movement methods without changing core mechanics in ways I don't want.
Is there a way to change either my hit registration or style of movement to prevent this problem?

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: Mathematics should I learn for 2D and 3D game programming/development What mathematics should I learn to become game programer 2D and 3D. From the very basic for beginner until advance

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:
Where should I put my mob rendering code? I'm making a simple LWJGL game. However, I'm a bit confused about rendering. So I have a Mob class and a TriangleMob is a basic enemy.

package daniel.entity.Mob;

public class TriangleMob {
        public void render(){
        }
        public void move(){
        }
}

Now I'm wondering do I put a render method in the TriangleMob or do I put some render method in graphics bit.

I'm really confused as I thought you needed to put all rendering in it's own bit. Then, all game logic like movement in another bit. Essentially, I want to spawn a TriangleMob in the SpawnMob class and then render it. I could put the render method in the TriangleMob class, however I want logic and rendering to be in different parts.

sentences:
How to apply forces to character with gamepad in Unity? I've been following Brackey's tutorial on this, see the excerpt from my code below. In his tutorial it only teaches "transform.Translate", how do I use this gamepad input system tool to add forces to the character to make them move instead? So I can have jump physics, and when they're in space they'll keep the momentum.
{
    NewControls controls;

    Vector2 move;
    Vector2 rotate;
    private void Awake()
    {
        controls = new NewControls();

        controls.Gameplay.Jump.performed += ctx => Jump();

        controls.Gameplay.Walk.performed += ctx => move = ctx.ReadValue<Vector2>();
        controls.Gameplay.Walk.canceled += ctx => move = Vector2.zero;

        controls.Gameplay.Rotate.performed += ctx => rotate = ctx.ReadValue<Vector2>();
        controls.Gameplay.Rotate.canceled += ctx => rotate = Vector2.zero;
    }

    private void Update()
    {
        Vector2 m = new Vector2(move.y, move.x) * Time.deltaTime;
        transform.Translate(m, Space.Self);**

        Vector2 r = new Vector2(rotate.y, rotate.x) * 100f * Time.deltaTime;
        transform.Rotate(r, Space.Self);
    }
}

To move with rigidbody controls, you have to use things like “forward” or “left” but I want one joystick to control the forward, backwards, and side to side movements. I don’t know how to use the joystick input for moving in all those directions. The tutorials have them as separate arrow keys
does anyone have some sample code, or a tutorial to point me to, or just some explanation?  it would be much appreciated.

sentences:
Attaching two objects and changing their world matrices accordingly I'm having a hard time wrapping my head around the transformations required to bind two objects together in either a two-way or one-way relationship. I will need to implement both types.

For the first case, I want to be able to 'couple' two ships together in space. The ships have different mass, of course. Forces applied to either ship will use combined mass and moment of inertia to calculate and move both ships. The trick is, being sure that the point at which they are coupled remains the same, and they don't move at all relative to each other.

The second case is similar: I want a ship to be able to enter the atmosphere of a planet and move relative to the planet. The planet will be orbiting the sun, which is fixed at 0,0,0. Essentially, when the ship is sitting still outside of the atmosphere, the planet will move past it on its course-- but when the ship is sitting still inside the atmosphere, it moves and rotates with the planet, so that it is always relative to the horizon. Essentially, the vertices which make up the ship are now transformed just like the ones that make up the planet, except that the ship can move itself around relative to the planet.

I get the feeling I can implement both of these with the same code. Essentially, I am thinking of giving each object (which I call Fixtures) a list of "slave" Fixtures onto which that Fixture's world matrix is imposed. So, this would be the planet imposing its world on any contained ships. In the case of coupling, I would simply make each ship a slave of the other, somehow.

Obviously I can't just multiply the ship's world matrix by the planet's, or each ship by the others. What I'd like some help with is what calculations to make in order to get a nice, seamless relative world to the other object. I was thinking maybe I could just multiply the world of the slave by the inverse of the master, but then when you couple two ships you would lose all that world data. So, perhaps I need an intermediate "world" which is the absolute world, but use a secondary "final world" to actually transform the objects?

sentences:
Multimonitor Support in MonoGame How can I support multiple monitors in mono game ? As far as I know I can not override OnPreparingDeviceSettings and in GraphicsDeviceInformation class there is no DeviceName property in Adapter.

Thanks.

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:
Best way to separate display and game logic (threads) What is the best way to separate render and game logic threads?

I'd like to make logic-heavy game (ai, machine learning, and network) in which world updates 50-60 times per second.

I want to separate rendering so it will not waste logic's thread power.

I'm planning to use c++ with boost.

sentences:
Collision handling for grid based games and simulations I'm trying to implement a grid based game where there are many creatures moving in the grid from square to square. I'm having a hard time handling collision with creatures in the grid (multiple creatures trying to move into the same square or cell). Where can I find information on how I should handle a game (or simulation) where multiple creatures in a grid want to move into the same cell but aren't allowed to? It's easy to handle 2 creatures, but handling n object collision is tough.

I'm looking for info on how to handle collision in a grid world. I don't expect a specific answer as much as resources or suggestions to find more info.

EDIT: To clarify, I'm looking for info on HOW TO HANDLE COLLISIONS BETWEEN MULTIPLE OBJECTS IN A GRID. In a grid world where multiple objects want to move into the same cell at the same time, how do I resolve this? Does one object get to move into the cell and the other objects remain stationary? Do I make each object push the other object out of its cell? These are the questions I want to answer.

An example of the problem I'm looking to answer:
Consider a grid where there's 3 creatures who move from tile to tile. What do I do when two creatures, A and B, try moving into the same tile? Let's consider if I allow creature A to move into the tile but creature B remains stationary. What happens if a different creature C wanted to move into the tile that creature B was stuck in? Then creature C also wouldn't be able to move.

This would cause an issue if I would evaluate creature C's movement first, telling it that he can move into the tile that creature B is in (because creature B plans to move out) but then creature B ends up never moving out.

How do I determine which creatures to evaluate first? Also, how do I avoid this huge chain of creatures being forced to remain stationary (in this example, only 1/3 creatures were able to move).

sentences:
How to correctly handle multiple movement key presses resulting in double the speed? I am trying to implement acceleration and drag into my top-down 2D game. The player can move using the WASD keys. Acceleration works fine, but the way I handle the directional velocity causes the player to abruptly stop when the movement keys are released instead of coming to a stop. Here is the code I currently have:

EDIT: I officially solved the above issue by implementing an applyForce method and triggering it when the movement keys are pressed as seen here:

    public void applyForce(float angle, float amount)
    {
        Vector2 v = new Vector2((float)(Math.Cos(angle)), (float)(Math.Sin(angle)));
        v.Normalize();
        v = Vector2.Multiply(v, amount);

        velocity = Vector2.Add(velocity, v);
    }

            if (oldKeys.IsKeyDown(Keys.A))
            {
                applyForce((float)Math.PI, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.D))
            {
                applyForce(0, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.W))
            {
                applyForce((float)Math.PI * 1.5f, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.S))
            {
                applyForce((float)Math.PI * 0.5f, CurrentSpeed);
            }

As you may have guessed, the new problem is that when 2 keys are pressed the method is called twice causing the player to move faster than he should be. Are there any effective ways of handling this?

sentences:
Anti-Aliasing Issues in MonoGame My anti-aliasing is not working in MonoGame.  I'm not sure if I'm doing something wrong.  See the image below (rotating the screen -- coordinates are all overlapping/adjacent, so should blend them):

http://imgur.com/a/xIj7C

On the ctor of my Game, I have the following:

        Graphics = new GraphicsDeviceManager( this )
        {
            PreferredBackBufferHeight = 720,
            PreferredBackBufferWidth = 1280,
            PreferMultiSampling = true
        };

        Graphics.ApplyChanges();

Which, should enable Anti-Aliasing.  Further, I have:

                GraphicsDevice.RasterizerState = new RasterizerState()
                {
                    CullMode = CullMode.None,
                    MultiSampleAntiAlias = true,
                };
                TileMeshEffect.CurrentTechnique.Passes[0].Apply();
                GraphicsDevice.SetVertexBuffer( TileMeshVertexBuffers[Coordinate] );
                GraphicsDevice.DrawPrimitives( PrimitiveType.TriangleList, 0, TileMeshVertexBuffers[Coordinate].VertexCount / 3 );

Right as I'm rendering the Mesh, which should, I would think, do everything necessary.  I was able to confirm via debugger that both are set, and that furthermore, the number of passes was 4 (GraphicsDevice.PresentationParameters.MultiSampleCount).

Any clue what I'm doing wrong?

sentences: mobile: Is every position in percentages when you support multiple screen sizes (different aspect ratios)? Is every position in percentages when you support different aspect ratios? Or do you do if-else statements for each aspect ratio and put absolute positions? What are the pros and cons of each?

sentences:
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:
How can I animate characters' static-geometry eyes? Here's a Nintendo example:

Specifically, the animation of the pupils seems not to animate the geometry.

How is this done?

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:
Which things to do in AutoCAD and which in 3ds Max? I learned 3ds Max two months ago. I am not perfect in it, but I used it to make a model of a house. I am interested in house architectures. I used to model everything in Max.

I have just started to learn AutoCAD and it has been two weeks. I realized that AutoCAD is very accurate in modelling floor plans, doors, windows, etc.

The teacher told me that every thing from a chair to a pen to a bed, etc., can be modelled in AutoCAD.

Now I am confused as to which is the right way to model house interiors, AutoCAD or Max.

I want to know at what point should I finish things in Autocad and then move to Max?

sentences:
Pre Computing shadows, advantages/disadvantages? Today I was looking at a still frame of a game, and noticed that all of the shadows were dynamic (created per frame). As we know, shadows can be quite expensive.
I was wondering why shadows could not be simply mapped at run time for non moving objects, and then only do dynamic shadows for players, vehicles, etc.
What are the advantages/disadvantages of doing this?

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: Outputting wrong colours from pixel shader in Direct3D The output from the pixel shader in Direct3D is four floats, normalized 0-1 for each channel (RGBA). But what happens if these floats haven't been normalized correctly and are above 1?

sentences:
Modelling the board in a Mastermind game Hey, I'm trying to make a Mastermind game. I'm having trouble figuring how to design the game board for the guesses. The board must consist of four columns and eight rows. I'm having trouble figuring out how to go about printing the game board on screen. I know I could use a two dimensional array to store the letters and guesses, but I need to print the game board on the screen as well as the guesses inside the game board.

I hope this was clear enough, if not i can explain more, I just need help with this game board situation.

sentences:
Unity C# Input Buffering So, I've got a fighting game with some pretty tight input windows, and I'd like to buffer the inputs for a few frames.

Basically, if the fighter is in the neutral state, pressing attack should lead into an attack. It uses Input.GetButtonDown("attack") to get the button, and if it detects a press, transitions into attacking state. Now, let's suppose the fighter has just landed, and ends up hitting "attack" a few frames before the land animation ends and he transitions back into neutral. As of right now, nothing would happen, since he's not in the neutral state where the check is, and when he enters the state, the button press is no longer happening.

Is there a way to store inputs for a few frames, so that I can read a button press a few frames back? So, instead of using Input.GetButtonDown("attack"), it'd be something like InputBuffer.KeyBuffered("attack",12) to see if the button was pressed within 12 frames?

The example above is just a bit of a simplification, I know for the above situation I could just use GetButton instead of GetButtonDown, but for a fighting game, you can imagine that the necessary inputs to buffer would get significantly more complicated.

sentences: List of all games names? Is there any list of game names anywhere, so i can choose a name for my game and avoid (legal) conflicts with other games as much as possible?

sentences:
how can I specify interleaved vertex attributes and vertex indices I'm writing a generic ShaderProgram class that compiles a set of Shader objects, passes args to the shader (like vertex position, vertex normal, tex coords etc), then links the shader components into a shader program, for use with glDrawArrays.

My vertex data already exists in a VertexBufferObject that uses the following data structure to create a vertex buffer:

class CustomVertex
{
public:
float   m_Position[3];      // x, y, z      // offset 0, size = 3*sizeof(float)
float   m_TexCoords[2];     // u, v         // offset 3*sizeof(float), size = 2*sizeof(float)
float   m_Normal[3];        // nx, ny, nz;
float   colour[4];          // r, g, b, a
float   padding[20];        // padded for performance
};

I've already written a working VertexBufferObject class that creates a vertex buffer object from an array of CustomVertex objects.  This array is said to be interleaved.  It renders successfully with the following code:

void VertexBufferObject::Draw()
{
if( ! m_bInitialized )
    return;

glBindBuffer( GL_ARRAY_BUFFER,          m_nVboId );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER,  m_nVboIdIndex );

glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glEnableClientState( GL_NORMAL_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );

glVertexPointer( 3, GL_FLOAT, sizeof(CustomVertex), ((char*)NULL + 0) );
glTexCoordPointer(3, GL_FLOAT, sizeof(CustomVertex), ((char*)NULL + 12));
glNormalPointer(GL_FLOAT, sizeof(CustomVertex), ((char*)NULL + 20));
glColorPointer(3, GL_FLOAT, sizeof(CustomVertex), ((char*)NULL + 32));

glDrawElements( GL_TRIANGLES, m_nNumIndices, GL_UNSIGNED_INT, ((char*)NULL +  0) );

glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisableClientState( GL_NORMAL_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );

glBindBuffer( GL_ARRAY_BUFFER,          0 );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER,  0 );
}

Back to the Vertex Array Object though.  My code for creating the Vertex Array object is as follows.  This is performed before the ShaderProgram runtime linking stage, and no glErrors are reported after its steps.

// Specify the shader arg locations (e.g. their order in the shader code)
for( int n = 0; n < vShaderArgs.size(); n ++)
    glBindAttribLocation( m_nProgramId, n, vShaderArgs[n].sFieldName.c_str() );

// Create and bind to a vertex array object, which stores the relationship between
// the buffer and the input attributes
glGenVertexArrays( 1, &m_nVaoHandle );
glBindVertexArray( m_nVaoHandle );

// Enable the vertex attribute array (we're using interleaved array, since its faster)
glBindBuffer( GL_ARRAY_BUFFER,          vShaderArgs[0].nVboId );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER,  vShaderArgs[0].nVboIndexId );

// vertex data
for( int n = 0; n < vShaderArgs.size(); n ++ )
{
    glEnableVertexAttribArray(n);

    glVertexAttribPointer(
        n,
        vShaderArgs[n].nFieldSize,
        GL_FLOAT,
        GL_FALSE,
        vShaderArgs[n].nStride,
        (GLubyte *) NULL + vShaderArgs[n].nFieldOffset
    );

    AppLog::Ref().OutputGlErrors();
}

This doesn't render correctly at all.  I get a pattern of white specks onscreen, in the shape of the terrain rectangle, but there are no regular lines etc.  Here's the code I use for rendering:

void ShaderProgram::Draw()
{
using namespace AntiMatter;

if( ! m_nShaderProgramId || ! m_nVaoHandle )
{
    AppLog::Ref().LogMsg("ShaderProgram::Draw() Couldn't draw object, as initialization of ShaderProgram is incomplete");
    return;
}

glUseProgram( m_nShaderProgramId );
glBindVertexArray( m_nVaoHandle );
glDrawArrays( GL_TRIANGLES, 0, m_nNumTris );

glBindVertexArray(0);
glUseProgram(0);
}

Can anyone see errors or omissions in either the VAO creation code or rendering code?

thanks!

sentences: UI Automation for Flash Games has anyone used or heard of a good selenium-like toolset for doing automated UI testing with Flash? I would ideally like to have the ability to record and playback events against my game and integrate this into our build server.

sentences:
Black screen after unity updated to 2019.4.17and later on Android I upgraded my app from Unity 2019.4.9 to 2019.4.21.  it seems to work fine in the editor, but on my Android build I just get a blank screen.  No splash screen, no app main window.  I've been able to isolate it to the update from 2019.4.16 to .17 that breaks it.  I can toggle back and forth, build .16 it works, .17 and higher are all black screen.  I tried (.17,.18 and .21)
only thing relevant in the logs seems to be:
03-13 10:49:09.689  1458  7484 I WindowManager: WIN DEATH: Window{378e77 u0 com.mycompany.myapp/com.unity3d.player.UnityPlayerActivity}
03-13 10:49:09.689  1458  7484 W InputDispatcher: Attempted to unregister already unregistered input channel
03-13 10:49:09.689  1458  2335 I ActivityManager: Process com.mycompany.myapp (pid 8851) has died: fore TOP (366,458)

i'm building for Mono, .NET 4.x and Targeting ARMv7
anyone else run into this?  any info on what I should look at next to continue to debug?  anyone know what changed in .17 that might be causing this?

sentences:
Viewport not matching Window size when fullscreen I am using:

GraphicsDevice.Viewport.Bounds

to determine the size of the canvas / stage for my window. This works well if I am in Windowed mode, but if I launched into fullscreen, it does not update to the new fullscreen size.

public HelloWorld()
{
    graphics = new GraphicsDeviceManager(this);

    int height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
    int width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
    graphics.PreferredBackBufferHeight = height;
    graphics.PreferredBackBufferWidth = width;

    graphics.IsFullScreen = true;
    graphics.ApplyChanges();

    Content.RootDirectory = "Content";
}

Basically, I am setting the window to fullscreen in the constructor, but the Viewport does not get set to the new size (I also tried just setting to fullscreen without explicitly setting PreferredBackBuffer settings). I have tried manually setting the viewport size, but it appears to be null in the constructor.

So, is there a way to get the stage / screen bounds that I can draw to in a way that is consistent in both Windowed mode and fullscreen mode?

When I run, here is what I get:

(i.e. the viewport doesnt match the entire screensize).

Debugging this a bit more and the issue isnt that the viewport isnt being updated to the correct size (it is), but that it seems to render in a smaller space (see attached image). If I print out with the width / height of the viewport, it matches the full screen window, but when I draw at 0,0, it doesnt place it at the top left of the window).

Note, if I just set the window size to the dimensions of the screen, and DONT set it to fullscreen, then things work (i.e. the balls fill the screen)(see image below).

I can get it to work if I move the fullscreen call from the Constructor, and to Initialize. This works, but I am trying to figure out why it doesnt work when I call full screen in the constructor (and if that is the right place for me to make that call).

sentences:
How do I define a required component on a Unity game object? I have a script that expected the game object to have a Terrain component.

Is there an attribute I can add (or some other way) which will prevent a designer from adding my script/component/MonoBehavior to a GameObject that does not have the Terrain component?

The only alternative I have been able to find is to attach my script to something else, and then have a public Terrain field, which requires the user to attach the terrain object to it.  (since the editor won't allow you to associate a different object type.) - I just want the reverse.

Any thoughts?

sentences:
Can I reset the `[DisallowMultipleComponent]` attribute in child classes in Unity somehow? Can I reset the [DisallowMultipleComponent] attribute in child classes in Unity somehow?
I want to create my base class:
[DisallowMultipleComponent]
public class MyCompanyClass : Monobehaviour {}

I want all my component scripts to inherit from the MyCompanyClass. So, I will be able to add only one instance of my component script to a game object at a time. I need it for most of my classes. But for some classes I still want to preserve the ability to add a few class instances to a game object, while still inheriting from the MyCompanyClass (because I am going to put some custom behavior into it, which is going to be used by all my component scripts).
So, I was trying to search for something like [AllowMultipleComponent], but found nothing. Is there maybe another way to achieve what I want?

sentences:
Computer generated 2d graphics for games - how to get started I've seen a lot of nice 2d games recently, like Geometry wars that have really nice computer generated graphics.

I would like to know how is it done so game looks really nice even if it is composed only from really primitive graphic objects. All those lights, glowing particles, transformations etc.

Do you have any tips, info, books, articles that would uncover some details about creating graphics this way?

And what about development for all the mobile platforms, any good frameworks for this kind of work?

sentences: How to not freeze the main thread in Unity? I have a level generation algorithm that is computationally heavy. As such, calling it always results in the game screen freezing. How can I place the function on a second thread while the game still continues to render a loading screen to indicate the game is not frozen?

sentences:
Is web browsers, how much latency is there with event listeners? I have an event listener in JavaScript looking for keydown events.
document.addEventListener('keydown', e => {
    // Callback code
});

What is the latency between someone pressing a key and my function executing. Is the function immediately added to the event queue or does it wait until the next frame is ready to be drawn? Is the behavior consistent between web browsers?
Just to be extra clear, I'm only interested latency in the context of web browsers, not anything before it.

sentences:
XNA Distortion Shader problem So I came up with a distortion pixel shader in hlsl, but it has some issues. First of all, here is how it works:

The shader uses another texture generated by the program as a distortion "map" (if that's the correct term) I called this map a "mask".

The shader uses the red values in the mask for horizontal distortion and the blue values as vertical distortion. The green values are not used.

It subtracts 0.5 from the red and green values so that they have a range from -0.5 to 0.5 instead of 0 to 1. This lets the distortion go in any direction using only two color values.

I let the shader "push" pixels up to 128 pixels.

sampler s0;
texture textu;
sampler tex_sampler = sampler_state{Texture = textu;};
float2 screenSize;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    float4 tex_color = tex2D(tex_sampler, coords);

    if (tex_color.a)
    {
        float distX = (tex_color.r - 0.5f) * (256.0f / screenSize.x) * tex_color.a;
        float distY = (tex_color.b - 0.5f) * (256.0f / screenSize.y) * tex_color.a;

        return tex2D(s0, float2(coords.x + distX, coords.y + distY));
    }
    return tex2D(s0, coords);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

"textu" being the mask, "tex_color" is the color value from the mask.
It also multiplies the distortion by the alpha value in the mask.

This seemed to work perfectly at first, but I started noticing some issues.
I was using a completely white texture (as the mask) that was blurred around the edges. I set the color of this texture based on its rotation.
Here is the method I used for that:

private Color GetDirectionColor(float rad)
{
    Vector2 v = new Vector2(
        (float)Math.Cos(rad + Math.PI),
        (float)Math.Sin(rad + Math.PI)
        );

    float r = (v.X * 0.5f) + 0.5f;
    float b = (v.Y * 0.5f) + 0.5f;

    return new Color(new Vector3(r, 0, b));
}

This allows the texture to "push" pixels in whatever direction it is facing.
This method seems to work fine.

The problem is, when the texture is rotated more than 135 degrees and less than 315 degrees (as in, the texture is pointing into the upper left half of a circle if you cut it in half at a 45 degree angle) it does something strange. Where the texture is blurred (the alpha values become less than 1) it starts to "push" the pixels in the opposite direction that it should be.

I suspect this has to do with my shader and not something else in the program. Possibly the -0.5f part???

I'm terribly sorry if this is confusing... I could not find a better way to word it.

Thanks a lot for your help!

sentences:
Zoom Camera from C# in Unity I am creating endless running game. I want to zoom camera when player dies to the player. I have tried using camera.FieldOfView, but it does not work. Is there another way to zoom In camera to the object when particular condition becomes true.
Thanks in advance.

sentences: 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:
OpenGL: glRotatef cause performance drop while rotating -x and -y I have made a rotating cube and I got some performance drops while using two glRotatef calls. So basically this code is giving me 80FPS:

    //code 1
GLrotate_x += 0.4f;
GLrotate_y += 0.4f;
        glPushMatrix();
            glRotatef( GLrotate_y, 0.0f, 1.0f, 0.0f );
            glRotatef( GLrotate_x, 1.0f, 0.0f, 0.0f );
            glTranslatef(multiplxGL+0.5f+spaceGL/2, -multiplyGL-0.5f-spaceGL/2,  multiplzGL+0.5f+spaceGL/2);
            glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
        glPopMatrix();

While this one is giving me 100FPS

    //code 2
GLrotate_y += 0.4f;
        glPushMatrix();
            glRotatef( GLrotate_y, 1.0f, 1.0f, 0.0f );
            glTranslatef(multiplxGL+0.5f+spaceGL/2, -multiplyGL-0.5f-spaceGL/2,  multiplzGL+0.5f+spaceGL/2);
            glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
        glPopMatrix();

The rotate results from the rotation code 1 and code 2 are not the same (cube rotates different).I know that the code 1 is the most proper way here for the rotation but why the performance drops? Any chance of updating my code 1 to the performance of code 2?

On the other side in DirectX I use:

D3DXMatrixRotationYawPitchRoll(&matDXRotate,
                                D3DXToRadian(DXrotate_y),
                                D3DXToRadian(DXrotate_x),
                                D3DXToRadian(0.0f));

and then

matDXStack->Push();
        D3DXMatrixTranslation(&matDXmove, multiplxDX + 0.5f + spaceDX / 2, multiplyDX + 0.5f + spaceDX / 2, multiplzDX + 0.5f + spaceDX / 2);
        matDXStack->LoadMatrix(&(matDXmove*matDXRotate));
        d3ddev->SetTransform(D3DTS_WORLD, matDXStack->GetTop());
        d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 36, 0, 12);
    matDXStack->Pop();

Which gives me 100 FPS and rotate results same as code 1.

sentences:
Why not derive velocity from position updates in games? Is there a reason why retrieving velocity of a 3d object in a game engine vs deriving it from position updates is preferable?

I am currently polling position at every step and deriving current velocity, however, there is also a "get velocity" option. I already need position but I'm wondering if the velocity in the game engine is preferable for some reason like it has less latency than the derivative.

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:
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:
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:
How can I rotate a cylinder so the top points at specific transform? I have a GameObject (goA) with a LineRenderer that has a single line drawn, on which I'd like to place cylinders so the top of the cylinder points to each end of the straight line that the cylinder sits on, (similar to a cylindrical bead on a straight piece of string, or a Candlestick chart).

The cylinder GameObject (goB) is a child of the goA which the LineRenderer is sat on (goB.transform.parent == goA.transform).

goA is not rotated itself, and the Line drawn could be any angle relative to the GameObject, and it would be a bit of a hassle to refactor so that the Line is always vertical and instead rotate goA, and it seems this should be an easily solvable problem!

I'm attempting to use either LookRotation or LookAt on the cylinder but for whatever reason all permutations I can think of simply are not working.

Thanks for any advice!

sentences:
How do I set horizonal Field of View by code as in Inspector? I have a camera that I have set to
RenderType = Base
Projection = Perspective
FOV Axis = Horizontal
Field of View = 75
Physical Camera = False
Clipping Planes Near = 0.3, Far  = 1000

If I set Field of View values during gameplay in the Inspector, it works as expected.
For example, I type 75, and the camera behaves as I think it should. I'm comparing with Resident Evil 4. It has a camera cheat, and if I select FOV 75 in this cheat, the Resident Evil 4 camera behaves like my Unity game camera.
However, when I set the camera.fieldOfView to a 75 by code, the Inspector shows 104, and the code does not look as it looks when I type 75 in the Inspector.
_camera.fieldOfView however returns 75.
What is going on here, and how do I fix it?
Thank you!

sentences:
How to properly change resolution I'm trying to understand how LibGDX handles screen size / resolution, etc.
Coming from XNA this seems very confusing to me. Basically I want to support 480x800 for my game. If the screen size is different it should scale the resolution and use letterboxing. To do this I use a FitViewport. And that's the code:

public static final int VIRTUAL_WIDTH = 480;
public static final int VIRTUAL_HEIGHT = 800;
Viewport viewport;
SpriteBatch spriteBatch;
ShapeRenderer shapeBatch;
Texture img;

@Override
public void create()
{
    viewport = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
    spriteBatch = new SpriteBatch();
    shapeBatch = new ShapeRenderer();
    img = new Texture("test.jpg");
}

@Override
public void resize(int width, int height)
{
    viewport.update(width, height);
}

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

    shapeBatch.begin(ShapeType.Filled);
    shapeBatch.setColor(Color.GRAY);
    shapeBatch.rect(0, 0, viewport.getWorldWidth(), viewport.getWorldHeight());
    shapeBatch.end();

    spriteBatch.begin();
    spriteBatch.draw(img, 0, 0);
    spriteBatch.end();
}

Now if I set the game resolution to be 480x800 right at the beginning, it basically works except that if I change the window size, the resolution keeps to be 480x800. So it stretches the image but keeps the aspect ratio:

And if I run the game with any other resolution like for example 700x500 I get this:

What is going on behind the scenes?
(And sorry if my english is bad)

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:
Tower Defence stat storing system I'm trying to find a smart way to store and retrieve stats for a tower defence game, but am currently unsure as to which approach would be best.

Description:

The stats system should quite basic, there are 4 different towers, with up to 5 different levels each.
One important requirement is that the stats should be stored in an XML file so that the game designer easily can access and balance the stats. (He knows nothing about programming)

I can see two ways of doing this:

By creating a TowerStats class which hold values for one type of tower for one level. Something like:

public class TowerStats2
{
    public TowerType type;
    public int lvl;
    public int damageLow;
    public int damageHigh;
    public float range;
    public float attackFrequency;
}

Then i would load the stats from the XMl file using Linq and XDocument and load it directly into a TowerStat List. I would do this for each tower so in the end there would be 4 different List's which would hold the different level stats for the specified tower.

gunTowerStats[0] would hold level 1 stats of the gun tower
rocketTowerStats[2] would be level 3 stats of the rocket tower

When a new tower is bought by the player or when a tower is upgraded, the stats would then be taken from the List so something like:

UpgradeTower()
{
    lvl++;
    towerStats = gunTowerStats[towerLevel - 1]
}

Alternativly I could hardcode all the values, and have one big class which would go something like this:

gunTowerDamageLvl1 = 4;
gunTowerDamageLvl2 = 8;
gunTowerDamageLvl3 = 15;
rocketTowerDamageLvl1 = 10;

you get the point.
I know that hardcoding is never never really the way to go. But does that also count for this kind of example where all possible tower attributes are known and will not change? the only thing that will change are the values of these attributes.

Question
I'm personally in favour of the first way, but I must admit that I find both ways a bit clumsy, would it be alright to do it one of these ways or is there a much smarter  and more obvious way to deal with this that I'm completely unable to see?

I hope my question is understandable.

sentences:
Unity Cloud Build: Corrupted reffernces. Reimport All Assets possible? When references in scenes or prefabs are missing, usually a reimport all fixes all issues. But when those problems occur in a cloud build that get's its data from a git repository the solution seems much harder. The AssetDatabase API allows for a reimport in a prebuild script:
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;

class Reimporter : IPreprocessBuildWithReport {

    public int callbackOrder { get { return 0; } }
    public void OnPreprocessBuild(BuildReport report) {
        AssetDatabase.ImportAsset("Assets", ImportAssetOptions.ImportRecursive);
    }
}

But the UnityEditor libary isn't accessible in a cloud build.
Is there a way to fix missing references in a cloud build or trigger a reimport via a pre build script or something similar?
PS: Local builds after a fresh checkout of the github project do not have this issue, and only Cloud builds suffer from these missing references. Maybe someone knows the root of the issue and how to overcome it, so that none of these hacky solutions would be required.

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:
My sprites are spwaning on top of each other with a new class? I am making a game for college in XNA C#, however I have got to the point where I need some enemy sprites to be spawned in for the player to shoot. I did this with one enemy by itself without using arrays and for loops to load and update all the enemy's at once as I have my enemy sprites inside a class. The class I have it supposed to give the enemy a random position, load the texture in and then draw them.

So I thought I would put my enemy sprites in a form of a array, and use a for loop to load, update and draw them. However, it all works but they all spawn in the random position on top of each other, but this works with one enemy at a time without for loops or putting them in an array.

Here is some of the code I used:

This is how I decide how many enemy sprite I want.

giantManager[] giant = new giantManager[7];

Because I have to create an instants of the giantManager class before the load content I use this to do so:

        for (int i = 0; i < 7; i++)
        {
            giant[i] = new giantManager();
        }

The following is how I load the giantManager class with the texture for my giants in the load function:

            for (int i = 0; i < 7; i++)
            {
                giant[i] = new giantManager(Content.Load<Texture2D>("giant"));
            }

Then to draw them I just use:

            for (int i = 0; i < giant.Length - 1; i++)
            {
                giant[i].Draw(spriteBatch);
            }

And this is the draw method inside the class:

public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(giantTexture, new Rectangle((int)position.X, (int)position.Y, giantTexture.Width, giantTexture.Height), null, Color.White, giantAngle, new Vector2(giantTexture.Width / 2, giantTexture.Height / 2), SpriteEffects.None, 0);
    }

To choose my random spawn location I just use the Random C# data type and use if statements to decide which spawn location to set depending on the Random number generated. This happens in the constructor here:

    public giantManager(Texture2D newTexture)
    {
        giantTexture = newTexture;
        position = randomPosition();
    }

Just to conclude this question I would like to say sorry if I have posted to much code or not explained it in enough detail, I have tried by best.

Also if you look at this image below, it shows the rectangles in a black box, now the player rectangle is a little see through, but the giant rectangle is totally black which is because they all spawn on top of each other. That is my problem.

Thanks for reading all of this and any help in advanced would be great.

sentences:
Making Edges of Hand-Drawn Tileset Match Up I'm making a tile-based platformer. A friend at college is doing all my art, and so far it's beautifully hand-drawn. The problem is, I can't seem to make the edges of the tilesets match up. He measures them meticulously to get sections to match up, but, due to variations in his art medium, tiles that aren't next to each other in his drawing don't match up. For example, he's drawn a basic 9-slice tileset, and the top-to-center, left-top-to-left-center, right-top-to-right-center, etc. all connect perfectly because they're touching each other in his drawing. But when I clip the tiles apart and put them together in other variations or try to put other "change-up" tiles together (any tile that wasn't touching in his drawing), the larger features fit together because of his measurements, but you can see an obvious seam where they join.

I've been using the heal tool in my graphic editor to fix the seams and re-export the tiles with edited edges to fit together correctly, and it works well, but when I heal the edges for one seam, it makes another seam appear.

Note: I don't want a solution to fix the seams at runtime using graphical filter magic or something on the code side. I'm looking for a solution to process the images and export them so that they fit together.

[EDIT:] Here's one of the tiles for reference. It tiles along the bottom of a block of stone.

And here's a 9-slice thumbnail of an early stage of the tileset:

[Edit again:] To be clear, it's not the big-ish things (stone sides, grass, etc.) connecting that's my problem. My artist already measures everything to make it match up. It's the variations in shading and impreciseness of the physical medium that's the problem.

sentences:
C# Divide points based on players damage How can i divide points based on highest damage? For e.g i have monster which drop 50 experience points and 4 different players has dealt damage to this monster. But i will like to split the experience points based on the players damage.

So far i got this:

private Dictionary<Player, int> damageMap = new Dictionary<Player, int>();

public void TakeDamage(Player attacker, int damage)
{
    damageMap.Add(attacker, damage);
}

private void OnDeath()
{
    foreach (KeyValuePair<Player, int> entry in damageMap)
    {
        Player player = entry.Key;
        int damage = entry.Value;

        player.addExperience(50);
    }
}

sentences: Way to Round Numbers I have it when the player clicks the mouse they can move the peice aoround the board. I am trying to have the chess pieces snap to a grid after the mouse has been released. Is there any way to round numbers so that I can round the X and Y coordinates so that it will snap to the grid?

sentences:
What should I keep in mind when making 2D games for multiple resolutions? I'm making a 2D (Android) game. Android devices vary quite a lot in screen resolution; what do I need to keep in mind when making my game?

Do I need to keep big versions of all images and scale down depending on the resolution (doesn't that waste space)?
Do bitmap fonts scale well or do I need to use something else?
Anything else I'm forgetting?

sentences:
Random/Procedural vs. Previously Made Level Generation What the advantages/disadvantages of using random/procedural generation vs. pre-made levels?

There seems to be few that I can think of, other than the fact that items may be a problem to distribute in randomly generated terrain, and that the generated terrain may look weird.

The downside to previously made levels is that I would need to make a level editor, though. I cannot decide what is better to use.

Could answers include code/examples of both procedural and premade generation, as well as the pros/cons?

sentences:
Where should I put the SDL_Renderer* using the ECS with SDL2 and C++? So I'm still learning about ECS (Entity Component System) and whenever I'm thinking about the architecture and actual implementation, I just can't figure out where should I put the SDL_Renderer*.

So far what I've learned is that the Entity class should have its own unique ID, there should be a Component and System class and things like RenderComponent and RenderSystem should be derived from them. RenderComponent should contain all the data and the RenderSystem should contain the actual algorithms (correct me if I'm wrong so far).

I'm using C++ and SDL2 and I don't know how about you guys but I never really used more than one SDL_Renderer and I'm not intending to do so either. I always just create a renderer for the window and copy everything to that one renderer and than I present that renderer to the screen.
So my questions are:

In an ECS design like I explained above, where should I put my
SDL_Renderer?
What should the RenderComponent, and RenderSystem,    contain?

sentences:
Clamping the camera isn't so smooth when moving the camera around. Is there a way to make the clamping smoother? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class CamerasManager : MonoBehaviour
{
    public CinemachineFreeLook playerCameraCloseLook;
    public CinemachineFreeLook playerCameraGameplayLook;
    public float timeBeforeSwitching;
    public float clampMin;
    public float clampMax;
    public float pitch;
    public float speed;

    private float brainBlendTime;

    // Start is called before the first frame update
    void Start()
    {
        brainBlendTime = Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time;

        StartCoroutine(SwitchCameras(timeBeforeSwitching));
    }

    // Update is called once per frame
    void LateUpdate()
    {
        if (playerCameraGameplayLook != null)
        {
            pitch += speed * Input.GetAxis("Mouse Y");
            pitch = Mathf.Clamp(pitch, clampMin, clampMax);
            playerCameraGameplayLook.GetRig(1).GetCinemachineComponent<CinemachineComposer>().m_TrackedObjectOffset.y = pitch;
        }
    }

    IEnumerator SwitchCameras(float TimeBeforeSwitching)
    {
        yield return new WaitForSeconds(TimeBeforeSwitching);

        playerCameraCloseLook.enabled = false;
        playerCameraGameplayLook.enabled = true;

        PlayerLockManager.PlayerLockState(false);

        StartCoroutine(BlendTime());
    }

    IEnumerator BlendTime()
    {
        yield return new WaitForSeconds(brainBlendTime);

        PlayerLockManager.PlayerLockState(true);
    }
}

I can look around up down left right using Cinemachine CinemachineFreeLook but when using the clamping in this script and then when moving the camera around with the mouse it looks like the camera is a bit stuttering/jittering.
Without the clamping, in the LateUpdate the camera will work fine but then I can't move the camera up down left right only to the left and right.
The reason I'm trying to do the clamping on my own is that in the FreeLookCamera in the Axis Control > Y Axis if I set the speed to 100 or 300 when I move the camera up and down it will also zoom in/out on the player and I don't want that zooming but there is no option to remove/disable the zooming.

sentences:
Different executions with different results using the same Random seed in LIBGDX In my Libgdx project (for PC) I am using a Java Random object initialized with a constant seed. I use the Random object to generate a lot of different pseudorandom integers. I am not using multithreading, but the integers are a bit different each time I execute the application.

How can this be possible?

EDIT: What is really strange is that the Random object is called a few times more in some executions and I don't know why, causing the random numbers to be a bit different for each execution.

sentences:
how to clamp the look at function? how can i look at a target on 2 axis but clamp the the object's rotation ,to only rotate from -45 to 45 on x and from -60 to 60 on y axis. i used this script to look at target and clamp the rotation, but it's not working right ): there is no problem with maximum value but whenever the rotation is about to become zero or a negative value the wired problem will show up. i made a gif here (http://www.mediafire.com/view/55phgr5qrhy8fk1/record.gif)

public Transform target;
public float speed;

public float minimumX;
public float maximumX;

public float minimumY;
public float maximumY;
// Start is called before the first frame update
void Start()
{

}

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

    Quaternion OriginalRot = transform.rotation;
    transform.LookAt(target);
    Quaternion NewRot = transform.rotation;
    transform.rotation = OriginalRot;
    transform.rotation = Quaternion.Lerp(transform.rotation, NewRot, speed * Time.deltaTime);

    transform.eulerAngles = new Vector3(Mathf.Clamp(transform.eulerAngles.x, minimumX, maximumX), Mathf.Clamp(transform.eulerAngles.y, minimumY, maximumY), 0);

}

}

sentences: How To Use Unity With C++? In the C++ Visual Studio installer, there is an option Game Development With Unity. However, after selecting that, I didn't find any changes to regular Visual Studio. So I looked it up, and found no results regarding C++. How can I use Unity with Visual Studio for C++?

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:
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:
Character keeps falling through the terrain and jittering I honestly don't know what the problem could be anymore. I have a humanoid character with animations, and a charactercontroller.
I also have a ragdoll (seperately) that only follows the animations through script (doesn't do anything else).
the ragdoll has a script on both feet, with colliders and rigidbody's, and sets a bool to true when either of them hits something.
It also has an update function that casts a ray, and sets that same bool when it hits something. this way i know if it is grounded or not. the charactercontroller is also used to see if it is grounded or not.

In my control script I translate the character downward when it is not grounded, and set that gravity vector to 0 if it is.

the collisions work, the raycasts work, and the charactercontroller work, but still the character falls through.
i've also tried increasing the solver settings, turning off auto simulation and PCM, increasing the contact offset to the point where it floats above the ground, and still falls through.

All the scripts use update functions, but the behaviour is the same in FixedUpdate. I tried with and without rigidbody's in the charactercontroller, and with and without charactercontroller itself.

this part of code is for movement:

bool walking = skaterParams.walking;

            if (walking && !Onboard && !Helper.bailing) {
                moveDirection.y = 0;

                moveDirection = new Vector3(Input.GetAxisRaw("Horizontal"), 0.0F, Input.GetAxisRaw("Vertical"));
                moveDirection = transform.TransformDirection(moveDirection);
                moveDirection *= speed;
                if (Input.GetKeyUp ("joystick button 1")) {
                    moveDirection.y = jumpSpeed  ;

                }

            }

        if (!walking && !Onboard) {
            moveDirection.y -= gravity * Time.deltaTime;
        }
        if (!Onboard  && !Helper.bailing) {
            Char.transform.Translate (moveDirection * Time.deltaTime * 10);
        }

i could also share the code for seeing if he is grounded, but i'm trying to limit the post here, to not have too much text. I just know it works, but it's just not consistent. When setting auto simulation to true, the ragdoll is also extremely jittery...
the ragdoll and character are on seperate layers and cannot collide. The raycasts have a layermask set to the terrain layer.

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:
C# - Collision Detection problem with platforms on Monogame(XNA) So I am having issues with my platformer that I am developing. I can detect collisions fine when there are a line of parralel blocks or even single blocks. The issue I have is when blocks form an L shape.
  []   for example.
[]

When my character runs into the wall, he sort of just squeaks through and gets zoomed out. I've tried using an else statement that just sends him back a couple pixels back, but it doesn't work because I don't think it accounts for one of the two blocks. Each block is it's own object.

Any help?

This collision code is in my Player class. This is the only detection I have so far in the game. I attempted to use and adjust code from a breakernoid tutorial I found somehwere, and I realized that the code doesn't totally work for what I am doing.

public void checkYCollisions(block[] platforms)
    {

        if (position.Y >= 700)
            grounded = true;
        else
            grounded = false;

        float Xradius = Width / 2;
        float Yradius = Height / 2;
        block collidedPlatform = null;

        foreach (block p in platforms)
        {
            if ((position.X > (p.position.X - p.Width / 2 - Xradius )) &&
                (position.X < (p.position.X + p.Width / 2 + Xradius )) &&
               (position.Y > (p.position.Y - p.Height / 2 - Yradius )) &&
                (position.Y < (p.position.Y + p.Height / 2 + Yradius)))

            {
                collidedPlatform = p;
                break;
            }
        }
        //collisions work for all side of blocks.
        if (collidedPlatform != null)
        {
            if ((position.Y <
                (collidedPlatform.position.Y - collidedPlatform.Height / 1.5 /*+ radius*/)))
            {

                grounded = true;

            }

            else if ((position.Y   >
                (collidedPlatform.position.Y + collidedPlatform.Height / 2 )))
            {
                if(y_vel < 0)
                    y_vel *= -1;
                //player1.direction.Y = -1.0f * player1.direction.Y;
            }

            else
            {
                x_vel *= -2;
            }
        }

I am guessing the issue is because I only have one collided block selected at any time. So I don't really know how to fix it that I can have two blocks selected. Note, once again, this code works for all blocks that are by themselves, or just a horizontal(same x position) line of blocks. It's just that L situation where I run into a corner.

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

sentences:
How can teams collaborate on Unity 3D projects? With a friend of mine, we are planning to develop a small game to get the hang of game development and teamwork. But since Unity 3D barely supports version control (or at least the free version lacks of it) we have no idea how to efficiently manage teamwork. Sharing tasks in a small project is also seems like a challange for us.

I would also appreciate any advice that could be useful for beginner indie developers related to teamwork. :)

sentences:
Using A*Pathfinding on terrain created by scripts? I'm looking to use A* Path-finding as a method of navigating my game terrain. Trouble is, my terrain is built upon play using a script and A* grid does not detect this, therefore marking all nodes as "un-walkable".

I'm wondering if anyone knows a solution for this or an alternative path finding method. I have tried enabling the terrain to spawn on edit more using ExexcuteInEditMode, but this does not seem to work either.

The terrain was generated through a fantastic guide called Procedural Terrain Tutorial.

Would greatly appreciate any help I'll be able to get.

I've attached some screenshots for clarity :

sentences:
Accuracy and frame-rate in a rhythm game My question is related with Fixed time step vs Variable time step. But where a fixed frame-rate improve the consistency of a physics based game, is it the case for a rythm game, or wouldn't it be preferable to use a variable frame-rate ?

Say, I set the frame-rate to 100/sec, that will lead to an accuracy of 10ms, which is correct, but depending on the computer it will be possible to have a better accuracy. And if I set a too high frame-rate, some other computers may not follow, which may resolve in unsyncing the game and the music.

The first solution that came in my mind is to use a variable frame-rate. This way, the game will not be unsynchronized with the music, but the accuracy is too dependent of the computer.
Another, better, idea (I don't know if this is possible or not), would be to get the instant when has been pressed a key, and the accuracy will be no more dependent of the frame-rate. I'll make this game with LWJGL and I while reading the javadoc I found the method getEventNanoseconds(), and I was wondering how it is reliable since it's written "Only useful for relative comparisons with other Keyboard events, as the absolute time has no defined origin.".

What game loop method, do you think, is the most appropriate for a rythm game ? And for a rythm game with keysound ?
Did you made a rythm game, or some game that require a good accuracy and how did you manage the updating ?

Thanks for your help ! :)

sentences:
Should I switch to UDP for a mobile p2p game when considering 3G network? I have been making a mobile game that is similar to "Street Fighter" where two players play with each other via Internet.

The game sends out a small packet (controller status) to the other party every 30ms (a lot of packets going on).

I am currently using a server to connect two players and all communications are via TCP through the server. The server load increases a lot even for just 30 concurrent players. I know it sounds not wise to let the communication go through the server, so I think the best design should let these two players to communicate directly via UDP after the server hooks them up.

However, I have some questions when trying to move on to the new design:

Since it's a mobile game, players might be using 3G network a lot. Does UDP hole punching work well in 3G network? Does it matter when a player is actually moving physically (such as inside a car)? Do you think I should change the design or any recommendation of better design concepts?

sentences:
Textures not rendering with VBOs After having used display lists for my programs since I started learning OpenGL, I've finally decided to switch to VBOs after experiencing a considerable amount of lag when I started work on a new game. I've nearly finished with my transition, but I'm still having a bit of trouble with rendering the textures to the screen. The way I'm working it is this: I have several sprites of the same dimensions for each type of "block" in the game (it's a Terraria port) which are loaded into the game via a convenience method, then after they're all loaded, they're compiled into a virtual texture atlas via Graphics2D, converted to a Slick texture, and their relative coordinates are saved to a HashMap. However, when it comes time to grab the textures out of the HashMap and render them, the game simply doesn't. Here's part of my code for adding a block to the VBO (this is executed 4 times per block, once for each corner):

// top left
// vertex
values.add(Float.valueOf((float)b.getLocation().getPixelX()));
values.add(Float.valueOf((float)b.getLocation().getPixelY()));
// light
values.add(Float.valueOf((float)b.getLightLevel() / 15));
values.add(Float.valueOf((float)b.getLightLevel() / 15));
values.add(Float.valueOf((float)b.getLightLevel() / 15));
// texture
values.add(tX);
values.add(tY);

(Note: values is a list which is later converted to an array.)
Then comes my code for rendering the VBO:

public static void render(){
    glPushMatrix();
    glTranslatef(MineFlat.xOffset, MineFlat.yOffset, 0);
    glBindTexture(GL_TEXTURE_2D, BlockUtil.atlas.getTextureID());
    glVertexPointer(2, GL_FLOAT, 28, 0);
    glColorPointer(3, GL_FLOAT, 28, 8);
    glTexCoordPointer(2, GL_FLOAT, 28, 20);
    glDrawArrays(GL_QUADS, 0, vertexArray.length / 7);
    glBindTexture(GL_TEXTURE_2D, 0);
    glPopMatrix();
}

The blocks are properly rendered with the correct lighting, but they lack any sort of texture. Any suggestions as to how to get the code working? I apologize if the answer is obvious, but I still consider myself a bit of an OpenGL noob, especially in the area of VBOs.

One last thing; I should mention that I'm not using any shaders in my current game.

EDIT: I seem to be a bit mistaken. Upon experimenting with the code by manually setting all texture coords, I discovered that the game simply converts the texture to a uniform color by averaging the RGB value of all pixels. I didn't recognize this before because the color of most blocks is grey. I recall having this problem before with display lists, but that was quite a while ago, and so I don't remember how I resolved it.

SECOND EDIT: Screenshots of the expected and actual result, respectively:
http://i.stack.imgur.com/3t4r4.png
http://i.stack.imgur.com/edv8v.png

sentences:
Disposing objects when changing screens I'm making my first game with LibGDX and Box2D, and I've realized that the memory used increases when I change screens. It starts from 150MB and progressively reaches 850. How should I deal with this? It does not seem to be a memory leak, memory is constant throughout the level, and I'm using an AssetManager to dispose everything needed.

The problem is when switching screens, since objects remain in memory. What is the best practice in this case?
Should I have a method in each class that sets every object to null before the screen is disposed?
Another problem might be that I have a static class for all my constants (this was the method proposed in the Udacity course), could this be an issue?

Another idea described here is initializing all screens in the beginning and using them throughout the game. Though I'm not sure this could be done in my game now. Is this good practice?

I tried profiling a bit although it's the first time, here are some results. The sudden 'hops' are when switching screens.

sentences:
Use an instance or a class for game resources (wood,iron,gold) So I'm making a game where you can send ships to locations to sell or buy resources like wood, iron, gold, etc.

Now I was wondering how the resources should be created in de game. I came up with 2 options

Create a class for each resource:

public class ResourceBase {
    private int value;
    // other base properties
}

public class Gold : ResourceBase {
     public Gold {
         this.value = 40 // or whatever
     }
}

Create instances of a Resource class

public class Resource {
    string name;
    int value;

    public Resource(string name, int value) {
        this.name = name;
        this.value = value;
     }
 }

// later on...

Resource gold = new Resource("Gold",40);

With the second option it's possible to fill the game resources from a resources.json file, I kinda like that structure.

New ideas / design patterns / structures are always welcome!

EDIT: It's a little bit like Assassins Creed Black Flag's companion app. See the resource bar on the image below

EDIT 2: I've done some more research on the "load items/resources from JSON file" and found this blog: Power of JSON in Game Development - Items. It shows the best of option 1 and option 2. You're still able to add functionality to each resource :)

sentences:
change position/orientation of a bone using assimp I have been using assimp to import rigged models and animations. I followed this tutorial for skeletal animation and I have got it done properly. The part that I am trying to do now is to orient a certain mesh by using transformation matrix, which represents change from the initial orientation of bone For example, rotating left hand of the model by a 90 deg angle shall make the hand vertical if it's initially horizontal. To achieve this I have taken the following steps:

map each bone with its bone offset matrix, given by pBoneData[BoneIndex].BoneOffset below. This BoneOffset matrix transforms from mesh space to bone space.
find the parent bone in a mesh i.e. body part,
get the matrix for orienting the mesh, and save this matrix for parent bone of that mesh, given by pBoneData[BoneIndex].rotTransform. For all the other bones in a mesh, the orientation matrix is identity matrix;
traverse the node heirarchy and assign final transformation for each bone as:

void rag::BoneTransform(const aiScene* mScene)
{
aiNode* pNode = mScene->mRootNode;
readNode(pNode, IdentityMatrix);
}

//recursive process
void rag::readNode(aiNode* pNode, Matrix4f& ParentTransform)
{
 Matrix4f rot, GlobalTransformation;
 std::string NodeName(pNode->mName.data);
 Matrix4f NodeTransformation(pNode->mTransformation);

 if (boneMapping.find(NodeName) != boneMapping.end())
 {
 //if node represents a bone, then take it`s unique index
 unsigned int BoneIndex = boneMapping[NodeName];
 //rot is the matrix that represents change in orientation of bone
 rot = pBoneData[BoneIndex].rotTransform;
 GlobalTransformation = ParentTransform * NodeTransformation;
 pBoneData[BoneIndex].FinalTransformation = GlobalInverseTransform * GlobalTransformation * pBoneData[BoneIndex].BoneOffset;
 }

 GlobalTransformation = ParentTransform * NodeTransformation;

for (unsigned int i = 0 ; i < pNode->mNumChildren ; i++)
readNode(pNode->mChildren[i], GlobalTransformation);

}

If the function above is run as it is, it will display the model in the state it was while posing it in Blender, in T pose in my case. I am having problems on using 'rot' Matrix. One of the books that I read suggested multiplying the initialBoneOrientation with the changeMatrix. My initial thoughts was to sum 'rot' with NodeTransformation as both of these represent relative change from their parent Matrices. However, I got a totally disfigured model on doing so. Any thoughts on these is highly welcomed.

sentences:
Rendering mountains around a tile layer When making a 2D Pokémon game, I just faked elevation by putting mountain tiles underneath the land. Now my tiles are 3D models, so I'm using layer properties to define their elevation. What I don't know though is how to generate a 'mountain' around them.

The tilemap is kinda' like this:

Layer 1: Layer 2: Layer 3:
....     \\\\     \\\\
....     \..\     \\.\
....     \..\     \\\\
....     \\\\     \\\\

Layer 2 has y-offset set to 1, and Layer 3 has y-offset set to 2. All they do right now is float in the air. What I'm trying to do is render a mountain around them.

sentences:
Why do I seem to lose control of my computer when full screen Unity game loses focus? When I press Ctrl+Alt+Esc or Ctrl+Shift+Esc the game loses focus, but then the whole PC is unusable  and I need to restart the PC to regain control

How do I prevent the computer from locking up (let the player control their PC) when a full screen Unity game loses focus?

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:
Default movement keybindings for roguelike? I'm developing a text based MUD, but unlike MUDs I'm developing without telnet and making a custom interface.  Think Caves of Qud or Dwarf Fortress.  The game only has 6 directions you can walk.  North, East, South, West, Up, Down.  So cardinal directions plus up and down.  The question is I want to map these directions to the numpad. But often these types of games include intermediate directions northeast, northwest, southeast, southwest so I'm not sure I should really use those keybindings from other games.  I could be wrong.  I don't know of any other games that use only the directions I'm using that also include a custom interface.  My personal feeling is the directions would be bound to the numpad as such, but if there is a kind of de facto standard out there I would prefer that.  I'm planning to add key rebindings, but I'm trying to figure what the default should be.

n = 8
e = 6
w = 4
s = 5
u = 9
d = 7

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:
Creating Animations Without Hardcore Art for 2D Action RPG I'm working on a 2D action RPG. One of the issues I run into is art; in the vein of Flash games like FF7, Secret of Mana, or Epic Battle Fantasy, I would like to actually display the weapon with the player while they're walking around, and swap it out with a different image when they change weapons.

As a simple example, if I have a bronze and gold sword, when walking around, attacking, etc. you would see the bronze or gold sword image accordingly. This is an oversimplifcation, because I'm not sticking to only recolouring based on the weapon; I may actually change the design (not 100% sure about this yet).

As such, my core question is: how can I design this to minimize the amount of artwork I need to make for each weapon?

It seems like I need to create standardized weapon sizes (eg. 18x36px sword), positions relative to the character to show them for each frame, and I need to create a sprite-sheet for each frame. (I have four directional images for walking, each with four frames of animation.)

This means, per weapon, I need another 4x4 frames of animation; that's a lot (for a non-artist like me). The other approach would be programmatic animation; but how will that work? I have to worry about:

Positioning must be always similar for each weapon (different sizes?)
Occlusion; the whole weapon appears when looking down, but most of it is hidden when looking up; how can I standardize this?

For reference, see (really) FF7; they did a fairly decent job of this, albeit in 3D.

Sample:

sentences:
Role of an entity state in a component based system? Component-based entity systems are all the rage these days; everyone seems to agree they are the way to go, but no one really has a definitive implementation of such a system. I was wondering, what role do entity states (walking-left, standing, jumping, etc) have in a CBS? Do they act like controllers (i.e. they handle events and change the entity's attributes based on those events)?

What about cases where a state would, for example, require that the entity enters no-clip mode? Should, that state, when it enters, maybe set the CollisionComponent of the entity to a null pointer or something? (Then, on exit, the state should restore the entity's CollisionComponent to its previous state.)

Also, I guess it's the current state's job to change the entity's state to something else, right?

sentences:
Unity3d Rigidbodies overlap even at low speeds I have an issue that I can't solve. There are many questions relating to similar issues and they come down to "change some settings" and "object is travelling too fast". My problem doesn't seem to equate to either of these.

I am running through the basic tutorial for the Breakout Game and have added some of my own tweaks to the code, my issue is that even at low speed my ball overlaps with the bricks, rather than bouncing off them.

I have read various related questions but nothing seems to fix this for me.

Things I've done:

Set Project Settings >> Physics2d >> Maximum penetration For Overlap = 0.0001
Set Ball RigidBody Collision detection to "Continuous Dynamic" .
Set Brick RigidBody Collision Detection to "Continuous"
Forced a speed limit on the ball of 25 15. Which I think is not fast at all, as most the given solutions are talking about situations arising when the offending object is travelling at much higher speeds.
Bricks are standard rigidbody cubes and ball is a standard rigidbody sphere.
According to this answer I have also set the rigidbody interpolation to "interpolation" for both ball and bricks. But this seems processor expensive and doesn't solve the issue.
As well as set the Project Settings >> Physics >> Solver Iteration Count to 25. This does seem to have helped somewhat (ball no longer gets "stuck" inside brick wireframes, but still overlaps).

Below are some screenshots of my issue and my code.

The only aspect that I can't fully account for is that I've added an acceleration function so when ball is launched it accelerates over a course of several seconds to it's max speed. It's start speed is 8 (although the force applied is actually 1000 when launched, ignore that figure), and the max speed is set to 25 15. I don't know enough to say if this is somehow "breaking" rigidbody overlap detection but it seems pretty silly if so. See line 63 below:

Ball Source Code:

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour {

    public float initialVelocity = 500f;
    public float accelerationSpeed = 5f;
    public float MaximumSpeed = 15f;
    private Rigidbody rb;
    private bool ballInPlay = false;

    void Awake () {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    void Update () {
        if (Input.GetButtonDown("Fire1") && ballInPlay == false)
        {
            transform.parent = null;
            rb.isKinematic = false;
            rb.AddForce(new Vector3(initialVelocity,initialVelocity,0));
            ballInPlay = true;
        }
    }

    void FixedUpdate ()
    {
        /***
         * Gradually increase ball speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude < MaximumSpeed)
        {
            speedUp();
            Debug.Log("Ball Speed is "+rb.velocity.magnitude);
        }

        /***
         Clamp to maximum speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude > MaximumSpeed)
        {
            rb.velocity = rb.velocity.normalized * MaximumSpeed;
        }

    }

   //     rb.velocity.magnitude

    void speedUp()
    {
        /***
         This is line 63:
         ***/
        rb.AddForce(rb.velocity.normalized * accelerationSpeed,ForceMode.Acceleration);
    }

}

Why are the rigidbodies not detecting and preventing overlap?

sentences:
How to add a nice looking muzzle flash to the tip of my guns I am making a top down shooter and would like to add a muzzle flash to the tips of my guns. So I have an idea of what I want to do which would be just a circle that would fade from yellow to white or from white to yellow, don't really know yet. I actually have know clue how to fade in and fade out colors in libgdx so don't know how to do that. I guess I could also pass in a texture that I can color yellow and append that to the tip of the gun but still would like to add a color fade. Of course, these are just my crappy little ideas. Anyone else have a better idea that would look better graphically and if so could you try to describe it in some detail that would be great.

Thanks!

sentences:
Terracing mountain features I'm looking to replicate a procedural terrain effect I found on a portfolio/blog site a few days ago.

Quoting the site, the terracing was generated through, "multiplying [the final height] by some damping value within a certain height range, to create beautiful canyon features."

I was wondering, would anyone be able to provide a more technical example or procedure for going about this? Over the past week, I've been researching and learning a lot about procedural terrain/texture methods and practices but I still haven't come across anything that explains in detail what 'clamping' is, and I'm starting to become frustrated.

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:
OOP in cocos2d for ios I have been pulling my hair out trying to make an object in cocos 2d that is a CCSprite (with an image) and a CCLabelBMFont.

I tried making a CCNode object and I tried making a custom CCSprite object but none of it worked!

Can someone show me how to do this?

Thanks.

sentences:
How to make a texture appear the same way in a cube? My problem seems so simple, that before asking the question here I did a search on google and this site:

https://forums.unrealengine.com/development-discussion/content-creation/33665-applying-and-manipulating-textures-on-actors
https://www.youtube.com/watch?v=p6O4AgSwTmQ
Trouble applying a texture to a cube
How to produce a texture to represent a vector field
Why do I get a blank material in Unreal Engine 4?
How to create smoke that spreads outward in all directions?

But nothing seemed to be related to my problem.

I imported this image.png:

I created a material and added the image to it:

But I did not get the expected result in the game (I wish this yellow line were under that pink arrow that I drew):

Innocently I thought the solution was obvious, so I added another image.png and added it to the material:

To my surprise, the result was worse, the yellow line did not even appear:

I realized this happens because the floor of my game is a "stretched" cube, so the image I added is appearing correctly on one of its faces, not just the one I want.

I'd like to know how to make it look the same on all faces, or some value that I can change so that it appears correctly on the face I want.

EDIT 1 (attempt using rotator)

I put the input time to see if any value would be compatible with what I want, but none is.

I tried with both texture images, but both presented the same behavior:

See that spinning looks like the shaft rotates around the top left of the floor.

For some moments the yellow line will disappear.

sentences:
Java Distance between two Vector positions never 0 I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0.

It starts printing this:
0.9672514210000003

End by this and then start to raise back again:
0.0015875672000023044

// My position is 5.0 and toPosition is either +1 or -1
if (getDistance(getPosition(), toPosition) <= 0) {
    allowMovement = false;
}

public double getDistance (PositionVector pos1, PositionVector pos2) {
    double dx = pos1.x - pos2.x;
    double dy = pos1.y - pos2.y;
    return Math.sqrt(dx * dx + dy * dy);
}

Cheers.

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

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

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

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

sentences:
Get intersecting point of Arc, X distance from centre (Unity) I'm no mathmetician so forgive my wording when I ask this, there is no doubt an answer somewhere but I dont even know what to search for.

I want to find the intersection point (B) as a Vector2 on a perfect circle.

If I know X, Y, A and C I assume I can use the radius and distance to calulate the position of B based on the distance between X and C somehow? (using C# if there are any methods which will accomplish this)

TIA.

sentences:
Fixed timestep without physics? I read Gaffer's Fix Your Timestep article many years ago, and have since had the impression that game code should have a fixed timestep, with only non-gameplay related tasks outside of that in the main loop.

However, I recently reread the article, along with several others, and realized the emphasis is on physics. Which makes sense, but now I'm wondering if it only applies to physics.

What about games which don't use a real physics simulation? People talk about 60fps games, doesn't that imply a fixed timestep? What about multiplayer where you have regular updates to and from the server?

The only alternative I know of is variable rate with time delta, but that sounds like it wouldn't be any better, and less exact. What method is typically used?

sentences:
Frame Interpolation issues for skeletal animation I'm trying to animate in-between keyframes for skeletal animation but having some issues. Each joint is represented by a quaternion and there is no translation component. When I try to slerp between the orientations at the two key frames, I got a very wacky animation. I know my skinning equation is right because the animation is perfectly fine when the animation is directly on a keyframe rather than in-between two.

I'm using glm's built in mix function to do the slerp, so I don't think there are any problems with the actual slerp implementation.

There's really one thing left that could be wrong here. I must not be in the correct space to do slerp. Right now the orientations are in joint local space. Do I have to be in world space? In some other space along the way? I have the bind pose matrix and world-space transformation matrix at my disposal if those are needed.

sentences:
How can I change the value of a matrix uniform in an OpenGL vertex shader? I'm new at OpenGL. I have a uniform transform matrix in a vertex shader file. I want to modify the matrix by individually assigning each values in the matrix. How can I do that in C++?

I learned that we have to get location variable by using glGetUniformLocation but I am not sure how to access and modify index n with it with glUniform.

sentences:
Handling game logic events by behavior components My question continues on topic discussed here

I have tried implementing attribute/behavior design
and here is a quick example demonstrating the issue.

class HealthAttribute : public ActorAttribute
{
public:
    HealthAttribute( float val ) : mValue( val ) { }

    float Get( void ) const { return mValue; }
    void Set( float val ) { mValue = val; }

private:
    float mValue;

};

class HealthBehavior : public ActorBehavior
{
public:
    HealthBehavior( shared_ptr< HealthAttribute > health )
        : pHealth( health )
    {
        // Set OnDamage() to listen for game logic event "DamageEvent"
    }

    void OnDamage( IEventDataPtr pEventData )
    {
        // Check DamageEvent target entity
        // ( compare my entity ID with event's target entity ID )

        // If not my entity, do nothing
        // Else, modify health attribute with received DamageEvent data
    }

protected:
    shared_ptr< HealthAttribute > pHealth;

};

My question - is it possible to get rid of this annoying check for game logic events?
In the current implementation when some entity must receive damage, game logic just fires off event that contains damage value and the entity id which should receive that damage.
And all HealthBehaviors are subscribed to the DamageEvent type, which leads to any entity possesing HealthBehavior call OnDamage() even if he is not the addressee.

sentences:
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:
How can I store a set of concrete components and implement "GetComponent()?" I would like an abstract class, AbstractComponentAggregate, which has many AbstractComponents.  Users of my framework will create their components by extending AbstractComponent and appending the component to this AbstractComponentAggregate.

I would like to know if there is an elegant way to have AbstractComponentAggregate to store a dictionary of the concrete classes that extend AbstractComponents.  Note, that I want to store many concrete classes, each of which is an AbstractComponent.  This is different than storing a list of AbstractComponents.

Thus, you can invoke a method on AbstractComponentAggregate, such as:

AbstractComponentAggregate.GetComponent(), which returns type T.  T is the concrete class, and we ensure T is of type AbstractComponent.

Something similar to this is done in Unity3d, and I would like to emulate this.

sentences:
Preventing boredom creep with hobby projects This question is directed more towards the hobbyist developer rather than professional game developers.  Quite frequently while developing a game I'll get bored staring at the same exact game scene after days or weeks of work (while new features only slowly creep in) that I find myself abandoning projects and starting new ones, never really finishing what I've started.

How do you prevent yourself from getting bored with a hobby or side project?  What tips/tricks/techniques do you use to keep yourself motivated to actually finish a project?

sentences:
Building a guided tracing scene I'm trying to figure out an approach to creating a cocos2d scene that would help kiddos learn to draw letters of the alphabet. Right now I am just using Apple’s PaintView demo code and applying an outline mask for each letter such that the child only sees their tracings within the unmasked parts of each letter. But I want to take it a step further.

Here is how I have defined the challenge:

I have used Cocos2d before and was thinking it should be used for this problem as well.
I need to build 26 of these and was wonder if sprite builder would be a good tool to layout each letter. If so do you have any hints on how to define the stroke paths?

sentences:
Implementing Vehicles in your game In the game i am creating as an hobby (learning is the primal goal of it all) i plan to implement a space ship that the player can enter and use to explore it. I tried to search the internet for the concept of vehicle implementation but i couldnt find anything worth mentioning, and before I start writing the code I really want a clear idea of what I strive for. So id like to ask the pro game developers how should I look at a vehicle, should I think of it as a player's body extention with different mechanics? or should I just think of it as a usable exterior object? What kind of link should be between the player and the drivable vehicle? How do games usually do it, like GTA 2 and that kind of games?

Main Question: What is the basis of vehicle implementation?

P.S. I dont think its important to mention but the game is 2D and top-down perspective, so i guess GTA 2 can be a close reference to what i wanna do, although the gameplay is very different, but ye, the vehicle implementation i want is similar to GTA 2 although i only plan to do a space ship for now.

sentences:
Unity C# Object Scaling when parenting by script How do I make it so an object doesn't scale with another object that I parented it with by script? If anyone knows how to get around this I would really appreciate it.

This is the part of the script I used for parenting:

arrowToObjAnchor.transform.parent = hitTransform;

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:
What language to use to create a browser-MMO? I have a game ready to be implemented (Class Diagrams and other UML stuff are good).

Here are some characteristics:

MMO.
Browser game and download-game.
Multiplatform.
With 2D graphics.
Real time.
Point-and-click.
With an online database (duh!).

What language should I use?

sentences:
Unity2D: Item selection previous button not working! I'm having a problem with my item selection script. As you can see in the video, button 3 (when the previous button is pressed)  goes straight to button 1, instead of going to button 2 and then button 1. Can anyone help me with this issue! Thank you. My script is listed below;

int activeObject = 0;
public GameObject tool01, tool02, tool03, tool04, tool05, tool06;
public int max_number_of_objects;

// in the button press code
public void Right()
{

        // increment the active object, wrapping around to 0
        activeObject++;
        if (activeObject >= max_number_of_objects) {
            activeObject = 0;
        }
        // here's another way to do this that eliminates the conditional logic
        // just pick one of them - don't do them both
        // look up the modulus operator (%)
        activeObject = (activeObject + 1) % max_number_of_objects;
        RightActivateObject (activeObject);
}

public void Left()
{
    activeObject--;
    if (activeObject <= 0) {
        activeObject = max_number_of_objects;
    }
    // here's another way to do this that eliminates the conditional logic
    // just pick one of them - don't do them both
    // look up the modulus operator (%)
    activeObject = (activeObject - 1) % 1;
    LeftActivateObject (activeObject);
}
    // activate the selected object
void RightActivateObject(int activeObject)
{
    switch (activeObject)
    {
    case 0:
        tool01.SetActive(true);
        tool02.SetActive(false);
        tool03.SetActive(false);
        break;
    case 1:
        tool01.SetActive(false);
        tool02.SetActive(true);
        tool03.SetActive(false);
        break;
    case 2:
        tool01.SetActive(false);
        tool02.SetActive(false);
        tool03.SetActive(true);
        break;
    }
}

void LeftActivateObject(int activeObject)
{
    switch (activeObject)
    {
    case 0:
        tool04.SetActive(false);
        tool05.SetActive(true);
        tool06.SetActive(false);
        break;
    case 1:
        tool04.SetActive(false);
        tool05.SetActive(false);
        tool06.SetActive(true);
        break;
    case 2:
        tool04.SetActive(true);
        tool05.SetActive(false);
        tool06.SetActive(false);
        break;
    }
}

sentences:
Why my object Triggering too far? I have some issues with detecting the collision when OnTrigger2d, as you can see in my screenshot below, that actually too far from the object.

this my script
private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Obstacle")
        {
            anim.SetBool("isDeath", true);

            _GameManager.instance.GameOver();
        }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.tag == "Obstacle")
        {
            anim.SetBool("isDeath", false);

        }
    }
```

sentences:
Quaternion Translation I am writing a small game and I need some help with my quaternions.

If I have an object at rotation A (quaternion)

And I need it to be at rotation B (quaternion) in 10 steps how would I work out the step change?

For normal vectors I would do C = (B - A) / 10
And then each step simply add C to my position to move from A to B in 10 steps.
I don't believe this would work for quaternions so how do I do this?

Also there would be an infinite number of routes that could be taken to get from A to B, so I would like to calculate this for the shortest route.

I did find this http://wasted.nz/posts.php?topic=82629
But if this is correct then how do you apply the difference to the current rotation? and could this difference be divided by 10 to get the step difference?

If it helps I am using C++, DirectX 11 and Bullet Physics

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:
Unity: Edge of quad is dark. How do I avoid this? I have four quads together like this

These are just the default Unity quad from create\3d object\quad

the texture is white with grey borders on two sides and a black border on other two sides..

Lets zoom in..

How do I get rid of these black lines?

I am generating these bigger shapes out of quads and applying the texture using code...
I noticed that If I didnt change the material in code then there were no black lines.
So I made prefabs for each material, and am now spawning those in instead of changing a material on a quad. But I still get the same lines.
Also, if I drag the prefabs into the scene when the game is running they appear perfect.
I have no idea whats going on.

sentences:
Unity : Android Button : Select (Highlight) by touch, before clicking I have a multiplatform game with dozens of buttons in many menus.

I used the animated buttons setup to have a normal state and highlight state. Highlight will most of the time resize the button with a nice anim AS WELL as make a dedicated text box appear with extra information. So far so good. Everything works perfectly on PC.

However, as I am testing my build on android, I cannot find how to access the "highlight" state since touching the screen = click and it execute the on click () associated.

What I need is a way to select a button when it is first touched, since selected = highlight (somewhat) then if it is touched (clicked) a second time while selected then to do the on click ( ) function.

I have a few theory on how to do it, but it would require recreating every of my 80 or so buttons as well as changing everything from using the Unity GUI system to make my own C# version which would take weeks.

I am also trying a few other way to achieve the same thing. One of which is using the "button.select()" to select the button on its first click. That works. problem is I cannot seem to write a way to do:
"if (thisbutton.IsSelected == true)" that just refuses to work.

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:
How to know if the player is signed in? I was wondering if there's any way to know if the "player" is signed in or not?

Something like this:

if (GamePad.GetState(PlayerIndex.Two).IsConnected && !Gamer.PlayerTwo.IsSignedIn)

So that the controller is connected and it can be used, but the player is not signed in to an account. Something like a guess.

sentences:
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: Making color of sprite darker or lighter Is there any way to make a sprite darker or lighter in AndEngine? I dont want to use the alpha thing. Nor I want to loose the texture/design of the image.

sentences: SDL2 for hardware accelerated graphics? I am attempting to make a 3d game using SDL2 just to learn and have a bit of fun. I was wondering if there is any way to get SDL2 do calculations on GPU. I have read that SDL2 Textures uses GPU for calculation, but is there any way to get it to do calculations from my functions using GPU? For example, if I have a function multiplyVectorWithMatrix, and there is a bunch of additions going on in that function, how would I get SDL2 to do those additions using GPU rather than CPU?

sentences:
Is there a way to convert shader graph to shader code for older version? Editing Shader in a graph is brilliant feature, however it's only works in Unity 2018 with Lightweight RP template.

So I want to use the shader made from shader graph in Unity 2018 to older versions, such as 2017 or 5.x.

There is a button to compile the shader to code but unfortunately when I drag into 2017 it gives me syntax error so I can't use it.

Is there a way to use the shader made from Unity 2018's graph editor to older versions of Unity?

sentences:
cocos3d versus Unity for simple IOS 3D games? Wondering if anyone here happens to have experience in doing some simple 3D based games/apps for IOS, using cocos3d & Unity and could give some pointers....questions I have are:

GENERAL

1) It seems currently cocos3d has the most traction in terms of a free 3D games engine for IOS development?

2) If one wanted to step up from the free IOS games engine, to a commercial one it would seem Unity is a popular choice, however you would then not really be doing apple/objective-c development, but rather unity development and pushing a button to pop out an IOS deployable artifact correct?

FOR MY SPECIFIC REQUIREMENT - If I was interested in doing the following:

develop a relatively simple 3D application for iPhone/iPad
have a small 'world' such as a room with a few basic items in it (table, cupboard)
ability to 'drop' a basket ball in the room and have it bounce around based on a physics engine & perhaps some user input (not sure what, lets say control wind direction)
monitor it and react accordingly - e.g. say if it goes into a net which is in the room then add a point to the scoreboard

At a high level how would one do this using Unity versus using cocos3d, for example:

3) Which would be quicker to develop such a basic iPhone/iPad game/simulation out of Unity/cocos3d?

4) Would 'building your world/room' approach be different? Like in Unity would you build tables/cupboards within a Unity IDE which would make it very quick, whereas with cocos3d would you have to do this programmatically?

5) Would the programming aspect of letting the ball go and monitoring it be different between the two? Or would you roughly in both cases just be setting up world, release ball in certain position, and then engaging physics engine?

6) Any advice/guidance re which tool/approach to use? (Unity versus cocos3d)

7) Re using cocos3d for my requirement, what additional tools would you recommend above/beyond XCode? (e.g. just perhaps some sort of 3D design tool to help model the room and import/save somehow for us in cocos3d)

Basically I'm a hobbyist iOS developer who wants to do some 3d, so the concept of using a free/open-source approach such as cocos3d sounds great as (a) it's free, (b) keep using existing skill set re objective-c etc, BUT the biggest unknown to me is whether by chosing cocos3d would I be giving myself say 20 hours of work to develop a 3d app/animation that could be developed in 1 hour in one of these commercial product (e.g. Unity)?

sentences:
Approaches for storing grid-like information I am drawing this simple grid on my NodeJS server:

var grid = [];

for(var x = 0; x < 20; x++){
    grid[x] = [];
    for(var y = 0; y < 20; y++){
    grid[x][y] = 0;

    }
}

console.log(grid);

The outcome looks like this:

I know, pretty right?!

0 is supposed to indicate FREE, thus if a player requests to move to a field with 0, he will!

The problems come when I want to add more then just Free/Occupied, for instance I would like to give each Array Element an ID number for the Client Updates, or certain features on the field to be stored.

I tried to assign { something: N, something2: N}

But thought it looked rather performance expensive in the long run. (On a big Grid)

I read about using a single Object for several elements, but I cannot find this any more..

Should I perhaps use an Array of Objects, or an Additional Array inside each X,Y element?

Any performance / convenience / anything goes   tips are welcome :D

Edit:
Thank you for the ideas so far, I was now thinking to perhaps using Strings. Storing Variable_A + "," + Variable_B   and then later using the .split to use the information. Any thoughts on this?

sentences:
Sfml: Sprite scale transformation animation Is there any way to animate a transformation on sf::Sprite like setScale or setPosition?

ie: sprite.setScale(0.5f,0.5f);. I want the transition between normal and half scale be smooth.

Thanks!

sentences:
Efficient Sprite Batching Am considering porting over from XNA to the Stage3D API's (Molehill).
So as a performance examination I've implemented sprite-batching, but the performance is not all that great, while with XNA i can easily draw up to 500 000 quads but with my Molehill implementation i can draw around a measly 1000 quads and while a rather dramatic performance difference was expected on the CPU side this is due to being GPU bound.
So currently the implementation is as follows.
set render states

let texture be null
let batchSize be arbitrary

for each sprite in queue
    if texture is not sprite texture
    or buffers are full

        upload vertex data to index buffer
        upload index data to vertex buffer

        bind texture
        draw triangles

        flush vertex data
        flush index data

    add sprite vertices to vertex data
    add sprite indices to index data
end

upload remaining vertex data to vertex buffer
upload remaining index data to index buffer
draw remaining triangles

flush data

The bottleneck is uploading the buffers, but as for a better implementation I'm hoping for a discussion here.
Cheers.
Revision:

One optimization that comes to mind is to persist the index buffer, since the indices are predictable and will always follow the same format. Am going to benchmark that now.

Caching the index buffer had no noticeable performance gains, so in an effort to try to understand where the bottleneck is, I ported it over to C#/XNA, ever so slightly slower than Microsoft's implementation but still has a GPU capacity over 500 times more than the Molehill implementation.
Is Molehill simply an extremely bad abstraction layer?

sentences:
How can I test if my rotated rectangle intersects a corner? I have a square, tile-based collision map. To check if one of my (square) entities is colliding, I get the vertices of the 4 corners, and test those 4 points against my collision map. If none of those points are intersecting, I know I'm good to move to the new position.

I'd like to allow entities to rotate. I can still calculate the 4 corners of the square, but once you factor in rotation, those 4 corners alone don't seem to be enough information to determine if the entity is trying to move to a valid state.

For example:

In the picture below, black is unwalkable terrain, and red is the player's hitbox. The left scenario is allowed because the 4 corners of the red square are not in the black terrain.

The right scenario would also be (incorrectly) allowed, because the player, cleverly turned at a 45* angle, has its corners in valid spaces, even if it is (quite literally) cutting the corner.

How can I detect scenarios similar to the situation on the right?

sentences:
Real-Time Terrain Deformation I can't really find anything at all on this topic. There's a bunch of YouTube videos that show people doing it, but there aren't any articles that I can find explaining the mechanics of it. In my game, terrain is loaded from a .RAW heightmap, and saved to a .RAW heightmap. But the player will be able to modify the terrain. I don't really understand his this terrain deformation works, but so far, I've only created things using vertex buffers which as far as I know can't be changed efficiently. Here and there I've read a few things about GPU tessellation and compute shaders. I understand tessellation and I can do that, but there's also very little I can find about compute shaders.

Are there any good books or websites that explain these things in detail? I'm not really looking for tutorials, because they tend to be pretty specific. But I really just want anything to bring me out of the dark on this subject.

sentences:
How to sort polygons without a depth buffer Please help me getting understanding how did they sort polygons in old games from the eighties.
They did not use z-buffer or anything like this, thats for sure.

Please look at the screenshot. How would one decide that the green surface should be drawn after the table polygons?
The center of the table surface is closer to the viewer from object center, closest vertex point of view. The green surface has the farthest Z. Oh, this big gray table is not split into smaller polygons.
How did they know to draw the green poly after the big gray table surface?

sentences:
Version Not Final, Does Not Represent Actual Game Footage? Just curious about this.  Frequently, a lot of gameplay videos from big studios have small subtitled text at the lower part of the screen, reading something like:

Pre-Alpha Gameplay -- Footage not Final
Game Footage not Final
Pre-Alpha, Game here is not final

Is there some sort of reason they do this?  Is there some sort of legal ramification that they need to go through by adding this?   I have especially seen some gameplay vids whose titles are "Alpha x.x.x", yet still, in the video itself, it always something like "footage not final, game may change".

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: 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: Game state from Web to iPhone version? I'm currently in the planning stages for an Web and iPhone game. I'm developing it with Adobe AS3/Air. I was wondering if it's possible for people to be able to play the Web version, save their state of play and then pickup again where they left of on the iPhone version? (and visa versa) how that would be achieved? the Web version will probably be on Facebook, so could I link both versions through their FB UID?

sentences:
Animator Panel in Unity - Where is "Entry"? I am following a tutorial on Unity, and I saw a screenshot like the following:

When I reproduced the steps of the tutorial, I realized that the green "Entry" box was not present on my screen. I have been thinking why this could be and the only reasons that I could think of are:

The tutorial skipped a step
I have something misconfigured
In the latest version of Unity that box has been erased or replaced

Which one is it? Did I forget a 4th option?
PS: If it is option #3, could someone explain me what was this feature for, and what has it been replaced with?
UPDATE I am using Unity 4.6.2f1

sentences:
What is the right process to get compatibility or at least a workaround for the ‘Threaded optimization’ feature of NVIDIA? It's peculiar this issue is not well understood on NVIDIA forums and project forums.

For example, the well known ioquake3 project based on id tech 3 requires to force 'Threaded optimization' off on the NVIDIA settings or there are severe FPS drops.

Do you know what a programmer has to do to acquire compatibility with the feature or at least a workaround to not get issues with it (e.g. turning it off explicitly via the application or other means)?

--

The main importance is that such projects get issues with it by default since not all users know they have to explicitly turn off the feature.

sentences:
self extending factory: return type and serialization I'm trying to implement a better management for the objects in my game project.
With input from another thread here on S.O., I decided to implement different collections for different types for better access. Seems to be a common way. So far I #included all the class files and added containers (just maps right now) for each type I needed/wanted, as well as functions to create/add/remove etc., that take care of what is needed. That way no free objects exist (object's constructors are private) that could be missed somewhere.
But ofc that means for every new type the container/manager/factory needs to be modified and that's error prone. So I wanted to try and make it self extending with a registration like this:
template<typename ObjectType>
class Registration
{
    public:
        Registration(const std::string& typeID)
        {
            EntMan::getInstance()->registerTypeCreator(typeID, [] (Properties* props)->Entity* {return new ObjectType(props); } );
        }
};

saving it in a std::map<std::string, std::function<Entity*(Properties* props)> >. This works, ofc it's a common pattern, but has especially one flaw: the return type.
I could add as much additional containers, defined by tags for example, as I want (shurely helps with iteration/preselection), but the contained items would always be just base class pointers.
So if I get an item I still would need to dynamic_cast (or static_cast with if(object->getType == "someThing") ) it to the derived type to get full derived access to the object. Seems wasteful and error prone.
Integrating all functionality with virtual functions would solve this, but in the end turns the base in a kind of blob class. Doesn't feel right either.
Let alone the fact that it would also be also pretty horrible for data locality. Not my main concern right now, but maybe will be in the future.
I'm a bit uneasy with the Properties "parameter amalgamation"-workaround aswell, to fullfill the std::function criteria of having the same signature, as it's a bit error prone doing it "by hand" for example, but should be less of a problem once it's abstracted away with parsing those as prefabs from files and
accessing those. Still, it also would mean a lot of wasted space to save those as prefabs...
So I'm at my wits end here.
How could I go on from here, if I need...

different collections for different types (for preselection)
acessors delivering the proper derived types (for avoiding casts and blobs)
self extending, no modification needed just for adding types
serializable use (ie: create("stone") for use with parsing functions of xml data etc. )

Can this be done? Or is this a dead end? No good idea at all?
Thanks in advance for any help.

sentences:
Moving while doing loop animation in RPGMaker I made a custom class to display character portrait in RPGMaker XP
Here is the class :

class Poser
  attr_accessor :images

  def initialize
    @images = Sprite.new
    @images.bitmap = RPG::Cache.picture('Character.png') #100x300
    @images.x = 540 #place it on the bottom right corner of the screen
    @images.y = 180
  end
end

Create an event on the map to create an instance as global variable, tada! image popped out. Ok nice. But Im not satisfied, Now I want it to have bobbing-head animation-like (just like when we breathe, sometimes bob our head up and down) so I added another method :

  def move(x,y)
    @images.x += x
    @images.y += y
  end

  def animate(x,y,step,delay)
    forward = true
    2.times {
      step.times {
        wait(delay)
        if forward
          move(x/step,y/step)
        else
          move(-x/step,-y/step)
        end
      }
      wait(delay*3)
      forward = false
    }
  end

  def wait(time)
    while time > 0
      time -= 1
      Graphics.update
    end
  end

I called the method to run the animation and it works, so far so good, but the problem is, WHILE the portrait goes up and down, I cannot move my character until the animation is finished.

So that's it, I'm stuck in the loop block, what I want is to watch the portrait moving up and down while I walk around village, talk to npc, etc.

Anyone can solve my problem ? Or better solution ? Thanks in advance

sentences:
Use "Google Play Game Services" (Multiplayer feature) with LibGDX I'm developing a simple game (for Android, using LibGDX Framework) and I would like to implement multiplayer feature to it. So, since the main project with the logic of the game in LibGDX is separated from the android project, I have created an interface to allow my game to call the GPGS API in order to implement its services. But, it doesn't work. Have someone an example to show me how to do this? However, this is what I have done (premise: GPGS SDK is already installed and its library is linked to my Android project):

Copy the GameHelper class of BaseGameUtils (downloaded from Google) in my Android project.
Make the interface in the main libgdx project
Create a class (named MultiplayerOperations) that implement the interface, in my android project. This class is more similar of the BaseGameActivity available in the BaseGameUtils.
In the activity of my Android project a make an object of the last class type and pass it to the constructor of the main libgdx project.

mpOperations = new MultiplayerOperations(this);
mpOperations.onCreate();

initialize(new CloseWall(mpOperations), cfg);

When I start the application, it doesn't work and it exit with an exception.

sentences:
How to configure A* for large 2D Grid based pathfinding, where paths could be long or short? I thought A* was Optimal, meaning I'd always get the quickest path.

I have written a generic Pathfinding implementation here:
https://github.com/mGuv/mGuv/blob/PathPerformanceExperiment/mGuv/mGuv/Pathfinding/Pathfinder.cs

It's a bit messy/weird as I've branched off my original to fix some issues and experiment.

I wrote a testing class that can read in an image file that uses Black for Obstacles, Blue for start, Green for goal. It too is a little messy but I'm just debugging again.

http://hastebin.com/wikejexige.avrasm

So it uses Euclidean Distance and Orthogonal movement to attempt to path.

It then generates an output image, with Black for Obstacles, Blue for the Path found, Orange for the Nodes Expanded, and Cyan for the Open Set.

Given the input image:

It outputs:

Which is less than Optimal?

I've tried tweaking the cost/heuristic functions and their weighting.

Eventually I can get something like:

But now look at that open set, it's essentially turned in to Dijkstra's Algorithm.

I also believe I have the "Breaking the tie" problem, as an input like:

Will expand way more nodes that necessary:

I've tried to follow the Wikipedia article on A* to come up with better cost handling but most of those assume you know the estimated path length. Which is difficult for me as I will be using this to path find on giant (1024x1024+) grids that are dynamic. From tiny (<10 step paths) to huge (> 10000 step paths).

I'm a little lost now as to where I'm going wrong. I don't know if there's a bug or a misunderstanding. I apologise for the tiny images, it was just easier to work a pixel basis.

sentences:
Should a system be able to render things? (ECS) I'm currently building an entity component system and I just have one question... Should a system be allowed to render things to the screen?

For example, should I make a SpriteComponent that contains a Sprite, and then create a SpriteRenderSystem that renders the sprite to the screen? Or should rendering entities be managed by something else entirely?

The reason I ask is because I've read in many forums that allowing a system to render is a bad idea. But I just don't understand why this is; If game objects in my game are represented using the ECS, how else would I go about rendering objects to the screen?

sentences:
How do I structure a 2D platform level? I'm doing a 2D platformer but I don't know how they are usually built.

The approach I'm looking at is making it tilebased, with ground tiles on bottom row, then platforms on some places in "mid-air" within the array.

Then some physics to add gravity to pull the player down if airborn, and just scroll the map horizontally and check for collisions.

Am I on the right track? Thank you.

sentences:
MonoGame hosted in a control/form I would very much like to host my monogame window inside a Form so that I can take advantage of the nice gui elements in the C# framework when creating a simple level editor. I have looked online, but I am unable to find any working examples on how to do it. What is the state of this? Is it possible? I am using window 8.

Regards,

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:
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:
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:
How to change the time dilation using C++ in Unreal Engine? I searched a bit and found a blueprint solution which does this but I've just started using Unreal and I prefer C++ instead of this visual programming thingy.

I'm looking for a Unity-like Time.timeScale property which could be easily set during runtime.

Is there a thing like that in Unreal?
I just want to play with changing the speed of time of the whole world.

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:
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:
Default Animations is not playing again when the object is set inactive and made active again in my game I have a default animation added through animator. The default Animation is now stops working after playing once. In a non looped Animation clip, When the Object is disabled by setting it's SetActive false, then the default animation doesn't play upon reactivating the object. See the following package. When you open it in Unity 5.5 then Animation play fine but in Unity 5.6 Default animation plays only once

File To download

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:
What resolution should I render art for a 3D game for PC? I hope this is not too stupid a question. I'm making my first game for PC and I'm wondering what resolution I should render the artwork at. It will be a fixed-perspective game, so I'm using a 2D background with 3D characters moving around.

How big should I render the background? Is 1920x1080 enough these days or should I go even higher? How big should the character textures be?

Thanks a lot!

sentences:
Should my GLSL Shader object/wrapper encapsulate loading/setting a VertexArrayObject? I am working on a 2D game in C++, with a simple rendering layer over OpenGL.

I have a wrapper for GLSL shaders and shader programs, these wrappers encapsulate shader objects into C++ classes and automatically handle loading/compiling/linking and using shader programs.

VertexArrayObjects, it seems to me, are basically a collection of configuration settings to use with a particular ShaderProgram.

My question is: Should I encapsulate VAO's within my ShaderProgram objects, or within the Sprite objects? Does a VAO change on a per-shader basis or do I need a new VAO for every type of drawable object? If the latter, do I need one VAO to draw all Sprites (each containing 4 vertices, a position/orientation etc), or one VAO per sprite object in the game?

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:
Irradiance Map ( Irradiance environment map)? As irradiance map is generated for every possible normal for all the texels in environment map (as every texel act as a light source) so that we can look up irradiance map, based on normal of fragment to find out its resulting illumination.

When Irradiance map is generated, does it get generated for every object in the scene to capture all possible normal and then eventually combined in a single texture?
Is there any example code to create irradiance map and use it to light the scene?
Any one has an example of CG-shader for reading irradiance map?

Thanks

sentences:
Duration in ScaleModifier andengine I want to scale an image before screen resume in AndEngine so I have applied the following code to my sprite:

ScaleModifier scaleDrag1 = new ScaleModifier(1, 1, 0.7f);

drag1.registerEntityModifier(scaleDrag1);

But my issue is that the scaled image is shown when the screen resumes because of the 1 duration. It makes my sprite scale after the screen resume so the scaling is visible to the user, I tried setting the duration to 0 but then that sprite is not shown.

Can anyone tell me what should I do to scale image before resume in AndEngine.

sentences:
Drawing tile images with bigger height on floor tiles on 2.5D isometric map Hello I am creating my first isometric game.
I have floor tiles which are 112*56 in size.
This is a simple strategy game I am making, it's an existing game, I just copied the idea for practice since I don't have anything else to do.
Each game object should be located inside the floor tile, like floor tile is the base, it can't be outside of it. All entities will be inside one floor tile, or separated.
When I try to place a rock in tiles[0][1], this happens:

(source: gyazo.com)
When I try to place it at tiles[9][9] (corner) this happens (With red borders, so you can see offsets):

(source: gyazo.com)
I am not really sure what creates this big padding when the tiles go further. The further they are, the bigger padding they will have from the tile I think.
I use this formula to locate tiles:
    int x = (this.x * width / 2) - (this.y * width / 2);
    int y = (this.x * height / 2) + (this.y * height / 2);

x = i
y = j

I've tried making offY variable, where it does imageHeight - floorTileHeight = 18, and then do int y = offY - (... formula for y ...) but no luck, the position is always randomised. Works for one position, won't work for further position.
this is the water floor tile (112x56):

this is the rock tile (112x74):

I've added red borders so you can see how big it is.
What is causing this padding between tiles when I place them?
EDIT
I am using Slick2D game library.
EDIT 2
In my program, my graphics are separated into Layers. Each layer implements Layer.
I have the layer Board, which is responsible about everything that happens on the board, the floor, it's entities, and nature objects.
That layer Board, has 2 more sub-layers in it, Nature and Entity.
Currently I am having problems with the Nature layer, which is responsible for drawing nature objects like Rocks, flowers, and more.
public class Nature implements Layer {

    private Tile[][] tiles = new Tile[15][10];

    public Nature() {
        tiles[9][9] = new Tile(9, 9, 0, 0, Tiles.ROCK);
//      tiles[0][0] = new Tile(0, -22, Tiles.ROCK);
//      tiles[0][1] = new Tile(0, -22, Tiles.ROCK);
    }

    @Override
    public void render(Graphics g) {
        for (int i = 0; i < this.tiles[0].length; i++){
            for (int j = 0; j < this.tiles[1].length; j++){
                Tile tile = this.tiles[i][j];

                if (tile == null)
                    continue;

                tile.render(g);
            }
        }
    }

    @Override
    public void update() {
        // TODO Auto-generated method stub

    }

}

The actual tile class which does the drawing:
public class Tile {

    private int offX;
    private int offY;

    private int x;
    private int y;

    public TileSprite sprite;

    public Tile(int x, int y, Tiles tile) {
        this(x, y, 0, 0, tile);
    }

    public Tile(int x, int y, int offX, int offY, Tiles tile) {
        this.x = x;
        this.y = y;
        this.offX = offX;
        this.offY = offY;
        this.sprite = new TileSprite(tile);
    }

    public int getOffX() {
        return this.offX;
    }

    public int getOffY() {
        return this.offY;
    }

    public TileSprite getSprite() {
        return this.sprite;
    }

    public int getWidth() {
        return this.sprite.getSprite().getWidth();
    }

    public int getHeight() {
        return this.sprite.getSprite().getHeight();
    }

    public void render(Graphics g) {
        int width = this.getWidth();
        int height = this.getHeight();

        int x = (this.x * width / 2) - (this.y * width / 2);
        int y = (this.x * height / 2) + (this.y * height / 2);

        x -= width / 2;
        y -= height;

        g.drawImage(this.sprite.getImage(), x, y);
    }
}

sentences: Is Opengl 2.x still usable? i've used opengl core profile for a while now and i was wondering if it was possible to create a "decent" application (like a game/game engine) with good graphics. I have a machine which can run only OpenGl 2.1(raspberry pi3), i already know the advantages of core profile, but is Opengl 2.x still usable for today's standards?

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:
Configurable Joint: how to create a FixedJoint, and Rotating it? I have 2 rigidbody, in 2d view, non kinematic, and with no gravity, and want to connect them with a Configurable joint. I don't want the joint to be spring (I want the same distance always). But I would like to move the blue object left / right (rotating it around the red one)

How can I setup my Configurable Joint ?

Thanks you !

sentences:
glm::perspective isn't working? So I'm learning how to make games and program, and while trying to setup a projection camera using GLM in GFLW, this line of code refuses to work and I can't figuire out why. The code is in the image below.
                                                 Thanks!

sentences:
Unity build does not launch and leaves no logs/errors I have released my first title Audio Infection ( https://store.steampowered.com/app/911580/Audio_Infection/ ) for a bit over a year ago. Recently 1 user has so far encountered an issue where the game does not launch. He is the only user that encounters this problem.

He has this issue on both Win 7 and Win 10. His system specs are fine and his drivers are up-to-date. The game does not leave a log file, rather it looks like it is unable to boot. There are no Windows error reports on it either. I watched it through Discord screenshare because I could not properly understand his issue.

I had asked a few other random people to test my game and demo (he has the issue with both, the demo and full version) however no one else (including me) is able to reproduce this behavior.

At this point I have tried:

updating Unity from 2018 to 2019 (no change in behavior)
added manual logging (with no results)
updating drivers (on his system)
installing Visual C++ (on his system)
empty project with Unity sample scene (he was able to load the sample scene!)
deleting crashhandler.exe (used to fix similar issue in the past based on older threads)
modifying files
deleting and downloading the files

What else can I try in order to figure out what is causing the issue? I am honestly clueless. Since the sample project was able to boot on his system there is definitely something wrong with the build on my end. However he is the first person with this issue. It doesn't even get to the point of launching on his system and it can't be found in the memory either. It is almost as if Windows is blocking it from launching, however that is not the case. But the result is very similar to that.

There is a free demo on the store page available in case you want to see if it boots on your system. It works for both VR and non VR systems. When no VR devices are detected all VR related contents are disabled. This has been thoroughly tested and worked on loads of different Windows systems with different specs, with VR and no VR.

Once again, there are no errors, no logs, the build doesn't even make it to that point, yet that exact same build works for literally everyone else on various systems. I am absolutely clueless about what to do in order to resolve this issue. Any help/advice or pointers towards the right direction are greatly appreciated!

PS: he is not a troll, I have known this guy for a long time now and he genuinely wants to support me.

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:
Different aspects of games development I am and have been quite interested in programming games for quite a while now, however an interesting question I've thought about lately is what do I want to specialize in?

After doing some research I found that game developers/programmers could specialize their skills in quite a few fields such as:

AI
Interface design
Game engine development

There are even some who focus on optimizing network code in the case of online multiplayer games. So I guess my question would be, what other aspects of games programming exist that I could focus on? What would be the ones that are more valued and would increase my chances of being employed in a well paying company?

sentences:
Detect which monitor an SDL window uses I have some SDL code that, before creating a Window and a Renderer, detects the display DPI using SDL_GetDisplayDPI, to properly scale textures late on for different types of monitors (for instance my MacBook Pro's monitor returns a DPI of 258, while my external Dell monitor returns 93).

When I use 2 monitors, SDL_GetNumVideoDisplays properly returns 2, but I couldn't find any function in SDL that would get me which monitor the window is running in, to call SDL_GetDisplayDPI with the correct index, nor any way to detect when the window is dragged from one monitor to the other.

Is there a way to do those things in SDL, or is there a tutorial somewhere that would explain how to do that (hopefully in a platform-independent way)?

sentences:
Unity gravity not effecting everyone like it should so My problem is a bit weird. I have a model that will not fall at the correct speed. She falls incredibly slowly. This is the only script attached to her, and I did the "Scale to large" test by placing a box next to her and letting them drop at the same time. The box fell instantly to the ground and she just kind floats taking her time.

Gravity is on kinematic is off, I'm out of ideas and could use some help. :D!

Thank you.

This is unity in c#.

using UnityEngine;

using System.Collections;

public class PlayerController : MonoBehaviour {

// public variables
public float speed = 1.5f;
public float JumpH = 1.5f;
public float RotateSpeed = 30f;

//pivate component checks
private Animator animr;
private Rigidbody LillyRB;

//private generic bits.
private bool checker;
private float movever;
private float movehor;
private float turn;

void Start (){
    LillyRB = GetComponent<Rigidbody> ();
    animr = GetComponent<Animator> ();

}

void FixedUpdate () {

    // movevertical and move horizontal check for player input wasd
    // jump checks for jump/spacebar.

    movever = Input.GetAxisRaw ("Vertical");
    movehor = Input.GetAxisRaw ("Horizontal");
    turn = Input.GetAxisRaw ("mouse x");
    Quaternion rot = LillyRB.rotation;

    Quaternion Exturn = Quaternion.Euler (0.0f, RotateSpeed * Time.deltaTime *  turn + rot.eulerAngles.y, 0.0f);

    if (movehor != 0 || movever != 0) {
        checker = true;
    }
    else {
        checker = false;
    }

    animr.SetBool ("IsMoving", checker);
    LillyRB.MoveRotation (Exturn);
    LillyRB.MovePosition (LillyRB.position + (transform.forward * movever));
    LillyRB.MovePosition (LillyRB.position + (transform.right * movehor));

}

}

sentences: Is it OK to use 6-7k texture map in Unity? I want to unwrap all my car into one texture (interier, wheels and e.t.c), so for better quality i need to use one big 7k texture. Is it OK or the better choice is to make smaller ones for groups ?

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:
Understanding how OpenGL blending works I am attempting to understand how OpenGL (ES) blending works. I am finding it difficult to understand the documentation and how the results of glBlendFunc and glBlendEquation effect the final pixel that is written.

Do the source and destination out of glBlendFunc get added together with GL_FUNC_ADD by default?

This seems wrong because "basic" blending of GL_ONE, GL_ONE would output 2,2,2,2 then (Source giving 1,1,1,1 and dest giving 1,1,1,1).

I have written the following pseudo-code, what have I got wrong?

struct colour {
    float r, g, b, a;
};

colour blend_factor( GLenum factor,
    colour source,
    colour destination,
    colour blend_colour ) {

    colour colour_factor;
    float i = min( source.a, 1 - destination.a );

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendFunc.xml
    switch( factor ) {
        case GL_ZERO: colour_factor = { 0, 0, 0, 0 }; break;
        case GL_ONE: colour_factor = { 1, 1, 1, 1 }; break;
        case GL_SRC_COLOR: colour_factor = source; break;
        case GL_ONE_MINUS_SRC_COLOR: colour_factor = { 1 - source.r, 1 - source.g, 1 - source.b, 1 - source.a }; break;
        // ...
    }

    return colour_factor;
}

colour blend( colour & source,
    colour destination,
    GLenum source_factor, // from glBlendFunc
    GLenum destination_factor, // from glBlendFunc
    colour blend_colour, // from glBlendColor
    GLenum blend_equation // from glBlendEquation
    ) {

    colour source_colour = blend_factor( source_factor, source, destination, blend_colour );
    colour destination_colour = blend_factor( destination_factor, source, destination, blend_colour );
    colour output;

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendEquation.xml
    switch( blend_equation ) {
        case GL_FUNC_ADD: output = add( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_SUBTRACT: output = sub( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_REVERSE_SUBTRACT: output = sub( mul( destination, destination_colour ), mul( source, source_colour ) );
    }

    return output;
}

void do_pixel() {

    colour final_colour;

    // Blending
    if( enable_blending ) {

        final_colour = blend( current_colour_output, framebuffer[ pixel ], ... );
    } else {

        final_colour = current_colour_output;
    }

}

Thanks!

sentences:
What is the purpose of the Allocation Callstacks button in Unity's Profile window? I have an idea of what this button does, but I cannot find any specific information in the documentation.

What information does this button add to the profiling data? How can I see this extra information?

sentences:
Why is chunk size often a power of two? There are many Minecraft clones out there and I am working on my own implementation. A principle of terrain rendering is tiling the whole world in fixed size chunks to reduce the effort of localized changes.

In Minecraft the chunk size is 16 x 16 x 256 as far as I now. And in clones I also always saw chunk sizes of a power of the number 2.

Is there any reason for that, maybe performance or memory related? I know that powers of 2 play a special role in binary computers but what has that to do with the chunk size?

sentences:
Texture won't appear using a vector of unique pointers of an Object I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m using:

    std::vector<std::unique_ptr<Bullet>> b;

    while(win.isOpen)
    {
    //Getting Key Press
    if (Keyboard::isKeyPressed(Keyboard::Space))
    {
        space = true;
    }
    else
    {
        space = false;
    }
    if (space)
    {
        Bullet b1;
        b1.setPos(player.getPosition());
        b.push_back(std::make_unique<Bullet>(b1));
    }

    for (auto& it : b)
    {
        //Keep Updating
        it->update();
    }

    //Bullet out of Screen
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i]->getPos().y < 0.0f)
        {
            b.erase(b.begin() + i);
            i--;
        }
    }

    //Drawing Bullet
    for (auto& i : b)
    {
        win.draw(i->getSprite());
    }
     }

The game runs fine but the bullet’s texture won’t load. I’m assuming it has something to do with the vector but I don’t know how to solve it.
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();
void setPos(Vector2f pos);
void update();
Sprite& getSprite();
Vector2f getPos();
};

Cpp File:
     #include "pch.h"
     #include "Bullet.h"
     #include

Bullet::Bullet()
{
//Setting Texture
if (!t.loadFromFile("Graphics/bullet.png"))
{
    std::cout << "Bullet Texture Failed to Load\n";
}
else
{
    t.loadFromFile("Graphics/bullet.png");
    bullet.setTexture(t);
}

}

void Bullet::setPos(Vector2f pos)
{
//Setting Position
this->pos = pos;
bullet.setPosition(this->pos);
}

void Bullet::update()
{
pos = bullet.getPosition();

bullet.move(0.0f, -4.0f);

}

Sprite& Bullet::getSprite()
{
return bullet;
}

Vector2f Bullet::getPos()
{
return pos;
}

sentences:
How to force play area corners to Lighthouses in Unity I'm working for a guy that wants to recreate real environments in VR and superpose them for business demos. Think of one of those mall kiosks where you "enter virtual reality" and at first it looks exactly the same as regular reality until you start interacting with objects and the virtual elements start being superposed. Basically, AR in VR.

To do this, I have an exact model of the kiosk, but I need to be able to force the play area in vive and unity to be always the same and equal to the dimensions of the real space, so that my model can superpose the actual world objects. Is there a way to force the play area to be the same as the distance between the lighthouses?

Additionally, is there a way to force the lighthouses to never recalibrate after the initial setup(as it does when someone moves in front of them for example)?

sentences:
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: Does Minecraft Really Rely on CPU More Than GPU For FPS? I understand that Minecraft runs on Java which is very demanding on the CPU (garbage collection and JVM processes), but I still don't understand how FPS is the CPU's responsibility. Shouldn't the CPU handle game logic while the GPU handles rendering the results of that logic asynchronously? Minecraft was developed using OpenGL libraries afterall. But I still see a ton of people saying that upgrading your CPU is more worth it than upgrading your GPU if you want good FPS on Minecraft. What's actually happening under the hood?

sentences: 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:
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:
Black Box Functionality Testing Methods that apply to an MMO I've been interesed in a career in Video Game QA for a long time now. I've participated in roughly a dozen+ public/closed betas for different games, everything from FPS, MMO, MOBA and RTS, as well as a lot of early access Indie Games recently.

I'm not some 12 year old kid who thinks playing video games every day will be fun. I know it's tedius work with strict deadlines and a lot of pressure. I enjoy the analytical side of the process and I would like to make this passion a career.

I currently have a few upcoming closed beta weekends scheduled that I'm going to be participating in.

What are some ways I can use these to really improve as a tester?

Anyone in this line of work that would be willing to share some pointers for what type of experience people hiring for a QA job would be looking for, besides the obvious; analytical, attention to detail, communication, etc

Additional information: Feel like I should also mention that I have a lot of programming experience as well. I'm currently a Software Engineering major in my final year, but what I'm really interesting in is QA.

Thank you

EDIT:: I'd like to get this back opened so let me see if I can word this more appropriately.

What are some professional Game Functionality/UX Testing methodologies that I could apply to an upcoming Closed Beta Weekend event for WildStars or Elder Scrolls Online.

I'm looking for information that I could use to provide a thourough evaluation of game aspects that I could then include in a Resume or Testing Profile/Portfolio to show a potential employer "This is how I planned my session out, this is how I executed it and this is what I found."

I hope this is less open ended then my original post.

sentences:
How to create a joint, where the rotation of one object is relative to the other? I would like to create a top down view scene, with one rectangle (top) is on top of an other (base). There is a joint, where these two objects are connected.
The one on the top should be able to freely rotate, but if the base rotates, its rotation should be changed as well, because it should behave as if it is on top of it. If the joint is at the center of both objects, then the top one should rotate like this:
Δ top rotation = Δ time * ( top angular velocity + base angular velocity )

If the joint is not at the center of the objects, then it is more complicated than that. How is it possible to define a joint like that in Box2D?
This is a testbed example with the joint. Notice, that the top one is not rotating:
#include "test.h"

class RelJoint : public Test
{

    b2Body* base;
    b2Body* top;
    b2RevoluteJoint* m_joint;

public:

    RelJoint() {

        m_world->SetGravity(b2Vec2(0.0f, 0.0f));

        {

            b2PolygonShape shape;
            shape.SetAsBox(1.f, 0.5f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            body->SetAngularDamping(1.f);

            base = body;
        }

        {

            b2PolygonShape shape;
            shape.SetAsBox(0.5f, 0.25f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            top = body;
        }

        b2RevoluteJointDef revoluteJointDef;
        revoluteJointDef.bodyA = base;
        revoluteJointDef.bodyB = top;
        revoluteJointDef.collideConnected = false;

        revoluteJointDef.localAnchorA.Set(0, 0);
        revoluteJointDef.localAnchorB.Set(0, 0);

        m_joint = (b2RevoluteJoint*)m_world->CreateJoint(&revoluteJointDef);

    }

    void Step(Settings& settings) override {
        base->ApplyTorque(3.f, true);

        Test::Step(settings);
    }

    static Test* Create()
    {
        return new RelJoint;
    }

};

static int testIndex = RegisterTest("Joints", "Relative", RelJoint::Create);

I tried to combine b2RevoluteJointDef with b2FrictionJointDef. It looks promising, but unfortunately if I apply torque to the top body only, the base starts to rotate too, which I would like to avoid.

sentences: Hardcoding C++ shader interop code When writing code that interacts with multiple shaders, is it best practice to hard code the use of each effect? I wrote a couple of hard-coded loops and then noticed that I accidentally ended the pass of the wrong shader, and this has me concerned that instead, I should be writing some sort of Shader class that generically executes a shader. Is this the right way to go?

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:
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 prevent text rendering from looking ugly when in motion? I'm drawing a name above the player's head in a 2D top-down view game. The code to draw the string looks like this:

Vector2 textPos = new Vector2(
  (positionX * 2 * world.Map.TileWidth + (16 -(SmallFont.MeasureString(mName).X / 2))),
  (positionY * 2 * world.Map.TileWidth - 32));

spriteBatch.DrawString(SmallFont, mName, textPos, Color.White, 0, Vector2.Zero,
  1, SpriteEffects.None, 1);

The text is drawn to the position right above the player's head just fine, and it follows the player as he moves just fine as well. But the problem is that when the player moves, the text kind of gets thicker and ugly. I tried screen capping it but the screenshot doesn't capture the problem (because it's just taking a single frame, I presume).

How can I fix this?

sentences:
Concerns about Google Play Games security I want to develop a Android game using LibGDX. Let's take a classic example ; some player can battle another one in turn based matches. The outcome of match defines the reward in some ingame currency. There will be premium currency with in-app purchases, and both can be used to purchase some upgrades.

I am discovering both Android and GPG at this point. GPG allows some P2P turn battles, matchmaking and cloud saves, making it looks like quite the thing I need.

However, I have concerns regarding its security. The currencies needs, for obvious reasons here, to be fully secure, non corruptable by altering saves on the device. In the same way, it is my understanding that the turn based (and real time) matches are P2P, between devices.

My question is, what GPGS does to enforce security on both (cloud) saves and P2P matches ? Will I need to use some backend server for this case ? And if yes, how can I authenticate a player logged in GPG on this backend server ?

Thanks for any clues about that.

sentences:
How to make a model parts glow one after the another I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first part still remains.

public GameObject pons;
public GameObject frontallobe1;

void Update () {
    Invoke("PonsGlow",2);
    Invoke("frontalLobe1Glow",4);
}
void PonsGlow()
{
    pons.renderer.material.color=Color.red;
}
void frontalLobe1Glow()
{
    frontallobe1.renderer.material.color=Color.red;
}

sentences:
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: Global fog does not work with deferred rendering in Unity When I set deferred rendering the global fog from the Unity Standard Assets does not work, there is no fog at all. With forward rendering the global fog works. How do I add fog with deferred rendering?

sentences:
How can I resolve collisions a little better? I'm currently developing a physics engine and I'm not sure the best way to go about resolving my problem. I have a little box, that I can move around with in my scene.

When I'm resolving collisions, I take in the two bodies that are colliding, determine what both of their normal forces are and apply it to them (I also multiple it by a small number, if I don't I can't continue to walk around the scene).

Anyways, while I'm resolving the collision I do this:

a.Position -= a.Velocity;
b.Position -= b.Velocity;

I know this isn't a very good way to resolve the collision, but I'm just not sure how to do it correctly.

How should I go about resolve collision correctly?

Also, here is the whole method I use to resolve collision at the moment:

    private void ResolveCollision(Body a, Body b)
    {
        // Calculate normals forces (N = M * G)
        Vector2 normalForceA = this.CalculateNormalForce(a);
        Vector2 normalForceB = this.CalculateNormalForce(b);

        // Resolve collision, which is super buggy and obviously a bad idea.
        a.Position -= a.Velocity;
        b.Position -= b.Velocity;

        // Apply normal forces
        a.ApplyForce(-normalForceA * 11);
        b.ApplyForce(-normalForceB * 11);
    }

EDIT:

This is for a 2D game.

EDIT

Here is a video of what's going on when I applied TomTsagk's answer.

The video is here

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 can I update a Stage-based HUD from another Stage's Actor in libGDX? I feel like this is a simple problem, but I'm having issues finding the correct search terms.

I have a Screen that includes two Stages.

The first, stage, contains a number of objects deriving from Actor and added via the standard stage.addActor(Actor). This is for the actual game objects.
The second, hudStage, consists of a single Table actor. This table includes a button as well as two Labels. This is for the static user interface/HUD.

I'm handling touch events on my custom actors in the game stage like the following:

public class GameObject extends Actor {
    private final static String TAG = GameObject.class.getName();
    // ...

    public GameObject() {
        // ...

        addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log(TAG, "touchDown on GameObject actor: <" + x + "," + y + ">");
                return super.touchDown(event, x, y, pointer, button);
            }
        });
    }

This works perfectly and logs what I need. However, I would now like to update the HUD with information about the object the user touched.

My screen has defined the Label I want to update (added via hudStage), but I'm not sure how to go from an actor in stage to the screen, or to the hudStage label.

public class GameScreen implements Screen {
    Stage stage;
    Stage hudStage;
    // This is the label I want to update.
    Label infoLabel;
    // ...
}

I know I can call setText(String) on the label, but I'm not sure the best way to bubble the click up. Plenty of examples have simplified versions where objects are defined in the main class (in my case, GameScreen) and are able to refer to them that way, but I've already broken these apart.

I started to look at creating a custom event that my actor could trigger, and that the stage would handle, but documentation is sparse and I'm not sure this is required.

I've also thought about scrapping the idea of having a label in the hudStage and instead having my actor draw text where the HUD would have. However, from what I continue to see, I think Scene2D is the right direction to go for the UI.

Thanks!

EDIT: What I'm looking for:

An actor in GameScreen.stage is target of a touchDown event.
Logic in actor fires and updates object.
touchDown event in actor finishes by updating infoLabel in GameScreen.hudStage or updates String value in GameScreen (if easier, I'll go this route).

sentences:
Best way to add animated sprites to canvas in Unity In have a 3D world map, and I want to have a 2D UI with top nav/character thumbnail/stats/etc. overlaying it. I figured the best way to do this would be to use a canvas an embed all of UI stuff on it. For reference I'm going to be using this pack for the UI and this character as the thumbnail in case the issue I'm having is specific to these assets.

The character asset comes as a prefab that I tried to just drag and drop on to the canvas but it stays relative to the camera view (i.e. it looks really small on the canvas in scene view but bigger than all canvas elments in game view, and is positioned as it was relative to the world)

Heres some screenshot to help:

That tiny little dot inside the directional light is the sprite "on the canvas" next to the 3D world, you can see him in the camera preview. As you can see it's much smaller than the panel also on the canvas leading off screen.

Now when I hit play, he is much bigger than the canvas panel, and still positioned relative to the world:

Why isn't it treating the sprite like he is on the canvas, I tried setting it to the "UI" layer but no affect. It is nested under the canvas in the hierarchy.

Is there an easy way to make it act as a UI element while keeping the animations attached to him. And with the littlest effort as I'll be downloading many more of these sprites so I would prefer not to fully recreate them or anything.

sentences:
Inventory Item Exist checker I have a question regarding declaring my inventory. I made it a string named inventory, with a constant number as its max value. The thing is, I want the user to use an item if he / she gains an item. The problem is, I do not know what syntax should I use to determine if the user has an item and use that item. Here's my code I just started:

so declaring the inventory:

    const int MAX_ITEMS = 15;
    string game_inventory [MAX_ITEMS];
    int itemnum = 0;

I have some items like potion, antidote, gems and others. I use the:

game_inventory[itemnum++] = "Potion"

to place items in my inventory. If I want to use the potion, IF I HAVE one, how can i make a function to check whether I have a potion or anything and use it?

sentences:
How to handle back press in Unity? By back press on Android, I want to close all the open windows first then exit the game, I see everywhere it's suggested to check input key in Update:

void Update()
{
    if (Input.GetKey(KeyCode.Escape))
    {
        if (AreAllWindowsClosed())
            Input.backButtonLeavesApp = true;
    }
}

But my issue with this is that it's calling the code in every frame and also may handle a single press multiple times!

Isn't there a single BackPressed event in Unity for this simple task?

sentences:
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:
Simple coherent noise function to use in a GLSL shader I'm looking for a simple (but especially fast) coherent noise function to use it in a shader written in GLSL.

I don't need it to be excessively smooth or good looking, I just need that it has the following properties:

Passing in the same input value will always return the same output value.
A small change in the input value will produce a small change in the output value.
A large change in the input value will produce a random change in the output value.

I really need it to be fast, as it will be called once for each pixel by the GPU (to have an idea of how fast it should be, I tried Perlin Noise and it crashed my application).

What method should I use? I'd also like if the same pattern didn't repeat over time.

sentences:
In HLSL, what is the difference between "static const" and "#define" for constants? So far I've been declaring all my constant variables as static const in my HLSL code, yet virtually every single shader example I've come across uses #define instead.

I know the reasons I would I use static const in C++ over the preprocessor and I just carried it into HLSL as well. However, I'm curious if there are any side effects or pros/cons to this, besides the standard C++ "static const versus #define" arguments.

sentences: Pixmaps, ByteBuffers, and Textures....Oh my My ultimate goal is to take a specific region of the screen, and redraw it somewhere else. For example, take a square from the upper left hand corner of the screen and redraw it on the lower right hand corner, so that it is basically a copy of that screen section; kind of like a minimap, but at the same scale as the original. I have looked in to pixmaps and bytebuffers. Also maybe copying that region from the backbuffer somehow. Wondering the best way to go about this. Any help is appreciated. I am using opengl es and libgdx for what it's worth.

sentences:
OpenGL ES - DrawCalls count - bottleneck? I am newbie to OpenGL ES (so far, I used mainly DX11). Now for my scene, I have about 100 draw calls. I can use instancing, but only about half of objects can be instanced, so draw calls count would be about 50 - 60 / frame. Every object is max. 700 triangles (I use low-poly models)

What is some kind of limit of drawcalls per scene (targeting iPhone 4 like performance devices) ? So far I am running my code via ATI GLES on Windows, but there is a lot of power from my CPU and GPU.

Or is there a way, how to find bottleneck of my application ? I know gDebugger is for OpenGL, but with ES version it behave sometimes weird (a lot of warnings in calls I dont have in my code, so I suspect them to be from ATI layer code).

sentences:
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:
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:
Should I distribute shaders in a compiled form or in plain text? Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile?

I'm aiming to distribute this in a binary form or as plain serialized text, i would like a good suggestion on this.

sentences: Internet Access is always set to required in unity android player settings I am using unity 2019.4.2f1, I want to remove the internet access permission from the final android manifest file created by unity but, because this option is locked I am not able to remove the permission. Let me know if there is any-workaround to do so or disable this option somehow.

sentences:
Open source level editor for HTML5 platform game? A natty GUI editor is very helpful to create level map. I want to use some open-source choices rather than build my own from scratch. I found Tiled Map Editor but it doesn't work for what I want.

Though I'm building HTML5 game, I don't have to use a HTML5 level editor as long as it can output well-formatted map files which my javascript can read.

Edit:

Sorry for the confusion. Tiled does not work for me because to make the player perform a 'tricky' jump, sometimes I want to set the distance between two platforms to, say, 7/3 or 8/3 tiles. But in Tiled I get only 2 or 3. If Tiled can do this, please teach me.

sentences:
Environment collision in a pseudo-3d 2d space The game is a 2D brawler with depth movement in the vein of Golden Axe, Final Fight, Castle Crashers etc. Characters and environment are all 2d sprites as well. I've had no real issue setting up collision between characters to take the depth into account either.

However, it's just not a proper brawler without higher ground to jump to and pits to throw the enemy into, and that is where I run into a bit of an issue with how best to implement it.

I considered making the collision boxes for the level in the 3D space and having the sprites just translate the z movement of their game object into y movement of the visual component, but I don't particularly like that approach because it feels difficult to work with for doing the level design of matching 3D colliders to a drawn backdrop and placing objects in there.

Any suggestions for a design that is the 2D first, so to speak? Ideally being able to "paint" height levels and pits in the 2D design wise. If it matters, I'm working in unity with a primarily 2d space (though involving the third dimension here will be necessary), but I think the base design problem would be fairly engine/language agnostic.

sentences:
Generating 3D models / meshes In LibGDX how can I construct a 3D terrain model that has

Position
Normal
Color

The model does not require a texture, it is colored on a per vertex basis.
I've looked into LibGDX's ModelBuilder and MeshPartBuilder, but I can't seem to get it to work. I suspect this is a problem with indexing since I'm inexperienced on the subject.

So the question boils down to; In LibGDX, given positions (x, y, z), normals (nx, ny, nz), color (r, g, b, a) how can I construct a mesh / model with these vertex attributes and properly index them?

What I've tried so far:

final int attributes = Usage.Position | Usage.Normal | Usage.ColorPacked;
partBuilder = modelBuilder.part("Terrain", GL20.GL_TRIANGLES, attributes, material);

/*Generate vertices*/
for (int i = 0; i < VERTEX_COUNT; i++) {
    for (int j = 0; j < VERTEX_COUNT; j++) {
        final float x = j / ((float) VERTEX_COUNT - 1) * SIZE;
        final float z = i / ((float) VERTEX_COUNT - 1) * SIZE;
        final float y = MathUtils.random() * 10; // Testing different heights
        /*Position at (x,y,z), normal generated automatically*/
        partBuilder.vertex(new Vector3(x, y, z), null, Color.WHITE, null);
    }
}

/*Generate indices*/
for (short gz = 0; gz < VERTEX_COUNT - 1; gz++) {
    for (short gx = 0; gx < VERTEX_COUNT - 1; gx++) {
        final short topLeft = (short) ((gz * VERTEX_COUNT) + gx);
        final short topRight = (short) (topLeft + 1);
        final short bottomLeft = (short) (((gz + 1) * VERTEX_COUNT) + gx);
        final short bottomRight = (short) (bottomLeft + 1);
        partBuilder.index(topLeft, bottomLeft, topRight, topRight, bottomLeft, bottomRight);
    }
}

This doesn't work as I expected and generates the following result:

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:
Unity LWRP alternatives for camera stacking I am working on upgrading a project in unity from a 2018 version to the latest 2019. One of the mechanics of the game is an AR (augmented reality) system. Some of the UI elements appear in the 3D world, but clearly as part of the hud. They need to be transformed as the camera moves, but should always be drawn on top of the 3d scene.

The old project achieved this via camera stacking. All the AR elements were drawn on a different camera which rendered on top of the 3D camera. The clear flags were set to "depth only" and it removed all other elements from that camera.

In the 2019 version of Unity with the Lightweight Render Pipeline (LWRP), the clear flags feature on the camera is missing. To the best of my research, camera stacking has been removed from LWRP.

What are my alternatives? How can I now achieve this effect? I would like to stick to LWRP as I am using Shader Graph for many of the effects in the game.

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:
Light intensity on plain from angle Given a vector (v) for the direction of light and a vector (n) for the normal of a plain.

How can I calculate a rudimentary intensity value (i) where

When (v) points at (n) directly/face on (i) = 1.0
When (v) points away from (n) (i) = 0.0
And everything else in-between

For now we don't need to account for reflection, or any other side effect of a plain.

Has anyone got any ides on how to do this?

I am using DirectX11 for this but I would prefer a solution that I can implement independently.

sentences:
Creating a DrawableGameComponent If I'm going to draw cubes effectively, I need to get rid of the numerous amounts of draw calls I have and what has been suggested is that I create a "mesh" of my cubes. I already have them being stored in a single vertex buffer, but the issue lies in my draw method where I am still looping through every cube in order to draw them. I thought this was necessary as each cube will have a set position, but it lowers the frame rate incredibly.
 What's the easiest way to go about this? I have a class CubeChunk that inherits Microsoft.Stuff.DrawableGameComponent, but I don't know what comes next. I suppose I could just use the chunk of cubes created in my cube class, but that would just keep me going in circles and drawing each cube individually.

The goal here is to create a draw method that draws my chunk as a whole, and to not draw individual cubes as I've been doing.

sentences:
Player's camera, how to obtain smooth movement In a 2D platformer, I have a player that can move both horizontally and vertically. I also have a camera that moves in relation to player. In every update I do this:

public void RepositionCamera()
{
   // For the example I don't consider world rectangle bounds
   current_camera.Position =
      new Vector2(
         player_.Position.X - 250,
         player_.Position.Y - 100));
}

The problem here is that when I press very rapidly "left-right-left-rigth..." the camera does a very annoying effect, it seems an eartquake.

I think this is due to the strict relation to player's position and camera's position.
This is just an example, it is annoying also when climbing onto stairs because every step I force the player's Y up to the step height, so the camera does the same thing!

How can I solve this? How can I edit my RepositionCamera() to be less strict about moving itself?

sentences:
How to avoid checking the same triangle twice in collision detection with spatial hashing I'm implementing a spatial hashing system to speed up my collision detection, but I've run into a problem. Since a triangle can be hashed into multiple buckets, how do I ensure that I don't check the same triangle multiple times?

I've though about having each struct Triangle have a list of pointers to each triangle it has been checked against, as well as a double lastTimeChecked. That way, if the lastTimeChecked was less than the current time, I would know all that data was invalid. This seems inefficient because I am guessing I would have to have this list be a std::vector since I won't know ahead of time how big the list should be.

Then, each time I want to check one triangle against another, I check each triangle's list of triangles it has been checked against to see if either has been checked against the other. Is this the most efficient way to do it?

sentences:
RPG Equipped Item System I'm making a 2d rpg with libgdx and java. I have an Inventory class with an Array of Items, and now I want to be able to equip items onto the player. Would it be more managable to do

have every item have an "equipped" boolean flag
have an "equipped" array in the player class
have individual equipped fields in player class, e.g.

  private Item equippedWeapon;
  private Item equippedArmor;
  public void equipWeapon(Item weapon){
   equippedWeapon = weapon; }

Or just another way completely? Thanks.

sentences:
Problem if 2 HTC Vive into field of view of emitters? I am developing an app for a trade fair that uses the HTC Vive.

Now I am wondering how the HTC Vive syncs with the sensors...I suppose it uses bluetooth, are the sensors "coupled" with the glasses for example with a MAC-Address or sth like that, so another glasses will not work at all, before not configuring it?

I mean, if for any reason another glasses (connected to other computer but powered on) come into the field of view of the emitters, could it be a problem?

Since I have no access at the moment for a second HTC Vive I can't just test it.

If someone has info regarding this it will be very useful.

sentences:
Scene Transition in libgdx How can I make transition between stages in libgdx ?

I have 2 screens MenuScreen and GameScreen each of which has a stage

I write the following to make a transition :

in MenuScreen

SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(Actions.moveTo(-Gdx.graphics.getWidth(), 0, 4.0f));
sequenceAction.addAction(Actions.run(new Runnable() {
     @Override
     public void run() {
        gameMain.setScreen(new GameScreen(gameMain));
             }
     }));
stage.getRoot().addAction(sequenceAction);

in GameScreen

stage.getRoot().setPosition(Gdx.graphics.getWidth(), 0);
stage.getRoot().addAction(Actions.moveTo(0, 0, 4.0f));

but the problem is GameScreen does not following MenuScreen directly
i.e it wait until MenuScreen has completely gone from screen and I want them to move at the same time

sentences: Which 2D rendering algorithm is the most suited for mobile devices? Which 2d rendering algorithms are popular for mobile game engines (specifically Android) and why? Are the same ones for the desktop and/or console world as effective here?

sentences:
Node.js/V8 as a Platform for High End Local PC Game Development? As a Web/UI dev rapidly expanding into more wide-open generalist territory, the more I learn about how its done in other languages, the more I love JS for architectural and basic messaging/event-driven concerns. For the record I am most certainly not a full-blown game-dev (although I did once write for a major gaming mag which is like saying I pretended to be friends with game devs on TV, although you guys were always my favorite folks to talk to).

Anyway, since it's fairly easy to bind C and C++ to JavaScript via Node (or perhaps more specifically V8), how reasonable would it be to assume you could write a decent 3D engine that exposed outcomes of things like collision calculations as events to the JS with the intention of getting the dynamic first-class-function party language benefits (assuming you see such things as benefits - I do) to higher level architecture and AI logic concerns without a crippling loss in performance?

Node, as I understand it, basically exposes a C event loop to JavaScript handled by V8. The JS is single-threaded, meaning any attempt to do anything calculation/IO-intensive with the JS would be foolish, but you get the advantage of not really having to sweat threads, queuing etc... since you're ideally never trying to muck with the same data at the same time. Most code would of course be heavily event/callback driven. All the file I/O concerns and other processor intensive stuff is basically C or C++ under the hood telling you when its done. Not to mention handling UI concerns directly out of the JavaScript via a webkit layer slapped on top of everything.

I'd be delighted to hear why you love/hate the idea but the core question is: is it feasible and why/not? And no, I seriously doubt my own ability to do this all by myself, although plugging an existing 3D engine in might not be outside of the realm of possibility but I'd still be learning a lot of new stuff to make that happen I'm sure.

sentences:
Will having many timers affect my game performance? I'm making a game for android, and earlier today I was trying to add some cool stuff to my game. The problem is this thing needs like 5 timers. I build my timers like this:

timer += deltaTime;
if(timer >= 2.0f){
    doStuff;
    timer -= 2.0f;
} // this timers gets stuff done every 2 secs

Will having to many timers like this, getting checked every frame, screw up my games performance? The effect I wanted to add was a crosshair every 2 sec, then remove it after 2 sec and do a timed animation. So an array of crosshairs dependent on a bunch of timers to be exact. This caused my game to shut down when used, so thats why Im wondering if using that many timers causes my game to flip out.

sentences: Will importing more items from unity packages increase the build size? I'm developing a GoogleVR (formerly Google Cardboard) application and need to import the GoogleVR SDK. While I only expect to use some of the items available in the Unity package, I'd like to import them all at once and save potential headaches later when I can't find something I might need. However I'm worried that including everything in the project may affect the build size, which would be troublesome on a mobile application.

sentences:
Fastest way to render lines with AA, varying thickness in DirectX So I'm doing some DirectX development, using SharpDX under .NET to be exact (but DirectX/C++ API solutions are applicable). I'm looking for the fastest way to render lines in an orthogonal projection (e.g. simulating 2D line drawing for scientific apps) using DirectX.

A screenshot of the sorts of plots I'm trying to render follows:

It's not uncommon for these sorts of plots to have lines with millions of segments, of variable thickness, with or without antialiasing per-line (or full screen AA on/off). I need to update the vertices for the lines very frequently (e.g. 20 times/second) and offload as much to the GPU as possible.

So far I have tried:

Software rendering, e.g. GDI+ actually not bad performance but obviously is heavy on the CPU
Direct2D API - slower than GDI, especially with Antialiasing on
Direct3D10 using this method to emulate AA using vertex colours and tessellation on the CPU side. Also slow (I profiled it and 80% of time is spent computing vertex positions)

For the 3rd method I'm using Vertex Buffers to send a triangle strip to the GPU and updating every 200ms with new vertices. I'm getting a refresh rate of around 5FPS for 100,000 line segments. I need millions ideally!

Now I'm thinking that the fastest way would be to do the tessellation on the GPU, e.g. in a Geometry Shader. I could send the vertices as a line-list or pack in a texture and unpack in a Geometry Shader to create the quads. Or, just send raw points to a pixel shader and implement Bresenham Line drawing entirely in a pixel shader. My HLSL is rusty,  shader model 2 from 2006 so I don't know about the crazy stuff modern GPUs can do.

So the question is:
 - has anyone done this before, and do you have any suggestions to try?
 - Do you have any suggestions to improve performance with rapidly updating geometry (e.g. new vertex list every 20ms)?

UPDATE 21st Jan

I have since implemented method (3) above using Geometry shaders using LineStrip and Dynamic Vertex Buffers. Now I'm getting 100FPS at 100k points and 10FPS at 1,000,000 points. This is a huge improvement but now I'm fill-rate and compute limited, so I got thinking about other techniques/ideas.

What about Hardware Instancing of a Line Segment geometry?
What about Sprite Batch?
What about other (Pixel shader) oriented methods?
Can I efficiently cull on the GPU or CPU?

Your comments & suggestions much appreciated!

sentences: 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:
Sharing VBO with multiple objects and fixed size buffer data I'm just messing around with OpenGL and getting some basic structures in place and my first attempt resulted in each SceneObject class (just contains vertex information right now) having it's own VBO inside it, however I've read that it might be better to share VBOs across multiple objects.

Also, I read that you should avoid resizing a VBO (repeated calls to glBufferData with different size parameters), and instead choose a fixed size for a VBO, and just try a range from the buffer. I don't think changing the size of the buffer data would happen too often, but surely it would be better to only allocate the data you need? Choosing an arbitrary value seems risky.

I'm looking for some advice on working with individual objects in a scene and their associated buffer data.

sentences:
C++&SFML Moving Sprites Smoothly in Tiles As a student, I've always wanted to become a game developer. So far I've managed to learn the basics of C++ and SFML 2.1

For my first project, upon deciding to make a 2D RPG-ish game, I encountered a problem that the game loop refreshes so quickly that if I move them by 1 pixel per frame, the sprite will move more quick than I intended to.

I implemented a frame-determined movement system(not sure what it's called) that whatever the fps is, the character moves at same speed.

However, I couldn't solve the problem(which is what I'm asking) that the sprite won't move smoothly. What's happening in my build is that the player will move about 1px per frame, and can be interrupted by other inputs. What I want the sprite to do is move horizontally 32px per second. How can I do this?

Edit: wasn't being clear enough. What I want the program to do is when I press 'Right' key once, sprite moves towards the positive side of x-axis, for 32px. What's currently functioning in my program is the sprite will move only once, 1px

TL;DR : I want to move my sprite like old-school RPG games, moving predetermined pixels(or tiles) smoothly.

sentences:
Distinguishing between multiple objects with the same name in a text based adventure game/interactive fiction I'm in the middle of writing my own parser in Python. I've managed to make some simple commands, with simple prints to make sure they work. Since I intend there to be combat, I needed to write a command for attacking something. I just completed that.

My issue is: What should I do to allow the player to choose which of a given enemy they attack? It is fairly simple when they are different types of enemies (e.g. a goblin and a troglodyte), but how should I distinguish between two of the same type (e.g two troglodytes)?

Suggestions I have had so far: Give each of them a significant feature (color, height, relative direction) but that only so far; name each of them (so you attack "bob" or "steve"); or the one I have been favoring the most, give them each a number (so there would be troglodyte1, troglodyte2 etc.)-this might break some immersion, though.

sentences:
Picking a local origin as the centroid of given three points in 3D Given three points non-collinear P, Q, R in 3D, I need a generic method to generate x', y', z' unit vectors that behave like origin of local coordinate system.

x' and y' vectos should be on the plane that is defined by P Q and R.

The part that I could not figure out was:
After calculating the centroid C, I can pick x' as normalize(vec(PQ) + vec(PC)) but could not figure out how to generate y' and z'.

The method should be generic. I know this is possible without rotations etc. but how?

I'm going to write a program in Java, so I'd appreciate answers with step-by-step.

sentences:
Can I use the inclinometer and accelerometer on every Windows Phone device? I want to do a little game that uses the Windows Phone inclinometer to control an object's pitch, roll and yaw. In addition, I need the accelerometer in another project to let an object jump.

Can I use the inclinometer and accelerometer on every Windows Phone device or are there older devices that don't support the inclinometer and accelerometer? Can I use the inclinometer and accelerometer on Windows Tablets like the surface?

sentences:
Custom Coloring of Tileset Characters Games like Dwarft Fortress and Dungeon Crawl Stone Soup are drawing their boards using tiles from a tileset image (I think?). I know you can do color keying and replace the background color with transparency or another color, but how are games like these drawing the text characters into different colors? Using the same method? I am trying to find the best way to use a tilesheet to draw ascii graphics and be able to choose what color the text is, and what color the background of the tile is separately.

Something similar to what is pictured here.

sentences:
How to Make Games Faster (Without Sacrificing Quality) I posted a similar question on the Programmers SE site. Please read it. I want to know what specific things I can do to help me create games faster.

Already, in addition to whatever I wrote there, I am:

Creating reusable libraries on top of existing engines that I'm using
Creating reusable assets (graphics, sounds, icons)
Finding sites where I can find assets quickly (graphics, sounds, icons)
Using game engines instead of writing code from scratch
Using agile so my game is customer-focused and gets results
Biting off small games (like a vanilla rogue-like)

I feel it's not enough; I'm taking far too long to make games. A simple chemistry puzzle game, for example, took nearly 40 hours -- and that's with only half-decent graphics.

What are your recommendations? How can I get better and faster?

sentences:
Finding next experience level using the square root? I recently asked this question on how to calculate a level based on experience:

Algorithm for dynamically calculating a level based on experience points?

I am using the following calculation to determine the players level:

decimal experience = 1829;
decimal rawLevel = (decimal)(.06 * Math.Sqrt(experience));
decimal level = Math.Floor(rawLevel);

For my test, 1829 experience points equates to 2.56600857364117M, which I floor to level 2.

My question is, how can I figure out how many points it would take to get to the next level based off of the calculation above?

I know the next level is 3, so I would need to figure out how many points equate to level 3 so that I can find the difference.  What formula would I use, given the constant .06 above?

Update: Solution:

int experience = 150777;
decimal rawLevel = (decimal)(.06 * Math.Sqrt(experience));
decimal level = Math.Floor(rawLevel);
decimal nextPoints = (decimal)Math.Pow((double)(level + 1) / 0.06, 2);

sentences:
What happened to procedurally generated textures? I recall some time ago that procedurally generated textures were becoming a big deal that a lot of people/companies were really interested in with some serious benefits (smaller deployments, potentially faster loading, higher quality, scalable textures, potentially cheaper to produce, etc.).

From what I can tell, the buzz is dead and no games on my radar are using them. What happened?

I was hoping I'd see procedural textures go the way that NaturalMotion's stuff has (slow but steady adoption).

sentences:
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 to create a scripted sequence Like countless other video games, I'd like to have scripted sequences in my game. Character 1 says something, the player replies, then a rock falls, that sorta stuff. I could find a way to do it, but I would like to use a common method, assuming there is one.

My current thought is to have a separate file for each level of the game that contains all the possible scripted actions for that level. When the corresponding trigger is activated, the function is called. I think early Call of Duty games (up to CoD4) used something similar, but I'm not entirely sure.

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:
How to draw objects that have a smaller Y axis first? In my game there is a large 2D map of various objects. Example. As you see, upon creation objects of the same type (trees for example) are placed correctly, but objects of another type (enemies) are placed on top of the no matter the position. Now, how can I arrange that everything is drawn according to it's position?

Another example (the dog should be drawn before the tree, and not on top of it):

sentences:
How to dispose in Newest Java/LibGDX ApplicationListener? What I'm wondering:

How do you dispose of textures / spritebatches and the things you normally need to dispose of now?

Why I'm asking:

Because theirs no automatic dispose() function upon creation of the Main libGDX class. I don't remember details but there used to of been an @override dispose

I don't want a memory leak or whatever it's called when you don't dispose.

sentences:
Let a time counter working when an app is closed? Can we let a time counter working even if an app is closed? I would like to add a timer so that we have to wait XX seconds/minutes before a building is created in a game.

I don't want to use an internet connection, and if the user closes the app and just changes the time on his mobile, I cannot compare the 2 time values - before and after.

Would you know how to do this?

Thanks

sentences:
GLSL C++ Only first sampler array index is accessible I have the following shader, which whose fragment shader contains a sampler array of 16 elements.

Fragment

#version 330 core
in vec2 _uv;
flat in int _instanceID;

out vec4 color;

uniform sampler2D sampler[16];

void main() {
    color = texture(sampler[_instanceID], _uv);
}

Now when I try to set the second array element using the following method

void Shader::setUniform(const std::string& uniform, GLuint* values, size_t amount) const {
    bindProgram();

    GLuint loc = getUniformLocation(uniform + "[0]");
    for(int i = 0; i < amount; i++){
        glUniform1ui(loc+i, values[i]);
        std::cout << values[i] << " "; //For debug
    }
    std::cout << std::endl; //For debug
}

It just sets the first element of the shader. Even though I'm passing 2 values.

This is the output of the cout's:

5 4
5 4
5 4
5 4
...

Looking up the shader variables with GDebugger, only the first element is set.

It also only draws the first (index 0) image.

sentences:
Theoretic question about rendering in sfml and in general I have read whole tutorial section on sfml-dev.org and have some question.

What are exactly views and how to use them ?

Should I render things in views or in renderwindow ?

sentences:
Java: Standing Animation I've been working on a top-down, and the player already has animations for moving left and right.  However, if I move a certain distance and stop, it will stop on the walking animation, which isn't logical as opposed to a standing animation while the player is idle.

I've been using this input handler class:

public class InputHandler implements KeyListener
{
public boolean up = false;
public boolean down = false;
public boolean left = false;
public boolean right = false;

public InputHandler(Game game)
{
    game.addKeyListener(this);
}

public void toggle(KeyEvent ke, boolean Pressed)
{
    int KeyCode = ke.getKeyCode();

    if(KeyCode == ke.VK_UP) up = Pressed;
    if(KeyCode == ke.VK_DOWN) down = Pressed;
    if(KeyCode == ke.VK_LEFT) left = Pressed;
    if(KeyCode == ke.VK_RIGHT) right = Pressed;
}

public void keyPressed(KeyEvent e)
{
    toggle(e, true);
}

public void keyReleased(KeyEvent e)
{
    toggle(e, false);
}

public void keyTyped(KeyEvent e)
{

}
}

and it is coupled with the tick() method from my main class:

private void tick()
{
    if(input.right)
    {
        xScroll++;

        if(xScroll / 16 % 2 == 0)
        {
            dirFacing = 2;
        }
        if(xScroll / 16 % 2 != 0)
        {
            dirFacing = 4;
        }
    }

    if(input.left)
    {
        xScroll--;

        if(xScroll / 16 % 2 == 0)
        {
            dirFacing = 1;
        }
        if(xScroll / 16 % 2 != 0)
        {
            dirFacing = 3;
        }
    }

    if(input.down)
    {
        yScroll++;
    }

    if(input.up)
    {
        yScroll--;
    }
}

Again, the above yScroll will be added later, I really just need to solve the standing animation first.

sentences:
'CoreMinimal.h' file not found when building on Unreal Engine on Mac I'm trying out C++ on Unreal Engine 4.25 on Mac. If relevant, my Xcode version is 12. When I try to compile, there's an error: 'CoreMinimal.h' file not found.
I've looked around and some solutions mention a workaround, which is to add the path to CoreMinimal.h into the .vscode/c_cpp_properties.json file. I did that:
...
    "includePath": [
        "${workspaceFolder}/**",
        "/Users/Shared/Epic Games/UE_4.25/Engine/**" // This is the filepath to CoreMinimal.h
    ],
...

I still get the same error. I couldn't find any other solution. Has someone found a solution to this?
Thanks.

sentences: Rendering artifacts at a large scale I'm a new to OpenGL or graphics in general. Trying to write a game with realistic scale. I had a perfectly fine rendering of earth at a small scale, but when I try to scale it up to 1:1 I get this artifact. Any ideas what this could be? I suspect it's because I am using floats, but I would rather avoid using doubles in the shader for performance reasons.

sentences:
Collision detection performance problem Using python and pygame I've built a collision detection system according to the instructions in this YouTube tutorial.

This is updated 40 times per second and controls movement and collision detection between some number of "agents", which are circles, each with a radius of 20:

for a in self.agents:
    dir = a.target - a.pos
    if dir.length >= 3:
        dir.length = 3
        a.pos = a.pos + dir

for a in self.agents:
    for a2 in self.agents:
        if a==a2: continue
        d = a.pos.get_distance(a2.pos)
        if d<40:
            overlap = 40 - d
            dir = a2.pos - a.pos
            dir.length = overlap/2
            a2.pos= a2.pos+dir
            a.pos= a.pos-dir

This looks and works great, as long as the number of agents is below 100. A higher number of agents will cause the pygame frame rate to drop. I left out some code which increases movement speed and pushback for a selected agent, but I don't think it has any consequence for the issue.

How can I make the code more efficient? For instance, would it help to make it so agents only check the distance of other nearby agents, say within a circle 4X the size of the agent, instead checking the complete list in every iteration of the code. Or is it better to change the method all together?

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

By the way, I'm using Unreal 4.16.

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

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

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

You can find the class AAIPaddle here.

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

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

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

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

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

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

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

The project is public in Github.

Maybe I don't understand something about Vectors.

sentences:
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:
Rent-a-Coder style site for artists My Google-fu is failing me: is there a site in the same vein as Rent a Coder, but for hiring artists?  In particular, I'm looking for a site which fits the following criteria:

Allows me to specify the style and scope of the work I'm looking for beforehand
Allows artists to "bid" on the project, including time and cost estimates
Showcases the work of the bidding artists so that I can see what kind of quality I can expect from each bidder
Is designed specifically for smaller, short-term projects or one-off graphics

It seems that the original incarnation of Rent a Coder is dead (the above seems to be some sort of knockoff), and that it was probably killed by an unsustainable market full of unrealistically low bids for large projects by unskilled and unqualified "coders."  That being the case, such a site might be poorly suited to art as well.

The reason I'd like such a site, though, is that as a "bedroom programmer" with a small budget and little experience in this sort of thing, I have no idea where I should be looking for art or how much I should reasonably expect to pay.  Thus, a site with good competition where market prices are somewhat transparent would be ideal.

Any other suggestions about how best to acquire custom artwork as an indie developer are also appreciated.

sentences:
How do I set a touch listener in a child scene in AndEngine? In my game, I want to implement touch listener for my child scene objects. Basically I tried all the possible way to implement this that I have usually done for my normal scenes, but those methods do not work here. Could somebody provide some guidance for setting touch area listener in child scene?

Here is my code:

    menuScene.setTouchAreaBindingEnabled(true);

    menuScene.registerTouchArea(resumeButtonSprite);
    menuScene.registerTouchArea(retryButtonSprite);
    menuScene.registerTouchArea(exitButtonSprite);

    menuScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea, float pTouchAreaLocalX,
                float pTouchAreaLocalY) {
            System.out.println("Touch");
            return true;
        }
    });

In this code, menuScene was a child scene activity.

Also after research I found that my engine was stopped while the child scene was activated so the touch event is not detected. I want to implement a pause menu in my game so any desirable solution for a pause menu implementation would help.

sentences:
How to optimize the distance function? While developing a reasonably simple RTS-like game, I noticed my distance calculations were causing an impact in performance.

At all times, there are distance checks to know if a unit is in range to its target, if the projectile has reached its target, if the player has run over a pickup, general collision, etc. The list goes on, and checking for distance between two points is used a lot.

My question is exactly about that. I want to know what alternatives game developers have for checking distances, other than the usual sqrt(x*x + y*y) approach, which is fairly time consuming if we are performing it thousands of times per frame.

I'd like to point out I am aware of the manhattan distances and squared distance comparisons (by skipping the sqrt bottleneck). Anything else?

sentences:
How can I achieve a bullet tracing effect similar to the one in Planetside? I've noticed that bullet tracers in Planetside 2 don't show up close -- every time I see them, it came from a barrel a ways away. I don't believe Planetside traces every bullet either, because then it'd look really weird.

I'm not sure what the exact parameters are, so how can I achieve a similar affect?

sentences:
How do I 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:
How to set a body to a specific position using Andengine I'm developing a game with a single player and multiplayer mode. Lets say I have walls (static bodies), vehicles (dynamic bodies) and bullets (dynamic bodies).

It works fine to control my own vehicle using vehicleBody.setLinearVelocity(velocityX, velocityY);. The vehicle can collide with walls and bullets as expected.
Now I like to move the enemy vehicles in multiplayer mode. When I use the same method to move the body by its velocity values (in multiplayer mode), the vehicles get out of sync really quickly, means they don't have the same position on all devices because some data packages get lost.

What I'm currently doing is the following:

On device #1:

1) I move the body using setLinearVelocity

2) Then I get the X and Y position of the body and send a data package to the other device

On device #2:

3) I receive the data package and set the position of the body. I tried different ways, hopefully you can tell me the best way or alternatives I did not try yet:

using vehicleBody.setTransform(...):

activity.runOnUpdateThread(new Runnable() {
    @Override
    public void run() {
        vehicleBody.setTransform(new Vector2(newPosX, newPosY), angle);
    }
});

I also tried using MouseJoint (based on that tutorial),
    but somehow the body was bouncing randomly to the next position. Sometimes it was working great, but when I restarted the game the vehicle of the enemy started bouncing again. Maybe I failed to setup the parameters. Here is what I used:

public MouseJoint createMouseJoint(float newPosX, float newPosY) {
    final float PIXEL_TO_METER_RATIO = PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT;
    Vector2 v = vehicleBody.getWorldPoint(
            new Vector2(newPosX / PIXEL_TO_METER_RATIO, newPosY / PIXEL_TO_METER_RATIO));

    MouseJointDef mjd = new MouseJointDef();
    mjd.bodyA = groundBody;
    mjd.bodyB = vehicleBody;
    mjd.dampingRatio = 0.2f;
    mjd.frequencyHz = 30;
    mjd.maxForce = (float) (1000.0f * vehicleBody.getMass());
    mjd.collideConnected = true;
    mjd.target.set(v);

    return (MouseJoint) mScene.mPhysicsWorld.createJoint(mjd);
}

Before I've used bodies I was using simple sprites and it worked perfectly. I sent data packages to the other device(s) and set the position and rotation of the enemy vehicle by using vehicleSprite.setX(newPosX), vehicleSprite.setY(newPosY) and vehicleSprite.setRotation(angle). Compared to that, bodies seem to be very complicated. So how I can I keep positions synced without bouncing?

By the way, on some pages I read about using KinematicBody instead of DynamicBody for a vehicle. What is the advantage? My vehicle needs to collide with the environment, so I think DynamicBody is the correct choice, isn't it?

sentences:
Compile-time checking for component-based, data-driven games This is not a specific question, but rather someone who is looking for opinions about a typical design problem. In a component based data-driven games, I've often seen something similar to the following when accessing attributes:

int* health = mOwner->get< int >( HEALTH_ATTRIBUTE );

if (health)
    *health -= 10;

Or, alternatively:

if (mOwner->hasAttribute( HEALTH_ATTRIBUTE ))
{
    int health = mOwner->get< int >( HEALTH_ATTRIBUTE );
    mOwner->set( HEALTH_ATTRIBUTE, health - 10 );
}

Where mOwner is a pointer to the parent game object. In this example, assume that the game object stores a map of attributes which are downcasted to the correct type at runtime.

There are some problems with this approach. Mainly, it is prone to bugs since it requires the programmer to know the the type of the attribute they are after. If I was working on a small team or by myself, this wouldn't be an issue. However for my requirements, this is undesired.

The only way to have compile-time checks is to create a helper function for each attribute that returns the proper type, so our code would then look like:

int* health = Attributes::getHealth( mOwner );

Where Attributes is declared as a namespace. Because the type is known at compile time, this gives us several advantages. In addition to the compile-time check, we gain the flexibility to easily declare certain attributes as constant, or that can't be modified outside the game object, etc. Of course, the downside is that it becomes necessary to manually create a new function for each and every attribute in the game.

Thoughts? Opinions?

EDIT:

After thinking it through a little more, I realized there is a way to define the function once using templates to avoid code duplication. For example:

template <typename Type, int ID>
class Attribute
{
public:
    typedef Type type;

    static int getID()
    {
        return ID;
    }

    static type getData( const GameObject* obj )
    {
        return obj->getAttribute < type >( ID );
    }

};

And then for each attribute we have in our game,

typedef Attribute< std::string, MODEL_NAME > ModelName;
typedef Attribute< Vector3, POSITION > Position;
typedef Attribute< int, HEALTH > Health;

/// ... and so on ...

And when we want to access an attribute:

int health = Health::getData( mOwner );

Or alternatively, if we want to:

Health::type health = Health::getData( mOwner );

If we don't know the health attribute exists or not:

int* health = Health::getData( mOwner );

if (health)
   // ....

I think this approach gives a lot of flexibility while still maintaining type safety.

sentences:
LookAt different object smoothly in unity3d As picture depicted my camera moving on path i want to lookAt bath different object smoothly. Currently have tried

trasnform.LooAt(activePath.gameObject.transform);

but it producing jerky result. object suddenly lookAt to next object how to avoid it. I searched and found this sloution but it also not working

var targetRotation = Quaternion.LookRotation(activePath.gameObject.transform.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime);

sentences:
Colliding a player and a maze wall I am making a game very similar to Tank Trouble. I cannot get t the tank to collide with the maze in the map.

Let tx and ty = the tank x and y value.
Let x and y = the walls x and y value.
Let h and w = the walls height and width.

public boolean collidesWith(double tx, double ty)
{
    if ((tx - 55 > x) && (tx + 55 < x + w) && (ty - 55 > y) && (ty + 55 < y + h))
    {
        return true;
    }

    return false;
}

sentences:
unity Rigidbody jump I absolutely don't know what is the problem with this code and I have tried everything without any success. I need help.

void FixedUpdate()
{
if (Physics.Raycast(transform.localPosition+new Vector3(0f,0.1f,0f),-transform.up,0.2f) )
        {
            grounded = true;
        } else
            grounded = false;

if (Input.GetButtonDown ("Jump") && grounded)

            {
                rb.velocity+= Vector3.up*jumpSpeed;

            }
}

Some time it jumps and some time it doesn't jump with no visible pattern.

sentences:
player goes off screen as the camera smooth follow interpolation Sometimes player goes off screen as the camera lags behind it, especially when the player is falling. Also when the player is climbing walls by jumping left and right, the camera moves left and right, as I want it to stay still.
I am assuming this is a problem with the camera speed not matching the physics speed of the player, I don't know how to match those two.
This is my code:
let camera = Camera()
let player = Player()

let followFrame = Rectangle(0, 0, viewWidth, viewHeight);

let followTarget = Point(player.x, player.y);

function update = () => {

  if (!followFrame.containsPoint(player.x, player.y)) {

     followFrame.position = [player.x - followFrame.width * 0.5,
         player.y - followFrame.height * 0.5];

     followTarget.position = [followFrame.x, followFrame.y];
  }

  camera.position = interpolate(camera.position, followTarget)

};

I have to account for player to take long distance jumps and falls.

sentences:
Problem with Parameters for polymorphism class This is going to be a bit tricky but it is really bothering me so I hope you will have the patience to follow along :)
Here is my very basic architecture:

So in the framework, I am creating I have Actions these currently have a list of Conditions or Considerations (same thing different name).
While each Condition share some of the same functionality  such as:

Returning a float score
Using an evaluation formula

They implement these in very different ways depending on the situation.
Take a look at the following code:
[CreateAssetMenu(fileName = "Consider my health vs max health",
    menuName = "AnAppGames/AI/Example/Decisions/Health Consideration")]
public class MyHealth : BaseConsideration
{
    private float health;
    public float maxHealth;

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        health = value as float;
        return EvaluateValues(health / maxHealth);
    }

}

What you are looking at is my first attempt at making some sort of "reusable" Consideration.
Now in the continuation of my development, I had to make the following Consideration:
public class DistanceFromMe : BaseConsideration
{
    public float minRange;
    public float maxRange;

    private float ConsiderWithValues(Transform target, Transform caller)
    {
        return EvaluateValues(new FloatData(Vector3.Distance(target.transform.position, caller.position),
            minRange,
            maxRange).GetNormalizedData());
    }

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        Transform target = value as Transform;
        if (target == null)
        {
            return 0;
        }
        return ConsiderWithValues(target.transform, context.transform);
    }

    public override float Consider(float x)
    {
        return EvaluateValues(new FloatData(x,
            minRange,
            maxRange).GetNormalizedData());
    }

}

And now the trouble begins I thought "This is not a scaleable solution" as soon as I need more than 1 generic parameter I am screwed and have to create additional overrides of this Consider function.
So what I need is somehow to add different types of parameters to the Consideration however these parameters will vary a lot.
Another problem I have with this is that when I loop through the list I won't be able to tell what parameters i needed and how to fulfill the needs of the Consideration.
I thought of different ways of dealing with this inside the editor but I have come up empty :(
Can anyone help me out with this architectural mess? :)
It is worth mentioning that at the current point each of these are ScriptableObjects I am not 100 set in the fact that they should be but i am just not sure how to deal with this problem.

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:
(2D) Detect mouse click on object with no script attached I'm creating a 2D project which does not have a character. So i created an empty gameobject and attached the script to it. In the script, i have declared other objects which are in the scene like this:

public GameObject obj1,obj2,obj3;

How can I know if obj1 or obj2 or obj3 was clicked? Is raycasting the only solution?

sentences:
Find meeting point of 2 objects in 2D, knowing (constant) speed and slope I have a gun which fires a projectile that has to hit an enemy. The problem is that the gun has to be automatic, i.e. - choose the angle in which it has to shoot, so that the projectile hits the enemy dead in the center.

It's been a looooong time since school, and my physics skills are a bit rusty, but they're there. I've been thinking to somehow apply the v = d/t formula to find the time needed for the projectile or enemy to reach a certain point. But the problem is that I can't find a common point for both the projectile and enemy trajectories. Yes, I can find a certain point for the projectile, and another for the enemy, but I would need lots of tries to find one where the two points coincide, which is stupid. There has to be a way to link them together but I can't figure it out.

I prepared some drawings and samples:

A simple version of my Flash game, dumbed down to the basics, just some shapes:

http://axonnsd.org/W/P001/MathSandBox.swf - click the mouse anywhere to fire a projectile.

Or, here is an image which describes my problem:

So... who has any ideas about how to find x3/y3, thus leading me to find the angle in which the weapon has to tilt in order to fire a projectile to meet the enemy?

EDIT

I think it would be clearer if I also mention that I know: the speed of both Enemy and Projectile and the Enemy travels on a straight vertical line.

sentences:
improving speed of 2d ball collision I am making a game which has many balls bouncing around the screen (around 200-300 balls in a small area). One thing I am trying to do is improve the performance of the collision detection and resolution.

What I've tried to do so far is to maintain a large number of ArrayLists. I split the screen up into a grid and for each cell I keep an ArrayList containing each ball that is currently inside that particular grid square. Whenever I update the positions of the balls, I also update which list they belong to.

When checking for collisions, I have a separate ArrayList which contains all the balls. I iterate through this list, and for each ball:

find out what grid square it is in
check for collisions with all the balls in adjacent grid squares

I've tested this approach and it doesn't seem any different to just iterating over a list of all the bubbles twice.

Does anyone have some suggestions on how I can improve things? For instance, with my current algorithm I am handling collisions twice but I'm unsure how I can work around it.

sentences:
Ideas for fair travelling system for text based RPGs I'm working on a text RPG (in principle similar to cantr.net) that allows players to role-play their characters in a player-driven world. Players form cities, societies and so on. Pretty much nothing is predetermined for them including currency, etc.

The thing I'm struggling with is how to strike a balance between "pro" players that are logged in nearly 24/7 and more casual players that would like to log in once a day/two days. Most of the systems already take that into account and I'm fairly happy with them, but I'm struggling with creating traveling system that would be fair both ways.

Currently for crafting and other things I'm using "energy" points that are capped at X number and regenerate Y number per hour (basically it regenerates every three real-life days so allows for some catch-up if you miss a day or two). Could it be applied somehow to traveling? What are your ideas?

The world is a flat surface with x/y coordinates the "locations" are just specific points on a map that users can go to and while in the same "location" they can interact with each other. Kinda like Fallout 1 map. I was thinking of allowing movement of X units per 1 energy + some bonuses if vehicles/horse is used.

Let's assume this situation: a thief steals something in a town and starts to run. The game shouldn't require the guards (which are player characters) to be online 24/7 to be able to catch up. They need to have some form of slack or catch-up mechanic to be able to compete, but the thief shouldn't be severely punished by that either. I don't want to force guards to be online too much but at the same time I'm trying not to create a situation where guard characters can just talk freely and "don't give a shit" for a day and then go and chase because they know they will catch him easily.

What are your thoughts on this?

EDIT:
As requested I'm going to include a bit of more context here. The game itself has no goals, quests or really any "purpose". All that I need to provide is a world and mechanics that allow player characters to craft, fight and live in a sandbox world and do whatever they wish. Players are "role-playing" in the Dungeon & Dragons sense - they actually have to play and talk from the perspective of their character.

But since I can't expect players to be logged in 24/7 I need to create a fair (or close) system with respect for players' time.

The biggest problem I have is with travel. Not travel per se but chasing mostly. How not to require constant logging in and checking if something happened, allow to catch up to someone who logged in earlier/in different timezone but give the chance to escape as well.

I was thinking about energy points (so players would have to strategize and leave some "just in case") and using something like Tracking skill which would influence how well one character can find another character in travel.

sentences:
How can I color/un color object that don't have renderer and material? I have a simple object:

I want to create a highlight effect.

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

public class Map : MonoBehaviour
{
    public Camera mapCamera;
    public Text objectWasHit;

    private Camera[] cameras;
    private GameObject mouseOvered;

    // Use this for initialization
    void Start()
    {
        cameras = Camera.allCameras;

        GameObject levels = GameObject.Find("_Level");
        foreach (Transform child in levels.transform)
        {
            child.gameObject.AddComponent<Renderer>();
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.M))
        {
            if (mapCamera.enabled == false)
            {
                foreach (Camera cam in cameras)
                {
                    cam.enabled = false;
                }
                mapCamera.enabled = true;
            }
            else
            {
                foreach (Camera cam in cameras)
                {
                    cam.enabled = true;
                }
                mapCamera.enabled = false;
            }
        }

        bool rcHit = false;
        Vector3 mouse = Input.mousePosition;
        Ray castPoint = mapCamera.ScreenPointToRay(mouse);
        RaycastHit hit;
        Debug.DrawRay(castPoint.origin, castPoint.direction * 1000, Color.magenta);
        if (Physics.Raycast(castPoint, out hit, 1000))
        {
            rcHit = true;
            if (mouseOvered != hit.collider.gameObject)
            {
                mouseOvered = hit.collider.gameObject;
            }
            objectWasHit.text = mouseOvered.name;
        }

        if (!rcHit && mouseOvered != null)
        {
            //do your thing to undo the material change
            mouseOvered = null;
        }
    }
}

First I'm not sure if white color is the right way for highlighting.
Second there is no startcolor since the object don't have any renderer or material at the first time. Then how can I make the highlight effect ?

sentences:
Checking if a click happened "off" an object Having made the first game in Game Maker, Catch the Clown, I realised there was no way to win or lose.

Winning is easy enough, set a maximum score and a test that fires whenever a score increments, but losing has proved challenging. I had an idea; if the player attempts to click on the clown but misses he/she loses a life. I have tested every check, read the manual and looked through forums but I can't find a way to do this.

I also can't figure out where to put the event. I tried on the clown; tests like checking to if there would be a collision between where the click occurred and where the clown is... nothing works. I am at a complete loss so any help would be greatly appreciated.

sentences:
Confused about Max Vertex Uniform Vector limit While coding my WebGL app I've encountered an interesting phenomena:

On my first PC (with GPU Radeon HD 5850), BrowserLeaks (link) tells me that in my browser - Google Chrome Version 36.0.1985.143m the Max Vertex Uniform Vectors value equals 1024 - which is true, when I try to create inside the shader an attribute array bigger than 1024, the browser throws an error: too many uniforms, which f.e. in my case let's me draw about 85 simple cubes in a single draw call.

Meanwhile on my other PC (with GPU Intel X3100) with Opera-Next Version 12.15 installed, where BrowserLeaks shows a value 4096 next to the Max Vertex Uniform Vectors field, I can init an array of size 250 000 and even bigger, I can draw 20 000 cubes in a single draw call and everything works fine (except a very low framerate).

So now my question is: Why those numbers varies so much, why in the second case the upper limit value does not seem to be valid? How would I find the true upper limit value (and read it inside my WebGL app at the runtime)?

EDIT: Ok, I've found out how to get this parameter inside a WebGL app: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS), but the question now is how would I adapt it to shaders...

sentences:
How to design components for tile-based movement in an RPG using ECS I'm trying to re-write a small game of mine using ECS mostly for educational purposes and to see if it fits top-down RPG games in the style of Pokemon (gameboy). Since everything is tile based, initially I had a Position component that only holds the position of the player, and a Controller/Input component that, when a movement keypress is detected, starts to change the player's position until it falls into a tile. Then, the Rendering component would render the player based on a vector of clips that simulate the movement.

Thinking that my player should only move in tiles, I thought that it might be better to change the position tile-by tile every time, and then use some sort of interpolation in the Animation or Rendering component to figure out which of the clips to use (left foot forward, right foot forward etc.). This proved to be much less error prone, but now this means that I need to keep the actual position and the "visual" position (the one you can see on the screen). Thinking that logic should be not mixed with rendering, it seems that the "correct" thing would be to not keep the "visual" position in the Position component, but in one of the "front end" components like Animation or Rendering. Which would be the most correct thing to do? By correct meaning the thing that will keep the code truly decoupled in the vein of pure ECS.

sentences:
How can I move the snake toward the mouse cursor? I am making a snake game. I have got it to animate. I just want it to follow the mouse pointer. I am able to find the mouse cursor position. I am also to get my snake to move to the right. What I want is to get my snake to move in the direction in the mouse pointer.

        private void timer1_Tick(object sender, EventArgs e)
    {
        Graphics g = this.CreateGraphics();
        SolidBrush greenBrush = new SolidBrush(Color.Green);
        SolidBrush blackBrush = new SolidBrush(Color.Black);
        Rectangle rect_green = new Rectangle(340 + x, 280 + y, 100, 10);
        Rectangle rect_black = new Rectangle(240 + x, 280 + y, 100, 10);
        g.FillRectangle(greenBrush, rect_green);
        g.FillRectangle(blackBrush, rect_black);
        if (x >= 340)
        {
            x = 340;
        }
        x += 5;
        greenBrush.Dispose();
        g.Dispose();

        if (MouseButtons == MouseButtons.Left)
        {
            Graphics g_two = this.CreateGraphics();
            SolidBrush greenBrush_two = new SolidBrush(Color.Green);
            SolidBrush blackBrush_two = new SolidBrush(Color.Black);
            Rectangle rect_green_two = new Rectangle(340 + x, 280 + y, 10, 100);
            Rectangle rect_black_two = new Rectangle(340 + x, 180 + y, 10, 100);
            g_two.FillRectangle(greenBrush_two, rect_green_two);
            g_two.FillRectangle(blackBrush_two, rect_black_two);
            y += 5;
            greenBrush_two.Dispose();
            g_two.Dispose();
        }
    }

sentences:
How can I project a 3D point onto a 3D line? Let's say I have a line defined by two points, A and B, both in the form (x, y, z). These points represent a line in 3D space.

I also have a point P, defined in the same format, that isn't on the line.

How would I calculate the projection of that point on to the line? I'm aware of how to do this in 2D but 3D seems to have bugger all resources on it.

sentences:
Unity 3D Imported Assets Rotated Backwards in-game I'm putting together boilerplate for a Unity FPS game, and having an issue with importing an Asset Store model.
All of my weapons are asset store prefabs. I'm new to Unity, but this makes me think there's something about the imported prefabs themselves that's setting the axis alignment of the models in-game.
Anyone know what I'm missing to fix this and rotate that model in the world (without just writing a model script to rotate it programmatically every time) ?

sentences:
Placing items randomly in a dynamically generated terrain I'm currently working on a 'Tiny wings' like game. I've already asked about the angle of the items in curved lines and i solved (thank you for responses),i'm currently placing the items in random positions, but the terrain it's dynamically and i don't get this working.

I've a vector with the points of the terrain, and i'm doing something similar to this (Iterating trough vector):

if( _SPManager && i % 15 == 0 && i != 0 )
{
    if (  _settings.specialPoints && _currentPoints < _settings.specialPoints )
    {
        _SPManager.addPoint( _hillsPosition[i].x , _hillsPosition[i].y );
        _currentPoints++;
    }
}

But it isn't working as i expected. It isn't displaying the right number of items (Always shows less than i specified).

How do i should place the items?

Thanks :)

sentences:
Ruby: implementing alpha-beta pruning for tic-tac-toe So, alpha-beta pruning seems to be the most efficient algorithm out there aside from hard coding (for tic tac toe). However, I'm having problems converting the algorithm from the C++ example given in the link: http://www.webkinesia.com/games/gametree.php

Players are either 1 or 0, so doing 1 - player will switch the player

  WIN = 1
    LOSS = -1
    DRAW = 0
    INFINITY = 100
    def calculate_ai_next_move
        best_move = -1
        best_score = -INFINITY

        cur_player = COMPUTER
        self.remaining_moves.each do |move|
          self.make_move_with_index(move, cur_player)
          score = -self.alphabeta(-INFINITY,INFINITY, 1 - cur_player)
          self.undo_move(move)

          if score > best_score
            best_score = score
            best_move = move
          end
        end

        return best_move
    end

    def alphabeta(alpha, beta, player)
      best_score = -INFINITY
      if not self.has_available_moves?
        return WIN if self.has_this_player_won?(player) == player
        return LOSS if self.has_this_player_won?(1 - player) == 1 - player
      else
        self.remaining_moves.each do |move|
          break if alpha > beta

          self.make_move_with_index(move, player)
          move_score = -alphabeta(-alpha, -beta, 1 - player)
          self.undo_move(move)

          if move_score > alpha
            alpha = move_score
            next_move = move
          end
          best_score = alpha
        end
      end
      return best_score
    end

currently, the algorithm is playing terribly. It will initially pick the last space, and then choose the first (from left to right) available space after that.

Any idea with whats wrong with it?

Also, I've been doing TDD, so I know that self.has_this_player_won?, self.undo_move and self.remaining_moves is correct.

sentences: Hills in a topdown game I'm making a top down rpg game and was wondering if it was possible to show hills on a map instead of having everything completely flat. I've thought about changing to an isometric view, but if it can be avoided, I would rather do top down. How would I do this? Would I draw the tiles on an angle or something? Or is not possible without switching levels like in dwarf fortress?

sentences:
Is there an algorithm for collision resolution that factors in velocity? I'm trying to program collision detection between moving convex polygons. To detect collisions, my program uses the GJK algorithm, and to resolve the collisions, it uses EPA. The problem with EPA is that it returns the vector to resolve the collision with the minimum distance, rather than returning the locations of the polygons at the time of the collision. Is there an algorithm that does that?

Edit: I realize my question is hard to understand, so let me rephrase/slightly change it: What continuous/predictive collision detection algorithm would you suggest?

sentences:
Automated animation retargeting I am currently developing a video game using my own game engine I develop at the same time. While making a good progress in the past months, I am currently stuck. I assume I only miss a minor thing, but I need another pair of eyes and I really hope you can help me!

I wrote a converter which reads FBX files (using the official FBX SDK 2017.0.1) and converts them into my own custom file format. I am able to read meshes, texture and material information, the skeleton and all animation stacks. In my game (engine) I am able to display the textured meshes and animate them with any of the read animation stacks.

However, there is one problem for me. I bought meshes for NPC characters from a 3D artist and I also bought a huge animation pack from another artist. The character meshes include the perfectly textured and rigged mesh with all joints and the animation pack contains a rigged dummy mesh with all joints and animations.

I want to be able to use any animation from the animation pack on any mesh from the character artist.

My first step was to write a joint mapper. When reading the files I know which joint has which type. So, I am able to map the joints from the character mesh to the animation mesh and vice versa. The skeletons of both meshes are pretty similar and the mapping is going to work out.

In the FBX samples the animation calculation for a given vertex is:

Inv(Mesh_GlobalPosition * Mesh_GeometryTransform) * Joint_GlobalPosition * Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix * Mesh_GeometryTransform

Since Mesh_GeometryTransform is the identity matrix for all files I have bought, I can remove it from the term above. The result is:

Inv(Mesh_GlobalPosition) * Joint_GlobalPosition * Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix

Joint_GlobalPosition is the transformation in Bone Space and the only matrix that is time-dependent in this equation. Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix is used to transform the World Space to the Bone Space, as I understood. Finally, Inv(Mesh_GlobalPosition) is used to transform the result back to World Space.

If I understood something wrong, please correct me!!!

The joints which are used for the animation mesh are in a different space than the joints from the character mesh, because they come from different artists. I believe the missing part is to map between the joint spaces of both meshes. However, I do not know where to enter the mapping and I also don't know which spaces do I need to map? Object Space? Bone Space?

I'd appreciate any kind of help and will reward a useable solution with credits in my game!

sentences:
The steps in implementing Bézier triangle patches What are the steps in creating a Bézier triangle patches. What steps would you do in order to create this in directx 11?

Say I just input 3 vertices and create a simple triangle. Is this enough? Or should I create a triangle with 9 vertices, all of them in different heights so it would make a bumpy triangle, then I apply berstein's formulas and make them smooth. so I get like a smooth triangle, not all bumpy.

A triangle like

My book says
Research and implement Bézier triangle patches.

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 11901). Mercury Learning and Information. Kindle Edition.

So what are the steps you would do in order to accomplish it? Please no "coulds"

sentences:
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:
Tips for Component Based Entity System message handling I'm trying to implement a component-based entity system but am a bit confused on how I should handle the messaging. There are two problems I'd like to resolve so I can test the system. Below is the code I have so far,

The Entity class:

class Entity{
public:
    Entity(unsigned int id):
    id_(id)
    {};
    void handleMessage(BaseMessage &message){
        for(auto element: components_){
            element.second->handleMessage(message);
        }
    }
    template<class T>
    void attachComponent(T *component){
        //Consider making safer in case someone tries to attach same component type twice
        components_[typeid(T).hash_code()] = component;
    }
    template<class T>
    void detachComponent(void){
        components_.erase(typeid(T).hash_code());
    }
    template<class T>
    T* getComponent(void)const{
        return *components_.find(typeid(T).hash_code());
    }
    unsigned int getInstanceID(void)const{
        return id_;
    }
private:
    unsigned int id_;
    std::map<size_t, BaseComponent*> components_;
};

The Base Component and Message classes:

class BaseComponent{
public:
    virtual void handleMessage(BaseMessage &message){};
};

class BaseMessage{
public:
    virtual int getType(void) = 0;
};

1. Message Type Handling

My first question is how I should handle the different (derived from BaseMessage) message types.

I have thought of two ways for handling the message types of the derived message types. One is to generate a hash (i.e. using FNV) from a string that names the message type and use that hash to determine the message type. So the handleMessage(BaseMessage &message) function, would first extract this hash from the message and then do a static_cast to the appropriate type.

The second method is to use a template as follows (similar to the attachComponent methods of the entity class),

template<class T>
handleMessage(T& message){};

and make specializations for each message type the specific component is going to make.

Are there any drawbacks using the second method? What about performance-wise, why don't I see this kind of use more often?

2. Input Handling

My second question is what would be the optimal (in terms of latency and ease of use) way to handle input?

My thought was to create an InputHandlerComponent which registers with the keyboard class to listen to specific key presses defined possibly in some file. For example

keyboard.register( player.getComponent<InputHandler>() , 'W')

I wish there was a more concise guide to component based systems but I guess there are many different ways to do the same things. I have more questions but I think it'd be wiser to first try implementing what I can.

sentences:
How do I scale up pixel art without blur in GM Studio? I'm creating a game in Game Maker Studio that uses pixel art.   When I launch the game, all scaled-up textures are really blurry. (It doesn't happen to small ones.)

For example, this image

renders in the game like this:

Is there anyway to resize small pixels into big pixels instead of blurred pixels?

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

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

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

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

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

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

sentences:
Modeling speed of light information propagation in space combat sim I'm working on a space combat sim that takes place over relatively vast areas (a cube of space ~20 light minutes to a side) and uses (mostly) realistic physics. One of the key elements I want to model is the propagation speed of information across the battle space -- that is, if Player A engages his main drive on one side of the battle space, there's a 20 minute delay before Player B sees it and can react to it

Even for relatively small battle spaces this is an important factor given the speeds involved. A 500m long ship doing 30kps is going to displace itself by its full length in 1/60th of a second, so even targeting an opponent just few tenths of a light second away are going to be affected by light lag.

I've not seen this done before, and I'm wondering if there are some best practices for modeling this. Right now I'm timestamping each event and marking it with a location, putting it into a queue, and then each tick checking to see if any of the objects in the game world are newly at the edge of the light cone and adding the event to their sensor queue. I will (but haven't yet) optimize it by removing any events that have already been sensed by all the objects that can possibly sense it, but still, I think this is going to get cumbersome pretty darn fast, and eat up a lot of cycles if there are hundreds of sensing objects in play (which is pretty routine).

Are there data models which would be better suited for this that I should check out?

sentences:
Rendering a distant star field in Unity using a separate camera for near stars I'm currently working on a hobby project which is a universe simulator (exclusive to stars) built in unity3D. In order to deal with the raw scale of the universe I'm trying to implement two co-ordinate systems.

In my project I have two cameras; camera1 is the first co-ordinate system where all stars are loaded as high detail 3D objects. While camera2 is used for gathering a list of points within this "extended" frustum. I want to display these stars from camera2 on the farplane of camera1 in a lowdetail 2d manner.

I'm new to game development so this may be completely wrong; my plan was to generate a mesh from all the points in cameras2 frustum (this mesh now respresents my points in world space). I have a variable that represents the conversionFactor between the two co-ordinate systems. I will convert this mesh into projection view using the my conversionFactor in the translation component.

I will display this projection view on my camera1 farplane selling the illusion of far away stars? Please let me know the flaws in my deisgn! any help is much appreciated

sentences:
What is the license you need to publish to Xbox 360 from Unity3D? I have a license for deploying and releasing games using XNA.
What is the license I need to deploy and publish games using Unity3D, and how do I get it?
I have found very little and unclear information about how to publish to Xbox360 from Unity3D, and I can't come up with search words to get this information.

sentences:
Does inflating scores make players happier? I realize that this will depend on a game-to-game, situation-to-situation basis and that this is not a very technical question, but I remember hearing in a tech podcast a few years ago that inflated numbers of points (e.g. 1000 points vs. 1 point) was preferable in games because it was either a standard or because it had been shown to produce better feedback/experience from users. Either case, it seemed to make users happier than lower numbers of points.

I have since been unable to find supportive evidence either way for the theory that inflating scores can keep the user engaged.

Is this inflated-point theory true? Where can I find more information and, particularly, some experimental data on different approaches and their effectiveness?

sentences:
Where to create the vertex buffers? Please note that this is purely an architectural/design question. And sorry for the long post, there are a lot of "thinking out loud" here.

I'm working on a simple graphics engine (as a universtiy research project) and I'm stuck with a decision. I'm trying to abstract every low level API call (so there is no direct gl/d3d call in the high level of code) making the "engine" basically graphics-API-independent.

Let's say I have a class that can represent the source of any geometry (eg. positions, normals, texcoords, etc). The attributes provided can vary from geometry to geometry, there is no guarantee that every geometry contains all of the possible attributes.

I also have the traditional Scene/GameObject/Component/etc classes: a GameObject can be added to the Scene and a GameObject can contain any number of Components.

Lastly, there are multiple Renderers that iterate over a certain set of "things" and use the RenderDevice to issue graphics commands (like setting states, creating resources, executing draw calls, etc).

I'm wondering where I should create/store the actual vertex buffer(s), etc. As far as I know, it is the best to have the least amount of different vertex layouts. Also, the vertex layout is tightly coupled to the shader (especially in DX11+) so it seems logical that the renderer specifies a vertex struct with a layout descriptor. And this was my initial idea.

However, this means that only the renderer knows how to align/store data interleaved from the individual components of the geometry source. And this means that the renderer should create the actual vertex buffers. (This would also help with static batching, since the batching logic depends on the actual rendering task).

However with this approach a "GeometrySource" might be stored in multiple vertex buffers. For example the ShadowMapRenderer requires only the position component of the geometry. Also it can batch every static geometry into a single vertex buffer since there will be no state/uniform/etc changes between the draw calls.

My very first approach (years ago) was that the GeometrySource self-contained a vertex buffer with a vertex layout descriptor. However there are multiple problems with this approach:

every (even the smallest one) geometry would be stored in separate buffers which would cause a big driver overhead
in the modern graphics APIs (eg. DX11+) the vertex layout is tightly coupled to the shader that will be used to render that geometry (see)
the vertex layout should be checked before rendering (does the buffer provide every necessary attribute with the right format?)

So I don't think that this approach would be beneficial. What is a sensible alternative?

Also, there are multiple stack*** posts, but unfortunately, I couldn't find my answer in these:

https://stackoverflow.com/questions/21347636/dx11-inputlayout-cannot-be-set-to-multiple-shaders
Creating Input layouts for different vertex types
How do commercial games engines organise the index/vertex buffers?

sentences:
Bullets doesn't do any damage I have a melee enemy tagged as enemy. enemy has two coliders: a capsule(physics) and a sphere(for attacking player in radius and istrigger) and a particlesystem, enemy has enemyhealth script attached.

Similarly, bullet has capsule collider and set istrigger, I've attached enemyhealth script to bullet as enemy sphere and bullet capsule are triggers (bullet doesn't have any particle system need fix for this too without raycast), bullets are destroyed on colliding with enemy but doesn't damage the enemy.

script used for enemy health

using UnityEngine;
using System.Collections;

public class enemyhealth : MonoBehaviour {
  public int health = 40;
  public int current;
  //public int score = 10;
  public AudioSource deathclip;
  public ParticleSystem death;
  CapsuleCollider Collider;
  bool dead;
  // Use this for initialization
  void Start ()
  {
    deathclip = GetComponent<AudioSource> ();
    Collider = GetComponent<CapsuleCollider> ();
    death = GetComponentInChildren <ParticleSystem> ();
    current = health;
    dead = false;
  }

  void Update()
  {}

  public void Takedamage (int amount )
  {
    if (dead)
      return;
    current -= amount;

    if (current <=0)
      die ();
  }

  void die ()
  {
    //GetComponent<NavMeshAgent> ().enabled = false;
    dead = true;
    Collider.isTrigger = true;
    deathclip.Play ();
    death.transform.parent = null;
    death.Play ();
    Destroy(death.gameObject);
    Destroy(gameObject);
  }
}

script used for bullet

using UnityEngine;
using System.Collections;

public class mover : MonoBehaviour {
  public float speed;
  public int damage = 10;
  enemyhealth Enemyhealth;
  GameObject ENEMY;
  bool enemyinrange;

  // Use this for initialization
  void Awake () {
    GetComponent<Rigidbody>().velocity = transform.forward*speed;
    Enemyhealth = GetComponent<enemyhealth> ();
    ENEMY = GameObject.FindGameObjectWithTag ("enemy");
  }
  void OnTriggerEnter(Collider other)
  {
    if(other.gameObject == ENEMY && Enemyhealth.currenthealth >=0)
      enemyinrange=true;

    //Destroy(gameObject);
  }
  void OnTriggerExit(Collider other)
  {
    if (other.gameObject == ENEMY)
      enemyinrange = false;
  }
  void Damage()
  {
    Enemyhealth.Takedamage (damage);
  }

  // Update is called once per frame
  void Update ()
  {
    if (enemyinrange)
        Damage ();
  }
}

sentences:
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:
Unity Mask shows black content in world space canvas (Vuforia) So I've built my scroll rect, like this reference tells me to do : http://docs.unity3d.com/Manual/script-ScrollRect.html

-> Scroll View (Rect Transform with scroll rect attached)
---> Viewport (Image + Mask attached)
-----> Content (Image attached)

In scene view it looks like I want it to look like, but in play mode it looks like this, which is the correct shape, but obviously not the correct content :

Update : My Canvas

Update : The Image is getting displayed normally, when I disable the mask.

Update : The source of this problem seems to lie in Vuforia (Image/Object Tracking library) since Vuforia appends a ClippingMask to the cameras

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:
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 would you create a single object effect with ecs like a shadow moving straight and a bouncing ball? I have a bullet that has projectile motion, this bullet is also an effect. Also the bullet has a shadow, that fade on specific time relatively  to bullet. So I'm thinking of using the libgdx particle system (I am using an Entity Component-based System approach) so I created a particle component, or would you rather recommend to create another component for that specific effect? like a projectile component and linear component or a motion component in general.

Creating shadow, bullet, and other single object effect entity. Notice that I doesn't use any Box2d Physics yet.

Entity shadow = engine.createEntity();

... add texture, transform, movement or with gravity components

engine.addEntity(shadow);

To move the shadow entity

// Shadow
Vector2 linear = ...
movement.velocity.set(linear);

To move the bullet entity

// Bullet
gravity.vertical = 9.8f; // set earth gravity
Vector2 projectile = ...
movement.velocity.set(projectile);
// Also I need to calculate the time to reach its destination to add in lifespan

To create and move a ball entity

Entity ball = ...

// assume that the world has zero horizontal and 9.8 vertical Vector2 gravity
// set the physics body and set restitution to have bounce
physics.body = createCircleBody(...);

add(texture);
add(transform);
add(physics);

Every single object has lifespan so I added some lifespan component

LifespanComponent lifespan = ...
lifespan.duration = 0.5f; // let say half a second

Then the lifespan system will handle if the time reached the duration, then remove entity.

The problem is, Because Particle System has many moving objects, I don't know if I could use libgdx Particle System to create a single moving object that has a lifespan, like shadow, ball, bullet.

sentences:
Remove hidden values within string I tried removing the Unicode Whitespaces in the string using words[len].Trim() but still there's still an extra character.

Every letter represents the coordinate of where the letter is. As you can see there's an extra coordinate/value and it is always located at the end of the string. (dont mind the '# tries')
Can you help me Identify what is the extra invisible unicode and what to do in order for it to be removed?

private string[] FisherShuffle(string[] words) {
    int len = words.Length;
    while(len > 0) {
        float index = Mathf.Floor(Random.Range(0f, 1f) * len);
        len--;
        var temp = words[len].Trim();
        words[len] = words[(int)index];
        words[(int)index] = temp;
    }
    return words;
}

UPDATE:
I have found out that the ASCII value is 13. I also have tried using TrimEnd('\n','\n') & words[len].TrimEnd(System.Environment.NewLine.ToCharArray()) to no avail

private string[] FisherShuffle(string[] words) {
    int len = words.Length;
    int index;
    string temp;
    while(len > 0) {
        index = (int) Mathf.Floor(Random.Range(0f, len));
        len--;
        //temp = words[len].TrimEnd('\n','\r');
        temp = words[len].TrimEnd(System.Environment.NewLine.ToCharArray());
        words[len] = words[index];
        words[index] = temp;
    }
    return words;
}

sentences:
How can I change the list of enum options displayed in the inspector? I have an array of enums:

using UnityEngine;

public class EnumsInInspector : MonoBehaviour
{
    [SerializeField]
    public EnumType[] myEnums = new EnumType[3];

    public enum EnumType
    {
        A,
        B,
        C
    }
}

I want it so that if the enum at index 0 is B, then when selecting the enum at index 1, only A and C are options, and B is no longer available.  How can I achieve this?

sentences:
Designing a profit maximization model - multi-level game I am looking for some help in designing a multi-level game for a network simulator I am building.

In this network, actors have a choice to set up a number of units and to fill their units with money. They have a fixed amount of money that they start out with and are aiming to gain the earn the largest monetary reward they can.

Before the game starts, each actor has a heterogeneous amount of money and no units.

A pot of money will be distributed to the actors according to their relative size in the marketplace, which is determined by the number of units they have and the amount of money in each unit. Specifically, each unit will receive a score and the proportion of the reward claimable for that unit is determined by that unit's score divided by the total of all units' scores in the network. Logically, an actor's reward is the sum of their units' scores divided by all the units' scores in the network.

A unit's score is divided into two parts: operations and investment. A unit receives 0.7 points for operating (it is assumed all units will gain at least this score), and a unit can receive up to 0.3 points for the level of investment in the node.

There is a minimum investment of $20 for a unit to be eligible for rewards. When a unit has the minimum investment, it earns 50% of the total possible investment points - 0.15. This gives a node with the minimum investment amount a score of .85.

For all investment above the minimum, there are diminishing marginal returns with the optimal investment being $50, which gives 90% of the total possible investment points - 0.27 - and an overall score of .97

For further reference, here are the percentages of the total possible investment points (0.3) for each investment level.

$20 - 50% (of 0.3) --> .15

$25 - 65%

$30 - 75%

$35 - 81%

$40 - 85%

$45 - 88%

$50 - 90%

This is calculated by an arctan diminishing marginal returns function, the second derivative of which is 0 at $50.

--

How can I write an equation that shows how an actor chooses how many units to build and how much money to put in each unit?

sentences:
Optimizing the economy of a resource management game I am an amateur game designer. I am designing a resource management game involving real money. This is my first time designing such a game. I explain the design and mechanics below. I need feedback from experienced game designers regarding:
i) The sustainability of the core economic loop of this game,
ii) Concrete suggestions to de-risk or fine-tune it (if you can think of any)

My game is about digging up treasure. Treasure is real $$$ players can cash out. The objective of the game is to make as much money as possible.
Players utilize digging machines (excavators) to unearth treasure. The attributes of these digging machines are:

Digging prowess: Most machines are mediocre diggers. I.e. they unearth small treasure. A few rare machines can dig up really big treasure. And then there are other types in between these two extremes.
Scarcity: Only a finite number of machines are available in this game world.
Transparency: Machines' visual design varies in accordance to their digging prowess. I.e. players can easily spot which machine is better than the rest.

Main mechanics:
When a new player joins this game, they utilize real $$$ to buy one or multiple such machines. Once bought, each machine can either be:

Stored away (unused), or

Put to work. Note that when a machine accumulates 1 hour of digging time, it unearths treasure. The amount unearthed is always proportional to the machine's digging prowess.

Putting machines to work has an upside and a downside:

Upside: Machines that are put to work unearth treasure (actual $$$ players can claim).

Downside: Working machines can be forcefully bought by another player (for the machine's current value + 5% profit). No permission is needed. This permanently increases the value of the machine. Which means, if you want to snatch it back, you pay a further 5% increment on top of everything.

Storing machines away has an upside and a downside:

Upside: Nobody can forcefully buy them from the player.

Downside: They don't help the player earn anything.

How do we finance the treasure-finds?
There is a pool of money in the back-end that finances each and every treasure-finding. We finance this pool in two ways:

The first time a digging machine is bought, 90% of the proceeds are routed to this pool (10% are pocketed by the game developer).

I earlier mentioned that whenever a machine is forcefully bought, a 5% profit is paid by the buyer to the unwitting seller. We route 10% of that profit to the treasure pool, 10% to the game developer, and 80% to the unwitting seller of the machine.

It would be great to get feedback from experienced game designers regarding the economic viability of the game's core loop. How do we:

Make it sustainable?
What are the economic risks?
How can they be quantified?
Are there any risk-minimization tactics we can bake in?

sentences:
How to handle wildly varying rendering hardware / getting baseline I've recently started with mobile programming (cross-platform, also with desktop) and am encountering wildly differing hardware performance, in particular with OpenGL and the GPU. I know I'll basically have to adjust my rendering code but I'm uncertain of how to detect performance and what reasonable default settings are.

I notice that certain shader functions are basically free in a desktop implemenation but can be unusable in a mobile device. The problem is I have no way of knowing what features will cause what performance issues on all the devices. So my first issue is that even if I allow configuring options I'm uncertain of which options I have to make configurable. I'm wondering also wheher one just writes one very configurable pipeline, or whether I should have 2 distinct options (high/low).

I'm also unsure of where to set the default. If I set to the poorest performer the graphics will be so minimal that any user with a modern device would dismiss the game. If I set them even at some moderate point, the low end devices will basically become a slide-show. I was thinking perhaps that I just run some benchmarks when the user first installs and randomly guess what works, but I've not see a game do this before.

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:
Must read game development books Let's make a list of the best books that every game developer should read.

Each answer should have a single book (by title and optionally author), a link to buy the book, and a short synopsis of what the book is about.

sentences:
How do I get the vertical angle between 2 vectors? So I'm modding a 3D game, my goal is to place a label on the screen pointing to the unit's direction. I'm getting the horizontal angle by projecting these vectors in a plane, like this:

private double getXAxisAngle(EntityPlayer player,EntityPlayer player2){

    double meYaw = player2.rotationYaw;
    double meX = player2.posX;
    double meZ = player2.posZ;
    double playerX =  player.posX -meX;
    double playerZ =  player.posZ-meZ;
    double yawX = Math.cos(Math.toRadians(meYaw));
    double yawY = Math.sin(Math.toRadians(meYaw));
    double dist = getDist(playerX,playerZ);
    playerX = playerX / dist;
    playerZ = playerZ / dist;
    dist = getDist(yawX,yawY); //get the vector magnitude
    yawX = yawX / dist;
    yawY = yawY / dist;
    double angle1 = Math.toDegrees(Math.atan2(yawY, yawX));
    double angle2 = Math.toDegrees(Math.atan2(playerZ, playerX));
    double angle = angle1-angle2;
            angle+=90; //So when it's facing the other unit it becomes 0
    if(angle > 180)
        angle-=360;
    else if(angle < -180)
        angle += 360;

    return angle;
}

This function gives me an angle between 0/-180 and 0/+180, depending on which side I'm facing then I get this angle and transform into a coord into the screen like this:

private double angleXToPosition(double angle,FontRenderer fontrenderer,String label)
{
    ScaledResolution scaledresolution =
        new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

    double width = scaledresolution.getScaledWidth();

    double namePosX =
        (int)(angle * ((width / 2 - (fontrenderer.getStringWidth(label) / 2)) / 50)) +
        width / 2 - (fontrenderer.getStringWidth(label) / 2);

    //If the angle is bigger then 50 the label sticks on the side of the screen
    if (angle > 50)
        namePosX = width - (fontrenderer.getStringWidth(label));
    else if (angle < -50)
        namePosX = 0; //Same as above

    return namePosX;
}

And it works until this, the label moves perfectly to the sides, accompanying the unit position on the screen, but now I'm trying to make the label move up and down and the same functions doesn't work, and I can't figure this out.

Some info: the pitch of the player when facing the sky is -90 and when facing the ground is 90.

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:
Real-time 3D Scene-reconstruction into Physics Engine I am trying to create a game where the user scans the room using RGBD camera and reconstructs 3D scene. This scene would be integrated into physics engine, after an object recognition algorithm tells it what objects are there in the scene and of what shape and size. Finally, after being rendered in Physics Engine, user should be able to interact with the environment.
I know how to do 3D scene reconstruction from images, I can figure out how to contruct objects and interact with them in Physics Engine. I know how to do object recognition, shape and size.
However, I am not sure how to integrate the output of 3D scene reconstruction, Object Recognition as input to the physics engine.
Any ideas would be helpful.

sentences:
How to smooth low-res sampling of noise for voxel terrain I am attempting to create a new terrain generator as part of a minecraft mod, which works very well if it samples at the full terrain resolution (16x256x16 voxels per terrain chunk). This is extremely laggy, so i attempted using a lower-resolution sample, x4x64x4, with an extra one sample on each positive axis to interpolate with (5x65x5, representing 20x260x20 space).

It all works fine until i try to smooth out the resulting 4x4x4 cubes of terrain. I have tried interpolating the noise value (0.0 to 2.0) of each block with the value next to it along each positive axis, each value weighted by how close the block is to it.

The result has some smoothing, but some of it seems to be rotated 90 degrees, and some areas are unsmoothed. I know this is possible, minecraft does it internally (the code is illegibly obfuscated and messy, about half a page, 20 variables and 6 loops).

Does anyone have any ideas about a reliable method for smoothing, only knowing the contents of the chunk and one sample to the north/east/top?

my current noise array generator:

protected double[] getNoise(float x, float z)
{
 // get a rough noisemap every 4 blocks, 1 more past the edge to round with
 double[] n = new double[1625]; // x65x5x5 3D space in order y,x,z  represents one chunk at 1/4 precision (1024 blocks plus 601 blocks padding along the positive-axis sides for rounding. Minecraft uses 825 doubles internally, 5x33x5)

 for(int lx = 0; lx < 5; ++lx)
   for(int lz = 0; lz < 5; ++lz)
   {
     // some extra noise that controls terrain thickness along Y
     double m = 32+(1f+SimplexNoiseGenerator.getNoise( (x+(lx*4))/256, (z+(lz*4))/256) )*32;

     for(int ly = 0; ly < 65; ++ly)
     {
       n[ (ly*25) + (lx*5) + lz ]= ( 1f+SimplexNoiseGenerator.getNoise( (float)(x+(lx*4))/512f, ((float)ly*4)/m, (float)(z+(lz*4))/512f ) ) * (1.5f-(Math.abs(32f-ly)/32f) ) ;
     }
   }
   return n;
}

Someone posted this on stack overflow, it is exactly the same problem and seems to be unresolved. https://stackoverflow.com/questions/35852194/smooth-lower-resolution-voxel-noise

sentences: 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:
string on GUI.Button not showned I am sure that inventoryItem.Name contains "Wood" cause i see it when i add a breakpoint. Still i get nothing in the game. Just empty buttons.

void DrawInventoryContent (int id)
    {
            var buttonIndex = 0;
            var x = 0;
            var y = 0;

            foreach (var item in inventoryItems) {
                    //create position rectangel for button
                    var startMargin = buttonMargin;
                    var leftStartPosition = startMargin + buttonMargin * x + buttonWidth * x;
                    var topStartPosition = startMargin + buttonMargin * y + buttonHeight * y;
                    var buttonRectangel = new Rect (leftStartPosition, topStartPosition, buttonWidth, buttonHeight);

                    //Get inventoryiten by index
                    var inventoryItem = inventoryItems [buttonIndex];
                    var name = inventoryItem.Name;

                    //Create and place buttin
                    GUI.Button (buttonRectangel, name);

                    // check if this button is at end of row and change to next row
                    if (x == buttonsPerRow - 1) {
                            x = 0;
                            y++;
                    } else {
                            x++;
                    }
                    //go to next item
                    buttonIndex ++;

            }
    }

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:
How to extrude mesh? Say we have the following simple mesh data:

// additional data
// Vector3(x, y, z) - +x left, +y up, +z forward
// triangle indices are in clocwise order

// list of vertices that form a place
List<Vector3> vertices = new List<Vector3>() {
  new Vector3(2f, 0f, 2f),
  new Vector3(-2f, 0f, 2f),
  new Vector3(2f, 0f, -2f),
  new Vector3(-2f, 0f, -2f),
};

List<int> indices = new List<int>() {
  0, 3, 2, 3, 0, 1
};

How to extrude given plane in a certain direction? E.g 2f in y axis, it should form a bottomless cube.

I'm interested in how it works in general, not only this specific example.

sentences: How can I play and stop a Visual Effect Graph effect through script? Can anyone please give an example lines of code one could use to play/stop a VFX through C# script.

sentences:
Problem with rotation a camera with the mouse OPENGL GLFW I am trying to move my camera with my mouse, I can translate it juste by changing the current position of my camera, but when I want to move my forward vector and my up vector of my camera it doesnt work very well, the camera seem to move whereas it's not the case...

void Camera::moveCameraRotateUpdtade(GLFWwindow * window)
{

 //curseur mvt ...
  double xpos, ypos;
  Vec3f new_front;
  std::cout << "front = " << CameraFront << std::endl;

  glfwGetCursorPos(window, &xpos, &ypos);
  if(!(xpos > _width-1 || xpos < 0) && !(ypos > _height-1 || ypos < 0))
  {
    float x = (2.0f * xpos) / _width - 1.0f;
    float y = 1.0f - (2.0f * ypos) / _height;

horizontalAngle += mouseSpeed  * float(x) ;
verticalAngle   -= mouseSpeed  * float(y) ;

std::cout << "x y = " << x << " " << y << std::endl;
std::cout << "horizontalAngle verticalAngle = " << horizontalAngle << " " << verticalAngle << std::endl;

new_front = Vec3f(cos(verticalAngle) * sin(horizontalAngle),sin(verticalAngle),cos(verticalAngle) * cos(horizontalAngle));
Vec3f right = Vec3f(sin(horizontalAngle - M_PI/2.0f),0.0,cos(horizontalAngle - M_PI/2.0f));
CameraUp = right.cross(new_front);
CameraUp = CameraUp.normalize();
CameraFront = new_front.normalize();

std::cout << "CameraFront = " << CameraFront;
std::cout << "CameraUp = " << CameraUp;
std::cout << "position = " << _positionCam;

LookAt( _positionCam + CameraFront,_positionCam, CameraUp);
}

}

Here my lookAt function :

Mat4f Camera::LookAt(Vec3f target, Vec3f position,Vec3f CameraUp)
{
  //ce dont j'ai besoin pour calculer les parametre de ma camera...
  Vec3f f = (target - position).normalize();
  Vec3f u = CameraUp.normalize();
  Vec3f s = f.cross(u).normalize();
  u = s.cross(f);

  Mat4f R;
  R.setCol(0,s);
  R.setCol(1,u);
  Vec3f f_tmp = f*-1.0 ;
  R.setCol(2,f_tmp);
  R.setElement(0,3,-1.0f * s.dot(position));
  R.setElement(1,3,-1.0f * u.dot(position));
  R.setElement(2,3,f.dot(position));
  _LookAt = R.transpose();

  return  _LookAt;

}

Here a video showing my problem :

https://www.youtube.com/watch?v=Am_1sfMQllQ

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:
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:
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:
Approaches on 2D top-down track racing visualisation I'm considering writing a very simple management style game with the theme being motorsport racing.
I've got a good idea how to do the 'management side', but the issue I'm having is how to visually render cars and move on a track (something a bit like):

The key points (keeping it simple):

the user won't control the vehicle directly, they are the 'manager' (think football manager) - they can decide on a strategy but cannot control the vehicle
the car should stay on track (visually) - they may 'crash' (along with other events) though
the speed it goes around the track is determined by vehicle performance
a car will be aware of other near-by cars around the track - for example, if they're about to be overtaken, they may actually do a slower lap as they are defending - they may collide, along with other events

My initial thoughts are there are two key design elements here, the track and the car.
The track:

a track is composed of many segments
each segment is stored in an array
a segment (I'm not entirely sure here) but one thing it might contain is a 2D array:

(From [this](https://gamedev.stackexchange.com/questions/149966/approaches-on-2d-top-view-racing-game-track-design) answer gave an approach of using multi-dimensional arrays)
_ _ _ _ _ _ _ _ _ _
| d d x x x d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d r r r d d d |
| d d e e e d d d |
| _ _ _ _ _ _ _ _ |

_ _ _ _ _ _ _ _ _ _
| d d x x x d d d |
| d d r r r d d d |
| d d d r r r d d |
| d d d d r r r e |
| d d d d r r r e |
| d d d d d d r e |
| d d d d d d d d |
| d d d d d d d d |
| _ _ _ _ _ _ _ _ |

Above is a straight and a 90 degree corner - x exit, e entry, r racetrack and d dirt. Maybe I could create a bunch of these and create a track.
Or maybe a simpler version where I define just an entry and exit:
_ _ _ _ _
| d e d |
| d r d |
| d e d |
| _ _ _ |

_ _ _ _ _
| d x d |
| d r e |
| d d d |
| _ _ _ |

The simplified version where I define an entry e and exit x. I can add additional points r and then construct a curve/straight-line based on the x, e and r coordinates?
My idea is that the vehicle will then move across each segment and I can calculate the time it takes to complete that segment. I can then add up all segments which will give me the lap time. With this approach, I can also check the previous/current/next segment to determine if there are other vehicles it needs to defend/attack against.
The car:

store all vehicles in an array
each vehicle will always be in a segment
speed it completes the segment is determined by its performance (and segment characteristics)
vehicle can 'see' if there are other vehicles in previous/current/next segment and decide whether to overtake/defend.

I think I could make this work, but I'd be really interested to know if there are better/simpler approach - bearing in mind it's mostly a visualization and the speed and events are determined by my program.

sentences:
My game is mostly complete, how do I find a publisher? I've been working for quite a while on a game.

I'm mostly done with it.

Simply finishing the project, adding banners and just publishing it on google play / appstore probably won't bring in any money, at least without firstly investing some in promotion...

How do I go about finding companies that might be interested in either promoting or maybe even fully buying out such a product?

sentences:
Love2d: Failed to load tileset map I'm reading the Love2D Development book, which i think i will stop reading because is outdated and very instable, sometimes i got a lot of troubles. Backing to the question, i made a tileset map with Tiled and saved in .tmx with Base64 ( uncompressed ) then i used Advanced-Tiled-Loader and used the code from the book:

-- This is the main.lua file --

local loader = require ("Advanced-Tiled-Loader-master/Loader")

---the path to our .tmx files and sprites

loader.path = "map/"

local map = loader.load("tilemap.tmx")

function love.load()

    love.graphics.setBackgroundColor(255, 153, 0)

    --- load the level and bind the variable map

    loader.path = "map/"

    local map = loader.load("tilemap.tmx")
end

function love.draw()

    map:draw()

end

When i tested the game, the result was this:

http://i.imgur.com/JM8EYrv.png

The result was suposted to be like this:

http://i.imgur.com/W26XFjE.png

So what it could be?

sentences:
Matching a chunk of procedurally generated world to a chunk of other world Have you read The Chronicles of Amber by Roger Zelazny?

Imagine yourself playing in 3rd person MMO game. You spawn in the world and start to wander around. After some time, when you think, that you've learned the map, you realize, that you are in a place, that you have never seen before. You go back to the last place you were sure you know and it is still there. But the rest of the world has changed and you didn't even notice how did it happen.

I've read about procedural world generation. I've read about Perlin noise and octaves, Simplex noise, Diamond-square algorithm, about simulation of tectonic plates and water erosion. I believe I have some vague understanding of general approach in procedural world generation.

And with this knowledge I have no idea on how can you do something like written above. Every idea that comes to my mind encounters some theoretical problems.
Here are some ideas I can think of:

1) "Reversible" world-generation with a seed number as input and some fully-describing-a-chunk-number

I doubt that it is even possible, but I imagine a function, that will receive a seed and produce a matrix of numbers, upon which chunks are built. And for each unique number there is an unique chunk. And a second function, that gets this unique chunk number and produces a seed, that contains this number. I've tried to make a scheme in the picture below:

2) Making chunks completely random and make a transition between them.

As Aracthor suggested. The benefits of this approach is that it is possible and it doesn't require a magic fuction :)

The cons this approach has in my opinion, is that it's likely not possible to have a diverse world. If you have let's say both archipelago and a continent represented by just one number and it's adjacent chunks, then wouldn't the size of a chunk be equal to continent. And I doubt that it is possible to make good-looking transition between chunks. Am I missing something?

So, in other words, you are developing a MMO with procedurally generated world. But instead of having one world, you have many. What approach would you take to generate worlds and how would you implement transition of player from one world to another without player noticing the transition.

Anyway, I believe you've got the general idea. How would you have done it?

sentences:
HLSL compiler specification (optimizations) Can I read somewhere about optimizations that HLSL compiler performs?

For example, in some codes I have different variables that get a constant value (just to let myself adjust the shader with other values) and I use them later in some mathematical expressions, but actually it can be precalculated earlier. Does the compiler do such thing?

It's just an example, I would like to know most of these things.

sentences:
Embed Unity3D and load multiple games from a single app Is is possible to export an entire unity3d project/game as an AssetBundle and load it on iOS/Android/Windows on an app that doesn't know anything about such game beforehand? What I have in mind is something like the web plugin does - it loads a series of .unity3d files over http, and render inline in the browser window.

Is it even possible to do something closer for iOS/Android?

I have read a lot of docs so far, but still can't be sure:

http://floored.com/blog/2013/integrating-unity3d-within-ios-native-application.html
http://docs.unity3d.com/Manual/LoadingResourcesatRuntime.html
http://docs.unity3d.com/Manual/AssetBundlesIntro.html

The code from the post at http://forum.unity3d.com/threads/112703-Override-Unity-Data-folder-path?p=749108&viewfull=1#post749108 works for Android, but how about iOS and other platforms?

sentences:
General pointers and advice in creating inventory structure? I am working on text-based Diablo-like RPG, where each weapon and armor has unique stats and names and there is a lot of overlap. Ie I can generate Silver Sword with 40 damage, but I can also generate Silver sword with 20 damage. So those items can't obviously be stored as one value. I am thinking of storing the items in multidimensional array where one column would store weapon name and the other column would be used for storing the damage. Same for armor etc. But I feel this may get cumbersome and spiral out of control very quickly.

Is there any other data structure I could use and have more flexible and efficient solution?

sentences:
How would I go about making a movement system like Mario Party? Main question

How would I go about getting a movement system similar to the one they have in Mario Party only minus the dice roll?

Things I have researched

I have been studying the uses  for ****arrays ,lists, for loops,onmousebuttondown**** but I want to make a movement system where the player has a limited amount of spaces, clicks a tile, and then moves to it. I kind of have a vague idea of how to go about this and I kind of know what I need......and I kind of don't....basically my brain isnt working and kind of hit a road block... Thus far all I have is the board it self...
I understand how to make the highlights work when the cursor moves over the tile ..... but the major thing I can't figure out is how I should actually get the player to move after I click on the tile with the mouse button and have the player only move in a limited range.

Summary of things I'm looking for

Movement system kind of like mario party but minus the dice roll
and instead of game board it would be on a grid

Players would only be able to move x amount of spaces both horizontally and vertically

Strictly for unity and please put any code in c#

Not looking for you to do my work but an example would be nice or at the very least point me in the right direction

Also, the board would be in a top down view but in 3d

I pretty much have an idea know what i need i just dont know the how
to

Im not looking for a way to highlight the board just the turn based movement system itself.  I thought I was clear with my question but maybe not as clear as I thought I was*

Picture of the grid on unity and an example of the turnbased movement system im looking for

using UnityEngine;
using System.Collections;

public class GridScript : MonoBehaviour {

    public Transform cellPrefab;
    public Vector3 Size;
    // Use this for initialization
    void Start () {
        CreatGrid ();

    }

    void CreatGrid (){

    for (int x = 0; x< Size.x; x++) {
        for (int z = 0; z< Size.x; z++) {
                Transform newCell;
            newCell = (Transform)Instantiate (cellPrefab, new Vector3 (x, 0, z), Quaternion.identity);
                newCell.name = string.Format ("({1},0,{1})",x,z);
                newCell.parent =transform;
                }
            }
        }
}

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:
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: Looking for good comunication schema in turn-based game with multiple players based coop game that will need to communicate to the server to handle the game process. Basically I need to be able to invite to the game, progress through turns (one player at a time) and finish in win or loss. Also players could drop off from the game and the game should continue. Is there a known basic schema for this or a set of standards?

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

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

sentences: glDisableClientState in OpenGL I'm just wondering why we need to call glDisableClientState(GL_VERTEX_ARRAY) after the drawing of a vertex array. Is it possible to just leave it there for the next drawing? Is there any side effect of doing this?

sentences:
Store static environment in chunks I have terrain separated by chunks and I would like to put environment (For example, rocks, trees, etc..) in each chunk randomly.

My question is related to how to implement such system in OpenGL.

What I have tried:

Solution: Draw the environment with instancing once for all the terrain (not a specific chunk)

Problem: I except the chunk to sometimes take a bit to load and because I am using threads the environment will appear as floating.
Solution: Draw the environment with instancing for each chunk.

Problem: To draw each chunk, I will need to bind the VBO for the chunk, draw the chunk, bind the VBO for the environment (and the VAO probably) and draw it.

I don't want to put so many glBindBuffer functions because I heard it is slow (Please correct me if I am wrong)
(Not tried) Solution: Somehow merge the vertices of the terrain with its environment and draw them together.

Problem: My terrain is drawn with GL_TRIANGLE_STRIP so this is a first problem, the second problem(?) is that I don't know how well it will function (talking speed).

I tried looking up solutions on the internet but didn't seem to find any that relate to chunks.

Anyone know how other games that uses chunks do that? Is there a way to do it without causing a lot of speed decrease?

sentences:
Creating a bitmapfont from images? A bitmapfont consists of a image and a textfile that hold the position and size of each character on that image. Is there any way to create the text file with just a image? Or do I have to manually create the "atlas" for each character, which is kinda tedious.

Here is a line for a character in such a textfile .fnt

char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0

I think xadvance would mean how many pixels to advance on the line to put the next character. I have 36 characters A-Z0-9 but I want upper and lower case to output the same image.

I need this specifically for libgdx but this would probably be the same for any tool that uses a BitmapFont.

In addition I have a xml file that came with the sheet that includes the characters allong with the other images.

<TextureAtlas imagePath="sheet.png">
  ...
  <SubTexture name="letterA.png" x="412" y="835" width="61" height="64"/>
  <SubTexture name="letterB.png" x="460" y="977" width="52" height="66"/>
  <SubTexture name="letterC.png" x="432" y="1613" width="54" height="66"/>
  ...
</TextureAtlas>

I also have a each character separately in PNG and Vector.

To make clear to what I need this is a complete .fnt it needs to be accompanied by a single image that holds all the images of each character.

info face="FontName" size=78 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=93 base=73 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="fontsheet.png"
chars count=83
char id=32   x=0     y=0     width=0     height=0     xoffset=0     yoffset=73    xadvance=25     page=0  chnl=0
char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0
char id=106   x=46     y=0     width=19     height=82     xoffset=2     yoffset=9    xadvance=26     page=0  chnl=0
char id=41   x=65     y=0     width=20     height=75     xoffset=1     yoffset=3    xadvance=26     page=0  chnl=0
char id=40   x=85     y=0     width=21     height=75     xoffset=2     yoffset=3    xadvance=27     page=0  chnl=0
char id=96   x=106     y=0     width=31     height=75     xoffset=5     yoffset=0    xadvance=39     page=0  chnl=0
char id=64   x=137     y=0     width=72     height=68     xoffset=1     yoffset=7    xadvance=77     page=0  chnl=0
char id=48   x=209     y=0     width=51     height=68     xoffset=1     yoffset=7    xadvance=57     page=0  chnl=0
char id=85   x=260     y=0     width=54     height=68     xoffset=1     yoffset=7    xadvance=60     page=0  chnl=0
char id=79   x=314     y=0     width=60     height=68     xoffset=1     yoffset=7    xadvance=65     page=0  chnl=0
char id=38   x=374     y=0     width=60     height=67     xoffset=2     yoffset=8    xadvance=65     page=0  chnl=0
char id=54   x=434     y=0     width=47     height=67     xoffset=1     yoffset=8    xadvance=53     page=0  chnl=0
char id=121   x=0     y=83     width=43     height=67     xoffset=1     yoffset=26    xadvance=48     page=0  chnl=0
char id=113   x=43     y=83     width=48     height=67     xoffset=1     yoffset=24    xadvance=53     page=0  chnl=0
char id=112   x=91     y=83     width=48     height=67     xoffset=0
// etc...

sentences: Maximum audio delay before the player notices? Given some event in a game, what is the maximum delay to producing audio that the player will properly associate the audio with that event (and not perceive lag)?

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:
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:
Check if point lies within coordinates Let's say I have min (0,0,0) and max (1,1,1).
If I have 3 points, lets say

a (0.2,0.4,0.2)
b (-0.5,0.8,0.2)
c (2,0.3,0.1)

How would I go about calculating it those points are within the coordinates of min and max?
Note that I am using simple shapes such as Cubes and that I am going to use this for optimizations with octrees

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 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:
Should I batch up debug primitives for rendering in modern OpenGL? I've recently started porting some old rendering demos I did to modern OpenGL. I had a debug drawing class in my old code which used immediate mode glBegin(), glEnd() etc. for rendering debug objects such as triangles, cubes and spheres etc.

Originally I replaced the code in these functions with code to generate the VAO and VBOs (for position and colour), bind them, assign the vertex data, render, then disable and delete the VBOs and VAO. Is there anything wrong with this?

I've been thinking about modifying the class so that every time it gets a draw primitive call it generates the VAO and VBOs and assigns the vertex data but doesn't actually do the rendering until after all the other rendering has been completed. Then it renders all the debug prims that have been stored at once.

I'm not sure of the benefits of either way of doing this and was just wondering what people thought.

sentences:
Good Way to Handle Scheduled Events in Mobile Multiplayer Strategy Games I am developing a mobile strategy game like Clash of Kings. There are scheduled events in the game (like constructing buildings, recruiting troops, and attacking to other settlements) which happen when a specified time comes.

I was wondering what is a good way to handle these kind of events?

In my current design, I am using AWS products everywhere. A load balancer redirects a user request to one of the http servers which runs a nodejs code. Nodejs script creates an event record which contains required data to do the event later.(For example it contains number of soldiers, defender settlement, event time etc. in case of attacks.) It then inserts a record to a table called Events in DynamoDB(NoSQL DB in AWS). DynamoDB supports something like a callback system using AWS Lambda and DynamoDB Streams, which basically allows me to run a serverless code whenever new data is inserted to a table. I am planning to write a lambda function that connects to an internal worker computer through an internal load balancer, and gives event data to the worker for it to process. Worker runs a java code, and uses a priority queue to hold events. At each second, it pops events whose time has come from priority queue and spawns threads to handle them. Threads does the required calculations, inserts the results to DynamoDB, and possibly sends notifications to users through AWS SNS.

The reason I did not connect directly to workers from http servers was to use http servers to answer user queries as fast as possible, and carrying load to the background system.

Do you think handling timed events like this is a good solution? Is there a standard or a better way to approach this problem?

My main concern is that I will be running a loop that sleeps for 1 sec and polls the priority queue. If I was able to design a callback like system, which calls a function when the event time comes, I would be using less resources. Is there such an architecture or a system that makes this easy?

As an alternative, I read that some browser strategy games do not have background processes, and they do available events on user requests. Before handling each request, they run a code that does due events. Would that be a better approach?

As a footnote, I want to develop a system that is easily scalable which can support number of users in the order of millions.

sentences:
How do I calculate the new Quaternions from translated points? The code below is for a rag-doll using Verlet method, I have the correct points (or joints) positions, I just need the correct Quaternions, otherwise the resulting model looks like in the picture, I'm constraining the body to the bind pose on purpose for testing purposes.

Based on the two points, their position and quaternion, what will the new Quaternion be for each translated point?

struct Point
{
    XMVECTOR position = { 0,0,0 };
    XMVECTOR quaternion = { 0,0,0,-1 };
};

Point p1;
Point p2;

p1.position += { 0.0f,0.3f, 0.1f };
p2.position += { -1.0,0.3f,0.1f };

sentences:
Interact with texture / flat surface (Unity) I don't know exactly how to put this into words, so googling did nothing really for me.

Imagine a bowling game. On the oldern bowling lanes there was only a scheme of the pins above the lane, lighting up all the pins that are still standing, while the ones that already fell, were not lit anymore.

How can I achieve this in Unity? Is there any way to do this, without having to make something stupid like creating hundreds of textures, with all the possible combinations and swap them out?

I'm still very new to Unity, so I'd love to know the best approach to something like this.

Thank you very much in advance

sentences:
How can I efficiently store tilemaps in work memory? I've been working on different tile-based projects, but never really bothered with being efficient memory-wise. Each tile was represented by a tile class which would hold the following:

X and Y ID of the tile
Solid boolean
Events for entities when leaving or entering a tile
Graphic data
Size

But especially now, when using a component based system where everything is an entity (which has some base functionality which already takes some memory), I've started to run into memory issues.

I started looking at existing tile engines and noticed that a lot of them don't even have a tile class, but just use an array of integers. I figured you could just use the index of the array for position and the actual integer value for the graphics.

But how would store the other data for this tile? With the events for example, would save them externally from the array or something? This would mean that you would need to have a list for every property you want to save, which sounds like a pain in the ass.

It might be good to know how they would have handled this on a more limited platform, let's say the SNES?

sentences:
How to efficiently move in Unity2D? If i want to use Physics in Unity2D what should be the most efficient way to move the object without interfering physics?

 1. Transform.position
 2. Rigidbody.Velocity
 3. Rigidbody.addForce
 4. Transform.translate
 5. Rigidbody.movePosition

Seems like there are a lot of ways and each way has a special purpose for when it should be used and when not. I just don't know that.

sentences:
How to remove terrain in 3d? After the release of Minecraft I saw more and more rip offs of the game but some actually began to change it up a bit making the game have a organic look instead of the iconic blocky one that Minecraft does. If you'd like to look at the game that i'm referring to you can do so here. If you skip to around 50 seconds on the first video the steam page offers you can see the mining part that i'm wondering about.

I was wondering how this affect is achieved where they are able to remove part of the 3D object on collison with the players pick. I have heard about constructive solid geometry before and figured that could have been used but i'm not so sure.

sentences:
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:
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:
Unity Analytics: I see custom events in funnels, but not in the Event Manager? I've just started using Unity Analytics, and I send two custom events: level1Started and level2Started.

After 1,5 days, the first results came in:

The funnels are working, so my custom events do reach Unity Analytics.
But in Event Manager I can't see the mentioned events by themselves.

4 days already have passed, the funnel is updated every day, but the Event Manager is still empty.

Or I'm looking at the wrong page? Then where can I see the raw number of events?

Why?

UPDATE:

For some reason, it took 12 days for them to show up in the Event Manager as well. Anyone knows why?

UPDATE AGAIN:

Now it's gone again. Why?

sentences:
How to get the overlap volume of OBB and or ABB? The following code is a current attempt at a function I have to determine if two bounding boxes overlap. The bounding box structures are [min[x,y,z], max[x,y,z]] The following .gif shows the current undesired behavior.

aabbOverlap(otherWorldAABB){
  // copied from
  // http://blog.meltinglogic.com/2015/04/aabb-overlapping-area/
  // Vector3 min = Vector3(max(min1.x, min2.x), max(min1.y, min2.y), max(min1.z, min2.z));
  // Vector3 max = Vector3(min(max1.x, max2.x), min(max1.y, max2.y), min(max1.z, max2.z))

  return [
    [
      Math.max(this.worldAABB[0][0], otherWorldAABB[0][0]),
      Math.max(this.worldAABB[0][1], otherWorldAABB[0][1]),
      Math.max(this.worldAABB[0][2], otherWorldAABB[0][2]),
    ],

    [
      Math.min(this.worldAABB[1][0], otherWorldAABB[1][0]),
      Math.min(this.worldAABB[1][1], otherWorldAABB[1][1]),
      Math.min(this.worldAABB[1][2], otherWorldAABB[1][2]),
    ]
  ]
}

The gif has a render of the two entities bounding boxes the house and robot they are rendered in pink and then green when they overlap. Then I try to render the verts and the volume for the overlap section in White. You can see in the gif that some of the verts are way off from what you would expect and the volume gets skewed

Why I need this

I am using the AABB collision as the broad phase of my detection test. I want to calculate the overlap to restrict the narrow phase algorithim to within that overlap space. The narrow phase pass i'm using is a swept-sphere-to-triangle detection. I want to limit the mount of triangles scanned to within the overlap.

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:
What technique can I use to animate interaction between tiny objects in a sim game? In simulation games like Sim City and Factorio, there are numerous interaction between tiny objects that needs to be animated. e.g. random people walking on the sidewalk, then waits for a bus, then board the bus; tiny cars waiting in line for each other at the traffic junction; thousands of items on a convey belt and the robotic arm needs to wait for an item to arrive in front of it to pick it up; conveyor belt sections transferring items from one to another.

I expect the collision detection check for every tiny object independently will eat a lot of CPU; what technique can I use in such a game to avoid the heavy computation and make it look like it's realistic?

sentences: How can I change the appearance of the mouse cursor in libGDX? How can I change the mouse a cursor to a picture using libGDX?

sentences:
LibGdx ImageButton in table not clicking i'm having a problem adding ImageButtons to a Table in libGDX. The buttons seem to work fine when i add them directly to the stage, i can click on them, and they change textures and do whatever they are suppossed to. However, when i add them to a table, and then add the table to the stage, i can't click on them for some reason.

This is how i'm creating a button (aButton is an ImageButton which i declared preivously)

public void configAButton(Texture pressedTexture,Texture notPressedTexture)
{
Skin skin = new Skin();
skin.add("button_down", pressedTexture);
skin.add("button_up", notPressedTexture);
ImageButton.ImageButtonStyle buttonStyle = new ImageButton.ImageButtonStyle();
buttonStyle.imageUp = skin.getDrawable("button_up");
buttonStyle.imageDown = skin.getDrawable("button_down");
aButton = new ImageButton(buttonStyle);

}

i use that method in "show()", and once i've done that i create my table like

 userInterfaceTable = new Table();
 userInterfaceTable.setWidth(stage.getWidth());
 userInterfaceTable.align(Align.bottomRight);

i just add the button to the table

userInterfaceTable.add(aButton).size(60,60).padRight(30);

And add the table to the stage

stage.addActor(userInterfaceTable);

what am i missing? thanks in advance, i'm quite new to this.

sentences:
How to start an animation just once on an event in libGDX I am trying to show an explosion animation which i created using a few textureregions and created Animation missileblastAnimation from those textureregion like this -- >

 TextureRegion[] explosion = { explodemissile1, explodemissile2, explodemissile3, explodemissile4, explodemissile5,
                 explodemissile6, explodemissile7,explodemissile8, explodemissile9, explodemissile10, explodemissile11,
                 explodemissile12, explodemissile13, explodemissile14,explodemissile15, explodemissile16, explodemissile17,
                 explodemissile18};
        missileblastAnimation = new Animation(0.1f, explosion);
        missileblastAnimation.setPlayMode(Animation.NORMAL);

I have this following code in the render method -- >
Note:-  explosionstarted is set to true when missile hits the ground

  if(explosionstarted){//check if the missile hits the ground to start explosion animation
       batcher.draw(AssetLoader.missileblastAnimation.getKeyFrame(runTime),
                              100, 300-102, 50, 102);
      if(AssetLoader.missileblastAnimation.isAnimationFinished(runTime)){
     // i found that isAnimationFinished tells if animation is finished or not but i still cant understand the passing runTime thing
          explosionstarted = false; //reset the boolean to make the animation stop drawing
        }
    }

Problem is the animation is not playing as it should i.e sometimes it plays too much fast . sometimes it skips first few frames and jumps to ending frames.
What is the right way to do this?
Is there any other way i can check if the animation is completed ?

sentences: Fixed time step with Akihabara How could I implement fixed time step with Akihabara framework? I would like my avatar to move by fixed distances of one block as in Supaplex.

sentences:
Swap limbs of a skinned mesh If I have a model, such as a robot, I am able to swap its limb meshes out and replace them with other robot limb meshes by merely removing the limb mesh from the skeleton and attaching the new one to the appropriate bone.

Now I want to essentially do the same thing but with a skinned mesh, say a human/monster character. For example I want to swap a normal human arm for some bad-ass demon arm. How do I go about doing this as I believe I need to take into account skin/bone weights etc.

Didn't Spore do something similar? Although my skeleton would be predefined as opposed to the ones created in Spore.

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:
Minecraft: What is the reasonable face/vertex limit for custom models? When adding custom models to function as tile entity representations, what is a reasonable ceiling - based on performance - to maintain for individual models? Assume that the player will have the potential possibility to place as many of these as desired, but functionally it would also be reasonable to assume no more than 20 would have to be rendered at once.

If the answer has changed between significant versions of the game, it would be nice if that could be reflected

sentences:
HUD and score have gone missing in UnrealScript I am a student at Full Sail so I don't want just the solution; I want to understand the problem. I am working from tutorial videos where we are supposed to have a HUD, a score, and a timer. When I first started, my player had a gun and a HUD. As I worked through the videos, the HUD changed, the score showed up but the HUD disappeared. Now the score disappeared as well as well as the HUD and I only have a gun. When I playtest it from Visual Studio, nothing shows up at all but when I load editor only the gun shows up.

This is the code setting up my game type

// Credit: Christopher Maxwell GameType W1 Video

class EricsMapGameType extends UTGame; //Sets game type as Unreal Tournament Game

var int myScore; // Sets myScore as a Variable Integer

defaultproperties // Sets the properties to default

{
    HUDType =class 'EricsMapInterfaceHud'  // Sets the interfacehud class to the Hudtype variable

    PlayerControllerClass = class' EricsMapInterfacePlayerController' // Sets the player controllers class into the the player class Variable

    DefaultPawnClass = class' EricsMapPawn' //Sets the maps custom pawn class to the default pawn variable

    bUseClassicHUD = true // Turns off the Flash Hud and allows use of custom Hud

}

//This is the code for my score, timer, and HUD
class EricsMapInterfaceHUD extends HUD; // EricsMapInterface class extends from Hud

var bool showCursor;

var const Texture2D CursorTexture;

var const Color CursorColor;

var Font m_HUDFont;

var Texture2D m_textureEX;

//------------------------------------------------
function DrawHUD()

{
    super.DrawHUD();
    drawMyScore();
    drawHUDText( "Hello!", 8);
    ericTexture();
}

//------------------------------------------------
function ericTexture()
{
    Canvas.SetPos(300,100);
    Canvas.SetDrawColor(255,255,255);
    Canvas.DrawTile(m_textureEX, 64, 64, 0, 16,  32, 16);
}

//------------------------------------------------
function drawHUDText(string _hudString, int _aNumber)
{
    local float textSizeX;
    local float textSizeY;
    local string ericText;

    ericText=_hudString @ _aNumber;

    Canvas.Font = m_HUDFont;
    Canvas.TextSize(ericText, textSizeX, textSizeY, 0.1, 0.1);
    Canvas.SetPos((Canvas.SizeX/2) - (textSizeX/2),(Canvas.SizeY/2) - (textSizeY/2));

    Canvas.SetDrawColor (255,0,0);
    Canvas.DrawText(ericText,,0.1,0.1);

}

//------------------------------------------------
function DrawMyScore()

{
    local WorldInfo rWorldInfo;
    local EricsMapGameType rGame;
    local int nScore;

    rWorldInfo = class 'WorldInfo' .static.GetWorldInfo();
    if(rGame != none)
    {
        rGame=EricsMapGameType(rWorldInfo.Game); // Turns the generic game into the custom game
        if(rGame!=none) //If not custome game goes back to original map
        {
        nScore = rGame.myScore;
        }
    }

    Canvas.SetPos(10,10);
    Canvas.Font = class 'Engine' .static.GetMediumFont();
    Canvas.SetDrawColor(255,0,0);

    Canvas.DrawText("Score:" @nScore);
}

//------------------------------------------------
event PostRender()
{
//  Canvas.SetPos(MouseInterfacePlayerInput.MousePosition.X,MouseInterfacePlayerInput.MousePosition.Y); //Gives me a bad or missing expression call to SetPos
    Canvas.DrawColor = CursorColor; //Draws cursor color
    Canvas.DrawTile(CursorTexture, CursorTexture.SizeX, CursorTexture.SizeY,0.f,0.f,CursorTexture.SizeX, CursorTexture.SizeY,, true);

}

defaultproperties
{
    CursorColor=(255,0,0,);
    CursorTexture=Texture2D'EngineResources.Cursors.Arrow';
    showCursor=true;
    m_HUDFont = Font'UI_Fonts.Fonts.UI_Fonts_Positec14';
    m_textureEX = Texture2D'UDKHUD.skull'

}

Please don't just tell me the answer; help me understand the answer.

sentences:
Guidance for building a proper in game economy I'm seriously thinking of building a space opera game which would share some of Machiavelli The Prince aspects regarding commerce: each player will be able to extract/build/buy/sell/donate a wide range of products (from ore to spaceships roughly).

However, I'm struggling with the economy aspect of it. Should the game define the prices once and for all? Should each player be able to determine his own buy/sell prices, and if so, how? How can I avoid over engineering this game economy mechanism, while still making it attractive for users?

Edit: thanks to your very nice input, some more information about the setup:

it's a "player only game," with no "computer managed player."
players start with a planet and some resources/units and then (try to) expand
players can be of multiple "species" with no proper relationship apart from the one they might make up => no possible notion of "central bank" or similar in the first place
consequently, I would prefer "not magic" on the economy, by that I mean a standard currency whose value would be determined by the system. However then I don't see how trading would be appealing, since bartering would be the only way, which feels a bit clumsy for the players. I was thinking of having some rare metal as the standard exchange medium, but then I wonder how would to include other basic economic attributes, such as the population's wealth...

Hopefully it doesn't look too daunting...

labels: audio game-design mathematics unity unity xna unity opengl c++ movement animation graphics testing box2d server unity unity level-of-detail character 2d java opengl unity unity unity unity rendering unity unity unity unity java unity unity 2d android unity unity c# 2d xna html5 opengl 2d libgdx game-design game-design java unity animation camera c# graphics unity unity sprites directx mathematics c# java 3d unity game-design xna unity cocos2d xna-4.0 java mathematics xna libgdx 2d libgdx mobile c# unity 2d monogame physics collision-detection android shaders android game-maker c# cocos2d libgdx 3d animation blender unity c# optimization libgdx unity c++ unity game-design graphics libgdx xna 2d unity steam shaders unity tilemap box2d libgdx c# unity alpha-blending java legal unity opengl java mathematics java opengl unity collision-detection models unity tilemap 2d java unity publishing graphics javascript marketing architecture opengl-es2 iphone xna cryengine physics c++ unity box2d xna leaderboards animation architecture unity unity c# collision-detection unity path-finding unity file cocos2d-iphone 2d c# game-mechanics c++ minecraft-modding javascript opengl xna android c++ c# c# mathematics java geometry javascript opengl java path-finding geometry sdl unity libgdx collision-detection opengl unity javascript unity libgdx opengl c# 3d collision-detection mathematics java unity c# xna mathematics android c# unity c++ xna c++ unity opengl hlsl javascript unity vector 2d unity xna unity c++ unity unity animation unity 3d-meshes unity unity android javascript ai jumping unity unity xna vulkan 3d unreal-4 xna google-play assets blender architecture unity actionscript-3 mathematics opengl java level-of-detail java video game-design opengl project-management javascript unity architecture first-person-shooter c# android unity architecture opengl bullet-physics algorithm android android savegame xna 2d xna c++ unity 3d tiles unity c++ c++ opengl unity unity rendering jobs java game-design xna rts opengl xna android physics unity unity game-design 3d architecture unity shaders game-design unity unity camera opengl multiplayer c# rendering architecture game-design physics mathematics gui input java c++ unity collision-detection opengl 3d leaderboards ruby unity c++ directx 3d software-engineering graphics-programming xna java graphics lighting actionscript-3 game-design unity unity graphics unity c++ algorithm ai opengl xna unity sprites c# actionscript-3 character unity java mathematics c++ special-effects unity xna 3d unity graphics unity mathematics 2d java animation unity 3dsmax unity 3d color havok java c++ unity console unity project-management physics godot terrain character xna 3d unity c++ unity java opengl unity mathematics game-design animation javascript c++ unity resource-management rendering client-server unity unity multiplayer unity node.js events andengine java unity xna xna sdl opengl php mathematics collision-detection unity game-maker playstation3 box2d unity flash unity c++ unity unity 3dsmax marketing unity c++ xna unity lua 3d unreal-4 tiles data-structure unity mathematics fixed-timestep 3d unity unity opengl unity rts directx11 unity unity c++ javascript unity unity animation unity directx unity 3d c# game-design c# c++ unity xna 3d c# unity multiplayer xna-4.0 unity textures directx c++ movement c++ c# physics c++ unity java unity unity path-finding unity ios unity xna python cocos2d networking unity game-design java unity unreal-4 javascript unity unity game-design input rotation mathematics localization xna c# shaders unity opengl opengl unity sprites xna 2d c++ unreal ai shaders unity opengl xna box2d 2d rts unity unity 3d opengl java game-design unity voxels geometry terrain c# game-design libgdx opengl unity unity java unity php unity unity cocos2d-x 2d architecture unity algorithm 2d c# game-design graphics game-design unity unity unity xna opengl physics unity unity wii physics windows animation unity unity unity rendering opengl architecture c# terrain java collision-detection opengl game-design directx android xna javascript design-patterns 3d unity unity c# opengl opengl unity unity android c++ networking c++ software-engineering unity unity c++ xna-4.0 graphics collision-detection c++ 3d unity opengl minecraft-modding isometric libgdx tiles unity opengl unity actionscript-3 3d mathematics java android unity opengl ios libgdx unity unity lighting path-finding iphone books monogame hlsl physics tiles mathematics unity unity xna algorithm game-design unity 2d c++ unity xna xna c++ unity javascript unity c++ unity unity 2d unity monetization c++ unity android java animation game-design java opengl java physics c# algorithm c++ xna android mathematics xna unity opengl c# unity 2d unity collision-detection opengl xna frame-rate unity opengl java unity unity flash opengl hlsl cocos2d-iphone unity unity unity nintendo xna unity unreal-4 3d c++ java unity glsl multiplayer unity unity c# unity unity browser-based-games godot unity java cocos2d-iphone c# unity unity textures javascript unity textures shaders multiplayer iphone pygame java opengl unity unity unity c# java xna collision-detection mobile xna models game-design java sdl2 php c++ c# xna rotation c++ libgdx unity opengl models opengl c++ game-mechanics 3d input opengl html5 xna 2d unity unity java unity flash c# directx opengl mathematics mathematics shaders assimp graphics unity unity opengl unity game-center unity 3dsmax unity rendering unity c++ xna unity vector card-game blender entity-system tiles html5 libgdx c++ unity unity xna c# opengl opengl animation vector vulkan flash unity c# c++ unreal-4 java unity unity unity java game-design unity timer 2d savegame 2d c++ c++ xna unity c# minecraft-modding iphone javascript performance cocos2d-iphone unity unity ogre c# unity unity unity c++ unity 3d c# normal-generation corona-sdk c++ 3d c# collision-detection unity directx turn-based-strategy xna optimization tiles tiles opengl opengl opengl scripting xna c++ physics opengl sdl c++ c# c++ c# javascript physics opengl collision-detection javascript input algorithm ai networking game-mechanics unity legal libgdx mathematics c++ c# camera directx11 path-finding unity unity 2d opengl-es unity html-canvas unity algorithm game-design java matrix c# unity software-engineering animation java c++ c# xna unity unity c# assets c++ opengl xna-4.0 rendering xna mathematics unity animation mathematics c# performance playtesting game-maker unity java android unity android rendering algorithm javascript xna unity sprites opengl c++ c++ c# opengl 3d unity lwjgl unity opengl pygame opengl corona-sdk collision-detection game-industry unity unity cross-platform unity unity shaders unity iphone ranking physics graphics c# android legal c++ opengl copyright web java android unity java unity java javascript xna unity mathematics c# 2d java collision-detection unity physics collision-detection unity game-design xna xna opengl java 2d c# architecture unity unity game-design unity unity collision-detection state 2d opengl mathematics xna architecture java tools c++ 2d c++ animation unity unity opengl unity unity unity unity minecraft-modding unity 3d ios python 2d ai c++ sprites c# unity unity game-mechanics javascript java unity path-finding java 2d collision-detection component-based java opengl unity unreal-4 java opengl scripting unity unity unity python android android 2d collision-detection game-design unity publishing c++ opengl server c++ rotation sdl2 marketing unity php unity c# c# procedural-generation shaders android game-industry opengl 3d c# ipad java unreal c++ opengl rendering java cocos2d c# android mathematics java c# unity marketing opengl terminology javascript opengl unity unity c# android android xna unity glfw xna unreal-4 opengl unity tilemap java unity opengl opengl unity matrix procedural-generation depth-buffer java inverse-kinematics opengl 3d opengl rendering opengl unity unity opengl unity opengl c++ c++ c# unity unity unity javascript opengl-es2 unity collision-detection networking unity c++ opengl shaders xna spritekit rpg c++ path-finding frame-rate unity unity path-finding android java unity android android opengl c++ javascript cocos2d-iphone android unity game-loop c# c# color separating-axis-theorem unity xna unity unity collision-detection c++ xna unity javascript glsl libgdx game-maker 3d game-maker c++ unity opengl unity game-design directx11 sprites python c# unity unity java libgdx graphics collision-detection unity 2d map-editor unity unity path-finding algorithm unity 2d unity c# unity unity unity camera c++ vector collision-detection java java blender c++ unity iphone c++ unity c++ unity unity game-design xna java ios javascript unity ai html5 c# unity mathematics flash opengl directx10 unity 3d java unity xna unity rendering unity software-engineering xna timer education 2d c++ ai game-design andengine component-based mathematics python hardware javascript models java c++ unity physics c++ unity c# java opengl c# unity 2d android unity android xna unity graphics unity mobile unity c++ unity 2d server xna opengl 2d unity unity triangulation java directx opengl c++ opengl box2d unity unity textures opengl particles unity design-patterns unity unity procedural-generation hlsl opengl-es game-design unity matrix c++ unity unity 2d c++ godot javascript c# java collision-detection opengl nintendo andengine unity sprites c# love2d unity game-design java c++ c++ unity unity unity unity ai unity xna java unity libgdx c# unity unity networking unity android terrain java unity android unity 3d-meshes python java physics rendering c++ 3d box2d collision-detection 3d networking unity minecraft-modding ai game-design c# mathematics godot directx unity collision-detection controllers bullet-physics unreal collision-detection movement physics-engine game-design unity 3d collision-detection c++ mathematics unity procedural-generation c++ turn-based unity architecture sound publishing unity 3d unity unity unity unity 3d input scene c++ flash networking game-industry unity culling javascript unity unity xna camera opengl opengl xna opengl unity xna unity rendering game-design unity unity graphics unity 2d unity xna opengl android unity unity unity libgdx libgdx unity c# unity 3d unity text unity refactoring unity physics android 2d java tools unity unity marketing unity android glsl unity physics unity unity software-engineering textures steam xna shaders xna unity xna android 2d c# 2d opengl matrix c# unity entity-system android mouse libgdx java android xna c++ textures sfml libgdx unity process xna xna unity opengl opengl c++ c++ unity unity unity unity shaders unity java unity unity 2d game-design xna unreal-4 audio unity unity opengl android path-finding c++ directx code-reflection opengl 3d ai c# c# opengl legal opengl architecture 3dsmax shaders c++ java pygame java physics libgdx mmo matrix browser-based-games unity animation shaders c# unity c++ ranking software-engineering textures unity c# level-design movement unity unity game-maker unity multiplayer 2d unity unity unity c# collision-detection unity opengl xna c++ game-design opengl unity android architecture skeletal-animation game-design c# unity c++ unity cocos2d unity android rendering java camera unity algorithm collision-detection unity unity 2d javascript c++ client-server unity c++ unity unity game-design unity c# unity opengl physics-engine sprites flash minecraft-modding game-design unity collision-detection xna 3d 2d c++ matrix c++ unity java algorithm 2d opengl unity input unity unity architecture 2d c++ networking unity unity opengl algorithm opengl c# platformer jmonkeyengine unity java c# unity opengl java unity android procedural-generation unity java unity game-design unity c++ javascript unity unity-networking xna collision-detection xna java xna java unity unity textures c++ xna flash models unity unity xna 2d unity unity unity opengl architecture unity c# licensing unity xna unity javascript unity xna 3d opengl xna unity c# windows-phone-7 java game-design unity unity 2d opengl c++ physics unity c# pygame opengl-es unity 2d unreal-4 java c# minecraft-modding xna mathematics architecture box2d ai time-travel appstore graphics-programming opengl software-engineering unity c++ directx9 android mathematics php textures unity c# legal libgdx xna magicavoxel sprites 2d opengl opengl 2d level-design ios opengl tiles unity path-finding xna opengl opengl unity blender unity lwjgl opengl unity unity java rendering unity 3d xna unity android directx unity c# javascript entity-system mobile tools networking flash blender unity textures physics unity unity unity mathematics xna c# unity html5 graphics-programming c# xna game-mechanics unity business java 2d c++ c++ udk networking 2d 3d 3d unity xna unity xna simulations physics c# libgdx ios c++ unity c# algorithm textures legal construct-2 opengl unity android xna unity javascript xna optimization unity java graphics opengl procedural-generation unity art unity c++ databases unity unity xna opengl transformation unity unity opengl android java xna unity rpg unityscript physics xna animation game-industry c++ unity c++ performance game-design unity unity ai architecture pygame shaders unity textures game-design game-design unity optimization xna c++ xna path-finding 2d pico-8 3d software-rendering opengl scripting unity lighting ios unity unity shaders unity unity textures collision-detection xna unity loading unity opengl unity networking camera unity java unity sdl2 lua opengl unity c++ quaternion unity java physics 3d tilemap unity mathematics torque-x java javascript collision-detection android xna xna unity ios movement cocos2d-iphone java unity 3dsmax collision-detection architecture opengl xna java game-design 3d-meshes unity opengl sdl2 java 2d textures javascript algorithm unity camera procedural-generation design-patterns ios opengl java console collision-detection godot unity unity unity mathematics movement unity android tiles unity physics unity unity unity unity 3d multiplayer collision-detection unity animation networking multiplayer isometric java sdl mathematics godot unity c# 2d unity java unity text unity opengl game-design c# modding xna java compression actionscript-3 rotation algorithm legal opengl simulations xna unity lighting game-design rotation collision-detection android mmo sound c++ ios unity unity c++ java c++ unity unity unity tilemap sprites multiplayer unity directx unity c++ javascript java unity unity unity unity opengl opengl html5 2d c++ unity 2d opengl performance android algorithm opengl opengl unity libgdx libgdx browser-based-games unity human-resources c++ javascript unity opengl java opengl unity terrain physics java xna iphone c# java algorithm architecture fonts java xna game-design pyglet java opengl opengl unity c# c++ unity unity xna ai c# physics collision-detection textures unity android mathematics java algorithm java multiplayer game-design xna unity directx opengl sprites 2d unity java opengl c++ graphics unity c# java opengl-es2 unity opengl ios xna unity architecture java optimization game-design tilemap unity java unity ios unity c++ c# andengine unity collision-detection java xna xna unity lua unity java unity collision-detection opengl opengl opengl unity shaders architecture unity unity sprites xna unity physics unity box2d 2d javascript collision-detection c++ opengl directx c++ physics unity android mathematics xna java algorithm software-engineering java java unity unity c++ c++ unity xna unity facebook opengl c# unity opengl rotation unreal-4 c++ skybox c++ xna 2d unity level-design unity libgdx unity collision-detection opengl unity blender unity java 2d unity opengl shaders ios savegame global-illumination quake2 c++ mathematics unity collision-detection unity opengl c# unity android unity c++ shaders android opengl 2d unity spatial-partitioning animation opengl unity unity architecture java c# component-based xna javascript performance unity java unity xna unity c++ music opengl unity 2d color unity text models 2d ios libgdx android 2d c# java xna c++ physics opengl unity unity unity game-mechanics unity unity opengl java unity c# networking unity algorithm unity unity libgdx animation xna c# unity directx c# skeletal-animation unity libgdx ai game-design xna unity opengl godot rotation c++ 2d unity optimization collision-detection opengl c++ c++ architecture 2d c++ architecture unity opengl vector unity unity opengl 2d collision-detection unity game-design 2d animation opengl rendering collision-detection sound java java opengl unity unity xna mathematics unity assets javascript mmo c# unity blender opengl unity vector gpu shaders movement c++ minecraft-modding actionscript-3 libgdx unity 2d networking xna opengl glsl c++ mathematics android opengl android java unity xna 3d game-design networking unity algorithm opengl 3d-meshes xna opengl c++ unity android box2d sprites java c# unity models blender android libgdx lua c# opengl-es animation unity c++ ai unity vector game-design physics collision-detection 2d unity javascript unity c++ libgdx libgdx c++ php unity unity sfml shaders architecture c++ unity entity-system unity unity unity c++ unity software-engineering unity game-maker directx9 2d opengl collision-detection camera opengl legal iphone godot opengl unity unity rpg unity project-management game-design python unity unity xna collision-detection physics unity 2d opengl directx9 opengl unity opengl opengl flash game-design java javascript ios architecture opengl directx collision-detection xna xna unity java unity client-server c++ opengl 3dsmax javascript unity rendering android opengl unity unity ranking unity c++ java xna unity xna javascript mathematics unity teaching unity 3d android emulation javascript algorithm physics java textures unity xna unity piracy lwjgl unity game-design unity unreal-4 2d mathematics software-engineering 2d audio opengl java path-finding multithreading simulations rendering unity java unity shaders game-design unity rendering opengl game-design unity unity java c# unity rendering 2d directx11 java publishing unity c++ unity glsl unity xna octree c# component-based unity unity opengl camera unity java xna unity glsl sfml opengl networking networking unity 2d xna 3d game-design directx android opengl xna unity game-design game-design unity maya java unity game-maker unity networking android opengl unity unity java c# libgdx xna-4.0 networking xna unity objective-c cocos2d-iphone particles multiplayer unity unity physics-engine game-design game-loop networking 2d opengl unity 2d c# c# unity java game-design game-maker unity 2d metrics 3d 2d opengl collision-detection interpolation blender unity unity architecture opengl java multithreading actionscript-3 networking 2d c++ unity networking particles directx java unity physics unity love2d unity opengl xna unity c++ c++ unity java xna unreal-4 libgdx c++ unity unity 2d libgdx java xna education xna java unity procedural-generation unity visual-studio directx9 ios c++ xna haxe unity unity mmo 2d textures c++ c++ unity unity c++ opengl unity xna collision-detection java mathematics unity skyrim-modding xna 2d xna mmo unity xna unity collision-detection unity unity sdl2 simulations unity sfml unreal-4 c# collision-detection unity unity physics javascript xna c++ unity collision-detection java testing c++ unity google-play-services architecture models game-design windows video unity unity unity xna animation unity directx11 javascript unity 2d unity opengl java opengl unity collision-detection javascript unity 3d-meshes unity scripting game-loop unity xna collision-detection networking xna libgdx android opengl unity collision-detection android java networking 2d game-design libgdx game-design opengl unreal c# phaser 3d game-design c# xna networking random c# unity opengl 2d c# javascript javascript physics graphics node.js server opengl unity unity movement mathematics unity octree unity xna java terrain procedural-generation c# 2d opengl 3d unity graphics scripting unity unity c++ xna c# unity c# unity android opengl timer networking c# interpolation c++ physics-engine physics-engine multiplayer xna-4.0 rotation opengl c# libgdx c# c++ c# 2d xna-4.0 skybox android android opengl opengl unity opengl procedural-generation collision-detection unity unity c++ android rigging game-design xna opengl-es unity-networking architecture java physics 3d color mathematics algorithm c# c# tiles unity textures physics server libgdx python game-design mathematics mathematics algorithm game-design unity java android unity 3d unity opengl c++ unity game-loop unity 3d python c# unity collision-detection game-maker java textures game-design graphics android opengl c# unity opengl unity flash opengl game-design opengl animation c# legal procedural-generation android mathematics unity 2d 3d unity java game-maker mathematics directx9 glsl mathematics java c++ algorithm cocos2d-iphone c++ unity unity opengl c++ camera android audio iphone path-finding camera gpu flash c++ unity unity directx11 unity unity unity rendering unity unity unity pygame minecraft-modding java opengl 2d sdl2 3d mathematics unity 2d 2d godot unity rendering game-design xna unity 2d java opengl game-mechanics libgdx c# algorithm unity sprites 2d java unity javascript transformation unity opengl 2d unity ios unity game-maker unity 2d javascript flash xna xna physics opengl scene unity camera opengl opengl game-design unity unity libgdx android entity-system c++ game-mechanics development-speed c# legal unity c++ opengl tiles c++ ios voxels game-design unity unity box2d iphone xna opengl unity architecture tools opengl libgdx camera xna java physics android unity 2d 3d entity-component game-design unity game-design mmo unity opengl opengl c# physics unity game-design java xna-4.0 unity unity unity unity c++ java ios opengl-es unity java unity steering-behaviors unity unity 3d c++ physics unity c# sprites xna 2d android box2d 2d education algorithm unity unity rendering unity architecture cocos2d-x xna sprites animation turn-based opengl directx terrain opengl c++ algorithm windows c++ c++ mathematics javascript 2d unity flash animation spritesheet java mathematics xna image-processing opengl architecture glsl game-maker opengl java path-finding puzzle textures unity opengl c++ sprites unity java movement rendering unity opengl path-finding c++ c++ java architecture java android rotation opengl unity javascript software-engineering unity collision-detection ai opengl xna c++ unity c++ architecture collision-resolution path-finding physics unity mathematics unity unity pygame java ai unity java unity performance unity hacks mmo component-based physics unity 3d algorithm c++ c++ unity 3d fsm unity c++ godot tools animation graphics-programming linux legal xna design-patterns box2d animation unity xna camera unity java collision-detection unity cocos2d-iphone c++ xna unity physics graphics assets javascript java c# unity c# xna javascript textures godot java shaders opengl 3d libgdx opengl android c# unity physics software-engineering libgdx opengl camera client-server physics c++ animation unity unity rendering unity unreal-4 game-maker server c# xna game-mechanics unity 2d obj tiles xna mathematics sprites game-mechanics java unity java opengl unity space-partitioning c# path-finding 2d 2d unity xna c# c# unity 3d android opengl c# collision-detection networking opengl unity path-finding mathematics opengl libgdx algorithm opengl unity unity unity tessellation opengl libgdx graphics directx11 algorithm opengl algorithm xna sfml unity java c++ game-mechanics unity directx11 architecture mathematics unity unity c++ unity unity c++ unity terrain android java unity algorithm unity c++ c++ unity collision-detection procedural-generation opengl java opengl unity java opengl c# raycasting unity modding 3d shaders unity textures 2d unity animation unity physics collision-detection 2d iphone cocos2d-iphone vector unity tiles shaders 2d game-design c++ 2d unity architecture mathematics javascript game-design unity models unity c++ architecture architecture opengl ai 3d c++ unity ios java algorithm unity c++ xna java box2d c++ java unity 2d unity xna graphics unity minecraft-modding game-design udk c++ 3d game-design unity udk 2d game-industry game-design c++ 2d collision-detection java c++ camera unity c++ unity libgdx 2d game-maker game-design unity javascript 2d design-patterns c++ unity networking unity physics mathematics opengl linear-algebra libgdx c# unity c# 2d collision-detection architecture c++ algorithm unity lua physics mathematics opengl c++ c++ opengl libgdx opengl cocos2d-iphone c# physics legal procedural-generation unity opengl c# xna-4.0 collision-detection physics unity c# xna-4.0 unity game-mechanics unity algorithm c++ collision-detection unreal xna logic ai hexagonal-grid opengl opengl-es windows unity software-engineering c# mathematics unity unity game-design java unity c++ unreal unity unity iphone user-experience c++ unity optimization opengl c# unity opengl-es rendering mmo software-engineering directx9 unity game-design opengl opengl game-design unity algorithm java unity godot mathematics c++ android 2d collision-detection unity unity mobile opengl opengl android algorithm unity 3d unity 3d opengl unity c++ unity frame-rate unity terminology java unity animation unity java unity 2d opengl networking quaternion xna directx11 algorithm unity opengl c++ java content-rating c++ opengl architecture java opengl game-design unity opengl andengine android unity unity xna unity google-play andengine appstore physics entity-system game-design unity box2d 2d unity c++ android movement 3d box2d xna unity xna input unity java iphone cocos2d xna architecture directx11 xna irrlicht libgdx libgdx java multiplayer unity flash xna unity opengl-es models xna unity path-finding unity architecture opengl xna mmo libgdx 3d animation c# c# android 2d unity android mmo game-design transformation c++ game-maker xna-4.0 xna unity ai algorithm unity c# unity rotation camera unity unity unity unity ogre xna unity c++ cocos2d-x game-maker c# isometric architecture tiled 2d unity game-design graphics unity unity sprites gpu opengl terrain unity xna unity unity opengl marketing xna c# c# rendering networking c++ c++ c# unity flash android unity opengl optimization xna algorithm c++ networking tools opengl android c++ xna unity xna mathematics opengl sdl graphics 3d unity c# spritesheet opengl unity c++ mathematics unity unity collision-detection android xna c# 2d java xna unity opengl physics c++ javascript directx architecture unity opengl xna unreal-4 javascript textures java 2d camera unity unity android xna 2d html5 minecraft-modding game-design 3d optimization 2d user-experience opengl unity unity 2d c++ python xna xna c++ c++ c# unity opengl unity multiplayer physics iphone 2d unity directx11 unity java c++ game-design c# mobile xna unity c++ 3d game-design xna c# entity-system opengl-es2 libgdx education unity unity c# unity unity c# unity javascript javascript unity opengl unity physics 3d xna xna directx11 unity game-design unity cross-platform opengl collision-resolution animation python procedural-generation unity opengl xna software-engineering unity android javascript c++ geometry windows-forms models unity unity game-design unity opengl c++ 3d game-design unity 2d multiplayer unity game-mechanics unreal-4 algorithm 2d opengl c++ c# c++ textures tiles game-design unity collision-detection c# mathematics 2d c++ game-design playstation4 xna c# game-design libgdx 3d unity libgdx graphics commodore-64 unity unity collision-detection unity mesh unity collision-detection c++ architecture unity unity 2d opengl 3d 3d physics collision-detection physics opengl xna unity c++ sdl unity unity flash 3d xna software-engineering 2d c++ java performance rotation physics server opengl sdl2 algorithm shaders c++ server vector c++ corona-sdk game-design unity unity 2d unity unity data-structure c++ turn-based copyright glsl unity unity game-mechanics unity libgdx java unity blender unity coordinates unity unity graphics libgdx c# xna c++ opengl unity unity 2d c# unity unity c# c# mathematics unity opengl xna movement xna c++ ios android architecture unity xna unity c# animation xna c++ unity xna libgdx web 2d mathematics textures marketing xna unity opengl unity procedural-generation java 2d 2d c# mathematics unity path-finding design-patterns unity xna 2d collision-detection unity animation unity unity libgdx html5 maya 3d collision-detection unity rpg multiplayer mathematics xna unity unity unity webgl unity unity shaders java game-design unity libgdx mathematics marketing xna opengl unity opengl c++ android skeletal-animation xna java unity c++ audio animation xna xna game-design javascript unity android c++ opengl unity physics unity assets unity 2d unity unity java 3d unity game-design unity c++ mmo unity xna unity legal physics networking sprites unity unity ai unity unity directx unity c++ unity javascript 3d blender java unity sound c# unity flash unity unity android 2d opengl java 2d tiles java unity xna-4.0 unity c++ game-maker libgdx unity unity java algorithm animation procedural-generation unity architecture unity 2d unity 2d mathematics c++ unity opengl c++ 2d c++ unity unity models shaders unity unity xna unity game-design vertex flash algorithm c++ xna maps xna shaders 2d opengl physics 2d unity libgdx maps textures procedural-generation c# java mathematics box2d android unity project-management collision-detection rigging hardware unity unity ios libgdx unity unity unity android opengl vector unity unity algorithm textures c++ c++ sdl2 opengl ios unreal-4 unity ai mathematics glsl unity multiplayer xna unity physics java unreal-4 opengl unity publishing 2d directx libgdx software-engineering xna c++ opengl unity java opengl playstation3 textures c++ directx xna networking unity opengl 2d unity textures physics textures entity-system c++ 2d unity unity monogame android unity unity music pygame multiplayer xna animation unity opengl unity java libgdx multiplayer c++ xna unity unity unity game-design unity android python unity game-design blender c# 3d-meshes textures unity camera box2d xna opengl c++ collision-detection grid unity c# unity opengl unity opengl c++ c++ physics architecture unity xna c++ android xna c++ c++ allegro c# sdl2 unity 3dsmax c# c# state android xna c++ minecraft-modding javascript unity opengl procedural-generation xna xna xna xna animation flash mathematics opengl algorithm javascript java design-patterns box2d collision-detection c# opengl path-finding path-finding 3d-modeling java octree java unreal udk mathematics rendering iphone directx javascript xbox360 opengl unity procedural-generation java puzzle networking physics godot unity project-management opengl unity unity sound unity c++ unity 2d education unity matrix collision-detection android shaders java javascript unity animation unity libgdx unity angles c# c# android java collision-detection game-design java c# ai game-design ai physics java libgdx unity unreal opengl c# xna xna 2d algorithm javascript godot objective-c terminology architecture xna unity unity physics 3d c++ unreal unity libgdx opengl unity opengl unity mathematics unity opengl c++ unity unity unity unity xna c# performance unity actionscript-3 directx11 rendering 2d opengl iphone xna unity shaders physics xna unity cocos2d-iphone javascript architecture c++ directx godot c++ libgdx gpu gui unity c++ xna 2d unity java unity flash c# algorithm mmo c++ 2d unity unity 2d unity mathematics xna game-design materials javascript sprites unity java actionscript-3 c++ java libgdx collision-detection xna-4.0 legal java unity unity path-finding unity unity opengl opengl unity algorithm unity unity unity software-engineering unity java xna c# unity unity unity unity 2d game-design unity graphics-programming unity unity c# 3d java unity version-control c++ localization c# c++ spritekit c# unity textures 2d c# unity physics opengl lua terrain unity networking textures ios unity c# multiplayer testing opengl javascript unity c++ unity unity rotation 3d 3d 2d graphics-design unreal c++ c++ architecture android unity mmo java game-loop collision-detection 2d opengl c++ vector tilemap unity xna-4.0 c# unity shaders unity c++ unity android scripting unity architecture c# physics mmo game-maker rendering xna movement unity c++ ai software-engineering android starcraft-2 geometry 2d tiles unity unity java animation iphone javascript opengl javascript c# character animation c++ licensing c++ unity unity assets networking 3d unity physics game-design unity rendering unity unity windows c# deferred-rendering game-maker unity sprites unity collision-detection java collision-detection unity unity unity xna shaders c# level-design unity architecture 3dsmax 3d 2d unity opengl mathematics c++ opengl slimdx opengl xna game-design unity unity turn-based unity unity opengl unity textures unity c++ unity legal java java unity java unity opengl image hlsl networking c++ xna collision-detection procedural-generation c++ facebook iphone iphone android game-design unity 3d unity software-engineering libgdx unity java android java unity java c++ unity unity libgdx opengl unity xna-4.0 unity unity rendering c# unity unity unity xna xna unity c# opengl unity c++ physics javascript movement opengl unity unity c# architecture architecture unity unity javascript collision-detection android unity libgdx unity libgdx c++ physics textures java unity godot vector c# legal game-design c++ animation xna-4.0 ai gui unity java unity unity networking opengl physics unity game-design c# game-design unity java physics unity android voxels c# windows glsl waypoints assets c++ movement unity xna opengl encryption unity 2d architecture unity terrain game-design unity c++ java xna unity opengl opengl-es c# java java algorithm collision-detection javascript opengl java unity opengl xna iphone xna animation legal minecraft-modding mathematics matrix flash animation mathematics cocos2d-iphone architecture java 3d-modeling game-design opengl java shaders mathematics opengl c++ unity unity platform unity unity lua input unity unity libgdx architecture android unity game-mechanics performance mathematics architecture tools mathematics visual-studio directx11 xna 3d-modeling xna-4.0 physics unity unity mathematics architecture architecture spritekit unity streaming 2d unity android javascript physics game-loop unity 2d opengl unity unity unity javascript mathematics flash animation unity opengl unreal-4 xna unity software-engineering game-design sfml unity unity unity camera simulations unity bullet-physics iphone unity box2d unity gui puzzle physics unity shaders directx11 game-maker glsl monogame collision-detection 3d 2d ios c++ unity 2d unity opengl levels unity architecture pixel-art unity models unity java opengl opengl legal opengl java unity c# c++ directx11 unity unity xna unreal-4 ai algorithm collision-detection c++ game-mechanics unity mmo unity 2d audio raytracing unity opengl unity client-server blender java procedural-generation unity android 2d physics c++ camera unity c++ java steam input rendering c++ unity c++ game-maker xna c# unity java xna unity 3d xna unity sfml rendering unity assets architecture unity c++ xna unity android unity unity unity unity unity c++ unity c# c# vector 2d xna game-design unity unity ai camera architecture mvc unity steam opengl xna marketing unity ai textures ai opengl matrix books physics gimp unity iphone unity gui unreal-4 unity performance shaders directx architecture unity c# xna-4.0 java c++ performance efficiency c++ unity xna unity 3d particles cocos2d-x c shaders graphics software-engineering c++ collision-detection android mmo unity opengl xna java collision-detection unity c# game-design javascript opengl unity assets movement xna c++ unity 2d unity opengl xna unity unity 3d unity xna unity unity html5 3d xna unity unity unity game-design unity c++ procedural-generation xna unity movement events unity unity unity c++ opengl unity sprites animation unity c++ blender xna unity java unity game-design c++ google-play 3d java maps 3d networking opengl deferred-rendering c++ unity unity c++ browser-based-games rendering opengl java flash unity android c++ opengl unity c++ xna mmo multiplayer c# c camera levels 2d career blender unity unity c++ unity tiles xna c# game-mechanics c++ cocos2d-x xna actionscript-3 rotation c++ java opengl unity unreal-4 mathematics marketing animation animation unity ios unity gui unity 2d java unity music textures c++ unity game-design leaderboards java books textures game-design mathematics unity c# game-design opengl unity ios opengl unity unity architecture xna performance physics c++ opengl unity unity textures unity rendering mathematics opengl c# 2d procedural-generation physics 2d 2d unity rendering c# mathematics c++ entity-system ai opengl opengl marketing software-engineering unity unity unity 3d unity unity xna mathematics unity unity xna c++ unity unity algorithm transformation xna audio algorithm unity ai architecture unity unity java unity xna-4.0 c# unity glsl xna libgdx unity unity java geometry unity unity opengl opengl actionscript-3 opengl java unity xna 3d opengl unity libgdx 2d camera c++ memory-efficiency unity unity game-design 3d 3d javascript rendering collision-detection unity android xna unity unity cocos2d-iphone unity c++ opengl unity 2d flash unity rendering c++ procedural-generation opengl c++ unity c# c++ unity python unity graphics algorithm cocos2d-iphone c++ opengl ogre android xna unity unity xna unity game-design libgdx c# android physics xna ai collision-detection unity unity c# unity 3d-meshes unity unityscript java unity opengl xna windows unity architecture c++ 2d directx opengl opengl opengl unity real-money-transactions 3d unity unity c# 2d unity legal game-design xna unity rendering unity 2d udk unity tilemap game-design unity shaders java unity c++ unity architecture tiles c++ aabb architecture unity glsl android xna 2d unity game-design unity xna unity xna 3d networking camera libgdx c# mmo flash android opengl xna shaders unity c++ c++ architecture movement movement java unity networking unity c++ mathematics game-industry android c# c# path-finding unity unity java java unity 2d unity unity hardware xna java xna c# libgdx unity game-design unity sound unity unity xna shaders c++ architecture game-design collision-detection libgdx unity architecture soya3d shaders c# ai actionscript-3 architecture c# character c++ unity unity unity input xna xna c# directx path-finding opengl networking c# unity unity c++ unity opengl xna multiplayer android mathematics unity google-play c# jogl xna ai javascript fragment-shader libgdx unity mmo c# java 3d unity opengl unity rendering java movement java opengl rendering multiplayer unity algorithm javascript directx opengl unity c++ c# c# 3d xna 3d unity 3d xna xna-4.0 entity-system unity unity unity path-finding path-finding android c++ procedural-generation libgdx shaders xna unity unity collision-detection c++ sfml java opengl javascript unreal-4 monogame unity c c# unity xna c# graphics-programming android opengl architecture unity c# 2d opengl c# java directx11 c# c++ mathematics copyright java c++ collision-detection textures android xna javascript physics maya unity unity software-engineering terminology networking c++ unity unity xna java unity opengl unity c# shaders python unity opengl 2d mathematics unreal-4 game-design mathematics unity iphone xna java unity libgdx xna unity 3d projection unity unity c# unity android opengl xna c++ c++ opengl libgdx chess level-design unity unity java ai game-design unity javascript java physics legal unity assets phaser unity leaderboards iphone graphics camera unity ide c++ unity 3d mathematics xna libgdx game-design software-engineering mathematics opengl game-mechanics textures java textures c++ networking xna networking 2d java terminology textures opengl unity java unity 2d ios unity card-game java android java algorithm unity unity c# unity game-design entity-system xna fonts directx unity javascript opengl software-engineering box2d unity opengl unity sprites c# unity c++ c++ game-design unity javascript unity audio c++ java rendering textures unity unity c# xna networking unity c# assets collision-detection iphone javascript architecture unity monogame directx unity xna c# c++ windows c++ c++ xna c# vector architecture algorithm game-loop shaders java collision-detection unity cocos2d-iphone unity collision-detection procedural-generation actionscript-3 2d glsl networking ai c++ unreal-4 controllers unity unity game-design 2d minecraft-modding opengl 3d unity javascript unity multiplayer unity physics unity physics c++ directx java xna tiles javascript opengl java opengl unity textures shaders c# windows opengl terrain game-maker xna game-industry physics 2d collision-detection java collision-detection ai pyglet unity unity game-design android android c# collision-detection python opengl java physics ios xna unity shaders 3d libgdx xna unity architecture java unity xna graphics unity shaders javascript unity collision-detection c++ c# graphics unity c++ opengl unity unity octree networking unity architecture unity c++ unreal-4 unity game-design unity physics unity unity networking android unity shaders unity c++ 2d unity procedural-generation unity unity browser-based-games unity xna 2d xna physics unity c# mathematics 2d c++ voxels c++ 3d opengl unity unity unity python html5 c++ c++ java unity entity-component-system game-design architecture xna unity cocos2d-x opengl java unity android cross-platform java roguelikes 3d art fbx libgdx unity c++ c++ unity unity game-design physics xna camera unity windows libgdx camera opengl libgdx c++ algorithm visual-novel c# special-effects java unity python godot algorithm maps game-design unity unity unity unity c++ 2d unity physics unity pixel collision-detection unity legal matrix art 3d networking unity unity game-design random networking unity javascript c# c++ opengl xna c++ 2d unity java mathematics c++ directx11 java c# opengl unity javascript physics c# unity business unity unity java physics c++ career game-design directx procedural-generation unity networking unity opengl maps unity 2d unity opengl opengl java java unity unity networking opengl scripting 2d marketing lighting java c++ opengl java xna unity xna xna unity c++ unity unity libgdx legal xna xna xna android unity unity c# unity rendering xna unity unity unity unity 2d ai xna unity unity xna legal unity skeletal-animation unity unity unity unity mathematics unity javascript libgdx opengl c# ios flash unity 2d architecture c++ android python c# libgdx animation unity c++ c++ python mathematics xna unity unity c# augmented-reality unity c++ opengl java opengl unity cocos2d c++ productivity flash mathematics shaders unity unity ios physics unity xna legal optimization unity shaders unity java collision-detection xna unity unity user-experience opengl directx tiles unity unity opengl unity algorithm android scripting c# networking textures unity shaders mathematics legal 3d android java 2d libgdx xna c# unity xna unity collision-detection unity movement game-design data-structure marching-cubes unity 2d libgdx unity unity unity c# unity unity textures unity java opengl 3d-meshes collision-detection unity 3d unity unity c# opengl opengl open-source opengl unity shaders xna unity unity opengl opengl android algorithm unity animation java legal unity java sprites animation c# unity opengl maps 3d unity hlsl c# unity unity opengl 2d unity unity opengl path-finding opengl javascript unity unity xna sprites xna multiplayer directx11 2d unity c# unity c++ depth-buffer unity javascript godot 2d rotation mathematics c# performance opengl sdl c++ level-design unity unity opengl directx path-finding terrain multiplayer windows-phone-7 xna c++ directx10 libgdx unity appstore unity xna c# libgdx hlsl unity xna game-maker unity entity-system ogre c# unity xna java unity iphone unity iphone depth-buffer unity javascript unity javascript unity 2d unity unity algorithm unity c++ unity directx11 android c++ opengl c# libgdx opengl software-engineering javascript xna tiles opengl unity android unity textures education physics directx11 modding mathematics camera opengl unity physics mathematics unity c++ android opengl unity unity modding html5 mathematics unity unity opengl loading unity c# java directx11 planning copyright shaders unity opengl procedural-generation c# mathematics shaders mathematics game-design opengl unity legal perlin-noise mathematics opengl unity xna c# c++ java 3d algorithm oculus 3d opengl tiles c++ mathematics installer 2d mobile android unity java turn-based unity xna opengl xna sdl2 opengl java unity projectile-physics unity 3d random unity unity c++ xna c# opengl unity c# mathematics tilemap tools monogame c++ opengl unity unity libgdx shading xna transformation android unity c++ architecture unity java xna 3d java sprites unity collision-detection unity c++ actionscript-3 game-maker unity unity unity unity xna unity 3d java xna android game-maker libgdx c# unity java ai javascript unity algorithm physics rendering unity libgdx android directx sdl unity movement libgdx 3d-meshes unity unity java unity opengl c++ opengl unity networking unreal-4 java shaders xna unity collision-detection c++ c++ game-design c# unity mathematics unity xna-4.0 game-design unity unity cocos2d-iphone tilemap box2d unity xna audio unity c# unity java unity vsync unity unity physics licensing c++ sprites unity c++ physics unity c# input unity xna unity terrain-rendering actionscript-3 iphone graphics textures algorithm unity html-canvas collision-detection unity statistics animation godot savegame unity unity unity xna opengl networking sdl libgdx xna unity c# c++ opengl unity unity unity opengl motivation unity tiles xna unity 2d unity unity c++ xna 2d javascript animation lighting art java unity unity unity c# tiles unity 2d unity sprites c# c++ c# physics copyright opengl unity android unity java mathematics iphone game-design interface unity 2d entity-component animation unity unity unity unity c# 3d unity physics xna open-source c++ architecture c# unity game-design 2d xna multiplayer unity data-structure unity c++ c++ unity javascript java c# xna unity ai unity unity unity unity unity android unity multiplayer xna opengl ai vulkan unity unity unity 2d xna frame-rate voice unity 3d unity java minecraft-modding unity opengl mathematics c++ xna-4.0 actionscript-3 directx fonts anti-cheat directx python unity c# xna unity android performance ai animation unity opengl 2d lwjgl lwjgl unity c# physics animation c# unity opengl collision-detection java unity nintendo 2d unity opengl unity python mathematics c++ xna game-design unity ui-design unity unity c++ android c++ 2d c++ 2d c++ c++ mathematics 2d libgdx c++ c# networking 2d data-structure unity godot iphone c# unity physics android c# architecture xna 2d unity unity books sdl unity unity xna c++ tilemap python opengl c++ game-design unity unity unity opengl c# xna unity architecture unity game-design sound-effects game-industry xna xna graphics physics camera physics unity networking textures xna godot game-mechanics libgdx opengl-es unity game-design java assimp c# android xna 3d java cocos2d-x game-design 2d unity 2d opengl directx unity data-structure frustum-culling rigging gui xna data-structure rendering networking server shadow-mapping xna java opengl graphics-programming mouse 2d android architecture unity unity c# unity rendering opengl opengl unity unity libgdx xna mathematics opengl unity 2d unity c++ android shaders xna-4.0 opengl unity c++ unity unity game-design xna iphone mathematics unity directx unity unity c# unity collision-detection unity 2d unity unity collision-detection jbox2d game-design unity opengl unity c++ html5 godot webgl unity opengl 3d blender unity xna java javascript c# marketing game-design server android 2d opengl flash unity java python java unity xna unity collision-detection unity iphone unity unity c# unity unity javascript unity google-app-engine opengl c++ 2d c# javascript unity movement ai unity architecture unity unity c++ unity c# c# modding collision-detection unity xna unreal-4 vector physics c# udk pc business animation 2d unity game-industry opengl 2d java libgdx graphics unity unity unity unity opengl android 2d 3d android unity opengl unity android unity game-design cross-platform opengl python xna java component-based unity unity tilemap algorithm opengl bukkit architecture opengl lighting 2d ai unity c unity godot 3d c# opengl unreal-4 android python geometry unity webgl unity textures unity bullet-physics xna unity tilemap unity opengl game-design xna textures xna unity c# unity glsl c++ javascript mouse unity ogre unity resource-management movement windows unity collision-detection directx unity licensing collision-resolution legal c++ 2d directx c++ unity unity opengl unity game-design 2d c# unity unity sprites events c++ algorithm opengl c++ java unreal-4 architecture opengl c++ architecture pixel java multiplayer unity opengl unity ios unity libgdx libgdx c# client-server java unreal-4 2d java unity collision-detection textures psm unity unity c# c++ game-design unity game-design unity collision-detection mmo android 3d opengl unreal-4 shaders c# directx11 c++ unity performance client-server server virtual-reality 3d unity game-design color opengl xna unity game-design xna unity game-design fonts 2d unity xna unity input opengl c++ 2d 3d flash gui opengl c++ unity sdl2 unity java c++ sharpdx collision-detection xna libgdx opengl 3d-meshes algorithm unity c# android libgdx unity xna opengl unity graphics-programming iphone opengl path-finding cocos2d-iphone opengl opengl xna c++ javascript shaders xna unity c# unity c# xna xna-4.0 javascript android unity mathematics unity architecture game-maker c++ movement c++ unity unity python c++ models unity xna unity unity camera vector physics mathematics opengl unity android movement rotation unity game-design mathematics unity unity unity unity 2d libgdx c++ strategy testing movement unity camera c++ opengl unity opengl unity graphics opengl unity databases c++ 2d unity xna java unity java unreal-4 unity libgdx networking unity c# selection libgdx unity game-design c# opengl 2d collision-detection google-play game-industry hlsl game-design java directx10 xna shaders c++ rpg architecture opengl c++ unity unity unity c++ c++ c++ textures unity opengl xna xna ai unity unity xna unity unity unity c# opengl xna android sfml opengl shaders collision-detection xna collision-detection godot unity rpg architecture android mmo java 3d c++ android unity data-structure rendering opengl collision-detection c++ 2d c++ music c++ unity steam modding xna c# 3d xna xna unity javascript path-finding unity unity xna opengl xna opengl sprites unity physics collision-detection unity c# android android c++ tiles unity unity android unity unity physics opengl xna rigidbody xna architecture mathematics unity java javascript xna xna flash 3d spritesheet shaders xna unity mathematics oop unity lua deployment godot game-design 2d html-canvas opengl game-maker unity blender opengl iphone c++ networking java unity opengl java unity java 2d java c++ input unity unity c# unity unity java unity libgdx maya c# unity xna unity unity unity unity ios opengl unity opengl-es c++ architecture matrix c++ unity xna fragment-shader unity tiles lighting unity opengl-es2 unity javascript opengl fbx c++ unity physics text unity java unity 3d unity unity input opengl opengl unity unity unity unity unity game-industry legal unity java unity 2d graphics android unity xna unity unity assets unity transformation unity c# unity mathematics unity javascript unity 2d c++ physics algorithm physics unity directx physics unity java sdl game-design ios input java java java graphics-programming 3d javascript playstation4 memory-efficiency xna licensing android opengl opengl multiplayer directx flash graphics line-of-sight 2d xna c++ unity rotation c++ java unity 2d java unity unity javascript c++ c++ rotation java libgdx game-design unity opengl-es c++ unity unity c++ unity physics android 2d ai c++ collision-detection 3d mathematics java opengl matrix unity c# unity xna sprites entity-system unity java unity game-design architecture c# c# xna unity c# c# unity xna libgdx tilemap unity 2d unity c++ unity unity opengl c++ architecture sdl c++ c++ multiplayer algorithm unity opengl xna-4.0 unity c# unity javascript c# architecture c# c++ architecture sprites collision-detection game-design rotation opengl xna physics physics c# unity c++ directx opengl-es 3d unity java architecture javascript game-design crusader-kings-2-modding textures cocos2d-x-js component-based xna c++ matrix unity blender unity xna libgdx unity algorithm opengl xna c# opengl collision-detection architecture unity unity unity c++ android opengl scripting 2d godot 2d 2d unity unity unity unreal-4 unity collision-detection unity software-engineering networking unity unity android opengl opengl c++ xna xna xna unity unity java unity matrix procedural-generation xna 3d libgdx xna-4.0 collision-detection unity 3d 3d architecture architecture unity c++ quake3 3d physics unity unity javascript unity xna c++ c opengl-es c++ multiplayer 2d unity c++ unity game-design collision-detection unity unity unity unity racing xna unity keyboard animation mathematics collision-detection c++ c++ javascript terrain unity collision-detection sdl xna libgdx unity box2d unity c# c++ algorithm lua opengl unity unity ios unity unity c# physics c# 2d c# unity game-design xna architecture 2d flash directx component-based opengl c# java rendering path-finding unity 2d java xna xna-4.0 c# unity unreal-4 unity leaderboards game-design opengl-es server textures xna java opengl c++ voxels game-maker game-mechanics c# xna c# collision-detection java c# android xna java xna-4.0 collision-detection directx9 ios architecture java 3d java c# rendering art unity ios java c++ scripting unity libgdx c# monogame architecture c++ tiles unity javascript legal shaders mathematics python opengl c# opengl libgdx game-design animation unity rendering unity java javascript unity unity unity algorithm c++ libgdx c++ unity unity unity physics unity unity unity libgdx unity unity 2d flash ai unity android xna opengl textures c# 3d xna unity legal unity unity unity 2d opengl authentication c# unity game-maker c++ directx java game-design unity unity 3d unity terminology javascript coordinates lwjgl graphics architecture java collision-detection networking java effect mathematics android unity 2d performance vector unity 2d unity xna unity javascript unity lighting c# xna input opengl cocos2d-x unity procedural-generation xna architecture procedural-generation unity directx java c# unity unity collision-detection shaders c# c++ flash physics legal java lighting assets unity unity xna xna modding architecture opengl xna lighting physics-engine 2d c# animation java animation xna unity c# vector software-engineering blender xna unity unity game-design unity unity java spawning java game-design java steering-behaviors libgdx game-design unity javascript c++ unity c++ design-patterns unity xna unity opengl architecture unreal android collision-detection html5 opengl mathematics unity java unity unity software-engineering copyright c# c++ android mathematics unity ios 2d unity animation music unity 3d-meshes java unity algorithm c++ c++ xna-4.0 game-design unreal-4 physics glsl sdl opengl xna opengl path-finding 2d unity linear-algebra gpu unity unity c++ android shaders opengl unity mobile c# allegro python unity unity java android c++ game-design libgdx unity c# xna xna collision-detection architecture unity unity lwjgl java unity path-finding mathematics c++ android c++ physics opengl mathematics mmo modding unity 2d xna-4.0 unity quaternion c++ sdl libgdx 3d-meshes isometric cocos2d-iphone platform xna unity multithreading unity mobile unity xna sprites 2d 2d directx iphone java unity mathematics cocos2d-x java xna java mathematics iphone ogre ai javascript unity 2d game-design legal java javascript 2d open-source tools unreal-4 c++ opengl unity sprites movement opengl android opengl architecture tilemap game-design libgdx animation procedural-generation unity unity java unity unity unity unity opengl libgdx collision-detection xna libgdx 3d java unity unity 2d game-design 3d perlin-noise unity unity unity unity 2d 3d 3d pixel ai xna unity opengl terrain level-of-detail opengl xna algorithm unity resource-management opengl python javascript unity tilemap art xna textures 2d textures architecture unity terminology unity html5 unity 3d physics 2d java algorithm unity unity opengl unity textures turn-based directx unity unity xna mmo unity java entity-system java android java unity unreal-4 xna iphone shaders graphics ios kinect unity opengl-es2 unity c# networking c++ opengl opengl unity xna xna optimization unity unity c# textures opengl collision-detection unity directx unity algorithm c# unity java 2d mathematics rendering mathematics game-loop iphone c# textures c# unity rotation mathematics game-design unity unity c# unreal-4 c++ opengl opengl unity lighting unity coordinates opengl c++ xna java camera libgdx effects cross-platform android c++ c++ unity game-mechanics java opengl java skybox xna java unity unity c++ 2d xna graphics unity xna legal unity textures unity box2d c++ c++ android 3d physics xna ios c# rendering 3d opengl-es2 c++ sdl normals 3d html5 android unity libgdx unity c# 2d android design-patterns animation unity c++ 2d xna unity c++ unity flash c# xna camera directx11 legal unity 2d 2d unity unity java architecture unity 2d opengl game-maker unity libgdx xna unity unity javascript unity physics unity mathematics multithreading c++ android unity c# java platformer physics-engine 3d networking unity 3d animation flash javascript libgdx opengl-es unity 2d c# minecraft-modding c++ xna unity javascript xbox360 algorithm c game-design shaders c++ xna android graphics isometric java libgdx c# algorithm java multiplayer xna ios unity libgdx android opengl c# opengl opengl unreal-4 unity physics libgdx unity c# mathematics unity unity opengl xna unity java opengl gui unity c# opengl tiles unity c++ android opengl unreal-4 unity xna opengl unity unity xna libgdx unity xna 2d facebook android game-maker unity java 3d opengl javascript art unity 2d android c++ c++ libgdx python game-design 2d graphics unity multiplayer opengl xna unity unity mathematics steam unity opengl game-design textures shaders java unity text shaders c# unity unity unity unity 2d 2d c# splash-screen networking ai java unity unity directx11 sfml xna xna-4.0 architecture unity 3d mathematics assets architecture alpha-blending game-maker unity ai unity android unity coordinates opengl skeletal-animation 2d java opengl shading flash hlsl architecture unity textures networking unity java 2d opengl godot game-maker opengl android unity unreal modding unity c++ sfml unity java unity android unity directx9 3d 3d libgdx 2d android java 3d android directx path-finding opengl algorithm unity unity steam game-design opengl unity 2d unity unity android unity c++ 2d 2d unity xna unity opengl c++ flash opengl game-mechanics unity c++ javascript c++ opengl-es c# user-interface unity unity game-design 2d assets xna unity c xna mathematics android physics javascript mathematics databases opengl unity unity java textures architecture camera graphics first-person-shooter models opengl unity fsm game-mechanics xna unity directx opengl unity c# java collision-detection unity unity unity unity 2d c++ unity algorithm javascript c++ glsl unity 3d udk xna software-engineering unity movement unity 2d opengl unity textures rendering unity c++ opengl xna game-maker cocos2d-iphone directx11 copyright unity c# c++ roblox opengl-es2 sprites xna box2d javascript ai 3d 3d directx architecture unity xna javascript physics facebook textures algorithm tiles java game-design unity c++ impactjs unity unity xna minecraft-modding 2d unity opengl godot unity opengl libgdx server unity procedural-generation mathematics art opengl unity unity 2d algorithm scripting unity unity physics rendering xna xna javascript software-engineering unity unity unity c# c++ shaders xna collision-detection opengl unity camera opengl networking tiles mathematics unity html5 unity unity java unity web xna mathematics unity ios iphone 2d c++ physics shaders unity path-finding art collision-detection unity directx unity c++ web android graphics 3d textures mathematics unreal-4 voice directx xna java java java c++ open-source ios 2d unity java unity ai unity java c# opengl collision-detection unity legal cocos2d-iphone c++ architecture hlsl architecture unity networking mathematics java directx c++ xna unity c++ 2d cocos2d xna physics python collision-detection 3d opengl unity architecture unity unity unity architecture cocos2d-iphone java physics-engine unity 2d cocos2d-iphone unity c++ input unity opengl path-finding c# xna physics unity shaders unity 2d unity camera game-maker physics opengl unity mmo 2d mathematics game-maker physics 3d java movement java unity unity android architecture unity 3d collision-detection c++ opengl javascript unity opengl unity tiles libgdx java opengl 3d textures 2d xna java unity physics opengl performance textures opengl modding c# copyright path-finding unity c++ xna unity physics unity graphics javascript visual-studio python architecture unity unity mathematics rotation unity unity unity unity gameobject unity flash xna ai unity java unity unity unity unity c++ opengl scripting java xna unity unity game-design windows ios unity opengl udk unity mathematics unity javascript javascript collision-detection shaders unity unity c++ iphone java javascript version-control unity unity opengl unity c++ unity unity unity 3d blender trailer unity c# opengl unity unity cocos2d facebook marketing vector java unity mathematics cocos2d-iphone xna mathematics sprites tools unity 2d c# opengl android flash ios libgdx rotation java game-design 2d javascript unity unity savegame ai unity unity unreal c# unity unity unity unity unity unity c# shaders unity frame-rate opengl ai opengl 3d-meshes unity java unity c++ c# unity java 3d opengl directx android opengl algorithm level-design architecture c++ unity opengl unity animation cocos2d-x collision-detection android java c# libgdx unity animation java android xna unity java java c++ c++ architecture shaders opengl 3d xna c++ rendering directx unity c# unity multiplayer 2d unity architecture unity android tiles c# c++ unity performance opengl textures opengl unity unity textures rotation unity hlsl unity opengl game-design unity game-industry opengl unity textures xna 2d xna unreal-4 unity c# physics unity ai unity c++ c input xna android rpg collision-detection c++ opengl sdl sound sprites java unity unity opengl unity html5 architecture sdl game-design browser-based-games mmo unity java unity ios ai xna animation education career community-management minecraft-modding unity opengl opengl opengl licensing directx unity collision-detection libgdx release unity javascript xna xna java unity java mathematics c++ unity first-person-shooter 3d opengl game-design java c# java java actionscript-3 java shaders opengl unity c++ unity game-design unity collision-detection c# architecture 2d mobile unity 2d cocos2d-iphone opengl software-engineering libgdx c++ 2d java unity unity legal unity unity unity unity unity physics android unity c++ textures opengl xna game-design libgdx game-design unity c# rts unity data-structure actionscript-3 opengl xna-4.0 opengl mathematics opengl unity java terminology iphone unity ios xna sprites collision-detection unity architecture c++ 2d c# game-industry c++ rendering performance unity c++ opengl unity opengl 3dsmax ai portals java xna textures java unity unity opengl c# unity unity java algorithm python shaders xna terrain c++ collision-detection path-finding coordinates shaders xna unity unity mathematics animation linux c# architecture unity unity mathematics unity directx mathematics c# unity opengl c++ unity legal 2d rendering image unity competition mathematics unity unity 3d unity c++ xna unity unity blender xna unity iphone game-design collision-detection 2d android opengl c++ xna unity unity c++ ai game-maker textures architecture c++ ios 3d intersection mathematics maps xna unity matrix 3d actionscript-3 unity graphics c# java opengl path-finding opengl c# fbx unity unity blender 3d c++ monogame 2d java flash libgdx c# java monogame javascript silverlight algorithm c++ 3d java c++ movement c++ java xna mathematics geometry entity-component-system unity architecture unity unity blender sprites c# cocos2d-iphone unity 3d javascript tiles unity tools physics unity opengl c# java python unity 2d unity xna software-engineering 3d optimization c# rendering 2d java path-finding c++ c++ unity unity movement c++ opengl unity java unity android physics unity physics unity android mathematics quaternion javascript opengl c# collision-detection character performance java opengl glsl opengl directx11 collada xna java unity animation networking c# shaders java procedural-generation unreal-4 c# unity unity c# unity udk shaders image c++ extrapolation unity unity unity c# spritebatch pygame 2d unity publishing javascript c++ unity unity algorithm unity sdl2 java fund-raising unity game-design textures physics unity andengine unity unity xna algorithm xna unity c# unity physics-engine movement unity unity opengl c# directx random java c# legal unity xna sound c++ c++ server 3d 2d unity unity c++ unity 2d 2d path-finding xna unity unity directx11 c++ camera open-source physics unity graphics opengl unity xna c++ unity 3d game-design c# models ios textures textures libgdx game-design android unity game-design deployment 2d unity xna java mathematics algorithm unity opengl 2d 2d java unity unity unity java unity collision-detection corona-sdk xna sprites opengl c# unity android directx11 opengl tools collision-detection c# opengl libgdx game-design android c# opengl java cocos2d game-design unity unity publishing unity game-design direct3d12 directx unity unity android android unity xna mmo c++ unity collision-detection google-play graphics c++ geometry unity c++ lwjgl unity opengl opengl opengl opengl opengl unity unity opengl collision-detection projectile-physics unity component-based collision-detection android java unity 2d opengl unity flixel physics xna xna ai android havok software-engineering xna unity opengl c++ flash box2d java opengl unity unity unity java unity unity unity c# andengine 2d phaser unity unity opengl simulations vulkan c++ unity unity collision-detection unity java javascript java unity xna software-engineering java 2d c++ game-design opengl java unity unity c++ opengl c# java unity java xna c++ unreal-4 unity animation c++ opengl unity unity xna xna-4.0 2d sprites unity marketing game-design opengl game-mechanics unity xna hlsl unity graphics licensing unity opengl sdl java opengl xna steam unity c# mathematics ios vector collision-detection opengl-es c++ security unity unity android steam java unity 3d javascript performance monogame loading xna c++ 3dsmax java opengl physics java physics ai events java opengl unity lighting unity java path-finding collision-detection c++ unity 2d physics game-design architecture platformer c# mathematics sdl legal libgdx opengl client-server c# game-design unity game-design 2d game-design networking mathematics 3d fonts unity configuration directx11 unity 3d ios c++ unity game-design gui collision-detection android lighting xna c# animation c# collision-resolution c# 3d unity unity c++ algorithm java geometry 3d unity opengl pygame c++ physics xna c# unity opengl c++ design-patterns game-recording xna c# c# unity unity opengl collision-detection unity opengl graphics unity gui unity unity libgdx javascript mathematics game-design c++ android unity mathematics path-finding collision-detection xna unity android career maps java opengl game-design isometric cross-platform unity opengl 2d mathematics android andengine c++ unity unity c# opengl xna-4.0 opengl java legal c++ unity movement loading algorithm procedural-generation graphics c# 2d opengl 3d graphics user-experience xna ios opengl c++ unity unity mathematics java direct3d12 client-server unity ai c++ unity architecture server c# xna unity unity c++ game-design xna unity xna 3d game-design xna unity tiles java c++ c++ unity graphics performance c# unity unity blender heightmap hlsl android rendering c# unity xna graphics opengl c++ c# server c# networking 3d c# unity c++ graphics xna unity unity c# c# libgdx xna unity opengl game-design c++ c# physics opengl java libgdx opengl java opengl-es unity procedural-generation 2d software-engineering game-design unity java unity xna monogame directx c++ collision-detection xna xna mobile 3dsmax textures directx 3dsmax shadows xna c++ c++ unity legal c++ flash unity c# unity unity 2d unity input xna unity component-based opengl physics input trademark c++ unity unity libgdx multithreading unity unity c# xna graphics unity game-maker android game-design c++ unity java unity unity shaders game-design unity opengl c# android unity unity frame-rate networking opengl libgdx c# c++ tilemap unity javascript input unity animation architecture unity 2d mathematics 2d cocos2d-iphone textures java c# unity physics animation opengl c++ unity architecture motivation ios java c# cross-platform 2d unity unity 3d performance unity unity python xna c++ android sdl unity iphone javascript c++ actionscript-3 collision-detection directx11 3d legal behavior-tree java iphone unity opengl c++ ruby java c# c# game-design c# mmo game-loop unity c++ game-design unity unity unity rendering opengl unity opengl andengine java opengl-es c# unity camera unity unity software-engineering sdl2 c# textures ios opengl unity performance c++ unity unity java graphics xna testing c++ c++ pygame directx xna android c# c++ unity physics c++ libgdx unity c++ unity unity shaders directx graphics performance unity unity opengl unity javascript unity java c# unity opengl directx xna xna c++ java htc-vive java 2d javascript java unity 2d java opengl c++ text-based java c# libgdx productivity game-design textures 2d c++ shaders javascript java android opengl c++ java c++ opengl collision-detection c++ rendering art andengine collision-detection 3d xna box2d c++ unity java unity 2d unity libgdx unity physics java game-design unity game-maker javascript movement c# mathematics unity actionscript-3 c++ 2d collision-resolution animation directx11 c++ architecture pixel unity udp simulations unity xna game-design architecture unity javascript unity sdl2 opengl libgdx unity unity economy game-design opengl unity books vector opengl unity terrain unity unity unity c# unity opengl xna unity javascript game-design android lua algorithm hlsl unity java c# opengl unity multiplayer 3d opengl opengl libgdx audio 2d mathematics java xna ai opengl architecture animation textures tiles 2d unity 2d mathematics unity collision-detection directx11 collision-detection libgdx libgdx libgdx 2d 3d-meshes unity graphics unreal game-design